]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/widgets.php
WordPress 3.7-scripts
[autoinstalls/wordpress.git] / wp-admin / widgets.php
index 6c05e533033564b21af22938928634738830de69..db2a279f89a25ef7377e91fdce4a6f175f377508 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 /** WordPress Administration Bootstrap */
-require_once( './admin.php' );
+require_once( dirname( __FILE__ ) . '/admin.php' );
 
 /** WordPress Administration Widgets API */
 require_once(ABSPATH . 'wp-admin/includes/widgets.php');
@@ -25,11 +25,20 @@ function wp_widgets_access_body_class($classes) {
        return "$classes widgets_access ";
 }
 
-if ( 'on' == $widgets_access )
+if ( 'on' == $widgets_access ) {
        add_filter( 'admin_body_class', 'wp_widgets_access_body_class' );
-else
+} else {
        wp_enqueue_script('admin-widgets');
 
+       if ( wp_is_mobile() )
+               wp_enqueue_script( 'jquery-touch-punch' );
+}
+
+/**
+ * Fires early before the Widgets administration screen loads, after scripts are enqueued.
+ *
+ * @since 2.2.0
+ */
 do_action( 'sidebar_admin_setup' );
 
 $title = __( 'Widgets' );
@@ -55,7 +64,7 @@ get_current_screen()->add_help_tab( array(
 'title'                => __('Missing Widgets'),
 'content'      =>
        '<p>' . __('Many themes show some sidebar widgets by default until you edit your sidebars, but they are not automatically displayed in your sidebar management tool. After you make your first widget change, you can re-add the default widgets by adding them from the Available Widgets area.') . '</p>' .
-               '<p>' . __('When changing themes, there is often some variation in the number and setup of widget areas/sidebars and sometimes these conflicts make the transition a bit less smooth. If you changed themes and seem to be missing widgets, scroll down on this screen to the Inactive area, where all your widgets and their settings will have been saved.') . '</p>'
+               '<p>' . __('When changing themes, there is often some variation in the number and setup of widget areas/sidebars and sometimes these conflicts make the transition a bit less smooth. If you changed themes and seem to be missing widgets, scroll down on this screen to the Inactive Widgets area, where all of your widgets and their settings will have been saved.') . '</p>'
 ) );
 
 get_current_screen()->set_help_sidebar(
@@ -64,23 +73,8 @@ get_current_screen()->set_help_sidebar(
        '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
 );
 
-if ( empty($wp_registered_sidebars) ) {
-       // the theme has no sidebars, die.
-       require_once( './admin-header.php' );
-?>
-
-       <div class="wrap">
-       <?php screen_icon(); ?>
-       <h2><?php echo esc_html( $title ); ?></h2>
-               <div class="error">
-                       <p><?php _e( 'No Sidebars Defined' ); ?></p>
-               </div>
-               <p><?php _e( 'The theme you are currently using isn&#8217;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://codex.wordpress.org/Widgetizing_Themes">follow these instructions</a>.' ); ?></p>
-       </div>
-
-<?php
-       require_once( './admin-footer.php' );
-       exit;
+if ( ! current_theme_supports( 'widgets' ) ) {
+       wp_die( __( 'The theme you are currently using isn&#8217;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://codex.wordpress.org/Widgetizing_Themes">follow these instructions</a>.' ) );
 }
 
 // These are the widgets grouped by sidebar
@@ -193,7 +187,8 @@ if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) {
 
        if ( isset($_GET['addnew']) ) {
                // Default to the first sidebar
-               $sidebar = array_shift( $keys = array_keys($wp_registered_sidebars) );
+               $keys = array_keys( $wp_registered_sidebars );
+               $sidebar = array_shift( $keys );
 
                if ( isset($_GET['base']) && isset($_GET['num']) ) { // multi-widget
                        // Copy minimal info from an existing instance of this widget to a new instance
@@ -232,7 +227,7 @@ if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) {
        $width = ' style="width:' . max($control['width'], 350) . 'px"';
        $key = isset($_GET['key']) ? (int) $_GET['key'] : 0;
 
-       require_once( './admin-header.php' ); ?>
+       require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?>
        <div class="wrap">
        <?php screen_icon(); ?>
        <h2><?php echo esc_html( $title ); ?></h2>
@@ -299,7 +294,7 @@ if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) {
        </div>
        </div>
 <?php
-       require_once( './admin-footer.php' );
+       require_once( ABSPATH . 'wp-admin/admin-footer.php' );
        exit;
 }
 
@@ -312,7 +307,7 @@ $errors = array(
        __('Error in displaying the widget settings form.')
 );
 
-require_once( './admin-header.php' ); ?>
+require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
@@ -325,7 +320,13 @@ require_once( './admin-header.php' ); ?>
 <div id="message" class="error"><p><?php echo $errors[$_GET['error']]; ?></p></div>
 <?php } ?>
 
-<?php do_action( 'widgets_admin_page' ); ?>
+<?php
+/**
+ * Fires before the Widgets administration page content loads.
+ *
+ * @since 3.0.0
+ */
+do_action( 'widgets_admin_page' ); ?>
 
 <div class="widget-liquid-left">
 <div id="widgets-left">
@@ -356,12 +357,12 @@ foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
                        <div class="sidebar-name">
                                <div class="sidebar-name-arrow"><br /></div>
                                <h3><?php echo esc_html( $registered_sidebar['name'] ); ?>
-                                       <span><img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" /></span>
+                                       <span class="spinner"></span>
                                </h3>
                        </div>
                        <div class="widget-holder inactive">
                                <?php wp_list_widget_controls( $registered_sidebar['id'] ); ?>
-                               <br class="clear" />
+                               <div class="clear"></div>
                        </div>
                </div>
 <?php
@@ -391,7 +392,7 @@ foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
        <div class="sidebar-name">
        <div class="sidebar-name-arrow"><br /></div>
        <h3><?php echo esc_html( $registered_sidebar['name'] ); ?>
-       <span><img src="<?php echo esc_url( admin_url( 'images/wpspin_dark.gif' ) ); ?>" class="ajax-feedback" title="" alt="" /></span></h3></div>
+       <span class="spinner"></span></h3></div>
        <?php wp_list_widget_controls( $sidebar ); // Show the control forms for each of the widgets in this sidebar ?>
        </div>
 <?php
@@ -406,5 +407,11 @@ foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
 </div>
 
 <?php
+
+/**
+ * Fires after the available widgets and sidebars have loaded, before the admin footer.
+ *
+ * @since 2.2.0
+ */
 do_action( 'sidebar_admin_page' );
-require_once( './admin-footer.php' );
+require_once( ABSPATH . 'wp-admin/admin-footer.php' );