uld_use_admin_language; } /** * @return string */ public function get_admin_language() { if ( $this->sitepress->is_wpml_switch_language_triggered() ) { return $this->sitepress->get_admin_language(); } if ( ! $this->admin_language ) { $this->admin_language = $this->sitepress->get_admin_language(); } return $this->admin_language; } /** * @return bool */ private function is_admin_action_from_referer() { if ( $this->is_admin_action_from_referer === null ) { $this->is_admin_action_from_referer = $this->sitepress->check_if_admin_action_from_referer(); } return $this->is_admin_action_from_referer; } public function wpml_language_has_switched() { // clear the current language cache $this->current_string_language_cache = array(); } public function change_string_lang_ajax_callback() { if ( ! $this->verify_ajax_call( 'wpml_change_string_language_nonce' ) ) { die( 'verification failed' ); } global $wpdb; $change_string_language_dialog = new WPML_Change_String_Language_Select( $wpdb, $this->sitepress ); $string_ids = array_map( 'intval', $_POST['strings'] ); $lang = filter_var( isset( $_POST['language'] ) ? $_POST['language'] : '', FILTER_SANITIZE_SPECIAL_CHARS ); $response = $change_string_language_dialog->change_language_of_strings( $string_ids, (string) $lang ); wp_send_json( $response ); } public function change_string_lang_of_domain_ajax_callback() { if ( ! $this->verify_ajax_call( 'wpml_change_string_domain_language_nonce' ) ) { die( 'verification failed' ); } global $wpdb, $sitepress; $change_string_language_domain_dialog = make( \WPML_Change_String_Domain_Language_Dialog::class ); $response = $change_string_language_domain_dialog->change_language_of_strings( $_POST['domain'], isset( $_POST['langs'] ) ? $_POST['langs'] : array(), $_POST['language'], $_POST['use_default'] == 'true' ); wp_send_json( $response ); } private function verify_ajax_call( $ajax_action ) { return isset( $_POST['wpnonce'] ) && wp_verify_nonce( $_POST['wpnonce'], $ajax_action ); } }