View Source

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

{zone-data:component-name}
Zend_Filter_Sanitize (formerly Zend_Filter_SeoUrl)
{zone-data}

{zone-data:proposer-list}
[Martin Hujer|mailto:mhujer@gmail.com]
[Alexander Veremyev (Zend Liaison)|~alexander]
{zone-data}

{zone-data:revision}
1.0 - 24th January 2008: Initial proposal
1.1 - 28th January 2008: Renamed to Zend_Filter_Sanitize
{zone-data}

{zone-data:overview}
Zend_Filter_Sanitize is a component that converts string into SEO friendly url.
{zone-data}

{zone-data:references}
* [Jakub Vrána - Vytvo?ení p?átelského URL (czech)|http://php.vrana.cz/vytvoreni-pratelskeho-url.php]
{zone-data}

{zone-data:requirements}
* This filter *must* convert any string to seo url without any setting
* This component *will* correctly converts string into SEO url.
* This component *will* put all characters in lowercase.
* This component *will* translate special chars such as *'?'* or *'?'* into *'c'* and *'u'* (included in [Zend_Filter_Transliteration|http://framework.zend.com/wiki/display/ZFPROP/Zend_Filter_Transliteration+-+Martin+Hujer])
* This component *will* allow to change the word delimiter character (default are (' ', '.', '\\', '/', '-', '_'))
* This component *will* allow to change the delimiter replacement character (default is dash)
* This component *will* strip characters, which are not allowed in url.
{zone-data}

{zone-data:dependencies}
* Zend_Filter_Interface
* Zend_Filter_Exception
* Zend_Filter_StringToLower
* Zend_Filter_StringTrim
* [Zend_Filter_Transliteration|http://framework.zend.com/wiki/display/ZFPROP/Zend_Filter_Transliteration+-+Martin+Hujer]

{zone-data}

{zone-data:operation}
...
{zone-data}

{zone-data:milestones}
* Milestone 1: \[DONE\] Finalize this proposal
* Milestone 2: \[DONE\] Working prototype checked into the http://zfdev.googlecode.com/svn/trunk/ZendFilterSanitize/
* Milestone 3: \[DONE\] Unit tests exist, work, and are checked into SVN.
* Milestone 4: Community and Zend review
{zone-data}

{zone-data:class-list}
* Zend_Filter_Sanitize
{zone-data}

{zone-data:use-cases}
{composition-setup}

{deck:id=use-cases1}

{card:label=UC 1: simple usage}
{code:type=php}
<?php
$text = "Hello World";
$filter = new Zend_Filter_Sanitize();
echo $filter->filter(text); //prints 'hello-world';
{code}
{card}

{card:label=UC 2: set delimiter replacement}
{code:type=php}
<?php
$text = "Hello World";
$filter = new Zend_Filter_Sanitize();
$filter->setDelimiterReplacement('_');
echo $filter->filter(text); //prints 'hello_world';
{code}
{card}


{card:label=UC 3: set word delimiters}
{code:type=php}
<?php
$text = "Hello=World";
$filter = new Zend_Filter_Sanitize();
$filter->addWordDelimiter('=');
echo $filter->filter(text); //prints 'hello-world';
{code}
{card}

{card:label=UC 4: complex example}
{code:type=php}
<?php
$text = "Hello=World!Yeah";
$filter = new Zend_Filter_Sanitize();
$filter->addWordDelimiter(array('=', '!'));
$filter->setDelimiterReplacement(':');
echo $filter->filter(text); //prints 'hello:world:yeah';
{code}
{card}

{card:label=UC 5: set not converted chars}
{code:type=php}
<?php
$filter = new Zend_Filter_Sanitize();
$filter->addNotReplacedChars('.');
$string = "MoZIlla FiREfOx 1.0.0.12.EXE";
echo $filter->filter($string); // prints 'mozilla-firefox-1.0.0.12.exe'
{code}
{card}

{deck}
{zone-data}

{zone-data:skeletons}
{code}
class Zend_Filter_Sanitize implements Zend_Filter_Interface
{
public function filter ($s) {}

public function setDelimiterReplacement ($delimiterReplacement) {}

public function getDelimiterReplacement () {}

public function getWordDelimiters () {}

public function addWordDelimiter ($delimiter) {}
}
{code}
{zone-data}

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