Due to some minor bugs with the SoundCloud Shortcode plugin when served over HTTPS, I would like to run a Regex search & replace over my Wordpress blog. I'm sorted with with ways to do that in general, but I'm looking for a Regex pattern prepared for some eventualities.
When I manually grab the iframe embed code from the following shortcode…
[soundcloud url="http://api.soundcloud.com/tracks/58082404" params="auto_play=false&show_artwork=false&color=372f2d" width="100%" height="166" iframe="true" /]
…it turns into something like this:
<iframe width="100%" height="400" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?visual=true&url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F58082404&show_artwork=true"></iframe>
You might notice that the sizes vary and that some of the parameters won't be passed. I will have to deal with this one way or another, but for now I'm looking for a way to convert the shortcode into an iframe with all of the original parameters. One of the problems is, that I cannot be sure that all the parameters are available in the shortcode and that the order these are passed could differ.
[soundcloud url="…"]
[soundcloud url="…" width="…" height="…"]
[soundcloud width="…" height="…" url="…" params="…"]
[soundcloud height="…" width="…" params="…" url="…"]
I am looking for a Regex pattern that makes sure that any of these gets converted into embed code for the iframe player.
<iframe width="WIDTH" height="HEIGHT" src="URL&PARAMS"></iframe>
Can anyone provide a working Regex pattern to do this?
the_content). Best function for you:shortcode_parse_atts($text)- Adrian Preuss