diff --git a/includes/admin/class-algolia-admin-page-settings.php b/includes/admin/class-algolia-admin-page-settings.php index 1f5d63aa..600fb36d 100644 --- a/includes/admin/class-algolia-admin-page-settings.php +++ b/includes/admin/class-algolia-admin-page-settings.php @@ -180,6 +180,9 @@ public function powered_by_enabled_callback() { } public function sanitize_application_id( $value ) { + if ( $this->plugin->get_settings()->is_application_id_in_config() ) { + $value = $this->plugin->get_settings()->get_application_id(); + } $value = sanitize_text_field( $value ); if ( empty( $value ) ) { @@ -195,6 +198,9 @@ public function sanitize_application_id( $value ) { } public function sanitize_search_api_key( $value ) { + if ( $this->plugin->get_settings()->is_search_api_key_in_config() ) { + $value = $this->plugin->get_settings()->get_search_api_key(); + } $value = sanitize_text_field( $value ); if ( empty( $value ) ) { @@ -209,6 +215,9 @@ public function sanitize_search_api_key( $value ) { } public function sanitize_api_key( $value ) { + if ( $this->plugin->get_settings()->is_api_key_in_config() ) { + $value = $this->plugin->get_settings()->get_api_key(); + } $value = sanitize_text_field( $value ); if ( empty( $value ) ) { @@ -291,6 +300,10 @@ public function is_valid_index_name_prefix( $index_name_prefix ) { * @return array */ public function sanitize_index_name_prefix( $value ) { + if ( $this->plugin->get_settings()->is_index_name_prefix_in_config() ) { + $value = $this->plugin->get_settings()->get_index_name_prefix(); + } + if ( $this->is_valid_index_name_prefix( $value ) ) { return $value; }