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 +15 -4 12.5.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).
@@ -207,9 +218,9 @@
207 218
208 219 foreach ( $url_keys as $key ) {
209 220 if ( isset( $attr[ $key ] ) ) {
210 221 $url = $attr[ $key ];
211 - // phpcs:ignore WordPress.WP.CapitalPDangit
222 + // phpcs:ignore WordPress.WP.CapitalPDangit.MisspelledInText
212 223 if ( preg_match( '@videos.(videopress\.com|files\.wordpress\.com)/([a-z0-9]{8})/@i', $url, $matches ) ) {
213 224 $videopress_guid = $matches[2];
214 225 }
215 226
@@ -218,9 +229,9 @@
218 229 $videopress_guid = $matches[1];
219 230 }
220 231
221 232 // Also test for old v.wordpress.com oembed URL.
222 - if ( ! $videopress_guid && preg_match( '|^https?://v\.wordpress\.com/([a-zA-Z\d]{8})(.+)?$|i', $url, $matches ) ) { // phpcs:ignore WordPress.WP.CapitalPDangit.Misspelled
233 + if ( ! $videopress_guid && preg_match( '|^https?://v\.wordpress\.com/([a-zA-Z\d]{8})(.+)?$|i', $url, $matches ) ) { // phpcs:ignore WordPress.WP.CapitalPDangit.MisspelledInText
223 234 $videopress_guid = $matches[1];
224 235 }
225 236
226 237 break;