當前位置: 首頁>>代碼示例>>PHP>>正文


PHP I18N::textScript方法代碼示例

本文整理匯總了PHP中Fisharebest\Webtrees\I18N::textScript方法的典型用法代碼示例。如果您正苦於以下問題:PHP I18N::textScript方法的具體用法?PHP I18N::textScript怎麽用?PHP I18N::textScript使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Fisharebest\Webtrees\I18N的用法示例。


在下文中一共展示了I18N::textScript方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getSecondaryName

 /**
  * Which of the (possibly several) names of this record is the secondary one.
  *
  * @return int
  */
 public function getSecondaryName()
 {
     if (is_null($this->_getSecondaryName)) {
         // Generally, the primary and secondary names are the same
         $this->_getSecondaryName = $this->getPrimaryName();
         // ....except when there are names with different character sets
         $all_names = $this->getAllNames();
         if (count($all_names) > 1) {
             $primary_script = I18N::textScript($all_names[$this->getPrimaryName()]['sort']);
             foreach ($all_names as $n => $name) {
                 if ($n != $this->getPrimaryName() && $name['type'] != '_MARNM' && I18N::textScript($name['sort']) != $primary_script) {
                     $this->_getSecondaryName = $n;
                     break;
                 }
             }
         }
     }
     return $this->_getSecondaryName;
 }
開發者ID:AlexSnet,項目名稱:webtrees,代碼行數:24,代碼來源:GedcomRecord.php

示例2: spanLtrRtl


//.........這裏部分代碼省略.........
                                 if (strpos(self::NUMBER_PREFIX, $currentLetter) === false) {
                                     $currentLetter = WT_UTF8_PDF . $currentLetter;
                                 } 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(self::NUMBER_PREFIX, $currentLetter) !== false) {
                         // This might be a number lead-in
                         $offset = $currentLen;
                         $nextChar = substr($workingText . "\n", $offset, 1);
                         if (strpos(self::NUMBERS, $nextChar) !== false) {
                             $numberState = true;
                             // We found a digit: the lead-in is therefore numeric
                             if (self::$currentState == 'RTL') {
                                 $currentLetter = WT_UTF8_LRE . $currentLetter;
                             }
                         }
                     } elseif (strpos(self::NUMBERS, $currentLetter) !== false) {
                         $numberState = true;
                         // The current letter is a digit
                         if (self::$currentState == 'RTL') {
                             $currentLetter = WT_UTF8_LRE . $currentLetter;
                         }
                     }
                 }
                 // Determine the directionality of the current UTF-8 character
                 $newState = self::$currentState;
                 while (true) {
                     if (I18N::scriptDirection(I18N::textScript($currentLetter)) === 'rtl') {
                         if (self::$currentState == '') {
                             $newState = 'RTL';
                             break;
                         }
                         if (self::$currentState == 'RTL') {
                             break;
                         }
                         // Switch to RTL only if this isn't a solitary RTL letter
                         $tempText = substr($workingText, $currentLen);
                         while ($tempText != '') {
                             $nextCharArray = self::getChar($tempText, 0);
                             $nextLetter = $nextCharArray['letter'];
                             $nextLen = $nextCharArray['length'];
                             $tempText = substr($tempText, $nextLen);
                             if (I18N::scriptDirection(I18N::textScript($nextLetter)) === 'rtl') {
                                 $newState = 'RTL';
                                 break 2;
                             }
                             if (strpos(self::PUNCTUATION, $nextLetter) !== false || strpos(self::OPEN_PARENTHESES, $nextLetter) !== false) {
                                 $newState = 'RTL';
                                 break 2;
                             }
                             if ($nextLetter === ' ') {
                                 break;
                             }
                             $nextLetter .= substr($tempText . "\n", 0, 5);
                             if ($nextLetter === ' ') {
                                 break;
                             }
                         }
                         // This is a solitary RTL letter : wrap it in UTF8 control codes to force LTR directionality
                         $currentLetter = WT_UTF8_LRO . $currentLetter . WT_UTF8_PDF;
開發者ID:tunandras,項目名稱:webtrees,代碼行數:67,代碼來源:FunctionsRtl.php


注:本文中的Fisharebest\Webtrees\I18N::textScript方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。