]> src.bluestatic.org Git - isso.git/blob - kernel.php
Removing BSLoader and we'll just go with a singleton instance of BSRegister
[isso.git] / kernel.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Blue Static ISSO Framework [#]issoversion[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
6 || #
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.
10 || #
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
14 || # more details.
15 || #
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 \*=====================================================================*/
21
22 /**
23 * Blue Static ISSO Framework Kernel
24 * kernel.php
25 *
26 * @package ISSO
27 */
28
29 /**
30 * Blue Static ISSO Framework (ISSO)
31 *
32 * This framework allows a common backend to be used amongst all Blue
33 * Static applications and is built to be abstract and flexible.
34 * The base framework handles all loading and module management.
35 *
36 * Constants:
37 * ISSO_MT_START - Define the microtime() value at the top of your
38 * script and this will calculate the total execution
39 * time
40 * SVN - Place SVN $Id keyword to get SVN revision information on output
41 *
42 * @author Blue Static
43 * @copyright Copyright ©2002 - [#]year[#], Blue Static
44 * @version $Revision$
45 * @package ISSO
46 *
47 */
48 class ISSO
49 {
50 // ###################################################################
51 /**
52 * Constructs a debug information box that contains various debugging
53 * information points
54 *
55 * @param bool Show template information?
56 *
57 * @return string Debugging block
58 */
59 public function construct_debug_block($dotemplates)
60 {
61 $debug = '';
62
63 if ($this->debug)
64 {
65 $debug = "\n<ul>";
66
67 // templates
68 if ($dotemplates)
69 {
70 $optlist = array();
71 $usage = array();
72 foreach ($this->modules['template']->usage AS $name => $count)
73 {
74 if (in_array($name, $this->modules['template']->uncached))
75 {
76 $optlist[] = $name . '[' . $count . ']';
77 }
78 $usage[] = $name . " ($count)";
79 }
80
81 $sizeof = sizeof($this->modules['template']->uncached);
82 if ($sizeof > 0)
83 {
84 $debug .= "\n\t<li><strong style=\"color: red\">Uncached Template(s):</strong> $sizeof ( " . implode(' &nbsp; ', $optlist) . " )</li>";
85 }
86 }
87
88 // source control
89 if (defined('SVN') AND preg_match('#\$Id:?\s*\$#', constant('SVN')))
90 {
91 $debug .= "\n\t<li><strong>Source Control:</strong> " . 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', constant('SVN')) . "</li>";
92 }
93
94 // query information
95 if (is_object($this->modules[ISSO_DB_LAYER]))
96 {
97 $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) ? '&amp;query=1' : '?query=1') . "\">?</a>)</li>";
98 }
99
100 // total execution time
101 if (defined('ISSO_MT_START'))
102 {
103 $this->load('functions', 'functions');
104 $debug .= "\n\t<li><strong>Total Execution Time:</strong> " . round($this->modules['functions']->fetch_microtime_diff(ISSO_MT_START), 10) . "</li>";
105 }
106
107 // debug notices
108 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Debug Notices (" . sizeof($this->debuginfo) . ")</option>";
109 foreach ((array)$this->debuginfo AS $msg)
110 {
111 $debug .= "\n\t\t\t<option>--- $msg</option>";
112 }
113 $debug .= "\n\t\t</select>\n\t</li>";
114
115 // template usage
116 if ($dotemplates)
117 {
118 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Template Usage (" . array_sum($this->modules['template']->usage) . ")</option>";
119 foreach ($usage AS $tpl)
120 {
121 $debug .= "\n\t\t\t<option>--- $tpl</option>";
122 }
123 $debug .= "\n\t\t</select>\n\t</li>";
124 }
125
126 $debug .= "\n</ul>";
127
128 $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";
129 }
130
131 return $debug;
132 }
133 }
134
135 /*=====================================================================*\
136 || ###################################################################
137 || # $HeadURL$
138 || # $Id$
139 || ###################################################################
140 \*=====================================================================*/
141 ?>