Я пытаюсь преобразовать код для вставки html / javascript-видео camtasia в шорткод wordpress flowplayer.
Оригинальный код выглядит следующим образом:
<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/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");
Вывод, который мне нужен, выглядит так:
[FLOWPLAYER=http://www.superaffiliatecoachingclub.com/sacconly/utl/modules/sitereviews/compucard/compucard_controller.swf,600,450]
Спасибо!
preg_match('/SWFObject\( "(.*?)", ".*?", "(\d+)", "(\d+)"/', $str, $match); $output = "[FLOWPLAYER={$match[1]},{$match[2]},{$match[3]}]";
/SWFObject\( "(.+?)"/
\1 будет содержать URL, кажется, это единственное, что вы пытаетесь извлечь из субъекта.
\1