| @@ -1,10 +1,8 @@ | ||
| 1 | 1 | <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 | 2 | /** |
| 3 | - * Plugin Search Hints, aka Feature Suggestions. | |
| 3 | + * Adds the PSH functionality to Jetpack. | |
| 4 | 4 | * |
| 5 | - * @since 7.1.0 | |
| 6 | - * | |
| 7 | 5 | * @package automattic/jetpack |
| 8 | 6 | */ |
| 9 | 7 | |
| 10 | 8 | // phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- TODO: Move classes to appropriately-named class files. |
| @@ -15,9 +13,9 @@ | ||
| 15 | 13 | use Automattic\Jetpack\Tracking; |
| 16 | 14 | |
| 17 | 15 | // Disable direct access and execution. |
| 18 | 16 | if ( ! defined( 'ABSPATH' ) ) { |
| 19 | - exit( 0 ); | |
| 17 | + exit; | |
| 20 | 18 | } |
| 21 | 19 | |
| 22 | 20 | if ( |
| 23 | 21 | is_admin() && |
| @@ -239,8 +237,9 @@ | ||
| 239 | 237 | 'jetpackPluginSearch', |
| 240 | 238 | array( |
| 241 | 239 | 'nonce' => wp_create_nonce( 'wp_rest' ), |
| 242 | 240 | 'base_rest_url' => rest_url( '/jetpack/v4' ), |
| 241 | + 'poweredBy' => esc_html__( 'by Jetpack (installed)', 'jetpack' ), | |
| 243 | 242 | 'manageSettings' => esc_html__( 'Configure', 'jetpack' ), |
| 244 | 243 | 'activateModule' => esc_html__( 'Activate Module', 'jetpack' ), |
| 245 | 244 | 'getStarted' => esc_html__( 'Get started', 'jetpack' ), |
| 246 | 245 | 'activated' => esc_html__( 'Activated', 'jetpack' ), |
| @@ -312,9 +311,9 @@ | ||
| 312 | 311 | 'configure_url' => admin_url( 'admin.php?page=akismet-key-config' ), |
| 313 | 312 | ), |
| 314 | 313 | 'sharing-block' => array( |
| 315 | 314 | 'name' => esc_html__( 'Sharing buttons block', 'jetpack' ), |
| 316 | - 'search_terms' => 'share, sharing, sharing block, sharing button, social buttons, buttons, share facebook, share twitter, social share, icons, email, facebook, twitter, x, linkedin, pinterest, social media', | |
| 315 | + 'search_terms' => 'share, sharing, sharing block, sharing button, social buttons, buttons, share facebook, share twitter, social share, icons, email, facebook, twitter, x, linkedin, pinterest, pocket, social media', | |
| 317 | 316 | 'short_description' => esc_html__( 'Add sharing buttons blocks anywhere on your website to help your visitors share your content.', 'jetpack' ), |
| 318 | 317 | 'requires_connection' => false, |
| 319 | 318 | 'module' => 'sharing-block', |
| 320 | 319 | 'sort' => '13', |
| @@ -366,19 +365,8 @@ | ||
| 366 | 365 | } else { |
| 367 | 366 | $searchable_modules[] = 'sharedaddy'; |
| 368 | 367 | } |
| 369 | 368 | |
| 370 | - /* | |
| 371 | - * Only surface the SEO Tools hint when the new Jetpack SEO admin page is | |
| 372 | - * available and registered, so its CTA never points to a missing page. | |
| 373 | - */ | |
| 374 | - if ( | |
| 375 | - \Automattic\Jetpack\SEO\Initializer::is_available() | |
| 376 | - && \Automattic\Jetpack\SEO\Initializer::is_seo_surface_visible() | |
| 377 | - ) { | |
| 378 | - $searchable_modules[] = 'seo-tools'; | |
| 379 | - } | |
| 380 | - | |
| 381 | 369 | require_once JETPACK__PLUGIN_DIR . 'class.jetpack-admin.php'; |
| 382 | 370 | $tracking = new Tracking(); |
| 383 | 371 | $jetpack_modules_list = array_intersect_key( |
| 384 | 372 | array_merge( $this->get_extra_features(), Jetpack_Admin::init()->get_modules() ), |
| @@ -429,9 +417,8 @@ | ||
| 429 | 417 | esc_html_x( 'Jetpack: %s', 'Jetpack: Module Name', 'jetpack' ), |
| 430 | 418 | $jetpack_modules_list[ $matching_module ]['name'] |
| 431 | 419 | ), |
| 432 | 420 | 'short_description' => $jetpack_modules_list[ $matching_module ]['short_description'], |
| 433 | - 'author' => esc_attr__( 'Jetpack (installed)', 'jetpack' ), | |
| 434 | 421 | 'requires_connection' => (bool) $jetpack_modules_list[ $matching_module ]['requires_connection'], |
| 435 | 422 | 'slug' => self::$slug, |
| 436 | 423 | 'version' => JETPACK__VERSION, |
| 437 | 424 | 'icons' => array( |
| @@ -527,11 +514,14 @@ | ||
| 527 | 514 | case 'publicize': |
| 528 | 515 | $configure_url = Redirect::get_url( 'calypso-marketing-connections' ); |
| 529 | 516 | break; |
| 530 | 517 | case 'seo-tools': |
| 531 | - // Jetpack SEO has its own wp-admin page (the new SEO home base); | |
| 532 | - // send users there rather than the legacy Traffic page. | |
| 533 | - $configure_url = admin_url( 'admin.php?page=jetpack-seo' ); | |
| 518 | + $configure_url = Redirect::get_url( | |
| 519 | + 'calypso-marketing-traffic', | |
| 520 | + array( | |
| 521 | + 'anchor' => 'seo', | |
| 522 | + ) | |
| 523 | + ); | |
| 534 | 524 | break; |
| 535 | 525 | case 'google-analytics': |
| 536 | 526 | $configure_url = Redirect::get_url( |
| 537 | 527 | 'calypso-marketing-traffic', |
| @@ -575,9 +565,8 @@ | ||
| 575 | 565 | $links['jp_get_started'] = '<a |
| 576 | 566 | id="plugin-select-settings" |
| 577 | 567 | class="jetpack-plugin-search__primary jetpack-plugin-search__get-started button" |
| 578 | 568 | href="' . esc_url( Redirect::get_url( 'plugin-hint-learn-' . $plugin['module'] ) ) . '" |
| 579 | - target="_blank" | |
| 580 | 569 | data-module="' . esc_attr( $plugin['module'] ) . '" |
| 581 | 570 | data-track="get_started" |
| 582 | 571 | >' . esc_html__( 'Get started', 'jetpack' ) . '</a>'; |
| 583 | 572 | // Jetpack installed, active, feature not enabled; prompt to enable. |
| @@ -608,26 +597,13 @@ | ||
| 608 | 597 | data-module="' . esc_attr( $plugin['module'] ) . '" |
| 609 | 598 | data-track="configure" |
| 610 | 599 | >' . esc_html__( 'Configure', 'jetpack' ) . '</a>'; |
| 611 | 600 | // Module is active, doesn't have options to configure. |
| 612 | - } elseif ( 'seo-tools' === $plugin['module'] && Jetpack::is_module_active( $plugin['module'] ) ) { | |
| 613 | - // Jetpack SEO has its own wp-admin page; send users there (same tab) | |
| 614 | - // rather than a jetpack.com doc redirect, which isn't registered for | |
| 615 | - // this module. Reuse get_configure_url() so the destination stays in | |
| 616 | - // one place. | |
| 617 | - $links['jp_get_started'] = '<a | |
| 618 | - id="plugin-select-settings" | |
| 619 | - class="jetpack-plugin-search__primary jetpack-plugin-search__get-started button" | |
| 620 | - href="' . esc_url( $this->get_configure_url( $plugin['module'], $plugin['configure_url'] ) ) . '" | |
| 621 | - data-module="' . esc_attr( $plugin['module'] ) . '" | |
| 622 | - data-track="get_started" | |
| 623 | - >' . esc_html__( 'Get started', 'jetpack' ) . '</a>'; | |
| 624 | 601 | } elseif ( Jetpack::is_module_active( $plugin['module'] ) ) { |
| 625 | 602 | $links['jp_get_started'] = '<a |
| 626 | 603 | id="plugin-select-settings" |
| 627 | 604 | class="jetpack-plugin-search__primary jetpack-plugin-search__get-started button" |
| 628 | 605 | href="' . esc_url( Redirect::get_url( 'plugin-hint-learn-' . $plugin['module'] ) ) . '" |
| 629 | - target="_blank" | |
| 630 | 606 | data-module="' . esc_attr( $plugin['module'] ) . '" |
| 631 | 607 | data-track="get_started" |
| 632 | 608 | >' . esc_html__( 'Get started', 'jetpack' ) . '</a>'; |
| 633 | 609 | } |