| @@ -39,13 +39,11 @@ | ||
| 39 | 39 | global $wpdb; |
| 40 | 40 | $table = $wpdb->prefix . WOW_Plugin::PREFIX; |
| 41 | 41 | |
| 42 | 42 | return $wpdb->delete( $table, [ 'id' => $id ], [ '%d' ] ); |
| 43 | - | |
| 44 | 43 | } |
| 45 | 44 | |
| 46 | 45 | public static function create( $columns ): void { |
| 47 | - | |
| 48 | 46 | global $wpdb; |
| 49 | 47 | $table = $wpdb->prefix . WOW_Plugin::PREFIX; |
| 50 | 48 | |
| 51 | 49 | $sql = "CREATE TABLE IF NOT EXISTS $table ($columns) DEFAULT CHARACTER SET {$wpdb->charset} COLLATE {$wpdb->collate};"; |
| @@ -85,8 +83,12 @@ | ||
| 85 | 83 | return $wpdb->get_row( $query ); |
| 86 | 84 | } |
| 87 | 85 | |
| 88 | 86 | public static function update( $data, $where, $data_formats ): void { |
| 87 | + if(! current_user_can( 'unfiltered_html' )) { | |
| 88 | + return; | |
| 89 | + } | |
| 90 | + | |
| 89 | 91 | global $wpdb; |
| 90 | 92 | $table = $wpdb->prefix . WOW_Plugin::PREFIX; |
| 91 | 93 | $result = $wpdb->update( $table, $data, $where, $data_formats ); |
| 92 | 94 | } |
| @@ -91,16 +93,21 @@ | ||
| 91 | 93 | $result = $wpdb->update( $table, $data, $where, $data_formats ); |
| 92 | 94 | } |
| 93 | 95 | |
| 94 | 96 | public static function insert( $data, $data_formats ) { |
| 97 | + | |
| 98 | + if(! current_user_can( 'unfiltered_html' )) { | |
| 99 | + return false; | |
| 100 | + } | |
| 101 | + | |
| 95 | 102 | global $wpdb; |
| 96 | 103 | $table = $wpdb->prefix . WOW_Plugin::PREFIX; |
| 97 | 104 | |
| 105 | + | |
| 98 | 106 | $result = $wpdb->insert( $table, $data, $data_formats ); |
| 99 | 107 | |
| 100 | 108 | if ( $result ) { |
| 101 | 109 | return $wpdb->insert_id; |
| 102 | - | |
| 103 | 110 | } |
| 104 | 111 | |
| 105 | 112 | return false; |
| 106 | 113 | } |