| @@ -9,8 +9,12 @@ | ||
| 9 | 9 | |
| 10 | 10 | use Automattic\Jetpack\Assets; |
| 11 | 11 | use Automattic\Jetpack\Image_CDN\Image_CDN_Core; |
| 12 | 12 | |
| 13 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 14 | + exit( 0 ); | |
| 15 | +} | |
| 16 | + | |
| 13 | 17 | /** |
| 14 | 18 | * Jetpack_Gallery_Widget main class. |
| 15 | 19 | */ |
| 16 | 20 | class Jetpack_Gallery_Widget extends WP_Widget { |
| @@ -73,12 +77,12 @@ | ||
| 73 | 77 | $instance = wp_parse_args( (array) $instance, $this->defaults() ); |
| 74 | 78 | |
| 75 | 79 | $this->enqueue_frontend_scripts(); |
| 76 | 80 | |
| 77 | - $before_widget = isset( $args['before_widget'] ) ? $args['before_widget'] : ''; | |
| 78 | - $before_title = isset( $args['before_title'] ) ? $args['before_title'] : ''; | |
| 79 | - $after_title = isset( $args['after_title'] ) ? $args['after_title'] : ''; | |
| 80 | - $after_widget = isset( $args['after_widget'] ) ? $args['after_widget'] : ''; | |
| 81 | + $before_widget = $args['before_widget'] ?? ''; | |
| 82 | + $before_title = $args['before_title'] ?? ''; | |
| 83 | + $after_title = $args['after_title'] ?? ''; | |
| 84 | + $after_widget = $args['after_widget'] ?? ''; | |
| 81 | 85 | |
| 82 | 86 | $instance['attachments'] = $this->get_attachments( $instance ); |
| 83 | 87 | |
| 84 | 88 | $classes = array(); |
| @@ -107,10 +111,9 @@ | ||
| 107 | 111 | // Create new carousel so we can use the enqueue_assets() method. Not ideal, but there is a decent amount |
| 108 | 112 | // of logic in that method that shouldn't be duplicated. |
| 109 | 113 | $carousel = new Jetpack_Carousel(); |
| 110 | 114 | |
| 111 | - // First parameter is $output, which comes from filters, and causes bypass of the asset enqueuing. Passing null is correct. | |
| 112 | - $carousel->enqueue_assets( null ); | |
| 115 | + $carousel->enqueue_assets(); | |
| 113 | 116 | } |
| 114 | 117 | } |
| 115 | 118 | |
| 116 | 119 | echo $before_widget . "\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| @@ -328,9 +331,13 @@ | ||
| 328 | 331 | |
| 329 | 332 | /** |
| 330 | 333 | * Outputs the widget settings form. |
| 331 | 334 | * |
| 335 | + * @html-template-var array $instance | |
| 336 | + * @html-template-var array<string,array<string|int,string|int>> $allowed_values | |
| 337 | + * | |
| 332 | 338 | * @param array $instance Current settings. |
| 339 | + * @return string|void | |
| 333 | 340 | */ |
| 334 | 341 | public function form( $instance ) { |
| 335 | 342 | $defaults = $this->defaults(); |
| 336 | 343 | $allowed_values = $this->allowed_values(); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Used in included form template. |