当前位置: 首页>>代码示例>>PHP>>正文


PHP EasyBlogRouter::getItemIdByCategories方法代码示例

本文整理汇总了PHP中EasyBlogRouter::getItemIdByCategories方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogRouter::getItemIdByCategories方法的具体用法?PHP EasyBlogRouter::getItemIdByCategories怎么用?PHP EasyBlogRouter::getItemIdByCategories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EasyBlogRouter的用法示例。


在下文中一共展示了EasyBlogRouter::getItemIdByCategories方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:50,代码来源:helper.php

示例2: convertRawToItem


//.........这里部分代码省略.........
                     // full image
                     $item_image = new RokSprocket_Item_Image();
                     $item_image->setSource($image->getSource('large'));
                     $item_image->setIdentifier('image_full');
                     $item_image->setCaption(null);
                     $item_image->setAlttext(null);
                     $images[$item_image->getIdentifier()] = $item_image;
                     //thumbnail
                     $item_image = new RokSprocket_Item_Image();
                     $item_image->setSource($image->getSource('thumbnail'));
                     $item_image->setIdentifier('image_thumb');
                     $item_image->setCaption(null);
                     $item_image->setAlttext(null);
                     $images[$item_image->getIdentifier()] = $item_image;
                     //thumbnail
                     $item_image = new RokSprocket_Item_Image();
                     $item_image->setSource($image->getSource('icon'));
                     $item_image->setIdentifier('image_icon');
                     $item_image->setCaption(null);
                     $item_image->setAlttext(null);
                     $images[$item_image->getIdentifier()] = $item_image;
                 }
             } else {
                 $raw_image = RokCommon_JSON::decode($raw_item->image);
                 if (isset($raw_image) && !empty($raw_image)) {
                     $item_image = new RokSprocket_Item_Image();
                     if (isset($raw_image->place) && $raw_image->place == 'shared') {
                         $item_image->setSource(JPath::clean(JURI::root(true) . '/' . $cfg->get('main_shared_path') . $raw_image->path));
                     } else {
                         $folder = explode(':', $raw_image->place);
                         $item_image->setSource(JPath::clean(JURI::root(true) . '/' . $cfg->get('main_image_path') . $folder[1] . $raw_image->path));
                     }
                     $item_image->setIdentifier('image_item');
                     $item_image->setCaption(null);
                     $item_image->setAlttext(null);
                     $images[$item_image->getIdentifier()] = $item_image;
                     $item->setPrimaryImage($item_image);
                     //full image
                     $item_image = new RokSprocket_Item_Image();
                     $item_image->setSource(JPath::clean(str_replace(JURI::root(), JURI::root(true) . '/', $raw_image->url)));
                     $item_image->setIdentifier('image_full');
                     $item_image->setCaption(null);
                     $item_image->setAlttext(null);
                     $images[$item_image->getIdentifier()] = $item_image;
                     //thumbnail
                     $item_image = new RokSprocket_Item_Image();
                     $item_image->setSource(JPath::clean(str_replace(JURI::root(), JURI::root(true) . '/', $raw_image->thumbnail->url)));
                     $item_image->setIdentifier('image_thumb');
                     $item_image->setCaption(null);
                     $item_image->setAlttext(null);
                     $images[$item_image->getIdentifier()] = $item_image;
                     //icon
                     $item_image = new RokSprocket_Item_Image();
                     $item_image->setSource(JPath::clean(str_replace(JURI::root(), JURI::root(true) . '/', $raw_image->icon->url)));
                     $item_image->setIdentifier('image_icon');
                     $item_image->setCaption(null);
                     $item_image->setAlttext(null);
                     $images[$item_image->getIdentifier()] = $item_image;
                 }
             }
         } catch (RokCommon_JSON_Exception $jse) {
             $this->container->roksprocket_logger->warning('Unable to decode image JSON for article ' . $item->getArticleId());
         }
         $item->setImages($images);
     }
     $primary_link = new RokSprocket_Item_Link();
     $itemId = EasyBlogRouter::getItemIdByCategories($raw_item->category_id);
     $primary_link->setUrl(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $raw_item->id . '&Itemid=' . $itemId));
     $primary_link->getIdentifier('article_link');
     $item->setPrimaryLink($primary_link);
     $item->setPrimaryLink($primary_link);
     $links = array();
     $link = new RokSprocket_Item_Link();
     $link->setUrl(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $raw_item->id . '&Itemid=' . $itemId));
     $link->setText('');
     $link->setIdentifier('article_link');
     $links[$link->getIdentifier()] = $link;
     $item->setLinks($links);
     $texts = array();
     $texts['text_content'] = $raw_item->content;
     $texts['text_intro'] = $raw_item->intro;
     $texts['text_excerpt'] = $raw_item->excerpt;
     $texts['text_title'] = $raw_item->title;
     $texts['text_metadesc'] = $raw_item->metadesc;
     $texts = $this->processPlugins($texts);
     $item->setTextFields($texts);
     if ($provider_version < "5.0.0") {
         $item->setText($texts['text_intro']);
     } elseif ($provider_version >= "5.0.0") {
         $item->setText($texts['text_content']);
     }
     $item->setDbOrder($dborder);
     // unknown joomla items
     $item->setCommentCount($raw_item->comment_count);
     if (isset($raw_item->tags)) {
         $tags = explode(',', $raw_item->tags) ? explode(',', $raw_item->tags) : array();
         $item->setTags($tags);
     }
     return $item;
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:101,代码来源:EasyBlog.php

示例3: _

 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;
                         }
                     }
                 }
//.........这里部分代码省略.........
开发者ID:alexinteam,项目名称:joomla3,代码行数:101,代码来源:router.php


注:本文中的EasyBlogRouter::getItemIdByCategories方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。