public function render()
 {
     $viewFilePath = App::basePath() . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . $this->_viewPath . '.phtml';
     if (!file_exists($viewFilePath)) {
         trigger_error('View file not found: "' . $viewFilePath . '"');
         return false;
     }
     ob_start();
     include $viewFilePath;
     return ob_get_clean();
 }
 /**
  * Check for class definition exists
  * @param $className
  * @return bool true if definition found, false otherwise
  */
 public function classDefined($className)
 {
     if ('App' == substr($className, 0, 3)) {
         // base classes are in '/app' folder
         $classPath = App::basePath() . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . $className . '.php';
         return file_exists($classPath);
     } elseif (isset($this->_classMap[$className])) {
         // other classes must be imported
         $classPath = $this->_classMap[$className];
         return file_exists($classPath);
     }
     return false;
 }
 /**
  * Send HTTP 404 Page Not Found response
  */
 public function sendNotFound()
 {
     $this->_responseCode = '404 ' . $this->getHttpHeader(404);
     echo include_once App::basePath() . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'error' . DIRECTORY_SEPARATOR . '404.phtml';
 }
Esempio n. 4
0
 /**
  * @covers \Phix\App::basePath
  */
 public function testBasePathAutoDiscoveryWithPhpFile()
 {
     $_SERVER['HTTP_HOST'] = 'localhost';
     $_SERVER['REQUEST_URI'] = '/dir/action';
     $_SERVER['PHP_SELF'] = '/dir/index.php';
     $_SERVER['SCRIPT_FILENAME'] = '/var/web/dir/index.php';
     $app = new App();
     $this->assertEquals('/dir', $app->basePath(), $app->basePath());
 }
Esempio n. 5
0
<?php

return ['paths' => [realpath(App::basePath('resources/views'))], 'compiled' => realpath(App::storagePath('framework/views'))];
Esempio n. 6
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    $path = env('debug', false) ? './public/index.html' : './dist/index.html';
    return File::get(\App::basePath() . $path);
});
Esempio n. 7
0
 /**
  * Renvoie le chemin d'accès au répertoire où sont stockées les images de l'objet.
  * Il s'agit ici d'un chemin relatif par rapport au répertoire public
  *
  * @param bool   $absolute
  * @param string $sep Séparateur pour les répertoires
  * @return string
  */
 public function imagesDirectoryPath($absolute = false, $sep = DIRECTORY_SEPARATOR)
 {
     $pathPrefix = $absolute ? \App::basePath() . $sep . config('app.public_path') . $sep : "";
     return $pathPrefix . config('app.directories.images') . $sep . $this->images_directory_name;
 }