[ Index ]

MailPress 544

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/class/ -> MP_Admin_Bar_Menu.class.php (source)

   1  <?php
   2  class MP_Admin_Bar_Menu
   3  {
   4  	function __construct($wp_admin_bar)
   5      {
   6          $menus = $actions = array();
   7          foreach (MailPress::capabilities() as $capability => $datas) if (isset($datas['menu'], $datas['admin_bar']) && $datas['menu'] && $datas['admin_bar'] && current_user_can($capability)) $menus[$capability] = $datas;
   8          if (!$menus) return;
   9          uasort($menus, create_function('$a, $b', 'return strcmp($a["menu"], $b["menu"]);'));
  10  
  11          foreach($menus as $cap => $menu)
  12          {
  13              if (!$menu['parent']) $menu['parent'] = 'admin.php';
  14              if ($menu['page'] == MailPress_page_mails)  $actions['admin.php?page=' . MailPress_page_write] = array(__('Mail'), $cap . '_write');
  15          }
  16  
  17          foreach ( $actions as $link => $action ) {
  18              list( $title, $id ) = $action;
  19              $secondary = !empty( $action[2] );
  20      
  21              $wp_admin_bar->add_menu( array(
  22                  'parent'    => 'new-content',
  23                  'secondary' => $secondary,
  24                  'id'        => $id,
  25                  'title'     => $title,
  26                  'href'      => admin_url( $link )
  27              ) );
  28          }
  29      }
  30  
  31  }


Generated: Thu Apr 28 18:38:52 2016 Cross-referenced by PHPXref 0.7.1