PluginProbe
WowAddons – Product Addons and Product Options With Custom Fields / trunk
WowAddons – Product Addons and Product Options With Custom Fields vtrunk
1.7.2 1.7.1 1.7.0 1.6.21 1.6.20 1.6.19 1.6.18 1.6.17 1.6.16 1.6.15 1.6.14 1.6.13 1.6.12 1.6.11 1.6.10 1.6.9 1.6.8 1.6.7 1.6.6 1.5.10 1.5.11 1.5.2 1.5.3 1.5.4 1.5.5 All 57 releases
product-addons / includes / admin / class-our-plugins.php

class-our-plugins.php in WowAddons – Product Addons and Product Options With Custom Fields trunk, at includes/admin/class-our-plugins.php

49 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php //phpcs:ignore
2 /**
3 * Options Action.
4 */
5
6 namespace PRAD\Includes\Admin;
7
8 defined( 'ABSPATH' ) || exit;
9
10 use PRAD\Includes\Xpo;
11
12 /**
13 * OurPlugins class.
14 */
15 class OurPlugins {
16
17 /**
18 * Setup class.
19 */
20 public function __construct() {
21 add_action( 'wp_ajax_prad_install_plugin', array( $this, 'prad_install_plugin_callback' ) );
22 }
23
24 /**
25 * Handles plugin installation and activation via AJAX.
26 *
27 * @return void
28 */
29 public function prad_install_plugin_callback() {
30
31 $nonce = isset( $_POST['wpnonce'] ) ? sanitize_key( wp_unslash( $_POST['wpnonce'] ) ) : '';
32 $plugin = isset( $_POST['plugin'] ) ? sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) : '';
33
34 if ( ! wp_verify_nonce( $nonce, 'prad-nonce' ) || ! current_user_can( 'manage_options' ) ) {
35 wp_send_json_error( array( 'message' => 'No plugin specified' ) );
36 }
37
38 $res = array( 'message' => 'false' );
39
40 if ( $plugin ) {
41 $res = Xpo::install_and_active_plugin( $plugin );
42 }
43
44 wp_send_json_success( array( 'message' => $res ) );
45
46 die();
47 }
48 }
49