Update WordPress to 5.2
This commit is contained in:
parent
489b5a5914
commit
e00f87f2f5
599 changed files with 119573 additions and 55990 deletions
|
@ -58,7 +58,7 @@ class WP_Widget_Archives extends WP_Widget {
|
|||
$dropdown_id = "{$this->id_base}-dropdown-{$this->number}";
|
||||
?>
|
||||
<label class="screen-reader-text" for="<?php echo esc_attr( $dropdown_id ); ?>"><?php echo $title; ?></label>
|
||||
<select id="<?php echo esc_attr( $dropdown_id ); ?>" name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>
|
||||
<select id="<?php echo esc_attr( $dropdown_id ); ?>" name="archive-dropdown">
|
||||
<?php
|
||||
/**
|
||||
* Filters the arguments for the Archives widget drop-down.
|
||||
|
@ -104,6 +104,21 @@ class WP_Widget_Archives extends WP_Widget {
|
|||
<?php wp_get_archives( $dropdown_args ); ?>
|
||||
|
||||
</select>
|
||||
|
||||
<script type='text/javascript'>
|
||||
/* <![CDATA[ */
|
||||
(function() {
|
||||
var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" );
|
||||
function onSelectChange() {
|
||||
if ( dropdown.options[ dropdown.selectedIndex ].value !== '' ) {
|
||||
document.location.href = this.options[ this.selectedIndex ].value;
|
||||
}
|
||||
}
|
||||
dropdown.onchange = onSelectChange;
|
||||
})();
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
||||
<?php } else { ?>
|
||||
<ul>
|
||||
<?php
|
||||
|
|
|
@ -143,6 +143,9 @@ class WP_Widget_Custom_HTML extends WP_Widget {
|
|||
/** This filter is documented in wp-includes/widgets/class-wp-widget-text.php */
|
||||
$content = apply_filters( 'widget_text', $instance['content'], $simulated_text_widget_instance, $this );
|
||||
|
||||
// Adds noreferrer and noopener relationships, without duplicating values, to all HTML A elements that have a target.
|
||||
$content = wp_targeted_link_rel( $content );
|
||||
|
||||
/**
|
||||
* Filters the content of the Custom HTML widget.
|
||||
*
|
||||
|
|
|
@ -19,7 +19,7 @@ class WP_Widget_Media_Audio extends WP_Widget_Media {
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 4.8.0
|
||||
* @since 4.8.0
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
|
@ -54,7 +54,7 @@ class WP_Widget_Media_Audio extends WP_Widget_Media {
|
|||
/**
|
||||
* Get schema for properties of a widget instance (item).
|
||||
*
|
||||
* @since 4.8.0
|
||||
* @since 4.8.0
|
||||
*
|
||||
* @see WP_REST_Controller::get_item_schema()
|
||||
* @see WP_REST_Controller::get_additional_fields()
|
||||
|
@ -62,21 +62,18 @@ class WP_Widget_Media_Audio extends WP_Widget_Media {
|
|||
* @return array Schema for properties.
|
||||
*/
|
||||
public function get_instance_schema() {
|
||||
$schema = array_merge(
|
||||
parent::get_instance_schema(),
|
||||
array(
|
||||
'preload' => array(
|
||||
'type' => 'string',
|
||||
'enum' => array( 'none', 'auto', 'metadata' ),
|
||||
'default' => 'none',
|
||||
'description' => __( 'Preload' ),
|
||||
),
|
||||
'loop' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
'description' => __( 'Loop' ),
|
||||
),
|
||||
)
|
||||
$schema = array(
|
||||
'preload' => array(
|
||||
'type' => 'string',
|
||||
'enum' => array( 'none', 'auto', 'metadata' ),
|
||||
'default' => 'none',
|
||||
'description' => __( 'Preload' ),
|
||||
),
|
||||
'loop' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
'description' => __( 'Loop' ),
|
||||
),
|
||||
);
|
||||
|
||||
foreach ( wp_get_audio_extensions() as $audio_extension ) {
|
||||
|
@ -89,13 +86,13 @@ class WP_Widget_Media_Audio extends WP_Widget_Media {
|
|||
);
|
||||
}
|
||||
|
||||
return $schema;
|
||||
return array_merge( $schema, parent::get_instance_schema() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the media on the frontend.
|
||||
*
|
||||
* @since 4.8.0
|
||||
* @since 4.8.0
|
||||
*
|
||||
* @param array $instance Widget instance props.
|
||||
* @return void
|
||||
|
|
|
@ -175,37 +175,60 @@ class WP_Widget_Media_Gallery extends WP_Widget_Media {
|
|||
parent::render_control_template_scripts();
|
||||
?>
|
||||
<script type="text/html" id="tmpl-wp-media-widget-gallery-preview">
|
||||
<# var describedById = 'describedBy-' + String( Math.random() ); #>
|
||||
<#
|
||||
var ids = _.filter( data.ids, function( id ) {
|
||||
return ( id in data.attachments );
|
||||
} );
|
||||
#>
|
||||
<# if ( ids.length ) { #>
|
||||
<div class="gallery media-widget-gallery-preview">
|
||||
<ul class="gallery media-widget-gallery-preview" role="list">
|
||||
<# _.each( ids, function( id, index ) { #>
|
||||
<# var attachment = data.attachments[ id ]; #>
|
||||
<# if ( index < 6 ) { #>
|
||||
<dl class="gallery-item">
|
||||
<dt class="gallery-icon">
|
||||
<# if ( attachment.sizes.thumbnail ) { #>
|
||||
<img src="{{ attachment.sizes.thumbnail.url }}" width="{{ attachment.sizes.thumbnail.width }}" height="{{ attachment.sizes.thumbnail.height }}" alt="" />
|
||||
<# } else { #>
|
||||
<img src="{{ attachment.url }}" alt="" />
|
||||
<# } #>
|
||||
<# if ( index === 5 && ids.length > 6 ) { #>
|
||||
<li class="gallery-item">
|
||||
<div class="gallery-icon">
|
||||
<img alt="{{ attachment.alt }}"
|
||||
<# if ( index === 5 && data.ids.length > 6 ) { #> aria-hidden="true" <# } #>
|
||||
<# if ( attachment.sizes.thumbnail ) { #>
|
||||
src="{{ attachment.sizes.thumbnail.url }}" width="{{ attachment.sizes.thumbnail.width }}" height="{{ attachment.sizes.thumbnail.height }}"
|
||||
<# } else { #>
|
||||
src="{{ attachment.url }}"
|
||||
<# } #>
|
||||
<# if ( ! attachment.alt && attachment.filename ) { #>
|
||||
aria-label="
|
||||
<?php
|
||||
echo esc_attr(
|
||||
sprintf(
|
||||
/* translators: %s: the image file name. */
|
||||
__( 'The current image has no alternative text. The file name is: %s' ),
|
||||
'{{ attachment.filename }}'
|
||||
)
|
||||
);
|
||||
?>
|
||||
"
|
||||
<# } #>
|
||||
/>
|
||||
<# if ( index === 5 && data.ids.length > 6 ) { #>
|
||||
<div class="gallery-icon-placeholder">
|
||||
<p class="gallery-icon-placeholder-text">+{{ ids.length - 5 }}</p>
|
||||
<p class="gallery-icon-placeholder-text" aria-label="
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: the amount of additional, not visible images in the gallery widget preview. */
|
||||
__( 'Additional images added to this gallery: %s' ),
|
||||
'{{ data.ids.length - 5 }}'
|
||||
);
|
||||
?>
|
||||
">+{{ data.ids.length - 5 }}</p>
|
||||
</div>
|
||||
<# } #>
|
||||
</dt>
|
||||
</dl>
|
||||
<# } #>
|
||||
</div>
|
||||
</li>
|
||||
<# } #>
|
||||
<# } ); #>
|
||||
</div>
|
||||
</ul>
|
||||
<# } else { #>
|
||||
<div class="attachment-media-view">
|
||||
<p class="placeholder"><?php echo esc_html( $this->l10n['no_media_selected'] ); ?></p>
|
||||
<button type="button" class="placeholder button-add-media"><?php echo esc_html( $this->l10n['add_media'] ); ?></button>
|
||||
</div>
|
||||
<# } #>
|
||||
</script>
|
||||
|
|
|
@ -19,7 +19,7 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 4.8.0
|
||||
* @since 4.8.0
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
|
@ -53,7 +53,7 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
|
|||
/**
|
||||
* Get schema for properties of a widget instance (item).
|
||||
*
|
||||
* @since 4.8.0
|
||||
* @since 4.8.0
|
||||
*
|
||||
* @see WP_REST_Controller::get_item_schema()
|
||||
* @see WP_REST_Controller::get_additional_fields()
|
||||
|
@ -62,7 +62,6 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
|
|||
*/
|
||||
public function get_instance_schema() {
|
||||
return array_merge(
|
||||
parent::get_instance_schema(),
|
||||
array(
|
||||
'size' => array(
|
||||
'type' => 'string',
|
||||
|
@ -161,14 +160,15 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
|
|||
* - height (redundant when size is not custom)
|
||||
* - width (redundant when size is not custom)
|
||||
*/
|
||||
)
|
||||
),
|
||||
parent::get_instance_schema()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the media on the frontend.
|
||||
*
|
||||
* @since 4.8.0
|
||||
* @since 4.8.0
|
||||
*
|
||||
* @param array $instance Widget instance props.
|
||||
* @return void
|
||||
|
@ -266,7 +266,7 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
|
|||
$link .= '>';
|
||||
$link .= $image;
|
||||
$link .= '</a>';
|
||||
$image = $link;
|
||||
$image = wp_targeted_link_rel( $link );
|
||||
}
|
||||
|
||||
if ( $caption ) {
|
||||
|
@ -339,7 +339,6 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
|
|||
<# } #>
|
||||
</script>
|
||||
<script type="text/html" id="tmpl-wp-media-widget-image-preview">
|
||||
<# var describedById = 'describedBy-' + String( Math.random() ); #>
|
||||
<# if ( data.error && 'missing_attachment' === data.error ) { #>
|
||||
<div class="notice notice-error notice-alt notice-missing-attachment">
|
||||
<p><?php echo $this->l10n['missing_attachment']; ?></p>
|
||||
|
@ -349,15 +348,21 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
|
|||
<p><?php _e( 'Unable to preview media due to an unknown error.' ); ?></p>
|
||||
</div>
|
||||
<# } else if ( data.url ) { #>
|
||||
<img class="attachment-thumb" src="{{ data.url }}" draggable="false" alt="{{ data.alt }}" <# if ( ! data.alt && data.currentFilename ) { #> aria-describedby="{{ describedById }}" <# } #> />
|
||||
<# if ( ! data.alt && data.currentFilename ) { #>
|
||||
<p class="hidden" id="{{ describedById }}">
|
||||
<?php
|
||||
/* translators: %s: image filename */
|
||||
echo sprintf( __( 'Current image: %s' ), '{{ data.currentFilename }}' );
|
||||
?>
|
||||
</p>
|
||||
<# } #>
|
||||
<img class="attachment-thumb" src="{{ data.url }}" draggable="false" alt="{{ data.alt }}"
|
||||
<# if ( ! data.alt && data.currentFilename ) { #>
|
||||
aria-label="
|
||||
<?php
|
||||
echo esc_attr(
|
||||
sprintf(
|
||||
/* translators: %s: the image file name. */
|
||||
__( 'The current image has no alternative text. The file name is: %s' ),
|
||||
'{{ data.currentFilename }}'
|
||||
)
|
||||
);
|
||||
?>
|
||||
"
|
||||
<# } #>
|
||||
/>
|
||||
<# } #>
|
||||
</script>
|
||||
<?php
|
||||
|
|
|
@ -19,7 +19,7 @@ class WP_Widget_Media_Video extends WP_Widget_Media {
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 4.8.0
|
||||
* @since 4.8.0
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
|
@ -55,7 +55,7 @@ class WP_Widget_Media_Video extends WP_Widget_Media {
|
|||
/**
|
||||
* Get schema for properties of a widget instance (item).
|
||||
*
|
||||
* @since 4.8.0
|
||||
* @since 4.8.0
|
||||
*
|
||||
* @see WP_REST_Controller::get_item_schema()
|
||||
* @see WP_REST_Controller::get_additional_fields()
|
||||
|
@ -63,30 +63,28 @@ class WP_Widget_Media_Video extends WP_Widget_Media {
|
|||
* @return array Schema for properties.
|
||||
*/
|
||||
public function get_instance_schema() {
|
||||
$schema = array_merge(
|
||||
parent::get_instance_schema(),
|
||||
array(
|
||||
'preload' => array(
|
||||
'type' => 'string',
|
||||
'enum' => array( 'none', 'auto', 'metadata' ),
|
||||
'default' => 'metadata',
|
||||
'description' => __( 'Preload' ),
|
||||
'should_preview_update' => false,
|
||||
),
|
||||
'loop' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
'description' => __( 'Loop' ),
|
||||
'should_preview_update' => false,
|
||||
),
|
||||
'content' => array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
'description' => __( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ),
|
||||
'should_preview_update' => false,
|
||||
),
|
||||
)
|
||||
|
||||
$schema = array(
|
||||
'preload' => array(
|
||||
'type' => 'string',
|
||||
'enum' => array( 'none', 'auto', 'metadata' ),
|
||||
'default' => 'metadata',
|
||||
'description' => __( 'Preload' ),
|
||||
'should_preview_update' => false,
|
||||
),
|
||||
'loop' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
'description' => __( 'Loop' ),
|
||||
'should_preview_update' => false,
|
||||
),
|
||||
'content' => array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
'description' => __( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ),
|
||||
'should_preview_update' => false,
|
||||
),
|
||||
);
|
||||
|
||||
foreach ( wp_get_video_extensions() as $video_extension ) {
|
||||
|
@ -99,13 +97,13 @@ class WP_Widget_Media_Video extends WP_Widget_Media {
|
|||
);
|
||||
}
|
||||
|
||||
return $schema;
|
||||
return array_merge( $schema, parent::get_instance_schema() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the media on the frontend.
|
||||
*
|
||||
* @since 4.8.0
|
||||
* @since 4.8.0
|
||||
*
|
||||
* @param array $instance Widget instance props.
|
||||
*
|
||||
|
|
|
@ -122,7 +122,7 @@ abstract class WP_Widget_Media extends WP_Widget {
|
|||
/**
|
||||
* Get schema for properties of a widget instance (item).
|
||||
*
|
||||
* @since 4.8.0
|
||||
* @since 4.8.0
|
||||
*
|
||||
* @see WP_REST_Controller::get_item_schema()
|
||||
* @see WP_REST_Controller::get_additional_fields()
|
||||
|
@ -411,7 +411,9 @@ abstract class WP_Widget_Media extends WP_Widget {
|
|||
</p>
|
||||
<div class="media-widget-preview <?php echo esc_attr( $this->id_base ); ?>">
|
||||
<div class="attachment-media-view">
|
||||
<div class="placeholder"><?php echo esc_html( $this->l10n['no_media_selected'] ); ?></div>
|
||||
<button type="button" class="select-media button-add-media not-selected">
|
||||
<?php echo esc_html( $this->l10n['add_media'] ); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<p class="media-widget-buttons">
|
||||
|
@ -423,9 +425,6 @@ abstract class WP_Widget_Media extends WP_Widget {
|
|||
<?php echo esc_html( $this->l10n['replace_media'] ); ?>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<button type="button" class="button select-media not-selected">
|
||||
<?php echo esc_html( $this->l10n['add_media'] ); ?>
|
||||
</button>
|
||||
</p>
|
||||
<div class="media-widget-fields">
|
||||
</div>
|
||||
|
|
|
@ -328,6 +328,9 @@ class WP_Widget_Text extends WP_Widget {
|
|||
|
||||
$text = preg_replace_callback( '#<(video|iframe|object|embed)\s[^>]*>#i', array( $this, 'inject_video_max_width_style' ), $text );
|
||||
|
||||
// Adds noreferrer and noopener relationships, without duplicating values, to all HTML A elements that have a target.
|
||||
$text = wp_targeted_link_rel( $text );
|
||||
|
||||
?>
|
||||
<div class="textwidget"><?php echo $text; ?></div>
|
||||
<?php
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue