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

{zone-data:proposer-list}
[Pádraic Brady|mailto:padraic.brady@yahoo.com]
[Matthew Weier O'Phinney (Zend Liaison)|~matthew]
{zone-data}

{zone-data:revision}
1.0 - Awaiting Community Comment
{zone-data}

{zone-data:overview}
hCard is a simple microformat for representing people, groups, companies and even places. It is quite simply a publishable representation of a vCard for embedding in HTML/XHTML. If you need an example, check the source HTML for your Flickr profile.

The purpose of Zend_Microformat_Hcard is to both to collect and generate hCard data. You may collect the data from any URL, or HTML/XHTML source code, and generate hCard output using inputted data.
{zone-data}

{zone-data:references}
* [Microformats.org hCard Wiki|http://microformats.org/wiki/hcard]
* [About Microformats|http://www.microformats.org/about]
{zone-data}

{zone-data:requirements}
* This component *will* parse hCard data from any given URL.
* This component *will* parse hCard data from any given HTML/XHTML source.
* This component *will* generate hCard output for embedding in HTML based on user input.
* This component *will* present and accept data using an iterable and countable OO API.
{zone-data}

{zone-data:dependencies}
* Zend_Microformat
* Zend_Microformat_Exception
{zone-data}

{zone-data:operation}
The operation of this component is covered in the related Zend_Microformat proposal. In short, when supplied with a URL or HTML source, this component will parse out hCard data into a results object for use. It will also generate similar embeddable output.

Although this component can be used directly for specific purposes, or for implementing custom hCard forms, the majority of use cases work perfectly fine using the API supplied with Zend_Microformat.
{zone-data}

{zone-data:milestones}
* Milestone 1: Assemble some initial use cases to explore desired API
* Milestone 2: Commence proof-of-concept coding (will discard after)
* Milestone 3: Pending review, complete initial development using TDD
* Milestone 4: Complete acceptance testing, verify unit test coverage
* Milestone 5: Let's assume documentation is written during development
{zone-data}

{zone-data:class-list}
* Zend_Microformat_Hcard
* Zend_Microformat_Hcard_Entity
* Zend_Microformat_Hcard_Result
* Zend_Microformat_Hcard_Exception
{zone-data}

{zone-data:use-cases}
||UC-01||

*Fetch hCard data using default Zend_Microformat API*

{code}$mf = new Zend_Microformat('http://www.example.com');
$hcards = $mf->find('hcard');
foreach($hcards as $hcard) {
echo $hcard->nickname, ' at ', $hcard->url;
}{code}

||UC-02||

*Fetch hCard data using hCard class directly*

{code}$mfcard = new Zend_Microformat_Hcard;
$hcards = $mfcard->find('http://www.example.com');
foreach($hcards as $hcard) {
echo $hcard->nickname, ' at ', $hcard->url;
}{code}

||UC-03||

*Generating hCard embeddable output*

{code}$mfcard = new Zend_Microformat_Hcard;
$hcard = $mfcard->new();
$hcard->fn = 'someone';
$hcard->n->given-name = 'someone'
$hcard->n->nickname = 'someone';
$hcard->n->url = 'http://www.example.com';
$embeddable = $hcard->generate();
echo $embeddable; // html/xhtml to embed in a page
{code}
{zone-data}

{zone-data:skeletons}
Please see the above use cases. Based on these, source code will be developed following Test-Driven Development and therefore class skeletons will not be presented in this proposal prematurely. The TDD process will implement Zend_Microformat specifically to enable the use cases presented above.
{zone-data}

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