/**
  * Adds actions and such.
  *
  * @since   2.3.7
  * @access  public
  * @uses    add_action
  */
 public static function init($what = array())
 {
     self::$what_widget = $what;
     self::$widget_config['root']['title'] = __('Root directories', 'mtt');
     self::$widget_config['wpcontent']['title'] = __('Wp-content directories', 'mtt');
     $hook = is_multisite() ? 'network_' : '';
     add_action("wp_{$hook}dashboard_setup", array(__CLASS__, 'dashboard_setup'));
 }
Esempio n. 2
0
 /**
  * Check options and dispatch hooks
  * 
  * @param  array $options
  * @return void
  */
 public function __construct($options)
 {
     $this->params = $options;
     $welcome = !empty($this->params['dashboard_remove']) ? in_array('welcome', $this->params['dashboard_remove']) : false;
     if ($welcome) {
         add_action('admin_head-index.php', array($this, 'remove_welcome'));
     }
     if (!empty($this->params['dashboard_remove_footer_rightnow'])) {
         add_action('admin_head-index.php', array($this, 'right_now_footer'));
     }
     if (!empty($this->params['dashboard_add_cpt_enable'])) {
         add_action('right_now_content_table_end', array($this, 'right_now_cpt'));
     }
     if (!empty($this->params['dashboard_remove'])) {
         add_action('wp_dashboard_setup', array($this, 'remove_widgets'), 0);
     }
     if (isset($this->params['dashboard_add_widgets'])) {
         add_action('wp_dashboard_setup', array($this, 'add_widgets'), 0);
     }
     if (!empty($this->params['dashboard_folder_size'])) {
         require_once 'class-widget-folder-size.php';
         B5F_Folder_Size_Widgets::init($this->params['dashboard_folder_size']);
     }
 }