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
				
				911 B
			
		
		
			
		
	
	
					45 lines
				
				911 B
			| 
											13 years ago
										 | <?php
 | ||
|  | /**
 | ||
|  |  * @copyright Copyright (c) 2008 Yii Software LLC
 | ||
|  |  * @link http://www.yiiframework.com/
 | ||
|  |  * @license http://www.yiiframework.com/license/
 | ||
|  |  */
 | ||
|  | 
 | ||
| 
											12 years ago
										 | namespace yii\helpers;
 | ||
| 
											13 years ago
										 | 
 | ||
|  | use Michelf\MarkdownExtra;
 | ||
|  | 
 | ||
|  | /**
 | ||
| 
											12 years ago
										 |  * AbstractMarkdown provides concrete implementation for [[Markdown]].
 | ||
| 
											13 years ago
										 |  *
 | ||
| 
											12 years ago
										 |  * Do not use AbstractMarkdown. Use [[Markdown]] instead.
 | ||
| 
											13 years ago
										 |  *
 | ||
|  |  * @author Alexander Makarov <sam@rmcreative.ru>
 | ||
|  |  * @since 2.0
 | ||
|  |  */
 | ||
| 
											12 years ago
										 | abstract class AbstractMarkdown
 | ||
| 
											13 years ago
										 | {
 | ||
|  | 	/**
 | ||
|  | 	 * @var MarkdownExtra
 | ||
|  | 	 */
 | ||
|  | 	protected static $markdown;
 | ||
|  | 
 | ||
| 
											13 years ago
										 | 	/**
 | ||
|  | 	 * Converts markdown into HTML
 | ||
|  | 	 *
 | ||
|  | 	 * @param string $content
 | ||
|  | 	 * @param array $config
 | ||
|  | 	 * @return string
 | ||
|  | 	 */
 | ||
| 
											13 years ago
										 | 	public static function process($content, $config = array())
 | ||
|  | 	{
 | ||
| 
											13 years ago
										 | 		if (static::$markdown === null) {
 | ||
| 
											13 years ago
										 | 			static::$markdown = new MarkdownExtra();
 | ||
|  | 		}
 | ||
|  | 		foreach ($config as $name => $value) {
 | ||
|  | 			static::$markdown->{$name} = $value;
 | ||
|  | 		}
 | ||
|  | 		return static::$markdown->transform($content);
 | ||
|  | 	}
 | ||
|  | }
 |