| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 | 2 | /** |
| 3 | 3 | * Module Name: Notifications |
| 4 | - * Module Description: Receive instant notifications of site comments and likes. | |
| 4 | + * Module Description: Receive real‑time notifications about site activity across your devices. | |
| 5 | 5 | * Sort Order: 13 |
| 6 | 6 | * First Introduced: 1.9 |
| 7 | 7 | * Requires Connection: Yes |
| 8 | 8 | * Requires User Connection: Yes |
| @@ -16,8 +16,12 @@ | ||
| 16 | 16 | |
| 17 | 17 | use Automattic\Jetpack\Connection\Manager as Connection_Manager; |
| 18 | 18 | use Automattic\Jetpack\Status\Host; |
| 19 | 19 | |
| 20 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 21 | + exit( 0 ); | |
| 22 | +} | |
| 23 | + | |
| 20 | 24 | if ( ! defined( 'JETPACK_NOTES__CACHE_BUSTER' ) ) { |
| 21 | 25 | define( 'JETPACK_NOTES__CACHE_BUSTER', JETPACK__VERSION . '-' . gmdate( 'oW' ) . '-lite' ); |
| 22 | 26 | } |
| 23 | 27 | |
| @@ -191,18 +195,22 @@ | ||
| 191 | 195 | |
| 192 | 196 | $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>'; |
| 193 | 197 | |
| 194 | 198 | $title = self::get_notes_markup(); |
| 199 | + | |
| 200 | + // The default fallback is `en_US`. Remove underscore if present, noting that lang codes can be more than three chars. | |
| 201 | + $user_locale = strtolower( explode( '_', $user_locale, 2 )[0] ); | |
| 202 | + | |
| 195 | 203 | $wp_admin_bar->add_menu( |
| 196 | 204 | array( |
| 197 | 205 | 'id' => 'notes', |
| 198 | 206 | 'title' => $title, |
| 199 | 207 | '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, | |
| 208 | + 'html' => '<div id="wpnt-notes-panel2" class="intrinsic-ignore" style="display:none" lang="' . esc_attr( $user_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 | 209 | 'class' => 'menupop', |
| 202 | 210 | ), |
| 203 | 211 | 'parent' => 'top-secondary', |
| 204 | - 'href' => 'https://wordpress.com/notifications', | |
| 212 | + 'href' => 'https://wordpress.com/reader/notifications', | |
| 205 | 213 | ) |
| 206 | 214 | ); |
| 207 | 215 | } |
| 208 | 216 | |