From d5361dedecee991e37b6563918de0aa32c6d0f21 Mon Sep 17 00:00:00 2001 From: JorisDebonnet Date: Sat, 27 Sep 2014 22:32:35 +0200 Subject: [PATCH] Moving NoHTML function from Text to StringField This change will make the NoHTML function available for Varchar fields in particular. --- model/fieldtypes/StringField.php | 10 ++++++++++ model/fieldtypes/Text.php | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/model/fieldtypes/StringField.php b/model/fieldtypes/StringField.php index 6bc92a73b..1089becab 100644 --- a/model/fieldtypes/StringField.php +++ b/model/fieldtypes/StringField.php @@ -21,6 +21,7 @@ abstract class StringField extends DBField { 'LimitWordCountXML' => 'HTMLText', "LowerCase" => "Text", "UpperCase" => "Text", + 'NoHTML' => 'Text', ); /** @@ -187,4 +188,13 @@ abstract class StringField extends DBField { public function UpperCase() { return mb_strtoupper($this->value); } + + /** + * Return the value of the field stripped of html tags. + * + * @return string + */ + public function NoHTML() { + return strip_tags($this->value); + } } diff --git a/model/fieldtypes/Text.php b/model/fieldtypes/Text.php index 7c3a99ee6..4706408b7 100644 --- a/model/fieldtypes/Text.php +++ b/model/fieldtypes/Text.php @@ -30,7 +30,6 @@ class Text extends StringField { 'EscapeXML' => 'Text', 'LimitWordCount' => 'Text', 'LimitWordCountXML' => 'HTMLText', - 'NoHTML' => 'Text', ); /** @@ -52,15 +51,6 @@ class Text extends StringField { DB::requireField($this->tableName, $this->name, $values, $this->default); } - - /** - * Return the value of the field stripped of html tags. - * - * @return string - */ - public function NoHTML() { - return strip_tags($this->value); - } /** * Return the value of the field with relative links converted to absolute urls.