Astra_Customizer_Sanitizes::sanitize_background_obj( mixed $bg_obj )

Sanitize Background Obj


Description


Parameters

$bg_obj

(mixed) (Required) setting input.


Return

(array) setting input value.


Source

File: inc/customizer/class-astra-customizer-sanitizes.php

		public static function sanitize_background_obj( $bg_obj ) {

			$out_bg_obj = array(
				'background-color'      => '',
				'background-image'      => '',
				'background-repeat'     => 'repeat',
				'background-position'   => 'center center',
				'background-size'       => 'auto',
				'background-attachment' => 'scroll',
				'background-media'      => '',
				'background-type'       => '',
			);

			if ( is_array( $bg_obj ) ) {

				foreach ( $out_bg_obj as $key => $value ) {

					if ( isset( $bg_obj[ $key ] ) ) {

						if ( 'background-image' === $key ) {
							$out_bg_obj[ $key ] = esc_url_raw( $bg_obj[ $key ] );
						} else {
							$out_bg_obj[ $key ] = esc_attr( $bg_obj[ $key ] );
						}
					}
				}
			}

			return $out_bg_obj;
		}

User Contributed Notes

You must log in before being able to contribute a note or feedback.