MyBB Community Forums

Full Version: class_parser.php oddity
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Looking to code a plugin to allow users to override word filter without modifying core files, but it looks like there is something odd in the class_parser.php file (1.4.9)

In parse_mesage( ) its using both the passed $options array variable and the objects $options variable that gets assigned from the $options parameter

		// Set the options		
		$this->options = $options;

		$message = $plugins->run_hooks("parse_message_start", $message);

		// Get rid of cartridge returns for they are the workings of the devil
		$message = str_replace("\r", "", $message);

		// Filter bad words if requested.
		if($options['filter_badwords'])
		{
			$message = $this->parse_badwords($message);
		}

		if($options['allow_html'] != 1)
		{
			$message = $this->parse_html($message);
		}

as you can see, $this->options is populated from the passed reference but the $options variable is continued to be used instead of using $this->options

Since $options is not global and I do not want to edit core files, I can't change the $options['filter_badwords'] value in my plugin that runs in 'parse_message_start'

However I can modify $this->options['filter_badwords'] since the $parser variable ($this) is global.

So I'd like to bring it to the developers attention to correct class_parser.php in future versions to use the appropriate $this->options variable.