예제 #1
0
 function bws_plugins_admin_init()
 {
     /* Internationalization, first(!) */
     load_plugin_textdomain('bestwebsoft', false, dirname(plugin_basename(__FILE__)) . '/languages/');
     bws_add_editor_buttons();
 }
 function bws_plugins_admin_init()
 {
     if (isset($_GET['bws_activate_plugin']) && check_admin_referer('bws_activate_plugin' . $_GET['bws_activate_plugin'])) {
         $plugin = isset($_GET['bws_activate_plugin']) ? $_GET['bws_activate_plugin'] : '';
         $result = activate_plugin($plugin, '', is_network_admin());
         if (is_wp_error($result)) {
             if ('unexpected_output' == $result->get_error_code()) {
                 $redirect = self_admin_url('admin.php?page=bws_panel&error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin);
                 wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));
                 exit;
             } else {
                 wp_die($result);
             }
         }
         if (!is_network_admin()) {
             $recent = (array) get_option('recently_activated');
             unset($recent[$plugin]);
             update_option('recently_activated', $recent);
         } else {
             $recent = (array) get_site_option('recently_activated');
             unset($recent[$plugin]);
             update_site_option('recently_activated', $recent);
         }
         wp_redirect(self_admin_url('admin.php?page=bws_panel&activate=true'));
         exit;
     }
     if (isset($_GET['page']) && $_GET['page'] == 'bws_panel') {
         if (!session_id()) {
             @session_start();
         }
     }
     bws_add_editor_buttons();
 }