Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Need a preg_replace ninja!
I have this tag:
And I need it to be be automagically transformed into something like this:
I have looked at some of the YouTube expressions SirNot and Bergmot did, but I can't get them to work for this example.
Thanks for your time.
<mp3 src="myfile.mp3" title="my title" />
And I need it to be be automagically transformed into something like this:
<object><param name="movie" value="player.swf?src=myfile.mp3&title=my-title"></param><embed src="player.swf?src=myfile.mp3&title=my-title" type="application/x-shockwave-flash"></embed></object>
I have looked at some of the YouTube expressions SirNot and Bergmot did, but I can't get them to work for this example.
Thanks for your time.
0
This discussion has been closed.
Comments
http://1976design.com/blog/archive/site-news/2004/07/29/redesign-tag-transform/
HTH
Martin.
$String = preg_replace('!<mp3 src="(.*?)" title="(.*?)" />!ie', '<object><param name="movie" value="player.swf?src=$1&title=$2"></param><embed src="player.swf?src=$1&title=$2" type="application/x-shockwave-flash"></embed></object>', $String);
I came up with that, but, I have no idea how to make it into an extension now to test it.
Ideally, I would like it to work regardless of the post format (text, html, bbcode, etc.).
Can anyone help with that now?
sweeny, that really helped!