~canonical-sysadmins/wordpress/4.2.4

« back to all changes in this revision

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

  • Committer: Paul Gear
  • Date: 2015-04-24 01:35:20 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: paul.gear@canonical.com-20150424013520-w4p9ksth76zh6opw
Merge new upstream release 4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
 
78
78
?>
79
79
<script type="text/javascript">
80
 
/* <![CDATA[ */
81
80
        jQuery(document).ready(function($){
82
81
                $.get("<?php echo admin_url( 'admin-ajax.php?action=oembed-cache&post=' . $post->ID, 'relative' ); ?>");
83
82
        });
84
 
/* ]]> */
85
83
</script>
86
84
<?php
87
85
        }
126
124
         *     @type int $height Height of the embed in pixels.
127
125
         * }
128
126
         * @param string $url The URL attempting to be embedded.
129
 
         * @return string The embed HTML on success, otherwise the original URL.
 
127
         * @return string|false The embed HTML on success, otherwise the original URL.
 
128
         *                      `->maybe_make_link()` can return false on failure.
130
129
         */
131
130
        public function shortcode( $attr, $url = '' ) {
132
131
                $post = get_post();
135
134
                        $url = $attr['src'];
136
135
                }
137
136
 
 
137
 
138
138
                if ( empty( $url ) )
139
139
                        return '';
140
140
 
312
312
         * @return string Potentially modified $content.
313
313
         */
314
314
        public function autoembed( $content ) {
315
 
                return preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array( $this, 'autoembed_callback' ), $content );
 
315
                return preg_replace_callback( '|^(\s*)(https?://[^\s"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $content );
316
316
        }
317
317
 
318
318
        /**
324
324
        public function autoembed_callback( $match ) {
325
325
                $oldval = $this->linkifunknown;
326
326
                $this->linkifunknown = false;
327
 
                $return = $this->shortcode( array(), $match[1] );
 
327
                $return = $this->shortcode( array(), $match[2] );
328
328
                $this->linkifunknown = $oldval;
329
329
 
330
 
                return "\n$return\n";
 
330
                return $match[1] . $return . $match[3];
331
331
        }
332
332
 
333
333
        /**