| [ Index ] |
PHP Cross Reference of PageLines Framework |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 Section: NavBar 4 Author: PageLines 5 Author URI: http://www.pagelines.com 6 Description: A responsive and sticky navigation bar for your website. 7 Class Name: PLNavBar 8 Workswith: header 9 Compatibility: 2.2 10 Cloning: false 11 */ 12 13 /** 14 * Main section class 15 * 16 * @package PageLines Framework 17 * @author PageLines 18 */ 19 class PLNavBar extends PageLinesSection { 20 21 var $default_limit = 2; 22 23 function section_head() { 24 ?> 25 <!--[if IE 8]> 26 <style> 27 .nav-collapse.collapse { 28 height: auto; 29 overflow: visible; 30 } 31 </style> 32 <![endif]--> 33 <?php 34 } 35 36 function section_persistent() { 37 38 39 $header_options = array( 40 'navbar_fixed' => array( 41 'default' => false, 42 'version' => 'pro', 43 'type' => 'check', 44 'inputlabel'=> __( 'Enable Fixed Navigation Bar', 'pagelines' ), 45 'title' => __( 'Enable Fixed Navigation Bar', 'pagelines' ), 46 'shortexp' => __( 'Applies a fixed navigation bar to the top of your site', 'pagelines' ), 47 'exp' => __( 'Use this feature to add the NavBar section as a fixed navigation bar on the top of your site.', 'pagelines' ) 48 ), 49 'navbar_logo' => array( 50 'default' => $this->base_url.'/logo.png', 51 'version' => 'pro', 52 'type' => 'image_upload', 53 'inputlabel'=> __( 'Fixed NavBar Logo', 'pagelines' ), 54 'title' => __( 'Fixed NavBar - NavBar Logo', 'pagelines' ), 55 'shortexp' => __( 'Applies a fixed navigation bar to the top of your site', 'pagelines' ), 56 'exp' => __( 'Use this feature to add the NavBar section as a fixed navigation bar on the top of your site.<br/><br/><strong>Notes:</strong> <br/>1. Only visible in Fixed Mode.<br/>2. Image Height is constricted to a maximum 29px.', 'pagelines' ) 57 ), 58 59 'navbar_multi_option_theme' => array( 60 'default' => '', 61 'type' => 'multi_option', 62 'selectvalues'=> array( 63 64 'fixed_navbar_theme' => array( 65 'default' => 'black-trans', 66 'type' => 'select', 67 'inputlabel' => __( 'Fixed NavBar - Select Theme', 'pagelines' ), 68 'selectvalues' => array( 69 'black-trans' => array( 'name' => __( 'Black Transparent (Default)', 'pagelines' ) ), 70 'blue' => array( 'name' => __( 'Blue', 'pagelines' ) ), 71 'grey' => array( 'name' => __( 'Light Grey', 'pagelines' ) ), 72 'orange' => array( 'name' => __( 'Orange', 'pagelines' ) ), 73 'red' => array( 'name' => __( 'Red', 'pagelines' ) ), 74 ), 75 ), 76 'navbar_theme' => array( 77 'default' => 'black-trans', 78 'type' => 'select', 79 'inputlabel' => __( 'Standard NavBar - Select Theme', 'pagelines' ), 80 'selectvalues' => array( 81 'black-trans' => array( 'name' => __( 'Black Transparent (Default)', 'pagelines' ) ), 82 'blue' => array( 'name' => __( 'Blue', 'pagelines' ) ), 83 'grey' => array( 'name' => __( 'Light Grey', 'pagelines' ) ), 84 'orange' => array( 'name' => __( 'Orange', 'pagelines' ) ), 85 'red' => array( 'name' => __( 'Red', 'pagelines' ) ), 86 ), 87 ), 88 ), 89 'title' => __( 'NavBar and Fixed NavBar Theme', 'pagelines' ), 90 'shortexp' => __( 'Select the color and theme of the NavBar', 'pagelines' ), 91 'exp' => __( 'The NavBar comes with several color options. Select one to automatically configure.', 'pagelines' ) 92 93 ), 94 'navbar_multi_option_menu' => array( 95 'default' => '', 96 'type' => 'multi_option', 97 'selectvalues'=> array( 98 99 'fixed_navbar_menu' => array( 100 'default' => 'black-trans', 101 'type' => 'select_menu', 102 'inputlabel' => __( 'Fixed NavBar - Select Menu', 'pagelines' ), 103 ), 104 'navbar_menu' => array( 105 'default' => 'black-trans', 106 'type' => 'select_menu', 107 'inputlabel' => __( 'Standard NavBar - Select Menu', 'pagelines' ), 108 ), 109 ), 110 'title' => __( 'NavBar and Fixed NavBar Menu', 'pagelines' ), 111 'shortexp' => __( 'Select the WordPress Menu for the NavBar(s)', 'pagelines' ), 112 'exp' => __( 'The NavBar uses WordPress menus. Select one for use.', 'pagelines' ) 113 114 ), 115 116 'navbar_multi_check' => array( 117 'default' => '', 118 'type' => 'check_multi', 119 'selectvalues'=> array( 120 121 'navbar_enable_hover' => array( 122 'inputlabel' => __( 'Activate dropdowns on hover.', 'pagelines' ), 123 ), 124 125 'fixed_navbar_alignment' => array( 126 'inputlabel' => __( 'Fixed NavBar - Align Menu Right? (Defaults Left)', 'pagelines' ), 127 ), 128 'fixed_navbar_hidesearch' => array( 129 'inputlabel' => __( 'Fixed NavBar - Hide Searchform?', 'pagelines' ), 130 ), 131 'navbar_alignment' => array( 132 'inputlabel' => __( 'Standard NavBar - Align Menu Right? (Defaults Left)', 'pagelines' ), 133 ), 134 'navbar_hidesearch' => array( 135 'inputlabel' => __( 'Standard NavBar - Hide Searchform?', 'pagelines' ), 136 ), 137 ), 138 'inputlabel' => __( 'Configure Options for NavBars', 'pagelines' ), 139 'title' => __( 'NavBar and Fixed NavBar Configuration Options', 'pagelines' ), 140 'shortexp' => __( 'Control various appearance options for the NavBars', 'pagelines' ), 141 'exp' => '' 142 ), 143 'navbar_title' => array( 144 'type' => 'text', 145 'inputlabel'=> __( 'NavBar Title', 'pagelines' ), 146 'title' => __( 'NavBar Title', 'pagelines' ), 147 'shortexp' => __( 'Applies text to NavBar on small screens. Not available on Fixed NavBar', 'pagelines' ), 148 'exp' => __( 'Add text to the NavBar to serve as a title, but only displayed on small screens.', 'pagelines' ), 149 ), 150 151 152 ); 153 154 $option_args = array( 155 156 'name' => 'NavBar', 157 'array' => $header_options, 158 'icon' => $this->icon, 159 'position' => 6 160 ); 161 162 pl_add_options_page( $option_args ); 163 164 //pl_global_option( array( 'menu' => 'header_and_footer', 'options' => $header_options, 'location' => 'top' ) ); 165 166 167 if(ploption('navbar_fixed')){ 168 169 build_passive_section( array( 'sid' => $this->class_name ) ); 170 171 add_action( 'pagelines_before_page', create_function( '', 'echo pl_source_comment("Fixed NavBar Section");' ) ); 172 add_action( 'pagelines_before_page', array( &$this,'passive_section_template' ), 10, 2); 173 pagelines_add_bodyclass( 'navbar_fixed' ); 174 } 175 176 177 178 } 179 180 /** 181 * Load styles and scripts 182 */ 183 function section_styles() { 184 185 wp_enqueue_script( 'navbar', $this->base_url.'/navbar.js', array( 'jquery' ) ); 186 } 187 188 function before_section_template( $location = '' ) { 189 190 $format = ( $location == 'passive' ) ? 'open' : 'standard'; 191 $this->special_classes = ( $location == 'passive' ) ? ' fixed-top' : ''; 192 $this->settings['format'] = $format; 193 194 } 195 196 /** 197 * Section template. 198 */ 199 function section_template( $clone_id, $location = '' ) { 200 201 $passive = ( $location == 'passive' ) ? true : false; 202 203 // if fixed mode 204 if( $passive ){ 205 206 $width_class = 'navbar-full-width'; 207 $content_width_class = 'content'; 208 $theme = ( ploption('fixed_navbar_theme' ) ) ? ploption( 'fixed_navbar_theme' ) : false; 209 $align = ( ploption( 'fixed_navbar_alignment' ) ) ? ploption( 'fixed_navbar_alignment' ) : false; 210 $hidesearch = ( ploption( 'fixed_navbar_hidesearch' ) ) ? ploption( 'fixed_navbar_hidesearch' ) : false; 211 $menu = ( ploption( 'fixed_navbar_menu' ) ) ? ploption( 'fixed_navbar_menu' ) : null; 212 213 } else { 214 215 $width_class = 'navbar-content-width'; 216 $content_width_class = ''; 217 $theme = ( ploption( 'navbar_theme' ) ) ? ploption( 'navbar_theme' ) : false; 218 $align = ( ploption('navbar_alignment' ) ) ? ploption( 'navbar_alignment' ) : false; 219 $hidesearch = ( ploption( 'navbar_hidesearch' ) ) ? ploption( 'navbar_hidesearch' ) : false; 220 $menu = ( ploption( 'navbar_menu' ) ) ? ploption( 'navbar_menu' ) : null; 221 } 222 223 $pull = ( $align ) ? 'right' : 'left'; 224 $align_class = sprintf( 'pull-%s', $pull ); 225 $theme_class = ( $theme ) ? sprintf( ' pl-color-%s', $theme ) : ' pl-color-black-trans'; 226 $theme_class = ( ploption( 'navbar_enable_hover' ) ) ? $theme_class . ' plnav_hover' : $theme_class; 227 $brand = ( ploption( 'navbar_logo' ) || ploption( 'navbar_logo' ) != '') ? sprintf( '<img src="%s" alt="%s" />', ploption( 'navbar_logo' ), esc_attr( get_bloginfo('name') ) ) : sprintf( '<h2 class="plbrand-text">%s</h2>', get_bloginfo( 'name' ) ); 228 $navbartitle = ploption( 'navbar_title', $this->oset ); 229 230 ?> 231 <div class="navbar fix <?php echo $width_class.' '.$theme_class; ?>"> 232 <div class="navbar-inner <?php echo $content_width_class;?>"> 233 <div class="navbar-content-pad fix"> 234 <?php 235 if($navbartitle) 236 printf( '<span class="navbar-title">%s</span>',$navbartitle ); 237 ?> 238 <a href="javascript:void(0)" class="nav-btn nav-btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> 239 <span class="icon-bar"></span> 240 <span class="icon-bar"></span> 241 <span class="icon-bar"></span> 242 </a> 243 <?php if($passive): 244 printf( '<a class="plbrand" href="%s" title="%s">%s</a>', 245 esc_url( home_url() ), 246 esc_attr( get_bloginfo('name') ), 247 apply_filters('navbar_brand', $brand) 248 ); 249 endif; ?> 250 <div class="nav-collapse collapse"> 251 <?php if( !$hidesearch ) 252 get_search_form(); 253 if ( is_array( wp_get_nav_menu_items( $menu ) ) || has_nav_menu( 'primary' ) ) { 254 wp_nav_menu( 255 array( 256 'menu_class' => 'font-sub navline pldrop ' . $align_class, 257 'menu' => $menu, 258 'container' => null, 259 'container_class' => '', 260 'depth' => 3, 261 'fallback_cb' => '' 262 ) 263 ); 264 } else { 265 $this->nav_fallback( $align_class ); 266 } 267 ?> 268 </div> 269 <div class="clear"></div> 270 </div> 271 </div> 272 </div> 273 <?php } 274 function nav_fallback( $align_class ) { 275 276 printf( '<ul id="menu-main" class="font-sub navline pldrop %s">', $align_class ); 277 wp_list_pages( 'title_li=&sort_column=menu_order&depth=2' ); 278 echo '</ul>'; 279 } 280 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Apr 6 23:00:27 2013 | Cross-referenced by PHPXref 0.7.1 |