diff --git a/wp-includes/class-oembed.php b/wp-includes/class-oembed.php index 353837ff22..9c0aa1d60d 100644 --- a/wp-includes/class-oembed.php +++ b/wp-includes/class-oembed.php @@ -18,14 +18,14 @@ * @since 2.9.0 */ class WP_oEmbed { - var $providers = array(); + public $providers = array(); /** * Constructor * * @uses apply_filters() Filters a list of pre-defined oEmbed providers. */ - function __construct() { + public function __construct() { $providers = array( '#http://(www\.)?youtube\.com/watch.*#i' => array( 'http://www.youtube.com/oembed', true ), '#https://(www\.)?youtube\.com/watch.*#i' => array( 'http://www.youtube.com/oembed?scheme=https', true ), @@ -76,6 +76,18 @@ class WP_oEmbed { add_filter( 'oembed_dataparse', array($this, '_strip_newlines'), 10, 3 ); } + /** + * Make private/protected methods readable for backwards compatibility + * + * @since 4.0.0 + * @param string $name + * @param array $arguments + * @return mixed + */ + public function __call( $name, $arguments ) { + return call_user_func_array( array( $this, $name ), $arguments ); + } + /** * The do-it-all function that takes a URL and attempts to return the HTML. * @@ -87,7 +99,7 @@ class WP_oEmbed { * @param array $args Optional arguments. Usually passed from a shortcode. * @return bool|string False on failure, otherwise the UNSANITIZED (and potentially unsafe) HTML that should be used to embed. */ - function get_html( $url, $args = '' ) { + public function get_html( $url, $args = '' ) { $provider = false; if ( !isset($args['discover']) ) @@ -132,7 +144,7 @@ class WP_oEmbed { * @param string $url The URL that should be inspected for discovery tags. * @return bool|string False on failure, otherwise the oEmbed provider URL. */ - function discover( $url ) { + public function discover( $url ) { $providers = array(); // Fetch URL content @@ -198,7 +210,7 @@ class WP_oEmbed { * @param array $args Optional arguments. Usually passed from a shortcode. * @return bool|object False on failure, otherwise the result in the form of an object. */ - function fetch( $provider, $url, $args = '' ) { + public function fetch( $provider, $url, $args = '' ) { $args = wp_parse_args( $args, wp_embed_defaults() ); $provider = add_query_arg( 'maxwidth', (int) $args['width'], $provider ); @@ -234,7 +246,7 @@ class WP_oEmbed { * @param string $format Format to use * @return bool|object False on failure, otherwise the result in the form of an object. */ - function _fetch_with_format( $provider_url_with_args, $format ) { + private function _fetch_with_format( $provider_url_with_args, $format ) { $provider_url_with_args = add_query_arg( 'format', $format, $provider_url_with_args ); $response = wp_safe_remote_get( $provider_url_with_args ); if ( 501 == wp_remote_retrieve_response_code( $response ) ) @@ -251,7 +263,7 @@ class WP_oEmbed { * @since 3.0.0 * @access private */ - function _parse_json( $response_body ) { + private function _parse_json( $response_body ) { return ( ( $data = json_decode( trim( $response_body ) ) ) && is_object( $data ) ) ? $data : false; } @@ -261,7 +273,7 @@ class WP_oEmbed { * @since 3.0.0 * @access private */ - function _parse_xml( $response_body ) { + private function _parse_xml( $response_body ) { if ( ! function_exists( 'libxml_disable_entity_loader' ) ) return false; @@ -318,7 +330,7 @@ class WP_oEmbed { * @param string $url The URL to the content that is desired to be embedded. * @return bool|string False on error, otherwise the HTML needed to embed. */ - function data2html( $data, $url ) { + public function data2html( $data, $url ) { if ( ! is_object( $data ) || empty( $data->type ) ) return false; @@ -373,7 +385,7 @@ class WP_oEmbed { * @param string $url The original URL passed to oEmbed. * @return string Possibly modified $html */ - function _strip_newlines( $html, $data, $url ) { + private function _strip_newlines( $html, $data, $url ) { if ( false !== strpos( $html, "\n" ) ) $html = str_replace( array( "\r\n", "\n" ), '', $html );