本文整理汇总了PHP中JComments类的典型用法代码示例。如果您正苦于以下问题:PHP JComments类的具体用法?PHP JComments怎么用?PHP JComments使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JComments类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plgContentJCommentsViewJ10
function plgContentJCommentsViewJ10(&$row, &$params, $page = 0)
{
global $task, $option;
if (!isset($params)) {
$params = new mosParameters('');
}
$pvars = array_keys(get_object_vars($params->_params));
if ($params->get('popup') || in_array('moduleclass_sfx', $pvars)) {
return '';
}
if (isset($GLOBALS['jcomments_params_readmore']) && isset($GLOBALS['jcomments_row_readmore'])) {
$params->set('readmore', $GLOBALS['jcomments_params_readmore']);
$row->readmore = $GLOBALS['jcomments_row_readmore'];
}
require_once JCOMMENTS_BASE . '/jcomments.php';
require_once JCOMMENTS_HELPERS . '/content.php';
JCommentsContentPluginHelper::processForeignTags($row, false, false);
if (JCommentsContentPluginHelper::isDisabled($row)) {
return '';
}
if ($task == 'view' && (JCommentsContentPluginHelper::checkCategory($row->catid) || JCommentsContentPluginHelper::isEnabled($row))) {
if (JCommentsContentPluginHelper::isLocked($row)) {
$config = JCommentsFactory::getConfig();
$config->set('comments_locked', 1);
}
return JComments::show($row->id, 'com_content', $row->title);
} else {
if ($option == 'com_events' && $task == 'view_detail') {
return JComments::show($row->id, 'com_events', $row->title);
}
}
return '';
}
示例2: 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;
}
示例3: display
/**
* Wordbridge entry view display method
* @return void
**/
function display($tpl = null)
{
$app = JFactory::getApplication();
$menu = $app->getMenu();
$item = $menu->getActive();
if (!$item) {
$item = $menu->getItem(JRequest::getInt('Itemid'));
}
$params = $item->params;
$this->assignRef('params', $params);
$postid = JRequest::getInt('p', 0);
$blogInfo = WordbridgeHelper::getBlogByName($params->get('wordbridge_blog_name'));
$this->assignRef('blogTitle', $blogInfo['description']);
$model = $this->getModel();
$entry = $model->getEntry($postid, $blogInfo['uuid']);
$baseUrl = $item->link . '&Itemid=' . $item->id;
$this->assignRef('blogLink', $baseUrl);
// Determine if we'll convert links
$convertLinks = $params->get('wordbridge_convert_links', 'no') == 'yes' ? true : false;
$this->assignRef('convertLinks', $convertLinks);
$this->assignRef('content', $entry['content']);
$this->assignRef('title', $entry['title']);
$this->assignRef('slug', $entry['slug']);
$this->assignRef('categories', $entry['categories']);
$this->assignRef('postid', $entry['postid']);
$this->assignRef('date', $entry['date']);
// Allow JComments to be added to blog entries
$jcomments = false;
$jcommentsPath = JPATH_SITE . DS . 'components' . DS . 'com_jcomments' . DS;
$jcommentFile = $jcommentsPath . 'jcomments.php';
if ($params->get('wordbridge_show_jcomments') == 'yes' && file_exists($jcommentFile)) {
$jbase = JPATH_SITE . DS . 'components' . DS;
$jPlgSrc = $jbase . 'com_wordbridge' . DS . 'assets' . DS . 'com_wordbridge.plugin.php';
$jPlgDst = $jbase . 'com_jcomments' . DS . 'plugins' . DS . 'com_wordbridge.plugin.php';
// Check to see if the integration is installed
$copyRes = true;
if (!file_exists($jPlgDst) || filemtime($jPlgSrc) > filemtime($jPlgDst)) {
// Copy the wordbridge plugin over to jcomments
$copyRes = JFile::copy($jPlgSrc, $jPlgDst);
}
// Only set up JComments if the wordbridge plugin is
// installed OK
if ($copyRes) {
require_once $jcommentFile;
$jid = $item->id * 10000000 + $entry['postid'];
$jcomments = JComments::showComments($jid, 'com_wordbridge', $entry['title']);
}
}
$this->assignRef('jcomments', $jcomments);
$document = JFactory::getDocument();
// Set the title to place above the blog
$blog_title = $params->get('page_heading');
if (!$blog_title) {
$blog_title = $document->getTitle();
}
$this->assignRef('blog_title', $blog_title);
// Set the page title
$document->setTitle($document->getTitle() . ' - ' . $entry['title']);
parent::display($tpl);
}
示例4: integrateVideoComments
function integrateVideoComments($row)
{
$c = jomtube_configs::get_instance();
$jomtubeCommentingSystemCode = '';
if ($c->commenting_system != 'No') {
//integrate commenting system with JomComment
if ($c->commenting_system == 'JomComment') {
if (file_exists(JPATH_ROOT . DS . 'plugins' . DS . 'content' . DS . 'jom_comment_bot.php')) {
require_once JPATH_ROOT . DS . 'plugins' . DS . 'content' . DS . 'jom_comment_bot.php';
$jomtubeCommentingSystemCode = jomcomment($row->id, 'com_jomtube');
} else {
$jomtubeCommentingSystemCode = '<b>You must install JomComment component to use comment function</b>';
}
}
//integrate commenting system with JComment
if ($c->commenting_system == 'JComment') {
if (file_exists(JPATH_SITE . DS . 'components/com_jcomments/jcomments.php')) {
require_once JPATH_SITE . DS . 'components/com_jcomments/jcomments.php';
$jomtubeCommentingSystemCode = JComments::showComments($row->id, 'com_jomtube', $row->video_title);
} else {
$jomtubeCommentingSystemCode = '<b>You must install JComment component to use comment function</b>';
}
}
}
return $jomtubeCommentingSystemCode;
}
示例5: onBeforeDisplayProductView
function onBeforeDisplayProductView(&$view)
{
$comments = JPATH_SITE . '/components/com_jcomments/jcomments.php';
if (file_exists($comments)) {
require_once $comments;
$view->_tmp_product_html_before_review = '<div class="jcomments_comment">' . JComments::showComments($view->product->product_id, 'com_jshopping', $view->product->name) . '</div>';
}
}
示例6: onMatchComments
/**
* adds comments to a match (independent if they were made before or after the match)
* @param object match
* @param string title
* @return boolean true on success
*/
public function onMatchComments(&$match, $title, &$html)
{
$separate_comments = $this->params->get('separate_comments', 0);
if ($separate_comments == 0) {
$html = '<div class="jlgcomments">' . JComments::show($match->id, 'com_joomleague', $title) . '</div>';
return true;
}
}
示例7: ADSonContentAfterDisplay
/**
* JComments before display content method
*
* Method is called by the view and the results are imploded and displayed in a placeholder
*
* @param object The content params
*/
public function ADSonContentAfterDisplay($content)
{
// add JComments
$comments = JPATH_ROOT.DS.'components'.DS.'com_jcomments'.DS.'jcomments.php';
if (is_file($comments)) {
require_once($comments);
return JComments::showComments($content->id, 'com_adsmanager', htmlspecialchars($content->ad_headline));
}
}
示例8: getCommentPage
public function getCommentPage($object_id, $object_group, $comment_id)
{
$result = 0;
if ($this->commentsPerPage > 0) {
$compare = $this->commentsOrder == 'DESC' ? '>=' : '<=';
$prev = JComments::getCommentsCount($object_id, $object_group, "\n id " . $compare . " " . $comment_id);
$result = max(ceil($prev / $this->commentsPerPage), 1);
}
return $result;
}
示例9: onAfterRoute
function onAfterRoute()
{
include_once JPATH_ROOT . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.legacy.php';
$mainframe =& JFactory::getApplication('site');
$mainframe->getRouter();
$document =& JFactory::getDocument();
if ($document->getType() == 'pdf') {
return;
}
if ($mainframe->isAdmin()) {
$document->addStyleSheet(JURI::base() . 'components/com_jcomments/assets/icon.css?v=2');
$option = JAdministratorHelper::findOption();
$task = JRequest::getCmd('task');
$type = JRequest::getCmd('type', '', 'post');
// remove comments if content item deleted from trash
if ($option == 'com_trash' && $task == 'delete' && $type == 'content') {
$cid = JRequest::getVar('cid', array(0), 'post', 'array');
JArrayHelper::toInteger($cid, array(0));
include_once JPATH_ROOT . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
JComments::deleteComments($cid, 'com_content');
}
} else {
$option = JRequest::getCmd('option');
if ($option == 'com_content' || $option == 'com_alphacontent') {
include_once JCOMMENTS_BASE . DS . 'jcomments.class.php';
include_once JCOMMENTS_BASE . DS . 'jcomments.config.php';
include_once JCOMMENTS_HELPERS . DS . 'system.php';
// include JComments CSS
if ($this->params->get('disable_template_css', 0) == 0) {
$document->addStyleSheet(JCommentsSystemPluginHelper::getCSS());
$language =& JFactory::getLanguage();
if ($language->isRTL()) {
$rtlCSS = JCommentsSystemPluginHelper::getCSS(true);
if ($rtlCSS != '') {
$document->addStyleSheet($rtlCSS);
}
}
}
if (!defined('JCOMMENTS_CSS')) {
define('JCOMMENTS_CSS', 1);
}
$config =& JCommentsCfg::getInstance();
// include JComments JavaScript library
$document->addScript(JCommentsSystemPluginHelper::getCoreJS());
if (!defined('JOOMLATUNE_AJAX_JS')) {
$document->addScript(JCommentsSystemPluginHelper::getAjaxJS());
define('JOOMLATUNE_AJAX_JS', 1);
}
if (!defined('JCOMMENTS_JS')) {
define('JCOMMENTS_JS', 1);
}
}
}
}
示例10: onMatchComments
/**
* adds comments to a match (independent if they were made before or after the match)
* @param object match
* @param string title
* @return boolean true on success
*/
public function onMatchComments(&$match, $title, &$html)
{
// load plugin params info
$plugin =& JPluginHelper::getPlugin('content', 'joomleague_comments');
$pluginParams = new JParameter($plugin->params);
$separate_comments = $pluginParams->get('separate_comments', 0);
if ($separate_comments == 0) {
$comments = JPATH_SITE . '/components/com_jcomments/jcomments.php';
if (file_exists($comments)) {
require_once $comments;
$html = '<div class="jlgcomments">' . JComments::show($match->id, 'com_joomleague', $title) . '</div>';
return true;
}
return false;
}
}
示例11: onEventEnd
/**
* This method handles the supported comment systems
*
* @access public
* @param int $event_id Integer Event identifier
* @param int $event_title String Event title
* @return boolean
*
*/
public function onEventEnd($event_id, $event_title = '')
{
//simple, skip if processing not needed
if (!$this->params->get('commentsystem', '0')) {
return '';
}
$res = '';
//jcomments integration
if ($this->params->get('commentsystem') == 1) {
if (file_exists(JPATH_SITE . '/components/com_jcomments/jcomments.php')) {
require_once JPATH_SITE . '/components/com_jcomments/jcomments.php';
$res .= '<div class="jcomments">';
$res .= JComments::showComments($event_id, 'com_jem', $event_title);
$res .= '</div>';
}
}
return $res;
}
示例12: TZPortfolioJComment
function TZPortfolioJComment($context, &$article, &$params, $page = 0)
{
$html = null;
$comments = JPATH_SITE . '/components/com_jcomments/jcomments.php';
if (file_exists($comments)) {
require_once $comments;
if (class_exists('JComments')) {
$html = '<div class="tz_portfolio_comment">';
$html .= JComments::showComments($article->id, 'com_tz_portfolio', $article->title);
$html .= '</div>';
}
} else {
$html = '<div class="tz_comment_notice">';
$html .= JText::_('COM_TZ_PORTFOLIO_COMMENT_NOTICE');
$html .= '</div>';
}
return $html;
}
示例13: onEventDetailsEnd
/**
* This method handles the supported comment systems
*
* @access public
* @param int $event_id Integer Event identifier
* @param int $event_title String Event title
* @return boolean
* @since 1.0
*/
public function onEventDetailsEnd($event_id, $event_title = '')
{
//simple, skip if processing not needed
if (!$this->params->get('commentsystem', '0')) {
return '';
}
$res = '';
//jomcomment integration
if ($this->params->get('commentsystem') == 1) {
if (file_exists(JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'jom_comment_bot.php')) {
require_once JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'jom_comment_bot.php';
$res .= '<div class="elcomments">';
$res .= jomcomment($event_id, 'com_eventlist');
$res .= '</div>';
}
}
//jcomments integration
if ($this->params->get('commentsystem') == 2) {
if (file_exists(JPATH_SITE . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php')) {
require_once JPATH_SITE . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
$res .= '<div class="elcomments">';
$res .= JComments::showComments($event_id, 'com_eventlist', $event_title);
$res .= '</div>';
}
}
//JXtended Comments integration
if ($this->params->get('commentsystem') == 3) {
if (file_exists(JPATH_SITE . DS . 'components' . DS . 'com_comments' . DS . 'helpers' . DS . 'html' . DS . 'comments.php')) {
require_once JPATH_SITE . DS . 'components' . DS . 'com_comments' . DS . 'helpers' . DS . 'html' . DS . 'comments.php';
$res .= '<div class="elcomments">';
// display sharing
$res .= JHtml::_('comments.share', substr($_SERVER['REQUEST_URI'], 1), $event_title);
// display ratings
$res .= JHtml::_('comments.rating', 'eventlist', $event_id, 'index.php?option=com_eventlist&view=details&id=' . $event_id, substr($_SERVER['REQUEST_URI'], 1), $event_title);
// display comments
$res .= JHtml::_('comments.comments', 'eventlist', $event_id, 'index.php?option=com_eventlist&view=details&id=' . $event_id, substr($_SERVER['REQUEST_URI'], 1), $event_title);
$res .= '<style type="text/css">';
$res .= 'div#respond-container dt { float: none;border-bottom: medium none;padding: 0;width: auto;}';
$res .= '</style>';
$res .= '</div>';
}
}
return $res;
}
示例14: onK2CommentsCounter
public function onK2CommentsCounter(&$item, &$params, $limitstart)
{
$result = '';
$commentsAPI = JPATH_SITE . '/components/com_jcomments/jcomments.php';
if (is_file($commentsAPI)) {
require_once $commentsAPI;
$count = JComments::getCommentsCount($item->id, 'com_k2');
if ($count == 0) {
$link = $item->link . '#addcomments';
$text = JText::_('PLG_K2_JCOMMENTS_LINK_ADD_COMMENT');
} else {
$link = $item->link . '#comments';
$text = JText::sprintf('PLG_K2_JCOMMENTS_LINK_READ_COMMENTS', $count);
}
$anchor_css = $this->params->get('anchor_css');
$class = empty($anchor_css) ? '' : ' class="' . $anchor_css . '"';
$result = '<a href="' . $link . '"' . $class . ' title="' . $text . '">' . $text . '</a>';
}
return $result;
}
示例15: onContentAfterDisplay
/**
* We display Jcomments tpl, regarding the plugin config and the display config set previously
*
* @author Florian Voutzinos
* @param string $context
* @param object reference $product virtuemart product object
* @param object reference $params
* @param int $limitstart
* @return string JComments display
*/
function onContentAfterDisplay($context, &$product, &$params, $limitstart = 0)
{
// If the trigger comes from virtuemart productdetails and the plugin is activated in the config
if ($context == 'com_virtuemart.productdetails' && $this->params->get('plugin_activated')) {
// Do not display comments in modules
$data = $params->toArray();
if (isset($data['moduleclass_sfx'])) {
return '';
}
// Display the comments if enabled
if (VmJcommentsHelperPlugin::areCommentsEnabled()) {
if (!class_exists('JComments')) {
require JCOMMENTS_BASE . '/jcomments.php';
}
return JComments::show($product->virtuemart_product_id, 'com_virtuemart', $product->product_name);
}
return '';
}
return '';
}