Ejemplo n.º 1
0
 /**
  * Constructor
  *
  * @param Norm\Cursor $entries Entries that we want to page
  */
 public function __construct(Cursor $entries)
 {
     $this->entries = $entries;
     $this->app = App::getInstance();
     $configCollection = $this->app->config('norm.collections');
     if (isset($configCollection['default'])) {
         if (isset($configCollection['default']['limit'])) {
             $this->limit = $configCollection['default']['limit'];
         }
     }
     $this->baseUrl = URL::current();
 }
Ejemplo n.º 2
0
 /**
  * Get specific view of this theme, I use Blade View Engine
  *
  * @return KrisanAlfa\Blade\BladeView
  */
 public function getView()
 {
     if (is_null($this->view)) {
         $appPath = $this->app->config('app.path');
         if (!is_null($appPath)) {
             $this->options['cachePath'] = $appPath . DIRECTORY_SEPARATOR . $this->options['cachePath'];
         }
         if (!is_dir($this->options['cachePath'])) {
             mkdir($this->options['cachePath'], 0755, true);
         }
         $this->options['viewPaths'] = $this->arrayFlatten($this->baseDirectories);
         $this->view = new BladeView($this->options);
     }
     return $this->view;
 }
Ejemplo n.º 3
0
 /**
  * Merge configuration from application and given configuration file path
  *
  * @param string $path Path of configuration file
  *
  * @return void
  */
 protected function mergeConfig($path)
 {
     // Only do if configuration file is readable
     if (is_readable($path)) {
         $config = (require_once $path);
         // Only do if configuration file return an array
         if (is_array($config)) {
             foreach ($config as $key => $value) {
                 // Only do if value is not empty and not null
                 if ($value) {
                     $this->app->config($key, $value);
                 }
             }
         }
     }
 }