Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/widgets/class-wp-widget-media-video.php

    r41933 r42343  
    2323     */
    2424    public function __construct() {
    25         parent::__construct( 'media_video', __( 'Video' ), array(
    26             'description' => __( 'Displays a video from the media library or from YouTube, Vimeo, or another provider.' ),
    27             'mime_type'   => 'video',
    28         ) );
    29 
    30         $this->l10n = array_merge( $this->l10n, array(
    31             'no_media_selected' => __( 'No video selected' ),
    32             'add_media' => _x( 'Add Video', 'label for button in the video widget' ),
    33             'replace_media' => _x( 'Replace Video', 'label for button in the video widget; should preferably not be longer than ~13 characters long' ),
    34             'edit_media' => _x( 'Edit Video', 'label for button in the video widget; should preferably not be longer than ~13 characters long' ),
    35             'missing_attachment' => sprintf(
    36                 /* translators: %s: URL to media library */
    37                 __( 'We can&#8217;t find that video. Check your <a href="%s">media library</a> and make sure it wasn&#8217;t deleted.' ),
    38                 esc_url( admin_url( 'upload.php' ) )
    39             ),
    40             /* translators: %d: widget count */
    41             'media_library_state_multi' => _n_noop( 'Video Widget (%d)', 'Video Widget (%d)' ),
    42             'media_library_state_single' => __( 'Video Widget' ),
    43             /* translators: %s: a list of valid video file extensions */
    44             'unsupported_file_type' => sprintf( __( 'Sorry, we can&#8217;t load the video at the supplied URL. Please check that the URL is for a supported video file (%s) or stream (e.g. YouTube and Vimeo).' ), '<code>.' . implode( '</code>, <code>.', wp_get_video_extensions() ) . '</code>' ),
    45         ) );
     25        parent::__construct(
     26            'media_video', __( 'Video' ), array(
     27                'description' => __( 'Displays a video from the media library or from YouTube, Vimeo, or another provider.' ),
     28                'mime_type'   => 'video',
     29            )
     30        );
     31
     32        $this->l10n = array_merge(
     33            $this->l10n, array(
     34                'no_media_selected'          => __( 'No video selected' ),
     35                'add_media'                  => _x( 'Add Video', 'label for button in the video widget' ),
     36                'replace_media'              => _x( 'Replace Video', 'label for button in the video widget; should preferably not be longer than ~13 characters long' ),
     37                'edit_media'                 => _x( 'Edit Video', 'label for button in the video widget; should preferably not be longer than ~13 characters long' ),
     38                'missing_attachment'         => sprintf(
     39                    /* translators: %s: URL to media library */
     40                    __( 'We can&#8217;t find that video. Check your <a href="%s">media library</a> and make sure it wasn&#8217;t deleted.' ),
     41                    esc_url( admin_url( 'upload.php' ) )
     42                ),
     43                /* translators: %d: widget count */
     44                'media_library_state_multi'  => _n_noop( 'Video Widget (%d)', 'Video Widget (%d)' ),
     45                'media_library_state_single' => __( 'Video Widget' ),
     46                /* translators: %s: a list of valid video file extensions */
     47                'unsupported_file_type'      => sprintf( __( 'Sorry, we can&#8217;t load the video at the supplied URL. Please check that the URL is for a supported video file (%s) or stream (e.g. YouTube and Vimeo).' ), '<code>.' . implode( '</code>, <code>.', wp_get_video_extensions() ) . '</code>' ),
     48            )
     49        );
    4650    }
    4751
     
    6165            array(
    6266                'preload' => array(
    63                     'type' => 'string',
    64                     'enum' => array( 'none', 'auto', 'metadata' ),
    65                     'default' => 'metadata',
    66                     'description' => __( 'Preload' ),
     67                    'type'                  => 'string',
     68                    'enum'                  => array( 'none', 'auto', 'metadata' ),
     69                    'default'               => 'metadata',
     70                    'description'           => __( 'Preload' ),
    6771                    'should_preview_update' => false,
    6872                ),
    69                 'loop' => array(
    70                     'type' => 'boolean',
    71                     'default' => false,
    72                     'description' => __( 'Loop' ),
     73                'loop'    => array(
     74                    'type'                  => 'boolean',
     75                    'default'               => false,
     76                    'description'           => __( 'Loop' ),
    7377                    'should_preview_update' => false,
    7478                ),
    7579                'content' => array(
    76                     'type' => 'string',
    77                     'default' => '',
    78                     'sanitize_callback' => 'wp_kses_post',
    79                     'description' => __( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ),
     80                    'type'                  => 'string',
     81                    'default'               => '',
     82                    'sanitize_callback'     => 'wp_kses_post',
     83                    'description'           => __( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ),
    8084                    'should_preview_update' => false,
    8185                ),
     
    8589        foreach ( wp_get_video_extensions() as $video_extension ) {
    8690            $schema[ $video_extension ] = array(
    87                 'type' => 'string',
    88                 'default' => '',
    89                 'format' => 'uri',
     91                'type'        => 'string',
     92                'default'     => '',
     93                'format'      => 'uri',
    9094                /* translators: %s: video extension */
    9195                'description' => sprintf( __( 'URL to the %s video source file' ), $video_extension ),
     
    106110     */
    107111    public function render_media( $instance ) {
    108         $instance = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' ), $instance );
     112        $instance   = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' ), $instance );
    109113        $attachment = null;
    110114
     
    244248                </a>
    245249            <# } else if ( data.model.src ) { #>
    246                 <?php wp_underscore_video_template() ?>
     250                <?php wp_underscore_video_template(); ?>
    247251            <# } #>
    248252        </script>
Note: See TracChangeset for help on using the changeset viewer.