Code Duplication    Length = 19-28 lines in 2 locations

classes/fields/pick.php 2 locations

@@ 428-446 (lines=19) @@
425
426
			$ignore = array( 'attachment', 'revision', 'nav_menu_item' );
427
428
			foreach ( $post_types as $post_type => $label ) {
429
				if ( in_array( $post_type, $ignore, true ) || empty( $post_type ) ) {
430
					unset( $post_types[ $post_type ] );
431
432
					continue;
433
				} elseif ( 0 === strpos( $post_type, '_pods_' ) && apply_filters( 'pods_pick_ignore_internal', true ) ) {
434
					unset( $post_types[ $post_type ] );
435
436
					continue;
437
				}
438
439
				$post_type = get_post_type_object( $post_type );
440
441
				self::$related_objects[ 'post_type-' . $post_type->name ] = array(
442
					'label'         => $post_type->label . ' (' . $post_type->name . ')',
443
					'group'         => __( 'Post Types', 'pods' ),
444
					'bidirectional' => true,
445
				);
446
			}
447
448
			// Taxonomies for relationships.
449
			$taxonomies = get_taxonomies();
@@ 454-481 (lines=28) @@
451
452
			$ignore = array( 'nav_menu', 'post_format' );
453
454
			foreach ( $taxonomies as $taxonomy => $label ) {
455
				/**
456
				 * Prevent ability to extend core Pods content types.
457
				 *
458
				 * @param bool $ignore_internal Default is true, when set to false Pods internal content types can not be extended.
459
				 *
460
				 * @since 2.3.19
461
				 */
462
				$ignore_internal = apply_filters( 'pods_pick_ignore_internal', true );
463
464
				if ( in_array( $taxonomy, $ignore, true ) || empty( $taxonomy ) ) {
465
					unset( $taxonomies[ $taxonomy ] );
466
467
					continue;
468
				} elseif ( 0 === strpos( $taxonomy, '_pods_' ) && $ignore_internal ) {
469
					unset( $taxonomies[ $taxonomy ] );
470
471
					continue;
472
				}
473
474
				$taxonomy = get_taxonomy( $taxonomy );
475
476
				self::$related_objects[ 'taxonomy-' . $taxonomy->name ] = array(
477
					'label'         => $taxonomy->label . ' (' . $taxonomy->name . ')',
478
					'group'         => __( 'Taxonomies', 'pods' ),
479
					'bidirectional' => true,
480
				);
481
			}//end foreach
482
483
			// Other WP Objects for relationships.
484
			self::$related_objects['user'] = array(