<# var w_rule = '', classes = [], w, h, settings = wp.media.view.settings, isYouTube = isVimeo = false; if ( ! _.isEmpty( data.model.src ) ) { isYouTube = data.model.src.match(/youtube|youtu\.be/); isVimeo = -1 !== data.model.src.indexOf('vimeo'); } if ( settings.contentWidth && data.model.width >= settings.contentWidth ) { w = settings.contentWidth; } else { w = data.model.width; } if ( w !== data.model.width ) { h = Math.ceil( ( data.model.height * w ) / data.model.width ); } else { h = data.model.height; } if ( w ) { w_rule = 'width: ' + w + 'px; '; } if ( isYouTube ) { classes.push( 'youtube-video' ); } if ( isVimeo ) { classes.push( 'vimeo-video' ); } #>
Learn how to describe the purpose of the image%3$s. Leave empty if the image is purely decorative.' ), /* translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations. */ esc_url( __( 'https://www.w3.org/WAI/tutorials/images/decision-tree/' ) ), 'target="_blank"', sprintf( ' %s', /* translators: Hidden accessibility text. */ __( '(opens in a new tab)' ) ) ); ?> tags, * whose content is treated as raw text by the HTML Tag Processor. * Extract each script block's content, process it separately, * then reassemble the full output. */ $script_processor = new WP_HTML_Tag_Processor( $html ); while ( $script_processor->next_tag( 'SCRIPT' ) ) { if ( 'text/html' !== $script_processor->get_attribute( 'type' ) ) { continue; } /* * Unlike wp_add_crossorigin_attributes(), this does not check whether * URLs are actually cross-origin. Media templates use Underscore.js * template expressions (e.g. {{ data.url }}) as placeholder URLs, * so actual URLs are not available at parse time. * The crossorigin attribute is added unconditionally to all relevant * media tags to ensure cross-origin isolation works regardless of * the final URL value at render time. * * IMG is intentionally excluded, matching wp_add_crossorigin_attributes(). * Under Document-Isolation-Policy: isolate-and-credentialless the browser * loads cross-origin images in credentialless mode without CORS headers, * so adding crossorigin="anonymous" would force a CORS request and break * previews of images served without Access-Control-Allow-Origin headers. */ $template_processor = new WP_HTML_Tag_Processor( $script_processor->get_modifiable_text() ); while ( $template_processor->next_tag() ) { if ( in_array( $template_processor->get_tag(), array( 'AUDIO', 'VIDEO' ), true ) && ! is_string( $template_processor->get_attribute( 'crossorigin' ) ) ) { $template_processor->set_attribute( 'crossorigin', 'anonymous' ); } } $script_processor->set_modifiable_text( $template_processor->get_updated_html() ); } echo $script_processor->get_updated_html(); } }