diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-03-07 15:13:07 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-03-07 15:13:07 +0100 |
commit | 0be30fc27d62952e909d920d90716d793b14cfd0 (patch) | |
tree | 6e211de89f1983f735c857419a0224545f236e95 /vendor/fguillot/picofeed/lib/PicoFeed | |
parent | c53250f18730b2edef57f098cec3ad706d6efb53 (diff) |
update picofeed
Diffstat (limited to 'vendor/fguillot/picofeed/lib/PicoFeed')
7 files changed, 74 insertions, 15 deletions
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php index 5e5514f52..278eeb422 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php @@ -143,7 +143,6 @@ class Curl extends Client { $headers = array( 'Connection: close', - 'User-Agent: '.$this->user_agent, ); if ($this->etag) { @@ -236,13 +235,23 @@ class Curl extends Client curl_setopt($ch, CURLOPT_URL, $this->url); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); 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_ENCODING, ''); curl_setopt($ch, CURLOPT_COOKIEJAR, 'php://memory'); curl_setopt($ch, CURLOPT_COOKIEFILE, 'php://memory'); - curl_setopt($ch, CURLOPT_SSLVERSION, 1); // Enforce TLS v1 + + // Disable SSLv3 by enforcing TLSv1.x for curl >= 7.34.0 and < 7.39.0. + // Versions prior to 7.34 and at least when compiled against openssl + // interpret this parameter as "limit to TLSv1.0" which fails for sites + // which enforce TLS 1.1+. + // Starting with curl 7.39.0 SSLv3 is disabled by default. + $version = curl_version(); + if ($version['version_number'] >= 467456 && $version['version_number'] < 468736) { + curl_setopt($ch, CURLOPT_SSLVERSION, 1); + } $ch = $this->prepareDownloadMode($ch); $ch = $this->prepareProxyContext($ch); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php index 21566527e..0e53d2778 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php @@ -138,16 +138,20 @@ class Atom extends Parser * Find the item date * * @access public - * @param SimpleXMLElement $entry Feed item - * @param Item $item Item object + * @param SimpleXMLElement $entry Feed item + * @param Item $item Item object + * @param \PicoFeed\Parser\Feed $feed Feed object */ - public function findItemDate(SimpleXMLElement $entry, Item $item) + public function findItemDate(SimpleXMLElement $entry, Item $item, Feed $feed) { $published = isset($entry->published) ? $this->date->getDateTime((string) $entry->published) : null; $updated = isset($entry->updated) ? $this->date->getDateTime((string) $entry->updated) : null; - if ($published !== null && $updated !== null) { - $item->date = max($published, $updated); + if ($published === null && $updated === null) { + $item->date = $feed->getDate(); // We use the feed date if there is no date for the item + } + else if ($published !== null && $updated !== null) { + $item->date = max($published, $updated); // We use the most recent date between published and updated } else { $item->date = $updated ?: $published; diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Parser.php b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Parser.php index 7ada6d10f..4d45f539c 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Parser.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Parser.php @@ -164,7 +164,7 @@ abstract class Parser // Id generation can use the item url/title/content (order is important) $this->findItemId($entry, $item, $feed); - $this->findItemDate($entry, $item); + $this->findItemDate($entry, $item, $feed); $this->findItemEnclosure($entry, $item, $feed); $this->findItemLanguage($entry, $item, $feed); @@ -333,7 +333,7 @@ abstract class Parser if ($timezone) { $this->date->timezone = $timezone; } - + return $this; } @@ -532,9 +532,10 @@ abstract class Parser * * @access public * @param SimpleXMLElement $entry Feed item - * @param \PicoFeed\Parser\Item $item Item object + * @param Item $item Item object + * @param \PicoFeed\Parser\Feed $feed Feed object */ - public abstract function findItemDate(SimpleXMLElement $entry, Item $item); + public abstract function findItemDate(SimpleXMLElement $entry, Item $item, Feed $feed); /** * Find the item content diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Rss20.php b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Rss20.php index b5fb09580..2529b5984 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Rss20.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Rss20.php @@ -142,9 +142,10 @@ class Rss20 extends Parser * * @access public * @param SimpleXMLElement $entry Feed item - * @param \PicoFeed\Parser\Item $item Item object + * @param Item $item Item object + * @param \PicoFeed\Parser\Feed $feed Feed object */ - public function findItemDate(SimpleXMLElement $entry, Item $item) + public function findItemDate(SimpleXMLElement $entry, Item $item, Feed $feed) { $date = XmlParser::getNamespaceValue($entry, $this->namespaces, 'date'); @@ -156,7 +157,7 @@ class Rss20 extends Parser $date = (string) $entry->pubDate; } - $item->date = $this->date->getDateTime($date); + $item->date = empty($date) ? $feed->getDate() : $this->date->getDateTime($date); } /** @@ -208,7 +209,7 @@ class Rss20 extends Parser { $content = XmlParser::getNamespaceValue($entry, $this->namespaces, 'encoded'); - if (empty($content) && $entry->description->count() > 0) { + if (trim($content) === '' && $entry->description->count() > 0) { $content = (string) $entry->description; } diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/dailyjs.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/dailyjs.com.php new file mode 100755 index 000000000..bde589586 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/dailyjs.com.php @@ -0,0 +1,15 @@ +<?php +return array( + 'test_url' => 'http://dailyjs.com/2014/08/07/p5js/', + 'body' => array( + '//div[@id="post"]', + ), + 'strip' => array( + '//h2[@class="post"]', + '//div[@class="meta"]', + '//*[contains(@class, "addthis_toolbox")]', + '//*[contains(@class, "addthis_default_style")]', + '//*[@class="navigation small"]', + '//*[@id="related"]', + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/putaindecode.fr.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/putaindecode.fr.php new file mode 100755 index 000000000..6857c20e2 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/putaindecode.fr.php @@ -0,0 +1,12 @@ +<?php +return array( + 'test_url' => 'http://putaindecode.fr/posts/js/etat-lieux-js-modulaire-front/', + 'body' => array( + '//*[@class="putainde-Post-md"]', + ), + 'strip' => array( + '//*[contains(@class, "inlineimg")]', + '//*[contains(@class, "comment-respond")]', + '//header' + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/www.developpez.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/www.developpez.com.php new file mode 100644 index 000000000..d56bcca6e --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/www.developpez.com.php @@ -0,0 +1,17 @@ +<?php +return array( + 'test_url' => 'http://www.developpez.com/actu/81757/Mozilla-annonce-la-disponibilite-de-Firefox-36-qui-passe-au-HTTP-2-et-permet-la-synchronisation-de-son-ecran-d-accueil/', + 'body' => array( + '//*[@itemprop="articleBody"]', + ), + 'strip' => array( + '//form', + '//div[@class="content"]/img', + '//a[last()]/following-sibling::*', + '//*[contains(@class,"actuTitle")]', + '//*[contains(@class,"date")]', + '//*[contains(@class,"inlineimg")]', + '//*[@id="signaler"]', + '//*[@id="signalerFrame"]', + ) +);
\ No newline at end of file |