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

Version Description

Download this release

Release Info

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

Code changes from version 9.5.4-beta1 to 9.5.5

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.5.4-beta1
7
  * Author: Nicolas Jonas
8
  * Author URI: https://nextgenthemes.com
9
  * License: GPL-3.0
@@ -19,12 +19,13 @@
19
 
20
  namespace Nextgenthemes\ARVE;
21
 
22
- const VERSION = '9.5.4-beta1';
23
  const PRO_VERSION_REQUIRED = '5.1.11';
24
  const NUM_TRACKS = 3;
25
  const PLUGIN_FILE = __FILE__;
26
  const PLUGIN_DIR = __DIR__;
27
  const VIDEO_FILE_EXTENSIONS = array( 'av1mp4', 'mp4', 'm4v', 'webm', 'ogv' );
28
  const DEFAULT_MAXWIDTH = 900;
 
29
 
30
  require_once __DIR__ . '/php/init.php';
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.5.5
7
  * Author: Nicolas Jonas
8
  * Author URI: https://nextgenthemes.com
9
  * License: GPL-3.0
19
 
20
  namespace Nextgenthemes\ARVE;
21
 
22
+ const VERSION = '9.5.5';
23
  const PRO_VERSION_REQUIRED = '5.1.11';
24
  const NUM_TRACKS = 3;
25
  const PLUGIN_FILE = __FILE__;
26
  const PLUGIN_DIR = __DIR__;
27
  const VIDEO_FILE_EXTENSIONS = array( 'av1mp4', 'mp4', 'm4v', 'webm', 'ogv' );
28
  const DEFAULT_MAXWIDTH = 900;
29
+ const OEMBED_HTML_PRIORITY = -5;
30
 
31
  require_once __DIR__ . '/php/init.php';
changelog.md CHANGED
@@ -4,6 +4,13 @@
4
  * [ARVE Pro changelog](https://nextgenthemes.com/plugins/arve-pro/#changelog)
5
  * [ARVE Random Videos changelog](https://nextgenthemes.com/plugins/arve-random-video/#changelog)
6
 
 
 
 
 
 
 
 
7
  ### 2021-03-02 9.5.4-beta1 ###
8
 
9
  * Fix: Possible conflict with PHP8 polyfills.
4
  * [ARVE Pro changelog](https://nextgenthemes.com/plugins/arve-pro/#changelog)
5
  * [ARVE Random Videos changelog](https://nextgenthemes.com/plugins/arve-random-video/#changelog)
6
 
7
+ ### 2021-03-08 9.5.5 ###
8
+
9
+ * Fix: JSON decode error appearing.
10
+ * Fix: Error messages for no longer needed and not existing `.js` file.
11
+ * Improved: Default width for sticky videos set to `500px`.
12
+ * Tested with WP 5.7-RC2
13
+
14
  ### 2021-03-02 9.5.4-beta1 ###
15
 
16
  * Fix: Possible conflict with PHP8 polyfills.
php/Common/Admin/Notices.php CHANGED
@@ -149,17 +149,6 @@ if ( 'always' ) {
149
 
150
  }
151
 
152
- /**
153
- * Load the script
154
- *
155
- * @since 1.0
156
- * @return void
157
- */
158
- public function load_script() {
159
- wp_register_script( 'dnh', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'assets/js/main.js', array( 'jquery' ), self::$instance->version, true );
160
- wp_enqueue_script( 'dnh' );
161
- }
162
-
163
  /**
164
  * Display all the registered notices
165
  *
149
 
150
  }
151
 
 
 
 
 
 
 
 
 
 
 
 
152
  /**
153
  * Display all the registered notices
154
  *
php/functions-oembed.php CHANGED
@@ -36,16 +36,13 @@ function filter_oembed_dataparse( $result, $data, $url ) {
36
 
37
  function filter_embed_oembed_html( $cache, $url, $attr, $post_ID ) {
38
 
39
- $json = extract_oembed_json( $cache );
 
40
 
41
- if ( json_last_error() !== JSON_ERROR_NONE ) {
42
- $a['errors'] = new \WP_Error( $url . '-json-error', 'json decode error code ' . json_last_error() );
43
- }
44
-
45
- if ( $json ) {
46
 
47
  $a['url'] = $url;
48
- $a['oembed_data'] = $json;
49
  $a['origin_data'] = [
50
  'from' => 'filter_embed_oembed_html',
51
  'post_id' => $post_ID,
@@ -61,15 +58,28 @@ function filter_embed_oembed_html( $cache, $url, $attr, $post_ID ) {
61
  return $cache;
62
  }
63
 
64
- function extract_oembed_json( $html ) {
65
 
66
  \preg_match( '#(?<=data-arve-oembed>).*?(?=</script>)#s', $html, $matches );
67
 
68
- if ( ! empty( $matches[0] ) ) {
69
- return json_decode( $matches[0], false, 512, JSON_UNESCAPED_UNICODE );
70
  }
71
 
72
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  }
74
 
75
  function yt_srcset( $url ) {
36
 
37
  function filter_embed_oembed_html( $cache, $url, $attr, $post_ID ) {
38
 
39
+ $a['errors'] = new \WP_Error();
40
+ $oembed_data = extract_oembed_json( $cache, $a );
41
 
42
+ if ( $oembed_data ) {
 
 
 
 
43
 
44
  $a['url'] = $url;
45
+ $a['oembed_data'] = $oembed_data;
46
  $a['origin_data'] = [
47
  'from' => 'filter_embed_oembed_html',
48
  'post_id' => $post_ID,
58
  return $cache;
59
  }
60
 
61
+ function extract_oembed_json( $html, array $a ) {
62
 
63
  \preg_match( '#(?<=data-arve-oembed>).*?(?=</script>)#s', $html, $matches );
64
 
65
+ if ( empty( $matches[0] ) ) {
66
+ return false;
67
  }
68
 
69
+ $data = json_decode( $matches[0], false, 512, JSON_UNESCAPED_UNICODE );
70
+
71
+ if ( json_last_error() !== JSON_ERROR_NONE ) {
72
+
73
+ $error_code = "$url-extract-json";
74
+
75
+ $a['errors']->add( $error_code, 'json decode error code ' . json_last_error() );
76
+ $a['errors']->add_data(
77
+ compact('html', 'matches', 'data', 'a'),
78
+ $error_code
79
+ );
80
+ }
81
+
82
+ return $data;
83
  }
84
 
85
  function yt_srcset( $url ) {
php/functions-settings.php CHANGED
@@ -524,7 +524,7 @@ function all_settings() {
524
  ),
525
  'sticky_width' => array(
526
  'tag' => 'sticky-videos',
527
- 'default' => '350px',
528
  'shortcode' => false,
529
  'label' => __( 'Sticky Video Width', 'advanced-responsive-video-embedder' ),
530
  'type' => 'string',
@@ -577,7 +577,7 @@ function all_settings() {
577
  ),
578
  'description' => __( 'Corner the video gets pinned to on bigger screens.', 'advanced-responsive-video-embedder' ),
579
  ),
580
- 'align_maxwidth' => array(
581
  'default' => 400,
582
  'shortcode' => false,
583
  'label' => __( 'Align Maximal Width', 'advanced-responsive-video-embedder' ),
@@ -592,7 +592,7 @@ function all_settings() {
592
  'description' => __( 'E.g. 4:3, 21:9. ARVE is usually smart enough to figure this out on its own.', 'advanced-responsive-video-embedder' ),
593
  'placeholder' => __( '4:3, 21:9 ...', 'advanced-responsive-video-embedder' ),
594
  ),
595
- 'parameters' => array(
596
  'default' => null,
597
  'html5' => false,
598
  'option' => false,
@@ -605,7 +605,7 @@ function all_settings() {
605
  esc_url( 'https://nextgenthemes.com/plugins/arve/documentation/#parameters' )
606
  ),
607
  ),
608
- 'wp_video_override' => array(
609
  'tag' => 'html5',
610
  'default' => true,
611
  'shortcode' => false,
@@ -628,7 +628,7 @@ function all_settings() {
628
  'options' => $def_bool_options,
629
  'description' => __( 'Show controls on HTML5 video.', 'advanced-responsive-video-embedder' ),
630
  ),
631
- 'loop' => array(
632
  'tag' => 'html5',
633
  'default' => 'n',
634
  'shortcode' => true,
@@ -682,7 +682,7 @@ function all_settings() {
682
  'descriptionlink' => esc_url( 'https://nextgenthemes.com/plugins/arve-random-video/' ),
683
  'descriptionlinktext' => esc_html__( 'Random Video Addon', 'advanced-responsive-video-embedder' ),
684
  ),
685
- 'vimeo_api_secret' => array(
686
  'tag' => 'random-video',
687
  'default' => '',
688
  'shortcode' => false,
@@ -696,7 +696,7 @@ function all_settings() {
696
  'descriptionlink' => esc_url( 'https://nextgenthemes.com/plugins/arve-random-video/' ),
697
  'descriptionlinktext' => esc_html__( 'Random Video Addon', 'advanced-responsive-video-embedder' ),
698
  ),
699
- 'vimeo_api_token' => array(
700
  'tag' => 'random-video',
701
  'default' => '',
702
  'shortcode' => false,
@@ -710,7 +710,7 @@ function all_settings() {
710
  'descriptionlink' => esc_url( 'https://nextgenthemes.com/plugins/arve-random-video/' ),
711
  'descriptionlinktext' => esc_html__( 'Random Video Addon', 'advanced-responsive-video-embedder' ),
712
  ),
713
- 'random_video_url' => array(
714
  'tag' => 'random-video',
715
  'default' => null,
716
  'option' => false,
@@ -725,7 +725,7 @@ function all_settings() {
725
  'descriptionlink' => esc_url( 'https://nextgenthemes.com/plugins/arve-random-video/' ),
726
  'descriptionlinktext' => esc_html__( 'Random Video Addon', 'advanced-responsive-video-embedder' ),
727
  ),
728
- 'random_video_urls' => array(
729
  'tag' => 'random-video',
730
  'default' => null,
731
  'option' => false,
@@ -740,36 +740,36 @@ function all_settings() {
740
  'descriptionlink' => esc_url( 'https://nextgenthemes.com/plugins/arve-random-video/' ),
741
  'descriptionlinktext' => esc_html__( 'Random Video Addon', 'advanced-responsive-video-embedder' ),
742
  ),
743
- 'legacy_shortcodes' => array(
744
  'default' => true,
745
  'shortcode' => false,
746
  'label' => __( 'Enable lagacy shortcodes', 'advanced-responsive-video-embedder' ),
747
  'type' => 'boolean',
748
  'description' => __( 'Enable the old and deprected <code>[youtube id="abcde" /]</code> or <code>[vimeo id="abcde" /]</code> ... style shortcodes. Only enable if you have them in your content.', 'advanced-responsive-video-embedder' ),
749
  ),
750
- 'sandbox' => array(
751
  'default' => true,
752
  'shortcode' => true,
753
  'label' => __( 'Sandbox', 'advanced-responsive-video-embedder' ),
754
  'type' => 'boolean',
755
  'description' => __( "Only disable if you have to. If you embed encrypted media you have to disable this. 'Disable Links' feature from ARVE Pro will not work when without sandbox.", 'advanced-responsive-video-embedder' ),
756
  ),
757
- 'seo_data' => array(
758
  'tag' => 'main',
759
  'default' => true,
760
  'shortcode' => false,
761
  'label' => __( 'Enable structured data (schema.org)', 'advanced-responsive-video-embedder' ),
762
  'type' => 'boolean',
763
- 'description' => __( 'Disable if you use Yoast Video SEO or another plugin that generates the data already.', 'advanced-responsive-video-embedder' ),
764
  ),
765
- 'gutenberg_help' => array(
766
  'default' => true,
767
  'shortcode' => false,
768
  'label' => __( 'Enable help text in the Block sidebar?', 'advanced-responsive-video-embedder' ),
769
  'type' => 'boolean',
770
  'description' => __( 'Disabling this makes the interface much cleaner.', 'advanced-responsive-video-embedder' ),
771
  ),
772
- 'feed' => array(
773
  'default' => true,
774
  'shortcode' => false,
775
  'option' => true,
@@ -801,7 +801,7 @@ function all_settings() {
801
  'type' => 'boolean',
802
  ],
803
  */
804
- 'admin_bar_menu' => array(
805
  'default' => false,
806
  'shortcode' => false,
807
  'option' => true,
524
  ),
525
  'sticky_width' => array(
526
  'tag' => 'sticky-videos',
527
+ 'default' => '500px',
528
  'shortcode' => false,
529
  'label' => __( 'Sticky Video Width', 'advanced-responsive-video-embedder' ),
530
  'type' => 'string',
577
  ),
578
  'description' => __( 'Corner the video gets pinned to on bigger screens.', 'advanced-responsive-video-embedder' ),
579
  ),
580
+ 'align_maxwidth' => array(
581
  'default' => 400,
582
  'shortcode' => false,
583
  'label' => __( 'Align Maximal Width', 'advanced-responsive-video-embedder' ),
592
  'description' => __( 'E.g. 4:3, 21:9. ARVE is usually smart enough to figure this out on its own.', 'advanced-responsive-video-embedder' ),
593
  'placeholder' => __( '4:3, 21:9 ...', 'advanced-responsive-video-embedder' ),
594
  ),
595
+ 'parameters' => array(
596
  'default' => null,
597
  'html5' => false,
598
  'option' => false,
605
  esc_url( 'https://nextgenthemes.com/plugins/arve/documentation/#parameters' )
606
  ),
607
  ),
608
+ 'wp_video_override' => array(
609
  'tag' => 'html5',
610
  'default' => true,
611
  'shortcode' => false,
628
  'options' => $def_bool_options,
629
  'description' => __( 'Show controls on HTML5 video.', 'advanced-responsive-video-embedder' ),
630
  ),
631
+ 'loop' => array(
632
  'tag' => 'html5',
633
  'default' => 'n',
634
  'shortcode' => true,
682
  'descriptionlink' => esc_url( 'https://nextgenthemes.com/plugins/arve-random-video/' ),
683
  'descriptionlinktext' => esc_html__( 'Random Video Addon', 'advanced-responsive-video-embedder' ),
684
  ),
685
+ 'vimeo_api_secret' => array(
686
  'tag' => 'random-video',
687
  'default' => '',
688
  'shortcode' => false,
696
  'descriptionlink' => esc_url( 'https://nextgenthemes.com/plugins/arve-random-video/' ),
697
  'descriptionlinktext' => esc_html__( 'Random Video Addon', 'advanced-responsive-video-embedder' ),
698
  ),
699
+ 'vimeo_api_token' => array(
700
  'tag' => 'random-video',
701
  'default' => '',
702
  'shortcode' => false,
710
  'descriptionlink' => esc_url( 'https://nextgenthemes.com/plugins/arve-random-video/' ),
711
  'descriptionlinktext' => esc_html__( 'Random Video Addon', 'advanced-responsive-video-embedder' ),
712
  ),
713
+ 'random_video_url' => array(
714
  'tag' => 'random-video',
715
  'default' => null,
716
  'option' => false,
725
  'descriptionlink' => esc_url( 'https://nextgenthemes.com/plugins/arve-random-video/' ),
726
  'descriptionlinktext' => esc_html__( 'Random Video Addon', 'advanced-responsive-video-embedder' ),
727
  ),
728
+ 'random_video_urls' => array(
729
  'tag' => 'random-video',
730
  'default' => null,
731
  'option' => false,
740
  'descriptionlink' => esc_url( 'https://nextgenthemes.com/plugins/arve-random-video/' ),
741
  'descriptionlinktext' => esc_html__( 'Random Video Addon', 'advanced-responsive-video-embedder' ),
742
  ),
743
+ 'legacy_shortcodes' => array(
744
  'default' => true,
745
  'shortcode' => false,
746
  'label' => __( 'Enable lagacy shortcodes', 'advanced-responsive-video-embedder' ),
747
  'type' => 'boolean',
748
  'description' => __( 'Enable the old and deprected <code>[youtube id="abcde" /]</code> or <code>[vimeo id="abcde" /]</code> ... style shortcodes. Only enable if you have them in your content.', 'advanced-responsive-video-embedder' ),
749
  ),
750
+ 'sandbox' => array(
751
  'default' => true,
752
  'shortcode' => true,
753
  'label' => __( 'Sandbox', 'advanced-responsive-video-embedder' ),
754
  'type' => 'boolean',
755
  'description' => __( "Only disable if you have to. If you embed encrypted media you have to disable this. 'Disable Links' feature from ARVE Pro will not work when without sandbox.", 'advanced-responsive-video-embedder' ),
756
  ),
757
+ 'seo_data' => array(
758
  'tag' => 'main',
759
  'default' => true,
760
  'shortcode' => false,
761
  'label' => __( 'Enable structured data (schema.org)', 'advanced-responsive-video-embedder' ),
762
  'type' => 'boolean',
763
+ 'description' => __( 'ARVE Pro helps you autofill the data so you do not have to manually enter things for every single video to make it complete.', 'advanced-responsive-video-embedder' ),
764
  ),
765
+ 'gutenberg_help' => array(
766
  'default' => true,
767
  'shortcode' => false,
768
  'label' => __( 'Enable help text in the Block sidebar?', 'advanced-responsive-video-embedder' ),
769
  'type' => 'boolean',
770
  'description' => __( 'Disabling this makes the interface much cleaner.', 'advanced-responsive-video-embedder' ),
771
  ),
772
+ 'feed' => array(
773
  'default' => true,
774
  'shortcode' => false,
775
  'option' => true,
801
  'type' => 'boolean',
802
  ],
803
  */
804
+ 'admin_bar_menu' => array(
805
  'default' => false,
806
  'shortcode' => false,
807
  'option' => true,
php/functions-shortcodes.php CHANGED
@@ -3,8 +3,8 @@ namespace Nextgenthemes\ARVE;
3
 
4
  function shortcode( $a ) {
5
 
6
- $a = (array) $a;
7
-
8
  $a['origin_data']['from'] = 'shortcode';
9
 
10
  foreach ( $a as $k => $v ) {
@@ -19,23 +19,18 @@ function shortcode( $a ) {
19
  return $override;
20
  }
21
 
22
- $a['errors'] = new \WP_Error();
23
- $a = apply_filters( 'nextgenthemes/arve/shortcode_args', $a );
24
 
25
  if ( ! empty( $a['url'] ) ) {
26
 
27
- remove_filter( 'embed_oembed_html', __NAMESPACE__ . '\filter_embed_oembed_html', -5 );
28
  $maybe_arve_html = $GLOBALS['wp_embed']->shortcode( array(), $a['url'] );
29
- add_filter( 'embed_oembed_html', __NAMESPACE__ . '\filter_embed_oembed_html', -5, 4 );
30
-
31
- $json = extract_oembed_json( $maybe_arve_html );
32
 
33
- if ( json_last_error() !== JSON_ERROR_NONE ) {
34
- $a['errors']->add( 'json-error', 'json decode error code ' . json_last_error() );
35
- }
36
 
37
- if ( $json ) {
38
- $a['oembed_data'] = $json;
39
  $a['origin_data']['from'] = 'shortcode oembed_data detected';
40
  }
41
  }
3
 
4
  function shortcode( $a ) {
5
 
6
+ $a = (array) $a;
7
+ $a['errors'] = new \WP_Error();
8
  $a['origin_data']['from'] = 'shortcode';
9
 
10
  foreach ( $a as $k => $v ) {
19
  return $override;
20
  }
21
 
22
+ $a = apply_filters( 'nextgenthemes/arve/shortcode_args', $a );
 
23
 
24
  if ( ! empty( $a['url'] ) ) {
25
 
26
+ remove_filter( 'embed_oembed_html', __NAMESPACE__ . '\filter_embed_oembed_html', OEMBED_HTML_PRIORITY );
27
  $maybe_arve_html = $GLOBALS['wp_embed']->shortcode( array(), $a['url'] );
28
+ add_filter( 'embed_oembed_html', __NAMESPACE__ . '\filter_embed_oembed_html', OEMBED_HTML_PRIORITY, 4 );
 
 
29
 
30
+ $oembed_data = extract_oembed_json( $maybe_arve_html, $a );
 
 
31
 
32
+ if ( $oembed_data ) {
33
+ $a['oembed_data'] = $oembed_data;
34
  $a['origin_data']['from'] = 'shortcode oembed_data detected';
35
  }
36
  }
php/init.php CHANGED
@@ -40,7 +40,7 @@ function init_public() {
40
  add_action( 'wp_video_shortcode_override', __NAMESPACE__ . '\wp_video_shortcode_override', 10, 4 );
41
  add_filter( 'language_attributes', __NAMESPACE__ . '\html_id' );
42
  add_filter( 'oembed_dataparse', __NAMESPACE__ . '\filter_oembed_dataparse', PHP_INT_MAX, 3 );
43
- add_filter( 'embed_oembed_html', __NAMESPACE__ . '\filter_embed_oembed_html', -5, 4 );
44
  }
45
 
46
  function init_admin() {
40
  add_action( 'wp_video_shortcode_override', __NAMESPACE__ . '\wp_video_shortcode_override', 10, 4 );
41
  add_filter( 'language_attributes', __NAMESPACE__ . '\html_id' );
42
  add_filter( 'oembed_dataparse', __NAMESPACE__ . '\filter_oembed_dataparse', PHP_INT_MAX, 3 );
43
+ add_filter( 'embed_oembed_html', __NAMESPACE__ . '\filter_embed_oembed_html', OEMBED_HTML_PRIORITY, 4 );
44
  }
45
 
46
  function init_admin() {
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: YouTube, Vimeo, lazyload, thumbnail, video, responsive, embeds, video-embe
5
  Requires at least: 4.9.16
6
  Tested up to: 5.6.2
7
  Requires PHP: 5.6
8
- Stable tag: 9.5.4-beta1
9
  License: GPL-3.0
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -193,6 +193,13 @@ Please read the [official documentation](https://wordpress.org/support/article/m
193
  * [ARVE Pro changelog](https://nextgenthemes.com/plugins/arve-pro/#changelog)
194
  * [ARVE Random Videos changelog](https://nextgenthemes.com/plugins/arve-random-video/#changelog)
195
 
 
 
 
 
 
 
 
196
  ### 2021-03-02 9.5.4-beta1 ###
197
 
198
  * Fix: Possible conflict with PHP8 polyfills.
5
  Requires at least: 4.9.16
6
  Tested up to: 5.6.2
7
  Requires PHP: 5.6
8
+ Stable tag: 9.5.5
9
  License: GPL-3.0
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
193
  * [ARVE Pro changelog](https://nextgenthemes.com/plugins/arve-pro/#changelog)
194
  * [ARVE Random Videos changelog](https://nextgenthemes.com/plugins/arve-random-video/#changelog)
195
 
196
+ ### 2021-03-08 9.5.5 ###
197
+
198
+ * Fix: JSON decode error appearing.
199
+ * Fix: Error messages for no longer needed and not existing `.js` file.
200
+ * Improved: Default width for sticky videos set to `500px`.
201
+ * Tested with WP 5.7-RC2
202
+
203
  ### 2021-03-02 9.5.4-beta1 ###
204
 
205
  * Fix: Possible conflict with PHP8 polyfills.