Apache Zeta Components Manual :: File Source for content_module.php
Source for file content_module.php
Documentation is available at content_module.php
* File containing the ezcFeedContentModule class.
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* @version //autogentag//
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* Support for the Content module: data container, generator, parser.
* Specifications: {@link http://purl.org/rss/1.0/modules/content/}. Only support
* for the 'encoded' element of the Content module is provided.
* // $feed is an ezcFeed object
* $item = $feed->add( 'item' );
* $module = $item->addModule( 'Content' );
* $module->encoded = 'text content';
* // $item is an ezcFeedEntryElement object
* $text = $item->Content->encoded;
* @property ezcFeedTextElement $encoded
* Item-level container for text. The text is stored
* in a feed by applying htmlspecialchars() with
* ENT_NOQUOTES and restored from a feed with
* htmlspecialchars_decode() with ENT_NOQUOTES.
* @version //autogentag//
* Constructs a new ezcFeedContentModule object.
* @param string $level The level of the data container ('feed' or 'item')
* Sets the property $name to $value.
* @throws ezcBasePropertyNotFoundException
* if the property $name is not defined
* @param string $name The property name
* @param mixed $value The property value
public function __set( $name, $value )
$node =
$this->add( $name );
parent::__set( $name, $value );
* Returns the value of property $name.
* @throws ezcBasePropertyNotFoundException
* if the property $name is not defined
* @param string $name The property name
public function __get( $name )
return parent::__get( $name );
* Returns if the property $name is set.
* @param string $name The property name
public function __isset( $name )
return parent::__isset( $name );
* Returns true if the element $name is allowed in the current module at the
* current level (feed or item), and false otherwise.
* @param string $name The element name to check if allowed in the current module and level (feed or item)
// no support yet for content:encoded element at feed-level
if ( in_array( $name, array( 'encoded' ) ) )
* Adds a new ezcFeedElement element with name $name to this module and
* @throws ezcFeedUnsupportedElementException
* if trying to add an element which is not supported.
* @param string $name The element name
public function add( $name )
* Adds the module elements to the $xml XML document, in the container $root.
* @param DOMDocument $xml The XML document in which to add the module elements
* @param DOMNode $root The parent node which will contain the module elements
public function generate( DOMDocument $xml, DOMNode $root )
if ( isset
( $this->encoded ) )
$root->appendChild( $elementTag );
$elementTag->nodeValue =
htmlspecialchars( $this->encoded->__toString(), ENT_NOQUOTES );
* Parses the XML element $node and creates a feed element in the current
* module with name $name.
* @param string $name The name of the element belonging to the module
* @param DOMElement $node The XML child from which to take the values for $name
public function parse( $name, DOMElement $node )
$element =
$this->add( $name );
$value =
$node->textContent;
* Returns the module name ('Content').
* Returns the namespace for this module ('http://purl.org/rss/1.0/modules/content/').
return 'http://purl.org/rss/1.0/modules/content/';
* Returns the namespace prefix for this module ('content').