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