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/widgets/wordpress-post-widget/class.jetpack-display-posts-widget-base.php +15 -11 13.2.416.3-a.1 View file →
@@ -1,8 +1,12 @@
1 1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 2
3 3 use Automattic\Jetpack\Image_CDN\Image_CDN_Core;
4 4
5 +if ( ! defined( 'ABSPATH' ) ) {
6 + exit( 0 );
7 +}
8 +
5 9 /**
6 10 * For back-compat, the final widget class must be named
7 11 * Jetpack_Display_Posts_Widget.
8 12 *
@@ -105,9 +109,9 @@
105 109 if ( empty( $instance['url'] ) ) {
106 110 if ( current_user_can( 'manage_options' ) ) {
107 111 $content .= '<p>';
108 112 /* Translators: the "Blog URL" field mentioned is the input field labeled as such in the widget form. */
109 - $content .= esc_html__( 'The Blog URL is not properly setup in the widget.', 'jetpack' );
113 + $content .= esc_html__( 'The Blog URL is not properly set up in the widget.', 'jetpack' );
110 114 $content .= '</p>';
111 115 }
112 116 $content .= $args['after_widget'];
113 117
@@ -129,9 +133,9 @@
129 133
130 134 if ( ! empty( $instance['title'] ) ) {
131 135 /** This filter is documented in core/src/wp-includes/default-widgets.php */
132 136 $instance['title'] = apply_filters( 'widget_title', $instance['title'] );
133 - $content .= $args['before_title'] . $instance['title'] . ': ' . $site_info->name . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
137 + $content .= $args['before_title'] . $instance['title'] . ': ' . esc_html( $site_info->name ) . $args['after_title'];
134 138 } else {
135 139 $content .= $args['before_title'] . esc_html( $site_info->name ) . $args['after_title'];
136 140 }
137 141
@@ -176,13 +180,13 @@
176 180 *
177 181 * @param array $args Array of Photon Parameters.
178 182 */
179 183 $image_params = apply_filters( 'jetpack_display_posts_widget_image_params', array() );
180 - $content .= '<a title="' . esc_attr( $post_title ) . '" href="' . esc_url( $single_post['url'] ) . '"' . $target . '><img src="' . Image_CDN_Core::cdn_url( $featured_image, $image_params ) . '" alt="' . esc_attr( $post_title ) . '"/></a>';
184 + $content .= '<a title="' . esc_attr( $post_title ) . '" href="' . esc_url( $single_post['url'] ) . '"' . $target . '><img src="' . esc_url( Image_CDN_Core::cdn_url( $featured_image, $image_params ) ) . '" alt="' . esc_attr( $post_title ) . '"/></a>';
181 185 }
182 186
183 187 if ( true === $instance['show_excerpts'] ) {
184 - $content .= $single_post['excerpt'];
188 + $content .= wp_kses_post( $single_post['excerpt'] );
185 189 }
186 190 }
187 191
188 192 $content .= '</div><!-- .jetpack-display-remote-posts -->';
@@ -211,14 +215,14 @@
211 215
212 216 /**
213 217 * Initialize widget configuration variables.
214 218 */
215 - $title = ( isset( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts', 'jetpack' );
216 - $url = ( isset( $instance['url'] ) ) ? $instance['url'] : '';
217 - $number_of_posts = ( isset( $instance['number_of_posts'] ) ) ? $instance['number_of_posts'] : 5;
218 - $open_in_new_window = ( isset( $instance['open_in_new_window'] ) ) ? $instance['open_in_new_window'] : false;
219 - $featured_image = ( isset( $instance['featured_image'] ) ) ? $instance['featured_image'] : false;
220 - $show_excerpts = ( isset( $instance['show_excerpts'] ) ) ? $instance['show_excerpts'] : false;
219 + $title = $instance['title'] ?? __( 'Recent Posts', 'jetpack' );
220 + $url = $instance['url'] ?? '';
221 + $number_of_posts = $instance['number_of_posts'] ?? 5;
222 + $open_in_new_window = $instance['open_in_new_window'] ?? false;
223 + $featured_image = $instance['featured_image'] ?? false;
224 + $show_excerpts = $instance['show_excerpts'] ?? false;
221 225
222 226 /**
223 227 * Check if the widget instance has errors available.
224 228 *
@@ -670,9 +674,9 @@
670 674
671 675 /**
672 676 * If no optional data is supplied, initialize a new structure
673 677 */
674 - if ( ! empty( $original_data ) ) {
678 + if ( ! empty( $original_data ) && is_array( $original_data ) ) {
675 679 $widget_data = $original_data;
676 680 } else {
677 681 $widget_data = array(
678 682 'site_info' => array(