wp/wp-includes/customize/class-wp-customize-media-control.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 21 48c4eec2b7e6
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    89 		if ( is_object( $this->setting ) ) {
    89 		if ( is_object( $this->setting ) ) {
    90 			if ( $this->setting->default ) {
    90 			if ( $this->setting->default ) {
    91 				// Fake an attachment model - needs all fields used by template.
    91 				// Fake an attachment model - needs all fields used by template.
    92 				// Note that the default value must be a URL, NOT an attachment ID.
    92 				// Note that the default value must be a URL, NOT an attachment ID.
    93 				$ext  = substr( $this->setting->default, -3 );
    93 				$ext  = substr( $this->setting->default, -3 );
    94 				$type = in_array( $ext, array( 'jpg', 'png', 'gif', 'bmp' ), true ) ? 'image' : 'document';
    94 				$type = in_array( $ext, array( 'jpg', 'png', 'gif', 'bmp', 'webp' ), true ) ? 'image' : 'document';
    95 
    95 
    96 				$default_attachment = array(
    96 				$default_attachment = array(
    97 					'id'    => 1,
    97 					'id'    => 1,
    98 					'url'   => $this->setting->default,
    98 					'url'   => $this->setting->default,
    99 					'type'  => $type,
    99 					'type'  => $type,
   168 						<# } #>
   168 						<# } #>
   169 						<# if ( data.attachment.artist || data.attachment.meta.artist ) { #>
   169 						<# if ( data.attachment.artist || data.attachment.meta.artist ) { #>
   170 						<p class="attachment-meta">{{ data.attachment.artist || data.attachment.meta.artist }}</p>
   170 						<p class="attachment-meta">{{ data.attachment.artist || data.attachment.meta.artist }}</p>
   171 						<# } #>
   171 						<# } #>
   172 						<audio style="visibility: hidden" controls class="wp-audio-shortcode" width="100%" preload="none">
   172 						<audio style="visibility: hidden" controls class="wp-audio-shortcode" width="100%" preload="none">
   173 							<source type="{{ data.attachment.mime }}" src="{{ data.attachment.url }}"/>
   173 							<source type="{{ data.attachment.mime }}" src="{{ data.attachment.url }}" />
   174 						</audio>
   174 						</audio>
   175 					<# } else if ( 'video' === data.attachment.type ) { #>
   175 					<# } else if ( 'video' === data.attachment.type ) { #>
   176 						<div class="wp-media-wrapper wp-video">
   176 						<div class="wp-media-wrapper wp-video">
   177 							<video controls="controls" class="wp-video-shortcode" preload="metadata"
   177 							<video controls="controls" class="wp-video-shortcode" preload="metadata"
   178 								<# if ( data.attachment.image && data.attachment.image.src !== data.attachment.icon ) { #>poster="{{ data.attachment.image.src }}"<# } #>>
   178 								<# if ( data.attachment.image && data.attachment.image.src !== data.attachment.icon ) { #>poster="{{ data.attachment.image.src }}"<# } #>>
   179 								<source type="{{ data.attachment.mime }}" src="{{ data.attachment.url }}"/>
   179 								<source type="{{ data.attachment.mime }}" src="{{ data.attachment.url }}" />
   180 							</video>
   180 							</video>
   181 						</div>
   181 						</div>
   182 					<# } else { #>
   182 					<# } else { #>
   183 						<img class="attachment-thumb type-icon icon" src="{{ data.attachment.icon }}" draggable="false" alt="" />
   183 						<img class="attachment-thumb type-icon icon" src="{{ data.attachment.icon }}" draggable="false" alt="" />
   184 						<p class="attachment-title">{{ data.attachment.title }}</p>
   184 						<p class="attachment-title">{{ data.attachment.title }}</p>