Code Duplication    Length = 25-25 lines in 2 locations

classes/PodsAPI.php 2 locations

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