summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php')
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php
index f03305c02..396a1085e 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php
@@ -149,6 +149,24 @@ class Url
}
/**
+ * Filters the path of a URI
+ *
+ * Imported from Guzzle library: https://github.com/guzzle/psr7/blob/master/src/Uri.php#L568-L582
+ *
+ * @access public
+ * @param $path
+ * @return string
+ */
+ public function filterPath($path, $charUnreserved = 'a-zA-Z0-9_\-\.~', $charSubDelims = '!\$&\'\(\)\*\+,;=')
+ {
+ return preg_replace_callback(
+ '/(?:[^' . $charUnreserved . $charSubDelims . ':@\/%]+|%(?![A-Fa-f0-9]{2}))/',
+ function (array $matches) { return rawurlencode($matches[0]); },
+ $path
+ );
+ }
+
+ /**
* Get the path
*
* @access public
@@ -156,7 +174,7 @@ class Url
*/
public function getPath()
{
- return empty($this->components['path']) ? '' : $this->components['path'];
+ return $this->filterPath(empty($this->components['path']) ? '' : $this->components['path']);
}
/**