Changeset 5700 for trunk/wp-admin/widgets.php
- Timestamp:
- 06/14/2007 02:25:30 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/widgets.php
r5631 r5700 11 11 function wp_widgets_admin_head() { 12 12 global $wp_registered_sidebars, $wp_registered_widgets, $wp_registered_widget_controls; 13 13 14 14 define( 'WP_WIDGETS_WIDTH', 1 + 262 * ( count( $wp_registered_sidebars ) ) ); 15 15 define( 'WP_WIDGETS_HEIGHT', 35 * ( count( $wp_registered_widgets ) ) ); … … 31 31 <?php 32 32 } 33 33 34 34 $cols = array(); 35 35 foreach ( $wp_registered_sidebars as $index => $sidebar ) { … … 37 37 } 38 38 $cols = implode( ', ', $cols ); 39 39 40 40 $widgets = array(); 41 41 foreach ( $wp_registered_widgets as $name => $widget ) { … … 180 180 function wp_widget_draggable( $name ) { 181 181 global $wp_registered_widgets, $wp_registered_widget_controls; 182 182 183 183 if ( !isset( $wp_registered_widgets[$name] ) ) { 184 184 return; 185 185 } 186 186 187 187 $sanitized_name = sanitize_title( $wp_registered_widgets[$name]['id'] ); 188 188 $link_title = __( 'Configure' ); … … 190 190 ? ' <div class="popper" id="' . $sanitized_name . 'popper" title="' . $link_title . '">≡</div>' 191 191 : ''; 192 192 193 193 $output = '<li class="module" id="widgetprefix-%1$s"><span class="handle">%2$s</span></li>'; 194 194 195 195 printf( $output, $sanitized_name, $wp_registered_widgets[$name]['name'] . $popper ); 196 196 } … … 205 205 <div class="wrap"> 206 206 <h2><?php _e( 'No Sidebars Defined' ); ?></h2> 207 207 208 208 <p><?php _e( 'You are seeing this message because the theme you are currently using isn’t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="http://automattic.com/code/widgets/themes/">follow these instructions</a>.' ); /* TODO: article on codex */; ?></p> 209 209 </div> 210 210 <?php 211 211 212 212 require_once 'admin-footer.php'; 213 213 exit; … … 222 222 if ( isset( $_POST['action'] ) ) { 223 223 check_admin_referer( 'widgets-save-widget-order' ); 224 224 225 225 switch ( $_POST['action'] ) { 226 226 case 'default' : … … 228 228 wp_set_sidebars_widgets( $sidebars_widgets ); 229 229 break; 230 230 231 231 case 'save_widget_order' : 232 232 $sidebars_widgets = array(); 233 233 234 234 foreach ( $wp_registered_sidebars as $index => $sidebar ) { 235 235 $postindex = $index . 'order'; 236 236 237 237 parse_str( $_POST[$postindex], $order ); 238 238 239 239 $new_order = $order[$index]; 240 240 241 241 if ( is_array( $new_order ) ) { 242 242 foreach ( $new_order as $sanitized_name ) { … … 249 249 } 250 250 } 251 251 252 252 wp_set_sidebars_widgets( $sidebars_widgets ); 253 253 break; … … 261 261 foreach ( $wp_registered_widgets as $name => $widget ) { 262 262 $is_active = false; 263 263 264 264 foreach ( $wp_registered_sidebars as $index => $sidebar ) { 265 265 if ( is_array( $sidebars_widgets[$index] ) && in_array( $name, $sidebars_widgets[$index] ) ) { … … 268 268 } 269 269 } 270 270 271 271 if ( !$is_active ) { 272 272 $inactive_widgets[] = $name; … … 298 298 <div class="wrap"> 299 299 <h2><?php _e( 'Sidebar Arrangement' ); ?></h2> 300 300 301 301 <p><?php _e( 'You can drag and drop widgets onto your sidebar below.' ); ?></p> 302 302 303 303 <form id="sbadmin" method="post" onsubmit="serializeAll();"> 304 304 <p class="submit"> … … 310 310 ?> 311 311 <input type="hidden" id="<?php echo $index; ?>order" name="<?php echo $index; ?>order" value="" /> 312 312 313 313 <div class="dropzone"> 314 314 <h3><?php echo $sidebar['name']; ?></h3> 315 315 316 316 <div id="<?php echo $index; ?>placematt" class="module placemat"> 317 317 <span class="handle"> … … 320 320 </span> 321 321 </div> 322 322 323 323 <ul id="<?php echo $index; ?>"> 324 324 <?php … … 334 334 } 335 335 ?> 336 336 337 337 <br class="clear" /> 338 338 339 339 </div> 340 340 341 341 <div id="palettediv"> 342 342 <h3><?php _e( 'Available Widgets' ); ?></h3> 343 343 344 344 <ul id="palette"> 345 345 <?php … … 351 351 </ul> 352 352 </div> 353 353 354 354 <script type="text/javascript"> 355 355 // <![CDATA[ … … 363 363 // ]]> 364 364 </script> 365 365 366 366 <p class="submit"> 367 367 <?php wp_nonce_field( 'widgets-save-widget-order' ); ?> … … 369 369 <input type="submit" value="<?php _e( 'Save Changes »' ); ?>" /> 370 370 </p> 371 371 372 372 <div id="controls"> 373 373 <?php foreach ( $wp_registered_widget_controls as $name => $widget ) { ?> … … 382 382 </div> 383 383 </form> 384 384 385 385 <br class="clear" /> 386 386 </div> 387 387 388 388 <div id="shadow"> </div> 389 389 390 390 <?php do_action( 'sidebar_admin_page' ); ?> 391 391
Note: See TracChangeset
for help on using the changeset viewer.