Esempio n. 1
0
 public function __construct()
 {
     // This will set $locale and collators, which affect the actual sorting order
     parent::__construct('fa');
     // Override the 'fa' language set by parent constructor, which affects #getFirstLetterData()
     $this->digitTransformLanguage = Language::factory('ckb');
 }
Esempio n. 2
0
 function charCallback($data)
 {
     // Skip non-printable characters,
     // but do not skip a normal space (U+0020) since
     // people like to use that as a fake no header symbol.
     $category = substr($data['gc'], 0, 1);
     if (strpos('LNPS', $category) === false && $data['cp'] !== '0020') {
         return;
     }
     $cp = hexdec($data['cp']);
     // Skip the CJK ideograph blocks, as an optimisation measure.
     // UCA doesn't sort them properly anyway, without tailoring.
     if (IcuCollation::isCjk($cp)) {
         return;
     }
     // Skip the composed Hangul syllables, we will use the bare Jamo
     // as first letters
     if ($data['block'] == 'Hangul Syllables') {
         return;
     }
     // Calculate implicit weight per UTS #10 v6.0.0, sec 7.1.3
     if ($data['UIdeo'] === 'Y') {
         if ($data['block'] == 'CJK Unified Ideographs' || $data['block'] == 'CJK Compatibility Ideographs') {
             $base = 0xfb40;
         } else {
             $base = 0xfb80;
         }
     } else {
         $base = 0xfbc0;
     }
     $a = $base + ($cp >> 15);
     $b = $cp & 0x7fff | 0x8000;
     $this->weights[$cp] = sprintf(".%04X.%04X", $a, $b);
     if ($data['dm'] !== '#') {
         $this->mappedChars[$cp] = true;
     }
     if ($cp % 4096 == 0) {
         print "{$data['cp']}\n";
     }
 }
Esempio n. 3
0
 function getFirstLetter($string)
 {
     return self::unmangle(parent::getFirstLetter(self::mangle($string)));
 }
Esempio n. 4
0
 /**
  * Return the version of Unicode appropriate for the version of ICU library
  * currently in use, or false when it can't be determined.
  *
  * @since 1.21
  * @return string|bool
  */
 static function getUnicodeVersionForICU()
 {
     $icuVersion = IcuCollation::getICUVersion();
     if (!$icuVersion) {
         return false;
     }
     $versionPrefix = substr($icuVersion, 0, 3);
     // Source: http://site.icu-project.org/download
     $map = ['50.' => '6.2', '49.' => '6.1', '4.8' => '6.0', '4.6' => '6.0', '4.4' => '5.2', '4.2' => '5.1', '4.0' => '5.1', '3.8' => '5.0', '3.6' => '5.0', '3.4' => '4.1'];
     if (isset($map[$versionPrefix])) {
         return $map[$versionPrefix];
     } else {
         return false;
     }
 }
Esempio n. 5
0
 /**
  * Returns wiki text showing the third party software versions (apache, php, mysql).
  *
  * @return string
  */
 public static function softwareInformation()
 {
     $dbr = wfGetDB(DB_REPLICA);
     // Put the software in an array of form 'name' => 'version'. All messages should
     // be loaded here, so feel free to use wfMessage in the 'name'. Raw HTML or
     // wikimarkup can be used.
     $software = [];
     $software['[https://www.mediawiki.org/ MediaWiki]'] = self::getVersionLinked();
     if (wfIsHHVM()) {
         $software['[http://hhvm.com/ HHVM]'] = HHVM_VERSION . " (" . PHP_SAPI . ")";
     } else {
         $software['[https://php.net/ PHP]'] = PHP_VERSION . " (" . PHP_SAPI . ")";
     }
     $software[$dbr->getSoftwareLink()] = $dbr->getServerInfo();
     if (IcuCollation::getICUVersion()) {
         $software['[http://site.icu-project.org/ ICU]'] = IcuCollation::getICUVersion();
     }
     // Allow a hook to add/remove items.
     Hooks::run('SoftwareInfo', [&$software]);
     $out = Xml::element('h2', ['id' => 'mw-version-software'], wfMessage('version-software')->text()) . Xml::openElement('table', ['class' => 'wikitable plainlinks', 'id' => 'sv-software']) . "<tr>\n\t\t\t\t\t<th>" . wfMessage('version-software-product')->text() . "</th>\n\t\t\t\t\t<th>" . wfMessage('version-software-version')->text() . "</th>\n\t\t\t\t</tr>\n";
     foreach ($software as $name => $version) {
         $out .= "<tr>\n\t\t\t\t\t<td>" . $name . "</td>\n\t\t\t\t\t<td dir=\"ltr\">" . $version . "</td>\n\t\t\t\t</tr>\n";
     }
     return $out . Xml::closeElement('table');
 }