当前位置: 首页>>代码示例>>PHP>>正文


PHP EasyBlogHelper::table方法代码示例

本文整理汇总了PHP中EasyBlogHelper::table方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogHelper::table方法的具体用法?PHP EasyBlogHelper::table怎么用?PHP EasyBlogHelper::table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EasyBlogHelper的用法示例。


在下文中一共展示了EasyBlogHelper::table方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 public function get()
 {
     $input = JFactory::getApplication()->input;
     $model = EasyBlogHelper::getModel('Blog');
     //$id = $input->get('id', null, 'INT');
     $id = 0;
     $search = $input->get('search', '', 'STRING');
     $featured = $input->get('featured', 0, 'INT');
     $tags = $input->get('tags', 0, 'INT');
     $user_id = $input->get('user_id', 0, 'INT');
     $posts = array();
     // If we have an id try to fetch the user
     $blog = EasyBlogHelper::table('Blog');
     $blog->load($id);
     $modelPT = EasyBlogHelper::getModel('PostTag');
     if ($tags) {
         $rows = $model->getTaggedBlogs($tags);
     } else {
         if ($featured) {
             $rows = $this->getfeature_Blog();
             $sorting = $this->plugin->params->get('sorting', 'featured');
         } else {
             if ($user_id) {
                 $blogs = EasyBlogHelper::getModel('Blog');
                 $rows = $blogs->getBlogsBy('blogger', $user_id, 'latest');
             } else {
                 //to get latest blog
                 //$sorting	= $this->plugin->params->get( 'sorting' , 'latest' );
                 //$rows 	= $model->getBlogsBy( $sorting , '' , $sorting , 0, EBLOG_FILTER_PUBLISHED, $search );
                 $rows = $model->getBlogsBy('', '', 'latest', 0, EBLOG_FILTER_PUBLISHED, null, true, array(), false, false, true, '', '', null, 'listlength', false);
                 //$rows = EB::formatter('list', $rows, false);
             }
         }
     }
     $rows = EB::formatter('list', $rows, false);
     //data mapping
     foreach ($rows as $k => $v) {
         //$item = EB::helper( 'simpleschema' )->mapPost($v,'', 100, array('text'));
         $scm_obj = new EasyBlogSimpleSchema_plg();
         $item = $scm_obj->mapPost($v, '', 100, array('text'));
         $item->tags = $modelPT->getBlogTags($item->postid);
         $item->isowner = $v->created_by == $this->plugin->get('user')->id ? true : false;
         if ($v->blogpassword != '') {
             $item->ispassword = true;
         } else {
             $item->ispassword = false;
         }
         $item->blogpassword = $v->blogpassword;
         $model = EasyBlogHelper::getModel('Ratings');
         $ratingValue = $model->getRatingValues($item->postid, 'entry');
         $item->rate = $ratingValue;
         $item->isVoted = $model->hasVoted($item->postid, 'entry', $this->plugin->get('user')->id);
         if ($item->rate->ratings == 0) {
             $item->rate->ratings = -2;
         }
         $posts[] = $item;
     }
     $this->plugin->setResponse($posts);
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:59,代码来源:latest.php

示例2: setRatings

 public function setRatings()
 {
     $input = JFactory::getApplication()->input;
     $user_id = $input->get('uid', 0, 'INT');
     $blog_id = $input->get('blogid', 0, 'INT');
     $values = $input->get('values', 0, 'INT');
     $model = EasyBlogHelper::table('Ratings');
     $model->uid = $blog_id;
     $model->created_by = $user_id;
     $model->value = $values;
     $model->type = 'entry';
     //$model->fill($user_id,$blog_id,'entry');
     $ratingValue = $model->store();
     return $ratingValue;
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:15,代码来源:rating.php

示例3: getBlogsubscribers

 public function getBlogsubscribers()
 {
     $app = JFactory::getApplication();
     $blogid = $app->input->get('blogid', 0, 'INT');
     $db = EasyBlogHelper::db();
     $where = array();
     //Making query for getting count of blog subscription.
     $query = 'select count(1) from `#__easyblog_post_subscription` as a';
     $query .= ' where  a.post_id = ' . $db->Quote($blogid);
     $db->setQuery($query);
     $val = $db->loadResult();
     $result['count'] = $val;
     $btable = EasyBlogHelper::table('Blog');
     //try to save blog id in table
     $btable->load($blogid);
     $result['data'] = $btable->getSubscribers(array());
     return $result;
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:18,代码来源:subscribe.php

示例4: getEasyBlog_user

 public function getEasyBlog_user()
 {
     $app = JFactory::getApplication();
     $limitstart = $app->input->get('limitstart', 0, 'INT');
     $limit = $app->input->get('limit', 0, 'INT');
     $search = $app->input->get('search', '', 'STRING');
     $ob1 = new EasyBlogModelBlogger();
     $ob1->setState('limitstart', $limitstart);
     //$bloggers = $ob1->getAllBloggers('latest',$limit, $filter='showallblogger' , $search );
     $bloggers = $ob1->getBloggers('latest', $limit, $filter = 'showallblogger', $search);
     $blogger = EasyBlogHelper::table('Profile');
     foreach ($bloggers as $usr) {
         $blogger->load($usr->id);
         //$avatar = $blogger->getAvatar();
         $usr->avatar = $blogger->getAvatar();
     }
     return $bloggers;
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:18,代码来源:easyblog_users.php

示例5: getEasyBlog_user

 public function getEasyBlog_user()
 {
     $app = JFactory::getApplication();
     $limitstart = $app->input->get('limitstart', 0, 'INT');
     $limit = $app->input->get('limit', 0, 'INT');
     $search = $app->input->get('search', '', 'STRING');
     //order options are
     //latest,alphabet,featured,latestpost,postcount,active
     $orderBy = $app->input->get('orderby', 'alphabet', 'STRING');
     $ob1 = new EasyBlogModelBlogger();
     $ob1->setState('limitstart', $limitstart);
     //$bloggers = $ob1->getAllBloggers('latest',$limit, $filter='showallblogger' , $search );
     $bloggers = $ob1->getBloggers($orderBy, $limit, $filter = 'showallblogger', $search);
     $blogger = EasyBlogHelper::table('Profile');
     foreach ($bloggers as $usr) {
         $blogger->load($usr->id);
         //$avatar = $blogger->getAvatar();
         $usr->avatar = $blogger->getAvatar();
     }
     return $bloggers;
 }
开发者ID:alexforte,项目名称:com_api-plugins,代码行数:21,代码来源:easyblog_users.php

示例6: post

 public function post()
 {
     $app = JFactory::getApplication();
     $my = $this->plugin->getUser();
     $config = EasyBlogHelper::getConfig();
     //$acl = EasyBlogACLHelper::getRuleSet();
     $acl = EB::acl();
     $post = $app->input->post->getArray();
     if (empty($acl->rules->allow_comment) && (empty($my->id) && !$config->get('main_allowguestcomment'))) {
         $this->plugin->setResponse($this->getErrorResponse(500, JText::_('COM_EASYBLOG_NO_PERMISSION_TO_POST_COMMENT')));
     }
     $isModerated = false;
     $parentId = isset($post['parent_id']) ? $post['parent_id'] : 0;
     $commentDepth = isset($post['comment_depth']) ? $post['comment_depth'] : 0;
     $blogId = isset($post['id']) ? $post['id'] : 0;
     $subscribeBlog = isset($post['subscribe-to-blog']) ? true : false;
     if (!$blogId) {
         $this->plugin->setResponse($this->getErrorResponse(404, 'Invalid Blog'));
     }
     // @task: Cleanup posted values.
     array_walk($post, array($this, '_trim'));
     array_walk($post, array($this, '_revertValue'));
     if (!$config->get('comment_require_email') && !isset($post['esemail'])) {
         $post['esemail'] = '';
     }
     // @task: Run some validation tests on the posted values.
     if (!$this->_validateFields($post)) {
         $this->plugin->setResponse($this->getErrorResponse(500, $this->err[0]));
     }
     // @task: Akismet detection service.
     if ($config->get('comment_akismet')) {
         $data = array('author' => $post['esname'], 'email' => $post['esname'], 'website' => JURI::root(), 'body' => $post['comment'], 'permalink' => EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $post['id']));
         if (EasyBlogHelper::getHelper('Akismet')->isSpam($data)) {
             $this->plugin->setResponse($this->getErrorResponse(500, JText::_('COM_EASYBLOG_SPAM_DETECTED_IN_COMMENT')));
         }
     }
     // @task: Retrieve the comments model
     $model = EasyBlogHelper::getModel('Comment');
     // @task: Retrieve the comment's table
     $comment = EasyBlogHelper::table('Comment');
     // We need to rename the esname and esemail back to name and email.
     $post['post_id'] = $post['id'];
     $post['name'] = $post['esname'];
     $post['email'] = $post['esemail'];
     unset($post['id']);
     unset($post['esname']);
     unset($post['esemail']);
     // @task: Bind posted values into the table.
     $comment->bindPost($post);
     // @task: Process registrations
     $registerUser = isset($post['esregister']) ? true : false;
     $fullname = isset($post['name']) ? $post['name'] : '';
     $username = isset($post['esusername']) ? $post['esusername'] : '';
     $email = $post['email'];
     $message = '';
     $newUserId = 0;
     // @task: Process registrations if necessary
     if ($registerUser && $my->id <= 0) {
         $state = $this->processRegistrations($post, $username, $email, $ajax);
         if (!is_numeric($state)) {
             $this->plugin->setResponse($this->getErrorResponse(500, $state));
         }
         $newUserId = $state;
     }
     $totalComments = empty($post['totalComment']) ? 1 : $post['totalComment'];
     //$date 	= EasyBlogHelper::getDate();
     $date = EasyBlogDate::getDate();
     $comment->set('created', $date->toMySQL());
     $comment->set('modified', $date->toMySQL());
     $comment->set('published', 1);
     $comment->set('parent_id', $parentId);
     $comment->set('sent', 0);
     $comment->set('created_by', $my->id);
     // @rule: Update the user's id if they have just registered earlier.
     if ($newUserId != 0) {
         $comment->set('created_by', $newUserId);
     }
     // @rule: Update publish status if the comment requires moderation
     if ($config->get('comment_moderatecomment') == 1 || $my->id == 0 && $config->get('comment_moderateguestcomment') == 1) {
         $comment->set('published', EBLOG_COMMENT_STATUS_MODERATED);
         $isModerated = true;
     }
     $blog = EasyBlogHelper::table('Blog');
     $blog->load($blogId);
     // If moderation for author is disabled, ensure that the comment is published.
     // If the author is the owner of the blog, it should never be moderated.
     if (!$config->get('comment_moderateauthorcomment') && $blog->created_by == $my->id) {
         $comment->set('published', 1);
         $isModerated = false;
     }
     if (!$comment->store()) {
         $this->plugin->setResponse($this->getErrorResponse(500, 'There was a problem saving the comment'));
     }
     // @rule: Process subscription for blog automatically when the user submits a new comment and wants to subscribe to the blog.
     if ($subscribeBlog && $config->get('main_subscription') && $blog->subscription) {
         $isSubscribed = false;
         $userId = $my->id;
         $blogModel = EasyblogHelper::getModel('Blog');
         if ($userId == 0) {
             $sid = $blogModel->isBlogSubscribedEmail($blog->id, $email);
//.........这里部分代码省略.........
开发者ID:yalive,项目名称:com_api-plugins,代码行数:101,代码来源:comments.php

示例7: delete_blog

 public function delete_blog()
 {
     $app = JFactory::getApplication();
     $id = $app->input->get('id', 0, 'INT');
     $blog = EasyBlogHelper::table('Blog', 'Table');
     $blog->load($id);
     if (!$blog->id || !$id) {
         $res->status = 0;
         $res->message = 'blog not exists';
         return $res;
     } else {
         $val = $blog->delete($id);
         $re->status = $val;
         $res->message = 'blog deleted successfully';
         return $res;
     }
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:17,代码来源:blog.php

示例8: get

 public function get()
 {
     $input = JFactory::getApplication()->input;
     $model = EasyBlogHelper::getModel('Blog');
     $category = EasyBlogHelper::table('Category', 'Table');
     $id = $input->get('id', null, 'INT');
     $search = $input->get('search', null, 'STRING');
     $posts = array();
     if (!isset($id)) {
         $categoriesmodel = EasyBlogHelper::getModel('Categories');
         $categories = $categoriesmodel->getCategoryTree('ordering');
         $this->plugin->setResponse($categories);
         return;
     }
     $category->load($id);
     // private category shouldn't allow to access.
     $privacy = $category->checkPrivacy();
     if (!$category->id || !$privacy->allowed) {
         $this->plugin->setResponse($this->getErrorResponse(404, 'Category not found'));
         return;
     }
     //new code
     $category = EB::table('Category');
     $category->load($id);
     //get the nested categories
     $category->childs = null;
     // Build nested childsets
     EB::buildNestedCategories($category->id, $category, false, true);
     $catIds = array();
     $catIds[] = $category->id;
     EB::accessNestedCategoriesId($category, $catIds);
     // Get the category model
     $model = EB::model('Category');
     // Get total posts in this category
     $category->cnt = $model->getTotalPostCount($category->id);
     // Get teamblog posts count
     // $teamBlogCount = $model->getTeamBlogCount($category->id);
     $limit = EB::call('Pagination', 'getLimit', array(EBLOG_PAGINATION_CATEGORIES));
     // Get the posts in the category
     $data = $model->getPosts($catIds, $limit);
     $rows = EB::formatter('list', $data);
     //end
     foreach ($rows as $k => $v) {
         //$item = EasyBlogHelper::getHelper( 'SimpleSchema' )->mapPost($v, '', 100, array('text'));
         $scm_obj = new EasyBlogSimpleSchema_plg();
         $item = $scm_obj->mapPost($v, '', 100, array('text'));
         $item->isowner = $v->created_by == $this->plugin->get('user')->id ? true : false;
         if ($v->blogpassword != '') {
             $item->ispassword = true;
         } else {
             $item->ispassword = false;
         }
         $item->blogpassword = $v->blogpassword;
         $model = EasyBlogHelper::getModel('Ratings');
         $ratingValue = $model->getRatingValues($item->postid, 'entry');
         $item->rate = $ratingValue;
         $item->isVoted = $model->hasVoted($item->postid, 'entry', $this->plugin->get('user')->id);
         if ($item->rate->ratings == 0) {
             $item->rate->ratings = -2;
         }
         $posts[] = $item;
     }
     $this->plugin->setResponse($posts);
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:64,代码来源:category.php


注:本文中的EasyBlogHelper::table方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。