summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot/picofeed/docs
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 /vendor/fguillot/picofeed/docs
parenta813b535eeb517e0ccd69a90d0058756014a1e01 (diff)
update picofeed, fix #695
Diffstat (limited to 'vendor/fguillot/picofeed/docs')
-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
4 files changed, 131 insertions, 8 deletions
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.
+
+Here an example if your proxy need a shared secret key:
+
+```php
+$config = new Config;
+
+$config->setFilterImageProxyCallback(function ($image_url) {
+ $key = hash_hmac('sha1', $image_url, 'secret');
+ return 'https://mypublicproxy/'.$key.'/'.urlencode($image_url);
+});
+```
+
+Will generate an image url like that:
+
+```html
+<img src="https://mypublicproxy/4924964043f3119b3cf2b07b1922d491bcc20092/http%3A%2F%2Ffoo%2Fimage.png"/>
+```