コード例 #1
0
 public static function isValidRTL()
 {
     global $global_e;
     if (isset($global_e->attr["lang"])) {
         $lang_code = trim($global_e->attr["lang"]);
     } else {
         $lang_code = trim($global_e->attr["xml:lang"]);
     }
     // return no error if language code is not specified
     if (!BasicChecks::isValidLangCode($lang_code)) {
         return true;
     }
     $rtl_lang_codes = BasicChecks::getRtlLangCodes();
     if (in_array($lang_code, $rtl_lang_codes)) {
         // When these 2 languages, "dir" attribute must be set and set to "rtl"
         return strtolower(trim($global_e->attr["dir"])) == "rtl";
     } else {
         return !isset($global_e->attr["dir"]) || strtolower(trim($global_e->attr["dir"])) == "ltr";
     }
 }