Moving NoHTML function from Text to StringField

This change will make the NoHTML function available for Varchar fields in particular.
This commit is contained in:
JorisDebonnet 2014-09-27 22:32:35 +02:00 committed by Loz Calver
parent a77ca1995a
commit d5361dedec
2 changed files with 10 additions and 10 deletions

View File

@ -21,6 +21,7 @@ abstract class StringField extends DBField {
'LimitWordCountXML' => 'HTMLText', 'LimitWordCountXML' => 'HTMLText',
"LowerCase" => "Text", "LowerCase" => "Text",
"UpperCase" => "Text", "UpperCase" => "Text",
'NoHTML' => 'Text',
); );
/** /**
@ -187,4 +188,13 @@ abstract class StringField extends DBField {
public function UpperCase() { public function UpperCase() {
return mb_strtoupper($this->value); 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);
}
} }

View File

@ -30,7 +30,6 @@ class Text extends StringField {
'EscapeXML' => 'Text', 'EscapeXML' => 'Text',
'LimitWordCount' => 'Text', 'LimitWordCount' => 'Text',
'LimitWordCountXML' => 'HTMLText', 'LimitWordCountXML' => 'HTMLText',
'NoHTML' => 'Text',
); );
/** /**
@ -52,15 +51,6 @@ class Text extends StringField {
DB::requireField($this->tableName, $this->name, $values, $this->default); 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. * Return the value of the field with relative links converted to absolute urls.