1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace HM\BackUpWordPress; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class Plugin |
7
|
|
|
*/ |
8
|
|
|
final class Plugin { |
9
|
|
|
const PLUGIN_VERSION = '3.5'; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @var Plugin The singleton instance. |
13
|
|
|
*/ |
14
|
|
|
private static $instance; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Instantiates a new Plugin object. |
18
|
|
|
*/ |
19
|
|
|
private function __construct() { |
20
|
|
|
add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) ); |
21
|
|
|
|
22
|
|
|
$hide_notice = get_site_option( 'hmbkp_hide_info_notice', false ); |
23
|
|
|
|
24
|
|
|
if ( ! $hide_notice ) { |
25
|
|
|
add_action( 'admin_notices', array( $this, 'display_feature_message' ) ); |
26
|
|
|
add_action( 'network_admin_notices', array( $this, 'display_feature_message' ) ); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Insures we always return the same object. |
33
|
|
|
* |
34
|
|
|
* @return Plugin |
35
|
|
|
*/ |
36
|
|
|
public static function get_instance() { |
37
|
|
|
|
38
|
|
|
if ( ! ( self::$instance instanceof Plugin ) ) { |
39
|
|
|
self::$instance = new Plugin(); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
return self::$instance; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Initialize the plugin. |
47
|
|
|
*/ |
48
|
|
|
public function plugins_loaded() { |
49
|
|
|
|
50
|
|
|
if ( true !== $this->maybe_self_deactivate() ) { |
51
|
|
|
|
52
|
|
|
$this->constants(); |
53
|
|
|
|
54
|
|
|
$this->includes(); |
55
|
|
|
|
56
|
|
|
$this->hooks(); |
57
|
|
|
|
58
|
|
|
$this->text_domain(); |
59
|
|
|
|
60
|
|
|
// If we get here, then BWP is loaded |
61
|
|
|
do_action( 'backupwordpress_loaded' ); |
62
|
|
|
|
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Check plugin requirements. |
69
|
|
|
* |
70
|
|
|
* @return bool True is fails requirements. False otherwise. |
71
|
|
|
*/ |
72
|
|
|
public function maybe_self_deactivate() { |
73
|
|
|
|
74
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/class-setup.php' ); |
75
|
|
|
|
76
|
|
View Code Duplication |
if ( false === \HMBKP_Setup::meets_requirements() ) { |
77
|
|
|
|
78
|
|
|
add_action( 'admin_init', array( '\HMBKP_Setup', 'self_deactivate' ) ); |
79
|
|
|
|
80
|
|
|
add_action( 'all_admin_notices', array( '\HMBKP_Setup', 'display_admin_notices' ) ); |
81
|
|
|
|
82
|
|
|
return true; |
83
|
|
|
|
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
return false; |
87
|
|
|
|
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Define all the constants. |
92
|
|
|
*/ |
93
|
|
|
public function constants() { |
94
|
|
|
|
95
|
|
|
if ( ! defined( 'HMBKP_PLUGIN_SLUG' ) ) { |
96
|
|
|
define( 'HMBKP_PLUGIN_SLUG', dirname( HMBKP_BASENAME ) ); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
if ( ! defined( 'HMBKP_PLUGIN_URL' ) ) { |
100
|
|
|
define( 'HMBKP_PLUGIN_URL', plugin_dir_url( HMBKP_BASENAME ) ); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
if ( ! defined( 'HMBKP_PLUGIN_LANG_DIR' ) ) { |
104
|
|
|
define( 'HMBKP_PLUGIN_LANG_DIR', apply_filters( 'hmbkp_filter_lang_dir', HMBKP_PLUGIN_SLUG . '/languages/' ) ); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
if ( ! defined( 'HMBKP_ADMIN_URL' ) ) { |
108
|
|
|
$page = is_multisite() ? network_admin_url( 'settings.php' ) : admin_url( 'tools.php' ); |
109
|
|
|
define( 'HMBKP_ADMIN_URL', add_query_arg( 'page', HMBKP_PLUGIN_SLUG, $page ) ); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
if ( ! defined( 'HMBKP_ADMIN_PAGE' ) ) { |
113
|
|
|
$prefix = is_multisite() ? 'settings_page_' : 'tools_page_'; |
114
|
|
|
|
115
|
|
|
define( 'HMBKP_ADMIN_PAGE', $prefix . HMBKP_PLUGIN_SLUG ); |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
define( 'HMBKP_SECURE_KEY', $this->generate_key() ); |
119
|
|
|
|
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Load all BackUpWordPress functions. |
124
|
|
|
*/ |
125
|
|
|
protected function includes() { |
126
|
|
|
|
127
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'vendor/autoload.php' ); |
128
|
|
|
|
129
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/class-notices.php' ); |
130
|
|
|
|
131
|
|
|
// Load the admin menu |
132
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'admin/menu.php' ); |
133
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'admin/actions.php' ); |
134
|
|
|
|
135
|
|
|
// Load Backdrop if necessary. |
136
|
|
|
if ( ! class_exists( 'HM_Backdrop_Task' ) ) { |
137
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'backdrop/hm-backdrop.php' ); |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/class-requirements.php' ); |
141
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/class-requirement.php' ); |
142
|
|
|
|
143
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/class-path.php' ); |
144
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/class-excludes.php' ); |
145
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/class-site-size.php' ); |
146
|
|
|
|
147
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/backup/class-backup-utilities.php' ); |
148
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/backup/class-backup-status.php' ); |
149
|
|
|
|
150
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/backup/class-backup-engine.php' ); |
151
|
|
|
|
152
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/backup/class-backup-engine-database.php' ); |
153
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/backup/class-backup-engine-database-mysqldump.php' ); |
154
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/backup/class-backup-engine-database-imysqldump.php' ); |
155
|
|
|
|
156
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/backup/class-backup-engine-file.php' ); |
157
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/backup/class-backup-engine-file-zip.php' ); |
158
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/backup/class-backup-engine-file-zip-archive.php' ); |
159
|
|
|
|
160
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/backup/class-backup.php' ); |
161
|
|
|
|
162
|
|
|
// Load the backup scheduling classes |
163
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/class-scheduled-backup.php' ); |
164
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/class-schedules.php' ); |
165
|
|
|
|
166
|
|
|
// Load the core functions |
167
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'functions/core.php' ); |
168
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'functions/interface.php' ); |
169
|
|
|
|
170
|
|
|
// Load the services |
171
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/class-services.php' ); |
172
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/class-service.php' ); |
173
|
|
|
|
174
|
|
|
// Load the email service |
175
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/class-email-service.php' ); |
176
|
|
|
|
177
|
|
|
// Load the webhook services |
178
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/class-webhook-service.php' ); |
179
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/class-wpremote-webhook-service.php' ); |
180
|
|
|
|
181
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/deprecated.php' ); |
182
|
|
|
|
183
|
|
|
require_once( HMBKP_PLUGIN_PATH . 'classes/class-extensions.php' ); |
184
|
|
|
|
185
|
|
|
// Load the wp cli command |
186
|
|
|
if ( defined( 'WP_CLI' ) && WP_CLI ) { |
187
|
|
|
include( HMBKP_PLUGIN_PATH . 'classes/class-backupwordpress-wp-cli-command.php' ); |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* Hook into WordPress page lifecycle and execute BackUpWordPress functions. |
194
|
|
|
*/ |
195
|
|
|
public function hooks() { |
196
|
|
|
|
197
|
|
|
add_action( 'activated_plugin', array( $this, 'load_first' ) ); |
198
|
|
|
|
199
|
|
|
add_action( 'admin_init', array( $this, 'upgrade' ) ); |
200
|
|
|
|
201
|
|
|
add_action( 'admin_init', array( $this, 'init' ) ); |
202
|
|
|
|
203
|
|
|
add_action( 'hmbkp_schedule_hook', array( $this, 'schedule_hook_run' ) ); |
204
|
|
|
|
205
|
|
|
add_action( 'admin_enqueue_scripts', array( $this, 'scripts' ) ); |
206
|
|
|
|
207
|
|
|
add_action( 'admin_footer-' . HMBKP_ADMIN_PAGE, array( $this, 'load_intercom_script' ) ); |
208
|
|
|
|
209
|
|
|
add_action( 'admin_enqueue_scripts', array( $this, 'styles' ) ); |
210
|
|
|
|
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* Load the Javascript in the admin. |
215
|
|
|
* |
216
|
|
|
* @param $hook The name of the admin page hook. |
217
|
|
|
*/ |
218
|
|
|
public function scripts( $hook ) { |
219
|
|
|
|
220
|
|
|
if ( HMBKP_ADMIN_PAGE !== $hook ) { |
221
|
|
|
return; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
$js_file = HMBKP_PLUGIN_URL . 'assets/hmbkp.min.js'; |
225
|
|
|
|
226
|
|
|
// TODO shuold this also support WP_SCRIPT_DEBUG |
227
|
|
|
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
228
|
|
|
$js_file = HMBKP_PLUGIN_URL . 'assets/hmbkp.js'; |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
wp_enqueue_script( 'hmbkp', $js_file, array( 'heartbeat' ), sanitize_key( self::PLUGIN_VERSION ) ); |
232
|
|
|
|
233
|
|
|
wp_localize_script( |
234
|
|
|
'hmbkp', |
235
|
|
|
'hmbkp', |
236
|
|
|
array( |
237
|
|
|
'page_slug' => HMBKP_PLUGIN_SLUG, |
238
|
|
|
'nonce' => wp_create_nonce( 'hmbkp_nonce' ), |
239
|
|
|
'hmbkp_run_schedule_nonce' => wp_create_nonce( 'hmbkp_run_schedule' ), |
240
|
|
|
'update' => __( 'Update', 'backupwordpress' ), |
241
|
|
|
'cancel' => __( 'Cancel', 'backupwordpress' ), |
242
|
|
|
'delete_schedule' => __( 'Are you sure you want to delete this schedule? All of its backups will also be deleted.', 'backupwordpress' ) . "\n\n" . __( '\'Cancel\' to go back, \'OK\' to delete.', 'backupwordpress' ) . "\n", |
243
|
|
|
'delete_backup' => __( 'Are you sure you want to delete this backup?', 'backupwordpress' ) . "\n\n" . __( '\'Cancel\' to go back, \'OK\' to delete.', 'backupwordpress' ) . "\n", |
244
|
|
|
'remove_exclude_rule' => __( 'Are you sure you want to remove this exclude rule?', 'backupwordpress' ) . "\n\n" . __( '\'Cancel\' to go back, \'OK\' to delete.', 'backupwordpress' ) . "\n", |
245
|
|
|
'remove_old_backups' => __( 'Reducing the number of backups that are stored on this server will cause some of your existing backups to be deleted. Are you sure that\'s what you want?', 'backupwordpress' ) . "\n\n" . __( '\'Cancel\' to go back, \'OK\' to delete.', 'backupwordpress' ) . "\n", |
246
|
|
|
) |
247
|
|
|
); |
248
|
|
|
|
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
/** |
252
|
|
|
* Loads the plugin text domain for translation. |
253
|
|
|
* This setup allows a user to just drop his custom translation files into the WordPress language directory |
254
|
|
|
* Files will need to be in a subdirectory with the name of the textdomain 'backupwordpress' |
255
|
|
|
*/ |
256
|
|
|
public function text_domain() { |
257
|
|
|
|
258
|
|
|
// Set unique textdomain string |
259
|
|
|
$textdomain = 'backupwordpress'; |
260
|
|
|
|
261
|
|
|
// The 'plugin_locale' filter is also used by default in load_plugin_textdomain() |
262
|
|
|
$locale = apply_filters( 'plugin_locale', get_locale(), $textdomain ); |
263
|
|
|
|
264
|
|
|
// Set filter for WordPress languages directory |
265
|
|
|
$hmbkp_wp_lang_dir = apply_filters( 'hmbkp_do_filter_wp_lang_dir', trailingslashit( WP_LANG_DIR ) . trailingslashit( $textdomain ) . $textdomain . '-' . $locale . '.mo' ); |
266
|
|
|
|
267
|
|
|
// Translations: First, look in WordPress' "languages" folder = custom & update-secure! |
268
|
|
|
load_textdomain( $textdomain, $hmbkp_wp_lang_dir ); |
269
|
|
|
|
270
|
|
|
// Translations: Secondly, look in plugin's "languages" folder = default |
271
|
|
|
load_plugin_textdomain( $textdomain, false, HMBKP_PLUGIN_LANG_DIR ); |
272
|
|
|
|
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* Determine if we need to run an upgrade routine. |
277
|
|
|
*/ |
278
|
|
|
public function upgrade() { |
279
|
|
|
|
280
|
|
|
// Fire the update action |
281
|
|
|
if ( self::PLUGIN_VERSION != get_option( 'hmbkp_plugin_version' ) ) { |
282
|
|
|
update(); |
283
|
|
|
} |
284
|
|
|
|
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* Runs on every admin page load |
289
|
|
|
*/ |
290
|
|
|
public function init() { |
291
|
|
|
|
292
|
|
|
// If we have multiple paths for some reason then clean them up |
293
|
|
|
Path::get_instance()->merge_existing_paths(); |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
/** |
297
|
|
|
* Generate a unique key. |
298
|
|
|
* |
299
|
|
|
* @return string |
300
|
|
|
*/ |
301
|
|
|
protected function generate_key() { |
302
|
|
|
|
303
|
|
|
$check = apply_filters( 'hmbkp_generate_key', null ); |
304
|
|
|
|
305
|
|
|
if ( null !== $check ) { |
306
|
|
|
return $check; |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
$key = array( ABSPATH, time() ); |
310
|
|
|
$constants = array( 'AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT', 'LOGGED_IN_SALT', 'NONCE_SALT', 'SECRET_KEY' ); |
311
|
|
|
|
312
|
|
|
foreach ( $constants as $constant ) { |
313
|
|
|
if ( defined( $constant ) ) { |
314
|
|
|
$key[] = constant( $constant ); |
315
|
|
|
} |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
shuffle( $key ); |
319
|
|
|
|
320
|
|
|
return md5( serialize( $key ) ); |
321
|
|
|
|
322
|
|
|
} |
323
|
|
|
|
324
|
|
|
/** |
325
|
|
|
* Ensure BackUpWordPress is loaded before add-ons, changes the order of the serialized values in the DB field. |
326
|
|
|
*/ |
327
|
|
|
public function load_first() { |
328
|
|
|
|
329
|
|
|
$active_plugins = get_option( 'active_plugins' ); |
330
|
|
|
|
331
|
|
|
$plugin_path = plugin_basename( __FILE__ ); |
332
|
|
|
|
333
|
|
|
$key = array_search( $plugin_path, $active_plugins ); |
334
|
|
|
|
335
|
|
|
if ( $key > 0 ) { |
336
|
|
|
|
337
|
|
|
array_splice( $active_plugins, $key, 1 ); |
338
|
|
|
|
339
|
|
|
array_unshift( $active_plugins, $plugin_path ); |
340
|
|
|
|
341
|
|
|
update_option( 'active_plugins', $active_plugins ); |
342
|
|
|
|
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
} |
346
|
|
|
|
347
|
|
|
/** |
348
|
|
|
* Function to run when the schedule cron fires. |
349
|
|
|
* |
350
|
|
|
* @param $schedule_id |
351
|
|
|
*/ |
352
|
|
|
public function schedule_hook_run( $schedule_id ) { |
353
|
|
|
|
354
|
|
|
if ( ! is_backup_possible() ) { |
355
|
|
|
return; |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
$schedules = Schedules::get_instance(); |
359
|
|
|
$schedule = $schedules->get_schedule( $schedule_id ); |
360
|
|
|
|
361
|
|
|
if ( ! $schedule ) { |
362
|
|
|
return; |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
$schedule->run(); |
366
|
|
|
|
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
/** |
370
|
|
|
* Enqueue the plugin styles. |
371
|
|
|
* |
372
|
|
|
* @param $hook |
373
|
|
|
*/ |
374
|
|
|
public function styles( $hook ) { |
375
|
|
|
|
376
|
|
|
if ( 'tools_page_backupwordpress_extensions' !== $hook && HMBKP_ADMIN_PAGE !== $hook ) { |
377
|
|
|
return; |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
$css_file = HMBKP_PLUGIN_URL . 'assets/hmbkp.min.css'; |
381
|
|
|
|
382
|
|
|
if ( WP_DEBUG ) { |
383
|
|
|
$css_file = HMBKP_PLUGIN_URL . 'assets/hmbkp.css'; |
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
wp_enqueue_style( 'backupwordpress', $css_file, false, sanitize_key( self::PLUGIN_VERSION ) ); |
387
|
|
|
|
388
|
|
|
} |
389
|
|
|
|
390
|
|
|
/** |
391
|
|
|
* Load Intercom and send across user information and server info. Only loaded if the user has opted in. |
392
|
|
|
* |
393
|
|
|
* @param $hook |
394
|
|
|
*/ |
395
|
|
|
public function load_intercom_script() { |
396
|
|
|
|
397
|
|
|
if ( ! get_option( 'hmbkp_enable_support' ) ) { |
398
|
|
|
return; |
399
|
|
|
} |
400
|
|
|
|
401
|
|
|
$info = array(); |
402
|
|
|
|
403
|
|
|
foreach ( Requirements::get_requirement_groups() as $group ) { |
404
|
|
|
foreach ( Requirements::get_requirements( $group ) as $requirement ) { |
|
|
|
|
405
|
|
|
$info[ $requirement->name() ] = $requirement->result(); |
406
|
|
|
} |
407
|
|
|
} |
408
|
|
|
|
409
|
|
|
foreach ( Services::get_services() as $file => $service ) { |
410
|
|
|
array_merge( $info, call_user_func( array( $service, 'intercom_data' ) ) ); |
411
|
|
|
} |
412
|
|
|
|
413
|
|
|
$current_user = wp_get_current_user(); |
414
|
|
|
|
415
|
|
|
$info['user_hash'] = hash_hmac( 'sha256', $current_user->user_email, 'fcUEt7Vi4ym5PXdcr2UNpGdgZTEvxX9NJl8YBTxK' ); |
416
|
|
|
$info['email'] = $current_user->user_email; |
417
|
|
|
$info['created_at'] = strtotime( $current_user->user_registered ); |
418
|
|
|
$info['app_id'] = '7f1l4qyq'; |
419
|
|
|
$info['name'] = $current_user->display_name; |
420
|
|
|
$info['widget'] = array( 'activator' => '#intercom' ); ?> |
421
|
|
|
|
422
|
|
|
<script id="IntercomSettingsScriptTag"> |
423
|
|
|
window.intercomSettings = <?php echo json_encode( $info ); ?>; |
424
|
|
|
</script> |
425
|
|
|
<script>!function(){function e(){var a=c.createElement("script");a.type="text/javascript",a.async=!0,a.src="https://static.intercomcdn.com/intercom.v1.js";var b=c.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}var a=window,b=a.Intercom;if("function"==typeof b)b("reattach_activator"),b("update",intercomSettings);else{var c=document,d=function(){d.c(arguments)};d.q=[],d.c=function(a){d.q.push(a)},a.Intercom=d,a.attachEvent?a.attachEvent("onload",e):a.addEventListener("load",e,!1)}}();</script> |
426
|
|
|
|
427
|
|
|
<?php } |
428
|
|
|
|
429
|
|
|
public function display_feature_message() { |
430
|
|
|
|
431
|
|
|
$current_screen = get_current_screen(); |
432
|
|
|
|
433
|
|
|
if ( ! isset( $current_screen ) ) { |
434
|
|
|
return; |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
$page = is_multisite() ? HMBKP_ADMIN_PAGE . '-network' : HMBKP_ADMIN_PAGE; |
438
|
|
|
if ( $current_screen->id !== $page ) { |
439
|
|
|
return; |
440
|
|
|
} |
441
|
|
|
|
442
|
|
|
/* translators: %1$s and %2$s expand to anchor tags linking to the new extensions page. */ |
443
|
|
|
$info_message = sprintf( |
444
|
|
|
__( 'Thanks for updating BackUpWordPress, why not check out %1$sour extensions?%2$s', 'backupwordpress' ), |
445
|
|
|
'<a href="' . esc_url( get_settings_url( HMBKP_PLUGIN_SLUG . '_extensions' ) ) . '">', |
446
|
|
|
'</a>' |
447
|
|
|
); |
448
|
|
|
?> |
449
|
|
|
|
450
|
|
|
<div id="hmbkp-info-message" class="updated notice is-dismissible"> |
451
|
|
|
|
452
|
|
|
<p><?php echo wp_kses_post( $info_message ); ?></p> |
453
|
|
|
|
454
|
|
|
<button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'backupwordpress' ); ?></span></button> |
455
|
|
|
|
456
|
|
|
</div> |
457
|
|
|
|
458
|
|
|
<?php } |
459
|
|
|
|
460
|
|
|
} |
461
|
|
|
|
462
|
|
|
if ( is_multisite() && ! is_main_site() ) { |
463
|
|
|
return; |
464
|
|
|
} |
465
|
|
|
|
466
|
|
|
Plugin::get_instance(); |
467
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: