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:  *
  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:     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:      * Interface implementation
136:      *
137:      * @param mixed $mVariable
138:      * @param string $sVariableDescription [optional]
139:      */
140:     public function add($mVariable, $sVariableDescription = '') {
141:     }
142: 
143:     /**
144:      * Interface implementation
145:      */
146:     public function reset() {
147:     }
148: 
149:     /**
150:      * Interface implementation
151:      */
152:     public function showAll() {
153:     }
154: }
155: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0