• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP markdown函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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, $this->cacheTime, function () use($version, $page) {
         $path = $this->fullPagePath($version, $page);
         if ($this->files->exists($path)) {
             $content = $this->replaceLinks($version, markdown($this->files->get($path)));
             $title = $content ? $this->getDocTitleByContent($content) : null;
             return compact('content', 'title');
         }
         return null;
     });
 }
开发者ID:vs0uz4,项目名称:laravel-docs.artesaos.org,代码行数:20,代码来源:Documentation.php


示例17: create

 public static function create(Document $data, string $url) : Article
 {
     $article = new static();
     $article->title = $data->matter('title', '');
     $article->contents = markdown($data->body());
     $article->description = $data->matter('description', '');
     $article->date = Carbon::createFromFormat('d/m/Y', $data->matter('date', '01/02/1992'));
     $article->era = $data->matter('era', '');
     $article->commentable = $data->matter('comments', true);
     $article->url = $url;
     return $article;
 }
开发者ID:sebastiandedeyne,项目名称:sebastiandedeyne.com,代码行数:12,代码来源:Article.php


示例18: get

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


示例19: outputFile

 /**
  * retrieves and parses file for output
  *
  * @return string
  * @param $file Base name of file to parse
  */
 public function outputFile($infile)
 {
     require_once 'markdown.php';
     $hostPrefix = '/content/';
     if (preg_match('/^sandbox/', $this->getRequest()->getHost())) {
         $hostPrefix .= 'sandbox_';
     }
     $fileRoot = sfConfig::get('sf_data_dir') . $hostPrefix . $infile . '_';
     $file = $fileRoot . $this->getUser()->getCulture() . '.txt';
     if (!is_readable($file)) {
         $file = $fileRoot . '_en.txt';
     }
     $this->html = markdown(file_get_contents($file));
     $this->getContext()->getResponse()->setTitle(sfConfig::get('app_title_prefix') . $infile);
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:21,代码来源:actions.class.php


示例20: index

 protected function index()
 {
     global $config;
     $pkg = new Packager($config['packages']);
     $data = array();
     foreach ($pkg->get_packages() as $package) {
         $data[$package] = array('files' => array(), 'package' => $package, 'package_web' => markdown($pkg->get_package_web($package)), 'package_authors' => markdown(implode(' & ', $pkg->get_package_authors($package))), 'package_description' => markdown($pkg->get_package_description($package)), 'package_license' => markdown($pkg->get_package_license($package)), 'package_copyright' => markdown($pkg->get_package_copyright($package)));
         foreach ($pkg->get_all_files($package) as $file) {
             $file_meta = array('name' => $pkg->get_file_name($file), 'depends' => implode(', ', $pkg->get_file_dependancies($file)), 'provides' => implode(', ', $pkg->get_file_provides($file)), 'description' => markdown($pkg->get_file_description($file)));
             $data[$package]['files'][$file] = $file_meta;
         }
     }
     $this->data('packages', $data);
     $this->data('config', $config['view']);
     $this->render($config['view']['theme']);
 }
开发者ID:kamicane,项目名称:packager-web,代码行数:16,代码来源:web.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP markdown_to_html函数代码示例发布时间:2022-05-15
下一篇:
PHP mark_user_preferences_changed函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap