Ejemplo n.º 1
0
 /**
  * error class init
  *
  * @return void
  */
 public static function _init()
 {
     // we capture non fatal errors only in dev environments
     if (ClanCats::in_development()) {
         // add a hook to the main resposne
         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-errors'));
             $table->header(array('#', 'message', 'file'));
             foreach (\CCError::$non_fatals as $key => $item) {
                 $table->row(array($key + 1, $item->getMessage(), CCStr::strip($item->getFile(), CCROOT) . ':' . $item->getLine()));
             }
             return str_replace('</body>', $table . "\n</body>", $output);
         });
     }
 }
Ejemplo n.º 2
0
 /**
  * test string strip
  */
 public function testStrip()
 {
     $this->assertEquals(CCStr::strip('hellotestworld', 'test'), 'helloworld');
 }
Ejemplo n.º 3
0
 /**
  * install a ship
  *
  * string 	$path | the ship name / the folder. If the path is not absolute, ORBITPATH gets used
  */
 public static function install($path)
 {
     // load ship at path
     $ship = CCOrbit_Ship::create($path);
     if (static::$data->has('installed.' . $ship->name)) {
         throw new CCException("CCOrbit::install - {$ship->name} ship already installed.");
     }
     if ($ship->install !== false) {
         $ship->event($ship->install);
     }
     static::$data->set('installed.' . $ship->name, CCStr::strip($ship->path, CCROOT));
     // save changes
     static::$data->write('json');
 }