<?php /** * Vine shortcode * The service is now archived, but existing embeds are still accessible. * * Examples: * Vine embed code: * <iframe class="vine-embed" src="https://vine.co/v/bjHh0zHdgZT" width="600" height="600" frameborder="0"></iframe> * <script async src="//platform.vine.co/static/scripts/embed.js" charset="utf-8"></script> * * URL example: * https://vine.co/v/bjHh0zHdgZT/ * * Embed shortcode examples: * [embed]https://vine.co/v/bjHh0zHdgZT[/embed] * [embed width="300"]https://vine.co/v/bjHh0zHdgZT[/embed] * [embed type="postcard" width="300"]https://vine.co/v/bjHh0zHdgZT[/embed] * * @package automattic/jetpack */ /** * Handle Vine embeds. * * @param array $matches Results after parsing the URL using the regex in wp_embed_register_handler(). * @param array $attr Embed attributes. * @param string $url The original URL that was matched by the regex. * @param array $rawattr The original unmodified attributes. * @return string The embed HTML. */ function vine_embed_video( $matches, $attr, $url, $rawattr ) { $max_height = 300; $type = 'simple'; // Only allow 'postcard' or 'simple' types. if ( isset( $rawattr['type'] ) && 'postcard' === $rawattr['type'] ) { $type = 'postcard'; } $vine_size = Jetpack::get_content_width(); // If the user enters a value for width or height, we ignore the Jetpack::get_content_width(). if ( isset( $rawattr['width'] ) || isset( $rawattr['height'] ) ) { // 300 is the minimum size that Vine provides for embeds. Lower than that, the postcard embeds looks weird. $vine_size = max( $max_height, min( $attr['width'], $attr['height'] ) ); } if ( empty( $vine_size ) ) { $vine_size = $max_height; } $url = 'https://vine.co/v/' . $matches[1] . '/embed/' . $type; $vine_html = sprintf( '<span class="embed-vine" style="display: block;"><iframe class="vine-embed" src="%1$s" width="%2$d" height="%3$d" frameborder="0"></iframe></span>', esc_url( $url ), (int) $vine_size, (int) $vine_size ); wp_enqueue_script( 'vine-embed', 'https://platform.vine.co/static/scripts/embed.js', array(), JETPACK__VERSION, true ); return $vine_html; } wp_embed_register_handler( 'jetpack_vine', '#https?://vine.co/v/([a-z0-9]+).*#i', 'vine_embed_video' ); /** * Display the Vine shortcode. * * @param array $atts Shortcode attributes. */ function vine_shortcode( $atts ) { global $wp_embed; if ( empty( $atts['url'] ) ) { return ''; } if ( ! preg_match( '#https?://vine.co/v/([a-z0-9]+).*#i', $atts['url'] ) ) { return ''; } return $wp_embed->shortcode( $atts, $atts['url'] ); } add_shortcode( 'vine', 'vine_shortcode' );
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
css | Folder | 0755 |
|
|
images | Folder | 0755 |
|
|
img | Folder | 0755 |
|
|
js | Folder | 0755 |
|
|
archiveorg-book.php | File | 3.31 KB | 0644 |
|
archiveorg.php | File | 3.92 KB | 0644 |
|
archives.php | File | 2.38 KB | 0644 |
|
bandcamp.php | File | 7.75 KB | 0644 |
|
brightcove.php | File | 8.77 KB | 0644 |
|
cartodb.php | File | 803 B | 0644 |
|
class.filter-embedded-html-objects.php | File | 13.01 KB | 0644 |
|
codepen.php | File | 265 B | 0644 |
|
crowdsignal.php | File | 21.6 KB | 0644 |
|
dailymotion.php | File | 15.27 KB | 0644 |
|
descript.php | File | 3 KB | 0644 |
|
facebook.php | File | 4.41 KB | 0644 |
|
flatio.php | File | 383 B | 0644 |
|
flickr.php | File | 9.29 KB | 0644 |
|
getty.php | File | 7.54 KB | 0644 |
|
gist.php | File | 8.31 KB | 0644 |
|
googleapps.php | File | 9.84 KB | 0644 |
|
googlemaps.php | File | 7.97 KB | 0644 |
|
googleplus.php | File | 1.03 KB | 0644 |
|
gravatar.php | File | 6.13 KB | 0644 |
|
houzz.php | File | 920 B | 0644 |
|
inline-pdfs.php | File | 1.14 KB | 0644 |
|
instagram.php | File | 14.5 KB | 0644 |
|
kickstarter.php | File | 2.39 KB | 0644 |
|
mailchimp.php | File | 7.03 KB | 0644 |
|
medium.php | File | 3.22 KB | 0644 |
|
mixcloud.php | File | 3.62 KB | 0644 |
|
others.php | File | 2.04 KB | 0644 |
|
pinterest.php | File | 1.79 KB | 0644 |
|
presentations.php | File | 14.53 KB | 0644 |
|
quiz.php | File | 9.16 KB | 0644 |
|
recipe.php | File | 18.95 KB | 0644 |
|
scribd.php | File | 2.45 KB | 0644 |
|
sitemap.php | File | 562 B | 0644 |
|
slideshare.php | File | 3.81 KB | 0644 |
|
slideshow.php | File | 8.93 KB | 0644 |
|
smartframe.php | File | 3.64 KB | 0644 |
|
soundcloud.php | File | 8.68 KB | 0644 |
|
spotify.php | File | 3.21 KB | 0644 |
|
ted.php | File | 3.35 KB | 0644 |
|
tweet.php | File | 5.03 KB | 0644 |
|
twitchtv.php | File | 2.63 KB | 0644 |
|
twitter-timeline.php | File | 1.93 KB | 0644 |
|
unavailable.php | File | 3.24 KB | 0644 |
|
untappd-menu.php | File | 2.41 KB | 0644 |
|
upcoming-events.php | File | 1.68 KB | 0644 |
|
ustream.php | File | 3.13 KB | 0644 |
|
videopress.php | File | 423 B | 0644 |
|
vimeo.php | File | 11.13 KB | 0644 |
|
vine.php | File | 2.61 KB | 0644 |
|
vr.php | File | 4.92 KB | 0644 |
|
wordads.php | File | 1.81 KB | 0644 |
|
wufoo.php | File | 3.38 KB | 0644 |
|
youtube.php | File | 20.54 KB | 0644 |
|