diff --git wp-admin/js/post-formats.js wp-admin/js/post-formats.js
index 4456c85..73af601 100644
|
|
window.wp = window.wp || {}; |
17 | 17 | description = $('.post-format-description'), |
18 | 18 | postTitle = $('#title'); |
19 | 19 | |
20 | | if ( typeof container === 'undefined' ) |
21 | | container = $('#post-body-content'); |
| 20 | if ( typeof container === 'undefined' ) |
| 21 | container = $('#post-body-content'); |
22 | 22 | |
23 | 23 | parent.slideUp().find('a.active').removeClass('active'); |
24 | 24 | $this.addClass('active'); |
… |
… |
window.wp = window.wp || {}; |
77 | 77 | // Media selection |
78 | 78 | $('.wp-format-media-select').click(function (event) { |
79 | 79 | event.preventDefault(); |
80 | | var $el = $(this), mime, |
| 80 | var $el = $(this), mime = 'image', |
81 | 81 | $holder = $el.closest('.wp-format-media-holder'), |
82 | 82 | $field = $( '#wp_format_' + $holder.data('format') ); |
83 | 83 | |
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 6ef945b..04e5f56 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 ) { |
2425 | 2426 | $sizes = get_intermediate_image_sizes(); |
2426 | 2427 | $sizes[] = 'full'; // Add original image source. |
2427 | 2428 | |
2428 | | $urls = array(); |
| 2429 | $urls = array( get_attachment_link( $media->ID ) ); |
2429 | 2430 | foreach ( $sizes as $size ) { |
2430 | 2431 | $image = wp_get_attachment_image_src( $media->ID, $size ); |
2431 | 2432 | if ( $image ) |
… |
… |
function get_the_post_format_image( $attached_size = 'full', &$post = null ) { |
2443 | 2444 | foreach ( $matches as $shortcode ) { |
2444 | 2445 | if ( 'caption' === $shortcode[2] ) { |
2445 | 2446 | foreach ( $urls as $url ) { |
2446 | | if ( strstr( $shortcode[0], $url ) ) |
| 2447 | if ( strstr( $shortcode[0], $url ) ) { |
| 2448 | if ( ! $matched ) |
| 2449 | $matched = do_shortcode( $shortcode[0] ); |
2447 | 2450 | $content = str_replace( $shortcode[0], '', $content, $count ); |
| 2451 | } |
2448 | 2452 | } |
2449 | 2453 | } |
2450 | 2454 | } |
… |
… |
function get_the_post_format_image( $attached_size = 'full', &$post = null ) { |
2454 | 2458 | if ( preg_match_all( '#' . get_tag_regex( $tag ) . '#', $content, $matches, PREG_SET_ORDER ) && ! empty( $matches ) ) { |
2455 | 2459 | foreach ( $matches as $match ) { |
2456 | 2460 | foreach ( $urls as $url ) { |
2457 | | if ( strstr( $match[0], $url ) ) |
| 2461 | if ( strstr( $match[0], $url ) ) { |
| 2462 | if ( ! $matched ) |
| 2463 | $matched = $match[0]; |
2458 | 2464 | $content = str_replace( $match[0], '', $content, $count ); |
| 2465 | } |
2459 | 2466 | } |
2460 | 2467 | } |
2461 | 2468 | } |
2462 | 2469 | } |
2463 | 2470 | |
2464 | 2471 | $post->split_content = $content; |
2465 | | $image = wp_get_attachment_image( $media->ID, $attached_size ); |
2466 | | $post->format_content = sprintf( $link_fmt, $image ); |
| 2472 | if ( ! $matched ) { |
| 2473 | $image = wp_get_attachment_image( $media->ID, $attached_size ); |
| 2474 | $post->format_content = sprintf( $link_fmt, $image ); |
| 2475 | } else { |
| 2476 | $post->format_content = $matched; |
| 2477 | if ( ! empty( $meta['url'] ) && false === stripos( $matched, '<a ' ) ) |
| 2478 | $post->format_content = sprintf( $link_fmt, $matched ); |
| 2479 | } |
2467 | 2480 | return $post->format_content; |
2468 | 2481 | } |
2469 | 2482 | |