public static function sanitizeSettings( array $settings ) {
		$result = array();

		if ( ! empty( $settings['autoupdate'] ) && is_array( $settings['autoupdate'] ) ) {
			foreach ( $settings['autoupdate'] as $category => $itemSetting ) {
				$category = sanitize_key( $category );

				foreach ( $itemSetting as $id => $val ) {
					$id = sanitize_text_field( $id );

					$result['autoupdate'][ $category ][ $id ] = (bool) $val;
				}
			}
		}

		// Validate release channel settings.
		$channels = array(
			'stable',
			'edge',
			'candidate',
		);

		if ( empty( $settings['release_channel'] ) ||
			! in_array( $settings['release_channel'], $channels, true ) ) {
				$result['release_channel'] = 'stable';
		} else {
			$result['release_channel'] = $settings['release_channel'];
		}

		if ( empty( $settings['theme_release_channel'] ) ||
			! in_array( $settings['theme_release_channel'], $channels, true ) ) {
				$result['theme_release_channel'] = 'stable';
		} else {
			$result['theme_release_channel'] = $settings['theme_release_channel'];
		}

		return $result;
	}
public static function sanitizeSettings( array $settings ) {
		$result = array();

		if ( ! empty( $settings['autoupdate'] ) && is_array( $settings['autoupdate'] ) ) {
			foreach ( $settings['autoupdate'] as $category => $itemSetting ) {
				$category = sanitize_key( $category );

				foreach ( $itemSetting as $id => $val ) {
					$id = sanitize_text_field( $id );

					$result['autoupdate'][ $category ][ $id ] = (bool) $val;
				}
			}
		}

		// Validate release channel settings.
		$channels = array(
			'stable',
			'edge',
			'candidate',
		);

		if ( empty( $settings['release_channel'] ) ||
			! in_array( $settings['release_channel'], $channels, true ) ) {
				$result['release_channel'] = 'stable';
		} else {
			$result['release_channel'] = $settings['release_channel'];
		}

		if ( empty( $settings['theme_release_channel'] ) ||
			! in_array( $settings['theme_release_channel'], $channels, true ) ) {
				$result['theme_release_channel'] = 'stable';
		} else {
			$result['theme_release_channel'] = $settings['theme_release_channel'];
		}

		return $result;
	}
public static function sanitizeSettings ( array $ settings ) { $ result = array ( ) ; if ( ! empty ( $ settings [ 'autoupdate' ] ) && is_array ( $ settings [ 'autoupdate' ] ) ) { foreach ( $ settings [ 'autoupdate' ] as $ category => $ itemSetting ) { $ category = sanitize_key ( $ category ) ; foreach ( $ itemSetting as $ id => $ val ) { $ id = sanitize_text_field ( $ id ) ; $ result [ 'autoupdate' ] [ $ category ] [ $ id ] = ( bool ) $ val ; } } } // Validate release channel settings. $ channels = array ( 'stable' , 'edge' , 'candidate' , ) ; if ( empty ( $ settings [ 'release_channel' ] ) || ! in_array ( $ settings [ 'release_channel' ] , $ channels , true ) ) { $ result [ 'release_channel' ] = 'stable' ; } else { $ result [ 'release_channel' ] = $ settings [ 'release_channel' ] ; } if ( empty ( $ settings [ 'theme_release_channel' ] ) || ! in_array ( $ settings [ 'theme_release_channel' ] , $ channels , true ) ) { $ result [ 'theme_release_channel' ] = 'stable' ; } else { $ result [ 'theme_release_channel' ] = $ settings [ 'theme_release_channel' ] ; } return $ result ; }
Sanitize settings.

@since 2.7.0

@static

@param  array $settings {
Settings.

@type array  $autoupdate {
Optional auto-update settings.  This array does not always get included.

@type array $plugins {
Plugin auto-update settings.

@type string $slug Plugin auto-update setting (1=Enabled, 0=Disabled).
}
@type array $themes {
Theme auto-update settings.

@type string $stylesheet Theme auto-update setting (1=Enabled, 0=Disabled).
}
}
@type string $release_channel        Plugin release channel.
@type string $theme_release_channel  Theme release channel.
}
@return array
Sanitize settings .