/** * Execute the console command. * * @return mixed */ public function handle() { if ($classname = $this->argument('name')) { $classname = ucfirst($classname); $template = $this->getTemplateDir() . $this->templateName; if (file_exists($template)) { if (file_exists(ModelCore::getModelDirectory())) { $text = str_replace($this->mergeCode, $classname, file_get_contents($template)); $tableDefine = $this->option('table') ? 'protected $table = \'' . $this->option('table') . '\';' : ''; $text = str_replace('{table-define}', $tableDefine, $text); $path = ModelCore::getModelDirectory() . $classname . $this->suffix . $this->ext; if (!file_exists($path)) { if (false == file_put_contents($path, $text)) { $this->error('Can\'t write file to ' . ControllerCore::getControllerDirectory() . $path); } else { chmod($path, 0766); $this->info($classname . ' Model class created.'); } } else { $this->error($classname . ' already exist'); } } else { $this->error('Model class directory not found ' . ControllerCore::getControllerDirectory()); } } else { $this->error('Model class template not found ' . $template); } } }
public function __construct() { $this->profiler[] = $this->stamp('config'); parent::__construct(); $this->profiler[] = $this->stamp('__construct'); }
public function __construct() { parent::__construct(); // error management set_error_handler('developpementErrorHandler'); ini_set('html_errors', 'on'); ini_set('display_errors', 'on'); error_reporting(E_ALL | E_STRICT); if (!self::$_footer) { return; } $this->_memory['config'] = memory_get_usage(); $this->_time['config'] = microtime(true); parent::__construct(); $this->_memory['constructor'] = memory_get_usage(); $this->_time['constructor'] = microtime(true); }
/** * Set the layout * @param CAction $action * @return boolean whether this process is succceded */ public function beforeAction($action) { $this->layout = '//layouts/parent-raw'; return parent::beforeAction($action); }
public function preStart() { parent::preStart(); }
public function start() { parent::start(); }
public function __construct() { if (!self::$_footer) { return; } $this->_memory['config'] = memory_get_usage(); $this->_mempeak['config'] = memory_get_peak_usage(); $this->_time['config'] = microtime(true); parent::__construct(); $this->_memory['constructor'] = memory_get_usage(); $this->_mempeak['constructor'] = memory_get_peak_usage(); $this->_time['constructor'] = microtime(true); }
public function addMedia() { parent::addMedia(); }
public function run() { if (!class_exists('DebugToolbar')) { return parent::run(); } if (!DebugToolbar::isEnable()) { return parent::run(); } $this->init(); $this->_memory['init'] = memory_get_usage(); $this->_mempeak['init'] = memory_get_peak_usage(); $this->_time['init'] = microtime(true); if ($this->checkAccess()) { $this->_memory['checkAccess'] = memory_get_usage(); $this->_mempeak['checkAccess'] = memory_get_peak_usage(); $this->_time['checkAccess'] = microtime(true); if (!$this->content_only && ($this->display_header || isset($this->className) && $this->className)) { $this->setMedia(); } $this->_memory['setMedia'] = memory_get_usage(); $this->_mempeak['setMedia'] = memory_get_peak_usage(); $this->_time['setMedia'] = microtime(true); // postProcess handles ajaxProcess $this->postProcess(); $this->_memory['postProcess'] = memory_get_usage(); $this->_mempeak['postProcess'] = memory_get_peak_usage(); $this->_time['postProcess'] = microtime(true); if (!empty($this->redirect_after)) { $this->redirect(); } if (!$this->content_only && ($this->display_header || isset($this->className) && $this->className)) { $this->initHeader(); } $this->_memory['initHeader'] = memory_get_usage(); $this->_mempeak['initHeader'] = memory_get_peak_usage(); $this->_time['initHeader'] = microtime(true); $this->initContent(); $this->_memory['initContent'] = memory_get_usage(); $this->_mempeak['initContent'] = memory_get_peak_usage(); $this->_time['initContent'] = microtime(true); if (!$this->content_only && ($this->display_footer || isset($this->className) && $this->className)) { $this->initFooter(); } $this->_memory['initFooter'] = memory_get_usage(); $this->_mempeak['initFooter'] = memory_get_peak_usage(); $this->_time['initFooter'] = microtime(true); // default behavior for ajax process is to use $_POST[action] or $_GET[action] // then using displayAjax[action] if ($this->ajax) { $action = Tools::getValue('action'); if (!empty($action) && method_exists($this, 'displayAjax' . Tools::toCamelCase($action))) { $this->{'displayAjax' . $action}(); } elseif (method_exists($this, 'displayAjax')) { $this->displayAjax(); } } else { $this->displayDebug(); } } else { $this->initCursedPage(); $this->displayDebug(); } }