ARVE Advanced Responsive Video Embedder (YouTube, Vimeo, HTML5 Video …) - Version 9.0.0-beta13

Version Description

Download this release

Release Info

Developer nico23
Plugin Icon 128x128 ARVE Advanced Responsive Video Embedder (YouTube, Vimeo, HTML5 Video …)
Version 9.0.0-beta13
Comparing to
See all releases

Code changes from version 9.0.0-beta12 to 9.0.0-beta13

advanced-responsive-video-embedder.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: ARVE Advanced Responsive Video Embedder
4
  * Plugin URI: https://nextgenthemes.com/plugins/arve-pro/
5
  * Description: Easy responsive video embeds via URL (like WordPress) or Shortcodes. Supports almost anything you can imagine.
6
- * Version: 9.0.0-beta12
7
  * Author: Nicolas Jonas
8
  * Author URI: https://nextgenthemes.com
9
  * License: GPL-3.0
@@ -21,7 +21,7 @@
21
 
22
  namespace Nextgenthemes\ARVE;
23
 
24
- const VERSION = '9.0.0-beta12';
25
  const PRO_VERSION_REQUIRED = '5.0.0-beta5';
26
  const NUM_TRACKS = 3;
27
  const PLUGIN_FILE = __FILE__;
3
  * Plugin Name: ARVE Advanced Responsive Video Embedder
4
  * Plugin URI: https://nextgenthemes.com/plugins/arve-pro/
5
  * Description: Easy responsive video embeds via URL (like WordPress) or Shortcodes. Supports almost anything you can imagine.
6
+ * Version: 9.0.0-beta13
7
  * Author: Nicolas Jonas
8
  * Author URI: https://nextgenthemes.com
9
  * License: GPL-3.0
21
 
22
  namespace Nextgenthemes\ARVE;
23
 
24
+ const VERSION = '9.0.0-beta13';
25
  const PRO_VERSION_REQUIRED = '5.0.0-beta5';
26
  const NUM_TRACKS = 3;
27
  const PLUGIN_FILE = __FILE__;
php/functions-host-properties.php CHANGED
@@ -594,6 +594,10 @@ function get_host_properties() {
594
  'url' => 'https://www.youtube.com/watch?v=-fEo3kgHFaw',
595
  'id' => '-fEo3kgHFaw',
596
  ],
 
 
 
 
597
  [
598
  'url' => 'http://www.youtube.com/watch?v=vrXgLhkv21Y',
599
  'id' => 'vrXgLhkv21Y',
594
  'url' => 'https://www.youtube.com/watch?v=-fEo3kgHFaw',
595
  'id' => '-fEo3kgHFaw',
596
  ],
597
+ [
598
+ 'url' => 'https://www.youtube.com/watch?time_continue=1&v=eqnnyDa7C7Q&feature=emb_logo',
599
+ 'id' => 'eqnnyDa7C7Q',
600
+ ],
601
  [
602
  'url' => 'http://www.youtube.com/watch?v=vrXgLhkv21Y',
603
  'id' => 'vrXgLhkv21Y',
php/functions-shortcode-filters.php CHANGED
@@ -171,6 +171,7 @@ function sc_filter_validate( array $a ) {
171
 
172
  $url_args = VIDEO_FILE_EXTENSIONS;
173
  $url_args[] = 'url';
 
174
 
175
  foreach ( $url_args as $urlattr ) {
176
  $a = validate_url( $a, $urlattr );
@@ -437,7 +438,6 @@ function special_iframe_src_mods( array $a ) {
437
  case 'wistia':
438
  $a['src'] = add_query_arg( 'dnt', 1, $a['src'] );
439
  $a['src_gen'] = add_query_arg( 'dnt', 1, $a['src_gen'] );
440
-
441
  break;
442
  }
443
 
@@ -464,7 +464,7 @@ function sc_filter_iframe_src( array $a ) {
464
  $a = special_iframe_src_mods( $a );
465
  $a = compare_oembed_src_with_generated_src( $a );
466
 
467
- if ( ! $a['src'] ) {
468
  $a['src'] = $a['src_gen'];
469
  }
470
 
@@ -494,6 +494,9 @@ function compare_oembed_src_with_generated_src( array $a ) {
494
  $src = Common\remove_url_query( $a['src'] );
495
  $src_gen = Common\remove_url_query( $a['src_gen'] );
496
  break;
 
 
 
497
  }
498
 
499
  if ( $src !== $src_gen ) {
@@ -504,7 +507,16 @@ function compare_oembed_src_with_generated_src( array $a ) {
504
  $a['src_gen']
505
  );
506
 
507
- $a['errors']->add( 'info', $msg );
 
 
 
 
 
 
 
 
 
508
  }
509
 
510
  return $a;
@@ -543,17 +555,20 @@ function build_iframe_src( array $a ) {
543
  switch ( $a['provider'] ) {
544
 
545
  case 'youtube':
546
- $t_arg = Common\get_url_arg( $a['url'], 't' );
547
- $list_arg = Common\get_url_arg( $a['url'], 'list' );
 
548
 
549
  if ( $t_arg ) {
550
  $src = add_query_arg( 'start', youtube_time_to_seconds( $t_arg ), $src );
551
  }
552
 
 
 
 
 
553
  if ( $list_arg ) {
554
  $src = add_query_arg( 'list', $list_arg, $src );
555
- } else {
556
- $src = add_query_arg( 'feature', 'oembed', $src );
557
  }
558
  break;
559
  case 'ted':
171
 
172
  $url_args = VIDEO_FILE_EXTENSIONS;
173
  $url_args[] = 'url';
174
+ $url_args[] = 'src';
175
 
176
  foreach ( $url_args as $urlattr ) {
177
  $a = validate_url( $a, $urlattr );
438
  case 'wistia':
439
  $a['src'] = add_query_arg( 'dnt', 1, $a['src'] );
440
  $a['src_gen'] = add_query_arg( 'dnt', 1, $a['src_gen'] );
 
441
  break;
442
  }
443
 
464
  $a = special_iframe_src_mods( $a );
465
  $a = compare_oembed_src_with_generated_src( $a );
466
 
467
+ if ( ! valid_url( $a['src'] ) && valid_url( $a['src_gen'] ) ) {
468
  $a['src'] = $a['src_gen'];
469
  }
470
 
494
  $src = Common\remove_url_query( $a['src'] );
495
  $src_gen = Common\remove_url_query( $a['src_gen'] );
496
  break;
497
+ case 'youtube':
498
+ $src = remove_query_arg( 'feature', $a['src'] );
499
+ break;
500
  }
501
 
502
  if ( $src !== $src_gen ) {
507
  $a['src_gen']
508
  );
509
 
510
+ if ( 'vimeo' === $a['provider'] ) {
511
+ $msg .= sprintf(
512
+ 'vimeo compared <br>url: %s<br>src in: %s<br>src gen: %s',
513
+ $a['url'],
514
+ $src,
515
+ $src_gen
516
+ );
517
+ }
518
+
519
+ $a['errors']->add( 'hidden', $msg );
520
  }
521
 
522
  return $a;
555
  switch ( $a['provider'] ) {
556
 
557
  case 'youtube':
558
+ $t_arg = Common\get_url_arg( $a['url'], 't' );
559
+ $time_continue = Common\get_url_arg( $a['url'], 'time_continue' );
560
+ $list_arg = Common\get_url_arg( $a['url'], 'list' );
561
 
562
  if ( $t_arg ) {
563
  $src = add_query_arg( 'start', youtube_time_to_seconds( $t_arg ), $src );
564
  }
565
 
566
+ if ( $time_continue ) {
567
+ $src = add_query_arg( 'start', youtube_time_to_seconds( $time_continue ), $src );
568
+ }
569
+
570
  if ( $list_arg ) {
571
  $src = add_query_arg( 'list', $list_arg, $src );
 
 
572
  }
573
  break;
574
  case 'ted':
php/functions-shortcodes.php CHANGED
@@ -92,14 +92,17 @@ function build_video( array $input_atts ) {
92
  ksort( $a );
93
  ksort( $input_atts );
94
 
95
- if ( ! empty( $a['errors'] ) ) {
96
-
97
- foreach ( $a['errors']->get_error_messages() as $key => $message ) {
98
- $html .= sprintf(
99
- '%s %s<br>',
100
- __( '<abbr title="Advanced Responsive Video Embedder">ARVE</abbr> Error:', 'advanced-responsive-video-embedder' ),
101
- $message
102
- );
 
 
 
103
  }
104
 
105
  if ( '' !== $a['errors']->get_error_message( 'fatal' ) ) {
92
  ksort( $a );
93
  ksort( $input_atts );
94
 
95
+ if ( $a['errors']->has_errors() ) {
96
+
97
+ foreach ( $a['errors']->get_error_codes() as $code ) {
98
+ foreach ( $a['errors']->get_error_messages( $code ) as $key => $message ) {
99
+ $html .= sprintf(
100
+ '<span class="arve-error"%s>%s %s</span>',
101
+ 'hidden' === $code ? ' hidden' : '',
102
+ __( '<abbr title="Advanced Responsive Video Embedder">ARVE</abbr> Error:', 'advanced-responsive-video-embedder' ),
103
+ $message
104
+ );
105
+ }
106
  }
107
 
108
  if ( '' !== $a['errors']->get_error_message( 'fatal' ) ) {
php/functions-validation.php CHANGED
@@ -3,6 +3,10 @@ namespace Nextgenthemes\ARVE;
3
 
4
  function valid_url( $url ) {
5
 
 
 
 
 
6
  if ( Common\starts_with( $url, '//' ) ) {
7
  $url = 'https:' . $url;
8
  }
@@ -14,7 +18,7 @@ function valid_url( $url ) {
14
  return false;
15
  }
16
 
17
- function validate_url( $a, $attr_name ) {
18
 
19
  if ( ! empty( $a[ $attr_name ] ) && ! valid_url( $a[ $attr_name ] ) ) {
20
 
@@ -31,7 +35,7 @@ function validate_url( $a, $attr_name ) {
31
  return $a;
32
  }
33
 
34
- function validate_aspect_ratio( $a ) {
35
 
36
  if ( empty( $a['aspect_ratio'] ) ) {
37
  return $a;
@@ -102,7 +106,7 @@ function validate_bool( array $a, $attr_name ) {
102
  return $a;
103
  }
104
 
105
- function validate_align( $a ) {
106
 
107
  switch ( $a['align'] ) {
108
  case null:
3
 
4
  function valid_url( $url ) {
5
 
6
+ if ( empty( $url ) ) {
7
+ return false;
8
+ }
9
+
10
  if ( Common\starts_with( $url, '//' ) ) {
11
  $url = 'https:' . $url;
12
  }
18
  return false;
19
  }
20
 
21
+ function validate_url( array $a, $attr_name ) {
22
 
23
  if ( ! empty( $a[ $attr_name ] ) && ! valid_url( $a[ $attr_name ] ) ) {
24
 
35
  return $a;
36
  }
37
 
38
+ function validate_aspect_ratio( array $a ) {
39
 
40
  if ( empty( $a['aspect_ratio'] ) ) {
41
  return $a;
106
  return $a;
107
  }
108
 
109
+ function validate_align( array $a ) {
110
 
111
  switch ( $a['align'] ) {
112
  case null:
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: YouTube, Vimeo, lazyload, thumbnail, video, responsive, embeds, video-embe
5
  Requires at least: 4.4.0
6
  Tested up to: 5.6
7
  Requires PHP: 5.6
8
- Stable tag: 9.0.0-beta12
9
  License: GPL-3.0
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -16,7 +16,13 @@ Easy responsive video embeds via URLs or shortcodes. Perfect drop-in replacement
16
  * [ARVE Pro addon changelog](https://nextgenthemes.com/plugins/arve-pro/changelog/)
17
  * [ARVE AMP addon changelog](https://nextgenthemes.com/plugins/arve-amp/)
18
 
19
- ### 2020-12-13 9.0.0-beta12 ###
 
 
 
 
 
 
20
 
21
  * Fix: When deactivating or uninstalling ARVE, it will delete its embeds from the oembed cache.
22
  * Improved: Caching system.
5
  Requires at least: 4.4.0
6
  Tested up to: 5.6
7
  Requires PHP: 5.6
8
+ Stable tag: 9.0.0-beta13
9
  License: GPL-3.0
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
16
  * [ARVE Pro addon changelog](https://nextgenthemes.com/plugins/arve-pro/changelog/)
17
  * [ARVE AMP addon changelog](https://nextgenthemes.com/plugins/arve-amp/)
18
 
19
+ ### 2020-12-14 9.0.0-beta13 ###
20
+
21
+ * Fix: When no oembed data is found or input `src` is invalid url use generated `src` in all cases.
22
+ * Improved: added check for valid url for `src` input.
23
+ * Improved: 'src mismach' errors will be hidden as they are not critical and should not clutter peoples sites.
24
+
25
+ ### 2020-12-14 9.0.0-beta12 ###
26
 
27
  * Fix: When deactivating or uninstalling ARVE, it will delete its embeds from the oembed cache.
28
  * Improved: Caching system.