public static function load($controlName = '', $funcName = 'index')
 {
     // $funcOfController = '';
     if (preg_match('/(\\w+)\\@(\\w+)/i', $controlName, $matchesName)) {
         $controlName = $matchesName[1];
         // $funcOfController = $matchesName[2];
         $funcName = $matchesName[2];
     }
     // $path = CONTROLLERS_PATH . $controlName . '.php';
     $path = self::getPath() . $controlName . '.php';
     if (!file_exists($path)) {
         Response::headerCode(404);
         Log::warning('Controller <b>' . $controlName . '</b> not exists.');
     }
     include $path;
     if (preg_match('/.*?\\/(\\w+)$/i', $controlName, $matches)) {
         $controlName = $matches[1];
     }
     $load = new $controlName();
     if (!isset($funcName[0])) {
         $funcName = 'index';
     }
     $funcName = $funcName == 'index' ? $funcName : 'get' . ucfirst($funcName);
     if (!method_exists($load, $funcName)) {
         Response::headerCode(404);
         Log::warning('Function <b>' . $funcName . '</b> not exists inside controller <b>' . $controlName . '</b> .');
     }
     $load->{$funcName}();
 }
Example #2
0
 public static function make($alertMessage = '')
 {
     ob_end_clean();
     Response::headerCode(404);
     View::make('alert', array('alert' => $alertMessage));
     die;
 }
Example #3
0
 public static function to($reUrl = '', $code = 0)
 {
     $url = $reUrl;
     if (!preg_match('/http/i', $reUrl)) {
         $url = ROOT_URL . $reUrl;
     }
     if ((int) $code > 0) {
         Response::headerCode($code);
     }
     header("Location: " . $url);
     die;
 }