Code Duplication    Length = 17-17 lines in 2 locations

includes/class-sensei-settings-api.php 2 locations

@@ 475-491 (lines=17) @@
472
	 * @param  array $args
473
	 * @return void
474
	 */
475
	public function form_field_select ( $args ) {
476
		$options = $this->get_settings();
477
478
		if ( isset( $args['data']['options'] ) && ( count( (array)$args['data']['options'] ) > 0 ) ) {
479
			$html = '';
480
			$html .= '<select class="" id="' . esc_attr( $args['key'] ) . '" name="' . esc_attr( $this->token ) . '[' . esc_attr( $args['key'] ) . ']">' . "\n";
481
				foreach ( $args['data']['options'] as $k => $v ) {
482
					$html .= '<option value="' . esc_attr( $k ) . '"' . selected( esc_attr( $options[$args['key']] ), $k, false ) . '>' . $v . '</option>' . "\n";
483
				}
484
			$html .= '</select>' . "\n";
485
			echo $html;
486
487
			if ( isset( $args['data']['description'] ) ) {
488
				echo '<p><span class="description">' . esc_html( $args['data']['description'] ) . '</span></p>' . "\n";
489
			}
490
		}
491
	} // End form_field_select()
492
493
	/**
494
	 * Generate radio button field.
@@ 556-572 (lines=17) @@
553
	 * @param  array $args
554
	 * @return void
555
	 */
556
	public function form_field_range ( $args ) {
557
		$options = $this->get_settings();
558
559
		if ( isset( $args['data']['options'] ) && ( count( (array)$args['data']['options'] ) > 0 ) ) {
560
			$html = '';
561
			$html .= '<select id="' . esc_attr( $args['key'] ) . '" name="' . esc_attr( $this->token ) . '[' . esc_attr( $args['key'] ) . ']" class="range-input">' . "\n";
562
				foreach ( $args['data']['options'] as $k => $v ) {
563
					$html .= '<option value="' . esc_attr( $k ) . '"' . selected( esc_attr( $options[$args['key']] ), $k, false ) . '>' . $v . '</option>' . "\n";
564
				}
565
			$html .= '</select>' . "\n";
566
			echo $html;
567
568
			if ( isset( $args['data']['description'] ) ) {
569
				echo '<p><span class="description">' . esc_html( $args['data']['description'] ) . '</span></p>' . "\n";
570
			}
571
		}
572
	} // End form_field_range()
573
574
	/**
575
	 * Generate image-based selector form field.