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


PHP Converter::curt方法代码示例

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


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

示例1: page

 /**
  * ==========================================================================
  *  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);
         }
//.........这里部分代码省略.........
开发者ID:razordaze,项目名称:mecha-cms,代码行数:101,代码来源:get.php

示例2: post

 /**
  * ==========================================================================
  *  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
//.........这里部分代码省略.........
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:101,代码来源:get.php

示例3: array

                ?>
');" 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')) {
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:31,代码来源:cargo.shield.php

示例4: recentResponse

 /**
  * 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);
 }
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:77,代码来源:widget.php

示例5: filemtime

                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>
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:cargo.shield.php

示例6: filemtime

            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 {
            ?>
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:cargo.plugin.php

示例7: 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

示例8: array

        ?>
"><?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 {
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:31,代码来源:cargo.response.php


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