PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 12.9.5
Jetpack – WP Security, Backup, Speed, & Growth v12.9.5
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
49 lines 1.8 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( 'YW' );
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 $_locale = isset( $gp_locale->slug ) ? $gp_locale->slug : '';
24
25 $likes_locale = ( '' === $_locale || 'en' === $_locale ) ? '' : '&amp;lang=' . strtolower( $_locale );
26 /** This filter is documented in projects/plugins/jetpack/modules/likes.php */
27 $new_layout = apply_filters( 'likes_new_layout', true ) ? '&amp;n=1' : '';
28 $new_layout_class = $new_layout ? 'wpl-new-layout' : '';
29
30 $src = sprintf(
31 'https://widgets.wp.com/likes/master.html?ver=%1$s#ver=%1$s%2$s%3$s',
32 $version,
33 $likes_locale,
34 $new_layout
35 );
36
37 if ( $new_layout ) {
38 // The span content is replaced by queuehandler when showOtherGravatars is called.
39 $likers_text = wp_kses( '<span>%d</span>', array( 'span' => array() ) );
40 } else {
41 /* translators: The value of %d is not available at the time of output */
42 $likers_text = wp_kses( __( '<span>%d</span> bloggers like this:', 'jetpack' ), array( 'span' => array() ) );
43 }
44 ?>
45 <iframe src='<?php echo esc_url( $src ); ?>' scrolling='no' id='likes-master' name='likes-master' style='display:none;'></iframe>
46 <div id='likes-other-gravatars' class='<?php echo esc_attr( $new_layout_class ); ?>'><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 <?php
48 }
49