X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=languages%2FLanguageConverter.php;h=6286a2b062781d7c7ce886ce375ab70a19969782;hb=097e69e7f5e203f381c1a2386d32f4ed136ad3e0;hp=2183c965d3a88392f22efa2df8b0f279510ff1d2;hpb=3d6e6cd952e640bd112f6871e64772df8b06e6ee;p=lhc%2Fweb%2Fwiklou.git diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index 2183c965d3..6286a2b062 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -99,13 +99,13 @@ class LanguageConverter { // '+' add rules for alltext // 'E' the gave flags is error // these flags above are reserved for program - 'A' => 'A', // add rule for convert code (all text convert) - 'T' => 'T', // title convert - 'R' => 'R', // raw content - 'D' => 'D', // convert description (subclass implement) - '-' => '-', // remove convert (not implement) - 'H' => 'H', // add rule for convert code (but no display in placed code) - 'N' => 'N' // current variant name + 'A' => 'A', // add rule for convert code (all text convert) + 'T' => 'T', // title convert + 'R' => 'R', // raw content + 'D' => 'D', // convert description (subclass implement) + '-' => '-', // remove convert (not implement) + 'H' => 'H', // add rule for convert code (but no display in placed code) + 'N' => 'N', // current variant name ]; $this->mFlags = array_merge( $defaultflags, $flags ); foreach ( $this->mVariants as $v ) { @@ -357,10 +357,10 @@ class LanguageConverter { } /* we convert everything except: - 1. HTML markups (anything between < and >) - 2. HTML entities - 3. placeholders created by the parser - */ + * 1. HTML markups (anything between < and >) + * 2. HTML entities + * 3. placeholders created by the parser + */ $marker = '|' . Parser::MARKER_PREFIX . '[\-a-zA-Z0-9]+'; // this one is needed when the text is inside an HTML markup @@ -380,6 +380,7 @@ class LanguageConverter { $literalBlob = ''; // Guard against delimiter nulls in the input + // (should never happen: see T159174) $text = str_replace( "\000", '', $text ); $markupMatches = null; @@ -844,9 +845,8 @@ class LanguageConverter { * @throws MWException */ function loadDefaultTables() { - $name = get_class( $this ); - - throw new MWException( "Must implement loadDefaultTables() method in class $name" ); + $class = static::class; + throw new MWException( "Must implement loadDefaultTables() method in class $class" ); } /** @@ -865,12 +865,9 @@ class LanguageConverter { $this->mTables = false; $cache = ObjectCache::getInstance( $wgLanguageConverterCacheType ); if ( $fromCache ) { - wfProfileIn( __METHOD__ . '-cache' ); $this->mTables = $cache->get( $this->mCacheKey ); - wfProfileOut( __METHOD__ . '-cache' ); } if ( !$this->mTables || !array_key_exists( self::CACHE_VERSION_KEY, $this->mTables ) ) { - wfProfileIn( __METHOD__ . '-recache' ); // not in cache, or we need a fresh reload. // We will first load the default tables // then update them using things in MediaWiki:Conversiontable/* @@ -884,7 +881,6 @@ class LanguageConverter { $this->mTables[self::CACHE_VERSION_KEY] = true; $cache->set( $this->mCacheKey, $this->mTables, 43200 ); - wfProfileOut( __METHOD__ . '-recache' ); } } @@ -1085,12 +1081,12 @@ class LanguageConverter { // text should be splited by ";" only if a valid variant // name exist after the markup, for example: // -{zh-hans:xxx;zh-hant:\ - // yyy;}- + // yyy;}- // we should split it as: // [ - // [0] => 'zh-hans:xxx' - // [1] => 'zh-hant:yyy' - // [2] => '' + // [0] => 'zh-hans:xxx' + // [1] => 'zh-hant:yyy' + // [2] => '' // ] $pat = '/;\s*(?='; foreach ( $this->mVariants as $variant ) {