Example #1
0
 /**
  * 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();
 }
Example #2
0
 /**
  * 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;
 }
Example #3
0
 public static function disable()
 {
     if (!static::$enabled) {
         return;
     }
     static::$enabled = false;
     error_reporting(0);
 }
Example #4
0
 /**
  * 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;
 }
Example #5
0
 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);
 }
Example #6
0
 /**
  * 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);
 }
Example #7
0
 /**
  * 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);
         }
     }
 }
Example #8
0
 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();
 }
Example #9
0
 /**
  * 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();
 }
Example #10
0
 /**
  * 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 integer $errorReportingLevel The level of error reporting you want
  */
 public static function enable($errorReportingLevel = null)
 {
     if (static::$enabled) {
         return;
     }
     static::$enabled = true;
     error_reporting(-1);
     ErrorHandler::register($errorReportingLevel);
     if ('cli' !== php_sapi_name()) {
         ExceptionHandler::register();
     } elseif (!ini_get('log_errors') || ini_get('error_log')) {
         ini_set('display_errors', 1);
     }
     if (class_exists('Symfony\\Component\\ClassLoader\\DebugClassLoader')) {
         DebugClassLoader::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();
     }
 }
Example #12
0
 public static function enable(array $enabled)
 {
     return static::$enabled = $enabled;
 }
Example #13
0
 /**
     Enables the debug output.
     @return null
     **/
 public static function enable()
 {
     static::$enabled = true;
 }
Example #14
0
 public static function Disable()
 {
     static::$enabled = false;
 }
Example #15
0
 /**
  * {@inheritdoc}
  */
 public function enable()
 {
     static::$enabled = TRUE;
     return $this;
 }
Example #16
0
 /**
  * @return void
  */
 public static function unregister()
 {
     restore_error_handler();
     static::$enabled = false;
     static::$callback = null;
 }
Example #17
0
 protected static function isEnabled()
 {
     if (null === static::$enabled) {
         $db = JFactory::getDbo();
         $db->setQuery('Select enabled From #__extensions Where name=' . $db->quote('com_weblinks'));
         static::$enabled = (bool) $db->loadResult();
     }
     return static::$enabled;
 }
Example #18
0
 /**
  * Set whether TODO expiration functionality is enabled.
  *
  * @param boolean $enabled
  */
 public static function setEnabled($enabled)
 {
     static::$enabled = $enabled;
 }
Example #19
0
 /**
  * Returns/Set master switch on cache.
  *
  * @method enabled
  *
  * @param  boolean  $enabled Enable/Disable the cache status.
  *
  * @return boolean  Cache on/off status
  */
 public static function enabled($enabled = null)
 {
     return $enabled ? static::$enabled : (static::$enabled = $enabled);
 }
Example #20
0
 /**
  * Disable logging (enabled by default)
  **/
 static function DisableLog()
 {
     static::$enabled = false;
 }