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

    r41951 r42343  
    2323     */
    2424    public function __construct() {
    25         parent::__construct( 'media_gallery', __( 'Gallery' ), array(
    26             'description' => __( 'Displays an image gallery.' ),
    27             'mime_type'   => 'image',
    28         ) );
    29 
    30         $this->l10n = array_merge( $this->l10n, array(
    31             'no_media_selected' => __( 'No images selected' ),
    32             'add_media' => _x( 'Add Images', 'label for button in the gallery widget; should not be longer than ~13 characters long' ),
    33             'replace_media' => '',
    34             'edit_media' => _x( 'Edit Gallery', 'label for button in the gallery widget; should not be longer than ~13 characters long' ),
    35         ) );
     25        parent::__construct(
     26            'media_gallery', __( 'Gallery' ), array(
     27                'description' => __( 'Displays an image gallery.' ),
     28                'mime_type'   => 'image',
     29            )
     30        );
     31
     32        $this->l10n = array_merge(
     33            $this->l10n, array(
     34                'no_media_selected' => __( 'No images selected' ),
     35                'add_media'         => _x( 'Add Images', 'label for button in the gallery widget; should not be longer than ~13 characters long' ),
     36                'replace_media'     => '',
     37                'edit_media'        => _x( 'Edit Gallery', 'label for button in the gallery widget; should not be longer than ~13 characters long' ),
     38            )
     39        );
    3640    }
    3741
     
    4852    public function get_instance_schema() {
    4953        $schema = array(
    50             'title' => array(
    51                 'type' => 'string',
    52                 'default' => '',
    53                 'sanitize_callback' => 'sanitize_text_field',
    54                 'description' => __( 'Title for the widget' ),
     54            'title'          => array(
     55                'type'                  => 'string',
     56                'default'               => '',
     57                'sanitize_callback'     => 'sanitize_text_field',
     58                'description'           => __( 'Title for the widget' ),
    5559                'should_preview_update' => false,
    5660            ),
    57             'ids' => array(
    58                 'type' => 'array',
    59                 'items' => array(
     61            'ids'            => array(
     62                'type'              => 'array',
     63                'items'             => array(
    6064                    'type' => 'integer',
    6165                ),
    62                 'default' => array(),
     66                'default'           => array(),
    6367                'sanitize_callback' => 'wp_parse_id_list',
    6468            ),
    65             'columns' => array(
    66                 'type' => 'integer',
     69            'columns'        => array(
     70                'type'    => 'integer',
    6771                'default' => 3,
    6872                'minimum' => 1,
    6973                'maximum' => 9,
    7074            ),
    71             'size' => array(
    72                 'type' => 'string',
    73                 'enum' => array_merge( get_intermediate_image_sizes(), array( 'full', 'custom' ) ),
     75            'size'           => array(
     76                'type'    => 'string',
     77                'enum'    => array_merge( get_intermediate_image_sizes(), array( 'full', 'custom' ) ),
    7478                'default' => 'thumbnail',
    7579            ),
    76             'link_type' => array(
    77                 'type' => 'string',
    78                 'enum' => array( 'post', 'file', 'none' ),
    79                 'default' => 'post',
    80                 'media_prop' => 'link',
     80            'link_type'      => array(
     81                'type'                  => 'string',
     82                'enum'                  => array( 'post', 'file', 'none' ),
     83                'default'               => 'post',
     84                'media_prop'            => 'link',
    8185                'should_preview_update' => false,
    8286            ),
Note: See TracChangeset for help on using the changeset viewer.