<!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>[32994] trunk/src: Introducing Site Icon, favicon management for WordPress.</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" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/32994">32994</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/32994","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>obenland</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-06-29 12:57:35 +0000 (Mon, 29 Jun 2015)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Introducing Site Icon, favicon management for WordPress.

This v1 marries Jetpack's Site Icon module with the Media Modal, reusing code
from the Custom Header admin. For now, the core-provided icons will be limited
to a favicon, an iOS app icon, and a Windows tile icon, leaving `.ico` support
and additional icons to plugins to add.

Props obenland, tyxla, flixos90, jancbeck, markjaquith, scruffian.
See <a href="https://core.trac.wordpress.org/ticket/16434">#16434</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincsswpadmincss">trunk/src/wp-admin/css/wp-admin.css</a></li>
<li><a href="#trunksrcwpadminincludesadminphp">trunk/src/wp-admin/includes/admin.php</a></li>
<li><a href="#trunksrcwpadminincludestemplatephp">trunk/src/wp-admin/includes/template.php</a></li>
<li><a href="#trunksrcwpadminoptionsgeneralphp">trunk/src/wp-admin/options-general.php</a></li>
<li><a href="#trunksrcwpadminoptionsphp">trunk/src/wp-admin/options.php</a></li>
<li><a href="#trunksrcwpincludesdefaultfiltersphp">trunk/src/wp-includes/default-filters.php</a></li>
<li><a href="#trunksrcwpincludesfeedphp">trunk/src/wp-includes/feed.php</a></li>
<li><a href="#trunksrcwpincludesformattingphp">trunk/src/wp-includes/formatting.php</a></li>
<li><a href="#trunksrcwpincludesgeneraltemplatephp">trunk/src/wp-includes/general-template.php</a></li>
<li><a href="#trunksrcwpincludesscriptloaderphp">trunk/src/wp-includes/script-loader.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincsssiteiconcss">trunk/src/wp-admin/css/site-icon.css</a></li>
<li><a href="#trunksrcwpadminimagesbrowserpng">trunk/src/wp-admin/images/browser.png</a></li>
<li><a href="#trunksrcwpadminincludessiteiconphp">trunk/src/wp-admin/includes/site-icon.php</a></li>
<li><a href="#trunksrcwpadminjssiteiconcropjs">trunk/src/wp-admin/js/site-icon-crop.js</a></li>
<li><a href="#trunksrcwpadminjssiteiconjs">trunk/src/wp-admin/js/site-icon.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincsssiteiconcss"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/wp-admin/css/site-icon.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/css/site-icon.css                              (rev 0)
+++ trunk/src/wp-admin/css/site-icon.css        2015-06-29 12:57:35 UTC (rev 32994)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,57 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/*------------------------------------------------------------------------------
+  28.0 - Site Icon
+------------------------------------------------------------------------------*/
+
+.site-icon-image {
+       float: left;
+       margin: 0 20px 0 0;
+}
+
+.site-icon-content {
+       overflow: hidden;
+       padding: 10px;
+       position: relative;
+}
+
+.site-icon-crop-shell {
+       max-width: 720px;
+}
+
+.site-icon-crop-preview-shell {
+       float: right;
+       overflow: hidden;
+}
+
+.site-icon-crop-preview-shell h3 {
+       margin-top: 0;
+}
+
+.site-icon-crop-favicon-preview-shell {
+       margin-bottom: 20px;
+       position: relative;
+}
+
+.site-icon-crop-preview-favicon,
+.site-icon-browser-title {
+       height: 16px;
+       left: 88px;
+       overflow: hidden;
+       position: absolute;
+       top: 16px;
+}
+
+.site-icon-crop-preview-favicon {
+       width: 16px;
+}
+
+.site-icon-browser-title {
+       left: 109px;
+}
+
+.site-icon-crop-preview-homeicon {
+       -webkit-border-radius: 16px;
+       border-radius: 16px;
+       height: 64px;
+       overflow: hidden;
+       width: 64px;
+} 
</ins></span></pre></div>
<a id="trunksrcwpadmincsswpadmincss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/css/wp-admin.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/css/wp-admin.css       2015-06-29 02:06:25 UTC (rev 32993)
+++ trunk/src/wp-admin/css/wp-admin.css 2015-06-29 12:57:35 UTC (rev 32994)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,4 +10,5 @@
</span><span class="cx" style="display: block; padding: 0 10px"> @import url(about.css);
</span><span class="cx" style="display: block; padding: 0 10px"> @import url(nav-menus.css);
</span><span class="cx" style="display: block; padding: 0 10px"> @import url(widgets.css);
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+@import url(site-icon.css);
</ins><span class="cx" style="display: block; padding: 0 10px"> @import url(l10n.css);
</span></span></pre></div>
<a id="trunksrcwpadminimagesbrowserpng"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/wp-admin/images/browser.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx" style="display: block; padding: 0 10px">Index: trunk/src/wp-admin/images/browser.png
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- trunk/src/wp-admin/images/browser.png        2015-06-29 02:06:25 UTC (rev 32993)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ trunk/src/wp-admin/images/browser.png 2015-06-29 12:57:35 UTC (rev 32994)
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/src/wp-admin/images/browser.png
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:mime-type</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+application/octet-stream
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunksrcwpadminincludesadminphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/admin.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/admin.php     2015-06-29 02:06:25 UTC (rev 32993)
+++ trunk/src/wp-admin/includes/admin.php       2015-06-29 12:57:35 UTC (rev 32994)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -64,6 +64,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** WordPress User Administration API */
</span><span class="cx" style="display: block; padding: 0 10px"> require_once(ABSPATH . 'wp-admin/includes/user.php');
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/** WordPress Site Icon API */
+require_once(ABSPATH . 'wp-admin/includes/site-icon.php');
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /** WordPress Update Administration API */
</span><span class="cx" style="display: block; padding: 0 10px"> require_once(ABSPATH . 'wp-admin/includes/update.php');
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcwpadminincludessiteiconphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/wp-admin/includes/site-icon.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/site-icon.php                         (rev 0)
+++ trunk/src/wp-admin/includes/site-icon.php   2015-06-29 12:57:35 UTC (rev 32994)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,636 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+/**
+ * Class WP_Site_Icon.
+ *
+ * @since 4.3.0
+ */
+class WP_Site_Icon {
+
+       /**
+        * The minimum size of the site icon.
+        *
+        * @since 4.3.0
+        *
+        * @var int
+        */
+       public $min_size  = 512;
+
+       /**
+        * The size to which to crop the image so that we can display it in the UI nicely.
+        *
+        * @since 4.3.0
+        *
+        * @var int
+        */
+       public $page_crop = 512;
+
+       /**
+        *
+        * @since 4.3.0
+        *
+        * @var array
+        */
+       public $site_icon_sizes = array(
+               /**
+                * Square, medium sized tiles for IE11+.
+                *
+                * @link https://msdn.microsoft.com/library/dn455106(v=vs.85).aspx
+                */
+               270,
+
+               /**
+                * App icons up to iPhone 6 Plus.
+                *
+                * @link https://developer.apple.com/library/prerelease/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html
+                */
+               180,
+
+               // Our regular Favicon.
+               32,
+       );
+
+       /**
+        * Register our actions and filters.
+        *
+        * @since 4.3.0
+        */
+       public function __construct() {
+
+               // Add the favicon to the backend.
+               add_action( 'admin_head', 'wp_site_icon' );
+
+               add_action( 'admin_menu', array( $this, 'admin_menu_upload_site_icon' ) );
+
+               add_action( 'admin_action_set_site_icon',    array( $this, 'set_site_icon'    ) );
+               add_action( 'admin_action_remove_site_icon', array( $this, 'remove_site_icon' ) );
+
+               add_action( 'delete_attachment', array( $this, 'delete_attachment_data' ), 10, 1 );
+               add_filter( 'get_post_metadata', array( $this, 'get_post_metadata' ), 10, 4 );
+       }
+
+       /**
+        * Add a hidden upload page.
+        *
+        * There is no need to access it directly.
+        *
+        * @since 4.3.0
+        */
+       public function admin_menu_upload_site_icon() {
+               $hook = add_submenu_page( null, __( 'Site Icon' ), __( 'Site Icon' ), 'manage_options', 'site-icon', array( $this, 'upload_site_icon_page' ) );
+
+               add_action( "load-$hook", array( $this, 'add_upload_settings' ) );
+               add_action( "admin_print_scripts-$hook", array( $this, 'enqueue_scripts' ) );
+       }
+
+       /**
+        * Add scripts to admin settings pages.
+        *
+        * @since 4.3.0
+        */
+       public function enqueue_scripts() {
+               wp_enqueue_style( 'jcrop' );
+               wp_enqueue_script( 'site-icon-crop' );
+       }
+
+       /**
+        * Load on when the admin is initialized.
+        *
+        * @since 4.3.0
+        */
+       public function add_upload_settings() {
+               add_settings_section( 'site-icon-upload', false, false, 'site-icon-upload' );
+               add_settings_field( 'site-icon-upload', __( 'Upload Image' ), array( $this, 'upload_field' ), 'site-icon-upload', 'site-icon-upload', array(
+                       'label_for' => 'site-icon-upload',
+               ) );
+       }
+
+       /**
+        * Removes site icon.
+        *
+        * @since 4.3.0
+        */
+       public function remove_site_icon() {
+               check_admin_referer( 'remove-site-icon' );
+
+               $this->delete_site_icon();
+
+               add_settings_error( 'site-icon', 'icon-removed', __( 'Site Icon removed.' ), 'updated' );
+       }
+
+       /**
+        * Uploading a site_icon is a 3 step process
+        *
+        * 1. Select the file to upload
+        * 2. Crop the file
+        * 3. Confirmation
+        *
+        * @since 4.3.0
+        */
+       public function upload_site_icon_page() {
+               $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'select_site_icon';
+
+               switch ( $action ) {
+                       case 'select_site_icon':
+                               $this->select_page();
+                               break;
+
+                       case 'crop_site_icon':
+                               $this->crop_page();
+                               break;
+
+                       default:
+                               wp_safe_redirect( admin_url( 'options-general.php#site-icon' ) );
+                               exit;
+               }
+       }
+
+       /**
+        * Displays the site_icon form to upload the image.
+        *
+        * @since 4.3.0
+        */
+       public function select_page() {
+               ?>
+               <div class="wrap">
+                       <h2><?php _e( 'Add Site Icon' ); ?></h2>
+                       <?php settings_errors( 'site-icon' ); ?>
+                       <?php do_settings_sections( 'site-icon-upload' ); ?>
+               </div>
+       <?php
+       }
+
+       /**
+        * Settings field for file upload.
+        *
+        * @since 4.3.0
+        */
+       public function upload_field() {
+               wp_enqueue_media();
+               wp_enqueue_script( 'site-icon' );
+               wp_dequeue_script( 'site-icon-crop' );
+
+               $update_url = esc_url( add_query_arg( array(
+                       'page' => 'site-icon',
+                       'action' => 'crop_site_icon',
+               ), wp_nonce_url( admin_url( 'options-general.php' ), 'crop-site-icon' ) ) );
+               ?>
+               <p class="hide-if-no-js">
+                       <label class="screen-reader-text" for="choose-from-library-link"><?php _e( 'Choose an image from your media library:' ); ?></label>
+                       <button type="button" id="choose-from-library-link" class="button" data-update-link="<?php echo esc_attr( $update_url ); ?>" data-choose="<?php esc_attr_e( 'Choose a Site Icon' ); ?>" data-update="<?php esc_attr_e( 'Set as Site Icon' ); ?>"><?php _e( 'Choose Image' ); ?></button>
+               </p>
+               <form class="hide-if-js" action="<?php echo esc_url( admin_url( 'options-general.php?page=site-icon' ) ); ?>" method="post" enctype="multipart/form-data">
+                       <input name="action" value="crop_site_icon" type="hidden" />
+                       <input name="site-icon" type="file" />
+                       <input name="submit" value="<?php esc_attr_e( 'Upload Image' ); ?>" type="submit" class="button button-primary" />
+                       <p class="description">
+                               <?php printf( __( 'The image is recommended to be a square image of at least %spx in both width and height.' ), "<strong>$this->min_size</strong>" ); ?>
+                       </p>
+                       <?php wp_nonce_field( 'crop-site-icon' ); ?>
+               </form>
+       <?php
+       }
+
+       /**
+        * Crop a the image admin view.
+        *
+        * @since 4.3.0
+        */
+       public function crop_page() {
+               check_admin_referer( 'crop-site-icon' );
+
+               if ( isset( $_GET['file'] ) ) {
+                       $attachment_id = absint( $_GET['file'] );
+                       $file          = get_attached_file( $attachment_id, true );
+                       $url           = wp_get_attachment_image_src( $attachment_id, 'full' );
+                       $url           = $url[0];
+               } else {
+                       $upload        = $this->handle_upload();
+                       $attachment_id = $upload['attachment_id'];
+                       $file          = $upload['file'];
+                       $url           = $upload['url'];
+               }
+
+               $image_size = getimagesize( $file );
+
+               if ( $image_size[0] < $this->min_size ) {
+                       add_settings_error( 'site-icon', 'too-small', sprintf( __( 'The selected image is smaller than %upx in width.' ), $this->min_size ) );
+
+                       // back to step one
+                       $this->select_page();
+
+                       return;
+               }
+
+               if ( $image_size[1] < $this->min_size ) {
+                       add_settings_error( 'site-icon', 'too-small', sprintf( __( 'The selected image is smaller than %upx in height.' ), $this->min_size ) );
+
+                       // Back to step one.
+                       $this->select_page();
+
+                       return;
+               }
+
+               // Let's resize the image so that the user can easier crop a image that in the admin view.
+               $crop_height = absint( $this->page_crop * $image_size[1] / $image_size[0] );
+               $cropped = wp_crop_image( $attachment_id, 0, 0, 0, 0, $this->page_crop, $crop_height );
+               if ( ! $cropped || is_wp_error( $cropped ) ) {
+                       wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
+               }
+               $cropped_size = getimagesize( $cropped );
+
+               // set default values (in case of no JS)
+               $crop_ratio = $image_size[0] / $cropped_size[0];
+               if ( $cropped_size[0] < $cropped_size[1] ) {
+                       $crop_x    = 0;
+                       $crop_y    = absint( ( $cropped_size[1] - $cropped_size[0] ) / 2 );
+                       $crop_size = $cropped_size[0];
+               } elseif ( $cropped_size[0] > $cropped_size[1] ) {
+                       $crop_x    = absint( ( $cropped_size[0] - $cropped_size[1] ) / 2 );
+                       $crop_y    = 0;
+                       $crop_size = $cropped_size[1];
+               } else {
+                       $crop_x    = 0;
+                       $crop_y    = 0;
+                       $crop_size = $cropped_size[0];
+               }
+
+               wp_delete_file( $cropped );
+
+               wp_localize_script( 'site-icon-crop', 'wpSiteIconCropData', $this->initial_crop_data( $crop_ratio, $cropped_size ) );
+               ?>
+
+               <div class="wrap">
+                       <h2 class="site-icon-title"><?php _e( 'Site Icon' ); ?></h2>
+                       <?php settings_errors( 'site-icon' ); ?>
+
+                       <div class="site-icon-crop-shell">
+                               <form action="options-general.php" method="post" enctype="multipart/form-data">
+                                       <p class="hide-if-no-js description"><?php _e('Choose the part of the image you want to use as your site icon.'); ?></p>
+                                       <p class="hide-if-js description"><strong><?php _e( 'You need Javascript to choose a part of the image.'); ?></strong></p>
+
+                                       <div class="site-icon-crop-preview-shell hide-if-no-js">
+                                               <h3><?php _e( 'Preview' ); ?></h3>
+                                               <strong><?php _e( 'As your favicon' ); ?></strong>
+                                               <div class="site-icon-crop-favicon-preview-shell">
+                                                       <img src="images/browser.png" class="site-icon-browser-preview" width="182" height="" alt="<?php esc_attr_e( 'Browser Chrome' ); ?>"/>
+
+                                                       <div class="site-icon-crop-preview-favicon">
+                                                               <img src="<?php echo esc_url( $url ); ?>" id="preview-favicon" alt="<?php esc_attr_e( 'Preview Favicon' ); ?>"/>
+                                                       </div>
+                                                       <span class="site-icon-browser-title"><?php bloginfo( 'name' ); ?></span>
+                                               </div>
+
+                                               <strong><?php _e( 'As a mobile icon' ); ?></strong>
+                                               <div class="site-icon-crop-preview-homeicon">
+                                                       <img src="<?php echo esc_url( $url ); ?>" id="preview-homeicon" alt="<?php esc_attr_e( 'Preview Home Icon' ); ?>"/>
+                                               </div>
+                                       </div>
+                                       <img src="<?php echo esc_url( $url ); ?>" id="crop-image" class="site-icon-crop-image" width="<?php echo esc_attr( $cropped_size[0] ); ?>" height="<?php echo esc_attr( $cropped_size[1] ); ?>" alt="<?php esc_attr_e( 'Image to be cropped' ); ?>"/>
+
+                                       <input type="hidden" id="crop-x" name="crop-x" value="<?php echo esc_attr( $crop_x ); ?>" />
+                                       <input type="hidden" id="crop-y" name="crop-y" value="<?php echo esc_attr( $crop_y ); ?>" />
+                                       <input type="hidden" id="crop-width" name="crop-w" value="<?php echo esc_attr( $crop_size ); ?>" />
+                                       <input type="hidden" id="crop-height" name="crop-h" value="<?php echo esc_attr( $crop_size ); ?>" />
+
+                                       <input type="hidden" name="action" value="set_site_icon" />
+                                       <input type="hidden" name="attachment_id" value="<?php echo esc_attr( $attachment_id ); ?>" />
+                                       <input type="hidden" name="crop_ratio" value="<?php echo esc_attr( $crop_ratio ); ?>" />
+                                       <?php if ( empty( $_POST ) && isset( $_GET['file'] ) ) : ?>
+                                               <input type="hidden" name="create-new-attachment" value="true" />
+                                       <?php endif; ?>
+                                       <?php wp_nonce_field( 'set-site-icon' ); ?>
+
+                                       <p class="submit">
+                                               <?php submit_button( __( 'Crop and Publish' ), 'primary hide-if-no-js', 'submit', false ); ?>
+                                               <?php submit_button( __( 'Publish' ), 'primary hide-if-js', 'submit', false ); ?>
+                                               <a class="button secondary" href="options-general.php"><?php _e( 'Cancel' ); ?></a>
+                                       </p>
+                               </form>
+                       </div>
+               </div>
+       <?php
+       }
+
+       /**
+        * Saves a new Site Icon.
+        *
+        * @since 4.3.0
+        */
+       public function set_site_icon() {
+               check_admin_referer( 'set-site-icon' );
+
+               // Delete any existing site icon images.
+               $this->delete_site_icon();
+
+               $attachment_id = absint( $_POST['attachment_id'] );
+
+               // TODO
+               if ( empty( $_POST['skip-cropping'] ) ) {
+                       $crop_ratio = (float) $_POST['crop_ratio'];
+                       $crop_data = $this->convert_coordinates_from_resized_to_full( $_POST['crop-x'], $_POST['crop-y'], $_POST['crop-w'], $_POST['crop-h'], $crop_ratio );
+                       $cropped = wp_crop_image( $attachment_id, $crop_data['crop_x'], $crop_data['crop_y'], $crop_data['crop_width'], $crop_data['crop_height'], $this->min_size, $this->min_size );
+               } elseif ( ! empty( $_POST['create-new-attachment'] ) ) {
+                       $cropped = _copy_image_file( $attachment_id );
+               } else {
+                       $cropped = get_attached_file( $attachment_id );
+               }
+
+               if ( ! $cropped || is_wp_error( $cropped ) ) {
+                       wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
+               }
+
+               $object = $this->create_attachment_object( $cropped, $attachment_id );
+
+               if ( ! empty( $_POST['create-new-attachment'] ) ) {
+                       unset( $object['ID'] );
+               }
+
+               // Update the attachment
+               add_filter( 'intermediate_image_sizes_advanced', array( $this, 'additional_sizes' ) );
+               $attachment_id = $this->insert_attachment( $object, $cropped );
+               remove_filter( 'intermediate_image_sizes_advanced', array( $this, 'additional_sizes' ) );
+
+               // Save the site_icon data into option
+               update_option( 'site_icon', $attachment_id );
+
+               add_settings_error( 'site-icon', 'icon-updated', __( 'Site Icon updated.' ), 'updated' );
+       }
+
+       /**
+        * This function is used to pass data to the localize script
+        * so that we can center the cropper and also set the minimum
+        * cropper.
+        *
+        * @since 4.3.0
+        *
+        * @param float $ratio
+        * @param array $cropped_size
+        * @return array
+        */
+       public function initial_crop_data( $ratio, $cropped_size ) {
+               $init_x = $init_y = $init_size = 0;
+
+               $min_crop_size  = ( $this->min_size / $ratio );
+               $resized_width  = $cropped_size[0];
+               $resized_height = $cropped_size[1];
+
+               // Landscape format ( width > height )
+               if ( $resized_width > $resized_height ) {
+                       $init_x    = ( $this->page_crop - $resized_height ) / 2;
+                       $init_size = $resized_height;
+               }
+
+               // Portrait format ( height > width )
+               if ( $resized_width < $resized_height ) {
+                       $init_y    = ( $this->page_crop - $resized_width ) / 2;
+                       $init_size = $resized_height;
+               }
+
+               // Square height == width
+               if ( $resized_width == $resized_height ) {
+                       $init_size = $resized_height;
+               }
+
+               return array(
+                       'init_x'    => $init_x,
+                       'init_y'    => $init_y,
+                       'init_size' => $init_size,
+                       'min_size'  => $min_crop_size,
+               );
+       }
+
+       /**
+        * Converts the coordinates from the downsized image to the original image for accurate cropping.
+        *
+        * @since 4.3.0
+        *
+        * @param int   $crop_x
+        * @param int   $crop_y
+        * @param int   $crop_width
+        * @param int   $crop_height
+        * @param float $ratio
+        * @return array
+        */
+       public function convert_coordinates_from_resized_to_full( $crop_x, $crop_y, $crop_width, $crop_height, $ratio ) {
+               return array(
+                       'crop_x'      => floor( $crop_x * $ratio ),
+                       'crop_y'      => floor( $crop_y * $ratio ),
+                       'crop_width'  => floor( $crop_width * $ratio ),
+                       'crop_height' => floor( $crop_height * $ratio ),
+               );
+       }
+
+       /**
+        * Upload the file to be cropped in the second step.
+        *
+        * @since 4.3.0
+        */
+       public function handle_upload() {
+               $uploaded_file = $_FILES['site-icon'];
+               $file_type     = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'] );
+               if ( ! wp_match_mime_types( 'image', $file_type['type'] ) ) {
+                       wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) );
+               }
+
+               $file = wp_handle_upload( $uploaded_file, array( 'test_form' => false ) );
+
+               if ( isset( $file['error'] ) ) {
+                       wp_die( $file['error'], __( 'Image Upload Error' ) );
+               }
+
+               $url      = $file['url'];
+               $type     = $file['type'];
+               $file     = $file['file'];
+               $filename = basename( $file );
+
+               // Construct the object array
+               $object = array(
+                       'post_title'     => $filename,
+                       'post_content'   => $url,
+                       'post_mime_type' => $type,
+                       'guid'           => $url,
+                       'context'        => 'site-icon',
+               );
+
+               // Save the data
+               $attachment_id = wp_insert_attachment( $object, $file );
+
+               return compact( 'attachment_id', 'file', 'filename', 'url', 'type' );
+       }
+
+       /**
+        * Create an attachment 'object'.
+        *
+        * @since 4.3.0
+        *
+        * @param string $cropped              Cropped image URL.
+        * @param int    $parent_attachment_id Attachment ID of parent image.
+        * @return array Attachment object.
+        */
+       public function create_attachment_object( $cropped, $parent_attachment_id ) {
+               $parent     = get_post( $parent_attachment_id );
+               $parent_url = $parent->guid;
+               $url        = str_replace( basename( $parent_url ), basename( $cropped ), $parent_url );
+
+               $size       = @getimagesize( $cropped );
+               $image_type = ( $size ) ? $size['mime'] : 'image/jpeg';
+
+               $object = array(
+                       'ID'             => $parent_attachment_id,
+                       'post_title'     => basename( $cropped ),
+                       'post_content'   => $url,
+                       'post_mime_type' => $image_type,
+                       'guid'           => $url,
+                       'context'        => 'site-icon'
+               );
+
+               return $object;
+       }
+
+       /**
+        * Insert an attachment and its metadata.
+        *
+        * @since 4.3.0
+        *
+        * @param array  $object  Attachment object.
+        * @param string $cropped Cropped image URL.
+        * @return int Attachment ID.
+        */
+       public function insert_attachment( $object, $cropped ) {
+               $attachment_id = wp_insert_attachment( $object, $cropped );
+               $metadata      = wp_generate_attachment_metadata( $attachment_id, $cropped );
+
+               /**
+                * Filter the site icon attachment metadata.
+                *
+                * @since 4.3.0
+                *
+                * @see wp_generate_attachment_metadata()
+                *
+                * @param array $metadata Attachment metadata.
+                */
+               $metadata = apply_filters( 'site_icon_attachment_metadata', $metadata );
+               wp_update_attachment_metadata( $attachment_id, $metadata );
+
+               return $attachment_id;
+       }
+
+       /**
+        * Add additional sizes to be made when creating the site_icon images.
+        *
+        * @since 4.3.0
+        *
+        * @param array $sizes
+        * @return array
+        */
+       public function additional_sizes( $sizes = array() ) {
+               $only_crop_sizes = array();
+
+               /**
+                * Filter the different dimensions that a site icon is saved in.
+                *
+                * @since 4.3.0
+                *
+                * @param array $site_icon_sizes Sizes available for the Site Icon.
+                */
+               $this->site_icon_sizes = apply_filters( 'site_icon_image_sizes', $this->site_icon_sizes );
+
+               // Use a natural sort of numbers.
+               natsort( $this->site_icon_sizes );
+               $this->site_icon_sizes = array_reverse( $this->site_icon_sizes );
+
+               // ensure that we only resize the image into
+               foreach ( $sizes as $name => $size_array ) {
+                       if ( $size_array['crop'] ) {
+                               $only_crop_sizes[ $name ] = $size_array;
+                       }
+               }
+
+               foreach ( $this->site_icon_sizes as $size ) {
+                       if ( $size < $this->min_size ) {
+                               $only_crop_sizes[ 'site_icon-' . $size ] = array(
+                                       'width ' => $size,
+                                       'height' => $size,
+                                       'crop'   => true,
+                               );
+                       }
+               }
+
+               return $only_crop_sizes;
+       }
+
+       /**
+        * Add Site Icon sizes to the array of image sizes on demand.
+        *
+        * @since 4.3.0
+        *
+        * @param array $sizes
+        * @return array
+        */
+       public function intermediate_image_sizes( $sizes = array() ) {
+               /** This filter is documented in wp-admin/includes/site-icon.php */
+               $this->site_icon_sizes = apply_filters( 'site_icon_image_sizes', $this->site_icon_sizes );
+               foreach ( $this->site_icon_sizes as $size ) {
+                       $sizes[] = 'site_icon-' . $size;
+               }
+
+               return $sizes;
+       }
+
+       /**
+        * Deletes all additional image sizes, used for site icons.
+        *
+        * @since 4.3.0
+        *
+        * @return bool
+        */
+       public function delete_site_icon() {
+               // We add the filter to make sure that we also delete all the added images.
+               add_filter( 'intermediate_image_sizes', array( $this, 'intermediate_image_sizes' ) );
+               wp_delete_attachment( get_option( 'site_icon' ), true );
+               remove_filter( 'intermediate_image_sizes', array( $this, 'intermediate_image_sizes' ) );
+
+               return delete_option( 'site_icon' );
+       }
+
+       /**
+        * Deletes the Site Icon when the image file is deleted.
+        *
+        * @since 4.3.0
+        *
+        * @param int $post_id Attachment ID.
+        */
+       public function delete_attachment_data( $post_id ) {
+               $site_icon_id = get_option( 'site_icon' );
+
+               if ( $site_icon_id && $post_id == $site_icon_id ) {
+                       delete_option( 'site_icon' );
+               }
+       }
+
+       /**
+        * Adds custom image sizes when meta data for an image is requested, that happens to be used as Site Icon.
+        *
+        * @since 4.3.0
+        *
+        * @param null|array|string $value    The value get_metadata() should
+        *                                    return - a single metadata value,
+        *                                    or an array of values.
+        * @param int               $post_id  Post ID.
+        * @param string            $meta_key Meta key.
+        * @param string|array      $single   Meta value, or an array of values.
+        * @return array|null|string
+        */
+       public function get_post_metadata( $value, $post_id, $meta_key, $single ) {
+               $site_icon_id = get_option( 'site_icon' );
+
+               if ( $post_id == $site_icon_id && '_wp_attachment_backup_sizes' == $meta_key && $single ) {
+                       add_filter( 'intermediate_image_sizes', array( $this, 'intermediate_image_sizes' ) );
+               }
+
+               return $value;
+       }
+}
+
+$GLOBALS['wp_site_icon'] = new WP_Site_Icon;
</ins></span></pre></div>
<a id="trunksrcwpadminincludestemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/template.php  2015-06-29 02:06:25 UTC (rev 32993)
+++ trunk/src/wp-admin/includes/template.php    2015-06-29 12:57:35 UTC (rev 32994)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1778,13 +1778,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $media_states[] = __( 'Background Image' );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        if ( $post->ID == get_option( 'site_icon' ) ) {
+               $media_states[] = __( 'Site Icon' );
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         /**
</span><span class="cx" style="display: block; padding: 0 10px">         * Filter the default media display states for items in the Media list table.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 3.2.0
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param array $media_states An array of media states. Default 'Header Image',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         *                            'Background Image'.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  *                            'Background Image', 'Site Icon'.
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        $media_states = apply_filters( 'display_media_states', $media_states );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcwpadminjssiteiconcropjs"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/wp-admin/js/site-icon-crop.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/site-icon-crop.js                           (rev 0)
+++ trunk/src/wp-admin/js/site-icon-crop.js     2015-06-29 12:57:35 UTC (rev 32994)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,54 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/* global wpSiteIconCropData, jQuery */
+(function($) {
+       var jcrop_api = {},
+               siteIconCrop = {
+
+               updateCoords : function ( coords ) {
+                       $( '#crop-x' ).val( coords.x );
+                       $( '#crop-y' ).val( coords.y );
+                       $( '#crop-width' ).val( coords.w );
+                       $( '#crop-height' ).val( coords.h );
+
+                       siteIconCrop.showPreview( coords );
+               },
+
+               showPreview : function( coords ){
+                       var rx = 64 / coords.w,
+                               ry = 64 / coords.h,
+                               preview_rx = 16 / coords.w,
+                               preview_ry = 16 / coords.h,
+                               $cropImage = $( '#crop-image' ),
+                               $homeIcon = $( '#preview-homeicon' ),
+                               $favicon = $( '#preview-favicon' );
+
+                       $homeIcon.css({
+                               width: Math.round(rx * $cropImage.attr( 'width' ) ) + 'px',
+                               height: Math.round(ry * $cropImage.attr( 'height' ) ) + 'px',
+                               marginLeft: '-' + Math.round(rx * coords.x) + 'px',
+                               marginTop: '-' + Math.round(ry * coords.y) + 'px'
+                       });
+
+                       $favicon.css({
+                               width: Math.round( preview_rx *  $cropImage.attr( 'width' ) ) + 'px',
+                               height: Math.round( preview_ry * $cropImage.attr( 'height' ) ) + 'px',
+                               marginLeft: '-' + Math.round( preview_rx * coords.x ) + 'px',
+                               marginTop: '-' + Math.floor( preview_ry* coords.y ) + 'px'
+                       });
+               },
+
+               ready: function() {
+                       jcrop_api = $.Jcrop( '#crop-image' );
+                       jcrop_api.setOptions({
+                               aspectRatio: 1,
+                               onSelect: siteIconCrop.updateCoords,
+                               onChange: siteIconCrop.updateCoords,
+                               minSize: [ wpSiteIconCropData.min_size, wpSiteIconCropData.min_size ]
+                       });
+                       jcrop_api.animateTo([wpSiteIconCropData.init_x, wpSiteIconCropData.init_y, wpSiteIconCropData.init_size, wpSiteIconCropData.init_size]);
+               }
+
+       };
+
+       siteIconCrop.ready();
+
+})(jQuery);
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpadminjssiteiconjs"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/wp-admin/js/site-icon.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/site-icon.js                                (rev 0)
+++ trunk/src/wp-admin/js/site-icon.js  2015-06-29 12:57:35 UTC (rev 32994)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,49 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+(function($) {
+       var frame;
+
+       $( function() {
+               // Build the choose from library frame.
+               $( '#choose-from-library-link' ).click( function( event ) {
+                       var $el = $(this);
+                       event.preventDefault();
+
+                       // If the media frame already exists, reopen it.
+                       if ( frame ) {
+                               frame.open();
+                               return;
+                       }
+
+                       // Create the media frame.
+                       frame = wp.media.frames.customHeader = wp.media({
+                               // Set the title of the modal.
+                               title: $el.data('choose'),
+
+                               // Tell the modal to show only images.
+                               library: {
+                                       type: 'image'
+                               },
+
+                               // Customize the submit button.
+                               button: {
+                                       // Set the text of the button.
+                                       text: $el.data('update'),
+                                       // Tell the button not to close the modal, since we're
+                                       // going to refresh the page when the image is selected.
+                                       close: false
+                               }
+                       });
+
+                       // When an image is selected, run a callback.
+                       frame.on( 'select', function() {
+                               // Grab the selected attachment.
+                               var attachment = frame.state().get('selection').first(),
+                                       link = $el.data('updateLink');
+
+                               // Tell the browser to navigate to the crop step.
+                               window.location = link + '&file=' + attachment.id;
+                       });
+
+                       frame.open();
+               });
+       });
+}(jQuery));
</ins></span></pre></div>
<a id="trunksrcwpadminoptionsgeneralphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/options-general.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/options-general.php    2015-06-29 02:06:25 UTC (rev 32993)
+++ trunk/src/wp-admin/options-general.php      2015-06-29 12:57:35 UTC (rev 32994)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -124,6 +124,48 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <td><input name="blogdescription" type="text" id="blogdescription" aria-describedby="tagline-description" value="<?php form_option('blogdescription'); ?>" class="regular-text" />
</span><span class="cx" style="display: block; padding: 0 10px"> <p class="description" id="tagline-description"><?php _e( 'In a few words, explain what this site is about.' ) ?></p></td>
</span><span class="cx" style="display: block; padding: 0 10px"> </tr>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<tr>
+<th scope="row"><label for="site_icon"><?php _e( 'Site Icon' ); ?></label></th>
+<td>
+       <?php
+       $upload_url = admin_url( 'options-general.php?page=site-icon' );
+       $update_url = esc_url( add_query_arg( array(
+               'page'   => 'site-icon',
+               'action' => 'crop_site_icon',
+       ), wp_nonce_url( admin_url( 'options-general.php' ), 'crop-site-icon' ) ) );
+
+       wp_enqueue_media();
+       wp_enqueue_script( 'site-icon' );
+
+       if ( has_site_icon() ) :
+               $remove_url = add_query_arg( array(
+                       'action' => 'remove_site_icon',
+               ), wp_nonce_url( admin_url( 'options-general.php' ), 'remove-site-icon' ) );
+       ?>
+
+       <img class="avatar avatar-150" src="<?php site_icon_url( null, 150 ); ?>" height="150" width="150" />
+       <p class="hide-if-no-js">
+               <label class="screen-reader-text" for="choose-from-library-link"><?php _e( 'Choose an image from your media library:' ); ?></label>
+               <button type="button" id="choose-from-library-link" class="button" data-update-link="<?php echo esc_attr( $update_url ); ?>" data-choose="<?php esc_attr_e( 'Choose a Site Icon' ); ?>" data-update="<?php esc_attr_e( 'Set as Site Icon' ); ?>"><?php _e( 'Update Site Icon' ); ?></button>
+               <a href="<?php echo esc_url( $remove_url ); ?>"><?php _e( 'Remove Site Icon' ); ?></a>
+       </p>
+       <p class="hide-if-js">
+               <a href="<?php echo esc_url( $upload_url ); ?>" class="button"><?php _e( 'Update Site Icon' ); ?></a>
+               <a href="<?php echo esc_url( $remove_url ); ?>"><?php _e( 'Remove Site Icon' ); ?></a>
+       </p>
+
+       <?php else : ?>
+
+       <p class="hide-if-no-js">
+               <label class="screen-reader-text" for="choose-from-library-link"><?php _e( 'Choose an image from your media library:' ); ?></label>
+               <button type="button" id="choose-from-library-link" class="button" data-update-link="<?php echo esc_attr( $update_url ); ?>" data-choose="<?php esc_attr_e( 'Choose a Site Icon' ); ?>" data-update="<?php esc_attr_e( 'Set as Site Icon' ); ?>"><?php _e( 'Choose Image' ); ?></button>
+       </p>
+       <a class="button hide-if-js" href="<?php echo esc_url( $upload_url ); ?>"><?php _e( 'Add a Site Icon' ); ?></a>
+
+       <?php endif; ?>
+       <p class="description"><?php _e( 'Site Icon creates a favicon and app icons for your site.' ) ?></p>
+</td>
+</tr>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php if ( !is_multisite() ) { ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <tr>
</span><span class="cx" style="display: block; padding: 0 10px"> <th scope="row"><label for="siteurl"><?php _e('WordPress Address (URL)') ?></label></th>
</span></span></pre></div>
<a id="trunksrcwpadminoptionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/options.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/options.php    2015-06-29 02:06:25 UTC (rev 32993)
+++ trunk/src/wp-admin/options.php      2015-06-29 12:57:35 UTC (rev 32994)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -72,7 +72,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> $whitelist_options = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'general' => array( 'blogname', 'blogdescription', 'site_icon', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG' ),
</ins><span class="cx" style="display: block; padding: 0 10px">         'discussion' => 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><span class="cx" style="display: block; padding: 0 10px">        'media' => 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' ),
</span><span class="cx" style="display: block; padding: 0 10px">        'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public' ),
</span></span></pre></div>
<a id="trunksrcwpincludesdefaultfiltersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/default-filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/default-filters.php 2015-06-29 02:06:25 UTC (rev 32993)
+++ trunk/src/wp-includes/default-filters.php   2015-06-29 12:57:35 UTC (rev 32994)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -222,8 +222,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wp_head',             'wp_print_head_scripts',            9    );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wp_head',             'wp_generator'                           );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wp_head',             'rel_canonical'                          );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_action( 'wp_head',             'wp_shortlink_wp_head',            10, 0 );
+add_action( 'wp_head',             'wp_site_icon',                    99    );
</ins><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wp_footer',           'wp_print_footer_scripts',         20    );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-add_action( 'wp_head',             'wp_shortlink_wp_head',            10, 0 );
</del><span class="cx" style="display: block; padding: 0 10px"> add_action( 'template_redirect',   'wp_shortlink_header',             11, 0 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wp_print_footer_scripts', '_wp_footer_scripts'                 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'init',                'check_theme_switched',            99    );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -243,6 +244,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">        add_action( $action, 'the_generator' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+// Feed Site Icon
+add_action( 'atom_head', 'atom_site_icon' );
+add_action( 'rss2_head', 'rss2_site_icon' );
+
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // WP Cron
</span><span class="cx" style="display: block; padding: 0 10px"> if ( !defined( 'DOING_CRON' ) )
</span><span class="cx" style="display: block; padding: 0 10px">        add_action( 'init', 'wp_cron' );
</span></span></pre></div>
<a id="trunksrcwpincludesfeedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/feed.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/feed.php    2015-06-29 02:06:25 UTC (rev 32993)
+++ trunk/src/wp-includes/feed.php      2015-06-29 12:57:35 UTC (rev 32994)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -588,6 +588,42 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Display Site Icon in atom feeds.
+ *
+ * @since 4.3.0
+ */
+function atom_site_icon() {
+       $url = get_site_icon_url( null, 32 );
+       if ( $url ) {
+               echo "<icon>$url</icon>\n";
+       }
+}
+
+/**
+ * Display Site Icon in RSS2.
+ *
+ * @since 4.3.0
+ */
+function rss2_site_icon() {
+       $rss_title = get_wp_title_rss();
+       if ( empty( $rss_title ) ) {
+               $rss_title = get_bloginfo_rss( 'name' );
+       }
+
+       $url = get_site_icon_url( null, 32 );
+       if ( $url ) {
+               echo '
+<image>
+       <url>' . convert_chars( $url ) . '</url>
+       <title>' . $rss_title . '</title>
+       <link>' . get_bloginfo_rss( 'url' ) . '</link>
+       <width>32</width>
+       <height>32</height>
+</image> ' . "\n";
+       }
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Display the link for the currently displayed feed in a XSS safe way.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * Generate a correct link for the atom:self element.
</span></span></pre></div>
<a id="trunksrcwpincludesformattingphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/formatting.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/formatting.php      2015-06-29 02:06:25 UTC (rev 32993)
+++ trunk/src/wp-includes/formatting.php        2015-06-29 12:57:35 UTC (rev 32994)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3421,6 +3421,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                case 'thread_comments_depth':
</span><span class="cx" style="display: block; padding: 0 10px">                case 'users_can_register':
</span><span class="cx" style="display: block; padding: 0 10px">                case 'start_of_week':
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                case 'site_icon':
</ins><span class="cx" style="display: block; padding: 0 10px">                         $value = absint( $value );
</span><span class="cx" style="display: block; padding: 0 10px">                        break;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcwpincludesgeneraltemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/general-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/general-template.php        2015-06-29 02:06:25 UTC (rev 32993)
+++ trunk/src/wp-includes/general-template.php  2015-06-29 12:57:35 UTC (rev 32994)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -722,6 +722,58 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Returns the Site Icon URL.
+ *
+ * @param  null|int $blog_id Id of the blog to get the site icon for.
+ * @param  int      $size    Size of the site icon.
+ * @param  string   $url     Fallback url if no site icon is found.
+ * @return string            Site Icon URL.
+ */
+function get_site_icon_url( $blog_id = null, $size = 512, $url = '' ) {
+       if ( function_exists( 'get_blog_option' ) ) {
+               if ( ! is_int( $blog_id ) ) {
+                       $blog_id = get_current_blog_id();
+               }
+               $site_icon_id = get_blog_option( $blog_id, 'site_icon' );
+       } else {
+               $site_icon_id = get_option( 'site_icon' );
+       }
+
+       if ( $site_icon_id  ) {
+               if ( $size >= 512 ) {
+                       $size_data = 'full';
+               } else {
+                       $size_data = array( $size, $size );
+               }
+               $url_data = wp_get_attachment_image_src( $site_icon_id, $size_data );
+               $url = $url_data[0];
+       }
+
+       return $url;
+}
+
+/**
+ * Displays the Site Icon URL.
+ *
+ * @param null|int $blog_id Id of the blog to get the site icon for.
+ * @param int      $size    Size of the site icon.
+ * @param string   $url     Fallback url if no site icon is found.
+ */
+function site_icon_url( $blog_id = null, $size = 512, $url = '' ) {
+       echo esc_url( get_site_icon_url( $blog_id, $size, $url ) );
+}
+
+/**
+ * Whether the site has a Site Icon.
+ *
+ * @param int|null $blog_id Optional. Blog ID. Default: Current blog.
+ * @return bool
+ */
+function has_site_icon( $blog_id = null ) {
+       return !! get_site_icon_url( $blog_id, 512 );
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Display title tag with contents.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @ignore
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2386,6 +2438,39 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Display site icon meta tags.
+ *
+ * @since 4.3.0
+ *
+ * @link http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#rel-icon HTML5 specification link icon.
+ */
+function wp_site_icon() {
+       if ( ! has_site_icon() ) {
+               return;
+       }
+
+       $meta_tags = array(
+               sprintf( '<link rel="icon" href="%s" sizes="32x32" />', esc_url( get_site_icon_url( null, 32 ) ) ),
+               sprintf( '<link rel="apple-touch-icon-precomposed" href="%s">', esc_url( get_site_icon_url( null, 180 ) ) ),
+               sprintf( '<meta name="msapplication-TileImage" content="%s">', esc_url( get_site_icon_url( null, 270 ) ) ),
+       );
+
+       /**
+        * Filters the site icon meta tags, so Plugins can add their own.
+        *
+        * @since 4.3.0
+        *
+        * @param array $meta_tags Site Icon meta elements.
+        */
+       $meta_tags = apply_filters( 'site_icon_meta_tags', $meta_tags );
+       $meta_tags = array_filter( $meta_tags );
+
+       foreach ( $meta_tags as $meta_tag ) {
+               echo "$meta_tag\n";
+       }
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Whether the user should have a WYSIWIG editor.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * Checks that the user requires a WYSIWIG editor and that the editor is
</span></span></pre></div>
<a id="trunksrcwpincludesscriptloaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/script-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/script-loader.php   2015-06-29 02:06:25 UTC (rev 32993)
+++ trunk/src/wp-includes/script-loader.php     2015-06-29 12:57:35 UTC (rev 32994)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -612,6 +612,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'untitled' => _x( '(no label)', 'missing menu item navigation label' )
</span><span class="cx" style="display: block; padding: 0 10px">                ) );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $scripts->add( 'site-icon', '/wp-admin/js/site-icon.js', array( 'jquery' ), false, 1 );
+               $scripts->add( 'site-icon-crop', '/wp-admin/js/site-icon-crop.js', array( 'jcrop' ), false, 1 );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $scripts->add( 'custom-header', "/wp-admin/js/custom-header.js", array( 'jquery-masonry' ), false, 1 );
</span><span class="cx" style="display: block; padding: 0 10px">                $scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array( 'wp-color-picker', 'media-views' ), false, 1 );
</span><span class="cx" style="display: block; padding: 0 10px">                $scripts->add( 'media-gallery', "/wp-admin/js/media-gallery$suffix.js", array('jquery'), false, 1 );
</span></span></pre>
</div>
</div>

</body>
</html>