contributions/text.htmlpurifier/model/base/fields/dbfield.text.htmlpurified.cls.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * A DB Text field holding HTML that automatically gets purified before it is written to DB 00004 * 00005 * This class is rather generic. You can overload it to apply more specialized conversion. 00006 * 00007 * @deprecated It is recommended to use DBFieldTextHtml instead, which is much more flexible. 00008 * 00009 * @ingroup HtmlPurifier 00010 * @author Gerd Riesselmann 00011 */ 00012 class DBFieldTextHtmlPurified extends DBFieldText { 00013 /** 00014 * Constructor 00015 * 00016 * Since TEXT is more likely than varchar, default length is TEXT 00017 */ 00018 public function __construct($name, $length = DBFieldText::BLOB_LENGTH_SMALL, $default_value = null, $policy = self::NONE) { 00019 parent::__construct($name, $length, $default_value, $policy); 00020 } 00021 00022 /** 00023 * Format values that are not NULL 00024 * 00025 * @param mixed $value 00026 * @return string 00027 */ 00028 protected function do_format_not_null($value) { 00029 return parent::format($this->apply_conversion($value)); 00030 } 00031 00032 /** 00033 * To be overloaded: Apply conversion 00034 * 00035 * @param string $value 00036 * @return string 00037 */ 00038 protected function apply_conversion($value) { 00039 return ConverterFactory::encode($value, CONVERTER_HTMLPURIFIER); 00040 } 00041 }