LLMS_Voucher::is_code_duplicate( string[] $codes )
Dupcheck generated voucher codes.
Parameters Parameters
- $codes
-
(string[]) (Required) Array of voucher code strings.
Return Return
(boolean)
Source Source
File: includes/class.llms.voucher.php
public function is_code_duplicate( $codes ) { global $wpdb; $codes_as_string = join( '","', $codes ); // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared $codes = $wpdb->get_results( $wpdb->prepare( "SELECT code FROM {$this->get_codes_table_name()} WHERE code IN ( {$codes_as_string} ) AND voucher_id != %d", array( $this->id ) ), ARRAY_A ); // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared if ( count( $codes ) ) { return $codes; } return false; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.35.0 | Prepare SQL. |
2.0.0 | Introduced. |