@@ -59,28 +59,6 @@ public static function init() {
59
59
Plugin::VERSION
60
60
);
61
61
62
- \wp_register_script (
63
- 'AceEditor ' ,
64
- \plugin_dir_url (__FILE__ )."../public/js/ace-builds/src-min-noconflict/ace.js " ,
65
- array ('jquery ' ),
66
- Plugin::VERSION
67
- );
68
-
69
- \wp_localize_script (
70
- 'AceEditor ' ,
71
- 'AceEditorLocalized ' ,
72
- array (
73
- 'plugin_url ' => \plugin_dir_url (__FILE__ ) . "../ " ,
74
- )
75
- );
76
-
77
- \wp_enqueue_script (
78
- "AceEditor " ,
79
- \plugin_dir_url (__FILE__ )."../public/js/ace-builds/src-min-noconflict/ace.js " ,
80
- array ("jquery " ),
81
- Plugin::VERSION
82
- );
83
-
84
62
\wp_register_style (
85
63
'RollbarWordpressSettings ' ,
86
64
\plugin_dir_url (__FILE__ )."../public/css/RollbarWordpressSettings.css " ,
@@ -89,20 +67,11 @@ public static function init() {
89
67
);
90
68
\wp_enqueue_style ('RollbarWordpressSettings ' );
91
69
});
92
-
93
- \add_action ('init ' , array (get_called_class (), 'registerSession ' ));
94
70
95
71
\add_action ('admin_post_rollbar_wp_restore_defaults ' , array (get_called_class (), 'restoreDefaultsAction ' ));
96
72
97
73
\add_action ('pre_update_option_rollbar_wp ' , array (get_called_class (), 'preUpdate ' ));
98
74
}
99
-
100
- public static function registerSession ()
101
- {
102
- if ( ! session_id () && ! defined ( 'DOING_CRON ' ) ) {
103
- session_start ();
104
- }
105
- }
106
75
107
76
function addAdminMenu ()
108
77
{
@@ -372,6 +341,13 @@ public static function flashRedirect($type, $message)
372
341
373
342
public static function flashMessage ($ type , $ message )
374
343
{
344
+ // This is only designed to run in the admin for the main HTML request.
345
+ // If there is no session at this point something has gone terribly
346
+ // wrong, and we should bail out.
347
+ if ( ! is_admin () || ! session_id () || wp_doing_cron () ) {
348
+ return ;
349
+ }
350
+
375
351
$ _SESSION ['rollbar_wp_flash_message ' ] = array (
376
352
"type " => $ type ,
377
353
"message " => $ message
@@ -397,14 +373,18 @@ public static function preUpdate($settings)
397
373
try {
398
374
Plugin::instance ()->enableMustUsePlugin ();
399
375
} catch (\Exception $ exception ) {
400
- self ::flashMessage ('error ' , 'Failed enabling the Must-Use plugin. ' );
376
+ add_action ('admin_notices ' , function () {
377
+ echo '<div class="error notice"><p><strong>Error:</strong> failed to enable the Rollbar Must-Use plugin.</p></div> ' ;
378
+ });
401
379
$ settings ['enable_must_use_plugin ' ] = false ;
402
380
}
403
381
} else {
404
382
try {
405
383
Plugin::instance ()->disableMustUsePlugin ();
406
384
} catch (\Exception $ exception ) {
407
- self ::flashMessage ('error ' , 'Failed disabling the Must-Use plugin. ' );
385
+ add_action ('admin_notices ' , function () {
386
+ echo '<div class="error notice"><p><strong>Error:</strong> failed to disable the Rollbar Must-Use plugin.</p></div> ' ;
387
+ });
408
388
$ settings ['enable_must_use_plugin ' ] = true ;
409
389
}
410
390
}
0 commit comments