X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fparser%2FLinkHolderArray.php;h=816f7f79126446546bce1f160766f0d04be0d139;hp=e7712f2b74c3e1c80bc24705fb63f0ab9efbfeb7;hb=08edb27f6ce31c676660a4ef89b87da79bde2cc2;hpb=9aba586d3b758719d9aa08b236a9de93956b6a96 diff --git a/includes/parser/LinkHolderArray.php b/includes/parser/LinkHolderArray.php index e7712f2b74..816f7f7912 100644 --- a/includes/parser/LinkHolderArray.php +++ b/includes/parser/LinkHolderArray.php @@ -134,7 +134,7 @@ class LinkHolderArray { $maxId = $newKey > $maxId ? $newKey : $maxId; } } - $texts = preg_replace_callback( '/()/', + $texts = preg_replace_callback( '/()/', [ $this, 'mergeForeignCallback' ], $texts ); # Renumber interwiki links @@ -143,7 +143,7 @@ class LinkHolderArray { $this->interwikis[$newKey] = $entry; $maxId = $newKey > $maxId ? $newKey : $maxId; } - $texts = preg_replace_callback( '/()/', + $texts = preg_replace_callback( '/()/', [ $this, 'mergeForeignCallback' ], $texts ); # Set the parent link ID to be beyond the highest used ID @@ -172,7 +172,7 @@ class LinkHolderArray { # Internal links $pos = 0; while ( $pos < strlen( $text ) ) { - if ( !preg_match( '//', + if ( !preg_match( '//', $text, $m, PREG_OFFSET_CAPTURE, $pos ) ) { break; @@ -186,7 +186,7 @@ class LinkHolderArray { # Interwiki links $pos = 0; while ( $pos < strlen( $text ) ) { - if ( !preg_match( '//', $text, $m, PREG_OFFSET_CAPTURE, $pos ) ) { + if ( !preg_match( '//', $text, $m, PREG_OFFSET_CAPTURE, $pos ) ) { break; } $key = $m[1][0]; @@ -249,12 +249,12 @@ class LinkHolderArray { // Use a globally unique ID to keep the objects mergable $key = $this->parent->nextLinkID(); $this->interwikis[$key] = $entry; - $retVal = "{$trail}"; + $retVal = "{$trail}"; } else { $key = $this->parent->nextLinkID(); $ns = $nt->getNamespace(); $this->internals[$ns][$key] = $entry; - $retVal = "{$trail}"; + $retVal = "{$trail}"; } $this->size++; } @@ -264,7 +264,7 @@ class LinkHolderArray { /** * Replace link placeholders with actual links, in the buffer * - * @param string $text + * @param string &$text */ public function replace( &$text ) { $this->replaceInternal( $text ); @@ -273,7 +273,7 @@ class LinkHolderArray { /** * Replace internal links - * @param string $text + * @param string &$text */ protected function replaceInternal( &$text ) { if ( !$this->internals ) { @@ -374,7 +374,7 @@ class LinkHolderArray { $title = $entry['title']; $query = isset( $entry['query'] ) ? $entry['query'] : []; $key = "$ns:$index"; - $searchkey = ""; + $searchkey = ""; $displayText = $entry['text']; if ( isset( $entry['selflink'] ) ) { $replacePairs[$searchkey] = Linker::makeSelfLinkObj( $title, $displayText, $query ); @@ -408,7 +408,7 @@ class LinkHolderArray { # Do the thing $text = preg_replace_callback( - '/()/', + '/()/', $replacer->cb(), $text ); @@ -416,7 +416,7 @@ class LinkHolderArray { /** * Replace interwiki links - * @param string $text + * @param string &$text */ protected function replaceInterwiki( &$text ) { if ( empty( $this->interwikis ) ) { @@ -437,14 +437,14 @@ class LinkHolderArray { $replacer = new HashtableReplacer( $replacePairs, 1 ); $text = preg_replace_callback( - '//', + '//', $replacer->cb(), $text ); } /** * Modify $this->internals and $colours according to language variant linking rules - * @param array $colours + * @param array &$colours */ protected function doVariants( &$colours ) { global $wgContLang; @@ -612,8 +612,8 @@ class LinkHolderArray { */ public function replaceText( $text ) { $text = preg_replace_callback( - '//', - [ &$this, 'replaceTextCallback' ], + '//', + [ $this, 'replaceTextCallback' ], $text ); return $text;