开发者

Regexp help - converting video code to wordpress short tag

I'm trying to convert a camtasia html/javascript video embed code to a wordpress flowplayer shortcode.

The original code is as follows:

<p>The Camtasia Studio video content presented here requires JavaScript to be enabled and the latest version of the Adobe Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Adobe Flash Player by <a href="http://www.adobe.com/go/getflashplayer">downloading here</a>. </p>



var fo = new SWFObject( "http://www.superaffiliatecoachingclub.com/sacconly/utl/modules开发者_C百科/sitereviews/compucard/compucard_controller.swf", "csSwf", "640", "535", "8", "#FFFFFF" );
fo.addVariable( "csConfigFile", "http://www.superaffiliatecoachingclub.com/sacconly/utl/modules/sitereviews/compucard/compucard_config.xml" );
fo.addVariable( "csColor" , "FFFFFF" );
fo.addVariable( "csPreloader" , "http://www.superaffiliatecoachingclub.com/sacconly/utl/modules/sitereviews/compucard/compucard_preload.swf" );
if( args.movie )
{
fo.addVariable( "csFilesetBookmark", args.movie );
}
fo.write("flashcontent");

The output I need is like so:

[FLOWPLAYER=http://www.superaffiliatecoachingclub.com/sacconly/utl/modules/sitereviews/compucard/compucard_controller.swf,600,450]

Thanks!


preg_match('/SWFObject\( "(.*?)", ".*?", "(\d+)", "(\d+)"/', $str, $match);
$output = "[FLOWPLAYER={$match[1]},{$match[2]},{$match[3]}]";


/SWFObject\( "(.+?)"/

the \1 will contain the url, it seems that's the only thing you're trying to extract from the subject.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜