20.2. Standard Filter Classes

Zend Framework comes with a standard set of filters, which are ready for you to use.

20.2.1. Alnum

Returns the string $value, removing all but alphabetic and digit characters. This filter includes an option to also allow white space characters.

[Note] Note

The alphabetic characters mean characters that makes up words in each language. However, the english alphabet is treated as the alphabetic characters in following languages: Chinese, Japanese, Korean. The language is specified by Zend_Locale.

20.2.2. Alpha

Returns the string $value, removing all but alphabetic characters. This filter includes an option to also allow white space characters.

20.2.3. BaseName

Given a string containing a path to a file, this filter will return the base name of the file

20.2.4. Digits

Returns the string $value, removing all but digit characters.

20.2.5. Dir

Returns directory name component of path.

20.2.6. HtmlEntities

Returns the string $value, converting characters to their corresponding HTML entity equivalents where they exist.

20.2.7. Int

Returns (int) $value

20.2.8. StripNewlines

Returns the string $value without any newline control characters.

20.2.9. RealPath

Expands all symbolic links and resolves references to '/./', '/../' and extra '/' characters in the input path and return the canonicalized absolute pathname. The resulting path will have no symbolic link, '/./' or '/../' components.

Zend_Filter_RealPath will return FALSE on failure, e.g. if the file does not exist. On BSD systems Zend_Filter_RealPath doesn't fail if only the last path component doesn't exist, while other systems will return FALSE.

20.2.10. StringToLower

Returns the string $value, converting alphabetic characters to lowercase as necessary.

20.2.11. StringToUpper

Returns the string $value, converting alphabetic characters to uppercase as necessary.

20.2.12. StringTrim

Returns the string $value with characters stripped from the beginning and end.

20.2.13. StripTags

This filter returns the input string, with all HTML and PHP tags stripped from it, except those that have been explicitly allowed. In addition to the ability to specify which tags are allowed, developers can specify which attributes are allowed across all allowed tags and for specific tags only. Finally, this filter offers control over whether comments (e.g., <!-- ... -->) are removed or allowed.