Add some security hardening to passed playlist attributes.
Props xknown. See #26631. git-svn-id: https://develop.svn.wordpress.org/trunk@27311 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9bcb738064
commit
ad0751a29c
|
@ -1013,6 +1013,10 @@ function wp_get_playlist( $attr, $type ) {
|
||||||
$orderby = 'none';
|
$orderby = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! in_array( $style, array( 'light', 'dark' ), true ) ) {
|
||||||
|
$style = 'light';
|
||||||
|
}
|
||||||
|
|
||||||
$args = array(
|
$args = array(
|
||||||
'post_status' => 'inherit',
|
'post_status' => 'inherit',
|
||||||
'post_type' => 'attachment',
|
'post_type' => 'attachment',
|
||||||
|
@ -1113,13 +1117,16 @@ function wp_get_playlist( $attr, $type ) {
|
||||||
}
|
}
|
||||||
$data['tracks'] = $tracks;
|
$data['tracks'] = $tracks;
|
||||||
|
|
||||||
|
$safe_type = esc_attr( $safe_type );
|
||||||
|
$safe_style = esc_attr( $style );
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
if ( 1 === $instance ):
|
if ( 1 === $instance ):
|
||||||
wp_enqueue_style( 'wp-mediaelement' );
|
wp_enqueue_style( 'wp-mediaelement' );
|
||||||
wp_enqueue_script( 'wp-playlist' );
|
wp_enqueue_script( 'wp-playlist' );
|
||||||
?>
|
?>
|
||||||
<!--[if lt IE 9]><script>document.createElement('<?php echo $type ?>');</script><![endif]-->
|
<!--[if lt IE 9]><script>document.createElement('<?php echo esc_js( $type ) ?>');</script><![endif]-->
|
||||||
<script type="text/html" id="tmpl-wp-playlist-current-item">
|
<script type="text/html" id="tmpl-wp-playlist-current-item">
|
||||||
<# if ( data.image ) { #>
|
<# if ( data.image ) { #>
|
||||||
<img src="{{{ data.thumb.src }}}"/>
|
<img src="{{{ data.thumb.src }}}"/>
|
||||||
|
@ -1154,11 +1161,11 @@ function wp_get_playlist( $attr, $type ) {
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<div class="wp-playlist wp-<?php echo $type ?>-playlist wp-playlist-<?php echo $style ?>">
|
<div class="wp-playlist wp-<?php echo $safe_type ?>-playlist wp-playlist-<?php echo $safe_style ?>">
|
||||||
<?php if ( 'audio' === $type ): ?>
|
<?php if ( 'audio' === $type ): ?>
|
||||||
<div class="wp-playlist-current-item"></div>
|
<div class="wp-playlist-current-item"></div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<<?php echo $type ?> controls="controls" preload="metadata" width="<?php echo $theme_width ?>"></<?php echo $type ?>>
|
<<?php echo $safe_type ?> controls="controls" preload="metadata" width="<?php echo (int) $theme_width ?>"></<?php echo $safe_type ?>>
|
||||||
<div class="wp-playlist-next"></div>
|
<div class="wp-playlist-next"></div>
|
||||||
<div class="wp-playlist-prev"></div>
|
<div class="wp-playlist-prev"></div>
|
||||||
<noscript>
|
<noscript>
|
||||||
|
@ -2594,4 +2601,4 @@ function theme_supports_thumbnails( $post ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return current_theme_supports( 'post-thumbnails', $post->post_type );
|
return current_theme_supports( 'post-thumbnails', $post->post_type );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue