X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/fa11948979fd6a4ea5705dc613b239699a459db3..88550bc3400cc7c035ff590ecb007c7938041ded:/wp-admin/includes/meta-boxes.php?ds=sidebyside diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index 357fec8f..c7307d52 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -42,11 +42,21 @@ if ( 'publish' == $post->post_status ) { $preview_button = __( 'Preview Changes' ); } else { $preview_link = set_url_scheme( get_permalink( $post->ID ) ); - $preview_link = esc_url( apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ) ) ); + + /** + * Filter the URI of a post preview in the post submit box. + * + * @since 2.0.5 + * @since 4.0.0 $post parameter was added. + * + * @param string $preview_link URI the user will be directed to for a post preview. + * @param WP_Post $post Post object. + */ + $preview_link = esc_url( apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ) ); $preview_button = __( 'Preview' ); } ?> - + @@ -79,7 +89,7 @@ switch ( $post->post_status ) { ?> post_status || 'private' == $post->post_status || $can_publish ) { ?> -post_status ) { ?>style="display:none;" class="edit-post-status hide-if-no-js"> +post_status ) { ?>style="display:none;" class="edit-post-status hide-if-no-js">
@@ -99,7 +109,7 @@ switch ( $post->post_status ) { - +
@@ -125,7 +135,7 @@ if ( 'private' == $post->post_status ) { echo esc_html( $visibility_trans ); ?> - +
@@ -143,7 +153,7 @@ echo esc_html( $visibility_trans ); ?>

- +

@@ -151,7 +161,7 @@ echo esc_html( $visibility_trans ); ?> ID ) { if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date @@ -185,7 +195,7 @@ if ( ! empty( $args['args']['revisions_count'] ) ) : printf( __( 'Revisions: %s' ), '' . number_format_i18n( $args['args']['revisions_count'] ) . '' ); } ?> - +
- +
- +
- +
ID ) ) { @@ -255,11 +279,6 @@ if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 * @param object $post */ function attachment_submit_meta_box( $post ) { - global $action; - - $post_type = $post->post_type; - $post_type_object = get_post_type_object($post_type); - $can_publish = current_user_can($post_type_object->cap->publish_posts); ?>
@@ -273,7 +292,7 @@ function attachment_submit_meta_box( $post ) {
%1$s'); $date = date_i18n( $datef, strtotime( $post->post_date ) ); @@ -282,7 +301,15 @@ function attachment_submit_meta_box( $post ) {
- +
@@ -318,7 +345,15 @@ function attachment_submit_meta_box( $post ) { * * @since 3.1.0 * - * @param object $post + * @param WP_Post $post Post object. + * @param array $box { + * Post formats meta box arguments. + * + * @type string $id Meta box ID. + * @type string $title Meta box title. + * @type callback $callback Meta box display callback. + * @type array $args Extra meta box arguments. + * } */ function post_format_meta_box( $post, $box ) { if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) : @@ -346,17 +381,32 @@ function post_format_meta_box( $post, $box ) { * * @since 2.6.0 * - * @param object $post + * @todo Create taxonomy-agnostic wrapper for this. + * + * @param WP_Post $post Post object. + * @param array $box { + * Tags meta box arguments. + * + * @type string $id Meta box ID. + * @type string $title Meta box title. + * @type callback $callback Meta box display callback. + * @type array $args { + * Extra meta box arguments. + * + * @type string $taxonomy Taxonomy. Default 'post_tag'. + * } + * } */ -function post_tags_meta_box($post, $box) { - $defaults = array('taxonomy' => 'post_tag'); - if ( !isset($box['args']) || !is_array($box['args']) ) +function post_tags_meta_box( $post, $box ) { + $defaults = array( 'taxonomy' => 'post_tag' ); + if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { $args = array(); - else + } else { $args = $box['args']; - extract( wp_parse_args($args, $defaults), EXTR_SKIP ); - $tax_name = esc_attr($taxonomy); - $taxonomy = get_taxonomy($taxonomy); + } + $r = wp_parse_args( $args, $defaults ); + $tax_name = esc_attr( $r['taxonomy'] ); + $taxonomy = get_taxonomy( $r['taxonomy'] ); $user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms ); $comma = _x( ',', 'tag delimiter' ); ?> @@ -388,59 +438,74 @@ function post_tags_meta_box($post, $box) { * * @since 2.6.0 * - * @param object $post + * @todo Create taxonomy-agnostic wrapper for this. + * + * @param WP_Post $post Post object. + * @param array $box { + * Categories meta box arguments. + * + * @type string $id Meta box ID. + * @type string $title Meta box title. + * @type callback $callback Meta box display callback. + * @type array $args { + * Extra meta box arguments. + * + * @type string $taxonomy Taxonomy. Default 'category'. + * } + * } */ function post_categories_meta_box( $post, $box ) { - $defaults = array('taxonomy' => 'category'); - if ( !isset($box['args']) || !is_array($box['args']) ) + $defaults = array( 'taxonomy' => 'category' ); + if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { $args = array(); - else + } else { $args = $box['args']; - extract( wp_parse_args($args, $defaults), EXTR_SKIP ); - $tax = get_taxonomy($taxonomy); - + } + $r = wp_parse_args( $args, $defaults ); + $tax_name = esc_attr( $r['taxonomy'] ); + $taxonomy = get_taxonomy( $r['taxonomy'] ); ?> -
-