Example #1
0
/**
 * Wordpress API support for those who cut and paste the Shortcodes
 */
function shortcode_atts($pairs, $atts)
{
    return elgg_shortcode_atts($pairs, $atts);
}
/**
 * Embed Videos
 * [video site="youtube" id="dQw4w9WgXcQ" w="600" h="340"]
 */
function video_sc($atts, $content = null)
{
    extract(elgg_shortcode_atts(array('site' => 'youtube', 'id' => '', 'w' => '600', 'h' => '370'), $atts));
    if ($site == "youtube") {
        $src = 'http://www.youtube-nocookie.com/embed/' . $id;
    } else {
        if ($site == "vimeo") {
            $src = 'http://player.vimeo.com/video/' . $id;
        } else {
            if ($site == "dailymotion") {
                $src = 'http://www.dailymotion.com/embed/video/' . $id;
            } else {
                if ($site == "yahoo") {
                    $src = 'http://d.yimg.com/nl/vyc/site/player.html#vid=' . $id;
                } else {
                    if ($site == "bliptv") {
                        $src = 'http://a.blip.tv/scripts/shoggplayer.html#file=http://blip.tv/rss/flash/' . $id;
                    } else {
                        if ($site == "veoh") {
                            $src = 'http://www.veoh.com/static/swf/veoh/SPL.swf?videoAutoPlay=0&permalinkId=' . $id;
                        } else {
                            if ($site == "viddler") {
                                $src = 'http://www.viddler.com/simple/' . $id;
                            }
                        }
                    }
                }
            }
        }
    }
    if ($id != '') {
        return '<iframe width="' . $w . '" height="' . $h . '" src="' . $src . '" class="vid iframe-' . $site . '"></iframe>';
    }
}