Changeset 14815 for trunk/wp-admin/includes/dashboard.php
- Timestamp:
- 05/23/2010 07:58:06 AM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/dashboard.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/dashboard.php
r14582 r14815 384 384 } 385 385 386 function wp_dashboard_quick_press() { 386 function wp_dashboard_quick_press_output() { 387 global $post_ID; 388 387 389 $drafts = false; 388 390 if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'post-quickpress' ) && (int) $_POST['post_ID'] ) { … … 391 393 if ( 'post-quickpress-publish' == $_POST['action'] ) { 392 394 if ( current_user_can('publish_posts') ) 393 printf( '<div class=" message"><p>' . __( 'Post Published. <a href="%s">View post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( $view ), $edit );395 printf( '<div class="updated"><p>' . __( 'Post published. <a href="%s">View post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( $view ), $edit ); 394 396 else 395 printf( '<div class=" message"><p>' . __( 'Post submitted. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit );397 printf( '<div class="updated"><p>' . __( 'Post submitted. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit ); 396 398 } else { 397 printf( '<div class=" message"><p>' . __( 'Draft Saved. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit );399 printf( '<div class="updated"><p>' . __( 'Draft saved. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit ); 398 400 $drafts_query = new WP_Query( array( 399 401 'post_type' => 'post', … … 408 410 $drafts =& $drafts_query->posts; 409 411 } 410 printf('<p class="textright">' . __('You can also try %s, easy blogging from anywhere on the Web.') . '</p>', '<a href=" tools.php">' . __('Press This') . '</a>' );412 printf('<p class="textright">' . __('You can also try %s, easy blogging from anywhere on the Web.') . '</p>', '<a href="' . esc_url( admin_url( 'tools.php' ) ) . '">' . __('Press This') . '</a>' ); 411 413 $_REQUEST = array(); // hack for get_default_post_to_edit() 412 414 } 413 415 414 $post = get_default_post_to_edit(); 416 /* Check if a new auto-draft (= no new post_ID) is needed or if the old can be used */ 417 $last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID 418 if ( $last_post_id ) { 419 $post = get_post( $last_post_id ); 420 if ( empty( $post ) || $post->post_status != 'auto-draft' ) { // auto-draft doesn't exists anymore 421 $post = get_default_post_to_edit('post', true); 422 update_user_option( (int) $GLOBALS['current_user']->ID, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID 423 } else { 424 $post->post_title = ''; // Remove the auto draft title 425 } 426 } else { 427 $post = get_default_post_to_edit('post', true); 428 update_user_option( (int) $GLOBALS['current_user']->ID, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID 429 } 430 431 $post_ID = (int) $post->ID; 415 432 ?> 416 433 … … 441 458 <p class="submit"> 442 459 <input type="hidden" name="action" id="quickpost-action" value="post-quickpress-save" /> 443 <input type="hidden" name="quickpress_post_ID" value="<?php echo (int) $post->ID; ?>" />460 <input type="hidden" name="quickpress_post_ID" value="<?php echo $post_ID; ?>" /> 444 461 <input type="hidden" name="post_type" value="post" /> 445 462 <?php wp_nonce_field('add-post'); ?> … … 458 475 if ( $drafts ) 459 476 wp_dashboard_recent_drafts( $drafts ); 477 } 478 479 function wp_dashboard_quick_press() { 480 echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>'; 460 481 } 461 482
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)