| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
if ( ! isset( $post_ID ) ) |
|---|
| 15 |
$post_ID = 0; |
|---|
| 16 |
else |
|---|
| 17 |
$post_ID = (int) $post_ID; |
|---|
| 18 |
|
|---|
| 19 |
$action = isset($action) ? $action : ''; |
|---|
| 20 |
if ( isset($_GET['message']) ) |
|---|
| 21 |
$_GET['message'] = absint( $_GET['message'] ); |
|---|
| 22 |
$messages[1] = sprintf( __( 'Post updated. Continue editing below or <a href="%s">go back</a>.' ), attribute_escape( stripslashes( ( isset( $_GET['_wp_original_http_referer'] ) ? $_GET['_wp_original_http_referer'] : '') ) ) ); |
|---|
| 23 |
$messages[2] = __('Custom field updated.'); |
|---|
| 24 |
$messages[3] = __('Custom field deleted.'); |
|---|
| 25 |
$messages[4] = __('Post updated.'); |
|---|
| 26 |
$messages[6] = __('Post published.'); |
|---|
| 27 |
$messages[7] = __('Post saved.'); |
|---|
| 28 |
|
|---|
| 29 |
if ( isset($_GET['revision']) ) |
|---|
| 30 |
$messages[5] = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ); |
|---|
| 31 |
|
|---|
| 32 |
$notice = false; |
|---|
| 33 |
$notices[1] = __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>.' ); |
|---|
| 34 |
|
|---|
| 35 |
if ( 0 == $post_ID ) { |
|---|
| 36 |
$form_action = 'post'; |
|---|
| 37 |
$temp_ID = -1 * time(); |
|---|
| 38 |
$form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />"; |
|---|
| 39 |
$autosave = false; |
|---|
| 40 |
} else { |
|---|
| 41 |
$form_action = 'editpost'; |
|---|
| 42 |
$form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />"; |
|---|
| 43 |
$autosave = wp_get_post_autosave( $post_ID ); |
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) ) { |
|---|
| 47 |
foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) { |
|---|
| 48 |
if ( wp_text_diff( $autosave->$autosave_field, $post->$autosave_field ) ) { |
|---|
| 49 |
$notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) ); |
|---|
| 50 |
break; |
|---|
| 51 |
} |
|---|
| 52 |
} |
|---|
| 53 |
unset($autosave_field, $_autosave_field); |
|---|
| 54 |
} |
|---|
| 55 |
} |
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
function post_submit_meta_box($post) { |
|---|
| 67 |
global $action; |
|---|
| 68 |
|
|---|
| 69 |
$can_publish = current_user_can('publish_posts'); |
|---|
| 70 |
?> |
|---|
| 71 |
<div class="submitbox" id="submitpost"> |
|---|
| 72 |
|
|---|
| 73 |
<div class="inside-submitbox"> |
|---|
| 74 |
|
|---|
| 75 |
<div class="insidebox"><label for="post_status"><?php _e('This post is') ?></label> |
|---|
| 76 |
<strong><span id="post-status-display"> |
|---|
| 77 |
<?php |
|---|
| 78 |
switch ( $post->post_status ) { |
|---|
| 79 |
case 'publish': |
|---|
| 80 |
case 'private': |
|---|
| 81 |
_e('Published'); |
|---|
| 82 |
break; |
|---|
| 83 |
case 'future': |
|---|
| 84 |
_e('Scheduled'); |
|---|
| 85 |
break; |
|---|
| 86 |
case 'pending': |
|---|
| 87 |
_e('Pending Review'); |
|---|
| 88 |
break; |
|---|
| 89 |
case 'draft': |
|---|
| 90 |
_e('Unpublished'); |
|---|
| 91 |
break; |
|---|
| 92 |
} |
|---|
| 93 |
?> |
|---|
| 94 |
</span></strong> |
|---|
| 95 |
<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { ?> |
|---|
| 96 |
<a href="#post_status" class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a> |
|---|
| 97 |
|
|---|
| 98 |
<div id="post-status-select" class="hide-if-js"> |
|---|
| 99 |
<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo $post->post_status; ?>" /> |
|---|
| 100 |
<?php _e('Change post status'); ?><br /> |
|---|
| 101 |
<select name='post_status' id='post_status' tabindex='4'> |
|---|
| 102 |
<?php |
|---|
| 103 |
|
|---|
| 104 |
if ( $can_publish OR ( $post->post_status == 'publish' AND current_user_can('edit_post', $post->ID) ) ) : ?> |
|---|
| 105 |
<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option> |
|---|
| 106 |
<?php if ( 'future' == $post->post_status ) : ?> |
|---|
| 107 |
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option> |
|---|
| 108 |
<?php endif; ?> |
|---|
| 109 |
<?php endif; ?> |
|---|
| 110 |
<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option> |
|---|
| 111 |
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option> |
|---|
| 112 |
</select> |
|---|
| 113 |
|
|---|
| 114 |
<a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a> |
|---|
| 115 |
<a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a> |
|---|
| 116 |
</div> |
|---|
| 117 |
</div> |
|---|
| 118 |
|
|---|
| 119 |
<?php } else { ?> |
|---|
| 120 |
</div> |
|---|
| 121 |
|
|---|
| 122 |
<?php if ( $can_publish && 'pending' != $post->post_status ) { ?> |
|---|
| 123 |
<div class="insidebox"><input name="pending" type="submit" class="button" id="pending" tabindex="6" accesskey="r" value="<?php _e('Submit for Review') ?>" /></div> |
|---|
| 124 |
<?php } ?> |
|---|
| 125 |
|
|---|
| 126 |
<?php } ?> |
|---|
| 127 |
|
|---|
| 128 |
<?php if ( $can_publish && current_user_can( 'edit_others_posts' ) ) { ?> |
|---|
| 129 |
<div class="insidebox" id="sticky-checkbox"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID), true); ?> tabindex="4" /> <label for="sticky" class="selectit"><?php _e('Stick this post to the front page') ?></label></div> |
|---|
| 130 |
<?php } ?> |
|---|
| 131 |
|
|---|
| 132 |
<?php |
|---|
| 133 |
if ( ( 'edit' == $action ) && current_user_can('delete_post', $post->ID) ) { ?> |
|---|
| 134 |
<div class="insidebox" id="deletebutton"><a class="submitdelete" href="<?php echo wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID); ?>" onclick="if ( confirm('<?php echo 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;"><?php _e('Delete post'); ?></a></div> |
|---|
| 135 |
<?php } ?> |
|---|
| 136 |
|
|---|
| 137 |
<?php |
|---|
| 138 |
if ( 0 != $post->ID ) { |
|---|
| 139 |
if ( 'future' == $post->post_status ) { |
|---|
| 140 |
$stamp = __('Scheduled for: %1$s at %2$s'); |
|---|
| 141 |
} else if ( 'publish' == $post->post_status ) { |
|---|
| 142 |
$stamp = __('Published on: %1$s at %2$s'); |
|---|
| 143 |
} else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { |
|---|
| 144 |
$stamp = __('Publish immediately'); |
|---|
| 145 |
} else { |
|---|
| 146 |
$stamp = __('Publish on: %1$s at %2$s'); |
|---|
| 147 |
} |
|---|
| 148 |
$date = mysql2date(get_option('date_format'), $post->post_date); |
|---|
| 149 |
$time = mysql2date(get_option('time_format'), $post->post_date); |
|---|
| 150 |
} else { |
|---|
| 151 |
$stamp = __('Publish immediately'); |
|---|
| 152 |
$date = mysql2date(get_option('date_format'), current_time('mysql')); |
|---|
| 153 |
$time = mysql2date(get_option('time_format'), current_time('mysql')); |
|---|
| 154 |
} |
|---|
| 155 |
?> |
|---|
| 156 |
<?php if ( $can_publish ) : ?> |
|---|
| 157 |
<div class="insidebox curtime"><span id="timestamp"><?php printf($stamp, $date, $time); ?></span> |
|---|
| 158 |
<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a> |
|---|
| 159 |
|
|---|
| 160 |
<div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div></div> |
|---|
| 161 |
<?php endif; ?> |
|---|
| 162 |
|
|---|
| 163 |
</div> |
|---|
| 164 |
|
|---|
| 165 |
<p class="submit"> |
|---|
| 166 |
<?php do_action('post_submitbox_start'); ?> |
|---|
| 167 |
<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status ) |
|---|
| 168 |
$savebtn = attribute_escape( __('Save') ); |
|---|
| 169 |
else |
|---|
| 170 |
$savebtn = attribute_escape( __('Save Draft') ); |
|---|
| 171 |
?> |
|---|
| 172 |
<input type="submit" name="save" id="save-post" value="<?php echo $savebtn; ?>" tabindex="4" class="button button-highlighted" /> |
|---|
| 173 |
|
|---|
| 174 |
<?php if ( 'publish' == $post->post_status ) { ?> |
|---|
| 175 |
<a class="preview button" href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank" tabindex="4"><?php _e('View this Post'); ?></a> |
|---|
| 176 |
<?php } else { ?> |
|---|
| 177 |
<a class="preview button" href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" target="_blank" tabindex="4"><?php _e('Preview'); ?></a> |
|---|
| 178 |
<?php } ?> |
|---|
| 179 |
|
|---|
| 180 |
<?php |
|---|
| 181 |
if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post->ID ) { ?> |
|---|
| 182 |
<?php if ( current_user_can('publish_posts') ) : ?> |
|---|
| 183 |
<input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" /> |
|---|
| 184 |
<?php else : ?> |
|---|
| 185 |
<input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" /> |
|---|
| 186 |
<?php endif; ?> |
|---|
| 187 |
<?php } ?> |
|---|
| 188 |
|
|---|
| 189 |
</p> |
|---|
| 190 |
<div class="clear"></div> |
|---|
| 191 |
</div> |
|---|
| 192 |
|
|---|
| 193 |
<?php |
|---|
| 194 |
} |
|---|
| 195 |
add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side', 'core'); |
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 |
function post_tags_meta_box($post) { |
|---|
| 205 |
?> |
|---|
| 206 |
<p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><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> |
|---|
| 207 |
<div id="tagchecklist"></div> |
|---|
| 208 |
<p><a href='#'><?php _e( 'Choose from tags' ); ?></a></p> |
|---|
| 209 |
<?php |
|---|
| 210 |
} |
|---|
| 211 |
add_meta_box('tagsdiv', __('Tags'), 'post_tags_meta_box', 'post', 'side', 'core'); |
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 |
|
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 |
|
|---|
| 220 |
|
|---|
| 221 |
function post_media_meta_box($post) { |
|---|
| 222 |
echo "<p><small><em>This feature isn't fully functional in this prototype.</em></small></p>"; |
|---|
| 223 |
|
|---|
| 224 |
if ( empty( $post->ID ) ) |
|---|
| 225 |
return; |
|---|
| 226 |
|
|---|
| 227 |
$atts = get_children( array( |
|---|
| 228 |
'post_parent' => $post->ID, |
|---|
| 229 |
'post_type' => 'attachment' |
|---|
| 230 |
) ); |
|---|
| 231 |
|
|---|
| 232 |
if ( !$atts ) { |
|---|
| 233 |
_e( 'No media.' ); |
|---|
| 234 |
return; |
|---|
| 235 |
} |
|---|
| 236 |
|
|---|
| 237 |
foreach ( $atts as $att ) { |
|---|
| 238 |
if ( $thumb = wp_get_attachment_image( $att->ID, array(60, 45), true ) ) { |
|---|
| 239 |
?> |
|---|
| 240 |
<a href="media.php?action=edit&attachment_id=<?php echo $att->ID ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att->post_title)); ?>"> |
|---|
| 241 |
<?php echo $thumb; ?> |
|---|
| 242 |
</a> |
|---|
| 243 |
|
|---|
| 244 |
<?php |
|---|
| 245 |
} |
|---|
| 246 |
echo "<h4>$att->post_title</h4>"; |
|---|
| 247 |
|
|---|
| 248 |
echo "<a href='#' class='no-crazy'>Remove</a> | "; |
|---|
| 249 |
echo "<a href='media.php?action=edit&attachment_id=$att->ID'>Edit</a>"; |
|---|
| 250 |
|
|---|
| 251 |
echo "<br class='clear' />"; |
|---|
| 252 |
} |
|---|
| 253 |
|
|---|
| 254 |
} |
|---|
| 255 |
add_meta_box( 'mediadiv', __('Media' ), 'post_media_meta_box', 'post', 'side', 'core' ); |
|---|
| 256 |
|
|---|
| 257 |
|
|---|
| 258 |
|
|---|
| 259 |
|
|---|
| 260 |
|
|---|
| 261 |
|
|---|
| 262 |
|
|---|
| 263 |
|
|---|
| 264 |
function post_categories_meta_box($post) { |
|---|
| 265 |
?> |
|---|
| 266 |
<ul id="category-tabs"> |
|---|
| 267 |
<li class="ui-tabs-selected"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li> |
|---|
| 268 |
<li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li> |
|---|
| 269 |
</ul> |
|---|
| 270 |
|
|---|
| 271 |
<div id="categories-pop" class="ui-tabs-panel" style="display: none;"> |
|---|
| 272 |
<ul id="categorychecklist-pop" class="categorychecklist form-no-clear" > |
|---|
| 273 |
<?php $popular_ids = wp_popular_terms_checklist('category'); ?> |
|---|
| 274 |
</ul> |
|---|
| 275 |
</div> |
|---|
| 276 |
|
|---|
| 277 |
<div id="categories-all" class="ui-tabs-panel"> |
|---|
| 278 |
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> |
|---|
| 279 |
<?php wp_category_checklist($post->ID, false, false, $popular_ids) ?> |
|---|
| 280 |
</ul> |
|---|
| 281 |
</div> |
|---|
| 282 |
|
|---|
| 283 |
<div id="category-adder" class="wp-hidden-children"> |
|---|
| 284 |
<h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4> |
|---|
| 285 |
<p id="category-add" class="wp-hidden-child"> |
|---|
| 286 |
<label class="hidden" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" aria-required="true"/> |
|---|
| 287 |
<label class="hidden" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?> |
|---|
| 288 |
<input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" /> |
|---|
| 289 |
<?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?> |
|---|
| 290 |
<span id="category-ajax-response"></span> |
|---|
| 291 |
</p> |
|---|
| 292 |
</div> |
|---|
| 293 |
|
|---|
| 294 |
<?php |
|---|
| 295 |
} |
|---|
| 296 |
add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core'); |
|---|
| 297 |
|
|---|
| 298 |
|
|---|
| 299 |
|
|---|
| 300 |
|
|---|
| 301 |
|
|---|
| 302 |
|
|---|
| 303 |
|
|---|
| 304 |
|
|---|
| 305 |
function post_excerpt_meta_box($post) { |
|---|
| 306 |
?> |
|---|
| 307 |
<label class="hidden" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea> |
|---|
| 308 |
<p><?php _e('Excerpts are optional hand-crafted summaries of your content. You can <a href="http://codex.wordpress.org/Template_Tags/the_excerpt" target="_blank">use them in your template</a>'); ?></p> |
|---|
| 309 |
<?php |
|---|
| 310 |
} |
|---|
| 311 |
add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core'); |
|---|
| 312 |
|
|---|
| 313 |
|
|---|
| 314 |
|
|---|
| 315 |
|
|---|
| 316 |
|
|---|
| 317 |
|
|---|
| 318 |
|
|---|
| 319 |
|
|---|
| 320 |
function post_trackback_meta_box($post) { |
|---|
| 321 |
$form_trackback = '<input type="text" name="trackback_url" id="trackback_url" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />'; |
|---|
| 322 |
if ('' != $post->pinged) { |
|---|
| 323 |
$pings = '<p>'. __('Already pinged:') . '</p><ul>'; |
|---|
| 324 |
$already_pinged = explode("\n", trim($post->pinged)); |
|---|
| 325 |
foreach ($already_pinged as $pinged_url) { |
|---|
| 326 |
$pings .= "\n\t<li>" . wp_specialchars($pinged_url) . "</li>"; |
|---|
| 327 |
} |
|---|
| 328 |
$pings .= '</ul>'; |
|---|
| 329 |
} |
|---|
| 330 |
|
|---|
| 331 |
?> |
|---|
| 332 |
<p class="meta-options"> |
|---|
| 333 |
<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 <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a> on this post') ?></label> |
|---|
| 334 |
</p> |
|---|
| 335 |
<p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p> |
|---|
| 336 |
<p><?php _e('Trackbacks are a way to notify legacy blog systems that you’ve linked to them. If you link other WordPress blogs they’ll be notified automatically using <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">pingbacks</a>, no other action necessary.'); ?></p> |
|---|
| 337 |
<?php |
|---|
| 338 |
if ( ! empty($pings) ) |
|---|
| 339 |
echo $pings; |
|---|
| 340 |
} |
|---|
| 341 |
add_meta_box('trackbacksdiv', __('Trackbacks and Pings'), 'post_trackback_meta_box', 'post', 'normal', 'core'); |
|---|
| 342 |
|
|---|
| 343 |
|
|---|
| 344 |
|
|---|
| 345 |
|
|---|
| 346 |
|
|---|
| 347 |
|
|---|
| 348 |
|
|---|
| 349 |
|
|---|
| 350 |
function post_custom_meta_box($post) { |
|---|
| 351 |
?> |
|---|
| 352 |
<div id="postcustomstuff"> |
|---|
| 353 |
<table cellpadding="3"> |
|---|
| 354 |
<?php |
|---|
| 355 |
$metadata = has_meta($post->ID); |
|---|
| 356 |
list_meta($metadata); |
|---|
| 357 |
?> |
|---|
| 358 |
|
|---|
| 359 |
</table> |
|---|
| 360 |
<?php |
|---|
| 361 |
meta_form(); |
|---|
| 362 |
?> |
|---|
| 363 |
<div id="ajax-response"></div> |
|---|
| 364 |
</div> |
|---|
| 365 |
<p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p> |
|---|
| 366 |
<?php |
|---|
| 367 |
} |
|---|
| 368 |
add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'normal', 'core'); |
|---|
| 369 |
|
|---|
| 370 |
do_action('dbx_post_advanced'); |
|---|
| 371 |
|
|---|
| 372 |
|
|---|
| 373 |
|
|---|
| 374 |
|
|---|
| 375 |
|
|---|
| 376 |
|
|---|
| 377 |
|
|---|
| 378 |
|
|---|
| 379 |
function post_comment_status_meta_box($post) { |
|---|
| 380 |
global $wpdb, $post_ID; |
|---|
| 381 |
?> |
|---|
| 382 |
<input name="advanced_view" type="hidden" value="1" /> |
|---|
| 383 |
<p class="meta-options"> |
|---|
| 384 |
<label for="comment_status" class="selectit"> <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e('Allow comments on this post') ?></label> |
|---|
| 385 |
</p> |
|---|
| 386 |
<?php |
|---|
| 387 |
|
|---|
| 388 |
if ( !$post_ID || $post_ID < 0 ) |
|---|
| 389 |
return; |
|---|
| 390 |
|
|---|
| 391 |
if ( !$comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $post_ID) ) ) |
|---|
| 392 |
return; |
|---|
| 393 |
|
|---|
| 394 |
|
|---|
| 395 |
// update_comment_cache($comments); |
|---|
| 396 |
?> |
|---|
| 397 |
|
|---|
| 398 |
<table class="widefat"> |
|---|
| 399 |
<thead> |
|---|
| 400 |
<tr> |
|---|
| 401 |
<th scope="col"><?php _e('Comments') ?></th> |
|---|
| 402 |
<th scope="col"><?php _e('Author') ?></th> |
|---|
| 403 |
<th scope="col"><?php _e('Submitted') ?></th> |
|---|
| 404 |
</tr> |
|---|
| 405 |
</thead> |
|---|
| 406 |
<tbody id="the-comment-list" class="list:comment"> |
|---|
| 407 |
<?php |
|---|
| 408 |
foreach ($comments as $comment) |
|---|
| 409 |
_wp_comment_row( $comment, 'single', false, false ); |
|---|
| 410 |
?> |
|---|
| 411 |
</tbody> |
|---|
| 412 |
</table> |
|---|
| 413 |
|
|---|
| 414 |
<?php |
|---|
| 415 |
} |
|---|
| 416 |
add_meta_box('commentstatusdiv', __('Comments on this Post'), 'post_comment_status_meta_box', 'post', 'normal', 'core'); |
|---|
| 417 |
|
|---|
| 418 |
|
|---|
| 419 |
|
|---|
| 420 |
|
|---|
| 421 |
|
|---|
| 422 |
|
|---|
| 423 |
|
|---|
| 424 |
|
|---|
| 425 |
function post_password_meta_box($post) { |
|---|
| 426 |
?> |
|---|
| 427 |
<p> |
|---|
| 428 |
<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'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label> |
|---|
| 429 |
</p> |
|---|
| 430 |
<h4><?php _e( 'Post Password' ); ?></h4> |
|---|
| 431 |
<p><label class="hidden" for="post_password"><?php _e('Password Protect This Post') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php the_post_password(); ?>" /></p> |
|---|
| 432 |
<p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this post and its comments.'); ?></p> |
|---|
| 433 |
<?php |
|---|
| 434 |
} |
|---|
| 435 |
add_meta_box('passworddiv', __('Privacy Options'), 'post_password_meta_box', 'post', 'normal', 'core'); |
|---|
| 436 |
|
|---|
| 437 |
|
|---|
| 438 |
|
|---|
| 439 |
|
|---|
| 440 |
|
|---|
| 441 |
|
|---|
| 442 |
|
|---|
| 443 |
|
|---|
| 444 |
function post_slug_meta_box($post) { |
|---|
| 445 |
?> |
|---|
| 446 |
<label class="hidden" for="post_name"><?php _e('Post Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" /> |
|---|
| 447 |
<?php |
|---|
| 448 |
} |
|---|
| 449 |
if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) ) |
|---|
| 450 |
add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', 'post', 'normal', 'core'); |
|---|
| 451 |
|
|---|
| 452 |
$authors = get_editable_user_ids( $current_user->id ); |
|---|
| 453 |
if ( $post->post_author && !in_array($post->post_author, $authors) ) |
|---|
| 454 |
$authors[] = $post->post_author; |
|---|
| 455 |
if ( $authors && count( $authors ) > 1 ) : |
|---|
| 456 |
|
|---|
| 457 |
|
|---|
| 458 |
|
|---|
| 459 |
|
|---|
| 460 |
|
|---|
| 461 |
|
|---|
| 462 |
|
|---|
| 463 |
function post_author_meta_box($post) { |
|---|
| 464 |
global $current_user, $user_ID; |
|---|
| 465 |
$authors = get_editable_user_ids( $current_user->id ); |
|---|
| 466 |
if ( $post->post_author && !in_array($post->post_author, $authors) ) |
|---|
| 467 |
$authors[] = $post->post_author; |
|---|
| 468 |
?> |
|---|
| 469 |
<label class="hidden" for="post_author_override"><?php _e('Post Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?> |
|---|
| 470 |
<?php |
|---|
| 471 |
} |
|---|
| 472 |
add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'normal', 'core'); |
|---|
| 473 |
endif; |
|---|
| 474 |
|
|---|
| 475 |
if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) : |
|---|
| 476 |
|
|---|
| 477 |
|
|---|
| 478 |
|
|---|
| 479 |
|
|---|
| 480 |
|
|---|
| 481 |
|
|---|
| 482 |
|
|---|
| 483 |
function post_revisions_meta_box($post) { |
|---|
| 484 |
wp_list_post_revisions(); |
|---|
| 485 |
} |
|---|
| 486 |
add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'normal', 'core'); |
|---|
| 487 |
endif; |
|---|
| 488 |
|
|---|
| 489 |
?> |
|---|
| 490 |
|
|---|
| 491 |
<div id="edit-settings-wrap" class="hidden"> |
|---|
| 492 |
<h5><?php _e('Show on screen') ?></h5> |
|---|
| 493 |
<form id="adv-settings" action="" method="get"> |
|---|
| 494 |
<div class="metabox-prefs"> |
|---|
| 495 |
<?php meta_box_prefs('post') ?> |
|---|
| 496 |
<br class="clear" /> |
|---|
| 497 |
</div></form> |
|---|
| 498 |
</div> |
|---|
| 499 |
|
|---|
| 500 |
<?php if ( $notice ) : ?> |
|---|
| 501 |
<div id="notice" class="error"><p><?php echo $notice ?></p></div> |
|---|
| 502 |
<?php endif; ?> |
|---|
| 503 |
<?php if (isset($_GET['message'])) : ?> |
|---|
| 504 |
<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div> |
|---|
| 505 |
<?php endif; ?> |
|---|
| 506 |
|
|---|
| 507 |
<?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?> |
|---|
| 508 |
<input type="hidden" name="mode" value="bookmarklet" /> |
|---|
| 509 |
<?php endif; ?> |
|---|
| 510 |
|
|---|
| 511 |
<div class="wrap"> |
|---|
| 512 |
|
|---|
| 513 |
<form name="post" action="post.php" method="post" id="post"> |
|---|
| 514 |
<?php |
|---|
| 515 |
|
|---|
| 516 |
if ( 0 == $post_ID) |
|---|
| 517 |
wp_nonce_field('add-post'); |
|---|
| 518 |
else |
|---|
| 519 |
wp_nonce_field('update-post_' . $post_ID); |
|---|
| 520 |
|
|---|
| 521 |
?> |
|---|
| 522 |
|
|---|
| 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 $form_action ?>" /> |
|---|
| 525 |
<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" /> |
|---|
| 526 |
<input type="hidden" id="post_author" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" /> |
|---|
| 527 |
<input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" /> |
|---|
| 528 |
<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" /> |
|---|
| 529 |
<input name="referredby" type="hidden" id="referredby" value="<?php echo clean_url(stripslashes(wp_get_referer())); ?>" /> |
|---|
| 530 |
<?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?> |
|---|
| 531 |
|
|---|
| 532 |
<?php echo $form_extra ?> |
|---|
| 533 |
|
|---|
| 534 |
<div id="poststuff" class="metabox-holder"> |
|---|
| 535 |
|
|---|
| 536 |
<div id="side-info" style="display: none;"><?php ?> |
|---|
| 537 |
|
|---|
| 538 |
<h5><?php _e('Related') ?></h5> |
|---|
| 539 |
<ul> |
|---|
| 540 |
<?php if ($post_ID): ?> |
|---|
| 541 |
<li><a href="edit.php?p=<?php echo $post_ID ?>"><?php _e( |
|---|