summaryrefslogtreecommitdiff
path: root/languages/LanguageConverter.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-12-20 09:00:55 +0100
committerPierre Schmitz <pierre@archlinux.de>2015-12-20 09:00:55 +0100
commita2190ac74dd4d7080b12bab90e552d7aa81209ef (patch)
tree8b31f38de9882d18df54cf8d9e0de74167a094eb /languages/LanguageConverter.php
parent15e69f7b20b6596b9148030acce5b59993b95a45 (diff)
parent257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff)
Merge branch 'mw-1.26'
Diffstat (limited to 'languages/LanguageConverter.php')
-rw-r--r--languages/LanguageConverter.php17
1 files changed, 4 insertions, 13 deletions
diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php
index 844888ee..78793090 100644
--- a/languages/LanguageConverter.php
+++ b/languages/LanguageConverter.php
@@ -355,12 +355,7 @@ class LanguageConverter {
2. HTML entities
3. placeholders created by the parser
*/
- global $wgParser;
- if ( isset( $wgParser ) && $wgParser->UniqPrefix() != '' ) {
- $marker = '|' . $wgParser->UniqPrefix() . '[\-a-zA-Z0-9]+';
- } else {
- $marker = '';
- }
+ $marker = '|' . Parser::MARKER_PREFIX . '[\-a-zA-Z0-9]+';
// this one is needed when the text is inside an HTML markup
$htmlfix = '|<[^>]+$|^[^<>]*>';
@@ -507,13 +502,9 @@ class LanguageConverter {
}
if ( $action == 'add' ) {
+ // More efficient than array_merge(), about 2.5 times.
foreach ( $pair as $from => $to ) {
- // to ensure that $from and $to not be left blank
- // so $this->translate() could always return a string
- if ( $from || $to ) {
- // more efficient than array_merge(), about 2.5 times.
- $this->mTables[$variant]->setPair( $from, $to );
- }
+ $this->mTables[$variant]->setPair( $from, $to );
}
} elseif ( $action == 'remove' ) {
$this->mTables[$variant]->removeArray( $pair );
@@ -1001,7 +992,7 @@ class LanguageConverter {
if ( $recursive ) {
foreach ( $sublinks as $link ) {
$s = $this->parseCachedTable( $code, $link, $recursive );
- $ret = array_merge( $ret, $s );
+ $ret = $s + $ret;
}
}