| @@ 9-53 (lines=45) @@ | ||
| 6 | use HTMLPurifier; |
|
| 7 | use HTMLPurifier_Config; |
|
| 8 | ||
| 9 | class BlogArticlesComment extends Entity |
|
| 10 | { |
|
| 11 | ||
| 12 | /** |
|
| 13 | * Fields that can be mass assigned using newEntity() or patchEntity(). |
|
| 14 | * |
|
| 15 | * @var array |
|
| 16 | */ |
|
| 17 | protected $_accessible = [ |
|
| 18 | '*' => true, |
|
| 19 | 'id' => false, |
|
| 20 | ]; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * Get the comment content purified with HTMLPurifier. |
|
| 24 | * |
|
| 25 | * @param string $content The content to be purified. |
|
| 26 | * |
|
| 27 | * @return string |
|
| 28 | */ |
|
| 29 | protected function _getContent($content) |
|
| 30 | { |
|
| 31 | $config = HTMLPurifier_Config::createDefault(); |
|
| 32 | $config->loadArray(Configure::read('HtmlPurifier.Blog.comment')); |
|
| 33 | ||
| 34 | $HTMLPurifier = new HTMLPurifier($config); |
|
| 35 | ||
| 36 | return $HTMLPurifier->purify($content); |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * Get the comment content purified with HTMLPurifier. |
|
| 41 | * |
|
| 42 | * @return string |
|
| 43 | */ |
|
| 44 | protected function _getContentEmpty() |
|
| 45 | { |
|
| 46 | $config = HTMLPurifier_Config::createDefault(); |
|
| 47 | $config->loadArray(Configure::read('HtmlPurifier.Blog.comment_empty')); |
|
| 48 | ||
| 49 | $HTMLPurifier = new HTMLPurifier($config); |
|
| 50 | ||
| 51 | return $HTMLPurifier->purify($this->content); |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| @@ 9-53 (lines=45) @@ | ||
| 6 | use HTMLPurifier; |
|
| 7 | use HTMLPurifier_Config; |
|
| 8 | ||
| 9 | class ConversationsMessage extends Entity |
|
| 10 | { |
|
| 11 | ||
| 12 | /** |
|
| 13 | * Fields that can be mass assigned using newEntity() or patchEntity(). |
|
| 14 | * |
|
| 15 | * @var array |
|
| 16 | */ |
|
| 17 | protected $_accessible = [ |
|
| 18 | '*' => true, |
|
| 19 | 'id' => false, |
|
| 20 | ]; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * Purify the message for display the message. |
|
| 24 | * |
|
| 25 | * @param string $content The message to be purified. |
|
| 26 | * |
|
| 27 | * @return string |
|
| 28 | */ |
|
| 29 | protected function _getMessage($content) |
|
| 30 | { |
|
| 31 | $config = HTMLPurifier_Config::createDefault(); |
|
| 32 | $config->loadArray(Configure::read('HtmlPurifier.Conversations.message')); |
|
| 33 | ||
| 34 | $HTMLPurifier = new HTMLPurifier($config); |
|
| 35 | ||
| 36 | return $HTMLPurifier->purify($content); |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * Purify the message for display the message. |
|
| 41 | * |
|
| 42 | * @return string |
|
| 43 | */ |
|
| 44 | protected function _getMessageEmpty() |
|
| 45 | { |
|
| 46 | $config = HTMLPurifier_Config::createDefault(); |
|
| 47 | $config->loadArray(Configure::read('HtmlPurifier.Conversations.message_empty')); |
|
| 48 | ||
| 49 | $HTMLPurifier = new HTMLPurifier($config); |
|
| 50 | ||
| 51 | return $HTMLPurifier->purify($this->message); |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||