示例#1
0
 public function getThemeXmlInfo($name)
 {
     $filePath = OW_DIR_THEME . trim($name) . DS . self::MANIFEST_FILE;
     if (!file_exists($filePath)) {
         return;
     }
     return UTIL_String::xmlToArray(file_get_contents($filePath));
 }
示例#2
0
 private function getThemeXmlInfo($themeXmlPath)
 {
     if (!file_exists($themeXmlPath)) {
         OW::getLogger()->addEntry(__CLASS__ . "::" . __FUNCTION__ . " - `" . $themeXmlPath . "` not found");
         return null;
     }
     //$propList = array("key", "developerKey", "name", "description", "license", "author", "build", "copyright", "licenseUrl");
     $propList = array("key", "name", "description");
     $xmlInfo = UTIL_String::xmlToArray(file_get_contents($themeXmlPath));
     //TODO refactor
     if (empty($xmlInfo["developerKey"])) {
         $xmlInfo["developerKey"] = null;
     }
     if (empty($xmlInfo["build"])) {
         $xmlInfo["build"] = 0;
     }
     if (!$xmlInfo) {
         OW::getLogger()->addEntry(__CLASS__ . "::" . __FUNCTION__ . " - invalid `" . $themeXmlPath . "`");
         return null;
     }
     foreach ($propList as $prop) {
         if (empty($xmlInfo[$prop])) {
             OW::getLogger()->addEntry(__CLASS__ . "::" . __FUNCTION__ . " - in `" . $themeXmlPath . "` property `" . $prop . "` not found");
             return null;
         }
     }
     $sidebarPositions = array(BOL_ThemeDao::VALUE_SIDEBAR_POSITION_LEFT, BOL_ThemeDao::VALUE_SIDEBAR_POSITION_RIGHT, BOL_ThemeDao::VALUE_SIDEBAR_POSITION_NONE);
     if (empty($xmlInfo["sidebarPosition"]) || !in_array($xmlInfo["sidebarPosition"], $sidebarPositions)) {
         $xmlInfo["sidebarPosition"] = BOL_ThemeDao::VALUE_SIDEBAR_POSITION_NONE;
     }
     $xmlInfo["build"] = (int) $xmlInfo["build"];
     return $xmlInfo;
 }