Permalink
Browse files

replaced all calls to $this->xpath with $this->getXpath() to always h…

…ave a DOMXPath instance available
  • Loading branch information...
1 parent 2d1b40b commit f46429df5228fede6cfa4123724fcf5f5580d44e Matthias Tylkowski committed Nov 16, 2012
View
32 library/Zend/Feed/Reader/Extension/DublinCore/Entry.php
@@ -50,16 +50,16 @@ public function getAuthors()
}
$authors = array();
- $list = $this->xpath->evaluate($this->getXpathPrefix() . '//dc11:creator');
+ $list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc11:creator');
if (!$list->length) {
- $list = $this->xpath->evaluate($this->getXpathPrefix() . '//dc10:creator');
+ $list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc10:creator');
}
if (!$list->length) {
- $list = $this->xpath->evaluate($this->getXpathPrefix() . '//dc11:publisher');
+ $list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc11:publisher');
if (!$list->length) {
- $list = $this->xpath->evaluate($this->getXpathPrefix() . '//dc10:publisher');
+ $list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc10:publisher');
}
}
@@ -92,10 +92,10 @@ public function getCategories()
return $this->data['categories'];
}
- $list = $this->xpath->evaluate($this->getXpathPrefix() . '//dc11:subject');
+ $list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc11:subject');
if (!$list->length) {
- $list = $this->xpath->evaluate($this->getXpathPrefix() . '//dc10:subject');
+ $list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc10:subject');
}
if ($list->length) {
@@ -138,10 +138,10 @@ public function getDescription()
}
$description = null;
- $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:description)');
+ $description = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:description)');
if (!$description) {
- $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:description)');
+ $description = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:description)');
}
if (!$description) {
@@ -165,10 +165,10 @@ public function getId()
}
$id = null;
- $id = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:identifier)');
+ $id = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:identifier)');
if (!$id) {
- $id = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:identifier)');
+ $id = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:identifier)');
}
$this->data['id'] = $id;
@@ -188,10 +188,10 @@ public function getTitle()
}
$title = null;
- $title = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:title)');
+ $title = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:title)');
if (!$title) {
- $title = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:title)');
+ $title = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:title)');
}
if (!$title) {
@@ -215,10 +215,10 @@ public function getDate()
}
$d = null;
- $date = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:date)');
+ $date = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:date)');
if (!$date) {
- $date = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:date)');
+ $date = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:date)');
}
if ($date) {
@@ -237,7 +237,7 @@ public function getDate()
*/
protected function registerNamespaces()
{
- $this->xpath->registerNamespace('dc10', 'http://purl.org/dc/elements/1.0/');
- $this->xpath->registerNamespace('dc11', 'http://purl.org/dc/elements/1.1/');
+ $this->getXpath()->registerNamespace('dc10', 'http://purl.org/dc/elements/1.0/');
+ $this->getXpath()->registerNamespace('dc11', 'http://purl.org/dc/elements/1.1/');
}
}
View
40 library/Zend/Feed/Reader/Extension/DublinCore/Feed.php
@@ -50,16 +50,16 @@ public function getAuthors()
}
$authors = array();
- $list = $this->xpath->query('//dc11:creator');
+ $list = $this->getXpath()->query('//dc11:creator');
if (!$list->length) {
- $list = $this->xpath->query('//dc10:creator');
+ $list = $this->getXpath()->query('//dc10:creator');
}
if (!$list->length) {
- $list = $this->xpath->query('//dc11:publisher');
+ $list = $this->getXpath()->query('//dc11:publisher');
if (!$list->length) {
- $list = $this->xpath->query('//dc10:publisher');
+ $list = $this->getXpath()->query('//dc10:publisher');
}
}
@@ -93,10 +93,10 @@ public function getCopyright()
}
$copyright = null;
- $copyright = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:rights)');
+ $copyright = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:rights)');
if (!$copyright) {
- $copyright = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:rights)');
+ $copyright = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:rights)');
}
if (!$copyright) {
@@ -120,10 +120,10 @@ public function getDescription()
}
$description = null;
- $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:description)');
+ $description = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:description)');
if (!$description) {
- $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:description)');
+ $description = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:description)');
}
if (!$description) {
@@ -147,10 +147,10 @@ public function getId()
}
$id = null;
- $id = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:identifier)');
+ $id = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:identifier)');
if (!$id) {
- $id = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:identifier)');
+ $id = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:identifier)');
}
$this->data['id'] = $id;
@@ -170,10 +170,10 @@ public function getLanguage()
}
$language = null;
- $language = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:language)');
+ $language = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:language)');
if (!$language) {
- $language = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:language)');
+ $language = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:language)');
}
if (!$language) {
@@ -197,10 +197,10 @@ public function getTitle()
}
$title = null;
- $title = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:title)');
+ $title = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:title)');
if (!$title) {
- $title = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:title)');
+ $title = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:title)');
}
if (!$title) {
@@ -224,10 +224,10 @@ public function getDate()
}
$d = null;
- $date = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:date)');
+ $date = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:date)');
if (!$date) {
- $date = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:date)');
+ $date = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:date)');
}
if ($date) {
@@ -250,10 +250,10 @@ public function getCategories()
return $this->data['categories'];
}
- $list = $this->xpath->evaluate($this->getXpathPrefix() . '//dc11:subject');
+ $list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc11:subject');
if (!$list->length) {
- $list = $this->xpath->evaluate($this->getXpathPrefix() . '//dc10:subject');
+ $list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc10:subject');
}
if ($list->length) {
@@ -280,7 +280,7 @@ public function getCategories()
*/
protected function registerNamespaces()
{
- $this->xpath->registerNamespace('dc10', 'http://purl.org/dc/elements/1.0/');
- $this->xpath->registerNamespace('dc11', 'http://purl.org/dc/elements/1.1/');
+ $this->getXpath()->registerNamespace('dc10', 'http://purl.org/dc/elements/1.0/');
+ $this->getXpath()->registerNamespace('dc11', 'http://purl.org/dc/elements/1.1/');
}
}

0 comments on commit f46429d

Please sign in to comment.