← All changes
|
_inc/lib/admin-pages/class.jetpack-admin-page.php
+127
-164
12.0.3
→
16.3-a.1
View file →
| @@ -4,17 +4,27 @@ | ||
| 4 | 4 | * |
| 5 | 5 | * @package automattic/jetpack |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | +use Automattic\Jetpack\Current_Plan as Jetpack_Plan; | |
| 8 | 9 | use Automattic\Jetpack\Identity_Crisis; |
| 9 | 10 | use Automattic\Jetpack\Redirect; |
| 10 | 11 | use Automattic\Jetpack\Status; |
| 12 | +use Automattic\Jetpack\Status\Host; | |
| 11 | 13 | |
| 12 | 14 | /** |
| 13 | 15 | * Shared logic between Jetpack admin pages. |
| 14 | 16 | */ |
| 15 | 17 | abstract class Jetpack_Admin_Page { |
| 18 | + | |
| 16 | 19 | /** |
| 20 | + * Determines whether or not to hide if not active. | |
| 21 | + * | |
| 22 | + * @var bool | |
| 23 | + */ | |
| 24 | + protected $dont_show_if_not_active; | |
| 25 | + | |
| 26 | + /** | |
| 17 | 27 | * Add page specific actions given the page hook. |
| 18 | 28 | * |
| 19 | 29 | * @param string $hook Hook of current page. |
| 20 | 30 | */ |
| @@ -37,15 +47,8 @@ | ||
| 37 | 47 | */ |
| 38 | 48 | abstract public function page_render(); |
| 39 | 49 | |
| 40 | 50 | /** |
| 41 | - * Should we block the page rendering because the site is in IDC? | |
| 42 | - * | |
| 43 | - * @var bool | |
| 44 | - */ | |
| 45 | - public static $block_page_rendering_for_idc; | |
| 46 | - | |
| 47 | - /** | |
| 48 | 51 | * Function called after admin_styles to load any additional needed styles. |
| 49 | 52 | * |
| 50 | 53 | * @since 4.3.0 |
| 51 | 54 | */ |
| @@ -51,28 +54,8 @@ | ||
| 51 | 54 | */ |
| 52 | 55 | public function additional_styles() {} |
| 53 | 56 | |
| 54 | 57 | /** |
| 55 | - * The constructor. | |
| 56 | - */ | |
| 57 | - public function __construct() { | |
| 58 | - add_action( 'jetpack_loaded', array( $this, 'on_jetpack_loaded' ) ); | |
| 59 | - } | |
| 60 | - | |
| 61 | - /** | |
| 62 | - * Runs on Jetpack being ready to load its packages. | |
| 63 | - * | |
| 64 | - * @param Jetpack $jetpack object. | |
| 65 | - */ | |
| 66 | - public function on_jetpack_loaded( $jetpack ) { | |
| 67 | - $this->jetpack = $jetpack; | |
| 68 | - | |
| 69 | - self::$block_page_rendering_for_idc = ( | |
| 70 | - Identity_Crisis::validate_sync_error_idc_option() && ! Jetpack_Options::get_option( 'safe_mode_confirmed' ) | |
| 71 | - ); | |
| 72 | - } | |
| 73 | - | |
| 74 | - /** | |
| 75 | 58 | * Add common page actions and attach page-specific actions. |
| 76 | 59 | */ |
| 77 | 60 | public function add_actions() { |
| 78 | 61 | $is_offline_mode = ( new Status() )->is_offline_mode(); |
| @@ -95,17 +78,13 @@ | ||
| 95 | 78 | // Initialize menu item for the page in the admin. |
| 96 | 79 | $hook = $this->get_page_hook(); |
| 97 | 80 | |
| 98 | 81 | // Attach hooks common to all Jetpack admin pages based on the created hook. |
| 99 | - add_action( "load-$hook", array( $this, 'admin_help' ) ); | |
| 100 | 82 | add_action( "load-$hook", array( $this, 'admin_page_load' ) ); |
| 101 | 83 | add_action( "admin_print_styles-$hook", array( $this, 'admin_styles' ) ); |
| 102 | 84 | add_action( "admin_print_scripts-$hook", array( $this, 'admin_scripts' ) ); |
| 85 | + add_action( "admin_print_styles-$hook", array( $this, 'additional_styles' ) ); | |
| 103 | 86 | |
| 104 | - if ( ! self::$block_page_rendering_for_idc ) { | |
| 105 | - add_action( "admin_print_styles-$hook", array( $this, 'additional_styles' ) ); | |
| 106 | - } | |
| 107 | - | |
| 108 | 87 | // Check if the site plan changed and deactivate modules accordingly. |
| 109 | 88 | add_action( 'current_screen', array( $this, 'check_plan_deactivate_modules' ) ); |
| 110 | 89 | |
| 111 | 90 | // Attach page specific actions in addition to the above. |
| @@ -110,40 +89,21 @@ | ||
| 110 | 89 | |
| 111 | 90 | // Attach page specific actions in addition to the above. |
| 112 | 91 | $this->add_page_actions( $hook ); |
| 113 | 92 | |
| 114 | - // If the current user can connect Jetpack, Jetpack isn't connected, and is not in offline mode, let's prompt! | |
| 115 | - if ( current_user_can( 'jetpack_connect' ) && $connectable ) { | |
| 116 | - $this->add_connection_banner_actions(); | |
| 117 | - } | |
| 93 | + // Override the page title for the module list page and the debugger page. | |
| 94 | + add_action( 'current_screen', array( __CLASS__, 'override_page_title' ) ); | |
| 118 | 95 | } |
| 119 | 96 | |
| 120 | 97 | /** |
| 121 | - * Hooks to add when Jetpack is not active or in offline mode for an user capable of connecting. | |
| 122 | - */ | |
| 123 | - private function add_connection_banner_actions() { | |
| 124 | - global $pagenow; | |
| 125 | - // If someone just activated Jetpack, let's show them a fullscreen connection banner. | |
| 126 | - if ( ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && 'jetpack' === $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 127 | - add_action( 'admin_enqueue_scripts', array( 'Jetpack_Connection_Banner', 'enqueue_banner_scripts' ) ); | |
| 128 | - add_action( 'admin_enqueue_scripts', array( 'Jetpack_Connection_Banner', 'enqueue_connect_button_scripts' ) ); | |
| 129 | - add_action( 'admin_print_styles', array( Jetpack::init(), 'admin_banner_styles' ) ); | |
| 130 | - add_action( 'admin_notices', array( 'Jetpack_Connection_Banner', 'render_connect_prompt_full_screen' ) ); | |
| 131 | - delete_transient( 'activated_jetpack' ); | |
| 132 | - } | |
| 133 | - | |
| 134 | - // If Jetpack not yet connected, but user is viewing one of the pages with a Jetpack connection banner. | |
| 135 | - if ( ( 'index.php' === $pagenow || 'plugins.php' === $pagenow ) ) { | |
| 136 | - add_action( 'admin_enqueue_scripts', array( 'Jetpack_Connection_Banner', 'enqueue_connect_button_scripts' ) ); | |
| 137 | - } | |
| 138 | - } | |
| 139 | - | |
| 140 | - /** | |
| 141 | 98 | * Render the page with a common top and bottom part, and page specific content. |
| 142 | 99 | */ |
| 143 | 100 | public function render() { |
| 101 | + /** This action is documented in class.jetpack.php */ | |
| 102 | + do_action( 'jetpack_initialize_tracking' ); | |
| 103 | + | |
| 144 | 104 | // We're in an IDC: we need a decision made before we show the UI again. |
| 145 | - if ( self::$block_page_rendering_for_idc ) { | |
| 105 | + if ( $this->block_page_rendering_for_idc() ) { | |
| 146 | 106 | return; |
| 147 | 107 | } |
| 148 | 108 | |
| 149 | 109 | // Check if we are looking at the main dashboard. |
| @@ -150,18 +110,18 @@ | ||
| 150 | 110 | if ( isset( $_GET['page'] ) && 'jetpack' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- View logic. |
| 151 | 111 | $this->page_render(); |
| 152 | 112 | return; |
| 153 | 113 | } |
| 154 | - self::wrap_ui( array( $this, 'page_render' ) ); | |
| 155 | - } | |
| 156 | 114 | |
| 157 | - /** | |
| 158 | - * Load Help tab. | |
| 159 | - * | |
| 160 | - * @todo This may no longer be used. | |
| 161 | - */ | |
| 162 | - public function admin_help() { | |
| 163 | - $this->jetpack->admin_help(); | |
| 115 | + $args = array(); | |
| 116 | + | |
| 117 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 118 | + if ( isset( $_GET['page'] ) && 'jetpack_modules' === $_GET['page'] ) { | |
| 119 | + $args['is-wide'] = true; | |
| 120 | + $args['show-nav'] = false; | |
| 121 | + } | |
| 122 | + | |
| 123 | + self::wrap_ui( array( $this, 'page_render' ), $args ); | |
| 164 | 124 | } |
| 165 | 125 | |
| 166 | 126 | /** |
| 167 | 127 | * Call the existing admin page events. |
| @@ -166,9 +126,9 @@ | ||
| 166 | 126 | /** |
| 167 | 127 | * Call the existing admin page events. |
| 168 | 128 | */ |
| 169 | 129 | public function admin_page_load() { |
| 170 | - $this->jetpack->admin_page_load(); | |
| 130 | + Jetpack::init()->admin_page_load(); | |
| 171 | 131 | } |
| 172 | 132 | |
| 173 | 133 | /** |
| 174 | 134 | * Add page specific scripts and jetpack stats for all menu pages. |
| @@ -174,9 +134,9 @@ | ||
| 174 | 134 | * Add page specific scripts and jetpack stats for all menu pages. |
| 175 | 135 | */ |
| 176 | 136 | public function admin_scripts() { |
| 177 | 137 | $this->page_admin_scripts(); // Delegate to inheriting class. |
| 178 | - add_action( 'admin_footer', array( $this->jetpack, 'do_stats' ) ); | |
| 138 | + add_action( 'admin_footer', array( Jetpack::init(), 'do_stats' ) ); | |
| 179 | 139 | } |
| 180 | 140 | |
| 181 | 141 | /** |
| 182 | 142 | * Enqueue the Jetpack admin stylesheet. |
| @@ -183,9 +143,9 @@ | ||
| 183 | 143 | */ |
| 184 | 144 | public function admin_styles() { |
| 185 | 145 | $min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 186 | 146 | |
| 187 | - wp_enqueue_style( 'jetpack-admin', plugins_url( "css/jetpack-admin{$min}.css", JETPACK__PLUGIN_FILE ), array( 'genericons' ), JETPACK__VERSION . '-20121016' ); | |
| 147 | + wp_enqueue_style( 'jetpack-admin', plugins_url( "css/jetpack-admin{$min}.css", JETPACK__PLUGIN_FILE ), array( 'genericons', 'jetpack-connection' ), JETPACK__VERSION . '-20121016' ); | |
| 188 | 148 | wp_style_add_data( 'jetpack-admin', 'rtl', 'replace' ); |
| 189 | 149 | wp_style_add_data( 'jetpack-admin', 'suffix', $min ); |
| 190 | 150 | } |
| 191 | 151 | |
| @@ -272,75 +232,35 @@ | ||
| 272 | 232 | public static function load_wrapper_styles() { |
| 273 | 233 | $rtl = is_rtl() ? '.rtl' : ''; |
| 274 | 234 | wp_enqueue_style( 'dops-css', plugins_url( "_inc/build/admin{$rtl}.css", JETPACK__PLUGIN_FILE ), array(), JETPACK__VERSION ); |
| 275 | 235 | wp_enqueue_style( 'components-css', plugins_url( "_inc/build/style.min{$rtl}.css", JETPACK__PLUGIN_FILE ), array( 'wp-components' ), JETPACK__VERSION ); |
| 276 | - $custom_css = ' | |
| 277 | - #wpcontent { | |
| 278 | - padding-left: 0 !important; | |
| 279 | - } | |
| 280 | - #wpbody-content { | |
| 281 | - background-color: #f6f6f6; | |
| 282 | - } | |
| 283 | - | |
| 284 | - @media (max-width: 782px) { | |
| 285 | - #wpbody-content { | |
| 286 | - padding-bottom: 50px; | |
| 287 | - } | |
| 288 | - } | |
| 289 | - | |
| 290 | - #jp-plugin-container .wrap { | |
| 291 | - margin: 0 auto; | |
| 292 | - max-width:45rem; | |
| 293 | - padding: 0 1.5rem; | |
| 294 | - } | |
| 295 | - #jp-plugin-container.is-wide .wrap { | |
| 296 | - max-width: 1040px; | |
| 297 | - } | |
| 298 | - #jp-plugin-container .wrap .jetpack-wrap-container { | |
| 299 | - margin-top: 1em; | |
| 300 | - } | |
| 301 | - .wp-admin #dolly { | |
| 302 | - float: none; | |
| 303 | - position: relative; | |
| 304 | - right: 0; | |
| 305 | - left: 0; | |
| 306 | - top: 0; | |
| 307 | - padding: .625rem; | |
| 308 | - text-align: right; | |
| 309 | - background: #fff; | |
| 310 | - font-size: .75rem; | |
| 311 | - font-style: italic; | |
| 312 | - color: #87a6bc; | |
| 313 | - border-bottom: 1px #e9eff3 solid; | |
| 314 | - } | |
| 315 | - '; | |
| 316 | - wp_add_inline_style( 'dops-css', $custom_css ); | |
| 317 | 236 | } |
| 318 | 237 | |
| 319 | 238 | /** |
| 320 | 239 | * Build header, content, and footer for admin page. |
| 321 | 240 | * |
| 322 | - * @param string $callback Callback to produce the content of the page. The callback is responsible for any needed escaping. | |
| 323 | - * @param array $args Options for the wrapping. Also passed to the `jetpack_admin_pages_wrap_ui_after_callback` action. | |
| 324 | - * - is-wide: (bool) Set the "is-wide" class on the wrapper div, which increases the max width. Default false. | |
| 325 | - * - show-nav: (bool) Whether to show the navigation bar at the top of the page. Default true. | |
| 241 | + * @param callable $callback Callback to produce the content of the page. The callback is responsible for any needed escaping. | |
| 242 | + * @param array $args Options for the wrapping. Also passed to the `jetpack_admin_pages_wrap_ui_after_callback` action. | |
| 243 | + * - is-wide: (bool) Set the "is-wide" class on the wrapper div, which increases the max width. Default false. | |
| 244 | + * - show-nav: (bool) Whether to show the navigation bar at the top of the page. Default true. | |
| 326 | 245 | */ |
| 327 | 246 | public static function wrap_ui( $callback, $args = array() ) { |
| 328 | - $defaults = array( | |
| 247 | + $defaults = array( | |
| 329 | 248 | 'is-wide' => false, |
| 330 | 249 | 'show-nav' => true, |
| 331 | 250 | ); |
| 332 | - $args = wp_parse_args( $args, $defaults ); | |
| 251 | + $args = wp_parse_args( $args, $defaults ); | |
| 252 | + | |
| 253 | + // Is Jetpack not connected and not offline? | |
| 254 | + // True means that Jetpack is NOT connected and NOT in offline mode. | |
| 255 | + // If Jetpack is connected OR in offline mode, this will be false. | |
| 256 | + $connectable = ! Jetpack::is_connection_ready() && ! ( new Status() )->is_offline_mode(); | |
| 257 | + | |
| 333 | 258 | $jetpack_admin_url = admin_url( 'admin.php?page=jetpack' ); |
| 334 | - $jetpack_offline = ( new Status() )->is_offline_mode(); | |
| 335 | - $jetpack_about_url = ( Jetpack::is_connection_ready() || $jetpack_offline ) | |
| 259 | + $jetpack_about_url = ! $connectable | |
| 336 | 260 | ? admin_url( 'admin.php?page=jetpack_about' ) |
| 337 | 261 | : Redirect::get_url( 'jetpack' ); |
| 338 | 262 | |
| 339 | - $jetpack_privacy_url = ( Jetpack::is_connection_ready() || $jetpack_offline ) | |
| 340 | - ? $jetpack_admin_url . '#/privacy' | |
| 341 | - : Redirect::get_url( 'a8c-privacy' ); | |
| 342 | - | |
| 343 | 263 | ?> |
| 344 | 264 | <div id="jp-plugin-container" class=" |
| 345 | 265 | <?php |
| 346 | 266 | if ( $args['is-wide'] ) { |
| @@ -347,17 +267,43 @@ | ||
| 347 | 267 | echo 'is-wide'; } |
| 348 | 268 | ?> |
| 349 | 269 | "> |
| 350 | 270 | |
| 351 | - <div class="jp-masthead"> | |
| 271 | + <header class="jp-masthead"> | |
| 352 | 272 | <div class="jp-masthead__inside-container"> |
| 353 | - <div class="jp-masthead__logo-container"> | |
| 354 | - <a class="jp-masthead__logo-link" href="<?php echo esc_url( $jetpack_admin_url ); ?>"> | |
| 355 | - <svg class="jetpack-logo__masthead" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" height="32" viewBox="0 0 118 32"><path fill="#069e08" d="M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M15,19H7l8-16V19z M17,29V13h8L17,29z"></path><path d="M41.3,26.6c-0.5-0.7-0.9-1.4-1.3-2.1c2.3-1.4,3-2.5,3-4.6V8h-3V6h6v13.4C46,22.8,45,24.8,41.3,26.6z"></path><path d="M65,18.4c0,1.1,0.8,1.3,1.4,1.3c0.5,0,2-0.2,2.6-0.4v2.1c-0.9,0.3-2.5,0.5-3.7,0.5c-1.5,0-3.2-0.5-3.2-3.1V12H60v-2h2.1V7.1 H65V10h4v2h-4V18.4z"></path><path d="M71,10h3v1.3c1.1-0.8,1.9-1.3,3.3-1.3c2.5,0,4.5,1.8,4.5,5.6s-2.2,6.3-5.8,6.3c-0.9,0-1.3-0.1-2-0.3V28h-3V10z M76.5,12.3 c-0.8,0-1.6,0.4-2.5,1.2v5.9c0.6,0.1,0.9,0.2,1.8,0.2c2,0,3.2-1.3,3.2-3.9C79,13.4,78.1,12.3,76.5,12.3z"></path><path d="M93,22h-3v-1.5c-0.9,0.7-1.9,1.5-3.5,1.5c-1.5,0-3.1-1.1-3.1-3.2c0-2.9,2.5-3.4,4.2-3.7l2.4-0.3v-0.3c0-1.5-0.5-2.3-2-2.3 c-0.7,0-2.3,0.5-3.7,1.1L84,11c1.2-0.4,3-1,4.4-1c2.7,0,4.6,1.4,4.6,4.7L93,22z M90,16.4l-2.2,0.4c-0.7,0.1-1.4,0.5-1.4,1.6 c0,0.9,0.5,1.4,1.3,1.4s1.5-0.5,2.3-1V16.4z"></path><path d="M104.5,21.3c-1.1,0.4-2.2,0.6-3.5,0.6c-4.2,0-5.9-2.4-5.9-5.9c0-3.7,2.3-6,6.1-6c1.4,0,2.3,0.2,3.2,0.5V13 c-0.8-0.3-2-0.6-3.2-0.6c-1.7,0-3.2,0.9-3.2,3.6c0,2.9,1.5,3.8,3.3,3.8c0.9,0,1.9-0.2,3.2-0.7V21.3z"></path><path d="M110,15.2c0.2-0.3,0.2-0.8,3.8-5.2h3.7l-4.6,5.7l5,6.3h-3.7l-4.2-5.8V22h-3V6h3V15.2z"></path><path d="M58.5,21.3c-1.5,0.5-2.7,0.6-4.2,0.6c-3.6,0-5.8-1.8-5.8-6c0-3.1,1.9-5.9,5.5-5.9s4.9,2.5,4.9,4.9c0,0.8,0,1.5-0.1,2h-7.3 c0.1,2.5,1.5,2.8,3.6,2.8c1.1,0,2.2-0.3,3.4-0.7C58.5,19,58.5,21.3,58.5,21.3z M56,15c0-1.4-0.5-2.9-2-2.9c-1.4,0-2.3,1.3-2.4,2.9 C51.6,15,56,15,56,15z"></path></svg> | |
| 273 | + <div class="jp-masthead__title-container"> | |
| 274 | + <a class="jp-masthead__logo-link" href="<?php echo esc_url( admin_url( 'admin.php?page=my-jetpack#/overview' ) ); ?>"> | |
| 275 | + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" height="20" aria-label="<?php esc_attr_e( 'Jetpack logo', 'jetpack' ); ?>"><path fill="#069e08" d="M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M15,19H7l8-16V19z M17,29V13h8L17,29z"></path></svg> | |
| 356 | 276 | </a> |
| 277 | + <h2 class="jp-masthead__title"> | |
| 278 | + <?php | |
| 279 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- View logic only. | |
| 280 | + $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; | |
| 281 | + $is_offline_mode = ( new Status() )->is_offline_mode(); | |
| 282 | + $current_label = ''; | |
| 283 | + if ( 'jetpack_modules' === $page ) { | |
| 284 | + $current_label = __( 'Modules', 'jetpack' ); | |
| 285 | + } elseif ( 'jetpack_about' === $page ) { | |
| 286 | + $current_label = __( 'About', 'jetpack' ); | |
| 287 | + } elseif ( 'jetpack-debugger' === $page ) { | |
| 288 | + $current_label = __( 'Debug', 'jetpack' ); | |
| 289 | + } | |
| 290 | + ?> | |
| 291 | + <?php if ( $current_label ) : ?> | |
| 292 | + <a class="jp-masthead__title-link" href="<?php echo esc_url( admin_url( 'admin.php?page=my-jetpack#/overview' ) ); ?>">Jetpack</a><?php // "Jetpack" is a product name, do not translate. ?> | |
| 293 | + <span class="jp-masthead__title-separator" aria-hidden="true">/</span> | |
| 294 | + <?php if ( $is_offline_mode ) : ?> | |
| 295 | + <span class="jp-masthead__title-offline"><?php esc_html_e( 'Offline Mode', 'jetpack' ); ?></span> | |
| 296 | + <span class="jp-masthead__title-separator" aria-hidden="true">/</span> | |
| 297 | + <?php endif; ?> | |
| 298 | + <span class="jp-masthead__title-current"><?php echo esc_html( $current_label ); ?></span> | |
| 299 | + <?php else : ?> | |
| 300 | + Jetpack<?php // "Jetpack" is a product name, do not translate. ?> | |
| 301 | + <?php endif; ?> | |
| 302 | + </h2> | |
| 357 | 303 | </div> |
| 358 | 304 | <?php |
| 359 | - if ( $args['show-nav'] ) : | |
| 305 | + if ( $args['show-nav'] && ! ( new Host() )->is_wpcom_platform() ) : | |
| 360 | 306 | ?> |
| 361 | 307 | <div class="jp-masthead__nav"> |
| 362 | 308 | <?php |
| 363 | 309 | if ( is_network_admin() ) { |
| @@ -393,9 +339,9 @@ | ||
| 393 | 339 | <?php } ?> |
| 394 | 340 | </div> |
| 395 | 341 | <?php endif; ?> |
| 396 | 342 | </div> |
| 397 | - </div> | |
| 343 | + </header> | |
| 398 | 344 | <div class="wrap"><div id="jp-admin-notices" aria-live="polite"></div></div> |
| 399 | 345 | <!-- START OF CALLBACK --> |
| 400 | 346 | <?php |
| 401 | 347 | ob_start(); |
| @@ -421,47 +367,64 @@ | ||
| 421 | 367 | ?> |
| 422 | 368 | </div> |
| 423 | 369 | </div> |
| 424 | 370 | |
| 425 | - <div class="jp-footer"> | |
| 426 | - <div class="jp-footer__a8c-attr-container"> | |
| 427 | - <a href="<?php echo esc_url( $jetpack_about_url ); ?>"> | |
| 428 | - <svg role="img" class="jp-footer__a8c-attr" x="0" y="0" viewBox="0 0 935 38.2" enable-background="new 0 0 935 38.2" aria-labelledby="a8c-svg-title"><title id="a8c-svg-title">An Automattic Airline</title><path d="M317.1 38.2c-12.6 0-20.7-9.1-20.7-18.5v-1.2c0-9.6 8.2-18.5 20.7-18.5 12.6 0 20.8 8.9 20.8 18.5v1.2C337.9 29.1 329.7 38.2 317.1 38.2zM331.2 18.6c0-6.9-5-13-14.1-13s-14 6.1-14 13v0.9c0 6.9 5 13.1 14 13.1s14.1-6.2 14.1-13.1V18.6zM175 36.8l-4.7-8.8h-20.9l-4.5 8.8h-7L157 1.3h5.5L182 36.8H175zM159.7 8.2L152 23.1h15.7L159.7 8.2zM212.4 38.2c-12.7 0-18.7-6.9-18.7-16.2V1.3h6.6v20.9c0 6.6 4.3 10.5 12.5 10.5 8.4 0 11.9-3.9 11.9-10.5V1.3h6.7V22C231.4 30.8 225.8 38.2 212.4 38.2zM268.6 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H268.6zM397.3 36.8V8.7l-1.8 3.1 -14.9 25h-3.3l-14.7-25 -1.8-3.1v28.1h-6.5V1.3h9.2l14 24.4 1.7 3 1.7-3 13.9-24.4h9.1v35.5H397.3zM454.4 36.8l-4.7-8.8h-20.9l-4.5 8.8h-7l19.2-35.5h5.5l19.5 35.5H454.4zM439.1 8.2l-7.7 14.9h15.7L439.1 8.2zM488.4 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H488.4zM537.3 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H537.3zM569.3 36.8V4.6c2.7 0 3.7-1.4 3.7-3.4h2.8v35.5L569.3 36.8 569.3 36.8zM628 11.3c-3.2-2.9-7.9-5.7-14.2-5.7 -9.5 0-14.8 6.5-14.8 13.3v0.7c0 6.7 5.4 13 15.3 13 5.9 0 10.8-2.8 13.9-5.7l4 4.2c-3.9 3.8-10.5 7.1-18.3 7.1 -13.4 0-21.6-8.7-21.6-18.3v-1.2c0-9.6 8.9-18.7 21.9-18.7 7.5 0 14.3 3.1 18 7.1L628 11.3zM321.5 12.4c1.2 0.8 1.5 2.4 0.8 3.6l-6.1 9.4c-0.8 1.2-2.4 1.6-3.6 0.8l0 0c-1.2-0.8-1.5-2.4-0.8-3.6l6.1-9.4C318.7 11.9 320.3 11.6 321.5 12.4L321.5 12.4z"></path><path d="M37.5 36.7l-4.7-8.9H11.7l-4.6 8.9H0L19.4 0.8H25l19.7 35.9H37.5zM22 7.8l-7.8 15.1h15.9L22 7.8zM82.8 36.7l-23.3-24 -2.3-2.5v26.6h-6.7v-36H57l22.6 24 2.3 2.6V0.8h6.7v35.9H82.8z"></path><path d="M719.9 37l-4.8-8.9H694l-4.6 8.9h-7.1l19.5-36h5.6l19.8 36H719.9zM704.4 8l-7.8 15.1h15.9L704.4 8zM733 37V1h6.8v36H733zM781 37c-1.8 0-2.6-2.5-2.9-5.8l-0.2-3.7c-0.2-3.6-1.7-5.1-8.4-5.1h-12.8V37H750V1h19.6c10.8 0 15.7 4.3 15.7 9.9 0 3.9-2 7.7-9 9 7 0.5 8.5 3.7 8.6 7.9l0.1 3c0.1 2.5 0.5 4.3 2.2 6.1V37H781zM778.5 11.8c0-2.6-2.1-5.1-7.9-5.1h-13.8v10.8h14.4c5 0 7.3-2.4 7.3-5.2V11.8zM794.8 37V1h6.8v30.4h28.2V37H794.8zM836.7 37V1h6.8v36H836.7zM886.2 37l-23.4-24.1 -2.3-2.5V37h-6.8V1h6.5l22.7 24.1 2.3 2.6V1h6.8v36H886.2zM902.3 37V1H935v5.6h-26v9.2h20v5.5h-20v10.1h26V37H902.3z"></path></svg> | |
| 371 | + <div class="jp-footer jp-footer--static"> | |
| 372 | + <div class="jp-footer__container"> | |
| 373 | + <div class="jp-footer__logo"> | |
| 374 | + <svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 32 32" class="jetpack-logo jp-footer__jetpack-symbol" aria-labelledby="jetpack-logo-title" height="16" aria-label="<?php esc_html_e( 'Jetpack logo', 'jetpack' ); ?>"> | |
| 375 | + <desc id="jetpack-logo-title"> | |
| 376 | + <?php esc_html_e( 'Jetpack Logo', 'jetpack' ); ?> | |
| 377 | + </desc> | |
| 378 | + <path fill="#000" d="M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M15,19H7l8-16V19z M17,29V13h8L17,29z"></path> | |
| 379 | + </svg> | |
| 380 | + <span class="jp-footer__module-name"><?php esc_html_e( 'Jetpack', 'jetpack' ); ?></span> | |
| 381 | + </div> | |
| 382 | + <?php if ( ! ( new Host() )->is_wpcom_platform() ) : ?> | |
| 383 | + <div class="jp-footer__menu"> | |
| 384 | + <a href="<?php echo esc_url( admin_url( 'admin.php?page=my-jetpack#/products' ) ); ?>" class="jp-footer__menu-item"><?php echo esc_html_x( 'Products', 'Navigation item', 'jetpack' ); ?></a> | |
| 385 | + <a href="<?php echo esc_url( admin_url( 'admin.php?page=my-jetpack#/help' ) ); ?>" class="jp-footer__menu-item"><?php echo esc_html_x( 'Help', 'Navigation item', 'jetpack' ); ?></a> | |
| 386 | + </div> | |
| 387 | + <?php endif; ?> | |
| 388 | + <a class="jp-footer__a8c-logo" href="<?php echo esc_url( $jetpack_about_url ); ?>" aria-label="<?php echo esc_attr__( 'An Automattic Airline', 'jetpack' ); ?>"> | |
| 389 | + <svg role="img" x="0" y="0" viewBox="0 0 935 38.2" enable-background="new 0 0 935 38.2" aria-labelledby="jp-automattic-byline-logo-title" height="7" class="jp-automattic-byline-logo"> | |
| 390 | + <desc id="jp-automattic-byline-logo-title"> | |
| 391 | + <?php echo esc_attr__( 'An Automattic Airline', 'jetpack' ); ?> | |
| 392 | + </desc> | |
| 393 | + <path d="M317.1 38.2c-12.6 0-20.7-9.1-20.7-18.5v-1.2c0-9.6 8.2-18.5 20.7-18.5 12.6 0 20.8 8.9 20.8 18.5v1.2C337.9 29.1 329.7 38.2 317.1 38.2zM331.2 18.6c0-6.9-5-13-14.1-13s-14 6.1-14 13v0.9c0 6.9 5 13.1 14 13.1s14.1-6.2 14.1-13.1V18.6zM175 36.8l-4.7-8.8h-20.9l-4.5 8.8h-7L157 1.3h5.5L182 36.8H175zM159.7 8.2L152 23.1h15.7L159.7 8.2zM212.4 38.2c-12.7 0-18.7-6.9-18.7-16.2V1.3h6.6v20.9c0 6.6 4.3 10.5 12.5 10.5 8.4 0 11.9-3.9 11.9-10.5V1.3h6.7V22C231.4 30.8 225.8 38.2 212.4 38.2zM268.6 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H268.6zM397.3 36.8V8.7l-1.8 3.1 -14.9 25h-3.3l-14.7-25 -1.8-3.1v28.1h-6.5V1.3h9.2l14 24.4 1.7 3 1.7-3 13.9-24.4h9.1v35.5H397.3zM454.4 36.8l-4.7-8.8h-20.9l-4.5 8.8h-7l19.2-35.5h5.5l19.5 35.5H454.4zM439.1 8.2l-7.7 14.9h15.7L439.1 8.2zM488.4 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H488.4zM537.3 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H537.3zM569.3 36.8V4.6c2.7 0 3.7-1.4 3.7-3.4h2.8v35.5L569.3 36.8 569.3 36.8zM628 11.3c-3.2-2.9-7.9-5.7-14.2-5.7 -9.5 0-14.8 6.5-14.8 13.3v0.7c0 6.7 5.4 13 15.3 13 5.9 0 10.8-2.8 13.9-5.7l4 4.2c-3.9 3.8-10.5 7.1-18.3 7.1 -13.4 0-21.6-8.7-21.6-18.3v-1.2c0-9.6 8.9-18.7 21.9-18.7 7.5 0 14.3 3.1 18 7.1L628 11.3zM321.5 12.4c1.2 0.8 1.5 2.4 0.8 3.6l-6.1 9.4c-0.8 1.2-2.4 1.6-3.6 0.8l0 0c-1.2-0.8-1.5-2.4-0.8-3.6l6.1-9.4C318.7 11.9 320.3 11.6 321.5 12.4L321.5 12.4z"></path><path d="M37.5 36.7l-4.7-8.9H11.7l-4.6 8.9H0L19.4 0.8H25l19.7 35.9H37.5zM22 7.8l-7.8 15.1h15.9L22 7.8zM82.8 36.7l-23.3-24 -2.3-2.5v26.6h-6.7v-36H57l22.6 24 2.3 2.6V0.8h6.7v35.9H82.8z"></path><path d="M719.9 37l-4.8-8.9H694l-4.6 8.9h-7.1l19.5-36h5.6l19.8 36H719.9zM704.4 8l-7.8 15.1h15.9L704.4 8zM733 37V1h6.8v36H733zM781 37c-1.8 0-2.6-2.5-2.9-5.8l-0.2-3.7c-0.2-3.6-1.7-5.1-8.4-5.1h-12.8V37H750V1h19.6c10.8 0 15.7 4.3 15.7 9.9 0 3.9-2 7.7-9 9 7 0.5 8.5 3.7 8.6 7.9l0.1 3c0.1 2.5 0.5 4.3 2.2 6.1V37H781zM778.5 11.8c0-2.6-2.1-5.1-7.9-5.1h-13.8v10.8h14.4c5 0 7.3-2.4 7.3-5.2V11.8zM794.8 37V1h6.8v30.4h28.2V37H794.8zM836.7 37V1h6.8v36H836.7zM886.2 37l-23.4-24.1 -2.3-2.5V37h-6.8V1h6.5l22.7 24.1 2.3 2.6V1h6.8v36H886.2zM902.3 37V1H935v5.6h-26v9.2h20v5.5h-20v10.1h26V37H902.3z"></path> | |
| 394 | + </svg> | |
| 429 | 395 | </a> |
| 430 | 396 | </div> |
| 431 | - <ul class="jp-footer__links"> | |
| 432 | - <li class="jp-footer__link-item"> | |
| 433 | - <a href="<?php echo esc_url( Redirect::get_url( 'jetpack' ) ); ?>" target="_blank" rel="noopener noreferrer" class="jp-footer__link" title="<?php esc_html_e( 'Jetpack version', 'jetpack' ); ?>">Jetpack <?php echo esc_html( JETPACK__VERSION ); ?></a> | |
| 434 | - </li> | |
| 435 | - <li class="jp-footer__link-item"> | |
| 436 | - <a href="<?php echo esc_url( $jetpack_about_url ); ?>" title="<?php esc_attr__( 'About Jetpack', 'jetpack' ); ?>" class="jp-footer__link"><?php echo esc_html__( 'About', 'jetpack' ); ?></a> | |
| 437 | - </li> | |
| 438 | - <li class="jp-footer__link-item"> | |
| 439 | - <a href="<?php echo esc_url( Redirect::get_url( 'wpcom-tos' ) ); ?>" target="_blank" rel="noopener noreferrer" title="<?php esc_html__( 'WordPress.com Terms of Service', 'jetpack' ); ?>" class="jp-footer__link"><?php echo esc_html_x( 'Terms', 'Navigation item', 'jetpack' ); ?></a> | |
| 440 | - </li> | |
| 441 | - <li class="jp-footer__link-item"> | |
| 442 | - <a href="<?php echo esc_url( $jetpack_privacy_url ); ?>" rel="noopener noreferrer" title="<?php esc_html_e( "Automattic's Privacy Policy", 'jetpack' ); ?>" class="jp-footer__link"><?php echo esc_html_x( 'Privacy', 'Navigation item', 'jetpack' ); ?></a> | |
| 443 | - </li> | |
| 444 | - <?php if ( is_multisite() && current_user_can( 'jetpack_network_sites_page' ) ) { ?> | |
| 445 | - <li class="jp-footer__link-item"> | |
| 446 | - <a href="<?php echo esc_url( network_admin_url( 'admin.php?page=jetpack' ) ); ?>" title="<?php esc_html_e( "Manage your network's Jetpack Sites.", 'jetpack' ); ?>" class="jp-footer__link"><?php echo esc_html_x( 'Network Sites', 'Navigation item', 'jetpack' ); ?></a> | |
| 447 | - </li> | |
| 448 | - <?php } ?> | |
| 449 | - <?php if ( is_multisite() && current_user_can( 'jetpack_network_settings_page' ) ) { ?> | |
| 450 | - <li class="jp-footer__link-item"> | |
| 451 | - <a href="<?php echo esc_url( network_admin_url( 'admin.php?page=jetpack-settings' ) ); ?>" title="<?php esc_html_e( "Manage your network's Jetpack Sites.", 'jetpack' ); ?>" class="jp-footer__link"><?php echo esc_html_x( 'Network Settings', 'Navigation item', 'jetpack' ); ?></a> | |
| 452 | - </li> | |
| 453 | - <?php } ?> | |
| 454 | - <?php if ( current_user_can( 'manage_options' ) ) { ?> | |
| 455 | - <li class="jp-footer__link-item"> | |
| 456 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=jetpack_modules' ) ); ?>" title="<?php esc_html_e( 'Access the full list of Jetpack modules available on your site.', 'jetpack' ); ?>" class="jp-footer__link"><?php echo esc_html_x( 'Modules', 'Navigation item', 'jetpack' ); ?></a> | |
| 457 | - </li> | |
| 458 | - <li class="jp-footer__link-item"> | |
| 459 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=jetpack-debugger' ) ); ?>" title="<?php esc_html_e( "Test your site's compatibility with Jetpack.", 'jetpack' ); ?>" class="jp-footer__link"><?php echo esc_html_x( 'Debug', 'Navigation item', 'jetpack' ); ?></a> | |
| 460 | - </li> | |
| 461 | - <?php } ?> | |
| 462 | - </ul> | |
| 463 | 397 | </div> |
| 464 | 398 | </div> |
| 465 | 399 | <?php |
| 400 | + } | |
| 401 | + | |
| 402 | + /** | |
| 403 | + * Should we block the page rendering because the site is in IDC? | |
| 404 | + * | |
| 405 | + * @return bool | |
| 406 | + */ | |
| 407 | + protected function block_page_rendering_for_idc() { | |
| 408 | + return Jetpack::is_connection_ready() && Identity_Crisis::validate_sync_error_idc_option() && ! Jetpack_Options::get_option( 'safe_mode_confirmed' ); | |
| 409 | + } | |
| 410 | + | |
| 411 | + /** | |
| 412 | + * Set a page title for both the module list page and the debugger page. | |
| 413 | + * We set these here because we do not register a page title when we register them, | |
| 414 | + * so they do not appear in the admin navigation. | |
| 415 | + * | |
| 416 | + * @since 15.4 | |
| 417 | + * | |
| 418 | + * @param WP_Screen $screen The screen object. | |
| 419 | + * | |
| 420 | + * @return void | |
| 421 | + */ | |
| 422 | + public static function override_page_title( WP_Screen $screen ) { | |
| 423 | + global $title; | |
| 424 | + if ( 'admin_page_jetpack_modules' === $screen->id ) { | |
| 425 | + $title = __( 'Jetpack Settings', 'jetpack' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- we override the title global only on this page. | |
| 426 | + } elseif ( 'admin_page_jetpack-debugger' === $screen->id ) { | |
| 427 | + $title = __( 'Debugging Center', 'jetpack' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- we override the title global only on this page. | |
| 428 | + } | |
| 466 | 429 | } |
| 467 | 430 | } |