| @@ -5,100 +5,18 @@ | ||
| 5 | 5 | * @since 2.1 |
| 6 | 6 | * @package elasticpress |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -use ElasticPress\Elasticsearch as Elasticsearch; | |
| 10 | -use ElasticPress\Features as Features; | |
| 9 | +use ElasticPress\Elasticsearch; | |
| 10 | +use ElasticPress\Features; | |
| 11 | +use ElasticPress\IndexHelper; | |
| 11 | 12 | |
| 12 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | 14 | exit; // Exit if accessed directly. |
| 14 | 15 | } |
| 15 | 16 | |
| 16 | -if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) { | |
| 17 | - $index_meta = get_site_option( 'ep_index_meta', false ); | |
| 18 | -} else { | |
| 19 | - $index_meta = get_option( 'ep_index_meta', false ); | |
| 20 | -} | |
| 17 | +$index_meta = IndexHelper::factory()->get_index_meta(); | |
| 21 | 18 | ?> |
| 22 | 19 | |
| 23 | 20 | <?php require_once __DIR__ . '/header.php'; ?> |
| 24 | 21 | |
| 25 | -<div class="error-overlay <?php if ( ! empty( $index_meta ) ) : ?>syncing<?php endif; ?> <?php if ( ! Elasticsearch::factory()->get_elasticsearch_version() ) : ?>cant-connect<?php endif; ?>"></div> | |
| 26 | -<div class="wrap"> | |
| 27 | - <h2 class="ep-list-features"><?php esc_html_e( 'List of features', 'elasticpress' ); // We use this since WP inserts warnings after the first h2. This will be hidden. ?></h2> | |
| 28 | - <div class="ep-features metabox-holder"> | |
| 29 | - <?php | |
| 30 | - $features = Features::factory()->registered_features; | |
| 31 | - uasort( | |
| 32 | - $features, | |
| 33 | - function( $feature_a, $feature_b ) { | |
| 34 | - $order_feature_a = (int) $feature_a->order; | |
| 35 | - $order_feature_b = (int) $feature_b->order; | |
| 36 | - | |
| 37 | - if ( $order_feature_a === $order_feature_b ) { | |
| 38 | - return 0; | |
| 39 | - } | |
| 40 | - | |
| 41 | - return $order_feature_a < $order_feature_b ? -1 : 1; | |
| 42 | - } | |
| 43 | - ); | |
| 44 | - ?> | |
| 45 | - | |
| 46 | - <?php | |
| 47 | - $left = ''; | |
| 48 | - $right = ''; | |
| 49 | - $i = 0; | |
| 50 | - foreach ( $features as $feature ) : | |
| 51 | - $i++; | |
| 52 | - $requirements_status = $feature->requirements_status(); | |
| 53 | - $active = $feature->is_active(); | |
| 54 | - | |
| 55 | - $feature_classes = 'feature-requirements-status-' . (int) $requirements_status->code; | |
| 56 | - | |
| 57 | - if ( ! empty( $active ) ) { | |
| 58 | - $feature_classes .= ' feature-active'; | |
| 59 | - } | |
| 60 | - | |
| 61 | - if ( ! empty( $index_meta ) && ! empty( $index_meta['feature_sync'] ) && $feature->slug === $index_meta['feature_sync'] ) { | |
| 62 | - $feature_classes .= ' feature-syncing'; | |
| 63 | - } | |
| 64 | - | |
| 65 | - ob_start(); | |
| 66 | - ?> | |
| 67 | - <div class="<?php if ( $feature->requires_install_reindex && defined( 'EP_DASHBOARD_SYNC' ) && ! EP_DASHBOARD_SYNC ) : ?>dash-sync-disabled<?php endif; ?> ep-feature ep-feature-<?php echo esc_attr( $feature->slug ); ?> <?php echo esc_attr( $feature_classes ); ?>"> | |
| 68 | - <div class="postbox"> | |
| 69 | - <h2 class="hndle"> | |
| 70 | - <span><?php echo esc_html( $feature->title ); ?></span> | |
| 71 | - <button aria-expanded="false" type="button" class="settings-button"><?php esc_html_e( 'settings', 'elasticpress' ); ?></button> | |
| 72 | - </h2> | |
| 73 | - | |
| 74 | - <div class="description inside"> | |
| 75 | - | |
| 76 | - <?php $feature->output_feature_box(); ?> | |
| 77 | - | |
| 78 | - </div> | |
| 79 | - | |
| 80 | - <div class="settings inside"> | |
| 81 | - <?php $feature->output_settings_box(); ?> | |
| 82 | - </div> | |
| 83 | - </div> | |
| 84 | - </div> | |
| 85 | - <?php | |
| 86 | - if ( 'right' === $feature->group_order || 'left' === $feature->group_order ) { | |
| 87 | - ${$feature->group_order} .= ob_get_clean(); | |
| 88 | - } else { | |
| 89 | - if ( 0 === $i % 2 ) { | |
| 90 | - $right .= ob_get_clean(); | |
| 91 | - } else { | |
| 92 | - $left .= ob_get_clean(); | |
| 93 | - } | |
| 94 | - } | |
| 95 | - ?> | |
| 96 | - <?php endforeach; ?> | |
| 97 | - <div class="left"> | |
| 98 | - <?php echo wp_kses( $left, 'ep-html' ); ?> | |
| 99 | - </div> | |
| 100 | - <div class="right"> | |
| 101 | - <?php echo wp_kses( $right, 'ep-html' ); ?> | |
| 102 | - </div> | |
| 103 | - </div> | |
| 104 | -</div> | |
| 22 | +<div id="ep-dashboard" class="wrap"></div> | |