Version 4.0.8 has caused me some problems (this is my first try so I don't know if it worked in previous versions of VB4).
Firstly I had to manually create the plugin - the XML upload throws an error. This was no problem - just look at the XML file and it is very obvious what to enter when you do 'Add new plugin'. However....
The function only worked for a new post. I believe this is to do with cache. Therefore after this initial posting is made, this line in the plugin no longer does anything:
Code:
$post['pagetext'] = amazon_links($post['pagetext']);
My solution - I'm sure not the ideal one, is to scrap the plugin and edit the file showthread.php as follows:
after line 113 add the include
Code:
require_once(DIR . '/includes/functions_amazon_links.php');
after line 980, in the loop for the large query that reads the post table:
Code:
$post['pagetext'] = amazon_links($post['pagetext']);
and then after 1469 when the post cache is being read
Code:
$post['pagetext'] = amazon_links($post['pagetext']);
Secondly the regex seems to be case sensitive when searching for URL, despite the /i at the end. Therefore as given it will not find
and (sod's law) the post I was testing on had it in upper case. I assume the user typed it in manually. I haven't been able to fix that yet, hence this post.
Can a regex expert please help and make the function search for both URL and url?