Пример #1
0
 /**
  *
  */
 protected function _loadAdminJs()
 {
     $adminJsPath = $this->_pathinfo->getRootJs() . 'admin.js';
     if (file_exists($adminJsPath)) {
         $handle = $this->getId() . '-' . 'admin-js';
         IfwPsn_Wp_Proxy_Script::loadAdmin($handle, $this->_env->getUrlJs() . 'admin.js', array(), $this->getVersion());
     }
 }
Пример #2
0
 /**
  * @return array
  */
 public function getModules()
 {
     require_once $this->_pm->getPathinfo()->getRootLib() . '/IfwPsn/Wp/Pathinfo/Module.php';
     require_once $this->_pm->getPathinfo()->getRootLib() . '/IfwPsn/Wp/Env/Module.php';
     if (empty($this->_modules) && !empty($this->_locations)) {
         // loop through module locations
         foreach ($this->_locations as $locationName => $location) {
             // get all subdirs
             foreach ($this->_getModulesDirnames($location) as $moduleDir) {
                 try {
                     // check if it is a valid module
                     if ($this->_isValidModule($moduleDir, $location, $locationName)) {
                         // try to instantiate module object
                         $className = $this->_getModuleClassName($moduleDir);
                         $modulePathinfo = new IfwPsn_Wp_Pathinfo_Module($this->_getModuleBootstrapPath($moduleDir, $location));
                         $mod = new $className($modulePathinfo, $locationName, $this->_pm);
                         // init module environment
                         $moduleEnv = IfwPsn_Wp_Env_Module::getInstance($modulePathinfo, $mod, $this->getCustomModulesLocationName());
                         $mod->setEnv($moduleEnv);
                         if (!isset($this->_modules[$mod->getId()])) {
                             $this->_modules[$mod->getId()] = $mod;
                         }
                         //array_push($this->_modules, $mod);
                     } else {
                         $this->_pm->getLogger()->err('Invalid module: ' . $moduleDir);
                     }
                 } catch (IfwPsn_Wp_Module_Exception $e) {
                     $this->_pm->getLogger()->err('Module error: ' . $e->getMessage());
                 } catch (Exception $e) {
                     $this->_pm->getLogger()->err('Unexpected exception in module "' . $moduleDir . '":' . $e->getMessage());
                 }
             }
             // end inner foreach
         }
         // end outer foreach
     }
     return $this->_modules;
 }