Changeset 12695 for trunk/wp-admin/edit-form-advanced.php
- Timestamp:
- 01/11/2010 09:42:45 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r12682 r12695 17 17 */ 18 18 $post_ID = isset($post_ID) ? (int) $post_ID : 0; 19 19 $temp_ID = isset($temp_ID) ? (int) $temp_ID : 0; 20 $user_ID = isset($user_ID) ? (int) $user_ID : 0; 20 21 $action = isset($action) ? $action : ''; 22 23 $messages = array(); 24 $messages['post'] = array( 25 '', 26 sprintf( __('Post updated. <a href="%s">View post</a>'), get_permalink($post_ID) ), 27 __('Custom field updated.'), 28 __('Custom field deleted.'), 29 __('Post updated.'), 30 isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 31 sprintf( __('Post published. <a href="%s">View post</a>'), get_permalink($post_ID) ), 32 __('Post saved.'), 33 sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ), 34 // translators: Publish box date format, see http://php.net/date - Same as in meta-boxes.php 35 sprintf( __('Post scheduled for: <b>%1$s</b>. <a target="_blank" href="%2$s">Preview post</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), get_permalink($post_ID) ), 36 sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) 37 ); 38 $messages['page'] = array( 39 '', 40 sprintf( __('Page updated. <a href="%s">View page</a>'), get_permalink($post_ID) ), 41 __('Custom field updated.'), 42 __('Custom field deleted.'), 43 sprintf( __('Page published. <a href="%s">View page</a>'), get_permalink($post_ID) ), 44 isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 45 sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ), 46 // translators: Publish box date format, see http://php.net/date - Same as in meta-boxes.php 47 sprintf( __('Page scheduled for: <b>%1$s</b>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), get_permalink($post_ID) ), 48 sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) 49 ); 21 50 22 51 $message = false; 23 52 if ( isset($_GET['message']) ) { 24 53 $_GET['message'] = absint( $_GET['message'] ); 25 26 switch ( $_GET['message'] ) { 27 case 1: 28 $message = sprintf( __('Post updated. <a href="%s">View post</a>'), get_permalink($post_ID) ); 29 break; 30 case 2: 31 $message = __('Custom field updated.'); 32 break; 33 case 3: 34 $message = __('Custom field deleted.'); 35 break; 36 case 4: 37 $message = __('Post updated.'); 38 break; 39 case 5: 40 if ( isset($_GET['revision']) ) 41 $message = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ); 42 break; 43 case 6: 44 $message = sprintf( __('Post published. <a href="%s">View post</a>'), get_permalink($post_ID) ); 45 break; 46 case 7: 47 $message = __('Post saved.'); 48 break; 49 case 8: 50 $message = sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ); 51 break; 52 case 9: 53 // translators: Publish box date formt, see http://php.net/date - Same as in meta-boxes.php 54 $message = sprintf( __('Post scheduled for: <b>%1$s</b>. <a target="_blank" href="%2$s">Preview post</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), get_permalink($post_ID) ); 55 break; 56 case 10: 57 $message = sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ); 58 break; 59 } 54 if ( isset($messages[$post_type][$_GET['message']]) ) 55 $message = $messages[$post_type][$_GET['message']]; 56 elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) ) 57 $message = $messages['post'][$_GET['message']]; 60 58 } 61 59 … … 63 61 if ( 0 == $post_ID ) { 64 62 $form_action = 'post'; 63 $nonce_action = 'add-' . $post_type; 65 64 $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post() 66 65 $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='" . esc_attr($temp_ID) . "' />"; … … 68 67 } else { 69 68 $form_action = 'editpost'; 69 $nonce_action = 'update-' . $post_type . '_' . $post_ID; 70 70 $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post_ID) . "' />"; 71 71 $autosave = wp_get_post_autosave( $post_ID ); … … 83 83 } 84 84 85 $post_type_object = get_post_type_object($post_type); 86 $post_type_cap = $post_type_object->capability_type; 87 $form_post = 'post.php'; 88 if ( 'page' == $post_type ) 89 $form_post = 'page.php'; 90 85 91 // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action). 86 92 require_once('includes/meta-boxes.php'); … … 88 94 add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $post_type, 'side', 'core'); 89 95 90 // all tag-style posttaxonomies96 // all tag-style taxonomies 91 97 foreach ( get_object_taxonomies($post_type) as $tax_name ) { 92 98 if ( !is_taxonomy_hierarchical($tax_name) ) { … … 100 106 if ( is_object_in_taxonomy($post_type, 'category') ) 101 107 add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', $post_type, 'side', 'core'); 108 109 if ( post_type_supports($post_type, 'page-attributes') ) 110 add_meta_box('pageparentdiv', __('Attributes'), 'page_attributes_meta_box', $post_type, 'side', 'core'); 111 102 112 if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports($post_type, 'post-thumbnails') ) 103 113 add_meta_box('postimagediv', __('Post Thumbnail'), 'post_thumbnail_meta_box', $post_type, 'side', 'low'); 114 104 115 if ( post_type_supports($post_type, 'excerpts') ) 105 116 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $post_type, 'normal', 'core'); 117 106 118 if ( post_type_supports($post_type, 'trackbacks') ) 107 119 add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', $post_type, 'normal', 'core'); 120 108 121 if ( post_type_supports($post_type, 'custom-fields') ) 109 122 add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', $post_type, 'normal', 'core'); 123 110 124 do_action('dbx_post_advanced'); 111 125 if ( post_type_supports($post_type, 'comments') ) … … 116 130 117 131 if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) ) 118 add_meta_box('slugdiv', __(' PostSlug'), 'post_slug_meta_box', $post_type, 'normal', 'core');132 add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', $post_type, 'normal', 'core'); 119 133 120 134 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM … … 122 136 $authors[] = $post->post_author; 123 137 if ( $authors && count( $authors ) > 1 ) 124 add_meta_box('authordiv', __(' PostAuthor'), 'post_author_meta_box', $post_type, 'normal', 'core');138 add_meta_box('authordiv', __('Author'), 'post_author_meta_box', $post_type, 'normal', 'core'); 125 139 126 140 if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) 127 add_meta_box('revisionsdiv', __(' PostRevisions'), 'post_revisions_meta_box', $post_type, 'normal', 'core');141 add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', $post_type, 'normal', 'core'); 128 142 129 143 do_action('do_meta_boxes', $post_type, 'normal', $post); … … 132 146 133 147 require_once('admin-header.php'); 134 135 148 ?> 136 149 … … 144 157 <div id="message" class="updated"><p><?php echo $message; ?></p></div> 145 158 <?php endif; ?> 146 <form name="post" action="post.php" method="post" id="post"> 147 <?php 148 149 if ( 0 == $post_ID) 150 wp_nonce_field('add-post'); 151 else 152 wp_nonce_field('update-post_' . $post_ID); 153 154 ?> 155 159 <form name="post" action="<?php echo $form_post; ?>" method="post" id="post"> 160 <?php wp_nonce_field($nonce_action); ?> 156 161 <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" /> 157 162 <input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr($form_action) ?>" /> … … 170 175 <div id="side-info-column" class="inner-sidebar"> 171 176 172 <?php do_action('submitpost_box'); ?> 173 174 <?php $side_meta_boxes = do_meta_boxes($post_type, 'side', $post); ?> 177 <?php 178 ('page' == $post_type) ? do_action('submitpage_box') : do_action('submitpost_box'); 179 $side_meta_boxes = do_meta_boxes($post_type, 'side', $post); 180 ?> 175 181 </div> 176 182 … … 185 191 <?php 186 192 $sample_permalink_html = get_sample_permalink_html($post->ID); 187 if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_ posts' ) ) ) { ?>193 if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_' . $post_type_cap . 's' ) ) ) { ?> 188 194 <div id="edit-slug-box"> 189 195 <?php … … 231 237 do_meta_boxes($post_type, 'normal', $post); 232 238 233 do_action('edit_form_advanced');239 ( 'page' == $post_type ) ? do_action('edit_page_form') : do_action('edit_form_advanced'); 234 240 235 241 do_meta_boxes($post_type, 'advanced', $post);
Note: See TracChangeset
for help on using the changeset viewer.