Code Duplication    Length = 19-28 lines in 2 locations

classes/fields/pick.php 2 locations

@@ 460-478 (lines=19) @@
457
458
			$ignore = array( 'attachment', 'revision', 'nav_menu_item' );
459
460
			foreach ( $post_types as $post_type => $label ) {
461
				if ( in_array( $post_type, $ignore, true ) || empty( $post_type ) ) {
462
					unset( $post_types[ $post_type ] );
463
464
					continue;
465
				} elseif ( 0 === strpos( $post_type, '_pods_' ) && apply_filters( 'pods_pick_ignore_internal', true ) ) {
466
					unset( $post_types[ $post_type ] );
467
468
					continue;
469
				}
470
471
				$post_type = get_post_type_object( $post_type );
472
473
				self::$related_objects[ 'post_type-' . $post_type->name ] = array(
474
					'label'         => $post_type->label . ' (' . $post_type->name . ')',
475
					'group'         => __( 'Post Types', 'pods' ),
476
					'bidirectional' => true,
477
				);
478
			}
479
480
			// Taxonomies for relationships.
481
			$taxonomies = get_taxonomies();
@@ 486-513 (lines=28) @@
483
484
			$ignore = array( 'nav_menu', 'post_format' );
485
486
			foreach ( $taxonomies as $taxonomy => $label ) {
487
				/**
488
				 * Prevent ability to extend core Pods content types.
489
				 *
490
				 * @param bool $ignore_internal Default is true, when set to false Pods internal content types can not be extended.
491
				 *
492
				 * @since 2.3.19
493
				 */
494
				$ignore_internal = apply_filters( 'pods_pick_ignore_internal', true );
495
496
				if ( in_array( $taxonomy, $ignore, true ) || empty( $taxonomy ) ) {
497
					unset( $taxonomies[ $taxonomy ] );
498
499
					continue;
500
				} elseif ( 0 === strpos( $taxonomy, '_pods_' ) && $ignore_internal ) {
501
					unset( $taxonomies[ $taxonomy ] );
502
503
					continue;
504
				}
505
506
				$taxonomy = get_taxonomy( $taxonomy );
507
508
				self::$related_objects[ 'taxonomy-' . $taxonomy->name ] = array(
509
					'label'         => $taxonomy->label . ' (' . $taxonomy->name . ')',
510
					'group'         => __( 'Taxonomies', 'pods' ),
511
					'bidirectional' => true,
512
				);
513
			}
514
515
			// Other WP Objects for relationships.
516
			self::$related_objects['user'] = array(