From e0a0e46abd1c0e457bc29caaafd91b7d8eb269b7 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Thu, 30 May 2013 21:33:46 +0000 Subject: [PATCH] First pass at removing Post Format UI. see #24452. fixes #24455. git-svn-id: https://develop.svn.wordpress.org/trunk@24388 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/admin-ajax.php | 2 +- wp-admin/admin-header.php | 33 --- wp-admin/edit-form-advanced.php | 92 +------- wp-admin/includes/ajax-actions.php | 17 -- wp-admin/includes/post-formats.php | 163 ------------- wp-admin/includes/post.php | 20 -- wp-admin/includes/screen.php | 30 --- wp-admin/js/post-formats.js | 361 ----------------------------- wp-admin/js/post-formats.min.js | 1 - wp-includes/post.php | 3 +- wp-includes/script-loader.php | 2 - 11 files changed, 9 insertions(+), 715 deletions(-) delete mode 100644 wp-admin/includes/post-formats.php delete mode 100644 wp-admin/js/post-formats.js delete mode 100644 wp-admin/js/post-formats.min.js diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index c652ae7cca..ebe7550dc6 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -56,7 +56,7 @@ $core_actions_post = array( 'save-widget', 'set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post', 'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment', 'query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor', - 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'show-post-format-ui', + 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', ); // Register core Ajax calls. diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index cebebfc59a..b2655b8ee1 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -95,39 +95,6 @@ if ( isset( $post ) && is_a( $post, 'WP_Post' ) && post_type_supports( get_post_ $post_format = 'standard'; $admin_body_class .= ' wp-format-' . $post_format; - - $show_post_format_ui = false; - - if ( apply_filters( 'enable_post_format_ui', true, $post ) ) { - - // If the user has explicitly set a screen option, use it, otherwise the UI is shown - // when the theme supports formats, or if the site has formats assigned to posts. - $post_format_user_option = get_user_option( 'post_formats_' . $post->post_type ); - if ( false !== $post_format_user_option ) - $show_post_format_ui = (bool) $post_format_user_option; - else - $show_post_format_ui = current_theme_supports( 'post-formats' ) || (bool) get_terms( 'post_format', array( 'number' => 1 ) ); - - if ( ! $show_post_format_ui ) { - $meta = get_post_format_meta( $post->ID ); - $format_meta_keys = array( - 'link' => array( 'linkurl' ), - 'image' => array( 'url', 'image' ), - 'quote' => array( 'quote_source_name', 'quote_source_url' ), - 'video' => array( 'video_embed' ), - 'audio' => array( 'audio_embed' ), - ); - - // If there's any structured post format data, enforce the UI display. - $format_meta_keys = isset( $format_meta_keys[ get_post_format() ] ) ? $format_meta_keys[ get_post_format() ] : array(); - foreach ( $format_meta_keys as $key ) - if ( ! empty( $meta[ $key ] ) ) - $show_post_format_ui = true; - } - } - - if ( $show_post_format_ui ) - $admin_body_class .= ' wp-post-format-show-ui'; } if ( wp_is_mobile() ) diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 39d7103627..3e485f24af 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -112,6 +112,9 @@ if ( 'attachment' == $post_type ) { add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core' ); } +if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) + add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core' ); + // all taxonomies foreach ( get_object_taxonomies( $post ) as $tax_name ) { $taxonomy = get_taxonomy($tax_name); @@ -126,73 +129,6 @@ foreach ( get_object_taxonomies( $post ) as $tax_name ) { add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', null, 'side', 'core', array( 'taxonomy' => $tax_name )); } -// post format -$format_class = ''; -$post_format = ''; -$post_format_options = ''; -if ( post_type_supports( $post_type, 'post-formats' ) && apply_filters( 'enable_post_format_ui', true, $post ) ) { - wp_enqueue_script( 'post-formats' ); - wp_enqueue_script( 'wp-mediaelement' ); - wp_enqueue_style( 'wp-mediaelement' ); - $post_format = get_post_format(); - - if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) ) - $post_format = $_REQUEST['format']; - - if ( ! $post_format ) - $post_format = 'standard'; - - $format_class = " class='wp-format-{$post_format}'"; - - $all_post_formats = array( - 'standard' => array ( - 'description' => __( 'Use the editor below to compose your post.' ) - ), - 'image' => array ( - 'description' => __( 'Select or upload an image for your post.' ) - ), - 'gallery' => array ( - 'description' => __( 'Use the Add Media button to select or upload images for your gallery.' ) - ), - 'link' => array ( - 'description' => __( 'Add a link title and destination URL. Use the editor to compose optional text to accompany the link.' ) - ), - 'video' => array ( - 'description' => __( 'Select or upload a video, or paste a video embed code into the box.' ) - ), - 'audio' => array ( - 'description' => __( 'Select or upload an audio file, or paste an audio embed code into the box.' ) - ), - 'chat' => array ( - 'description' => __( 'Copy a chat or Q&A transcript into the editor.' ) - ), - 'status' => array ( - 'description' => __( 'Use the editor to compose a status update. What’s new?' ) - ), - 'quote' => array ( - 'description' => __( 'Add a source name and link if you have them. Use the editor to compose the quote.' ) - ), - 'aside' => array ( - 'description' => __( 'Use the editor to share a quick thought or side topic.' ) - ) - ); - - foreach ( $all_post_formats as $slug => $attr ) { - $class = ''; - if ( $post_format == $slug ) { - $class = 'class="active"'; - $active_post_type_slug = $slug; - } - - $url = add_query_arg( 'format', $slug ); - - $post_format_options .= '
' . ucfirst( $slug ) . '
'; - } - - $current_post_format = array( 'currentPostFormat' => esc_html( $active_post_type_slug ) ); - wp_localize_script( 'post-formats', 'postFormats', $current_post_format ); -} - if ( post_type_supports($post_type, 'page-attributes') ) add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core'); @@ -379,13 +315,7 @@ if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create - -
-
- -
-
- +
> @@ -411,12 +341,8 @@ wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
-
> - -
-
-
- +
+
@@ -456,10 +382,6 @@ if ( has_action( 'edit_form_after_title' ) ) { echo '
'; } -// post format fields -if ( post_type_supports( $post_type, 'post-formats' ) && apply_filters( 'enable_post_format_ui', true, $post ) ) - require_once( './includes/post-formats.php' ); - if ( post_type_supports($post_type, 'editor') ) { ?>
@@ -467,7 +389,7 @@ if ( post_type_supports($post_type, 'editor') ) { post_content, 'content', array( 'dfw' => true, 'tabfocus_elements' => 'insert-media-button,save-post', - 'editor_height' => in_array( $post_format, array( 'status', 'aside' ) ) ? 120 : 360 + 'editor_height' => 360, ) ); ?> diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 7e843e75c9..bde94e1545 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -1126,23 +1126,6 @@ function wp_ajax_closed_postboxes() { wp_die( 1 ); } -function wp_ajax_show_post_format_ui() { - if ( empty( $_POST['post_type'] ) ) - wp_die( 0 ); - - check_ajax_referer( 'show-post-format-ui_' . $_POST['post_type'], 'nonce' ); - - if ( ! $post_type_object = get_post_type_object( $_POST['post_type'] ) ) - wp_die( 0 ); - - if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) - wp_die( -1 ); - - update_user_option( get_current_user_id(), 'post_formats_' . $post_type_object->name, empty( $_POST['show'] ) ? 0 : 1 ); - - wp_die( 1 ); -} - function wp_ajax_hidden_columns() { check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' ); $hidden = isset( $_POST['hidden'] ) ? $_POST['hidden'] : ''; diff --git a/wp-admin/includes/post-formats.php b/wp-admin/includes/post-formats.php deleted file mode 100644 index e2a58e74e0..0000000000 --- a/wp-admin/includes/post-formats.php +++ /dev/null @@ -1,163 +0,0 @@ - -
-
- - - -
- - -
- -
- -
- ', esc_url( $image ), get_the_title( $value ) ); - } elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $value ) ) { - echo do_shortcode( $value ); - } elseif ( ! preg_match( '#<[^>]+>#', $value ) ) { - printf( '', esc_url( $value ) ); - } else { - echo $value; - } - ?> -
- -
-

- - - -
-
- - -
-

- use an image URL or HTML)' ); - else - _e( '(or use an image URL)' ); - ?> - select/upload an image)' ); ?>

-
- - - -
- - -
- -
- - -
- -
- -
- ]+>#', $value ) ) { - if ( strstr( $value, home_url() ) ) - echo do_shortcode( sprintf( '[video src="%s"]', $value ) ); - else - echo $wp_embed->autoembed( $value ); - } else { - echo $value; - } - ?> -
- - - -
- - - -
-
- -
- -
- ]+>#', $value ) ) { - if ( strstr( $value, home_url() ) ) - echo do_shortcode( sprintf( '[audio src="%s"]', $value ) ); - else - echo $wp_embed->autoembed( $value ); - } else { - echo $value; - } - ?> -
- - - -
- - - -
-
-
-
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 21d8c1e8fe..519c71b351 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -1290,26 +1290,6 @@ function wp_create_post_autosave( $post_id ) { $new_autosave['ID'] = $old_autosave->ID; $new_autosave['post_author'] = $post_author; - // Auto-save revisioned meta fields. - foreach ( _wp_post_revision_meta_keys() as $meta_key ) { - if ( isset( $_POST[ $meta_key ] ) && get_post_meta( $new_autosave['ID'], $meta_key, true ) != $_POST[ $meta_key ] ) { - // Use the underlying delete_metadata and add_metadata vs delete_post_meta - // and add_post_meta to make sure we're working with the actual revision meta. - delete_metadata( 'post', $new_autosave['ID'], $meta_key ); - - if ( ! empty( $_POST[ $meta_key ] ) ) - add_metadata( 'post', $new_autosave['ID'], $meta_key, $_POST[ $meta_key ] ); - } - } - - // Save the post format if different - if ( isset( $_POST['post_format'] ) && get_post_meta( $new_autosave['ID'], '_revision_post_format', true ) != $_POST['post_format'] ) { - delete_metadata( 'post', $new_autosave['ID'], '_revision_post_format' ); - - if ( ! empty( $_POST['post_format'] ) ) - add_metadata( 'post', $new_autosave['ID'], '_revision_post_format', $_POST['post_format'] ); - } - return wp_update_post( $new_autosave ); } diff --git a/wp-admin/includes/screen.php b/wp-admin/includes/screen.php index f66249cdbf..932ca0632a 100644 --- a/wp-admin/includes/screen.php +++ b/wp-admin/includes/screen.php @@ -963,36 +963,6 @@ final class WP_Screen { echo '\n"; - } elseif ( 'post' == $this->base && post_type_supports( $this->post_type, 'post-formats' ) && apply_filters( 'enable_post_format_ui', true, $post ) ) { - - // If the user has explicitly set a screen option, use it, otherwise the UI is shown - // when the theme supports formats, or if the site has formats assigned to posts. - $post_format_user_option = get_user_option( 'post_formats_' . $post->post_type ); - if ( false !== $post_format_user_option ) - $show_post_format_ui = (bool) $post_format_user_option; - else - $show_post_format_ui = current_theme_supports( 'post-formats' ) || (bool) get_terms( 'post_format', array( 'number' => 1 ) ); - - if ( ! $show_post_format_ui && 'auto-draft' != $post->post_status ) { - $meta = get_post_format_meta( $post->ID ); - $format_meta_keys = array( - 'link' => array( 'linkurl' ), - 'image' => array( 'url', 'image' ), - 'quote' => array( 'quote_source_name', 'quote_source_url' ), - 'video' => array( 'video_embed' ), - 'audio' => array( 'audio_embed' ), - ); - - // If there's any structured post format data, enforce the UI display. - $format_meta_keys = isset( $format_meta_keys[ get_post_format() ] ) ? $format_meta_keys[ get_post_format() ] : array(); - foreach ( $format_meta_keys as $key ) - if ( ! empty( $meta[ $key ] ) ) - $show_post_format_ui = true; - } - - echo '\n"; } ?>
diff --git a/wp-admin/js/post-formats.js b/wp-admin/js/post-formats.js deleted file mode 100644 index 8e7ca2c79c..0000000000 --- a/wp-admin/js/post-formats.js +++ /dev/null @@ -1,361 +0,0 @@ -/*globals window, $, jQuery, document, _, postFormats, tinymce, ajaxurl, wp, getUserSetting */ - -window.wp = window.wp || {}; - -(function ($) { - "use strict"; - - var mediaFrame, insertMediaButton, container, icon, formatField, - body, - lastMimeType, - classRegex = /\s?\bwp-format-[^ ]+/g, - shortHeight = 120, - lastHeight = 360, - initialFormat = 'standard', - shortClass = 'short-format', - noTitleFormats = ['status'], - noMediaFormats = ['status', 'aside', 'image', 'audio', 'video'], - shortContentFormats = ['status', 'aside'], - noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery']; - - function imageFormatUploadProgress( uploader, file ) { - var $bar = $( '#' + uploader.settings.drop_element + ' .media-progress-bar div' ); - $bar.width( file.percent + '%' ); - } - - function imageFormatUploadStart( uploader ) { - $( '#' + uploader.settings.drop_element + ' .wp-format-media-select' ).append('
'); - } - - function imageFormatUploadError() { - $( '.media-progress-bar', $('.wp-format-media-holder[data-format=image]') ).remove(); - } - - function imageFormatUploadSuccess( attachment ) { - var $holder, $field, html = wp.media.string.image({ - size : 'full', - align : false, - link : 'none' - }, attachment.attributes ); - - $holder = $('.wp-format-media-holder[data-format=image]'); - $( '.media-progress-bar', $holder ).remove(); - - if ( 'image' !== attachment.attributes.type ) - return; - - $field = $( '#wp_format_' + $holder.data( 'format' ) ); - - // set the hidden input's value - $field.val( html ); - - $( '#image-preview' ).remove(); - - $holder.parent().prepend( ['
', - '', - '
'].join( '' ) ); - } - - function imageFormatUploadFilesAdded( uploader, files ) { - $.each( files, function( i, file ) { - if ( i > 0 ) - uploader.removeFile(file); - }); - } - - var uploader = { - container: null, - browser: null, - dropzone: $('.wp-format-media-holder[data-format=image]'), - success: imageFormatUploadSuccess, - error: imageFormatUploadError, - plupload: { - runtimes: 'html5', - filters: [ {title: 'Image', extensions: 'jpg,jpeg,gif,png'} ] - }, - params: {} - }; - uploader = new wp.Uploader( uploader ); - - if ( uploader.supports.dragdrop ) { - uploader.uploader.bind( 'BeforeUpload', imageFormatUploadStart ); - uploader.uploader.bind( 'UploadProgress', imageFormatUploadProgress ); - uploader.uploader.bind( 'FilesAdded', imageFormatUploadFilesAdded ); - } else { - uploader.uploader.destroy(); - uploader = null; - } - - function switchFormatClass( format ) { - formatField.val( format ); - - $.each( [ container, icon, body ], function(i, thing) { - thing.prop( 'className', thing.prop( 'className' ).replace( classRegex, '' ) ) - .addClass( 'wp-format-' + format ); - }); - } - - function resizeContent( format, noAnimate ) { - var height, content = $( '#content, #content_ifr' ); - - height = content.outerHeight(); - if ( shortHeight < height ) { - lastHeight = height; - } - - if ( -1 < $.inArray( format, shortContentFormats ) ) { - if ( ! content.hasClass( shortClass ) ) { - content.addClass( shortClass ); - _(content).each(function (elem) { - $(elem)[noAnimate ? 'css' : 'animate']( { height : shortHeight } ); - }); - } - } else { - content.removeClass( shortClass ).animate( { height : lastHeight } ); - } - } - - function switchFormat(elem) { - var editor, body, formatTo, formatFrom, - format = elem.data( 'wp-format' ), - titlePrompt = $( '#title-prompt-text' ), - description = $( '.post-format-description' ), - postTitle = $( '#title'), - fields = $( '.post-formats-fields' ), - tinyIcon = $( '.post-format-change span.icon' ); - - if ( format === postFormats.currentPostFormat ) { - return; - } - - elem.addClass( 'active' ).siblings().removeClass( 'active' ); - - // Animate the media button going away or coming back - formatTo = -1 < $.inArray( format, noMediaFormats ); - formatFrom = -1 < $.inArray( postFormats.currentPostFormat, noMediaFormats ); - if ( formatFrom ? !formatTo : formatTo ) { // XOR - insertMediaButton.fadeToggle( 200 ).css( 'display', 'inline-block' ); - } - // Animate the title going away or coming back - formatTo = -1 < $.inArray( format, noTitleFormats ); - formatFrom = -1 < $.inArray( postFormats.currentPostFormat, noTitleFormats ); - if ( formatFrom ? !formatTo : formatTo ) { // XOR - $( '#titlewrap' ).fadeToggle( 200 ); - } - - // Animate the fields moving going away or coming in - formatTo = -1 < $.inArray( format, noUIFormats ); - formatFrom = -1 < $.inArray( postFormats.currentPostFormat, noUIFormats ); - if ( formatTo && formatFrom ) { // To/from have no UI. No slide. - switchFormatClass( format ); - fields.hide(); - } else if ( formatFrom ) { // Only destination has UI. Slide down. - fields.hide(); - switchFormatClass( format ); - fields.slideDown( 400 ); - } else if ( formatTo ) { // Only source has UI. Slide up. - fields.slideUp( 200, function(){ - switchFormatClass( format ); - }); - } else { // Both have UI. Slide both ways. - fields.slideUp( 200, function(){ - switchFormatClass( format ); - fields.slideDown( 400 ); - }); - } - - resizeContent( format ); - postTitle.focus(); - - if ( '' === postTitle.val() ) { - titlePrompt.removeClass( 'screen-reader-text' ); - - postTitle.keydown( function (e) { - titlePrompt.addClass( 'screen-reader-text' ); - $( e.currentTarget ).unbind( e ); - } ); - } - - // Update description line - description.html( elem.data( 'description' ) ); - tinyIcon - .show() - .prop( 'className', tinyIcon.prop( 'className' ).replace( classRegex, '' ) ) - .addClass( 'wp-format-' + format ); - - if ( description.not( ':visible' ) ) { - description.slideDown( 'fast' ); - } - - if ( typeof tinymce !== 'undefined' ) { - editor = tinymce.get( 'content' ); - - if ( editor ) { - body = editor.getBody(); - body.className = body.className.replace( /\bpost-format-[^ ]+/, '' ); - editor.dom.addClass( body, 'post-format-' + format ); - } - } - - // If gallery, force it to open to gallery state - insertMediaButton.toggleClass( 'gallery', 'gallery' === format ); - postFormats.currentPostFormat = format; - } - - $(function () { - body = $( 'body' ); - container = $( '#post-body-content' ); - icon = $( '.icon32' ); - formatField = $( '#post_format' ); - insertMediaButton = $( '#insert-media-button' ).toggleClass( 'gallery', 'gallery' === postFormats.currentPostFormat ); - initialFormat = $( '.post-format-options .active' ).data( 'wp-format' ); - - if ( -1 < $.inArray( initialFormat, shortContentFormats ) ) { - resizeContent( initialFormat, true ); - } - - $( '#show_post_format_ui' ).on( 'change', function () { - body.toggleClass( 'wp-post-format-show-ui', this.checked ); - - // Reset the display properties of possibly hidden items. - insertMediaButton.css( 'display', '' ); - $( '#titlewrap' ).css( 'display', '' ); - - $.post( ajaxurl, { - action: 'show-post-format-ui', - post_type: $( '#post_type' ).val(), - show: this.checked ? 1 : 0, - nonce: $( '#show_post_format_ui_nonce' ).val() - } ); - } ); - - // Post formats selection - $( '.post-format-options' ).on( 'click', 'a', function (e) { - e.preventDefault(); - switchFormat( $( e.currentTarget ) ); - } ); - - // Toggle select/upload and URL/HTML for images - $( '.use-url-or-html' ).on( 'click', 'a', function(e) { - e.preventDefault(); - $( '.wp-format-media-holder, .wp-format-image-textarea' ).toggle(); - $(this).closest( 'p' ).find( 'span' ).toggle(); - }); - - // Media selection - $( '.wp-format-media-select' ).click( function (e) { - e.preventDefault(); - - var $el = $(e.currentTarget), mediaPreview, mime = 'image', $holder, $field; - - $holder = $el.closest( '.wp-format-media-holder' ); - $field = $( '#wp_format_' + $holder.data( 'format' ) ); - mime = $holder.data( 'format' ); - - // If the media frame already exists, reopen it. - if ( mediaFrame && lastMimeType === mime ) { - mediaFrame.open(); - return; - } - - lastMimeType = mime; - - mediaFrame = wp.media.frames.formatMedia = wp.media( { - button: { - text: $el.data( 'update' ) - }, - states: [ - new wp.media.controller.Library({ - library: wp.media.query( { type: mime } ), - title: $el.data( 'choose' ), - displaySettings: 'image' === mime - }) - ] - } ); - - mediaPreview = function (attachment) { - var w, h, dimensions = '', url = attachment.url, mime = attachment.mime, format = attachment.type; - - if ( 'video' === format ) { - if ( attachment.width ) { - w = attachment.width; - if ( w > 600 ) { - w = 600; - } - dimensions += ' width="' + w + '"'; - } - - if ( attachment.height ) { - h = attachment.height; - if ( attachment.width && w < attachment.width ) { - h = Math.round( ( h * w ) / attachment.width ); - } - dimensions += ' height="' + h + '"'; - } - } - - $( '#' + format + '-preview' ).remove(); - $holder.parent().prepend( '
' + - '<' + format + dimensions + ' class="wp-' + format + '-shortcode" controls="controls" preload="none">' + - '' + - '
' ); - $( '.wp-' + format + '-shortcode' ).mediaelementplayer(); - }; - - // When an image is selected, run a callback. - mediaFrame.on( 'select', function () { - // Grab the selected attachment. - var w = 0, h = 0, html, attachment = mediaFrame.state().get( 'selection' ).first().toJSON(); - - if ( 0 === attachment.mime.indexOf( 'audio' ) ) { - $field.val( attachment.url ); - // show one preview at a time - mediaPreview( attachment ); - } else if ( 0 === attachment.mime.indexOf( 'video' ) ) { - attachment.src = attachment.url; - $field.val( wp.shortcode.string( { - tag: 'video', - attrs: _.pick( attachment, 'src', 'width', 'height' ) - } ) ); - // show one preview at a time - mediaPreview( attachment ); - } else { - html = wp.media.string.image({ - size: 'full', - align : false, - link : 'none' - }, attachment); - - // set the hidden input's value - $field.val( html ); - - $( '#image-preview' ).remove(); - - if ( attachment.width ) { - w = attachment.width > 600 ? 600 : attachment.width; - } - - if ( attachment.height ) { - h = attachment.height; - } - - if ( w < attachment.width ) { - h = Math.round( ( h * w ) / attachment.width ); - } - - $holder.parent().prepend( ['
', - '', - '
'].join( '' ) ); - } - }); - - mediaFrame.open(); - }); - }); -}( jQuery ) ); diff --git a/wp-admin/js/post-formats.min.js b/wp-admin/js/post-formats.min.js deleted file mode 100644 index 136a64f6b4..0000000000 --- a/wp-admin/js/post-formats.min.js +++ /dev/null @@ -1 +0,0 @@ -window.wp=window.wp||{};(function(c){var y,n,k,t,q,j,w,m=/\s?\bwp-format-[^ ]+/g,g=120,s=360,v="standard",b="short-format",e=["status"],i=["status","aside","image","audio","video"],f=["status","aside"],d=["standard","chat","status","aside","gallery"];function x(C,A){var B=c("#"+C.settings.drop_element+" .media-progress-bar div");B.width(A.percent+"%")}function a(A){c("#"+A.settings.drop_element+" .wp-format-media-select").append('
')}function r(){c(".media-progress-bar",c(".wp-format-media-holder[data-format=image]")).remove()}function l(D){var C,B,A=wp.media.string.image({size:"full",align:false,link:"none"},D.attributes);C=c(".wp-format-media-holder[data-format=image]");c(".media-progress-bar",C).remove();if("image"!==D.attributes.type){return}B=c("#wp_format_"+C.data("format"));B.val(A);c("#image-preview").remove();C.parent().prepend(['
','","
"].join(""))}function u(B,A){c.each(A,function(D,C){if(D>0){B.removeFile(C)}})}var p={container:null,browser:null,dropzone:c(".wp-format-media-holder[data-format=image]"),success:l,error:r,plupload:{runtimes:"html5",filters:[{title:"Image",extensions:"jpg,jpeg,gif,png"}]},params:{}};p=new wp.Uploader(p);if(p.supports.dragdrop){p.uploader.bind("BeforeUpload",a);p.uploader.bind("UploadProgress",x);p.uploader.bind("FilesAdded",u)}else{p.uploader.destroy();p=null}function z(A){q.val(A);c.each([k,t,j],function(C,B){B.prop("className",B.prop("className").replace(m,"")).addClass("wp-format-"+A)})}function h(D,B){var A,C=c("#content, #content_ifr");A=C.outerHeight();if(g600){G=600}J+=' width="'+G+'"'}if(M.height){I=M.height;if(M.width&&G<'+L+J+' class="wp-'+L+'-shortcode" controls="controls" preload="none">");c(".wp-"+L+"-shortcode").mediaelementplayer()};y.on("select",function(){var G=0,I=0,H,J=y.state().get("selection").first().toJSON();if(0===J.mime.indexOf("audio")){B.val(J.url);C(J)}else{if(0===J.mime.indexOf("video")){J.src=J.url;B.val(wp.shortcode.string({tag:"video",attrs:_.pick(J,"src","width","height")}));C(J)}else{H=wp.media.string.image({size:"full",align:false,link:"none"},J);B.val(H);c("#image-preview").remove();if(J.width){G=J.width>600?600:J.width}if(J.height){I=J.height}if(G','",""].join(""))}}});y.open()})})}(jQuery)); \ No newline at end of file diff --git a/wp-includes/post.php b/wp-includes/post.php index 297e69ff11..388163edff 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2676,8 +2676,7 @@ function wp_insert_post($postarr, $wp_error = false) { } $maybe_empty = ! $post_content && ! $post_title && ! $post_excerpt && post_type_supports( $post_type, 'editor' ) - && post_type_supports( $post_type, 'title' ) && post_type_supports( $post_type, 'excerpt' ) - && ! in_array( get_post_format( $post_ID ), array( 'audio', 'video', 'quote', 'image' ) ); + && post_type_supports( $post_type, 'title' ) && post_type_supports( $post_type, 'excerpt' ); if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) { if ( $wp_error ) diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index e1752f0666..237ef0fc8a 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -415,8 +415,6 @@ function wp_default_scripts( &$scripts ) { 'comma' => _x( ',', 'tag delimiter' ), ) ); - $scripts->add( 'post-formats', "/wp-admin/js/post-formats$suffix.js", array( 'media-models', 'wp-plupload' ), false, 1 ); - $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 ); $scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array( 'jquery', 'postbox' ) );
0' ); ?>