Make WordPress Core


Ignore:
Timestamp:
05/19/2014 05:36:38 AM (10 years ago)
Author:
wonderboymusic
Message:

Add access modifier to methods/members in WP_oEmbed. Adds a magic __call() method for BC.

See #27881, #22234.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-oembed.php

    r27957 r28507  
    1919 */
    2020class WP_oEmbed {
    21     var $providers = array();
     21    public $providers = array();
    2222
    2323    /**
     
    2626     * @uses apply_filters() Filters a list of pre-defined oEmbed providers.
    2727     */
    28     function __construct() {
     28    public function __construct() {
    2929        $providers = array(
    3030            '#http://(www\.)?youtube\.com/watch.*#i'              => array( 'http://www.youtube.com/oembed',                      true  ),
     
    7878
    7979    /**
     80     * Make private/protected methods readable for backwards compatibility
     81     *
     82     * @since 4.0.0
     83     * @param string $name
     84     * @param array $arguments
     85     * @return mixed
     86     */
     87    public function __call( $name, $arguments ) {
     88        return call_user_func_array( array( $this, $name ), $arguments );
     89    }
     90
     91    /**
    8092     * The do-it-all function that takes a URL and attempts to return the HTML.
    8193     *
     
    88100     * @return bool|string False on failure, otherwise the UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
    89101     */
    90     function get_html( $url, $args = '' ) {
     102    public function get_html( $url, $args = '' ) {
    91103        $provider = false;
    92104
     
    133145     * @return bool|string False on failure, otherwise the oEmbed provider URL.
    134146     */
    135     function discover( $url ) {
     147    public function discover( $url ) {
    136148        $providers = array();
    137149
     
    199211     * @return bool|object False on failure, otherwise the result in the form of an object.
    200212     */
    201     function fetch( $provider, $url, $args = '' ) {
     213    public function fetch( $provider, $url, $args = '' ) {
    202214        $args = wp_parse_args( $args, wp_embed_defaults() );
    203215
     
    235247     * @return bool|object False on failure, otherwise the result in the form of an object.
    236248     */
    237     function _fetch_with_format( $provider_url_with_args, $format ) {
     249    private function _fetch_with_format( $provider_url_with_args, $format ) {
    238250        $provider_url_with_args = add_query_arg( 'format', $format, $provider_url_with_args );
    239251        $response = wp_safe_remote_get( $provider_url_with_args );
     
    252264     * @access private
    253265     */
    254     function _parse_json( $response_body ) {
     266    private function _parse_json( $response_body ) {
    255267        return ( ( $data = json_decode( trim( $response_body ) ) ) && is_object( $data ) ) ? $data : false;
    256268    }
     
    262274     * @access private
    263275     */
    264     function _parse_xml( $response_body ) {
     276    private function _parse_xml( $response_body ) {
    265277        if ( ! function_exists( 'libxml_disable_entity_loader' ) )
    266278            return false;
     
    319331     * @return bool|string False on error, otherwise the HTML needed to embed.
    320332     */
    321     function data2html( $data, $url ) {
     333    public function data2html( $data, $url ) {
    322334        if ( ! is_object( $data ) || empty( $data->type ) )
    323335            return false;
     
    374386     * @return string Possibly modified $html
    375387     */
    376     function _strip_newlines( $html, $data, $url ) {
     388    private function _strip_newlines( $html, $data, $url ) {
    377389        if ( false !== strpos( $html, "\n" ) )
    378390            $html = str_replace( array( "\r\n", "\n" ), '', $html );
Note: See TracChangeset for help on using the changeset viewer.