Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make CFormatter::formatHtml() more customizable.

  • Loading branch information...
commit 6d10c0bba15a43bb29722910e45629b22d568929 1 parent 16f128d
resurtm resurtm authored
Showing with 11 additions and 0 deletions.
  1. +1 −0  CHANGELOG
  2. +10 −0 framework/utils/CFormatter.php
1  CHANGELOG
View
@@ -74,6 +74,7 @@ Version 1.1.13 work in progress
- Enh: Value of the CHtml::activeTextArea() can now be set through $htmlOptions['value'] (resurtm)
- Enh: Allow to customize CHtml::error() container tag (creocoder)
- Enh: CModule::setComponents() now can reconfigure already loaded components (creocoder)
+- Enh: CFormatter::formatHtml() is now more flexible and customizable through new CFormatter::$htmlPurifierOptions property (resurtm)
- Chg #1373: Upgraded jquery star rating to 3.14 (samdark)
- Chg #1563: Updated CTestCase for PHPUnit 3.7.7+ (tanakahisateru, samdark)
- Chg: MSSQL unit tests updated and actualized, added SQLSRV driver support (resurtm)
10 framework/utils/CFormatter.php
View
@@ -47,6 +47,9 @@
*/
class CFormatter extends CApplicationComponent
{
+ /**
+ * @var CHtmlPurifier
+ */
private $_htmlPurifier;
/**
@@ -73,6 +76,12 @@ class CFormatter extends CApplicationComponent
* to the text display for false, the second element for true. Defaults to <code>array('No', 'Yes')</code>.
*/
public $booleanFormat=array('No','Yes');
+ /**
+ * @var array the options to be passed to CHtmlPurifer instance used in this class. CHtmlPurifer is used
+ * in {@link formatHtml} method, so this property could be useful to customize HTML filtering behavior.
+ * @since 1.1.13
+ */
+ public $htmlPurifierOptions=array();
/**
* @var array the format used to format size (bytes). Two elements may be specified: "base" and "decimals".
@@ -263,6 +272,7 @@ public function getHtmlPurifier()
{
if($this->_htmlPurifier===null)
$this->_htmlPurifier=new CHtmlPurifier;
+ $this->_htmlPurifier->options=$this->htmlPurifierOptions;
return $this->_htmlPurifier;
}
Please sign in to comment.
Something went wrong with that request. Please try again.