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


PHP Parsedown::parse方法代码示例

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


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

示例1: renderDefault

 function renderDefault()
 {
     $projects = $this->projectManager->byUser($this->user->id);
     $awaiting = 0;
     $accepted = 0;
     $declined = 0;
     foreach ($projects as $p) {
         if ($p->accepted == Model\ProjectManager::STATUS_AWAITING) {
             $awaiting++;
         }
         if ($p->accepted == Model\ProjectManager::STATUS_ACCEPTED) {
             $accepted++;
         }
         if ($p->accepted == Model\ProjectManager::STATUS_DECLINED) {
             $declined++;
         }
     }
     $this->template->accepted = $accepted;
     $this->template->declined = $declined;
     $this->template->awaiting = $awaiting;
     $project = $this->projectManager->accepted($this->user->id);
     $this->template->project = $project;
     $this->template->projects = $projects;
     if ($accepted > 0) {
         $parsedown = new \Parsedown();
         $desc = htmlentities($project->description, ENT_QUOTES, 'UTF-8');
         $this->template->desc = $parsedown->parse($desc);
         $this->template->solutions = $this->projectManager->solutions($project->id);
         $this->template->comments = $this->database->table('comments')->where(array('comments_id' => null, 'projects_id' => $project->id))->order('bump DESC');
         $this->template->parsedown = $parsedown;
     }
 }
开发者ID:vitush93,项目名称:dba,代码行数:32,代码来源:HomepagePresenter.php

示例2: getConfiguration

 public function getConfiguration()
 {
     $token = Seat::get('slack_token');
     $parser = new \Parsedown();
     $changelog = $parser->parse($this->getChangelog());
     return view('slackbot::configuration', compact('token', 'changelog'));
 }
开发者ID:warlof,项目名称:slackbot,代码行数:7,代码来源:SlackbotController.php

示例3: formatRaw

 public function formatRaw($string)
 {
     include_once SIMPLEWIKI_DIR . '/thirdparty/parsedown-0.9.0/Parsedown.php';
     $parsedown = new Parsedown();
     return $parsedown->parse($string);
     //		include_once SIMPLEWIKI_DIR . '/thirdparty/php-markdown-extra-1.2.4/markdown.php';
     return Markdown($string);
 }
开发者ID:nyeholt,项目名称:silverstripe-simplewiki,代码行数:8,代码来源:MarkdownFormatter.php

示例4: ShiftType_view

function ShiftType_view($shifttype, $angeltype)
{
    $parsedown = new Parsedown();
    $title = $shifttype['name'];
    if ($angeltype) {
        $title .= ' <small>' . sprintf(_('for team %s'), $angeltype['name']) . '</small>';
    }
    return page_with_title($title, [msg(), buttons([button(page_link_to('shifttypes'), shifttypes_title(), 'back'), $angeltype ? button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], $angeltype['name']) : '', button(page_link_to('shifttypes') . '&action=edit&shifttype_id=' . $shifttype['id'], _('edit'), 'edit'), button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'], _('delete'), 'delete')]), $parsedown->parse($shifttype['description'])]);
}
开发者ID:max-weller,项目名称:engelsystem,代码行数:9,代码来源:ShiftTypes_view.php

示例5: comment

 /**
  * Creates a new comment thread.
  *
  * @param $user_id
  * @param $project_id
  * @param string $text comment text
  * @return JsonResponse
  * @throws CommentingException
  */
 function comment($user_id, $project_id, $text)
 {
     $inserted = $this->database->table('comments')->insert(array('users_id' => $user_id, 'text' => $text, 'projects_id' => $project_id, 'bump' => new DateTime()));
     if ($inserted) {
         $parsedown = new \Parsedown();
         $user = $inserted->ref('users');
         $name = $user->name ? $user->name : $user->username;
         return new JsonResponse(array('text' => $parsedown->parse($inserted->text), 'posted' => $inserted->posted->format('j.n.Y H:i'), 'author' => $name, 'id' => $inserted->id));
     } else {
         throw new CommentingException();
     }
 }
开发者ID:vitush93,项目名称:dba,代码行数:21,代码来源:CommentingService.php

示例6: urlencode

 /**
  * Get and parse a markdown file from Github
  *
  * @param string $file
  *
  * @return bool|string
  */
 function get_github_markdown($file = 'readme.md')
 {
     $response = wp_remote_get('https://raw.githubusercontent.com/siteorigin/siteorigin-installer/' . self::UPDATES_BRANCH . '/' . urlencode($file));
     if (is_wp_error($response) || empty($response['body'])) {
         return false;
     }
     if (!class_exists('Parsedown')) {
         require_once plugin_dir_path(__FILE__) . '/Parsedown/Parsedown.php';
     }
     $parsedown = new Parsedown();
     return $parsedown->parse($response['body']);
 }
开发者ID:siteorigin,项目名称:siteorigin-installer,代码行数:19,代码来源:github-plugin-updater.php

示例7: getPost

 /**
  * Get the Post
  *
  * @param int $id
  * @return \Illuminate\Http\JsonResponse
  */
 public function getPost($id)
 {
     $post = \App\Post::find($id);
     if (!$post) {
         return response()->json(['status' => 404, 'error' => "Post not Found"], 404);
     }
     // Lazy eager load
     $post->load(['user', 'comments']);
     $post->comments->load('user');
     // nice :)
     $converter = new \Parsedown();
     $post->html = $converter->parse($post->body);
     return response()->json($post);
 }
开发者ID:nickolasgregory,项目名称:laravel-demo,代码行数:20,代码来源:ApiController.php

示例8: md

 public function md($markdown, $tag = array(), $class = '')
 {
     static $parser = null;
     if (is_null($parser)) {
         include_once 'Parsedown.php';
         $parser = new Parsedown();
     }
     $markdown = $parser->parse($markdown);
     if (empty($tag)) {
         return $markdown;
     }
     if (!is_array($tag)) {
         $tag = array($tag => $class);
     }
     return $this->add_class($tag, $markdown);
 }
开发者ID:kikoseijo,项目名称:BootPress,代码行数:16,代码来源:Bootstrap.php

示例9: Shift_view

function Shift_view($shift, $shifttype, $room, $shift_admin, $angeltypes_source, $user_shift_admin, $admin_rooms, $admin_shifttypes, $user_shifts, $signed_up)
{
    $parsedown = new Parsedown();
    $angeltypes = [];
    foreach ($angeltypes_source as $angeltype) {
        $angeltypes[$angeltype['id']] = $angeltype;
    }
    $needed_angels = '';
    foreach ($shift['NeedAngels'] as $needed_angeltype) {
        $class = 'progress-bar-warning';
        if ($needed_angeltype['taken'] == 0) {
            $class = 'progress-bar-danger';
        }
        if ($needed_angeltype['taken'] >= $needed_angeltype['count']) {
            $class = 'progress-bar-success';
        }
        $needed_angels .= '<div class="list-group-item">';
        $needed_angels .= '<div class="pull-right">' . Shift_signup_button_render($shift, $angeltypes[$needed_angeltype['TID']]) . '</div>';
        $needed_angels .= '<h3>' . AngelType_name_render($angeltypes[$needed_angeltype['TID']]) . '</h3>';
        $needed_angels .= progress_bar(0, $needed_angeltype['count'], min($needed_angeltype['taken'], $needed_angeltype['count']), $class, $needed_angeltype['taken'] . ' / ' . $needed_angeltype['count']);
        $angels = [];
        foreach ($shift['ShiftEntry'] as $shift_entry) {
            if ($shift_entry['TID'] == $needed_angeltype['TID']) {
                $entry = User_Nick_render(User($shift_entry['UID']));
                if ($shift_entry['freeloaded']) {
                    $entry = '<strike>' . $entry . '</strike>';
                }
                if ($user_shift_admin) {
                    $entry .= ' <div class="btn-group">';
                    $entry .= button_glyph(page_link_to('user_myshifts') . '&edit=' . $shift_entry['id'] . '&id=' . $shift_entry['UID'], 'pencil', 'btn-xs');
                    $entry .= button_glyph(page_link_to('user_shifts') . '&entry_id=' . $shift_entry['id'], 'trash', 'btn-xs');
                    $entry .= '</div>';
                }
                $angels[] = $entry;
            }
        }
        $needed_angels .= join(', ', $angels);
        $needed_angels .= '</div>';
    }
    $shiftManagers = getShiftManagers($shift['SID']);
    return page_with_title($shift['name'] . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>', [msg(), Shift_collides($shift, $user_shifts) ? info(_('This shift collides with one of your shifts.'), true) : '', $signed_up ? info(_('You are signed up for this shift.'), true) : '', $shift_admin || $admin_shifttypes || $admin_rooms ? buttons([$shift_admin ? button(shift_edit_link($shift), glyph('pencil') . _('edit')) : '', $shift_admin ? button(shift_delete_link($shift), glyph('trash') . _('delete')) : '', $admin_shifttypes ? button(shifttype_link($shifttype), $shifttype['name']) : '', $admin_rooms ? button(room_link($room), glyph('map-marker') . $room['Name']) : '']) : '', div('row', [div('col-sm-3 col-xs-6', ['<h4>' . _('Title') . '</h4>', '<p class="lead">' . ($shift['URL'] != '' ? '<a href="' . $shift['URL'] . '">' . $shift['title'] . '</a>' : $shift['title']) . '</p>']), div('col-sm-3 col-xs-6', ['<h4>' . _('Start') . '</h4>', '<p class="lead' . (time() >= $shift['start'] ? ' text-success' : '') . '">', glyph('calendar') . date('Y-m-d', $shift['start']), '<br />', glyph('time') . date('H:i', $shift['start']), '</p>']), div('col-sm-3 col-xs-6', ['<h4>' . _('End') . '</h4>', '<p class="lead' . (time() >= $shift['end'] ? ' text-success' : '') . '">', glyph('calendar') . date('Y-m-d', $shift['end']), '<br />', glyph('time') . date('H:i', $shift['end']), '</p>']), div('col-sm-3 col-xs-6', ['<h4>' . _('Location') . '</h4>', '<p class="lead">' . glyph('map-marker') . $room['Name'] . '</p>'])]), div('row', [div('col-sm-6', ['<h2>' . _('Needed angels') . '</h2>', '<div class="list-group">' . $needed_angels . '</div>']), div('col-sm-6', [!empty($shiftManagers) ? '<h2>' . _('Shift Manager') . '</h2>' : '', !empty($shiftManagers) ? implode('<br>', array_map(function ($manager) {
        return $manager['Vorname'] . ' ' . $manager['Name'];
    }, $shiftManagers)) : '', '<h2>' . _('Description') . '</h2>', $parsedown->parse($shifttype['description'])])]), $shift_admin ? Shift_editor_info_render($shift) : '']);
}
开发者ID:Grreg,项目名称:engelsystem,代码行数:44,代码来源:Shifts_view.php

示例10: str_replace

				</div>
		
			</div>

			<!-- end row -->

			<!-- row -->
		
			<div class="row">
		
				<div class="col-sm-12">
					<div class="well">
						<?php 
$md = file_get_contents("docs/smartui/widget.md");
$parsedown = new Parsedown();
$doc = $parsedown->parse($md);
echo str_replace('<pre', '<pre class="prettyprint linenums"', $doc);
?>
				
					</div>
		
				</div>
		
			</div>

		
			<!-- end row -->
		
		</section>
		<!-- end widget grid -->
开发者ID:mickey-ichi,项目名称:theme-admin,代码行数:30,代码来源:widgets-class.php

示例11: date

                        <span class="created_at"> · 发布于 <time
                                datetime="<?php 
    echo date('Y-m-d H:i:s', $article['created_at']);
    ?>
"><?php 
    echo Yii::$app->getFormatter()->asRelativeTime($article['created_at']);
    ?>
</time></span><span
                            class="comment-total"> · <?php 
    echo $article['comment_total'] > 0 ? '已经有' . $article['comment_total'] . '个用户发表了读后感' : '还没人鸟我哟';
    ?>
</span>
                    </section>
                    <div class="article-content">
                        <?php 
    echo \yii\helpers\StringHelper::truncateWords($parsedown->parse($article['text']), 10);
    ?>
                    </div>
                </article>
            <?php 
}
?>
            <?php 
echo \yii\widgets\LinkPager::widget(['pagination' => $articles['pagination']]);
?>
        </div>
        <div class="hidden-xs col-md-3 col-lg-4">
            <div class="panel panel-default">
                <div class="panel-heading">分类简介</div>
                <div class="panel-body"><?php 
echo $category['description'] ?: '唔,这个分类的介绍被搞丢了。。。';
开发者ID:luobenyu,项目名称:blog-1,代码行数:31,代码来源:view.php

示例12: Parsedown

<?php

$res = '';
if (file_exists($_GET['file'] . '.md')) {
    require_once 'Parsedown.php';
    $parsedown = new Parsedown();
    // gets file content
    $md = file_get_contents($_GET['file'] . '.md');
    $res .= $parsedown->parse($md);
    // get page title
    preg_match('/<h1>(.*)<\\/h1>/', $res, $matches);
    $title = $matches[1];
    // footer
    $res .= '<footer>&copy; Julien Sébire 2011-' . date('Y') . '</footer>';
} else {
    $res .= 'File not found: ' . $_GET['file'] . '.md';
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><?php 
echo $title;
?>
 | Julien Sébire's Dev Doc</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<style type="text/css">
    body{background:#fff;font-family:Sans-Serif;font-size:1em;}
    h2{border-bottom:1px solid #666;}
    pre{border:1px solid #ccc;background:#ccc;border-radius:10px;color:#300;padding:5px;}
开发者ID:alfalarc,项目名称:jsdd,代码行数:31,代码来源:md.php

示例13: run

 /**
  * {@inheritdoc}
  */
 public function run($markdown = '')
 {
     return $this->parsedown->parse($markdown);
 }
开发者ID:kzykhys,项目名称:markbench,代码行数:7,代码来源:ParsedownDriver.php

示例14: renderProject

 function renderProject()
 {
     $this->template->setFile(__DIR__ . '/templates/Homepage/default.latte');
     $this->template->admin = true;
     $parsedown = new \Parsedown();
     $desc = htmlentities($this->template->project->description, ENT_QUOTES, 'UTF-8');
     $this->template->desc = $parsedown->parse($desc);
     $this->template->parsedown = $parsedown;
 }
开发者ID:vitush93,项目名称:dba,代码行数:9,代码来源:AdminPresenter.php

示例15: parse

 /**
  * 
  *
  * @static 
  */
 public static function parse($text)
 {
     return \Parsedown::parse($text);
 }
开发者ID:9IPHP,项目名称:LaravelBlog,代码行数:9,代码来源:_ide_helper.php


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