| @@ -70,14 +70,8 @@ | ||
| 70 | 70 | |
| 71 | 71 | $this->db_version = $this->get_db_version(); |
| 72 | 72 | $this->stream_url = self_admin_url( $this->plugin->admin->admin_parent_page . '&page=' . $this->plugin->admin->settings_page_slug ); |
| 73 | 73 | |
| 74 | - // Ensure the tables are created even when the plugin activation hook does not run, | |
| 75 | - // and run the check in WP Admin or on WP CLI to avoid extra frontend load. | |
| 76 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { | |
| 77 | - $this->check(); | |
| 78 | - } | |
| 79 | - | |
| 80 | 74 | register_activation_hook( $this->plugin->locations['plugin'], array( $this, 'check' ) ); |
| 81 | 75 | } |
| 82 | 76 | |
| 83 | 77 | /** |
| @@ -101,14 +95,10 @@ | ||
| 101 | 95 | return; |
| 102 | 96 | } |
| 103 | 97 | |
| 104 | 98 | $update = null; |
| 105 | - if ( | |
| 106 | - isset( $_REQUEST['wp_stream_update'], $_REQUEST['_wpnonce'] ) | |
| 107 | - && | |
| 108 | - wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'wp_stream_update_db' ) | |
| 109 | - ) { | |
| 110 | - $update = sanitize_key( wp_unslash( $_REQUEST['wp_stream_update'] ) ); | |
| 99 | + if ( isset( $_REQUEST['wp_stream_update'] ) && wp_verify_nonce( 'wp_stream_update_db' ) ) { | |
| 100 | + $update = esc_attr( $_REQUEST['wp_stream_update'] ); | |
| 111 | 101 | } |
| 112 | 102 | |
| 113 | 103 | if ( ! $update ) { |
| 114 | 104 | $this->update_required = true; |
| @@ -224,14 +214,10 @@ | ||
| 224 | 214 | return; |
| 225 | 215 | } |
| 226 | 216 | |
| 227 | 217 | $update = null; |
| 228 | - if ( | |
| 229 | - isset( $_REQUEST['wp_stream_update'], $_REQUEST['_wpnonce'] ) | |
| 230 | - && | |
| 231 | - wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'wp_stream_update_db' ) | |
| 232 | - ) { | |
| 233 | - $update = sanitize_key( wp_unslash( $_REQUEST['wp_stream_update'] ) ); | |
| 218 | + if ( isset( $_REQUEST['wp_stream_update'] ) && wp_verify_nonce( 'wp_stream_update_db' ) ) { | |
| 219 | + $update = esc_attr( $_REQUEST['wp_stream_update'] ); | |
| 234 | 220 | } |
| 235 | 221 | |
| 236 | 222 | if ( ! $update ) { |
| 237 | 223 | $this->prompt_update(); |