PluginProbe
Plugin Detective – Troubleshooting Conflicts / 1.2.24
Plugin Detective – Troubleshooting Conflicts v1.2.24
1.2.33 1.2.32 1.2.31 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2 1.2.1 1.2.10 1.2.12 1.2.13 1.2.14 1.2.16 1.2.19 1.2.20 1.2.22 1.2.23 1.2.24 1.2.25 All 53 releases
plugin-detective / troubleshoot / includes / class-plugins.php

class-plugins.php in Plugin Detective – Troubleshooting Conflicts 1.2.24, at troubleshoot/includes/class-plugins.php

83 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Troubleshoot Plugins.
4 *
5 * @since 0.0.0
6 * @package Troubleshoot
7 */
8
9 /**
10 * Troubleshoot Plugins.
11 *
12 * @since 0.0.0
13 */
14 class PDT_Plugins {
15 /**
16 * Parent plugin class.
17 *
18 * @since 0.0.0
19 *
20 * @var Troubleshoot
21 */
22 protected $plugin = null;
23
24 /**
25 * Constructor.
26 *
27 * @since 0.0.0
28 *
29 * @param Troubleshoot $plugin Main plugin object.
30 */
31 public function __construct( $plugin ) {
32 $this->plugin = $plugin;
33 $this->hooks();
34 }
35
36 /**
37 * Initiate our hooks.
38 *
39 * @since 0.0.0
40 */
41 public function hooks() {
42
43 }
44
45 public function set_active( $plugins ) {
46 update_option( 'pdt_tmp_active_plugins_backup', get_option( 'active_plugins' ) );
47 update_option( 'active_plugins', $plugins );
48
49 return true;
50 }
51
52
53 public function activate( $args=array() ) {
54 $args['plugins'] = (array)$args['plugins'];
55 if ( empty( $args['plugins'] ) ) {
56 return false;
57 }
58
59 $plugins = (array)$args['plugins'];
60 $active_plugins = get_option( 'active_plugins', array() );
61
62 $this->plugin->plugins->set_active( array_values( array_unique( array_merge( $active_plugins, $plugins ) ) ) );
63
64 return true;
65 }
66
67
68 public function deactivate( $args=array() ) {
69 $args['plugins'] = (array)$args['plugins'];
70 if ( empty( $args['plugins'] ) ) {
71 return false;
72 }
73
74 $plugins = (array)$args['plugins'];
75 $active_plugins = get_option( 'active_plugins', array() );
76
77 $this->plugin->plugins->set_active( array_values( array_unique( array_diff( $active_plugins, $plugins ) ) ) );
78
79 return true;
80 }
81
82 }
83