jetpack-likes-master-iframe.php
2 years ago
jetpack-likes-settings.php
2 years ago
post-count-jetpack.js
4 years ago
post-count.js
4 years ago
queuehandler.js
2 years ago
style.css
2 years ago
jetpack-likes-master-iframe.php
49 lines
| 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 | $_locale = isset( $gp_locale->slug ) ? $gp_locale->slug : ''; |
| 24 | |
| 25 | $likes_locale = ( '' === $_locale || 'en' === $_locale ) ? '' : '&lang=' . strtolower( $_locale ); |
| 26 | /** This filter is documented in projects/plugins/jetpack/modules/likes.php */ |
| 27 | $new_layout = apply_filters( 'likes_new_layout', true ) ? '&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 ); ?>' 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> |
| 47 | <?php |
| 48 | } |
| 49 |