Make WordPress Core


Ignore:
Timestamp:
04/17/2013 08:57:44 PM (14 years ago)
Author:
markjaquith
Message:

Standardize post format postmeta keys around the ones already used by the Crowd Favorite plugin.

props wonderboymusic. fixes #24010.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post-formats.php

    r24006 r24021  
    1212        <div class="field wp-format-quote">
    1313                <label for="wp_format_quote"><?php _e( 'Quote' ); ?></label>
    14                 <textarea id="wp_format_quote" name="_wp_format_quote" class="widefat"><?php echo esc_textarea( $format_meta['quote'] ); ?></textarea>
     14                <textarea id="wp_format_quote" name="_format_quote" class="widefat"><?php echo esc_textarea( $format_meta['quote'] ); ?></textarea>
    1515        </div>
    1616
    1717        <div class="field wp-format-quote">
    1818                <label for="wp_format_quote_source"><?php _e( 'Quote source' ); ?></label>
    19                 <input type="text" id="wp_format_quote_source" name="_wp_format_quote_source" value="<?php echo esc_attr( $format_meta['quote_source'] ); ?>" class="widefat" />
     19                <input type="text" id="wp_format_quote_source" name="_format_quote_source_name" value="<?php echo esc_attr( $format_meta['quote_source_name'] ); ?>" class="widefat" />
    2020        </div>
    2121
    2222        <div class="field wp-format-image">
    23                 <?php if ( ! empty( $format_meta['image'] ) ) : ?>
     23                <?php if ( ! empty( $format_meta['image'] ) ) :
     24                        $value = $format_meta['image'];
     25                ?>
    2426                <div id="image-preview" class="wp-format-media-preview">
    2527                        <?php
    26                                 if ( is_numeric( $format_meta['image'] ) ) {
    27                                         $format_meta['image'] = absint( $format_meta['image'] );
     28                                if ( is_numeric( $value ) ) {
     29                                        $format_meta['image'] = absint( $value );
    2830                                        $image = wp_get_attachment_url( $format_meta['image'] );
    2931                                        printf( '<img src="%s" alt="%s" />', esc_url( $image ), get_the_title( $format_meta['image'] ) );
    30                                 } elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $format_meta['image'] ) ) {
    31                                         echo do_shortcode( $format_meta['image'] );
    32                                 } elseif ( ! preg_match( '#<[^>]+>#', $format_meta['image'] ) ) {
    33                                         printf( '<img src="%s" alt="" />', esc_url( $format_meta['image'] ) );
     32                                } elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $value ) ) {
     33                                        echo do_shortcode( $value );
     34                                } elseif ( ! preg_match( '#<[^>]+>#', $value ) ) {
     35                                        printf( '<img src="%s" alt="" />', esc_url( $value ) );
    3436                                } else {
    35                                         echo $format_meta['image'];
     37                                        echo $value;
    3638                                }
    3739                        ?>
    … …  
    4446                                _e( 'Image URL' );
    4547                ?></label>
    46                 <textarea id="wp_format_image" type="text" name="_wp_format_image" class="widefat"><?php esc_html_e( $format_meta['image'] ); ?></textarea>
     48                <textarea id="wp_format_image" type="text" name="_format_image" class="widefat"><?php esc_html_e( $format_meta['image'] ); ?></textarea>
    4749                <div data-format="image" class="wp-format-media-holder hide-if-no-js">
    4850                        <a href="#" class="wp-format-media-select"
    … …  
    5456        </div>
    5557
    56         <div class="field wp-format-link wp-format-quote wp-format-image">
    57                 <label for="wp_format_url"><?php _e( 'Link URL' ); ?></label>
    58                 <input type="text" id="wp_format_url" name="_wp_format_url" value="<?php echo esc_url( $format_meta['url'] ); ?>" class="widefat" />
     58        <div class="field wp-format-link">
     59                <label for="wp_format_link_url"><?php _e( 'Link URL' ); ?></label>
     60                <input type="text" id="wp_format_link_url" name="_format_link_url" value="<?php echo esc_url( $format_meta['link_url'] ); ?>" class="widefat" />
     61        </div>
     62
     63        <div class="field wp-format-quote">
     64                <label for="wp_format_quote_source_url"><?php _e( 'Link URL' ); ?></label>
     65                <input type="text" id="wp_format_quote_source_url" name="_format_quote_source_url" value="<?php echo esc_url( $format_meta['quote_source_url'] ); ?>" class="widefat" />
     66        </div>
     67
     68        <div class="field wp-format-image">
     69                <label for="wp_format_image_url"><?php _e( 'Link URL' ); ?></label>
     70                <input type="text" id="wp_format_image_url" name="_format_url" value="<?php echo esc_url( $format_meta['url'] ); ?>" class="widefat" />
    5971        </div>
    6072
    6173        <div class="field wp-format-video">
    62                 <?php if ( ! empty( $format_meta['video'] ) ): ?>
     74                <?php if ( ! empty( $format_meta['video_embed'] ) ):
     75                        $value = $format_meta['video_embed'];
     76                ?>
    6377                <div id="video-preview" class="wp-format-media-preview">
    6478                        <?php
    65                                 if ( is_numeric( $format_meta['video'] ) ) {
    66                                         $url = wp_get_attachment_url( $format_meta['video'] );
     79                                if ( is_numeric( $value ) ) {
     80                                        $url = wp_get_attachment_url( $value );
    6781                                        echo do_shortcode( sprintf( '[video src="%s"]', $url ) );
    68                                 } elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $format_meta['video'] ) ) {
    69                                         echo do_shortcode( $format_meta['video'] );
    70                                 } elseif ( ! preg_match( '#<[^>]+>#', $format_meta['video'] ) ) {
    71                                         if ( strstr( $format_meta['video'], home_url() ) )
    72                                                 echo do_shortcode( sprintf( '[video src="%s"]', $format_meta['video'] ) );
     82                                } elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $value ) ) {
     83                                        echo do_shortcode( $value );
     84                                } elseif ( ! preg_match( '#<[^>]+>#', $value ) ) {
     85                                        if ( strstr( $value, home_url() ) )
     86                                                echo do_shortcode( sprintf( '[video src="%s"]', $value ) );
    7387                                        else
    74                                                 echo $wp_embed->autoembed( $format_meta['video'] );
     88                                                echo $wp_embed->autoembed( $value );
    7589                                } else {
    76                                         echo $format_meta['video'];
     90                                        echo $value;
    7791                                }
    7892                        ?>
    … …  
    8599                                _e( 'Video URL' );
    86100                ?></label>
    87                 <textarea id="wp_format_video" type="text" name="_wp_format_video" class="widefat"><?php esc_html_e( $format_meta['video'] ); ?></textarea>
     101                <textarea id="wp_format_video" type="text" name="_format_video_embed" class="widefat"><?php esc_html_e( $format_meta['video_embed'] ); ?></textarea>
    88102                <div data-format="video" class="wp-format-media-holder hide-if-no-js">
    89103                        <a href="#" class="wp-format-media-select"
    … …  
    96110
    97111        <div class="field wp-format-audio">
    98                 <?php if ( ! empty( $format_meta['audio'] ) ): ?>
     112                <?php if ( ! empty( $format_meta['audio_embed'] ) ):
     113                        $value = $format_meta['audio_embed'];
     114                ?>
    99115                <div id="audio-preview" class="wp-format-media-preview">
    100116                        <?php
    101                                 if ( is_numeric( $format_meta['audio'] ) ) {
    102                                         $url = wp_get_attachment_url( $format_meta['audio'] );
     117                                if ( is_numeric( $value ) ) {
     118                                        $url = wp_get_attachment_url( $value );
    103119                                        echo do_shortcode( sprintf( '[audio src="%s"]', $url ) );
    104                                 } elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $format_meta['audio'] ) ) {
    105                                         echo do_shortcode( $format_meta['audio'] );
    106                                 } elseif ( ! preg_match( '#<[^>]+>#', $format_meta['audio'] ) ) {
    107                                         if ( strstr( $format_meta['audio'], home_url() ) )
    108                                                 echo do_shortcode( sprintf( '[audio src="%s"]', $format_meta['audio'] ) );
     120                                } elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $value ) ) {
     121                                        echo do_shortcode( $value );
     122                                } elseif ( ! preg_match( '#<[^>]+>#', $value ) ) {
     123                                        if ( strstr( $value, home_url() ) )
     124                                                echo do_shortcode( sprintf( '[audio src="%s"]', $value ) );
    109125                                        else
    110                                                 echo $wp_embed->autoembed( $format_meta['audio'] );
     126                                                echo $wp_embed->autoembed( $value );
    111127                                } else {
    112                                         echo $format_meta['audio'];
     128                                        echo $value;
    113129                                }
    114130                        ?>
    … …  
    121137                                _e( 'Audio URL' );
    122138                ?></label>
    123                 <textarea id="wp_format_audio" name="_wp_format_audio" class="widefat"><?php esc_html_e( $format_meta['audio'] ); ?></textarea>
     139                <textarea id="wp_format_audio" name="_format_audio_embed" class="widefat"><?php esc_html_e( $format_meta['audio_embed'] ); ?></textarea>
    124140                <div data-format="audio" class="wp-format-media-holder hide-if-no-js">
    125141                        <a href="#" class="wp-format-media-select" data-choose="<?php esc_attr_e( 'Choose Audio' ); ?>" data-update="<?php esc_attr_e( 'Select Audio' ); ?>">
Note: See TracChangeset for help on using the changeset viewer.