예제 #1
0
 /**
  * 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));
 }
예제 #2
0
             $articles[] = $file;
             $anchor = Get::articleAnchor($file);
             $kw = str_replace('-', ' ', $keywords);
             if (strpos(strtolower($anchor->title), $kw) !== false || strpos(File::N($anchor->path), $kw) !== false) {
                 $articles[] = $file;
             }
         }
         unset($files);
     }
     // Matched with a keyword
     $keywords = explode('-', $keywords);
     foreach ($keywords as $keyword) {
         if ($files = Get::articles('DESC', 'keyword:' . $keyword)) {
             foreach ($files as $file) {
                 $articles[] = $file;
                 $anchor = Get::articleAnchor($file);
                 if (strpos(strtolower($anchor->title), $keyword) !== false || strpos(File::N($anchor->path), $keyword) !== false) {
                     $articles[] = $file;
                 }
             }
             unset($files);
         }
     }
     $articles = array_unique($articles);
     // Remove search result(s) duplicate
     Session::set('search.query', $query);
     Session::set('search.results', $articles);
 }
 $title = sprintf($config->search->title, $query);
 if (!empty($articles) && ($results = Mecha::eat($articles)->chunk($offset, $config->search->per_page)->vomit())) {
     $_articles = Mecha::walk($results, function ($path) use($excludes) {
예제 #3
0
<?php

$aa = Get::articleAnchor($response->post);
echo $messages;
?>
<p><strong><?php 
echo $response->name;
?>
</strong><?php 
echo $aa ? ' ' . strtolower($speak->to) . ' <a href="' . $response->permalink . '" target="_blank">' . $aa->title . '</a>' : "";
?>
</p>
<p><?php 
echo $response->message;
?>
</p>
  <p><strong><?php 
echo $speak->date;
?>
:</strong> <?php 
echo Date::format($response->time, 'Y/m/d H:i:s');
?>
</p>
<form class="form-kill form-comment" id="form-kill" action="<?php 
echo $config->url_current . $config->url_query;
?>
" method="post">
<?php 
echo Jot::button('action', $speak->yes);
?>
 <?php