Log in

View Full Version : 'Allow Dynamic URL for [IMG] Tags': link replacement question


timetunnel
12-28-2006, 06:37 PM
Hello.

Is this 'preg_replace()' statement coded to replace ALL instances of tags in one shot? If so, what can I change in the 'preg_replace()' to only change ONE link at a time if I put it in a loop? I can do the other alterations necessary.

I want to be able to evaluate each link separately to decide which image URLs to parse and which ones not.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(ref: class_bbcode.php and class_bbcode_alt.php in "function handle_bbcode_img()")

// do [img]xxx
$bbcode = preg_replace('#\[img\]\s*(https?://([^<>*"' . iif(!$this->registry->options['allowdynimg'], '?&') . ']+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', "\$this->handle_bbcode_img_match('\\1')", $bbcode);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thanks in advance.

aisais
07-11-2008, 04:59 AM
I want to be able to evaluate each link separately to decide which image URLs to parse and which ones not.
me 2.. I looked around for a week but no go...

Dismounted
07-11-2008, 05:07 AM
That PCRE function matches the URL inside the IMG tags, and allows/disallows query string depending on what is set. It then passes each result into handle_bbcode_img_match() to create the HTML.

aisais
07-11-2008, 09:44 AM
What I really want is to get rid of spammers who use this type of links.

https://vborg.vbsupport.ru/external/2008/07/22.gif (http://www.spamlink.com)

I want to keep the image and remove the url.
can I strip the above linke to make it like this:

https://vborg.vbsupport.ru/external/2008/07/22.gif

I not a programmer but I can manage to do some modifications.

Dismounted
07-11-2008, 10:13 AM
It's possible, but you'll need to know regular expressions (regex). Regex is complicated and is more suited to programmers who are confident.