本文整理汇总了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"]);
}
}
}
}