Code Duplication    Length = 20-28 lines in 2 locations

classes/fields/pick.php 2 locations

@@ 406-425 (lines=20) @@
403
404
            $ignore = array( 'attachment', 'revision', 'nav_menu_item' );
405
406
            foreach ( $post_types as $post_type => $label ) {
407
                if ( in_array( $post_type, $ignore ) || empty( $post_type ) ) {
408
                    unset( $post_types[ $post_type ] );
409
410
                    continue;
411
                }
412
                elseif ( 0 === strpos( $post_type, '_pods_' ) && apply_filters( 'pods_pick_ignore_internal', true ) ) {
413
                    unset( $post_types[ $post_type ] );
414
415
                    continue;
416
                }
417
418
                $post_type = get_post_type_object( $post_type );
419
420
                self::$related_objects[ 'post_type-' . $post_type->name ] = array(
421
                    'label' => $post_type->label . ' (' . $post_type->name . ')',
422
                    'group' => __( 'Post Types', 'pods' ),
423
                    'bidirectional' => true
424
                );
425
            }
426
427
            // Taxonomies
428
            $taxonomies = get_taxonomies();
@@ 433-460 (lines=28) @@
430
431
            $ignore = array( 'nav_menu', 'post_format' );
432
433
            foreach ( $taxonomies as $taxonomy => $label ) {
434
                if ( in_array( $taxonomy, $ignore ) || empty( $taxonomy ) ) {
435
                    unset( $taxonomies[ $taxonomy ] );
436
437
                    continue;
438
                }
439
440
				/**
441
				 * Prevent ability to extend core Pods content types.
442
				 *
443
				 * @param bool. Default is true, when set to false Pods internal content types can not be extended.
444
				 *
445
				 * @since 2.3.19
446
				 */
447
				elseif ( 0 === strpos( $taxonomy, '_pods_' ) && apply_filters( 'pods_pick_ignore_internal', true ) ) {
448
                    unset( $taxonomies[ $taxonomy ] );
449
450
                    continue;
451
                }
452
453
                $taxonomy = get_taxonomy( $taxonomy );
454
455
                self::$related_objects[ 'taxonomy-' . $taxonomy->name ] = array(
456
                    'label' => $taxonomy->label . ' (' . $taxonomy->name . ')',
457
                    'group' => __( 'Taxonomies', 'pods' ),
458
                    'bidirectional' => true
459
                );
460
            }
461
462
            // Other WP Objects
463
            self::$related_objects[ 'user' ] = array(