<!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>[24735] trunk: Allow absolute URLs in editor styles.</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 { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { 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/24735">24735</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2013-07-18 18:11:43 +0000 (Thu, 18 Jul 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Allow absolute URLs in editor styles.

Props nacin, obenland
fixes <a href="http://core.trac.wordpress.org/ticket/24787">#24787</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpcontentthemestwentythirteenfunctionsphp">trunk/wp-content/themes/twentythirteen/functions.php</a></li>
<li><a href="#trunkwpcontentthemestwentythirteeninccustomheaderphp">trunk/wp-content/themes/twentythirteen/inc/custom-header.php</a></li>
<li><a href="#trunkwpincludesclasswpeditorphp">trunk/wp-includes/class-wp-editor.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpcontentthemestwentythirteenfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-content/themes/twentythirteen/functions.php (24734 => 24735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-content/themes/twentythirteen/functions.php     2013-07-18 17:42:53 UTC (rev 24734)
+++ trunk/wp-content/themes/twentythirteen/functions.php        2013-07-18 18:11:43 UTC (rev 24735)
</span><span class="lines">@@ -72,12 +72,13 @@
</span><span class="cx">   * This theme styles the visual editor to resemble the theme style,
</span><span class="cx">   * specifically font, colors, icons, and column width.
</span><span class="cx">   */
</span><del>-       add_editor_style( array( 'css/editor-style.css', 'fonts/genericons.css' ) );
</del><ins>+        add_editor_style( array( 'css/editor-style.css', 'fonts/genericons.css', twentythirteen_fonts_url() ) );
</ins><span class="cx"> 
</span><span class="cx">  // Adds RSS feed links to <head> for posts and comments.
</span><span class="cx">  add_theme_support( 'automatic-feed-links' );
</span><span class="cx"> 
</span><del>-       // Switches default core markup for search form to output valid HTML5.
</del><ins>+        // Switches default core markup for search form, comment form, and comments
+       // to output valid HTML5.
</ins><span class="cx">   add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) );
</span><span class="cx"> 
</span><span class="cx">  /*
</span><span class="lines">@@ -132,73 +133,22 @@
</span><span class="cx">          $font_families = array();
</span><span class="cx"> 
</span><span class="cx">          if ( 'off' !== $source_sans_pro )
</span><del>-                       $font_families[] = 'Source+Sans+Pro:300,400,700,300italic,400italic,700italic';
</del><ins>+                        $font_families[] = 'Source Sans Pro:300,400,700,300italic,400italic,700italic';
</ins><span class="cx"> 
</span><span class="cx">          if ( 'off' !== $bitter )
</span><span class="cx">                  $font_families[] = 'Bitter:400,700';
</span><span class="cx"> 
</span><del>-               $protocol = is_ssl() ? 'https' : 'http';
</del><span class="cx">           $query_args = array(
</span><del>-                       'family' => implode( '|', $font_families ),
-                       'subset' => 'latin,latin-ext',
</del><ins>+                        'family' => urlencode( implode( '|', $font_families ) ),
+                       'subset' => urlencode( 'latin,latin-ext' ),
</ins><span class="cx">           );
</span><del>-               $fonts_url = add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" );
</del><ins>+                $fonts_url = add_query_arg( $query_args, "//fonts.googleapis.com/css" );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  return $fonts_url;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Loads our special font CSS file.
- *
- * To disable in a child theme, use wp_dequeue_style()
- * function mytheme_dequeue_fonts() {
- *     wp_dequeue_style( 'twentythirteen-fonts' );
- * }
- * add_action( 'wp_enqueue_scripts', 'mytheme_dequeue_fonts', 11 );
- *
- * Also used in the Appearance > Header admin panel:
- * @see twentythirteen_custom_header_setup()
- *
- * @since Twenty Thirteen 1.0
- *
- * @return void
- */
-function twentythirteen_fonts() {
-       $fonts_url = twentythirteen_fonts_url();
-       if ( ! empty( $fonts_url ) )
-               wp_enqueue_style( 'twentythirteen-fonts', esc_url_raw( $fonts_url ), array(), null );
-
-       wp_enqueue_style( 'genericons', get_template_directory_uri() . '/fonts/genericons.css', array(), '2.09' );
-}
-add_action( 'wp_enqueue_scripts', 'twentythirteen_fonts' );
-
-/**
- * Adds additional stylesheets to the TinyMCE editor if needed.
- *
- * @uses twentythirteen_fonts_url() to get the Google Font stylesheet URL.
- *
- * @since Twenty Thirteen 1.0
- *
- * @param string $mce_css CSS path to load in TinyMCE.
- * @return string The filtered CSS paths list.
- */
-function twentythirteen_mce_css( $mce_css ) {
-       $fonts_url = twentythirteen_fonts_url();
-
-       if ( empty( $fonts_url ) )
-               return $mce_css;
-
-       if ( ! empty( $mce_css ) )
-               $mce_css .= ',';
-
-       $mce_css .= esc_url_raw( str_replace( ',', '%2C', $fonts_url ) );
-
-       return $mce_css;
-}
-add_filter( 'mce_css', 'twentythirteen_mce_css' );
-
-/**
</del><span class="cx">  * Enqueues scripts and styles for front end.
</span><span class="cx">  *
</span><span class="cx">  * @since Twenty Thirteen 1.0
</span><span class="lines">@@ -208,10 +158,8 @@
</span><span class="cx"> function twentythirteen_scripts_styles() {
</span><span class="cx">  global $wp_styles;
</span><span class="cx"> 
</span><del>-       /*
-        * Adds JavaScript to pages with the comment form to support sites with
-        * threaded comments (when in use).
-        */
</del><ins>+        // Adds JavaScript to pages with the comment form to support sites with
+       // threaded comments (when in use).
</ins><span class="cx">   if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
</span><span class="cx">          wp_enqueue_script( 'comment-reply' );
</span><span class="cx"> 
</span><span class="lines">@@ -222,8 +170,14 @@
</span><span class="cx">  // Loads JavaScript file with functionality specific to Twenty Thirteen.
</span><span class="cx">  wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20130625a', true );
</span><span class="cx"> 
</span><ins>+       // Add Open Sans and Bitter fonts, used in the main stylesheet.
+       wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null );
+
+       // Add Genericons font, used in the main stylesheet.
+       wp_enqueue_style( 'genericons', get_template_directory_uri() . '/fonts/genericons.css', array(), '2.09' );
+
</ins><span class="cx">   // Loads our main stylesheet.
</span><del>-       wp_enqueue_style( 'twentythirteen-style', get_stylesheet_uri() );
</del><ins>+        wp_enqueue_style( 'twentythirteen-style', get_stylesheet_uri(), array( 'genericons' ), '1.0' );
</ins><span class="cx"> 
</span><span class="cx">  // Loads the Internet Explorer specific stylesheet.
</span><span class="cx">  wp_enqueue_style( 'twentythirteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentythirteen-style' ), '20130213' );
</span></span></pre></div>
<a id="trunkwpcontentthemestwentythirteeninccustomheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-content/themes/twentythirteen/inc/custom-header.php (24734 => 24735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-content/themes/twentythirteen/inc/custom-header.php     2013-07-18 17:42:53 UTC (rev 24734)
+++ trunk/wp-content/themes/twentythirteen/inc/custom-header.php        2013-07-18 18:11:43 UTC (rev 24735)
</span><span class="lines">@@ -58,12 +58,24 @@
</span><span class="cx">                  'description'   => _x( 'Star', 'header image description', 'twentythirteen' )
</span><span class="cx">          ),
</span><span class="cx">  ) );
</span><del>-
-       add_action( 'admin_print_styles-appearance_page_custom-header', 'twentythirteen_fonts' );
</del><span class="cx"> }
</span><span class="cx"> add_action( 'after_setup_theme', 'twentythirteen_custom_header_setup' );
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * Loads our special font CSS files.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_custom_header_fonts() {
+       // Add Open Sans and Bitter fonts.
+       wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null );
+
+       // Add Genericons font.
+       wp_enqueue_style( 'genericons', get_template_directory_uri() . '/fonts/genericons.css', array(), '2.09' );
+}
+add_action( 'admin_print_styles-appearance_page_custom-header', 'twentythirteen_custom_header_fonts' );
+
+/**
</ins><span class="cx">  * Styles the header text displayed on the blog.
</span><span class="cx">  *
</span><span class="cx">  * get_header_textcolor() options: Hide text (returns 'blank'), or any hex value.
</span></span></pre></div>
<a id="trunkwpincludesclasswpeditorphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-wp-editor.php (24734 => 24735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-editor.php    2013-07-18 17:42:53 UTC (rev 24734)
+++ trunk/wp-includes/class-wp-editor.php       2013-07-18 18:11:43 UTC (rev 24735)
</span><span class="lines">@@ -152,7 +152,6 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  public static function editor_settings($editor_id, $set) {
</span><del>-               global $editor_styles;
</del><span class="cx">           $first_run = false;
</span><span class="cx"> 
</span><span class="cx">          if ( empty(self::$first_init) ) {
</span><span class="lines">@@ -353,12 +352,23 @@
</span><span class="cx">                          );
</span><span class="cx"> 
</span><span class="cx">                          // load editor_style.css if the current theme supports it
</span><del>-                               if ( ! empty( $editor_styles ) && is_array( $editor_styles ) ) {
</del><ins>+                                if ( ! empty( $GLOBALS['editor_styles'] ) && is_array( $GLOBALS['editor_styles'] ) ) {
+                                       $editor_styles = $GLOBALS['editor_styles'];
+
</ins><span class="cx">                                   $mce_css = array();
</span><del>-                                       $editor_styles = array_unique($editor_styles);
</del><ins>+                                        $editor_styles = array_unique( array_filter( $editor_styles ) );
</ins><span class="cx">                                   $style_uri = get_stylesheet_directory_uri();
</span><span class="cx">                                  $style_dir = get_stylesheet_directory();
</span><span class="cx"> 
</span><ins>+                                       // Support externally referenced styles (like, say, fonts).
+                                       foreach ( $editor_styles as $key => $file ) {
+                                               if ( preg_match( '~^(https?:)?//~', $file ) ) {
+                                                       $mce_css[] = esc_url_raw( $file );
+                                                       unset( $editor_styles[ $key ] );
+                                               }
+                                       }
+
+                                       // Look in a parent theme first, that way child theme CSS overrides.
</ins><span class="cx">                                   if ( is_child_theme() ) {
</span><span class="cx">                                          $template_uri = get_template_directory_uri();
</span><span class="cx">                                          $template_dir = get_template_directory();
</span></span></pre>
</div>
</div>

</body>
</html>