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: 60:
61: public function out($msg) {
62: }
63:
64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75:
76: public function show($mVariable, $sVariableDescription = '', $bExit = false) {
77: $bTextarea = false;
78: $bPlainText = false;
79: if (is_array($mVariable)) {
80: if (sizeof($mVariable) > 10) {
81: $bTextarea = true;
82: } else {
83: $bPlainText = true;
84: }
85: }
86: if (is_object($mVariable)) {
87: $bTextarea = true;
88: }
89: if (is_string($mVariable)) {
90: if (preg_match('/<(.*)>/', $mVariable)) {
91: if (cString::getStringLength($mVariable) > 40) {
92: $bTextarea = true;
93: } else {
94: $bPlainText = true;
95: $mVariable = conHtmlSpecialChars($mVariable);
96: }
97: } else {
98: $bPlainText = true;
99: }
100: }
101:
102: $tpl = new cTemplate();
103: $tpl->set("s", "VAR_DESCRIPTION", $sVariableDescription);
104: $varText = "";
105: if ($bTextarea === true) {
106: $varText .= '<textarea rows="10" cols="100">';
107: } elseif ($bPlainText === true) {
108: $varText .= '<pre class="debug_output">';
109: } else {
110: $varText .= '<pre class="debug_output">';
111: }
112:
113: if (is_array($mVariable)) {
114: $varText .= print_r($mVariable, true);
115: } else {
116: $varText .= var_dump($mVariable, true);
117: }
118:
119: if ($bTextarea === true) {
120: $varText .= '</textarea>';
121: } elseif ($bPlainText === true) {
122: $varText .= '</pre>';
123: } else {
124: $varText .= '</pre>';
125: }
126: $tpl->set("s", "VAR_TEXT", $varText);
127:
128: global $cfg;
129:
130: $tpl->generate($cfg["templates"]["debug_visible"]);
131: if ($bExit === true) {
132: die('<p class="debug_footer"><b>debugg\'ed</b></p>');
133: }
134: }
135:
136: 137: 138: 139: 140: 141:
142: public function add($mVariable, $sVariableDescription = '') {
143: }
144:
145: 146: 147:
148: public function reset() {
149: }
150:
151: 152: 153:
154: public function showAll() {
155: }
156: }
157: