-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbulk-actions-select-all.php
executable file
·214 lines (181 loc) · 4.96 KB
/
bulk-actions-select-all.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<?php
/*
Plugin Name: Bulk Actions Select All
Version: 1.1.1
Description: Adds an option to the admin posts and terms overview pages to select all items (instead of just the ones on the current page) to apply bulk actions. "Trash", "Restore", "Delete", and custom bulk actions are supported.
Author: Jesper van Engelen
Author URI: http://jespervanengelen.com
Text Domain: basa
License: GPLv2
Copyright 2014 Jesper van Engelen contact@jepps.nl
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as published by
the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if access directly
define( 'BASA_VERSION', '1.1.1' );
define( 'BASA_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'BASA_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
class BASA {
/**
* Holds the only instance of this plugin
*
* @static
* @var BASA
* @access private
* @since 1.0
*/
private static $_instance = NULL;
/**
* Plugin version
*
* @var string
* @access protected
* @since 1.0
*/
protected $version = '1.1.1';
/**
* Admin class instance
*
* @var BASA_Admin
* @access private
* @since 1.0
*/
private $_admin;
/**
* Get the admin class instance, instantiating it if it doesn't exist yet
*
* @since 1.0
*
* @return BASA_Admin Admin class instance
*/
public function admin() {
if ( ! $this->_admin ) {
$this->_admin = new BASA_Admin( $this );
}
return $this->_admin;
}
/**
* Constructor
*
* @access private
* @since 1.0
*/
private function __construct() {}
/**
* Initialize
*
* @since 1.0
*/
private function init() {
// Hooks
add_action( 'plugins_loaded', array( $this, 'finish_setup' ) );
add_action( 'init', array( $this, 'localize' ), 3 );
// Library
require_once BASA_PLUGIN_DIR . 'library/Admin.php';
if ( is_admin() ) {
$this->admin();
// Load admin feedback class
require_once BASA_PLUGIN_DIR . 'library/AdminFeedback.php';
new BASA_AdminFeedback();
}
// Plugin upgrade
add_action( 'plugins_loaded', array( $this, 'plugin_check_upgrade' ) );
}
/**
* Get the instance of this class, insantiating it if it doesn't exist yet
*
* @since 1.0
*
* @return Righteous_Plugin Class instance
*/
public static function get_instance() {
if ( ! is_object( self::$_instance ) ) {
self::$_instance = new BASA();
self::$_instance->init();
}
return self::$_instance;
}
/**
* Handle localization, loading the plugin textdomain
*
* @since 1.0
*/
public function localize() {
load_plugin_textdomain( 'basa', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
/**
* Handle final aspects of plugin setup, such as adding action hooks
*
* @since 1.0
*/
public function finish_setup() {
/**
* Fires after the plugin was fully set up.
*
* @since 1.0
*
* @param BASA $plugin_instance Main plugin class instance
*/
do_action( 'basa/after_setup', $this );
}
/**
* Handle inital installation and upgrading of the plugin
*
* @since 1.0
*/
public function plugin_check_upgrade() {
$version = $this->get_version();
$db_version = get_option( 'basa_version' );
// First install
if ( ! $db_version ) {
// First install
// Save timestamp at which the plugin was installed (does nothing if it already exists)
add_option( 'basa_installed_timestamp', time() );
// Save version
add_option( 'basa_version', $version );
/**
* Fires after the plugin is first installed
*
* @since 1.1.1
*/
do_action( 'basa/after_install' );
}
else {
// Check whether the plugin has been upgraded
$difference = version_compare( $db_version, $version );
if ( $difference != 0 ) {
// Upgrade plugin
// Save new version
update_option( 'basa_version', $version );
/**
* Fires after the plugin is upgraded to a newer version.
*
* @since 1.0
*
* @param string $old_version Plugin version before the upgrade
* @param string $new_version Plugin version after the upgrade
*/
do_action( 'basa/after_upgrade', $db_version, $version );
}
}
}
/**
* Get the plugin version
*
* @since 1.0
*
* @return string Plugin version
*/
public function get_version() {
return $this->version;
}
}
BASA::get_instance();