本文整理汇总了PHP中JComments::getCommentAuthorName方法的典型用法代码示例。如果您正苦于以下问题:PHP JComments::getCommentAuthorName方法的具体用法?PHP JComments::getCommentAuthorName怎么用?PHP JComments::getCommentAuthorName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JComments
的用法示例。
在下文中一共展示了JComments::getCommentAuthorName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
public static function getList($params)
{
$db = JFactory::getDBO();
$db->setQuery("SELECT * FROM #__jcomments ORDER BY date DESC", 0, $params->get('count'));
$items = $db->loadObjectList();
if (!is_array($items)) {
$items = array();
}
if (count($items)) {
$config = JCommentsFactory::getConfig();
$bbcode = JCommentsFactory::getBBCode();
$limit_comment_text = (int) $params->get('limit_comment_text', 0);
foreach ($items as &$item) {
$item->link = 'index.php?option=com_jcomments&&view=comment&layout=edit&id=' . $item->id;
$item->author = JComments::getCommentAuthorName($item);
$text = JCommentsText::censor($item->comment);
$text = $bbcode->filter($text, true);
$text = JCommentsText::cleanText($text);
if ($limit_comment_text && JString::strlen($text) > $limit_comment_text) {
$text = self::truncateText($text, $limit_comment_text - 1);
}
$item->comment = $text;
}
}
return $items;
}
示例2: quoteComment
function quoteComment($id, $loadForm = 0)
{
if (JCommentsSecurity::badRequest() == 1) {
JCommentsSecurity::notAuth();
}
$db =& JCommentsFactory::getDBO();
$acl =& JCommentsFactory::getACL();
$config =& JCommentsFactory::getConfig();
$response =& JCommentsFactory::getAjaxResponse();
$comment = new JCommentsDB($db);
$id = (int) $id;
if ($comment->load($id)) {
$comment_name = JComments::getCommentAuthorName($comment);
$comment_text = JCommentsText::br2nl($comment->comment);
if ($config->getInt('enable_nested_quotes') == 0) {
$bbcode =& JCommentsFactory::getBBCode();
$comment_text = $bbcode->removeQuotes($comment_text);
}
if ($config->getInt('enable_custom_bbcode')) {
$customBBCode =& JCommentsFactory::getCustomBBCode();
$comment_text = $customBBCode->filter($comment_text, true);
}
if ($acl->getUserId() == 0) {
$bbcode =& JCommentsFactory::getBBCode();
$comment_text = $bbcode->removeHidden($comment_text);
}
if ($comment_text != '') {
if ($acl->check('enable_autocensor')) {
$comment_text = JCommentsText::censor($comment_text);
}
if (intval($loadForm) == 1) {
$form = JComments::getCommentsForm($comment->object_id, $comment->object_group, true);
$response->addAssign('comments-form-link', 'innerHTML', $form);
}
$comment_text = JCommentsText::jsEscape($comment_text);
$text = "[quote name=\"" . $comment_name . "\"]" . $comment_text . "[/quote]\\n";
$response->addScript("jcomments.insertText('" . $text . "');");
} else {
$response->addAlert(JText::_('ERROR_NOTHING_TO_QUOTE'));
}
}
unset($comment);
return $response;
}
示例3: prepareComment
public static function prepareComment(&$comment)
{
if (isset($comment->_skip_prepare) && $comment->_skip_prepare == 1) {
return;
}
JCommentsEventHelper::trigger('onJCommentsCommentBeforePrepare', array(&$comment));
$config = JCommentsFactory::getConfig();
$acl = JCommentsFactory::getACL();
// run autocensor
if ($acl->check('enable_autocensor')) {
$comment->comment = JCommentsText::censor($comment->comment);
if ($comment->title != '') {
$comment->title = JCommentsText::censor($comment->title);
}
}
// replace deleted comment text with predefined message
if ($comment->deleted == 1) {
$comment->comment = JText::_('COMMENT_TEXT_COMMENT_HAS_BEEN_DELETED');
$comment->username = '';
$comment->name = '';
$comment->email = '';
$comment->homepage = '';
$comment->userid = 0;
$comment->isgood = 0;
$comment->ispoor = 0;
}
// replace BBCode tags
$comment->comment = JCommentsFactory::getBBCode()->replace($comment->comment);
if ($config->getInt('enable_custom_bbcode')) {
$comment->comment = JCommentsFactory::getCustomBBCode()->replace($comment->comment);
}
// fix long words problem
$word_maxlength = $config->getInt('word_maxlength');
if ($word_maxlength > 0) {
$comment->comment = JCommentsText::fixLongWords($comment->comment, $word_maxlength);
if ($comment->title != '') {
$comment->title = JCommentsText::fixLongWords($comment->title, $word_maxlength);
}
}
if ($acl->check('emailprotection')) {
$comment->comment = JComments::maskEmail($comment->id, $comment->comment);
}
// autolink urls
if ($acl->check('autolinkurls')) {
$comment->comment = preg_replace_callback(_JC_REGEXP_LINK, array('JComments', 'urlProcessor'), $comment->comment);
if ($acl->check('emailprotection') != 1) {
$comment->comment = preg_replace(_JC_REGEXP_EMAIL, '<a href="mailto:\\1@\\2">\\1@\\2</a>', $comment->comment);
}
}
// replace smilies' codes with images
if ($config->get('enable_smilies') == '1') {
$comment->comment = JCommentsFactory::getSmilies()->replace($comment->comment);
}
$comment->author = JComments::getCommentAuthorName($comment);
// Gravatar support
$comment->gravatar = md5(strtolower($comment->email));
if (empty($comment->avatar)) {
$comment->avatar = '<img src="http://www.gravatar.com/avatar/' . $comment->gravatar . '?d=' . urlencode(JCommentsFactory::getLink('noavatar')) . '" alt="' . htmlspecialchars($comment->author) . '" />';
}
JCommentsEventHelper::trigger('onJCommentsCommentAfterPrepare', array(&$comment));
}
示例4: showUserComments
public static function showUserComments()
{
$config = JCommentsFactory::getConfig();
if ($config->get('enable_rss') == '1') {
$app = JFactory::getApplication('site');
$acl = JCommentsFactory::getACL();
$userid = $app->input->getInt('userid', 0);
$limit = $app->input->getInt('limit', $config->getInt('feed_limit', 100));
$user = JFactory::getUser($userid);
if (!isset($user->id)) {
self::showNotFound();
return;
}
$lm = $limit != $config->getInt('feed_limit') ? '&limit=' . $limit : '';
if (JCommentsMultilingual::isEnabled()) {
$language = JCommentsMultilingual::getLanguage();
$lp = '&lang=' . $language;
} else {
$language = null;
$lp = '';
}
$liveSite = trim(str_replace(JURI::root(true), '', str_replace('/administrator', '', JURI::root())), '/');
$syndicationURL = $liveSite . JRoute::_('index.php?option=com_jcomments&task=rss_user&userid=' . $userid . $lm . $lp . '&tmpl=raw');
$user->userid = $user->id;
$username = JComments::getCommentAuthorName($user);
$rss = new JoomlaTuneFeed();
$rss->title = JText::sprintf('USER_FEED_TITLE', $username);
$rss->link = str_replace('/administrator', '', JURI::root());
$rss->syndicationURL = $syndicationURL;
$rss->description = JText::sprintf('USER_FEED_DESCRIPTION', $username);
$options = array();
$options['lang'] = $language;
$options['userid'] = $userid;
$options['published'] = 1;
$options['filter'] = 'c.deleted = 0';
$options['orderBy'] = 'c.date DESC';
$options['votes'] = false;
$options['limit'] = $limit;
$options['limitStart'] = 0;
$options['objectinfo'] = true;
$options['access'] = $acl->getUserAccess();
$rows = JCommentsModel::getCommentsList($options);
$word_maxlength = $config->getInt('word_maxlength');
foreach ($rows as $row) {
$comment = JCommentsText::cleanText($row->comment);
if ($comment != '') {
// getting object's information (title and link)
$object_title = $row->object_title;
$object_link = JCommentsFactory::getAbsLink(str_replace('amp;', '', $row->object_link));
// apply censor filter
$object_title = JCommentsText::censor($object_title);
$comment = JCommentsText::censor($comment);
// fix long words problem
if ($word_maxlength > 0) {
$comment = JCommentsText::fixLongWords($comment, $word_maxlength, ' ');
if ($object_title != '') {
$object_title = JCommentsText::fixLongWords($object_title, $word_maxlength, ' ');
}
}
$author = JComments::getCommentAuthorName($row);
$item = new JoomlaTuneFeedItem();
$item->title = $object_title;
$item->link = $object_link . '#comment-' . $row->id;
$item->description = JText::sprintf('USER_FEED_ITEM_DESCRIPTION', $author, $comment);
$item->source = $object_link;
$item->pubDate = $row->date;
$item->author = $author;
$rss->addItem($item);
}
}
$rss->display();
unset($rows, $rss);
exit;
}
}
示例5: feedLastCommentsGlobal
function feedLastCommentsGlobal()
{
global $mainframe;
$object_group = trim(strip_tags(JCommentsInput::getVar('object_group', '')));
$object_group = preg_replace('#[^0-9A-Za-z\\-\\_\\,\\.]#is', '', $object_group);
$limit = (int) JCommentsInput::getVar('limit', 100);
$config =& JCommentsFactory::getConfig();
if ($config->get('enable_rss') == '1') {
$iso = explode('=', _ISO);
$charset = strtolower((string) $iso[1]);
if (JCOMMENTS_JVERSION == '1.5') {
$offset = $mainframe->getCfg('offset');
} else {
$offset = $mainframe->getCfg('offset') + date('O') / 100;
}
$object_group = preg_replace('#[\'\\"]#ism', '', $object_group);
$og = $object_group ? '&object_group=' . $object_group : '';
$lm = $limit != 100 ? '&limit=' . $limit : '';
if (JCOMMENTS_JVERSION == '1.5') {
$syndicationURL = JoomlaTuneRoute::_('index.php?option=com_jcomments&task=rss_full' . $og . $lm . '&tmpl=component');
} else {
$syndicationURL = $mainframe->getCfg('live_site') . '/index2.php?option=com_jcomments&task=rss_full' . $og . $lm . '&no_html=1';
}
$rss = new JoomlaTuneFeed();
$rss->setOffset($offset);
$rss->encoding = $charset;
$rss->title = JText::_('Comments');
$rss->link = $mainframe->getCfg('live_site');
$rss->syndicationURL = $syndicationURL;
$rss->description = JText::_('COMMENTS_FOR') . ' ' . $mainframe->getCfg('sitename');
if ($object_group != '') {
$groups = explode(',', $object_group);
} else {
$groups = array();
}
$db =& JCommentsFactory::getDBO();
$query = "SELECT id, title, object_id, object_group, userid, name, username, date, UNIX_TIMESTAMP(date) as date_ts, comment" . "\nFROM #__jcomments " . "\nWHERE published = '1'" . (count($groups) > 0 ? "\n AND (object_group = '" . implode("' OR object_group='", $groups) . "')" : '') . (JCommentsMultilingual::isEnabled() ? "\nAND lang = '" . JCommentsMultilingual::getLanguage() . "'" : "") . "\nORDER BY date DESC";
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
$word_maxlength = $config->getInt('word_maxlength');
$lang = JCommentsMultilingual::isEnabled() ? JCommentsMultilingual::getLanguage() : null;
foreach ($rows as $row) {
$comment = JCommentsText::cleanText($row->comment);
$author = JComments::getCommentAuthorName($row);
if ($comment != '') {
$object_title = JCommentsObjectHelper::getTitle($row->object_id, $row->object_group, $lang);
$object_link = JCommentsObjectHelper::getLink($row->object_id, $row->object_group);
$object_link = str_replace('amp;', '', $object_link);
$object_link = JCommentsFactory::getAbsLink($object_link);
// apply censor filter
$object_title = JCommentsText::censor($object_title);
$comment = JCommentsText::censor($comment);
// fix long words problem
if ($word_maxlength > 0) {
$comment = JCommentsText::fixLongWords($comment, $word_maxlength, ' ');
if ($comment != '') {
$comment = JCommentsText::fixLongWords($comment, $word_maxlength, ' ');
}
}
$item = new JoomlaTuneFeedItem();
$item->title = $object_title;
$item->link = $object_link . '#comment-' . $row->id;
$item->description = $author . ' ' . JText::_('Wrote') . ' "' . $comment . '"';
$item->source = $object_link;
if (JCOMMENTS_JVERSION == '1.5') {
$item->pubDate = $row->date;
} else {
$date = strtotime((string) $row->date) - $offset * 3600;
$item->pubDate = date('Y-m-d H:i:s', $date);
}
$item->author = $author;
$rss->addItem($item);
}
}
$rss->display();
unset($rows, $rss);
exit;
}
}
示例6: showUserComments
public static function showUserComments()
{
$config = JCommentsFactory::getConfig();
if ($config->get('enable_rss') == '1') {
$app = JCommentsFactory::getApplication('site');
$acl = JCommentsFactory::getACL();
$userid = (int) JCommentsInput::getVar('userid', 0);
$limit = (int) JCommentsInput::getVar('limit', $config->getInt('feed_limit', 100));
$user = JCommentsFactory::getUser($userid);
if (!isset($user->id)) {
self::showNotFound();
return;
}
if (JCOMMENTS_JVERSION == '1.0') {
$offset = $app->getCfg('offset') + date('O') / 100;
} else {
$offset = $app->getCfg('offset');
}
$lm = $limit != $config->getInt('feed_limit') ? '&limit=' . $limit : '';
if (JCommentsMultilingual::isEnabled()) {
$language = JCommentsMultilingual::getLanguage();
$lp = '&lang=' . $language;
} else {
$language = null;
$lp = '';
}
if (JCOMMENTS_JVERSION == '1.0') {
$syndicationURL = $app->getCfg('live_site') . '/index2.php?option=com_jcomments&task=rss_user&userid=' . $userid . $lm . $lp . '&no_html=1';
} else {
$liveSite = str_replace(JURI::root(true), '', $app->getCfg('live_site'));
$syndicationURL = $liveSite . JRoute::_('index.php?option=com_jcomments&task=rss_user&userid=' . $userid . $lm . $lp . '&tmpl=raw');
}
$user->userid = $user->id;
$username = JComments::getCommentAuthorName($user);
$rss = new JoomlaTuneFeed();
$rss->setOffset($offset);
$rss->encoding = JCOMMENTS_ENCODING;
$rss->title = JText::sprintf('USER_FEED_TITLE', $username);
$rss->link = $app->getCfg('live_site');
$rss->syndicationURL = $syndicationURL;
$rss->description = JText::sprintf('USER_FEED_DESCRIPTION', $username);
$options = array();
$options['lang'] = $language;
$options['userid'] = $userid;
$options['published'] = 1;
$options['filter'] = 'c.deleted = 0';
$options['orderBy'] = 'c.date DESC';
$options['votes'] = false;
$options['limit'] = $limit;
$options['limitStart'] = 0;
$options['objectinfo'] = true;
$options['access'] = $acl->getUserAccess();
$rows = JCommentsModel::getCommentsList($options);
$word_maxlength = $config->getInt('word_maxlength');
$lang = JCommentsMultilingual::isEnabled() ? JCommentsMultilingual::getLanguage() : null;
foreach ($rows as $row) {
$comment = JCommentsText::cleanText($row->comment);
if ($comment != '') {
// getting object's information (title and link)
$object_title = empty($row->object_title) ? JCommentsObjectHelper::getTitle($row->object_id, $row->object_group, $lang) : $row->object_title;
$object_link = empty($row->object_link) ? JCommentsObjectHelper::getLink($row->object_id, $row->object_group, $lang) : $row->object_link;
$object_link = JCommentsFactory::getAbsLink(str_replace('amp;', '', $object_link));
// apply censor filter
$object_title = JCommentsText::censor($object_title);
$comment = JCommentsText::censor($comment);
// fix long words problem
if ($word_maxlength > 0) {
$comment = JCommentsText::fixLongWords($comment, $word_maxlength, ' ');
if ($object_title != '') {
$object_title = JCommentsText::fixLongWords($object_title, $word_maxlength, ' ');
}
}
$author = JComments::getCommentAuthorName($row);
$item = new JoomlaTuneFeedItem();
$item->title = $object_title;
$item->link = $object_link . '#comment-' . $row->id;
$item->description = JText::sprintf('USER_FEED_ITEM_DESCRIPTION', $author, $comment);
$item->source = $object_link;
if (JCOMMENTS_JVERSION == '1.0') {
$date = strtotime((string) $row->date) - $offset * 3600;
$item->pubDate = date('Y-m-d H:i:s', $date);
} else {
$item->pubDate = $row->date;
}
$item->author = $author;
$rss->addItem($item);
}
}
$rss->display();
unset($rows, $rss);
exit;
}
}
示例7: prepareComment
function prepareComment(&$comment)
{
if (isset($comment->_skip_prepare) && $comment->_skip_prepare == 1) {
return;
}
$config =& JCommentsFactory::getConfig();
$bbcode =& JCommentsFactory::getBBCode();
$acl =& JCommentsFactory::getACL();
// convert to datetime if variable contains string value
if (is_string($comment->datetime)) {
$comment->datetime = strtotime($comment->datetime);
}
// run autocensor
if ($acl->check('enable_autocensor')) {
$comment->comment = JCommentsText::censor($comment->comment);
}
// replace BBCode tags
$comment->comment = $bbcode->replace($comment->comment);
if ($config->getInt('enable_custom_bbcode')) {
$customBBCode =& JCommentsFactory::getCustomBBCode();
$comment->comment = $customBBCode->replace($comment->comment);
}
// fix long words problem
$word_maxlength = $config->getInt('word_maxlength');
if ($word_maxlength > 0) {
$comment->comment = JCommentsText::fixLongWords($comment->comment, $word_maxlength);
if ($comment->title != '') {
$comment->title = JCommentsText::fixLongWords($comment->title, $word_maxlength);
}
}
if ($acl->check('emailprotection')) {
$comment->comment = JComments::maskEmail($comment->id, $comment->comment);
}
// autolink urls
if ($acl->check('autolinkurls')) {
$comment->comment = preg_replace_callback(_JC_REGEXP_LINK, array('JComments', 'urlProcessor'), $comment->comment);
if ($acl->check('emailprotection') != 1) {
$comment->comment = preg_replace(_JC_REGEXP_EMAIL, '<a href="mailto:\\1@\\2">\\1@\\2</a>', $comment->comment);
}
}
// replace smile codes with images
if ($config->get('enable_smiles') == '1') {
$smiles =& JCommentsFactory::getSmiles();
$comment->comment = $smiles->replace($comment->comment);
}
// Gravatar support
$comment->gravatar = md5(strtolower($comment->email));
if (empty($comment->avatar)) {
$comment->avatar = '<img src="http://www.gravatar.com/avatar.php?gravatar_id=' . $comment->gravatar . '&default=' . urlencode(JCommentsFactory::getLink('noavatar')) . '" alt="" />';
}
$comment->author = JComments::getCommentAuthorName($comment);
if ($config->getInt('enable_mambots') == 1) {
JCommentsPluginHelper::trigger('onAfterPrepareComment', array(&$comment));
}
}
示例8: prepareData
/**
* Prepares data for notification
*
* @param array $data An associative array of notification data
* @param string $type Type of notification
*
* @return mixed
*/
private static function prepareData($data, $type)
{
require_once JPATH_ROOT . '/components/com_jcomments/jcomments.php';
$object = JCommentsObjectHelper::getObjectInfo($data['comment']->object_id, $data['comment']->object_group, $data['comment']->lang);
$data['notification-type'] = $type;
$data['object_title'] = $object->title;
$data['object_link'] = JCommentsFactory::getAbsLink($object->link);
$data['comment']->author = JComments::getCommentAuthorName($data['comment']);
$data['comment']->title = JCommentsText::censor($data['comment']->title);
$data['comment']->comment = JCommentsText::censor($data['comment']->comment);
$data['comment']->comment = JCommentsFactory::getBBCode()->replace($data['comment']->comment);
if (JCommentsFactory::getConfig()->getInt('enable_custom_bbcode')) {
$data['comment']->comment = JCommentsFactory::getCustomBBCode()->replace($data['comment']->comment, true);
}
$data['comment']->comment = trim(preg_replace('/(\\s){2,}/i', '\\1', $data['comment']->comment));
return $data;
}
示例9: getList
//.........这里部分代码省略.........
if (count($source) == 1 && $source[0] == 'com_content') {
$joins[] = 'JOIN #__content AS cc ON cc.id = o.object_id';
$joins[] = 'LEFT JOIN #__categories AS ct ON ct.id = cc.catid';
$where[] = "c.object_group = " . $db->Quote($source[0]);
$where[] = "(cc.publish_up = '0000-00-00 00:00:00' OR cc.publish_up <= '{$now}')";
$where[] = "(cc.publish_down = '0000-00-00 00:00:00' OR cc.publish_down >= '{$now}')";
$categories = $params->get('catid', array());
if (!is_array($categories)) {
$categories = explode(',', $categories);
}
JArrayHelper::toInteger($categories);
$categories = implode(',', $categories);
if (!empty($categories)) {
$where[] = "cc.catid IN (" . $categories . ")";
}
} else {
if (count($source)) {
$where[] = "c.object_group in ('" . implode("','", $source) . "')";
}
}
$query = "SELECT c.id, c.userid, c.comment, c.title, c.name, c.username, c.email, c.date, c.object_id, c.object_group, '' as avatar" . ", o.title AS object_title, o.link AS object_link, o.access AS object_access, o.userid AS object_owner" . " FROM #__jcomments AS c" . " JOIN #__jcomments_objects AS o ON c.object_id = o.object_id AND c.object_group = o.object_group AND c.lang = o.lang" . (count($joins) ? ' ' . implode(' ', $joins) : '') . (count($where) ? ' WHERE ' . implode(' AND ', $where) : '') . " ORDER BY " . $orderBy;
$db->setQuery($query, 0, $params->get('count'));
$list = $db->loadObjectList();
if (!is_array($list)) {
$list = array();
}
if (count($list)) {
$show_date = $params->get('show_comment_date', 0);
$date_type = $params->get('date_type', '');
$date_format = $params->get('date_format', 'd.m.Y H:i');
$show_author = $params->get('show_comment_author', 0);
$show_object_title = $params->get('show_object_title', 0);
$show_comment_title = $params->get('show_comment_title', 0);
$show_smiles = $params->get('show_smiles', 0);
$show_avatar = $params->get('show_avatar', 0);
$limit_comment_text = (int) $params->get('limit_comment_text', 0);
$config = JCommentsFactory::getConfig();
$bbcode = JCommentsFactory::getBBCode();
$smiles = JCommentsFactory::getSmiles();
$acl = JCommentsFactory::getACL();
if ($show_avatar) {
JPluginHelper::importPlugin('jcomments');
if (version_compare(JVERSION, '3.0', 'ge')) {
$dispatcher = JEventDispatcher::getInstance();
} else {
$dispatcher = JDispatcher::getInstance();
}
$dispatcher->trigger('onPrepareAvatars', array(&$list));
}
foreach ($list as &$item) {
$item->displayDate = '';
if ($show_date) {
if ($date_type == 'relative') {
$item->displayDate = modJCommentsLatestHelper::getRelativeDate($item->date);
} else {
$item->displayDate = JHTML::_('date', $item->date, $date_format);
}
}
$item->displayAuthorName = '';
if ($show_author) {
$item->displayAuthorName = JComments::getCommentAuthorName($item);
}
$item->displayObjectTitle = '';
if ($show_object_title) {
$item->displayObjectTitle = $item->object_title;
}
$item->displayCommentTitle = '';
if ($show_comment_title) {
$item->displayCommentTitle = $item->title;
}
$item->displayCommentLink = $item->object_link . '#comment-' . $item->id;
$text = JCommentsText::censor($item->comment);
$text = preg_replace('#\\[quote[^\\]]*?\\](((?R)|.)*?)\\[\\/quote\\]#ismu', '', $text);
$text = $bbcode->filter($text, true);
$text = JCommentsText::fixLongWords($text, $config->getInt('word_maxlength'), ' ');
if ($acl->check('autolinkurls')) {
$text = preg_replace_callback(_JC_REGEXP_LINK, array('JComments', 'urlProcessor'), $text);
}
$text = JCommentsText::cleanText($text);
if ($limit_comment_text && JString::strlen($text) > $limit_comment_text) {
$text = self::truncateText($text, $limit_comment_text - 1);
}
switch ($show_smiles) {
case 1:
$text = $smiles->replace($text);
break;
case 2:
$text = $smiles->strip($text);
break;
}
$item->displayCommentText = $text;
if ($show_avatar && empty($item->avatar)) {
$gravatar = md5(strtolower($item->email));
$item->avatar = '<img src="http://www.gravatar.com/avatar.php?gravatar_id=' . $gravatar . '&default=' . urlencode(JCommentsFactory::getLink('noavatar')) . '" alt="' . htmlspecialchars(JComments::getCommentAuthorName($item)) . '" />';
}
$item->readmoreText = JText::_('MOD_JCOMMENTS_LATEST_READMORE');
}
}
return $list;
}
示例10: onPrepareAvatars
//.........这里部分代码省略.........
$comment->profileLink = $avatars[$uid]->link;
if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '') {
if (file_exists($avatarA . $avatars[$uid]->avatar)) {
$comment->avatar = $avatarL . $avatars[$uid]->avatar;
}
}
}
} else {
$helper = JPATH_SITE . '/plugins/slogin_integration/slogin_avatar/slogin_avatar.php';
if (is_file($helper)) {
if (count($users)) {
$db->setQuery('SELECT userid, photo_src as avatar FROM #__plg_slogin_avatar WHERE main = 1 AND userid in (' . implode(',', $users) . ')');
$avatars = $db->loadObjectList('userid');
}
$plugin = JPluginHelper::getPlugin('slogin_integration', 'slogin_avatar');
$pluginParams = new JRegistry();
$pluginParams->loadString($plugin->params);
$folder = $pluginParams->get('rootfolder', 'images/avatar');
$avatarA = JPATH_SITE . '/' . $folder . '/';
$avatarL = JURI::base() . $folder . '/';
foreach ($comments as &$comment) {
$uid = (int)$comment->userid;
$comment->profileLink = '';
if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '') {
if (file_exists($avatarA . $avatars[$uid]->avatar)) {
$comment->avatar = $avatarL . $avatars[$uid]->avatar;
}
}
}
}
}
break;
case 'easyprofile':
$api = JPATH_ADMINISTRATOR . '/components/com_jsn/jsn.php';
if (is_file($api)) {
if (count($users)) {
$db->setQuery('SELECT id as userid, avatar FROM #__jsn_users WHERE id in (' . implode(',', $users) . ')');
$avatars = $db->loadObjectList('userid');
}
foreach ($comments as &$comment) {
$uid = (int)$comment->userid;
$comment->profileLink = $uid ? JRoute::_('index.php?option=com_jsn&view=profile&id=' . $uid) : '';
if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '') {
if (is_file(JPATH_SITE . '/' . $avatars[$uid]->avatar)) {
$comment->avatar = JURI::base() . $avatars[$uid]->avatar;
}
}
}
}
break;
case 'gravatar':
default:
foreach ($comments as &$comment) {
$comment->profileLink = '';
$comment->avatar = $this->getGravatar($comment->email);
}
break;
}
if ($avatar_default_avatar == 'custom' && empty($avatar_custom_default_avatar)) {
$avatar_default_avatar = 'default';
}
foreach ($comments as &$comment) {
if (empty($comment->avatar)) {
switch ($avatar_default_avatar) {
case 'gravatar':
$comment->avatar = $this->getGravatar($comment->email);
break;
case 'custom':
$comment->avatar = JURI::base() . ltrim($avatar_custom_default_avatar, '/');
break;
case 'default':
$comment->avatar = JURI::base() . 'components/com_jcomments/images/no_avatar.png';
break;
}
}
$comment->avatar = self::createImg($comment->avatar, JComments::getCommentAuthorName($comment));
if ($avatar_link && !empty($comment->profileLink)) {
$comment->avatar = self::createLink($comment->avatar, $comment->profileLink, $avatar_link_target);
}
}
return;
}