Code Duplication    Length = 2-2 lines in 4 locations

classes/PodsAPI.php 4 locations

@@ 8046-8047 (lines=2) @@
8043
                            if ( in_array( $type, PodsForm::file_field_types() ) || 'media' == $pick_object ) {
8044
                                $where = "`guid` = '" . pods_sanitize( $pick_value ) . "'";
8045
8046
                                if ( 0 < pods_absint( $pick_value ) && false !== $numeric_mode )
8047
                                    $where = "`ID` = " . pods_absint( $pick_value );
8048
8049
                                $result = pods_query( "SELECT `ID` AS `id` FROM `{$wpdb->posts}` WHERE `post_type` = 'attachment' AND {$where} ORDER BY `ID`", $this );
8050
@@ 8071-8072 (lines=2) @@
8068
                                if ( in_array( 'taxonomy', array( $pick_object, $related_pod[ 'type' ] ) ) ) {
8069
                                    $where = "`t`.`name` = '" . pods_sanitize( $pick_value ) . "'";
8070
8071
                                    if ( 0 < pods_absint( $pick_value ) && false !== $numeric_mode )
8072
                                        $where = "`tt`.`term_id` = " . pods_absint( $pick_value );
8073
8074
                                    $result = pods_query( "SELECT `t`.`term_id` AS `id` FROM `{$wpdb->term_taxonomy}` AS `tt` LEFT JOIN `{$wpdb->terms}` AS `t` ON `t`.`term_id` = `tt`.`term_id` WHERE `taxonomy` = '{$pick_val}' AND {$where} ORDER BY `t`.`term_id`", $this );
8075
@@ 8082-8083 (lines=2) @@
8079
                                elseif ( in_array( 'post_type', array( $pick_object, $related_pod[ 'type' ] ) ) || in_array( 'media', array( $pick_object, $related_pod[ 'type' ] ) ) ) {
8080
                                    $where = "`post_title` = '" . pods_sanitize( $pick_value ) . "'";
8081
8082
                                    if ( 0 < pods_absint( $pick_value ) && false !== $numeric_mode )
8083
                                        $where = "`ID` = " . pods_absint( $pick_value );
8084
8085
                                    $result = pods_query( "SELECT `ID` AS `id` FROM `{$wpdb->posts}` WHERE `post_type` = '{$pick_val}' AND {$where} ORDER BY `ID`", $this );
8086
@@ 8093-8094 (lines=2) @@
8090
                                elseif ( in_array( 'user', array( $pick_object, $related_pod[ 'type' ] ) ) ) {
8091
                                    $where = "`user_login` = '" . pods_sanitize( $pick_value ) . "'";
8092
8093
                                    if ( 0 < pods_absint( $pick_value ) && false !== $numeric_mode )
8094
                                        $where = "`ID` = " . pods_absint( $pick_value );
8095
8096
                                    $result = pods_query( "SELECT `ID` AS `id` FROM `{$wpdb->users}` WHERE {$where} ORDER BY `ID`", $this );
8097