本文整理汇总了PHP中EBR::getMenus方法的典型用法代码示例。如果您正苦于以下问题:PHP EBR::getMenus方法的具体用法?PHP EBR::getMenus怎么用?PHP EBR::getMenus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EBR
的用法示例。
在下文中一共展示了EBR::getMenus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _
/**
* Converts the non sef links to SEF links when necessary
*
* @since 5.0
* @access public
* @param string
* @return
*/
public static function _($url, $xhtml = true, $ssl = null, $search = false, $isCanonical = false)
{
static $cache = array();
static $itemIds = array();
// Cache index
$key = $url . (int) $xhtml . (int) $isCanonical;
// If the url has already loaded previously, do not need to load it again.
if (isset($cache[$key])) {
return $cache[$key];
}
$config = EB::config();
$app = JFactory::getApplication();
$input = $app->input;
// Parse the url
parse_str($url, $query);
// Get the view portion from the query string
$view = isset($query['view']) ? $query['view'] : 'latest';
$layout = isset($query['layout']) ? $query['layout'] : null;
$itemId = isset($query['Itemid']) ? $query['Itemid'] : '';
$task = isset($query['task']) ? $query['task'] : '';
$id = isset($query['id']) ? $query['id'] : null;
// Get routing behavior
$behavior = $config->get('main_routing', 'default');
$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;
}
}
}
//.........这里部分代码省略.........