當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Parse::markdown方法代碼示例

本文整理匯總了PHP中Parse::markdown方法的典型用法代碼示例。如果您正苦於以下問題:PHP Parse::markdown方法的具體用法?PHP Parse::markdown怎麽用?PHP Parse::markdown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Parse的用法示例。


在下文中一共展示了Parse::markdown方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __call

 public function __call($method, $arguments)
 {
     $extensions = array(".html", ".md", ".markdown", ".textile");
     $html = null;
     foreach ($extensions as $extension) {
         $full_src = Path::assemble(BASE_PATH, Config::getCurrentThemePath(), 'partials', ltrim($method . $extension, '/'));
         if (File::exists($full_src)) {
             // Merge additional variables passed as parameters
             Statamic_View::$_dataStore = $arguments + Statamic_View::$_dataStore;
             if ($this->fetchParam('use_context', false, false, true, false)) {
                 $html = Parse::contextualTemplate(File::get($full_src), Statamic_View::$_dataStore, $this->context, 'Statamic_View::callback');
             } else {
                 $html = Parse::template(File::get($full_src), Statamic_View::$_dataStore, 'Statamic_View::callback');
             }
             // parse contents if needed
             if ($extension == ".md" || $extension == ".markdown") {
                 $html = Parse::markdown($html);
             } elseif ($extension == ".textile") {
                 $html = Parse::textile($html);
             }
         }
     }
     if (Config::get('enable_smartypants', TRUE)) {
         $html = Parse::smartypants($html);
     }
     return $html;
 }
開發者ID:andorpandor,項目名稱:git-deploy.eu2.frbit.com-yr-prototype,代碼行數:27,代碼來源:pi.partial.php

示例2: index

 public function index($value, $parameters = array())
 {
     $rows = $value;
     $parse_markdown = $this->fetchConfig('parse_markdown', false, null, true);
     $html = '<table>';
     foreach ($rows as $row) {
         $html .= '<tr>';
         foreach ($row['cells'] as $cell) {
             $html .= '<td>';
             $html .= $parse_markdown ? Parse::markdown($cell) : $cell;
             $html .= '</td>';
         }
         $html .= '</tr>';
     }
     $html .= '</table>';
     return $html;
 }
開發者ID:andorpandor,項目名稱:git-deploy.eu2.frbit.com-yr-prototype,代碼行數:17,代碼來源:mod.table.php

示例3: partial

 public function partial()
 {
     $start = time();
     $src = $this->fetchParam('src', null, null, false, false);
     $extensions = array(".html", ".md", ".markdown", ".textile");
     $html = null;
     // measurement
     $hash = Debug::markStart('partials', $src, $start);
     Debug::increment('partials', $src);
     if ($src) {
         foreach ($extensions as $extension) {
             $full_src = Path::assemble(BASE_PATH, $this->theme_root, 'partials', ltrim($src . $extension, '/'));
             if (File::exists($full_src)) {
                 Statamic_View::$_dataStore = $this->attributes + Statamic_View::$_dataStore;
                 if ($this->fetchParam('use_context', false, false, true, false)) {
                     // to use context, we only want to pass the attributes as
                     // the current data, as those will override into the context
                     // set of data; if we were to include all of ::$_dataStore,
                     // we run into the issue where all of the global-level variables
                     // are overriding variables in context, when the variables in
                     // context are more accurate scope-wise at this point in the parse
                     $html = Parse::contextualTemplate(file_get_contents($full_src), $this->attributes, $this->context, array('statamic_view', 'callback'), true);
                 } else {
                     $html = Parse::template(file_get_contents($full_src), Statamic_View::$_dataStore);
                 }
                 // parse contents if needed
                 if ($extension == ".md" || $extension == ".markdown") {
                     $html = Parse::markdown($html);
                 } elseif ($extension == ".textile") {
                     $html = Parse::textile($html);
                 }
             }
         }
         if (Config::get('enable_smartypants', TRUE)) {
             $html = Parse::smartypants($html);
         }
     }
     Debug::markEnd($hash);
     return $html;
 }
開發者ID:zane-insight,項目名稱:WhiteLaceInn,代碼行數:40,代碼來源:pi.theme.php

示例4: transform

 /**
  * Render content via a given $content_type
  *
  * @param string  $content  Content to render
  * @param mixed  $content_type  Content type to use (overrides configured content_type)
  * @return string
  */
 public static function transform($content, $content_type = NULL)
 {
     $content_type = Helper::pick($content_type, Config::getContentType());
     // render HTML from the given $content_type
     switch (strtolower($content_type)) {
         case "markdown":
         case "md":
             $content = Parse::markdown($content);
             break;
         case "text":
         case "txt":
             $content = nl2br(strip_tags($content));
             break;
         case "textile":
             $content = Parse::textile($content);
     }
     if (Config::get('enable_smartypants', TRUE) === TRUE) {
         $content = Parse::smartypants($content);
     } elseif (Config::get('enable_smartypants', TRUE) === 'typographer') {
         $content = Parse::smartypants($content, TRUE);
     }
     return trim($content);
 }
開發者ID:Bferreira5,項目名稱:Theme-Example,代碼行數:30,代碼來源:content.php

示例5: index

 public function index($value, $parameters = array())
 {
     return Parse::markdown($value);
 }
開發者ID:andorpandor,項目名稱:git-deploy.eu2.frbit.com-yr-prototype,代碼行數:4,代碼來源:mod.markdown.php

示例6: foreach

        foreach ($log as $row) {
            ?>
        <li class="level-<?php 
            echo strtolower($row[0]);
            ?>
">
          <strong class="level level-<?php 
            echo strtolower($row[0]);
            ?>
"><?php 
            echo ucwords(strtolower($row[0]));
            ?>
</strong>

          <?php 
            echo Parse::markdown($row[7]);
            ?>

          <h6>
            <?php 
            echo Date::format($time_format, $row[1]);
            ?>
 ·
            <?php 
            echo $row[2];
            ?>
: <?php 
            echo $row[3];
            ?>
 ·
            <a href="<?php 
開發者ID:andorpandor,項目名稱:git-deploy.eu2.frbit.com-yr-prototype,代碼行數:31,代碼來源:logs.php


注:本文中的Parse::markdown方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。