*/
static function getDoubleUnderscoreArray() {
if ( is_null( self::$mDoubleUnderscoreArray ) ) {
+ wfRunHooks( 'GetDoubleUnderscoreIDs', array( &self::$mDoubleUnderscoreIDs ) );
self::$mDoubleUnderscoreArray = new MagicWordArray( self::$mDoubleUnderscoreIDs );
}
return self::$mDoubleUnderscoreArray;
* Initialises this object with an ID
*
* @param $id
+ * @throws MWException
*/
function load( $id ) {
global $wgContLang;
*
* @return string
*/
- function getVariableRegex() {
+ function getVariableRegex() {
if ( $this->mVariableRegex == '' ) {
$this->initRegex();
}
*
* @return bool
*/
- function getWasModified(){
+ function getWasModified() {
return $this->mModified;
}
*
* @return bool
*/
- function replaceMultiple( $magicarr, $subject, &$result ){
+ function replaceMultiple( $magicarr, $subject, &$result ) {
$search = array();
$replace = array();
- foreach( $magicarr as $id => $replacement ){
+ foreach( $magicarr as $id => $replacement ) {
$mw = MagicWord::get( $id );
$search[] = $mw->getRegex();
$replace[] = $replacement;
var $baseRegex, $regex;
var $matches;
+ /**
+ * @param $names array
+ */
function __construct( $names = array() ) {
$this->names = $names;
}
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)
*
* @param $m array
*
+ * @throws MWException
* @return array
*/
function parseMatch( $m ) {
$regexes = $this->getVariableStartToEndRegex();
foreach ( $regexes as $regex ) {
if ( $regex !== '' ) {
- $m = false;
+ $m = array();
if ( preg_match( $regex, $text, $m ) ) {
return $this->parseMatch( $m );
}