= $input ) ) { return $input; } return 'automatic'; } } if ( ! function_exists( 'pen_sanitize_thumbnail_resize' ) ) { /** * Sanitizes the post thumbnail size option. * * @param string $input The post thumbnail size. * * @since Pen 1.0.0 * @return string */ function pen_sanitize_thumbnail_resize( $input ) { /* phpcs:disable */ if ( 'none' === $input || in_array( (string) $input, get_intermediate_image_sizes(), true ) ) { return $input; } /* phpcs:enable */ return 'none'; } } if ( ! function_exists( 'pen_sanitize_list_type' ) ) { /** * Sanitizes the content list types. * * @param string $input The content list type. * * @since Pen 1.0.0 * @return string */ function pen_sanitize_list_type( $input ) { if ( in_array( (string) $input, array( 'masonry', 'plain' ), true ) ) { return $input; } return ''; } } if ( ! function_exists( 'pen_sanitize_site_width' ) ) { /** * Sanitizes the layout type. * * @param string $input The content area layout. * * @since Pen 1.0.2 * @return string */ function pen_sanitize_site_width( $input ) { // 'default' === 'standard' (Content Meta). if ( in_array( (string) $input, array( 'default', 'standard', 'wide', 'boxed' ), true ) ) { return $input; } return 'default'; } } if ( ! function_exists( 'pen_sanitize_location' ) ) { /** * Sanitizes the element location option. * * @param string $input The content area layout. * * @since Pen 1.0.0 * @return string */ function pen_sanitize_location( $input ) { if ( in_array( (string) $input, array( 'header', 'content', 'footer' ), true ) ) { return $input; } return 'header'; } } if ( ! function_exists( 'pen_sanitize_alignment' ) ) { /** * Sanitizes the alignment option. * * @param string $input The "alignment" option. * * @since Pen 1.0.4 * @return string */ function pen_sanitize_alignment( $input ) { if ( in_array( (string) $input, array( 'left', 'center', 'right' ), true ) ) { return $input; } return 'left'; } } if ( ! function_exists( 'pen_sanitize_font_family' ) ) { /** * Sanitizes font families. * * @param string $input The font size. * * @since Pen 1.0.0 * @return string */ function pen_sanitize_font_family( $input ) { $fonts = pen_fonts_all(); if ( 'default' === $input || array_key_exists( $input, $fonts ) ) { return $input; } return 'default'; } } if ( ! function_exists( 'pen_sanitize_font_size' ) ) { /** * Sanitizes font sizes. * * @param string $input The font size. * * @since Pen 1.0.0 * @return string */ function pen_sanitize_font_size( $input ) { if ( in_array( (string) $input, array( 'default', '0.5em', '0.75em', 'normal', '2em', '3em' ), true ) ) { return $input; } return 'default'; } } if ( ! function_exists( 'pen_sanitize_animation' ) ) { /** * Sanitizes animations. * * @param string $input The animation effect ID. * * @since Pen 1.0.8 * @return string */ function pen_sanitize_animation( $input ) { if ( in_array( (string) $input, pen_animations(), true ) ) { return $input; } return 'none'; } }