</p>
                        </td>
                    </tr>
                    <tr>
                        <th scope="row">
                            <?php 
_e('Admin Bar CSS Styles', 'ub');
?>
                        </th>
                        <td>
                            <textarea style="display: none" type="text" name="ub_admin_bar_style" id="ub_admin_bar_style_input"><?php 
echo UB_Admin_Bar::styles(true);
?>
</textarea>
                            <div id="ub_admin_bar_style_editor" data-input="#ub_admin_bar_style_input"  class="ub_css_editor"><?php 
echo UB_Admin_Bar::styles(true);
?>
</div>
                            <p class="description">
                                <?php 
_e("Styles defined here only apply to the admin bar, no other part of WordPress will be affected. Leave empty if no change to the default style is being made.", "ub");
?>

                            </p>
                            <p class="description">
                                <?php 
_e("Style <code>.ub_admin_bar_image</code> to change styling of images in the admin bar", "ub");
?>
                            </p>
                            <p class="description">
                                <?php 
<?php

/**
 * Renders menu boxes
 *
 * @var $menu UB_Admin_Bar_Menu
 * @var $sub UB_Admin_Bar_Menu
 */
$order = 1;
foreach (UB_Admin_Bar::menus() as $menu) {
    ?>
<div class="meta-box-sortables parent_admin_bar parent_admin_bar_prev not-sortable">
        <div class="postbox closed">
            <div class="handlediv" title="Click to toggle"><br>
            </div>
            <h3 class="hndle">
                <a href="#" data-id="<?php 
    echo $menu->id;
    ?>
" class="wdcab_step_delete button-secondary pull-right ub_delete_row"><?php 
    _e("Delete", "ub");
    ?>
</a>

                <?php 
    echo $menu->title_image;
    ?>
            </h3>
            <div class="inside">
                <table class="form-table">
                    <tbody>
Esempio n. 3
0
	/**
	 * Adds custom menus to the admin bar
	 *
	 * @since 1.0
	 * @access public
	 *
	 * @param $wp_admin_bar WP_Admin_Bar passed by refrence
	 * @hook admin_bar_menu
	 *
	 * @return void
	 */
	function add_custom_menus() {
		/**
		 * @var $wp_admin_bar WP_Admin_Bar
		 */
		global $wp_admin_bar, $current_user;

		$enabled = ub_get_option("wdcab");
		$enabled = (bool) $enabled['enabled'];

		if(!$enabled) return;

		/**
		 * @var $menu UB_Admin_Bar_Menu
		 * @var $sub UB_Admin_Bar_Menu
		 */
		$menus = UB_Admin_Bar::menus();
		if( is_array( $menus ) && !empty( $menus )){
			foreach( $menus as $menu ){
				$menu_roles = isset( $menu->menu->menu_roles ) ? $menu->menu->menu_roles : array();
				if( is_user_logged_in() || $menu_roles === array() || self::user_has_access($menu_roles, true)) {
					$wp_admin_bar->add_menu(array(
							'id' => "ub_admin_bar_" . $menu->id,
							'title' => $menu->title_image,
							'href' => $menu->link_url,
							'meta' => array(
								'target' => $menu->target
							),
						)
					);
					$submenus = $menu->subs;
					if( $submenus ){
						foreach( $submenus as $sub ){
							$wp_admin_bar->add_menu(array(
									'parent' => "ub_admin_bar_" . $menu->id,
									'id' => $sub->external_id ,
									'title' => $sub->title_image,
									'href' => $sub->link_url,
									'meta' => array(
										'target' => $sub->target
									),
								)
							);
						}
					}
				}

			}
		}

	}
Esempio n. 4
0
                            <form method="post">
                                <button id="ub_admin_bar_start_ordering" class="button-secondary"><?php _e("Reorder Menus", "ub"); ?></button>
                                <button type="submit" class="button-secondary" name="ub_admin_bar_restore_default_order"><?php _e("Restore Default Order", 'ub'); ?></button>
                            </form>
                            <p class="description">
                                <?php _e("Select 'Reorder Menus' then drag and drop to reorder your menu items. 'Restore Default Order' reverts them back to their original order, overriding any ordering you have set up.", "ub"); ?>
                            </p>
                        </td>
                    </tr>
                    <tr>
                        <th scope="row">
                            <?php  _e('Admin Bar CSS Styles', 'ub') ?>
                        </th>
                        <td>
                            <textarea style="display: none" type="text" name="ub_admin_bar_style" id="ub_admin_bar_style_input"><?php echo UB_Admin_Bar::styles( true );  ?></textarea>
                            <div id="ub_admin_bar_style_editor" data-input="#ub_admin_bar_style_input"  class="ub_css_editor"><?php echo UB_Admin_Bar::styles( true );  ?></div>
                            <p class="description">
                                <?php _e("Styles defined here only apply to the admin bar, no other part of WordPress will be affected. Leave empty if no change to the default style is being made. Please don't use more than one selector for each set of rules", "ub"); ?>

                            </p>
                            <p class="description">
                                <?php _e("Style <code>.ub_admin_bar_image</code> to change styling of images in the admin bar", "ub"); ?>
                            </p>
                            <p class="description">
                                <?php _e("Style <code>#wpadminbar</code> to change color or other styling of the admin bar", "ub"); ?>
                            </p>
                            <p class="description">
                                <?php _e("Style <code>.ab-label</code> and <code>.ab-item</code> to change font  or other styling of the links in admin bar", "ub"); ?>
                            </p>
                        </td>
                    </tr>
 /**
  * Adds custom menus to the admin bar
  *
  * @since 1.0
  * @access public
  *
  * @param $wp_admin_bar WP_Admin_Bar passed by refrence
  * @hook admin_bar_menu
  *
  * @return void
  */
 function add_custom_menus()
 {
     /**
      * @var $wp_admin_bar WP_Admin_Bar
      */
     global $wp_admin_bar;
     $enabled = ub_get_option("wdcab");
     $enabled = (bool) $enabled['enabled'];
     if (!$enabled) {
         return;
     }
     /**
      * @var $menu UB_Admin_Bar_Menu
      * @var $sub UB_Admin_Bar_Menu
      */
     $menus = UB_Admin_Bar::menus();
     if (is_array($menus) && !empty($menus)) {
         foreach ($menus as $menu) {
             $wp_admin_bar->add_menu(array('id' => "ub_admin_bar_" . $menu->id, 'title' => $menu->title_image, 'href' => $menu->link_url, 'meta' => array('target' => $menu->target)));
             $submenus = $menu->subs;
             if ($submenus) {
                 foreach ($submenus as $sub) {
                     $wp_admin_bar->add_menu(array('parent' => "ub_admin_bar_" . $menu->id, 'id' => $sub->external_id, 'title' => $sub->title_image, 'href' => $sub->link_url, 'meta' => array('target' => $sub->target)));
                 }
             }
         }
     }
 }