File tree Expand file tree Collapse file tree 2 files changed +8
-15
lines changed
plugins/wpgraphql-logging/src Expand file tree Collapse file tree 2 files changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ public function process_bulk_action(): void {
128128 $ nonce_action = 'bulk- ' . $ this ->_args ['plural ' ];
129129 $ nonce = $ _REQUEST ['_wpnonce ' ] ?? '' ;
130130
131- if ( ! wp_verify_nonce ( $ nonce , $ nonce_action ) ) {
131+ if ( false === wp_verify_nonce ( $ nonce , $ nonce_action ) ) {
132132 wp_die ( esc_html__ ( 'Nonce verification failed! ' , 'wpgraphql-logging ' ) );
133133 }
134134
@@ -449,6 +449,7 @@ protected function get_sortable_columns(): array {
449449 * @param string $which The location of the nav ('top' or 'bottom').
450450 */
451451 protected function display_tablenav ( $ which ): void {
452+ $ which_position = ( 'top ' === $ which ) ? 'top ' : 'bottom ' ;
452453 ?>
453454 <div class="tablenav <?php echo esc_attr ( $ which ); ?> ">
454455 <?php if ( 'top ' === $ which ) : ?>
@@ -457,12 +458,12 @@ protected function display_tablenav( $which ): void {
457458 <?php endif ; ?>
458459
459460 <div class="alignleft actions bulkactions">
460- <?php $ this ->bulk_actions ( $ which ); ?>
461+ <?php $ this ->bulk_actions ( $ which_position ); ?>
461462 </div>
462463
463464 <?php
464465 $ this ->extra_tablenav ( $ which );
465- $ this ->pagination ( $ which );
466+ $ this ->pagination ( $ which_position );
466467 ?>
467468
468469 <br class="clear" />
Original file line number Diff line number Diff line change @@ -112,20 +112,12 @@ public function delete(int $id): bool {
112112 /**
113113 * Delete all log entries.
114114 *
115- * @return bool True if all logs were deleted successfully, false otherwise.
115+ * @return void
116116 */
117117 public function delete_all (): void {
118118 global $ wpdb ;
119-
120- if ( isset ( $ this ->table ) && ! empty ( $ this ->table ) ) {
121- $ table = $ this ->table ;
122- } else {
123- $ table = $ wpdb ->prefix . 'wpgraphql_logging ' ;
124- }
125- $ table_quoted = "` " . str_replace ( "` " , "`` " , $ table ) . "` " ;
126- $ sql = "TRUNCATE TABLE {$ table_quoted }" ;
127-
128- // Execute
129- $ wpdb ->query ( $ sql );
119+ // Use DatabaseEntity::get_table_name() to get the table name
120+ $ table_name = DatabaseEntity::get_table_name ();
121+ $ wpdb ->query ( "DELETE FROM {$ table_name }" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
130122 }
131123}
You can’t perform that action at this time.
0 commit comments