X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/41578db67d72562346e4dbb2a14889b23d522813..refs/tags/wordpress-4.5:/wp-admin/includes/meta-boxes.php
diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php
index 9f7f469a..bf877c3d 100644
--- a/wp-admin/includes/meta-boxes.php
+++ b/wp-admin/includes/meta-boxes.php
@@ -3,13 +3,23 @@
// -- Post related Meta Boxes
/**
- * Display post submit form fields.
+ * Displays post submit form fields.
*
* @since 2.7.0
*
- * @param object $post
+ * @global string $action
+ *
+ * @param WP_Post $post Current post object.
+ * @param array $args {
+ * Array of arguments for building the post submit meta box.
+ *
+ * @type string $id Meta box ID.
+ * @type string $title Meta box title.
+ * @type callable $callback Meta box display callback.
+ * @type array $args Extra meta box arguments.
+ * }
*/
-function post_submit_meta_box($post, $args = array() ) {
+function post_submit_meta_box( $post, $args = array() ) {
global $action;
$post_type = $post->post_type;
@@ -29,27 +39,19 @@ function post_submit_meta_box($post, $args = array() ) {
post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?>
post_status ) { ?>style="display:none" type="submit" name="save" id="save-post" value="" class="button" />
+
post_status && $can_publish ) { ?>
-
+
-public ) : ?>
+
post_status ) {
- $preview_link = esc_url( get_permalink( $post->ID ) );
$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
- *
- * @param string $preview_link URI the user will be directed to for a post preview.
- */
- $preview_link = esc_url( apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ) ) );
$preview_button = __( 'Preview' );
}
?>
@@ -57,6 +59,16 @@ if ( 'publish' == $post->post_status ) {
+
@@ -295,7 +297,7 @@ function attachment_submit_meta_box( $post ) {
%1$s');
$date = date_i18n( $datef, strtotime( $post->post_date ) );
?>
@@ -321,7 +323,7 @@ function attachment_submit_meta_box( $post ) {
ID ) )
if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
- echo "
" . __( 'Trash' ) . " ";
+ echo "
" . _x( 'Trash', 'verb' ) . " ";
} else {
$delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
echo "
" . __( 'Delete Permanently' ) . " ";
@@ -332,7 +334,7 @@ function attachment_submit_meta_box( $post ) {
-
+
@@ -347,7 +349,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 callable $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 +372,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' );
+ $terms_to_edit = get_terms_to_edit( $post->ID, $tax_name );
+ if ( ! is_string( $terms_to_edit ) ) {
+ $terms_to_edit = '';
+ }
?>
@@ -417,59 +449,109 @@ 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 callable $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'] );
?>
-
-
- labels->all_items; ?>
-
+
+
-
-
+
@@ -866,6 +1003,8 @@ function link_target_meta_box($link) { ?>
*
* @since 1.0.1
*
+ * @global object $link
+ *
* @param string $class
* @param string $value
* @param mixed $deprecated Never used.
@@ -1052,6 +1191,8 @@ function link_advanced_meta_box($link) {
* Display post thumbnail meta box.
*
* @since 2.9.0
+ *
+ * @param WP_Post $post A post object.
*/
function post_thumbnail_meta_box( $post ) {
$thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
@@ -1063,7 +1204,7 @@ function post_thumbnail_meta_box( $post ) {
*
* @since 3.9.0
*
- * @param WP_Post $post
+ * @param WP_Post $post A post object.
*/
function attachment_id3_data_meta_box( $post ) {
$meta = array();