Skip to end of metadata
Go to start of metadata

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_Filter_StringAppend & Zend_Filter_StringPrepend Component Proposal

Proposed Component Name Zend_Filter_StringAppend & Zend_Filter_StringPrepend
Developer Notes & Zend_Filter_StringPrepend
Proposers Thomas Weidner
Zend Liaison TBD
Revision 1.0 - 14 May 2010: Initial (wiki revision: 3)

Table of Contents

1. Overview

Zend_Filter_StringAppend and Zend_Filter_StringPrepend are filters which allow to append or prepend a string with a certain content to a given string.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will append and prepend strings.
  • This component will not work on resources like files.

4. Dependencies on Other Framework Components

  • Zend_Filter

5. Theory of Operation

Zend_Filter_StringAppend can append a string to a string. It can be used to detect if the given string is already appended (per option). In this case, if set, no string will be appended. Zend_Filter_StringPrepend works reverse.

6. Milestones / Tasks

  • Milestone 1: [DONE] Proposal finished
  • Milestone 2: Proposal accepted
  • Milestone 3: Working implementation
  • Milestone 4: Unit tests
  • Milestone 5: Documentation
  • Milestone 6: Moved to core

7. Class Index

  • Zend_Filter_StringAppend
  • Zend_Filter_StringPrepend

8. Use Cases


Prepend a string



Prepend a string but only if it does not already exist



Append a string but only if a collection of strings does not already exist


INPUT: "http://www.example"

9. Class Skeletons



Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jul 28, 2010

    <p>Could you give some extra usecases aside from url's?</p>

    1. Jul 30, 2010

      <p>// My content</p>

      <p>Quoting a text:<br />
      $filter = new Zend_Filter_StringPrepend('>');</p>

      <p>// makes ">My content"</p>

      <p>Making a XML from a userentry:<br />
      $filter = new Zend_Filter_StringPrepend('<entry>');<br />
      $filter = new Zend_Filter_StringAppend('</entry>');</p>

      <p>// makes "<entry>My content</entry>"</p>

  2. Aug 03, 2010

    <ac:macro ac:name="note"><ac:rich-text-body><p><strong>Community Review Team Recommendation</strong></p>

    <p>The CR Team advises that this proposal be approved.</p></ac:rich-text-body></ac:macro>

  3. Aug 20, 2010

    <p>What is the output expected for an empty input?</p>

    <p>Take the example of a Zend_Form_Element_Text that will yield information url. We want to protect the input with this filter for users who do not follow the instructions to know if 'http://' must be filled in the field or not. This field is optional in this case. And, we also want to use Zend_Filter_Null. What will be the output? null or 'http://'?</p>

    1. Aug 28, 2010

      <p>You need to do a proper filter chaining or proper options on the form element.</p>

      <p>Using Zend_Filter_Append standalone the string will be appended using the examples from the usecase. Using isEmpty on the form field will stop any further processing.</p>

      <p>This is something which is done by Zend_Form_Element and not by this filter.</p>