summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-12-17 09:01:54 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2014-12-17 09:02:13 +0100
commit867cb7dbf960dc0cfbf7e59d656d1337bb59c526 (patch)
tree5bbdf1eef51cd3747f55ef2c524364f9cd3bf029
parenta813b535eeb517e0ccd69a90d0058756014a1e01 (diff)
update picofeed, fix #695
-rw-r--r--composer.lock8
-rw-r--r--fetcher/feedfetcher.php2
-rw-r--r--tests/unit/fetcher/FeedFetcherTest.php4
-rw-r--r--utility/picofeedfaviconfactory.php2
-rw-r--r--vendor/autoload.php2
-rw-r--r--vendor/composer/ClassLoader.php6
-rw-r--r--vendor/composer/autoload_real.php10
-rw-r--r--vendor/composer/installed.json10
-rw-r--r--vendor/fguillot/picofeed/README.markdown1
-rw-r--r--vendor/fguillot/picofeed/docs/config.markdown23
-rw-r--r--vendor/fguillot/picofeed/docs/favicon.markdown37
-rw-r--r--vendor/fguillot/picofeed/docs/feed-parsing.markdown13
-rw-r--r--vendor/fguillot/picofeed/docs/image-proxy.markdown66
-rw-r--r--vendor/fguillot/picofeed/example.php45
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Client/Client.php40
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php14
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Config/Config.php4
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php75
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Filter/Filter.php32
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Filter/Html.php2
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php89
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Parser/Feed.php29
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php37
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Parser/Parser.php108
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Parser/Rss20.php63
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Reader/Favicon.php (renamed from vendor/fguillot/picofeed/lib/PicoFeed/Client/Favicon.php)69
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Reader/Reader.php43
-rw-r--r--vendor/fguillot/picofeed/tests/Client/ClientTest.php20
-rw-r--r--vendor/fguillot/picofeed/tests/Filter/AttributeFilterTest.php49
-rw-r--r--vendor/fguillot/picofeed/tests/Filter/FilterTest.php35
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/AtomParserTest.php29
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/ItemTest.php24
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/ParserTest.php11
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/Rss10ParserTest.php11
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/Rss20ParserTest.php21
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/Rss91ParserTest.php5
-rw-r--r--vendor/fguillot/picofeed/tests/Parser/Rss92ParserTest.php5
-rw-r--r--vendor/fguillot/picofeed/tests/Reader/FaviconTest.php (renamed from vendor/fguillot/picofeed/tests/Client/FaviconTest.php)19
-rw-r--r--vendor/fguillot/picofeed/tests/Reader/ReaderTest.php11
-rw-r--r--vendor/fguillot/picofeed/tests/fixtures/podbean.xml1596
40 files changed, 2350 insertions, 320 deletions
diff --git a/composer.lock b/composer.lock
index 0e25a2be0..a73fdcce7 100644
--- a/composer.lock
+++ b/composer.lock
@@ -57,12 +57,12 @@
"source": {
"type": "git",
"url": "https://github.com/fguillot/picoFeed.git",
- "reference": "687cc58b51d739f06bc1729d69280e5a867840dd"
+ "reference": "6485f32d62698be73c3f0456bb87d960fcae1586"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/687cc58b51d739f06bc1729d69280e5a867840dd",
- "reference": "687cc58b51d739f06bc1729d69280e5a867840dd",
+ "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/6485f32d62698be73c3f0456bb87d960fcae1586",
+ "reference": "6485f32d62698be73c3f0456bb87d960fcae1586",
"shasum": ""
},
"require": {
@@ -86,7 +86,7 @@
],
"description": "Modern library to write or read feeds (RSS/Atom)",
"homepage": "http://fguillot.github.io/picoFeed",
- "time": "2014-11-25 23:40:52"
+ "time": "2014-12-16 23:53:59"
},
{
"name": "pear/net_url2",
diff --git a/fetcher/feedfetcher.php b/fetcher/feedfetcher.php
index faf473475..28d1f951c 100644
--- a/fetcher/feedfetcher.php
+++ b/fetcher/feedfetcher.php
@@ -179,7 +179,7 @@ class FeedFetcher implements IFeedFetcher {
$etag, $location) {
$feed = new Feed();
- $link = $parsedFeed->getUrl();
+ $link = $parsedFeed->getSiteUrl();
if (!$link) {
$link = $location;
diff --git a/tests/unit/fetcher/FeedFetcherTest.php b/tests/unit/fetcher/FeedFetcherTest.php
index 5f68ff333..9c24524b0 100644
--- a/tests/unit/fetcher/FeedFetcherTest.php
+++ b/tests/unit/fetcher/FeedFetcherTest.php
@@ -77,7 +77,7 @@ class FeedFetcherTest extends \PHPUnit_Framework_TestCase {
->disableOriginalConstructor()
->getMock();
$this->faviconFetcher = $this->getMockBuilder(
- '\PicoFeed\Client\Favicon')
+ '\PicoFeed\Reader\Favicon')
->disableOriginalConstructor()
->getMock();
$this->faviconFactory = $this->getMockBuilder(
@@ -228,7 +228,7 @@ class FeedFetcherTest extends \PHPUnit_Framework_TestCase {
private function createFeed($hasFavicon=false) {
$this->expectFeed('getTitle', $this->feedTitle);
- $this->expectFeed('getUrl', $this->feedLink);
+ $this->expectFeed('getSiteUrl', $this->feedLink);
$feed = new Feed();
$feed->setTitle('&its a title');
diff --git a/utility/picofeedfaviconfactory.php b/utility/picofeedfaviconfactory.php
index 4509b9e06..b3a48747a 100644
--- a/utility/picofeedfaviconfactory.php
+++ b/utility/picofeedfaviconfactory.php
@@ -15,7 +15,7 @@
namespace OCA\News\Utility;
use \PicoFeed\Config\Config;
-use \PicoFeed\Client\Favicon;
+use \PicoFeed\Reader\Favicon;
class PicoFeedFaviconFactory {
diff --git a/vendor/autoload.php b/vendor/autoload.php
index 357c2c52a..f8495def9 100644
--- a/vendor/autoload.php
+++ b/vendor/autoload.php
@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php';
-return ComposerAutoloaderInit80e526884d05a69ec5f87ea0eadf0d03::getLoader();
+return ComposerAutoloaderInitb70f37963a41b6db289ef240676024ef::getLoader();
diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php
index 443364959..70d78bc3f 100644
--- a/vendor/composer/ClassLoader.php
+++ b/vendor/composer/ClassLoader.php
@@ -56,7 +56,11 @@ class ClassLoader
public function getPrefixes()
{
- return call_user_func_array('array_merge', $this->prefixesPsr0);
+ if (!empty($this->prefixesPsr0)) {
+ return call_user_func_array('array_merge', $this->prefixesPsr0);
+ }
+
+ return array();
}
public function getPrefixesPsr4()
diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php
index bc6f011c7..113cd5ee5 100644
--- a/vendor/composer/autoload_real.php
+++ b/vendor/composer/autoload_real.php
@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
-class ComposerAutoloaderInit80e526884d05a69ec5f87ea0eadf0d03
+class ComposerAutoloaderInitb70f37963a41b6db289ef240676024ef
{
private static $loader;
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit80e526884d05a69ec5f87ea0eadf0d03
return self::$loader;
}
- spl_autoload_register(array('ComposerAutoloaderInit80e526884d05a69ec5f87ea0eadf0d03', 'loadClassLoader'), true, true);
+ spl_autoload_register(array('ComposerAutoloaderInitb70f37963a41b6db289ef240676024ef', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
- spl_autoload_unregister(array('ComposerAutoloaderInit80e526884d05a69ec5f87ea0eadf0d03', 'loadClassLoader'));
+ spl_autoload_unregister(array('ComposerAutoloaderInitb70f37963a41b6db289ef240676024ef', 'loadClassLoader'));
$includePaths = require __DIR__ . '/include_paths.php';
array_push($includePaths, get_include_path());
@@ -46,14 +46,14 @@ class ComposerAutoloaderInit80e526884d05a69ec5f87ea0eadf0d03
$includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $file) {
- composerRequire80e526884d05a69ec5f87ea0eadf0d03($file);
+ composerRequireb70f37963a41b6db289ef240676024ef($file);
}
return $loader;
}
}
-function composerRequire80e526884d05a69ec5f87ea0eadf0d03($file)
+function composerRequireb70f37963a41b6db289ef240676024ef($file)
{
require $file;
}
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 7c9dac276..2a5124d70 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -119,20 +119,20 @@
"source": {
"type": "git",
"url": "https://github.com/fguillot/picoFeed.git",
- "reference": "687cc58b51d739f06bc1729d69280e5a867840dd"
+ "reference": "6485f32d62698be73c3f0456bb87d960fcae1586"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/687cc58b51d739f06bc1729d69280e5a867840dd",
- "reference": "687cc58b51d739f06bc1729d69280e5a867840dd",
+ "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/6485f32d62698be73c3f0456bb87d960fcae1586",
+ "reference": "6485f32d62698be73c3f0456bb87d960fcae1586",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
- "time": "2014-11-25 23:40:52",
+ "time": "2014-12-16 23:53:59",
"type": "library",
- "installation-source": "source",
+ "installation-source": "dist",
"autoload": {
"psr-0": {
"PicoFeed": "lib/"
diff --git a/vendor/fguillot/picofeed/README.markdown b/vendor/fguillot/picofeed/README.markdown
index 868d532e9..a1e1e39c5 100644
--- a/vendor/fguillot/picofeed/README.markdown
+++ b/vendor/fguillot/picofeed/README.markdown
@@ -59,6 +59,7 @@ Documentation
- [Favicon fetcher](docs/favicon.markdown)
- [OPML file importation](docs/opml-import.markdown)
- [OPML file exportation](docs/opml-export.markdown)
+- [Image proxy](docs/image-proxy.markdown) (avoid SSL mixed content warnings)
- [Web scraping](docs/grabber.markdown)
- [Exceptions](docs/exceptions.markdown)
- [Debugging](docs/debugging.markdown)
diff --git a/vendor/fguillot/picofeed/docs/config.markdown b/vendor/fguillot/picofeed/docs/config.markdown
index 5e0dfea53..75546abd1 100644
--- a/vendor/fguillot/picofeed/docs/config.markdown
+++ b/vendor/fguillot/picofeed/docs/config.markdown
@@ -261,3 +261,26 @@ $config->setFilterSchemeWhitelist(['http://', 'ftp://']);
```php
$config->setFilterWhitelistedTags(['a' => ['href'], 'img' => ['src', 'title']]);
```
+
+### Define a image proxy url
+
+- Method name: `setFilterImageProxyUrl()`
+- Default value: Empty
+- Argument value: string
+
+```php
+$config->setFilterImageProxyUrl('http://myproxy.example.org/?url=%s');
+```
+
+### Define a image proxy callback
+
+- Method name: `setFilterImageProxyCallback()`
+- Default value: null
+- Argument value: Closure
+
+```php
+$config->setFilterImageProxyCallback(function ($image_url) {
+ $key = hash_hmac('sha1', $image_url, 'secret');
+ return 'https://mypublicproxy/'.$key.'/'.urlencode($image_url);
+});
+``` \ No newline at end of file
diff --git a/vendor/fguillot/picofeed/docs/favicon.markdown b/vendor/fguillot/picofeed/docs/favicon.markdown
index 14e25955d..1ac3ee1fc 100644
--- a/vendor/fguillot/picofeed/docs/favicon.markdown
+++ b/vendor/fguillot/picofeed/docs/favicon.markdown
@@ -5,7 +5,7 @@ Find and download the favicon
-----------------------------
```php
-use PicoFeed\Client\Favicon;
+use PicoFeed\Reader\Favicon;
$favicon = new Favicon;
@@ -21,11 +21,42 @@ PicoFeed will try first to find the favicon from the meta tags and fallback to t
When the HTML page is parsed, relative links and protocol relative links are converted to absolute url.
+Get Favicon file type
+---------------------
+
+It's possible to fetch the image type, this information come from the Content-Type HTTP header:
+
+```php
+$favicon = new Favicon;
+$favicon->find('http://example.net/');
+
+echo $favicon->getType();
+
+// Will output the content type, by example "image/png"
+```
+
+Get the Favicon as Data URI
+---------------------------
+
+You can also get the whole image as Data URI.
+It's useful if you want to store the icon in your database and avoid too many HTTP requests.
+
+```php
+$favicon = new Favicon;
+$favicon->find('http://example.net/');
+
+echo $favicon->getDataUri();
+
+// Output something like that: data:image/png;base64,iVBORw0KGgoAAAANSUh.....
+```
+
+See: http://en.wikipedia.org/wiki/Data_URI_scheme
+
Check if a favicon link exists
------------------------------
```php
-use PicoFeed\Client\Favicon;
+use PicoFeed\Reader\Favicon;
$favicon = new Favicon;
@@ -40,7 +71,7 @@ Like other classes, the Favicon class support the Config object as constructor a
```php
use PicoFeed\Config\Config;
-use PicoFeed\Client\Favicon;
+use PicoFeed\Reader\Favicon;
$config = new Config;
$config->setClientUserAgent('My RSS Reader');
diff --git a/vendor/fguillot/picofeed/docs/feed-parsing.markdown b/vendor/fguillot/picofeed/docs/feed-parsing.markdown
index df881400e..82d3703e9 100644
--- a/vendor/fguillot/picofeed/docs/feed-parsing.markdown
+++ b/vendor/fguillot/picofeed/docs/feed-parsing.markdown
@@ -43,7 +43,8 @@ Output:
```bash
Feed::id = tag:linuxfr.org,2005:/news
Feed::title = LinuxFr.org : les dĂ©pĂȘches
-Feed::url = http://linuxfr.org/news
+Feed::feed_url = http://linuxfr.org/news.atom
+Feed::site_url = http://linuxfr.org/news
Feed::date = 1415138079
Feed::language = en-US
Feed::description =
@@ -58,6 +59,7 @@ Item::language = en-US
Item::author = Syvolc
Item::enclosure_url =
Item::enclosure_type =
+Item::isRTL() = false
Item::content = 18307 bytes
....
```
@@ -181,7 +183,8 @@ Feed and item properties
// Feed object
$feed->getId(); // Unique feed id
$feed->getTitle(); // Feed title
-$feed->getUrl(); // Website url
+$feed->getFeedUrl(); // Feed url
+$feed->getSiteUrl(); // Website url
$feed->getDate(); // Feed last updated date
$feed->getLanguage(); // Feed language
$feed->getDescription(); // Feed description
@@ -198,16 +201,16 @@ $feed->items[0]->getAuthor(); // Item author
$feed->items[0]->getEnclosureUrl(); // Enclosure url
$feed->items[0]->getEnclosureType(); // Enclosure mime-type (audio/mp3, image/png...)
$feed->items[0]->getContent(); // Item content (filtered or raw)
+$feed->items[0]->isRTL(); // Return true if the item language is Right-To-Left
```
RTL language detection
----------------------
-There is an utility method to determine if a language code is Right-To-Left or not:
+Use the method `Item::isRTL()` to test if an item is RTL or not:
```php
-// Return true if RTL
-Parser::isLanguageRTL($item->getLanguage());
+var_dump($item->isRTL()); // true or false
```
Known RTL languages are:
diff --git a/vendor/fguillot/picofeed/docs/image-proxy.markdown b/vendor/fguillot/picofeed/docs/image-proxy.markdown
new file mode 100644
index 000000000..74e10d0c6
--- /dev/null
+++ b/vendor/fguillot/picofeed/docs/image-proxy.markdown
@@ -0,0 +1,66 @@
+Image Proxy
+===========
+
+To prevent mixed content warnings on SSL pages served from your RSS reader you might want to use an assets proxy.
+
+Images url will be rewritten to be downloaded through the proxy.
+
+Example:
+
+```html
+<img src="http://example.org/image.png"/>
+```
+
+Can be rewritten like that:
+
+```html
+<img src="http://myproxy.example.org/?url=http%3A%2F%2Fexample.org%2Fimage.png"/>
+```
+
+Currently this feature is only compatible with images.
+
+There is several open source SSL image proxy available like [Camo](https://github.com/atmos/camo).
+You can also write your own proxy.
+
+Usage
+-----
+
+There two different ways to use this feature, define a proxy url or a callback.
+
+### Define a proxy url
+
+A proxy url must be defined with a placeholder `%s`.
+The placeholder will be replaced by the image source urlencoded.
+
+```php
+$config = new Config;
+$config->setFilterImageProxyUrl('http://myproxy.example.org/?url=%s');
+```
+
+Will rewrite the image source like that:
+
+```html
+<img src="http://myproxy.example.org/?url=http%3A%2F%2Fexample.org%2Fimage.png"/>
+```
+
+### Define a callback
+
+Your callback will be called each time an image url need to be rewritten.
+The first argument is the original image url and your function must returns the new image url.