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-audio.php

    r41640 r42343  
    2323     */
    2424    public function __construct() {
    25         parent::__construct( 'media_audio', __( 'Audio' ), array(
    26             'description' => __( 'Displays an audio player.' ),
    27             'mime_type'   => 'audio',
    28         ) );
    29 
    30         $this->l10n = array_merge( $this->l10n, array(
    31             'no_media_selected' => __( 'No audio selected' ),
    32             'add_media' => _x( 'Add Audio', 'label for button in the audio widget' ),
    33             'replace_media' => _x( 'Replace Audio', 'label for button in the audio widget; should preferably not be longer than ~13 characters long' ),
    34             'edit_media' => _x( 'Edit Audio', 'label for button in the audio 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 audio file. 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( 'Audio Widget (%d)', 'Audio Widget (%d)' ),
    42             'media_library_state_single' => __( 'Audio Widget' ),
    43             'unsupported_file_type' => __( 'Looks like this isn&#8217;t the correct kind of file. Please link to an audio file instead.' ),
    44         ) );
     25        parent::__construct(
     26            'media_audio', __( 'Audio' ), array(
     27                'description' => __( 'Displays an audio player.' ),
     28                'mime_type'   => 'audio',
     29            )
     30        );
     31
     32        $this->l10n = array_merge(
     33            $this->l10n, array(
     34                'no_media_selected'          => __( 'No audio selected' ),
     35                'add_media'                  => _x( 'Add Audio', 'label for button in the audio widget' ),
     36                'replace_media'              => _x( 'Replace Audio', 'label for button in the audio widget; should preferably not be longer than ~13 characters long' ),
     37                'edit_media'                 => _x( 'Edit Audio', 'label for button in the audio 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 audio file. 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( 'Audio Widget (%d)', 'Audio Widget (%d)' ),
     45                'media_library_state_single' => __( 'Audio Widget' ),
     46                'unsupported_file_type'      => __( 'Looks like this isn&#8217;t the correct kind of file. Please link to an audio file instead.' ),
     47            )
     48        );
    4549    }
    4650
     
    6064            array(
    6165                'preload' => array(
    62                     'type' => 'string',
    63                     'enum' => array( 'none', 'auto', 'metadata' ),
    64                     'default' => 'none',
     66                    'type'        => 'string',
     67                    'enum'        => array( 'none', 'auto', 'metadata' ),
     68                    'default'     => 'none',
    6569                    'description' => __( 'Preload' ),
    6670                ),
    67                 'loop' => array(
    68                     'type' => 'boolean',
    69                     'default' => false,
     71                'loop'    => array(
     72                    'type'        => 'boolean',
     73                    'default'     => false,
    7074                    'description' => __( 'Loop' ),
    7175                ),
     
    7579        foreach ( wp_get_audio_extensions() as $audio_extension ) {
    7680            $schema[ $audio_extension ] = array(
    77                 'type' => 'string',
    78                 'default' => '',
    79                 'format' => 'uri',
     81                'type'        => 'string',
     82                'default'     => '',
     83                'format'      => 'uri',
    8084                /* translators: %s: audio extension */
    8185                'description' => sprintf( __( 'URL to the %s audio source file' ), $audio_extension ),
     
    9599     */
    96100    public function render_media( $instance ) {
    97         $instance = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' ), $instance );
     101        $instance   = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' ), $instance );
    98102        $attachment = null;
    99103
     
    193197                </div>
    194198            <# } else if ( data.model && data.model.src ) { #>
    195                 <?php wp_underscore_audio_template() ?>
     199                <?php wp_underscore_audio_template(); ?>
    196200            <# } #>
    197201        </script>
Note: See TracChangeset for help on using the changeset viewer.