|
@@ -89,7 +89,13 @@ class Zend_Feed_Reader_FeedSet extends ArrayObject
|
|
|
{
|
|
{
|
|
|
if (!Zend_Uri::check($link)) {
|
|
if (!Zend_Uri::check($link)) {
|
|
|
if (!is_null($uri)) {
|
|
if (!is_null($uri)) {
|
|
|
- $link = rtrim($uri, '/') . '/' . ltrim($link, '/');
|
|
|
|
|
|
|
+ $uri = Zend_Uri::factory($uri);
|
|
|
|
|
+
|
|
|
|
|
+ if ($link[0] !== '/') {
|
|
|
|
|
+ $link = $uri->getPath() . '/' . $link;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $link = $uri->getScheme() . '://' . $uri->getHost() . '/' . $this->_canonicalizePath($link);
|
|
|
if (!Zend_Uri::check($link)) {
|
|
if (!Zend_Uri::check($link)) {
|
|
|
$link = null;
|
|
$link = null;
|
|
|
}
|
|
}
|
|
@@ -97,6 +103,26 @@ class Zend_Feed_Reader_FeedSet extends ArrayObject
|
|
|
}
|
|
}
|
|
|
return $link;
|
|
return $link;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Canonicalize relative path
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function _canonicalizePath($path)
|
|
|
|
|
+ {
|
|
|
|
|
+ $parts = array_filter(explode('/', $path));
|
|
|
|
|
+ $absolutes = array();
|
|
|
|
|
+ foreach ($parts as $part) {
|
|
|
|
|
+ if ('.' == $part) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ if ('..' == $part) {
|
|
|
|
|
+ array_pop($absolutes);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $absolutes[] = $part;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return implode('/', $absolutes);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Supports lazy loading of feeds using Zend_Feed_Reader::import() but
|
|
* Supports lazy loading of feeds using Zend_Feed_Reader::import() but
|