'sanitize_text_field', 'default' => '', ] ); register_setting( 'aisp_global_settings', 'aisp_autocomplete_here_limit', [ 'sanitize_callback' => 'absint', 'default' => 5, ] ); } /** Enqueue admin JS for Check Key */ public function enqueue_admin_scripts( $hook ) { if ( 'toplevel_page_aisp-autocomplete' === $hook ) { wp_enqueue_style( 'aisp-admin-style', plugin_dir_url( AISP_SMART_AUTOCOMPLETE_ADDRESS_FILE ) . 'assets/css/admin.css', [], AISP_SMART_AUTOCOMPLETE_ADDRESS_VERSION ); wp_enqueue_script( 'aisp-check-key', plugin_dir_url( AISP_SMART_AUTOCOMPLETE_ADDRESS_FILE ) . 'assets/js/admin-check-key.js', [ 'jquery' ], AISP_SMART_AUTOCOMPLETE_ADDRESS_VERSION, true ); wp_localize_script( 'aisp-check-key', 'aispCheckKey', [ 'checking' => __( 'Checking...', 'aisp-smart-autocomplete-address' ), 'empty' => __( 'Please enter an API key first.', 'aisp-smart-autocomplete-address' ), 'error' => __( 'Error checking key.', 'aisp-smart-autocomplete-address' ), 'nonce' => wp_create_nonce( 'aisp_check_api_key' ), ] ); } } /** Render settings page with tabs */ public function render_settings_page() { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Safe read for tab navigation in admin settings. $active_tab = isset( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : 'settings'; echo '
'; echo '

' . esc_html__( 'Smart Autocomplete Address', 'aisp-smart-autocomplete-address' ) . '

'; echo ''; // Active tab rendering. switch ( $active_tab ) { case 'settings': $this->render_global_tab(); break; case 'custom-field': if ( class_exists( 'AISP_Autocomplete_Custom_Field_Integration' ) ) { AISP_Autocomplete_Custom_Field_Integration::render_settings_tab(); } break; case 'woocommerce': if ( class_exists( 'AISP_Autocomplete_WC_Integration' ) ) { AISP_Autocomplete_WC_Integration::render_woocommerce_tab(); } break; case 'fluent-forms': if ( class_exists( 'AISP_Autocomplete_Fluent_Forms_Integration' ) ) { AISP_Autocomplete_Fluent_Forms_Integration::render_settings_tab(); } break; case 'sureforms': if ( class_exists( 'AISP_Autocomplete_SureForms_Integration' ) ) { AISP_Autocomplete_SureForms_Integration::render_settings_tab(); } break; case 'contact-form-7': if ( class_exists( 'AISP_Autocomplete_CF7_Integration' ) ) { AISP_Autocomplete_CF7_Integration::render_settings_tab(); } break; case 'wpforms': if ( class_exists( 'AISP_Autocomplete_WPForms_Integration' ) ) { AISP_Autocomplete_WPForms_Integration::render_settings_tab(); } break; case 'help': $this->render_help_tab(); break; default: $this->render_global_tab(); break; } echo '
'; } /** Render a nav tab (returns sanitized HTML) */ private function render_tab_link( $slug, $label, $active_tab ) { $url = esc_url( add_query_arg( 'tab', $slug ) ); $active = $active_tab === $slug ? 'nav-tab-active' : ''; return sprintf( '%3$s', $url, esc_attr( $active ), esc_html( $label ) ); } /** Render conditional tabs safely */ private function render_conditional_tab( $class, $slug, $label, $active_tab, $req = '' ) { if ( class_exists( $class ) ) { printf( '%3$s', esc_url( add_query_arg( 'tab', $slug ) ), esc_attr( $active_tab === $slug ? 'nav-tab-active' : '' ), esc_html( $label ) ); } else { echo '' . esc_html( $label ); if ( $req ) { echo ' (' . esc_html( $req ) . ')'; } echo ''; } } /** Render global settings tab */ private function render_global_tab() { ?>

tags linking to the HERE Developer Portal. */ __( 'Enter your HERE API key. Get it from the %1$sHERE Developer Portal%2$s.', 'aisp-smart-autocomplete-address' ), [ 'a' => [ 'href' => [], 'target' => [], 'rel' => [] ] ] ), '', '' ); ?>

  1. [ 'href' => [], 'target' => [], 'rel' => [] ] ] ), '', '' ); ?>

  2. https://yoursite.com
    https://www.yoursite.com

tags. */ __( 'The free plan includes %1$s1,000 autocomplete requests per day%2$s — enough for most small to medium WooCommerce stores.', 'aisp-smart-autocomplete-address' ), [ 'strong' => [] ] ), '', '' ); ?>