Exemple #1
0
 public static function pathViews()
 {
     $path = 'resources/views/';
     if (property_exists(App::appConf(), 'pathViews')) {
         $path = App::appConf()->pathViews;
     }
     return App::appPath() . '/' . $path;
 }
Exemple #2
0
 /**
  * Initialise the application
  * 
  * @return void
  */
 public static function init()
 {
     // Instantiate the application
     $app = Application::fromCwd();
     // Give proxies an instance of the application
     $app->initializeProxies();
     // Boot the app
     $app->boot();
     static::$appPath = \App::appPath();
     static::$vendorPath = \App::vendorPath();
     if (defined('COMPILING')) {
         static::$appPath = BUILD_PATH . '/app';
         static::$vendorPath = BUILD_PATH . '/vendor';
     }
 }
Exemple #3
0
 /**
  * check if the application is opened. If not, it displays the yourapp/install/closed.html
  * file with an http error (or Jelix/Core/closed.html), and exit.
  * This function should be called in all entry point, before the creation of the coordinator.
  * @see Jelix\Core\AppManager
  */
 public static function errorIfAppClosed()
 {
     if (!App::isInit()) {
         if (!\jServer::isCLI()) {
             header("HTTP/1.1 500 Application not available");
             header('Content-type: text/html');
         }
         echo "Jelix App is not initialized!";
         exit(1);
     }
     if (!self::isOpened()) {
         $message = file_get_contents(App::configPath('CLOSED'));
         if (\jServer::isCLI()) {
             echo "Application closed." . ($message ? "\n{$message}\n" : "\n");
             exit(1);
         }
         if (file_exists(App::appPath('install/closed.html'))) {
             $file = App::appPath('install/closed.html');
         } else {
             $file = __DIR__ . '/closed.html';
         }
         header("HTTP/1.1 500 Application not available");
         header('Content-type: text/html');
         echo str_replace('%message%', $message, file_get_contents($file));
         exit(1);
     }
 }
Exemple #4
0
 protected function loadRoutes()
 {
     require App::appPath() . '/routes.php';
 }