diff options
Diffstat (limited to 'vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php')
-rw-r--r-- | vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php index 1585131c7..d891ef41c 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php @@ -100,6 +100,47 @@ class Item public $language = ''; /** + * Raw XML + * + * @access public + * @var \SimpleXMLElement + */ + public $xml; + + /** + * List of namespaces + * + * @access public + * @var array + */ + public $namespaces = array(); + + /** + * Get specific XML tag or attribute value + * + * @access public + * @param string $tag Tag name (examples: guid, media:content) + * @param string $attribute Tag attribute + * @return string + */ + public function getTag($tag, $attribute = '') + { + // Get namespaced value + if (strpos($tag, ':') !== false) { + list(,$tag) = explode(':', $tag); + return XmlParser::getNamespaceValue($this->xml, $this->namespaces, $tag, $attribute); + } + + // Return attribute value + if (! empty($attribute)) { + return (string) $this->xml->{$tag}[$attribute]; + } + + // Return tag content + return (string) $this->xml->$tag; + } + + /** * Return item information * * @access public |