Пример #1
0
 public function add_widgets()
 {
     $i = 0;
     foreach ($this->params['dashboard_add_widgets'] as $dash_widg) {
         $ucan = empty($dash_widg['roles']) ? true : B5F_MTT_Utils::current_user_has_role_array($dash_widg['roles']);
         if ($ucan && !empty($dash_widg['enabled'])) {
             $title = $dash_widg['title'] == '' ? '  ' : stripslashes($dash_widg['title']);
             wp_add_dashboard_widget("mtt_widget_{$i}", $title, array($this, 'add_dashboard_content'));
         }
         $i++;
     }
 }
Пример #2
0
 /**
  * Add custom menu to Admin Bar
  * 
  * @global type $wp_admin_bar
  * @return type
  */
 public function custom_menu()
 {
     global $wp_admin_bar;
     // ERROR, NO PARENT
     if ($this->params['adminbar_custom_enable']['bar_0_title'] == '') {
         return;
     }
     // PARENT
     $href0 = $this->params['adminbar_custom_enable']['bar_0_url'] != '' ? $this->params['adminbar_custom_enable']['bar_0_url'] : '#';
     $wp_admin_bar->add_menu(array('id' => 'MTT', 'title' => $this->params['adminbar_custom_enable']['bar_0_title'], 'href' => $href0));
     // NO SUBMENUS
     if (empty($this->params['adminbar_custom_submenus'])) {
         return;
     }
     $i = 0;
     foreach ($this->params['adminbar_custom_submenus'] as $submenu) {
         $ucan = empty($submenu['roles']) ? true : B5F_MTT_Utils::current_user_has_role_array($submenu['roles']);
         if ($ucan) {
             $href = $submenu['url'] != '' ? $submenu['url'] : '#';
             $wp_admin_bar->add_menu(array('parent' => 'MTT', 'id' => 'MTT' . $i, 'title' => $submenu['title'], 'href' => $href));
             $i++;
         }
     }
     return;
     // CHILDREN
     for ($i = 1; $i <= 5; $i++) {
         if ($this->params['adminbar_custom_enable']["bar_{$i}_title"] != '') {
             $href = $this->params['adminbar_custom_enable']["bar_{$i}_url"] != '' ? $this->params['adminbar_custom_enable']["bar_{$i}_url"] : '#';
             $wp_admin_bar->add_menu(array('parent' => 'MTT', 'id' => 'MTT' . $i, 'title' => $this->params['adminbar_custom_enable']["bar_{$i}_title"], 'href' => $href));
         }
     }
 }
Пример #3
0
 public function admin_notices()
 {
     global $current_screen;
     if (!empty($this->params['admin_notice_header_settings_enable']['enabled']) && 'options-general' == $current_screen->parent_base) {
         print '<div  class="updated">' . $this->params['admin_notice_header_settings_enable']['text'] . '</div>';
     }
     // enable general notice
     if (!empty($this->params['admin_notice_header_allpages_enable']['enabled'])) {
         $ucan = empty($this->params['admin_notice_header_allpages_enable']['level']) ? true : B5F_MTT_Utils::current_user_has_role_array($this->params['admin_notice_header_allpages_enable']['level']);
         if ($ucan) {
             echo '<div  class="updated">' . $this->params['admin_notice_header_allpages_enable']['text'] . '</div>';
         }
     }
 }