admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'af_translate_secure_action' ), ) ); } /** * Register and securely enqueue admin-side workspace automation mechanisms. */ public function af_translate_admin_dashboard_scripts( $hook ) { if ( strpos( $hook, 'af-translate' ) === false ) { return; } wp_enqueue_script( 'af-translate-dashboard-script', AF_TRANSLATE_URL . 'assets/js/project-dashboard.js', array( 'jquery' ), AF_TRANSLATE_VERSION, true ); wp_localize_script( 'af-translate-dashboard-script', 'afTranslateDashboard', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'af_translate_secure_action' ), 'strings' => array( 'confirmSync' => esc_html__( 'Sync this language file with the master template? This updates new customization strings without destroying existing translations.', 'af-translate' ), 'confirmDelete' => esc_html__( 'Are you sure you want to permanently delete this translation file and its compiled machine code?', 'af-translate' ), 'errorDelete' => esc_html__( 'Failed to delete the selected file.', 'af-translate' ), ), ) ); } /** * Enqueue control mechanisms for the language initialization view layout wizard. */ public function af_translate_new_language_scripts( $hook ) { if ( strpos( $hook, 'af-translate' ) === false ) { return; } wp_enqueue_script( 'af-translate-new-lang-script', AF_TRANSLATE_URL . 'assets/js/new-language.js', array( 'jquery' ), AF_TRANSLATE_VERSION, true ); wp_localize_script( 'af-translate-new-lang-script', 'afTranslateNewLang', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'af_translate_secure_action' ), 'strings' => array( 'loadingText' => esc_html__( 'Analyzing bundle infrastructure...', 'af-translate' ), 'buttonDefault' => esc_html__( 'Start translating', 'af-translate' ), 'errorPrefix' => esc_html__( 'Error: ', 'af-translate' ), 'errorDefault' => esc_html__( 'Failed to initialize localized dataset parameters.', 'af-translate' ), ), ) ); } /** * Enqueue tab routing and key visibility mask behaviors for the main settings page. */ public function af_translate_admin_settings_scripts( $hook ) { // Enforce execution isolation so it only targets your engine configuration panel // (Adjust string match to your exact options/settings submenu page slug if different) if ( strpos( $hook, 'af-translate' ) === false || strpos( $hook, 'ai-connecter' ) === false ) { return; } // Ensure native dashicons are available for the visibility eye toggles wp_enqueue_style( 'dashicons' ); wp_enqueue_script( 'af-translate-admin-settings-js', AF_TRANSLATE_URL . 'assets/js/ai-admin-settings.js', array(), AF_TRANSLATE_VERSION, true // Injected cleanly before the closing body tag ); } }