Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] Bugs in parser
#5
ZiNga BuRgA Wrote:This is from a previous thread:
http://community.mybboard.net/showthread.php?tid=17588

Tikitiki asked me to post here, so:
Quote:
Tikitiki Wrote:As for {{mybb-code}} I ask you to not use it, as there is no other alternative.
Nah, I don't mind that, but I'm suggesting the { and } characters, entered by the user gets replaced with the &xxxx; equivalents. This is what I use in the parser:
		// If MyCode needs to be replaced, first filter out [code] and [php] tags.
		if($options['allow_mycode'] != "no")
		{
			//replace \, { and }s to save trouble later
			$message = str_replace("{", '{', $message);
			$message = str_replace("}", '}', $message);
			$message = str_replace("\\", '\', $message);
			$message = str_replace("\"", '"', $message);

			// First we split up the contents of code and php tags to ensure they're not parsed.
			preg_match_all("#\[(code|php)\](.*?)\[/\\1\](\r\n?|\n?)#si", $message, $code_matches, PREG_SET_ORDER);
			$message = preg_replace("#\[(code|php)\](.*?)\[/\\1\](\r\n?|\n?)#si", "{{mybb-code}}\n", $message);
		}
Oh, and replacing the \ character at that point fixes another bug with the parser.
*EDIT* Note that the '\' is really '\' - this is also a bug :|

but but \ already gets converted to \. . .
And also the bug with \ should be \ seems to only exist after editing?
Also other parts of your code will break the whole idea with an highlighter. We can't convert " to &quote; before after the php highlight function has been ran.


Messages In This Thread
[F] Bugs in parser - by Yumi - 03-24-2007, 01:24 AM
RE: Bugs in parser - by Ryan Gordon - 04-05-2007, 03:25 AM
RE: Bugs in parser - by Martin M. - 05-13-2007, 07:54 PM
RE: Bugs in parser - by Ryan Gordon - 05-13-2007, 08:55 PM
RE: Bugs in parser - by Martin M. - 05-19-2007, 02:15 PM
RE: Bugs in parser - by Chris Boulton - 06-17-2007, 01:19 PM
RE: [F] Bugs in parser - by Chris Boulton - 06-17-2007, 01:19 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)