Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cDebug
  • cDebugDevNull
  • cDebugFile
  • cDebugFileAndVisAdv
  • cDebugHidden
  • cDebugVisible
  • cDebugVisibleAdv
  • cDebugVisibleAdvItem

Interfaces

  • cDebugInterface
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the visible debug class.
  5:  *
  6:  * @package Core
  7:  * @subpackage Debug
  8:  *
  9:  * @author Rudi Bieller
 10:  * @copyright four for business AG <www.4fb.de>
 11:  * @license http://www.contenido.org/license/LIZENZ.txt
 12:  * @link http://www.4fb.de
 13:  * @link http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: /**
 19:  * Debug object to show info on screen.
 20:  * In case you cannot output directly to screen when debugging a live system,
 21:  * this object writes
 22:  * the info to a file located in /data/log/debug.log.
 23:  *
 24:  * @package Core
 25:  * @subpackage Debug
 26:  */
 27: class cDebugVisible implements cDebugInterface {
 28: 
 29:     /**
 30:      * Singleton instance
 31:      *
 32:      * @var cDebugVisible
 33:      */
 34:     private static $_instance;
 35: 
 36:     /**
 37:      * Return singleton instance.
 38:      *
 39:      * @return cDebugVisible
 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:      * Constructor to create an instance of this class.
 50:      */
 51:     private function __construct() {
 52:     }
 53: 
 54:     /**
 55:      * Writes a line.
 56:      * This method does nothing!
 57:      *
 58:      * @see cDebugInterface::out()
 59:      * @param string $msg
 60:      */
 61:     public function out($msg) {
 62:     }
 63: 
 64:     /**
 65:      * Outputs contents of passed variable in a preformatted, readable way
 66:      *
 67:      * @param mixed  $mVariable
 68:      *                                     The variable to be displayed
 69:      * @param string $sVariableDescription [optional]
 70:      *                                     The variable's name or description
 71:      * @param bool   $bExit                [optional]
 72:      *                                     If set to true, your app will die() after output of current var
 73:      *
 74:      * @throws cInvalidArgumentException
 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:      * Interface implementation
138:      *
139:      * @param mixed $mVariable
140:      * @param string $sVariableDescription [optional]
141:      */
142:     public function add($mVariable, $sVariableDescription = '') {
143:     }
144: 
145:     /**
146:      * Interface implementation
147:      */
148:     public function reset() {
149:     }
150: 
151:     /**
152:      * Interface implementation
153:      */
154:     public function showAll() {
155:     }
156: }
157: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0