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/tiled-gallery/tiled-gallery.php +28 -6 12.0.3 → 16.3-a.1 View file →
@@ -1,9 +1,14 @@
1 1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 2
3 3 use Automattic\Jetpack\Assets;
4 +use Automattic\Jetpack\Image_CDN\Image_CDN;
4 5 use Automattic\Jetpack\Status;
5 6
7 +if ( ! defined( 'ABSPATH' ) ) {
8 + exit( 0 );
9 +}
10 +
6 11 // Include the class file containing methods for rounding constrained array elements.
7 12 // Here the constrained array element is the dimension of a row, group or an image in the tiled gallery.
8 13 require_once __DIR__ . '/math/class-constrained-array-rounding.php';
9 14
@@ -16,8 +21,22 @@
16 21 * Jetpack tiled gallery class.
17 22 */
18 23 class Jetpack_Tiled_Gallery {
19 24 /**
25 + * Shortcode attributes.
26 + *
27 + * @var array
28 + */
29 + public $atts;
30 +
31 + /**
32 + * Text direction (right or left).
33 + *
34 + * @var string
35 + */
36 + public $float;
37 +
38 + /**
20 39 * Supported gallery design types.
21 40 *
22 41 * @var array
23 42 */
@@ -52,9 +71,9 @@
52 71 $this->atts = shortcode_atts(
53 72 array(
54 73 'order' => 'ASC',
55 74 'orderby' => 'menu_order ID',
56 - 'id' => isset( $post->ID ) ? $post->ID : 0,
75 + 'id' => $post->ID ?? 0,
57 76 'include' => '',
58 77 'exclude' => '',
59 78 'type' => '',
60 79 'grayscale' => false,
@@ -166,11 +185,14 @@
166 185 'modules/tiled-gallery/tiled-gallery/tiled-gallery.js'
167 186 ),
168 187 array(),
169 188 JETPACK__VERSION,
170 - false
189 + array(
190 + 'in_footer' => true,
191 + 'strategy' => 'defer',
192 + )
171 193 );
172 - wp_enqueue_style( 'tiled-gallery', plugins_url( 'tiled-gallery/tiled-gallery.css', __FILE__ ), array(), '2012-09-21' );
194 + wp_enqueue_style( 'tiled-gallery', plugins_url( 'tiled-gallery/tiled-gallery.css', __FILE__ ), array(), '2023-08-21' );
173 195 wp_style_add_data( 'tiled-gallery', 'rtl', 'replace' );
174 196 }
175 197
176 198 /**
@@ -216,13 +238,13 @@
216 238 $gallery_class = 'Jetpack_Tiled_Gallery_Layout_' . ucfirst( $this->atts['type'] );
217 239 $gallery = new $gallery_class( $attachments, $this->atts['link'], $this->atts['grayscale'], (int) $this->atts['columns'] );
218 240 $gallery_html = $gallery->HTML();
219 241
220 - if ( $gallery_html && class_exists( 'Jetpack' ) && class_exists( 'Jetpack_Photon' ) ) {
242 + if ( $gallery_html && class_exists( 'Jetpack' ) && class_exists( Image_CDN::class ) ) {
221 243 // Tiled Galleries in Jetpack require that Photon be active.
222 244 // If it's not active, run it just on the gallery output.
223 - if ( ! in_array( 'photon', Jetpack::get_active_modules(), true ) && ! ( new Status() )->is_offline_mode() ) {
224 - $gallery_html = Jetpack_Photon::filter_the_content( $gallery_html );
245 + if ( ! Image_CDN::is_enabled() && ! ( new Status() )->is_offline_mode() ) {
246 + $gallery_html = Image_CDN::filter_the_content( $gallery_html );
225 247 }
226 248 }
227 249
228 250 return trim( preg_replace( '/\s+/', ' ', $gallery_html ) ); // remove any new lines from the output so that the reader parses it better