Exemplo n.º 1
0
function shiftnav_show_tip($content)
{
    $showtips = false;
    if (shiftnav_op('admin_tips', 'general') == 'on') {
        if (shiftnav_user_is_admin()) {
            echo '<div class="shiftnav-admin-tip">' . $content . '</div>';
        }
    }
}
Exemplo n.º 2
0
function shiftnav_main_toggle_right_edge($main_toggle = false, $target_id, $id)
{
    if (!$main_toggle) {
        return;
    }
    $toggle_content_right = shiftnav_op('toggle_content_right', 'togglebar');
    if ($toggle_content_right) {
        ?>
	<span class="shiftnav-main-toggle-content-after"><?php 
        echo do_shortcode($toggle_content_right);
        ?>
</span>
	<?php 
    }
}
Exemplo n.º 3
0
function shiftnav($id, $settings = array())
{
    $ops = shiftnav_get_instance_options($id);
    extract(wp_parse_args($settings, array('theme_location' => !empty($ops['theme_location']) ? $ops['theme_location'] : '_none', 'menu' => !empty($ops['menu']) ? $ops['menu'] : '_none', 'container' => 'nav', 'edge' => !empty($ops['edge']) ? $ops['edge'] : 'left', 'skin' => !empty($ops['skin']) ? $ops['skin'] : 'standard-dark')));
    $class = "shiftnav shiftnav-nojs";
    $class .= " shiftnav-{$edge}-edge";
    $class .= " shiftnav-skin-{$skin}";
    $class .= " shiftnav-transition-standard";
    $id_att = strpos($id, 'shiftnav') !== 0 ? 'shiftnav-' . $id : $id;
    ?>



	<!-- ShiftNav #<?php 
    echo $id;
    ?>
 -->
	<div class="<?php 
    echo $class;
    ?>
" id="<?php 
    echo $id_att;
    ?>
" data-shiftnav-id="<?php 
    echo $id;
    ?>
">
		<div class="shiftnav-inner">
		<?php 
    do_action('shiftnav_before', $id);
    $disable_menu = shiftnav_op('disable_menu', $id, 'off') == 'on' ? true : false;
    if (!$disable_menu) {
        $args = array('container_class' => 'shiftnav-nav', 'container' => $container, 'menu_class' => 'shiftnav-menu', 'walker' => new ShiftNavWalker(), 'fallback_cb' => 'shiftnav_fallback', 'depth' => 0, 'shiftnav' => $id);
        //Target size
        $args['menu_class'] .= ' shiftnav-targets-' . shiftnav_op('target_size', 'general');
        //Text size
        $args['menu_class'] .= ' shiftnav-targets-text-' . shiftnav_op('text_size', 'general');
        //Icon size
        $args['menu_class'] .= ' shiftnav-targets-icon-' . shiftnav_op('icon_size', 'general');
        //Submenu indent
        if (shiftnav_op('indent_submenus', $id) == 'on') {
            $args['menu_class'] .= ' shiftnav-indent-subs';
        }
        //Active on hover
        if (shiftnav_op('active_on_hover', 'general') == 'on') {
            $args['menu_class'] .= ' shiftnav-active-on-hover';
        }
        //Active Highlight
        if (shiftnav_op('active_highlight', 'general') == 'on') {
            $args['menu_class'] .= '	shiftnav-active-highlight';
        }
        if ($menu != '_none') {
            $args['menu'] = $menu;
        } else {
            if ($theme_location != '_none') {
                $args['theme_location'] = $theme_location;
                if (!has_nav_menu($theme_location)) {
                    shiftnav_count_menus();
                    $locs = get_registered_nav_menus();
                    $loc = $locs[$theme_location];
                    shiftnav_show_tip('Please <a href="' . admin_url('nav-menus.php?action=locations') . '">assign a menu</a> to the <strong>' . $loc . '</strong> theme location');
                }
            } else {
                shiftnav_count_menus();
                shiftnav_show_tip('Please <a href="' . admin_url('themes.php?page=shiftnav-settings#shiftnav_' . $id) . '">set a Theme Location or Menu</a> for this instance');
            }
        }
        wp_nav_menu($args);
    } else {
        echo "\n\n\t\t<!-- ShiftNav Menu Disabled --> \n\n";
    }
    do_action('shiftnav_after', $id);
    ?>
		</div><!-- /.shiftnav-inner -->
	</div><!-- /.shiftnav #<?php 
    echo $id;
    ?>
 -->


	<?php 
}
Exemplo n.º 4
0
function shiftnav_check_menu_assignment()
{
    $display = shiftnav_op('display_main', 'shiftnav-main');
    if ($display == 'on') {
        if (!has_nav_menu('shiftnav')) {
            ?>
			<div class="update-nag"><strong>Important!</strong> There is no menu assigned to the <strong>ShiftNav [Main]</strong> Menu Location.  <a href="<?php 
            echo admin_url('nav-menus.php?action=locations');
            ?>
">Assign a menu</a></div>
			<br/><br/>
			<?php 
        }
    }
}
Exemplo n.º 5
0
 /**
  * Traverse elements to create list from elements.
  *
  * Calls parent function in UberMenuWalker.class.php
  */
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     if (!$element) {
         return;
     }
     $id_field = $this->db_fields['id'];
     $id = $element->{$id_field};
     $data = shiftnav_get_menu_item_data($id);
     //If the item is disabled, kill its children, Lannister-style
     if (isset($data['disable_item']) && $data['disable_item'] == 'on') {
         $this->clear_children($children_elements, $id);
         return;
     }
     //UberMenu Conditionals
     if (shiftnav_op('inherit_ubermenu_conditionals', 'general') == 'on') {
         if (function_exists('ubermenu')) {
             $has_children = !empty($children_elements[$element->{$id_field}]);
             if (isset($args[0]) && is_array($args[0])) {
                 $args[0]['has_children'] = $has_children;
             }
             $cb_args = array_merge(array(&$output, $element, $depth), $args);
             $umitem_obect_class = apply_filters('ubermenu_item_object_class', 'UberMenuItemDefault', $element, $id, $this->auto_child);
             $umitem = new $umitem_obect_class($output, $element, $depth, $cb_args[3], $id, $this, $has_children);
             //The $args that get passed to start_el are $cb[3] -- i.e. the 4the element in the array merged above
             $display_on = apply_filters('ubermenu_display_item', true, $this, $element, $max_depth, $depth, $args, $umitem);
         } else {
             $display_on = apply_filters('uberMenu_display_item', true, $this, $element, $max_depth, $depth, $args);
         }
         if (!$display_on) {
             $this->clear_children($children_elements, $id);
             return;
         }
     }
     Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }