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.
		
		
		
		
			
				
					35 lines
				
				918 B
			
		
		
			
		
	
	
					35 lines
				
				918 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
										 | 
 | ||
|  | /**
 | ||
| 
											12 years ago
										 |  * BaseHtmlPurifier provides concrete implementation for [[HtmlPurifier]].
 | ||
| 
											13 years ago
										 |  *
 | ||
| 
											12 years ago
										 |  * Do not use BaseHtmlPurifier. Use [[HtmlPurifier]] instead.
 | ||
| 
											13 years ago
										 |  *
 | ||
|  |  * @author Alexander Makarov <sam@rmcreative.ru>
 | ||
|  |  * @since 2.0
 | ||
|  |  */
 | ||
| 
											12 years ago
										 | class BaseHtmlPurifier
 | ||
| 
											13 years ago
										 | {
 | ||
| 
											13 years ago
										 | 	/**
 | ||
|  | 	 * Passes markup through HTMLPurifier making it safe to output to end user
 | ||
|  | 	 *
 | ||
|  | 	 * @param string $content
 | ||
|  | 	 * @param array|null $config
 | ||
|  | 	 * @return string
 | ||
|  | 	 */
 | ||
| 
											13 years ago
										 | 	public static function process($content, $config = null)
 | ||
|  | 	{
 | ||
| 
											13 years ago
										 | 		$configInstance = \HTMLPurifier_Config::create($config);
 | ||
|  | 		$configInstance->autoFinalize = false;
 | ||
|  | 		$purifier=\HTMLPurifier::instance($configInstance);
 | ||
| 
											13 years ago
										 | 		$purifier->config->set('Cache.SerializerPath', \Yii::$app->getRuntimePath());
 | ||
|  | 		return $purifier->purify($content);
 | ||
|  | 	}
 | ||
|  | }
 |