You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
890 B
45 lines
890 B
12 years ago
|
<?php
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2008 Yii Software LLC
|
||
|
* @link http://www.yiiframework.com/
|
||
|
* @license http://www.yiiframework.com/license/
|
||
|
*/
|
||
|
|
||
11 years ago
|
namespace yii\helpers;
|
||
12 years ago
|
|
||
|
use Michelf\MarkdownExtra;
|
||
|
|
||
|
/**
|
||
11 years ago
|
* BaseMarkdown provides concrete implementation for [[Markdown]].
|
||
12 years ago
|
*
|
||
11 years ago
|
* Do not use BaseMarkdown. Use [[Markdown]] instead.
|
||
12 years ago
|
*
|
||
|
* @author Alexander Makarov <sam@rmcreative.ru>
|
||
|
* @since 2.0
|
||
|
*/
|
||
11 years ago
|
class BaseMarkdown
|
||
12 years ago
|
{
|
||
|
/**
|
||
|
* @var MarkdownExtra
|
||
|
*/
|
||
|
protected static $markdown;
|
||
|
|
||
12 years ago
|
/**
|
||
|
* Converts markdown into HTML
|
||
|
*
|
||
|
* @param string $content
|
||
|
* @param array $config
|
||
|
* @return string
|
||
|
*/
|
||
12 years ago
|
public static function process($content, $config = array())
|
||
|
{
|
||
12 years ago
|
if (static::$markdown === null) {
|
||
12 years ago
|
static::$markdown = new MarkdownExtra();
|
||
|
}
|
||
|
foreach ($config as $name => $value) {
|
||
|
static::$markdown->{$name} = $value;
|
||
|
}
|
||
|
return static::$markdown->transform($content);
|
||
|
}
|
||
|
}
|