| @@ -5,22 +5,26 @@ | ||
| 5 | 5 | * @since 2.1 |
| 6 | 6 | * @package elasticpress |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | +use ElasticPress\FeatureRequirementsStatus; | |
| 10 | + | |
| 9 | 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | 12 | exit; // Exit if accessed directly. |
| 11 | 13 | } |
| 12 | 14 | |
| 15 | +$install_status = \ElasticPress\Installer::factory()->get_install_status(); | |
| 16 | + | |
| 13 | 17 | if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) { |
| 14 | 18 | $setup_url = admin_url( 'network/admin.php?page=elasticpress-settings' ); |
| 15 | - $sync_url = admin_url( 'network/admin.php?page=elasticpress-sync&do_sync' ); | |
| 16 | 19 | $dashboard_url = admin_url( 'network/admin.php?page=elasticpress' ); |
| 17 | 20 | } else { |
| 18 | 21 | $setup_url = admin_url( 'admin.php?page=elasticpress-settings' ); |
| 19 | - $sync_url = admin_url( 'admin.php?page=elasticpress-sync&do_sync' ); | |
| 20 | 22 | $dashboard_url = admin_url( 'admin.php?page=elasticpress' ); |
| 21 | 23 | } |
| 22 | 24 | |
| 25 | +$sync_url = \ElasticPress\Utils\get_sync_url( 'install' ); | |
| 26 | + | |
| 23 | 27 | $skip_install_url = add_query_arg( |
| 24 | 28 | [ |
| 25 | 29 | 'ep-skip-install' => 1, |
| 26 | 30 | 'ep-skip-features' => 1, |
| @@ -63,9 +67,9 @@ | ||
| 63 | 67 | <?php esc_html_e( 'Step', 'elasticpress' ); ?><p>2</p> |
| 64 | 68 | </div> |
| 65 | 69 | <h2><?php esc_html_e( 'Set up Elasticsearch hosting', 'elasticpress' ); ?></h2> |
| 66 | 70 | <p class="ep-copy-text"> |
| 67 | - <?php echo wp_kses_post( __( 'The next step is to make sure you have a working Elasticsearch server. We recommend creating an <a href="https://elasticpress.io">ElasticPress.io</a> account or if you want you can set up your own hosting.', 'elasticpress' ) ); ?> | |
| 71 | + <?php echo wp_kses_post( __( 'The next step is to make sure you have a working Elasticsearch server. We recommend creating an <a href="https://elasticpress.io" target="_blank">ElasticPress.io</a> account or if you want you can set up your own hosting.', 'elasticpress' ) ); ?> | |
| 68 | 72 | </p> |
| 69 | 73 | <?php if ( 2 === $install_status ) : ?> |
| 70 | 74 | <div class="setup-message"> |
| 71 | 75 | <a class="setup-button" href="<?php echo esc_url( $setup_url ); ?>"><?php esc_html_e( 'Got hosting? Get Started', 'elasticpress' ); ?></a> |
| @@ -84,12 +88,12 @@ | ||
| 84 | 88 | <ul class="ep-feature-list"> |
| 85 | 89 | <?php |
| 86 | 90 | $features = \ElasticPress\Features::factory()->registered_features; |
| 87 | 91 | foreach ( $features as $feature ) { |
| 88 | - $feature_status_code = (int) $feature->requirements_status()->code; | |
| 92 | + $feature_status_code = (int) $feature->requirements_status()->get_code(); | |
| 89 | 93 | $activation_available = $feature->available_during_installation; |
| 90 | 94 | |
| 91 | - if ( 2 === $feature_status_code ) { | |
| 95 | + if ( in_array( $feature_status_code, [ FeatureRequirementsStatus::FORCE_DISABLED, FeatureRequirementsStatus::TEMPORARILY_DISABLED ], true ) ) { | |
| 92 | 96 | continue; |
| 93 | 97 | } |
| 94 | 98 | |
| 95 | 99 | if ( ! $activation_available ) { |
| @@ -95,9 +99,9 @@ | ||
| 95 | 99 | if ( ! $activation_available ) { |
| 96 | 100 | continue; |
| 97 | 101 | } |
| 98 | 102 | |
| 99 | - $should_be_checked = 0 === $feature_status_code || $feature->is_active(); | |
| 103 | + $should_be_checked = FeatureRequirementsStatus::AUTO_ENABLED === $feature_status_code || $feature->is_active(); | |
| 100 | 104 | ?> |
| 101 | 105 | <li> |
| 102 | 106 | <label> |
| 103 | 107 | <input |
| @@ -104,9 +108,9 @@ | ||
| 104 | 108 | type="checkbox" |
| 105 | 109 | name="features[]" |
| 106 | 110 | value="<?php echo esc_attr( $feature->slug ); ?>" |
| 107 | 111 | <?php checked( $should_be_checked ); ?>> |
| 108 | - <?php echo esc_html( $feature->title ); ?> | |
| 112 | + <?php echo esc_html( $feature->get_short_title() ); ?> | |
| 109 | 113 | </label> |
| 110 | 114 | <?php if ( $feature->summary ) : ?> |
| 111 | 115 | <span class="a11y-tip a11y-tip--no-delay"> |
| 112 | 116 | <a href="<?php echo esc_url( $feature->docs_url ); ?>" class="a11y-tip__trigger ep-feature-info" target="_blank" rel="noreferrer noopener"> |
| @@ -115,15 +119,15 @@ | ||
| 115 | 119 | <?php |
| 116 | 120 | printf( |
| 117 | 121 | /* translators: %s: Feature name. */ |
| 118 | 122 | esc_html__( 'Learn more about %s.', 'elasticpress' ), |
| 119 | - esc_html( $feature->title ) | |
| 123 | + esc_html( $feature->get_short_title() ) | |
| 120 | 124 | ); |
| 121 | 125 | ?> |
| 122 | 126 | </span> |
| 123 | 127 | </a> |
| 124 | 128 | <span role="tooltip" class="a11y-tip__help a11y-tip__help--top"> |
| 125 | - <?php echo esc_html( $feature->summary ); ?> | |
| 129 | + <?php echo wp_kses( $feature->summary, 'ep-html' ); ?> | |
| 126 | 130 | <?php esc_html_e( 'Click to learn more.', 'elasticpress' ); ?> |
| 127 | 131 | </span> |
| 128 | 132 | </span> |
| 129 | 133 | <?php endif; ?> |