本文整理汇总了PHP中UTIL_String::xmlToArray方法的典型用法代码示例。如果您正苦于以下问题:PHP UTIL_String::xmlToArray方法的具体用法?PHP UTIL_String::xmlToArray怎么用?PHP UTIL_String::xmlToArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UTIL_String
的用法示例。
在下文中一共展示了UTIL_String::xmlToArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getThemeXmlInfo
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: getThemeXmlInfo
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;
}