PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 All 504 releases
← All changes | modules/videopress/shortcode.php +13 -2 13.6.216.3-a.1 View file →
@@ -1,6 +1,12 @@
1 1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 2
3 +if ( ! defined( 'ABSPATH' ) ) {
4 + exit( 0 );
5 +}
6 +
7 +use Automattic\Jetpack\VideoPress\Data as VideoPress_Data;
8 +
3 9 /**
4 10 * VideoPress Shortcode Handler
5 11 *
6 12 * This file may or may not be included from the Jetpack VideoPress module.
@@ -58,9 +64,9 @@
58 64
59 65 /**
60 66 * We only accept GUIDs as a first unnamed argument.
61 67 */
62 - $guid = isset( $attr[0] ) ? $attr[0] : null;
68 + $guid = $attr[0] ?? null;
63 69
64 70 if ( isset( $attr['postid'] ) ) {
65 71 $guid = get_post_meta( $attr['postid'], 'videopress_guid', true );
66 72 }
@@ -103,8 +109,13 @@
103 109 if ( isset( $attr['preload'] ) ) {
104 110 $attr['preloadcontent'] = $attr['preload'];
105 111 }
106 112
113 + // The site-wide opt-out wins over the shortcode's own preload attribute.
114 + if ( VideoPress_Data::get_videopress_player_preload_disabled() ) {
115 + $attr['preloadcontent'] = 'none';
116 + }
117 +
107 118 $attr = shortcode_atts( $defaults, $attr, 'videopress' );
108 119
109 120 /**
110 121 * Cast the attributes, post-input.
@@ -126,9 +137,9 @@
126 137 /**
127 138 * If there was an invalid or unspecified width, set the width equal to the theme's `$content_width`.
128 139 */
129 140 if ( 0 === $attr['width'] && isset( $content_width ) && $content_width >= VIDEOPRESS_MIN_WIDTH ) {
130 - $attr['width'] = $content_width;
141 + $attr['width'] = (int) $content_width;
131 142 }
132 143
133 144 /**
134 145 * If the width isn't an even number, reduce it by one (making it even).