diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-12-17 09:01:54 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-12-17 09:02:13 +0100 |
commit | 867cb7dbf960dc0cfbf7e59d656d1337bb59c526 (patch) | |
tree | 5bbdf1eef51cd3747f55ef2c524364f9cd3bf029 /vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php | |
parent | a813b535eeb517e0ccd69a90d0058756014a1e01 (diff) |
update picofeed, fix #695
Diffstat (limited to 'vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php')
-rw-r--r-- | vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php | 37 |
1 files changed, 37 insertions, 0 deletions
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; + } } |