Widget_Audio::filter_oembed_result( string $html )
Filter audio widget oEmbed results.
Description
Written in PHP and used to generate the final HTML.
Parameters
Name | Type | Required | Description |
---|---|---|---|
$html | string |
Required | The HTML returned by the oEmbed provider. |
Return
(string) Filtered audio widget oEmbed HTML.
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |
Source
includes/widgets/audio.php
foreach ( $param_keys as $param_key ) { $params[ $param_key ] = 'yes' === $this->_current_instance[ 'sc_' . $param_key ] ? 'true' : 'false'; } $params['color'] = str_replace( '#', '', $this->_current_instance['sc_color'] ); preg_match( '/<iframe.*src=\"(.*)\".*><\/iframe>/isU', $html, $matches ); $url = esc_url( add_query_arg( $params, $matches[1] ) ); $visual = 'yes' === $this->_current_instance['visual'] ? 'true' : 'false'; $html = str_replace( [ $matches[1], 'visual=true' ], [ $url, 'visual=' . $visual ], $html ); if ( 'false' === $visual ) { $html = str_replace( 'height="400"', 'height="200"', $html ); } return $html; } /** * Render audio widget output in the editor. * * Written as a Backbone JavaScript template and used to generate the live preview. * * @since 1.0.0 * @access protected */ protected function _content_template() {} }