當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。