import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
* @package Zend_Feed_Reader
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Entry.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Entry.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -34,6 +34,11 @@ require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
|
||||
*/
|
||||
require_once 'Zend/Date.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Uri
|
||||
*/
|
||||
require_once 'Zend/Uri.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Feed_Reader
|
||||
@ -43,7 +48,7 @@ require_once 'Zend/Date.php';
|
||||
class Zend_Feed_Reader_Extension_Atom_Entry
|
||||
extends Zend_Feed_Reader_Extension_EntryAbstract
|
||||
{
|
||||
/**
|
||||
/**
|
||||
* Get the specified author
|
||||
*
|
||||
* @param int $index
|
||||
@ -264,6 +269,34 @@ class Zend_Feed_Reader_Extension_Atom_Entry
|
||||
return $this->_data['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base URI of the feed (if set).
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getBaseUrl()
|
||||
{
|
||||
if (array_key_exists('baseUrl', $this->_data)) {
|
||||
return $this->_data['baseUrl'];
|
||||
}
|
||||
|
||||
$baseUrl = $this->_xpath->evaluate('string('
|
||||
. $this->getXpathPrefix() . '/@xml:base[1]'
|
||||
. ')');
|
||||
|
||||
if (!$baseUrl) {
|
||||
$baseUrl = $this->_xpath->evaluate('string(//@xml:base[1])');
|
||||
}
|
||||
|
||||
if (!$baseUrl) {
|
||||
$baseUrl = null;
|
||||
}
|
||||
|
||||
$this->_data['baseUrl'] = $baseUrl;
|
||||
|
||||
return $this->_data['baseUrl'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a specific link
|
||||
*
|
||||
@ -303,7 +336,7 @@ class Zend_Feed_Reader_Extension_Atom_Entry
|
||||
|
||||
if ($list->length) {
|
||||
foreach ($list as $link) {
|
||||
$links[] = $link->value;
|
||||
$links[] = $this->_absolutiseUri($link->value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -392,6 +425,7 @@ class Zend_Feed_Reader_Extension_Atom_Entry
|
||||
|
||||
if ($list->length) {
|
||||
$link = $list->item(0)->value;
|
||||
$link = $this->_absolutiseUri($link);
|
||||
}
|
||||
|
||||
$this->_data['commentlink'] = $link;
|
||||
@ -418,6 +452,7 @@ class Zend_Feed_Reader_Extension_Atom_Entry
|
||||
|
||||
if ($list->length) {
|
||||
$link = $list->item(0)->value;
|
||||
$link = $this->_absolutiseUri($link);
|
||||
}
|
||||
|
||||
$this->_data['commentfeedlink'] = $link;
|
||||
@ -425,6 +460,23 @@ class Zend_Feed_Reader_Extension_Atom_Entry
|
||||
return $this->_data['commentfeedlink'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to absolutise the URI, i.e. if a relative URI apply the
|
||||
* xml:base value as a prefix to turn into an absolute URI.
|
||||
*/
|
||||
protected function _absolutiseUri($link)
|
||||
{
|
||||
if (!Zend_Uri::check($link)) {
|
||||
if (!is_null($this->getBaseUrl())) {
|
||||
$link = $this->getBaseUrl() . $link;
|
||||
if (!Zend_Uri::check($link)) {
|
||||
$link = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an author entry
|
||||
*
|
||||
|
Reference in New Issue
Block a user