Esempio n. 1
0
File: Cli.php Progetto: sincco/sfphp
 public function __construct($url)
 {
     $_GET['url'] = $url;
     $_SERVER['SERVER_SOFTWARE'] = '';
     $_SERVER['REQUEST_METHOD'] = 'cli';
     $segments = Request::get();
     $segments = $segments['segments'];
     $_config = Reader::get('app');
     if (isset($_config['timezone'])) {
         date_default_timezone_set($_config['timezone']);
     }
     Debug::path(PATH_LOGS);
     Debug::reporting(DEV_SHOWERRORS);
     Debug::cli(1);
     $path = "";
     if (trim($segments['controller']) == "") {
         $segments['controller'] = "Index";
     }
     if (trim($segments['action']) == "") {
         $segments['action'] = "index";
     }
     if (trim($segments['module']) != "") {
         $path .= "\\{$segments['module']}";
     }
     $path .= "\\Controllers\\{$segments['controller']}";
     $objClass = $this->_loadClass($path, $segments['controller'] . "Controller");
     if (is_callable(array($objClass, $segments['action']))) {
         if (strtolower($segments['action']) != 'index') {
             call_user_func(array($objClass, $segments['action']));
         }
     } else {
         Debug::dump("ERROR :: No es posible lanzar " . implode("->", $segments));
     }
 }
Esempio n. 2
0
 public function __construct()
 {
     $_config = Reader::get('app');
     if (isset($_config['timezone'])) {
         date_default_timezone_set($_config['timezone']);
     }
     Debug::path(PATH_LOGS);
     Debug::reporting(DEV_SHOWERRORS);
     Plugger::dispatchGlobal('pre', 'ResolveUrl');
     $path = "";
     $segments = Request::get('segments');
     if (trim($segments['controller']) == "") {
         $segments['controller'] = "Index";
     }
     if (trim($segments['action']) == "") {
         $segments['action'] = "index";
     }
     if (trim($segments['module']) != "") {
         $path .= "\\{$segments['module']}";
     }
     $path .= "\\Controllers\\{$segments['controller']}";
     if (trim($segments['module']) != '') {
         $observer = $segments['module'] . '_' . $segments['controller'] . '_' . $segments['action'];
     } else {
         $observer = $segments['controller'] . '_' . $segments['action'];
     }
     $objClass = ClassLoader::load($path, $segments['controller'] . "Controller");
     if (is_callable(array($objClass, $segments['action']))) {
         Plugger::dispatchAction('pre', $observer);
         call_user_func(array($objClass, $segments['action']));
         Plugger::dispatchAction('post', $observer);
     } else {
         if (DEV_SHOWERRORS) {
             Debug::dump("ERROR :: No es posible lanzar " . implode("->", $segments));
         } else {
             new Response('htmlstatuscode', '404 Not Found');
         }
     }
 }
Esempio n. 3
0
 public function getRequest()
 {
     return Request::getInstance();
 }
Esempio n. 4
0
 public function getRequest()
 {
     return Request::get();
 }