Code Duplication    Length = 9-9 lines in 6 locations

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

@@ 1222-1230 (lines=9) @@
1219
 *
1220
 * @return string
1221
 */
1222
function _give_terms_option_field_value( $field_value, $field, $postid ) {
1223
	$term_option = give_get_meta( $postid, '_give_terms_option', true );
1224
1225
	if ( in_array( $term_option, array( 'none', 'yes' ) ) ) {
1226
		$field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' );
1227
	}
1228
1229
	return $field_value;
1230
}
1231
1232
add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 );
1233
@@ 1275-1283 (lines=9) @@
1272
 *
1273
 * @return string
1274
 */
1275
function _give_custom_amount_field_value( $field_value, $field, $postid ) {
1276
	$custom_amount = give_get_meta( $postid, '_give_custom_amount', true );
1277
1278
	if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) {
1279
		$field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' );
1280
	}
1281
1282
	return $field_value;
1283
}
1284
1285
add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 );
1286
@@ 1301-1309 (lines=9) @@
1298
 *
1299
 * @return string
1300
 */
1301
function _give_goal_option_field_value( $field_value, $field, $postid ) {
1302
	$goal_option = give_get_meta( $postid, '_give_goal_option', true );
1303
1304
	if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) {
1305
		$field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' );
1306
	}
1307
1308
	return $field_value;
1309
}
1310
1311
add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 );
1312
@@ 1327-1335 (lines=9) @@
1324
 *
1325
 * @return string
1326
 */
1327
function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) {
1328
	$close_form = give_get_meta( $postid, '_give_close_form_when_goal_achieved', true );
1329
1330
	if ( in_array( $close_form, array( 'yes', 'no' ) ) ) {
1331
		$field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' );
1332
	}
1333
1334
	return $field_value;
1335
}
1336
1337
add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 );
1338
@@ 1353-1361 (lines=9) @@
1350
 *
1351
 * @return string
1352
 */
1353
function _give_logged_in_only_value( $field_value, $field, $postid ) {
1354
	$guest_donation = give_get_meta( $postid, '_give_logged_in_only', true );
1355
1356
	if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) {
1357
		$field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' );
1358
	}
1359
1360
	return $field_value;
1361
}
1362
1363
add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 );
1364
@@ 1379-1387 (lines=9) @@
1376
 *
1377
 * @return string
1378
 */
1379
function _give_customize_offline_donations_value( $field_value, $field, $postid ) {
1380
	$customize_offline_text = give_get_meta( $postid, '_give_customize_offline_donations', true );
1381
1382
	if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) {
1383
		$field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' );
1384
	}
1385
1386
	return $field_value;
1387
}
1388
1389
add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 );
1390