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/likes/jetpack-likes-master-iframe.php +20 -10 12.7.316.3-a.1 View file →
@@ -8,9 +8,9 @@
8 8 /**
9 9 * This function needs to get loaded after the like scripts get added to the page.
10 10 */
11 11 function jetpack_likes_master_iframe() {
12 - $version = gmdate( 'YW' );
12 + $version = gmdate( 'Ymd' );
13 13
14 14 $_locale = get_locale();
15 15
16 16 if ( ! defined( 'JETPACK__GLOTPRESS_LOCALES_PATH' ) || ! file_exists( JETPACK__GLOTPRESS_LOCALES_PATH ) ) {
@@ -19,21 +19,31 @@
19 19
20 20 require_once JETPACK__GLOTPRESS_LOCALES_PATH;
21 21
22 22 $gp_locale = GP_Locales::by_field( 'wp_locale', $_locale );
23 - $_locale = isset( $gp_locale->slug ) ? $gp_locale->slug : '';
23 + if ( ! $gp_locale ) {
24 + $gp_locale = GP_Locales::by_slug( $_locale );
25 + }
26 + $_locale = $gp_locale->slug ?? '';
24 27
25 28 $likes_locale = ( '' === $_locale || 'en' === $_locale ) ? '' : '&lang=' . strtolower( $_locale );
26 29
27 - $src = sprintf(
28 - 'https://widgets.wp.com/likes/master.html?ver=%1$s#ver=%1$s%2$s',
29 - $version,
30 - $likes_locale
31 - );
30 + $src = sprintf( 'https://widgets.wp.com/likes/master.html?ver=%1$s#ver=%1$s%2$s', $version, $likes_locale );
32 31
33 - /* translators: The value of %d is not available at the time of output */
34 - $likers_text = wp_kses( __( '<span>%d</span> bloggers like this:', 'jetpack' ), array( 'span' => array() ) );
32 + /**
33 + * Filters the Likes iframe src, if any parameters need to be overridden or tracked.
34 + *
35 + * @module likes
36 + *
37 + * @since 14.1
38 + *
39 + * @param string URL to https://widgets.wp.com/ with various arguments appended to the get string and fragment.
40 + */
41 + $src = apply_filters( 'jetpack_likes_iframe_src', $src );
42 +
43 + // The span content is replaced by queuehandler when showOtherGravatars is called.
44 + $likers_text = wp_kses( '<span>%d</span>', array( 'span' => array() ) );
35 45 ?>
36 46 <iframe src='<?php echo esc_url( $src ); ?>' scrolling='no' id='likes-master' name='likes-master' style='display:none;'></iframe>
37 - <div id='likes-other-gravatars'><div class="likes-text"><?php echo $likers_text; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div><ul class="wpl-avatars sd-like-gravatars"></ul></div>
47 + <div id='likes-other-gravatars' role="dialog" aria-hidden="true" tabindex="-1"><div class="likes-text"><?php echo $likers_text; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div><ul class="wpl-avatars sd-like-gravatars"></ul></div>
38 48 <?php
39 49 }