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