The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
Hi
LATEST PROBLEM I was able to replace the code between my custom tags using... Code:
$text = preg_replace("/\[flow-rtmp\](.*)\[\/flow-rtmp\]/Usi", $replacement, $text); Any suggestion? Lux I need to replace a custom bbcode on the page NOT in the custom bb page. The code I'm putting in will be re-generated every time the page is loaded with different return values each time. I've started writing a simple plugin that will replace the custom bbcode but the problem I'm having is how to identify the tag by name, extract it's param and then replace it with new code. If anybody has an example of doing something like this it would be great. I've bee looking at loads of articles and other plugins for hours but no luck. All the code I've found so far relates to changing the bbcode when users are posting and not when the post is displayed which is what i'm trying to do. Thanks Lux --------------- Added [DATE]1345885381[/DATE] at [TIME]1345885381[/TIME] --------------- I came up with a solution in the end but I'm sure it's not the most elegant way of doing it. If anybody does have the correct solution please let me know. I ended up doing this to find the tag and extract the param/text Code:
foreach($this->tag_list as $tag_item => $tag){ if($tag['flow-rtmp']){ preg_match('/\[flow-rtmp\](.*?)\[\/flow-rtmp\]/i',$text,$match); if($match){ Like I said it's not the best solution but it's all I could come up with. Hopefully somebody has a more elegant/correct solution. Thanks Lux --------------- Added [DATE]1345945424[/DATE] at [TIME]1345945424[/TIME] --------------- Well while my solution seemed to have worked I noticed some problem with it. The code replaces ALL the text in the post and not just the text in between the custom bbcode which is not really what I want. I'll continue trying to find a solution but if anybody can shed some light on this I'd appreciate it. Thanks Lux |
#2
|
|||
|
|||
![]()
Take a look at my BB Code Hider...
https://vborg.vbsupport.ru/showthrea...ighlight=hider Your main concern will be with the bbcode_parse_start hook. Also pay attention to the uninstall code for the mod. |
#3
|
||||
|
||||
![]()
Hi nhawk - Thanks for the tip. I looked at the code but couldn't see any way to make the object html show as html rather than text on the page.
I'd figured out how to find my custom bb tag but the latest problem I have is that assigning the new text to $parsedtext means I lose all the formatting and the normal bbtags are just written to the page. If I assign it to $text then the object html shows as text on the page rather than showing the player as it should do. Any suggestions? Thanks Lux SOLUTION This is a bit of a hack but it works. I went ahead and used the $parsetext and then parsed it myself using pregreplace for the bbcode. Code:
$search = array( '@\[(?i)b\](.*?)\[/(?i)b\]@si', '@\[(?i)i\](.*?)\[/(?i)i\]@si', '@\[(?i)u\](.*?)\[/(?i)u\]@si', '@\[(?i)img\](.*?)\[/(?i)img\]@si', '@\[(?i)url=(.*?)\](.*?)\[/(?i)url\]@si', '@\[(?i)code\](.*?)\[/(?i)code\]@si' ); $replace = array( '<b>\\1</b>', '<i>\\1</i>', '<u>\\1</u>', '<img src="\\1">', '<a href="\\1">\\2</a>', '<code>\\1</code>' ); $parsedtext = nl2br(preg_replace($search, $replace, $parsedtext)); Thanks Lux |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|