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: private static $_instance;
30:
31: 32: 33:
34: private function __construct() {
35: }
36:
37: 38: 39:
40: static public function getInstance() {
41: if (self::$_instance == null) {
42: self::$_instance = new cDebugVisible();
43: }
44: return self::$_instance;
45: }
46:
47: public function out($msg) {
48: }
49:
50: 51: 52: 53: 54: 55: 56: 57:
58: public function show($mVariable, $sVariableDescription = '', $bExit = false) {
59: $bTextarea = false;
60: $bPlainText = false;
61: if (is_array($mVariable)) {
62: if (sizeof($mVariable) > 10) {
63: $bTextarea = true;
64: } else {
65: $bPlainText = true;
66: }
67: }
68: if (is_object($mVariable)) {
69: $bTextarea = true;
70: }
71: if (is_string($mVariable)) {
72: if (preg_match('/<(.*)>/', $mVariable)) {
73: if (strlen($mVariable) > 40) {
74: $bTextarea = true;
75: } else {
76: $bPlainText = true;
77: $mVariable = conHtmlSpecialChars($mVariable);
78: }
79: } else {
80: $bPlainText = true;
81: }
82: }
83:
84: $tpl = new cTemplate();
85: $tpl->set("s", "VAR_DESCRIPTION", $sVariableDescription);
86: $varText = "";
87: if ($bTextarea === true) {
88: $varText .= '<textarea rows="10" cols="100">';
89: } elseif ($bPlainText === true) {
90: $varText .= '<pre class="debug_output">';
91: } else {
92: $varText .= '<pre class="debug_output">';
93: }
94:
95: if (is_array($mVariable)) {
96: $varText .= print_r($mVariable, true);
97: } else {
98: $varText .= var_dump($mVariable, true);
99: }
100:
101: if ($bTextarea === true) {
102: $varText .= '</textarea>';
103: } elseif ($bPlainText === true) {
104: $varText .= '</pre>';
105: } else {
106: $varText .= '</pre>';
107: }
108: $tpl->set("s", "VAR_TEXT", $varText);
109:
110: global $cfg;
111:
112: $tpl->generate($cfg["templates"]["debug_visible"]);
113: if ($bExit === true) {
114: die('<p class="debug_footer"><b>debugg\'ed</b></p>');
115: }
116: }
117:
118: 119: 120: 121: 122: 123:
124: public function add($mVariable, $sVariableDescription = '') {
125: }
126:
127: 128: 129:
130: public function reset() {
131: }
132:
133: 134: 135:
136: public function showAll() {
137: }
138:
139: }
140: