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


PHP K2HelperUtilities::getAvatar方法代码示例

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


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

示例1: 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

示例2: generateLayout

 function generateLayout($config, $data)
 {
     /*
     	Available variables:
     	{TITLE} - article title
     			{TEXT} - article text
     			{URL} - article URL
     			{IMAGE_SRC} - article image URL
     			{AUTHOR_EMAIL} - article autor e-mail 
     			{AUTHOR_NAME} - article author name
     			{AUTHOR_URL} - article author URL
     			{CATEGORY} - article category name
     			{CATEGORY_URL} - article category URL
     			{HITS} - article hits
     			{DATE} - article date (gets format from the information block settings)
     			{RATING} - article rating
     	K2 specific variables:
     	{TAGS} - article tag lists
     			{VIDEO_HTML} - HTML of the article video
     			{CATEGORY_IMAGE_SRC} - article category image URL
     			{AVATAR_URL} - user avatar URL
     	{{extra_field_alias}} - value of the extra field with specific alias
     			{{extra_field_alias_X}} - value of X-nth element in the array of the extra field data - indexing starts with 0
     */
     //
     // Get the values
     //
     // Image
     $viewClass = 'NSP_GK5_' . $config['source_name'] . '_View';
     // Basic data
     $title = NSP_GK5_Utils::cutText($data['title'], $config, 'title_limit');
     $text = NSP_GK5_Utils::cutText($data['text'], $config, 'news_limit');
     // URL
     $url = '';
     if (isset($data['url'])) {
         $url = $data['url'];
     } else {
         $url = call_user_func(array($viewClass, 'itemLink'), $data, $config);
     }
     // PHP 5.3:
     //$image_src = $viewClass::image($config, $data, true);
     $image_src = call_user_func(array($viewClass, 'image'), $config, $data, true);
     // Author data
     $author_email = $data['author_email'];
     $author_name = $data['author_username'];
     $author_url = call_user_func(array($viewClass, 'authorLink'), $data);
     // Category data
     $category = $data['catname'];
     $category_url = '';
     if (isset($data['caturl'])) {
         $category_url = $data['caturl'];
     } else {
         $category_url = call_user_func(array($viewClass, 'categoryLink'), $data);
     }
     // detect K2
     $avatar = '';
     if (isset($data['video'])) {
         $avatar = K2HelperUtilities::getAvatar($data['author_id'], $data['author_email'], $config['avatar_size']);
     }
     // Other data
     $hits = $data['hits'];
     $date = JHTML::_('date', $data['date'], $config['date_format']);
     $rating = $item['rating_count'] > 0 ? number_format($data['rating_sum'] / $data['rating_count'], 2) : 0;
     //
     // Get the layout text
     //
     if ($config['article_format'] != '-1' && is_file(JPATH_ROOT . DS . 'modules' . DS . 'mod_news_pro_gk5' . DS . 'article_formats' . DS . $config['article_format']) || $config['article_format'] == '-1' && $config['article_format_text'] != '') {
         // read the format file
         $format_file = $config['article_format_text'];
         if ($config['article_format'] != '-1') {
             $format_file = file_get_contents(JPATH_ROOT . DS . 'modules' . DS . 'mod_news_pro_gk5' . DS . 'article_formats' . DS . $config['article_format']);
         }
         // replace values
         $to_replace = array('{TITLE}', '{TEXT}', '{URL}', '{IMAGE_SRC}', '{AUTHOR_EMAIL}', '{AUTHOR_NAME}', '{AUTHOR_URL}', '{CATEGORY}', '{CATEGORY_URL}', '{HITS}', '{DATE}', '{RATING}', '{AVATAR_URL}');
         // values for the replacement
         $replacement = array($title, $text, $url, $image_src, $author_email, $author_name, $author_url, $category, $category_url, $hits, $date, $rating, $avatar);
         // replace values in the format file
         $format_file = str_replace($to_replace, $replacement, $format_file);
         // replacements only for K2
         if (stripos($config['data_source'], 'k2_') !== FALSE) {
             // tags list value
             $tags = '';
             // if tags exists
             if (isset($data['tags']) && count($data['tags']) > 0) {
                 $i = 0;
                 foreach ($data['tags'] as $tag) {
                     $link = urldecode(JRoute::_(K2HelperRoute::getTagRoute($tag)));
                     if ($i == 0) {
                         $tags .= '<a href="' . $link . '">' . $tag . '</a>';
                     } else {
                         $tags .= ', <a href="' . $link . '">' . $tag . '</a>';
                     }
                     //
                     $i++;
                 }
             }
             // video HTML value
             $video_html = $data['video'];
             // category image URL value
             $category_image_src = '';
//.........这里部分代码省略.........
开发者ID:haufsolutions,项目名称:News-Show-Pro-GK5,代码行数:101,代码来源:gk.format.parser.php

示例3: display

    function display($tpl = null)
    {
        $mainframe =& JFactory::getApplication();
        $user =& JFactory::getUser();
        $document =& JFactory::getDocument();
        $params =& JComponentHelper::getParams('com_k2');
        $limitstart = JRequest::getInt('limitstart', 0);
        $view = JRequest::getWord('view');
        $task = JRequest::getWord('task');
        $db =& JFactory::getDBO();
        $jnow =& JFactory::getDate();
        $now = $jnow->toMySQL();
        $nullDate = $db->getNullDate();
        $this->setLayout('item');
        //Add link
        if (K2HelperPermissions::canAddItem()) {
            $addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component');
        }
        $this->assignRef('addLink', $addLink);
        //Get item
        $model =& $this->getModel();
        $item = $model->getData();
        //Prepare item
        if ($user->guest) {
            $cache =& JFactory::getCache('com_k2_extended');
            $hits = $item->hits;
            $item->hits = 0;
            $item = $cache->call(array('K2ModelItem', 'prepareItem'), $item, $view, $task);
            $item->hits = $hits;
        } else {
            $item = $model->prepareItem($item, $view, $task);
        }
        //Plugins
        $item = $model->execPlugins($item, $view, $task);
        //Access check
        if ($this->getLayout() == 'form') {
            JError::raiseError(403, JText::_("ALERTNOTAUTH"));
        }
        if ($item->access > $user->get('aid', 0) || $item->category->access > $user->get('aid', 0)) {
            JError::raiseError(403, JText::_("ALERTNOTAUTH"));
        }
        //Published check
        if (!$item->published || $item->trash) {
            JError::raiseError(404, JText::_("Item not found"));
        }
        if ($item->publish_up != $nullDate && $item->publish_up > $now) {
            JError::raiseError(404, JText::_("Item not found"));
        }
        if ($item->publish_down != $nullDate && $item->publish_down < $now) {
            JError::raiseError(404, JText::_("Item not found"));
        }
        if (!$item->category->published || $item->category->trash) {
            JError::raiseError(404, JText::_("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)) {
                //Load reCAPTCHA script
                if (!JRequest::getInt('print') && ($item->params->get('comments') == '1' || $item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($item->catid))) {
                    if ($item->params->get('recaptcha') && $user->guest) {
                        $document->addScript('http://api.recaptcha.net/js/recaptcha_ajax.js');
                        $js = 'function showRecaptcha(){
								    Recaptcha.create("' . $item->params->get('recaptcha_public_key') . '", "recaptcha", {
								        theme: "' . $item->params->get('recaptcha_theme', 'clean') . '"
								    });
								}
								window.addEvent(\'load\', function(){
									showRecaptcha();
								})';
                        $document->addScriptDeclaration($js);
                    }
                    //Auto complete some fields for registered users
                    if (!$user->guest) {
                        $js = "window.addEvent('domready', function(){\n\t\t\t\t\t\t\t\t\t\$('userName').setProperty('value','" . $user->name . "');\n\t\t\t\t\t\t\t\t\t\$('userName').setProperty('disabled','disabled');\n\t\t\t\t\t\t\t\t\t\$('commentEmail').setProperty('value','" . $user->email . "');\n\t\t\t\t\t\t\t\t\t\$('commentEmail').setProperty('disabled','disabled');\n\n\t\t\t\t\t\t\t\t})";
                        $document->addScriptDeclaration($js);
                    }
                }
                $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);
//.........这里部分代码省略.........
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:101,代码来源:view.raw.php

示例4: display


//.........这里部分代码省略.........
                     $ordering = $params->get('singleCatOrdering');
                 } else {
                     $ordering = $params->get('catOrdering');
                 }
                 // Set parameters prefix
                 $prefix = 'cat';
                 // Prepare the JSON category object;
                 $row = new JObject();
                 unset($row->_errors);
                 $row->id = $category->id;
                 $row->name = $category->name;
                 $row->alias = $category->alias;
                 $row->link = $category->link;
                 $row->parent = $category->parent;
                 $row->extraFieldsGroup = $category->extraFieldsGroup;
                 $row->image = $category->image;
                 $row->ordering = $category->ordering;
                 //$row->plugins = $category->plugins;
                 $row->events = $category->event;
                 $row->chidlren = $subCategories;
                 $response->category = $row;
                 break;
             case 'user':
                 //Get user
                 $id = JRequest::getInt('id');
                 $userObject = JFactory::getUser($id);
                 //Check user status
                 if ($userObject->block) {
                     JError::raiseError(404, JText::_('K2_USER_NOT_FOUND'));
                 }
                 //Get K2 user profile
                 $userObject->profile = $model->getUserProfile();
                 //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');
                 }
                 //Set title
                 $title = $userObject->name;
                 // Set ordering
                 $ordering = $params->get('userOrdering');
                 // Set parameters prefix
                 $prefix = 'user';
                 // Prepare the JSON user object;
                 $row = new JObject();
                 unset($row->_errors);
                 //$row->id = $userObject->id;
                 $row->name = $userObject->name;
                 //$row->username = $userObject->username;
                 if (isset($userObject->profile->plugins)) {
                     unset($userObject->profile->plugins);
                 }
                 $row->profile = $userObject->profile;
                 $row->avatar = $userObject->avatar;
                 $row->events = $userObject->event;
                 $response->user = $row;
                 break;
             case 'tag':
                 //Set limit
                 $limit = $params->get('tagItemCount');
开发者ID:jamielaff,项目名称:als_resourcing,代码行数:67,代码来源:view.json.php

示例5: display


//.........这里部分代码省略.........
     }
     if ($item->publish_up != $nullDate && $item->publish_up > $now) {
         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

示例6: getTopCommenters

 function getTopCommenters(&$params)
 {
     JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2' . DS . 'tables');
     $limit = $params->get('commenters_limit', '5');
     $user =& JFactory::getUser();
     $aid = $user->get('aid');
     $db =& JFactory::getDBO();
     $query = "SELECT COUNT(id) as counter, userName, userID, commentEmail FROM #__k2_comments WHERE userID > 0 AND published = 1 GROUP BY userID ORDER BY counter DESC";
     $db->setQuery($query, 0, $limit);
     $rows = $db->loadObjectList();
     $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_!~*'().;?:\\@&=+\$,%#-]+)*/?)@";
     require_once JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'models' . DS . 'item.php';
     $model = new K2ModelItem();
     $componentParams =& JComponentHelper::getParams('com_k2');
     if (count($rows)) {
         foreach ($rows as $row) {
             if ($row->counter > 0) {
                 $row->link = JRoute::_(K2HelperRoute::getUserRoute($row->userID));
                 if ($params->get('commentAvatar')) {
                     $row->userImage = K2HelperUtilities::getAvatar($row->userID, $row->commentEmail, $componentParams->get('commenterImgWidth'));
                 }
                 if ($params->get('commenterLatestComment')) {
                     $query = "SELECT * FROM #__k2_comments WHERE userID = " . (int) $row->userID . " AND published = 1 ORDER BY commentDate DESC";
                     $db->setQuery($query, 0, 1);
                     $comment = $db->loadObject();
                     $item =& JTable::getInstance('K2Item', 'Table');
                     $item->load($comment->itemID);
                     $category =& JTable::getInstance('K2Category', 'Table');
                     $category->load($item->catid);
                     $row->latestCommentText = $comment->commentText;
                     $row->latestCommentText = preg_replace($pattern, '<a target="_blank" rel="nofollow" href="\\0">\\0</a>', $row->latestCommentText);
                     $row->latestCommentLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($item->id . ':' . urlencode($item->alias), $item->catid . ':' . urlencode($category->alias)))) . "#comment{$comment->id}";
                     $row->latestCommentDate = $comment->commentDate;
                 }
                 $commenters[] = $row;
             }
         }
         if (isset($commenters)) {
             return $commenters;
         }
     }
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:42,代码来源:helper.php

示例7: display


//.........这里部分代码省略.........
                     }
                     $child->image = K2HelperUtilities::getCategoryImage($child->image, $params);
                     $child->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($child->id . ':' . urlencode($child->alias))));
                     $subCategories[] = $child;
                 }
                 $this->assignRef('subCategories', $subCategories);
             }
             //Set limit
             $limit = $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items') + $params->get('num_links');
             //Set featured flag
             JRequest::setVar('featured', $params->get('catFeaturedItems'));
             //Set layout
             $this->setLayout('category');
             //Set title
             $title = $category->name;
             // Set ordering
             if ($params->get('singleCatOrdering')) {
                 $ordering = $params->get('singleCatOrdering');
             } else {
                 $ordering = $params->get('catOrdering');
             }
             break;
         case 'user':
             //Get user
             $id = JRequest::getInt('id');
             $userObject =& JFactory::getUser($id);
             //Check user status
             if ($userObject->block) {
                 JError::raiseError(404, JText::_('K2_USER_NOT_FOUND'));
             }
             //Get K2 user profile
             $userObject->profile = $model->getUserProfile();
             //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));
             }
             $this->assignRef('user', $userObject);
             //Set layout
             $this->setLayout('user');
             //Set limit
             $limit = $params->get('userItemCount');
             //Set title
             $title = $userObject->name;
             // Set ordering
             $ordering = $params->get('userOrdering');
             break;
         case 'tag':
             //Set layout
             $this->setLayout('tag');
             //Set limit
             $limit = $params->get('tagItemCount');
             //set title
             $title = JText::_('K2_DISPLAYING_ITEMS_BY_TAG') . ' ' . JRequest::getVar('tag');
             // Set ordering
             $ordering = $params->get('tagOrdering');
             break;
         case 'search':
             //Set layout
             $this->setLayout('generic');
             $tpl = JRequest::getCmd('tpl', null);
开发者ID:vuchannguyen,项目名称:dayhoc,代码行数:67,代码来源:view.raw.php

示例8: info

 static function info($config, $item, $num = 1)
 {
     // %AUTHOR %DATE %HITS %CATEGORY
     $news_info = '';
     //
     if ($num == 1) {
         if ($config['news_content_info_pos'] != 'disabled') {
             $class = 'nspInfo1 t' . $config['news_content_info_pos'] . ' f' . $config['news_content_info_float'];
         }
     } else {
         if ($config['news_content_info2_pos'] != 'disabled') {
             $class = 'nspInfo2 t' . $config['news_content_info2_pos'] . ' f' . $config['news_content_info2_float'];
         }
     }
     //
     if ($config['news_content_info_pos'] != 'disabled' && $num == 1 || $config['news_content_info2_pos'] != 'disabled' && $num == 2) {
         $news_info = '<p class="nspInfo ' . $class . '">' . $config['info' . ($num == 2 ? '2' : '') . '_format'] . '</p>';
         //
         $author = trim(htmlspecialchars($item['author_alias'])) != '' ? htmlspecialchars($item['author_alias']) : htmlspecialchars($item['author_username']);
         $info_author = $config['user_avatar'] == 1 ? '<span><img src="' . K2HelperUtilities::getAvatar($item['author_id'], $item['author_email'], $config['avatar_size']) . '" alt="' . $author . ' - avatar" class="nspAvatar" width="' . $config['avatar_size'] . '" height="' . $config['avatar_size'] . '" /> ' . $author . '</span>' : $author;
         //
         $info_date = JHTML::_('date', $item['date'], $config['date_format']);
         //
         $info_hits = JText::_('MOD_NEWS_PRO_GK5_NHITS') . $item['hits'];
         $info_rate = $item['rating_count'] > 0 ? '<span class="nspRate">' . JText::_('MOD_NEWS_PRO_GK5_NSP_RATE') . ' ' . number_format($item['rating_sum'] / $item['rating_count'], 2) . '</span>' : '';
         $info_category = $config['category_link'] == 1 ? '<a href="' . NSP_GK5_com_k2_View::categoryLink($item) . '" >' . $item['catname'] . '</a>' : $item['catname'];
         $info_comments = JText::_('MOD_NEWS_PRO_GK5_NO_COMMENTS');
         //
         if (isset($item['comments'])) {
             if ($item['comments'] == 1) {
                 $info_comments = JText::_('MOD_NEWS_PRO_GK5_1COMMENT');
             } else {
                 if ($item['comments'] > 1 && $item['comments'] < 5) {
                     $info_comments = $item['comments'] . ' ' . JText::_('MOD_NEWS_PRO_GK5_MORECOMMENTS');
                 } else {
                     if ($item['comments'] >= 5) {
                         $info_comments = $item['comments'] . ' ' . JText::_('MOD_NEWS_PRO_GK5_MUCHMORECOMMENTS');
                     }
                 }
             }
         }
         //
         $info_tags = '';
         if (isset($item['tags']) && count($item['tags']) > 0) {
             $i = 0;
             foreach ($item['tags'] as $tag) {
                 $link = urldecode(JRoute::_(K2HelperRoute::getTagRoute($tag)));
                 if ($i == 0) {
                     $info_tags .= '<a href="' . $link . '">' . $tag . '</a>';
                 } else {
                     $info_tags .= ', <a href="' . $link . '">' . $tag . '</a>';
                 }
                 //
                 $i++;
             }
         }
         //
         $news_info = str_replace('%AUTHOR', $info_author, $news_info);
         $news_info = str_replace('%DATE', $info_date, $news_info);
         $news_info = str_replace('%HITS', $info_hits, $news_info);
         $news_info = str_replace('%CATEGORY', $info_category, $news_info);
         $news_info = str_replace('%RATE', $info_rate, $news_info);
         $news_info = str_replace('%COMMENTS', $info_comments, $news_info);
         $news_info = str_replace('%TAGS', $info_tags, $news_info);
     } else {
         return '';
     }
     //
     return $news_info;
 }
开发者ID:Roma48,项目名称:abazherka_old,代码行数:70,代码来源:view.php

示例9: info

 static function info($config, $item, $num = 1)
 {
     // %AUTHOR %DATE %HITS %CATEGORY
     $news_info = '';
     //
     if ($num == 1) {
         if ($config['news_content_info_pos'] != 'disabled') {
             $class = 'nspInfo1 t' . $config['news_content_info_pos'] . ' f' . $config['news_content_info_float'];
         }
     } else {
         if ($config['news_content_info2_pos'] != 'disabled') {
             $class = 'nspInfo2 t' . $config['news_content_info2_pos'] . ' f' . $config['news_content_info2_float'];
         }
     }
     //
     if ($config['news_content_info_pos'] != 'disabled' && $num == 1 || $config['news_content_info2_pos'] != 'disabled' && $num == 2) {
         $news_info_tag = stripos($config['info' . ($num == 2 ? '2' : '') . '_format'], '%CART') !== FALSE ? 'div' : 'p';
         $news_info = '<' . $news_info_tag . ' class="nspInfo ' . $class . '">' . $config['info' . ($num == 2 ? '2' : '') . '_format'] . '</' . $news_info_tag . '>';
         //
         $author = trim(htmlspecialchars($item['author_alias'])) != '' ? htmlspecialchars($item['author_alias']) : htmlspecialchars($item['author_username']);
         $info_author = $config['user_avatar'] == 1 ? '<span><img src="' . K2HelperUtilities::getAvatar($item['author_id'], $item['author_email'], $config['avatar_size']) . '" alt="' . $author . ' - avatar" class="nspAvatar" width="' . $config['avatar_size'] . '" height="' . $config['avatar_size'] . '" /> ' . $author . '</span>' : $author;
         //
         $info_date = JHTML::_('date', $item['date'], $config['date_format']);
         //
         $info_hits = JText::_('MOD_NEWS_PRO_GK5_NHITS') . $item['hits'];
         // case when there is no rates
         if ($item['rating_count'] == 0) {
             $item['rating_count'] = 1;
         }
         $info_rate = $item['rating_count'] > 0 ? '<span class="nspRate">' . JText::_('MOD_NEWS_PRO_GK5_NSP_RATE') . ' ' . number_format($item['rating_sum'] / $item['rating_count'], 2) . '</span>' : '';
         $info_stars = '<span class="nsp-stars">';
         $stars_count = floor($item['rating_sum'] / $item['rating_count']);
         for ($i = 0; $i < 5; $i++) {
             $info_stars .= $i < $stars_count ? '<span class="nsp-star-1"></span>' : '<span class="nsp-star-0"></span>';
         }
         $info_stars .= '</span>';
         $info_category = $config['category_link'] == 1 ? '<a href="' . NSP_GK5_com_k2_View::categoryLink($item) . '" >' . $item['catname'] . '</a>' : $item['catname'];
         $info_comments = JText::_('MOD_NEWS_PRO_GK5_NO_COMMENTS');
         //
         if (isset($item['comments'])) {
             if ($item['comments'] == 1) {
                 $info_comments = JText::_('MOD_NEWS_PRO_GK5_1COMMENT');
             } else {
                 if ($item['comments'] > 1 && $item['comments'] < 5) {
                     $info_comments = $item['comments'] . ' ' . JText::_('MOD_NEWS_PRO_GK5_MORECOMMENTS');
                 } else {
                     if ($item['comments'] >= 5) {
                         $info_comments = $item['comments'] . ' ' . JText::_('MOD_NEWS_PRO_GK5_MUCHMORECOMMENTS');
                     }
                 }
             }
         }
         //
         $info_comments_short = '0';
         $link = NSP_GK5_com_k2_View::itemLink($item);
         //
         if (isset($item['comments'])) {
             $info_comments_short = $item['comments'];
         }
         $info_comments_short = '<a href="' . $link . '">' . $info_comments_short . '</a>';
         //
         $info_tags = '';
         if (isset($item['tags']) && count($item['tags']) > 0) {
             $i = 0;
             foreach ($item['tags'] as $tag) {
                 $link = urldecode(JRoute::_(K2HelperRoute::getTagRoute($tag)));
                 if ($i == 0) {
                     $info_tags .= '<a href="' . $link . '">' . $tag . '</a>';
                 } else {
                     $info_tags .= ', <a href="' . $link . '">' . $tag . '</a>';
                 }
                 //
                 $i++;
             }
         }
         // get k2 store data
         $k2store_data = array('cart' => '', 'price' => '');
         // get K2Store data if necessary
         if (stripos($news_info, '%CART') !== FALSE || stripos($news_info, '%PRICE') !== FALSE) {
             $k2store_data = NSP_GK5_com_k2_View::k2Store($item);
             if (stripos($news_info, '%CART') !== FALSE) {
                 // load K2Store scripts
                 $uri = JURI::getInstance();
                 $document = JFactory::getDocument();
                 $headData = $document->getHeadData();
                 // generate keys of script section
                 $headData_keys = array_keys($headData["scripts"]);
                 // set variable for false
                 $engine_founded = false;
                 // searching phrase mootools in scripts paths
                 if (array_search($uri->root() . 'media/k2store/js/k2store.js', $headData_keys) > 0) {
                     $engine_founded = true;
                 }
                 // if engine doesn't exists in the head section
                 if (!$engine_founded) {
                     // add new script tag connected with mootools from module
                     $document->addScript($uri->root() . 'media/k2store/js/k2store.noconflict.js');
                     $document->addScript($uri->root() . 'media/k2store/js/k2store.js');
                 }
             }
//.........这里部分代码省略.........
开发者ID:networksoft,项目名称:networksoft.com.co,代码行数:101,代码来源:view.php

示例10: defined

// no direct access
defined('_JEXEC') or die;

?>

<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2UserBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">

	<?php if($userGreetingText): ?>
	<p class="ubGreeting"><?php echo $userGreetingText; ?></p>
  <?php endif; ?>

	<div class="k2UserBlockDetails">
	  <?php if($params->get('userAvatar')): ?>
	  <a class="k2Avatar ubAvatar" href="<?php echo JRoute::_(K2HelperRoute::getUserRoute($user->id)); ?>" title="<?php echo JText::_('K2_MY_PAGE'); ?>">
	  	<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>
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:30,代码来源:userblock.php

示例11: display


//.........这里部分代码省略.........
                        $document->addScriptDeclaration($js);
                    }
                }
                // 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
开发者ID:emavro,项目名称:k2,代码行数:67,代码来源:view.html.php

示例12: getTopCommenters

 function getTopCommenters(&$params)
 {
     JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2' . DS . 'tables');
     $limit = $params->get('commenters_limit', '5');
     $user =& JFactory::getUser();
     $aid = $user->get('aid');
     $db =& JFactory::getDBO();
     $query = "SELECT COUNT(id) as counter, userName, userID, commentEmail FROM #__k2_comments" . " WHERE userID > 0" . " AND published = 1";
     " GROUP BY userID ORDER BY counter DESC";
     $db->setQuery($query, 0, $limit);
     $rows = $db->loadObjectList();
     require_once JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'models' . DS . 'item.php';
     $model = new K2ModelItem();
     $componentParams =& JComponentHelper::getParams('com_k2');
     if (count($rows)) {
         foreach ($rows as $row) {
             if ($row->counter > 0) {
                 $row->link = JRoute::_(K2HelperRoute::getUserRoute($row->userID));
                 if ($params->get('commentAvatar')) {
                     $row->userImage = K2HelperUtilities::getAvatar($row->userID, $row->commentEmail, $componentParams->get('commenterImgWidth'));
                 }
                 if ($params->get('commenterLatestComment')) {
                     $query = "SELECT * FROM #__k2_comments" . " WHERE userID = {$row->userID}" . " AND published = 1" . " ORDER BY commentDate DESC";
                     $db->setQuery($query, 0, 1);
                     $comment = $db->loadObject();
                     $item =& JTable::getInstance('K2Item', 'Table');
                     $item->load($comment->itemID);
                     $category =& JTable::getInstance('K2Category', 'Table');
                     $category->load($item->catid);
                     $row->latestCommentText = $comment->commentText;
                     $row->latestCommentLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($item->id . ':' . urlencode($item->alias), $item->catid . ':' . urlencode($category->alias)))) . "#comment{$comment->id}";
                     $row->latestCommentDate = $comment->commentDate;
                 }
                 $commenters[] = $row;
             }
         }
         if (isset($commenters)) {
             return $commenters;
         }
     }
 }
开发者ID:navinpai,项目名称:GEC-Tandav,代码行数:41,代码来源:helper.php

示例13: getAvatar

function getAvatar($userId,$wallversion)
{	
$path=JURI::base(); 
$temp='plugins/content/loadjomwall/';
$path=str_replace($temp,'',$path);
$db =& JFactory::getDBO();
$app = JFactory::getApplication('site');
$config =  & $app->getParams('com_awdwall');
$template 		= $config->get('temp', 'blue');
$avatarintergration 		= $config->get('avatarintergration', '0');
		$query 	= "SELECT facebook_id FROM #__jconnector_ids WHERE user_id = "  . (int)$userId;
		$db->setQuery($query);
		$facebook_id = $db->loadResult();
		if($facebook_id)
		{
			$avatar='https://graph.facebook.com/'.$facebook_id.'/picture?type=square';
		}
		else
		{
			
			$query 	= 'SELECT avatar FROM #__awd_wall_users WHERE user_id = ' . (int)$userId;
			$db 	= & JFactory::getDBO();
			$db->setQuery($query);
			$img = $db->loadResult();		
			
			if($img == NULL){
				$avatar = $path . "components/com_awdwall/images/".$template."/".$template."32.png";
			}else{
				$avatar = $path. "images/wallavatar/" . $userId . "/thumb/tn32" . $img;
			}
			
		}
	    if($avatarintergration==1) // k2
		{
				if(file_exists(JPATH_SITE . '/components/com_k2/k2.php'))
				{
					require_once (JPATH_SITE . '/components/com_k2/helpers/utilities.php');
				
				$avatar=K2HelperUtilities::getAvatar($userId);
				}
		}
		else if($avatarintergration==2) // easyblog
		{
				if(file_exists(JPATH_SITE . '/components/com_easyblog/easyblog.php'))
				{
					require_once (JPATH_SITE . '/components/com_easyblog/helpers/helper.php');
				
				$blogger	= EasyBlogHelper::getTable( 'Profile', 'Table');
				$blogger->load( $userId );
				$avatar=$blogger->getAvatar();
				}
		}
		else if($avatarintergration==3) // alphauserpoint
		{
				if(file_exists(JPATH_SITE . '/components/com_alphauserpoints/alphauserpoints.php'))
				{
					require_once (JPATH_SITE . '/components/com_alphauserpoints/helper.php');
					require_once (JPATH_SITE . '/components/com_alphauserpoints/helpers/helpers.php');
				
					$_user_info = AlphaUserPointsHelper::getUserInfo ( $referrerid='', $userId  );
					$com_params = &JComponentHelper::getParams( 'com_alphauserpoints' );
					$useAvatarFrom = $com_params->get('useAvatarFrom');
					$height = 32;
					$width=32;
					$avatar = getAvatar( $useAvatarFrom, $_user_info, $height,$width);	
					$doc = new DOMDocument();
					$doc->loadHTML($avatar);
					$imageTags = $doc->getElementsByTagName('img');
					
					foreach($imageTags as $tag) {
						$avatar=$tag->getAttribute('src');
					}
				}
		}
		return $avatar;
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:76,代码来源:loadjomwall_ajax.php

示例14: info_k2

 function info_k2($config, $news_catname, $news_cid, $news_cat_alias, $news_author, $news_author_id, $news_author_email, $news_date, $news_hits, $news_id, $news_alias, $comments, $rating_count, $rating_sum, $num = 1)
 {
     //
     require_once JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'helpers' . DS . 'route.php';
     require_once JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'helpers' . DS . 'utilities.php';
     // %AUTHOR %COMMENTS %DATE %HITS %CATEGORY %RATE
     $news_info = '';
     //
     if ($num == 1) {
         if ($config['news_content_info_pos'] != 'disabled') {
             $class = ' nspInfo1 t' . $config['news_content_info_pos'] . ' f' . $config['news_content_info_float'];
         }
     } else {
         if ($config['news_content_info2_pos'] != 'disabled') {
             $class = ' nspInfo2 t' . $config['news_content_info2_pos'] . ' f' . $config['news_content_info2_float'];
         }
     }
     //
     if ($config['news_content_info_pos'] != 'disabled' && $num == 1 || $config['news_content_info2_pos'] != 'disabled' && $num == 2) {
         $news_info = '<p class="nspInfo ' . $class . '">' . $config['info' . ($num == 2 ? '2' : '') . '_format'] . '</p>';
         //
         $info_category = $config['category_link'] == 1 ? '<a href="' . urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($news_cid . ':' . urlencode($news_cat_alias)))) . '" >' . $news_catname . '</a>' : $news_catname;
         $info_author = $config['user_avatar'] == 1 ? '<span><img src="' . K2HelperUtilities::getAvatar($news_author_id, $news_author_email, $config['avatar_size']) . '" alt="' . htmlspecialchars($news_author) . ' - avatar" class="nspAvatar" width="' . $config['avatar_size'] . '" height="' . $config['avatar_size'] . '" /> ' . $news_author . '</span>' : $news_author;
         $info_date = JHTML::_('date', $news_date, $config['date_format']);
         $info_hits = JText::_('MOD_NEWS_PRO_GK4_NHITS') . $news_hits;
         //
         if ($config['no_comments_text'] && (!isset($comments['art' . $news_id]) || $comments['art' . $news_id] == 0)) {
             $comments_amount = JText::_('MOD_NEWS_PRO_GK4_NO_COMMENTS');
         } else {
             $comments_amount = JText::_('MOD_NEWS_PRO_GK4_COMMENTS') . ' (' . (isset($comments['art' . $news_id]) ? $comments['art' . $news_id] : '0') . ')';
         }
         $info_comments = '<a class="nspComments" href="' . urldecode(JRoute::_(K2HelperRoute::getItemRoute($news_id . ':' . urlencode($news_alias), $news_cid . ':' . urlencode($news_cat_alias)))) . '#itemCommentsAnchor">' . $comments_amount . '</a>';
         //
         $info_rate = $rating_count > 0 ? '<span class="nspRate">' . JText::_('MOD_NEWS_PRO_GK4_NSP_RATE') . ' <strong>' . number_format($rating_sum / $rating_count, 2) . '</strong></span>' : '';
         //
         $news_info = str_replace('%AUTHOR', $info_author, $news_info);
         $news_info = str_replace('%COMMENTS', $info_comments, $news_info);
         $news_info = str_replace('%DATE', $info_date, $news_info);
         $news_info = str_replace('%HITS', $info_hits, $news_info);
         $news_info = str_replace('%CATEGORY', $info_category, $news_info);
         $news_info = str_replace('%RATE', $info_rate, $news_info);
     }
     //
     return $news_info;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:45,代码来源:layout.parts.php

示例15: getListComment

 public function getListComment($portfolioId, $limit, $limitstart, $orderDir)
 {
     // Create a new query object.
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $user = JFactory::getUser();
     $app = JFactory::getApplication();
     // Select fields
     $query->select('*');
     // From the bt portfolio_comments table
     $query->from('#__bt_portfolio_comments');
     $query->where('published = 1');
     $query->where('item_id = ' . $portfolioId);
     $query->order('created ' . $orderDir);
     if (!$limit) {
         $limit = $app->getCfg('list_limit', 0);
     }
     $items = $this->_getList($query, $limitstart, $limit);
     $params = JComponentHelper::getParams("com_bt_portfolio");
     $user->image = '';
     $user->link = '';
     $avatar_type = $params->get('avatars_integrated');
     foreach ($items as $item) {
         $item->image = '';
         $item->link = '';
         $item->admin = false;
         if ($user->authorise('core.admin')) {
             $item->admin = true;
         }
         switch ($avatar_type) {
             case 'k2':
                 if (is_file(JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'helpers' . DS . 'route.php')) {
                     JLoader::register('K2HelperRoute', JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'helpers' . DS . 'route.php');
                     JLoader::register('K2HelperUtilities', JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'helpers' . DS . 'utilities.php');
                     $item->image = K2HelperUtilities::getAvatar($item->user_id, $item->email);
                     if ($item->user_id) {
                         $item->link = JRoute::_(K2HelperRoute::getUserRoute($item->user_id));
                     } else {
                         $item->link = "#";
                     }
                 }
                 break;
             case 'cb':
                 global $_CB_framework, $_CB_database, $ueConfig, $mainframe, $_SERVER;
                 if (defined('JPATH_ADMINISTRATOR')) {
                     if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php')) {
                         echo 'CB not installed';
                         break;
                     }
                     include_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
                 } else {
                     if (!file_exists($mainframe->getCfg('absolute_path') . '/administrator/components/com_comprofiler/plugin.foundation.php')) {
                         echo 'CB not installed';
                         break;
                     }
                     include_once $mainframe->getCfg('absolute_path') . '/administrator/components/com_comprofiler/plugin.foundation.php';
                 }
                 $cbUser =& CBuser::getInstance($item->user_id);
                 $item->image = $cbUser->avatarFilePath();
                 if ($item->user_id) {
                     $item->link = JRoute::_('index.php?option=com_comprofiler&task=userProfile&user=' . $item->user_id);
                 }
                 break;
             default:
                 break;
         }
     }
     return $items;
 }
开发者ID:Tommar,项目名称:remate,代码行数:69,代码来源:comment.php


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