PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 13.5
Jetpack – WP Security, Backup, Speed, & Growth v13.5
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 14.1.1 14.2.2 14.3.1 All 501 releases
← All changes | modules/notes.php +22 -8 14.2.213.5 View file →
@@ -14,9 +14,8 @@
14 14 * @package automattic/jetpack
15 15 */
16 16
17 17 use Automattic\Jetpack\Connection\Manager as Connection_Manager;
18 -use Automattic\Jetpack\Status\Host;
19 18
20 19 if ( ! defined( 'JETPACK_NOTES__CACHE_BUSTER' ) ) {
21 20 define( 'JETPACK_NOTES__CACHE_BUSTER', JETPACK__VERSION . '-' . gmdate( 'oW' ) . '-lite' );
22 21 }
@@ -110,9 +109,9 @@
110 109 return;
111 110 }
112 111 $is_rtl = is_rtl();
113 112
114 - if ( ( new Host() )->is_woa_site() ) {
113 + if ( Jetpack::is_module_active( 'masterbar' ) ) {
115 114 /**
116 115 * Can be used to force Notifications to display in RTL style.
117 116 *
118 117 * @module notes
@@ -173,9 +172,9 @@
173 172 if ( self::is_block_editor() ) {
174 173 return;
175 174 }
176 175
177 - $user_locale = get_user_locale();
176 + $wpcom_locale = get_locale();
178 177
179 178 if ( ! class_exists( 'GP_Locales' ) ) {
180 179 if ( defined( 'JETPACK__GLOTPRESS_LOCALES_PATH' ) && file_exists( JETPACK__GLOTPRESS_LOCALES_PATH ) ) {
181 180 require JETPACK__GLOTPRESS_LOCALES_PATH;
@@ -182,11 +181,11 @@
182 181 }
183 182 }
184 183
185 184 if ( class_exists( 'GP_Locales' ) ) {
186 - $jetpack_locale_object = GP_Locales::by_field( 'slug', $user_locale );
187 - if ( $jetpack_locale_object instanceof GP_Locale ) {
188 - $user_locale = $jetpack_locale_object->slug;
185 + $wpcom_locale_object = GP_Locales::by_field( 'wp_locale', $wpcom_locale );
186 + if ( $wpcom_locale_object instanceof GP_Locale ) {
187 + $wpcom_locale = $wpcom_locale_object->slug;
189 188 }
190 189 }
191 190
192 191 $third_party_cookie_check_iframe = '<span style="display:none;"><iframe class="jetpack-notes-cookie-check" src="https://widgets.wp.com/3rd-party-cookie-check/index.html"></iframe></span>';
@@ -196,9 +195,9 @@
196 195 array(
197 196 'id' => 'notes',
198 197 'title' => $title,
199 198 'meta' => array(
200 - 'html' => '<div id="wpnt-notes-panel2" class="intrinsic-ignore" style="display:none" lang="' . esc_attr( strtolower( substr( $user_locale, 0, 2 ) ) ) . '" dir="' . ( is_rtl() ? 'rtl' : 'ltr' ) . '"><div class="wpnt-notes-panel-header"><span class="wpnt-notes-header">' . __( 'Notifications', 'jetpack' ) . '</span><span class="wpnt-notes-panel-link"></span></div></div>' . $third_party_cookie_check_iframe,
199 + 'html' => '<div id="wpnt-notes-panel2" class="intrinsic-ignore" style="display:none" lang="' . esc_attr( $wpcom_locale ) . '" dir="' . ( is_rtl() ? 'rtl' : 'ltr' ) . '"><div class="wpnt-notes-panel-header"><span class="wpnt-notes-header">' . __( 'Notifications', 'jetpack' ) . '</span><span class="wpnt-notes-panel-link"></span></div></div>' . $third_party_cookie_check_iframe,
201 200 'class' => 'menupop',
202 201 ),
203 202 'parent' => 'top-secondary',
204 203 'href' => 'https://wordpress.com/notifications',
@@ -212,9 +211,9 @@
212 211 * @return string
213 212 */
214 213 private static function get_notes_markup() {
215 214 return '<span id="wpnt-notes-unread-count" class="wpnt-loading wpn-read"></span>
216 -<span class="noticon noticon-bell ab-icon"></span>
215 +<span class="noticon noticon-bell"></span>
217 216 <span class="screen-reader-text">' . esc_html__( 'Notifications', 'jetpack' ) . '</span>';
218 217 }
219 218
220 219 /**
@@ -232,8 +231,23 @@
232 231 <?php if ( $link_accounts_url ) : ?>
233 232 var wpNotesLinkAccountsURL = '<?php echo esc_url( $link_accounts_url ); ?>';
234 233 <?php endif; ?>
235 234 /* ]]> */
235 + window.addEventListener('message', function ( event ) {
236 + // Confirm that the message is from the right origin.
237 + if ('https://widgets.wp.com' !== event.origin) {
238 + return;
239 + }
240 + // Check whether 3rd Party Cookies are blocked
241 + var has3PCBlocked = 'WPCOM:3PC:blocked' === event.data;
242 +
243 + var tagerElement = document.getElementById('wp-admin-bar-notes');
244 +
245 + if ( has3PCBlocked && tagerElement ) {
246 + // Hide the notification button/icon
247 + tagerElement.style.display = 'none';
248 + }
249 + }, false );
236 250 </script>
237 251 <?php
238 252 }
239 253