本文整理汇总了PHP中EasyBlogRouter::getItemIdByEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogRouter::getItemIdByEntry方法的具体用法?PHP EasyBlogRouter::getItemIdByEntry怎么用?PHP EasyBlogRouter::getItemIdByEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogRouter
的用法示例。
在下文中一共展示了EasyBlogRouter::getItemIdByEntry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _
public static function _($url, $xhtml = true, $ssl = null, $search = false, $isCanonical = false)
{
$mainframe = JFactory::getApplication();
$config = EasyBlogHelper::getConfig();
static $loaded = array();
static $eUri = array();
$useXHTML = (int) $xhtml . (int) $isCanonical;
if (isset($loaded[$url . $useXHTML])) {
return $loaded[$url . $useXHTML];
}
$rawURL = $url;
$blogger = JRequest::getVar('blogger', '');
if (!empty($blogger)) {
$url .= '&blogger=' . $blogger;
}
//$jURL = JRoute::_($url, false);
$jURL = $url;
// convert the string to variable so that we can access it.
parse_str($jURL, $post);
$view = isset($post['view']) ? $post['view'] : 'latest';
$Itemid = isset($post['Itemid']) ? $post['Itemid'] : '';
$routingBehavior = $config->get('main_routing', 'currentactive');
$exItemid = '';
$findItemId = false;
$dropSegment = false;
if (($routingBehavior == 'currentactive' || $routingBehavior == 'menuitemid') && !$isCanonical) {
$routingMenuItem = $config->get('main_routing_itemid', '');
if ($routingBehavior == 'menuitemid' && $routingMenuItem != '') {
$exItemid = $routingMenuItem;
}
// @rule: If there is already an item id, try to use the explicitly set one.
if (empty($exItemid)) {
if ($view == 'entry') {
$blogId = $post['id'];
$blog = EasyBlogHelper::getTable('Blog', 'Table');
$blog->load($blogId);
$author = $blog->created_by;
if (!empty($author)) {
$tmpItemid = EasyBlogRouter::getItemIdByBlogger($author);
if (!empty($tmpItemid)) {
$isBloggerMode = EasyBlogRouter::isMenuABloggerMode($tmpItemid);
if ($isBloggerMode) {
$exItemid = $tmpItemid;
}
}
}
}
// @rule: If it is not a blogger mode, we just use the current one.
if (!$mainframe->isAdmin()) {
// Retrieve the active menu item.
$menu = JFactory::getApplication()->getMenu();
$item = $menu->getActive();
if (isset($item->id)) {
$isBloggerMode = EasyBlogRouter::isMenuABloggerMode($item->id);
if (!$isBloggerMode) {
$exItemid = $item->id;
}
}
}
}
} else {
switch ($view) {
case 'entry':
$routingOrder = EasyBlogRouter::getDefaultRoutingOrder();
$exItemid = '';
if (!empty($routingOrder)) {
$blogId = $post['id'];
$blog = EasyBlogHelper::getTable('Blog', 'Table');
$blog->load($blogId);
$authorId = $blog->created_by;
$categoryId = $blog->category_id;
foreach ($routingOrder as $key => $val) {
switch ($key) {
case 'bloggerstandalone':
$bloggerId = EasyBlogRouter::isBloggerMode();
if ($bloggerId !== false) {
$exItemid = EasyBlogRouter::getItemIdByBlogger($bloggerId);
}
break;
case 'entry':
$exItemid = EasyBlogRouter::getItemIdByEntry($blogId);
break;
case 'category':
$exItemid = EasyBlogRouter::getItemIdByCategories($categoryId);
break;
case 'blogger':
$exItemid = EasyBlogRouter::getItemIdByBlogger($authorId);
break;
case 'teamblog':
$teamId = $blog->getTeamContributed();
if (!empty($teamId)) {
$exItemid = EasyBlogRouter::getItemIdByTeamBlog($teamId);
}
break;
}
if (!empty($exItemid)) {
break;
}
}
}
//.........这里部分代码省略.........