/** * Configuration settings file (must return array) to object * * @param string $file_path * @param boolean $store * @return mixed */ function conf($file_path = null, $store = true) { if (!func_num_args()) { return System::conf(); } return System::conf($file_path, $store); }
/** * Display template file * * @param string $template * @return void */ public function display($template) { // format template name $template = rtrim(System::conf()->__eco__->path->template, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . preg_replace('/[^\\w\\-\\.\\/\\\\]{1}/', '#', $template) . '.tpl'; if (!is_file($template)) { System::error('Template file does not exist \'' . $template . '\'', null, 'Eco'); return; } extract($this->__param, EXTR_OVERWRITE); include $template; // display template file System::log()->debug('View template file loaded \'' . $template . '\''); }
/** * Add log entry * * @param string $message * @param string $category * @param int $level * @param mixed $info * @return void */ private function __add($message, $category, $level, $info) { if ($level < self::LOG_NONE && $level <= System::conf()->__eco__->log->level) { if ($this->__handler !== null) { $handler = $this->__handler; if ($handler($message, $level, $category, $info) !== true) { return; // handled } } if (count($this->__log) > self::MAX_ENTRIES) { array_shift($this->__log); } $this->__id++; $this->__log[$this->__id] = ['message' => $message, 'category' => $category, 'level' => $level]; if ($info !== null) { $this->__log[$this->__id]['info'] = $info; } } }
/** * Class loader * * @param string $class * @param string $type * @return boolean (false on load fail) */ private function __classLoad($class, $type) { $class_path = System::conf()->__eco__->path->controller . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php'; if (class_exists($class, false)) { return true; } if (is_file($class_path)) { require_once $class_path; $class = $this->__classFormat($class); if (class_exists($class)) { System::log()->debug($type . ' class \'' . $class . '\' loaded from \'' . $class_path . '\'', 'Eco'); return true; } System::error('Class \'' . $class . '\' does not exist in class file \'' . $class_path . '\'', null, 'Eco'); } else { System::error('Class path does not exist \'' . $class_path . '\'', null, 'Eco'); } return false; }