当前位置: 首页>>代码示例>>PHP>>正文


PHP Debug::enabled方法代码示例

本文整理汇总了PHP中Debug::enabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Debug::enabled方法的具体用法?PHP Debug::enabled怎么用?PHP Debug::enabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Debug的用法示例。


在下文中一共展示了Debug::enabled方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: build

 public static function build()
 {
     self::$enabled = $GLOBALS['config']['DEBUG']['enabled'];
     self::$out = $GLOBALS['config']['DEBUG']['out'];
     self::$outfile = $GLOBALS['config']['DEBUG']['outfile'];
     self::$verbosity = $GLOBALS['config']['DEBUG']['verbosity'];
     if (self::$enabled && !is_writable(self::$outfile) && (self::$out === "file" || self::$out === "both")) {
         self::$out = "stdout";
         self::write("Debug outfile is not writable. Switching back to stdout", 0);
     }
     if (self::$enabled === true) {
         self::write(date('Ymd-Gis - ') . "Debug mode enabled. Use in development env. only!", 0);
     }
 }
开发者ID:Almazys,项目名称:SPF,代码行数:14,代码来源:Debug.class.php

示例2: render

 /**
  * Método para apresentar a página de erro. Mata execução
  * @param	int		$number		número do erro HTTP
  * @param	string	$message	mensagem do erro
  * @param	string	$file		endereço completo do arquivo em que ocorreu o erro
  * @param	int		$line		número da linha em que ocorreu o erro
  * @param	string	$trace		trilha de arquivo antes de ocorrer o erro
  * @param	string	$details	detalhes do erro, apresenta o trecho do arquivo em que ocorreu o erro
  * @return	void
  */
 public static function render($number, $message, $file, $line, $trace = null, $details = null)
 {
     if (Debug::enabled()) {
         return require_once root . 'core/error/debug.php';
     }
     $files = array();
     $files[0] = root . 'app/views/_error/' . $number . '.php';
     $files[1] = root . 'core/error/' . $number . '.php';
     foreach ($files as $f) {
         if (file_exists($f)) {
             return require_once $f;
         }
     }
     exit('error');
 }
开发者ID:nylmarcos,项目名称:estagio,代码行数:25,代码来源:Error.php

示例3: enable

 /**
  * Enables displaying or logging errors and exceptions.
  * @param  bool          enable production mode? (NULL means autodetection)
  * @param  string        error log file (FALSE disables logging in production mode)
  * @param  array|string  administrator email or email headers; enables email sending in production mode
  * @return void
  */
 public static function enable($productionMode = NULL, $logFile = NULL, $email = NULL)
 {
     if (version_compare(PHP_VERSION, '5.2.1') === 0) {
         throw new NotSupportedException(__METHOD__ . ' is not supported in PHP 5.2.1');
         // PHP bug #40815
     }
     error_reporting(E_ALL | E_STRICT);
     // production/development mode detection
     if (is_bool($productionMode)) {
         self::$productionMode = $productionMode;
     }
     if (self::$productionMode === self::DETECT) {
         if (class_exists('Environment')) {
             self::$productionMode = Environment::isProduction();
         } elseif (isset($_SERVER['SERVER_ADDR']) || isset($_SERVER['LOCAL_ADDR'])) {
             // IP address based detection
             $addr = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
             $oct = explode('.', $addr);
             self::$productionMode = $addr !== '::1' && (count($oct) !== 4 || $oct[0] !== '10' && $oct[0] !== '127' && ($oct[0] !== '172' || $oct[1] < 16 || $oct[1] > 31) && ($oct[0] !== '169' || $oct[1] !== '254') && ($oct[0] !== '192' || $oct[1] !== '168'));
         } else {
             self::$productionMode = !self::$consoleMode;
         }
     }
     // logging configuration
     if (self::$productionMode && $logFile !== FALSE) {
         self::$logFile = 'log/php_error.log';
         if (class_exists('Environment')) {
             if (is_string($logFile)) {
                 self::$logFile = Environment::expand($logFile);
             } else {
                 try {
                     self::$logFile = Environment::expand('%logDir%/php_error.log');
                 } catch (InvalidStateException $e) {
                 }
             }
         } elseif (is_string($logFile)) {
             self::$logFile = $logFile;
         }
         ini_set('error_log', self::$logFile);
     }
     // php configuration
     if (function_exists('ini_set')) {
         ini_set('display_errors', !self::$productionMode);
         // or 'stderr'
         ini_set('html_errors', !self::$consoleMode);
         ini_set('log_errors', (bool) self::$logFile);
     } elseif (ini_get('log_errors') != (bool) self::$logFile || ini_get('display_errors') != !self::$productionMode && ini_get('display_errors') !== (self::$productionMode ? 'stderr' : 'stdout')) {
         throw new NotSupportedException('Function ini_set() must be enabled.');
     }
     self::$sendEmails = $logFile && $email;
     if (self::$sendEmails) {
         if (is_string($email)) {
             self::$emailHeaders['To'] = $email;
         } elseif (is_array($email)) {
             self::$emailHeaders = $email + self::$emailHeaders;
         }
     }
     if (!defined('E_DEPRECATED')) {
         define('E_DEPRECATED', 8192);
     }
     if (!defined('E_USER_DEPRECATED')) {
         define('E_USER_DEPRECATED', 16384);
     }
     set_exception_handler(array(__CLASS__, 'exceptionHandler'));
     set_error_handler(array(__CLASS__, 'errorHandler'));
     register_shutdown_function(array(__CLASS__, 'shutdownHandler'));
     self::$enabled = TRUE;
     if (is_int($productionMode)) {
         // back compatibility
         //trigger_error('Debug::enable($errorLevel) is deprecated; Remove $errorLevel parameter.', E_USER_WARNING);
     }
 }
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:79,代码来源:Debug.php

示例4: enable

 /**
  * Enables displaying or logging errors and exceptions.
  * @param  mixed         production, development mode, autodetection or IP address(es).
  * @param  string        error log file (FALSE disables logging in production mode)
  * @param  array|string  administrator email or email headers; enables email sending in production mode
  * @return void
  */
 public static function enable($mode = NULL, $logFile = NULL, $email = NULL)
 {
     error_reporting(E_ALL | E_STRICT);
     // production/development mode detection
     if (is_bool($mode)) {
         self::$productionMode = $mode;
     } elseif (is_string($mode)) {
         // IP adresses
         $mode = preg_split('#[,\\s]+#', $mode);
     }
     if (is_array($mode)) {
         // IP adresses
         self::$productionMode = !isset($_SERVER['REMOTE_ADDR']) || !in_array($_SERVER['REMOTE_ADDR'], $mode, TRUE);
     }
     if (self::$productionMode === self::DETECT) {
         if (class_exists('Environment')) {
             self::$productionMode = Environment::isProduction();
         } elseif (isset($_SERVER['SERVER_ADDR']) || isset($_SERVER['LOCAL_ADDR'])) {
             // IP address based detection
             $addr = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
             $oct = explode('.', $addr);
             self::$productionMode = $addr !== '::1' && (count($oct) !== 4 || $oct[0] !== '10' && $oct[0] !== '127' && ($oct[0] !== '172' || $oct[1] < 16 || $oct[1] > 31) && ($oct[0] !== '169' || $oct[1] !== '254') && ($oct[0] !== '192' || $oct[1] !== '168'));
         } else {
             self::$productionMode = !self::$consoleMode;
         }
     }
     // logging configuration
     if (self::$productionMode && $logFile !== FALSE) {
         self::$logFile = 'log/php_error.log';
         if (class_exists('Environment')) {
             if (is_string($logFile)) {
                 self::$logFile = Environment::expand($logFile);
             } else {
                 try {
                     self::$logFile = Environment::expand('%logDir%/php_error.log');
                 } catch (InvalidStateException $e) {
                 }
             }
         } elseif (is_string($logFile)) {
             self::$logFile = $logFile;
         }
         ini_set('error_log', self::$logFile);
     }
     // php configuration
     if (function_exists('ini_set')) {
         ini_set('display_errors', !self::$productionMode);
         // or 'stderr'
         ini_set('html_errors', !self::$logFile && !self::$consoleMode);
         ini_set('log_errors', FALSE);
     } elseif (ini_get('display_errors') != !self::$productionMode && ini_get('display_errors') !== (self::$productionMode ? 'stderr' : 'stdout')) {
         // intentionally ==
         throw new NotSupportedException('Function ini_set() must be enabled.');
     }
     self::$sendEmails = self::$logFile && $email;
     if (self::$sendEmails) {
         if (is_string($email)) {
             self::$emailHeaders['To'] = $email;
         } elseif (is_array($email)) {
             self::$emailHeaders = $email + self::$emailHeaders;
         }
     }
     if (!defined('E_DEPRECATED')) {
         define('E_DEPRECATED', 8192);
     }
     if (!defined('E_USER_DEPRECATED')) {
         define('E_USER_DEPRECATED', 16384);
     }
     register_shutdown_function(array(__CLASS__, '_shutdownHandler'));
     set_exception_handler(array(__CLASS__, '_exceptionHandler'));
     set_error_handler(array(__CLASS__, '_errorHandler'));
     self::$enabled = TRUE;
 }
开发者ID:regiss,项目名称:texyla-s-Nete1-PhP-5.2,代码行数:79,代码来源:Debug.php

示例5: enable

 public static function enable($mode = NULL, $logDirectory = NULL, $email = NULL)
 {
     error_reporting(E_ALL | E_STRICT);
     if (is_bool($mode)) {
         self::$productionMode = $mode;
     } elseif (is_string($mode)) {
         $mode = preg_split('#[,\\s]+#', "{$mode} 127.0.0.1 ::1");
     }
     if (is_array($mode)) {
         self::$productionMode = !isset($_SERVER['REMOTE_ADDR']) || !in_array($_SERVER['REMOTE_ADDR'], $mode, TRUE);
     }
     if (self::$productionMode === self::DETECT) {
         if (class_exists('Environment')) {
             self::$productionMode = Environment::isProduction();
         } elseif (isset($_SERVER['SERVER_ADDR']) || isset($_SERVER['LOCAL_ADDR'])) {
             $addrs = array();
             if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
                 $addrs = preg_split('#,\\s*#', $_SERVER['HTTP_X_FORWARDED_FOR']);
             }
             if (isset($_SERVER['REMOTE_ADDR'])) {
                 $addrs[] = $_SERVER['REMOTE_ADDR'];
             }
             $addrs[] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
             self::$productionMode = FALSE;
             foreach ($addrs as $addr) {
                 $oct = explode('.', $addr);
                 if ($addr !== '::1' && (count($oct) !== 4 || $oct[0] !== '10' && $oct[0] !== '127' && ($oct[0] !== '172' || $oct[1] < 16 || $oct[1] > 31) && ($oct[0] !== '169' || $oct[1] !== '254') && ($oct[0] !== '192' || $oct[1] !== '168'))) {
                     self::$productionMode = TRUE;
                     break;
                 }
             }
         } else {
             self::$productionMode = !self::$consoleMode;
         }
     }
     if (is_string($logDirectory) || $logDirectory === FALSE) {
         self::$logDirectory = $logDirectory;
     } else {
         self::$logDirectory = defined('APP_DIR') ? APP_DIR . '/../log' : getcwd() . '/log';
     }
     if (self::$logDirectory) {
         ini_set('error_log', self::$logDirectory . '/php_error.log');
     }
     if (function_exists('ini_set')) {
         ini_set('display_errors', !self::$productionMode);
         ini_set('html_errors', FALSE);
         ini_set('log_errors', FALSE);
     } elseif (ini_get('display_errors') != !self::$productionMode && ini_get('display_errors') !== (self::$productionMode ? 'stderr' : 'stdout')) {
         throw new NotSupportedException('Function ini_set() must be enabled.');
     }
     if ($email) {
         if (!is_string($email)) {
             throw new InvalidArgumentException('E-mail address must be a string.');
         }
         self::$email = $email;
     }
     if (!defined('E_DEPRECATED')) {
         define('E_DEPRECATED', 8192);
     }
     if (!defined('E_USER_DEPRECATED')) {
         define('E_USER_DEPRECATED', 16384);
     }
     if (!self::$enabled) {
         register_shutdown_function(array(__CLASS__, '_shutdownHandler'));
         set_exception_handler(array(__CLASS__, '_exceptionHandler'));
         set_error_handler(array(__CLASS__, '_errorHandler'));
         self::$enabled = TRUE;
     }
 }
开发者ID:kravco,项目名称:dibi,代码行数:69,代码来源:Debug.php

示例6: enable

 /**
  * Enables displaying or logging errors and exceptions.
  * @param  int   error reporting level
  * @param  bool|string  log to file?
  * @param  array|string  send emails?
  * @return void
  */
 public static function enable($level = E_ALL, $logErrors = NULL, $sendEmails = FALSE)
 {
     if (version_compare(PHP_VERSION, '5.2.1') === 0) {
         throw new NotSupportedException(__METHOD__ . ' is not supported in PHP 5.2.1');
         // PHP bug #40815
     }
     // Environment auto-detection
     if ($logErrors === NULL && class_exists('Environment')) {
         $logErrors = Environment::isLive();
     }
     // Firebug detection
     if (self::$useFirebug === NULL) {
         self::$useFirebug = function_exists('json_encode') && !$logErrors && isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'FirePHP/');
     }
     if ($level !== NULL) {
         error_reporting($level);
     }
     if (function_exists('ini_set')) {
         ini_set('display_startup_errors', !$logErrors);
         ini_set('display_errors', !$logErrors);
         // or 'stderr'
         ini_set('html_errors', self::$html);
         ini_set('log_errors', (bool) $logErrors);
     } elseif ($logErrors) {
         // throws error only on production server
         throw new NotSupportedException('Function ini_set() is not enabled.');
     }
     if ($logErrors) {
         if (is_string($logErrors)) {
             self::$logFile = strpos($logErrors, '%') === FALSE ? $logErrors : Environment::expand($logErrors);
         } else {
             try {
                 self::$logFile = Environment::expand('%logDir%/php_error.log');
             } catch (InvalidStateException $e) {
                 self::$logFile = 'php_error.log';
             }
         }
         ini_set('error_log', self::$logFile);
     }
     self::$sendEmails = $logErrors && $sendEmails;
     if (self::$sendEmails) {
         if (is_string($sendEmails)) {
             self::$emailHeaders['To'] = $sendEmails;
         } elseif (is_array($sendEmails)) {
             self::$emailHeaders = $sendEmails + self::$emailHeaders;
         }
         if (mt_rand() / mt_getrandmax() < self::$emailProbability) {
             self::observeErrorLog();
         }
     }
     if (!defined('E_RECOVERABLE_ERROR')) {
         define('E_RECOVERABLE_ERROR', 4096);
     }
     if (!defined('E_DEPRECATED')) {
         define('E_DEPRECATED', 8192);
     }
     set_exception_handler(array(__CLASS__, 'exceptionHandler'));
     set_error_handler(array(__CLASS__, 'errorHandler'));
     self::$enabled = TRUE;
 }
开发者ID:laiello,项目名称:webuntucms,代码行数:67,代码来源:Debug.php

示例7: getProperties

        $key = 'Trilado.Annotation.Property.' . $this->classname . '->' . $property;
        $cache = Cache::factory();
        if (Debug::enabled() && $cache->has($key)) {
            return $cache->read($key);
        } else {
            $reflection = new ReflectionProperty($this->classname, $property);
            $comment = $reflection->getDocComment();
            $annotation = $this->extractAnnotation($comment);
            $cache->write($key, $annotation, CACHE_TIME);
            return $annotation;
        }
    }
    /**
	 * Pega a anotação todas as propriedades da classe
	 * @return	array	lista com instâncias de sdtClass
	 */
    public function getProperties()
    {
开发者ID:nylmarcos,项目名称:estagio,代码行数:18,代码来源:Annotation.php

示例8: disable_debug_mode

 /**
  * @desc Disables the debug mode
  */
 public static function disable_debug_mode()
 {
     self::$enabled = false;
     self::$options = array();
     self::write_debug_file();
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:9,代码来源:Debug.class.php

示例9: array

<?php

require_once './app/config.php';
header('Content-Type: text/html; charset=' . ESCMS_OUTPUT_ENCODING);
require_once './app/layers/debug.layer.php';
set_exception_handler(array('Debug', 'catchException'));
set_error_handler(array('Debug', 'catchError'));
date_default_timezone_set(ESCMS_TIMEZONE);
Debug::$enabled = ESCMS_DEBUG_ENABLE;
require_once './app/layers/lib.layer.php';
require_once './app/layers/dal.layer.php';
require_once './app/layers/tpl.layer.php';
require_once './app/layers/core.layer.php';
Lib::$dirpath = ESCMS_PATH_LIB;
SQL::$dirpath = ESCMS_PATH_DAL_DRIVERS;
TPL::$dirpath = ESCMS_PATH_TPL . 'looksmog/';
# replace! -> db
TPL::add('SITE_ROOT_PATH', SITE_ROOT_PATH);
switch (ESCMS_DB_TYPE) {
    case 'sqlite2':
        $params = array('file' => ESCMS_DB_FILE);
        break;
}
SQL::openConnection(array('type' => ESCMS_DB_TYPE, 'prefix' => ESCMS_DB_PREFIX, 'params' => $params));
if (defined('REQUEST_RAW') && !defined('REDIRECTED')) {
    $e = explode(SITE_ROOT_PATH, 'http://' . $_SERVER['HTTP_HOST'] . REQUEST_RAW, 2);
    TPL::add('PAGE_URI', SITE_ROOT_PATH . $e[1]);
    define('REQUEST', '/' . end($e));
    require_once './app/resolve.php';
    die;
} else {
开发者ID:jankuca,项目名称:escms,代码行数:31,代码来源:init.php

示例10: disable

 /**
  * Disables debug checking
  * 
  * @return void
  */
 public static function disable()
 {
     self::$enabled = false;
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:9,代码来源:debug.php


注:本文中的Debug::enabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。