| 1 | <?php |
|---|
| 2 | if ( isset($_GET['message']) ) |
|---|
| 3 | $_GET['message'] = (int) $_GET['message']; |
|---|
| 4 | $messages[1] = __('Post updated'); |
|---|
| 5 | $messages[2] = __('Custom field updated'); |
|---|
| 6 | $messages[3] = __('Custom field deleted.'); |
|---|
| 7 | ?> |
|---|
| 8 | <?php if (isset($_GET['message'])) : ?> |
|---|
| 9 | <div id="message" class="updated fade"><p><?php echo wp_specialchars($messages[$_GET['message']]); ?></p></div> |
|---|
| 10 | <?php endif; ?> |
|---|
| 11 | |
|---|
| 12 | <form name="post" action="post.php" method="post" id="post"> |
|---|
| 13 | <?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?> |
|---|
| 14 | <input type="hidden" name="mode" value="bookmarklet" /> |
|---|
| 15 | <?php endif; ?> |
|---|
| 16 | |
|---|
| 17 | <div class="wrap"> |
|---|
| 18 | <?php |
|---|
| 19 | |
|---|
| 20 | if (0 == $post_ID) { |
|---|
| 21 | $form_action = 'post'; |
|---|
| 22 | $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post() |
|---|
| 23 | $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />"; |
|---|
| 24 | wp_nonce_field('add-post'); |
|---|
| 25 | } else { |
|---|
| 26 | $post_ID = (int) $post_ID; |
|---|
| 27 | $form_action = 'editpost'; |
|---|
| 28 | $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />"; |
|---|
| 29 | wp_nonce_field('update-post_' . $post_ID); |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | $form_pingback = '<input type="hidden" name="post_pingback" value="' . (int) get_option('default_pingback_flag') . '" id="post_pingback" />'; |
|---|
| 33 | |
|---|
| 34 | $form_prevstatus = '<input type="hidden" name="prev_status" value="' . attribute_escape( $post->post_status ) . '" />'; |
|---|
| 35 | |
|---|
| 36 | $form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />'; |
|---|
| 37 | |
|---|
| 38 | if ('' != $post->pinged) { |
|---|
| 39 | $pings = '<p>'. __('Already pinged:') . '</p><ul>'; |
|---|
| 40 | $already_pinged = explode("\n", trim($post->pinged)); |
|---|
| 41 | foreach ($already_pinged as $pinged_url) { |
|---|
| 42 | $pings .= "\n\t<li>" . wp_specialchars($pinged_url) . "</li>"; |
|---|
| 43 | } |
|---|
| 44 | $pings .= '</ul>'; |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | $saveasdraft = '<input name="save" type="submit" id="save" tabindex="3" value="' . attribute_escape( __('Save and Continue Editing') ) . '" />'; |
|---|
| 48 | |
|---|
| 49 | ?> |
|---|
| 50 | |
|---|
| 51 | <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" /> |
|---|
| 52 | <input type="hidden" id="hiddenaction" name="action" value="<?php echo $form_action ?>" /> |
|---|
| 53 | <input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" /> |
|---|
| 54 | <input type="hidden" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" /> |
|---|
| 55 | <input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" /> |
|---|
| 56 | |
|---|
| 57 | <?php echo $form_extra ?> |
|---|
| 58 | <?php if ((isset($post->post_title) && '' == $post->post_title) || (isset($_GET['message']) && 2 > $_GET['message'])) : ?> |
|---|
| 59 | <script type="text/javascript"> |
|---|
| 60 | function focusit() { |
|---|
| 61 | // focus on first input field |
|---|
| 62 | document.post.title.focus(); |
|---|
| 63 | } |
|---|
| 64 | addLoadEvent(focusit); |
|---|
| 65 | </script> |
|---|
| 66 | <?php endif; ?> |
|---|
| 67 | <div id="poststuff"> |
|---|
| 68 | |
|---|
| 69 | <div id="titlediv"> |
|---|
| 70 | <h3><?php _e('Title') ?></h3> |
|---|
| 71 | <div class="inside"> |
|---|
| 72 | <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape($post->post_title); ?>" id="title" /> |
|---|
| 73 | <?php |
|---|
| 74 | $sample_permalink_html = get_sample_permalink_html($post->ID); |
|---|
| 75 | if ($post->ID && $sample_permalink_html): |
|---|
| 76 | ?> |
|---|
| 77 | <div id="edit-slug-box" style="display: <?php echo $post->ID? 'block' : 'none';?>"> |
|---|
| 78 | <strong><?php _e('Permalink:'); ?></strong> |
|---|
| 79 | <span id="sample-permalink"><?php echo $sample_permalink_html; ?></span> |
|---|
| 80 | <span id="edit-slug-buttons"><a href="#post_name" class="edit-slug" onclick="edit_permalink(<?php echo $post->ID; ?>);return false;"><?php _e('Edit');?></a></span> |
|---|
| 81 | </div> |
|---|
| 82 | <?php |
|---|
| 83 | endif; |
|---|
| 84 | ?> |
|---|
| 85 | </div> |
|---|
| 86 | </div> |
|---|
| 87 | |
|---|
| 88 | <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea"> |
|---|
| 89 | <h3><?php _e('Post') ?></h3> |
|---|
| 90 | <?php the_editor($post->post_content); ?> |
|---|
| 91 | <?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?> |
|---|
| 92 | <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> |
|---|
| 93 | <?php wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); ?> |
|---|
| 94 | </div> |
|---|
| 95 | |
|---|
| 96 | <?php echo $form_pingback ?> |
|---|
| 97 | <?php echo $form_prevstatus ?> |
|---|
| 98 | |
|---|
| 99 | <div class="submitbox" id="submitpost"> |
|---|
| 100 | |
|---|
| 101 | <div id="previewview"> |
|---|
| 102 | <?php if ( 'publish' == $post->post_status ) { ?> |
|---|
| 103 | <a href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank"><?php _e('View this Post'); ?></a> |
|---|
| 104 | <?php } elseif ( 'edit' == $action ) { ?> |
|---|
| 105 | <a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" target="_blank"><?php _e('Preview this Post'); ?></a> |
|---|
| 106 | <?php } ?> |
|---|
| 107 | </div> |
|---|
| 108 | |
|---|
| 109 | <div class="inside"> |
|---|
| 110 | |
|---|
| 111 | <p><strong><?php _e('Publish Status') ?></strong></p> |
|---|
| 112 | <p> |
|---|
| 113 | <select name='post_status'> |
|---|
| 114 | <?php if ( current_user_can('publish_posts') ) : ?> |
|---|
| 115 | <?php $pub_value = ( 'private' == $post->post_status ) ? 'private' : 'publish'; ?> |
|---|
| 116 | <option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='<?php echo $pub_value ?>'><?php _e('Published') ?></option> |
|---|
| 117 | <?php else: ?> |
|---|
| 118 | <option<?php selected( $post->post_status, 'private' ); ?> value='private'><?php _e('Published') ?></option> |
|---|
| 119 | <?php endif; ?> |
|---|
| 120 | <?php if ( 'future' == $post->post_status ) : ?> |
|---|
| 121 | <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Pending') ?></option> |
|---|
| 122 | <?php endif; ?> |
|---|
| 123 | <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option> |
|---|
| 124 | <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option> |
|---|
| 125 | </select> |
|---|
| 126 | </p> |
|---|
| 127 | |
|---|
| 128 | <p><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php _e('Keep this post private') ?></label></p> |
|---|
| 129 | <?php |
|---|
| 130 | if ($post_ID) { |
|---|
| 131 | |
|---|
| 132 | if ( 'future' == $post->post_status ) { |
|---|
| 133 | $stamp = __('Scheduled for:<br />%1$s at %2$s'); |
|---|
| 134 | } else if ( 'publish' == $post->post_status ) { |
|---|
| 135 | $stamp = __('Published on:<br />%1$s at %2$s'); |
|---|
| 136 | } else { |
|---|
| 137 | $stamp = __('Saved on:<br />%1$s at %2$s'); |
|---|
| 138 | } |
|---|
| 139 | |
|---|
| 140 | $date = mysql2date(get_option('date_format'), $post->post_date); |
|---|
| 141 | $time = mysql2date(get_option('time_format'), $post->post_date); |
|---|
| 142 | } else { |
|---|
| 143 | $stamp = __('Timestamp:<br />%1$s at %2$s'); |
|---|
| 144 | $date = mysql2date(get_option('date_format'), current_time('mysql')); |
|---|
| 145 | $time = mysql2date(get_option('time_format'), current_time('mysql')); |
|---|
| 146 | } |
|---|
| 147 | ?> |
|---|
| 148 | <p><?php printf($stamp, $date, $time); ?> |
|---|
| 149 | <a href="#edit_timestamp" class="edit-timestamp"><?php _e('Edit') ?></a></p> |
|---|
| 150 | |
|---|
| 151 | <div id='timestamp'><?php touch_time(($action == 'edit')); ?></div> |
|---|
| 152 | |
|---|
| 153 | <p class="submit"> |
|---|
| 154 | <input type="submit" name="save" id="save-post" value="<?php _e('Save'); ?>" style="font-weight: bold;" tabindex="4" /> |
|---|
| 155 | <?php |
|---|
| 156 | if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post_ID ) { |
|---|
| 157 | ?> |
|---|
| 158 | <?php if ( current_user_can('publish_posts') ) : ?> |
|---|
| 159 | <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" /> |
|---|
| 160 | <?php else : ?> |
|---|
| 161 | <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" /> |
|---|
| 162 | <?php endif; ?> |
|---|
| 163 | <?php |
|---|
| 164 | } |
|---|
| 165 | |
|---|
| 166 | if ( ('edit' == $action) && current_user_can('delete_post', $post_ID) ) |
|---|
| 167 | echo "<a href='" . wp_nonce_url("post.php?action=delete&post=$post_ID", 'delete-post_' . $post_ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete post') . "</a>"; |
|---|
| 168 | ?> |
|---|
| 169 | <?php if ($post_ID): ?> |
|---|
| 170 | <br /> |
|---|
| 171 | <?php printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); ?> |
|---|
| 172 | <?php endif; ?> |
|---|
| 173 | </p> |
|---|
| 174 | |
|---|
| 175 | <?php if ($post_ID): ?> |
|---|
| 176 | <div class="inside"> |
|---|
| 177 | <p><strong><?php _e('Related') ?></strong></p> |
|---|
| 178 | |
|---|
| 179 | <ul> |
|---|
| 180 | <li><a href="edit.php?p=<?php echo $post_ID ?>"><?php _e('See Comments on this Post') ?></a></li> |
|---|
| 181 | <li><a href="edit-comments.php"><?php _e('Manage All Comments') ?></a></li> |
|---|
| 182 | <li><a href="edit.php"><?php _e('Manage All Posts') ?></a></li> |
|---|
| 183 | </ul> |
|---|
| 184 | </div> |
|---|
| 185 | <?php endif; ?> |
|---|
| 186 | <?php do_action('submitpost_box'); ?> |
|---|
| 187 | </div> |
|---|
| 188 | |
|---|
| 189 | <p class="submit"> |
|---|
| 190 | |
|---|
| 191 | <span id="autosave"></span> |
|---|
| 192 | |
|---|
| 193 | <input name="referredby" type="hidden" id="referredby" value="<?php |
|---|
| 194 | if ( !empty($_REQUEST['popupurl']) ) |
|---|
| 195 | echo clean_url(stripslashes($_REQUEST['popupurl'])); |
|---|
| 196 | else if ( url_to_postid(wp_get_referer()) == $post_ID ) |
|---|
| 197 | echo 'redo'; |
|---|
| 198 | else |
|---|
| 199 | echo clean_url(stripslashes(wp_get_referer())); |
|---|
| 200 | ?>" /></p> |
|---|
| 201 | |
|---|
| 202 | <div id="commentstatusdiv" class="postbox <?php echo postbox_classes('commentstatusdiv', 'post'); ?>"> |
|---|
| 203 | <h3><?php _e('Discussion') ?></h3> |
|---|
| 204 | <div class="inside"> |
|---|
| 205 | <input name="advanced_view" type="hidden" value="1" /> |
|---|
| 206 | <label for="comment_status" class="selectit"> |
|---|
| 207 | <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> |
|---|
| 208 | <?php _e('Allow Comments<br/>') ?></label> |
|---|
| 209 | <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label> |
|---|
| 210 | </div> |
|---|
| 211 | </div> |
|---|
| 212 | |
|---|
| 213 | <div id="passworddiv" class="postbox <?php echo postbox_classes('passworddiv', 'post'); ?>"> |
|---|
| 214 | <h3><?php _e('Post Password') ?></h3> |
|---|
| 215 | <div class="inside"> |
|---|
| 216 | <input name="post_password" type="text" size="13" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /> |
|---|
| 217 | </div> |
|---|
| 218 | </div> |
|---|
| 219 | |
|---|
| 220 | <div id="slugdiv" class="postbox <?php echo postbox_classes('slugdiv', 'post'); ?>"> |
|---|
| 221 | <h3><?php _e('Post Slug') ?></h3> |
|---|
| 222 | <div class="inside"> |
|---|
| 223 | <input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" /> |
|---|
| 224 | </div> |
|---|
| 225 | </div> |
|---|
| 226 | |
|---|
| 227 | <?php |
|---|
| 228 | $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM |
|---|
| 229 | if ( $post->post_author && !in_array($post->post_author, $authors) ) |
|---|
| 230 | $authors[] = $post->post_author; |
|---|
| 231 | if ( $authors && count( $authors ) > 1 ) : |
|---|
| 232 | ?> |
|---|
| 233 | <div id="authordiv" class="postbox <?php echo postbox_classes('authordiv', 'post'); ?>"> |
|---|
| 234 | <h3><?php _e('Post Author'); ?></h3> |
|---|
| 235 | <div class="inside"> |
|---|
| 236 | <?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?> |
|---|
| 237 | </div> |
|---|
| 238 | </div> |
|---|
| 239 | <?php endif; ?> |
|---|
| 240 | </div> |
|---|
| 241 | |
|---|
| 242 | |
|---|
| 243 | <div id="tagsdiv" class="postbox <?php echo postbox_classes('tagsdiv', 'post'); ?>"> |
|---|
| 244 | <h3><?php _e('Tags'); ?></h3> |
|---|
| 245 | <div class="inside"> |
|---|
| 246 | <p id="jaxtag"><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post_ID ); ?>" /></p> |
|---|
| 247 | <p id="tagchecklist"></p> |
|---|
| 248 | </div> |
|---|
| 249 | </div> |
|---|
| 250 | |
|---|
| 251 | <div id="categorydiv" class="postbox <?php echo postbox_classes('categorydiv', 'post'); ?>"> |
|---|
| 252 | <h3><?php _e('Categories') ?></h3> |
|---|
| 253 | <div class="inside"> |
|---|
| 254 | |
|---|
| 255 | <div id="category-adder" class="wp-hidden-children"> |
|---|
| 256 | <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4> |
|---|
| 257 | <p id="category-add" class="wp-hidden-child"> |
|---|
| 258 | <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" /> |
|---|
| 259 | <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category') ) ); ?> |
|---|
| 260 | <input type="button" id="category-add-sumbit" class="add:categorychecklist:categorydiv button" value="<?php _e( 'Add' ); ?>" /> |
|---|
| 261 | <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?> |
|---|
| 262 | <span id="category-ajax-response"></span> |
|---|
| 263 | </p> |
|---|
| 264 | </div> |
|---|
| 265 | |
|---|
| 266 | <ul id="category-tabs"> |
|---|
| 267 | <li class="ui-tabs-selected"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li> |
|---|
| 268 | <li class="wp-no-js-hidden"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li> |
|---|
| 269 | </ul> |
|---|
| 270 | |
|---|
| 271 | <div id="categories-all" class="ui-tabs-panel"> |
|---|
| 272 | <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> |
|---|
| 273 | <?php dropdown_categories(); ?> |
|---|
| 274 | </ul> |
|---|
| 275 | </div> |
|---|
| 276 | |
|---|
| 277 | <div id="categories-pop" class="ui-tabs-panel" style="display: none;"> |
|---|
| 278 | <ul id="categorychecklist-pop" class="categorychecklist form-no-clear"> |
|---|
| 279 | <?php wp_popular_terms_checklist('category'); ?> |
|---|
| 280 | </ul> |
|---|
| 281 | </div> |
|---|
| 282 | |
|---|
| 283 | </div> |
|---|
| 284 | </div> |
|---|
| 285 | |
|---|
| 286 | <?php do_meta_boxes('post', 'normal', $post); ?> |
|---|
| 287 | |
|---|
| 288 | <?php do_action('edit_form_advanced'); ?> |
|---|
| 289 | |
|---|
| 290 | <?php |
|---|
| 291 | if (current_user_can('upload_files') && false) { |
|---|
| 292 | $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID); |
|---|
| 293 | $uploading_iframe_src = wp_nonce_url("upload.php?style=inline&tab=upload&post_id=$uploading_iframe_ID", 'inlineuploading'); |
|---|
| 294 | $uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src); |
|---|
| 295 | if ( false != $uploading_iframe_src ) |
|---|
| 296 | echo '<iframe id="uploading" name="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>'; |
|---|
| 297 | } |
|---|
| 298 | ?> |
|---|
| 299 | |
|---|
| 300 | <h2><?php _e('Advanced Options'); ?></h2> |
|---|
| 301 | |
|---|
| 302 | <div id="postexcerpt" class="postbox <?php echo postbox_classes('postexcerpt', 'post'); ?>"> |
|---|
| 303 | <h3><?php _e('Optional Excerpt') ?></h3> |
|---|
| 304 | <div class="inside"><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div> |
|---|
| 305 | </div> |
|---|
| 306 | |
|---|
| 307 | <div id="trackbacksdiv" class="postbox <?php echo postbox_classes('trackbacksdiv', 'post'); ?>"> |
|---|
| 308 | <h3><?php _e('Trackbacks') ?></h3> |
|---|
| 309 | <div class="inside"> |
|---|
| 310 | <?php _e('Send trackbacks to:'); ?> <?php echo $form_trackback; ?> (<?php _e('Separate multiple URLs with spaces'); ?>) |
|---|
| 311 | <?php |
|---|
| 312 | if ( ! empty($pings) ) |
|---|
| 313 | echo $pings; |
|---|
| 314 | ?> |
|---|
| 315 | </div> |
|---|
| 316 | </div> |
|---|
| 317 | |
|---|
| 318 | <div id="postcustom" class="postbox <?php echo postbox_classes('postcustom', 'post'); ?>"> |
|---|
| 319 | <h3><?php _e('Custom Fields') ?></h3> |
|---|
| 320 | <div class="inside"> |
|---|
| 321 | <div id="postcustomstuff"> |
|---|
| 322 | <table cellpadding="3"> |
|---|
| 323 | <?php |
|---|
| 324 | $metadata = has_meta($post_ID); |
|---|
| 325 | list_meta($metadata); |
|---|
| 326 | ?> |
|---|
| 327 | |
|---|
| 328 | </table> |
|---|
| 329 | <?php |
|---|
| 330 | meta_form(); |
|---|
| 331 | ?> |
|---|
| 332 | <div id="ajax-response"></div> |
|---|
| 333 | </div> |
|---|
| 334 | </div> |
|---|
| 335 | </div> |
|---|
| 336 | |
|---|
| 337 | <?php do_action('dbx_post_advanced'); ?> |
|---|
| 338 | |
|---|
| 339 | |
|---|
| 340 | |
|---|
| 341 | <?php do_meta_boxes('post', 'advanced', $post); ?> |
|---|
| 342 | |
|---|
| 343 | <?php do_action('dbx_post_sidebar'); ?> |
|---|
| 344 | |
|---|
| 345 | </div> |
|---|
| 346 | |
|---|
| 347 | </div> |
|---|
| 348 | |
|---|
| 349 | </div> |
|---|
| 350 | |
|---|
| 351 | </form> |
|---|