The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
||||
|
||||
using preg_replace to turn one BB Code into another BB Code...
What I need to do is when a message is quoted to replace one bb code inside the quote with another bb code...
So let's say the message data contains: Code:
[quote=BirOPrey;938322]This is a test [cust]http://www.google.com[/cust] more test. One more time [cust]http://www.yahoo.com[/cust][/quote] Hi. [cust]http://www.bing.com[/cust] Bye. Code:
[quote=BirOPrey;938322]This is a test [xxx]http://www.google.com[/xxx] more test. One more time [xxx]http://www.yahoo.com[/xxx][/quote] Hi. [cust]http://www.bing.com[/cust] Bye. I'm thinking preg_replace will be the key to doing this... to match [cust] and [/cust] and replace with [xxx] and [/xxx] only within a quote- but I have read the pho manual on preg_replace and wondering if there isn't more to it? I found some info in this thread: https://vborg.vbsupport.ru/showthread.php?t=77173 But that code doesn't seem to work in 3.7/3.8... EDIT That line from that thread looks exactly like I want to do.., in class_bbcode.php after line 1424 I want to do a preg_replace on $html and change all the [cust] tags to [xxx] but this is never matching: Code:
$html = preg_replace('#\[test\]\s*(https?://([^<>*"]+|[a-z0-9/\\._\- !]+))\[/test\]#iue', "[url]$1[/url]", $html); Edit AGAIN It appears the problem is in 3.8 $html and $message are already converted to HTML so there are no bb code's left in the code at this point anymore, they have already been parsed. --------------- Added [DATE]1293416282[/DATE] at [TIME]1293416282[/TIME] --------------- Well I ended up just using str_replace, twice... Once to remove all the HTML in front of the {param} and replace it, and another to remove and replace all the code after the {param}... I was looking and I just don't see anywhere were the unparsed QUOTE only is available... --------------- Added [DATE]1293417599[/DATE] at [TIME]1293417599[/TIME] --------------- Wow... I found a mod that does everything I need really easily... at least this was a learning experience... https://vborg.vbsupport.ru/showthread.php?t=191223 :up: |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|