FOSSology  4.4.0
Open Source License Compliance by Open Source Software
core-debug-plugins.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2008-2013 Hewlett-Packard Development Company, L.P.
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
9 
10 define("TITLE_core_debug", _("Debug Plugins"));
11 
16 class core_debug extends FO_Plugin
17 {
18  function __construct()
19  {
20  $this->Name = "debug";
21  $this->Title = TITLE_core_debug;
22  $this->MenuList = "Help::Debug::Debug Plugins";
23  $this->DBaccess = PLUGIN_DB_ADMIN;
24  parent::__construct();
25  }
26 
31  function Output()
32  {
33  if ($this->State != PLUGIN_STATE_READY)
34  {
35  return 0;
36  }
37  if ($this->OutputToStdout && $this->OutputType=="Text") {
38  global $Plugins;
39  print_r($Plugins);
40  }
41  $output = "";
42  if ($this->OutputType=='HTML')
43  {
44  $output = $this->htmlContent();
45  }
46  if (!$this->OutputToStdout)
47  {
48  $this->vars['content'] = $output;
49  return; // $output;
50  }
51  print $output;
52  }
53 
58  protected function htmlContent()
59  {
60  $V = "";
64  global $Plugins;
65 
66  $text = _("Plugin Summary");
67  $V .= "<H2>$text</H2>";
68  foreach ($Plugins as $key => $val)
69  {
70  $V .= "$key : $val->Name (state=$val->State)<br>\n";
71  }
72  $text = _("Plugin State Details");
73  $V .= "<H2>$text</H2>";
74  $V .= "<pre>";
75  foreach ($Plugins as $plugin)
76  {
77  $V .= strval($plugin) . "\n";
78  }
79  $V .= "</pre>";
80 
81  return $V;
82  }
83 
84 }
85 $NewPlugin = new core_debug;
86 $NewPlugin->Initialize();
This is the Plugin class. All plugins should:
Definition: FO_Plugin.php:57
Definition: state.hpp:16
Plugin for core debug.
__construct()
base constructor. Most plugins will just use this
Output()
display the loaded menu and plugins.
#define PLUGIN_DB_ADMIN
Plugin requires admin level permission on DB.
Definition: libfossology.h:39