← All changes
|
WPDataAccess/Plugin_Table_Models/WPDA_Publisher_Model.php
+9
-18
5.5.76
→
5.5.84
View file →
| @@ -29,18 +29,15 @@ | ||
| 29 | 29 | * @return bool|array |
| 30 | 30 | */ |
| 31 | 31 | public static function get_publication( $pub_id ) { |
| 32 | 32 | global $wpdb; |
| 33 | + // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders -- plugin table | |
| 33 | 34 | $dataset = $wpdb->get_results( |
| 34 | - $wpdb->prepare( | |
| 35 | - 'SELECT * FROM `%1s` WHERE pub_id = %d', | |
| 36 | - // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders | |
| 37 | - array(WPDA::remove_backticks( self::get_base_table_name() ), $pub_id) | |
| 38 | - ), | |
| 35 | + $wpdb->prepare( 'SELECT * FROM `%1s` WHERE pub_id = %d', array(WPDA::remove_backticks( self::get_base_table_name() ), $pub_id) ), | |
| 39 | 36 | // db call ok; no-cache ok. |
| 40 | 37 | 'ARRAY_A' |
| 41 | 38 | ); |
| 42 | - // phpcs:ignore Standard.Category.SniffName.ErrorCode | |
| 39 | + // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders | |
| 43 | 40 | return ( 1 === $wpdb->num_rows ? $dataset : false ); |
| 44 | 41 | } |
| 45 | 42 | |
| 46 | 43 | /** |
| @@ -51,33 +48,27 @@ | ||
| 51 | 48 | * @return bool|array |
| 52 | 49 | */ |
| 53 | 50 | public static function get_publication_by_name( $pub_name ) { |
| 54 | 51 | global $wpdb; |
| 52 | + // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders -- plugin table | |
| 55 | 53 | $dataset = $wpdb->get_results( |
| 56 | - $wpdb->prepare( | |
| 57 | - 'SELECT * FROM `%1s` WHERE pub_name = %s', | |
| 58 | - // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders | |
| 59 | - array(WPDA::remove_backticks( self::get_base_table_name() ), $pub_name) | |
| 60 | - ), | |
| 54 | + $wpdb->prepare( 'SELECT * FROM `%1s` WHERE pub_name = %s', array(WPDA::remove_backticks( self::get_base_table_name() ), $pub_name) ), | |
| 61 | 55 | // db call ok; no-cache ok. |
| 62 | 56 | 'ARRAY_A' |
| 63 | 57 | ); |
| 64 | - // phpcs:ignore Standard.Category.SniffName.ErrorCode | |
| 58 | + // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders | |
| 65 | 59 | return ( 1 === $wpdb->num_rows ? $dataset : false ); |
| 66 | 60 | } |
| 67 | 61 | |
| 68 | 62 | public static function get_publication_list() { |
| 69 | 63 | global $wpdb; |
| 64 | + // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders -- plugin table | |
| 70 | 65 | return $wpdb->get_results( |
| 71 | - $wpdb->prepare( | |
| 72 | - 'SELECT * FROM `%1s` ORDER BY pub_name', | |
| 73 | - // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders | |
| 74 | - array(WPDA::remove_backticks( self::get_base_table_name() )) | |
| 75 | - ), | |
| 66 | + $wpdb->prepare( 'SELECT * FROM `%1s` ORDER BY pub_name', array(WPDA::remove_backticks( self::get_base_table_name() )) ), | |
| 76 | 67 | // db call ok; no-cache ok. |
| 77 | 68 | 'ARRAY_A' |
| 78 | 69 | ); |
| 79 | - // phpcs:ignore Standard.Category.SniffName.ErrorCode | |
| 70 | + // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders | |
| 80 | 71 | } |
| 81 | 72 | |
| 82 | 73 | public static function get_temporary_table_from_custom_query( $database, $query ) { |
| 83 | 74 | $response = array( |