Skip to content

Commit

Permalink
Codacy security fixes.
Browse files Browse the repository at this point in the history
Security fixes suggested by codacy. Codacy code reviewed and badge added.
  • Loading branch information
amostajo committed Oct 25, 2019
1 parent 6c531bc commit 976069b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Latest Stable Version](https://poser.pugx.org/10quality/wp-query-builder/v/stable)](https://packagist.org/packages/10quality/wp-query-builder)
[![Total Downloads](https://poser.pugx.org/10quality/wp-query-builder/downloads)](https://packagist.org/packages/10quality/wp-query-builder)
[![License](https://poser.pugx.org/10quality/wp-query-builder/license)](https://packagist.org/packages/10quality/wp-query-builder)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/549d3f322a0a4eafa0ea2f4c6206a9b1)](https://www.codacy.com/manual/amostajo/wp-query-builder?utm_source=github.com&utm_medium=referral&utm_content=10quality/wp-query-builder&utm_campaign=Badge_Grade)

Provides a Query Builder class built over Wordpress core Database class accessor. Usability is similar to Laravel's Eloquent.

Expand Down
8 changes: 4 additions & 4 deletions src/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @author 10 Quality <[email protected]>
* @license MIT
* @package wp-query-builder
* @version 1.0.5
* @version 1.0.5.1
*/
class QueryBuilder
{
Expand Down Expand Up @@ -141,7 +141,7 @@ public function where( $args )
? [$arg_value]
: [
$key,
is_array( $value ) && isset( $value['operator'] ) ? $value['operator'] : ( is_null( $arg_value ) ? 'is' : '=' ),
is_array( $value ) && isset( $value['operator'] ) ? $value['operator'] : ( $arg_value === null ? 'is' : '=' ),
is_array( $value ) && isset( $value['key'] )
? '`' . $value['key'] . '`'
: ( is_array( $arg_value )
Expand Down Expand Up @@ -189,12 +189,12 @@ public function join( $table, $args, $left = false, $add_prefix = true )
? $argument['raw']
: implode( ' ', [
isset( $argument['key_a'] ) ? $argument['key_a'] : $argument['key'],
isset( $argument['operator'] ) ? $argument['operator'] : ( is_null( $arg_value ) && ! isset( $argument['key_b'] ) ? 'is' : '=' ),
isset( $argument['operator'] ) ? $argument['operator'] : ( $arg_value === null && ! isset( $argument['key_b'] ) ? 'is' : '=' ),
isset( $argument['key_b'] )
? $argument['key_b']
: ( is_array( $arg_value )
? ( '(\'' . implode( '\',\'', $arg_value ) . '\')' )
: ( is_null( $arg_value )
: ( $arg_value === null
? 'null'
: $wpdb->prepare( is_numeric( $arg_value ) ? '%d' : '%s' , $arg_value )
)
Expand Down

0 comments on commit 976069b

Please sign in to comment.