Changeset 13257
- Timestamp:
- 02/20/2010 09:57:43 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 16 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/menu.php
r13217 r13257 109 109 $submenu['themes.php'][10] = array(_x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php'); 110 110 $submenu['themes.php'][15] = array(__('Add New Themes'), 'install_themes', 'theme-install.php'); 111 $submenu['themes.php'][20] = array(__('Custom Navigation'), 'switch_themes', 'custom-navigation.php'); 111 112 112 113 $update_plugins = get_site_transient( 'update_plugins' ); -
trunk/wp-includes/default-widgets.php
r13248 r13257 1002 1002 1003 1003 /** 1004 * Custom Navigation widget class 1005 * 1006 * @since 3.0.0 1007 */ 1008 class WP_CustomNavWidget extends WP_Widget { 1009 1010 function WP_CustomNavWidget() { 1011 $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) { 1016 $navmenu = $instance['navmenu']; 1017 $navtitle = $instance['navtitle']; 1018 $navdeveloper = strtolower($instance['navdeveloper']); 1019 $navdiv = strtolower($instance['navdiv']); 1020 $navul = strtolower($instance['navul']); 1021 $navdivid = $instance['navdivid']; 1022 $navdivclass = $instance['navdivclass']; 1023 $navulid = $instance['navulid']; 1024 $navulclass = $instance['navulclass']; 1025 1026 //Override for menu descriptions 1027 $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options'); 1028 if ($advanced_option_descriptions == 'no') 1029 { 1030 $navwidgetdescription = 2; 1031 } 1032 else 1033 { 1034 $navwidgetdescription = $instance['navwidgetdescription']; 1035 } 1036 $menuexists = false; 1037 1038 global $wpdb; 1039 1040 //GET menu name 1041 if ($navmenu > 0) 1042 { 1043 $table_name_menus = $wpdb->prefix . "custom_nav_menus"; 1044 $wp_result = $wpdb->get_results("SELECT menu_name FROM ".$table_name_menus." WHERE id='".$navmenu."'"); 1045 $wp_custom_nav_menu_name = $wp_result[0]->menu_name; 1046 $menuexists = true; 1047 } 1048 //Do nothing 1049 else 1050 { 1051 $menuexists = false; 1052 } 1053 ?> 1054 1055 <?php 1056 //DEVELOPER settings enabled 1057 if ($navdeveloper == 'yes') 1058 { 1059 //DISPLAY Custom DIV 1060 if ($navdiv == 'yes') 1061 { 1062 ?> 1063 <div id="<?php echo $navdivid; ?>" class="<?php echo $navdivclass; ?>"> 1064 <?php 1065 } 1066 //Do NOT display DIV 1067 else 1068 { 1069 1070 } 1071 1072 } 1073 //DISPLAY default DIV 1074 else 1075 { 1076 ?> 1077 <div class="widget"> 1078 <?php 1079 } 1080 ?> 1081 1082 <h3><?php echo $navtitle; ?></h3> 1083 <?php 1084 1085 if ($menuexists) 1086 { 1087 ?> 1088 <?php 1089 1090 //DEVELOPER settings enabled 1091 if ($navdeveloper == 'yes') 1092 { 1093 //DISPLAY Custom UL 1094 if ($navul == 'yes') 1095 { 1096 ?> 1097 <ul id="<?php echo $navulid; ?>" class="<?php echo $navulclass; ?>"> 1098 <?php 1099 } 1100 //Do NOT display UL 1101 else 1102 { 1103 1104 } 1105 1106 } 1107 //DISPLAY default UL 1108 else 1109 { 1110 ?> 1111 <ul class="custom-nav"> 1112 <?php 1113 } 1114 1115 ?> 1116 1117 <?php 1118 //DISPLAY custom navigation menu 1119 if (get_option('wp_custom_nav_menu') == 'true') { 1120 custom_nav('name='.$wp_custom_nav_menu_name.'&desc='.$navwidgetdescription); 1121 } 1122 ?> 1123 1124 <?php 1125 1126 //DEVELOPER settings enabled 1127 if ($navdeveloper == 'yes') 1128 { 1129 //DISPLAY Custom UL 1130 if ($navul == 'yes') 1131 { 1132 ?> 1133 </ul> 1134 <?php 1135 } 1136 //Do NOT display UL 1137 else 1138 { 1139 1140 } 1141 1142 } 1143 //DISPLAY default UL 1144 else 1145 { 1146 ?> 1147 </ul> 1148 <?php 1149 } 1150 1151 ?> 1152 <?php 1153 } 1154 else 1155 { 1156 echo "You have not setup the custom navigation widget correctly, please check your settings in the backend."; 1157 } 1158 ?> 1159 <?php 1160 //DEVELOPER settings enabled 1161 if ($navdeveloper == 'yes') 1162 { 1163 //DISPLAY Custom DIV 1164 if ($navdiv == 'yes') 1165 { 1166 ?> 1167 </div> 1168 <?php 1169 } 1170 //Do NOT display DIV 1171 else 1172 { 1173 1174 } 1175 1176 } 1177 //DISPLAY default DIV 1178 else 1179 { 1180 ?> 1181 </div> 1182 <?php 1183 } 1184 ?><!-- /#nav-container --> 1185 1186 <?php 1187 } 1188 1189 function update($new_instance, $old_instance) { 1190 return $new_instance; 1191 } 1192 1193 function form($instance) { 1194 $navmenu = esc_attr($instance['navmenu']); 1195 $navtitle = esc_attr($instance['navtitle']); 1196 $navdeveloper = esc_attr($instance['navdeveloper']); 1197 $navdiv = esc_attr($instance['navdiv']); 1198 $navul = esc_attr($instance['navul']); 1199 $navdivid = esc_attr($instance['navdivid']); 1200 $navdivclass = esc_attr($instance['navdivclass']); 1201 $navulid = esc_attr($instance['navulid']); 1202 $navulclass = esc_attr($instance['navulclass']); 1203 $navwidgetdescription = esc_attr($instance['navwidgetdescription']); 1204 1205 global $wpdb; 1206 1207 //GET Menu Items for SELECT OPTIONS 1208 $table_name_custom_menus = $wpdb->prefix . "custom_nav_menus"; 1209 $custom_menu_records = $wpdb->get_results("SELECT id,menu_name FROM ".$table_name_custom_menus); 1210 1211 //CHECK if menus exist 1212 if ($custom_menu_records > 0) 1213 { 1214 1215 ?> 1216 1217 <p> 1218 <label for="<?php echo $this->get_field_id('navmenu'); ?>"><?php _e('Select Menu:'); ?></label> 1219 1220 <select id="<?php echo $this->get_field_id('navmenu'); ?>" name="<?php echo $this->get_field_name('navmenu'); ?>"> 1221 <?php 1222 1223 //DISPLAY SELECT OPTIONS 1224 foreach ($custom_menu_records as $custom_menu_record) 1225 { 1226 if ($navmenu == $custom_menu_record->id) { 1227 $selected_option = 'selected="selected"'; 1228 } 1229 else { 1230 $selected_option = ''; 1231 } 1232 ?> 1233 <option value="<?php echo $custom_menu_record->id; ?>" <?php echo $selected_option; ?>><?php echo $custom_menu_record->menu_name; ?></option> 1234 <?php 1235 1236 } 1237 ?> 1238 </select> 1239 1240 </p> 1241 1242 <p> 1243 1244 <label for="<?php echo $this->get_field_id('navtitle'); ?>"><?php _e('Title:'); ?></label> 1245 <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'); ?>" /> 1246 </p> 1247 1248 <p> 1249 <?php 1250 $checked = strtolower($navdeveloper); 1251 ?> 1252 1253 <label for="<?php echo $this->get_field_id('navdeveloper'); ?>"><?php _e('Advanced Options:'); ?></label><br /> 1254 <span class="checkboxes"> 1255 <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"'; } ?> /> 1256 <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"'; } ?> /> 1257 </span><!-- /.checkboxes --> 1258 1259 </p> 1260 1261 <?php 1262 1263 //DEVELOPER settings 1264 if ($checked == 'yes') 1265 { 1266 ?> 1267 1268 <p> 1269 <?php 1270 $checked = strtolower($navdiv); 1271 ?> 1272 1273 <label for="<?php echo $this->get_field_id('navdiv'); ?>"><?php _e('Wrap in container DIV:'); ?></label><br /> 1274 <span class="checkboxes"> 1275 <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"'; } ?> /> 1276 <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"'; } ?> /> 1277 </span><!-- /.checkboxes --> 1278 1279 </p> 1280 1281 <?php 1282 1283 if ($checked == 'yes') 1284 { 1285 1286 ?> 1287 1288 <p> 1289 1290 <label for="<?php echo $this->get_field_id('navdivid'); ?>"><?php _e('DIV id:'); ?></label> 1291 <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'); ?>" /> 1292 </p> 1293 <p> 1294 1295 <label for="<?php echo $this->get_field_id('navdivclass'); ?>"><?php _e('DIV class:'); ?></label> 1296 <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'); ?>" /> 1297 </p> 1298 1299 <?php 1300 1301 } 1302 1303 ?> 1304 1305 <p> 1306 <?php 1307 $checked = strtolower($navul); 1308 ?> 1309 1310 <label for="<?php echo $this->get_field_id('navul'); ?>"><?php _e('Wrap in container UL:'); ?></label><br /> 1311 <span class="checkboxes"> 1312 <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"'; } ?> /> 1313 <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"'; } ?> /> 1314 </span><!-- /.checkboxes --> 1315 1316 </p> 1317 1318 <?php 1319 1320 if ($checked == 'yes') 1321 { 1322 1323 ?> 1324 1325 <p> 1326 1327 <label for="<?php echo $this->get_field_id('navulid'); ?>"><?php _e('UL id:'); ?></label> 1328 <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'); ?>" /> 1329 </p> 1330 <p> 1331 1332 <label for="<?php echo $this->get_field_id('navulclass'); ?>"><?php _e('UL class:'); ?></label> 1333 <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'); ?>" /> 1334 </p> 1335 1336 <?php 1337 1338 } 1339 1340 ?> 1341 <?php $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options'); ?> 1342 <p <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?>> 1343 1344 <?php 1345 $checked = strtolower($navwidgetdescription); 1346 ?> 1347 1348 <label for="<?php echo $this->get_field_id('navwidgetdescription'); ?>"><?php _e('Show Top Level Descriptions:'); ?></label><br /> 1349 <span class="checkboxes"> 1350 <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"'; } ?> /> 1351 <label>No</label><input type="radio" id="<?php echo $this->get_field_name('navwidgetdescription'); ?>" name="<?php echo $this->get_field_name('navwidgetdescription'); ?>" value="2" <?php if ($checked=='1') { } else { echo 'checked="checked"'; } ?> /> 1352 </span><!-- /.checkboxes --> 1353 </p> 1354 <?php 1355 } 1356 //Do nothing 1357 else 1358 { 1359 1360 } 1361 1362 } 1363 //Error message for menus not existing 1364 else 1365 { 1366 ?> 1367 <p> 1368 <label><?php _e('The Custom Navigation has not been configured correctly. Please check your Custom Navigation settings before adding this widget.'); ?></label> 1369 </p> 1370 <?php 1371 } 1372 } 1373 1374 } 1375 1376 /** 1004 1377 * Register all of the default WordPress widgets on startup. 1005 1378 * … … 1036 1409 1037 1410 register_widget('WP_Widget_Tag_Cloud'); 1038 1411 1412 register_widget('WP_CustomNavWidget'); 1413 1039 1414 do_action('widgets_init'); 1040 1415 } -
trunk/wp-includes/general-template.php
r13242 r13257 2216 2216 } 2217 2217 2218 /** 2219 * Outputs the Custom Navigation. 2220 * 2221 * @since 3.0.0 2222 */ 2223 function custom_nav($args = array()) { 2224 require_once (ABSPATH . WPINC . '/custom-navigation-functions.php'); 2225 wp_custom_navigation_output($args); 2226 } 2227 2218 2228 ?> -
trunk/wp-includes/post.php
r13242 r13257 64 64 ) ); 65 65 66 register_post_type( 'menu_item', array( 'public' => false, 67 'show_ui' => false, 68 '_builtin' => true, 69 'capability_type' => 'post', 70 'hierarchical' => false, 71 'rewrite' => false, 72 'query_var' => false, 73 ) ); 66 74 register_post_status( 'publish', array( 'label' => _x('Published', 'post'), 67 75 'public' => true, … … 105 113 '_builtin' => true, 106 114 'label_count' => _n_noop('Auto-Draft <span class="count">(%s)</span>', 'Auto-Drafts <span class="count">(%s)</span>') 115 ) ); 116 117 register_post_status( 'menu-category', array( 'internal' => true, 118 '_builtin' => true 119 ) ); 120 121 register_post_status( 'menu-page', array( 'internal' => true, 122 '_builtin' => true 123 ) ); 124 125 register_post_status( 'menu-custom', array( 'internal' => true, 126 '_builtin' => true 107 127 ) ); 108 128 } -
trunk/wp-includes/script-loader.php
r13239 r13257 395 395 396 396 } 397 398 //Custom Navigation 399 400 $scripts->add( 'custom-navigation-jquery', '/wp-admin/js/custom-navigation-custom-jquery-1.3.2.js', false, '1.3.2' ); 401 402 $scripts->add( 'custom-navigation-ui-custom', '/wp-admin/js/custom-navigation-custom-jquery-ui-1.7.2.js', array('custom-navigation-jquery'), '1.7.2' ); 403 $scripts->add_data( 'custom-navigation-ui-custom', 'group', 1 ); 404 405 $scripts->add( 'custom-navigation-autocomplete', '/wp-admin/js/custom-navigation-custom-jquery-autocomplete.js', array('custom-navigation-jquery'), '1.0.0' ); 406 $scripts->add_data( 'custom-navigation-autocomplete', 'group', 1 ); 407 408 $scripts->add( 'custom-navigation-default-items', '/wp-admin/js/custom-navigation-default-items.js', false, '1.0.0' ); 409 $scripts->add( 'custom-navigation-dynamic-functions', '/wp-admin/js/custom-navigation-dynamic-functions.js', false, '1.0.0' ); 410 $scripts->add( 'custom-navigation-php-functions', '/wp-admin/js/custom-navigation-php-functions.js', false, '1.0.0' ); 411 397 412 } 398 413 … … 460 475 $styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' ); 461 476 $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' ); 462 477 $styles->add( 'custom-navigation', "/wp-admin/css/custom-navigation$suffix.css", array(), '20100215' ); 478 463 479 foreach ( $rtl_styles as $rtl_style ) 464 480 $styles->add_data( $rtl_style, 'rtl', true ); -
trunk/wp-includes/taxonomy.php
r13216 r13257 38 38 '_builtin' => true 39 39 ) ) ; 40 41 register_taxonomy( 'menu', 'post', array( 'hierarchical' => false, 42 'query_var' => false, 43 'rewrite' => false 44 ) ) ; 40 45 41 46 register_taxonomy( 'link_category', 'link', array( 'hierarchical' => false,
Note: See TracChangeset
for help on using the changeset viewer.