Beispiel #1
0
 public function get($d = array())
 {
     parent::get($d);
     if (empty($this->_allTemplates)) {
         $directories = utilsBup::getDirList(BUP_TEMPLATES_DIR);
         if (!empty($directories)) {
             foreach ($directories as $code => $dir) {
                 if ($xml = utilsBup::getXml($dir['path'] . 'settings.xml')) {
                     $this->_allTemplates[$code] = $xml;
                     $this->_allTemplates[$code]->prevImg = BUP_TEMPLATES_PATH . $code . '/screenshot.png';
                 }
             }
         }
         if (is_dir(utilsBup::getCurrentWPThemeDir() . 'csp' . DS)) {
             if ($xml = utilsBup::getXml(utilsBup::getCurrentWPThemeDir() . 'csp' . DS . 'settings.xml')) {
                 $code = utilsBup::getCurrentWPThemeCode();
                 if (strpos($code, '/') !== false) {
                     // If theme is in sub-folder
                     $code = explode('/', $code);
                     $code = trim($code[count($code) - 1]);
                 }
                 $this->_allTemplates[$code] = $xml;
                 if (is_file(utilsBup::getCurrentWPThemeDir() . 'screenshot.jpg')) {
                     $this->_allTemplates[$code]->prevImg = utilsBup::getCurrentWPThemePath() . '/screenshot.jpg';
                 } else {
                     $this->_allTemplates[$code]->prevImg = utilsBup::getCurrentWPThemePath() . '/screenshot.png';
                 }
             }
         }
     }
     if (isset($d['code']) && isset($this->_allTemplates[$d['code']])) {
         return $this->_allTemplates[$d['code']];
     }
     return $this->_allTemplates;
 }
Beispiel #2
0
 private static function _getModulesFromXml($xmlPath)
 {
     if ($xml = utilsBup::getXml($xmlPath)) {
         if (isset($xml->modules) && isset($xml->modules->mod)) {
             $modules = array();
             $xmlMods = $xml->modules->children();
             foreach ($xmlMods->mod as $mod) {
                 $modules[] = $mod;
             }
             if (empty($modules)) {
                 errorsBup::push(langBup::_('No modules were found in XML file'), errorsBup::MOD_INSTALL);
             } else {
                 return $modules;
             }
         } else {
             errorsBup::push(langBup::_('Invalid XML file'), errorsBup::MOD_INSTALL);
         }
     } else {
         errorsBup::push(langBup::_('No XML file were found'), errorsBup::MOD_INSTALL);
     }
     return false;
 }