X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/41578db67d72562346e4dbb2a14889b23d522813..refs/tags/wordpress-4.3:/wp-admin/includes/meta-boxes.php diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index 9f7f469a..a7a895a1 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -7,6 +7,8 @@ * * @since 2.7.0 * + * @global string $action + * * @param object $post */ function post_submit_meta_box($post, $args = array() ) { @@ -42,14 +44,17 @@ if ( 'publish' == $post->post_status ) { $preview_button = __( 'Preview Changes' ); } else { $preview_link = set_url_scheme( get_permalink( $post->ID ) ); + /** * 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 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 ) ) ); + $preview_link = esc_url( apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ) ); $preview_button = __( 'Preview' ); } ?> @@ -159,15 +164,15 @@ echo esc_html( $visibility_trans ); ?> ID ) { if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date $stamp = __('Scheduled for: %1$s'); - } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published + } elseif ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published $stamp = __('Published on: %1$s'); - } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified + } elseif ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified $stamp = __('Publish immediately'); - } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified + } elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified $stamp = __('Schedule for: %1$s'); } else { // draft, 1 or more saves, date specified $stamp = __('Publish on: %1$s'); @@ -201,7 +206,10 @@ if ( $can_publish ) : // Contributors don't get to choose the date of publish ?> -
+
+ + +
@@ -245,19 +253,19 @@ if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 if ( $can_publish ) : if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?> - 'p' ) ); ?> + - 'p' ) ); ?> + - 'p' ) ); ?> + - + @@ -276,11 +284,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); ?>
@@ -295,7 +298,7 @@ function attachment_submit_meta_box( $post ) {
%1$s'); $date = date_i18n( $datef, strtotime( $post->post_date ) ); ?> @@ -332,7 +335,7 @@ function attachment_submit_meta_box( $post ) {
- +
@@ -347,7 +350,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' ) ) : @@ -362,10 +373,13 @@ function post_format_meta_box( $post, $box ) { $post_formats[0][] = $post_format; ?>
- /> - -
/> -
+
+ + /> + +
/> + +
'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' ); ?> @@ -397,7 +426,6 @@ function post_tags_meta_box($post, $box) {
-
labels->add_new_item; ?>

@@ -417,59 +445,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'] ); ?> -
-