diff --git wp-admin/includes/post-formats.php wp-admin/includes/post-formats.php
index 0364f5d..9524a75 100644
|
|
$format_meta = get_post_format_meta( $post_ID ); |
76 | 76 | _e( 'Video URL' ); |
77 | 77 | ?></label> |
78 | 78 | <textarea id="wp_format_video" type="text" name="_wp_format_video" class="widefat"><?php esc_html_e( $format_meta['video'] ); ?></textarea> |
79 | | <div data-format="video" class="wp-format-media-holder hide-if-no-js<?php if ( ! $image ) echo ' empty'; ?>"> |
| 79 | <div data-format="video" class="wp-format-media-holder hide-if-no-js<?php if ( ! $show_video_preview ) echo ' empty'; ?>"> |
80 | 80 | <a href="#" class="wp-format-media-select" |
81 | 81 | data-choose="<?php esc_attr_e( 'Choose a Video' ); ?>" |
82 | 82 | data-update="<?php esc_attr_e( 'Select Video' ); ?>"> |
… |
… |
$format_meta = get_post_format_meta( $post_ID ); |
114 | 114 | else |
115 | 115 | _e( 'Audio URL' ); |
116 | 116 | ?></label> |
117 | | <textarea id="wp_format_audio" name="_wp_format_audio" class="widefat"><?php esc_html_e( $format_meta['audio'] ); |
118 | | ?></textarea> |
119 | | <div data-format="audio" class="wp-format-media-holder hide-if-no-js<?php if ( empty( $format_meta['audio'] ) ) echo ' empty'; ?>"> |
| 117 | <textarea id="wp_format_audio" name="_wp_format_audio" class="widefat"><?php esc_html_e( $format_meta['audio'] ); ?></textarea> |
| 118 | <div data-format="audio" class="wp-format-media-holder hide-if-no-js<?php if ( ! $show_audio_preview ) echo ' empty'; ?>"> |
120 | 119 | <a href="#" class="wp-format-media-select" data-choose="<?php esc_attr_e( 'Choose Audio' ); ?>" data-update="<?php esc_attr_e( 'Select Audio' ); ?>"> |
121 | 120 | <?php _e( 'Select Audio From Media Library' ) ?> |
122 | 121 | </a> |
diff --git wp-admin/js/post-formats.js wp-admin/js/post-formats.js
index 62c75f6..589bfba 100644
|
|
window.wp = window.wp || {}; |
19 | 19 | format = $this.data('wp-format'), |
20 | 20 | description = $('.post-format-description'); |
21 | 21 | |
22 | | if ( typeof container === 'undefined' ) |
23 | | container = $('#post-body-content'); |
| 22 | if ( typeof container === 'undefined' ) |
| 23 | container = $('#post-body-content'); |
24 | 24 | |
25 | 25 | // Already on this post format. Bail. |
26 | 26 | if ( format === postFormats.currentPostFormat ) |
… |
… |
window.wp = window.wp || {}; |
68 | 68 | // Media selection |
69 | 69 | $('.wp-format-media-select').click(function (event) { |
70 | 70 | event.preventDefault(); |
71 | | var $el = $(this), $holder, $field, mime = 'image', menu = '', |
| 71 | var $el = $(this), $holder, $field, mime = 'image', |
72 | 72 | $holder = $el.closest('.wp-format-media-holder'), |
73 | 73 | $field = $( '#wp_format_' + $holder.data('format') ); |
74 | 74 | |
… |
… |
window.wp = window.wp || {}; |
82 | 82 | } |
83 | 83 | |
84 | 84 | // If the media frame already exists, reopen it. |
85 | | if ( mediaFrame && lastMimeType === mime && lastMenu === menu ) { |
| 85 | if ( mediaFrame && lastMimeType === mime ) { |
86 | 86 | mediaFrame.open(); |
87 | 87 | return; |
88 | 88 | } |
89 | 89 | |
90 | 90 | lastMimeType = mime; |
91 | | lastMenu = menu; |
92 | 91 | |
93 | 92 | // Create the media frame. |
94 | 93 | mediaFrame = wp.media.frames.formatMedia = wp.media({ |
95 | 94 | // Set the title of the modal. |
96 | 95 | title: $el.data('choose'), |
97 | 96 | |
98 | | // Set the menu sidebar of the modal, if applicable |
99 | | toolbar: menu, |
100 | | |
101 | 97 | // Tell the modal to show only items matching the current mime type. |
102 | 98 | library: { |
103 | 99 | type: mime |
diff --git wp-includes/functions.php wp-includes/functions.php
index 0afa50b..8d3653e 100644
|
|
function wp_auth_check( $response, $data ) { |
3985 | 3985 | function get_tag_regex( $tag ) { |
3986 | 3986 | if ( empty( $tag ) ) |
3987 | 3987 | return; |
3988 | | |
3989 | | return sprintf( '(<%1$s[^>]*(?:/?>$|>[\s\S]*?</%1$s>))', tag_escape( $tag ) ); |
| 3988 | return sprintf( '(<%1$s[^>]*(?:/?>\s*$|>[\s\S]*?</%1$s>))', tag_escape( $tag ) ); |
3990 | 3989 | } |
diff --git wp-includes/media.php wp-includes/media.php
index 25fa507..c3cd50d 100644
|
|
function get_the_post_format_image( $attached_size = 'full', &$post = null ) { |
2399 | 2399 | if ( isset( $post->format_content ) ) |
2400 | 2400 | return $post->format_content; |
2401 | 2401 | |
| 2402 | $matched = false; |
2402 | 2403 | $meta = get_post_format_meta( $post->ID ); |
2403 | 2404 | |
2404 | 2405 | $link_fmt = '%s'; |
… |
… |
function get_the_post_format_image( $attached_size = 'full', &$post = null ) { |
2415 | 2416 | $media = reset( $medias ); |
2416 | 2417 | $sizes = get_intermediate_image_sizes(); |
2417 | 2418 | |
2418 | | $urls = array(); |
| 2419 | $urls = array( get_attachment_link( $media->ID ) ); |
2419 | 2420 | foreach ( $sizes as $size ) { |
2420 | 2421 | $image = wp_get_attachment_image_src( $media->ID, $size ); |
2421 | | if ( $image ) { |
| 2422 | if ( $image ) |
2422 | 2423 | $urls[] = reset( $image ); |
2423 | | $urls[] = get_attachment_link( $media->ID ); |
2424 | | } |
2425 | 2424 | } |
2426 | 2425 | |
2427 | 2426 | $count = 1; |
… |
… |
function get_the_post_format_image( $attached_size = 'full', &$post = null ) { |
2432 | 2431 | foreach ( $matches as $shortcode ) { |
2433 | 2432 | if ( 'caption' === $shortcode[2] ) { |
2434 | 2433 | foreach ( $urls as $url ) { |
2435 | | if ( strstr( $shortcode[0], $url ) ) |
| 2434 | if ( strstr( $shortcode[0], $url ) ) { |
| 2435 | if ( ! $matched ) |
| 2436 | $matched = do_shortcode( $shortcode[0] ); |
2436 | 2437 | $content = str_replace( $shortcode[0], '', $content, $count ); |
| 2438 | } |
2437 | 2439 | } |
2438 | 2440 | } |
2439 | 2441 | } |
… |
… |
function get_the_post_format_image( $attached_size = 'full', &$post = null ) { |
2443 | 2445 | if ( preg_match_all( '#' . get_tag_regex( $tag ) . '#', $content, $matches, PREG_SET_ORDER ) && ! empty( $matches ) ) { |
2444 | 2446 | foreach ( $matches as $match ) { |
2445 | 2447 | foreach ( $urls as $url ) { |
2446 | | if ( strstr( $match[0], $url ) ) |
| 2448 | if ( strstr( $match[0], $url ) ) { |
| 2449 | if ( ! $matched ) |
| 2450 | $matched = $match[0]; |
2447 | 2451 | $content = str_replace( $match[0], '', $content, $count ); |
| 2452 | } |
2448 | 2453 | } |
2449 | 2454 | } |
2450 | 2455 | } |
2451 | 2456 | } |
2452 | 2457 | |
2453 | 2458 | $post->split_content = $content; |
2454 | | $image = wp_get_attachment_image( $media->ID, $attached_size ); |
2455 | | $post->format_content = sprintf( $link_fmt, $image ); |
| 2459 | if ( ! $matched ) { |
| 2460 | $image = wp_get_attachment_image( $media->ID, $attached_size ); |
| 2461 | $post->format_content = sprintf( $link_fmt, $image ); |
| 2462 | } else { |
| 2463 | $post->format_content = $matched; |
| 2464 | if ( ! empty( $meta['url'] ) && false === stripos( $matched, '<a ' ) ) |
| 2465 | $post->format_content = sprintf( $link_fmt, $matched ); |
| 2466 | } |
2456 | 2467 | return $post->format_content; |
2457 | 2468 | } |
2458 | 2469 | |