]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/dashboard.php
Wordpress 3.3
[autoinstalls/wordpress.git] / wp-admin / includes / dashboard.php
index 1d3f373f7e11dde7c5295154a60fccecd5f2ff87..80be66bd8e66e1175e99b32e61a9d9db5946b5aa 100644 (file)
@@ -176,7 +176,7 @@ function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_
        if ( 'dashboard_browser_nag' === $widget_id )
                $priority = 'high';
 
-       add_meta_box( $widget_id, $widget_name, $callback, $screen->id, $location, $priority );
+       add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority );
 }
 
 function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
@@ -200,33 +200,33 @@ function wp_dashboard() {
        $hide2 = $hide3 = $hide4 = '';
        switch ( $screen_layout_columns ) {
                case 4:
-                       $width = 'width:24.5%;';
+                       $width = 'width:25%;';
                        break;
                case 3:
-                       $width = 'width:32.67%;';
+                       $width = 'width:33.333333%;';
                        $hide4 = 'display:none;';
                        break;
                case 2:
-                       $width = 'width:49%;';
+                       $width = 'width:50%;';
                        $hide3 = $hide4 = 'display:none;';
                        break;
                default:
-                       $width = 'width:98%;';
+                       $width = 'width:100%;';
                        $hide2 = $hide3 = $hide4 = 'display:none;';
        }
 ?>
 <div id="dashboard-widgets" class="metabox-holder">
 <?php
-       echo "\t<div class='postbox-container' style='$width'>\n";
+       echo "\t<div id='postbox-container-1' class='postbox-container' style='$width'>\n";
        do_meta_boxes( $screen->id, 'normal', '' );
 
-       echo "\t</div><div class='postbox-container' style='{$hide2}$width'>\n";
+       echo "\t</div><div id='postbox-container-2' class='postbox-container' style='{$hide2}$width'>\n";
        do_meta_boxes( $screen->id, 'side', '' );
 
-       echo "\t</div><div class='postbox-container' style='{$hide3}$width'>\n";
+       echo "\t</div><div id='postbox-container-3' class='postbox-container' style='{$hide3}$width'>\n";
        do_meta_boxes( $screen->id, 'column3', '' );
 
-       echo "\t</div><div class='postbox-container' style='{$hide4}$width'>\n";
+       echo "\t</div><div id='postbox-container-4' class='postbox-container' style='{$hide4}$width'>\n";
        do_meta_boxes( $screen->id, 'column4', '' );
 ?>
 </div></div>
@@ -387,7 +387,11 @@ function wp_dashboard_right_now() {
        $ct = current_theme_info();
 
        echo "\n\t<p>";
-       if ( !empty($wp_registered_sidebars) ) {
+
+       if ( empty( $ct->stylesheet_dir ) ) {
+               if ( ! is_multisite() || is_super_admin() )
+                       echo '<span class="error-message">' . __('ERROR: The themes directory is either empty or doesn&#8217;t exist. Please check your installation.') . '</span>';
+       } elseif ( ! empty($wp_registered_sidebars) ) {
                $sidebars_widgets = wp_get_sidebars_widgets();
                $num_widgets = 0;
                foreach ( (array) $sidebars_widgets as $k => $v ) {
@@ -531,8 +535,8 @@ function wp_dashboard_quick_press() {
                </div>
 
                <?php if ( current_user_can( 'upload_files' ) ) : ?>
-               <div id="media-buttons" class="hide-if-no-js">
-                       <?php do_action( 'media_buttons' ); ?>
+               <div id="wp-content-wrap" class="wp-editor-wrap hide-if-no-js wp-media-buttons">
+                       <?php do_action( 'media_buttons', 'content' ); ?>
                </div>
                <?php endif; ?>
 
@@ -550,7 +554,7 @@ function wp_dashboard_quick_press() {
 
                <p class="submit">
                        <input type="hidden" name="action" id="quickpost-action" value="post-quickpress-save" />
-                       <input type="hidden" name="quickpress_post_ID" value="<?php echo $post_ID; ?>" />
+                       <input type="hidden" name="post_ID" value="<?php echo $post_ID; ?>" />
                        <input type="hidden" name="post_type" value="post" />
                        <?php wp_nonce_field('add-post'); ?>
                        <?php submit_button( __( 'Save Draft' ), 'button', 'save', false, array( 'id' => 'save-post', 'tabindex'=> 4 ) ); ?>
@@ -1023,7 +1027,7 @@ function wp_dashboard_plugins_output() {
  * Checks to see if all of the feed url in $check_urls are cached.
  *
  * If $check_urls is empty, look for the rss feed url found in the dashboard
- * widget optios of $widget_id. If cached, call $callback, a function that
+ * widget options of $widget_id. If cached, call $callback, a function that
  * echoes out output for this widget. If not cache, echo a "Loading..." stub
  * which is later replaced by AJAX call (see top of /wp-admin/index.php)
  *
@@ -1189,7 +1193,7 @@ function wp_dashboard_browser_nag() {
                        $browser_nag_class = ' has-browser-icon';
                }
                $notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>";
-               $notice .= sprintf( __( '<p><a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a></p>' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), 'http://browsehappy.com/' );
+               $notice .= '<p>' . sprintf( __( '<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), 'http://browsehappy.com/' ) . '</p>';
                $notice .= '<p class="hide-if-no-js"><a href="" class="dismiss">' . __( 'Dismiss' ) . '</a></p>';
                $notice .= '<div class="clear"></div>';
        }
@@ -1259,4 +1263,101 @@ function wp_check_browser_version() {
  */
 function wp_dashboard_empty() {}
 
+/**
+ * Displays a welcome panel to introduce users to WordPress.
+ *
+ * @since 3.3
+ */
+function wp_welcome_panel() {
+       global $wp_version;
+
+       if ( ! current_user_can( 'edit_theme_options' ) )
+               return;
+
+       $classes = 'welcome-panel';
+
+       $option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
+       // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
+       $hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
+       if ( $hide )
+               $classes .= ' hidden';
+
+       list( $display_version ) = explode( '-', $wp_version );
+       ?>
+       <div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
+       <?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
+       <a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>"><?php _e('Dismiss'); ?></a>
+       <div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
+
+       <div class="welcome-panel-content">
+       <h3><?php _e( 'Welcome to your new WordPress site! ' ); ?></h3>
+       <p class="about-description"><?php _e( 'If you need help getting started, check out our documentation on <a href="http://codex.wordpress.org/First_Steps_With_WordPress">First Steps with WordPress</a>. If you&#8217;d rather dive right in, here are a few things most people do first when they set up a new WordPress site. If you need help, use the Help tabs in the upper right corner to get information on how to use your current screen and where to go for more assistance.' ); ?></p>
+       <div class="welcome-panel-column-container">
+       <div class="welcome-panel-column">
+               <h4><span class="icon16 icon-settings"></span> <?php _e( 'Basic Settings' ); ?></h4>
+               <p><?php _e( 'Here are a few easy things you can do to get your feet wet. Make sure to click Save on each Settings screen.' ); ?></p>
+               <ul>
+               <li><?php echo sprintf( __( '<a href="%s">Choose your privacy setting</a>' ), esc_url( admin_url('options-privacy.php') ) ); ?></li>
+               <li><?php echo sprintf( __( '<a href="%s">Select your tagline and time zone</a>' ), esc_url( admin_url('options-general.php') ) ); ?></li>
+               <li><?php echo sprintf( __( '<a href="%s">Turn comments on or off</a>' ), esc_url( admin_url('options-discussion.php') ) ); ?></li>
+               <li><?php echo sprintf( __( '<a href="%s">Fill in your profile</a>' ), esc_url( admin_url('profile.php') ) ); ?></li>
+               </ul>
+       </div>
+       <div class="welcome-panel-column">
+               <h4><span class="icon16 icon-page"></span> <?php _e( 'Add Real Content' ); ?></h4>
+               <p><?php _e( 'Check out the sample page & post editors to see how it all works, then delete the default content and write your own!' ); ?></p>
+               <ul>
+               <li><?php echo sprintf( __( 'View the <a href="%1$s">sample page</a> and <a href="%2$s">post</a>' ), esc_url( get_permalink( 2 ) ), esc_url( get_permalink( 1 ) ) ); ?></li>
+               <li><?php echo sprintf( __( 'Delete the <a href="%1$s">sample page</a> and <a href="%2$s">post</a>' ), esc_url( admin_url('edit.php?post_type=page') ), esc_url( admin_url('edit.php') ) ); ?></li>
+               <li><?php echo sprintf( __( '<a href="%s">Create an About Me page</a>' ), esc_url( admin_url('edit.php?post_type=page') ) ); ?></li>
+               <li><?php echo sprintf( __( '<a href="%s">Write your first post</a>' ), esc_url( admin_url('post-new.php') ) ); ?></li>
+               </ul>
+       </div>
+       <div class="welcome-panel-column welcome-panel-last">
+               <h4><span class="icon16 icon-appearance"></span> <?php _e( 'Customize Your Site' ); ?></h4>
+               <?php
+               $ct = current_theme_info();
+               if ( empty ( $ct->stylesheet_dir ) ) :
+                       echo '<p>';
+                       printf( __( '<a href="%s">Install a theme</a> to get started customizing your site.' ), esc_url( admin_url( 'themes.php' ) ) );
+                       echo '</p>';
+               else:
+                       $customize_links = array();
+                       if ( 'twentyeleven' == $ct->stylesheet )
+                               $customize_links[] = sprintf( __( '<a href="%s">Choose light or dark</a>' ), esc_url( admin_url( 'themes.php?page=theme_options' ) ) );
+
+                       if ( current_theme_supports( 'custom-background' ) )
+                               $customize_links[] = sprintf( __( '<a href="%s">Set a background color</a>' ), esc_url( admin_url( 'themes.php?page=custom-background' ) ) );
+
+                       if ( current_theme_supports( 'custom-header' ) )
+                               $customize_links[] = sprintf( __( '<a href="%s">Select a new header image</a>' ), esc_url( admin_url( 'themes.php?page=custom-header' ) ) );
+
+                       if ( current_theme_supports( 'widgets' ) )
+                               $customize_links[] = sprintf( __( '<a href="%s">Add some widgets</a>' ), esc_url( admin_url( 'widgets.php' ) ) );
+
+                       if ( ! empty( $customize_links ) ) {
+                               echo '<p>';
+                               printf( __( 'Use the current theme &mdash; %1$s &mdash; or <a href="%2$s">choose a new one</a>. If you stick with %3$s, here are a few ways to make your site look unique.' ), $ct->title, esc_url( admin_url( 'themes.php' ) ), $ct->title );
+                               echo '</p>';
+                       ?>
+                       <ul>
+                               <?php foreach ( $customize_links as $customize_link ) : ?>
+                               <li><?php echo $customize_link ?></li>
+                               <?php endforeach; ?>
+                       </ul>
+                       <?php
+                       } else {
+                               echo '<p>';
+                               printf( __( 'Use the current theme &mdash; %1$s &mdash; or <a href="%2$s">choose a new one</a>.' ), $ct->title, esc_url( admin_url( 'themes.php' ) ) );
+                               echo '</p>';
+                       }
+               endif; ?>
+       </div>
+       </div>
+       <p class="welcome-panel-dismiss"><?php printf( __( 'Already know what you&#8217;re doing? <a href="%s">Dismiss this message</a>.' ), esc_url( admin_url( '?welcome=0' ) ) ); ?></p>
+       </div>
+       </div>
+       <?php
+}
+
 ?>