1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
16:
17: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
18:
19: 20: 21: 22: 23: 24: 25: 26: 27:
28: class cDebugVisible implements cDebugInterface {
29:
30: 31: 32: 33: 34:
35: private static $_instance;
36:
37: 38: 39: 40: 41:
42: static public function getInstance() {
43: if (self::$_instance == NULL) {
44: self::$_instance = new cDebugVisible();
45: }
46: return self::$_instance;
47: }
48:
49: 50: 51:
52: private function __construct() {
53: }
54:
55: 56: 57: 58: 59: 60: 61:
62: public function out($msg) {
63: }
64:
65: 66: 67: 68: 69: 70: 71: 72: 73: 74:
75: public function show($mVariable, $sVariableDescription = '', $bExit = false) {
76: $bTextarea = false;
77: $bPlainText = false;
78: if (is_array($mVariable)) {
79: if (sizeof($mVariable) > 10) {
80: $bTextarea = true;
81: } else {
82: $bPlainText = true;
83: }
84: }
85: if (is_object($mVariable)) {
86: $bTextarea = true;
87: }
88: if (is_string($mVariable)) {
89: if (preg_match('/<(.*)>/', $mVariable)) {
90: if (strlen($mVariable) > 40) {
91: $bTextarea = true;
92: } else {
93: $bPlainText = true;
94: $mVariable = conHtmlSpecialChars($mVariable);
95: }
96: } else {
97: $bPlainText = true;
98: }
99: }
100:
101: $tpl = new cTemplate();
102: $tpl->set("s", "VAR_DESCRIPTION", $sVariableDescription);
103: $varText = "";
104: if ($bTextarea === true) {
105: $varText .= '<textarea rows="10" cols="100">';
106: } elseif ($bPlainText === true) {
107: $varText .= '<pre class="debug_output">';
108: } else {
109: $varText .= '<pre class="debug_output">';
110: }
111:
112: if (is_array($mVariable)) {
113: $varText .= print_r($mVariable, true);
114: } else {
115: $varText .= var_dump($mVariable, true);
116: }
117:
118: if ($bTextarea === true) {
119: $varText .= '</textarea>';
120: } elseif ($bPlainText === true) {
121: $varText .= '</pre>';
122: } else {
123: $varText .= '</pre>';
124: }
125: $tpl->set("s", "VAR_TEXT", $varText);
126:
127: global $cfg;
128:
129: $tpl->generate($cfg["templates"]["debug_visible"]);
130: if ($bExit === true) {
131: die('<p class="debug_footer"><b>debugg\'ed</b></p>');
132: }
133: }
134:
135: 136: 137: 138: 139: 140:
141: public function add($mVariable, $sVariableDescription = '') {
142: }
143:
144: 145: 146:
147: public function reset() {
148: }
149:
150: 151: 152:
153: public function showAll() {
154: }
155: }
156: