Code Duplication    Length = 2-2 lines in 4 locations

classes/PodsAPI.php 4 locations

@@ 8107-8108 (lines=2) @@
8104
                            if ( in_array( $type, PodsForm::file_field_types() ) || 'media' == $pick_object ) {
8105
                                $where = "`guid` = '" . pods_sanitize( $pick_value ) . "'";
8106
8107
                                if ( 0 < pods_absint( $pick_value ) && false !== $numeric_mode )
8108
                                    $where = "`ID` = " . pods_absint( $pick_value );
8109
8110
                                $result = pods_query( "SELECT `ID` AS `id` FROM `{$wpdb->posts}` WHERE `post_type` = 'attachment' AND {$where} ORDER BY `ID`", $this );
8111
@@ 8132-8133 (lines=2) @@
8129
                                if ( in_array( 'taxonomy', array( $pick_object, $related_pod[ 'type' ] ) ) ) {
8130
                                    $where = "`t`.`name` = '" . pods_sanitize( $pick_value ) . "'";
8131
8132
                                    if ( 0 < pods_absint( $pick_value ) && false !== $numeric_mode )
8133
                                        $where = "`tt`.`term_id` = " . pods_absint( $pick_value );
8134
8135
                                    $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 );
8136
@@ 8143-8144 (lines=2) @@
8140
                                elseif ( in_array( 'post_type', array( $pick_object, $related_pod[ 'type' ] ) ) || in_array( 'media', array( $pick_object, $related_pod[ 'type' ] ) ) ) {
8141
                                    $where = "`post_title` = '" . pods_sanitize( $pick_value ) . "'";
8142
8143
                                    if ( 0 < pods_absint( $pick_value ) && false !== $numeric_mode )
8144
                                        $where = "`ID` = " . pods_absint( $pick_value );
8145
8146
                                    $result = pods_query( "SELECT `ID` AS `id` FROM `{$wpdb->posts}` WHERE `post_type` = '{$pick_val}' AND {$where} ORDER BY `ID` LIMIT 1", $this );
8147
@@ 8154-8155 (lines=2) @@
8151
                                elseif ( in_array( 'user', array( $pick_object, $related_pod[ 'type' ] ) ) ) {
8152
                                    $where = "`user_login` = '" . pods_sanitize( $pick_value ) . "'";
8153
8154
                                    if ( 0 < pods_absint( $pick_value ) && false !== $numeric_mode )
8155
                                        $where = "`ID` = " . pods_absint( $pick_value );
8156
8157
                                    $result = pods_query( "SELECT `ID` AS `id` FROM `{$wpdb->users}` WHERE {$where} ORDER BY `ID` LIMIT 1", $this );
8158