| @@ -151,13 +151,12 @@ | ||
| 151 | 151 | if(!current_user_can( 'install_plugins' )) { |
| 152 | 152 | wp_send_json_error(__('you are not allowed to do this action', 'betterdocs')); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - $slug = isset( $_POST['slug'] ) ? sanitize_text_field( wp_unslash( $_POST['slug'] ) ) : ''; | |
| 155 | + $slug = isset( $_POST['slug'] ) ? sanitize_text_field( $_POST['slug'] ) : ''; | |
| 156 | 156 | $result = $this->install_plugin( $slug ); |
| 157 | 157 | |
| 158 | - $promotype = isset( $_POST['promotype'] ) ? sanitize_text_field( wp_unslash( $_POST['promotype'] ) ) : ''; | |
| 159 | - if ( 'eb-banner' === $promotype ) { | |
| 158 | + if( isset( $_POST['promotype'] ) && 'eb-banner' === $_POST['promotype'] ) { | |
| 160 | 159 | wp_remote_get( 'https://essential-addons.com/essential-blocks-install-gutenberg' ); |
| 161 | 160 | } |
| 162 | 161 | |
| 163 | 162 | if ( is_wp_error( $result ) ) { |
| @@ -174,9 +173,9 @@ | ||
| 174 | 173 | if(!current_user_can( 'update_plugins' )) { |
| 175 | 174 | wp_send_json_error(__('you are not allowed to do this action', 'betterdocs')); |
| 176 | 175 | } |
| 177 | 176 | |
| 178 | - $basename = isset( $_POST['basename'] ) ? sanitize_text_field( wp_unslash( $_POST['basename'] ) ) : ''; | |
| 177 | + $basename = isset( $_POST['basename'] ) ? sanitize_text_field( $_POST['basename'] ) : ''; | |
| 179 | 178 | $result = $this->upgrade_plugin( $basename ); |
| 180 | 179 | |
| 181 | 180 | if (is_wp_error($result)) { |
| 182 | 181 | wp_send_json_error($result->get_error_message()); |
| @@ -193,9 +192,9 @@ | ||
| 193 | 192 | if(!current_user_can( 'activate_plugins' )) { |
| 194 | 193 | wp_send_json_error(__('you are not allowed to do this action', 'betterdocs')); |
| 195 | 194 | } |
| 196 | 195 | |
| 197 | - $basename = isset( $_POST['basename'] ) ? sanitize_text_field( wp_unslash( $_POST['basename'] ) ) : ''; | |
| 196 | + $basename = isset( $_POST['basename'] ) ? sanitize_text_field( $_POST['basename'] ) : ''; | |
| 198 | 197 | $result = activate_plugin( $basename, '', false, true ); |
| 199 | 198 | |
| 200 | 199 | if ( is_wp_error( $result ) ) { |
| 201 | 200 | wp_send_json_error( $result->get_error_message() ); |
| @@ -214,9 +213,9 @@ | ||
| 214 | 213 | if ( ! current_user_can( 'activate_plugins' ) ) { |
| 215 | 214 | wp_send_json_error( __( 'you are not allowed to do this action', 'betterdocs' ) ); |
| 216 | 215 | } |
| 217 | 216 | |
| 218 | - $basename = isset( $_POST['basename'] ) ? sanitize_text_field( wp_unslash( $_POST['basename'] ) ) : ''; | |
| 217 | + $basename = isset( $_POST['basename'] ) ? sanitize_text_field( $_POST['basename'] ) : ''; | |
| 219 | 218 | deactivate_plugins( $basename, true ); |
| 220 | 219 | |
| 221 | 220 | wp_send_json_success( __( 'Plugin is deactivated successfully!', 'betterdocs' ) ); |
| 222 | 221 | } |
| @@ -223,10 +222,9 @@ | ||
| 223 | 222 | |
| 224 | 223 | public function ajax_auto_active_even_not_installed() { |
| 225 | 224 | check_ajax_referer( 'betterdocs-wpdeveloper-plugins', 'security' ); |
| 226 | 225 | |
| 227 | - $basename = isset( $_POST['basename'] ) ? sanitize_text_field( wp_unslash( $_POST['basename'] ) ) : ''; | |
| 228 | - if ( $this->get_local_plugin_data( $basename ) === false ) { | |
| 226 | + if ( $this->get_local_plugin_data( $_POST['basename'] ) === false ) { | |
| 229 | 227 | $this->ajax_install_plugin(); |
| 230 | 228 | } else { |
| 231 | 229 | $this->ajax_activate_plugin(); |
| 232 | 230 | } |