]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/widgets.php
WordPress 4.0
[autoinstalls/wordpress.git] / wp-admin / includes / widgets.php
index a591c60d87eac7d57a853c50887fafa61d75f9c6..c869449434cd41093df394743f4e7dd94fe478db 100644 (file)
@@ -12,7 +12,7 @@
  * @since 2.5.0
  */
 function wp_list_widgets() {
-       global $wp_registered_widgets, $sidebars_widgets, $wp_registered_widget_controls;
+       global $wp_registered_widgets, $wp_registered_widget_controls;
 
        $sort = $wp_registered_widgets;
        usort( $sort, '_sort_name_callback' );
@@ -58,27 +58,40 @@ function _sort_name_callback( $a, $b ) {
 
 /**
  * Show the widgets and their settings for a sidebar.
- * Used in the the admin widget config screen.
+ * Used in the admin widget config screen.
  *
  * @since 2.5.0
  *
  * @param string $sidebar id slug of the sidebar
+ * @param string optional $sidebar_name Include the HTML for the sidebar name
  */
-function wp_list_widget_controls( $sidebar ) {
+function wp_list_widget_controls( $sidebar, $sidebar_name = '' ) {
        add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' );
 
-       echo "<div id='$sidebar' class='widgets-sortables'>\n";
-
        $description = wp_sidebar_description( $sidebar );
 
-       if ( !empty( $description ) ) {
-               echo "<div class='sidebar-description'>\n";
-               echo "\t<p class='description'>$description</p>";
-               echo "</div>\n";
+       echo '<div id="' . esc_attr( $sidebar ) . '" class="widgets-sortables">';
+
+       if ( $sidebar_name ) {
+               ?>
+               <div class="sidebar-name">
+                       <div class="sidebar-name-arrow"><br /></div>
+                       <h3><?php echo esc_html( $sidebar_name ); ?> <span class="spinner"></span></h3>
+               </div>
+               <?php
+       }
+
+       echo '<div class="sidebar-description">';
+
+       if ( ! empty( $description ) ) {
+               echo '<p class="description">' . $description . '</p>';
        }
 
+       echo '</div>';
+
        dynamic_sidebar( $sidebar );
-       echo "</div>\n";
+
+       echo '</div>';
 }
 
 /**
@@ -160,11 +173,14 @@ function wp_widget_control( $sidebar_args ) {
                $query_arg['key'] = $key;
        }
 
-       // We aren't showing a widget control, we're outputing a template for a mult-widget control
+       /*
+        * We aren't showing a widget control, we're outputting a template
+        * for a multi-widget control.
+        */
        if ( isset($sidebar_args['_display']) && 'template' == $sidebar_args['_display'] && $widget_number ) {
                // number == -1 implies a template where id numbers are replaced by a generic '__i__'
                $control['params'][0]['number'] = -1;
-               // with id_base widget id's are constructed like {$id_base}-{$id_number}
+               // With id_base widget id's are constructed like {$id_base}-{$id_number}.
                if ( isset($control['id_base']) )
                        $id_format = $control['id_base'] . '-__i__';
        }
@@ -179,7 +195,11 @@ function wp_widget_control( $sidebar_args ) {
        <div class="widget-top">
        <div class="widget-title-action">
                <a class="widget-action hide-if-no-js" href="#available-widgets"></a>
-               <a class="widget-control-edit hide-if-js" href="<?php echo esc_url( add_query_arg( $query_arg ) ); ?>"><span class="edit"><?php _e('Edit'); ?></span><span class="add"><?php _e('Add'); ?></span></a>
+               <a class="widget-control-edit hide-if-js" href="<?php echo esc_url( add_query_arg( $query_arg ) ); ?>">
+                       <span class="edit"><?php _ex( 'Edit', 'widget' ); ?></span>
+                       <span class="add"><?php _ex( 'Add', 'widget' ); ?></span>
+                       <span class="screen-reader-text"><?php echo $widget_title; ?></span>
+               </a>
        </div>
        <div class="widget-title"><h4><?php echo $widget_title ?><span class="in-widget-title"></span></h4></div>
        </div>
@@ -207,8 +227,8 @@ function wp_widget_control( $sidebar_args ) {
                <a class="widget-control-close" href="#close"><?php _e('Close'); ?></a>
                </div>
                <div class="alignright<?php if ( 'noform' === $has_form ) echo ' widget-control-noform'; ?>">
-               <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback " title="" alt="" />
-               <?php submit_button( __( 'Save' ), 'button-primary widget-control-save', 'savewidget', false ); ?>
+                       <?php submit_button( __( 'Save' ), 'button-primary widget-control-save right', 'savewidget', false, array( 'id' => 'widget-' . esc_attr( $id_format ) . '-savewidget' ) ); ?>
+                       <span class="spinner"></span>
                </div>
                <br class="clear" />
        </div>
@@ -220,6 +240,6 @@ function wp_widget_control( $sidebar_args ) {
        </div>
 <?php
        echo $sidebar_args['after_widget'];
+
        return $sidebar_args;
 }
-