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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.