Esempio n. 1
0
 /**
  * The Autoloader initialisation
  *
  * @return void
  */
 public static function _init()
 {
     // is the profiler enabled?
     if (!(static::$_enabled = ClanCats::$config->get('profiler.enabled'))) {
         return;
     }
     // enable profiling only in development mode
     if (ClanCats::in_development()) {
         // add a hook to the resposne so that we can
         // append a table with the profiler data to the body
         CCEvent::mind('response.output', function ($output) {
             if (strpos($output, '</body>') === false) {
                 return $output;
             }
             $table = \UI\Table::create(array('style' => array('width' => '100%'), 'cellpadding' => '5', 'class' => 'table debug-table debug-table-profiler'));
             $table->header(array('#', 'message', 'memory', 'time'));
             foreach (\CCProfiler::data() as $key => $item) {
                 $table->row(array($key + 1, $item[0], $item[1], $item[2]));
             }
             // add the table before the body end
             return str_replace('</body>', $table . "\n</body>", $output);
         });
         // also add an error inspector hook so that we can access the
         // profiler data in the error handler
         CCError_Inspector::info_callback('Profiler', function () {
             $table = array();
             foreach (\CCProfiler::data() as $key => $check) {
                 $table['#' . ($key + 1) . ': ' . $check[2]] = $check[0];
             }
             return $table;
         });
     }
 }
Esempio n. 2
0
 /**
  * start the ccf lifecycle
  *
  * this method sets the current environment, loads the configuration
  * and wakes the application
  *
  * @param string			$environment
  * @return void
  */
 public static function wake($environment)
 {
     if (!is_null(static::$environment)) {
         throw new CCException("ClanCats::wake - you cannot wake the application twice.");
     }
     // set environment
     static::$environment = $environment;
     // load the main configuration
     static::$config = CCConfig::create('main');
     // setup the application error tables
     CCError_Inspector::info_callback('ClanCatsFramework', function () {
         return array('Runtime Class' => \ClanCats::runtime(), 'CCF Version' => \ClanCats::version(), 'CCF Environment' => \ClanCats::environment(), 'Development env' => var_export(\ClanCats::in_development(), true), 'File extention' => EXT, 'Core namespace' => CCCORE_NAMESPACE);
     });
     CCError_Inspector::info_callback('CCF Paths', array('ClanCats', 'paths'));
     CCError_Inspector::info_callback('CCF Directories', array('ClanCats', 'directories'));
     CCError_Inspector::info_callback('Namespaces', function () {
         return \CCFinder::$namespaces;
     });
 }
Esempio n. 3
0
 /**
  * respond information to the user
  * 
  * @return void
  */
 public function respond()
 {
     echo "<h1>" . $this->inspector->message() . " <small>( " . $this->inspector->exception_name() . " )</small></h1>";
     echo "<pre>" . $this->inspector->exception()->getTraceAsString() . "</pre>";
 }