## Apache Zeta Components Manual :: Docs For Class ezcFeedITunesModule

### Feed::ezcFeedITunesModule

### Class ezcFeedITunesModule

Support for the iTunes module: data container, generator, parser.

Specifications: http://www.apple.com/itunes/store/podcaststechspecs.html.

Create example:

1. <?php
2. // $feed is an ezcFeed object
3. $item=$feed-> add ('item');
4. $module=$item->addModule('iTunes');
5. $category=$module-> add ('category');
6. $category->term='Category name';
7. // add a sub-category
8. $subCategory=$category-> add ('category');
9. $subCategory->term='Sub-category name';
10. ?>

Parse example:

1. <?php
2. // $feed is an ezcFeed object
3. if(isset($feed->iTunes) )
4. {
5. $iTunes=$feed->iTunes;
6. if(isset($iTunes->category) )
7. {
8. foreach($iTunes->categoryas$category)
9. {
10. echo$category->term;
11. if(isset($category->category) )
12. {
13. foreach($category->categoryas$subCategory)
14. {
15. echo$subCategory->term;
16. }
17. }
18. }
19. }
20. }
21. ?>

Source for this file: /Feed/src/modules/itunes_module.php

    ezcFeedModule
       |
       --ezcFeedITunesModule

Version: | //autogentag//

### Properties

ezcFeedPersonElement | read/write | `$author` The author of a resource. Can appear at both feed-level and item-level.
ezcFeedTextElement | read/write | `$block` Prevents a feed or a feed item to appear. Can appear at both feed-level and item-level. Valid values are 'yes' and 'no', default 'no'.
array(ezcFeedCategoryElement) | read/write | `$category` Categories for a feed. Can appear at feed-level only. Multiple categories can be specified, and categories can have sub-categories. The ampersands (&) in categories must be escaped to &amp;. Valid iTunes categories
ezcFeedTextElement | read/write | `$duration` The duration of a feed item. Can appear at item-level only. Can be specified as HH:MM:SS, H:MM:SS, MM:SS, M:SS or S (H = hours, M = minutes, S = seconds).
ezcFeedTextElement | read/write | `$explicit` Specifies if a feed or feed-item contains explicit content. Can appear at both feed-level and item-level. Valid values are 'clean', 'no' and 'yes', default 'no'.

ezcFeedImageElement

read/write

`$image`
A link to an image for the feed. Can appear at both feed-level and item-level only. The iTunes specifications says that image is supported at feed-level only, but there are many podcasts using image at item-level also, and there are software applications supporting image at item-level too. Use image at item-level at your own risk, as some software applications might not support it. The Feed component supports parsing and generating feeds with image at both feed-level and item-level.

ezcFeedTextElement | read/write | `$keywords` A list of keywords for a feed or feed item. Can appear at both feed-level and item-level. The keywords should be separated by commas.
ezcFeedLinkElement | read/write | `$newfeedurl` A new URL for the feed. Can appear at feed-level only. In XML it will appear as 'new-feed-url'.
ezcFeedPersonElement | read/write | `$owner` The owner of the feed. Can appear at feed-level only.
ezcFeedTextElement | read/write | `$subtitle` Short description of a feed or feed item. Can appear at both feed-level and item-level.
ezcFeedTextElement | read/write | `$summary` Longer description of a feed or feed item. Can appear at both feed-level and item-level.

### Inherited Member Variables

From ezcFeedModule
protected | `ezcFeedModule::$level`
protected | `ezcFeedModule::$properties`

### Method Summary

public static string | `getModuleName( )` Returns the module name ('iTunes').
public static string | `getNamespace( )` Returns the namespace for this module ('http://www.itunes.com/dtds/podcast-1.0.dtd').
public static string | `getNamespacePrefix( )` Returns the namespace prefix for this module ('itunes').
public ezcFeedITunesModule | `__construct( [ $level = 'feed'] )` Constructs a new ezcFeedITunesModule object.
public ezcFeedElement | `add( $name )` Adds a new ezcFeedElement element with name $name to this module and returns it.
public void | `generate( $xml , $root )` Adds the module elements to the $xml XML document, in the container $root.
public bool | `isElementAllowed( $name )` Returns true if the element $name is allowed in the current module at the current level (feed or item), and false otherwise.
public void | `parse( $name , $node )` Parses the XML element $node and creates a feed element in the current module with name $name.

### Inherited Methods

From ezcFeedModule
public ezcFeedModule | `ezcFeedModule::__construct()` Constructs a new ezcFeedModule object.
public abstract ezcFeedElement | `ezcFeedModule::add()` Adds a new ezcFeedElement element with name $name to this module and returns it.
public static ezcFeedModule | `ezcFeedModule::create()` Returns a new instance of the $name module with data container level $level.
public abstract void | `ezcFeedModule::generate()` Adds the module elements to the $xml XML document, in the container $root.
public abstract bool | `ezcFeedModule::isElementAllowed()` Returns true if the element $name is allowed in the current module at the current level (feed or item), and false otherwise.
public abstract void | `ezcFeedModule::parse()` Parses the XML element $node and creates a feed element in the current module with name $name.

### Methods

#### getModuleName

static string getModuleName( )

Returns the module name ('iTunes').

#### getNamespace

static string getNamespace( )

Returns the namespace for this module ('http://www.itunes.com/dtds/podcast-1.0.dtd').

#### getNamespacePrefix

static string getNamespacePrefix( )

Returns the namespace prefix for this module ('itunes').

#### __construct

ezcFeedITunesModule __construct( [string $level = 'feed'] )

Constructs a new ezcFeedITunesModule object.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$level` | string | The level of the data container ('feed' or 'item')

##### Redefinition of:

Method | Description
--- | ---
`ezcFeedModule::__construct()` | Constructs a new ezcFeedModule object.

#### add

ezcFeedElement add( string $name )

Adds a new ezcFeedElement element with name $name to this module and returns it.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$name` | string | The element name

##### Exceptions:

Type | Description
--- | ---
`ezcFeedUnsupportedElementException` | if trying to add an element which is not supported.

##### Redefinition of:

Method | Description
--- | ---
`ezcFeedModule::add()` | Adds a new ezcFeedElement element with name $name to this module and returns it.

#### generate

void generate( $xml , $root )

Adds the module elements to the $xml XML document, in the container $root.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$xml` | DOMDocument | The XML document in which to add the module elements
`$root` | DOMNode | The parent node which will contain the module elements

##### Redefinition of:

Method | Description
--- | ---
`ezcFeedModule::generate()` | Adds the module elements to the $xml XML document, in the container $root.

#### isElementAllowed

bool isElementAllowed( string $name )

Returns true if the element $name is allowed in the current module at the current level (feed or item), and false otherwise.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$name` | string | The element name to check if allowed in the current module and level (feed or item)

##### Redefinition of:

Method | Description
--- | ---
`ezcFeedModule::isElementAllowed()` | Returns true if the element $name is allowed in the current module at the current level (feed or item), and false otherwise.

#### parse

void parse( string $name , $node )

Parses the XML element $node and creates a feed element in the current module with name $name.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$name` | string | The name of the element belonging to the module
`$node` | DOMElement | The XML child from which to take the values for $name

##### Redefinition of:

Method | Description
--- | ---
`ezcFeedModule::parse()` | Parses the XML element $node and creates a feed element in the current module with name $name.

Documentation generated by phpDocumentor 1.4.3