Пример #1
0
 /**
  * Setup all variables values.
  */
 protected function __construct()
 {
     $current_dir = dirname(dirname(realpath(__DIR__)));
     $this->PATHS['root'] = $current_dir . DIRECTORY_SEPARATOR;
     if (!isset($_SERVER['CONTEXT_DOCUMENT_ROOT'])) {
         $this->URLS['relative'] = str_replace('\\', '/', str_replace(realpath($_SERVER['DOCUMENT_ROOT']), '', $current_dir . '/'));
     } else {
         $this->URLS['relative'] = $_SERVER['CONTEXT_PREFIX'] . str_replace(realpath($_SERVER['CONTEXT_DOCUMENT_ROOT']), '', $current_dir . '/');
         $this->URLS['relative'] = str_replace(DIRECTORY_SEPARATOR, '/', $this->URLS['relative']);
     }
     /* Check if the request is sent over HTTPS */
     $is_SSL = Core\Utils::httpRequestIsSsl();
     $port = null;
     if (isset($_SERVER['SERVER_PORT'])) {
         $port = in_array($_SERVER['SERVER_PORT'], array('80', '443', true)) ? null : $_SERVER['SERVER_PORT'];
     }
     $this->URLS['protocol'] = 'http' . ($is_SSL ? 's' : '');
     $this->URLS['full'] = null;
     if (isset($_SERVER['SERVER_NAME'])) {
         $this->URLS['full'] = $this->URLS['protocol'] . '://' . $_SERVER['SERVER_NAME'] . $port . $this->URLS['relative'];
     }
     $this->PATHS['vendor'] = $this->PATHS['root'] . 'vendor' . DIRECTORY_SEPARATOR;
     $this->PATHS['resources'] = $this->PATHS['root'] . 'resources' . DIRECTORY_SEPARATOR;
     $this->PATHS['tmp'] = $this->PATHS['root'] . 'temp' . DIRECTORY_SEPARATOR;
     $this->PATHS['cache'] = $this->PATHS['tmp'] . 'cache' . DIRECTORY_SEPARATOR;
     $this->PATHS['public'] = $this->PATHS['root'] . 'public' . DIRECTORY_SEPARATOR;
     $this->PATHS['views']['compiled'] = $this->PATHS['cache'] . 'compiled' . DIRECTORY_SEPARATOR;
     $this->PATHS['views']['cache'] = $this->PATHS['cache'] . 'views' . DIRECTORY_SEPARATOR;
     $this->PATHS['views']['config'] = $this->PATHS['root'] . 'configurations' . DIRECTORY_SEPARATOR . SILLA_ENVIRONMENT . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR;
     /* Process modes */
     $this->MODES = $this->setupModes($this->MODES);
     /* Default mode */
     $this->setMode($this->MODES[0]);
 }