Make WordPress Core


Ignore:
Timestamp:
02/21/2010 12:03:42 AM (17 years ago)
Author:
ryan
Message:

Trim trailing whites

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/default-widgets.php

    r13257 r13268  
    10101010        function WP_CustomNavWidget() {
    10111011                $widget_ops = array('description' => 'Use this widget to add one of your Custom Navigation Menus as a widget.' );
    1012                 parent::WP_Widget(false, __('Custom Navigation Menu'),$widget_ops);     
    1013         }
    1014 
    1015         function widget($args, $instance) { 
     1012                parent::WP_Widget(false, __('Custom Navigation Menu'),$widget_ops);
     1013        }
     1014
     1015        function widget($args, $instance) {
    10161016                $navmenu = $instance['navmenu'];
    10171017                $navtitle = $instance['navtitle'];
    … …  
    10231023                $navulid = $instance['navulid'];
    10241024                $navulclass = $instance['navulclass'];
    1025                
     1025
    10261026                //Override for menu descriptions
    10271027                $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options');
    1028                 if ($advanced_option_descriptions == 'no') 
    1029                 { 
     1028                if ($advanced_option_descriptions == 'no')
     1029                {
    10301030                        $navwidgetdescription = 2;
    1031                 } 
     1031                }
    10321032                else
    10331033                {
    … …  
    10351035                }
    10361036                $menuexists = false;
    1037                
     1037
    10381038                global $wpdb;
    1039                
     1039
    10401040                //GET menu name
    10411041                if ($navmenu > 0)
    … …  
    10471047                }
    10481048                //Do nothing
    1049                 else 
     1049                else
    10501050                {
    10511051                        $menuexists = false;
    10521052                }
    10531053                ?>
    1054                
    1055                 <?php 
     1054
     1055                <?php
    10561056                        //DEVELOPER settings enabled
    1057                         if ($navdeveloper == 'yes') 
    1058                         { 
     1057                        if ($navdeveloper == 'yes')
     1058                        {
    10591059                                //DISPLAY Custom DIV
    1060                                 if ($navdiv == 'yes') 
    1061                                 { 
     1060                                if ($navdiv == 'yes')
     1061                                {
    10621062                                        ?>
    10631063                                        <div id="<?php echo $navdivid;  ?>" class="<?php echo $navdivclass; ?>">
    1064                                         <?php 
     1064                                        <?php
    10651065                                }
    10661066                                //Do NOT display DIV
    1067                                 else 
     1067                                else
    10681068                                {
    1069                                        
    1070                                 } 
    1071                                
    1072                         } 
     1069
     1070                                }
     1071
     1072                        }
    10731073                        //DISPLAY default DIV
    1074                         else 
     1074                        else
    10751075                        {
    10761076                                ?>
    10771077                                <div class="widget">
    1078                                 <?php 
     1078                                <?php
    10791079                        }
    10801080                ?>
    1081                
     1081
    10821082                        <h3><?php echo $navtitle; ?></h3>
    1083                         <?php 
    1084                        
    1085                         if ($menuexists) 
     1083                        <?php
     1084
     1085                        if ($menuexists)
    10861086                        {
    10871087                                ?>
    1088                         <?php 
    1089                        
     1088                        <?php
     1089
    10901090                        //DEVELOPER settings enabled
    1091                                 if ($navdeveloper == 'yes') 
    1092                                 { 
     1091                                if ($navdeveloper == 'yes')
     1092                                {
    10931093                                        //DISPLAY Custom UL
    1094                                         if ($navul == 'yes') 
    1095                                         { 
     1094                                        if ($navul == 'yes')
     1095                                        {
    10961096                                                ?>
    10971097                                                <ul id="<?php echo $navulid;  ?>" class="<?php echo $navulclass; ?>">
    1098                                                 <?php 
     1098                                                <?php
    10991099                                        }
    11001100                                        //Do NOT display UL
    1101                                         else 
     1101                                        else
    11021102                                        {
    1103                                                
    1104                                         } 
    1105                                        
    1106                                 } 
     1103
     1104                                        }
     1105
     1106                                }
    11071107                                //DISPLAY default UL
    1108                                 else 
     1108                                else
    11091109                                {
    11101110                                        ?>
    11111111                                        <ul class="custom-nav">
    1112                                         <?php 
     1112                                        <?php
    11131113                                }
    1114                        
     1114
    11151115                        ?>
    1116                                
     1116
    11171117                                                <?php
    11181118                                                        //DISPLAY custom navigation menu
    11191119                                                        if (get_option('wp_custom_nav_menu') == 'true') {
    11201120                                                        custom_nav('name='.$wp_custom_nav_menu_name.'&desc='.$navwidgetdescription);
    1121                                                 }                               
     1121                                                }
    11221122                                                ?>
    1123                                
    1124                                 <?php 
    1125                                
     1123
     1124                                <?php
     1125
    11261126                                        //DEVELOPER settings enabled
    1127                                         if ($navdeveloper == 'yes') 
    1128                                         { 
     1127                                        if ($navdeveloper == 'yes')
     1128                                        {
    11291129                                                //DISPLAY Custom UL
    1130                                                 if ($navul == 'yes') 
    1131                                                 { 
     1130                                                if ($navul == 'yes')
     1131                                                {
    11321132                                                        ?>
    11331133                                                        </ul>
    1134                                                         <?php 
     1134                                                        <?php
    11351135                                                }
    11361136                                                //Do NOT display UL
    1137                                                 else 
     1137                                                else
    11381138                                                {
    1139                                                        
    1140                                                 } 
    1141                                                
    1142                                         } 
     1139
     1140                                                }
     1141
     1142                                        }
    11431143                                        //DISPLAY default UL
    1144                                         else 
     1144                                        else
    11451145                                        {
    11461146                                                ?>
    11471147                                                </ul>
    1148                                                 <?php 
     1148                                                <?php
    11491149                                        }
    1150                                        
     1150
    11511151                                ?>
    11521152                        <?php
    … …  
    11571157                        }
    11581158                        ?>
    1159                 <?php 
     1159                <?php
    11601160                        //DEVELOPER settings enabled
    1161                         if ($navdeveloper == 'yes') 
    1162                         { 
     1161                        if ($navdeveloper == 'yes')
     1162                        {
    11631163                                //DISPLAY Custom DIV
    1164                                 if ($navdiv == 'yes') 
    1165                                 { 
     1164                                if ($navdiv == 'yes')
     1165                                {
    11661166                                        ?>
    11671167                                        </div>
    1168                                         <?php 
     1168                                        <?php
    11691169                                }
    11701170                                //Do NOT display DIV
    1171                                 else 
     1171                                else
    11721172                                {
    1173                                        
    1174                                 } 
    1175                                
    1176                         } 
     1173
     1174                                }
     1175
     1176                        }
    11771177                        //DISPLAY default DIV
    1178                         else 
     1178                        else
    11791179                        {
    11801180                                ?>
    11811181                                </div>
    1182                                 <?php 
     1182                                <?php
    11831183                        }
    11841184                ?><!-- /#nav-container -->
    1185                        
     1185
    11861186                        <?php
    11871187        }
    11881188
    1189         function update($new_instance, $old_instance) {               
     1189        function update($new_instance, $old_instance) {
    11901190                return $new_instance;
    11911191        }
    11921192
    1193         function form($instance) {       
     1193        function form($instance) {
    11941194                $navmenu = esc_attr($instance['navmenu']);
    11951195                $navtitle = esc_attr($instance['navtitle']);
    … …  
    12021202                $navulclass = esc_attr($instance['navulclass']);
    12031203                $navwidgetdescription = esc_attr($instance['navwidgetdescription']);
    1204                                
     1204
    12051205                global $wpdb;
    1206                                
    1207                 //GET Menu Items for SELECT OPTIONS     
     1206
     1207                //GET Menu Items for SELECT OPTIONS
    12081208                $table_name_custom_menus = $wpdb->prefix . "custom_nav_menus";
    12091209                $custom_menu_records = $wpdb->get_results("SELECT id,menu_name FROM ".$table_name_custom_menus);
    1210                
     1210
    12111211                //CHECK if menus exist
    12121212                if ($custom_menu_records > 0)
    12131213                {
    1214                
     1214
    12151215                        ?>
    1216                        
     1216
    12171217                         <p>
    12181218                    <label for="<?php echo $this->get_field_id('navmenu'); ?>"><?php _e('Select Menu:'); ?></label>
    1219                                
     1219
    12201220                                <select id="<?php echo $this->get_field_id('navmenu'); ?>" name="<?php echo $this->get_field_name('navmenu'); ?>">
    1221                                         <?php 
    1222                                        
     1221                                        <?php
     1222
    12231223                                        //DISPLAY SELECT OPTIONS
    12241224                                        foreach ($custom_menu_records as $custom_menu_record)
    … …  
    12331233                                                <option value="<?php echo $custom_menu_record->id; ?>" <?php echo $selected_option; ?>><?php echo $custom_menu_record->menu_name; ?></option>
    12341234                                                <?php
    1235                                                
     1235
    12361236                                        }
    12371237                                        ?>
    12381238                                </select>
    1239        
     1239
    12401240                        </p>
    1241                        
     1241
    12421242                        <p>
    1243                                
     1243
    12441244                        <label for="<?php echo $this->get_field_id('navtitle'); ?>"><?php _e('Title:'); ?></label>
    12451245                        <input type="text" name="<?php echo $this->get_field_name('navtitle'); ?>" value="<?php echo $navtitle; ?>" class="widefat" id="<?php echo $this->get_field_id('navtitle'); ?>" />
    12461246                    </p>
    1247                    
     1247
    12481248                <p>
    12491249                        <?php
    12501250                            $checked = strtolower($navdeveloper);
    12511251                        ?>
    1252                        
    1253                         <label for="<?php echo $this->get_field_id('navdeveloper'); ?>"><?php _e('Advanced Options:'); ?></label><br />         
     1252
     1253                        <label for="<?php echo $this->get_field_id('navdeveloper'); ?>"><?php _e('Advanced Options:'); ?></label><br />
    12541254                        <span class="checkboxes">
    12551255                                <label>Yes</label><input type="radio" id="<?php echo $this->get_field_name('navdeveloper'); ?>" name="<?php echo $this->get_field_name('navdeveloper'); ?>" value="yes" <?php if ($checked=='yes') { echo 'checked="checked"'; } ?> />
    12561256                            <label>No</label><input type="radio" id="<?php echo $this->get_field_name('navdeveloper'); ?>" name="<?php echo $this->get_field_name('navdeveloper'); ?>" value="no" <?php if ($checked=='yes') { } else { echo 'checked="checked"'; } ?> />
    12571257                        </span><!-- /.checkboxes -->
    1258                        
     1258
    12591259                        </p>
    1260                    
    1261                     <?php 
    1262                    
     1260
     1261                    <?php
     1262
    12631263                    //DEVELOPER settings
    12641264                    if ($checked == 'yes')
    12651265                    {
    12661266                        ?>
    1267                        
     1267
    12681268                        <p>
    12691269                                <?php
    12701270                                    $checked = strtolower($navdiv);
    12711271                                ?>
    1272                                
    1273                                 <label for="<?php echo $this->get_field_id('navdiv'); ?>"><?php _e('Wrap in container DIV:'); ?></label><br /> 
     1272
     1273                                <label for="<?php echo $this->get_field_id('navdiv'); ?>"><?php _e('Wrap in container DIV:'); ?></label><br />
    12741274                                <span class="checkboxes">
    12751275                                        <label>Yes</label><input type="radio" id="<?php echo $this->get_field_name('navdiv'); ?>" name="<?php echo $this->get_field_name('navdiv'); ?>" value="yes" <?php if ($checked=='yes') { echo 'checked="checked"'; } ?> />
    12761276                                    <label>No</label><input type="radio" id="<?php echo $this->get_field_name('navdiv'); ?>" name="<?php echo $this->get_field_name('navdiv'); ?>" value="no" <?php if ($checked=='yes') { } else { echo 'checked="checked"'; } ?> />
    12771277                                </span><!-- /.checkboxes -->
    1278                        
     1278
    12791279                        </p>
    1280                        
     1280
    12811281                        <?php
    1282                        
     1282
    12831283                        if ($checked == 'yes')
    12841284                        {
    1285                        
     1285
    12861286                                ?>
    1287                                
     1287
    12881288                                <p>
    1289                                
     1289
    12901290                            <label for="<?php echo $this->get_field_id('navdivid'); ?>"><?php _e('DIV id:'); ?></label>
    12911291                            <input type="text" name="<?php echo $this->get_field_name('navdivid'); ?>" value="<?php echo $navdivid; ?>" class="widefat" id="<?php echo $this->get_field_id('navdivid'); ?>" />
    12921292                        </p>
    12931293                        <p>
    1294                                
     1294
    12951295                            <label for="<?php echo $this->get_field_id('navdivclass'); ?>"><?php _e('DIV class:'); ?></label>
    12961296                            <input type="text" name="<?php echo $this->get_field_name('navdivclass'); ?>" value="<?php echo $navdivclass; ?>" class="widefat" id="<?php echo $this->get_field_id('navdivclass'); ?>" />
    12971297                        </p>
    1298                                
     1298
    12991299                                <?php
    1300                                
     1300
    13011301                        }
    1302                        
     1302
    13031303                        ?>
    1304                        
     1304
    13051305                        <p>
    13061306                                <?php
    13071307                                    $checked = strtolower($navul);
    13081308                                ?>
    1309                                
    1310                                 <label for="<?php echo $this->get_field_id('navul'); ?>"><?php _e('Wrap in container UL:'); ?></label><br />           
     1309
     1310                                <label for="<?php echo $this->get_field_id('navul'); ?>"><?php _e('Wrap in container UL:'); ?></label><br />
    13111311                                <span class="checkboxes">
    13121312                                        <label>Yes</label><input type="radio" id="<?php echo $this->get_field_name('navul'); ?>" name="<?php echo $this->get_field_name('navul'); ?>" value="yes" <?php if ($checked=='yes') { echo 'checked="checked"'; } ?> />
    13131313                                    <label>No</label><input type="radio" id="<?php echo $this->get_field_name('navul'); ?>" name="<?php echo $this->get_field_name('navul'); ?>" value="no" <?php if ($checked=='yes') { } else { echo 'checked="checked"'; } ?> />
    13141314                                </span><!-- /.checkboxes -->
    1315                        
     1315
    13161316                        </p>
    1317                        
     1317
    13181318                        <?php
    1319                
     1319
    13201320                        if ($checked == 'yes')
    13211321                        {
    1322                        
     1322
    13231323                                ?>
    1324                                
     1324
    13251325                                <p>
    1326                                
     1326
    13271327                            <label for="<?php echo $this->get_field_id('navulid'); ?>"><?php _e('UL id:'); ?></label>
    13281328                            <input type="text" name="<?php echo $this->get_field_name('navulid'); ?>" value="<?php echo $navulid; ?>" class="widefat" id="<?php echo $this->get_field_id('navulid'); ?>" />
    13291329                        </p>
    13301330                        <p>
    1331                                
     1331
    13321332                            <label for="<?php echo $this->get_field_id('navulclass'); ?>"><?php _e('UL class:'); ?></label>
    13331333                            <input type="text" name="<?php echo $this->get_field_name('navulclass'); ?>" value="<?php echo $navulclass; ?>" class="widefat" id="<?php echo $this->get_field_id('navulclass'); ?>" />
    13341334                        </p>
    1335                                
     1335
    13361336                                <?php
    1337                                
     1337
    13381338                        }
    1339                        
     1339
    13401340                        ?>
    13411341                        <?php $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options'); ?>
    13421342                        <p <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?>>
    1343                        
     1343
    13441344                   <?php
    13451345                                    $checked = strtolower($navwidgetdescription);
    13461346                                ?>
    1347                                
    1348                                 <label for="<?php echo $this->get_field_id('navwidgetdescription'); ?>"><?php _e('Show Top Level Descriptions:'); ?></label><br />     
     1347
     1348                                <label for="<?php echo $this->get_field_id('navwidgetdescription'); ?>"><?php _e('Show Top Level Descriptions:'); ?></label><br />
    13491349                                <span class="checkboxes">
    13501350                                        <label>Yes</label><input type="radio" id="<?php echo $this->get_field_name('navwidgetdescription'); ?>" name="<?php echo $this->get_field_name('navwidgetdescription'); ?>" value="1" <?php if ($checked=='1') { echo 'checked="checked"'; } ?> />
    … …  
    13521352                                </span><!-- /.checkboxes -->
    13531353                </p>
    1354                         <?php 
     1354                        <?php
    13551355                    }
    13561356                    //Do nothing
    1357                     else 
     1357                    else
    13581358                    {
    1359                        
     1359
    13601360                    }
    1361                        
     1361
    13621362                }
    13631363                //Error message for menus not existing
    1364                 else 
     1364                else
    13651365                {
    13661366                        ?>
    … …  
    13711371                }
    13721372        }
    1373        
     1373
    13741374}
    13751375
    … …  
    14091409
    14101410        register_widget('WP_Widget_Tag_Cloud');
    1411        
     1411
    14121412        register_widget('WP_CustomNavWidget');
    1413        
     1413
    14141414        do_action('widgets_init');
    14151415}
Note: See TracChangeset for help on using the changeset viewer.