コード例 #1
0
 /**
  * Loads the Shared UI to on all admin pages
  * @param $current_page
  */
 function load_shared_ui($current_page)
 {
     //If class method exists, load shared UI
     if (class_exists('WDEV_Plugin_Ui')) {
         if (method_exists('WDEV_Plugin_Ui', 'load')) {
             //Load Shared UI
             WDEV_Plugin_Ui::load(WP_SMUSH_URL . '/assets/shared-ui/', false);
             if ('media_page_wp-smush-bulk' != $current_page && 'gallery_page_wp-smush-nextgen-bulk' != $current_page) {
                 //Don't add thhe WPMUD class to body to other admin pages
                 remove_filter('admin_body_class', array('WDEV_Plugin_Ui', 'admin_body_class'));
             }
         }
     }
 }
コード例 #2
0
 /**
  * Load the CSS styles.
  *
  * @since  1.0.0
  * @internal Action hook
  */
 public function admin_styles()
 {
     // Remember: Current page is on the WPMUDEV Dashboard!
     $this->is_dashboard = true;
     $this->current_module = 'dashboard';
     // Find out what items to display in the search field.
     $screen = get_current_screen();
     $search_for = 'all';
     $search_class = 'plugins';
     if (is_object($screen)) {
         $base = (string) $screen->base;
         switch (true) {
             case false !== strpos($base, 'themes'):
                 $search_for = 'theme';
                 $search_class = 'themes';
                 $this->current_module = 'themes';
                 break;
             case false !== strpos($base, 'plugins'):
                 $search_for = 'plugin';
                 $this->current_module = 'plugins';
                 break;
             case false !== strpos($base, 'support'):
                 $this->current_module = 'support';
                 break;
             case false !== strpos($base, 'settings'):
                 $this->current_module = 'settings';
                 break;
         }
     }
     /*
      * Beta-testers will not have cached scripts!
      * Just in case we have to update the plugin prior to launch.
      */
     if (defined('WPMUDEV_BETATEST') && WPMUDEV_BETATEST) {
         $script_version = time();
     } else {
         $script_version = WPMUDEV_Dashboard::$version;
     }
     // Enqueue styles =====================================================.
     wp_enqueue_style('wpmudev-admin-css', WPMUDEV_Dashboard::$site->plugin_url . 'css/dashboard.css', array(), $script_version);
     // Register scripts ===================================================.
     wp_enqueue_script('wpmudev-dashboard-modules', WPMUDEV_Dashboard::$site->plugin_url . 'js/modules.js', array('jquery'), $script_version);
     // Load/Enqueue the plugin UI module.
     WDEV_Plugin_Ui::load(WPMUDEV_Dashboard::$site->plugin_url . 'shared-ui/', 'wpmud-' . $this->current_module);
     // Hide all default admin notices from another source on these pages.
     remove_all_actions('admin_notices');
     remove_all_actions('network_admin_notices');
     remove_all_actions('all_admin_notices');
 }