PluginProbe
Patchstack – WordPress & Plugins Security / 2.3.6
Patchstack – WordPress & Plugins Security v2.3.6
2.3.7 trunk 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.17 2.1.18 2.1.19 2.1.2 2.1.20 2.1.21 2.1.22 2.1.23 2.1.24 2.1.25 2.1.3 2.1.4 2.1.5 2.1.6 All 49 releases
← All changes | patchstack.php +53 -15 2.3.52.3.6 View file →
@@ -3,9 +3,9 @@
3 3 * Plugin Name: Patchstack Security
4 4 * Plugin URI: https://patchstack.com/?utm_medium=wp&utm_source=dashboard&utm_campaign=patchstack%20plugin
5 5 * Author URI: https://patchstack.com/?utm_medium=wp&utm_source=dashboard&utm_campaign=patchstack%20plugin
6 6 * Description: Patchstack identifies security vulnerabilities in WordPress plugins, themes, and core.
7 - * Version: 2.3.5
7 + * Version: 2.3.6
8 8 * Author: Patchstack
9 9 * License: GPLv3
10 10 * Text Domain: patchstack
11 11 * Domain Path: /languages
@@ -58,9 +58,9 @@
58 58 * The plugin version.
59 59 *
60 60 * @var string
61 61 */
62 - const VERSION = '2.3.5';
62 + const VERSION = '2.3.6';
63 63
64 64 /**
65 65 * API URL of Patchstack to communicate with.
66 66 *
@@ -173,8 +173,10 @@
173 173
174 174 // Define WP_CLI command.
175 175 if ( defined( 'WP_CLI' ) && WP_CLI && method_exists('\WP_CLI', 'add_command')) {
176 176 \WP_CLI::add_command( 'patchstack activate', [ $this, 'cli_activate' ] );
177 + \WP_CLI::add_command( 'patchstack deactivate', [ $this, 'cli_deactivate' ] );
178 + \WP_CLI::add_command( 'patchstack status', [ $this, 'cli_status' ] );
177 179 }
178 180 }
179 181
180 182 /**
@@ -229,22 +231,22 @@
229 231 * ## OPTIONS
230 232 *
231 233 * [<id>]
232 234 * : The API client id.
233 - *
235 + *
234 236 * [<secret>]
235 237 * : The API secret key.
236 - *
238 + *
237 239 * <secret-id>
238 240 * : The API client id and secret key merged together, found in the App. E.g. 2b072e8b60402e30d481df351fc08183906254e0-123456
239 - *
241 + *
240 242 * ## EXAMPLES
241 - *
243 + *
242 244 * $ wp patchstack activate 123456 2b072e8b60402e30d481df351fc08183906254e0
243 245 * Success: The Patchstack plugin has been successfully connected.
244 - *
246 + *
245 247 * or
246 - *
248 + *
247 249 * $ wp patchstack activate 2b072e8b60402e30d481df351fc08183906254e0-123456
248 250 * Success: The Patchstack plugin has been successfully connected.
249 251 */
250 252 public function cli_activate( $args ) {
@@ -265,8 +267,42 @@
265 267 \WP_CLI::success( 'The Patchstack plugin has been successfully connected.' );
266 268 }
267 269
268 270 /**
271 + * Disconnects the Patchstack plugin from the API and removes the API key.
272 + *
273 + * ## EXAMPLES
274 + *
275 + * $ wp patchstack deactivate
276 + * Success: The Patchstack plugin has been successfully disconnected.
277 + */
278 + public function cli_deactivate() {
279 + $this->activation->deactivate();
280 + $this->activation->alter_license( '', '', 'deactivate' );
281 +
282 + \WP_CLI::success( 'The Patchstack plugin has been successfully disconnected.' );
283 + }
284 +
285 + /**
286 + * Gets the current API connection status from the Patchstack plugin.
287 + *
288 + * ## EXAMPLES
289 + *
290 + * $ wp patchstack status
291 + * Success: The Patchstack plugin is currently connected to the API.
292 + *
293 + * $ wp patchstack status
294 + * Warning: The Patchstack plugin is not connected to the API.
295 + */
296 + public function cli_status() {
297 + if ( $this->api->is_connected() ) {
298 + \WP_CLI::success( __( 'The Patchstack plugin is currently connected to the API.', 'patchstack' ) );
299 + } else {
300 + \WP_CLI::warning( __( 'The Patchstack plugin is not connected to the API.', 'patchstack' ) );
301 + }
302 + }
303 +
304 + /**
269 305 * Deactivate the plugin.
270 306 *
271 307 * @return void
272 308 */
@@ -276,9 +312,9 @@
276 312 }
277 313
278 314 /**
279 315 * Load translated strings for the plugin.
280 - *
316 + *
281 317 * @return void
282 318 */
283 319 public function load_textdomain () {
284 320 load_plugin_textdomain( 'patchstack', false, dirname( $this->basename ) . '/languages/' );
@@ -401,11 +437,13 @@
401 437 return patchstack::get_instance();
402 438 }
403 439 }
404 440
405 -// Kick it off.
406 -add_action( 'plugins_loaded', [ patchstack(), 'init' ] );
441 +if ( ! has_action( 'plugins_loaded', [ patchstack(), 'init' ] ) ) {
442 + // Kick it off.
443 + add_action( 'plugins_loaded', [ patchstack(), 'init' ] );
407 444
408 -// Activation and deactivation hooks.
409 -register_activation_hook( __FILE__, [ patchstack(), 'activate' ] );
410 -register_deactivation_hook( __FILE__, [ patchstack(), 'deactivate' ] );
411 -register_uninstall_hook( __FILE__, 'patchstack_uninstall' );
445 + // Activation and deactivation hooks.
446 + register_activation_hook( __FILE__, [ patchstack(), 'activate' ] );
447 + register_deactivation_hook( __FILE__, [ patchstack(), 'deactivate' ] );
448 + register_uninstall_hook( __FILE__, 'patchstack_uninstall' );
449 +}