~canonical-sysadmins/wordpress/4.7

« back to all changes in this revision

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

  • Committer: Ryan Finnie
  • Date: 2015-08-31 16:03:58 UTC
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: ryan.finnie@canonical.com-20150831160358-32iuabgkh61u3sme
new upstream release 4.2.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
312
312
         * @return string Potentially modified $content.
313
313
         */
314
314
        public function autoembed( $content ) {
315
 
                // Strip newlines from all elements.
316
 
                $content = wp_replace_in_html_tags( $content, array( "\n" => " " ) );
 
315
                // Replace line breaks from all HTML elements with placeholders.
 
316
                $content = wp_replace_in_html_tags( $content, array( "\n" => '<!-- wp-line-break -->' ) );
317
317
 
318
318
                // Find URLs that are on their own line.
319
 
                return preg_replace_callback( '|^(\s*)(https?://[^\s"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $content );
 
319
                $content = preg_replace_callback( '|^(\s*)(https?://[^\s"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $content );
 
320
 
 
321
                // Put the line breaks back.
 
322
                return str_replace( '<!-- wp-line-break -->', "\n", $content );
320
323
        }
321
324
 
322
325
        /**