[a-z0-9]+)',
'embed_url' => 'http://mpora.com/videos/%s/embed',
'auto_thumbnail' => true,
'tests' => array(
array( 'url' => 'http://mpora.com/videos/AAdphry14rkn', 'id' => 'AAdphry14rkn' ),
array( 'url' => 'http://mpora.de/videos/AAdpxhiv6pqd', 'id' => 'AAdpxhiv6pqd' ),
)
),
'myspace' => array(
#House of Lies Season 5 Premiere from Showtime on Myspace.
'regex' => $s . 'myspace\.com/.+/(?[0-9]+)',
'embed_url' => 'https://media.myspace.com/play/video/%s',
'auto_thumbnail' => false,
'tests' => array(
array( 'url' => 'https://myspace.com/myspace/video/dark-rooms-the-shadow-that-looms-o-er-my-heart-live-/109471212', 'id' => 109471212 ),
)
),
/*
'myvideo' => array(
'name' => 'MyVideo',
'regex' => $s . 'myvideo\.de/(watch|embed)/([0-9]+)',
'embed_url' => 'http://www.myvideo.de/embedded/public/%s',
'auto_thumbnail' => false,
'tests' => array(
'http://www.myvideo.de/watch/8432624/Angeln_mal_anders',
)
),
*/
'snotr' => array(
'regex' => $s . 'snotr\.com/(video|embed)/(?[0-9]+)',
'embed_url' => 'http://www.snotr.com/embed/%s',
'auto_thumbnail' => false,
'requires_flash' => true,
'tests' => array(
array(
'url' => 'http://www.snotr.com/video/12314/How_big_a_truck_blind_spot_really_is',
'id' => 12314,
),
)
),
'spike' => array(
'regex' => 'https?://media.mtvnservices.com/embed/mgid:arc:video:spike\.com:(?[a-z0-9\-]{36})',
'embed_url' => 'http://media.mtvnservices.com/embed/mgid:arc:video:spike.com:%s',
'requires_src' => true,
'auto_thumbnail' => false,
'requires_flash' => true,
'tests' => array(
# Ink Master
array(
'url' => 'http://media.mtvnservices.com/embed/mgid:arc:video:spike.com:6a219882-c412-46ce-a8c9-32e043396621',
'id' => '6a219882-c412-46ce-a8c9-32e043396621',
),
),
'test_ids' => array(
'5afddf30-31d8-40fb-81e6-bb5c6f45525f',
)
),
'ted' => array(
'name' => 'TED Talks',
'regex' => $s . 'ted\.com/talks/(?[a-z0-9_]+)',
'embed_url' => 'https://embed-ssl.ted.com/talks/%s.html',
'auto_thumbnail' => true,
'auto_title' => true,
'requires_flash' => true,
'tests' => array(
array(
'url' => 'https://www.ted.com/talks/margaret_stewart_how_youtube_thinks_about_copyright',
'id' => 'margaret_stewart_how_youtube_thinks_about_copyright'
),
),
),
'twitch' => array(
'regex' => $s . 'twitch.tv/(?!directory)(?|[a-z0-9_]+/v/(?[0-9]+)|(?[a-z0-9_]+))',
'embed_url' => 'https://player.twitch.tv/?channel=%s', # if numeric id https://player.twitch.tv/?video=v%s
'auto_thumbnail' => true,
'tests' => array(
array(
'url' => 'https://www.twitch.tv/whiskeyexperts',
'id' => 'whiskeyexperts',
'api_img_contains' => 'https://static-cdn.jtvnw.net/jtv_user_pictures/whiskyexperts',
),
array(
'url' => 'https://www.twitch.tv/imaqtpie',
'id' => 'imaqtpie',
'api_img' => 'https://static-cdn.jtvnw.net/jtv_user_pictures/imaqtpie',
),
array(
'url' => 'https://www.twitch.tv/imaqtpie/v/95318019',
'id' => 95318019,
'api_img' => 'https://static-cdn.jtvnw.net/jtv_user_pictures/imaqtpie',
),
),
),
'ustream' => array(
'regex' => $s . 'ustream\.tv/(channel/)?(?[0-9]{8}|recorded/[0-9]{8}(/highlight/[0-9]+)?)',
'embed_url' => 'http://www.ustream.tv/embed/%s',
'default_params' => 'html5ui',
'auto_thumbnail' => false,
'aspect_ratio' => '480:270',
'requires_flash' => true,
'tests' => array(
array( 'url' => 'http://www.ustream.tv/recorded/59999872?utm_campaign=ustre.am&utm_source=ustre.am/:43KHS&utm_medium=social&utm_content=20170405204127', 'id' => 'recorded/59999872' ),
),
),
'rutube' => array(
'name' => 'RuTube.ru',
'regex' => $s . 'rutube\.ru/play/embed/(?[0-9]+)',
'embed_url' => 'https://rutube.ru/play/embed/%s',
'requires_flash' => true,
'tests' => array(
array(
'url' => 'https://rutube.ru/play/embed/9822149',
'id' => 9822149
),
),
),
'veoh' => array(
'regex' => $s . 'veoh\.com/watch/(?[a-z0-9]+)',
'embed_url' => 'http://www.veoh.com/swf/webplayer/WebPlayer.swf?version=AFrontend.5.7.0.1396&permalinkId=%s',
'default_params' => 'player=videodetailsembedded&id=anonymous',
'auto_thumbnail' => false,
#'aspect_ratio' => 60.257,
'tests' => array(
array(
'url' => 'http://www.veoh.com/watch/v19866882CAdjNF9b',
'id' => 'v19866882CAdjNF9b'
),
)
),
'vevo' => array(
'regex' => $s . 'vevo\.com/watch/([^\/]+/[^\/]+/)?(?[a-z0-9]+)',
'embed_url' => 'https://scache.vevo.com/assets/html/embed.html?video=%s',
'default_params' => 'playlist=false&playerType=embedded&env=0',
'auto_thumbnail' => false,
'requires_flash' => true,
'tests' => array(
array(
'url' => 'https://www.vevo.com/watch/the-offspring/the-kids-arent-alright/USSM20100649',
'id' => 'USSM20100649'
),
#array( '', '' ),
#array( '', '' ),
),
),
'viddler' => array(
'regex' => $s . 'viddler\.com/(embed|v)/(?[a-z0-9]{8})',
#'embed_url' => 'https://www.viddler.com/player/%s/',
#'default_params' => 'wmode=transparent&player=full&f=1&disablebranding=1',
'embed_url' => 'https://www.viddler.com/embed/%s/',
'default_params' => '?f=1&player=full&secret=59822701&disablebackwardseek=false&disableseek=false&disableforwardseek=false&make_responsive=false&loop=false&nologo=false&hd=false',
'auto_thumbnail' => true,
'auto_title' => true,
'aspect_ratio' => '545:349',
'requires_flash' => true,
'tests' => array(
array(
'url' => 'https://www.viddler.com/v/a695c468',
'id' => 'a695c468'
),
),
),
'vidspot' => array(
'name' => 'vidspot.net',
'regex' => $s . 'vidspot\.net/(embed-)?(?[a-z0-9]+)',
'embed_url' => 'http://vidspot.net/embed-%s.html',
'requires_flash' => true,
'tests' => array(
array( 'url' => 'http://vidspot.net/285wf9uk3rry', 'id' => '285wf9uk3rry' ),
array( 'url' => 'http://vidspot.net/embed-285wf9uk3rry.html', 'id' => '285wf9uk3rry' ),
),
),
'vine' => array(
'regex' => $s . 'vine\.co/v/(?[a-z0-9]+)',
'embed_url' => 'https://vine.co/v/%s/embed/simple',
'default_params' => '', //* audio=1 supported
'auto_thumbnail' => false,
'aspect_ratio' => '1:1',
'tests' => array(
array( 'url' => 'https://vine.co/v/bjAaLxQvOnQ', 'id' => 'bjAaLxQvOnQ' ),
array( 'url' => 'https://vine.co/v/MbrreglaFrA', 'id' => 'MbrreglaFrA' ),
array( 'url' => 'https://vine.co/v/bjHh0zHdgZT/embed', 'id' => 'bjHh0zHdgZT' ),
),
),
'vimeo' => array(
'regex' => 'https?://(player\.)?vimeo\.com/((video/)|(channels/[a-z]+/)|(groups/[a-z]+/videos/))?(?[0-9]+)',
'embed_url' => 'https://player.vimeo.com/video/%s',
'default_params' => 'html5=1&title=1&byline=0&portrait=0',
'auto_thumbnail' => true,
'auto_title' => true,
'tests' => array(
array( 'url' => 'https://vimeo.com/124400795', 'id' => 124400795 ),
array( 'url' => 'https://player.vimeo.com/124400795', 'id' => 124400795 ),
),
/*
'query_argss' => array(
'autoplay' => array( 'bool', __( 'Autoplay', ARVE_SLUG ) ),
'badge' => array( 'bool', __( 'Badge', ARVE_SLUG ) ),
'byline' => array( 'bool', __( 'Byline', ARVE_SLUG ) ),
'color' => 'string',
'loop' => array( 0, 1 ),
'player_id' => 'int',
'portrait' => array( 0, 1 ),
'title' => array( 0, 1 ),
),
*/
),
'vk' => array(
'name' => 'VK',
#https://vk.com/video 162756656_171388096
#https://vk.com/video_ext.php?oid=162756656&id=171388096&hash=b82cc24232fe7f9f&hd=1
'regex' => $s . 'vk\.com/video_ext\.php\?(?[^ ]+)',
'embed_url' => 'https://vk.com/video_ext.php?%s',
'requires_src' => true,
'auto_thumbnail' => false,
'tests' => array(
array(
'url' => 'https://vk.com/video_ext.php?oid=162756656&id=171388096&hash=b82cc24232fe7f9f&hd=1',
'id' => 'oid=162756656&id=171388096&hash=b82cc24232fe7f9f&hd=1'
),
),
),
'vzaar' => array(
'regex' => $s . 'vzaar.(com|tv)/(videos/)?(?[0-9]+)',
'embed_url' => 'https://view.vzaar.com/%s/player',
'tests' => array(
array( 'url' => 'https://vzaar.com/videos/993324', 'id' => 993324 ),
array( 'url' => 'https://vzaar.com/videos/1515906', 'id' => 1515906 ),
),
),
'wistia' => array(
# fast.wistia.net/embed/iframe/g5pnf59ala?videoFoam=true
'regex' => 'https?://fast\.wistia\.net/embed/iframe/(?[a-z0-9]+)',
'embed_url' => 'https://fast.wistia.net/embed/iframe/%s',
'default_params' => 'videoFoam=true',
'tests' => array(
array(
'url' => 'https://fast.wistia.net/embed/iframe/g5pnf59ala?videoFoam=true',
'id' => 'g5pnf59ala'
),
),
),
'xtube' => array(
'name' => 'XTube',
'regex' => $s . 'xtube\.com/watch\.php\?v=(?[a-z0-9_\-]+)',
'embed_url' => 'http://www.xtube.com/embedded/user/play.php?v=%s',
'auto_thumbnail' => false,
'requires_flash' => true,
'tests' => array(
array( 'url' => 'http://www.xtube.com/watch.php?v=1234', 'id' => 1234 ),
),
),
'yahoo' => array(
'regex' => '(?https?://([a-z.]+)yahoo\.com/[/-a-z0-9öäü]+\.html)',
'embed_url' => '%s',
'default_params' => 'format=embed',
'auto_thumbnail' => true,
'auto_title' => true,
'requires_flash' => true,
'tests' => array(
array(
'url' => 'https://de.sports.yahoo.com/video/krasse-vorher-nachher-bilder-mann-094957265.html?format=embed&player_autoplay=false',
'id' => 'https://de.sports.yahoo.com/video/krasse-vorher-nachher-bilder-mann-094957265.html'
),
array(
'url' => 'https://www.yahoo.com/movies/sully-trailer-4-211012511.html?format=embed',
'id' => 'https://www.yahoo.com/movies/sully-trailer-4-211012511.html'
),
)
),
'youku' => array(
'regex' => 'https?://([a-z.]+)?\.youku.com/(embed/|v_show/id_)(?[a-z0-9]+)',
'embed_url' => 'http://player.youku.com/embed/%s',
'auto_thumbnail' => false,
'aspect_ratio' => '450:292.5',
'requires_flash' => true,
#
'tests' => array(
array(
'url' => 'http://v.youku.com/v_show/id_XMTczMDAxMjIyNA==.html?f=27806190',
'id' => 'XMTczMDAxMjIyNA',
),
array(
'url' => 'http://player.youku.com/embed/XMTUyODYwOTc4OA==',
'id' => 'XMTUyODYwOTc4OA',
),
),
),
'youtube' => array(
'name' => 'YouTube',
'regex' => $s . '(youtube\.com\/\S*((\/e(mbed))?\/|watch\?(\S*?&?v\=))|youtu\.be\/)(?[a-zA-Z0-9_-]{6,11}((\?|&)list=[a-z0-9_\-]+)?)',
'embed_url' => 'https://www.youtube.com/embed/%s',
'default_params' => 'iv_load_policy=3&modestbranding=1&rel=0&autohide=1&playsinline=1',
'auto_thumbnail' => true,
'auto_title' => true,
#'[youtube id="XQEiv7t1xuQ"]',
'tests' => array(
array(
'url' => 'https://youtu.be/dqLyB5srdGI',
'id' => 'dqLyB5srdGI',
),
array(
'url' => 'https://www.youtube.com/watch?v=-fEo3kgHFaw',
'id' => '-fEo3kgHFaw',
),
array(
'url' => 'http://www.youtube.com/watch?v=vrXgLhkv21Y',
'id' => 'vrXgLhkv21Y',
'oembed_title' => 'TerrorStorm Full length version',
),
array(
'url' => 'https://youtu.be/hRonZ4wP8Ys',
'id' => 'hRonZ4wP8Ys',
'oembed_title' => 'One Bright Dot',
),
array(
'url' => 'http://www.youtube.com/watch?v=GjL82KUHVb0&list=PLI46g-I12_9qGBq-4epxOay0hotjys5iA&index=10', # The index part will be ignored
'id' => 'GjL82KUHVb0&list=PLI46g-I12_9qGBq-4epxOay0hotjys5iA'
),
array(
'url' => 'https://youtu.be/b8m9zhNAgKs?list=PLI_7Mg2Z_-4I-W_lI55D9lBUkC66ftHMg',
'id' => 'b8m9zhNAgKs?list=PLI_7Mg2Z_-4I-W_lI55D9lBUkC66ftHMg'
),
),
'specific_tests' => array(
__('URL from youtu.be shortener', ARVE_SLUG),
'http://youtu.be/3Y8B93r2gKg',
__('Youtube playlist URL inlusive the video to start at. The index part will be ignored and is not needed', ARVE_SLUG) ,
'http://www.youtube.com/watch?v=GjL82KUHVb0&list=PLI46g-I12_9qGBq-4epxOay0hotjys5iA&index=10',
__('Loop a YouTube video', ARVE_SLUG),
'[youtube id="FKkejo2dMV4" parameters="playlist=FKkejo2dMV4&loop=1"]',
__('Enable annotations and related video at the end (disable by default with this plugin)', ARVE_SLUG),
'[youtube id="uCQXKYPiz6M" parameters="iv_load_policy=1"]',
__('Testing Youtube Starttimes', ARVE_SLUG),
'http://youtu.be/vrXgLhkv21Y?t=1h19m14s',
'http://youtu.be/vrXgLhkv21Y?t=19m14s',
'http://youtu.be/vrXgLhkv21Y?t=1h',
'http://youtu.be/vrXgLhkv21Y?t=5m',
'http://youtu.be/vrXgLhkv21Y?t=30s',
__( 'The Parameter start only takes values in seconds, this will start the video at 1 minute and 1 second', ARVE_SLUG ),
'[youtube id="uCQXKYPiz6M" parameters="start=61"]',
),
/*
'query_args' => array(
array(
'attr' => 'autohide',
'type' => 'bool',
'name' => __( 'Autohide', ARVE_SLUG )
),
array(
'attr' => 'autoplay',
'type' => 'bool',
'name' => __( 'Autoplay', ARVE_SLUG )
),
array(
'attr' => 'cc_load_policy',
'type' => 'bool',
'name' => __( 'cc_load_policy', ARVE_SLUG )
),
array(
'attr' => 'color',
'type' => array(
'' => __( 'Default', ARVE_SLUG ),
'red' => __( 'Red', ARVE_SLUG ),
'white' => __( 'White', ARVE_SLUG ),
),
'name' => __( 'Color', ARVE_SLUG )
),
array(
'attr' => 'controls',
'type' => array(
'' => __( 'Default', ARVE_SLUG ),
0 => __( 'None', ARVE_SLUG ),
1 => __( 'Yes', ARVE_SLUG ),
2 => __( 'Yes load after click', ARVE_SLUG ),
),
'name' => __( 'Controls', ARVE_SLUG )
),
array(
'attr' => 'disablekb',
'type' => 'bool',
'name' => __( 'disablekb', ARVE_SLUG )
),
array(
'attr' => 'enablejsapi',
'type' => 'bool',
'name' => __( 'JavaScript API', ARVE_SLUG )
),
array(
'attr' => 'end',
'type' => 'number',
'name' => __( 'End', ARVE_SLUG )
),
array(
'attr' => 'fs',
'type' => 'bool',
'name' => __( 'Fullscreen', ARVE_SLUG )
),
array(
'attr' => 'hl',
'type' => 'text',
'name' => __( 'Language???', ARVE_SLUG )
),
array(
'attr' => 'iv_load_policy',
'type' => array(
'' => __( 'Default', ARVE_SLUG ),
1 => __( 'Show annotations', ARVE_SLUG ),
3 => __( 'Do not show annotations', ARVE_SLUG ),
),
'name' => __( 'iv_load_policy', ARVE_SLUG ),
),
array(
'attr' => 'list',
'type' => 'medium-text',
'name' => __( 'Language???', ARVE_SLUG )
),
array(
'attr' => 'listType',
'type' => array(
'' => __( 'Default', ARVE_SLUG ),
'playlist' => __( 'Playlist', ARVE_SLUG ),
'search' => __( 'Search', ARVE_SLUG ),
'user_uploads' => __( 'User Uploads', ARVE_SLUG ),
),
'name' => __( 'List Type', ARVE_SLUG ),
),
array(
'attr' => 'loop',
'type' => 'bool',
'name' => __( 'Loop', ARVE_SLUG ),
),
array(
'attr' => 'modestbranding',
'type' => 'bool',
'name' => __( 'Modestbranding', ARVE_SLUG ),
),
array(
'attr' => 'origin',
'type' => 'bool',
'name' => __( 'Origin', ARVE_SLUG ),
),
array(
'attr' => 'playerapiid',
'type' => 'bool',
'name' => __( 'playerapiid', ARVE_SLUG ),
),
array(
'attr' => 'playlist',
'type' => 'bool',
'name' => __( 'Playlist', ARVE_SLUG ),
),
array(
'attr' => 'playsinline',
'type' => 'bool',
'name' => __( 'playsinline', ARVE_SLUG ),
),
array(
'attr' => 'rel',
'type' => 'bool',
'name' => __( 'Related Videos at End', ARVE_SLUG ),
),
array(
'attr' => 'showinfo',
'type' => 'bool',
'name' => __( 'Show Info', ARVE_SLUG ),
),
array(
'attr' => 'start',
'type' => 'number',
'name' => __( 'Start', ARVE_SLUG ),
),
array(
'attr' => 'theme',
'type' => array(
'' => __( 'Default', ARVE_SLUG ),
'dark' => __( 'Dark', ARVE_SLUG ),
'light' => __( 'Light', ARVE_SLUG ),
),
'name' => __( 'Theme', ARVE_SLUG ),
),
),
*/
),
'youtubelist' => array(
'regex' => $s . 'youtube\.com/(embed/videoseries|playlist)\?list=(?[-a-z0-9]+)',
'name' => 'YouTube Playlist',
'embed_url' => 'https://www.youtube.com/embed/videoseries?list=%s',
'auto_thumbnail' => true,
'tests' => array(
array(
'url' => 'https://www.youtube.com/playlist?list=PL3Esg-ZzbiUmeSKBAQ3ej1hQxDSsmnp-7',
'id' => 'PL3Esg-ZzbiUmeSKBAQ3ej1hQxDSsmnp-7'
),
array(
'url' => 'https://www.youtube.com/embed/videoseries?list=PLMUvgtCRyn-6obmhiDS4n5vYQN3bJRduk',
'id' => 'PLMUvgtCRyn-6obmhiDS4n5vYQN3bJRduk',
)
)
),
'html5' => array(
'name' => 'HTML5 video files directly',
#'regex' => '(?' . $s . 'dropbox.com/[^.]+\.(mp4|webm|ogv)$)', # URLs ending with .mp4, .webm ... are handled by word
'aspect_ratio' => false,
),
'iframe' => array(
'embed_url' => '%s',
'default_params' => '',
'auto_thumbnail' => false,
'requires_flash' => true,
'tests' => array(
array( 'url' => 'https://example.com/', 'id' => 'https://example.com/' ),
),
),
'google_drive' => array( 'name', 'Google Drive' ),
'dropbox' => null,
'ooyala' => null,
);
foreach ( $properties as $key => $value ) {
if( empty( $value['name'] ) ) {
$properties[ $key ]['name'] = ucfirst( $key );
}
if( ! isset( $value['aspect_ratio'] ) ) {
$properties[ $key ]['aspect_ratio'] = '16:9';
}
if( empty( $value['requires_flash'] ) ) {
$properties[ $key ]['requires_flash'] = false;
}
}
return $properties;
}
function arve_attr( $attr = array() ) {
if ( empty( $attr ) ) {
return '';
}
$html = '';
foreach ( $attr as $key => $value ) {
if ( false === $value || null === $value ) {
continue;
} elseif ( '' === $value || true === $value ) {
$html .= sprintf( ' %s', esc_html( $key ) );
} elseif ( in_array( $key, array( 'href', 'data-href', 'src', 'data-src' ) ) ) {
$html .= sprintf( ' %s="%s"', esc_html( $key ), arve_esc_url( $value ) );
} else {
$html .= sprintf( ' %s="%s"', esc_html( $key ), esc_attr( $value ) );
}
}
return $html;
}
function arve_esc_url( $url ) {
return str_replace( 'jukebox?list%5B0%5D', 'jukebox?list[]', esc_url( $url ) );
}
function arve_starts_with( $haystack, $needle ) {
// search backwards starting from haystack length characters from the end
return $needle === "" || strrpos( $haystack, $needle, -strlen( $haystack ) ) !== false;
}
function arve_ends_with( $haystack, $needle ) {
// search forward starting from end minus needle length characters
return $needle === "" || ( ( $temp = strlen($haystack) - strlen( $needle ) ) >= 0 && strpos( $haystack, $needle, $temp ) !== false );
}
function arve_contains( $haystack, $needle ) {
return strpos( $haystack, $needle ) !== false;
}
function arve_register_asset( $args ) {
$defaults = array(
'handle' => null,
'src' => null,
'deps' => array(),
'in_footer' => true,
'media' => null,
'ver' => ARVE_VERSION,
'automin' => false,
);
$args = wp_parse_args( $args, $defaults );
if ( $args['automin'] && ! defined( 'WP_DEBUG' ) && ! WP_DEBUG ) {
$args['src'] = str_replace( '.css', '.min.css', $args['src'] );
$args['src'] = str_replace( '.js', '.min.js', $args['src'] );
}
if ( arve_ends_with( $args['src'], '.css' ) ) {
wp_register_style( $args['handle'], $args['src'], $args['deps'], $args['ver'], $args['media'] );
} else {
wp_register_script( $args['handle'], $args['src'], $args['deps'], $args['ver'], $args['in_footer'] );
}
}
function arve_get_min_suffix() {
return ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? '' : '.min';
}