本文整理汇总了PHP中EB::aup方法的典型用法代码示例。如果您正苦于以下问题:PHP EB::aup方法的具体用法?PHP EB::aup怎么用?PHP EB::aup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EB
的用法示例。
在下文中一共展示了EB::aup方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Saves a new rating item
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function store($updateNulls = false)
{
$config = EB::config();
$state = parent::store();
if ($this->type == 'entry' && $this->created_by) {
// Load the post item
$post = EB::post($this->uid);
// Get the author of the post
$author = $post->getAuthor();
// Get the link to the post
$link = $post->getExternalPermalink();
// Notify EasySocial users that someone rated their post
EB::easysocial()->notifySubscribers($post, 'ratings.add');
// Assign EasySocial points
EB::easysocial()->assignPoints('blog.rate');
EB::easysocial()->assignPoints('blog.rated', $post->created_by);
// Assign badge for users that report blog post.
// Only give points if the viewer is viewing another person's blog post.
EB::easysocial()->assignBadge('blog.rate', JText::_('COM_EASYBLOG_EASYSOCIAL_BADGE_RATED_BLOG'));
// Assign points for AUP
EB::aup()->assign('plgaup_easyblog_rate_blog', '', 'easyblog_rating', JText::_('COM_EASYBLOG_AUP_BLOG_RATED'));
// Add notifications for EasyDiscuss
// Add notifications
// EB::jomsocial()->addNotification(JText::sprintf('COM_EASYBLOG_JOMSOCIAL_NOTIFICATIONS_NEW_RATING_FOR_YOUR_BLOG', str_replace("administrator/","", $author->getProfileLink()), $author->getName() , $link , $blog->title), 'easyblog_new_blog' , $target , $author , $link);
// Add notifications for easydiscuss
if ($config->get('integrations_jomsocial_notification_rating')) {
$target = array($post->created_by);
EB::easydiscuss()->addNotification($post, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_NOTIFICATIONS_NEW_RATING_FOR_YOUR_BLOG', $author->getName(), $post->title), EBLOG_NOTIFICATIONS_TYPE_RATING, array($post->created_by), $this->created_by, $link);
}
}
return $state;
}
示例2: store
/**
* Override parent's implementation of store
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function store($updateNulls = false)
{
if (!$this->created) {
$this->created = EB::date()->toSql();
}
// Generate an alias if alias is empty
if (!$this->alias) {
$this->alias = EBR::normalizePermalink($this->title);
}
$my = JFactory::getUser();
// Add point integrations for new categories
if ($this->id == 0 && $my->id > 0) {
EB::loadLanguages();
// Integrations with EasyDiscuss
EB::easydiscuss()->log('easyblog.new.category', $my->id, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_HISTORY_NEW_CATEGORY', $this->title));
EB::easydiscuss()->addPoint('easyblog.new.category', $my->id);
EB::easydiscuss()->addBadge('easyblog.new.category', $my->id);
// AlphaUserPoints
EB::aup()->assign('plgaup_easyblog_add_category', '', 'easyblog_add_category_' . $this->id, JText::sprintf('COM_EASYBLOG_AUP_NEW_CATEGORY_CREATED', $this->title));
// JomSocial integrations
EB::jomsocial()->assignPoints('com_easyblog.category.add', $my->id);
// Assign EasySocial points
EB::easysocial()->assignPoints('category.create', $my->id);
}
// Figure out the proper nested set model
if ($this->id == 0 && $this->lft == 0) {
// No parent id, we use the current lft,rgt
if ($this->parent_id) {
$left = $this->getLeft($this->parent_id);
$this->lft = $left;
$this->rgt = $this->lft + 1;
// Update parent's right
$this->updateRight($left);
$this->updateLeft($left);
} else {
$this->lft = $this->getLeft() + 1;
$this->rgt = $this->lft + 1;
}
}
if ($this->id == 0) {
// new cats. we need to store the ordering.
$this->ordering = $this->getOrdering($this->parent_id) + 1;
}
$isNew = !$this->id ? true : false;
$state = parent::store();
return $state;
}
示例3: delete
/**
* Overrides the parent's delete method
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function delete($pk = null)
{
// Try to delete the comment item first
$state = parent::delete($pk);
// Get the current logged in user
$my = JFactory::getUser();
// Remove comment's stream
$this->removeStream();
if ($this->created_by != 0 && $this->published == '1') {
// Get the blog post
$post = $this->getBlog();
// Load language
EB::loadLanguages();
$config = EB::config();
// Integrations with EasyDiscuss
EB::easydiscuss()->log('easyblog.delete.comment', $this->created_by, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_HISTORY_DELETE_COMMENT', $post->title));
EB::easydiscuss()->addPoint('easyblog.delete.comment', $this->created_by);
EB::easydiscuss()->addBadge('easyblog.delete.comment', $this->created_by);
// AlphaUserPoints
EB::aup()->assign('plgaup_easyblog_delete_comment', $this->created_by, JText::_('COM_EASYBLOG_AUP_COMMENT_DELETED'));
// Assign EasySocial points
EB::easysocial()->assignPoints('comments.remove', $this->created_by);
// Deduct points from the comment author
EB::jomsocial()->assignPoints('com_easyblog.comments.remove', $this->created_by);
// Deduct points from the blog post author
if ($my->id != $post->created_by) {
// Deduct EasySocial points
EB::easysocial()->assignPoints('comments.remove.author', $post->created_by);
// JomSocial
EB::jomsocial()->assignPoints('com_easyblog.comments.removeblogger', $post->created_by);
// AUP
EB::aup()->assignPoints('plgaup_easyblog_delete_comment_blogger', $post->created_by, JText::sprintf('COM_EASYBLOG_AUP_COMMENT_DELETED_BLOGGER', $url, $post->title));
}
}
return $state;
}
示例4: deleteOtherRelations
/**
* Delete all other relations with the post
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function deleteOtherRelations()
{
// Delete relationships from jomsocial stream
EB::jomsocial()->removePostStream($this);
EB::jomsocial()->assignPoints('com_easyblog.blog.remove', $this->created_by);
// Deduct points from respective systems
EB::easydiscuss()->log('easyblog.delete.blog', $this->created_by, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_HISTORY_DELETE_BLOG', $this->title));
EB::easydiscuss()->addPoint('easyblog.delete.blog', $this->created_by);
EB::easydiscuss()->addBadge('easyblog.delete.blog', $this->created_by);
// Integrations with EasySocial
EB::easysocial()->assignPoints('blog.remove', $this->created_by);
EB::easysocial()->removePostStream($this);
// Integrations with AUP
EB::aup()->assignPoints('plgaup_easyblog_delete_blog', $this->created_by, JText::sprintf('COM_EASYBLOG_AUP_BLOG_DELETED', $this->title));
}
示例5: store
//.........这里部分代码省略.........
}
// @rule: Process badword filters for content here.
$blockedWord = EasyBlogHelper::getHelper('String')->hasBlockedWords($this->intro . $this->content);
if ($blockedWord !== false) {
$this->setError(JText::sprintf('COM_EASYBLOG_BLOG_POST_CONTAIN_BLOCKED_WORDS', $blockedWord));
return false;
}
// @rule: Test for the empty-ness
if (empty($this->intro) && empty($this->content)) {
$this->setError(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_CONTENT_ERROR'));
}
$state = parent::store();
$source = JRequest::getVar('blog_contribute_source', 'easyblog');
// if this is blog edit, then we should see the column isnew to determine
// whether the post is really new or not.
if (!$isNew) {
$isNew = $this->isnew;
}
// this one is needed for the trigger to work properly.
$this->isnew = $isNew;
// @trigger: onAfterSave
$this->triggerAfterSave();
// @task: If auto featured is enabled, we need to feature the blog post automatically since the blogger is featured.
if ($config->get('main_autofeatured', 0) && EB::isFeatured('blogger', $this->created_by) && !EB::isFeatured('post', $this->id)) {
// just call the model file will do as we do not want to create stream on featured action at this migration.
$modelF = EB::model('Featured');
$modelF->makeFeatured('post', $this->id);
}
// @task: This is when the blog is either created or updated.
if ($source == 'easyblog' && $state && $this->published == EASYBLOG_POST_PUBLISHED && $log) {
$category = EB::table('Category');
$category->load($this->category_id);
$easysocial = EasyBlogHelper::getHelper('EasySocial');
if ($category->private == 0) {
// @rule: Add new stream item in jomsocial
EB::jomsocial()->addBlogActivity($this, $isNew);
}
// @rule: Add stream for easysocial
if ($config->get('integrations_easysocial_stream_newpost') && $easysocial->exists() && $isNew) {
$easysocial->createBlogStream($this, $isNew);
}
// update privacy in easysocial.
if ($config->get('integrations_easysocial_privacy') && $easysocial->exists()) {
$easysocial->updateBlogPrivacy($this);
}
}
if ($source == 'easyblog' && $state && $this->published == EASYBLOG_POST_PUBLISHED && $isNew && $log) {
// @rule: Send email notifications out to subscribers.
$author = EB::user($this->created_by);
// Ping pingomatic
EB::pingomatic()->ping($this);
// Assign EasySocial points
$easysocial = EasyBlogHelper::getHelper('EasySocial');
if ($easysocial->exists()) {
$easysocial->assignPoints('blog.create', $this->created_by);
}
// @rule: Add userpoints for jomsocial
if ($config->get('main_jomsocial_userpoint')) {
$path = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'userpoints.php';
if (JFile::exists($path)) {
require_once $path;
CUserPoints::assignPoint('com_easyblog.blog.add', $this->created_by);
}
}
$link = $this->getExternalBlogLink('index.php?option=com_easyblog&view=entry&id=' . $this->id);
// @rule: Add notifications for jomsocial 2.6
if ($config->get('integrations_jomsocial_notification_blog')) {
// Get list of users who subscribed to this blog.
$target = $this->getRegisteredSubscribers('new', array($this->created_by));
EasyBlogHelper::getHelper('JomSocial')->addNotification(JText::sprintf('COM_EASYBLOG_JOMSOCIAL_NOTIFICATIONS_NEW_BLOG', str_replace("administrator/", "", $author->getProfileLink()), $author->getName(), $link, $this->title), 'easyblog_new_blog', $target, $author, $link);
}
// Get list of users who subscribed to this blog.
// @rule: Add notifications for easysocial
if ($config->get('integrations_easysocial_notifications_newpost') && $easysocial->exists()) {
$easysocial->notifySubscribers($this, 'new.post');
}
// @rule: Add indexer for easysocial
if ($config->get('integrations_easysocial_indexer_newpost') && $easysocial->exists()) {
$easysocial->addIndexerNewBlog($this);
}
// @rule: Integrations with EasyDiscuss
EasyBlogHelper::getHelper('EasyDiscuss')->log('easyblog.new.blog', $this->created_by, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_HISTORY_NEW_BLOG', $this->title));
EasyBlogHelper::getHelper('EasyDiscuss')->addPoint('easyblog.new.blog', $this->created_by);
EasyBlogHelper::getHelper('EasyDiscuss')->addBadge('easyblog.new.blog', $this->created_by);
// Assign badge for users that report blog post.
// Only give points if the viewer is viewing another person's blog post.
EasyBlogHelper::getHelper('EasySocial')->assignBadge('blog.create', JText::_('COM_EASYBLOG_EASYSOCIAL_BADGE_CREATE_BLOG_POST'));
if ($config->get('integrations_easydiscuss_notification_blog')) {
// Get list of users who subscribed to this blog.
$target = $this->getRegisteredSubscribers('new', array($this->created_by));
EasyBlogHelper::getHelper('EasyDiscuss')->addNotification($this, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_NOTIFICATIONS_NEW_BLOG', $author->getName(), $this->title), EBLOG_NOTIFICATIONS_TYPE_BLOG, $target, $this->created_by, $link);
}
// AUP
EB::aup()->assignPoints('plgaup_easyblog_add_blog', $this->created_by, JText::sprintf('COM_EASYBLOG_AUP_NEW_BLOG_CREATED', $this->getPermalink(), $this->title));
// Update the isnew column so that if user edits this entry again, it doesn't send any notifications the second time.
$this->isnew = $this->published && $this->isnew ? 0 : 1;
$this->store(false);
}
return $state;
}
示例6: bindAvatar
/**
* Binds avatar
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function bindAvatar($file, $acl)
{
if (!$acl->get('upload_avatar')) {
return false;
}
// Try to upload the avatar
$avatar = EB::avatar();
// Get the avatar path
$this->avatar = $avatar->upload($file);
// Assign points for aup
EB::aup()->assign('plgaup_easyblog_upload_avatar', '', 'easyblog_upload_avatar_' . $this->user->id, JText::_('COM_EASYBLOG_AUP_UPLOADED_AVATAR'));
}