.

ConverterHtmlPurifierAutoParagraph Class Reference
[HtmlPurifier]

Convert HTML to purified HTML, automatically inserting paragraphps. More...

Inheritance diagram for ConverterHtmlPurifierAutoParagraph:
ConverterHtmlPurifier IConverter

List of all members.

Public Member Functions

  encode ($value, $params=false)
  Purify HTML.

Detailed Description

Convert HTML to purified HTML, automatically inserting paragraphps.

Author:
Gerd Riesselmann

Definition at line 8 of file htmlpurifier.autoparagraph.converter.php.


Member Function Documentation

ConverterHtmlPurifierAutoParagraph::encode ( value,
params = false  
)

Purify HTML.

Parameters:
string  $value
array  See http://htmlpurifier.org/live/configdoc/plain.html for all possible values

Reimplemented from ConverterHtmlPurifier.

Definition at line 15 of file htmlpurifier.autoparagraph.converter.php.

00015                                                         {
00016                 if (is_null($value) || $value instanceof DBNull) {
00017                         return $value;
00018                 }
00019                 
00020                 $input = trim($value);
00021                 $input = str_replace("\r", "\n", $input);
00022                 $input = preg_replace('|<br.*?>|', "\n", $input);
00023                 $input = String::preg_replace('|\n\n+|m', "\n", $input);
00024                 $input = str_replace("\n", "\n\n", $input);
00025                 $params = array_merge(array(
00026                         'AutoFormat.RemoveEmpty' => true,
00027                         'AutoFormat.RemoveEmpty.RemoveNbsp' => true,
00028                         'AutoFormat.AutoParagraph' => true
00029                         ), Arr::force($params, false)
00030                 );
00031                 $input = parent::encode($input, $params);
00032                 $input = String::preg_replace('|\n\n+|m', "\n", $input);        
00033                 return $input;  
00034         }

The documentation for this class was generated from the following file: