| @@ -60,13 +60,13 @@ | ||
| 60 | 60 | */ |
| 61 | 61 | public function handle_heartbeat_requests($action) { |
| 62 | 62 | $this->set_heartbeat_subaction($action); |
| 63 | 63 | |
| 64 | - if (!$this->is_user_capable()) { | |
| 64 | + if (!WP_Optimize()->current_user_can()) { | |
| 65 | 65 | return wp_json_encode($this->send_user_capability_error_response(false)); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if (is_multisite() && !current_user_can('manage_network_options')) { | |
| 68 | + if (is_multisite() && !WP_Optimize()->current_user_can('manage_network_options')) { | |
| 69 | 69 | if (!$this->is_valid_multisite_command()) { |
| 70 | 70 | return wp_json_encode($this->send_invalid_multisite_command_error_response(false)); |
| 71 | 71 | } |
| 72 | 72 | } |
| @@ -105,13 +105,13 @@ | ||
| 105 | 105 | if (!$this->is_valid_request()) { |
| 106 | 106 | $this->send_security_check_failed_error_response(); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if (!$this->is_user_capable()) { | |
| 109 | + if (!WP_Optimize()->current_user_can()) { | |
| 110 | 110 | $this->send_user_capability_error_response(); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if (is_multisite() && !current_user_can('manage_network_options')) { | |
| 113 | + if (is_multisite() && !WP_Optimize()->current_user_can('manage_network_options')) { | |
| 114 | 114 | if (!$this->is_valid_multisite_command()) { |
| 115 | 115 | $this->send_invalid_multisite_command_error_response(); |
| 116 | 116 | } |
| 117 | 117 | } |
| @@ -189,18 +189,8 @@ | ||
| 189 | 189 | 'result' => false, |
| 190 | 190 | 'error_code' => 'security_check', |
| 191 | 191 | 'error_message' => __('The security check failed; try refreshing the page.', 'wp-optimize') |
| 192 | 192 | )); |
| 193 | - } | |
| 194 | - | |
| 195 | - | |
| 196 | - /** | |
| 197 | - * Checks whether current user capable of doing this action or not | |
| 198 | - * | |
| 199 | - * @return bool | |
| 200 | - */ | |
| 201 | - private function is_user_capable() { | |
| 202 | - return current_user_can(WP_Optimize()->capability_required()); | |
| 203 | 193 | } |
| 204 | 194 | |
| 205 | 195 | /** |
| 206 | 196 | * Send user capability check failed error response to browser and possibly die |