Make WordPress Core

Changeset 31589


Ignore:
Timestamp:
02/28/2015 08:07:45 PM (12 years ago)
Author:
azaozz
Message:

PressThis:

  • Remove unneeded passing of post formats strings to JS.
  • Set the currently selected post format name with jQuery.

See #31373.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-press-this.php

    r31588 r31589  
    3232         */
    3333        public function site_settings() {
    34                 $supported_formats = get_theme_support( 'post-formats' );
    35                 $post_formats      = array();
    36 
    37                 if ( ! empty( $supported_formats[0] ) && is_array( $supported_formats[0] ) ) {
    38                         $post_formats[0] = __( 'Standard' );
    39                         foreach ( $supported_formats[0] as $post_format ) {
    40                                 $post_formats[ $post_format ] = esc_html( get_post_format_string( $post_format ) );
    41                         }
    42                 }
    43 
    4434                return array(
    45                         'version'         => 5,
    46                         'post_formats'    => $post_formats,
     35                        // Used to trigger the bookmarklet update notice.
     36                        // Needs to be set here and in get_shortcut_link() in wp-includes/link-template.php.
     37                        'version' => '5',
    4738
    4839                        /**
  • trunk/src/wp-admin/js/press-this.js

    r31566 r31589  
    526526
    527527                /**
    528                  * Adds the currently selected post format next to the option, in the options panel.
    529                  *
    530                  * @param format string Post format to be displayed
    531                  */
    532                 function setPostFormatString( format ) {
    533                         if ( ! format || ! siteConfig || ! siteConfig.post_formats || ! siteConfig.post_formats[ format ] ) {
    534                                 return;
    535                         }
    536                         $( '#post-option-post-format' ).text( siteConfig.post_formats[ format ] );
    537                 }
    538 
    539                 /**
    540528                 * Save a new user-generated category via AJAX
    541529                 */
     
    954942
    955943                                if ( $this.is( ':checked' ) ) {
    956                                         setPostFormatString( $this.attr( 'id' ).replace( /^post-format-(.+)$/, '$1' ) );
     944                                        $( '#post-option-post-format' ).text( $( 'label[for="' + $this.attr( 'id' ) + '"]' ).text() || '' );
    957945                                }
    958946                        } );
Note: See TracChangeset for help on using the changeset viewer.