Code Duplication    Length = 19-28 lines in 2 locations

classes/fields/pick.php 2 locations

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