本文整理汇总了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();
}
示例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;
}
示例3: disable
public static function disable()
{
if (!static::$enabled) {
return;
}
static::$enabled = false;
error_reporting(0);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
}
示例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();
}
示例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();
}
示例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();
}
}
示例11: enable
public static function enable(array $enabled)
{
return static::$enabled = $enabled;
}
示例12: enable
/**
Enables the debug output.
@return null
**/
public static function enable()
{
static::$enabled = true;
}
示例13: Disable
public static function Disable()
{
static::$enabled = false;
}
示例14: enable
/**
* {@inheritdoc}
*/
public function enable()
{
static::$enabled = TRUE;
return $this;
}
示例15: unregister
/**
* @return void
*/
public static function unregister()
{
restore_error_handler();
static::$enabled = false;
static::$callback = null;
}