本文整理汇总了PHP中WT_I18N::languageScript方法的典型用法代码示例。如果您正苦于以下问题:PHP WT_I18N::languageScript方法的具体用法?PHP WT_I18N::languageScript怎么用?PHP WT_I18N::languageScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WT_I18N
的用法示例。
在下文中一共展示了WT_I18N::languageScript方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: spanLTRRTL
//.........这里部分代码省略.........
} else {
$currentLetter = $currentLetter . WT_UTF8_PDF;
// Include a trailing + or - in the run
}
}
}
}
} else {
// If we're outside a numeric string, look for reasons to start it
if (strpos($numberPrefix, $currentLetter) !== false) {
// This might be a number lead-in
$offset = $currentLen;
$nextChar = substr($workingText . "\n", $offset, 1);
if (strpos($numbers, $nextChar) !== false) {
$numberState = true;
// We found a digit: the lead-in is therefore numeric
if ($currentState == 'RTL') {
$currentLetter = WT_UTF8_LRE . $currentLetter;
}
}
} else {
if (strpos($numbers, $currentLetter) !== false) {
$numberState = true;
// The current letter is a digit
if ($currentState == 'RTL') {
$currentLetter = WT_UTF8_LRE . $currentLetter;
}
}
}
}
// Determine the directionality of the current UTF-8 character
$newState = $currentState;
while (true) {
if (WT_I18N::scriptDirection(WT_I18N::languageScript($currentLetter)) == 'rtl') {
if ($currentState == '') {
$newState = 'RTL';
break;
}
if ($currentState == 'RTL') {
break;
}
// Switch to RTL only if this isn't a solitary RTL letter
$tempText = substr($workingText, $currentLen);
while ($tempText != '') {
$nextCharArray = getChar($tempText, 0);
$nextLetter = $nextCharArray['letter'];
$nextLen = $nextCharArray['length'];
$tempText = substr($tempText, $nextLen);
if (WT_I18N::scriptDirection(WT_I18N::languageScript($nextLetter)) == 'rtl') {
$newState = 'RTL';
break 2;
}
if (strpos($punctuation, $nextLetter) !== false || strpos($openPar, $nextLetter) !== false) {
$newState = 'RTL';
break 2;
}
if ($nextLetter == ' ') {
break;
}
$nextLetter .= substr($tempText . "\n", 0, 5);
if ($nextLetter == ' ') {
$tempText = substr($tempText, 5);
break;
}
}
// This is a solitary RTL letter : wrap it in UTF8 control codes to force LTR directionality