Code Duplication    Length = 2-2 lines in 4 locations

classes/PodsAPI.php 4 locations

@@ 8198-8199 (lines=2) @@
8195
                            if ( in_array( $type, PodsForm::file_field_types() ) || 'media' == $pick_object ) {
8196
                                $where = "`guid` = '" . pods_sanitize( $pick_value ) . "'";
8197
8198
                                if ( 0 < pods_absint( $pick_value ) && false !== $numeric_mode )
8199
                                    $where = "`ID` = " . pods_absint( $pick_value );
8200
8201
                                $result = pods_query( "SELECT `ID` AS `id` FROM `{$wpdb->posts}` WHERE `post_type` = 'attachment' AND {$where} ORDER BY `ID`", $this );
8202
@@ 8223-8224 (lines=2) @@
8220
                                if ( in_array( 'taxonomy', array( $pick_object, $related_pod[ 'type' ] ) ) ) {
8221
                                    $where = "`t`.`name` = '" . pods_sanitize( $pick_value ) . "'";
8222
8223
                                    if ( 0 < pods_absint( $pick_value ) && false !== $numeric_mode )
8224
                                        $where = "`tt`.`term_id` = " . pods_absint( $pick_value );
8225
8226
                                    $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 );
8227
@@ 8234-8235 (lines=2) @@
8231
                                elseif ( in_array( 'post_type', array( $pick_object, $related_pod[ 'type' ] ) ) || in_array( 'media', array( $pick_object, $related_pod[ 'type' ] ) ) ) {
8232
                                    $where = "`post_title` = '" . pods_sanitize( $pick_value ) . "'";
8233
8234
                                    if ( 0 < pods_absint( $pick_value ) && false !== $numeric_mode )
8235
                                        $where = "`ID` = " . pods_absint( $pick_value );
8236
8237
                                    $result = pods_query( "SELECT `ID` AS `id` FROM `{$wpdb->posts}` WHERE `post_type` = '{$pick_val}' AND {$where} ORDER BY `ID` LIMIT 1", $this );
8238
@@ 8245-8246 (lines=2) @@
8242
                                elseif ( in_array( 'user', array( $pick_object, $related_pod[ 'type' ] ) ) ) {
8243
                                    $where = "`user_login` = '" . pods_sanitize( $pick_value ) . "'";
8244
8245
                                    if ( 0 < pods_absint( $pick_value ) && false !== $numeric_mode )
8246
                                        $where = "`ID` = " . pods_absint( $pick_value );
8247
8248
                                    $result = pods_query( "SELECT `ID` AS `id` FROM `{$wpdb->users}` WHERE {$where} ORDER BY `ID` LIMIT 1", $this );
8249