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


PHP Parsedown::text方法代码示例

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


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

示例1: getEula

 public function getEula()
 {
     $Parsedown = new Parsedown();
     if ($this->category->eula_text) {
         return $Parsedown->text(e($this->category->eula_text));
     } elseif (Setting::getSettings()->default_eula_text && $this->category->use_default_eula == '1') {
         return $Parsedown->text(e(Setting::getSettings()->default_eula_text));
     } else {
         return null;
     }
 }
开发者ID:lutherpros,项目名称:snipe-it,代码行数:11,代码来源:Consumable.php

示例2: ucfbands_rehearsal_schedule

/**
 * UCFBands Rehearsal - Get Schedule
 *
 * @author Jordan Pakrosnis
 */
function ucfbands_rehearsal_schedule($schedule_items)
{
    // Include Parsedown
    require_once CHILD_DIR . '/inc/parsedown/Parsedown.php';
    $Parsedown = new Parsedown();
    // Schedule Output String
    $schedule = '';
    // Schedule Wrapper
    $schedule .= '<div class="event-schedule"><h5>Schedule</h5>';
    // Start UL
    $schedule .= '<ul>';
    //-- SCHEDULE ITEM LOOP --//
    foreach ($schedule_items as $schedule_item) {
        // Get Item Meta
        $time = esc_attr($schedule_item['time']);
        $thing = esc_attr($schedule_item['thing']);
        $sub_items = $schedule_item['sub_item'];
        // Make "AM" and "PM" lowercase
        $time = explode(" ", $time);
        $time[1] = strtolower($time[1]);
        // Start List Item
        $schedule .= '<li>';
        // Parse thing into Markdown HTML
        $thing = $Parsedown->text($thing);
        // Time & Thing
        $schedule .= '<span>' . $time[0] . ' ' . $time[1] . '</span>' . $thing;
        // Check for sub-items
        if ($sub_items != '') {
            // Nested UL
            $schedule .= '<ul>';
            foreach ($sub_items as $sub_item) {
                // Parse item into Markdown HTML
                $sub_item = $Parsedown->text($sub_item);
                // Output Sub item
                $schedule .= '<li>' . $sub_item . '</li>';
            }
            // foreach sub-item
            $schedule .= '</ul>';
        }
        // if sub-items
        $schedule .= '</li>';
    }
    // foreach Item Loop
    $schedule .= '</ul>';
    //     Close Schedule Wrapper
    $schedule .= '</div>';
    // Return Schedule String
    return $schedule;
}
开发者ID:JordanPak,项目名称:UCFBands-Functionality,代码行数:54,代码来源:rehearsal-logic-schedule.php

示例3: render

 /**
  *
  * @param $text
  * @param null $cacheKey
  * @param int $life cache life time
  * @return mixed|string
  */
 public function render($text, $cacheKey = null, $life = 360)
 {
     //
     if (!$life || is_null($cacheKey)) {
         $text = $this->convertToRef($text);
         return $this->parser->text($text);
     }
     if (\Cache::has($cacheKey)) {
         return \Cache::get($cacheKey);
     }
     $text = $this->convertToRef($text);
     $result = $this->parser->text($text);
     \Cache::put($cacheKey, $result, $life);
     return $result;
 }
开发者ID:k-kurikuri,项目名称:Laravel.JpRecipe,代码行数:22,代码来源:Markdown.php

示例4: readme

 public function readme()
 {
     $result = $this->_shell->getBlob($this, $this->_currentBranch, 'README.md');
     $parsedown = new \Parsedown();
     $result = $parsedown->text($result);
     return str_replace('<pre>', '<pre class="prettyprint linenums">', $result);
 }
开发者ID:johnnyeven,项目名称:operation.php.find,代码行数:7,代码来源:Repository.php

示例5: parseEscapedMarkedown

 public static function parseEscapedMarkedown($str)
 {
     $Parsedown = new \Parsedown();
     if ($str) {
         return $Parsedown->text(e($str));
     }
 }
开发者ID:stijni,项目名称:snipe-it,代码行数:7,代码来源:Helper.php

示例6: postComment

 public function postComment($id)
 {
     $input = Input::all();
     Log::info($input);
     $validator = Comment::validate($input);
     if ($validator->fails()) {
         FlashHelper::message("Null title", FlashHelper::DANGER);
         return;
     }
     $post = Post::findOrFail($id);
     if (!$post->can_comment || !PrivacyHelper::checkPermission(Auth::user(), $post)) {
         throw new Exception("Don't have permision");
     }
     $comment = new Comment();
     $Parsedown = new Parsedown();
     $comment->post_id = $id;
     $comment->parrent_id = $input['parrent_id'];
     $comment->markdown = $input['markdown'];
     Log::info($comment);
     $comment->HTML = $Parsedown->text($comment->markdown);
     $comment->save();
     $comment->comments = array();
     $data['html'] = View::make('posts._comment')->with('data', $comment)->with('level', count($comment->parents()))->with('can_comment', true)->render();
     $data['status'] = true;
     $data['parent_id'] = $comment->parrent_id;
     return Response::json($data);
 }
开发者ID:sh1nu11bi,项目名称:CloMa,代码行数:27,代码来源:CommentController.php

示例7: build

function build($directory)
{
    $menu = "";
    $pages = "";
    foreach (glob("{$directory}/*", GLOB_MARK) as $f) {
        $find = array(".html", ".md", ".php", " ");
        $replace = array("", "", "", "-");
        $spaces = array("_", "-");
        $nice_name = str_replace($find, $replace, basename($f));
        $cap_name = ucwords(strtolower(str_replace($spaces, " ", $nice_name)));
        if (substr($f, -1) === '/') {
            $content = build($f);
            $pages .= $content[1];
            $menu .= "<li>\n\t\t\t\t\t<span data-menu='submenu'><i class='fa fa-plus-circle'></i> <span>{$cap_name}</span></span>\n\t\t\t\t\t<ul>";
            $menu .= $content[0];
            $menu .= "</ul></li>";
        } else {
            if ($cap_name != "Main") {
                $pages .= "<section class='doc' data-doc='{$nice_name}'>";
                $menu .= "<li data-show='{$nice_name}'> {$cap_name}</li>";
                if (end(explode('.', basename($f))) == "md") {
                    $Parsedown = new Parsedown();
                    $pages .= $Parsedown->text(file_get_contents($f));
                } else {
                    $pages .= file_get_contents($f);
                }
                $pages .= "</section>";
            }
        }
    }
    return [$menu, $pages];
}
开发者ID:HyuchiaDiego,项目名称:Draft,代码行数:32,代码来源:Draft.php

示例8: processDatamap_preProcessFieldArray

 /**
  * Convert markdown to html on saving
  *
  * @param array $incommingFieldArray (reference) The field array of a
  *     record
  * @param string $table The table currently processing data for
  * @param string $id The record uid currently processing data for,
  *     [integer] or [string] (like 'NEW...')
  * @param \TYPO3\CMS\Core\DataHandling\DataHandler $parentObject
  *
  * @return void
  */
 public function processDatamap_preProcessFieldArray(&$incomingFieldArray, $table, $id, $parentObject)
 {
     if ($incomingFieldArray['CType'] == 'parsedown_markdown') {
         $parseDown = new \Parsedown();
         $incomingFieldArray['bodytext'] = $parseDown->text((string) $incomingFieldArray['tx_parsedown_content']);
     }
 }
开发者ID:MaxServ,项目名称:t3ext-parsedown,代码行数:19,代码来源:TceMain.php

示例9: run

 public function run()
 {
     include getcwd() . '/vendor/autoload.php';
     $navStructure = (include getcwd() . '/docs/navigation.php');
     echo "Loading markdown...\n";
     $markdown = $this->findMarkdown($navStructure);
     echo "Converting markdown to html...\n";
     $Parsedown = new \Parsedown();
     $html = $Parsedown->text($markdown);
     $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     #$pdf->SetAuthor('Nicola Asuni');
     $pdf->SetTitle('My Documentation');
     #$pdf->SetSubject('TCPDF Tutorial');
     #$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->SetFont('helvetica', '', 20);
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->AddPage();
     $pdf->writeHTML($html, true, 0, true, 0);
     $pdf->lastPage();
     echo "Writing PDF...\n";
     $pdf->Output($this->config['output'], 'F');
     echo "Complete.\n";
 }
开发者ID:dev-lucid,项目名称:lucid,代码行数:27,代码来源:BuildDocs.php

示例10: invokeHandler

 protected function invokeHandler()
 {
     $content = $this->file->getContent();
     $parsedown = new Parsedown();
     $this->smarty->assign('content', $parsedown->text($content));
     $this->smarty->display('handler/markdown.tpl');
 }
开发者ID:nicefirework,项目名称:sharecloud,代码行数:7,代码来源:MarkdownHandler.class.php

示例11: setcookie

 function merge_action($mergeId)
 {
     $this->setBranch();
     $api = new \firegit\app\mod\git\Merge();
     $merge = $api->getMerge($mergeId);
     if (!$merge) {
         throw new \Exception('firegit.u_notfound');
     }
     $orig = $merge['orig_branch'];
     $dest = $merge['dest_branch'];
     setcookie('branch', $orig, time() + 3600 * 24, '/');
     //blame使用cookie
     $commits = $this->repo->listCommits($orig, $dest);
     $branches = $this->repo->listBranches();
     $umod = new \firegit\app\mod\user\User();
     $tusers = $umod->getUsers();
     // 评论
     $modComment = new \firegit\app\mod\util\Comment();
     $comments = $modComment->getComments(1, $mergeId, $this->_sz);
     require_once VENDOR_ROOT . '/parsedown/Parsedown.php';
     $parsedown = new \Parsedown();
     foreach ($comments['list'] as $key => $value) {
         $comments['list'][$key]['content'] = $parsedown->text($value['content']);
     }
     $this->set(array('pageTitle' => '合并请求:' . $merge['title'], 'merge' => $merge, 'commits' => $this->packCommits($commits), 'navType' => 'merge', 'branches' => $branches, 'orig' => $orig, 'dest' => $dest, 'tusers' => $tusers, 'notShowNav' => true, 'comments' => $comments['list'], 'curUser' => $this->getData('user')))->setView('git/merge.phtml');
 }
开发者ID:comdeng,项目名称:firegit,代码行数:26,代码来源:MergeTrait.php

示例12: page

 public function page(Page $page)
 {
     $this->tocBuilder = new TocBuilder();
     $page->setContent(parent::text($page->getContent()));
     $page->setToc($this->tocBuilder->getToc());
     $this->tocBuilder = null;
 }
开发者ID:stof,项目名称:Gitiki,代码行数:7,代码来源:Parser.php

示例13:

 function it_can_parse_html_from_file(\Parsedown $parser, Filesystem $filesystem)
 {
     $this->setPath('path/to/file.md');
     $filesystem->get('path/to/file.md')->shouldBeCalled()->willReturn('Some Markdown');
     $parser->text('Some Markdown')->shouldBeCalled()->willReturn('Parsed Markdown');
     $this->getHtml()->shouldBe('Parsed Markdown');
 }
开发者ID:jamesflight,项目名称:markaround,代码行数:7,代码来源:MarkdownFileSpec.php

示例14: get_posts

/**
 * 获取全部文章资源
 * @param  integer $page
 * @param  integer $perpage
 * @return
 */
function get_posts($page = 1, $perpage = 0)
{
    if ($perpage == 0) {
        $perpage = 5;
    }
    $posts = get_post_names();
    // 当前页面posts
    $posts = array_slice($posts, ($page - 1) * $perpage, $perpage);
    $tmp = [];
    $Parsedown = new Parsedown();
    foreach ($posts as $v) {
        $post = new stdClass();
        $arr = explode('_', $v);
        // 从文件名获取时间戳
        $post->date = strtotime(str_replace('posts/', '', $arr[0]));
        // 获取url
        $post->url = './' . date('Y/m', $post->date) . '/' . str_replace('.md', '', $arr[1]);
        // 得到post内容
        $content = $Parsedown->text(file_get_contents($v));
        $arr = explode('</h1>', $content);
        $post->title = str_replace('<h1>', '', $arr[0]);
        $post->body = $arr[1];
        $tmp[] = $post;
    }
    return $tmp;
}
开发者ID:sky-L,项目名称:LBlog-Slim,代码行数:32,代码来源:myFunc.php

示例15: render

 public function render($echo = false)
 {
     // Load template directories.
     $loader = new \Twig_Loader_Filesystem();
     $loader->addPath('templates');
     // Set up Twig.
     $twig = new \Twig_Environment($loader, array('debug' => true, 'strct_variables' => true));
     $twig->addExtension(new \Twig_Extension_Debug());
     // Mardown support.
     $twig->addFilter(new \Twig_SimpleFilter('markdown', function ($text) {
         $parsedown = new \Parsedown();
         return $parsedown->text($text);
     }));
     // DB queries.
     $twig->addFunction(new \Twig_SimpleFunction('db_queries', function () {
         return Db::getQueries();
     }));
     // Render.
     $string = $twig->render($this->template, $this->data);
     if ($echo) {
         echo $string;
     } else {
         return $string;
     }
 }
开发者ID:samwilson,项目名称:swidau,代码行数:25,代码来源:Template.php


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