本文整理匯總了PHP中JComments::sendToSubscribers方法的典型用法代碼示例。如果您正苦於以下問題:PHP JComments::sendToSubscribers方法的具體用法?PHP JComments::sendToSubscribers怎麽用?PHP JComments::sendToSubscribers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JComments
的用法示例。
在下文中一共展示了JComments::sendToSubscribers方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: publishComment
function publishComment($id)
{
if (JCommentsSecurity::badRequest() == 1) {
JCommentsSecurity::notAuth();
}
$acl =& JCommentsFactory::getACL();
$db =& JCommentsFactory::getDBO();
$config =& JCommentsFactory::getConfig();
$response =& JCommentsFactory::getAjaxResponse();
$comment = new JCommentsDB($db);
if ($comment->load((int) $id)) {
if ($acl->isLocked($comment)) {
$response->addAlert(JText::_('ERROR_BEING_EDITTED'));
} else {
if ($acl->canPublish()) {
$object_id = $comment->object_id;
$object_group = $comment->object_group;
$page = JComments::getCommentPage($object_id, $object_group, $comment->id);
$comment->published = !$comment->published;
$result = false;
if ($config->getInt('enable_mambots') == 1) {
$allowed = true;
require_once JCOMMENTS_HELPERS . DS . 'plugin.php';
JCommentsPluginHelper::importPlugin('jcomments');
JCommentsPluginHelper::trigger('onBeforeCommentPublished', array(&$comment, &$response, &$allowed));
if ($allowed === false) {
return $response;
}
$result = $comment->store();
JCommentsPluginHelper::trigger('onAfterCommentPublished', array(&$comment, &$response));
} else {
$result = $comment->store();
}
if ($result) {
if ($comment->published) {
// send notification to comment subscribers
JComments::sendToSubscribers($comment, true);
}
JCommentsAJAX::updateCommentsList($response, $object_id, $object_group, $page);
}
} else {
$response->addAlert(JText::_('ERROR_CANT_PUBLISH'));
}
}
}
unset($comment);
return $response;
}
示例2: publish
public static function publish($value)
{
JCommentsSecurity::checkToken();
$pks = JCommentsInput::getVar('cid', array());
if (is_array($pks)) {
$db = JCommentsFactory::getDBO();
$language = JCommentsFactory::getLanguage();
$config = JCommentsFactory::getConfig();
$config->set('enable_mambots', 1);
require_once JCOMMENTS_BASE . '/jcomments.php';
$lastLanguage = '';
foreach ($pks as $pk) {
$comment = new JCommentsTableComment($db);
if ($comment->load($pk)) {
if ($comment->published != $value) {
$comment->published = $value;
$result = JCommentsEvent::trigger('onJCommentsCommentBeforePublish', array(&$comment));
if (!in_array(false, $result, true)) {
if ($comment->store()) {
JCommentsEvent::trigger('onJCommentsCommentAfterPublish', array(&$comment));
if ($comment->published) {
if ($lastLanguage != $comment->lang) {
$lastLanguage = $comment->lang;
$language->load('com_jcomments', JOOMLATUNE_JPATH_SITE, $comment->lang);
}
// TODO: add separate message for just published comments
JComments::sendToSubscribers($comment, true);
}
}
}
}
}
}
}
JCommentsRedirect(JCOMMENTS_INDEX . '?option=com_jcomments&task=comments');
}
示例3: executeCmd
public static function executeCmd()
{
$app = JFactory::getApplication('site');
$cmd = strtolower($app->input->get('cmd', ''));
$hash = $app->input->get('hash', '');
$id = $app->input->getInt('id', 0);
$message = '';
$link = str_replace('/administrator', '', JURI::root()) . 'index.php';
$checkHash = JCommentsFactory::getCmdHash($cmd, $id);
if ($hash == $checkHash) {
$config = JCommentsFactory::getConfig();
if ($config->getInt('enable_quick_moderation') == 1) {
JTable::addIncludePath(JCOMMENTS_TABLES);
$comment = JTable::getInstance('Comment', 'JCommentsTable');
if ($comment->load($id)) {
$link = JCommentsObjectHelper::getLink($comment->object_id, $comment->object_group, $comment->lang);
$link = str_replace('&', '&', $link);
switch ($cmd) {
case 'publish':
$comment->published = 1;
$comment->store();
// send notification to comment subscribers
JComments::sendToSubscribers($comment, true);
$link .= '#comment-' . $comment->id;
break;
case 'unpublish':
$comment->published = 0;
$comment->store();
$acl = JCommentsFactory::getACL();
if ($acl->canPublish()) {
$link .= '#comment-' . $comment->id;
} else {
$link .= '#comments';
}
break;
case 'delete':
if ($config->getInt('delete_mode') == 0) {
$comment->delete();
$link .= '#comments';
} else {
$comment->markAsDeleted();
$link .= '#comment-' . $comment->id;
}
break;
case 'ban':
if ($config->getInt('enable_blacklist') == 1) {
$acl = JCommentsFactory::getACL();
// we will not ban own IP ;)
if ($comment->ip != $acl->getUserIP()) {
$options = array();
$options['ip'] = $comment->ip;
// check if this IP already banned
if (JCommentsSecurity::checkBlacklist($options)) {
$blacklist = JTable::getInstance('Blacklist', 'JCommentsTable');
$blacklist->ip = $comment->ip;
$blacklist->store();
$message = JText::_('SUCCESSFULLY_BANNED');
} else {
$message = JText::_('ERROR_IP_ALREADY_BANNED');
}
} else {
$message = JText::_('ERROR_YOU_CAN_NOT_BAN_YOUR_IP');
}
}
break;
}
JCommentsNotificationHelper::send();
} else {
$message = JText::_('ERROR_NOT_FOUND');
}
} else {
$message = JText::_('ERROR_QUICK_MODERATION_DISABLED');
}
} else {
$message = JText::_('ERROR_QUICK_MODERATION_INCORRECT_HASH');
}
$app->redirect($link, $message);
}
示例4: publishComment
public static function publishComment($id)
{
if (JCommentsSecurity::badRequest() == 1) {
JCommentsSecurity::notAuth();
}
$acl = JCommentsFactory::getACL();
$db = JCommentsFactory::getDBO();
$response = JCommentsFactory::getAjaxResponse();
$comment = new JCommentsTableComment($db);
if ($comment->load((int) $id)) {
if ($acl->isLocked($comment)) {
$response->addAlert(JText::_('ERROR_BEING_EDITTED'));
} else {
if ($acl->canPublish($comment)) {
$object_id = $comment->object_id;
$object_group = $comment->object_group;
$page = JComments::getCommentPage($object_id, $object_group, $comment->id);
$comment->published = !$comment->published;
$result = JCommentsEvent::trigger('onJCommentsCommentBeforePublish', array(&$comment));
if (!in_array(false, $result, true)) {
if ($comment->store()) {
JCommentsEvent::trigger('onJCommentsCommentAfterPublish', array(&$comment));
if ($comment->published) {
JComments::sendToSubscribers($comment, true);
}
self::updateCommentsList($response, $object_id, $object_group, $page);
}
}
} else {
$response->addAlert(JText::_('ERROR_CANT_PUBLISH'));
}
}
}
return $response;
}