Changeset 42343 for trunk/src/wp-includes/widgets/class-wp-widget-media.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/widgets/class-wp-widget-media.php
r41951 r42343 24 24 */ 25 25 public $l10n = array( 26 'add_to_widget' => '',27 'replace_media' => '',28 'edit_media' => '',29 'media_library_state_multi' => '',26 'add_to_widget' => '', 27 'replace_media' => '', 28 'edit_media' => '', 29 'media_library_state_multi' => '', 30 30 'media_library_state_single' => '', 31 'missing_attachment' => '',32 'no_media_selected' => '',33 'add_media' => '',31 'missing_attachment' => '', 32 'no_media_selected' => '', 33 'add_media' => '', 34 34 ); 35 35 … … 55 55 */ 56 56 public function __construct( $id_base, $name, $widget_options = array(), $control_options = array() ) { 57 $widget_opts = wp_parse_args( $widget_options, array( 58 'description' => __( 'A media item.' ), 59 'customize_selective_refresh' => true, 60 'mime_type' => '', 61 ) ); 57 $widget_opts = wp_parse_args( 58 $widget_options, array( 59 'description' => __( 'A media item.' ), 60 'customize_selective_refresh' => true, 61 'mime_type' => '', 62 ) 63 ); 62 64 63 65 $control_opts = wp_parse_args( $control_options, array() ); 64 66 65 67 $l10n_defaults = array( 66 'no_media_selected' => __( 'No media selected' ),67 'add_media' => _x( 'Add Media', 'label for button in the media widget' ),68 'replace_media' => _x( 'Replace Media', 'label for button in the media widget; should preferably not be longer than ~13 characters long' ),69 'edit_media' => _x( 'Edit Media', 'label for button in the media widget; should preferably not be longer than ~13 characters long' ),70 'add_to_widget' => __( 'Add to Widget' ),71 'missing_attachment' => sprintf(68 'no_media_selected' => __( 'No media selected' ), 69 'add_media' => _x( 'Add Media', 'label for button in the media widget' ), 70 'replace_media' => _x( 'Replace Media', 'label for button in the media widget; should preferably not be longer than ~13 characters long' ), 71 'edit_media' => _x( 'Edit Media', 'label for button in the media widget; should preferably not be longer than ~13 characters long' ), 72 'add_to_widget' => __( 'Add to Widget' ), 73 'missing_attachment' => sprintf( 72 74 /* translators: %s: URL to media library */ 73 75 __( 'We can’t find that file. Check your <a href="%s">media library</a> and make sure it wasn’t deleted.' ), … … 75 77 ), 76 78 /* translators: %d: widget count */ 77 'media_library_state_multi' => _n_noop( 'Media Widget (%d)', 'Media Widget (%d)' ),79 'media_library_state_multi' => _n_noop( 'Media Widget (%d)', 'Media Widget (%d)' ), 78 80 'media_library_state_single' => __( 'Media Widget' ), 79 'unsupported_file_type' => __( 'Looks like this isn’t the correct kind of file. Please link to an appropriate file instead.' ),81 'unsupported_file_type' => __( 'Looks like this isn’t the correct kind of file. Please link to an appropriate file instead.' ), 80 82 ); 81 83 $this->l10n = array_merge( $l10n_defaults, array_filter( $this->l10n ) ); … … 130 132 $schema = array( 131 133 'attachment_id' => array( 132 'type' => 'integer',133 'default' => 0,134 'minimum' => 0,134 'type' => 'integer', 135 'default' => 0, 136 'minimum' => 0, 135 137 'description' => __( 'Attachment post ID' ), 136 'media_prop' => 'id',138 'media_prop' => 'id', 137 139 ), 138 'url' => array(139 'type' => 'string',140 'default' => '',141 'format' => 'uri',140 'url' => array( 141 'type' => 'string', 142 'default' => '', 143 'format' => 'uri', 142 144 'description' => __( 'URL to the media file' ), 143 145 ), 144 'title' => array(145 'type' => 'string',146 'default' => '',147 'sanitize_callback' => 'sanitize_text_field',148 'description' => __( 'Title for the widget' ),146 'title' => array( 147 'type' => 'string', 148 'default' => '', 149 'sanitize_callback' => 'sanitize_text_field', 150 'description' => __( 'Title for the widget' ), 149 151 'should_preview_update' => false, 150 152 ), … … 323 325 final public function form( $instance ) { 324 326 $instance_schema = $this->get_instance_schema(); 325 $instance = wp_array_slice_assoc(327 $instance = wp_array_slice_assoc( 326 328 wp_parse_args( (array) $instance, wp_list_pluck( $instance_schema, 'default' ) ), 327 329 array_keys( $instance_schema )
Note: See TracChangeset
for help on using the changeset viewer.