[ Index ]

MailPress 7.2

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

title

Body

[close]

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

   1  <?php
   2  class MP_WP_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, array( 'self', 'sort_menus' ) );
  10  
  11          foreach( $menus as $cap => $menu )
  12          {
  13              if ( !$menu['parent'] ) $menu['parent'] = 'admin.php';
  14              if ( $menu['page'] == MailPress_page_mails )  $actions[MailPress_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  	public static function sort_menus( $a, $b ) 
  32      {
  33          return strcmp( $a['menu'], $b['menu'] );
  34      }
  35  }


Generated: Tue May 19 15:55:14 2020 Cross-referenced by PHPXref 0.7.1