Code Duplication    Length = 38-38 lines in 2 locations

includes/forms/template.php 2 locations

@@ 533-570 (lines=38) @@
530
	$output = '';
531
532
	switch ( $display_style ) {
533
		case 'buttons':
534
			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
535
536
			foreach ( $prices as $price ) {
537
				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price );
538
				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( give_is_default_level_id( $price ) ? 'give-default-level' : '' ), $form_id, $price );
539
540
				$formatted_amount = give_format_amount(
541
					$price['_give_amount'], array(
542
						'sanitize' => false,
543
						'currency' => give_get_currency( $form_id ),
544
					)
545
				);
546
547
				$output .= sprintf(
548
					'<li><button type="button" data-price-id="%1$s" class="%2$s" value="%3$s" data-default="%4$s">%5$s</button></li>',
549
					$price['_give_id']['level_id'],
550
					$level_classes,
551
					$formatted_amount,
552
					array_key_exists( '_give_default', $price ) ? 1 : 0,
553
					$level_text
554
				);
555
			}
556
557
			// Custom Amount.
558
			if (
559
				give_is_setting_enabled( $custom_amount )
560
				&& ! empty( $custom_amount_text )
561
			) {
562
563
				$output .= sprintf(
564
					'<li><button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">%1$s</button></li>',
565
					$custom_amount_text
566
				);
567
			}
568
569
			$output .= '</ul>';
570
571
			break;
572
573
		case 'radios':
@@ 573-610 (lines=38) @@
570
571
			break;
572
573
		case 'radios':
574
			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
575
576
			foreach ( $prices as $price ) {
577
				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price );
578
				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( give_is_default_level_id( $price ) ? ' give-default-level' : '' ), $form_id, $price );
579
580
				$formatted_amount = give_format_amount(
581
					$price['_give_amount'], array(
582
						'sanitize' => false,
583
						'currency' => give_get_currency( $form_id ),
584
					)
585
				);
586
587
				$output .= sprintf(
588
					'<li><input type="radio" data-price-id="%1$s" class="%2$s" value="%3$s" name="give-radio-donation-level" id="give-radio-level-%1$s" %4$s data-default="%5$s"><label for="give-radio-level-%1$s">%6$s</label></li>',
589
					$price['_give_id']['level_id'],
590
					$level_classes,
591
					$formatted_amount,
592
					( give_is_default_level_id( $price ) ? 'checked="checked"' : '' ),
593
					array_key_exists( '_give_default', $price ) ? 1 : 0,
594
					$level_text
595
				);
596
			}
597
598
			// Custom Amount.
599
			if (
600
				give_is_setting_enabled( $custom_amount )
601
				&& ! empty( $custom_amount_text )
602
			) {
603
				$output .= sprintf(
604
					'<li><input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom"><label for="give-radio-level-custom">%1$s</label></li>',
605
					$custom_amount_text
606
				);
607
			}
608
609
			$output .= '</ul>';
610
611
			break;
612
613
		case 'dropdown':