FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
core-debug-plugins.php
1 <?php
2 /***********************************************************
3  Copyright (C) 2008-2013 Hewlett-Packard Development Company, L.P.
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  version 2 as published by the Free Software Foundation.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 ***********************************************************/
18 
20 
21 define("TITLE_core_debug", _("Debug Plugins"));
22 
27 class core_debug extends FO_Plugin
28 {
29  function __construct()
30  {
31  $this->Name = "debug";
32  $this->Title = TITLE_core_debug;
33  $this->MenuList = "Help::Debug::Debug Plugins";
34  $this->DBaccess = PLUGIN_DB_ADMIN;
35  parent::__construct();
36  }
37 
42  function Output()
43  {
44  if ($this->State != PLUGIN_STATE_READY)
45  {
46  return 0;
47  }
48  if ($this->OutputToStdout && $this->OutputType=="Text") {
49  global $Plugins;
50  print_r($Plugins);
51  }
52  $output = "";
53  if ($this->OutputType=='HTML')
54  {
55  $output = $this->htmlContent();
56  }
57  if (!$this->OutputToStdout)
58  {
59  $this->vars['content'] = $output;
60  return; // $output;
61  }
62  print $output;
63  }
64 
69  protected function htmlContent()
70  {
71  $V = "";
75  global $Plugins;
76 
77  $text = _("Plugin Summary");
78  $V .= "<H2>$text</H2>";
79  foreach ($Plugins as $key => $val)
80  {
81  $V .= "$key : $val->Name (state=$val->State)<br>\n";
82  }
83  $text = _("Plugin State Details");
84  $V .= "<H2>$text</H2>";
85  $V .= "<pre>";
86  foreach ($Plugins as $plugin)
87  {
88  $V .= strval($plugin) . "\n";
89  }
90  $V .= "</pre>";
91 
92  return $V;
93  }
94 
95 }
96 $NewPlugin = new core_debug;
97 $NewPlugin->Initialize();
#define PLUGIN_DB_ADMIN
Plugin requires admin level permission on DB.
Definition: libfossology.h:51
Output()
display the loaded menu and plugins.
Plugin for core debug.
Definition: state.hpp:26
This is the Plugin class. All plugins should:
Definition: FO_Plugin.php:67