當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。