| @@ -1316,10 +1316,13 @@ | ||
| 1316 | 1316 | */ |
| 1317 | 1317 | do_action( 'mainwp_after_header', $websites ); |
| 1318 | 1318 | $after_header_content = ob_get_clean(); |
| 1319 | 1319 | if ( ! empty( trim( $after_header_content ) ) ) { |
| 1320 | + $has_extension_update_failure_notice = false !== strpos( $after_header_content, 'mainwp-extension-update-failure-notice' ); | |
| 1321 | + $admin_notices_style = $has_extension_update_failure_notice ? 'padding-bottom:0 !important;' : ''; | |
| 1322 | + $admin_notices_class = $has_extension_update_failure_notice ? ' mainwp-extension-update-failure-notice-segment' : ''; | |
| 1320 | 1323 | ?> |
| 1321 | - <div class="ui padded segment" id="mainwp-admin-notices-segment"> | |
| 1324 | + <div class="ui padded segment<?php echo esc_attr( $admin_notices_class ); ?>" id="mainwp-admin-notices-segment" style="<?php echo esc_attr( $admin_notices_style ); ?>"> | |
| 1322 | 1325 | <?php echo $after_header_content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 1323 | 1326 | </div> |
| 1324 | 1327 | <?php |
| 1325 | 1328 | } |
| @@ -1531,9 +1534,24 @@ | ||
| 1531 | 1534 | $sidebar_pages = apply_filters( 'mainwp_sidebar_pages', $sidebar_pages ); |
| 1532 | 1535 | $current_user = get_current_user_id(); |
| 1533 | 1536 | $custom_theme = MainWP_Settings::get_instance()->get_current_user_theme(); |
| 1534 | 1537 | $screen = get_current_screen(); |
| 1538 | + $show_command_palette_trigger = wp_script_is( 'wp-core-commands', 'enqueued' ); | |
| 1539 | + $command_palette_shortcut = ''; | |
| 1540 | + $command_palette_label = ''; | |
| 1535 | 1541 | |
| 1542 | + if ( $show_command_palette_trigger ) { | |
| 1543 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Used only to mirror WordPress core shortcut labels. | |
| 1544 | + $is_apple_os = (bool) preg_match( '/Macintosh|Mac OS X|Mac_PowerPC/i', $_SERVER['HTTP_USER_AGENT'] ?? '' ); | |
| 1545 | + | |
| 1546 | + $command_palette_shortcut = $is_apple_os | |
| 1547 | + ? _x( '⌘K', 'keyboard shortcut to open the command palette', 'mainwp' ) | |
| 1548 | + : _x( 'Ctrl+K', 'keyboard shortcut to open the command palette', 'mainwp' ); | |
| 1549 | + | |
| 1550 | + /* translators: %s: Keyboard shortcut label. */ | |
| 1551 | + $command_palette_label = sprintf( esc_attr__( 'Open command palette (%s)', 'mainwp' ), $command_palette_shortcut ); | |
| 1552 | + } | |
| 1553 | + | |
| 1536 | 1554 | if ( false === $custom_theme ) { |
| 1537 | 1555 | $compat_theme = null; |
| 1538 | 1556 | // to compatible with Custom Dashboard extension settings. |
| 1539 | 1557 | $compat_settings = get_option( 'mainwp_custom_dashboard_settings' ); |
| @@ -1571,8 +1589,17 @@ | ||
| 1571 | 1589 | $website = MainWP_DB::instance()->get_website_by_id( $id ); |
| 1572 | 1590 | } |
| 1573 | 1591 | } |
| 1574 | 1592 | ob_start(); |
| 1593 | + if ( $show_command_palette_trigger ) : | |
| 1594 | + ?> | |
| 1595 | + <span id="mainwp-header-command-palette-actions" class="mainwp-768-hide"> | |
| 1596 | + <a href="#" class="ui button hide-if-no-js" id="mainwp-command-palette-trigger" data-tooltip="<?php echo esc_attr( $command_palette_label ); ?>" data-inverted="" data-position="left center" aria-label="<?php echo esc_attr( $command_palette_label ); ?>" onclick='if ( window.wp && wp.data && wp.data.dispatch ) { wp.data.dispatch( "core/commands" ).open(); } return false;'> | |
| 1597 | + <kbd><?php echo esc_html( $command_palette_shortcut ); ?></kbd> | |
| 1598 | + </a> | |
| 1599 | + </span> | |
| 1600 | + <?php | |
| 1601 | + endif; | |
| 1575 | 1602 | if ( $website ) : |
| 1576 | 1603 | ?> |
| 1577 | 1604 | <?php if ( $id && $website && '' !== $website->sync_errors ) : ?> |
| 1578 | 1605 | <a href="#" class="mainwp-updates-overview-reconnect-site ui green button" adminuser="<?php echo esc_attr( $website->adminname ); ?>" siteid="<?php echo intval( $website->id ); ?>" data-position="bottom right" aria-label="Reconnect <?php echo esc_html( stripslashes( $website->name ) ); ?>" data-tooltip="Reconnect <?php echo esc_html( stripslashes( $website->name ) ); ?>" data-inverted=""><i class="undo alternate icon"></i> <?php echo esc_html__( 'Reconnect', 'mainwp' ); ?></a> |