Jump to content

[SOLVED] Need some help with strings and matching


pspcrazy

Recommended Posts

Hi I'm trying to get wordpress to replace the flv urls in my posts that are between [flv][/flv] tags with the ###URL### in the code.

 

A flv url is something like this:

http://v4.crunchyroll.com/user7/7/p/5/q/7p5qrn4513q1po75q5o/video.flv

 

 

// FLV Player Code

define("FLV_WIDTH", 540);
define("FLV_HEIGHT", 438);
define("FLV_REGEXP", "/\[flv\]([_A-Za-z0-9-]+)\[\/flv\]/");
define("FLV_TARGET", "<embed flashvars=\"&file=###URL###&autostart=false&skin=/modieus.swf\" allowfullscreen=\"true\" allowscriptaccess=\"always\" quality=\"high\" name=\"mpl\" id=\"mpl\" src=\"http://www.animecrazy.net/player.swf\" type=\"application/x-shockwave-flash\" width=\"540\" height=\"438\">");


function flv_plugin_callback($match) {
$output = FLV_TARGET;
$output = str_replace("###URL###", $match[1], $output);

return ($output);
}

function flv_plugin($content) {
return preg_replace_callback(FLV_REGEXP, 'flv_plugin_callback', $content);
}

add_filter('the_content', 'flv_plugin');
add_filter('comment_text', 'flv_plugin');

 

Anyone have any ideas to make this work? It works just fine if I don't use the url and use this code for things like video ids. But once I try url's or thing that have slashes, periods, colons in them it won't work.

 

Thanks for any help or fixes to this.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.