Introduction to Zend Framework

 Learning Zend Framework

appendix

 Zend Framework Reference


  •  Zend_Gdata
  •  Zend_Http
  •  Zend_InfoCard
  •  Zend_Json
  •  Zend_Layout
  •  Zend_Ldap
  •  Zend_Loader
  •  Zend_Locale
  •  Zend_Log
  •  Zend_Mail
  •  Zend_Markup
  •  Zend_Measure
  •  Zend_Memory
  •  Zend_Mime
  •  Zend_Navigation
  •  Zend_Oauth
  •  Zend_OpenId
  •  Zend_Paginator
  •  Zend_Pdf
  •  Zend_ProgressBar
  •  Zend_Queue
  •  Zend_Reflection
  •  Zend_Registry
  •  Zend_Rest

  •  Zend_Search_Lucene
  •  Zend_Serializer
  •  Zend_Server
  •  Zend_Service
  •  Zend_Session
  •  Zend_Soap
  •  Zend_Tag
  •  Zend_Test
  •  Zend_Text
  •  Zend_TimeSync
  •  Zend_Tool
  •  Zend_Tool_Framework
  •  Zend_Tool_Project
  •  Zend_Translate
  •  Zend_Uri
  •  Zend_Validate
  •  Zend_Version
  •  Zend_View
  •  Zend_Wildfire
  •  Zend_XmlRpc
  • ZendX_Console_Process_Unix
  • ZendX_JQuery
  • Update 2011-11-16 - Revision 24438 - Version ZF 1.11.x

    34.4. Writing Filters

    Zend_Filter supplies a set of commonly needed filters, but developers will often need to write custom filters for their particular use cases. The task of writing a custom filter is facilitated by implementing Zend_Filter_Interface.

    Zend_Filter_Interface defines a single method, filter(), that may be implemented by user classes. An object that implements this interface may be added to a filter chain with Zend_Filter::addFilter().

    The following example demonstrates how to write a custom filter:

    class MyFilter implements Zend_Filter_Interface
    {
        public function 
    filter($value)
        {
            
    // perform some transformation upon $value to arrive on $valueFiltered

            
    return $valueFiltered;
        }
    }

    To add an instance of the filter defined above to a filter chain:

    $filterChain = new Zend_Filter();
    $filterChain->addFilter(new MyFilter());
    digg delicious meneame google twitter technorati facebook

    Comments

    Loading...