Example #1
0
 /**
  * Checks whether the view exists
  *
  * @param string $view
  *
  * @return boolean
  */
 public static function exists($view)
 {
     if (App::views()->file($view . '.php')->exists() || App::views()->file($view . '.wow.php', 2)->exists()) {
         return true;
     }
     return false;
 }
Example #2
0
 /**
  * @param string $view
  * @param string|boolean $version
  */
 public function __construct($view, $version = false)
 {
     //view construct
     $this->_name = $view;
     //version
     $this->_version = $version;
     //get wow and php paths
     $wowPath = App::views()->file($view . '.wow.php', 2);
     $phpPath = App::views()->file($view . '.php');
     //check files
     if ($wowPath->exists()) {
         $this->_filePath = $wowPath;
         $this->_exists = true;
         $this->_isWow = true;
     } elseif ($phpPath->exists()) {
         $this->_filePath = $phpPath;
         $this->_exists = true;
         $this->_isWow = false;
     } else {
         $this->_exists = false;
     }
 }
Example #3
0
<?php

use application\core\App;
///////////////////
//VIEWS REGISTRY //
///////////////////
App::$views = array('index-view', 'map-view', 'header-view', 'details-view');
Example #4
0
<compile value="change+version" />');
    }
}, 'new:view');
/**
 * Creates a new view which extends a layout
 */
Workbench::register('^new:view ([a-zA-Z0-9\\_\\.]+) ([a-zA-Z0-9\\_\\.]+)$', function ($argv) {
    $name = $argv[1];
    $dot_pos = strrpos($name, '.');
    // get and check layout
    $layout = $argv[2];
    if (!Core\App::layouts()->file($layout . '.wow.php', 2)->exists()) {
        die('Layout does not exist');
    }
    if ($dot_pos !== false) {
        $dir = Core\App::views()->directory(substr($name, 0, $dot_pos));
        if (!$dir->exists()) {
            $dir->create();
        }
    }
    $view = Core\App::views()->file($name . '.wow.php', 2);
    if (Core\Wow::flavor() == Core\Wow::AT_SIGN) {
        $view->write('@version:1
@layout:' . $layout . '
@compile:change+version');
    } else {
        $view->write('<version value="1" />
<layout value="' . $layout . '" />
<compile value="change+version" />');
    }
});