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


PHP ParsedownExtra::text方法代码示例

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


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

示例1: render

 /**
  * @param string $string
  * @param array  $args
  *
  * @return string
  */
 public function render($string, array $args = [])
 {
     @preg_match_all('#{~sm:(.*)}#i', $string, $matches);
     if (0 < count($matches[0])) {
         for ($i = 0; $i < count($matches[0]); ++$i) {
             $replace = '<small class="text-muted">' . $this->parsedown->text($matches[1][$i]) . '</small>';
             $string = str_ireplace($matches[0][$i], $replace, $string);
         }
     }
     @preg_match_all('#{~scml:([^}]*)}#i', $string, $matches);
     if (0 < count($matches[0])) {
         for ($i = 0; $i < count($matches[0]); ++$i) {
             $replace = '<span class="scml">' . $matches[1][$i] . '</span>';
             $string = str_ireplace($matches[0][$i], $replace, $string);
         }
     }
     @preg_match_all('#{~scml-tag:([^}]*)}#i', $string, $matches);
     if (0 < count($matches[0])) {
         for ($i = 0; $i < count($matches[0]); ++$i) {
             $replace = '<span class="scml-tag">&lt;<span class="scml">' . $matches[1][$i] . '</span>&gt;</span>';
             $string = str_ireplace($matches[0][$i], $replace, $string);
         }
     }
     @preg_match_all('#{~app-menu:([^}]*)}#i', $string, $matches);
     if (0 < count($matches[0])) {
         for ($i = 0; $i < count($matches[0]); ++$i) {
             $replace = '<span class="app-menu">' . $matches[1][$i] . '</span>';
             $string = str_ireplace($matches[0][$i], $replace, $string);
         }
     }
     return $string;
 }
开发者ID:scr-be,项目名称:teavee-scribble-down-bundle,代码行数:38,代码来源:SwimCharacterStyleHandler.php

示例2: render

 public function render($path, $params)
 {
     $view = $this->_view;
     $options = $this->_options;
     $Extra = new \ParsedownExtra();
     echo $Extra->text(file_get_contents($path));
 }
开发者ID:CloudOJ,项目名称:ums,代码行数:7,代码来源:MarkdownAdapter.php

示例3: changelog

 public function changelog()
 {
     $output = '';
     $url = 'https://api.github.com/repos/arastta/arastta/releases';
     $json = $this->utility->getRemoteData($url);
     if (empty($json)) {
         return $output;
     }
     $parsedown = new ParsedownExtra();
     $releases = json_decode($json);
     foreach ($releases as $release) {
         if ($release->tag_name <= VERSION) {
             continue;
         }
         if (empty($release->body)) {
             continue;
         }
         $output .= '<h2><span class="label label-primary">' . $release->tag_name . '</span></h2>';
         // Parse markdown output
         $markdown = str_replace('## Changelog', '', $release->body);
         $output .= $parsedown->text($markdown);
         $output .= '<hr>';
     }
     return $output;
 }
开发者ID:LinuxJedi,项目名称:arastta,代码行数:25,代码来源:update.php

示例4: parse_string

 public function parse_string($template, $data = array(), $return = FALSE, $config = array())
 {
     if (!is_array($config)) {
         $config = array();
     }
     $config = array_merge($this->config, $config);
     $ci = $this->ci;
     $is_mx = false;
     if (!$return) {
         list($ci, $is_mx) = $this->detect_mx();
     }
     switch ($config['markdown_implementation']) {
         case 'parsedown':
             $parser = new ParsedownExtra();
             $template = @$parser->text($template);
             break;
         default:
             if (!empty($config['detect_code_blocks'])) {
                 $template = preg_replace('/`{3,}[a-z]*/i', '~~~', $template);
             }
             $parser = new MarkdownExtra_Parser();
             $template = @$parser->transform($template);
             if (!empty($config['apply_autolink'])) {
                 $this->ci->load->helper('url');
                 $template = auto_link($template);
             }
             break;
     }
     return $this->output($template, $return, $ci, $is_mx);
 }
开发者ID:Qnatz,项目名称:starter-public-edition-4,代码行数:30,代码来源:Parser_markdown.php

示例5: convert

 /**
  * Convert the input data.
  *
  * @param string $input The raw content without Front-matter
  *
  * @return string
  */
 public function convert($input)
 {
     if (is_string($input) === false) {
         throw new \InvalidArgumentException('Expected a string value at Parsedown converter.');
     }
     $converter = new \ParsedownExtra();
     return $converter->text($input);
 }
开发者ID:spress,项目名称:spress,代码行数:15,代码来源:ParsedownConverter.php

示例6: parseMarkdown

 public static function parseMarkdown($value)
 {
     include_once __DIR__ . '/vendor/Parsedown.php';
     include_once __DIR__ . '/vendor/ParsedownExtra.php';
     $parser = new \ParsedownExtra();
     $parser->setUrlsLinked(false);
     return $parser->text($value);
 }
开发者ID:bobbiebenton,项目名称:herbie,代码行数:8,代码来源:markdown.php

示例7: previewpost

 public function previewpost()
 {
     $this->load->library('Parsedown');
     $this->load->library('ParsedownExtra');
     $tulisan = $this->input->post('inilah');
     /*$tulisan = htmlspecialchars($_POST['inilah']);*/
     $Tulis = new ParsedownExtra();
     echo $Tulis->text($tulisan);
 }
开发者ID:dpyudha,项目名称:pinguin,代码行数:9,代码来源:admin.php

示例8: get

 public function get()
 {
     $content = [];
     $count = 1;
     // initial object creation
     foreach (glob(ELSA . '/content/' . $this->folder . '/*.' . $this->extension) as $contentItem) {
         // parse content
         $frontmatter = new FrontMatter($contentItem);
         $parsedown = new ParsedownExtra();
         $meta = [];
         $type = preg_match('/content\\/(.*)\\//', $contentItem, $match);
         $type = $match[1];
         foreach ($frontmatter->fetchMeta() as $key => $value) {
             $meta[$key] = $value;
         }
         // compose
         $content[$count]['id'] = (int) @explode('_', array_pop(explode('/', $contentItem)))[0];
         $content[$count]['slug'] = @explode('.', explode('_', array_pop(explode('/', $contentItem)))[1])[0];
         $content[$count]['content'] = $parsedown->text($frontmatter->fetchContent());
         $content[$count]['content_raw'] = $frontmatter->fetchContent();
         $content[$count]['type'] = $type;
         $content[$count]['meta'] = $meta;
         $count++;
     }
     // order
     usort($content, function ($a, $b) {
         // id desc
         if ($this->orderby === 'id' && $this->order === 'desc') {
             return $b['id'] - $a['id'];
         }
         // id asc
         if ($this->orderby === 'id' && $this->order === 'asc') {
             return $a['id'] - $b['id'];
         }
         // timestamp desc
         if ($this->orderby === 'timestamp' && $this->order === 'desc') {
             return $b['meta']['timestamp'] - $a['meta']['timestamp'];
         }
         // timestamp asc
         if ($this->orderby === 'timestamp' && $this->order === 'asc') {
             return $a['meta']['timestamp'] - $b['meta']['timestamp'];
         }
     });
     // convert to objects
     $content = json_decode(json_encode($content));
     // with slug ...
     if ($this->slug) {
         // find the content we want
         foreach ($content as $contentItem) {
             if ($contentItem->slug === $this->slug) {
                 return $contentItem;
                 break;
             }
         }
     }
     return $content;
 }
开发者ID:askoxyz,项目名称:elsa,代码行数:57,代码来源:Content.php

示例9: getPageContent

 /**
  * Get the content of a file
  * @param  string $path file path
  * @return string markdown formated string
  */
 public function getPageContent($path)
 {
     $extra = new \ParsedownExtra();
     $content = null;
     if (Storage::exists($path) === true) {
         $content = $extra->text(Storage::get($path));
     }
     return $content;
 }
开发者ID:mrjuliuss,项目名称:lecter,代码行数:14,代码来源:Lecter.php

示例10: execute

 protected function execute(array $arguments)
 {
     if (isset($arguments[0]) && ($wf_id = (int) $GLOBALS['workflow_id'])) {
         $extra = new \ParsedownExtra();
         WorkflowRepository::component_result($wf_id, 'markdown-view', $extra->text($arguments[0]));
         return '';
     }
     throw new InvalidArgumentException('strings invalid');
 }
开发者ID:sysatom,项目名称:workflow,代码行数:9,代码来源:MarkdowmView.php

示例11: printPostRSS

function printPostRSS($post)
{
    $parseDown = new ParsedownExtra();
    echo "    <item>\n";
    echo "      <title>" . $post['title'] . "</title>\n";
    echo "      <link>http://fisherevans.com/blog/post/" . $post['title_slug'] . "</link>\n";
    echo "      <guid>http://fisherevans.com/blog/post/" . $post['title_slug'] . "</guid>\n";
    echo "      <pubDate>" . date("D, d M Y H:i:s O", strtotime($post['posted_date'])) . "</pubDate>\n";
    echo "      <content:encoded><![CDATA[" . fixRelativeLinks($parseDown->text($post['content'])) . "]]></content:encoded>\n";
    echo "    </item>\n";
}
开发者ID:amdad,项目名称:FisherEvans.com,代码行数:11,代码来源:rss.php

示例12: markdown

/**
 * Markdown
 *
 * Parse Markdown to HTML
 *
 * @since 2.0.0
 *
 * @param $content (string) Markdown string or file to parse
 */
function markdown($content)
{
    // Check for file
    if (is_readable($content)) {
        $content = file_get_contents($content);
    }
    // Parse Markdown
    $markdown = new ParsedownExtra();
    $result = $markdown->text($content);
    return $result;
}
开发者ID:resknow,项目名称:boilerplate,代码行数:20,代码来源:markdown.php

示例13: index

 /**
  * Index Page for this controller.
  *
  * Maps to the following URL
  *         http://example.com/index.php/welcome
  *    - or -
  *         http://example.com/index.php/welcome/index
  *    - or -
  * Since this controller is set as the default controller in
  * config/routes.php, it's displayed at http://example.com/
  *
  * So any other public methods not prefixed with an underscore will
  * map to /index.php/welcome/<method_name>
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
 public function index()
 {
     $this->load->helper('url');
     $data = array();
     $data['readme'] = null;
     $readme = @file_get_contents(FCPATH . 'README.md');
     if ($readme != '') {
         $parser = new ParsedownExtra();
         $data['readme'] = @$parser->text($readme);
     }
     $this->load->view('welcome_message', $data);
 }
开发者ID:aliraza5pk,项目名称:codeigniter-restserver-test,代码行数:27,代码来源:Welcome.php

示例14: text

 public function text($text)
 {
     // Fix markdown blockquote syntax - > gets encoded.
     if (substr($text, 0, 4) == '&gt;') {
         $text = '>' . substr($text, 5);
     }
     $text = preg_replace('/[\\n\\r]&gt;\\s/', "\n> ", $text);
     // Fix autolink syntax
     $text = preg_replace('#&lt;(http[a-zA-Z0-9-\\.\\/:]*)&gt;#', "<\$1>", $text);
     $text = parent::text($text);
     $text = $this->smartypants($text);
     // Parsedown has naive encoding of URLs - fix it.
     $text = str_replace('&amp;amp;', '&amp;', $text);
     return $text;
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:15,代码来源:PerchParsedown.class.php

示例15: ParsedownExtra

 function text_to_html($text)
 {
     /*
             static $parser;
     
             if (!isset($parser)) {
                 $parser = new MarkdownExtra_Parser();
             }
     
             return @ $parser->transform($text);
     */
     static $parser;
     if (!isset($parser)) {
         $parser = new ParsedownExtra();
     }
     return @$parser->text($text);
 }
开发者ID:Qnatz,项目名称:starter-public-edition-4,代码行数:17,代码来源:MY_html_helper.php


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