View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFPROP:Proposal Zone Template}

{zone-data:component-name}
Zend_Filter_StringAppend & Zend_Filter_StringPrepend
{zone-data}

{zone-data:proposer-list}
[~thomas]
{zone-data}

{zone-data:liaison}
TBD
{zone-data}

{zone-data:revision}
1.0 - 14 May 2010: Initial
{zone-data}

{zone-data: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.
{zone-data}

{zone-data:references}
{zone-data}

{zone-data:requirements}
* This component *will* append and prepend strings.
* This component *will not* work on resources like files.
{zone-data}

{zone-data:dependencies}
* Zend_Filter
{zone-data}

{zone-data: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.
{zone-data}

{zone-data:milestones}
* 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
{zone-data}

{zone-data:class-list}
* Zend_Filter_StringAppend
* Zend_Filter_StringPrepend
{zone-data}

{zone-data:use-cases}
||UC-01||
Prepend a string
{code}
$filter = new Zend_Filter_StringPrepend('http://');
{code}
INPUT: "www.example.com"
OUTPUT: "http://www.example.com"

||UC-02||
Prepend a string but only if it does not already exist
{code}
$filter = new Zend_Filter_StringPrepend(array('content' => 'http://', 'single' => true);
{code}
INPUT: "http://www.example.com"
OUTPUT: "http://www.example.com"

||UC-03||
Append a string but only if a collection of strings does not already exist
{code}
$filter = new Zend_Filter_StringAppend(array('content' => '.com', 'single' => array('.com', '.gov', '.net'));
{code}
INPUT: "http://www.example.gov"
OUTPUT: "http://www.example.gov"

INPUT: "http://www.example"
OUTPUT: "http://www.example.com"
{zone-data}

{zone-data:skeletons}
{code}
class Zend_Filter_Append{
public function __construct();
public function getContent();
public function setContent($content);
public function getSingle();
public function setSingle($single);
public function filter($filter);
}

class Zend_Filter_Prepend{
public function __construct();
public function getContent();
public function setContent($content);
public function getSingle();
public function setSingle($single);
public function filter($filter);
}
{code}
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>