/** * Render the shortcode * @param array $args Shortcode paramters * @param string $content Content between shortcode * @return string HTML output */ function render($args, $content = '') { $defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'api_params' => '', 'autoplay' => 'no', 'center' => 'no', 'height' => 360, 'id' => '', 'width' => 600), $args); extract($defaults); self::$args = $defaults; $protocol = is_ssl() ? 's' : ''; if ($autoplay == 'true' || $autoplay == 'yes') { $autoplay = '?autoplay=1'; } else { $autoplay = '?autoplay=0'; } $html = sprintf('<div %s><div %s><iframe src="http%s://player.vimeo.com/video/%s%s%s" width="%s" height="%s" frameborder="0"></iframe></div></div>', FusionCore_Plugin::attributes('vimeo-shortcode'), FusionCore_Plugin::attributes('vimeo-shortcode-video-sc'), $protocol, $id, $autoplay, $api_params, $width, $height); return $html; }
/** * Render the shortcode * @param array $args Shortcode paramters * @param string $content Content between shortcode * @return string HTML output */ function render($args, $content = '') { $defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'api_params' => '', 'autoplay' => 'no', 'center' => 'no', 'height' => 360, 'id' => '', 'width' => 600), $args); extract($defaults); self::$args = $defaults; if (is_ssl()) { $protocol = 'https'; } else { $protocol = 'http'; } // Make sure only the video ID is passed to the iFrame $pattern = '/(?:https?:\\/\\/)?(?:www\\.)?vimeo.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^\\/]*)\\/videos\\/|album\\/(\\d+)\\/video\\/|)(\\d+)(?:$|\\/|\\?)/'; preg_match($pattern, $id, $matches); if (isset($matches[3])) { $id = $matches[3]; } $html = sprintf('<div %s><div %s><iframe src="%s://player.vimeo.com/video/%s?autoplay=0%s" width="%s" height="%s" frameborder="0"></iframe></div></div>', FusionCore_Plugin::attributes('vimeo-shortcode'), FusionCore_Plugin::attributes('vimeo-shortcode-video-sc'), $protocol, $id, $api_params, $width, $height); return $html; }