| @@ -392,10 +392,30 @@ | ||
| 392 | 392 | $query[] = 'INNER JOIN ' . $wpdb->prefix . 'frm_items e ON (e.id=it.item_id)'; |
| 393 | 393 | if ( is_array( $where ) ) { |
| 394 | 394 | if ( ! $args['is_draft'] ) { |
| 395 | 395 | $where['e.is_draft'] = 0; |
| 396 | - } elseif ( $args['is_draft'] == 1 ) { | |
| 397 | - $where['e.is_draft'] = 1; | |
| 396 | + } elseif ( is_numeric( $args['is_draft'] ) ) { | |
| 397 | + if ( class_exists( 'FrmAbandonmentHooksController', false ) ) { | |
| 398 | + $where['e.is_draft'] = absint( $args['is_draft'] ); | |
| 399 | + } else { | |
| 400 | + $where['e.is_draft'] = 1; | |
| 401 | + } | |
| 402 | + } elseif ( 'both' === $args['is_draft'] && class_exists( 'FrmAbandonmentHooksController', false ) ) { | |
| 403 | + $where['e.is_draft'] = array( 0, 1 ); | |
| 404 | + } elseif ( false !== strpos( $args['is_draft'], ',' ) ) { | |
| 405 | + $is_draft = array_reduce( | |
| 406 | + explode( ',', $args['is_draft'] ), | |
| 407 | + function( $total, $current ) { | |
| 408 | + if ( is_numeric( $current ) ) { | |
| 409 | + $total[] = absint( $current ); | |
| 410 | + } | |
| 411 | + return $total; | |
| 412 | + }, | |
| 413 | + array() | |
| 414 | + ); | |
| 415 | + if ( $is_draft ) { | |
| 416 | + $where['e.is_draft'] = $is_draft; | |
| 417 | + } | |
| 398 | 418 | } |
| 399 | 419 | |
| 400 | 420 | if ( ! empty( $args['user_id'] ) ) { |
| 401 | 421 | $where['e.user_id'] = $args['user_id']; |