Make WordPress Core

Changeset 36240

Timestamp:
01/09/2016 02:17:02 PM (9 years ago)
Author:
swissspidy
Message:

Media: Fix wp_audio_shortcode and wp_video_shortcode attributes handling.

Although documented, the class and style attributes were simply ignored.
Adds unit tests.

Fixes #35367.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r36121 r36240  
    21642164 *     @type string $loop     The 'loop' attribute for the `<audio>` element. Default empty.
    21652165 *     @type string $autoplay The 'autoplay' attribute for the `<audio>` element. Default empty.
    2166  *     @type string $preload  The 'preload' attribute for the `<audio>` element. Default empty.
     2166 *     @type string $preload  The 'preload' attribute for the `<audio>` element. Default .
    21672167 *     @type string $class    The 'class' attribute for the `<audio>` element. Default 'wp-audio-shortcode'.
    2168  *     @type string $style    The 'style' attribute for the `<audio>` element. Default 'width: 100%'.
     2168 *     @type string $style    The 'style' attribute for the `<audio>` element. Default 'width: 100%'.
    21692169 * }
    21702170 * @param string $content Shortcode content.
     
    22012201        'loop'     => '',
    22022202        'autoplay' => '',
    2203         'preload'  => 'none'
     2203        'preload'  => 'none',
     2204        'class'    => 'wp-audio-shortcode',
     2205        'style'    => 'width: 100%; visibility: hidden;'
    22042206    );
    22052207    foreach ( $default_types as $type ) {
     
    22632265     * @param string $class CSS class or list of space-separated classes.
    22642266     */
     2267
     2268
    22652269    $html_atts = array(
    2266         'class'    => apply_filters( 'wp_audio_shortcode_class', 'wp-audio-shortcode' ),
     2270        'class'    => ,
    22672271        'id'       => sprintf( 'audio-%d-%d', $post_id, $instance ),
    22682272        'loop'     => wp_validate_boolean( $atts['loop'] ),
    22692273        'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
    22702274        'preload'  => $atts['preload'],
    2271         'style'    => 'width: 100%; visibility: hidden;',
     2275        'style'    => ,
    22722276    );
    22732277
     
    24082412        'width'    => 640,
    24092413        'height'   => 360,
     2414
    24102415    );
    24112416
     
    24972502     * @param string $class CSS class or list of space-separated classes.
    24982503     */
     2504
     2505
    24992506    $html_atts = array(
    2500         'class'    => apply_filters( 'wp_video_shortcode_class', 'wp-video-shortcode' ),
     2507        'class'    => ,
    25012508        'id'       => sprintf( 'video-%d-%d', $post_id, $instance ),
    25022509        'width'    => absint( $atts['width'] ),
  • trunk/tests/phpunit/tests/media.php

    r36121 r36240  
    416416        $matches2 = get_media_embedded_in_content( $reversed, array( 'audio', 'video' ) );
    417417        $this->assertEquals( array( $video, $audio ), $matches2 );
     418
     419
     420
     421
     422
     423
     424
     425
     426
     427
     428
     429
     430
     431
     432
     433
     434
     435
     436
     437
     438
     439
     440
     441
     442
     443
     444
     445
     446
     447
     448
     449
     450
     451
     452
     453
     454
     455
     456
     457
     458
     459
     460
     461
     462
     463
     464
     465
     466
     467
     468
     469
     470
     471
     472
     473
     474
     475
     476
     477
     478
     479
     480
     481
     482
     483
     484
     485
     486
     487
     488
     489
     490
     491
     492
     493
     494
     495
     496
     497
     498
     499
     500
     501
     502
     503
     504
     505
     506
     507
     508
     509
     510
     511
     512
     513
     514
     515
     516
     517
     518
     519
     520
     521
     522
     523
     524
     525
     526
     527
    418528    }
    419529
Note: See TracChangeset for help on using the changeset viewer.