PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 15.5.1
Jetpack – WP Security, Backup, Speed, & Growth v15.5.1
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 14.1.1 14.2.2 14.3.1 14.4.2 All 500 releases
jetpack / modules / likes / jetpack-likes-master-iframe.php
jetpack-likes-master-iframe.php
50 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Jetpack likes iframe.
4 *
5 * @package jetpack
6 */
7
8 /**
9 * This function needs to get loaded after the like scripts get added to the page.
10 */
11 function jetpack_likes_master_iframe() {
12 $version = gmdate( 'Ymd' );
13
14 $_locale = get_locale();
15
16 if ( ! defined( 'JETPACK__GLOTPRESS_LOCALES_PATH' ) || ! file_exists( JETPACK__GLOTPRESS_LOCALES_PATH ) ) {
17 return false;
18 }
19
20 require_once JETPACK__GLOTPRESS_LOCALES_PATH;
21
22 $gp_locale = GP_Locales::by_field( 'wp_locale', $_locale );
23 if ( ! $gp_locale ) {
24 $gp_locale = GP_Locales::by_slug( $_locale );
25 }
26 $_locale = isset( $gp_locale->slug ) ? $gp_locale->slug : '';
27
28 $likes_locale = ( '' === $_locale || 'en' === $_locale ) ? '' : '&amp;lang=' . strtolower( $_locale );
29
30 $src = sprintf( 'https://widgets.wp.com/likes/master.html?ver=%1$s#ver=%1$s%2$s', $version, $likes_locale );
31
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() ) );
45 ?>
46 <iframe src='<?php echo esc_url( $src ); ?>' scrolling='no' id='likes-master' name='likes-master' style='display:none;'></iframe>
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>
48 <?php
49 }
50