diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-08-13 09:23:09 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-08-13 09:23:42 +0200 |
commit | de378700110c202bc25e9378cb5fdb852d27f07a (patch) | |
tree | 52d7d9ffb62d2dc732c54942fea59501473545d4 /vendor/fguillot/picofeed/lib/PicoFeed | |
parent | e282e47ac4b6cc2d309985996d02d8a9093050e4 (diff) |
remove net url package and update composer deps
Diffstat (limited to 'vendor/fguillot/picofeed/lib/PicoFeed')
5 files changed, 48 insertions, 19 deletions
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php index 0c609db29..3e408b6d8 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php @@ -243,8 +243,7 @@ class Curl extends Client curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->timeout); curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent); curl_setopt($ch, CURLOPT_HTTPHEADER, $this->prepareHeaders()); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, ini_get('open_basedir') === ''); - curl_setopt($ch, CURLOPT_MAXREDIRS, $this->max_redirects); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt($ch, CURLOPT_ENCODING, ''); curl_setopt($ch, CURLOPT_COOKIEJAR, 'php://memory'); curl_setopt($ch, CURLOPT_COOKIEFILE, 'php://memory'); @@ -310,8 +309,7 @@ class Curl extends Client list($status, $headers) = HttpHeaders::parse(explode("\n", $this->response_headers[$this->response_headers_count - 1])); - // When restricted with open_basedir - if ($this->needToHandleRedirection($follow_location, $status)) { + if ($follow_location && ($status == 301 || $status == 302)) { return $this->handleRedirection($headers['Location']); } @@ -323,19 +321,6 @@ class Curl extends Client } /** - * Check if the redirection have to be handled manually - * - * @access private - * @param boolean $follow_location Flag - * @param integer $status HTTP status code - * @return boolean - */ - private function needToHandleRedirection($follow_location, $status) - { - return $follow_location && ini_get('open_basedir') !== '' && ($status == 301 || $status == 302); - } - - /** * Handle manually redirections when there is an open base dir restriction * * @access private 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']); } /** diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php index ec1dac417..1c5842df4 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php @@ -149,6 +149,7 @@ class Attribute 'feeds.feedburner.com', 'share.feedsportal.com', 'da.feedsportal.com', + 'rc.feedsportal.com', 'rss.feedsportal.com', 'res.feedsportal.com', 'res1.feedsportal.com', diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/www.lesnumeriques.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/www.lesnumeriques.com.php new file mode 100644 index 000000000..8fe629922 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/www.lesnumeriques.com.php @@ -0,0 +1,25 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://www.lesnumeriques.com/blender/kitchenaid-diamond-5ksb1585-p27473/test.html', + 'body' => array( + '//*[@id="product-content"]', + '//*[@id="news-content"]', + '//*[@id="article-content"]', + ), + 'strip' => array( + '//form', + '//div[contains(@class, "price-v4"])', + '//div[contains(@class, "authors-and-date")]', + '//div[contains(@class, "mini-product")]', + '//div[@id="articles-related-authors"]', + '//div[@id="tags-socials"]', + '//div[@id="user-reviews"]', + '//div[@id="product-reviews"]', + '//div[@id="publication-breadcrumbs-and-date"]', + '//div[@id="publication-breadcrumbs-and-date"]', + ) + ) + ) +);
\ No newline at end of file diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Syndication/Rss20.php b/vendor/fguillot/picofeed/lib/PicoFeed/Syndication/Rss20.php index 69d6a2114..32b45e797 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Syndication/Rss20.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Syndication/Rss20.php @@ -179,7 +179,7 @@ class Rss20 extends Writer { $xml->appendChild($this->dom->createElement( 'pubDate', - date(DATE_RFC822, $value ?: time()) + date(DATE_RSS, $value ?: time()) )); } |