Changeset 42343 for trunk/src/wp-admin/edit-form-advanced.php
- Timestamp:
- 11/30/2017 11:09:33 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/edit-form-advanced.php
r42228 r42343 8 8 9 9 // don't load directly 10 if ( !defined('ABSPATH') ) 11 die('-1'); 10 if ( ! defined( 'ABSPATH' ) ) { 11 die( '-1' ); 12 } 12 13 13 14 /** … … 21 22 add_action( 'admin_footer', '_admin_notice_post_locked' ); 22 23 } else { 23 $check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) ); 24 25 if ( count( $check_users ) > 1 ) 24 $check_users = get_users( 25 array( 26 'fields' => 'ID', 27 'number' => 2, 28 ) 29 ); 30 31 if ( count( $check_users ) > 1 ) { 26 32 add_action( 'admin_footer', '_admin_notice_post_locked' ); 33 } 27 34 28 35 unset( $check_users ); 29 36 } 30 37 31 wp_enqueue_script( 'post');38 wp_enqueue_script( 'post' ); 32 39 $_wp_editor_expand = $_content_editor_dfw = false; 33 40 … … 45 52 apply_filters( 'wp_editor_expand', true, $post_type ) ) { 46 53 47 wp_enqueue_script( 'editor-expand');54 wp_enqueue_script( 'editor-expand' ); 48 55 $_content_editor_dfw = true; 49 $_wp_editor_expand = ( get_user_setting( 'editor_expand', 'on' ) === 'on' );50 } 51 52 if ( wp_is_mobile() ) 56 $_wp_editor_expand = ( get_user_setting( 'editor_expand', 'on' ) === 'on' ); 57 } 58 59 if ( wp_is_mobile() ) { 53 60 wp_enqueue_script( 'jquery-touch-punch' ); 61 } 54 62 55 63 /** 56 64 * Post ID global 65 * 57 66 * @name $post_ID 58 67 * @var int 59 68 */ 60 $post_ID = isset( $post_ID) ? (int) $post_ID : 0;61 $user_ID = isset( $user_ID) ? (int) $user_ID : 0;62 $action = isset($action) ? $action : '';69 $post_ID = isset( $post_ID ) ? (int) $post_ID : 0; 70 $user_ID = isset( $user_ID ) ? (int) $user_ID : 0; 71 $action = isset( $action ) ? $action : ''; 63 72 64 73 if ( $post_ID == get_option( 'page_for_posts' ) && empty( $post->post_content ) ) { … … 104 113 105 114 // Preview post link. 106 $preview_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', 115 $preview_post_link_html = sprintf( 116 ' <a target="_blank" href="%1$s">%2$s</a>', 107 117 esc_url( $preview_url ), 108 118 __( 'Preview post' ) … … 110 120 111 121 // Scheduled post preview link. 112 $scheduled_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', 122 $scheduled_post_link_html = sprintf( 123 ' <a target="_blank" href="%1$s">%2$s</a>', 113 124 esc_url( $permalink ), 114 125 __( 'Preview post' ) … … 116 127 117 128 // View post link. 118 $view_post_link_html = sprintf( ' <a href="%1$s">%2$s</a>', 129 $view_post_link_html = sprintf( 130 ' <a href="%1$s">%2$s</a>', 119 131 esc_url( $permalink ), 120 132 __( 'View post' ) … … 122 134 123 135 // Preview page link. 124 $preview_page_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', 136 $preview_page_link_html = sprintf( 137 ' <a target="_blank" href="%1$s">%2$s</a>', 125 138 esc_url( $preview_url ), 126 139 __( 'Preview page' ) … … 128 141 129 142 // Scheduled page preview link. 130 $scheduled_page_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', 143 $scheduled_page_link_html = sprintf( 144 ' <a target="_blank" href="%1$s">%2$s</a>', 131 145 esc_url( $permalink ), 132 146 __( 'Preview page' ) … … 134 148 135 149 // View page link. 136 $view_page_link_html = sprintf( ' <a href="%1$s">%2$s</a>', 150 $view_page_link_html = sprintf( 151 ' <a href="%1$s">%2$s</a>', 137 152 esc_url( $permalink ), 138 153 __( 'View page' ) … … 145 160 146 161 $messages['post'] = array( 147 0 => '', // Unused. Messages start at index 1.148 1 => __( 'Post updated.' ) . $view_post_link_html,149 2 => __( 'Custom field updated.' ),150 3 => __( 'Custom field deleted.' ),151 4 => __( 'Post updated.' ),162 0 => '', // Unused. Messages start at index 1. 163 1 => __( 'Post updated.' ) . $view_post_link_html, 164 2 => __( 'Custom field updated.' ), 165 3 => __( 'Custom field deleted.' ), 166 4 => __( 'Post updated.' ), 152 167 /* translators: %s: date and time of the revision */ 153 5 => isset($_GET['revision']) ? sprintf( __( 'Post restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,154 6 => __( 'Post published.' ) . $view_post_link_html,155 7 => __( 'Post saved.' ),156 8 => __( 'Post submitted.' ) . $preview_post_link_html,157 9 => sprintf( __( 'Post scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html,168 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Post restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 169 6 => __( 'Post published.' ) . $view_post_link_html, 170 7 => __( 'Post saved.' ), 171 8 => __( 'Post submitted.' ) . $preview_post_link_html, 172 9 => sprintf( __( 'Post scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html, 158 173 10 => __( 'Post draft updated.' ) . $preview_post_link_html, 159 174 ); 160 175 $messages['page'] = array( 161 0 => '', // Unused. Messages start at index 1.162 1 => __( 'Page updated.' ) . $view_page_link_html,163 2 => __( 'Custom field updated.' ),164 3 => __( 'Custom field deleted.' ),165 4 => __( 'Page updated.' ),176 0 => '', // Unused. Messages start at index 1. 177 1 => __( 'Page updated.' ) . $view_page_link_html, 178 2 => __( 'Custom field updated.' ), 179 3 => __( 'Custom field deleted.' ), 180 4 => __( 'Page updated.' ), 166 181 /* translators: %s: date and time of the revision */ 167 5 => isset($_GET['revision']) ? sprintf( __( 'Page restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,168 6 => __( 'Page published.' ) . $view_page_link_html,169 7 => __( 'Page saved.' ),170 8 => __( 'Page submitted.' ) . $preview_page_link_html,171 9 => sprintf( __( 'Page scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_page_link_html,182 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Page restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 183 6 => __( 'Page published.' ) . $view_page_link_html, 184 7 => __( 'Page saved.' ), 185 8 => __( 'Page submitted.' ) . $preview_page_link_html, 186 9 => sprintf( __( 'Page scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_page_link_html, 172 187 10 => __( 'Page draft updated.' ) . $preview_page_link_html, 173 188 ); … … 184 199 185 200 $message = false; 186 if ( isset( $_GET['message']) ) {201 if ( isset( $_GET['message'] ) ) { 187 202 $_GET['message'] = absint( $_GET['message'] ); 188 if ( isset($messages[$post_type][$_GET['message']]) ) 189 $message = $messages[$post_type][$_GET['message']]; 190 elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) ) 191 $message = $messages['post'][$_GET['message']]; 192 } 193 194 $notice = false; 203 if ( isset( $messages[ $post_type ][ $_GET['message'] ] ) ) { 204 $message = $messages[ $post_type ][ $_GET['message'] ]; 205 } elseif ( ! isset( $messages[ $post_type ] ) && isset( $messages['post'][ $_GET['message'] ] ) ) { 206 $message = $messages['post'][ $_GET['message'] ]; 207 } 208 } 209 210 $notice = false; 195 211 $form_extra = ''; 196 212 if ( 'auto-draft' == $post->post_status ) { 197 if ( 'edit' == $action ) 213 if ( 'edit' == $action ) { 198 214 $post->post_title = ''; 199 $autosave = false; 215 } 216 $autosave = false; 200 217 $form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />"; 201 218 } else { … … 203 220 } 204 221 205 $form_action = 'editpost';222 $form_action = 'editpost'; 206 223 $nonce_action = 'update-post_' . $post_ID; 207 $form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post_ID) . "' />";224 $form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr( $post_ID ) . "' />"; 208 225 209 226 // Detect if there exists an autosave newer than the post and if that autosave is different than the post … … 216 233 } 217 234 // If this autosave isn't different from the current post, begone. 218 if ( ! $notice ) 235 if ( ! $notice ) { 219 236 wp_delete_post_revision( $autosave->ID ); 220 unset($autosave_field, $_autosave_field); 221 } 222 223 $post_type_object = get_post_type_object($post_type); 237 } 238 unset( $autosave_field, $_autosave_field ); 239 } 240 241 $post_type_object = get_post_type_object( $post_type ); 224 242 225 243 // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action). … … 228 246 229 247 $publish_callback_args = null; 230 if ( post_type_supports( $post_type, 'revisions') && 'auto-draft' != $post->post_status ) {248 if ( post_type_supports( $post_type, 'revisions' ) && 'auto-draft' != $post->post_status ) { 231 249 $revisions = wp_get_post_revisions( $post_ID ); 232 250 … … 234 252 if ( count( $revisions ) > 1 ) { 235 253 reset( $revisions ); // Reset pointer for key() 236 $publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => key( $revisions ) ); 237 add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core'); 254 $publish_callback_args = array( 255 'revisions_count' => count( $revisions ), 256 'revision_id' => key( $revisions ), 257 ); 258 add_meta_box( 'revisionsdiv', __( 'Revisions' ), 'post_revisions_meta_box', null, 'normal', 'core' ); 238 259 } 239 260 } … … 242 263 wp_enqueue_script( 'image-edit' ); 243 264 wp_enqueue_style( 'imgareaselect' ); 244 add_meta_box( 'submitdiv', __( 'Save'), 'attachment_submit_meta_box', null, 'side', 'core' );265 add_meta_box( 'submitdiv', __( 'Save' ), 'attachment_submit_meta_box', null, 'side', 'core' ); 245 266 add_action( 'edit_form_after_title', 'edit_form_image_editor' ); 246 267 … … 252 273 } 253 274 254 if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) 275 if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) { 255 276 add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core' ); 277 } 256 278 257 279 // all taxonomies 258 280 foreach ( get_object_taxonomies( $post ) as $tax_name ) { 259 281 $taxonomy = get_taxonomy( $tax_name ); 260 if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) 282 if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) { 261 283 continue; 284 } 262 285 263 286 $label = $taxonomy->labels->name; 264 287 265 if ( ! is_taxonomy_hierarchical( $tax_name ) ) 288 if ( ! is_taxonomy_hierarchical( $tax_name ) ) { 266 289 $tax_meta_box_id = 'tagsdiv-' . $tax_name; 267 else290 } else { 268 291 $tax_meta_box_id = $tax_name . 'div'; 292 } 269 293 270 294 add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name ) ); … … 275 299 } 276 300 277 if ( $thumbnail_support && current_user_can( 'upload_files' ) ) 278 add_meta_box('postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low'); 279 280 if ( post_type_supports($post_type, 'excerpt') ) 281 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core'); 282 283 if ( post_type_supports($post_type, 'trackbacks') ) 284 add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core'); 285 286 if ( post_type_supports($post_type, 'custom-fields') ) 287 add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core'); 301 if ( $thumbnail_support && current_user_can( 'upload_files' ) ) { 302 add_meta_box( 'postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low' ); 303 } 304 305 if ( post_type_supports( $post_type, 'excerpt' ) ) { 306 add_meta_box( 'postexcerpt', __( 'Excerpt' ), 'post_excerpt_meta_box', null, 'normal', 'core' ); 307 } 308 309 if ( post_type_supports( $post_type, 'trackbacks' ) ) { 310 add_meta_box( 'trackbacksdiv', __( 'Send Trackbacks' ), 'post_trackback_meta_box', null, 'normal', 'core' ); 311 } 312 313 if ( post_type_supports( $post_type, 'custom-fields' ) ) { 314 add_meta_box( 'postcustom', __( 'Custom Fields' ), 'post_custom_meta_box', null, 'normal', 'core' ); 315 } 288 316 289 317 /** … … 317 345 } 318 346 319 if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) 320 add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core'); 347 if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) { 348 add_meta_box( 'slugdiv', __( 'Slug' ), 'post_slug_meta_box', null, 'normal', 'core' ); 349 } 321 350 322 351 if ( post_type_supports( $post_type, 'author' ) && current_user_can( $post_type_object->cap->edit_others_posts ) ) { … … 362 391 do_action( 'do_meta_boxes', $post_type, 'side', $post ); 363 392 364 add_screen_option('layout_columns', array('max' => 2, 'default' => 2) ); 393 add_screen_option( 394 'layout_columns', array( 395 'max' => 2, 396 'default' => 2, 397 ) 398 ); 365 399 366 400 if ( 'post' == $post_type ) { 367 $customize_display = '<p>' . __('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.') . '</p>'; 368 369 get_current_screen()->add_help_tab( array( 370 'id' => 'customize-display', 371 'title' => __('Customizing This Display'), 372 'content' => $customize_display, 373 ) ); 374 375 $title_and_editor = '<p>' . __('<strong>Title</strong> — Enter a title for your post. After you enter a title, you’ll see the permalink below, which you can edit.') . '</p>'; 401 $customize_display = '<p>' . __( 'The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.' ) . '</p>'; 402 403 get_current_screen()->add_help_tab( 404 array( 405 'id' => 'customize-display', 406 'title' => __( 'Customizing This Display' ), 407 'content' => $customize_display, 408 ) 409 ); 410 411 $title_and_editor = '<p>' . __( '<strong>Title</strong> — Enter a title for your post. After you enter a title, you’ll see the permalink below, which you can edit.' ) . '</p>'; 376 412 $title_and_editor .= '<p>' . __( '<strong>Post editor</strong> — Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab.' ) . '</p>'; 377 413 $title_and_editor .= '<p>' . __( 'Visual mode gives you an editor that is similar to a word processor. Click the Toolbar Toggle button to get a second row of controls.' ) . '</p>'; … … 381 417 $title_and_editor .= '<p>' . __( 'Keyboard users: When you’re working in the visual editor, you can use <kbd>Alt + F10</kbd> to access the toolbar.' ) . '</p>'; 382 418 383 get_current_screen()->add_help_tab( array( 384 'id' => 'title-post-editor', 385 'title' => __('Title and Post Editor'), 386 'content' => $title_and_editor, 387 ) ); 419 get_current_screen()->add_help_tab( 420 array( 421 'id' => 'title-post-editor', 422 'title' => __( 'Title and Post Editor' ), 423 'content' => $title_and_editor, 424 ) 425 ); 388 426 389 427 get_current_screen()->set_help_sidebar( 390 '<p>' . sprintf(__('You can also create posts with the <a href="%s">Press This bookmarklet</a>.'), 'tools.php') . '</p>' .391 '<p><strong>' . __( 'For more information:') . '</strong></p>' .392 '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Add_New_Screen">Documentation on Writing and Editing Posts</a>') . '</p>' .393 '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'428 '<p>' . sprintf( __( 'You can also create posts with the <a href="%s">Press This bookmarklet</a>.' ), 'tools.php' ) . '</p>' . 429 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 430 '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Add_New_Screen">Documentation on Writing and Editing Posts</a>' ) . '</p>' . 431 '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>' 394 432 ); 395 433 } elseif ( 'page' == $post_type ) { 396 $about_pages = '<p>' . __('Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the “Parent” of the other, creating a group of pages.') . '</p>' . 397 '<p>' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box.') . '</p>'; 398 399 get_current_screen()->add_help_tab( array( 400 'id' => 'about-pages', 401 'title' => __('About Pages'), 402 'content' => $about_pages, 403 ) ); 434 $about_pages = '<p>' . __( 'Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the “Parent” of the other, creating a group of pages.' ) . '</p>' . 435 '<p>' . __( 'Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box.' ) . '</p>'; 436 437 get_current_screen()->add_help_tab( 438 array( 439 'id' => 'about-pages', 440 'title' => __( 'About Pages' ), 441 'content' => $about_pages, 442 ) 443 ); 404 444 405 445 get_current_screen()->set_help_sidebar( 406 '<p><strong>' . __('For more information:') . '</strong></p>' .407 '<p>' . __( '<a href="https://codex.wordpress.org/Pages_Add_New_Screen">Documentation on Adding New Pages</a>') . '</p>' .408 '<p>' . __( '<a href="https://codex.wordpress.org/Pages_Screen#Editing_Individual_Pages">Documentation on Editing Pages</a>') . '</p>' .409 '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'446 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 447 '<p>' . __( '<a href="https://codex.wordpress.org/Pages_Add_New_Screen">Documentation on Adding New Pages</a>' ) . '</p>' . 448 '<p>' . __( '<a href="https://codex.wordpress.org/Pages_Screen#Editing_Individual_Pages">Documentation on Editing Pages</a>' ) . '</p>' . 449 '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>' 410 450 ); 411 451 } elseif ( 'attachment' == $post_type ) { 412 get_current_screen()->add_help_tab( array( 413 'id' => 'overview', 414 'title' => __('Overview'), 415 'content' => 416 '<p>' . __('This screen allows you to edit four fields for metadata in a file within the media library.') . '</p>' . 417 '<p>' . __('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.') . '</p>' . 418 '<p>' . __('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.') . '</p>' . 419 '<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>' 420 ) ); 452 get_current_screen()->add_help_tab( 453 array( 454 'id' => 'overview', 455 'title' => __( 'Overview' ), 456 'content' => 457 '<p>' . __( 'This screen allows you to edit four fields for metadata in a file within the media library.' ) . '</p>' . 458 '<p>' . __( 'For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.' ) . '</p>' . 459 '<p>' . __( 'Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.' ) . '</p>' . 460 '<p>' . __( 'Remember to click Update Media to save metadata entered or changed.' ) . '</p>', 461 ) 462 ); 421 463 422 464 get_current_screen()->set_help_sidebar( 423 '<p><strong>' . __('For more information:') . '</strong></p>' .424 '<p>' . __('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media">Documentation on Edit Media</a>') . '</p>' .425 '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'465 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 466 '<p>' . __( '<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media">Documentation on Edit Media</a>' ) . '</p>' . 467 '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>' 426 468 ); 427 469 } 428 470 429 471 if ( 'post' == $post_type || 'page' == $post_type ) { 430 $inserting_media = '<p>' . __( 'You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the “Create a new gallery” button.' ) . '</p>';472 $inserting_media = '<p>' . __( 'You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the “Create a new gallery” button.' ) . '</p>'; 431 473 $inserting_media .= '<p>' . __( 'You can also embed media from many popular websites including Twitter, YouTube, Flickr and others by pasting the media URL on its own line into the content of your post/page. Please refer to the Codex to <a href="https://codex.wordpress.org/Embeds">learn more about embeds</a>.' ) . '</p>'; 432 474 433 get_current_screen()->add_help_tab( array( 434 'id' => 'inserting-media', 435 'title' => __( 'Inserting Media' ), 436 'content' => $inserting_media, 437 ) ); 475 get_current_screen()->add_help_tab( 476 array( 477 'id' => 'inserting-media', 478 'title' => __( 'Inserting Media' ), 479 'content' => $inserting_media, 480 ) 481 ); 438 482 } 439 483 440 484 if ( 'post' == $post_type ) { 441 $publish_box = '<p>' . __('Several boxes on this screen contain settings for how your content will be published, including:') . '</p>';485 $publish_box = '<p>' . __( 'Several boxes on this screen contain settings for how your content will be published, including:' ) . '</p>'; 442 486 $publish_box .= '<ul><li>' . 443 487 __( '<strong>Publish</strong> — You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). The Password protected option allows you to set an arbitrary password for each post. The Private option hides the post from everyone except editors and administrators. Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.' ) . … … 455 499 $publish_box .= '</ul>'; 456 500 457 get_current_screen()->add_help_tab( array( 458 'id' => 'publish-box', 459 'title' => __('Publish Settings'), 460 'content' => $publish_box, 461 ) ); 462 463 $discussion_settings = '<p>' . __('<strong>Send Trackbacks</strong> — Trackbacks are a way to notify legacy blog systems that you’ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they’ll be notified automatically using pingbacks, and this field is unnecessary.') . '</p>'; 464 $discussion_settings .= '<p>' . __('<strong>Discussion</strong> — You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.') . '</p>'; 465 466 get_current_screen()->add_help_tab( array( 467 'id' => 'discussion-settings', 468 'title' => __('Discussion Settings'), 469 'content' => $discussion_settings, 470 ) ); 501 get_current_screen()->add_help_tab( 502 array( 503 'id' => 'publish-box', 504 'title' => __( 'Publish Settings' ), 505 'content' => $publish_box, 506 ) 507 ); 508 509 $discussion_settings = '<p>' . __( '<strong>Send Trackbacks</strong> — Trackbacks are a way to notify legacy blog systems that you’ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they’ll be notified automatically using pingbacks, and this field is unnecessary.' ) . '</p>'; 510 $discussion_settings .= '<p>' . __( '<strong>Discussion</strong> — You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.' ) . '</p>'; 511 512 get_current_screen()->add_help_tab( 513 array( 514 'id' => 'discussion-settings', 515 'title' => __( 'Discussion Settings' ), 516 'content' => $discussion_settings, 517 ) 518 ); 471 519 } elseif ( 'page' == $post_type ) { 472 $page_attributes = '<p>' . __('<strong>Parent</strong> — You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.') . '</p>' . 473 '<p>' . __('<strong>Template</strong> — Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu.') . '</p>' . 474 '<p>' . __('<strong>Order</strong> — Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.') . '</p>'; 475 476 get_current_screen()->add_help_tab( array( 477 'id' => 'page-attributes', 478 'title' => __('Page Attributes'), 479 'content' => $page_attributes, 480 ) ); 520 $page_attributes = '<p>' . __( '<strong>Parent</strong> — You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.' ) . '</p>' . 521 '<p>' . __( '<strong>Template</strong> — Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu.' ) . '</p>' . 522 '<p>' . __( '<strong>Order</strong> — Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.' ) . '</p>'; 523 524 get_current_screen()->add_help_tab( 525 array( 526 'id' => 'page-attributes', 527 'title' => __( 'Page Attributes' ), 528 'content' => $page_attributes, 529 ) 530 ); 481 531 } 482 532 … … 485 535 486 536 <div class="wrap"> 487 <h1 class="wp-heading-inline"><?php 537 <h1 class="wp-heading-inline"> 538 <?php 488 539 echo esc_html( $title ); 489 ?></h1> 540 ?> 541 </h1> 490 542 491 543 <?php … … 498 550 499 551 <?php if ( $notice ) : ?> 500 <div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice ?></p></div>552 <div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice; ?></p></div> 501 553 <?php endif; ?> 502 554 <?php if ( $message ) : ?> … … 508 560 </p> 509 561 </div> 510 <form name="post" action="post.php" method="post" id="post"<?php 562 <form name="post" action="post.php" method="post" id="post" 563 <?php 511 564 /** 512 565 * Fires inside the post editor form tag. … … 519 572 520 573 $referer = wp_get_referer(); 521 ?>> 522 <?php wp_nonce_field($nonce_action); ?> 523 <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" /> 524 <input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr( $form_action ) ?>" /> 525 <input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ) ?>" /> 574 ?> 575 > 576 <?php wp_nonce_field( $nonce_action ); ?> 577 <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID; ?>" /> 578 <input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr( $form_action ); ?>" /> 579 <input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ); ?>" /> 526 580 <input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" /> 527 <input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ) ?>" />528 <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status )?>" />581 <input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" /> 582 <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status ); ?>" /> 529 583 <input type="hidden" id="referredby" name="referredby" value="<?php echo $referer ? esc_url( $referer ) : ''; ?>" /> 530 584 <?php if ( ! empty( $active_post_lock ) ) { ?> … … 532 586 <?php 533 587 } 534 if ( 'draft' != get_post_status( $post ) ) 535 wp_original_referer_field(true, 'previous'); 588 if ( 'draft' != get_post_status( $post ) ) { 589 wp_original_referer_field( true, 'previous' ); 590 } 536 591 537 592 echo $form_extra; … … 551 606 * @param WP_Post $post Post object. 552 607 */ 553 do_action( 'edit_form_top', $post ); ?> 608 do_action( 'edit_form_top', $post ); 609 ?> 554 610 555 611 <div id="poststuff"> … … 557 613 <div id="post-body-content"> 558 614 559 <?php if ( post_type_supports( $post_type, 'title') ) { ?>615 <?php if ( post_type_supports( $post_type, 'title' ) ) { ?> 560 616 <div id="titlediv"> 561 617 <div id="titlewrap"> … … 587 643 <?php 588 644 if ( $viewable ) : 589 $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : '';590 591 // As of 4.4, the Get Shortlink button is hidden by default.592 if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) {593 $shortlink = wp_get_shortlink($post->ID, 'post');594 595 if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ) {596 $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" /><button type="button" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val());">' . __( 'Get Shortlink' ) . '</button>';597 }598 }599 600 if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) {601 $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status;602 ?>645 $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html( $post->ID ) : ''; 646 647 // As of 4.4, the Get Shortlink button is hidden by default. 648 if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) { 649 $shortlink = wp_get_shortlink( $post->ID, 'post' ); 650 651 if ( ! empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url( '?page_id=' . $post->ID ) ) { 652 $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" /><button type="button" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val());">' . __( 'Get Shortlink' ) . '</button>'; 653 } 654 } 655 656 if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) { 657 $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status; 658 ?> 603 659 <div id="edit-slug-box" class="hide-if-no-js"> 604 660 <?php 605 if ( $has_sample_permalink ) 606 echo $sample_permalink_html; 661 if ( $has_sample_permalink ) { 662 echo $sample_permalink_html; 663 } 607 664 ?> 608 665 </div> 609 <?php610 }666 <?php 667 } 611 668 endif; 612 669 ?> … … 627 684 do_action( 'edit_form_after_title', $post ); 628 685 629 if ( post_type_supports( $post_type, 'editor') ) {686 if ( post_type_supports( $post_type, 'editor' ) ) { 630 687 $_wp_editor_expand_class = ''; 631 688 if ( $_wp_editor_expand ) { … … 635 692 <div id="postdivrich" class="postarea<?php echo $_wp_editor_expand_class; ?>"> 636 693 637 <?php wp_editor( $post->post_content, 'content', array( 638 '_content_editor_dfw' => $_content_editor_dfw, 639 'drag_drop_upload' => true, 640 'tabfocus_elements' => 'content-html,save-post', 641 'editor_height' => 300, 642 'tinymce' => array( 643 'resize' => false, 644 'wp_autoresize_on' => $_wp_editor_expand, 645 'add_unload_trigger' => false, 646 'wp_keep_scroll_position' => ! $is_IE, 647 ), 648 ) ); ?> 694 <?php 695 wp_editor( 696 $post->post_content, 'content', array( 697 '_content_editor_dfw' => $_content_editor_dfw, 698 'drag_drop_upload' => true, 699 'tabfocus_elements' => 'content-html,save-post', 700 'editor_height' => 300, 701 'tinymce' => array( 702 'resize' => false, 703 'wp_autoresize_on' => $_wp_editor_expand, 704 'add_unload_trigger' => false, 705 'wp_keep_scroll_position' => ! $is_IE, 706 ), 707 ) 708 ); 709 ?> 649 710 <table id="post-status-info"><tbody><tr> 650 711 <td id="wp-word-count" class="hide-if-no-js"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td> … … 652 713 <span class="autosave-message"> </span> 653 714 <?php 654 if ( 'auto-draft' != $post->post_status ) { 655 echo '<span id="last-edit">'; 656 if ( $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ) ) { 657 /* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time */ 658 printf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) ); 659 } else { 660 /* translators: 1: Post edited date, 2: Post edited time */ 661 printf( __( 'Last edited on %1$s at %2$s' ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) ); 662 } 663 echo '</span>'; 664 } ?> 715 if ( 'auto-draft' != $post->post_status ) { 716 echo '<span id="last-edit">'; 717 if ( $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ) ) { 718 /* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time */ 719 printf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) ); 720 } else { 721 /* translators: 1: Post edited date, 2: Post edited time */ 722 printf( __( 'Last edited on %1$s at %2$s' ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) ); 723 } 724 echo '</span>'; 725 } 726 ?> 665 727 </td> 666 728 <td id="content-resize-handle" class="hide-if-no-js"><br /></td> … … 668 730 669 731 </div> 670 <?php } 732 <?php 733 } 671 734 /** 672 735 * Fires after the content editor. … … 694 757 */ 695 758 do_action( 'submitpage_box', $post ); 696 } 697 else { 759 } else { 698 760 /** 699 761 * Fires before meta boxes with 'side' context are output for all post types other than 'page'. … … 709 771 710 772 711 do_meta_boxes( $post_type, 'side', $post);773 do_meta_boxes( $post_type, 'side', $post ); 712 774 713 775 ?> … … 716 778 <?php 717 779 718 do_meta_boxes( null, 'normal', $post);780 do_meta_boxes( null, 'normal', $post ); 719 781 720 782 if ( 'page' == $post_type ) { … … 727 789 */ 728 790 do_action( 'edit_page_form', $post ); 729 } 730 else { 791 } else { 731 792 /** 732 793 * Fires after 'normal' context meta boxes have been output for all post types other than 'page'. … … 740 801 741 802 742 do_meta_boxes( null, 'advanced', $post);803 do_meta_boxes( null, 'advanced', $post ); 743 804 744 805 ?> … … 762 823 763 824 <?php 764 if ( post_type_supports( $post_type, 'comments' ) ) 825 if ( post_type_supports( $post_type, 'comments' ) ) { 765 826 wp_comment_reply(); 827 } 766 828 ?> 767 829
Note: See TracChangeset
for help on using the changeset viewer.