Code Duplication    Length = 7-8 lines in 2 locations

modules/shortcodes/slideshow.php 1 location

@@ 76-82 (lines=7) @@
73
		register_setting( 'media', 'jetpack_slideshow_background_color', array( $this, 'slideshow_background_color_sanitize' ) );
74
	}
75
76
	function slideshow_background_color_callback() {
77
		$options = array(
78
			'black' => __( 'Black', 'jetpack' ),
79
			'white' => __( 'White', 'jetpack' ),
80
		);
81
		$this->settings_select( 'jetpack_slideshow_background_color', $options );
82
	}
83
84
	function settings_select( $name, $values, $extra_text = '' ) {
85
		if ( empty( $name ) || empty( $values ) || ! is_array( $values ) ) {

modules/carousel/jetpack-carousel.php 1 location

@@ 798-805 (lines=8) @@
795
		return $this->sanitize_1or0_option( $value );
796
	}
797
798
	function carousel_background_color_callback() {
799
		$this->settings_select(
800
			'carousel_background_color', array(
801
				'black' => __( 'Black', 'jetpack' ),
802
				'white' => __( 'White', 'jetpack' ),
803
			)
804
		);
805
	}
806
807
	function carousel_background_color_sanitize( $value ) {
808
		return ( 'white' == $value ) ? 'white' : 'black';