PDA

View Full Version : BB Code Enhancements - IMG to URL BBCode Converter (In Quotes)


Dannyloski
08-18-2007, 10:00 PM
Hey Guys,

I know I was searching for a feature like this for the longest time and had no luck. Well I decided to do some digging and after a while I was able to find the code that you can use to remove the [IMG] Tag from Quotes in Posts under vB 3.6.0 and up.

This specific Modification will change all [IMG] Tags into Tags when they are inside a Quote. I guess that's pretty self explanatory.

Special thanks to masalaman for the code, I'm just posting it here for others to use it as they may be searching for it and it took me a while to find it. I guess this will just make you life's easier :up:

[U]Modification Instructions:

1) Open includes/class_bbcode.php
2) Find the following line:
eval('$html = "' . fetch_template($template) . '";');
3) After this line add the following:
// Start IMG to URL BBCode Converter
if ($this->contains_bbcode_img_tags($html))
{
$html = preg_replace('#\[img\]\s*(https?://([^<>*"]+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', "\$this->handle_bbcode_url(str_replace('\\\"', '\"', '\\1'), '')", $html);
}
// End IMG to URL BBCode Converter
4) Repeat steps 2-3 for every place that the line on Step 2 appears in the class_bbcode.php file (Four Times)
5) Save & Overwrite the File to your Server ... That's it! Enjoy!

- Danny

Dannyloski
08-19-2007, 03:36 AM
Reserved, just in case I need to update something ;)

HDT
08-19-2007, 04:10 AM
Subscibed first,installed later :) thanks for the mod

Dismounted
08-19-2007, 05:48 AM
You don't really need a file modification to do this...It can be done via plugins.

maxicep
08-19-2007, 03:03 PM
nice thanks.

Dannyloski
08-19-2007, 05:32 PM
Glad it can be useful for others :up:

You don't really need a file modification to do this...It can be done via plugins.
Well I do not know how to do plugins, if you wish to create one using the code above, feel free to do so and post it here. I did not write the code, it was written by masalaman, like I said in the first post. I just posted the code here so that other can use it since if you search for it you really have to do some digging until you find it on the forums.

Zia
08-20-2007, 02:29 AM
thnx...would be really nice if it could be done via plugins (previously it was done by HeLLcat)

if [img] likes [Img] or [iMg] or [IMG] or [imG] will that work too?
asking cos hellcat's plugin had that error ..tho later on it was fixed by him.

waiting fr a plugings

Dannyloski
08-20-2007, 02:45 PM
Zai, Im not going to be releasing a Plugin Version, so if you're gonna be waiting for that, you should ask someone else to see if they are willing to make a plug in. I might do it in the future, but I'm too busy right now to learn how to do Plugins, so I wont be dong it anytime soon.

As far as the error on the [img], [Img], [iMg], [IMG], [imG] that is not a problem with this Modification. It converts it anyway.

Stifmeister2
08-21-2007, 03:39 PM
Glad it can be useful for others :up:


Well I do not know how to do plugins, if you wish to create one using the code above, feel free to do so and post it here. I did not write the code, it was written by masalaman, like I said in the first post. I just posted the code here so that other can use it since if you search for it you really have to do some digging until you find it on the forums.
I would love that Dismounted. :)

Zia
08-25-2007, 03:05 AM
Zai,

Hhaha

Zia here not Zai :D

any way thnx mate

Dannyloski
08-27-2007, 12:57 AM
^ Oops, sorry ... Guess I got a typo there, must've been busy with other things :D

Still no news on the Plugin Version of this Mod guys ... Sorry, I looked into it, but seems kinda more in depth and stuff, so I'm not gonna be able to release it. Anyone and everyone is welcome to make the Plugin Version of this Hack and post it up if they want, so if you know how to do it, then do it - It would be best. I'm really busy now with other stuff, so I doubt I'll get around to it anytime soon ...

TeamDevotion
02-01-2008, 03:07 PM
alright, heres what I'm trying to do.

With this hack, the quote is modified once its submitted and not before, because even when you hit edit, it still says image tags, but when viewed, they are links.

The problem with this is that if you quoted 6 images, and wanted just one to show up as a picture and the other 5 as links you couldn't do this.

Is there anyway to get the code to convert the img to url when you first hit the quote button rather than right before it returns the value of the quote.

Dannyloski
04-06-2008, 04:05 AM
^ I do not think that is possible, but I did not make this Code I simply posted it so others could find it easier. It was made by masalaman, so maybe he would know the answer to this question ...

Anyways, I want BUMP this because it seems to not be working in vBulletin 3.6.9 ... When installed, the code makes anything that's inside the Quote Tags not visible. This was working fine in vB 3.6.8 PL2, but with the release of vB 3.6.9 the class_bbcode.php File was changed and that seems to have had an effect on this. The 4 Lines of the original code below are still there, but when replaced with the IMG to URL BBCode Converter Code, like you're suppose to, it does not work and causes the error that was previously stated.

eval('$html = "' . fetch_template($template) . '";');

I hope someone can shine some light as to why its happening and maybe even fix the code. Hopefully too, someone can come out with a Plugin Version rather than Manual File Edits. Anyone that can help would be highly appreciated and credit will be given appropriately in the Thread and First Post. If you wish to release a Fix in your own thread that is fine, just post the link here and I will edit the first post to point to that Link.

Boofo
04-06-2008, 04:12 AM
I thought uploading vb files was against the rules. You might want to make sure it is allowed now as it never used to be.

Dannyloski
04-06-2008, 04:16 AM
^ Well nobody has said anything for the past 8 Months that this has been out, so I guess its not against the Rules ... If it is in fact against the rules, then I would guess they would've removed the Attachment.

Anyone out there with an idea on a Fix for this in vB 3.6.9?

Dismounted
04-06-2008, 07:28 AM
Attachment removed, as per out rules (https://vborg.vbsupport.ru/info.php?do=rules).
No spreading of any copyrighted material (vBulletin or other) is to take place on this site without the expressed permission of the copyright holder, which must be attached to the material. For example, you cannot upload complete vBulletin files. Partial code is permitted, as long as it is solely for the location of the correct place in the code. Any copyrighted code snippets should be no more than 10 lines in length, unless approved by a member of Staff.

Dannyloski
04-06-2008, 01:55 PM
^ Thanks, no one had removed it before or said anything, so I didnt know ...

We still have the issue that there is no Hack available for vB 3.6.9 to convert [img] Tags to [url] Tags in Quotes, so can anyone help on a fix?

Dannyloski
04-08-2008, 05:28 PM
Somebody, anybody ... Please!

Dannyloski
04-10-2008, 10:02 PM
There is no one out there who has a Working [img] Tag to [url] Tag in Quotes Hack?

Dannyloski
04-11-2008, 02:56 PM
I think its crazy that no one has been able to get a Fix for this in vB 3.6.9. I know there is someone out there ..

Dannyloski
04-27-2008, 01:10 AM
Well this wasnt working on 3.6.9, but it works on 3.6.10 :biggrin: ... I dont know what it was that it wasnt working on 3.6.9, maybe I was not doing the File Edits correctly or something. I'm just happy this now works ...

SlimSoldier
07-06-2009, 02:49 PM
not working in 3.8.3

Keesa
05-06-2010, 02:15 AM
*cries*

Dirt Bike Addict
06-17-2010, 01:58 PM
Does anybody have this for vB 4?

Thanks in advance:up:

ferreo
07-30-2010, 06:58 PM
Does anybody have this for vB 4?

Thanks in advance:up:

vb4:
https://vborg.vbsupport.ru/showthread.php?t=241196


I can confirm that the code in this thread works for vb3.8.6PL1.

Dirt Bike Addict
08-01-2010, 05:29 PM
vb4:
https://vborg.vbsupport.ru/showthread.php?t=241196

:up: Thanks