~canonical-sysadmins/wordpress/4.7.1

« back to all changes in this revision

Viewing changes to wp-includes/class-oembed.php

  • Committer: Barry Price
  • Date: 2016-06-22 02:23:41 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: barry.price@canonical.com-20160622022341-9qrp2nesacwfx017
Merge WP4.5.3 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
315
315
         * @return false|string False on failure, otherwise the UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
316
316
         */
317
317
        public function get_html( $url, $args = '' ) {
 
318
                /**
 
319
                 * Filters the oEmbed result before any HTTP requests are made.
 
320
                 *
 
321
                 * This allows one to short-circuit the default logic, perhaps by
 
322
                 * replacing it with a routine that is more optimal for your setup.
 
323
                 *
 
324
                 * Passing a non-null value to the filter will effectively short-circuit retrieval,
 
325
                 * returning the passed value instead.
 
326
                 *
 
327
                 * @since 4.5.3
 
328
                 *
 
329
                 * @param null|string $result The UNSANITIZED (and potentially unsafe) HTML that should be used to embed. Default null.
 
330
                 * @param string      $url    The URL to the content that should be attempted to be embedded.
 
331
                 * @param array       $args   Optional. Arguments, usually passed from a shortcode. Default empty.
 
332
                 */
 
333
                $pre = apply_filters( 'pre_oembed_result', null, $url, $args );
 
334
 
 
335
                if ( null !== $pre ) {
 
336
                        return $pre;
 
337
                }
 
338
 
318
339
                $provider = $this->get_provider( $url, $args );
319
340
 
320
 
                if ( !$provider || false === $data = $this->fetch( $provider, $url, $args ) )
 
341
                if ( ! $provider || false === $data = $this->fetch( $provider, $url, $args ) ) {
321
342
                        return false;
 
343
                }
322
344
 
323
345
                /**
324
346
                 * Filter the HTML returned by the oEmbed provider.