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
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • 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:  * @version SVN Revision $Rev:$
  9:  *
 10:  * @author Rudi Bieller
 11:  * @copyright four for business AG <www.4fb.de>
 12:  * @license http://www.contenido.org/license/LIZENZ.txt
 13:  * @link http://www.4fb.de
 14:  * @link http://www.contenido.org
 15:  */
 16: 
 17: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 18: 
 19: /**
 20:  * Debug object to show info on screen.
 21:  * In case you cannot output directly to screen when debugging a live system,
 22:  * this object writes
 23:  * the info to a file located in /data/log/debug.log.
 24:  *
 25:  * @package Core
 26:  * @subpackage Debug
 27:  */
 28: class cDebugVisible implements cDebugInterface {
 29: 
 30:     /**
 31:      * Singleton instance
 32:      *
 33:      * @var cDebugVisible
 34:      */
 35:     private static $_instance;
 36: 
 37:     /**
 38:      * Return singleton instance.
 39:      *
 40:      * @return cDebugVisible
 41:      */
 42:     static public function getInstance() {
 43:         if (self::$_instance == NULL) {
 44:             self::$_instance = new cDebugVisible();
 45:         }
 46:         return self::$_instance;
 47:     }
 48: 
 49:     /**
 50:      * Constructor
 51:      */
 52:     private function __construct() {
 53:     }
 54: 
 55:     /**
 56:      * Writes a line.
 57:      * This method does nothing!
 58:      *
 59:      * @see cDebugInterface::out()
 60:      * @param string $msg
 61:      */
 62:     public function out($msg) {
 63:     }
 64: 
 65:     /**
 66:      * Outputs contents of passed variable in a preformatted, readable way
 67:      *
 68:      * @param mixed $mVariable
 69:      *         The variable to be displayed
 70:      * @param string $sVariableDescription [optional]
 71:      *         The variable's name or description
 72:      * @param bool $bExit [optional]
 73:      *         If set to true, your app will die() after output of current var
 74:      */
 75:     public function show($mVariable, $sVariableDescription = '', $bExit = false) {
 76:         $bTextarea = false;
 77:         $bPlainText = false;
 78:         if (is_array($mVariable)) {
 79:             if (sizeof($mVariable) > 10) {
 80:                 $bTextarea = true;
 81:             } else {
 82:                 $bPlainText = true;
 83:             }
 84:         }
 85:         if (is_object($mVariable)) {
 86:             $bTextarea = true;
 87:         }
 88:         if (is_string($mVariable)) {
 89:             if (preg_match('/<(.*)>/', $mVariable)) {
 90:                 if (strlen($mVariable) > 40) {
 91:                     $bTextarea = true;
 92:                 } else {
 93:                     $bPlainText = true;
 94:                     $mVariable = conHtmlSpecialChars($mVariable);
 95:                 }
 96:             } else {
 97:                 $bPlainText = true;
 98:             }
 99:         }
100: 
101:         $tpl = new cTemplate();
102:         $tpl->set("s", "VAR_DESCRIPTION", $sVariableDescription);
103:         $varText = "";
104:         if ($bTextarea === true) {
105:             $varText .= '<textarea rows="10" cols="100">';
106:         } elseif ($bPlainText === true) {
107:             $varText .= '<pre class="debug_output">';
108:         } else {
109:             $varText .= '<pre class="debug_output">';
110:         }
111: 
112:         if (is_array($mVariable)) {
113:             $varText .= print_r($mVariable, true);
114:         } else {
115:             $varText .= var_dump($mVariable, true);
116:         }
117: 
118:         if ($bTextarea === true) {
119:             $varText .= '</textarea>';
120:         } elseif ($bPlainText === true) {
121:             $varText .= '</pre>';
122:         } else {
123:             $varText .= '</pre>';
124:         }
125:         $tpl->set("s", "VAR_TEXT", $varText);
126: 
127:         global $cfg;
128: 
129:         $tpl->generate($cfg["templates"]["debug_visible"]);
130:         if ($bExit === true) {
131:             die('<p class="debug_footer"><b>debugg\'ed</b></p>');
132:         }
133:     }
134: 
135:     /**
136:      * Interface implementation
137:      *
138:      * @param mixed $mVariable
139:      * @param string $sVariableDescription [optional]
140:      */
141:     public function add($mVariable, $sVariableDescription = '') {
142:     }
143: 
144:     /**
145:      * Interface implementation
146:      */
147:     public function reset() {
148:     }
149: 
150:     /**
151:      * Interface implementation
152:      */
153:     public function showAll() {
154:     }
155: }
156: 
CMS CONTENIDO 4.9.8 API documentation generated by ApiGen 2.8.0