<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[21998] trunk: Always attempt to embed URLs in content, removing the Auto-embeds (autoembed_urls) option.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/21998">21998</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-09-25 07:10:09 +0000 (Tue, 25 Sep 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Always attempt to embed URLs in content, removing the Auto-embeds (autoembed_urls) option.

Remove the UI for setting the default width and height for embeds. Width was confusing as it
was blank by default (inheriting the content width from the theme, or 500px). The height is
now calculated as 1.5x the content width, or 1000px, whichever is smaller.

The [embed] shortcode can still receive manual height and width attributes. This just removes
the global settings.

props wonderboymusic. see <a href="http://core.trac.wordpress.org/ticket/21719">#21719</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesschemaphp">trunk/wp-admin/includes/schema.php</a></li>
<li><a href="#trunkwpadminoptionsmediaphp">trunk/wp-admin/options-media.php</a></li>
<li><a href="#trunkwpadminoptionsphp">trunk/wp-admin/options.php</a></li>
<li><a href="#trunkwpincludesdefaultfiltersphp">trunk/wp-includes/default-filters.php</a></li>
<li><a href="#trunkwpincludesformattingphp">trunk/wp-includes/formatting.php</a></li>
<li><a href="#trunkwpincludesmediaphp">trunk/wp-includes/media.php</a></li>
<li><a href="#trunkwpincludesversionphp">trunk/wp-includes/version.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesschemaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/schema.php (21997 => 21998)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/schema.php        2012-09-25 07:05:48 UTC (rev 21997)
+++ trunk/wp-admin/includes/schema.php        2012-09-25 07:10:09 UTC (rev 21998)
</span><span class="lines">@@ -468,11 +468,6 @@
</span><span class="cx">         // 2.8
</span><span class="cx">         'timezone_string' =&gt; $timezone_string,
</span><span class="cx"> 
</span><del>-        // 2.9
-        'embed_autourls' =&gt; 1,
-        'embed_size_w' =&gt; '',
-        'embed_size_h' =&gt; 600,
-
</del><span class="cx">         // 3.0
</span><span class="cx">         'page_for_posts' =&gt; 0,
</span><span class="cx">         'page_on_front' =&gt; 0,
</span><span class="lines">@@ -542,6 +537,7 @@
</span><span class="cx">                 'can_compress_scripts', 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron',
</span><span class="cx">                 'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page',
</span><span class="cx">                 'wporg_popular_tags', 'what_to_show', 'rss_language', 'language', 'enable_xmlrpc', 'enable_app',
</span><ins>+                'autoembed_urls',
</ins><span class="cx">         );
</span><span class="cx">         foreach ( $unusedoptions as $option )
</span><span class="cx">                 delete_option($option);
</span></span></pre></div>
<a id="trunkwpadminoptionsmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/options-media.php (21997 => 21998)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/options-media.php        2012-09-25 07:05:48 UTC (rev 21997)
+++ trunk/wp-admin/options-media.php        2012-09-25 07:10:09 UTC (rev 21998)
</span><span class="lines">@@ -15,14 +15,8 @@
</span><span class="cx"> $title = __('Media Settings');
</span><span class="cx"> $parent_file = 'options-general.php';
</span><span class="cx"> 
</span><del>-$media_options_help = '&lt;p&gt;' . __('You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.') . '&lt;/p&gt;' .
-        '&lt;p&gt;' . __('The Embed option allows you embed a video, image, or other media content into your content automatically by typing the URL (of the web page where the file lives) on its own line when you create your content.');
</del><ins>+$media_options_help = '&lt;p&gt;' . __('You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.') . '&lt;/p&gt;';
</ins><span class="cx"> 
</span><del>-if ( ! empty( $content_width ) )
-        $media_options_help .= ' ' . __( 'If you do not set the maximum embed size, it will be automatically sized to fit into your content area.' );
-
-$media_options_help .= '&lt;/p&gt;';
-
</del><span class="cx"> if ( ! is_multisite() ) {
</span><span class="cx">         $media_options_help .= '&lt;p&gt;' . __('Uploading Files allows you to choose the folder and path for storing your uploaded files.') . '&lt;/p&gt;';
</span><span class="cx"> }
</span><span class="lines">@@ -91,32 +85,12 @@
</span><span class="cx"> &lt;?php do_settings_fields('media', 'default'); ?&gt;
</span><span class="cx"> &lt;/table&gt;
</span><span class="cx"> 
</span><ins>+&lt;?php if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) : ?&gt;
</ins><span class="cx"> &lt;h3&gt;&lt;?php _e('Embeds') ?&gt;&lt;/h3&gt;
</span><del>-
</del><span class="cx"> &lt;table class=&quot;form-table&quot;&gt;
</span><del>-
-&lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Auto-embeds'); ?&gt;&lt;/th&gt;
-&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;screen-reader-text&quot;&gt;&lt;span&gt;&lt;?php _e('When possible, embed the media content from a URL directly onto the page. For example: links to Flickr and YouTube.'); ?&gt;&lt;/span&gt;&lt;/legend&gt;
-&lt;label for=&quot;embed_autourls&quot;&gt;&lt;input name=&quot;embed_autourls&quot; type=&quot;checkbox&quot; id=&quot;embed_autourls&quot; value=&quot;1&quot; &lt;?php checked( '1', get_option('embed_autourls') ); ?&gt;/&gt; &lt;?php _e('When possible, embed the media content from a URL directly onto the page. For example: links to Flickr and YouTube.'); ?&gt;&lt;/label&gt;
-&lt;/fieldset&gt;&lt;/td&gt;
-&lt;/tr&gt;
-
-&lt;tr valign=&quot;top&quot;&gt;
-&lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Maximum embed size') ?&gt;&lt;/th&gt;
-&lt;td&gt;
-&lt;label for=&quot;embed_size_w&quot;&gt;&lt;?php _e('Width'); ?&gt;&lt;/label&gt;
-&lt;input name=&quot;embed_size_w&quot; type=&quot;number&quot; step=&quot;1&quot; min=&quot;0&quot; id=&quot;embed_size_w&quot; value=&quot;&lt;?php form_option('embed_size_w'); ?&gt;&quot; class=&quot;small-text&quot; /&gt;
-&lt;label for=&quot;embed_size_h&quot;&gt;&lt;?php _e('Height'); ?&gt;&lt;/label&gt;
-&lt;input name=&quot;embed_size_h&quot; type=&quot;number&quot; step=&quot;1&quot; min=&quot;0&quot; id=&quot;embed_size_h&quot; value=&quot;&lt;?php form_option('embed_size_h'); ?&gt;&quot; class=&quot;small-text&quot; /&gt;
-&lt;?php if ( ! empty( $content_width ) )
-        echo '&lt;p class=&quot;description&quot;&gt;' . __( 'If the width value is left blank, embeds will default to the max width of your theme.' ) . '&lt;/p&gt;';
-?&gt;
-&lt;/td&gt;
-&lt;/tr&gt;
-
-&lt;?php do_settings_fields('media', 'embeds'); ?&gt;
</del><ins>+&lt;?php do_settings_fields( 'media', 'embeds' ); ?&gt;
</ins><span class="cx"> &lt;/table&gt;
</span><ins>+&lt;?php endif; ?&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;?php if ( !is_multisite() ) : ?&gt;
</span><span class="cx"> &lt;h3&gt;&lt;?php _e('Uploading Files'); ?&gt;&lt;/h3&gt;
</span></span></pre></div>
<a id="trunkwpadminoptionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/options.php (21997 => 21998)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/options.php        2012-09-25 07:05:48 UTC (rev 21997)
+++ trunk/wp-admin/options.php        2012-09-25 07:10:09 UTC (rev 21998)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx"> $whitelist_options = array(
</span><span class="cx">         'general' =&gt; array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string' ),
</span><span class="cx">         'discussion' =&gt; array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ),
</span><del>-        'media' =&gt; array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type', 'embed_autourls', 'embed_size_w', 'embed_size_h' ),
</del><ins>+        'media' =&gt; array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ),
</ins><span class="cx">         'reading' =&gt; array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public' ),
</span><span class="cx">         'writing' =&gt; array( 'default_post_edit_rows', 'use_smilies', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'default_post_format' )
</span><span class="cx"> );
</span></span></pre></div>
<a id="trunkwpincludesdefaultfiltersphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/default-filters.php (21997 => 21998)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/default-filters.php        2012-09-25 07:05:48 UTC (rev 21997)
+++ trunk/wp-includes/default-filters.php        2012-09-25 07:10:09 UTC (rev 21998)
</span><span class="lines">@@ -284,4 +284,7 @@
</span><span class="cx"> // If the upgrade hasn't run yet, assume link manager is used.
</span><span class="cx"> add_filter( 'default_option_link_manager_enabled', '__return_true' );
</span><span class="cx"> 
</span><ins>+// Automatically embed URLs
+add_filter( 'default_option_autoembed_urls', '__return_true' );
+
</ins><span class="cx"> unset($filter, $action);
</span></span></pre></div>
<a id="trunkwpincludesformattingphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/formatting.php (21997 => 21998)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/formatting.php        2012-09-25 07:05:48 UTC (rev 21997)
+++ trunk/wp-includes/formatting.php        2012-09-25 07:10:09 UTC (rev 21998)
</span><span class="lines">@@ -2764,7 +2764,6 @@
</span><span class="cx">                 case 'medium_size_h':
</span><span class="cx">                 case 'large_size_w':
</span><span class="cx">                 case 'large_size_h':
</span><del>-                case 'embed_size_h':
</del><span class="cx">                 case 'default_post_edit_rows':
</span><span class="cx">                 case 'mailserver_port':
</span><span class="cx">                 case 'comment_max_links':
</span><span class="lines">@@ -2782,11 +2781,6 @@
</span><span class="cx">                         $value = absint( $value );
</span><span class="cx">                         break;
</span><span class="cx"> 
</span><del>-                case 'embed_size_w':
-                        if ( '' !== $value )
-                                $value = absint( $value );
-                        break;
-
</del><span class="cx">                 case 'posts_per_page':
</span><span class="cx">                 case 'posts_per_rss':
</span><span class="cx">                         $value = (int) $value;
</span></span></pre></div>
<a id="trunkwpincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/media.php (21997 => 21998)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/media.php        2012-09-25 07:05:48 UTC (rev 21997)
+++ trunk/wp-includes/media.php        2012-09-25 07:10:09 UTC (rev 21998)
</span><span class="lines">@@ -1081,20 +1081,19 @@
</span><span class="cx">          */
</span><span class="cx">         function __construct() {
</span><span class="cx">                 // Hack to get the [embed] shortcode to run before wpautop()
</span><del>-                add_filter( 'the_content', array(&amp;$this, 'run_shortcode'), 8 );
</del><ins>+                add_filter( 'the_content', array( $this, 'run_shortcode' ), 8 );
</ins><span class="cx"> 
</span><span class="cx">                 // Shortcode placeholder for strip_shortcodes()
</span><span class="cx">                 add_shortcode( 'embed', '__return_false' );
</span><span class="cx"> 
</span><span class="cx">                 // Attempts to embed all URLs in a post
</span><del>-                if ( get_option('embed_autourls') )
-                        add_filter( 'the_content', array(&amp;$this, 'autoembed'), 8 );
</del><ins>+                add_filter( 'the_content', array( $this, 'autoembed' ), 8 );
</ins><span class="cx"> 
</span><span class="cx">                 // After a post is saved, invalidate the oEmbed cache
</span><del>-                add_action( 'save_post', array(&amp;$this, 'delete_oembed_caches') );
</del><ins>+                add_action( 'save_post', array( $this, 'delete_oembed_caches' ) );
</ins><span class="cx"> 
</span><span class="cx">                 // After a post is saved, cache oEmbed items via AJAX
</span><del>-                add_action( 'edit_form_advanced', array(&amp;$this, 'maybe_run_ajax_cache') );
</del><ins>+                add_action( 'edit_form_advanced', array( $this, 'maybe_run_ajax_cache' ) );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><span class="lines">@@ -1119,7 +1118,7 @@
</span><span class="cx">                 $orig_shortcode_tags = $shortcode_tags;
</span><span class="cx">                 remove_all_shortcodes();
</span><span class="cx"> 
</span><del>-                add_shortcode( 'embed', array(&amp;$this, 'shortcode') );
</del><ins>+                add_shortcode( 'embed', array( $this, 'shortcode' ) );
</ins><span class="cx"> 
</span><span class="cx">                 // Do the shortcode (only the [embed] one is registered)
</span><span class="cx">                 $content = do_shortcode( $content );
</span><span class="lines">@@ -1293,8 +1292,7 @@
</span><span class="cx">                         $this-&gt;usecache = false;
</span><span class="cx"> 
</span><span class="cx">                         $content = $this-&gt;run_shortcode( $post-&gt;post_content );
</span><del>-                        if ( get_option('embed_autourls') )
-                                $this-&gt;autoembed( $content );
</del><ins>+                        $this-&gt;autoembed( $content );
</ins><span class="cx"> 
</span><span class="cx">                         $this-&gt;usecache = true;
</span><span class="cx">                 }
</span><span class="lines">@@ -1309,7 +1307,7 @@
</span><span class="cx">          * @return string Potentially modified $content.
</span><span class="cx">          */
</span><span class="cx">         function autoembed( $content ) {
</span><del>-                return preg_replace_callback( '|^\s*(https?://[^\s&quot;]+)\s*$|im', array(&amp;$this, 'autoembed_callback'), $content );
</del><ins>+                return preg_replace_callback( '|^\s*(https?://[^\s&quot;]+)\s*$|im', array( $this, 'autoembed_callback' ), $content );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><span class="lines">@@ -1367,31 +1365,27 @@
</span><span class="cx"> /**
</span><span class="cx">  * Create default array of embed parameters.
</span><span class="cx">  *
</span><ins>+ * The width defaults to the content width as specified by the theme. If the
+ * theme does not specify a content width, then 500px is used.
+ *
+ * The default height is 1.5 times the width, or 1000px, whichever is smaller.
+ *
+ * The 'embed_defaults' filter can be used to adjust either of these values.
+ *
</ins><span class="cx">  * @since 2.9.0
</span><span class="cx">  *
</span><span class="cx">  * @return array Default embed parameters.
</span><span class="cx">  */
</span><span class="cx"> function wp_embed_defaults() {
</span><del>-        if ( !empty($GLOBALS['content_width']) )
-                $theme_width = (int) $GLOBALS['content_width'];
</del><ins>+        if ( ! empty( $GLOBALS['content_width'] ) )
+                $width = (int) $GLOBALS['content_width'];
</ins><span class="cx"> 
</span><del>-        $width = get_option('embed_size_w');
-
-        if ( empty($width) &amp;&amp; !empty($theme_width) )
-                $width = $theme_width;
-
-        if ( empty($width) )
</del><ins>+        if ( empty( $width ) )
</ins><span class="cx">                 $width = 500;
</span><span class="cx"> 
</span><del>-        $height = get_option('embed_size_h');
</del><ins>+        $height = min( ceil( $width * 1.5 ), 1000 );
</ins><span class="cx"> 
</span><del>-        if ( empty($height) )
-                $height = 700;
-
-        return apply_filters( 'embed_defaults', array(
-                'width'  =&gt; $width,
-                'height' =&gt; $height,
-        ) );
</del><ins>+        return apply_filters( 'embed_defaults', compact( 'width', 'height' ) );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkwpincludesversionphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/version.php (21997 => 21998)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/version.php        2012-09-25 07:05:48 UTC (rev 21997)
+++ trunk/wp-includes/version.php        2012-09-25 07:10:09 UTC (rev 21998)
</span><span class="lines">@@ -11,7 +11,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @global int $wp_db_version
</span><span class="cx">  */
</span><del>-$wp_db_version = 21823;
</del><ins>+$wp_db_version = 21998;
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * Holds the TinyMCE version
</span></span></pre>
</div>
</div>

</body>
</html>