summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot/picofeed/lib/PicoFeed
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/fguillot/picofeed/lib/PicoFeed')
-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
13 files changed, 400 insertions, 205 deletions
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Client.php b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Client.php
index e962ba4e8..c8c812c1a 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Client.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Client.php
@@ -22,6 +22,14 @@ abstract class Client
private $is_modified = true;
/**
+ * HTTP Content-Type
+ *
+ * @access private
+ * @var string
+ */
+ private $content_type = '';
+
+ /**
* HTTP encoding
*
* @access private
@@ -231,7 +239,8 @@ abstract class Client
{
if ($response['status'] == 200) {
$this->content = $response['body'];
- $this->encoding = $this->findCharset($response);
+ $this->content_type = $this->findContentType($response);
+ $this->encoding = $this->findCharset();
}
}
@@ -249,14 +258,26 @@ abstract class Client
}
/**
- * Find charset from response headers
+ * Find content type from response headers
*
* @access public
* @param array $response Client response
+ * @return string
*/
- public function findCharset(array $response)
+ public function findContentType(array $response)
{
- $result = explode('charset=', strtolower($this->getHeader($response, 'Content-Type')));
+ return strtolower($this->getHeader($response, 'Content-Type'));
+ }
+
+ /**
+ * Find charset from response headers
+ *
+ * @access public
+ * @return string
+ */
+ public function findCharset()
+ {
+ $result = explode('charset=', $this->content_type);
return isset($result[1]) ? $result[1] : '';
}
@@ -390,6 +411,17 @@ abstract class Client
}
/**
+ * Get the content type value from HTTP headers
+ *
+ * @access public
+ * @return string
+ */
+ public function getContentType()
+ {
+ return $this->content_type;
+ }
+
+ /**
* Get the encoding value from HTTP headers
*
* @access public
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php
index 90d7fb6f7..a74c23508 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Url.php
@@ -80,6 +80,20 @@ class Url
}
/**
+ * Shortcut method to get a base url
+ *
+ * @static
+ * @access public
+ * @param string $url
+ * @return string
+ */
+ public static function base($url)
+ {
+ $link = new Url($url);
+ return $link->getBaseUrl();
+ }
+
+ /**
* Get the base URL
*
* @access public
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Config/Config.php b/vendor/fguillot/picofeed/lib/PicoFeed/Config/Config.php
index 298b9a2d7..9a5381f0f 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Config/Config.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Config/Config.php
@@ -30,6 +30,8 @@ namespace PicoFeed\Config;
* @method \PicoFeed\Config\Config setFilterSchemeWhitelist(array $value)
* @method \PicoFeed\Config\Config setFilterWhitelistedTags(array $value)
* @method \PicoFeed\Config\Config setFilterBlacklistedTags(array $value)
+ * @method \PicoFeed\Config\Config setFilterImageProxyUrl($value)
+ * @method \PicoFeed\Config\Config setFilterImageProxyCallback($closure)
*
* @method integer getClientTimeout()
* @method string getClientUserAgent()
@@ -53,6 +55,8 @@ namespace PicoFeed\Config;
* @method array getFilterSchemeWhitelist(array $default_value)
* @method array getFilterWhitelistedTags(array $default_value)
* @method array getFilterBlacklistedTags(array $default_value)
+ * @method string getFilterImageProxyUrl($default_value)
+ * @method string getFilterImageProxyCallback($default_value)
*/
class Config
{
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php
index 23b1103ad..66b3470f8 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Attribute.php
@@ -13,6 +13,22 @@ use \PicoFeed\Client\Url;
class Attribute
{
/**
+ * Image proxy url
+ *
+ * @access private
+ * @var string
+ */
+ private $image_proxy_url = '';
+
+ /**
+ * Image proxy callback
+ *
+ * @access private
+ * @var \Closure|null
+ */
+ private $image_proxy_callback = null;
+
+ /**
* Tags and attribute whitelist
*
* @access private
@@ -204,10 +220,11 @@ class Attribute
'filterEmptyAttribute',
'filterAllowedAttribute',
'filterIntegerAttribute',
- 'filterAbsoluteUrlAttribute',
+ 'rewriteAbsoluteUrl',
'filterIframeAttribute',
'filterBlacklistResourceAttribute',
'filterProtocolUrlAttribute',
+ 'rewriteImageProxyUrl',
);
/**
@@ -349,7 +366,7 @@ class Attribute
* @param string $value Atttribute value
* @return boolean
*/
- public function filterAbsoluteUrlAttribute($tag, $attribute, &$value)
+ public function rewriteAbsoluteUrl($tag, $attribute, &$value)
{
if ($this->isResource($attribute)) {
$value = Url::resolve($value, $this->website);
@@ -359,6 +376,30 @@ class Attribute
}
/**
+ * Rewrite image url to use with a proxy
+ *
+ * @access public
+ * @param string $tag Tag name
+ * @param string $attribute Atttribute name
+ * @param string $value Atttribute value
+ * @return boolean
+ */
+ public function rewriteImageProxyUrl($tag, $attribute, &$value)
+ {
+ if ($tag === 'img' && $attribute === 'src') {
+
+ if ($this->image_proxy_url) {
+ $value = sprintf($this->image_proxy_url, urlencode($value));
+ }
+ else if (is_callable($this->image_proxy_callback)) {
+ $value = call_user_func($this->image_proxy_callback, $value);
+ }
+ }
+
+ return true;
+ }
+
+ /**
* Return true if the scheme is authorized
*
* @access public
@@ -484,7 +525,7 @@ class Attribute
}
/**
- * Set whitelisted tags adn attributes for each tag
+ * Set whitelisted tags and attributes for each tag
*
* @access public
* @param array $values List of tags: ['video' => ['src', 'cover'], 'img' => ['src']]
@@ -586,4 +627,32 @@ class Attribute
$this->iframe_whitelist = $values ?: $this->iframe_whitelist;
return $this;
}
+
+ /**
+ * Set image proxy URL
+ *
+ * The original image url will be urlencoded
+ *
+ * @access public
+ * @param string $url Proxy URL
+ * @return \PicoFeed\Filter\Filter
+ */
+ public function setImageProxyUrl($url)
+ {
+ $this->image_proxy_url = $url ?: $this->image_proxy_url;
+ return $this;
+ }
+
+ /**
+ * Set image proxy callback
+ *
+ * @access public
+ * @param \Closure $callback
+ * @return \PicoFeed\Filter\Filter
+ */
+ public function setImageProxyCallback($callback)
+ {
+ $this->image_proxy_callback = $callback ?: $this->image_proxy_callback;
+ return $this;
+ }
}
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Filter.php b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Filter.php
index 0490e2f49..82289444b 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Filter.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Filter.php
@@ -2,6 +2,8 @@
namespace PicoFeed\Filter;
+use PicoFeed\Parser\XmlParser;
+
/**
* Filter class
*
@@ -137,34 +139,4 @@ class Filter
return $data;
}
-
- /**
- * Get the first XML tag
- *
- * @static
- * @access public
- * @param string $data Feed content
- * @return string
- */
- public static function getFirstTag($data)
- {
- // Strip HTML comments (max of 5,000 characters long to prevent crashing)
- $data = preg_replace('/<!--(.{0,5000}?)-->/Uis', '', $data);
-
- /* Strip Doctype:
- * Doctype needs to be within the first 100 characters. (Ideally the first!)
- * If it's not found by then, we need to stop looking to prevent PREG
- * from reaching max backtrack depth and crashing.
- */
- $data = preg_replace('/^.{0,100}<!DOCTYPE([^>]*)>/Uis', '', $data);
-
- // Strip <?xml version....
- $data = self::stripXmlTag($data);
-
- // Find the first tag
- $open_tag = strpos($data, '<');
- $close_tag = strpos($data, '>');
-
- return substr($data, $open_tag, $close_tag);
- }
}
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Html.php b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Html.php
index d14d80907..f7816f1d2 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Html.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Html.php
@@ -96,6 +96,8 @@ class Html
$this->config = $config;
if ($this->config !== null) {
+ $this->attribute->setImageProxyCallback($this->config->getFilterImageProxyCallback());
+ $this->attribute->setImageProxyUrl($this->config->getFilterImageProxyUrl());
$this->attribute->setIframeWhitelist($this->config->getFilterIframeWhitelist(array()));
$this->attribute->setIntegerAttributes($this->config->getFilterIntegerAttributes(array()));
$this->attribute->setAttributeOverrides($this->config->getFilterAttributeOverrides(array()));
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php
index 1217bc4b0..5bb930b22 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php
@@ -30,19 +30,31 @@ class Atom extends Parser
* Find the feed url
*
* @access public
- * @param SimpleXMLElement $xml Feed xml
+ * @param SimpleXMLElement $xml Feed xml
* @param \PicoFeed\Parser\Feed $feed Feed object
*/
public function findFeedUrl(SimpleXMLElement $xml, Feed $feed)
{
- $feed->url = $this->getLink($xml);
+ $feed->feed_url = $this->getUrl($xml, 'self');
+ }
+
+ /**
+ * Find the site url
+ *
+ * @access public
+ * @param SimpleXMLElement $xml Feed xml
+ * @param \PicoFeed\Parser\Feed $feed Feed object
+ */
+ public function findSiteUrl(SimpleXMLElement $xml, Feed $feed)
+ {
+ $feed->site_url = $this->getUrl($xml, 'alternate', true);
}
/**
* Find the feed description
*
* @access public
- * @param SimpleXMLElement $xml Feed xml
+ * @param SimpleXMLElement $xml Feed xml
* @param \PicoFeed\Parser\Feed $feed Feed object
*/
public function findFeedDescription(SimpleXMLElement $xml, Feed $feed)
@@ -54,7 +66,7 @@ class Atom extends Parser
* Find the feed logo url
*
* @access public
- * @param SimpleXMLElement $xml Feed xml
+ * @param SimpleXMLElement $xml Feed xml
* @param \PicoFeed\Parser\Feed $feed Feed object
*/
public function findFeedLogo(SimpleXMLElement $xml, Feed $feed)
@@ -66,19 +78,19 @@ class Atom extends Parser
* Find the feed title
*
* @access public
- * @param SimpleXMLElement $xml Feed xml
+ * @param SimpleXMLElement $xml Feed xml
* @param \PicoFeed\Parser\Feed $feed Feed object
*/
public function findFeedTitle(SimpleXMLElement $xml, Feed $feed)
{
- $feed->title = Filter::stripWhiteSpace((string) $xml->title) ?: $feed->url;
+ $feed->title = Filter::stripWhiteSpace((string) $xml->title) ?: $feed->getSiteUrl();
}
/**
* Find the feed language
*
* @access public
- * @param SimpleXMLElement $xml Feed xml
+ * @param SimpleXMLElement $xml Feed xml
* @param \PicoFeed\Parser\Feed $feed Feed object
*/
public function findFeedLanguage(SimpleXMLElement $xml, Feed $feed)
@@ -90,7 +102,7 @@ class Atom extends Parser
* Find the feed id
*
* @access public
- * @param SimpleXMLElement $xml Feed xml
+ * @param SimpleXMLElement $xml Feed xml
* @param \PicoFeed\Parser\Feed $feed Feed object
*/
public function findFeedId(SimpleXMLElement $xml, Feed $feed)
@@ -102,7 +114,7 @@ class Atom extends Parser
* Find the feed date
*
* @access public
- * @param SimpleXMLElement $xml Feed xml
+ * @param SimpleXMLElement $xml Feed xml
* @param \PicoFeed\Parser\Feed $feed Feed object
*/
public function findFeedDate(SimpleXMLElement $xml, Feed $feed)
@@ -115,7 +127,7 @@ class Atom extends Parser
*
* @access public
* @param SimpleXMLElement $entry Feed item
- * @param Item $item Item object
+ * @param Item $item Item object
*/
public function findItemDate(SimpleXMLElement $entry, Item $item)
{
@@ -145,8 +157,8 @@ class Atom extends Parser
* Find the item author
*
* @access public
- * @param SimpleXMLElement $xml Feed
- * @param SimpleXMLElement $entry Feed item
+ * @param SimpleXMLElement $xml Feed
+ * @param SimpleXMLElement $entry Feed item
* @param \PicoFeed\Parser\Item $item Item object
*/
public function findItemAuthor(SimpleXMLElement $xml, SimpleXMLElement $entry, Item $item)
@@ -180,7 +192,7 @@ class Atom extends Parser
*/
public function findItemUrl(SimpleXMLElement $entry, Item $item)
{
- $item->url = $this->getLink($entry);
+ $item->url = $this->getUrl($entry, 'alternate');
}
/**
@@ -215,13 +227,11 @@ class Atom extends Parser
*/
public function findItemEnclosure(SimpleXMLElement $entry, Item $item, Feed $feed)
{
- foreach ($entry->link as $link) {
- if ((string) $link['rel'] === 'enclosure') {
+ $enclosure = $this->findLink($entry, 'enclosure');
- $item->enclosure_url = Url::resolve((string) $link['href'], $feed->url);
- $item->enclosure_type = (string) $link['type'];
- break;
- }
+ if ($enclosure) {
+ $item->enclosure_url = Url::resolve((string) $enclosure['href'], $feed->getSiteUrl());
+ $item->enclosure_type = (string) $enclosure['type'];
}
}
@@ -241,29 +251,54 @@ class Atom extends Parser
/**
* Get the URL from a link tag
*
- * @access public
- * @param SimpleXMLElement $xml XML tag
+ * @access private
+ * @param SimpleXMLElement $xml XML tag
+ * @param string $rel Link relationship: alternate, enclosure, related, self, via
* @return string
*/
- public function getLink(SimpleXMLElement $xml)
+ private function getUrl(SimpleXMLElement $xml, $rel, $fallback = false)
+ {
+ $link = $this->findLink($xml, $rel);
+
+ if ($link) {
+ return (string) $link['href'];
+ }
+
+ if ($fallback) {
+ $link = $this->findLink($xml, '');
+ return $link ? (string) $link['href'] : '';
+ }
+
+ return '';
+ }
+
+ /**
+ * Get a link tag that match a relationship
+ *
+ * @access private
+ * @param SimpleXMLElement $xml XML tag
+ * @param string $rel Link relationship: alternate, enclosure, related, self, via
+ * @return SimpleXMLElement|null
+ */
+ private function findLink(SimpleXMLElement $xml, $rel)
{
foreach ($xml->link as $link) {
- if ((string) $link['type'] === 'text/html' || (string) $link['type'] === 'application/xhtml+xml') {
- return (string) $link['href'];
+ if (empty($rel) || $rel === (string) $link['rel']) {
+ return $link;
}
}
- return (string) $xml->link['href'];
+ return null;
}
/**
* Get the entry content
*
- * @access public
+ * @access private
* @param SimpleXMLElement $entry XML Entry
* @return string
*/
- public function getContent(SimpleXMLElement $entry)
+ private function getContent(SimpleXMLElement $entry)
{
if (isset($entry->content) && ! empty($entry->content)) {
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Feed.php b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Feed.php
index 77a6f0c97..b8edbd6f8 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Feed.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Feed.php
@@ -48,7 +48,15 @@ class Feed
* @access public
* @var string
*/
- public $url = '';
+ public $feed_url = '';
+
+ /**
+ * Site url
+ *
+ * @access public
+ * @var string
+ */
+ public $site_url = '';
/**
* Feed date
@@ -84,7 +92,7 @@ class Feed
{
$output = '';
- foreach (array('id', 'title', 'url', 'date', 'language', 'description', 'logo') as $property) {
+ foreach (array('id', 'title', 'feed_url', 'site_url', 'date', 'language', 'description', 'logo') as $property) {
$output .= 'Feed::'.$property.' = '.$this->$property.PHP_EOL;
}
@@ -132,14 +140,25 @@ class Feed
}
/**
- * Get url
+ * Get feed url
+ *
+ * @access public
+ * $return string
+ */
+ public function getFeedUrl()
+ {
+ return $this->feed_url;
+ }
+
+ /**
+ * Get site url
*
* @access public
* $return string
*/
- public function getUrl()
+ public function getSiteUrl()
{
- return $this->url;
+ return $this->site_url;
}
/**
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php
index 1731f5a29..6b2864ba7 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php
@@ -11,6 +11,23 @@ namespace PicoFeed\Parser;
class Item
{
/**
+ * List of known RTL languages
+ *
+ * @access public
+ * @var public
+ */
+ public $rtl = array(
+ 'ar', // Arabic (ar-**)
+ 'fa', // Farsi (fa-**)
+ 'ur', // Urdu (ur-**)
+ 'ps', // Pashtu (ps-**)
+ 'syr', // Syriac (syr-**)
+ 'dv', // Divehi (dv-**)
+ 'he', // Hebrew (he-**)
+ 'yi', // Yiddish (yi-**)
+ );
+
+ /**
* Item id
*
* @access public
@@ -96,6 +113,7 @@ class Item
$output .= 'Item::'.$property.' = '.$this->$property.PHP_EOL;
}
+ $output .= 'Item::isRTL() = '.($this->isRTL() ? 'true' : 'false').PHP_EOL;
$output .= 'Item::content = '.strlen($this->content).' bytes'.PHP_EOL;
return $output;
@@ -199,4 +217,23 @@ class Item
{
return $this->author;
}
+
+ /**
+ * Return true if the item is "Right to Left"
+ *
+ * @access public
+ * @return bool
+ */
+ public function isRTL()
+ {
+ $language = strtolower($this->language);
+
+ foreach ($this->rtl as $prefix) {
+ if (strpos($language, $prefix) === 0) {
+ return true;
+ }
+ }
+
+ return false;
+ }
}
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Parser.php b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Parser.php
index 80e09e016..de73504e4 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Parser.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Parser.php
@@ -141,6 +141,9 @@ abstract class Parser
$this->findFeedUrl($xml, $feed);
$this->checkFeedUrl($feed);
+ $this->findSiteUrl($xml, $feed);
+ $this->checkSiteUrl($feed);
+
$this->findFeedTitle($xml, $feed);
$this->findFeedDescription($xml, $feed);
$this->findFeedLanguage($xml, $feed);
@@ -185,10 +188,27 @@ abstract class Parser
*/
public function checkFeedUrl(Feed $feed)
{
- $url = new Url($feed->getUrl());
+ if ($feed->getFeedUrl() === '') {
+ $feed->feed_url = $this->fallback_url;
+ }
+ else {
+ $feed->feed_url = Url::resolve($feed->getFeedUrl(), $this->fallback_url);
+ }
+ }
- if ($url->isRelativeUrl()) {
- $feed->url = $this->fallback_url;
+ /**
+ * Check if the site url is correct
+ *
+ * @access public
+ * @param Feed $feed Feed object
+ */
+ public function checkSiteUrl(Feed $feed)
+ {
+ if ($feed->getSiteUrl() === '') {
+ $feed->site_url = Url::base($feed->getFeedUrl());
+ }
+ else {
+ $feed->site_url = Url::resolve($feed->getSiteUrl(), $this->fallback_url);
}
}
@@ -201,11 +221,7 @@ abstract class Parser
*/
public function checkItemUrl(Feed $feed, Item $item)
{
- $url = new Url($item->getUrl());
-
- if ($url->isRelativeUrl()) {
- $item->url = Url::resolve($item->getUrl(), $feed->getUrl());
- }
+ $item->url = Url::resolve($item->getUrl(), $feed->getSiteUrl());
}
/**
@@ -238,7 +254,7 @@ abstract class Parser
public function filterItemContent(Feed $feed, Item $item)
{
if ($this->isFilteringEnabled()) {
- $filter = Filter::html($item->getContent(), $feed->getUrl());
+ $filter = Filter::html($item->getContent(), $feed->getSiteUrl());
$filter->setConfig($this->config);
$item->content = $filter->execute();
}
@@ -283,6 +299,7 @@ abstract class Parser
'D, d M Y H:i:s' => 25,
'D, d M Y h:i:s' => 25,
'D M d Y H:i:s' => 24,
+ 'j M Y H:i:s' => 20,
'Y-m-d H:i:s' => 19,
'Y-m-d\TH:i:s' => 19,
'd/m/Y H:i:s' => 19,
@@ -340,38 +357,6 @@ abstract class Parser
}
/**
- * Return true if the given language is "Right to Left"
- *
- * @static
- * @access public
- * @param string $language Language: fr-FR, en-US
- * @return bool
- */
- public static function isLanguageRTL($language)
- {
- $language = strtolower($language);
-
- $rtl_languages = array(
- 'ar', // Arabic (ar-**)
- 'fa', // Farsi (fa-**)
- 'ur', // Urdu (ur-**)
- 'ps', // Pashtu (ps-**)
- 'syr', // Syriac (syr-**)
- 'dv', // Divehi (dv-**)
- 'he', // Hebrew (he-**)
- 'yi', // Yiddish (yi-**)
- );
-
- foreach ($rtl_languages as $prefix) {
- if (strpos($language, $prefix) === 0) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
* Set Hash algorithm used for id generation
*
* @access public
@@ -464,16 +449,25 @@ abstract class Parser
* Find the feed url
*
* @access public
- * @param SimpleXMLElement $xml Feed xml
+ * @param SimpleXMLElement $xml Feed xml
* @param \PicoFeed\Parser\Feed $feed Feed object
*/
public abstract function findFeedUrl(SimpleXMLElement $xml, Feed $feed);
/**
+ * Find the site url
+ *
+ * @access public
+ * @param SimpleXMLElement $xml Feed xml
+ * @param \PicoFeed\Parser\Feed $feed Feed object
+ */
+ public abstract function findSiteUrl(SimpleXMLElement $xml, Feed $feed);
+
+ /**
* Find the feed title
*
* @access public
- * @param SimpleXMLElement $xml Feed xml
+ * @param SimpleXMLElement $xml Feed xml
* @param \PicoFeed\Parser\Feed $feed Feed object
*/
public abstract function findFeedTitle(SimpleXMLElement $xml, Feed $feed);
@@ -482,7 +476,7 @@ abstract class Parser
* Find the feed description
*
* @access public
- * @param SimpleXMLElement $xml Feed xml
+ * @param SimpleXMLElement $xml Feed xml
* @param \PicoFeed\Parser\Feed $feed Feed object
*/
public abstract function findFeedDescription(SimpleXMLElement $xml, Feed $feed);
@@ -491,7 +485,7 @@ abstract class Parser
* Find the feed language
*
* @access public
- * @param SimpleXMLElement $xml Feed xml
+ * @param SimpleXMLElement $xml Feed xml
* @param \PicoFeed\Parser\Feed $feed Feed object
*/
public abstract function findFeedLanguage(SimpleXMLElement $xml, Feed $feed);
@@ -500,7 +494,7 @@ abstract class Parser
* Find the feed id
*
* @access public
- * @param SimpleXMLElement $xml Feed xml
+ * @param SimpleXMLElement $xml Feed xml
* @param \PicoFeed\Parser\Feed $feed Feed object
*/
public abstract function findFeedId(SimpleXMLElement $xml, Feed $feed);
@@ -509,7 +503,7 @@ abstract class Parser
* Find the feed date
*
* @access public
- * @param SimpleXMLElement $xml Feed xml
+ * @param SimpleXMLElement $xml Feed xml
* @param \PicoFeed\Parser\Feed $feed Feed object
*/
public abstract function findFeedDate(SimpleXMLElement $xml, Feed $feed);
@@ -518,7 +512,7 @@ abstract class Parser
* Find the feed logo url
*
* @access public
- * @param SimpleXMLElement $xml Feed xml
+ * @param SimpleXMLElement $xml Feed xml
* @param \PicoFeed\Parser\Feed $feed Feed object
*/
public abstract function findFeedLogo(SimpleXMLElement $xml, Feed $feed);
@@ -536,8 +530,8 @@ abstract class Parser
* Find the item author
*
* @access public
- * @param SimpleXMLElement $xml Feed
- * @param SimpleXMLElement $entry Feed item
+ * @param SimpleXMLElement $xml Feed
+ * @param SimpleXMLElement $entry Feed item
* @param \PicoFeed\Parser\Item $item Item object
*/
public abstract function findItemAuthor(SimpleXMLElement $xml, SimpleXMLElement $entry, Item $item);
@@ -546,7 +540,7 @@ abstract class Parser
* Find the item URL
*
* @access public
- * @param SimpleXMLElement $entry Feed item
+ * @param SimpleXMLElement $entry Feed item
* @param \PicoFeed\Parser\Item $item Item object
*/
public abstract function findItemUrl(SimpleXMLElement $entry, Item $item);
@@ -555,7 +549,7 @@ abstract class Parser
* Find the item title
*
* @access public
- * @param SimpleXMLElement $entry Feed item
+ * @param SimpleXMLElement $entry Feed item
* @param \PicoFeed\Parser\Item $item Item object
*/
public abstract function findItemTitle(SimpleXMLElement $entry, Item $item);
@@ -564,7 +558,7 @@ abstract class Parser
* Genereate the item id
*
* @access public
- * @param SimpleXMLElement $entry Feed item
+ * @param SimpleXMLElement $entry Feed item
* @param \PicoFeed\Parser\Item $item Item object
* @param \PicoFeed\Parser\Feed $feed Feed object
*/
@@ -574,7 +568,7 @@ abstract class Parser
* Find the item date
*
* @access public
- * @param SimpleXMLElement $entry Feed item
+ * @param SimpleXMLElement $entry Feed item
* @param \PicoFeed\Parser\Item $item Item object
*/
public abstract function findItemDate(SimpleXMLElement $entry, Item $item);
@@ -583,7 +577,7 @@ abstract class Parser
* Find the item content
*