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

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

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

{zone-data:revision}
1.0 - 29 November 2009: Initial Draft.
{zone-data}

{zone-data:overview}
Zend_Filter_Phone is a filter which converts numeric input to a phone number.
{zone-data}

{zone-data:references}
* [Wikipedia - Telephone Numbers|http://en.wikipedia.org/wiki/Telephone_number]
* [Wikipedia - E.123|http://en.wikipedia.org/wiki/E.123]
* [ITU-T|http://www.itu.int/rec/recommendation.asp?type=items&lang=e&parent=T-REC-E.123-200102-I]
* [Country Calling Code|http://en.wikipedia.org/wiki/Country_calling_code]
* [Wikipedia - North American Number Plan|http://en.wikipedia.org/wiki/North_American_Numbering_Plan]
* [Zend_Validate_Phone|http://framework.zend.com/wiki/display/ZFPROP/Zend_Validate_Phone+-+Thomas+Weidner]
{zone-data}

{zone-data:requirements}
* This component *will* convert numeric input to conform a specified phone number format.
* This component *will* support national and international formats.
* This component *will* support definition of propritary formats.
* This component *will* provide and use the same API as Zend_Validate_Phone
{zone-data}

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

{zone-data:operation}
This components changes a given input so it conforms a given phone number format. You could give a number and convert it into an international format or a national format simply by changing one spezifier. You could also seperate the different number tokens of which a phone number consists.
{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_Phone
{zone-data}

{zone-data:use-cases}
||UC-01||
{code}
$filter = new Zend_Filter_Phone('en_US');
$filter->filter('2571234567');
// output could be "1 (257) 12345 - 67"
{code}
||UC-02||
{code}
$filter = new Zend_Filter_Phone();
$filter->setFormat(
Zend_Filter_Phone::INTERNATIONAL + Zend_Filter_Phone::PREFIX
);
$filter->filter('2571234567');
// output could be "1 (257)"
{code}
||UC-03||
{code}
$filter = new Zend_Filter_Phone();
$filter->setFormat(
Zend_Filter_Phone::TOKENIZE
);
$filter->filter('2571234567');
/* output could be
array(
'international' => 1,
'prefix' => 257,
'local' => 12345
'extension' => 67
);
{code}
{zone-data}

{zone-data:skeletons}
{code}
class Zend_Filter_Phone {
public function getFormat();
public function setFormat($format);
public function getLocale();
public function setLocale($locale);
public function filter($value);
}
{code}
{zone-data}

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