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


PHP static::enabled方法代码示例

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


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

示例1: enable

 /**
  * Enables the debug tools.
  *
  * This method registers an error handler and an exception handler.
  *
  * If the Symfony ClassLoader component is available, a special
  * class loader is also registered.
  *
  * @param int  $errorReportingLevel The level of error reporting you want
  * @param bool $displayErrors       Whether to display errors (for development) or just log them (for production)
  */
 public static function enable($errorReportingLevel = E_ALL, $displayErrors = true)
 {
     if (static::$enabled) {
         return;
     }
     static::$enabled = true;
     if (null !== $errorReportingLevel) {
         error_reporting($errorReportingLevel);
     } else {
         error_reporting(E_ALL);
     }
     if ('cli' !== PHP_SAPI) {
         ini_set('display_errors', 0);
         ExceptionHandler::register();
     } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
         // CLI - display errors only if they're not already logged to STDERR
         ini_set('display_errors', 1);
     }
     if ($displayErrors) {
         ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
     } else {
         ErrorHandler::register()->throwAt(0, true);
     }
     DebugClassLoader::enable();
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:36,代码来源:Debug.php

示例2: setCustomCache

 /**
  * Use a custom fCache object to serve caches. Any fCache object works, so if the directory
  * cache isn't working well, developers should test different cache options and find one that
  * works best.
  * 
  * @param fCache $cache 		The fCache object to serve as a cache
  */
 public static function setCustomCache(fCache $cache)
 {
     if (static::$authorized_override) {
         return false;
     }
     static::$enabled = true;
     static::$cache = $cache;
 }
开发者ID:rizqidjamaluddin,项目名称:Swoosh,代码行数:15,代码来源:sfPageCache.php

示例3: disable

 public static function disable()
 {
     if (!static::$enabled) {
         return;
     }
     static::$enabled = false;
     error_reporting(0);
 }
开发者ID:Air-Craft,项目名称:air-craft-www,代码行数:8,代码来源:Debug.php

示例4: enabled

 /**
  * Should we expect captcha submissions?
  *
  * @return boolean
  */
 public static function enabled()
 {
     if (!isset(static::$enabled)) {
         $enabled = !c('Garden.Registration.SkipCaptcha', false);
         $handlersAvailable = false;
         Gdn::pluginManager()->fireAs('captcha')->fireEvent('IsEnabled', ['Enabled' => &$handlersAvailable]);
         static::$enabled = $enabled && $handlersAvailable;
     }
     return static::$enabled;
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:15,代码来源:class.captcha.php

示例5: init

 public static function init($ip = null)
 {
     static::$enabled = is_array($ip) ? in_array(SiteCore::getClientIp(), $ip) : true;
     if (!static::$enabled) {
         return;
     }
     static::$stack = new SplStack();
     $className = get_called_class();
     static::$root = new $className('@');
     static::$stack->push(static::$root);
 }
开发者ID:voituk,项目名称:Misc,代码行数:11,代码来源:SimpleProfiler.class.php

示例6: tagsToColors

 /**
  * This is the primary function for converting tags to ANSI color codes
  * (see the class description for the supported tags)
  *
  * For safety, this function always appends a <reset> at the end, otherwise the console may stick
  * permanently in the colors you have used.
  *
  * @param string $string
  * @return string
  */
 public static function tagsToColors($string)
 {
     if (static::$enabled === null) {
         static::$enabled = !static::isWindows() || static::isAnsiCon();
     }
     if (!static::$enabled) {
         // Strip tags (replace them with an empty string)
         return str_replace(array_keys(static::$tags), '', $string);
     }
     // We always add a <reset> at the end of each string so that any output following doesn't continue the same styling
     $string .= '<reset>';
     return str_replace(array_keys(static::$tags), static::$tags, $string);
 }
开发者ID:InfinityWebMe,项目名称:PHPloy,代码行数:23,代码来源:Ansi.php

示例7: enable

 /**
  * activate custom debugging
  * registers error handler and exception handler
  * 
  * @param integer $reportingLevel
  * @param boolean $displayErrors
  */
 public static function enable($reportingLevel = NULL, $displayErrors = NULL)
 {
     if (!static::$enabled) {
         static::$enabled = true;
         error_reporting(E_ALL);
         ErrorHandler::register($reportingLevel, $displayErrors);
         if (PHP_SAPI !== 'cli') {
             ExceptionHandler::register($reportingLevel, $displayErrors);
         } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
             ini_set('display_errors', 1);
         }
     }
 }
开发者ID:vectrex,项目名称:vxphp,代码行数:20,代码来源:Debug.php

示例8: enable

 public static function enable($environment = 'dev')
 {
     if (static::$enabled) {
         return;
     }
     static::$enabled = true;
     error_reporting(-1);
     // Beware, ExceptionHandler::register and ErrorHandler::register must be called in this order
     // to fatal errors handling work
     ExceptionHandler::register(true, $environment);
     ErrorHandler::register();
     DebugClassLoader::enable();
 }
开发者ID:keboola,项目名称:syrup,代码行数:13,代码来源:Debug.php

示例9: enable

 /**
  * Enables the debug tools.
  *
  * This method registers an error handler and an exception handler.
  *
  * If the Symfony ClassLoader component is available, a special
  * class loader is also registered.
  *
  * @param int     $errorReportingLevel The level of error reporting you want
  * @param bool    $displayErrors       Whether to display errors (for development) or just log them (for production)
  */
 public static function enable($errorReportingLevel = null, $displayErrors = true)
 {
     if (static::$enabled) {
         return;
     }
     static::$enabled = true;
     error_reporting(-1);
     ErrorHandler::register($errorReportingLevel, $displayErrors);
     if ('cli' !== php_sapi_name()) {
         ExceptionHandler::register();
         // CLI - display errors only if they're not already logged to STDERR
     } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
         ini_set('display_errors', 1);
     }
     DebugClassLoader::enable();
 }
开发者ID:flelievre,项目名称:EasyVisit,代码行数:27,代码来源:Debug.php

示例10: enable

 /**
  * Enables the debug tools.
  *
  * This method registers an error handler and an exception handler.
  *
  * If the Symfony ClassLoader component is available, a special
  * class loader is also registered.
  *
  * @param int  $errorReportingLevel The level of error reporting you want
  * @param bool $displayErrors       Whether to display errors (for development) or just log them (for production)
  */
 public static function enable($errorReportingLevel = null, $displayErrors = true)
 {
     if (static::$enabled) {
         return;
     }
     static::$enabled = true;
     error_reporting(-1);
     ErrorHandler::register($errorReportingLevel, $displayErrors);
     if ('cli' !== PHP_SAPI) {
         ExceptionHandler::register();
         // CLI - display errors only if they're not already logged to STDERR
     } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
         ini_set('display_errors', 1);
     }
     if (class_exists('Symfony\\Component\\ClassLoader\\DebugClassLoader')) {
         DebugClassLoader::enable();
     }
 }
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:29,代码来源:Debug.php

示例11: enable

 public static function enable(array $enabled)
 {
     return static::$enabled = $enabled;
 }
开发者ID:matthieusieben,项目名称:sedra,代码行数:4,代码来源:Locale.php

示例12: enable

 /**
     Enables the debug output.
     @return null
     **/
 public static function enable()
 {
     static::$enabled = true;
 }
开发者ID:Griesbacher,项目名称:histou,代码行数:8,代码来源:debug.php

示例13: Disable

 public static function Disable()
 {
     static::$enabled = false;
 }
开发者ID:kuzmichus,项目名称:MQTTClient,代码行数:4,代码来源:spMQTTDebug.php

示例14: enable

 /**
  * {@inheritdoc}
  */
 public function enable()
 {
     static::$enabled = TRUE;
     return $this;
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:8,代码来源:SessionManager.php

示例15: unregister

 /**
  * @return void
  */
 public static function unregister()
 {
     restore_error_handler();
     static::$enabled = false;
     static::$callback = null;
 }
开发者ID:nguyen113,项目名称:Rai5,代码行数:9,代码来源:ErrorCatcher.php


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