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


PHP Get::comments方法代码示例

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


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

示例1: array

    if ($files = Get::comments(null, 'DESC', 'txt,hold')) {
        $comments = array();
        $comments_id = array();
        foreach ($files as $file) {
            $parts = explode('_', File::B($file));
            $comments_id[] = $parts[1];
        }
        rsort($comments_id);
        foreach (Mecha::eat($comments_id)->chunk($offset, $config->manager->per_page)->vomit() as $comment) {
            $comments[] = Get::comment($comment);
        }
        unset($comments_id, $files);
    } else {
        $comments = false;
    }
    Config::set(array('page_title' => $speak->comments . $config->title_separator . $config->manager->title, 'offset' => $offset, 'responses' => $comments, 'pagination' => Navigator::extract(Get::comments(null, 'DESC', 'txt,hold'), $offset, $config->manager->per_page, $config->manager->slug . '/comment'), 'cargo' => DECK . DS . 'workers' . DS . 'cargo.comment.php'));
    Shield::lot('segment', 'comment')->attach('manager', false);
});
/**
 * Comment Repair
 * --------------
 */
Route::accept($config->manager->slug . '/comment/repair/id:(:num)', function ($id = "") use($config, $speak) {
    if (Guardian::get('status') !== 'pilot' || !($comment = Get::comment($id))) {
        Shield::abort();
    }
    if (!isset($comment->content_type)) {
        $comment->content_type = $config->html_parser;
    }
    File::write($config->total_comments_backend)->saveTo(SYSTEM . DS . 'log' . DS . 'comments.total.log', 0600);
    Config::set(array('page_title' => $speak->editing . ': ' . $speak->comment . $config->title_separator . $config->manager->title, 'response' => Mecha::A($comment), 'cargo' => DECK . DS . 'workers' . DS . 'repair.comment.php'));
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:route.comment.php

示例2: function

 * --------------
 */
Route::accept($config->manager->slug . '/article/kill/id:(:num)', function ($id = "") use($config, $speak) {
    if (!($article = Get::article($id, array('comments')))) {
        Shield::abort();
    }
    if (Guardian::get('status') !== 'pilot' && Guardian::get('author') !== $article->author) {
        Shield::abort();
    }
    Config::set(array('page_title' => $speak->deleting . ': ' . $article->title . $config->title_separator . $config->manager->title, 'article' => $article, 'cargo' => DECK . DS . 'workers' . DS . 'kill.article.php'));
    $G = array('data' => Mecha::A($article));
    if ($request = Request::post()) {
        Guardian::checkToken($request['token']);
        File::open($article->path)->delete();
        // Deleting comment(s) ...
        if ($comments = Get::comments($id, 'DESC', 'txt,hold')) {
            foreach ($comments as $comment) {
                File::open($comment)->delete();
            }
        }
        $task_connect = $article;
        $P = array('data' => $request);
        include DECK . DS . 'workers' . DS . 'task.field.3.php';
        include DECK . DS . 'workers' . DS . 'task.custom.3.php';
        Notify::success(Config::speak('notify_success_deleted', $article->title));
        Weapon::fire('on_article_update', array($G, $G));
        Weapon::fire('on_article_destruct', array($G, $G));
        Guardian::kick($config->manager->slug . '/article');
    } else {
        Notify::warning(Config::speak('notify_confirm_delete_', '<strong>' . $article->title . '</strong>'));
        Notify::warning(Config::speak('notify_confirm_delete_page', strtolower($speak->article)));
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:route.article.php

示例3: function

 */
Get::plug('page', function ($reference, $excludes = array()) {
    return Get::post($reference, $excludes, PAGE, '/', 'page:');
});
Get::plug('article', function ($reference, $excludes = array()) {
    $config = Config::get();
    $speak = Config::speak();
    $FP = 'article:';
    if (!($results = Get::post($reference, $excludes, ARTICLE, '/' . $config->index->slug . '/', $FP))) {
        return $results;
    }
    // Include comment(s) data
    $c = array();
    $cc = 0;
    $ccc = '0 ' . $speak->comments;
    if ($comments = Get::comments('ASC', 'post:' . $results->id, Guardian::happy() ? 'txt,hold' : 'txt')) {
        $cc = $comments !== false ? count($comments) : 0;
        $ccc = $cc . ' ' . ($cc === 1 ? $speak->comment : $speak->comments);
        foreach ($comments as $comment) {
            $c[] = Get::comment($comment);
        }
        $results->comments = Filter::colon($FP . 'comments', $c, $results);
    }
    $results->total_comments = Filter::colon($FP . 'total_comments', $cc, $results);
    $results->total_comments_text = Filter::colon($FP . 'total_comments_text', $ccc, $results);
    unset($comments, $c, $cc, $ccc);
    return $results;
});
/**
 * ==========================================================================
 *  GET COMMENT PATH
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:31,代码来源:get.php

示例4: recentComment

 /**
  * Widget Recent Comment
  * ---------------------
  *
  * [1]. Widget::recentComment();
  * [2]. Widget::recentComment(5);
  *
  */
 public static function recentComment($total = 7, $avatar_size = 50, $summary = 100, $d = 'monsterid')
 {
     $T1 = TAB;
     $T2 = str_repeat(TAB, 2);
     $T3 = str_repeat(TAB, 3);
     $T4 = str_repeat(TAB, 4);
     $T5 = str_repeat(TAB, 5);
     $config = Config::get();
     $speak = Config::speak();
     $comments = Get::comments();
     $html = O_BEGIN . '<div class="widget widget-recent widget-recent-comment"' . ($comments ? ' id="widget-recent-comment-' . self::$id['recent_comment'] . '"' : "") . '>' . NL;
     self::$id['recent_comment']++;
     if ($comments) {
         $comments_id = array();
         foreach ($comments as $comment) {
             $parts = explode('_', File::B($comment));
             $comments_id[] = $parts[1];
         }
         rsort($comments_id);
         $html .= $T1 . '<ul class="recent-comment-list">' . NL;
         for ($i = 0, $count = count($comments_id); $i < $total; ++$i) {
             if ($i === $count) {
                 break;
             }
             $comment = Get::comment($comments_id[$i]);
             $article = Get::articleAnchor($comment->post);
             $html .= $T2 . '<li class="recent-comment">' . NL;
             if ($avatar_size !== false && $avatar_size > 0) {
                 $html .= $T3 . '<div class="recent-comment-avatar">' . NL;
                 $html .= $T4 . '<img alt="" src="' . $config->protocol . 'www.gravatar.com/avatar/' . md5($comment->email) . '?s=' . $avatar_size . '&amp;d=' . urlencode($d) . '" width="' . $avatar_size . '" height="' . $avatar_size . '"' . ES . NL;
                 $html .= $T3 . '</div>' . NL;
             }
             $html .= $T3 . '<div class="recent-comment-header">' . NL;
             if (trim($comment->url) === "" || $comment->url === '#') {
                 $html .= $T4 . '<span class="recent-comment-name">' . $comment->name . '</span>' . NL;
             } else {
                 $html .= $T4 . '<a class="recent-comment-name" href="' . $comment->url . '" rel="nofollow">' . $comment->name . '</a>' . NL;
             }
             $html .= $T3 . '</div>' . NL;
             $html .= $T3 . '<div class="recent-comment-body"><p>' . Converter::curt($comment->message, $summary, '&hellip;') . '</p></div>' . NL;
             $html .= $T3 . '<div class="recent-comment-footer">' . NL;
             $html .= $T4 . '<span class="recent-comment-time">' . NL;
             $html .= $T5 . '<time datetime="' . $comment->date->W3C . '">' . $comment->date->FORMAT_3 . '</time> <a title="' . ($article ? strip_tags($article->title) : $speak->notify_error_not_found) . '" href="' . $comment->permalink . '" rel="nofollow">#</a>' . NL;
             $html .= $T4 . '</span>' . NL;
             $html .= $T3 . '</div>' . NL;
             $html .= $T2 . '</li>' . NL;
         }
         $html .= $T1 . '</ul>' . NL;
     } else {
         $html .= Config::speak('notify_empty', strtolower($speak->comments));
     }
     $html .= '</div>' . O_END;
     $html = Filter::apply('widget', $html);
     return Filter::apply('widget:recent.comment', Filter::apply('widget:recent', $html));
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:63,代码来源:widget.php


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