Code Duplication    Length = 9-9 lines in 6 locations

includes/admin/give-metabox-functions.php 6 locations

@@ 1526-1534 (lines=9) @@
1523
 *
1524
 * @return string
1525
 */
1526
function _give_terms_option_field_value( $field_value, $field, $postid ) {
1527
	$term_option = give_get_meta( $postid, '_give_terms_option', true );
1528
1529
	if ( in_array( $term_option, array( 'none', 'yes' ) ) ) {
1530
		$field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' );
1531
	}
1532
1533
	return $field_value;
1534
}
1535
1536
add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 );
1537
@@ 1579-1587 (lines=9) @@
1576
 *
1577
 * @return string
1578
 */
1579
function _give_custom_amount_field_value( $field_value, $field, $postid ) {
1580
	$custom_amount = give_get_meta( $postid, '_give_custom_amount', true );
1581
1582
	if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) {
1583
		$field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' );
1584
	}
1585
1586
	return $field_value;
1587
}
1588
1589
add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 );
1590
@@ 1605-1613 (lines=9) @@
1602
 *
1603
 * @return string
1604
 */
1605
function _give_goal_option_field_value( $field_value, $field, $postid ) {
1606
	$goal_option = give_get_meta( $postid, '_give_goal_option', true );
1607
1608
	if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) {
1609
		$field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' );
1610
	}
1611
1612
	return $field_value;
1613
}
1614
1615
add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 );
1616
@@ 1631-1639 (lines=9) @@
1628
 *
1629
 * @return string
1630
 */
1631
function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) {
1632
	$close_form = give_get_meta( $postid, '_give_close_form_when_goal_achieved', true );
1633
1634
	if ( in_array( $close_form, array( 'yes', 'no' ) ) ) {
1635
		$field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' );
1636
	}
1637
1638
	return $field_value;
1639
}
1640
1641
add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 );
1642
@@ 1657-1665 (lines=9) @@
1654
 *
1655
 * @return string
1656
 */
1657
function _give_logged_in_only_value( $field_value, $field, $postid ) {
1658
	$guest_donation = give_get_meta( $postid, '_give_logged_in_only', true );
1659
1660
	if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) {
1661
		$field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' );
1662
	}
1663
1664
	return $field_value;
1665
}
1666
1667
add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 );
1668
@@ 1683-1691 (lines=9) @@
1680
 *
1681
 * @return string
1682
 */
1683
function _give_customize_offline_donations_value( $field_value, $field, $postid ) {
1684
	$customize_offline_text = give_get_meta( $postid, '_give_customize_offline_donations', true );
1685
1686
	if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) {
1687
		$field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' );
1688
	}
1689
1690
	return $field_value;
1691
}
1692
1693
add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 );
1694