コード例 #1
0
ファイル: get.php プロジェクト: razordaze/mecha-cms
 /**
  * ==========================================================================
  *  EXTRACT PAGE FILE INTO LIST OF PAGE DATA FROM ITS PATH/SLUG/ID
  * ==========================================================================
  *
  * -- CODE: -----------------------------------------------------------------
  *
  *    var_dump(Get::page('about'));
  *
  * --------------------------------------------------------------------------
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *  Parameter  | Type   | Description
  *  ---------- | ------ | ---------------------------------------------------
  *  $reference | mixed  | Slug, ID, path or array of `Get::pageExtract()`
  *  $excludes  | array  | Exclude some field(s) from result(s)
  *  $folder    | string | Folder of the page(s)
  *  $connector | string | Path connector for page URL
  *  $FP        | string | Filter prefix for `Text::toPage()`
  *  ---------- | ------ | ---------------------------------------------------
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
 public static function page($reference, $excludes = array(), $folder = PAGE, $connector = '/', $FP = 'page:')
 {
     $config = Config::get();
     $speak = Config::speak();
     $excludes = array_flip($excludes);
     $results = false;
     // From `Get::pageExtract()`
     if (is_array($reference)) {
         $results = $reference;
     } else {
         // By path => `cabinet\pages\0000-00-00-00-00-00_1,2,3_page-slug.txt`
         if (strpos($reference, $folder) === 0) {
             $results = self::pageExtract($reference, $FP);
         } else {
             // By slug => `page-slug` or by ID => 12345
             $results = self::pageExtract(self::pagePath($reference, $folder), $FP);
         }
     }
     if (!$results || !file_exists($results['path'])) {
         return false;
     }
     /**
      * RULES: Do not do any tags looping, content Markdown-ing
      * and external file requesting if it has been marked as
      * the excluded field(s). For better performance.
      */
     $results = $results + Text::toPage(File::open($results['path'])->read(), isset($excludes['content']) ? false : 'content', $FP);
     $content = isset($results['content_raw']) ? $results['content_raw'] : "";
     $time = str_replace(array(' ', ':'), '-', $results['time']);
     $extension = File::E($results['path']);
     if ($php_file = File::exist(File::D($results['path']) . DS . $results['slug'] . '.php')) {
         ob_start();
         include $php_file;
         $results['content'] = ob_get_clean();
     }
     $results['date'] = self::AMF(Date::extract($results['time']), $FP, 'date');
     $results['url'] = self::AMF($config->url . $connector . $results['slug'], $FP, 'url');
     $results['link'] = "";
     $results['excerpt'] = "";
     if (!isset($results['author'])) {
         $results['author'] = self::AMF($config->author, $FP, 'author');
     }
     if (!isset($results['description'])) {
         $summary = Converter::curt($content, $config->excerpt_length, $config->excerpt_tail);
         $results['description'] = self::AMF($summary, $FP, 'description');
     }
     $content_test = isset($excludes['content']) && strpos($content, '<!--') !== false ? Text::toPage(Text::ES($content), 'content', $FP) : $results;
     $content_test = $content_test['content'];
     $content_test = is_array($content_test) ? implode("", $content_test) : $content_test;
     // Redirect 301 with `<!-- kick: "http://example.com" -->`
     if (strpos($content_test, '<!-- kick:') !== false && $config->page_type === rtrim($FP, ':')) {
         preg_match('#<!-- kick\\: *([\'"]?)(.*?)\\1 -->#', $content_test, $matches);
         Guardian::kick($matches[2]);
     }
     // External link with `<!-- link: "http://example.com" -->`
     if (strpos($content_test, '<!-- link:') !== false) {
         preg_match('#<!-- link\\: *([\'"]?)(.*?)\\1 -->#', $content_test, $matches);
         $results['link'] = $matches[2];
         $results['content'] = preg_replace('#<!-- link\\:.*? -->#', "", $results['content']);
     }
     // Manual post excerpt with `<!-- cut+ "Read More" -->`
     if (strpos($content_test, '<!-- cut+ ') !== false) {
         preg_match('#<!-- cut\\+( +([\'"]?)(.*?)\\2)? -->#', $content_test, $matches);
         $more = !empty($matches[3]) ? $matches[3] : $speak->read_more;
         $content_test = preg_replace('#<!-- cut\\+( +(.*?))? -->#', '<p><a class="fi-link" href="' . $results['url'] . '#read-more:' . $results['id'] . '">' . $more . '</a></p><!-- cut -->', $content_test);
     }
     // ... or `<!-- cut -->`
     if (strpos($content_test, '<!-- cut -->') !== false) {
         $parts = explode('<!-- cut -->', $content_test, 2);
         $results['excerpt'] = self::AMF(trim($parts[0]), $FP, 'excerpt');
         $results['content'] = preg_replace('#<p><a class="fi-link" href=".*?">.*?<\\/a><\\/p>#', "", trim($parts[0])) . NL . NL . '<span class="fi" id="read-more:' . $results['id'] . '" aria-hidden="true"></span>' . NL . NL . trim($parts[1]);
     }
     if (!isset($excludes['tags'])) {
         $tags = array();
         foreach ($results['kind'] as $id) {
             $tags[] = self::rawTag($id);
         }
         $results['tags'] = self::AMF(Mecha::eat($tags)->order('ASC', 'name')->vomit(), $FP, 'tags');
     }
     if (!isset($excludes['css']) || !isset($excludes['js'])) {
         if ($file = File::exist(CUSTOM . DS . $time . '.' . $extension)) {
             $custom = explode(SEPARATOR, File::open($file)->read());
             $css = isset($custom[0]) ? Text::DS(trim($custom[0])) : "";
             $js = isset($custom[1]) ? Text::DS(trim($custom[1])) : "";
             /**
              * CSS
              * ---
              *
              * css_raw
              * page:css_raw
              * custom:css_raw
              *
              * shortcode
              * page:shortcode
              * custom:shortcode
              *
              * css
              * page:css
              * custom:css
              *
              */
             $css = self::AMF($css, $FP, 'css_raw');
             $results['css_raw'] = Filter::apply('custom:css_raw', $css);
             $css = self::AMF($css, $FP, 'shortcode');
             $css = Filter::apply('custom:shortcode', $css);
             $css = self::AMF($css, $FP, 'css');
             $results['css'] = Filter::apply('custom:css', $css);
             /**
              * JS
              * --
              *
              * js_raw
              * page:js_raw
              * custom:js_raw
              *
              * shortcode
              * page:shortcode
              * custom:shortcode
              *
              * js
              * page:js
              * custom:js
              *
              */
             $js = self::AMF($js, $FP, 'js_raw');
             $results['js_raw'] = Filter::apply('custom:js_raw', $js);
             $js = self::AMF($js, $FP, 'shortcode');
             $js = Filter::apply('custom:shortcode', $js);
             $js = self::AMF($js, $FP, 'js');
             $results['js'] = Filter::apply('custom:js', $js);
         } else {
             $results['css'] = $results['js'] = $results['css_raw'] = $results['js_raw'] = "";
         }
         $custom = $results['css'] . $results['js'];
     } else {
         $custom = "";
     }
     $results['images'] = self::AMF(self::imagesURL($results['content'] . $custom), $FP, 'images');
     $results['image'] = self::AMF(isset($results['images'][0]) ? $results['images'][0] : Image::placeholder(), $FP, 'image');
     $comments = self::comments($results['id'], 'ASC', Guardian::happy() ? 'txt,hold' : 'txt');
     $results['total_comments'] = self::AMF($comments !== false ? count($comments) : 0, $FP, 'total_comments');
     $results['total_comments_text'] = self::AMF($results['total_comments'] . ' ' . ($results['total_comments'] === 1 ? $speak->comment : $speak->comments), $FP, 'total_comments_text');
     if (!isset($excludes['comments'])) {
         if ($comments) {
             $results['comments'] = array();
             foreach ($comments as $comment) {
                 $results['comments'][] = self::comment($comment);
             }
             $results['comments'] = self::AMF($results['comments'], $FP, 'comments');
         }
     }
     unset($comments);
     /**
      * Custom Field(s)
      * ---------------
      */
     if (!isset($excludes['fields'])) {
         /**
          * Initialize custom field(s) with the default value(s) so that
          * user(s) don't have to write `isset()` function multiple time(s)
          * just to prevent error message(s) because of the object key(s)
          * that is not available in the old post(s).
          */
         $fields = self::state_field(rtrim($FP, ':'), null, array(), false);
         $init = array();
         foreach ($fields as $key => $value) {
             $init[$key] = $value['value'];
         }
         /**
          * Start re-writing ...
          */
         if (isset($results['fields']) && is_array($results['fields'])) {
             foreach ($results['fields'] as $key => $value) {
                 if (is_array($value) && isset($value['type'])) {
                     // <= 1.1.3
                     $value = isset($value['value']) ? $value['value'] : false;
                 }
                 $init[$key] = self::AMF($value, $FP, 'fields.' . $key);
             }
         }
         $results['fields'] = $init;
         unset($fields, $init);
     }
     /**
      * Exclude some field(s) from result(s)
      */
     foreach ($results as $key => $value) {
         if (isset($excludes[$key])) {
             unset($results[$key]);
         }
     }
     return Mecha::O($results);
 }
コード例 #2
0
ファイル: get.php プロジェクト: yiannisSt/mecha-cms
 /**
  * ==========================================================================
  *  EXTRACT POST FILE INTO LIST OF POST DATA FROM ITS PATH/SLUG/ID
  * ==========================================================================
  *
  * -- CODE: -----------------------------------------------------------------
  *
  *    var_dump(Get::post('about'));
  *
  * --------------------------------------------------------------------------
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *  Parameter  | Type   | Description
  *  ---------- | ------ | ---------------------------------------------------
  *  $reference | mixed  | Slug, ID, path or array of `Get::postExtract()`
  *  $excludes  | array  | Exclude some field(s) from result(s)
  *  $folder    | string | Folder of the post(s)
  *  $connector | string | Path connector for post URL
  *  $FP        | string | Filter prefix for `Text::toPage()`
  *  ---------- | ------ | ---------------------------------------------------
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
 public static function post($reference, $excludes = array(), $folder = POST, $connector = '/', $FP = 'post:')
 {
     $config = Config::get();
     $speak = Config::speak();
     $excludes = array_flip($excludes);
     $results = false;
     if (!is_array($reference)) {
         // By slug => `post-slug` or by ID => `1403355917`
         if (strpos($reference, $folder) !== 0) {
             $reference = self::postPath($reference, $folder);
         }
         // By path => `lot\posts\$folder\2014-06-21-20-05-17_1,2,3_page-slug.txt`
         $results = self::postExtract($reference, $FP);
     } else {
         // From `Get::postExtract()`
         $results = $reference;
     }
     if (!$results || !file_exists($results['path'])) {
         return false;
     }
     // RULES: Do not do any tags looping, content parsing
     // and external file requesting if it has been marked as
     // the excluded field(s). For better performance.
     $results = $results + Text::toPage(file_get_contents($results['path']), isset($excludes['content']) ? false : 'content', $FP, array('link' => "", 'author' => $config->author->name, 'description' => "", 'content_type' => $config->html_parser->active, 'fields' => array(), 'content' => "", 'css' => "", 'js' => ""), $results);
     $content = $results['content_raw'];
     $time = str_replace(array(' ', ':'), '-', $results['time']);
     $e = File::E($results['path']);
     // Custom post content with PHP file, named as the post slug
     if ($php = File::exist(File::D($results['path']) . DS . $results['slug'] . '.php')) {
         ob_start();
         include $php;
         $results['content'] = ob_get_clean();
     }
     $results['date'] = Filter::colon($FP . 'date', Date::extract($results['time']), $results);
     $results['url'] = Filter::colon($FP . 'url', $config->url . $connector . $results['slug'], $results);
     $results['excerpt'] = $more = "";
     if ($content !== "") {
         $exc = isset($excludes['content']) && strpos($content, '<!--') !== false ? Text::toPage(Converter::ES($content), 'content', $FP, array(), $results) : $results;
         $exc = $exc['content'];
         $exc = is_array($exc) ? implode("", $exc) : $exc;
         // Generate fake description data
         if ($results['description'] === "") {
             $results['description'] = Converter::curt($exc, $config->excerpt->length, $config->excerpt->suffix);
         }
         // Manual post excerpt with `<!-- cut+ "Read More" -->`
         if (strpos($exc, '<!-- cut+ ') !== false) {
             preg_match('#<!-- cut\\+( +([\'"]?)(.*?)\\2)? -->#', $exc, $matches);
             $more = !empty($matches[3]) ? $matches[3] : $speak->read_more;
             $more = '<p><a class="fi-link" href="' . $results['url'] . '#' . sprintf($config->excerpt->id, $results['id']) . '">' . $more . '</a></p>';
             $exc = preg_replace('#<!-- cut\\+( +(.*?))? -->#', '<!-- cut -->', $exc);
         }
         // ... or `<!-- cut -->`
         if (strpos($exc, '<!-- cut -->') !== false) {
             $parts = explode('<!-- cut -->', $exc, 2);
             $results['excerpt'] = Filter::colon($FP . 'excerpt', trim($parts[0]) . $more, $results);
             $results['content'] = trim($parts[0]) . NL . NL . '<span class="fi" id="' . sprintf($config->excerpt->id, $results['id']) . '" aria-hidden="true"></span>' . NL . NL . trim($parts[1]);
         }
     }
     // Post Tags
     if (!isset($excludes['tags'])) {
         $tags = array();
         foreach ($results['kind'] as $id) {
             $tags[] = call_user_func('self::' . rtrim($FP, ':') . 'Tag', 'id:' . $id);
         }
         $results['tags'] = Filter::colon($FP . 'tags', Mecha::eat($tags)->order('ASC', 'name')->vomit(), $results);
     }
     // Post Images
     $results['images'] = Filter::colon($FP . 'images', self::imagesURL($results['content']), $results);
     $results['image'] = Filter::colon($FP . 'image', isset($results['images'][0]) ? $results['images'][0] : Image::placeholder(), $results);
     // Post CSS and JS
     if ($file = File::exist(CUSTOM . DS . Date::slug($results['time']) . '.' . File::E($results['path']))) {
         $custom = explode(SEPARATOR, File::open($file)->read());
         $css = isset($custom[0]) ? Converter::DS(trim($custom[0])) : "";
         $js = isset($custom[1]) ? Converter::DS(trim($custom[1])) : "";
         // css_raw
         // post:css_raw
         // custom:css_raw
         // shortcode
         // custom:shortcode
         // css:shortcode
         // css
         // post:css
         // custom:css
         $css = Filter::colon($FP . 'css_raw', $css, $results);
         $results['css_raw'] = Filter::apply('custom:css_raw', $css, $results);
         $css = Filter::colon('css:shortcode', $css, $results);
         $css = Filter::apply('custom:shortcode', $css, $results);
         $css = Filter::colon($FP . 'css', $css, $results);
         $results['css'] = Filter::apply('custom:css', $css, $results);
         // js_raw
         // post:js_raw
         // custom:js_raw
         // shortcode
         // custom:shortcode
         // js:shortcode
         // js
         // post:js
         // custom:js
         $js = Filter::colon($FP . 'js_raw', $js, $results);
         $results['js_raw'] = Filter::apply('custom:js_raw', $js, $results);
         $js = Filter::colon('js:shortcode', $js, $results);
         $js = Filter::apply('custom:shortcode', $js, $results);
         $js = Filter::colon($FP . 'js', $js, $results);
         $results['js'] = Filter::apply('custom:js', $js, $results);
     }
     // Post Field(s)
     if (!isset($excludes['fields'])) {
         self::__fields($results, $FP);
     }
     // Exclude some field(s) from result(s)
     foreach ($results as $key => $value) {
         if (isset($excludes[$key])) {
             unset($results[$key]);
         }
     }
     return Mecha::O($results);
 }
コード例 #3
0
ファイル: cargo.shield.php プロジェクト: AdeHaze/mecha-cms
                ?>
');" role="image"></div>
        <?php 
            }
            ?>
        <h4 class="media-title"><?php 
            echo Jot::icon('shield') . ' ' . $page->title;
            ?>
</h4>
        <div class="media-content">
          <?php 
            if (preg_match('#<blockquote(>| .*?>)\\s*([\\s\\S]*?)\\s*<\\/blockquote>#', $page->content, $matches)) {
                $curt = Text::parse($matches[2], '->text', WISE_CELL_I);
                // get first blockquote content as description
            } else {
                $curt = Converter::curt($page->content);
            }
            ?>
          <p><?php 
            echo $curt;
            ?>
</p>
          <p>
            <?php 
            Weapon::fire('action_before', array($page, $segment));
            ?>
            <?php 
            echo Jot::btn('construct.small:cog', $speak->manage, $config->manager->slug . '/shield/' . $folder);
            ?>
 <?php 
            if (File::exist($r . 'manager.php')) {
コード例 #4
0
ファイル: widget.php プロジェクト: AdeHaze/mecha-cms
 /**
  * Widget Recent Response
  * ----------------------
  *
  * [1]. Widget::recentResponse();
  * [2]. Widget::recentResponse(5);
  *
  */
 public static function recentResponse($total = 7, $avatar_size = 50, $summary = 100, $d = 'monsterid', $folder = array(COMMENT, ARTICLE))
 {
     $T1 = TAB;
     $T2 = str_repeat($T1, 2);
     $T3 = str_repeat($T1, 3);
     $T4 = str_repeat($T1, 4);
     $T5 = str_repeat($T1, 5);
     $r = $folder[0] !== RESPONSE ? File::B($folder[0]) : 'response';
     $p = $folder[1] !== POST ? File::B($folder[1]) : 'post';
     $id = Config::get('widget_recent_' . $r . '_id', 0) + 1;
     $config = Config::get();
     $speak = Config::speak();
     $html = O_BEGIN . '<div class="widget widget-recent widget-recent-response" id="widget-recent-response-' . $id . '">' . NL;
     if ($responses = call_user_func('Get::' . $r . 's')) {
         $responses_id = Mecha::walk($responses, function ($v) {
             $parts = explode('_', File::B($v));
             return $parts[1];
         });
         rsort($responses_id);
         $html .= $T1 . '<ul class="recent-responses">' . NL;
         for ($i = 0, $count = count($responses_id); $i < $total; ++$i) {
             if ($i === $count) {
                 break;
             }
             $response = call_user_func('Get::' . $r, $responses_id[$i]);
             $post = call_user_func('Get::' . $p . 'Anchor', $response->post);
             $html .= $T2 . '<li class="recent-response">' . NL;
             if ($avatar_size !== false && $avatar_size > 0) {
                 $html .= $T3 . '<div class="recent-response-avatar">' . NL;
                 $html .= $T4;
                 $attr = ' alt="" width="' . $avatar_size . '" height="' . $avatar_size . '"';
                 if ($avatar = File::exist(ASSET . DS . '__avatar' . DS . $avatar_size . 'x' . $avatar_size . DS . md5($response->email) . '.png')) {
                     $html .= Asset::image($avatar, $attr);
                 } else {
                     if ($avatar = File::exist(ASSET . DS . '__avatar' . DS . '60x60' . DS . md5($response->email) . '.png')) {
                         $html .= Asset::image($avatar, $attr);
                     } else {
                         if ($avatar = File::exist(ASSET . DS . '__avatar' . DS . md5($response->email) . '.png')) {
                             $html .= Asset::image($avatar, $attr);
                         } else {
                             $html .= Asset::image($config->protocol . 'www.gravatar.com/avatar/' . md5($response->email) . '?s=' . $avatar_size . '&amp;d=' . urlencode($d), $attr);
                         }
                     }
                 }
                 $html .= $T3 . '</div>' . NL;
             }
             $html .= $T3 . '<div class="recent-response-header">' . NL;
             if ($response->url === '#') {
                 $html .= $T4 . '<span class="recent-response-name">' . $response->name . '</span>' . NL;
             } else {
                 $html .= $T4 . '<a class="recent-response-name" href="' . $response->url . '" rel="nofollow">' . $response->name . '</a>' . NL;
             }
             $html .= $T3 . '</div>' . NL;
             $html .= $T3 . '<div class="recent-response-body">' . Converter::curt($response->message, $summary, $config->excerpt->suffix) . '</div>' . NL;
             $html .= $T3 . '<div class="recent-response-footer">' . NL;
             $html .= $T4 . '<span class="recent-response-time">' . NL;
             $html .= $T5 . '<time datetime="' . $response->date->W3C . '">' . $response->date->FORMAT_3 . '</time> <a title="' . ($post ? Text::parse($post->title, '->text') : $speak->notify_error_not_found) . '" href="' . $response->permalink . '" rel="nofollow">#</a>' . NL;
             $html .= $T4 . '</span>' . NL;
             $html .= $T3 . '</div>' . NL;
             $html .= $T2 . '</li>' . NL;
         }
         $html .= $T1 . '</ul>' . NL;
     } else {
         $html .= $T1 . Config::speak('notify_empty', strtolower($speak->{$r . 's'})) . NL;
     }
     $html .= '</div>' . O_END;
     Config::set('widget_recent_' . $r . '_id', $id);
     return Filter::apply(array('widget:recent.' . $r, 'widget:recent.response', 'widget:recent', 'widget'), $html, $id);
 }
コード例 #5
0
ファイル: cargo.shield.php プロジェクト: razordaze/mecha-cms
                echo File::url($c);
                ?>
?v=<?php 
                echo filemtime($c);
                ?>
');" role="image"></div>
      <?php 
            }
            ?>
      <h4 class="media-title"><?php 
            echo Jot::icon('shield') . ' ' . $info->title;
            ?>
</h4>
      <div class="media-content">
        <p><?php 
            echo Converter::curt($info->content);
            ?>
</p>
        <p>
          <?php 
            echo Jot::btn('construct.small:cog', $speak->manage, $config->manager->slug . '/shield/' . $folder);
            ?>
 <?php 
            if (File::exist(SHIELD . DS . $folder . DS . 'manager.php')) {
                echo Jot::btn('action.small:shield', $speak->attach, $config->manager->slug . '/shield/attach/id:' . $folder);
                ?>
 <?php 
            }
            echo Jot::btn('destruct.small:times-circle', $speak->delete, $config->manager->slug . '/shield/kill/id:' . $folder);
            ?>
        </p>
コード例 #6
0
ファイル: cargo.plugin.php プロジェクト: razordaze/mecha-cms
            echo File::url($c);
            ?>
?v=<?php 
            echo filemtime($c);
            ?>
');" role="image"></div>
      <?php 
        }
        ?>
      <h4 class="media-title"><?php 
        echo Jot::icon(File::exist(PLUGIN . DS . $plugin->slug . DS . 'pending.php') ? 'unlock-alt' : 'lock') . ' ' . $plugin->about->title;
        ?>
</h4>
      <div class="media-content">
        <p><?php 
        echo Converter::curt($plugin->about->content);
        ?>
</p>
        <p>
          <?php 
        if (File::exist(PLUGIN . DS . $plugin->slug . DS . 'launch.php')) {
            ?>
          <?php 
            echo Jot::btn('begin.small:cog', $speak->manage, $config->manager->slug . '/plugin/' . $plugin->slug);
            ?>
 <?php 
            echo Jot::btn('action.small:cog', $speak->uninstall, $config->manager->slug . '/plugin/freeze/id:' . $plugin->slug . '?o=' . $config->offset);
            ?>
          <?php 
        } else {
            ?>
コード例 #7
0
ファイル: widget.php プロジェクト: razordaze/mecha-cms
 /**
  * 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));
 }
コード例 #8
0
        ?>
"><?php 
        echo Date::format($page->time, 'Y/m/d H:i:s');
        ?>
</time>
        <a href="<?php 
        echo $page->permalink;
        ?>
" title="<?php 
        echo $x ? $speak->error : $speak->permalink;
        ?>
" rel="nofollow" target="_blank">#</a>
      </p>
    </header>
    <div class="page-body"><p><?php 
        echo Converter::curt($page->message, $config->excerpt->length);
        ?>
</p></div>
    <footer class="page-footer">
      <?php 
        Weapon::fire($segment[0] . '_footer', array($page, false));
        ?>
    </footer>
  </li>
  <?php 
    }
    ?>
</ol>
<?php 
    include __DIR__ . DS . 'unit' . DS . 'pager' . DS . 'step.php';
} else {