Make WordPress Core

Ticket #24126: 24126.3.diff

File 24126.3.diff, 5.2 KB (added by wonderboymusic, 13 years ago)
  • wp-admin/js/post-formats.js

    diff --git wp-admin/js/post-formats.js wp-admin/js/post-formats.js
    index 33f2e96..10f0f1d 100644
    window.wp = window.wp || {}; 
    8080        }
    8181
    8282        $(function(){
    83 
    8483                $('.post-format-change a').click(function() {
    8584                        $('.post-formats-fields, .post-format-change').slideUp();
    8685                        $('.post-format-options').slideDown();
  • wp-content/themes/twentythirteen/content-gallery.php

    diff --git wp-content/themes/twentythirteen/content-gallery.php wp-content/themes/twentythirteen/content-gallery.php
    index 6ee2b3d..e357980 100644
     
    2424                        <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentythirteen' ) ); ?>
    2525                        <?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
    2626                <?php else : ?>
    27                         <?php the_content(); ?>
     27                        <?php the_post_format_gallery(); ?>
    2828                <?php endif; // is_single() ?>
    2929        </div><!-- .entry-content -->
    3030
  • wp-includes/media.php

    diff --git wp-includes/media.php wp-includes/media.php
    index 09e0630..9528874 100644
    function get_content_image( &$content, $html = true, $remove = false ) { 
    22932293 * @since 3.6.0
    22942294 *
    22952295 * @param string $content A string which might contain image data.
     2296 * @param boolean $html Whether to return HTML or data
    22962297 * @param boolean $remove Optional. Whether to remove the found data from the passed content.
    22972298 * @param int $limit Optional. The number of galleries to return
    22982299 * @return array A list of galleries, which in turn are a list of their srcs in order
    22992300 */
    2300 function get_content_galleries( &$content, $remove = false, $limit = 0 ) {
     2301function get_content_galleries( &$content, $html = true, $remove = false, $limit = 0 ) {
    23012302        $src = '';
    23022303        $galleries = array();
    23032304        $matches = array();
    function get_content_galleries( &$content, $remove = false, $limit = 0 ) { 
    23122313
    23132314                                $data = shortcode_parse_atts( $shortcode[3] );
    23142315                                $gallery = do_shortcode_tag( $shortcode );
    2315                                 preg_match_all( '#src=[\'"](.+?)[\'"]#is', $gallery, $src, PREG_SET_ORDER );
    2316                                 if ( ! empty( $src ) ) {
    2317                                         foreach ( $src as $s )
    2318                                                 $srcs[] = $s[1];
     2316                                if ( $html ) {
     2317                                        $galleries[] = $gallery;
     2318                                } else {
     2319                                        preg_match_all( '#src=[\'"](.+?)[\'"]#is', $gallery, $src, PREG_SET_ORDER );
     2320                                        if ( ! empty( $src ) ) {
     2321                                                foreach ( $src as $s )
     2322                                                        $srcs[] = $s[1];
     2323                                        }
     2324
     2325                                        $data['src'] = array_values( array_unique( $srcs ) );
     2326                                        $galleries[] = $data;
    23192327                                }
    23202328
    2321                                 $data['src'] = array_values( array_unique( $srcs ) );
    2322                                 $galleries[] = $data;
    23232329                                if ( $limit > 0 && count( $galleries ) >= $limit )
    23242330                                        break;
    23252331                        }
    function get_content_galleries( &$content, $remove = false, $limit = 0 ) { 
    23352341 * @since 3.6.0
    23362342 *
    23372343 * @param int $post_id Optional. Post ID.
     2344 * @param boolean $html Whether to return HTML or data
    23382345 * @return array A list of arrays, each containing gallery data and srcs parsed
    23392346 *              from the expanded shortcode
    23402347 */
    2341 function get_post_galleries( $post_id = 0 ) {
     2348function get_post_galleries( $post_id = 0, $html = true ) {
    23422349        $post = empty( $post_id ) ? clone get_post() : get_post( $post_id );
    23432350        if ( empty( $post ) || ! has_shortcode( $post->post_content, 'gallery' )  )
    23442351                return array();
    23452352
    2346         return get_content_galleries( $post->post_content );
     2353        return get_content_galleries( $post->post_content, $html );
    23472354}
    23482355
    23492356/**
    function get_post_galleries_images( $post_id = 0 ) { 
    23602367        if ( empty( $post ) || ! has_shortcode( $post->post_content, 'gallery' )  )
    23612368                return array();
    23622369
    2363         $data = get_content_galleries( $post->post_content );
     2370        $data = get_content_galleries( $post->post_content, false );
    23642371        return wp_list_pluck( $data, 'src' );
    23652372}
    23662373
    function get_post_galleries_images( $post_id = 0 ) { 
    23702377 * @since 3.6.0
    23712378 *
    23722379 * @param int $post_id Optional. Post ID.
     2380 * @param boolean $html Whether to return HTML or data
    23732381 * @return array Gallery data and srcs parsed from the expanded shortcode
    23742382 */
    2375 function get_post_gallery( $post_id = 0 ) {
     2383function get_post_gallery( $post_id = 0, $html = true ) {
    23762384        $post = empty( $post_id ) ? clone get_post() : get_post( $post_id );
    23772385        if ( empty( $post ) || ! has_shortcode( $post->post_content, 'gallery' ) )
    23782386                return array();
    23792387
    2380         $data = get_content_galleries( $post->post_content, false, 1 );
     2388        $data = get_content_galleries( $post->post_content, $html, false, 1 );
    23812389        return reset( $data );
    23822390}
    23832391
    23842392/**
     2393 * Output the first gallery in the current (@global) $post
     2394 *
     2395 * @since 3.6.0
     2396 */
     2397function the_post_format_gallery() {
     2398        echo get_post_gallery();
     2399}
     2400
     2401/**
    23852402 * Check a post's content for galleries and return the image srcs for the first found gallery
    23862403 *
    23872404 * @since 3.6.0
    function get_post_gallery( $post_id = 0 ) { 
    23902407 * @return array A list of a gallery's image srcs in order
    23912408 */
    23922409function get_post_gallery_images( $post_id = 0 ) {
    2393         $gallery = get_post_gallery( $post_id );
     2410        $gallery = get_post_gallery( $post_id, false );
    23942411        if ( empty( $gallery['src'] ) )
    23952412                return array();
    23962413