components/I18n/I18n.php
public function admin_save() {

		$this->languages_available = get_available_languages();

		/**
		 * format: array( language, version, updated, english_name, native_name, package, iso, strings )
		 */
		require_once ABSPATH . 'wp-admin/includes/translation-install.php';
		$this->languages_translated = wp_get_available_translations();

		$new_languages = array();

		if ( isset( $_POST['pods_i18n_enabled_languages'] ) && is_array( $_POST['pods_i18n_enabled_languages'] ) ) {
			foreach ( $_POST['pods_i18n_enabled_languages'] as $locale ) {
				$locale = sanitize_text_field( $locale );

				if ( in_array( $locale, $this->languages_available, true ) ) {
					$new_languages[ $locale ] = array();

					if ( isset( $this->languages_translated[ $locale ]['language'] ) ) {
						$new_languages[ $locale ]['language'] = $this->languages_translated[ $locale ]['language'];
					}

					if ( isset( $this->languages_translated[ $locale ]['english_name'] ) ) {
						$new_languages[ $locale ]['english_name'] = $this->languages_translated[ $locale ]['english_name'];
					}

					if ( isset( $this->languages_translated[ $locale ]['native_name'] ) ) {
						$new_languages[ $locale ]['native_name'] = $this->languages_translated[ $locale ]['native_name'];
					}
				}
			}
		}//end if

		$this->languages                     = $new_languages;
		$this->settings['enabled_languages'] = $new_languages;

		update_option( $this->option_key, $this->settings );

	}
public function admin_save() {

		$this->languages_available = get_available_languages();

		/**
		 * format: array( language, version, updated, english_name, native_name, package, iso, strings )
		 */
		require_once ABSPATH . 'wp-admin/includes/translation-install.php';
		$this->languages_translated = wp_get_available_translations();

		$new_languages = array();

		if ( isset( $_POST['pods_i18n_enabled_languages'] ) && is_array( $_POST['pods_i18n_enabled_languages'] ) ) {
			foreach ( $_POST['pods_i18n_enabled_languages'] as $locale ) {
				$locale = sanitize_text_field( $locale );

				if ( in_array( $locale, $this->languages_available, true ) ) {
					$new_languages[ $locale ] = array();

					if ( isset( $this->languages_translated[ $locale ]['language'] ) ) {
						$new_languages[ $locale ]['language'] = $this->languages_translated[ $locale ]['language'];
					}

					if ( isset( $this->languages_translated[ $locale ]['english_name'] ) ) {
						$new_languages[ $locale ]['english_name'] = $this->languages_translated[ $locale ]['english_name'];
					}

					if ( isset( $this->languages_translated[ $locale ]['native_name'] ) ) {
						$new_languages[ $locale ]['native_name'] = $this->languages_translated[ $locale ]['native_name'];
					}
				}
			}
		}//end if

		$this->languages                     = $new_languages;
		$this->settings['enabled_languages'] = $new_languages;

		update_option( $this->option_key, $this->settings );

	}
public function admin_save ( ) { $ this -> languages_available = get_available_languages ( ) ; /**
		 * format: array( language, version, updated, english_name, native_name, package, iso, strings )
		 */ require_once ABSPATH . 'wp-admin/includes/translation-install.php' ; $ this -> languages_translated = wp_get_available_translations ( ) ; $ new_languages = array ( ) ; if ( isset ( $ _POST [ 'pods_i18n_enabled_languages' ] ) && is_array ( $ _POST [ 'pods_i18n_enabled_languages' ] ) ) { foreach ( $ _POST [ 'pods_i18n_enabled_languages' ] as $ locale ) { $ locale = sanitize_text_field ( $ locale ) ; if ( in_array ( $ locale , $ this -> languages_available , true ) ) { $ new_languages [ $ locale ] = array ( ) ; if ( isset ( $ this -> languages_translated [ $ locale ] [ 'language' ] ) ) { $ new_languages [ $ locale ] [ 'language' ] = $ this -> languages_translated [ $ locale ] [ 'language' ] ; } if ( isset ( $ this -> languages_translated [ $ locale ] [ 'english_name' ] ) ) { $ new_languages [ $ locale ] [ 'english_name' ] = $ this -> languages_translated [ $ locale ] [ 'english_name' ] ; } if ( isset ( $ this -> languages_translated [ $ locale ] [ 'native_name' ] ) ) { $ new_languages [ $ locale ] [ 'native_name' ] = $ this -> languages_translated [ $ locale ] [ 'native_name' ] ; } } } } //end if $ this -> languages = $ new_languages ; $ this -> settings [ 'enabled_languages' ] = $ new_languages ; update_option ( $ this -> option_key , $ this -> settings ) ; }
Save component settings

@since 0.1.0
Save component settings