/**
  * Get the given documentation page.
  *
  * @param  string $manual
  * @param  string $version
  * @param  string $page
  * @return string
  */
 public function get($manual, $version, $page)
 {
     $pageFile = $this->storagePath . '/' . $manual . '/' . $version . '/' . $page . '.md';
     if ($this->files->exists($pageFile)) {
         return $this->cached("{$manual}.{$version}.{$pageFile}", Markdown::parse($this->files->get($pageFile), $manual . '/' . $version . '/' . dirname($page)));
     } else {
         App::abort(404);
     }
 }
Example #2
0
 public static function convert_raw_bodys($news_list)
 {
     if (!is_array($news_list)) {
         $news = (array) $news_list;
     }
     if (!$news_list) {
         return $news_list;
     }
     $raw_bodys = array();
     foreach ($news_list as $news) {
         $body = $news->body;
         if ($news->format == 2) {
             $body = \Markdown::parse($body);
         }
         $raw_bodys[$news->id] = $body;
     }
     return $raw_bodys;
 }
Example #3
0
 public function action_changelog()
 {
     $this->_view = 'components/nova2/everything/changelog';
     $nova23 = file_get_contents(APPPATH . 'views/components/nova2/everything/changelog_nova23.md');
     $nova22 = file_get_contents(APPPATH . 'views/components/nova2/everything/changelog_nova22.md');
     $nova21 = file_get_contents(APPPATH . 'views/components/nova2/everything/changelog_nova21.md');
     $nova20 = file_get_contents(APPPATH . 'views/components/nova2/everything/changelog_nova20.md');
     $nova12 = file_get_contents(APPPATH . 'views/components/nova2/everything/changelog_nova12.md');
     $nova11 = file_get_contents(APPPATH . 'views/components/nova2/everything/changelog_nova11.md');
     $nova10 = file_get_contents(APPPATH . 'views/components/nova2/everything/changelog_nova10.md');
     $this->_data->nova23 = Markdown::parse($nova23);
     $this->_data->nova22 = Markdown::parse($nova22);
     $this->_data->nova21 = Markdown::parse($nova21);
     $this->_data->nova20 = Markdown::parse($nova20);
     $this->_data->nova12 = Markdown::parse($nova12);
     $this->_data->nova11 = Markdown::parse($nova11);
     $this->_data->nova10 = Markdown::parse($nova10);
     $this->template->title .= 'Nova 2 Changelog';
 }
 /**
  * @return bool|string
  * @throws \SystemException
  */
 public function getContent()
 {
     switch ($this->popup->content_type) {
         case 'imageUrl':
             return "<img src='{$this->popup->content_image_url}'>";
             break;
         case 'imageUpload':
             return '<img src="' . MediaLibrary::instance()->getPathUrl($this->popup->content_image_upload) . '">';
             break;
         case 'page':
             /** @var Page $page */
             $page = Page::load(Theme::getActiveTheme(), $this->popup->content_page);
             $cms = new CmsController();
             return $cms->run($page->url)->getContent();
             break;
         case 'markdown':
             return \Markdown::parse($this->popup->content_markdown);
             break;
     }
 }
Example #5
0
function convert_body_by_format($body, $format = 0, $truncate_width = 0, $read_more_uri = '')
{
    switch ($format) {
        case 1:
            // raw(html_editor)
            break;
        case 2:
            $body = Markdown::parse($body);
            // markdown
            break;
        default:
            $body = '';
            break;
    }
    if (!$truncate_width) {
        return $body;
    }
    $options = array('truncate_width' => $truncate_width, 'is_strip_tags' => true, 'nl2br' => false, 'url2link' => false, 'truncate_line' => 0);
    if ($read_more_uri) {
        $options['read_more_uri'] = $read_more_uri;
    }
    $handler = new Site_PostedBodyHandler($options);
    return $handler->convert($body);
}
Example #6
0
    ?>
" role="alert">
			<?php 
    echo $massage['content'];
    ?>
		</div>
		<?php 
}
?>

		
		<?php 
if (isset($article)) {
    ?>
		<?php 
    echo Markdown::parse($article['topic_body']);
    ?>
		<pre>
		<?php 
    print_r($article);
    ?>

		<?php 
}
?>

		<?php 
if (isset($image)) {
    ?>
		<?php 
    foreach ($image[0] as $key => $item) {
Example #7
0
 public function save($id)
 {
     $setting = Setting::find($id);
     $setting->update(Input::all());
     $resolved_content = Markdown::parse(Input::get('content'));
     $setting->resolved_content = $resolved_content;
     $setting->save($id);
 }
Example #8
0
 /**
  * Return the formatted message.
  *
  * @param string $value
  *
  * @return string
  */
 public function getMessageAttribute($value)
 {
     return \Markdown::parse($value);
 }
 /**
  * Get the html content of the document.
  *
  * @return string
  */
 public function getHtmlContentAttribute()
 {
     return \Markdown::parse($this->content);
 }
Example #10
0
    foreach ($posts as $post) {
        ?>
		<article id="post-<?php 
        echo $post->id;
        ?>
" class="post-preview">
		    <a href="<?php 
        echo \Router::get('show_post', array('segment' => $post->slug));
        ?>
" >
                <h2><?php 
        echo $post->name;
        ?>
</h2>
                <p><?php 
        echo \Str::truncate(\Markdown::parse($post->content), \Config::get('application.truncate', 600));
        ?>
</p>
            </a>
            <small>
                <a href="<?php 
        echo \Router::get('show_post_category', array('category' => $post->category->slug));
        ?>
"><?php 
        echo $post->category->name;
        ?>
</a>,
                <?php 
        echo __('by');
        ?>
 <a href="<?php 
 /**
  * Update the specified resource in storage.
  * PUT /article/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $rules = ['title' => 'required|max:100', 'content' => 'required', 'tags' => array('required', 'regex:/^\\w+$|^(\\w+,)+\\w+$/')];
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         $article = Article::with('tags')->find($id);
         $article->update(Input::only('title', 'content'));
         $resolved_content = Markdown::parse(Input::get('content'));
         $article->resolved_content = $resolved_content;
         $tags = array_unique(explode(',', Input::get('tags')));
         if (str_contains($resolved_content, '<p>')) {
             $start = strpos($resolved_content, '<p>');
             $length = strpos($resolved_content, '</p>') - $start - 3;
             $article->summary = substr($resolved_content, $start + 3, $length);
         } elseif (str_contains($resolved_content, '</h')) {
             $start = strpos($resolved_content, '<h');
             $length = strpos($resolved_content, '</h') - $start - 4;
             $article->summary = substr($resolved_content, $start + 4, $length);
         }
         $article->save();
         foreach ($article->tags as $tag) {
             if (($index = array_search($tag->name, $tags)) !== false) {
                 unset($tags[$index]);
             } else {
                 $tag->count--;
                 $tag->save();
                 $article->tags()->detach($tag->id);
             }
         }
         foreach ($tags as $tagName) {
             $tag = Tag::whereName($tagName)->first();
             if (!$tag) {
                 $tag = Tag::create(array('name' => $tagName));
             }
             $tag->count++;
             $article->tags()->save($tag);
         }
         return Redirect::route('article.show', $article->id);
     } else {
         return Redirect::route('article.edit', $id)->withInput()->withErrors($validator);
     }
 }
Example #12
0
 public static function parse_markdown($text)
 {
     $text = preg_replace('!\\[\\]\\((.+?)\\)!', '[$1]($1)', $text);
     return Markdown::parse(Security::xss_clean($text));
 }
Example #13
0
<div class="post_small_description">
   	<?php 
echo \Markdown::parse($post->small_description);
?>
</div>
Example #14
0
 public function action_whatsnew($version = '23')
 {
     $version_safe = $version;
     $version = str_replace('2', '2.', $version);
     $content = file_get_contents(APPPATH . 'views/components/nova2/start/whatsnew_' . $version_safe . '.md');
     $title = "What's New in Nova " . $version;
     $this->_view = 'components/nova2/start/whatsnew';
     $this->_data->whatsnew = Markdown::parse($content);
     $this->_data->header = $title;
     $this->template->title .= $title;
 }
Example #15
0
?>
</h1>
    <p>
    	<small>
			<?php 
echo __('by');
?>
 <a href="<?php 
echo \Router::get('show_post_author', array('author' => $post->user->username));
?>
">
                <?php 
echo $post->user->username;
?>
</a> <?php 
echo __('on');
?>
 <em><?php 
echo date('d/m/Y', $post->created_at);
?>
</em>
		 </small>
	 </p>
    </div>

    <graph></graph>
    <?php 
echo $snippet == true ? \Str::truncate(\Markdown::parse($post->content), \Config::get('application.truncate', 400)) : \Markdown::parse($post->content);
?>

</article>
Example #16
0
echo $post->user->username;
?>
</a> <?php 
echo __('on');
?>
 <em><?php 
echo date('d/m/Y', $post->created_at);
?>
</em>
		 </small>
	 </p>
</div>

<article>
	<?php 
echo \Markdown::parse($post->content);
?>
</article>
<hr>

<section class="comments">
    <h3><?php 
echo __('frontend.comment-this-post');
?>
</h3>

    <?php 
echo \Form::open();
?>
        <div class="row">
            <div class="col-md-6">