/** * @param $file * * @throws \Exception */ public static function construct($file) { if (file_exists($file)) { self::$xml = new SimpleXMLElement($file, 0, True); self::$file = $file; } else { if (file_put_contents($file, '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<config>' . "\n" . '</config>')) { self::$xml = new SimpleXMLElement($file, 0, True); self::$file = $file; } else { throw new Exception($file . ' dosyası oluşturulamıyor. Yazma izinlerini kontrol ediniz'); } } }
/** * @param $time * @param $controller */ public static function refreshcontroller($time, $controller) { header("Refresh:{$time};url=" . TP_system_config::read('site_address') . '/' . $controller); }
/** * @param $request * @return array * @throws Exception */ private function parseparams($request) { $parseparams = explode('/', $request); $findpath = $this->paths->xpath('/paths/path[.="' . $parseparams[0] . '"]'); if (isset($findpath[0])) { $path = $parseparams[0]; $class = isset($parseparams[1]) ? $parseparams[1] : TP_system_config::read('default_controller'); $function = isset($parseparams[2]) ? $parseparams[2] : 'index'; unset($parseparams[0], $parseparams[1], $parseparams[2]); $params = array_values($parseparams); } else { $path = Null; $class = isset($parseparams[0]) ? $parseparams[0] : TP_system_config::read('default_controller'); $function = isset($parseparams[1]) ? $parseparams[1] : 'index'; unset($parseparams[0], $parseparams[1]); $params = array_values($parseparams); } return array('path' => $path, 'class' => $class, 'function' => $function, 'params' => $params); }