From aef064b16ef0d889f44fc80d3eefc15bfc818127 Mon Sep 17 00:00:00 2001 From: Maki Takahashi Date: Tue, 15 Nov 2011 11:11:51 +0900 Subject: [PATCH 1/2] (refs #3665, BP from #2497) changed opWidgetFormRichTextarea::render() without use sfWidget::fixDoubleEscape() --- lib/widget/opWidgetFormRichTextarea.class.php | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/widget/opWidgetFormRichTextarea.class.php b/lib/widget/opWidgetFormRichTextarea.class.php index 8981eee86..90ddea52a 100644 --- a/lib/widget/opWidgetFormRichTextarea.class.php +++ b/lib/widget/opWidgetFormRichTextarea.class.php @@ -64,6 +64,17 @@ protected function getId($name, $attributes) return $tmpAttributes['id']; } + /** + * HTML特殊文字を実体参照で設定後に記号に変換されてしまう不具合修正のため、 + * fixDoubleEscape() を呼ばないようにする + * + * @see sfWidget::escapeOnce() + */ + static public function escapeOnce($value) + { + return htmlspecialchars((string) $value, ENT_QUOTES, self::getCharset()); + } + public function render($name, $value = null, $attributes = array(), $errors = array()) { if (sfConfig::get('sf_app') == 'mobile_frontend') @@ -142,7 +153,17 @@ function op_toggle_mce_editor(id) sfContext::getInstance()->getI18N()->__('Preview Mode') ); } - return $toggle.sprintf($this->getOption('textarea_template'), parent::render($name, $value, $attributes, $errors)).$js; + + return $toggle.sprintf($this->getOption('textarea_template'), $this->renderTextarea($name, $value, $attributes, $errors)).$js; + } + + /** + * + * @see sfWidgetFormTextarea::render() + */ + protected function renderTextarea($name, $value = null, $attributes = array(), $errors = array()) + { + return $this->renderContentTag('textarea', self::escapeOnce($value), array_merge(array('name' => $name), $attributes)); } } From 6f1d19397df34e6205217468393d54124a3f3e9d Mon Sep 17 00:00:00 2001 From: Maki Takahashi Date: Tue, 19 Aug 2014 11:22:39 +0900 Subject: [PATCH 2/2] (fixes #2497) rewrite description of PHPDOC in English --- lib/widget/opWidgetFormRichTextarea.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/widget/opWidgetFormRichTextarea.class.php b/lib/widget/opWidgetFormRichTextarea.class.php index 90ddea52a..a93520721 100644 --- a/lib/widget/opWidgetFormRichTextarea.class.php +++ b/lib/widget/opWidgetFormRichTextarea.class.php @@ -65,9 +65,8 @@ protected function getId($name, $attributes) } /** - * HTML特殊文字を実体参照で設定後に記号に変換されてしまう不具合修正のため、 - * fixDoubleEscape() を呼ばないようにする - * + * not call the fixDoubleEscape() to not convert the HTML special characters that set in the entity reference + * * @see sfWidget::escapeOnce() */ static public function escapeOnce($value)