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


PHP K2HelperUtilities类代码示例

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


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

示例1: report

    function report($tpl = null)
    {
        JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables');
        $row =& JTable::getInstance('K2Comment', 'Table');
        $row->load(JRequest::getInt('commentID'));
        if (!$row->published) {
            JError::raiseError(404, JText::_('K2_NOT_FOUND'));
        }
        $this->assignRef('row', $row);
        $user = JFactory::getUser();
        $this->assignRef('user', $user);
        $params =& K2HelperUtilities::getParams('com_k2');
        if (!$params->get('comments') || !$params->get('commentsReporting') || $params->get('commentsReporting') == '2' && $user->guest) {
            JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
        }
        $this->assignRef('params', $params);
        if ($params->get('recaptcha') && $user->guest) {
            $document = JFactory::getDocument();
            $document->addScript('http://api.recaptcha.net/js/recaptcha_ajax.js');
            $js = '
			function showRecaptcha(){
				Recaptcha.create("' . $params->get('recaptcha_public_key') . '", "recaptcha", {
					theme: "' . $params->get('recaptcha_theme', 'clean') . '"
				});
			}
			$K2(window).load(function() {
				showRecaptcha();
			});
			';
            $document->addScriptDeclaration($js);
        }
        parent::display($tpl);
    }
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:33,代码来源:view.html.php

示例2: getAvatar

 function getAvatar($userID, $email = NULL, $width = 50)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.application.component.model');
     $mainframe =& JFactory::getApplication();
     $params =& K2HelperUtilities::getParams('com_k2');
     if (K2_CB && $userID != 'alias') {
         $cbUser = CBuser::getInstance((int) $userID);
         if (is_object($cbUser)) {
             $avatar = $cbUser->getField('avatar', null, 'csv', 'none', 'profile');
             return $avatar;
         }
     }
     /*
     		 // JomSocial Avatar integration
     		 if(JFolder::exists(JPATH_SITE.DS.'components'.DS.'com_community') && $userID>0){
     		 $userInfo = &CFactory::getUser($userID);
     		 return $userInfo->getThumbAvatar();
     		 }
     */
     // Check for placeholder overrides
     if (JFile::exists(JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'images' . DS . 'placeholder' . DS . 'user.png')) {
         $avatarPath = 'templates/' . $mainframe->getTemplate() . '/images/placeholder/user.png';
     } else {
         $avatarPath = 'components/com_k2/images/placeholder/user.png';
     }
     // Continue with default K2 avatar determination
     if ($userID == 'alias') {
         $avatar = JURI::root(true) . '/' . $avatarPath;
     } else {
         if ($userID == 0) {
             if ($params->get('gravatar') && !is_null($email)) {
                 $avatar = 'http://www.gravatar.com/avatar/' . md5($email) . '?s=' . $width . '&default=' . urlencode(JURI::root() . $avatarPath);
             } else {
                 $avatar = JURI::root(true) . '/' . $avatarPath;
             }
         } else {
             if (is_numeric($userID) && $userID > 0) {
                 JModel::addIncludePath(JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'models');
                 $model =& JModel::getInstance('Item', 'K2Model');
                 $profile = $model->getUserProfile($userID);
                 $avatar = is_null($profile) ? '' : $profile->image;
                 if (empty($avatar)) {
                     if ($params->get('gravatar') && !is_null($email)) {
                         $avatar = 'http://www.gravatar.com/avatar/' . md5($email) . '?s=' . $width . '&default=' . urlencode(JURI::root() . $avatarPath);
                     } else {
                         $avatar = JURI::root(true) . '/' . $avatarPath;
                     }
                 } else {
                     $avatar = JURI::root(true) . '/media/k2/users/' . $avatar;
                 }
             }
         }
     }
     if (!$params->get('userImageDefault') && $avatar == JURI::root(true) . '/' . $avatarPath) {
         $avatar = '';
     }
     return $avatar;
 }
开发者ID:vuchannguyen,项目名称:dayhoc,代码行数:59,代码来源:utilities.php

示例3: loadjQuery

 public static function loadjQuery($ui = false, $mediaManager = false)
 {
     JLoader::register('K2HelperUtilities', JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'helpers' . DS . 'utilities.php');
     $application = JFactory::getApplication();
     $document = JFactory::getDocument();
     $params = K2HelperUtilities::getParams('com_k2');
     if ($document->getType() == 'html') {
         if (K2_JVERSION == '15') {
             JHtml::_('behavior.mootools');
         } else {
             if (K2_JVERSION == '25') {
                 JHtml::_('behavior.framework');
             } else {
                 JHtml::_('behavior.framework');
                 if ($application->isAdmin() || $application->isSite() && $params->get('jQueryHandling')) {
                     JHtml::_('jquery.framework');
                 }
             }
         }
         $handling = $application->isAdmin() ? $params->get('backendJQueryHandling', 'remote') : $params->get('jQueryHandling', '1.8remote');
         // jQuery
         if (K2_JVERSION != '30') {
             if ($handling == 'remote') {
                 $document->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js');
             } else {
                 if ($handling == 'local') {
                     $document->addScript(JURI::root(true) . '/media/k2/assets/js/jquery-1.8.3.min.js');
                 } else {
                     if ($handling && JString::strpos($handling, 'remote') !== false) {
                         if ($handling == '1.9remote') {
                             $handling = '1remote';
                         }
                         $document->addScript('//ajax.googleapis.com/ajax/libs/jquery/' . str_replace('remote', '', $handling) . '/jquery.min.js');
                     } else {
                         if ($handling && JString::strpos($handling, 'remote') === false) {
                             $document->addScript(JURI::root(true) . '/media/k2/assets/js/jquery-' . $handling . '.min.js');
                         }
                     }
                 }
             }
         }
         // jQuery UI
         if ($application->isAdmin() || $ui) {
             // No conflict loaded when $ui requested or in the backend.
             // No need to reload for $mediaManager as the latter is always called with $ui
             $document->addScript(JURI::root(true) . '/media/k2/assets/js/k2.noconflict.js');
             if ($handling == 'local') {
                 $document->addScript(JURI::root(true) . '/media/k2/assets/js/jquery-ui-1.8.24.custom.min.js');
             } else {
                 $document->addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js');
             }
         }
         if ($mediaManager) {
             $document->addScript(JURI::root(true) . '/media/k2/assets/js/elfinder.min.js?v=2.6.7');
         }
     }
 }
开发者ID:Roma48,项目名称:abazherka_old,代码行数:57,代码来源:html.php

示例4: getUserRoute

 public static function getUserRoute($userID)
 {
     if (K2_CB) {
         global $_CB_framework;
         return $_CB_framework->userProfileUrl((int) $userID);
     }
     $key = (int) $userID;
     if (isset(self::$cache['user'][$key])) {
         return self::$cache['user'][$key];
     }
     $needles = array('user' => (int) $userID);
     $user = JFactory::getUser($userID);
     if (K2_JVERSION != '15' && JFactory::getConfig()->get('unicodeslugs') == 1) {
         $alias = JApplication::stringURLSafe($user->name);
     } else {
         if (JPluginHelper::isEnabled('system', 'unicodeslug') || JPluginHelper::isEnabled('system', 'jw_unicodeSlugsExtended')) {
             $alias = JFilterOutput::stringURLSafe($user->name);
         } else {
             mb_internal_encoding("UTF-8");
             mb_regex_encoding("UTF-8");
             $alias = trim(mb_strtolower($user->name));
             $alias = str_replace('-', ' ', $alias);
             $alias = mb_ereg_replace('[[:space:]]+', ' ', $alias);
             $alias = trim(str_replace(' ', '', $alias));
             $alias = str_replace('.', '', $alias);
             $stripthese = ',|~|!|@|%|^|(|)|<|>|:|;|{|}|[|]|&|`|„|‹|’|‘|“|â€�|•|›|«|´|»|°|«|»|…';
             $strips = explode('|', $stripthese);
             foreach ($strips as $strip) {
                 $alias = str_replace($strip, '', $alias);
             }
             $params = K2HelperUtilities::getParams('com_k2');
             $SEFReplacements = array();
             $items = explode(',', $params->get('SEFReplacements', NULL));
             foreach ($items as $item) {
                 if (!empty($item)) {
                     @(list($src, $dst) = explode('|', trim($item)));
                     $SEFReplacements[trim($src)] = trim($dst);
                 }
             }
             foreach ($SEFReplacements as $key => $value) {
                 $alias = str_replace($key, $value, $alias);
             }
             $alias = trim($alias, '-.');
             if (trim(str_replace('-', '', $alias)) == '') {
                 $datenow = JFactory::getDate();
                 $alias = K2_JVERSION == '15' ? $datenow->toFormat("%Y-%m-%d-%H-%M-%S") : $datenow->format("Y-m-d-H-i-s");
             }
         }
     }
     $link = 'index.php?option=com_k2&view=itemlist&task=user&id=' . $userID . ':' . $alias;
     if ($item = K2HelperRoute::_findItem($needles)) {
         $link .= '&Itemid=' . $item->id;
     }
     self::$cache['user'][$key] = $link;
     return $link;
 }
开发者ID:emavro,项目名称:k2,代码行数:56,代码来源:route.php

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

示例6: getLatestComments

 public static function getLatestComments($params)
 {
     $model = K2Model::getInstance('Comments');
     $model->setState('filter.items', true);
     $model->setState('state', 1);
     $filter = $params->get('category_id');
     if ($filter && isset($filter->enabled) && $filter->enabled) {
         $model->setState('category', $filter->categories);
     }
     $model->setState('limit', (int) $params->get('comments_limit', '5'));
     $model->setState('sorting', 'id.reverse');
     $comments = $model->getRows();
     foreach ($comments as $comment) {
         if ((int) $params->get('comments_word_limit')) {
             $comment->text = K2HelperUtilities::wordLimit($comment->text, $params->get('comments_word_limit'));
         }
         $comment->user->displayName = $params->get('commenterName', 1) == 2 ? $comment->user->username : $comment->user->name;
     }
     return $comments;
 }
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:20,代码来源:helper.php

示例7:

" title="<?php 
            if (!empty($item->image_caption)) {
                echo K2HelperUtilities::cleanHtml($item->image_caption);
            } else {
                echo K2HelperUtilities::cleanHtml($item->title);
            }
            ?>
">
				    	<img src="<?php 
            echo $item->imageGeneric;
            ?>
" alt="<?php 
            if (!empty($item->image_caption)) {
                echo K2HelperUtilities::cleanHtml($item->image_caption);
            } else {
                echo K2HelperUtilities::cleanHtml($item->title);
            }
            ?>
" style="width:<?php 
            echo $this->params->get('itemImageGeneric');
            ?>
px; height:auto;" />
				    </a>
				  </span>
				  <div class="clr"></div>
			  </div>
			  <?php 
        }
        ?>
		
				<div class="clr"></div>
开发者ID:ForAEdesWeb,项目名称:AEW9,代码行数:31,代码来源:user.php

示例8: defined

<?php

/**
 * @version		$Id: category_item.php 493 2010-06-17 14:58:58Z joomlaworks $
 * @package		K2
 * @author		JoomlaWorks http://www.joomlaworks.gr
 * @copyright	Copyright (c) 2006 - 2010 JoomlaWorks, a business unit of Nuevvo Webware Ltd. All rights reserved.
 * @license		GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
 */
// no direct access
defined('_JEXEC') or die('Restricted access');
// Define default image size (do not change)
K2HelperUtilities::setDefaultImage($this->item, 'itemlist', $this->item->params);
?>

<!-- Start K2 Item Layout -->
<div class="catItemView group<?php 
echo ucfirst($this->item->itemGroup);
echo $this->item->featured ? ' catItemIsFeatured' : '';
if ($this->item->params->get('pageclass_sfx')) {
    echo ' ' . $this->item->params->get('pageclass_sfx');
}
?>
">

	<!-- Plugins: BeforeDisplay -->
	<?php 
echo $this->item->event->BeforeDisplay;
?>

	<!-- K2 Plugins: K2BeforeDisplay -->
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:31,代码来源:category_item.php

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

示例10: getListItems


//.........这里部分代码省略.........
             break;
         case 'rand':
             $orderby = 'RAND()';
             break;
         case 'best':
             $orderby = 'rating DESC';
             break;
         case 'comments':
             if ($params->get('popularityRange')) {
                 $datenow = JFactory::getDate();
                 $date = K2_JVERSION == '15' ? $datenow->toMySQL() : $datenow->toSql();
                 $query .= " AND i.created > DATE_SUB('{$date}',INTERVAL " . $params->get('popularityRange') . " DAY) ";
             }
             $query .= " GROUP BY i.id ";
             $orderby = 'numOfComments DESC';
             break;
         case 'modified':
             $orderby = 'lastChanged DESC';
             break;
         case 'publishUp':
             $orderby = 'i.publish_up DESC';
             break;
         default:
             $orderby = 'i.id DESC';
             break;
     }
     $query .= " ORDER BY " . $orderby;
     $db->setQuery($query, 0, $limit);
     $items = $db->loadObjectList();
     $model = K2Model::getInstance('Item', 'K2Model');
     $show_introtext = $params->get('item_desc_display', 0);
     $introtext_limit = $params->get('item_desc_max_characs', 100);
     $show_title = $params->get('item_title_display', 1);
     $title_limit = $params->get('item_title_max_characs', 20);
     $item_title_ending_char = $params->get('item_title_ending_char', '');
     $item_desc_ending_char = $params->get('item_desc_ending_char', '');
     $show_other_title = $params->get('other_title_display', 1);
     $other_title_limit = $params->get('other_title_max_characs', 20);
     $other_item_title_ending_char = $params->get('other_item_title_ending_char', '');
     if (count($items)) {
         foreach ($items as $item) {
             //Clean title
             $item->title = JFilterOutput::ampReplace($item->title);
             $item->displaytitle = $show_title ? self::truncate($item->title, $title_limit, $item_title_ending_char) : '';
             //Read more link
             $item->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($item->id . ':' . urlencode($item->alias), $item->catid . ':' . urlencode($item->categoryalias))));
             //Author
             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));
             }
             //Tags
             $item->tags = '';
             if ($params->get('item_tags_display')) {
                 $tags = $model->getItemTags($item->id);
                 for ($i = 0; $i < sizeof($tags); $i++) {
                     $tags[$i]->link = JRoute::_(K2HelperRoute::getTagRoute($tags[$i]->name));
                 }
                 $item->tags = $tags;
             }
             // Restore the intotext variable after plugins execution
             self::getK2Images($item, $params);
             //Clean the plugin tags
             $item->introtext = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $item->introtext);
             if ($item->fulltext != '') {
                 $item->fulltext = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $item->fulltext);
                 $item->_introtext = self::_cleanText($item->introtext . $item->fulltext);
             } else {
                 $item->_introtext = self::_cleanText($item->introtext);
             }
             $item->displayIntrotext = $show_introtext ? self::truncate($item->_introtext, $introtext_limit, $item_desc_ending_char) : '';
             $item->othertitle = self::truncate($item->title, $other_title_limit, $other_item_title_ending_char);
             $rows[] = $item;
         }
         return $rows;
     }
 }
开发者ID:educakanchay,项目名称:educared,代码行数:101,代码来源:helper.php

示例11:

			<?php 
    echo JHTML::_('date', $this->item->created, JText::_('DATE_FORMAT_LC3'));
    ?>
		</span>
		<?php 
}
?>
		
			
		<?php 
if ($this->item->params->get('catItemAuthor')) {
    ?>
		<!-- Item Author -->
		<span class="createby">
			<?php 
    echo K2HelperUtilities::writtenBy($this->item->author->profile->gender);
    ?>
 <a href="<?php 
    echo $this->item->author->link;
    ?>
"><?php 
    echo $this->item->author->name;
    ?>
</a>
		</span>
		<?php 
}
?>
		  		
		</div>
	</div>
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:31,代码来源:category_item.php

示例12: foreach

                ?>
		  </h2>
			<?php 
            }
            ?>
			<?php 
        }
        ?>
	
		<?php 
    } else {
        ?>
	
			<?php 
        foreach ($block->items as $item) {
            K2HelperUtilities::setDefaultImage($item, 'latest', $this->params);
            ?>
			<?php 
            $this->item = $item;
            echo $this->loadTemplate('item');
            ?>
			<?php 
        }
        ?>
	
		<?php 
    }
    ?>
		</div>
		<!-- End Item list -->
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:30,代码来源:latest.php

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

示例14:

        echo $user->name;
        ?>
			</a>
			<?php 
    }
    ?>

			<?php 
    if ($params->get('userDescription') && $user->description) {
        ?>
			<div class="ubUserDescription">
				<?php 
        if ($params->get('userDescriptionWordLimit')) {
            ?>
				<?php 
            echo K2HelperUtilities::wordLimit($user->description, $params->get('userDescriptionWordLimit'));
            ?>
				<?php 
        } else {
            ?>
				<?php 
            echo $user->description;
            ?>
				<?php 
        }
        ?>
			</div>
			<?php 
    }
    ?>
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:30,代码来源:default.php

示例15: sendReport

 function sendReport()
 {
     JRequest::checkToken() or jexit('Invalid Token');
     $params = K2HelperUtilities::getParams('com_k2');
     $user = JFactory::getUser();
     if (!$params->get('comments') || !$params->get('commentsReporting') || ($params->get('commentsReporting') == '2' && $user->guest))
     {
         JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
     }
     K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models');
     $model = K2Model::getInstance('Comments', 'K2Model');
     $model->setState('id', JRequest::getInt('id'));
     $model->setState('name', JRequest::getString('name'));
     $model->setState('reportReason', JRequest::getString('reportReason'));
     if (!$model->report())
     {
         echo $model->getError();
     }
     else
     {
         echo JText::_('K2_REPORT_SUBMITTED');
     }
     $mainframe = JFactory::getApplication();
     $mainframe->close();
 }
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:25,代码来源:comments.php


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