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/contact-info.php +14 -10 13.9.216.3-a.1 View file →
@@ -4,8 +4,12 @@
4 4
5 5 use Automattic\Jetpack\Assets;
6 6 use Automattic\Jetpack\Redirect;
7 7
8 +if ( ! defined( 'ABSPATH' ) ) {
9 + exit( 0 );
10 +}
11 +
8 12 if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
9 13
10 14 /**
11 15 * Register Contact_Info_Widget widget
@@ -126,9 +130,9 @@
126 130
127 131 if ( '' !== $instance['address'] ) {
128 132
129 133 $showmap = $instance['showmap'];
130 - $goodmap = isset( $instance['goodmap'] ) ? $instance['goodmap'] : $this->has_good_map( $instance );
134 + $goodmap = $instance['goodmap'] ?? $this->has_good_map( $instance );
131 135
132 136 if ( $showmap && true === $goodmap ) {
133 137 /**
134 138 * Set a Google Maps API Key.
@@ -155,16 +159,15 @@
155 159 );
156 160 }
157 161
158 162 if ( '' !== $instance['phone'] ) {
159 - if ( wp_is_mobile() ) {
160 - echo '<div class="confit-phone"><span itemprop="telephone"><a href="' . esc_url( 'tel:' . $instance['phone'] ) . '">' . esc_html( $instance['phone'] ) . '</a></span></div>';
161 - } else {
162 - echo '<div class="confit-phone"><span itemprop="telephone">' . esc_html( $instance['phone'] ) . '</span></div>';
163 - }
163 + echo '<div class="confit-phone"><span itemprop="telephone"><a href="' . esc_url( 'tel:' . $instance['phone'] ) . '">' . esc_html( $instance['phone'] ) . '</a></span></div>';
164 164 }
165 165
166 - if ( is_email( trim( $instance['email'] ) ) ) {
166 + if (
167 + $instance['email']
168 + && is_email( trim( $instance['email'] ) )
169 + ) {
167 170 printf(
168 171 '<div class="confit-email"><a href="mailto:%1$s">%1$s</a></div>',
169 172 esc_html( $instance['email'] )
170 173 );
@@ -210,9 +213,9 @@
210 213 $instance['address'] = wp_kses( $new_instance['address'], array() );
211 214 $instance['phone'] = wp_kses( $new_instance['phone'], array() );
212 215 $instance['email'] = wp_kses( $new_instance['email'], array() );
213 216 $instance['hours'] = wp_kses( $new_instance['hours'], array() );
214 - $instance['apikey'] = wp_kses( isset( $new_instance['apikey'] ) ? $new_instance['apikey'] : $old_instance['apikey'], array() );
217 + $instance['apikey'] = wp_kses( $new_instance['apikey'] ?? $old_instance['apikey'], array() );
215 218
216 219 if ( ! isset( $new_instance['showmap'] ) ) {
217 220 $instance['showmap'] = 0;
218 221 } else {
@@ -228,9 +231,9 @@
228 231 * Displays the form for this widget on the Widgets page of the WP Admin area.
229 232 *
230 233 * @param array $instance Instance configuration.
231 234 *
232 - * @return void
235 + * @return string|void
233 236 */
234 237 public function form( $instance ) {
235 238 $instance = wp_parse_args( $instance, $this->defaults() );
236 239 /** This filter is documented in modules/widgets/contact-info.php */
@@ -487,9 +490,10 @@
487 490 if ( check_ajax_referer( 'customize_contact_info_api_key' ) && current_user_can( 'customize' ) ) {
488 491 $apikey = wp_kses( wp_unslash( $_POST['apikey'] ), array() );
489 492 $default_instance = $this->defaults();
490 493 $default_instance['apikey'] = $apikey;
491 - wp_send_json( array( 'result' => esc_html( $this->has_good_map( $default_instance ) ) ) );
494 + // @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
495 + wp_send_json( array( 'result' => esc_html( $this->has_good_map( $default_instance ) ) ), null, JSON_UNESCAPED_SLASHES );
492 496 }
493 497 } else {
494 498 wp_die();
495 499 }