[wp-hackers] Shortcode embedded within shortcode -- is it possible?

Claude Needham gxxaxx at gmail.com
Tue Aug 9 18:15:50 UTC 2011


The real world problem is a need to use aws s3 signed urls with
existing flowplayer plugin.

I offered code to flowplayer that would allow them to transparently
handle the s3 signed urls, but since there is still only a small
community of folks with a need for this feature, they were
understandably hesitant to take new code under their wing.

So my need is to find a way to dynamically refactor the video url at
runtime (during each page view). This is because the signed urls
typically have a 60 minutes lifetime.

I tried just putting a shortcode inside the other shortcode.
[FLOWPLAYER=http://domain.com/splash.jpg|[s3signedlink
url=https://s3.amazonaws.com/mybucket/myvideo.mp4],600,450]

That was a fail. Worth a try. But, at the time did not work for me. I
don't know php well enough yet to determine if the core shortcode
handler can deal with inline shortcodes within other shortcodes.

The note in wp-includes/shortcodes.php seems to indicate that the
simplistic approach will not work.

13	 * Shortcode tags support attributes and enclosed content, but does
not entirely
14	 * support inline shortcodes in other shortcodes. You will have to call the
15	 * shortcode parser in your function to account for that.
17	 * {@internal
18	 * Please be aware that the above note was made during the beta of
WordPress 2.6
19	 * and in the future may not be accurate. Please update the note
when it is no
20	 * longer the case.}}

So I'm looking for a clue on how to approach this. I'm a bit new to
php and much of the codex assumes more than the sparse background I
have currently.

Perhaps there is a hook or filter I can use that would allow me to get
at the video url in the flowplayer shortcode before it is processed.

Thanks for any hints.

Regards,
Claude Needham


More information about the wp-hackers mailing list