X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FMagicWord.php;h=357eae4a338aa000b6e41e8babef7096b3abd42c;hb=cb60d72be1316d3d49ec9e636f18a1143f263d78;hp=997034cf4659a5680c686c80ad0c5ae03814daf9;hpb=aab43dd49523476f3ec28c695e43006446a7be7a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 997034cf46..357eae4a33 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -299,6 +299,7 @@ class MagicWord { * Initialises this object with an ID * * @param $id + * @throws MWException */ function load( $id ) { global $wgContLang; @@ -533,7 +534,7 @@ class MagicWord { * * @return string */ - function getVariableRegex() { + function getVariableRegex() { if ( $this->mVariableRegex == '' ) { $this->initRegex(); } @@ -576,7 +577,7 @@ class MagicWord { * * @return bool */ - function getWasModified(){ + function getWasModified() { return $this->mModified; } @@ -593,7 +594,7 @@ class MagicWord { * * @return bool */ - function replaceMultiple( $magicarr, $subject, &$result ){ + function replaceMultiple( $magicarr, $subject, &$result ) { $search = array(); $replace = array(); foreach( $magicarr as $id => $replacement ){ @@ -645,6 +646,9 @@ class MagicWordArray { var $baseRegex, $regex; var $matches; + /** + * @param $names array + */ function __construct( $names = array() ) { $this->names = $names; } @@ -772,6 +776,14 @@ class MagicWordArray { return $newRegex; } + /** + * @since 1.20 + * @return array + */ + public function getNames() { + return $this->names; + } + /** * Parse a match array from preg_match * Returns array(magic word ID, parameter value) @@ -779,6 +791,7 @@ class MagicWordArray { * * @param $m array * + * @throws MWException * @return array */ function parseMatch( $m ) { @@ -815,7 +828,7 @@ class MagicWordArray { $regexes = $this->getVariableStartToEndRegex(); foreach ( $regexes as $regex ) { if ( $regex !== '' ) { - $m = false; + $m = array(); if ( preg_match( $regex, $text, $m ) ) { return $this->parseMatch( $m ); }