Standardize post format postmeta keys around the ones already used by the Crowd Favorite plugin.
props wonderboymusic. fixes #24010. git-svn-id: http://core.svn.wordpress.org/trunk@24021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
670c0e173f
commit
412161de03
|
@ -11,28 +11,30 @@ $format_meta = get_post_format_meta( $post_ID );
|
|||
|
||||
<div class="field wp-format-quote">
|
||||
<label for="wp_format_quote"><?php _e( 'Quote' ); ?></label>
|
||||
<textarea id="wp_format_quote" name="_wp_format_quote" class="widefat"><?php echo esc_textarea( $format_meta['quote'] ); ?></textarea>
|
||||
<textarea id="wp_format_quote" name="_format_quote" class="widefat"><?php echo esc_textarea( $format_meta['quote'] ); ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="field wp-format-quote">
|
||||
<label for="wp_format_quote_source"><?php _e( 'Quote source' ); ?></label>
|
||||
<input type="text" id="wp_format_quote_source" name="_wp_format_quote_source" value="<?php echo esc_attr( $format_meta['quote_source'] ); ?>" class="widefat" />
|
||||
<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" />
|
||||
</div>
|
||||
|
||||
<div class="field wp-format-image">
|
||||
<?php if ( ! empty( $format_meta['image'] ) ) : ?>
|
||||
<?php if ( ! empty( $format_meta['image'] ) ) :
|
||||
$value = $format_meta['image'];
|
||||
?>
|
||||
<div id="image-preview" class="wp-format-media-preview">
|
||||
<?php
|
||||
if ( is_numeric( $format_meta['image'] ) ) {
|
||||
$format_meta['image'] = absint( $format_meta['image'] );
|
||||
if ( is_numeric( $value ) ) {
|
||||
$format_meta['image'] = absint( $value );
|
||||
$image = wp_get_attachment_url( $format_meta['image'] );
|
||||
printf( '<img src="%s" alt="%s" />', esc_url( $image ), get_the_title( $format_meta['image'] ) );
|
||||
} elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $format_meta['image'] ) ) {
|
||||
echo do_shortcode( $format_meta['image'] );
|
||||
} elseif ( ! preg_match( '#<[^>]+>#', $format_meta['image'] ) ) {
|
||||
printf( '<img src="%s" alt="" />', esc_url( $format_meta['image'] ) );
|
||||
} elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $value ) ) {
|
||||
echo do_shortcode( $value );
|
||||
} elseif ( ! preg_match( '#<[^>]+>#', $value ) ) {
|
||||
printf( '<img src="%s" alt="" />', esc_url( $value ) );
|
||||
} else {
|
||||
echo $format_meta['image'];
|
||||
echo $value;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -43,7 +45,7 @@ $format_meta = get_post_format_meta( $post_ID );
|
|||
else
|
||||
_e( 'Image URL' );
|
||||
?></label>
|
||||
<textarea id="wp_format_image" type="text" name="_wp_format_image" class="widefat"><?php esc_html_e( $format_meta['image'] ); ?></textarea>
|
||||
<textarea id="wp_format_image" type="text" name="_format_image" class="widefat"><?php esc_html_e( $format_meta['image'] ); ?></textarea>
|
||||
<div data-format="image" class="wp-format-media-holder hide-if-no-js">
|
||||
<a href="#" class="wp-format-media-select"
|
||||
data-choose="<?php esc_attr_e( 'Choose an Image' ); ?>"
|
||||
|
@ -53,27 +55,39 @@ $format_meta = get_post_format_meta( $post_ID );
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field wp-format-link wp-format-quote wp-format-image">
|
||||
<label for="wp_format_url"><?php _e( 'Link URL' ); ?></label>
|
||||
<input type="text" id="wp_format_url" name="_wp_format_url" value="<?php echo esc_url( $format_meta['url'] ); ?>" class="widefat" />
|
||||
<div class="field wp-format-link">
|
||||
<label for="wp_format_link_url"><?php _e( 'Link URL' ); ?></label>
|
||||
<input type="text" id="wp_format_link_url" name="_format_link_url" value="<?php echo esc_url( $format_meta['link_url'] ); ?>" class="widefat" />
|
||||
</div>
|
||||
|
||||
<div class="field wp-format-quote">
|
||||
<label for="wp_format_quote_source_url"><?php _e( 'Link URL' ); ?></label>
|
||||
<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" />
|
||||
</div>
|
||||
|
||||
<div class="field wp-format-image">
|
||||
<label for="wp_format_image_url"><?php _e( 'Link URL' ); ?></label>
|
||||
<input type="text" id="wp_format_image_url" name="_format_url" value="<?php echo esc_url( $format_meta['url'] ); ?>" class="widefat" />
|
||||
</div>
|
||||
|
||||
<div class="field wp-format-video">
|
||||
<?php if ( ! empty( $format_meta['video'] ) ): ?>
|
||||
<?php if ( ! empty( $format_meta['video_embed'] ) ):
|
||||
$value = $format_meta['video_embed'];
|
||||
?>
|
||||
<div id="video-preview" class="wp-format-media-preview">
|
||||
<?php
|
||||
if ( is_numeric( $format_meta['video'] ) ) {
|
||||
$url = wp_get_attachment_url( $format_meta['video'] );
|
||||
if ( is_numeric( $value ) ) {
|
||||
$url = wp_get_attachment_url( $value );
|
||||
echo do_shortcode( sprintf( '[video src="%s"]', $url ) );
|
||||
} elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $format_meta['video'] ) ) {
|
||||
echo do_shortcode( $format_meta['video'] );
|
||||
} elseif ( ! preg_match( '#<[^>]+>#', $format_meta['video'] ) ) {
|
||||
if ( strstr( $format_meta['video'], home_url() ) )
|
||||
echo do_shortcode( sprintf( '[video src="%s"]', $format_meta['video'] ) );
|
||||
} elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $value ) ) {
|
||||
echo do_shortcode( $value );
|
||||
} elseif ( ! preg_match( '#<[^>]+>#', $value ) ) {
|
||||
if ( strstr( $value, home_url() ) )
|
||||
echo do_shortcode( sprintf( '[video src="%s"]', $value ) );
|
||||
else
|
||||
echo $wp_embed->autoembed( $format_meta['video'] );
|
||||
echo $wp_embed->autoembed( $value );
|
||||
} else {
|
||||
echo $format_meta['video'];
|
||||
echo $value;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -84,7 +98,7 @@ $format_meta = get_post_format_meta( $post_ID );
|
|||
else
|
||||
_e( 'Video URL' );
|
||||
?></label>
|
||||
<textarea id="wp_format_video" type="text" name="_wp_format_video" class="widefat"><?php esc_html_e( $format_meta['video'] ); ?></textarea>
|
||||
<textarea id="wp_format_video" type="text" name="_format_video_embed" class="widefat"><?php esc_html_e( $format_meta['video_embed'] ); ?></textarea>
|
||||
<div data-format="video" class="wp-format-media-holder hide-if-no-js">
|
||||
<a href="#" class="wp-format-media-select"
|
||||
data-choose="<?php esc_attr_e( 'Choose a Video' ); ?>"
|
||||
|
@ -95,21 +109,23 @@ $format_meta = get_post_format_meta( $post_ID );
|
|||
</div>
|
||||
|
||||
<div class="field wp-format-audio">
|
||||
<?php if ( ! empty( $format_meta['audio'] ) ): ?>
|
||||
<?php if ( ! empty( $format_meta['audio_embed'] ) ):
|
||||
$value = $format_meta['audio_embed'];
|
||||
?>
|
||||
<div id="audio-preview" class="wp-format-media-preview">
|
||||
<?php
|
||||
if ( is_numeric( $format_meta['audio'] ) ) {
|
||||
$url = wp_get_attachment_url( $format_meta['audio'] );
|
||||
if ( is_numeric( $value ) ) {
|
||||
$url = wp_get_attachment_url( $value );
|
||||
echo do_shortcode( sprintf( '[audio src="%s"]', $url ) );
|
||||
} elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $format_meta['audio'] ) ) {
|
||||
echo do_shortcode( $format_meta['audio'] );
|
||||
} elseif ( ! preg_match( '#<[^>]+>#', $format_meta['audio'] ) ) {
|
||||
if ( strstr( $format_meta['audio'], home_url() ) )
|
||||
echo do_shortcode( sprintf( '[audio src="%s"]', $format_meta['audio'] ) );
|
||||
} elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $value ) ) {
|
||||
echo do_shortcode( $value );
|
||||
} elseif ( ! preg_match( '#<[^>]+>#', $value ) ) {
|
||||
if ( strstr( $value, home_url() ) )
|
||||
echo do_shortcode( sprintf( '[audio src="%s"]', $value ) );
|
||||
else
|
||||
echo $wp_embed->autoembed( $format_meta['audio'] );
|
||||
echo $wp_embed->autoembed( $value );
|
||||
} else {
|
||||
echo $format_meta['audio'];
|
||||
echo $value;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -120,7 +136,7 @@ $format_meta = get_post_format_meta( $post_ID );
|
|||
else
|
||||
_e( 'Audio URL' );
|
||||
?></label>
|
||||
<textarea id="wp_format_audio" name="_wp_format_audio" class="widefat"><?php esc_html_e( $format_meta['audio'] ); ?></textarea>
|
||||
<textarea id="wp_format_audio" name="_format_audio_embed" class="widefat"><?php esc_html_e( $format_meta['audio_embed'] ); ?></textarea>
|
||||
<div data-format="audio" class="wp-format-media-holder hide-if-no-js">
|
||||
<a href="#" class="wp-format-media-select" data-choose="<?php esc_attr_e( 'Choose Audio' ); ?>" data-update="<?php esc_attr_e( 'Select Audio' ); ?>">
|
||||
<?php _e( 'Select Audio From Media Library' ) ?>
|
||||
|
|
|
@ -192,22 +192,25 @@ function edit_post( $post_data = null ) {
|
|||
}
|
||||
|
||||
// Post Formats
|
||||
if ( isset( $post_data['post_format'] ) ) {
|
||||
if ( isset( $post_data['post_format'] ) )
|
||||
set_post_format( $post_ID, $post_data['post_format'] );
|
||||
|
||||
$format_meta_urls = array( 'url', 'link_url', 'quote_source_url' );
|
||||
foreach ( $format_meta_urls as $format_meta_url ) {
|
||||
$keyed = '_format_' . $format_meta_url;
|
||||
if ( isset( $post_data[ $keyed ] ) )
|
||||
update_post_meta( $post_ID, $keyed, wp_slash( esc_url_raw( wp_unslash( $post_data[ $keyed ] ) ) ) );
|
||||
}
|
||||
|
||||
if ( isset( $post_data[ '_wp_format_url' ] ) ) {
|
||||
update_post_meta( $post_ID, '_wp_format_url', wp_slash( esc_url_raw( wp_unslash( $post_data['_wp_format_url'] ) ) ) );
|
||||
}
|
||||
|
||||
$format_keys = array( 'quote', 'quote_source', 'image', 'gallery', 'audio', 'video' );
|
||||
$format_keys = array( 'quote', 'quote_source_name', 'image', 'gallery', 'audio_embed', 'video_embed' );
|
||||
|
||||
foreach ( $format_keys as $key ) {
|
||||
if ( isset( $post_data[ '_wp_format_' . $key ] ) ) {
|
||||
$keyed = '_format_' . $key;
|
||||
if ( isset( $post_data[ $keyed ] ) ) {
|
||||
if ( current_user_can( 'unfiltered_html' ) )
|
||||
update_post_meta( $post_ID, '_wp_format_' . $key, $post_data[ '_wp_format_' . $key ] );
|
||||
update_post_meta( $post_ID, $keyed, $post_data[ $keyed ] );
|
||||
else
|
||||
update_post_meta( $post_ID, '_wp_format_' . $key, wp_filter_post_kses( $post_data[ '_wp_format_' . $key ] ) );
|
||||
update_post_meta( $post_ID, $keyed, wp_filter_post_kses( $post_data[ $keyed ] ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
window.wp = window.wp || {};
|
||||
|
||||
(function($) {
|
||||
var container, mediaFrame, lastMimeType, lastMenu, mediaPreview,
|
||||
noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery'],
|
||||
$container = $( '.post-formats-fields' );
|
||||
var container, mediaFrame, lastMimeType, mediaPreview,
|
||||
noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery'],
|
||||
$container = $( '.post-formats-fields' );
|
||||
|
||||
function switchFormatClass( format ) {
|
||||
container.get(0).className = container.get(0).className.replace( /\bwp-format-[^ ]+/g, '' );
|
||||
|
@ -76,9 +76,9 @@ window.wp = window.wp || {};
|
|||
// Media selection
|
||||
$('.wp-format-media-select').click(function(event) {
|
||||
event.preventDefault();
|
||||
var $el = $(this), mime,
|
||||
$holder = $el.closest('.wp-format-media-holder'),
|
||||
$field = $( '#wp_format_' + $holder.data('format') );
|
||||
var $el = $(this), mime = 'image',
|
||||
$holder = $el.closest('.wp-format-media-holder'),
|
||||
$field = $( '#wp_format_' + $holder.data('format') );
|
||||
|
||||
mime = $holder.data('format');
|
||||
|
||||
|
|
|
@ -367,7 +367,7 @@ wp.autosave.getPostData = function() {
|
|||
post_format = $('#post_format').val() || '';
|
||||
data['post_format'] = post_format == 'standard' ? '' : post_format;
|
||||
|
||||
$('.post-formats-fields').find('input[name^="_wp_format_"], textarea[name^="_wp_format_"]').each( function(i, field) {
|
||||
$('.post-formats-fields').find('input[name^="_format_"], textarea[name^="_format_"]').each( function(i, field) {
|
||||
data[ field.name ] = field.value || '';
|
||||
});
|
||||
|
||||
|
|
|
@ -2074,21 +2074,22 @@ function get_the_post_format_media( $type, &$post = null, $limit = 0 ) {
|
|||
|
||||
if ( has_post_format( $type, $post ) ) {
|
||||
$meta = get_post_format_meta( $post->ID );
|
||||
if ( ! empty( $meta[$type] ) ) {
|
||||
if ( is_integer( $meta[$type] ) ) {
|
||||
$url = wp_get_attachment_url( $meta[$type] );
|
||||
if ( ! empty( $meta[$type . '_embed'] ) ) {
|
||||
$value = $meta[$type . '_embed'];
|
||||
if ( is_integer( $value ) ) {
|
||||
$url = wp_get_attachment_url( $value );
|
||||
$shortcode = sprintf( '[%s src="%s"]', $type, $url );
|
||||
} elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $meta[$type] ) ) {
|
||||
$shortcode = $meta[$type];
|
||||
} elseif ( preg_match( '#<[^>]+>#', $meta[$type] ) ) {
|
||||
$post->format_content = $meta[$type];
|
||||
} elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $value ) ) {
|
||||
$shortcode = $value;
|
||||
} elseif ( preg_match( '#<[^>]+>#', $value ) ) {
|
||||
$post->format_content = $value;
|
||||
return $post->format_content;
|
||||
} elseif ( 0 === strpos( $meta[$type], 'http' ) ) {
|
||||
$post->split_content = str_replace( $meta[$type], '', $post->post_content, $count );
|
||||
if ( strstr( $meta[$type], home_url() ) ) {
|
||||
$shortcode = sprintf( '[%s src="%s"]', $type, $meta[$type] );
|
||||
} elseif ( 0 === strpos( $value, 'http' ) ) {
|
||||
$post->split_content = str_replace( $value, '', $post->post_content, $count );
|
||||
if ( strstr( $value, home_url() ) ) {
|
||||
$shortcode = sprintf( '[%s src="%s"]', $type, $value );
|
||||
} else {
|
||||
$post->format_content = $wp_embed->autoembed( $meta[$type] );
|
||||
$post->format_content = $wp_embed->autoembed( $value );
|
||||
return $post->format_content;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,18 +81,44 @@ function set_post_format( $post, $format ) {
|
|||
* @return array The array of post format metadata.
|
||||
*/
|
||||
function get_post_format_meta( $post_id = 0 ) {
|
||||
$values = array(
|
||||
'quote' => '',
|
||||
'quote_source' => '',
|
||||
'url' => '',
|
||||
'image' => '',
|
||||
'gallery' => '',
|
||||
'audio' => '',
|
||||
'video' => '',
|
||||
$meta = get_post_meta( $post_id );
|
||||
$keys = array( 'quote', 'quote_source_name', 'quote_source_url', 'link_url', 'gallery', 'audio_embed', 'video_embed', 'url', 'image' );
|
||||
|
||||
if ( empty( $meta ) )
|
||||
return array_fill_keys( $keys, '' );
|
||||
|
||||
$upgrade = array(
|
||||
'_wp_format_quote_source' => 'quote_source_name',
|
||||
'_wp_format_audio' => 'audio_embed',
|
||||
'_wp_format_video' => 'video_embed'
|
||||
);
|
||||
|
||||
foreach ( $values as $key => $value )
|
||||
$values[$key] = get_post_meta( $post_id, '_wp_format_' . $key, true );
|
||||
$format = get_post_format( $post_id );
|
||||
if ( ! empty( $format ) ) {
|
||||
switch ( $format ) {
|
||||
case 'link':
|
||||
$upgrade['_wp_format_url'] = 'link_url';
|
||||
break;
|
||||
case 'quote':
|
||||
$upgrade['_wp_format_url'] = 'quote_source_url';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$upgrade_keys = array_keys( $upgrade );
|
||||
foreach ( $meta as $key => $values ) {
|
||||
if ( ! in_array( $key, $upgrade_keys ) )
|
||||
continue;
|
||||
update_post_meta( $post_id, '_format_' . $upgrade[$key], reset( $values ) );
|
||||
delete_post_meta( $post_id, $key );
|
||||
}
|
||||
|
||||
$values = array();
|
||||
|
||||
foreach ( $keys as $key ) {
|
||||
$value = get_post_meta( $post_id, '_format_' . $key, true );
|
||||
$values[$key] = empty( $value ) ? '' : $value;
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
@ -324,11 +350,11 @@ function post_formats_compat( $content, $id = 0 ) {
|
|||
$compat['tag'] = '';
|
||||
$compat['position'] = 'before';
|
||||
|
||||
if ( ! empty( $meta['url'] ) ) {
|
||||
$esc_url = preg_quote( $meta['url'], '#' );
|
||||
if ( ! empty( $meta['link_url'] ) ) {
|
||||
$esc_url = preg_quote( $meta['link_url'], '#' );
|
||||
// Make sure the same URL isn't in the post (modified/extended versions allowed)
|
||||
if ( ! preg_match( '#' . $esc_url . '[^/&\?]?#', $content ) ) {
|
||||
$url = $meta['url'];
|
||||
$url = $meta['link_url'];
|
||||
} else {
|
||||
$url = get_content_url( $content, true );
|
||||
}
|
||||
|
@ -344,7 +370,7 @@ function post_formats_compat( $content, $id = 0 ) {
|
|||
'<a %shref="%s">%s</a>',
|
||||
empty( $compat['link_class'] ) ? '' : sprintf( 'class="%s" ', esc_attr( $compat['link_class'] ) ),
|
||||
esc_url( $url ),
|
||||
empty( $post->post_title ) ? esc_url( $meta['url'] ) : apply_filters( 'the_title', $post->post_title, $post->ID )
|
||||
empty( $post->post_title ) ? esc_url( $meta['link_url'] ) : apply_filters( 'the_title', $post->post_title, $post->ID )
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
@ -375,8 +401,8 @@ function post_formats_compat( $content, $id = 0 ) {
|
|||
case 'quote':
|
||||
if ( ! empty( $meta['quote'] ) && ! stristr( $content, $meta['quote'] ) ) {
|
||||
$quote = sprintf( '<blockquote>%s</blockquote>', wpautop( $meta['quote'] ) );
|
||||
if ( ! empty( $meta['quote_source'] ) ) {
|
||||
$source = ( empty( $meta['url'] ) ) ? $meta['quote_source'] : sprintf( '<a href="%s">%s</a>', esc_url( $meta['url'] ), $meta['quote_source'] );
|
||||
if ( ! empty( $meta['quote_source_name'] ) ) {
|
||||
$source = ( empty( $meta['quote_source_url'] ) ) ? $meta['quote_source_name'] : sprintf( '<a href="%s">%s</a>', esc_url( $meta['quote_source_url'] ), $meta['quote_source_name'] );
|
||||
$quote .= sprintf( '<figcaption class="quote-caption">%s</figcaption>', $source );
|
||||
}
|
||||
$format_output .= sprintf( '<figure class="quote">%s</figure>', $quote );
|
||||
|
@ -385,17 +411,18 @@ function post_formats_compat( $content, $id = 0 ) {
|
|||
|
||||
case 'video':
|
||||
case 'audio':
|
||||
if ( ! has_shortcode( $post->post_content, $format ) && ! empty( $meta[$format] ) ) {
|
||||
if ( ! has_shortcode( $post->post_content, $format ) && ! empty( $meta[$format . '_embed'] ) ) {
|
||||
$value = $meta[$format . '_embed'];
|
||||
// the metadata is an attachment ID
|
||||
if ( is_numeric( $meta[$format] ) ) {
|
||||
$url = wp_get_attachment_url( $meta[$format] );
|
||||
if ( is_numeric( $value ) ) {
|
||||
$url = wp_get_attachment_url( $value );
|
||||
$format_output .= sprintf( '[%s src="%s"]', $format, $url );
|
||||
// the metadata is a shortcode or an embed code
|
||||
} elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $meta[$format] ) || preg_match( '#<[^>]+>#', $meta[$format] ) ) {
|
||||
$format_output .= $meta[$format];
|
||||
} elseif ( ! stristr( $content, $meta[$format] ) ) {
|
||||
} elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $value ) || preg_match( '#<[^>]+>#', $value ) ) {
|
||||
$format_output .= $value;
|
||||
} elseif ( ! stristr( $content, $value ) ) {
|
||||
// attempt to embed the URL
|
||||
$format_output .= sprintf( '[embed]%s[/embed]', $meta[$format] );
|
||||
$format_output .= sprintf( '[embed]%s[/embed]', $value );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -707,10 +734,28 @@ function get_the_post_format_url( $id = 0 ) {
|
|||
if ( empty( $post ) )
|
||||
return '';
|
||||
|
||||
if ( in_array( get_post_format( $post->ID ), array( 'image', 'link', 'quote' ) ) ) {
|
||||
$format = get_post_format( $post->ID );
|
||||
if ( in_array( $format, array( 'image', 'link', 'quote' ) ) ) {
|
||||
$meta = get_post_format_meta( $post->ID );
|
||||
if ( ! empty( $meta['url'] ) )
|
||||
return apply_filters( 'get_the_post_format_url', esc_url_raw( $meta['url'] ), $post );
|
||||
$meta_link = '';
|
||||
|
||||
switch ( $format ) {
|
||||
case 'link':
|
||||
if ( ! empty( $meta['link_url'] ) )
|
||||
$meta_link = $meta['link_url'];
|
||||
break;
|
||||
case 'image':
|
||||
if ( ! empty( $meta['url'] ) )
|
||||
$meta_link = $meta['url'];
|
||||
break;
|
||||
case 'quote':
|
||||
if ( ! empty( $meta['quote_source_url'] ) )
|
||||
$meta_link = $meta['quote_source_url'];
|
||||
break;
|
||||
}
|
||||
|
||||
if ( ! empty( $meta_link ) )
|
||||
return apply_filters( 'get_the_post_format_url', esc_url_raw( $meta_link ), $post );
|
||||
}
|
||||
|
||||
if ( ! empty( $post->post_content ) )
|
||||
|
|
|
@ -68,13 +68,15 @@ function _wp_post_revision_fields( $post = null, $autosave = false ) {
|
|||
*/
|
||||
function _wp_post_revision_meta_keys() {
|
||||
return array(
|
||||
'_wp_format_url',
|
||||
'_wp_format_quote',
|
||||
'_wp_format_quote_source',
|
||||
'_wp_format_image',
|
||||
'_wp_format_gallery',
|
||||
'_wp_format_audio',
|
||||
'_wp_format_video',
|
||||
'_format_url',
|
||||
'_format_link_url',
|
||||
'_format_quote_source_url',
|
||||
'_format_quote_source_name',
|
||||
'_format_quote',
|
||||
'_format_image',
|
||||
'_format_gallery',
|
||||
'_format_audio_embed',
|
||||
'_format_video_embed',
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue