Code Duplication    Length = 25-25 lines in 2 locations

classes/PodsAPI.php 2 locations

@@ 7438-7462 (lines=25) @@
7435
		    $info[ 'orderby' ] = '`t`.`menu_order`, `t`.`' . $info[ 'field_index' ] . '`, `t`.`post_date`';
7436
7437
		    // WPML support
7438
		    if ( is_object( $sitepress ) && $sitepress->is_translated_post_type( $post_type ) && !$icl_adjust_id_url_filter_off ) {
7439
			    $info[ 'join' ][ 'wpml_translations' ] = "
7440
                        LEFT JOIN `{$wpdb->prefix}icl_translations` AS `wpml_translations`
7441
                            ON `wpml_translations`.`element_id` = `t`.`ID`
7442
                                AND `wpml_translations`.`element_type` = 'post_{$post_type}'
7443
                                AND `wpml_translations`.`language_code` = '{$current_language}'
7444
                    ";
7445
7446
			    $info[ 'join' ][ 'wpml_languages' ] = "
7447
                        LEFT JOIN `{$wpdb->prefix}icl_languages` AS `wpml_languages`
7448
                            ON `wpml_languages`.`code` = `wpml_translations`.`language_code` AND `wpml_languages`.`active` = 1
7449
                    ";
7450
7451
			    $info[ 'where' ][ 'wpml_languages' ] = "`wpml_languages`.`code` IS NOT NULL";
7452
		    }
7453
		    // Polylang support
7454
		    elseif( is_object( $polylang ) && !empty( $current_language ) && function_exists( 'pll_is_translated_post_type' ) && pll_is_translated_post_type( $post_type ) ) {
7455
			    $info[ 'join' ][ 'polylang_languages' ] = "
7456
                        LEFT JOIN `{$wpdb->term_relationships}` AS `polylang_languages`
7457
                            ON `polylang_languages`.`object_id` = `t`.`ID`
7458
                                AND `polylang_languages`.`term_taxonomy_id` = {$current_language_tt_id}
7459
                    ";
7460
7461
			    $info[ 'where' ][ 'polylang_languages' ] = "`polylang_languages`.`object_id` IS NOT NULL";
7462
		    }
7463
7464
		    $info[ 'object_fields' ] = $this->get_wp_object_fields( $object_type, $info[ 'pod' ] );
7465
	    }
@@ 7516-7540 (lines=25) @@
7513
		    );
7514
7515
		    // WPML Support
7516
		    if ( is_object( $sitepress ) && $sitepress->is_translated_taxonomy( $taxonomy ) && !$icl_adjust_id_url_filter_off ) {
7517
			    $info[ 'join' ][ 'wpml_translations' ] = "
7518
                        LEFT JOIN `{$wpdb->prefix}icl_translations` AS `wpml_translations`
7519
                            ON `wpml_translations`.`element_id` = `tt`.`term_taxonomy_id`
7520
                                AND `wpml_translations`.`element_type` = 'tax_{$taxonomy}'
7521
                                AND `wpml_translations`.`language_code` = '{$current_language}'
7522
                    ";
7523
7524
			    $info[ 'join' ][ 'wpml_languages' ] = "
7525
                        LEFT JOIN `{$wpdb->prefix}icl_languages` AS `wpml_languages`
7526
                            ON `wpml_languages`.`code` = `wpml_translations`.`language_code` AND `wpml_languages`.`active` = 1
7527
                    ";
7528
7529
			    $info[ 'where' ][ 'wpml_languages' ] = "`wpml_languages`.`code` IS NOT NULL";
7530
		    }
7531
		    // Polylang support
7532
		    elseif ( is_object( $polylang ) && !empty( $current_language ) && function_exists( 'pll_is_translated_taxonomy' ) && pll_is_translated_taxonomy( $taxonomy ) ) {
7533
			    $info[ 'join' ][ 'polylang_languages' ] = "
7534
                        LEFT JOIN `{$wpdb->termmeta}` AS `polylang_languages`
7535
                            ON `polylang_languages`.`term_id` = `t`.`term_id`
7536
                                AND `polylang_languages`.`meta_value` = {$current_language_t_id}
7537
                    ";
7538
7539
			    $info[ 'where' ][ 'polylang_languages' ] = "`polylang_languages`.`term_id` IS NOT NULL";
7540
		    }
7541
7542
		    $info[ 'object_fields' ] = $this->get_wp_object_fields( $object_type, $info[ 'pod' ] );
7543
	    }