本文整理汇总了PHP中EasyBlogRouter::getItemIdByBlogger方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogRouter::getItemIdByBlogger方法的具体用法?PHP EasyBlogRouter::getItemIdByBlogger怎么用?PHP EasyBlogRouter::getItemIdByBlogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogRouter
的用法示例。
在下文中一共展示了EasyBlogRouter::getItemIdByBlogger方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getMenuItemId
public static function _getMenuItemId($post, &$params)
{
$itemId = '';
$routeTypeCategory = false;
$routeTypeBlogger = false;
$routeTypeTag = false;
$routingType = $params->get('routingtype', 'default');
if ($routingType != 'default') {
switch ($routingType) {
case 'menuitem':
$itemId = $params->get('menuitemid') ? '&Itemid=' . $params->get('menuitemid') : '';
break;
case 'category':
$routeTypeCategory = true;
break;
case 'blogger':
$routeTypeBlogger = true;
break;
case 'tag':
$routeTypeTag = true;
break;
default:
break;
}
}
if ($routeTypeCategory) {
$xid = EasyBlogRouter::getItemIdByCategories($post->category_id);
} else {
if ($routeTypeBlogger) {
$xid = EasyBlogRouter::getItemIdByBlogger($post->created_by);
} else {
if ($routeTypeTag) {
$tags = self::_getPostTagIds($post->id);
if ($tags !== false) {
foreach ($tags as $tag) {
$xid = EasyBlogRouter::getItemIdByTag($tag);
if ($xid !== false) {
break;
}
}
}
}
}
}
if (!empty($xid)) {
// lets do it, do it, do it, lets override the item id!
$itemId = '&Itemid=' . $xid;
}
return $itemId;
}
示例2: _
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;
}
}
}
//.........这里部分代码省略.........