Skip to content

Commit

Permalink
Make CFormatter::formatHtml() more customizable.
Browse files Browse the repository at this point in the history
  • Loading branch information
resurtm committed Nov 4, 2012
1 parent 16f128d commit 6d10c0b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -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: Value of the CHtml::activeTextArea() can now be set through $htmlOptions['value'] (resurtm)
- Enh: Allow to customize CHtml::error() container tag (creocoder) - Enh: Allow to customize CHtml::error() container tag (creocoder)
- Enh: CModule::setComponents() now can reconfigure already loaded components (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 #1373: Upgraded jquery star rating to 3.14 (samdark)
- Chg #1563: Updated CTestCase for PHPUnit 3.7.7+ (tanakahisateru, samdark) - Chg #1563: Updated CTestCase for PHPUnit 3.7.7+ (tanakahisateru, samdark)
- Chg: MSSQL unit tests updated and actualized, added SQLSRV driver support (resurtm) - Chg: MSSQL unit tests updated and actualized, added SQLSRV driver support (resurtm)
Expand Down
10 changes: 10 additions & 0 deletions framework/utils/CFormatter.php
Expand Up @@ -47,6 +47,9 @@
*/ */
class CFormatter extends CApplicationComponent class CFormatter extends CApplicationComponent
{ {
/**
* @var CHtmlPurifier
*/
private $_htmlPurifier; private $_htmlPurifier;


/** /**
Expand All @@ -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>. * to the text display for false, the second element for true. Defaults to <code>array('No', 'Yes')</code>.
*/ */
public $booleanFormat=array('No','Yes'); 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". * @var array the format used to format size (bytes). Two elements may be specified: "base" and "decimals".
Expand Down Expand Up @@ -263,6 +272,7 @@ public function getHtmlPurifier()
{ {
if($this->_htmlPurifier===null) if($this->_htmlPurifier===null)
$this->_htmlPurifier=new CHtmlPurifier; $this->_htmlPurifier=new CHtmlPurifier;
$this->_htmlPurifier->options=$this->htmlPurifierOptions;
return $this->_htmlPurifier; return $this->_htmlPurifier;
} }


Expand Down

0 comments on commit 6d10c0b

Please sign in to comment.