-
Notifications
You must be signed in to change notification settings - Fork 1
/
quick-plugin-switcher.php
118 lines (105 loc) · 2.71 KB
/
quick-plugin-switcher.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
/**
* Plugin Name: Quick Plugin Switcher
* Plugin URI: https://dineshinaublog.wordpress.com/quick-plugin-switcher
* Description: This simplifies plugin handling operations by adding a new bulk action "Switch" on this page and also adds easy "Activate Again" & "Deactivate Again" links on plugin notices. You can delete a plugin directly from deactivated notice too.
* Version: 1.6.1
* Author: Dinesh Yadav
* Author URI: https://dineshinaublog.wordpress.com
* Text Domain: quick-plugin-switcher
* Domain Path: /languages
* Requires PHP: 7.4
* Requires at least: 5.0
*
* @package quick-plugin-switcher
*/
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
if ( ! class_exists( 'DKQPS_Core' ) ) {
/**
* Plugin core class file.
*
* Class DKQPS_Core
*/
class DKQPS_Core {
/**
* Instance variable.
*
* @var $instance
*/
public static $instance = null;
/**
* Variable to hold Admin object.
*
* @var DKQPS_Admin
*/
public $admin;
/**
* DKQPS_Core constructor.
*/
public function __construct() {
/**
* Load important variables and constants.
*/
$this->define_plugin_properties();
/**
* Initiates and load hooks.
*/
$this->load_hooks();
}
/**
* Defining constants.
*/
public function define_plugin_properties() {
define( 'DKQPS_VERSION', '1.6.0' );
define( 'DKQPS_PLUGIN_FILE', __FILE__ );
define( 'DKQPS_PLUGIN_DIR', __DIR__ );
define( 'DKQPS_PLUGIN_SLUG', 'quick-plugin-switcher' );
add_action( 'plugins_loaded', array( $this, 'load_wp_dependent_properties' ), 1 );
}
/**
* Define wp dependent properties.
*/
public function load_wp_dependent_properties() {
define( 'DKQPS_PLUGIN_URL', untrailingslashit( plugin_dir_url( DKQPS_PLUGIN_FILE ) ) );
define( 'DKQPS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
}
/**
* Adding actions.
*/
public function load_hooks() {
/**
* Initialize Localization.
*/
add_action( 'init', array( $this, 'localization' ) );
add_action( 'plugins_loaded', array( $this, 'load_classes' ), 1 );
}
/**
* Loading plugin text domain.
*/
public function localization() {
load_plugin_textdomain( 'quick-plugin-switcher', false, __DIR__ . '/languages/' );
}
/**
* Loading classes.
*/
public function load_classes() {
/**
* Loads the Admin file.
*/
include __DIR__ . '/admin/class-dkqps-admin.php';
$this->admin = DKQPS_Admin::get_instance();
}
/**
* Function to create a new instance.
*
* @return DKQPS_Core
*/
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
}
DKQPS_Core::get_instance();
}