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


PHP markdown函数代码示例

本文整理汇总了PHP中markdown函数的典型用法代码示例。如果您正苦于以下问题:PHP markdown函数的具体用法?PHP markdown怎么用?PHP markdown使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: odc_display_content

function odc_display_content($request_tag = "default", $anypage = FALSE)
{
    $tag = strtolower($request_tag);
    $page = strtolower($_SERVER['SCRIPT_NAME']);
    // now check for/get content from the database...
    if ($anypage) {
        $sql = 'SELECT content,markdown FROM odc WHERE tag="' . $tag . '" AND page="any";';
    } else {
        $sql = 'SELECT content,markdown FROM odc WHERE tag="' . $tag . '" AND page="' . $page . '";';
    }
    $rows = odc_my_query($sql);
    $content = mysql_fetch_assoc($rows);
    if (empty($content)) {
        // call function to create new content-stub if there is none
        odc_new($tag, $anypage);
    } else {
        // print out content
        if ($content['markdown'] > 0) {
            require_once $GLOBALS['MD_file'];
            echo markdown($content['content']);
        } else {
            echo $content['content'];
        }
    }
    // just for debugging, return nothing normally...
    //return "Tag: ".$tag." Page: ".$page;
    return;
}
开发者ID:noinfo,项目名称:odc,代码行数:28,代码来源:odc.php

示例2: _process

 function _process($items, $return_single = FALSE)
 {
     $this->load->helper('url');
     if ($items) {
         foreach ($items as $key => $value) {
             $new_item = new Sweetcron_item();
             //item feed components
             $new_item->feed_id = $items[$key]->feed_id;
             $new_item->feed_title = $items[$key]->feed_title;
             $new_item->feed_icon = $items[$key]->feed_icon;
             $new_item->feed_url = $items[$key]->feed_url;
             $new_item->feed_data = $items[$key]->feed_data;
             $new_item->feed_status = $items[$key]->feed_status;
             $new_item->feed_domain = $items[$key]->feed_domain;
             //standard item components
             $new_item->ID = $items[$key]->ID;
             $new_item->item_date = $items[$key]->item_date;
             //autolinks
             $new_item->item_content = auto_link($items[$key]->item_content);
             $new_item->item_content = markdown($new_item->item_content);
             $new_item->item_title = auto_link($items[$key]->item_title);
             $new_item->item_original_permalink = $items[$key]->item_permalink;
             $new_item->item_permalink = $this->config->item('base_url') . 'items/view/' . $new_item->ID;
             $new_item->item_status = $items[$key]->item_status;
             $new_item->item_name = $items[$key]->item_name;
             $new_item->item_data = unserialize($items[$key]->item_data);
             $new_item->item_tags = $this->get_tags($items[$key]->ID);
             //make adjustments if blog post
             if (!$items[$key]->feed_id) {
                 $new_item->feed_icon = '/favicon.ico';
                 $url = parse_url($this->config->item('base_url'));
                 if (substr($url['host'], 0, 4) == 'www.') {
                     $new_item->feed_domain = substr($url['host'], 4);
                 } else {
                     $new_item->feed_domain = $url['host'];
                 }
             }
             $new_item->feed_class = str_replace('.', '_', $new_item->feed_domain);
             //extended item components
             if ($new_item->feed_id) {
                 $new_item = $this->sweetcron->extend('pre_display', $new_item->feed_domain, $new_item);
             }
             //custom item components
             $new_item->nice_date = timespan($items[$key]->item_date);
             if ($new_item->item_date < strtotime('1 day ago')) {
                 $new_item->human_date = date('F j Y, g:ia', $items[$key]->item_date);
             } else {
                 $new_item->human_date = $new_item->nice_date . ' ago';
             }
             $items[$key] = $new_item;
         }
         if ($return_single) {
             return $items[0];
         } else {
             return $items;
         }
     } else {
         return false;
     }
 }
开发者ID:vu-nguyen,项目名称:sweetcron,代码行数:60,代码来源:item_model.php

示例3: get

 function get()
 {
     $text = preg_replace_callback('!(?=[^\\]])\\((' . implode('|', $this->tags) . '):(.*?)\\)!i', array($this, 'parse'), (string) $this->text);
     $text = preg_replace_callback('!```(.*?)```!is', array($this, 'code'), $text);
     $text = $this->mdown ? markdown($text) : $text;
     $text = $this->smartypants ? smartypants($text) : $text;
     return $text;
 }
开发者ID:sdvig,项目名称:kirbycms,代码行数:8,代码来源:kirbytext.php

示例4: setBody

 public function setBody($v)
 {
     parent::setBody($v);
     require_once 'markdown.php';
     // strip all HTML tags
     $v = htmlentities($v, ENT_QUOTES, 'UTF-8');
     $this->setHtmlBody(markdown($v));
 }
开发者ID:arrisray,项目名称:askeet,代码行数:8,代码来源:Question.php

示例5: kirbytext

function kirbytext($text, $markdown = true)
{
    $text = kirbytext::get($text);
    if ($markdown) {
        $text = markdown($text);
    }
    return $text;
}
开发者ID:robeam,项目名称:kirbycms,代码行数:8,代码来源:kirbytext.php

示例6: acquireData

 protected function acquireData($params, $userRec)
 {
     $data = parent::acquireData($params, $userRec);
     $data['config']['google_maps_api_key'] = GOOGLE_MAPS_API_KEY;
     for ($i = 1; $i <= 7; $i++) {
         $data['help'][] = markdown(file_get_contents('./help_doc_' . $i . '.markdown.text'));
     }
     return $data;
 }
开发者ID:BackupTheBerlios,项目名称:instructcontrol,代码行数:9,代码来源:icdemo.php

示例7: transform

 /**
  * Transform single resource.
  *
  * @param  \App\Article $article
  * @return  array
  */
 public function transform(Article $article)
 {
     $id = optimus((int) $article->id);
     $payload = ['id' => $id, 'title' => $article->title, 'content_raw' => strip_tags($article->content), 'content_html' => markdown($article->content), 'created' => $article->created_at->toIso8601String(), 'view_count' => (int) $article->view_count, 'link' => ['rel' => 'self', 'href' => route('api.v1.articles.show', $id)], 'comments' => (int) $article->comments->count(), 'author' => ['name' => $article->author->name, 'email' => $article->author->email, 'avatar' => 'http:' . gravatar_profile_url($article->author->email)], 'tags' => $article->tags->pluck('slug'), 'attachments' => (int) $article->attachments->count()];
     if ($fields = $this->getPartialFields()) {
         $payload = array_only($payload, $fields);
     }
     return $payload;
 }
开发者ID:linuxssm,项目名称:l5essential,代码行数:15,代码来源:ArticleTransformer.php

示例8: transform

 /**
  * Transform single resource.
  *
  * @param  \App\Comment $comment
  * @return  array
  */
 public function transform(Comment $comment)
 {
     $id = optimus((int) $comment->id);
     $payload = ['id' => $id, 'content_raw' => strip_tags($comment->content), 'content_html' => markdown($comment->content), 'created' => $comment->created_at->toIso8601String(), 'vote' => ['up' => (int) $comment->up_count, 'down' => (int) $comment->down_count], 'link' => ['rel' => 'self', 'href' => route('api.v1.comments.show', $id)], 'author' => ['name' => $comment->author->name, 'email' => $comment->author->email, 'avatar' => 'http:' . gravatar_profile_url($comment->author->email)]];
     if ($fields = $this->getPartialFields()) {
         $payload = array_only($payload, $fields);
     }
     return $payload;
 }
开发者ID:linuxssm,项目名称:l5essential,代码行数:15,代码来源:CommentTransformer.php

示例9: format

function format($text)
{
    $text = markdown($text);
    $text = smartypants($text);
    $search = array("<table>", "</table>");
    $replace = array("<figure class='table'><table>", "</table></figure>");
    $text = str_replace($search, $replace, $text);
    return $text;
}
开发者ID:clearleft,项目名称:nice-guidelines,代码行数:9,代码来源:functions.php

示例10: lang_markdown

function lang_markdown($name)
{
    include __DIR__ . "/../res/markdown.php";
    $output = lang($name);
    if ($output != null) {
        return markdown($output);
    } else {
        return null;
    }
}
开发者ID:alijaffar,项目名称:UploadMe,代码行数:10,代码来源:json.php

示例11: get

 /**
  * Get the given documentation page.
  *
  * @param  string  $version
  * @param  string  $page
  * @return string
  */
 public function get($version, $page)
 {
     return $this->cache->remember('docs.' . $version . '.' . $page, 5, function () use($version, $page) {
         $path = base_path('resources/docs/' . $page . '.md');
         if ($this->files->exists($path)) {
             return $this->replaceLinks($version, markdown($this->files->get($path)));
         }
         return null;
     });
 }
开发者ID:ifromz,项目名称:deploy-cloud,代码行数:17,代码来源:Documentation.php

示例12: show

 /**
  * Show document page in response to the given $file.
  *
  * @param string $file
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function show($file = '01-welcome.md')
 {
     $index = Cache::remember('documents.index', 120, function () {
         return markdown($this->document->get());
     });
     $content = Cache::remember("documents.{$file}", 120, function () use($file) {
         return markdown($this->document->get($file));
     });
     return view('documents.index', compact('index', 'content'));
 }
开发者ID:gabrieljo,项目名称:l5essential,代码行数:16,代码来源:DocumentsController.php

示例13: executeAbout

 public function executeAbout()
 {
     require_once 'markdown.php';
     $file = sfConfig::get('sf_data_dir') . '/content/about_' . $this->getUser()->getCulture() . '.txt';
     if (!is_readable($file)) {
         $file = sfConfig::get('sf_data_dir') . '/content/about_en.txt';
     }
     $this->html = markdown(file_get_contents($file));
     $this->getResponse()->setTitle('askeet! &raquo; about');
 }
开发者ID:emacsattic,项目名称:symfony,代码行数:10,代码来源:actions.class.php

示例14: toHtml

 /**
  * Converts the code to HTML
  *
  * @param File        $file File to render
  * @param Tool_Result $res  Tool result to integrate
  *
  * @return string HTML
  */
 public function toHtml(File $file, Tool_Result $res = null)
 {
     if (class_exists('\\Michelf\\Markdown', true)) {
         //composer-installed version 1.4+
         $markdown = \Michelf\Markdown::defaultTransform($file->getContent());
     } else {
         //PEAR-installed version 1.0.2 has a different API
         require_once 'markdown.php';
         $markdown = \markdown($file->getContent());
     }
     return '<div class="markdown">' . $markdown . '</div>';
 }
开发者ID:nickel715,项目名称:phorkie,代码行数:20,代码来源:Markdown.php

示例15: update

 public function update(UpdateReply $request, $id)
 {
     $reply = Reply::findOrFail($id);
     $mention = new Mention();
     $data = $request->all();
     $reply->body_original = $data['body'];
     $data['body'] = $mention->parse($data['body']);
     $reply->body = markdown($data['body']);
     $reply->save();
     flash()->success('Pranešimas sėkmingai atnaujintas!');
     return redirect()->route('topic.show', [$reply->topic->slug]);
 }
开发者ID:PovilasLT,项目名称:maze,代码行数:12,代码来源:RepliesController.php


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