Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • 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:  * This file contains the static debugger class.
  4:  *
  5:  * @package Core
  6:  * @subpackage Debug
  7:  * @version SVN Revision $Rev:$
  8:  *
  9:  * @author Rudi Bieller
 10:  * @author Murat Purc <murat@purc.de>
 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:  * Debugger class
 21:  *
 22:  * @package Core
 23:  * @subpackage Debug
 24:  */
 25: class cDebug {
 26: 
 27:     /**
 28:      *
 29:      * @var string
 30:      */
 31:     const DEBUGGER_VISIBLE = 'visible';
 32: 
 33:     /**
 34:      *
 35:      * @var string
 36:      */
 37:     const DEBUGGER_VISIBLE_ADV = 'visible_adv';
 38: 
 39:     /**
 40:      *
 41:      * @var string
 42:      */
 43:     const DEBUGGER_HIDDEN = 'hidden';
 44: 
 45:     /**
 46:      *
 47:      * @var string
 48:      */
 49:     const DEBUGGER_FILE = 'file';
 50: 
 51:     /**
 52:      *
 53:      * @var string
 54:      */
 55:     const DEBUGGER_VISIBLE_AND_FILE = 'vis_and_file';
 56: 
 57:     /**
 58:      *
 59:      * @var string
 60:      */
 61:     const DEBUGGER_DEVNULL = 'devnull';
 62: 
 63:     /**
 64:      * Default debugger, defined in system settings
 65:      *
 66:      * @var string
 67:      */
 68:     protected static $_defaultDebuggerName;
 69: 
 70:     /**
 71:      * Returns instance of debugger.
 72:      * If not defined, it returns the debugger from the current system settings.
 73:      *
 74:      * @param string $sType The debugger to get, empty string to get debugger
 75:      *            defined in system settings
 76:      *
 77:      * @throws cInvalidArgumentException If type of debugger is unknown
 78:      * @return cDebugInterface
 79:      */
 80:     public static function getDebugger($sType = '') {
 81:         if (empty($sType)) {
 82:             $sType = self::_getSystemSettingDebugger();
 83:         }
 84: 
 85:         $oDebugger = NULL;
 86:         switch ($sType) {
 87:             case self::DEBUGGER_VISIBLE:
 88:                 $oDebugger = cDebugVisible::getInstance();
 89:                 break;
 90:             case self::DEBUGGER_VISIBLE_ADV:
 91:                 $oDebugger = cDebugVisibleAdv::getInstance();
 92:                 break;
 93:             case self::DEBUGGER_HIDDEN:
 94:                 $oDebugger = cDebugHidden::getInstance();
 95:                 break;
 96:             case self::DEBUGGER_FILE:
 97:                 $oDebugger = cDebugFile::getInstance();
 98:                 break;
 99:             case self::DEBUGGER_VISIBLE_AND_FILE:
100:                 $oDebugger = cDebugFileAndVisAdv::getInstance();
101:                 break;
102:             case self::DEBUGGER_DEVNULL:
103:                 $oDebugger = cDebugDevNull::getInstance();
104:                 break;
105:             default:
106:                 throw new cInvalidArgumentException('This type of debugger is unknown to cDebug: ' . $sType);
107:                 break;
108:         }
109: 
110:         return $oDebugger;
111:     }
112: 
113:     /**
114:      * Prints a debug message if the settings allow it.
115:      * The debug messages will be
116:      * in a textrea in the header and in the file debuglog.txt. All messages are
117:      * immediately
118:      * written to the filesystem but they will only show up when
119:      * cDebug::showAll() is called.
120:      *
121:      * @param string $message Message to display. NOTE: You can use
122:      *            buildStackString to show stacktraces
123:      */
124:     public static function out($message) {
125:         self::getDebugger()->out($message);
126:     }
127: 
128:     /**
129:      * Adds a variable to the debugger.
130:      * This variable will be watched.
131:      *
132:      * @param mixed $var A variable or an object
133:      * @param string $label An optional description for the variable
134:      */
135:     public static function add($var, $label = '') {
136:         self::getDebugger()->add($var, $label);
137:     }
138: 
139:     /**
140:      * Prints the cached debug messages to the screen
141:      */
142:     public static function showAll() {
143:         self::getDebugger()->showAll();
144:     }
145: 
146:     /**
147:      * Returns default debugger name.
148:      *
149:      * @return string
150:      */
151:     public static function getDefaultDebuggerName() {
152:         return self::_getSystemSettingDebugger();
153:     }
154: 
155:     /**
156:      * Returns the debugger defined in system settings.
157:      *
158:      * @return string
159:      */
160:     protected static function _getSystemSettingDebugger() {
161:         if (isset(self::$_defaultDebuggerName)) {
162:             return self::$_defaultDebuggerName;
163:         }
164:         self::$_defaultDebuggerName = self::DEBUGGER_DEVNULL;
165:         if (getSystemProperty('debug', 'debug_to_file') == 'true') {
166:             self::$_defaultDebuggerName = self::DEBUGGER_FILE;
167:         } else if (getSystemProperty('debug', 'debug_to_screen') == 'true') {
168:             self::$_defaultDebuggerName = self::DEBUGGER_VISIBLE_ADV;
169:         }
170:         if ((getSystemProperty('debug', 'debug_to_screen') == 'true') && (getSystemProperty('debug', 'debug_to_file') == 'true')) {
171:             self::$_defaultDebuggerName = self::DEBUGGER_VISIBLE_AND_FILE;
172:         }
173: 
174:         return self::$_defaultDebuggerName;
175:     }
176: }
177: 
CMS CONTENIDO 4.9.5 API documentation generated by ApiGen 2.8.0