Code Duplication    Length = 19-19 lines in 2 locations

classes/fields/pick.php 2 locations

@@ 1678-1696 (lines=19) @@
1675
                            elseif ( 'taxonomy' == $object_type && $sitepress->is_translated_taxonomy( $object ) )
1676
                                $translated = true;
1677
1678
                            if ( $translated ) {
1679
                                $object_id = icl_object_id( $result[ $search_data->field_id ], $object, false, $current_language );
1680
1681
                                if ( 0 < $object_id && !in_array( $object_id, $ids ) ) {
1682
                                    $text = $result[ $search_data->field_index ];
1683
1684
                                    if ( $result[ $search_data->field_id ] != $object_id ) {
1685
                                        if ( $wpdb->posts == $search_data->table )
1686
                                            $text = trim( get_the_title( $object_id ) );
1687
                                        elseif ( $wpdb->terms == $search_data->table )
1688
                                            $text = trim( get_term( $object_id, $object )->name );
1689
                                    }
1690
1691
                                    $result[ $search_data->field_id ] = $object_id;
1692
                                    $result[ $search_data->field_index ] = $text;
1693
                                }
1694
                                else
1695
                                    continue;
1696
                            }
1697
                        }
1698
                        // Polylang integration for Post Types and Taxonomies
1699
                        elseif ( is_object( $polylang ) && in_array( $object_type, array( 'post_type', 'taxonomy' ) ) && method_exists( $polylang, 'get_translation' ) ) {
@@ 1707-1725 (lines=19) @@
1704
                            elseif ( 'taxonomy' == $object_type && pll_is_translated_taxonomy( $object ) )
1705
                                $translated = true;
1706
1707
                            if ( $translated ) {
1708
                                $object_id = $polylang->get_translation( $object, $result[ $search_data->field_id ], $current_language );
1709
1710
                                if ( 0 < $object_id && !in_array( $object_id, $ids ) ) {
1711
                                    $text = $result[ $search_data->field_index ];
1712
1713
                                    if ( $result[ $search_data->field_id ] != $object_id ) {
1714
                                        if ( $wpdb->posts == $search_data->table )
1715
                                            $text = trim( get_the_title( $object_id ) );
1716
                                        elseif ( $wpdb->terms == $search_data->table )
1717
                                            $text = trim( get_term( $object_id, $object )->name );
1718
                                    }
1719
1720
                                    $result[ $search_data->field_id ] = $object_id;
1721
                                    $result[ $search_data->field_index ] = $text;
1722
                                }
1723
                                else
1724
                                    continue;
1725
                            }
1726
                        }
1727
1728
                        if ( 0 < strlen( $display_filter ) ) {