Code Duplication    Length = 25-25 lines in 2 locations

classes/PodsAPI.php 2 locations

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