本文整理汇总了PHP中EBR::appendItemIdToQueryString方法的典型用法代码示例。如果您正苦于以下问题:PHP EBR::appendItemIdToQueryString方法的具体用法?PHP EBR::appendItemIdToQueryString怎么用?PHP EBR::appendItemIdToQueryString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EBR
的用法示例。
在下文中一共展示了EBR::appendItemIdToQueryString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _
//.........这里部分代码省略.........
$dropSegment = false;
// Legacy settings for "use current active menu"
if ($behavior == 'currentactive' && !$isCanonical) {
// Get the current active menu
$active = $app->getMenu()->getActive();
if ($active) {
$itemId = $active->id;
}
}
// Legacy settings for "use menu id"
if ($behavior == 'menuitemid' && !$isCanonical) {
// Get the menu id from the settings
$itemId = $config->get('main_routing_itemid');
}
// Default routing behavior
if ($behavior == 'default') {
// The default menu in the event we can't find anything for the url
$defaultMenu = EBR::getMenus('latest');
// Entry view needs to be treated differently.
if ($view == 'entry') {
// Respect which settings the user configured
$respectView = $config->get('main_routing_entry');
// Entry view has higher precedence over all
$menu = EBR::getMenus('entry', 'entry', $id);
if ($menu) {
$dropSegment = true;
} else {
// Get the post data from the cache
$postCache = EB::cache();
$post = $postCache->get($id, 'post');
// Get the category the post is created in
if ($respectView == 'categories') {
$menu = EBR::getMenus('categories', 'listings', $post->category_id);
}
if ($respectView == 'blogger') {
$menu = EBR::getMenus('blogger', 'listings', $post->created_by);
}
if ($respectView == 'teamblog' && $post->source_type == EASYBLOG_POST_SOURCE_TEAM) {
$menu = EBR::getMenus('teamblog', 'listings', $post->source_id);
}
}
}
// Get the default menu that the current view should use
if ($view != 'entry') {
$menu = EBR::getMenus($view);
// If there's a layout an id accompanying the view, we should search for a menu to a single item layout.
if ($layout && $id) {
$itemMenu = EBR::getMenus($view, $layout, $id);
// If there's a menu item created on the site associated with this item, we need to drop the segment
// to avoid redundant duplicate urls.
// E.g:
// menu alias = test
// post alias = test
// result = /test/test
if ($itemMenu) {
$menu = $itemMenu;
$dropSegment = true;
}
} else {
if ($layout) {
// this section here is to cater a view + layout page.
// e.g dashboard/entries
$itemMenu = EBR::getMenus($view, $layout);
if ($itemMenu) {
$menu = $itemMenu;
$dropSegment = true;
}
}
}
// If there is a menu created for the view, we just drop the segment
if (!$layout && !$id && $menu) {
$dropSegment = true;
}
}
// If we still cannot find any menu, use the default menu :(
if (!isset($menu) || !$menu) {
$menu = $defaultMenu;
}
// Only proceed when there is at least 1 menu created on the site for EasyBlog
if (isset($menu) && $menu) {
$itemId = $menu->id;
}
// If this is a task, we shouldn't drop any segments at all
if ($task) {
$dropSegment = false;
}
}
// If there's an item id located for the url, we need to intelligently apply it into the url.
if ($itemId) {
// We need to respect dropSegment to avoid duplicated menu and view name.
// For instance, if a menu is called "categories" which links to the categories page, it would be /categories/categories
if ($dropSegment && EBR::isSefEnabled()) {
$url = 'index.php?Itemid=' . $itemId;
} else {
$url = EBR::appendItemIdToQueryString($url, $itemId);
}
}
$cache[$key] = JRoute::_($url, $xhtml, $ssl);
return $cache[$key];
}