function getDefaultUserOptions()
 {
     $opt = parent::getDefaultUserOptions();
     $opt['quickbar'] = 2;
     # Right-to-left
     return $opt;
 }
Example #2
0
 function getMessage($key)
 {
     if (isset($this->mMessagesEs[$key])) {
         return $this->mMessagesEs[$key];
     } else {
         return parent::getMessage($key);
     }
 }
 function ucfirst($string)
 {
     if ($string[0] == 'i') {
         return 'İ' . substr($string, 1);
     } else {
         return parent::ucfirst($string);
     }
 }
 function getMessage($key)
 {
     global $wgAllMessagesLa;
     if (isset($wgAllMessagesLa[$key])) {
         return $wgAllMessagesLa[$key];
     }
     return parent::getMessage($key);
 }
Example #5
0
 function getMessage($key)
 {
     global $wgAllMessagesTa;
     if (array_key_exists($key, $wgAllMessagesTa)) {
         return $wgAllMessagesTa[$key];
     } else {
         return parent::getMessage($key);
     }
 }
Example #6
0
 function timeanddate($ts, $adj = false, $format = false, $timecorrection = false)
 {
     $format = $this->dateFormat($format);
     if ($format == MW_DATE_ISO) {
         return parent::timeanddate($ts, $adj, $format, $timecorrection);
     } else {
         return $this->date($ts, $adj, $format, $timecorrection) . " kl." . $this->time($ts, $adj, $format, $timecorrection);
     }
 }
 function getMessage($key)
 {
     global $wgAllMessagesMs;
     if (isset($wgAllMessagesMs[$key])) {
         return $wgAllMessagesMs[$key];
     } else {
         return parent::getMessage($key);
     }
 }
Example #8
0
 function getDefaultUserOptions()
 {
     $opt = parent::getDefaultUserOptions();
     $opt["quickbar"] = 2;
     # Right-to-left
     $opt["underline"] = 0;
     # Underline is hard to read in Arabic script
     return $opt;
 }
Example #9
0
 function date($ts, $adj = false, $format = true, $timecorrection = false)
 {
     $datePreference = $this->dateFormat($format);
     if ($datePreference == MW_DATE_ISO) {
         return parent::date($ts, $adj, $datePreference, $timecorrection);
     } else {
         if ($adj) {
             $ts = $this->userAdjust($ts, $timecorrection);
         }
         # Adjust based on the timezone setting.
         // 20050310001506 => 10.03.2005
         $date = substr($ts, 6, 2) . '.' . substr($ts, 4, 2) . '.' . substr($ts, 0, 4);
         return $date;
     }
 }
 function stripForSearch($string)
 {
     $fname = "LanguageZh::stripForSearch";
     wfProfileIn($fname);
     // eventually this should be a word segmentation
     // for now just treat each character as a word
     $t = preg_replace("/([\\xc0-\\xff][\\x80-\\xbf]*)/e", "' ' .\"\$1\"", $string);
     //always convert to zh-cn before indexing. it should be
     //better to use zh-cn for search, since conversion from
     //Traditional to Simplified is less ambiguous than the
     //other way around
     $t = $this->mConverter->autoConvert($t, 'zh-cn');
     $t = LanguageUtf8::stripForSearch($t);
     wfProfileOut($fname);
     return $t;
 }
Example #11
0
 function lc($str, $first = false)
 {
     if (function_exists('mb_strtolower')) {
         if ($first) {
             if (LanguageUtf8::isMultibyte($str)) {
                 return mb_strtolower(mb_substr($str, 0, 1)) . mb_substr($str, 1);
             } else {
                 return strtolower(substr($str, 0, 1)) . substr($str, 1);
             }
         } else {
             return LanguageUtf8::isMultibyte($str) ? mb_strtolower($str) : strtolower($str);
         }
     } else {
         if (LanguageUtf8::isMultibyte($str)) {
             global $wikiLowerChars;
             $x = $first ? '^' : '';
             return preg_replace("/{$x}([A-Z]|[\\xc0-\\xff][\\x80-\\xbf]*)/e", "strtr( \"\$1\" , \$wikiLowerChars )", $str);
         } else {
             return $first ? strtolower(substr($str, 0, 1)) . substr($str, 1) : strtolower($str);
         }
     }
 }
Example #12
0
 function formatDay($day, $format)
 {
     return parent::formatDay($day, $format) . '.';
 }
Example #13
0
 function stripForSearch($string)
 {
     # MySQL fulltext index doesn't grok utf-8, so we
     # need to fold cases and convert to hex
     $s = $string;
     # Strip known punctuation ?
     #$s = preg_replace( '/\xe3\x80[\x80-\xbf]/', '', $s ); # U3000-303f
     # Space strings of like hiragana/katakana/kanji
     $hiragana = '(?:\\xe3(?:\\x81[\\x80-\\xbf]|\\x82[\\x80-\\x9f]))';
     # U3040-309f
     $katakana = '(?:\\xe3(?:\\x82[\\xa0-\\xbf]|\\x83[\\x80-\\xbf]))';
     # U30a0-30ff
     $kanji = '(?:\\xe3[\\x88-\\xbf][\\x80-\\xbf]' . '|[\\xe4-\\xe8][\\x80-\\xbf]{2}' . '|\\xe9[\\x80-\\xa5][\\x80-\\xbf]' . '|\\xe9\\xa6[\\x80-\\x99])';
     # U3200-9999 = \xe3\x88\x80-\xe9\xa6\x99
     $s = preg_replace("/({$hiragana}+|{$katakana}+|{$kanji}+)/", ' $1 ', $s);
     # Double-width roman characters: ff00-ff5f ~= 0020-007f
     $s = preg_replace('/\\xef\\xbc([\\x80-\\xbf])/e', 'chr((ord("$1") & 0x3f) + 0x20)', $s);
     $s = preg_replace('/\\xef\\xbd([\\x80-\\x99])/e', 'chr((ord("$1") & 0x3f) + 0x60)', $s);
     # Do general case folding and UTF-8 armoring
     return LanguageUtf8::stripForSearch($s);
 }
 function LanguageOs()
 {
     global $wgNamespaceNamesOs, $wgMetaNamespace;
     LanguageUtf8::LanguageUtf8();
 }
Example #15
0
 function LanguageCv()
 {
     global $wgNamespaceNamesCv, $wgMetaNamespace;
     LanguageUtf8::LanguageUtf8();
 }
Example #16
0
 function LanguageUdm()
 {
     global $wgNamespaceNamesUdm, $wgMetaNamespace;
     LanguageUtf8::LanguageUtf8();
 }
Example #17
0
 function compare($a, $b)
 {
     if ($a['name'] === $b['name']) {
         return 0;
     } else {
         return LanguageUtf8::lc($a['name']) > LanguageUtf8::lc($b['name']) ? 1 : -1;
     }
 }
Example #18
0
 function &getMagicWords()
 {
     $t = $this->mMagicWordsMk + parent::getMagicWords();
     return $t;
 }
 /**
  * parse the conversion table stored in the cache
  *
  * the tables should be in blocks of the following form:
  *		-{
  *			word => word ;
  *			word => word ;
  *			...
  *		}-
  *
  *	to make the tables more manageable, subpages are allowed
  *	and will be parsed recursively if $recursive=true
  *
  * @access private
  */
 function parseCachedTable($code, $subpage = '', $recursive = true)
 {
     global $wgMessageCache;
     static $parsed = array();
     if (!is_object($wgMessageCache)) {
         return array();
     }
     $key = 'Conversiontable/' . $code;
     if ($subpage) {
         $key .= '/' . $subpage;
     }
     if (array_key_exists($key, $parsed)) {
         return array();
     }
     $txt = $wgMessageCache->get($key, true, true, true);
     // get all subpage links of the form
     // [[MediaWiki:conversiontable/zh-xx/...|...]]
     $linkhead = $this->mLangObj->getNsText(NS_MEDIAWIKI) . ':Conversiontable';
     $subs = explode('[[', $txt);
     $sublinks = array();
     foreach ($subs as $sub) {
         $link = explode(']]', $sub, 2);
         if (count($link) != 2) {
             continue;
         }
         $b = explode('|', $link[0]);
         $b = explode('/', trim($b[0]), 3);
         if (count($b) == 3) {
             $sublink = $b[2];
         } else {
             $sublink = '';
         }
         if ($b[0] == $linkhead && $b[1] == $code) {
             $sublinks[] = $sublink;
         }
     }
     // parse the mappings in this page
     $blocks = explode($this->mMarkup['begin'], $txt);
     array_shift($blocks);
     $ret = array();
     foreach ($blocks as $block) {
         $mappings = explode($this->mMarkup['end'], $block, 2);
         $stripped = str_replace(array("'", '"', '*', '#'), '', $mappings[0]);
         $table = explode(';', $stripped);
         foreach ($table as $t) {
             $m = explode('=>', $t);
             if (count($m) != 2) {
                 continue;
             }
             // trim any trailling comments starting with '//'
             $tt = explode('//', $m[1], 2);
             $ret[trim($m[0])] = trim($tt[0]);
         }
     }
     $parsed[$key] = true;
     // recursively parse the subpages
     if ($recursive) {
         foreach ($sublinks as $link) {
             $s = $this->parseCachedTable($code, $link, $recursive);
             $ret = array_merge($ret, $s);
         }
     }
     if ($this->mUcfirst) {
         foreach ($ret as $k => $v) {
             $ret[LanguageUtf8::ucfirst($k)] = LanguageUtf8::ucfirst($v);
         }
     }
     return $ret;
 }
Example #20
0
 function getNamespaces()
 {
     return $this->mNamespaceNamesAst + parent::getNamespaces();
 }
Example #21
0
 function getMessage($key)
 {
     global $wgAllMessagesRu;
     return isset($wgAllMessagesRu[$key]) ? $wgAllMessagesRu[$key] : parent::getMessage($key);
 }
 function getMessage($key)
 {
     global $wgAllMessagesSk;
     if ($wgAllMessagesSk[$key]) {
         return $wgAllMessagesSk[$key];
     }
     return parent::getMessage($key);
 }