14.5. Filters

Filters modify data. The filter infrastructure provides a simple chaining mechanism so that filters can be applied in a specified order. Filters can be called explicitly or used implicitly wherever filters are commonly used, for example, for form elements. Place filter classes in the module folder, in the filters folder.

Here is the skeleton of a filter to perform operation bar for the Foo module:

<?php
/**
 * Filter description
 *
 * @copyright   copyright info
 * @license     license info
 * @version     version info
 */
class Foo_Filter_Bar implements Zend_Filter_Interface
{
    /**
     * Description
     *
     * @param  string  $value  The value to be filtered.
     */
    public function filter($value)
    {
        // perform 'bar' operation to create $filtered
        return $filtered;
    }
}

For details, see the Zend Framework documentation.

Perforce Chronicle - Release: 2012.2/486814