| @@ -5,23 +5,19 @@ | ||
| 5 | 5 | * @since 2.1 |
| 6 | 6 | * @package elasticpress |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -use ElasticPress\Utils as Utils; | |
| 10 | -use ElasticPress\Elasticsearch as Elasticsearch; | |
| 9 | +use ElasticPress\Dashboard; | |
| 10 | +use ElasticPress\Elasticsearch; | |
| 11 | +use ElasticPress\IndexHelper; | |
| 12 | +use ElasticPress\Utils; | |
| 11 | 13 | |
| 12 | 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | 15 | exit; // Exit if accessed directly. |
| 14 | 16 | } |
| 15 | 17 | |
| 16 | -$action = 'options.php'; | |
| 18 | +$index_meta = IndexHelper::factory()->get_index_meta(); | |
| 17 | 19 | |
| 18 | -$index_meta = Utils\get_option( 'ep_index_meta', [] ); | |
| 19 | - | |
| 20 | -if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) { | |
| 21 | - $action = ''; | |
| 22 | -} | |
| 23 | - | |
| 24 | 20 | $version = Elasticsearch::factory()->get_elasticsearch_version(); |
| 25 | 21 | |
| 26 | 22 | $host = Utils\get_host(); |
| 27 | 23 | $is_epio = Utils\is_epio(); |
| @@ -36,11 +32,10 @@ | ||
| 36 | 32 | <div class="error-overlay <?php if ( ! empty( $index_meta ) ) : ?>syncing<?php endif; ?>"></div> |
| 37 | 33 | <div class="wrap"> |
| 38 | 34 | <h1><?php esc_html_e( 'Settings', 'elasticpress' ); ?></h1> |
| 39 | 35 | |
| 40 | - <form action="<?php echo esc_url( $action ); ?>" method="post" class="ep-settings"> | |
| 41 | - <?php settings_fields( 'elasticpress' ); ?> | |
| 42 | - <?php settings_errors(); ?> | |
| 36 | + <form action="" method="post" class="ep-settings"> | |
| 37 | + <?php wp_nonce_field( 'elasticpress_settings', 'ep_settings_nonce' ); ?> | |
| 43 | 38 | |
| 44 | 39 | <div class="ep-credentials"> |
| 45 | 40 | <?php if ( ! $wpconfig ) : ?> |
| 46 | 41 | <h2 class="nav-tab-wrapper ep-credentials-tabs"> |
| @@ -138,14 +133,14 @@ | ||
| 138 | 133 | * @return {boolean} New value |
| 139 | 134 | */ |
| 140 | 135 | if ( apply_filters( 'ep_admin_show_credentials', true ) ) : |
| 141 | 136 | ?> |
| 142 | - <input <?php if ( defined( 'EP_CREDENTIALS' ) && EP_CREDENTIALS ) : ?>disabled<?php endif; ?> type="text" value="<?php echo esc_attr( $credentials['token'] ); ?>" name="ep_credentials[token]" id="ep_token"> | |
| 137 | + <input <?php if ( defined( 'EP_CREDENTIALS' ) && EP_CREDENTIALS ) : ?>disabled<?php endif; ?> type="password" value="" autocomplete="off" placeholder="<?php echo esc_attr( $credentials['token'] ? '••••••••' : '' ); ?>" name="ep_credentials[token]" id="ep_token"> | |
| 143 | 138 | <?php endif ?> |
| 144 | 139 | <?php if ( defined( 'EP_CREDENTIALS' ) && EP_CREDENTIALS ) : ?> |
| 145 | - <p class="description"><?php esc_html_e( 'Your Subscription Token is set in wp-config.php', 'elasticpress' ); ?></p> | |
| 140 | + <p class="description"><?php esc_html_e( 'Your subscription token is defined in wp-config.php and is hidden for security.', 'elasticpress' ); ?></p> | |
| 146 | 141 | <?php else : ?> |
| 147 | - <p class="description"><?php esc_html_e( 'Plug in your subscription token here.', 'elasticpress' ); ?></p> | |
| 142 | + <p class="description"><?php esc_html_e( 'Your subscription token is saved and is hidden for security. Enter a new value to update it.', 'elasticpress' ); ?></p> | |
| 148 | 143 | <?php endif; ?> |
| 149 | 144 | </td> |
| 150 | 145 | </tr> |
| 151 | 146 | <?php endif; ?> |
| @@ -166,11 +161,15 @@ | ||
| 166 | 161 | $ep_language = Utils\get_language(); |
| 167 | 162 | |
| 168 | 163 | wp_dropdown_languages( |
| 169 | 164 | [ |
| 170 | - 'id' => 'ep_language', | |
| 171 | - 'name' => 'ep_language', | |
| 172 | - 'selected' => $ep_language, | |
| 165 | + 'id' => 'ep_language', | |
| 166 | + 'name' => 'ep_language', | |
| 167 | + 'selected' => $ep_language, | |
| 168 | + 'languages' => Dashboard\get_available_languages( 'locales' ), | |
| 169 | + 'show_option_site_default' => true, | |
| 170 | + 'explicit_option_en_us' => true, | |
| 171 | + 'show_available_translations' => false, | |
| 173 | 172 | ] |
| 174 | 173 | ); |
| 175 | 174 | ?> |
| 176 | 175 | <p class="description"><?php esc_html_e( 'Default language for your Elasticsearch mapping.', 'elasticpress' ); ?></p> |