2 /*=====================================================================*\
3 || ###################################################################
4 || # Blue Static ISSO Framework [#]issoversion[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
23 * Blue Static ISSO Framework Kernel
40 * Blue Static ISSO Framework (ISSO)
42 * This framework allows a common backend to be used amongst all Blue
43 * Static applications and is built to be abstract and flexible.
44 * The base framework handles all loading and module management.
47 * ISSO_MT_START - Define the microtime() value at the top of your
48 * script and this will calculate the total execution
50 * SVN - Place SVN keywords (like $Id) to display the information on output
53 * @copyright Copyright ©2002 - [#]year[#], Blue Static
64 private $version = '[#]issoversion[#]';
67 * List of loaded modules
70 private $modules = array();
72 // ###################################################################
74 * Prints a list of all currently loaded framework modules
76 * @param bool Return the data as an array?
78 * @return mixed HTML output or an array of loaded modules
80 public function show_modules($return = false
)
83 foreach ($this->modules
AS $object)
85 $module = get_class($object);
86 if (method_exists($object, 'init_as_package') AND in_array($module, $modules))
88 $module = $object->init_as_package() . " - ($module)";
100 $output = "\n\n<ul>\n\t<li>";
101 $output .= implode("</li>\n\t<li>", $modules);
102 $output .= "</li>\n</ul>\n\n";
103 $this->message('Loaded Modules', $output, 1);
107 // ###################################################################
109 * Constructs a debug information box that contains various debugging
112 * @param bool Show template information?
114 * @return string Debugging block
116 public function construct_debug_block($dotemplates)
129 foreach ($this->modules
['template']->usage
AS $name => $count)
131 if (in_array($name, $this->modules
['template']->uncached
))
133 $optlist[] = $name . '[' . $count . ']';
135 $usage[] = $name . " ($count)";
138 $sizeof = sizeof($this->modules
['template']->uncached
);
141 $debug .= "\n\t<li><strong style=\"color: red\">Uncached Template(s):</strong> $sizeof ( " . implode(' ', $optlist) . " )</li>";
146 $scinfo = 'Not Under Source Control';
149 $scinfo = constant('SVN');
151 if (preg_match('#\$Id:?\s*\$#', $scinfo))
153 $scinfo = 'Not Under Source Control';
157 $scinfo = preg_replace('#\$' . '(Head)?URL: (.+?) \$#e', "end(explode('/', '\\2'))", $scinfo);
158 $scinfo = preg_replace('#\$' . '(LastModified)?Revision: (.+?) \$#', 'SVN \\2', $scinfo);
159 $scinfo = preg_replace('#\$' . 'Id: (.+?) ([0-9].+?) [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.+?) (.+?) \$#', '\\1 - SVN \\2', $scinfo);
163 $scinfo = trim($scinfo);
164 $debug .= "\n\t<li><strong>Source Control:</strong> $scinfo</li>";
167 if (is_object($this->modules
[ISSO_DB_LAYER
]))
169 $debug .= "\n\t<li><strong>Total Queries:</strong> " . sizeof($this->modules
[ISSO_DB_LAYER
]->history
) . " (<a href=\"" . $this->sanitize($_SERVER['REQUEST_URI']) . ((strpos($_SERVER['REQUEST_URI'], '?') !== false
) ?
'&query=1' : '?query=1') . "\">?</a>)</li>";
172 // total execution time
173 if (defined('ISSO_MT_START'))
175 $this->load('functions', 'functions');
176 $debug .= "\n\t<li><strong>Total Execution Time:</strong> " . round($this->modules
['functions']->fetch_microtime_diff(ISSO_MT_START
), 10) . "</li>";
180 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Debug Notices (" . sizeof($this->debuginfo
) . ")</option>";
181 foreach ((array)$this->debuginfo
AS $msg)
183 $debug .= "\n\t\t\t<option>--- $msg</option>";
185 $debug .= "\n\t\t</select>\n\t</li>";
188 $modules = $this->show_modules(true
);
189 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Loaded Modules (" . sizeof($modules) . ")</option>";
190 foreach ($modules AS $mod)
192 $debug .= "\n\t\t\t<option>--- $mod</option>";
194 $debug .= "\n\t\t</select>\n\t</li>";
199 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Template Usage (" . array_sum($this->modules
['template']->usage
) . ")</option>";
200 foreach ($usage AS $tpl)
202 $debug .= "\n\t\t\t<option>--- $tpl</option>";
204 $debug .= "\n\t\t</select>\n\t</li>";
209 $debug = "\n\n<!-- dev debug -->\n<div align=\"center\">\n\n<hr />\n" . $this->message('Debug Information', $debug, 1, true
, false
) . "\n</div>\n<!-- / dev debug -->\n\n";
216 /*=====================================================================*\
217 || ###################################################################
220 || ###################################################################
221 \*=====================================================================*/