X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/8f374b7233bc2815ccc387e448d208c5434eb961..fa11948979fd6a4ea5705dc613b239699a459db3:/wp-admin/includes/dashboard.php
diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php
index 6e7d5f0d..1f71f243 100644
--- a/wp-admin/includes/dashboard.php
+++ b/wp-admin/includes/dashboard.php
@@ -131,6 +131,7 @@ function wp_dashboard_setup() {
}
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) {
+ check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' );
ob_start(); // hack - but the same hack wp-admin/widgets.php uses
wp_dashboard_trigger_widget_control( $_POST['widget_id'] );
ob_end_clean();
@@ -141,11 +142,13 @@ function wp_dashboard_setup() {
if ( $update )
update_option( 'dashboard_widget_options', $widget_options );
+ /** This action is documented in wp-admin/edit-form-advanced.php */
do_action('do_meta_boxes', $screen->id, 'normal', '');
+ /** This action is documented in wp-admin/edit-form-advanced.php */
do_action('do_meta_boxes', $screen->id, 'side', '');
}
-function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null ) {
+function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null ) {
$screen = get_current_screen();
global $wp_dashboard_control_callbacks;
@@ -176,12 +179,13 @@ 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, $location, $priority );
+ add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args );
}
function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
echo '
';
@@ -230,7 +234,7 @@ function wp_dashboard_right_now() {
$num_tags = wp_count_terms('post_tag');
- $num_comm = wp_count_comments( );
+ $num_comm = wp_count_comments();
echo "\n\t".'';
echo "\n\t".'
' . __('Content') . '
'."\n\t".'
';
@@ -364,7 +368,7 @@ function wp_dashboard_right_now() {
if ( $theme->errors() ) {
if ( ! is_multisite() || is_super_admin() )
- echo '' . __('ERROR: The themes directory is either empty or doesn’t exist. Please check your installation.') . '';
+ echo '' . sprintf( __( 'ERROR: %s' ), $theme->errors()->get_error_message() ) . '';
} elseif ( ! empty($wp_registered_sidebars) ) {
$sidebars_widgets = wp_get_sidebars_widgets();
$num_widgets = 0;
@@ -392,12 +396,12 @@ function wp_dashboard_right_now() {
}
echo '';
- // Check if search engines are blocked.
+ // Check if search engines are asked not to index this site.
if ( !is_network_admin() && !is_user_admin() && current_user_can('manage_options') && '1' != get_option('blog_public') ) {
$title = apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content') );
- $content = apply_filters('privacy_on_link_text', __('Search Engines Blocked') );
+ $content = apply_filters('privacy_on_link_text', __('Search Engines Discouraged') );
- echo "$content
";
+ echo "$content
";
}
update_right_now_message();
@@ -480,7 +484,7 @@ function wp_dashboard_quick_press() {
if ( $drafts_query->posts )
$drafts =& $drafts_query->posts;
}
- printf('' . __('You can also try %s, easy blogging from anywhere on the Web.') . '
', '' . __('Press This') . '' );
+ printf('' . __('You can also try %s, easy blogging from anywhere on the Web.') . '
', '' . __('Press This') . '' );
$_REQUEST = array(); // hack for get_default_post_to_edit()
}
@@ -490,22 +494,35 @@ function wp_dashboard_quick_press() {
$post = get_post( $last_post_id );
if ( empty( $post ) || $post->post_status != 'auto-draft' ) { // auto-draft doesn't exists anymore
$post = get_default_post_to_edit('post', true);
- update_user_option( (int) $GLOBALS['current_user']->ID, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
+ update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
} else {
$post->post_title = ''; // Remove the auto draft title
}
} else {
- $post = get_default_post_to_edit('post', true);
- update_user_option( (int) $GLOBALS['current_user']->ID, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
+ $post = get_default_post_to_edit( 'post' , true);
+ $user_id = get_current_user_id();
+ // Don't create an option if this is a super admin who does not belong to this site.
+ if ( ! ( is_super_admin( $user_id ) && ! in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) )
+ update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
}
$post_ID = (int) $post->ID;
+
+ $media_settings = array(
+ 'id' => $post->ID,
+ 'nonce' => wp_create_nonce( 'update-post_' . $post->ID ),
+ );
+
+ if ( current_theme_supports( 'post-thumbnails', $post->post_type ) && post_type_supports( $post->post_type, 'thumbnail' ) ) {
+ $featured_image_id = get_post_meta( $post->ID, '_thumbnail_id', true );
+ $media_settings['featuredImageId'] = $featured_image_id ? $featured_image_id : -1;
+ }
?>