Skip to content

Commit 8a0f8df

Browse files
Docs: Correct parameter type for the oembed_dataparse filter.
This commit updates the filter documentation to indicate that it can both take and return a `string|false` value. Documentation for functions attached to the filter has been similarly corrected: * `WP_oEmbed::_strip_newlines()` * `wp_filter_oembed_result()` * `wp_filter_oembed_iframe_title_attribute()` Follow-up to [12153], [25723], [34903], [34974], [44942]. Props justlevine. See #63268. git-svn-id: https://develop.svn.wordpress.org/trunk@60307 602fd350-edb4-49c9-b593-d223f7449a82
1 parent a49176e commit 8a0f8df

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/wp-includes/class-wp-oembed.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -739,9 +739,9 @@ public function data2html( $data, $url ) {
739739
*
740740
* @since 2.9.0
741741
*
742-
* @param string $return The returned oEmbed HTML.
743-
* @param object $data A data object result from an oEmbed provider.
744-
* @param string $url The URL of the content to be embedded.
742+
* @param string|false $return The returned oEmbed HTML, or false on failure.
743+
* @param object $data A data object result from an oEmbed provider.
744+
* @param string $url The URL of the content to be embedded.
745745
*/
746746
return apply_filters( 'oembed_dataparse', $return, $data, $url );
747747
}
@@ -752,10 +752,10 @@ public function data2html( $data, $url ) {
752752
* @since 2.9.0 as strip_scribd_newlines()
753753
* @since 3.0.0
754754
*
755-
* @param string $html Existing HTML.
756-
* @param object $data Data object from WP_oEmbed::data2html()
757-
* @param string $url The original URL passed to oEmbed.
758-
* @return string Possibly modified $html
755+
* @param string|false $html Existing HTML.
756+
* @param object $data Data object from WP_oEmbed::data2html()
757+
* @param string $url The original URL passed to oEmbed.
758+
* @return string|false Possibly modified $html.
759759
*/
760760
public function _strip_newlines( $html, $data, $url ) {
761761
if ( ! str_contains( $html, "\n" ) ) {

src/wp-includes/embed.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -843,10 +843,10 @@ function _oembed_create_xml( $data, $node = null ) {
843843
*
844844
* @since 5.2.0
845845
*
846-
* @param string $result The oEmbed HTML result.
847-
* @param object $data A data object result from an oEmbed provider.
848-
* @param string $url The URL of the content to be embedded.
849-
* @return string The filtered oEmbed result.
846+
* @param string|false $result The oEmbed HTML result.
847+
* @param object $data A data object result from an oEmbed provider.
848+
* @param string $url The URL of the content to be embedded.
849+
* @return string|false The filtered oEmbed result.
850850
*/
851851
function wp_filter_oembed_iframe_title_attribute( $result, $data, $url ) {
852852
if ( false === $result || ! in_array( $data->type, array( 'rich', 'video' ), true ) ) {
@@ -910,10 +910,10 @@ function wp_filter_oembed_iframe_title_attribute( $result, $data, $url ) {
910910
*
911911
* @since 4.4.0
912912
*
913-
* @param string $result The oEmbed HTML result.
914-
* @param object $data A data object result from an oEmbed provider.
915-
* @param string $url The URL of the content to be embedded.
916-
* @return string The filtered and sanitized oEmbed result.
913+
* @param string|false $result The oEmbed HTML result.
914+
* @param object $data A data object result from an oEmbed provider.
915+
* @param string $url The URL of the content to be embedded.
916+
* @return string|false The filtered and sanitized oEmbed result.
917917
*/
918918
function wp_filter_oembed_result( $result, $data, $url ) {
919919
if ( false === $result || ! in_array( $data->type, array( 'rich', 'video' ), true ) ) {

0 commit comments

Comments
 (0)