Code Duplication    Length = 2-2 lines in 4 locations

classes/PodsAPI.php 4 locations

@@ 8140-8141 (lines=2) @@
8137
                            if ( in_array( $type, PodsForm::file_field_types() ) || 'media' == $pick_object ) {
8138
                                $where = "`guid` = '" . pods_sanitize( $pick_value ) . "'";
8139
8140
                                if ( 0 < pods_absint( $pick_value ) && false !== $numeric_mode )
8141
                                    $where = "`ID` = " . pods_absint( $pick_value );
8142
8143
                                $result = pods_query( "SELECT `ID` AS `id` FROM `{$wpdb->posts}` WHERE `post_type` = 'attachment' AND {$where} ORDER BY `ID`", $this );
8144
@@ 8165-8166 (lines=2) @@
8162
                                if ( in_array( 'taxonomy', array( $pick_object, $related_pod[ 'type' ] ) ) ) {
8163
                                    $where = "`t`.`name` = '" . pods_sanitize( $pick_value ) . "'";
8164
8165
                                    if ( 0 < pods_absint( $pick_value ) && false !== $numeric_mode )
8166
                                        $where = "`tt`.`term_id` = " . pods_absint( $pick_value );
8167
8168
                                    $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` LIMIT 1", $this );
8169
@@ 8176-8177 (lines=2) @@
8173
                                elseif ( in_array( 'post_type', array( $pick_object, $related_pod[ 'type' ] ) ) || in_array( 'media', array( $pick_object, $related_pod[ 'type' ] ) ) ) {
8174
                                    $where = "`post_title` = '" . pods_sanitize( $pick_value ) . "'";
8175
8176
                                    if ( 0 < pods_absint( $pick_value ) && false !== $numeric_mode )
8177
                                        $where = "`ID` = " . pods_absint( $pick_value );
8178
8179
                                    $result = pods_query( "SELECT `ID` AS `id` FROM `{$wpdb->posts}` WHERE `post_type` = '{$pick_val}' AND {$where} ORDER BY `ID` LIMIT 1", $this );
8180
@@ 8187-8188 (lines=2) @@
8184
                                elseif ( in_array( 'user', array( $pick_object, $related_pod[ 'type' ] ) ) ) {
8185
                                    $where = "`user_login` = '" . pods_sanitize( $pick_value ) . "'";
8186
8187
                                    if ( 0 < pods_absint( $pick_value ) && false !== $numeric_mode )
8188
                                        $where = "`ID` = " . pods_absint( $pick_value );
8189
8190
                                    $result = pods_query( "SELECT `ID` AS `id` FROM `{$wpdb->users}` WHERE {$where} ORDER BY `ID` LIMIT 1", $this );
8191