]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/widgets.php
WordPress 4.3
[autoinstalls/wordpress.git] / wp-admin / includes / widgets.php
index dae95509aabe376ed3c682761dc5a1199ff8a9cd..36cf6449a8cc0ca76303d3276af9a1b57b6308f1 100644 (file)
  * Display list of the available widgets.
  *
  * @since 2.5.0
  * Display list of the available widgets.
  *
  * @since 2.5.0
+ *
+ * @global array $wp_registered_widgets
+ * @global array $wp_registered_widget_controls
  */
 function wp_list_widgets() {
  */
 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' );
 
        $sort = $wp_registered_widgets;
        usort( $sort, '_sort_name_callback' );
@@ -51,6 +54,8 @@ function wp_list_widgets() {
  *
  * @since 3.1.0
  * @access private
  *
  * @since 3.1.0
  * @access private
+ *
+ * @return int
  */
 function _sort_name_callback( $a, $b ) {
        return strnatcasecmp( $a['name'], $b['name'] );
  */
 function _sort_name_callback( $a, $b ) {
        return strnatcasecmp( $a['name'], $b['name'] );
@@ -63,22 +68,35 @@ function _sort_name_callback( $a, $b ) {
  * @since 2.5.0
  *
  * @param string $sidebar id slug of the sidebar
  * @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' );
 
        add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' );
 
-       echo "<div id='$sidebar' class='widgets-sortables'>\n";
-
        $description = wp_sidebar_description( $sidebar );
 
        $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 );
        dynamic_sidebar( $sidebar );
-       echo "</div>\n";
+
+       echo '</div>';
 }
 
 /**
 }
 
 /**
@@ -86,6 +104,10 @@ function wp_list_widget_controls( $sidebar ) {
  *
  * @since 2.5.0
  *
  *
  * @since 2.5.0
  *
+ * @global array $wp_registered_widgets
+ *
+ * @staticvar int $i
+ *
  * @param array $params
  * @return array
  */
  * @param array $params
  * @return array
  */
@@ -110,7 +132,14 @@ function wp_list_widget_controls_dynamic_sidebar( $params ) {
        return $params;
 }
 
        return $params;
 }
 
-function next_widget_id_number($id_base) {
+/**
+ *
+ * @global array $wp_registered_widgets
+ *
+ * @param string $id_base
+ * @return int
+ */
+function next_widget_id_number( $id_base ) {
        global $wp_registered_widgets;
        $number = 1;
 
        global $wp_registered_widgets;
        $number = 1;
 
@@ -130,6 +159,10 @@ function next_widget_id_number($id_base) {
  *
  * @since 2.5.0
  *
  *
  * @since 2.5.0
  *
+ * @global array $wp_registered_widgets
+ * @global array $wp_registered_widget_controls
+ * @global array $sidebars_widgets
+ *
  * @param array $sidebar_args
  * @return array
  */
  * @param array $sidebar_args
  * @return array
  */
@@ -160,11 +193,14 @@ function wp_widget_control( $sidebar_args ) {
                $query_arg['key'] = $key;
        }
 
                $query_arg['key'] = $key;
        }
 
-       // We aren't showing a widget control, we're outputting a template for a multi-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;
        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__';
        }
                if ( isset($control['id_base']) )
                        $id_format = $control['id_base'] . '-__i__';
        }
@@ -189,7 +225,7 @@ function wp_widget_control( $sidebar_args ) {
        </div>
 
        <div class="widget-inside">
        </div>
 
        <div class="widget-inside">
-       <form action="" method="post">
+       <form method="post">
        <div class="widget-content">
 <?php
        if ( isset($control['callback']) )
        <div class="widget-content">
 <?php
        if ( isset($control['callback']) )
@@ -224,5 +260,6 @@ function wp_widget_control( $sidebar_args ) {
        </div>
 <?php
        echo $sidebar_args['after_widget'];
        </div>
 <?php
        echo $sidebar_args['after_widget'];
+
        return $sidebar_args;
 }
        return $sidebar_args;
 }