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


PHP Comments::get方法代码示例

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


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

示例1: add_template_vars

 /**
  * Add additional template variables to the template output.
  *
  *  You can assign additional output values in the template here, instead of
  *  having the PHP execute directly in the template.  The advantage is that
  *  you would easily be able to switch between template types (RawPHP/Smarty)
  *  without having to port code from one to the other.
  *
  *  You could use this area to provide "recent comments" data to the template,
  *  for instance.
  *
  *  Note that the variables added here should possibly *always* be added,
  *  especially 'user'.
  *
  *  Also, this function gets executed *after* regular data is assigned to the
  *  template.  So the values here, unless checked, will overwrite any existing
  *  values.
  */
 public function add_template_vars()
 {
     //Theme Options
     $this->assign('home_tab', 'Home');
     //Set to whatever you want your first tab text to be.
     $this->assign('show_author', false);
     //Display author in posts
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     if (!$this->template_engine->assigned('page')) {
         $page = Controller::get_var('page');
         $this->assign('page', isset($page) ? $page : 1);
     }
     parent::add_template_vars();
     //from mzingi
     //visiting page/2, /3 will offset to the next page of posts in the sidebar
     $page = Controller::get_var('page');
     $pagination = Options::get('pagination');
     if ($page == '') {
         $page = 1;
     }
     $this->assign('more_posts', Posts::get(array('status' => 'published', 'content_type' => 'entry', 'offset' => $pagination * $page, 'limit' => 5)));
     //from mzingi
     //for recent comments loop in sidebar.php
     $this->assign('recent_comments', Comments::get(array('limit' => 5, 'status' => Comment::STATUS_APPROVED, 'orderby' => 'date DESC')));
 }
开发者ID:habari-extras,项目名称:hmallow2,代码行数:45,代码来源:theme.php

示例2: countStats

function countStats()
{
    $resultData = array();
    $today = date('Y-m-d');
    $loadData = Post::get(array('query' => "select count(postid)as totalcount from " . Database::getPrefix() . "post"));
    $resultData['post']['total'] = $loadData[0]['totalcount'];
    $loadData = Post::get(array('query' => "select count(postid)as totalcount from " . Database::getPrefix() . "post where DATE(date_added)='{$today}'"));
    $resultData['post']['today'] = $loadData[0]['totalcount'];
    $loadData = Post::get(array('query' => "select count(postid)as totalcount from " . Database::getPrefix() . "post where status='1'"));
    $resultData['post']['published'] = $loadData[0]['totalcount'];
    $loadData = Post::get(array('query' => "select count(postid)as totalcount from " . Database::getPrefix() . "post where status='0'"));
    $resultData['post']['pending'] = $loadData[0]['totalcount'];
    $loadData = Comments::get(array('query' => "select count(commentid)as totalcount from " . Database::getPrefix() . "comments"));
    $resultData['comments']['total'] = $loadData[0]['totalcount'];
    $loadData = Comments::get(array('query' => "select count(commentid)as totalcount from " . Database::getPrefix() . "comments where DATE(date_added)='{$today}'"));
    $resultData['comments']['today'] = $loadData[0]['totalcount'];
    $loadData = Comments::get(array('query' => "select count(commentid)as totalcount from " . Database::getPrefix() . "comments where status='1'"));
    $resultData['comments']['approved'] = $loadData[0]['totalcount'];
    $loadData = Comments::get(array('query' => "select count(commentid)as totalcount from " . Database::getPrefix() . "comments where status='0'"));
    $resultData['comments']['pending'] = $loadData[0]['totalcount'];
    $loadData = Contactus::get(array('query' => "select count(contactid)as totalcount from " . Database::getPrefix() . "contactus"));
    $resultData['contactus']['total'] = $loadData[0]['totalcount'];
    $loadData = Contactus::get(array('query' => "select count(contactid)as totalcount from " . Database::getPrefix() . "contactus where DATE(date_added)='{$today}'"));
    $resultData['contactus']['today'] = $loadData[0]['totalcount'];
    $loadData = Users::get(array('query' => "select count(userid)as totalcount from " . Database::getPrefix() . "users"));
    $resultData['users']['total'] = $loadData[0]['totalcount'];
    $loadData = Users::get(array('query' => "select count(userid)as totalcount from " . Database::getPrefix() . "users where DATE(date_added)='{$today}'"));
    $resultData['users']['today'] = $loadData[0]['totalcount'];
    return $resultData;
}
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:30,代码来源:dashboard.php

示例3: action_block_content_recent_comments

 /**
  * Recent Comments
  *
  * Handle recent comment block output
  *
  * @param Block $block The block instance to be configured
  * @param Theme $theme The active theme
  */
 public function action_block_content_recent_comments($block, $theme)
 {
     if (!($limit = $block->quantity)) {
         $limit = 5;
     }
     $offset = 0;
     $published_posts = 0;
     $valid_comments = array();
     // prevent endless looping if there are fewer comments than $limit
     $comments_remain = true;
     while ($published_posts < $limit && $comments_remain) {
         $comments = Comments::get(array('limit' => $limit - $published_posts, 'status' => Comment::STATUS_APPROVED, 'type' => Comment::COMMENT, 'offset' => $offset, 'orderby' => 'date DESC'));
         // check the posts
         foreach ($comments as $key => $comment) {
             if ($comment->post->status == Post::status('published')) {
                 $valid_comments[] = $comments[$key];
                 ++$published_posts;
             }
             ++$offset;
         }
         // stop looping if out of comments
         if (count($comments) === 0) {
             $comments_remain = false;
         }
     }
     $block->recent_comments = $valid_comments;
 }
开发者ID:wwxgitcat,项目名称:habari,代码行数:35,代码来源:coreblocks.plugin.php

示例4: add_template_vars

 public function add_template_vars()
 {
     //Theme Options
     $this->assign('show_author', true);
     //Display author in posts
     // How many months should be displayed by the RN Archives plugin
     $this->assign('rn_archives_months', 2);
     // Links list
     $this->assign('links_list', array('Follow me on Twitter' => 'http://twitter.com/sebastianp'));
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     // Fetch the last 5 posts, for displaying in the quickbar
     if (!$this->template_engine->assigned('latest_posts')) {
         $this->assign('latest_posts', Posts::get(array('content_type' => 'entry', 'status' => Post::status('published'), 'limit' => 5)));
     }
     // Fetch the last 5 comments, for displaying in the quickbar
     if (!$this->template_engine->assigned('latest_comments')) {
         $this->assign('latest_comments', Comments::get(array('status' => Comment::STATUS_APPROVED)));
     }
     if (!$this->template_engine->assigned('taglist')) {
         $this->assign('taglist', $this->theme_show_tags());
     }
     // Fetch all the posts
     if (!$this->template_engine->assigned('archives')) {
         $this->assign('archives', Posts::get(array('content_type' => 'entry', 'status' => Post::status('published'))));
     }
     parent::add_template_vars();
 }
开发者ID:sebastianp,项目名称:closure,代码行数:29,代码来源:theme.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $users = Users::get();
     $comments = Comments::get();
     $supports = Supports::get();
     $notes = Notes::get();
     $usersJson = array();
     $commentsJson = array();
     $supportsJson = array();
     $notesJson = array();
     // build users
     foreach ($users as $user) {
         array_push($usersJson, array('id' => $user->id, 'name' => $user->name));
     }
     // build comments
     foreach ($comments as $comment) {
         array_push($commentsJson, array('id' => $comment->id, 'article_id' => $comment->article_id, 'user_id' => $comment->user_id, 'comment' => $comment->comment, 'challenge' => $comment->challenge));
     }
     // build supports
     foreach ($supports as $support) {
         array_push($supportsJson, array('id' => $support->id, 'user_id' => $support->user_id, 'comment_id' => $support->comment_id));
     }
     // build notes
     foreach ($notes as $note) {
         array_push($notesJson, array('id' => $note->id, 'comment_id' => $note->comment_id, 'comment' => $note->comment));
     }
     // build json
     $json = array('users' => $usersJson, 'comments' => $commentsJson, 'supports' => $supportsJson, 'notes' => $notesJson);
     // display json
     echo json_encode($json);
 }
开发者ID:SecureCloud-biz,项目名称:duel,代码行数:36,代码来源:RestController.php

示例6: add_template_vars

 /**
  * Add additional template variables to the template output.
  * 
  * This function gets executed *after* regular data is assigned to the
  * template.  So the values here, unless checked, will overwrite any existing 
  * values.
  */
 public function add_template_vars()
 {
     parent::add_template_vars();
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get('page_list'));
     }
     if (!$this->template_engine->assigned('asides')) {
         //For Asides loop in sidebar.php
         $this->assign('asides', Posts::get('asides'));
     }
     if (!$this->template_engine->assigned('recent_comments')) {
         //for recent comments loop in sidebar.php
         $this->assign('recent_comments', Comments::get(array('limit' => 5, 'status' => Comment::STATUS_APPROVED, 'orderby' => 'date DESC')));
     }
     if (!$this->template_engine->assigned('more_posts')) {
         //Recent posts in sidebar.php
         //visiting page/2 will offset to the next page of posts in the footer /3 etc
         $pagination = Options::get('pagination');
         $this->assign('more_posts', Posts::get(array('content_type' => 'entry', 'status' => 'published', 'vocabulary' => array('tags:not:tag' => 'asides'), 'offset' => $pagination * $this->page, 'limit' => 5)));
     }
     if (!$this->template_engine->assigned('all_tags')) {
         // List of all the tags
         $this->assign('all_tags', Tags::vocabulary()->get_tree());
     }
     if (!$this->template_engine->assigned('all_entries')) {
         // List of all the entries
         $this->assign('all_entries', Posts::get(array('content_type' => 'entry', 'status' => 'published', 'nolimit' => 1)));
     }
 }
开发者ID:habari-extras,项目名称:thePrestige,代码行数:36,代码来源:theme.php

示例7: index

 public function index()
 {
     Cache::loadPage('', 30);
     $inputData = array();
     $postid = 0;
     Model::loadWithPath('post', System::getThemePath() . 'model/');
     if (!($match = Uri::match('post\\/(.*?)\\.html$'))) {
         Redirect::to('404page');
     }
     $friendly_url = addslashes($match[1]);
     $loadData = Post::get(array('cacheTime' => 30, 'where' => "where friendly_url='{$friendly_url}'"));
     if (!isset($loadData[0]['postid'])) {
         Redirect::to('404page');
     }
     $inputData = $loadData[0];
     if (Request::has('btnComment')) {
         try {
             sendComment($loadData[0]['postid']);
             $inputData['commentAlert'] = '<div class="alert alert-success">Send comment success.</div>';
         } catch (Exception $e) {
             $inputData['commentAlert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     $postid = $loadData[0]['postid'];
     $listTag = PostTags::renderToLink($postid);
     $inputData['listTag'] = $listTag;
     $inputData['listComments'] = Comments::get(array('where' => "where postid='{$postid}' AND status='1'", 'orderby' => "order by postid desc"));
     Post::upView($postid);
     System::setTitle(ucfirst($loadData[0]['title']));
     $keywords = isset($loadData[0]['keywords'][4]) ? $loadData[0]['keywords'] : System::getKeywords();
     System::setKeywords($keywords);
     self::makeContent('post', $inputData);
     Cache::savePage();
 }
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:34,代码来源:themePost.php

示例8: onecommentAction

 public function onecommentAction()
 {
     $comm_id = $this->_getParam('comm_id');
     $Comments = new Comments();
     $this->view->comm = $Comments->get($comm_id);
     //$this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout->disableLayout();
 }
开发者ID:vitsun,项目名称:igrushki-detkam,代码行数:8,代码来源:CommentsController.php

示例9: action_comment_insert_before

 function action_comment_insert_before($comment)
 {
     // This plugin ignores non-comments and comments already marked as spam
     if ($comment->type == Comment::COMMENT && $comment->status != Comment::STATUS_SPAM) {
         if (Comments::get(array('email' => $comment->email, 'name' => $comment->name, 'url' => $comment->url, 'status' => Comment::STATUS_APPROVED))->count >= Options::get('preapproved__approved_count')) {
             $comment->status = Comment::STATUS_APPROVED;
             EventLog::log('Comment by ' . $comment->name . ' automatically approved.', 'info', 'PreApproved', 'PreApproved');
         }
     }
     return $comment;
 }
开发者ID:habari-extras,项目名称:preapproved,代码行数:11,代码来源:preapproved.plugin.php

示例10: action_comment_insert_before

 public function action_comment_insert_before($comment)
 {
     if ($comment->url != '') {
         $lastcomment = Comments::get(array('url' => $comment->url, 'limit' => 1, 'orderby' => '`date` DESC', 'fetch_fn' => 'get_row'));
         if ($lastcomment instanceof Comment) {
             if (isset($lastcomment->info->redirecturl)) {
                 $comment->info->redirecturl = $lastcomment->info->redirecturl;
             }
         }
     }
 }
开发者ID:habari-extras,项目名称:urlapprove,代码行数:11,代码来源:urlapprove.plugin.php

示例11: add_template_vars

 public function add_template_vars()
 {
     $this->add_template('formcontrol_text', dirname(__FILE__) . '/forms/formcontrol_text.php', true);
     $this->add_template('formcontrol_textarea', dirname(__FILE__) . '/forms/formcontrol_textarea.php', true);
     $this->recent_comments = Comments::get(array('limit' => 5, 'status' => Comment::STATUS_APPROVED, 'orderby' => 'date DESC'));
     $this->recent_posts = Posts::get(array('limit' => 5, 'orderby' => 'pubdate DESC', 'content_type' => Post::type('entry'), 'status' => Post::status('published')));
     if (!$this->template_engine->assigned('pages')) {
         $this->pages = Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1));
     }
     parent::add_template_vars();
 }
开发者ID:habari-extras,项目名称:aligned,代码行数:11,代码来源:theme.php

示例12: delete_old_spam

 private function delete_old_spam()
 {
     // The inline values are safe and used this way for a reason
     $comments = Comments::get(array('where' => 'date < ' . strtotime('yesterday') . ' AND {comments}.status = ' . Comment::STATUS_SPAM));
     if ($comments->count == 0) {
         $message = _t('No old spam to delete.');
     } else {
         $total = $comments->count();
         $comments->delete();
         $message = _t('Deleted all %s spam comments.', array($total));
     }
     return $message;
 }
开发者ID:habari-extras,项目名称:spamcrondelete,代码行数:13,代码来源:spamcrondelete.plugin.php

示例13: view

 public function view()
 {
     if (!($match = Uri::match('\\/view\\/(\\d+)'))) {
         Redirect::to(ADMINCP_URL . 'comments/');
     }
     $commentid = $match[1];
     $loadData = Comments::get(array('query' => "select p.title,c.* from " . Database::getPrefix() . "post p," . Database::getPrefix() . "comments c where p.postid=c.postid AND c.commentid='{$commentid}'"));
     $post['edit'] = $loadData[0];
     System::setTitle('View comment - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('commentView', $post);
     View::make('admincp/footer');
 }
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:13,代码来源:controlComments.php

示例14: check_comment

 function check_comment($comment)
 {
     // don't blacklist logged-in users: they can speak freely
     if (User::identify()->loggedin) {
         return true;
     }
     // and if the person has more than 5 comments approved,
     // they're likely not a spammer, so don't blacklist them
     $bypass = Options::get('simpleblacklist__frequency', false);
     if ($bypass) {
         $comments = Comments::get(array('email' => $comment->email, 'name' => $comment->name, 'url' => $comment->url, 'status' => Comment::STATUS_APPROVED));
         if ($comments->count >= 5) {
             return true;
         }
     }
     $allow = true;
     $reason = "";
     $blacklist = explode("\n", Options::get('simpleblacklist__blacklist'));
     foreach ($blacklist as $item) {
         $item = trim(strtolower($item));
         if ('' == $item) {
             continue;
         }
         // check against the commenter name
         if (false !== strpos(strtolower($comment->name), $item)) {
             $allow = false;
         }
         // check against the commenter email
         if (false !== strpos(strtolower($comment->email), $item)) {
             $allow = false;
         }
         // check against the commenter URL
         if (false !== strpos(strtolower($comment->url), $item)) {
             $allow = false;
         }
         // check against the commenter IP address
         if ((strpos($comment->ip, '.') > 0 ? $comment->ip : long2ip($comment->ip)) == $item) {
             $allow = false;
         }
         // now check the body of the comment
         if (false !== strpos(strtolower($comment->content), $item)) {
             $allow = false;
         }
         if ($allow === false) {
             break;
         }
     }
     return $allow;
 }
开发者ID:habari-extras,项目名称:simpleblacklist,代码行数:49,代码来源:simpleblacklist.plugin.php

示例15: add_template_vars

 public function add_template_vars()
 {
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'))));
     }
     if (!$this->template_engine->assigned('user')) {
         $this->assign('user', User::identify());
     }
     if (!$this->template_engine->assigned('page')) {
         $this->assign('page', isset($page) ? $page : 1);
     }
     //for recent comments loop in sidebar.php
     $this->assign('recent_comments', Comments::get(array('limit' => 8, 'status' => Comment::STATUS_APPROVED, 'orderby' => 'date DESC')));
     parent::add_template_vars();
 }
开发者ID:habari-extras,项目名称:208,代码行数:15,代码来源:theme.php


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