Beispiel #1
0
 /**
  * Environment verification
  */
 private static function switchEnvironment()
 {
     if (defined('ENVIRONMENT')) {
         switch (ENVIRONMENT) {
             case 'Development':
                 error_reporting(E_ALL);
                 break;
             case 'Testing':
             case 'Production':
                 error_reporting(0);
                 break;
             default:
                 exit("Application environment not set correctly !");
         }
     }
     Log::debug("Application environment set to: " . ENVIRONMENT);
 }
Beispiel #2
0
 private function setUri()
 {
     $uri = isset(filter_input(INPUT_SERVER, URI_IDENTIFIER)) ? filter_input(INPUT_GET, URI_IDENTIFIER) : '';
     $this->uri = $uri;
     Log::debug("Uri set to: " . $this->uri);
 }
Beispiel #3
0
 private function setUri()
 {
     $uriString = filter_input(INPUT_GET, URI_IDENTIFIER);
     $uri = \is_null($uriString) ? '' : $uriString;
     $this->uri = $uri;
     Log::debug("Uri set to: " . $this->uri);
 }
Beispiel #4
0
 private function setAction()
 {
     if ($this->request->getSegment(1) == null or $this->request->getSegment(1) == '') {
         $this->setDefaultAction();
     } else {
         $this->action = $this->request->getSegment(1);
     }
     $actionRealName = strtolower($this->action) . 'Action';
     Log::debug("Action set to: " . $this->action);
     if (!method_exists($this->class, $actionRealName)) {
         $this->method = 'show404';
     } else {
         // o método existe, setamos as configurações da action atual:
         //$this->actionConfigs = $this->controllerConfigs['callables'][$this->action];
         //Verificando se o metodo pode ser chamado diretamente pela url ou é uma função fechada:
         if (array_key_exists($this->action, $this->controllerConfigs['callables']) and in_array($this->request->getRequestMethod(), $this->controllerConfigs['callables'][$this->action]['methods'])) {
             $this->method = $actionRealName;
             $this->actionConfigs = $this->controllerConfigs['callables'][$this->action];
         } else {
             $this->method = 'show404';
         }
     }
 }
Beispiel #5
0
 /**
  * setTablet
  *
  * Define o dispositivo do tipo tablet utilizado pelo usuário, caso haja algum identificado.
  *
  * @access private
  */
 private function setTablet()
 {
     if (is_array($this->tablets) and count($this->tablets) > 0) {
         foreach ($this->tablets as $k => $v) {
             if (preg_match('|' . preg_quote($k) . '|i', $this->agent)) {
                 $this->isTablet = true;
                 $this->tablet = $v;
                 break;
             } else {
                 $this->tablet = "Unknown tablet";
             }
         }
     } else {
         $this->tablet = "Unknown tablet";
     }
     if ($this->isTablet) {
         Log::debug("Tablet: " . $this->tablet);
     }
 }