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


PHP K2HelperRoute::getUserRoute方法代码示例

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


在下文中一共展示了K2HelperRoute::getUserRoute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLink

 /**
  * Retrieves the profile link
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function getLink()
 {
     if (!$this->exists()) {
         return parent::getLink();
     }
     $link = K2HelperRoute::getUserRoute($this->profile->id);
     return $link;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:16,代码来源:client.php

示例2: getAuthors

 function getAuthors(&$params)
 {
     $componentParams =& JComponentHelper::getParams('com_k2');
     $where = '';
     $cid = $params->get('authors_module_category');
     if ($cid > 0) {
         $categories = modK2ToolsHelper::getCategoryChildren($cid);
         $categories[] = $cid;
         JArrayHelper::toInteger($categories);
         $where = " catid IN(" . implode(',', $categories) . ") AND ";
     }
     $user =& JFactory::getUser();
     $aid = (int) $user->get('aid');
     $db =& JFactory::getDBO();
     $jnow =& JFactory::getDate();
     $now = $jnow->toMySQL();
     $nullDate = $db->getNullDate();
     $query = "SELECT DISTINCT created_by FROM #__k2_items  WHERE {$where} published=1 AND ( publish_up = " . $db->Quote($nullDate) . " OR publish_up <= " . $db->Quote($now) . " ) AND ( publish_down = " . $db->Quote($nullDate) . " OR publish_down >= " . $db->Quote($now) . " ) AND trash=0 AND access<={$aid} AND created_by_alias='' AND EXISTS (SELECT * FROM #__k2_categories WHERE id= #__k2_items.catid AND published=1 AND trash=0 AND access<={$aid} )";
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     $authors = array();
     if (count($rows)) {
         foreach ($rows as $row) {
             $author = JFactory::getUser($row->created_by);
             $author->link = JRoute::_(K2HelperRoute::getUserRoute($author->id));
             $query = "SELECT id, gender, description, image, url, `group`, plugins FROM #__k2_users WHERE userID=" . (int) $author->id;
             $db->setQuery($query);
             $author->profile = $db->loadObject();
             if ($params->get('authorAvatar')) {
                 $author->avatar = K2HelperUtilities::getAvatar($author->id, $author->email, $componentParams->get('userImageWidth'));
             }
             $query = "SELECT i.*, c.alias as categoryalias FROM #__k2_items as i\n        LEFT JOIN #__k2_categories c ON c.id = i.catid\n        WHERE i.created_by = " . (int) $author->id . "\n        AND i.published = 1\n        AND i.access <= {$aid}\n        AND ( i.publish_up = " . $db->Quote($nullDate) . " OR i.publish_up <= " . $db->Quote($now) . " )\n        AND ( i.publish_down = " . $db->Quote($nullDate) . " OR i.publish_down >= " . $db->Quote($now) . " )\n        AND i.trash = 0 AND created_by_alias='' AND c.published = 1 AND c.access <= {$aid} AND c.trash = 0 ORDER BY created DESC";
             $db->setQuery($query, 0, 1);
             $author->latest = $db->loadObject();
             $author->latest->id = (int) $author->latest->id;
             $author->latest->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($author->latest->id . ':' . urlencode($author->latest->alias), $author->latest->catid . ':' . urlencode($author->latest->categoryalias))));
             $query = "SELECT COUNT(*) FROM #__k2_comments WHERE published=1 AND itemID={$author->latest->id}";
             $db->setQuery($query);
             $author->latest->numOfComments = $db->loadResult();
             if ($params->get('authorItemsCounter')) {
                 $query = "SELECT COUNT(*) FROM #__k2_items  WHERE {$where} published=1 AND ( publish_up = " . $db->Quote($nullDate) . " OR publish_up <= " . $db->Quote($now) . " ) AND ( publish_down = " . $db->Quote($nullDate) . " OR publish_down >= " . $db->Quote($now) . " ) AND trash=0 AND access<={$aid} AND created_by_alias='' AND created_by={$row->created_by} AND EXISTS (SELECT * FROM #__k2_categories WHERE id= #__k2_items.catid AND published=1 AND trash=0 AND access<={$aid} )";
                 $db->setQuery($query);
                 $numofitems = $db->loadResult();
                 $author->items = $numofitems;
             }
             $authors[] = $author;
         }
     }
     return $authors;
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:50,代码来源:helper.php

示例3: go

 public function go($allGet)
 {
     $uri = JUri::getInstance();
     $currentLink = $uri->toString(array('path', 'query'));
     $start = JFactory::getApplication()->input->getInt('start', 0);
     JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_k2/tables');
     $limitstring = '';
     if ($start > 0) {
         $limits = $this->params->get('limits', 5);
         if ($start % $limits != 0) {
             $start = intval($start / $limits) * $limits;
         }
         $limitstring .= "?start=" . $start;
     }
     if ($allGet['view'] == 'item' && $allGet['task'] == '') {
         $item = JTable::getInstance('K2Item', 'Table');
         $item->load($allGet['id']);
         $category = JTable::getInstance('K2Category', 'Table');
         $category->load($item->catid);
         $original_link = JRoute::_(K2HelperRoute::getItemRoute($item->id . ':' . urlencode($item->alias), $item->catid . ':' . urlencode($category->alias)), false);
     } else {
         if ($allGet['view'] == 'itemlist' && $allGet['task'] == 'category') {
             $category = JTable::getInstance('K2Category', 'Table');
             $category->load((int) $allGet['id']);
             $original_link = JRoute::_(K2HelperRoute::getCategoryRoute((int) $allGet['id'] . ':' . urlencode($category->alias)), false) . $limitstring;
         } else {
             if ($allGet['view'] == 'itemlist' && $allGet['task'] == 'user') {
                 $original_link = JRoute::_(K2HelperRoute::getUserRoute((int) $allGet['id']), false) . $limitstring;
             } else {
                 return false;
             }
         }
     }
     if ($original_link && $original_link != $currentLink) {
         $this->shRedirect($original_link);
     }
     return true;
 }
开发者ID:pupsikus,项目名称:sto-city.test,代码行数:38,代码来源:com_k2.php

示例4: prepareFeedItem

 function prepareFeedItem(&$item)
 {
     JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables');
     $params =& JComponentHelper::getParams('com_k2');
     $limitstart = 0;
     //Category
     $category =& JTable::getInstance('K2Category', 'Table');
     $category->load($item->catid);
     $item->category = $category;
     //Read more link
     $item->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($item->id . ':' . $item->alias, $item->catid . ':' . urlencode($item->category->alias))));
     //Filtering
     if ($params->get('introTextCleanup')) {
         $filterTags = preg_split('#[,\\s]+#', trim($params->get('introTextCleanupExcludeTags')));
         $filterAttrs = preg_split('#[,\\s]+#', trim($params->get('introTextCleanupTagAttr')));
         $filter = new JFilterInput($filterTags, $filterAttrs, 0, 1);
         $item->introtext = $filter->clean($item->introtext);
     }
     if ($params->get('fullTextCleanup')) {
         $filterTags = preg_split('#[,\\s]+#', trim($params->get('fullTextCleanupExcludeTags')));
         $filterAttrs = preg_split('#[,\\s]+#', trim($params->get('fullTextCleanupTagAttr')));
         $filter = new JFilterInput($filterTags, $filterAttrs, 0, 1);
         $item->fulltext = $filter->clean($item->fulltext);
     }
     //Description
     $item->description = '';
     //Item image
     if ($params->get('feedItemImage') && JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $item->id) . '_' . $params->get('feedImgSize') . '.jpg')) {
         $item->description .= '<div class="K2FeedImage"><img src="' . JURI::root() . '/media/k2/items/cache/' . md5('Image' . $item->id) . '_' . $params->get('feedImgSize') . '.jpg" alt="' . $item->title . '"/></div>';
     }
     //Item Introtext
     if ($params->get('feedItemIntroText')) {
         //Introtext word limit
         if ($params->get('feedTextWordLimit')) {
             $item->introtext = K2HelperUtilities::wordLimit($item->introtext, $params->get('feedTextWordLimit'));
         }
         $item->description .= '<div class="K2FeedIntroText">' . $item->introtext . '<div>';
     }
     //Item Fulltext
     if ($params->get('feedItemFullText')) {
         $item->description .= '<div class="K2FeedFullText">' . $item->fulltext . '<div>';
     }
     //Author
     if (!empty($item->created_by_alias)) {
         $item->author->name = $item->created_by_alias;
     } else {
         $author = JFactory::getUser($item->created_by);
         $item->author = $author;
         $item->author->link = JRoute::_(K2HelperRoute::getUserRoute($item->created_by));
         $item->author->profile = K2ModelItem::getUserProfile($item->created_by);
     }
     return $item;
 }
开发者ID:navinpai,项目名称:GEC-Tandav,代码行数:53,代码来源:item.php

示例5: display


//.........这里部分代码省略.........
                 //Category plugins
                 $dispatcher =& JDispatcher::getInstance();
                 JPluginHelper::importPlugin('content');
                 $category->text = $category->description;
                 $dispatcher->trigger('onPrepareContent', array(&$category, &$params, $limitstart));
                 $category->description = $category->text;
                 //Category K2 plugins
                 $category->event->K2CategoryDisplay = '';
                 JPluginHelper::importPlugin('k2');
                 $results = $dispatcher->trigger('onK2CategoryDisplay', array(&$category, &$params, $limitstart));
                 $category->event->K2CategoryDisplay = trim(implode("\n", $results));
                 $category->text = $category->description;
                 $dispatcher->trigger('onK2PrepareContent', array(&$category, &$params, $limitstart));
                 $category->description = $category->text;
                 //Category link
                 $link = urldecode(K2HelperRoute::getCategoryRoute($category->id . ':' . urlencode($category->alias)));
                 $category->link = JRoute::_($link);
                 $category->feed = JRoute::_($link . '&format=feed');
                 JRequest::setVar('view', 'itemlist');
                 JRequest::setVar('task', 'category');
                 JRequest::setVar('id', $category->id);
                 JRequest::setVar('featured', 1);
                 JRequest::setVar('limit', $limit);
                 $category->items = $model->getData('rdate');
                 JRequest::setVar('view', 'latest');
                 JRequest::setVar('task', '');
                 for ($i = 0; $i < sizeof($category->items); $i++) {
                     if ($user->guest) {
                         $hits = $category->items[$i]->hits;
                         $category->items[$i]->hits = 0;
                         $category->items[$i] = $cache->call(array('K2ModelItem', 'prepareItem'), $category->items[$i], 'latest', '');
                         $category->items[$i]->hits = $hits;
                     } else {
                         $category->items[$i] = $itemModel->prepareItem($category->items[$i], 'latest', '');
                     }
                 }
                 $categories[] = $category;
             }
         }
         $source = 'categories';
         $this->assignRef('blocks', $categories);
     } else {
         $usersIDs = $params->get('userIDs');
         if (is_string($usersIDs) && !empty($usersIDs)) {
             $usersIDs = array();
             $usersIDs[] = $params->get('userIDs');
         }
         $users = array();
         foreach ($usersIDs as $userID) {
             $userObject = JFactory::getUser($userID);
             if (!$userObject->block) {
                 //User profile
                 $userObject->profile = $model->getUserProfile($userID);
                 //User image
                 $userObject->avatar = K2HelperUtilities::getAvatar($userObject->id, $userObject->email, $params->get('userImageWidth'));
                 //User K2 plugins
                 $userObject->event->K2UserDisplay = '';
                 if (is_object($userObject->profile) && $userObject->profile->id > 0) {
                     $dispatcher =& JDispatcher::getInstance();
                     JPluginHelper::importPlugin('k2');
                     $results = $dispatcher->trigger('onK2UserDisplay', array(&$userObject->profile, &$params, $limitstart));
                     $userObject->event->K2UserDisplay = trim(implode("\n", $results));
                 }
                 $link = K2HelperRoute::getUserRoute($userObject->id);
                 $userObject->link = JRoute::_($link);
                 $userObject->feed = JRoute::_($link . '&format=feed');
                 $userObject->items = $model->getAuthorLatest(0, $limit, $userID);
                 for ($i = 0; $i < sizeof($userObject->items); $i++) {
                     if ($user->guest) {
                         $hits = $userObject->items[$i]->hits;
                         $userObject->items[$i]->hits = 0;
                         $userObject->items[$i] = $cache->call(array('K2ModelItem', 'prepareItem'), $userObject->items[$i], 'latest', '');
                         $userObject->items[$i]->hits = $hits;
                     } else {
                         $userObject->items[$i] = $itemModel->prepareItem($userObject->items[$i], 'latest', '');
                     }
                 }
                 $users[] = $userObject;
             }
         }
         $source = 'users';
         $this->assignRef('blocks', $users);
     }
     //Look for template files in component folders
     $this->_addPath('template', JPATH_COMPONENT . DS . 'templates');
     $this->_addPath('template', JPATH_COMPONENT . DS . 'templates' . DS . 'default');
     //Look for overrides in template folder (K2 template structure)
     $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates');
     $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates' . DS . 'default');
     //Look for overrides in template folder (Joomla! template structure)
     $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'default');
     $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2');
     //Assign params
     $this->assignRef('params', $params);
     $this->assignRef('source', $source);
     //Set layout
     $this->setLayout('latest');
     //Display
     parent::display($tpl);
 }
开发者ID:navinpai,项目名称:GEC-Tandav,代码行数:101,代码来源:view.html.php

示例6: getList


//.........这里部分代码省略.........
             break;
     }
     // filter by featured params
     if ($params->get('show_featured', '1') == 2) {
         $query .= " AND a.featured != 1";
     } elseif ($params->get('show_featured', '1') == 3) {
         $query .= " AND a.featured = 1";
     }
     // valid publish date
     $jnow = JFactory::getDate();
     $now = $jnow->toSql();
     $nullDate = $db->getNullDate();
     $query .= " AND ( a.publish_up = " . $db->Quote($nullDate) . " OR a.publish_up <= " . $db->Quote($now) . " )";
     $query .= " AND ( a.publish_down = " . $db->Quote($nullDate) . " OR a.publish_down >= " . $db->Quote($now) . " )";
     //filter by language
     $languageTag = JFactory::getLanguage()->getTag();
     $query .= " AND a.language IN (" . $db->quote($languageTag) . "," . $db->quote('*') . ") AND c.language IN (" . $db->quote($languageTag) . "," . $db->quote('*') . ")";
     //Get data
     $data = array();
     $source = trim($this->_params->get('source', 'k2_category'));
     $catids = self::getCategoryIds();
     if ($source == 'k2_category' && !empty($catids) && $this->_params->get('limit_items_for_each')) {
         $db->setQuery('SELECT id from #__k2_categories where id in (' . implode($catids, ',') . ') order by ordering');
         $catids = $db->loadColumn();
         foreach ($catids as $catid) {
             $condition = ' AND  a.catid = ' . $catid . ' ';
             $db->setQuery($query . $condition . ' ORDER BY ' . $ordering . ($limit ? ' LIMIT ' . $limit : ''));
             $data = array_merge($data, $db->loadObjectlist());
         }
     } else {
         $condition = $this->buildConditionQuery($source, $catids);
         $db->setQuery($query . $condition . ' ORDER BY ' . $ordering . ($limit ? ' LIMIT ' . $limit : ''));
         $data = array_merge($data, $db->loadObjectlist());
     }
     // Rebuild data
     foreach ($data as $key => &$item) {
         // authorise
         if (in_array($item->access, $user->getAuthorisedViewLevels())) {
             $item->link = JRoute::_(K2HelperRoute::getItemRoute($item->id . ':' . $item->alias, $item->catid . ':' . $item->categoryalias));
         } else {
             $item->link = JRoute::_('index.php?option=com_users&view=login');
         }
         // format date
         $item->date = JHtml::_('date', $item->created, JText::_($dateFormat));
         //cut title
         if ($limit_title_by == 'word' && $titleMaxChars > 0) {
             $item->title_cut = self::substrword($item->title, $titleMaxChars, $replacer, $isStrips);
         } elseif ($limit_title_by == 'char' && $titleMaxChars > 0) {
             $item->title_cut = self::substring($item->title, $titleMaxChars, $replacer, $isStrips);
         }
         // escape html characters
         $item->title = htmlspecialchars($item->title);
         // import joomla content prepare plugin
         if ($params->get('content_plugin')) {
             $item->introtext = JHtml::_('content.prepare', $item->introtext);
         }
         // cut introtext
         if ($limitDescriptionBy == 'word') {
             $item->description = self::substrword($item->introtext, $maxDesciption, $replacer, $isStrips, $stringtags);
         } else {
             $item->description = self::substring($item->introtext, $maxDesciption, $replacer, $isStrips, $stringtags);
         }
         $item->categoryLink = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($item->catid . ':' . urlencode($item->categoryalias))));
         // get author name & link
         if ($show_author) {
             if (!empty($item->created_by_alias)) {
                 $item->author = $item->created_by_alias;
             } else {
                 $author = JFactory::getUser($item->created_by);
                 $item->author = $author->name;
             }
             $item->authorLink = JRoute::_(K2HelperRoute::getUserRoute($item->created_by));
         }
         // make thumbnail
         $item->thumbnail = '';
         $item->mainImage = '';
         if ($params->get('show_image')) {
             $item = $this->generateImages($item, $isThumb, $quality);
         }
         //get extrafields
         $showExtrafields = $params->get('show_extrafields', array());
         if (count($showExtrafields) && $item->extra_fields) {
             $item->extra_fields = json_decode($item->extra_fields);
             if (count($item->extra_fields)) {
                 $exIds = array();
                 foreach ($item->extra_fields as $ex) {
                     $exIds[] = $ex->id;
                 }
                 $exIds = implode(',', $exIds);
                 $query = 'SELECT name FROM #__k2_extra_fields WHERE id IN (' . $exIds . ') ORDER BY ordering';
                 $db->setQuery($query);
                 $rs = $db->loadObjectlist();
                 foreach ($item->extra_fields as $key => &$ex) {
                     $ex->name = $rs[$key]->name;
                 }
             }
         }
     }
     return $data;
 }
开发者ID:Tommar,项目名称:vino,代码行数:101,代码来源:k2.php

示例7: display


//.........这里部分代码省略.........
                }
                // Check for inline comment moderation
                if (!$user->guest && $user->id == $item->created_by && $params->get('inlineCommentsModeration')) {
                    $inlineCommentsModeration = true;
                    $commentsPublished = false;
                } else {
                    $inlineCommentsModeration = false;
                    $commentsPublished = true;
                }
                $this->assignRef('inlineCommentsModeration', $inlineCommentsModeration);
                // Flag spammer link
                $reportSpammerFlag = false;
                if (K2_JVERSION != '15') {
                    if ($user->authorise('core.admin', 'com_k2')) {
                        $reportSpammerFlag = true;
                        $document = JFactory::getDocument();
                        $document->addScriptDeclaration('var K2Language = ["' . JText::_('K2_REPORT_USER_WARNING', true) . '"];');
                    }
                } else {
                    if ($user->gid > 24) {
                        $reportSpammerFlag = true;
                    }
                }
                $limit = $params->get('commentsLimit');
                $comments = $model->getItemComments($item->id, $limitstart, $limit, $commentsPublished);
                for ($i = 0; $i < sizeof($comments); $i++) {
                    $comments[$i]->commentText = nl2br($comments[$i]->commentText);
                    // Convert URLs to links properly
                    $comments[$i]->commentText = preg_replace("/([^\\w\\/])(www\\.[a-z0-9\\-]+\\.[a-z0-9\\-]+)/i", "\$1http://\$2", $comments[$i]->commentText);
                    $comments[$i]->commentText = preg_replace("/([\\w]+:\\/\\/[\\w-?&;#~=\\.\\/\\@]+[\\w\\/])/i", "<a target=\"_blank\" rel=\"nofollow\" href=\"\$1\">\$1</A>", $comments[$i]->commentText);
                    $comments[$i]->commentText = preg_replace("/([\\w-?&;#~=\\.\\/]+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?))/i", "<a href=\"mailto:\$1\">\$1</A>", $comments[$i]->commentText);
                    $comments[$i]->userImage = K2HelperUtilities::getAvatar($comments[$i]->userID, $comments[$i]->commentEmail, $params->get('commenterImgWidth'));
                    if ($comments[$i]->userID > 0) {
                        $comments[$i]->userLink = K2HelperRoute::getUserRoute($comments[$i]->userID);
                    } else {
                        $comments[$i]->userLink = $comments[$i]->commentURL;
                    }
                    if ($reportSpammerFlag && $comments[$i]->userID > 0) {
                        $comments[$i]->reportUserLink = JRoute::_('index.php?option=com_k2&view=comments&task=reportSpammer&id=' . $comments[$i]->userID . '&format=raw');
                    } else {
                        $comments[$i]->reportUserLink = false;
                    }
                }
                $item->comments = $comments;
                if (!isset($item->numOfComments)) {
                    $item->numOfComments = 0;
                }
                jimport('joomla.html.pagination');
                $total = $item->numOfComments;
                $pagination = new JPagination($total, $limitstart, $limit);
            }
        }
        // Author's latest items
        if ($item->params->get('itemAuthorLatest') && $item->created_by_alias == '') {
            $model = $this->getModel('itemlist');
            $authorLatestItems = $model->getAuthorLatest($item->id, $item->params->get('itemAuthorLatestLimit'), $item->created_by);
            if (count($authorLatestItems)) {
                for ($i = 0; $i < sizeof($authorLatestItems); $i++) {
                    $authorLatestItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($authorLatestItems[$i]->id . ':' . urlencode($authorLatestItems[$i]->alias), $authorLatestItems[$i]->catid . ':' . urlencode($authorLatestItems[$i]->categoryalias))));
                }
                $this->assignRef('authorLatestItems', $authorLatestItems);
            }
        }
        // Related items
        if ($item->params->get('itemRelated') && isset($item->tags) && count($item->tags)) {
            $model = $this->getModel('itemlist');
开发者ID:emavro,项目名称:k2,代码行数:67,代码来源:view.html.php

示例8: getRelatedItems

 function getRelatedItems($itemID, $tags, $limit)
 {
     $params =& JComponentHelper::getParams('com_k2');
     $itemID = (int) $itemID;
     foreach ($tags as $tag) {
         $tagIDs[] = $tag->id;
     }
     JArrayHelper::toInteger($tagIDs);
     $sql = implode(',', $tagIDs);
     $user =& JFactory::getUser();
     $aid = (int) $user->get('aid');
     $db =& JFactory::getDBO();
     $jnow =& JFactory::getDate();
     $now = $jnow->toMySQL();
     $nullDate = $db->getNullDate();
     $query = "SELECT DISTINCT itemID FROM #__k2_tags_xref WHERE tagID IN ({$sql}) AND itemID!={$itemID}";
     $db->setQuery($query);
     $itemsIDs = $db->loadResultArray();
     if (!count($itemsIDs)) {
         return array();
     }
     $sql = implode(',', $itemsIDs);
     $query = "SELECT i.*, c.alias as categoryalias FROM #__k2_items as i" . " LEFT JOIN #__k2_categories c ON c.id = i.catid" . " WHERE i.published = 1" . " AND ( i.publish_up = " . $db->Quote($nullDate) . " OR i.publish_up <= " . $db->Quote($now) . " )" . " AND ( i.publish_down = " . $db->Quote($nullDate) . " OR i.publish_down >= " . $db->Quote($now) . " )" . " AND i.access <= {$aid}" . " AND i.trash = 0" . " AND c.published = 1" . " AND c.access <= {$aid}" . " AND c.trash = 0" . " AND (i.id) IN ({$sql})" . " ORDER BY i.created DESC";
     $db->setQuery($query, 0, $limit);
     $rows = $db->loadObjectList();
     foreach ($rows as $item) {
         //Image
         $item->imageXSmall = '';
         $item->imageSmall = '';
         $item->imageMedium = '';
         $item->imageLarge = '';
         $item->imageXLarge = '';
         if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $item->id) . '_XS.jpg')) {
             $item->imageXSmall = JURI::root() . 'media/k2/items/cache/' . md5("Image" . $item->id) . '_XS.jpg';
         }
         if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $item->id) . '_S.jpg')) {
             $item->imageSmall = JURI::root() . 'media/k2/items/cache/' . md5("Image" . $item->id) . '_S.jpg';
         }
         if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $item->id) . '_M.jpg')) {
             $item->imageMedium = JURI::root() . 'media/k2/items/cache/' . md5("Image" . $item->id) . '_M.jpg';
         }
         if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $item->id) . '_L.jpg')) {
             $item->imageLarge = JURI::root() . 'media/k2/items/cache/' . md5("Image" . $item->id) . '_L.jpg';
         }
         if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $item->id) . '_XL.jpg')) {
             $item->imageXLarge = JURI::root() . 'media/k2/items/cache/' . md5("Image" . $item->id) . '_XL.jpg';
         }
         if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $item->id) . '_Generic.jpg')) {
             $item->imageGeneric = JURI::root() . 'media/k2/items/cache/' . md5("Image" . $item->id) . '_Generic.jpg';
         }
         //Author
         if (!empty($item->created_by_alias)) {
             $item->author->name = $item->created_by_alias;
             $item->author->avatar = K2HelperUtilities::getAvatar('alias');
         } else {
             $author =& JFactory::getUser($item->created_by);
             $item->author = $author;
             $item->author->link = JRoute::_(K2HelperRoute::getUserRoute($item->created_by));
             $item->author->profile = K2ModelItem::getUserProfile($item->created_by);
             $item->author->avatar = K2HelperUtilities::getAvatar($author->id, $author->email, $params->get('userImageWidth'));
         }
         if (!is_object($item->author->profile)) {
             $item->author->profile = new JObject();
             $item->author->profile->gender = NULL;
         }
     }
     return $rows;
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:68,代码来源:itemlist.php

示例9: display


//.........这里部分代码省略.........
         JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
     }
     if ($item->publish_down != $nullDate && $item->publish_down < $now) {
         JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
     }
     if (!$item->category->published || $item->category->trash) {
         JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
     }
     // Increase hits counter
     $model->hit($item->id);
     // Set default image
     K2HelperUtilities::setDefaultImage($item, $view);
     // Comments
     $item->event->K2CommentsCounter = '';
     $item->event->K2CommentsBlock = '';
     if ($item->params->get('itemComments')) {
         // Trigger comments events
         $dispatcher = JDispatcher::getInstance();
         JPluginHelper::importPlugin('k2');
         $results = $dispatcher->trigger('onK2CommentsCounter', array(&$item, &$params, $limitstart));
         $item->event->K2CommentsCounter = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onK2CommentsBlock', array(&$item, &$params, $limitstart));
         $item->event->K2CommentsBlock = trim(implode("\n", $results));
         // Load K2 native comments system only if there are no plugins overriding it
         if (empty($item->event->K2CommentsCounter) && empty($item->event->K2CommentsBlock)) {
             $limit = $params->get('commentsLimit');
             $comments = $model->getItemComments($item->id, $limitstart, $limit);
             $pattern = "@\\b(https?://)?(([0-9a-zA-Z_!~*'().&=+\$%-]+:)?[0-9a-zA-Z_!~*'().&=+\$%-]+\\@)?(([0-9]{1,3}\\.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+\\.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z]\\.[a-zA-Z]{2,6})(:[0-9]{1,4})?((/[0-9a-zA-Z_!~*'().;?:\\@&=+\$,%#-]+)*/?)@";
             for ($i = 0; $i < sizeof($comments); $i++) {
                 $comments[$i]->commentText = nl2br($comments[$i]->commentText);
                 $comments[$i]->commentText = preg_replace($pattern, '<a target="_blank" rel="nofollow" href="\\0">\\0</a>', $comments[$i]->commentText);
                 $comments[$i]->userImage = K2HelperUtilities::getAvatar($comments[$i]->userID, $comments[$i]->commentEmail, $params->get('commenterImgWidth'));
                 if ($comments[$i]->userID > 0) {
                     $comments[$i]->userLink = K2HelperRoute::getUserRoute($comments[$i]->userID);
                 } else {
                     $comments[$i]->userLink = $comments[$i]->commentURL;
                 }
             }
             $item->comments = $comments;
             jimport('joomla.html.pagination');
             $total = $item->numOfComments;
             $pagination = new JPagination($total, $limitstart, $limit);
         }
     }
     // Author's latest items
     if ($item->params->get('itemAuthorLatest') && $item->created_by_alias == '') {
         $model = $this->getModel('itemlist');
         $authorLatestItems = $model->getAuthorLatest($item->id, $item->params->get('itemAuthorLatestLimit'), $item->created_by);
         if (count($authorLatestItems)) {
             for ($i = 0; $i < sizeof($authorLatestItems); $i++) {
                 $authorLatestItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($authorLatestItems[$i]->id . ':' . urlencode($authorLatestItems[$i]->alias), $authorLatestItems[$i]->catid . ':' . urlencode($authorLatestItems[$i]->categoryalias))));
             }
             $this->assignRef('authorLatestItems', $authorLatestItems);
         }
     }
     // Related items
     if ($item->params->get('itemRelated') && isset($item->tags) && count($item->tags)) {
         $model = $this->getModel('itemlist');
         $relatedItems = $model->getRelatedItems($item->id, $item->tags, $item->params);
         if (count($relatedItems)) {
             for ($i = 0; $i < sizeof($relatedItems); $i++) {
                 $relatedItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($relatedItems[$i]->id . ':' . urlencode($relatedItems[$i]->alias), $relatedItems[$i]->catid . ':' . urlencode($relatedItems[$i]->categoryalias))));
             }
             $this->assignRef('relatedItems', $relatedItems);
         }
     }
开发者ID:emavro,项目名称:k2,代码行数:67,代码来源:view.raw.php

示例10: display


//.........这里部分代码省略.........
                         $category->items = array();
                     }
                     $categories[] = $category;
                 }
             }
         }
         $source = 'categories';
         $this->assignRef('blocks', $categories);
     } else {
         $usersIDs = $params->get('userIDs');
         if (is_string($usersIDs) && !empty($usersIDs)) {
             $usersIDs = array();
             $usersIDs[] = $params->get('userIDs');
         }
         $users = array();
         if (is_array($usersIDs)) {
             foreach ($usersIDs as $userID) {
                 $userObject = JFactory::getUser($userID);
                 if (!$userObject->block) {
                     $userObject->event = new stdClass();
                     //User profile
                     $userObject->profile = $model->getUserProfile($userID);
                     //User image
                     $userObject->avatar = K2HelperUtilities::getAvatar($userObject->id, $userObject->email, $params->get('userImageWidth'));
                     //User K2 plugins
                     $userObject->event->K2UserDisplay = '';
                     if (is_object($userObject->profile) && $userObject->profile->id > 0) {
                         $dispatcher = JDispatcher::getInstance();
                         JPluginHelper::importPlugin('k2');
                         $results = $dispatcher->trigger('onK2UserDisplay', array(&$userObject->profile, &$params, $limitstart));
                         $userObject->event->K2UserDisplay = trim(implode("\n", $results));
                         $userObject->profile->url = htmlspecialchars($userObject->profile->url, ENT_QUOTES, 'UTF-8');
                     }
                     $link = K2HelperRoute::getUserRoute($userObject->id);
                     $userObject->link = JRoute::_($link);
                     $userObject->feed = JRoute::_($link . '&format=feed');
                     $userObject->name = htmlspecialchars($userObject->name, ENT_QUOTES);
                     if ($limit) {
                         $userObject->items = $model->getAuthorLatest(0, $limit, $userID);
                         for ($i = 0; $i < sizeof($userObject->items); $i++) {
                             $hits = $userObject->items[$i]->hits;
                             $userObject->items[$i]->hits = 0;
                             $userObject->items[$i] = $cache->call(array($itemModel, 'prepareItem'), $userObject->items[$i], 'latest', '');
                             $userObject->items[$i]->hits = $hits;
                             //Plugins
                             $userObject->items[$i] = $itemModel->execPlugins($userObject->items[$i], 'latest', '');
                             //Trigger comments counter event
                             $dispatcher = JDispatcher::getInstance();
                             JPluginHelper::importPlugin('k2');
                             $results = $dispatcher->trigger('onK2CommentsCounter', array(&$userObject->items[$i], &$params, $limitstart));
                             $userObject->items[$i]->event->K2CommentsCounter = trim(implode("\n", $results));
                         }
                     } else {
                         $userObject->items = array();
                     }
                     $users[] = $userObject;
                 }
             }
         }
         $source = 'users';
         $this->assignRef('blocks', $users);
     }
     // Set menu metadata for Joomla! 2.5+
     if (K2_JVERSION != '15') {
         if ($params->get('menu-meta_description')) {
             $document->setDescription($params->get('menu-meta_description'));
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:67,代码来源:view.html.php

示例11: prepareFeedItem


//.........这里部分代码省略.........

		if ($params->get('fullTextCleanup')){
			$filterTags	= preg_split( '#[,\s]+#', trim( $params->get( 'fullTextCleanupExcludeTags' ) ) );
			$filterAttrs = preg_split( '#[,\s]+#', trim( $params->get( 'fullTextCleanupTagAttr' ) ) );
			$filter	= new JFilterInput( $filterTags, $filterAttrs, 0, 1 );
			$item->fulltext= $filter->clean( $item->fulltext );
		}

		//Description
		$item->description = '';

		//Item image
		if ($params->get('feedItemImage') && JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_'.$params->get('feedImgSize').'.jpg')){
			$item->description.= '<div class="K2FeedImage"><img src="'.JURI::root().'/media/k2/items/cache/'.md5('Image'.$item->id).'_'.$params->get('feedImgSize').'.jpg" alt="'.$item->title.'" /></div>';
		}

		//Item Introtext
		if($params->get('feedItemIntroText')){
			//Introtext word limit
			if ($params->get('feedTextWordLimit') && $item->introtext){
				$item->introtext=K2HelperUtilities::wordLimit($item->introtext,$params->get('feedTextWordLimit'));
			}
			$item->description.= '<div class="K2FeedIntroText">'.$item->introtext.'</div>';
		}

		//Item Fulltext
		if($params->get('feedItemFullText') && $item->fulltext){
			$item->description.= '<div class="K2FeedFullText">'.$item->fulltext.'</div>';
		}

		//Item Tags
		if($params->get('feedItemTags')){
			$tags = K2ModelItem::getItemTags($item->id);
			if(count($tags)){
				$item->description.='<div class="K2FeedTags"><ul>';
				foreach($tags as $tag){
					$item->description.='<li>'.$tag->name.'</li>';
				}
				$item->description.='<ul></div>';
			}
		}

		//Item Video
		if($params->get('feedItemVideo') && $item->video){
			if (!empty($item->video) && JString::substr($item->video, 0, 1) !== '{') {
				$item->description.= '<div class="K2FeedVideo">'.$item->video.'</div>';
			}
			else {
				$params->set('vfolder', 'media/k2/videos');
				if(JString::strpos($item->video, 'remote}')){
					preg_match("#}(.*?){/#s",$item->video, $matches);
					if(!JString::strpos($matches[1], 'http://}'))
						$item->video = str_replace($matches[1], JURI::root().$matches[1], $item->video);
				}
				$dispatcher = &JDispatcher::getInstance();
				JPluginHelper::importPlugin ('content');
				$item->text=$item->video;
				$dispatcher->trigger ( 'onPrepareContent', array (&$item, &$params, $limitstart ) );
				$item->description.= '<div class="K2FeedVideo">'.$item->text.'</div>';
			}
		}

		//Item gallery
		if($params->get('feedItemGallery') && $item->gallery){
			$params->set('galleries_rootfolder', 'media/k2/galleries');
			$params->set('popup_engine', 'mootools_slimbox');
			$params->set('enabledownload', '0');
			$dispatcher = &JDispatcher::getInstance();
			JPluginHelper::importPlugin ('content');
			$item->text=$item->gallery;
			$dispatcher->trigger ( 'onPrepareContent', array (&$item, &$params, $limitstart ) );
			$item->description.= '<div class="K2FeedGallery">'.$item->text.'</div>';
		}

		//Item attachments
		if($params->get('feedItemAttachments')){
			$attachments = K2ModelItem::getItemAttachments($item->id);
			if(count($attachments)){
				$item->description.='<div class="K2FeedAttachments"><ul>';
				foreach($attachments as $attachment){
					$item->description.='<li><a title="'.htmlentities($attachment->titleAttribute, ENT_QUOTES, 'UTF-8').'" href="'.JRoute::_('index.php?option=com_k2&view=item&task=download&id='.$attachment->id).'">'.$attachment->title.'</a></li>';
				}
				$item->description.='<ul></div>';
			}
		}


		//Author
		if (!empty($item->created_by_alias)){
			$item->author->name = $item->created_by_alias;
		}
		else {
			$author=&JFactory::getUser($item->created_by);
			$item->author = $author;
			$item->author->link = JRoute::_(K2HelperRoute::getUserRoute($item->created_by));
			$item->author->profile = K2ModelItem::getUserProfile($item->created_by);
		}

		return $item;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:item.php

示例12: getItems


//.........这里部分代码省略.........
             //Attachments
             if ($params->get('itemAttachments')) {
                 $item->attachments = $model->getItemAttachments($item->id);
             }
             //Import plugins
             if ($format != 'feed') {
                 $dispatcher =& JDispatcher::getInstance();
                 JPluginHelper::importPlugin('content');
             }
             //Video
             if ($params->get('itemVideo') && $format != 'feed') {
                 $params->set('vfolder', 'media/k2/videos');
                 $item->text = $item->video;
                 $dispatcher->trigger('onPrepareContent', array(&$item, &$params, $limitstart));
                 $item->video = $item->text;
             }
             // Introtext
             $item->text = '';
             if ($params->get('itemIntroText')) {
                 // Word limit
                 if ($params->get('itemIntroTextWordLimit')) {
                     $item->text .= K2HelperUtilities::wordLimit($item->introtext, $params->get('itemIntroTextWordLimit'));
                 } else {
                     $item->text .= $item->introtext;
                 }
             }
             if ($format != 'feed') {
                 $params->set('parsedInModule', 1);
                 // for plugins to know when they are parsed inside this module
                 if ($params->get('JPlugins', 1)) {
                     //Plugins
                     $results = $dispatcher->trigger('onBeforeDisplay', array(&$item, &$params, $limitstart));
                     $item->event->BeforeDisplay = trim(implode("\n", $results));
                     $results = $dispatcher->trigger('onAfterDisplay', array(&$item, &$params, $limitstart));
                     $item->event->AfterDisplay = trim(implode("\n", $results));
                     $results = $dispatcher->trigger('onAfterDisplayTitle', array(&$item, &$params, $limitstart));
                     $item->event->AfterDisplayTitle = trim(implode("\n", $results));
                     $results = $dispatcher->trigger('onBeforeDisplayContent', array(&$item, &$params, $limitstart));
                     $item->event->BeforeDisplayContent = trim(implode("\n", $results));
                     $results = $dispatcher->trigger('onAfterDisplayContent', array(&$item, &$params, $limitstart));
                     $item->event->AfterDisplayContent = trim(implode("\n", $results));
                     $dispatcher->trigger('onPrepareContent', array(&$item, &$params, $limitstart));
                     $item->introtext = $item->text;
                 }
                 //Init K2 plugin events
                 $item->event->K2BeforeDisplay = '';
                 $item->event->K2AfterDisplay = '';
                 $item->event->K2AfterDisplayTitle = '';
                 $item->event->K2BeforeDisplayContent = '';
                 $item->event->K2AfterDisplayContent = '';
                 $item->event->K2CommentsCounter = '';
                 if ($params->get('K2Plugins', 1)) {
                     //K2 plugins
                     JPluginHelper::importPlugin('k2');
                     $results = $dispatcher->trigger('onK2BeforeDisplay', array(&$item, &$params, $limitstart));
                     $item->event->K2BeforeDisplay = trim(implode("\n", $results));
                     $results = $dispatcher->trigger('onK2AfterDisplay', array(&$item, &$params, $limitstart));
                     $item->event->K2AfterDisplay = trim(implode("\n", $results));
                     $results = $dispatcher->trigger('onK2AfterDisplayTitle', array(&$item, &$params, $limitstart));
                     $item->event->K2AfterDisplayTitle = trim(implode("\n", $results));
                     $results = $dispatcher->trigger('onK2BeforeDisplayContent', array(&$item, &$params, $limitstart));
                     $item->event->K2BeforeDisplayContent = trim(implode("\n", $results));
                     $results = $dispatcher->trigger('onK2AfterDisplayContent', array(&$item, &$params, $limitstart));
                     $item->event->K2AfterDisplayContent = trim(implode("\n", $results));
                     $dispatcher->trigger('onK2PrepareContent', array(&$item, &$params, $limitstart));
                     $item->introtext = $item->text;
                     if ($params->get('itemCommentsCounter')) {
                         $results = $dispatcher->trigger('onK2CommentsCounter', array(&$item, &$params, $limitstart));
                         $item->event->K2CommentsCounter = trim(implode("\n", $results));
                     }
                 }
             }
             //Clean the plugin tags
             $item->introtext = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $item->introtext);
             //Author
             if ($params->get('itemAuthor')) {
                 if (!empty($item->created_by_alias)) {
                     $item->author = $item->created_by_alias;
                     $item->authorGender = NULL;
                     if ($params->get('itemAuthorAvatar')) {
                         $item->authorAvatar = K2HelperUtilities::getAvatar('alias');
                     }
                 } else {
                     $author =& JFactory::getUser($item->created_by);
                     $item->author = $author->name;
                     $query = "SELECT `gender` FROM #__k2_users WHERE userID=" . (int) $author->id;
                     $db->setQuery($query, 0, 1);
                     $item->authorGender = $db->loadResult();
                     if ($params->get('itemAuthorAvatar')) {
                         $item->authorAvatar = K2HelperUtilities::getAvatar($author->id, $author->email, $componentParams->get('userImageWidth'));
                     }
                     //Author Link
                     $item->authorLink = JRoute::_(K2HelperRoute::getUserRoute($item->created_by));
                 }
             }
             $rows[] = $item;
         }
         return $rows;
     }
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:101,代码来源:helper.php

示例13: getItems


//.........这里部分代码省略.........
             // $item->event->BeforeDisplay = trim(implode("\n", $results));
             // $results = $dispatcher->trigger('onAfterDisplay', array(&$item, &$params, $limitstart));
             // $item->event->AfterDisplay = trim(implode("\n", $results));
             // $results = $dispatcher->trigger('onAfterDisplayTitle', array(&$item, &$params, $limitstart));
             // $item->event->AfterDisplayTitle = trim(implode("\n", $results));
             // $results = $dispatcher->trigger('onBeforeDisplayContent', array(&$item, &$params, $limitstart));
             // $item->event->BeforeDisplayContent = trim(implode("\n", $results));
             // $results = $dispatcher->trigger('onAfterDisplayContent', array(&$item, &$params, $limitstart));
             // $item->event->AfterDisplayContent = trim(implode("\n", $results));
             // $dispatcher->trigger('onPrepareContent', array(&$item, &$params, $limitstart));
             // }
             // }
             // //Init K2 plugin events
             // $item->event->K2BeforeDisplay = '';
             // $item->event->K2AfterDisplay = '';
             // $item->event->K2AfterDisplayTitle = '';
             // $item->event->K2BeforeDisplayContent = '';
             // $item->event->K2AfterDisplayContent = '';
             // $item->event->K2CommentsCounter = '';
             // if ($params->get('K2Plugins', 1))
             // {
             // //K2 plugins
             // JPluginHelper::importPlugin('k2');
             // $results = $dispatcher->trigger('onK2BeforeDisplay', array(&$item, &$params, $limitstart));
             // $item->event->K2BeforeDisplay = trim(implode("\n", $results));
             // $results = $dispatcher->trigger('onK2AfterDisplay', array(&$item, &$params, $limitstart));
             // $item->event->K2AfterDisplay = trim(implode("\n", $results));
             // $results = $dispatcher->trigger('onK2AfterDisplayTitle', array(&$item, &$params, $limitstart));
             // $item->event->K2AfterDisplayTitle = trim(implode("\n", $results));
             // $results = $dispatcher->trigger('onK2BeforeDisplayContent', array(&$item, &$params, $limitstart));
             // $item->event->K2BeforeDisplayContent = trim(implode("\n", $results));
             // $results = $dispatcher->trigger('onK2AfterDisplayContent', array(&$item, &$params, $limitstart));
             // $item->event->K2AfterDisplayContent = trim(implode("\n", $results));
             // $dispatcher->trigger('onK2PrepareContent', array(&$item, &$params, $limitstart));
             // if ($params->get('itemCommentsCounter'))
             // {
             // $results = $dispatcher->trigger('onK2CommentsCounter', array(&$item, &$params, $limitstart));
             // $item->event->K2CommentsCounter = trim(implode("\n", $results));
             // }
             // }
             // }
             // Restore the intotext variable after plugins execution
             $item->introtext = $item->text;
             //Clean the plugin tags
             $item->introtext = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $item->introtext);
             //Author
             if ($params->get('itemAuthor')) {
                 if (!empty($item->created_by_alias)) {
                     $item->author = $item->created_by_alias;
                     $item->authorGender = NULL;
                     $item->authorDescription = NULL;
                     if ($params->get('itemAuthorAvatar')) {
                         $item->authorAvatar = K2HelperUtilities::getAvatar('alias');
                     }
                     $item->authorLink = Juri::root(true);
                 } else {
                     $author = JFactory::getUser($item->created_by);
                     $item->author = $author->name;
                     $query = "SELECT `description`, `gender` FROM #__k2_users WHERE userID=" . (int) $author->id;
                     $db->setQuery($query, 0, 1);
                     $result = $db->loadObject();
                     if ($result) {
                         $item->authorGender = $result->gender;
                         $item->authorDescription = $result->description;
                     } else {
                         $item->authorGender = NULL;
                         $item->authorDescription = NULL;
                     }
                     if ($params->get('itemAuthorAvatar')) {
                         $item->authorAvatar = K2HelperUtilities::getAvatar($author->id, $author->email, $componentParams->get('userImageWidth'));
                     }
                     //Author Link
                     $item->authorLink = JRoute::_(K2HelperRoute::getUserRoute($item->created_by));
                 }
             }
             // Extra fields plugins
             if (is_array($item->extra_fields)) {
                 foreach ($item->extra_fields as $key => $extraField) {
                     if ($extraField->type == 'textarea' || $extraField->type == 'textfield') {
                         $tmp = new JObject();
                         $tmp->text = $extraField->value;
                         if ($params->get('JPlugins', 1)) {
                             if (K2_JVERSION != '15') {
                                 $dispatcher->trigger('onContentPrepare', array('mod_k2_content', &$tmp, &$params, $limitstart));
                             } else {
                                 $dispatcher->trigger('onPrepareContent', array(&$tmp, &$params, $limitstart));
                             }
                         }
                         if ($params->get('K2Plugins', 1)) {
                             $dispatcher->trigger('onK2PrepareContent', array(&$tmp, &$params, $limitstart));
                         }
                         $extraField->value = $tmp->text;
                     }
                 }
             }
             $rows[] = $item;
         }
         return $rows;
     }
 }
开发者ID:educakanchay,项目名称:kanchay,代码行数:101,代码来源:helper_base.php

示例14: if

	  	<img src="<?php echo K2HelperUtilities::getAvatar($user->id, $user->email); ?>" alt="<?php echo K2HelperUtilities::cleanHtml($user->name); ?>" style="width:<?php echo $avatarWidth; ?>px;height:auto;" />
	  </a>
	  <?php endif; ?>
	  <span class="ubName"><?php echo $user->name; ?></span>
		<span class="ubCommentsCount"><?php echo JText::_('K2_YOU_HAVE'); ?> <b><?php echo $user->numOfComments; ?></b> <?php if($user->numOfComments==1) echo JText::_('K2_PUBLISHED_COMMENT'); else echo JText::_('K2_PUBLISHED_COMMENTS'); ?></span>
	  <div class="clr"></div>
	</div>

  <ul class="k2UserBlockActions">
		<?php if(is_object($user->profile) && isset($user->profile->addLink)): ?>
		<li>
			<a class="modal" rel="{handler:'iframe',size:{x:990,y:550}}" href="<?php echo $user->profile->addLink; ?>"><?php echo JText::_('K2_ADD_NEW_ITEM'); ?></a>
		</li>
		<?php endif; ?>
		<li>
			<a href="<?php echo JRoute::_(K2HelperRoute::getUserRoute($user->id)); ?>"><?php echo JText::_('K2_MY_PAGE'); ?></a>
		</li>
		<li>
			<a href="<?php echo JRoute::_((K2_JVERSION != '15') ? 'index.php?option=com_users&view=profile&layout=edit' : 'index.php?option=com_user&view=user&task=edit'); ?>"><?php echo JText::_('K2_MY_ACCOUNT'); ?></a>
		</li>
		<li>
			<a class="modal" rel="{handler:'iframe',size:{x:990,y:550}}" href="<?php echo JRoute::_('index.php?option=com_k2&view=comments&tmpl=component'); ?>"><?php echo JText::_('K2_MODERATE_COMMENTS_TO_MY_PUBLISHED_ITEMS'); ?></a>
		</li>
	</ul>

	<ul class="k2UserBlockRenderedMenu">
		<?php $level = 1; foreach($menu as $key => $link): $level++; ?>
		<li class="linkItemId<?php echo $link->id; ?>">
			<?php if($link->type=='url' && $link->browserNav==0): ?>
			<a href="<?php echo $link->route; ?>"><?php echo $link->name; ?></a>
			<?php elseif(strpos($link->link,'option=com_k2&view=item&layout=itemform') || $link->browserNav==2): ?>
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:31,代码来源:userblock.php

示例15: authorLink

 static function authorLink($item)
 {
     return urldecode(JRoute::_(K2HelperRoute::getUserRoute($item['author_id'])));
 }
开发者ID:Roma48,项目名称:mayak,代码行数:4,代码来源:view.php


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