예제 #1
0
 /**
  * Installs a new downloaded or deployed model under POKELIO_MODULES_PATH
  * 
  * @param string $moduleName Name of the module to be installed
  */
 public static function installModule($moduleName)
 {
     //Are installations allowed?
     if (_::getConfig('ALLOW_INSTALLATIONS') === true) {
         //Do the module folder exists?
         if (file_exists(POKELIO_MODULES_PATH . '/' . $moduleName)) {
             //Do Install.php file exists?
             if (file_exists(POKELIO_MODULES_PATH . '/' . $moduleName . '/Install/Install.php')) {
                 //Invoke installation script for module
                 if (is_callable($moduleName . "_Install::execute")) {
                     $success = call_user_func($moduleName . "_Install::execute");
                     if ($success == true) {
                         self::successInstall($moduleName);
                     } else {
                         self::failedInstall($moduleName);
                     }
                 } else {
                     _::abort("Corrupted Install class of module " . $moduleName);
                 }
             } else {
                 _::abort("Corrupted (or already deployed) module. (Install.php does not exist)");
             }
         } else {
             _::abort("Module folder " . $moduleName . " does not exist under " . POKELIO_MODULES_PATH);
         }
     } else {
         _::abort("Installations are not allowed. Check Pokelio configuration file.");
     }
 }
예제 #2
0
 public static function deployVendors()
 {
     $webRscPath = realpath(_::getConfig("WEB_RSC_PATH"));
     if (file_exists(POKELIO_ROOT_PATH . '/Vendors')) {
         Pokelio_File::makedir($webRscPath . '/Vendors');
         Pokelio_File::copyDir(POKELIO_ROOT_PATH . '/Vendors', $webRscPath . '/Vendors');
     }
 }
예제 #3
0
 public function __construct()
 {
     $this->vars['rscUrl'] = _::getConfig("WEB_RSC_URL");
     $this->vars['htmlCss'] = array();
     $this->vars['htmlJs'] = array();
     $this->vars['htmlLang'] = _::getConfig('HTML')->lang;
     $this->vars['htmlCharset'] = _::getConfig('HTML')->charset;
 }
예제 #4
0
 private function extractParts()
 {
     $path = str_replace('\\', '/', $this->child);
     $parts = explode("/", $path);
     $trailPart = strlen($parts[sizeof($parts) - 1]) + strlen($parts[sizeof($parts) - 2]) + strlen($parts[sizeof($parts) - 3]) + 3;
     $this->modulePath = substr($this->child, 0, -$trailPart);
     $this->moduleName = $parts[sizeof($parts) - 3];
     if ($this->modulePath == POKELIO_MODULES_PATH) {
         $this->isPokelioModule == true;
         $this->rscUrl = _::getConfig("WEB_RSC_URL") . '/Pokelio/' . $this->moduleName;
     } else {
         $this->isPokelioModule == false;
         $this->rscUrl = _::getConfig("WEB_RSC_URL") . '/App/' . $this->moduleName;
     }
 }
예제 #5
0
 public static function view($templateSrc, $templateName, $moduleName)
 {
     $viewPath = _::getConfig("APP_VIEW_PATH");
     $cache = _::getConfig('USYNTAX_CACHE');
     $viewFile = $templateSrc;
     Pokelio_File::makedir($viewPath . '/' . $moduleName);
     $procViewFile = $viewPath . '/' . $moduleName . '/' . $templateName . 'Template.php';
     if (file_exists($procViewFile)) {
         if (filemtime($viewFile) > filemtime($procViewFile) || $cache == false) {
             self::processView($viewFile, $procViewFile);
         }
     } else {
         self::processView($viewFile, $procViewFile);
     }
     return $procViewFile;
 }
 protected function renderTemplate($templateName, $header = null, $footer = null)
 {
     //Get, if necessary, the default header and/or footer
     if ($header == null) {
         $header = _::getConfig('DEFAULT_HEADER_TEMPLATE_NAME');
     }
     if ($footer == null) {
         $footer = _::getConfig('DEFAULT_FOOTER_TEMPLATE_NAME');
     }
     //Import variables from varStore
     extract($this->view->getVars());
     //Initialize ouput buffer
     ob_start();
     //Require header file if specified
     if ($header != "") {
         $templateSrc = APP_TEMPLATE_PATH . '/' . $header . 'Template.php';
         if (_::getConfig('USE_USYNTAX')) {
             $view = Pokelio_uSyntax::view($templateSrc, $header, 'App');
         }
         require $view;
     }
     //Require JSEnabler if JSVar array contains variables
     $jsVars = $this->view->getJSVars();
     if (sizeof($jsVars) > 0) {
         $JSEnabler = APP_TEMPLATE_PATH . '/JSEnablerTemplate.php';
         require $JSEnabler;
     }
     //Require template file
     $template = _::getConfig('APP_VIEW_PATH') . '/' . $templateName . 'Template.php';
     $templateSrc = $this->modulePath . '/' . $this->moduleName . '/Template/' . $templateName . 'Template.php';
     if (_::getConfig('USE_USYNTAX')) {
         $view = Pokelio_uSyntax::view($templateSrc, $templateName, $this->moduleName);
     }
     require $view;
     //Require footer file if specified
     if ($footer != "") {
         $templateSrc = APP_TEMPLATE_PATH . '/' . $footer . 'Template.php';
         if (_::getConfig('USE_USYNTAX')) {
             $view = Pokelio_uSyntax::view($templateSrc, $footer, 'App');
         }
         require $view;
     }
     //Display buffered content and clean buffer
     $output = ob_get_clean();
     echo $output;
 }