X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=blobdiff_plain;f=includes%2FMagicWord.php;h=6e7799a308cbd08faa61a5b79a87939dfc4d218a;hb=015b74691b1320c37cef090e209c2794001a6e6f;hp=09317d7b1f1062e5a65c5b7e03e345a4c88919f6;hpb=b929c0eb7f3a0954af5aca6d50995d87fa83945b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 09317d7b1f..6e7799a308 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -46,8 +46,8 @@ * $magicWords = []; * * $magicWords['en'] = [ - * 'magicwordkey' => [ 0, 'case_insensitive_magic_word' ], - * 'magicwordkey2' => [ 1, 'CASE_sensitive_magic_word2' ], + * 'magicwordkey' => [ 0, 'case_insensitive_magic_word' ], + * 'magicwordkey2' => [ 1, 'CASE_sensitive_magic_word2' ], * ]; * @endcode * @@ -502,7 +502,7 @@ class MagicWord { # multiple matched parts (variable match); some will be empty because of # synonyms. The variable will be the second non-empty one so remove any # blank elements and re-sort the indices. - # See also bug 6526 + # See also T8526 $matches = array_values( array_filter( $matches ) ); @@ -518,7 +518,7 @@ class MagicWord { * Returns true if the text matches the word, and alters the * input string, removing all instances of the word * - * @param string $text + * @param string &$text * * @return bool */ @@ -534,7 +534,7 @@ class MagicWord { } /** - * @param string $text + * @param string &$text * @return bool */ public function matchStartAndRemove( &$text ) { @@ -646,38 +646,11 @@ class MagicWord { return $this->mModified; } - /** - * $magicarr is an associative array of (magic word ID => replacement) - * This method uses the php feature to do several replacements at the same time, - * thereby gaining some efficiency. The result is placed in the out variable - * $result. The return value is true if something was replaced. - * @deprecated since 1.25, unused - * - * @param array $magicarr - * @param string $subject - * @param string $result - * - * @return bool - */ - public function replaceMultiple( $magicarr, $subject, &$result ) { - wfDeprecated( __METHOD__, '1.25' ); - $search = []; - $replace = []; - foreach ( $magicarr as $id => $replacement ) { - $mw = MagicWord::get( $id ); - $search[] = $mw->getRegex(); - $replace[] = $replacement; - } - - $result = preg_replace( $search, $replace, $subject ); - return $result !== $subject; - } - /** * Adds all the synonyms of this MagicWord to an array, to allow quick * lookup in a list of magic words * - * @param array $array + * @param array &$array * @param string $value */ public function addToArray( &$array, $value ) {