summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php')
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php37
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;
+ }
}