- $text = preg_replace_callback( $this->regexes[$i], array( &$this, 'replace' ), $text );
+ $regex = $this->regexes[$i];
+
+ // Horrible hack
+ if (!$linked) {
+ $regex = str_replace( array( '\[\[', '\]\]' ), '', $regex );
+ }
+
+ if ($match_whole) {
+ // Let's hope this works
+ $regex = preg_replace( '!^/!', '/^', $regex );
+ $regex = str_replace( $this->regexTrail,
+ '$'.$this->regexTrail, $regex );
+ }
+
+ // Another horrible hack
+ $this->mLinked = $linked;
+ $text = preg_replace_callback( $regex, array( &$this, 'replace' ), $text );
+ unset($this->mLinked);