本文整理匯總了PHP中CFileman::GetMenuArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP CFileman::GetMenuArray方法的具體用法?PHP CFileman::GetMenuArray怎麽用?PHP CFileman::GetMenuArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CFileman
的用法示例。
在下文中一共展示了CFileman::GetMenuArray方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: BXDeleteFromMenuFile
function BXDeleteFromMenuFile($menuFile, $documentRoot, $site, $path)
{
$aMenuLinks = array();
$arMenu = CFileman::GetMenuArray($documentRoot . $menuFile);
if (empty($arMenu["aMenuLinks"])) {
return false;
}
$arFound = false;
foreach ($arMenu["aMenuLinks"] as $menuIndex => $arItem) {
if (!isset($arItem[1])) {
continue;
}
$menuLink = $arItem[1];
$position = strpos($menuLink, "?");
if ($position !== false) {
$menuLink = substr($menuLink, 0, $position);
}
if ($menuLink != "/") {
$menuLink = rtrim($menuLink, "/");
}
$filename = basename($path);
$dirName = str_replace("\\", "/", dirname($path));
if ($menuLink == $path || $filename == "index.php" && $menuLink == $dirName) {
$arFound = array('menuFile' => $menuFile, 'menuIndex' => $menuIndex, 'menuItem' => $arItem);
unset($arMenu["aMenuLinks"][$menuIndex]);
}
}
if ($arFound) {
CFileMan::SaveMenu(array($site, $menuFile), $arMenu["aMenuLinks"], $arMenu["sMenuTemplate"]);
if (COption::GetOptionString($module_id, "log_page", "Y") == "Y") {
$res_log = array();
$mt = COption::GetOptionString("fileman", "menutypes", $default_value, $site);
$mt = unserialize(str_replace("\\", "", $mt));
$res_log['menu_name'] = $mt[$menuType];
$res_log['path'] = substr($dirName, 1);
CEventLog::Log("content", "MENU_EDIT", "main", "", serialize($res_log));
}
}
return $arFound;
}
示例2: UndoNewSection
function UndoNewSection($Params, $type)
{
$io = CBXVirtualIo::GetInstance();
if (strlen($Params['path']) > 0 && $Params['path'] != "/" && $io->DirectoryExists($Params['absPath'])) {
CFileman::DeleteEx(array($Params['site'], $Params['path']));
}
$documentRoot = CSite::GetSiteDocRoot($Params['site']);
// Find and clean file from menu
if ($Params['menu']) {
$arMenu = CFileman::GetMenuArray($documentRoot . $Params['menu']['menuFile']);
if (!empty($arMenu["aMenuLinks"])) {
$found = false;
foreach ($arMenu["aMenuLinks"] as $menuIndex => $arItem) {
if ($arItem[1] == $Params['menu']['menuPath'] && $arItem[0] == $Params['menu']['menuName']) {
unset($arMenu["aMenuLinks"][$menuIndex]);
$found = true;
break;
}
}
if ($found) {
CFileMan::SaveMenu(array($Params['site'], $Params['menu']['menuFile']), $arMenu["aMenuLinks"], $arMenu["sMenuTemplate"]);
}
}
}
}