本文整理汇总了PHP中KunenaForumTopicHelper::favorite方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaForumTopicHelper::favorite方法的具体用法?PHP KunenaForumTopicHelper::favorite怎么用?PHP KunenaForumTopicHelper::favorite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaForumTopicHelper
的用法示例。
在下文中一共展示了KunenaForumTopicHelper::favorite方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unfavorite
function unfavorite() {
$app = JFactory::getApplication ();
if (! JRequest::checkToken ()) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
$this->redirectBack ();
}
$topics = KunenaForumTopicHelper::getTopics(array_keys(JRequest::getVar('topics', array ( 0 ), 'post', 'array')));
if ( KunenaForumTopicHelper::favorite(array_keys($topics), 0) ) {
$app->enqueueMessage ( JText::_('COM_KUNENA_USER_UNFAVORITE_YES') );
} else {
$app->enqueueMessage ( JText::_('COM_KUNENA_POST_NO_UNFAVORITED_TOPIC') );
}
$this->redirectBack ();
}
示例2: _unfavAll
/**
* Delete all users favorites
*
* @param moscomprofilerUser $user
* @param string $prefix
*/
function _unfavAll($user, $forum)
{
global $_CB_database;
if ($forum->prefix != 'kunena' || $forum->prefix == 'kunena' && !class_exists('KunenaForum')) {
$query = 'DELETE FROM ' . $_CB_database->NameQuote('#__' . $forum->prefix . '_favorites') . "\n WHERE " . $_CB_database->NameQuote('userid') . " = " . (int) $user->id;
$_CB_database->setQuery($query);
if (!$_CB_database->query()) {
trigger_error('CBForum-unfavAll SQL error' . $_CB_database->stderr(true), E_USER_WARNING);
}
} elseif (class_exists('KunenaForumTopicHelper')) {
$threads = array_keys(array_pop(KunenaForumTopicHelper::getLatestTopics(false, 0, 0, array('user' => (int) $user->id, 'favorited' => true))));
if ($threads) {
KunenaForumTopicHelper::favorite($threads, 0, (int) $user->id);
}
}
}
示例3: unfavorite
function unfavorite()
{
if (!JSession::checkToken('post')) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
$this->setRedirectBack();
return;
}
$ids = array_keys(JRequest::getVar('topics', array(), 'post', 'array'));
// Array of integer keys
JArrayHelper::toInteger($ids);
$topics = KunenaForumTopicHelper::getTopics($ids);
if (KunenaForumTopicHelper::favorite(array_keys($topics), 0)) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_USER_UNFAVORITE_YES'));
} else {
$this->app->enqueueMessage(JText::_('COM_KUNENA_POST_NO_UNFAVORITED_TOPIC'));
}
$this->setRedirectBack();
}
示例4: unFavorite
/**
* Un-favorite a post
*
* @param string|int $postid Forum Post id
* @param UserTable $user Viewed at User
* @param PluginTable $plugin Current Plugin
* @return boolean Result
*/
public static function unFavorite($postid, $user, $plugin)
{
if (!class_exists('KunenaForumTopicHelper')) {
return false;
}
if ($postid == 'all') {
$ids = array_keys(array_pop(KunenaForumTopicHelper::getLatestTopics(false, 0, 0, array('user' => (int) $user->id, 'favorited' => true))));
} else {
$ids = array((int) $postid);
}
if (!$ids || !KunenaForumTopicHelper::favorite($ids, 0, (int) $user->id)) {
return false;
}
return true;
}