<!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>[26690] trunk/src/wp-admin/includes: Dashboard backwards compatibility updates.</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/26690">26690</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2013-12-05 21:22:20 +0000 (Thu, 05 Dec 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Dashboard backwards compatibility updates.
 * Restore missing wp_dashboard_rss_control() helper.
 * Restore all original 3.7 functions, deprecating many, reusing others. 
 * Rename and remove functions so as not to clash with the original dash plugin.
 * Filter cleanup/restoration.

see <a href="http://core.trac.wordpress.org/ticket/25824">#25824</a>, <a href="http://core.trac.wordpress.org/ticket/26334">#26334</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesdashboardphp">trunk/src/wp-admin/includes/dashboard.php</a></li>
<li><a href="#trunksrcwpadminincludesdeprecatedphp">trunk/src/wp-admin/includes/deprecated.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesdashboardphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/dashboard.php (26689 => 26690)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/dashboard.php        2013-12-05 21:02:11 UTC (rev 26689)
+++ trunk/src/wp-admin/includes/dashboard.php   2013-12-05 21:22:20 UTC (rev 26690)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> 
</span><span class="cx">  // Activity Widget
</span><span class="cx">  if ( is_blog_admin() ) {
</span><del>-               wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_activity' );
</del><ins>+                wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_site_activity' );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  // QuickPress Widget
</span><span class="lines">@@ -343,17 +343,28 @@
</span><span class="cx"> 
</span><span class="cx">  </form>
</span><span class="cx">  <?php
</span><del>-       $query_args = array(
-               'post_type'      => 'post',
-               'post_status'    => 'draft',
-               'author'         => get_current_user_id(),
-               'posts_per_page' => 4,
-               'orderby'        => 'modified',
-               'order'          => 'DESC'
-       );
-       $drafts = get_posts( $query_args );
</del><ins>+        wp_dashboard_recent_drafts();
+}
+
+/**
+ * Show recent drafts of the user on the dashboard.
+ *
+ * @since 2.7.0
+ */
+function wp_dashboard_recent_drafts( $drafts = false ) {
</ins><span class="cx">   if ( ! $drafts ) {
</span><del>-               return;
</del><ins>+                $query_args = array(
+                       'post_type'      => 'post',
+                       'post_status'    => 'draft',
+                       'author'         => get_current_user_id(),
+                       'posts_per_page' => 4,
+                       'orderby'        => 'modified',
+                       'order'          => 'DESC'
+               );
+               $drafts = get_posts( $query_args );
+               if ( ! $drafts ) {
+                       return;
+               }
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  echo '<div class="drafts">';
</span><span class="lines">@@ -475,13 +486,11 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 3.8.0
</span><span class="cx">  */
</span><del>-function wp_dashboard_activity() {
</del><ins>+function wp_dashboard_site_activity() {
</ins><span class="cx"> 
</span><span class="cx">  echo '<div id="activity-widget">';
</span><span class="cx"> 
</span><del>-       do_action( 'dashboard_activity_beginning' );
-
-       $future_posts = dashboard_show_published_posts( array(
</del><ins>+        $future_posts = wp_dashboard_recent_posts( array(
</ins><span class="cx">           'display' => 2,
</span><span class="cx">          'max'     => 5,
</span><span class="cx">          'status'  => 'future',
</span><span class="lines">@@ -489,7 +498,7 @@
</span><span class="cx">          'title'   => __( 'Publishing Soon' ),
</span><span class="cx">          'id'      => 'future-posts',
</span><span class="cx">  ) );
</span><del>-       $recent_posts = dashboard_show_published_posts( array(
</del><ins>+        $recent_posts = wp_dashboard_recent_posts( array(
</ins><span class="cx">           'display' => 2,
</span><span class="cx">          'max'     => 5,
</span><span class="cx">          'status'  => 'publish',
</span><span class="lines">@@ -498,10 +507,8 @@
</span><span class="cx">          'id'      => 'published-posts',
</span><span class="cx">  ) );
</span><span class="cx"> 
</span><del>-       do_action( 'dashboard_activity_middle' );
</del><ins>+        $recent_comments = wp_dashboard_recent_comments();
</ins><span class="cx"> 
</span><del>-       $recent_comments = dashboard_comments();
-
</del><span class="cx">   if ( !$future_posts && !$recent_posts && !$recent_comments ) {
</span><span class="cx">          echo '<div class="no-activity">';
</span><span class="cx">          echo '<p class="smiley"></p>';
</span><span class="lines">@@ -509,8 +516,6 @@
</span><span class="cx">          echo '</div>';
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       do_action( 'dashboard_activity_end' );
-
</del><span class="cx">   echo '</div>';
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -521,8 +526,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @param array $args
</span><span class="cx">  */
</span><del>-function dashboard_show_published_posts( $args ) {
-
</del><ins>+function wp_dashboard_recent_posts( $args ) {
</ins><span class="cx">   $query_args = array(
</span><span class="cx">          'post_type'      => 'post',
</span><span class="cx">          'post_status'    => $args['status'],
</span><span class="lines">@@ -532,7 +536,6 @@
</span><span class="cx">          'no_found_rows'  => true,
</span><span class="cx">          'cache_results'  => false
</span><span class="cx">  );
</span><del>-       $query_args = apply_filters( 'dash_show_published_posts_query_args', $query_args );
</del><span class="cx">   $posts = new WP_Query( $query_args );
</span><span class="cx"> 
</span><span class="cx">  if ( $posts->have_posts() ) {
</span><span class="lines">@@ -548,12 +551,25 @@
</span><span class="cx">          echo '<ul>';
</span><span class="cx"> 
</span><span class="cx">          $i = 0;
</span><ins>+               $today    = date( 'Y-m-d', current_time( 'timestamp' ) );
+               $tomorrow = date( 'Y-m-d', strtotime( '+1 day', current_time( 'timestamp' ) ) );
+
</ins><span class="cx">           while ( $posts->have_posts() ) {
</span><span class="cx">                  $posts->the_post();
</span><ins>+
+                       $time = get_the_time( 'U' );
+                       if ( date( 'Y-m-d', $time ) == $today ) {
+                               $relative = __( 'Today' );
+                       } elseif ( date( 'Y-m-d', $time ) == $tomorrow ) {
+                               $relative = __( 'Tomorrow' );
+                       } else {
+                               $relative = date( 'M jS', $time );
+                       }
+
</ins><span class="cx">                   printf(
</span><span class="cx">                          '<li%s><span>%s, %s</span> <a href="%s">%s</a></li>',
</span><span class="cx">                          ( $i >= intval ( $args['display'] ) ? ' class="hidden"' : '' ),
</span><del>-                               dashboard_relative_date( get_the_time( 'U' ) ),
</del><ins>+                                $relative,
</ins><span class="cx">                           get_the_time(),
</span><span class="cx">                          get_edit_post_link(),
</span><span class="cx">                          _draft_or_post_title()
</span><span class="lines">@@ -580,7 +596,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @param int $total_items
</span><span class="cx">  */
</span><del>-function dashboard_comments( $total_items = 5 ) {
</del><ins>+function wp_dashboard_recent_comments( $total_items = 5 ) {
</ins><span class="cx">   global $wpdb;
</span><span class="cx"> 
</span><span class="cx">  // Select all comment types and filter out spam later for better query performance.
</span><span class="lines">@@ -631,28 +647,6 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Return relative date for given timestamp.
- *
- * @since 3.8.0
- *
- * @param int $time Unix $timestamp.
- */
-function dashboard_relative_date( $time ) {
-
-       $today    = date( 'Y-m-d', current_time( 'timestamp' ) );
-       $tomorrow = date( 'Y-m-d', strtotime( '+1 day', current_time( 'timestamp' ) ) );
-
-       if ( date( 'Y-m-d', $time ) == $today )
-               return __( 'Today' );
-
-       if ( date( 'Y-m-d', $time ) == $tomorrow )
-               return __( 'Tomorrow' );
-
-       return date( 'M jS', $time);
-
-}
-
-/**
</del><span class="cx">  * Display generic dashboard RSS widget feed.
</span><span class="cx">  *
</span><span class="cx">  * @since 2.5.0
</span><span class="lines">@@ -735,6 +729,50 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * The RSS dashboard widget control.
+ *
+ * Sets up $args to be used as input to wp_widget_rss_form(). Handles POST data
+ * from RSS-type widgets.
+ *
+ * @since 2.5.0
+ *
+ * @param string $widget_id
+ * @param array $form_inputs
+ */
+function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
+       if ( !$widget_options = get_option( 'dashboard_widget_options' ) )
+               $widget_options = array();
+
+       if ( !isset($widget_options[$widget_id]) )
+               $widget_options[$widget_id] = array();
+
+       $number = 1; // Hack to use wp_widget_rss_form()
+       $widget_options[$widget_id]['number'] = $number;
+
+       if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number]) ) {
+               $_POST['widget-rss'][$number] = wp_unslash( $_POST['widget-rss'][$number] );
+               $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] );
+               $widget_options[$widget_id]['number'] = $number;
+               // title is optional. If black, fill it if possible
+               if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) {
+                       $rss = fetch_feed($widget_options[$widget_id]['url']);
+                       if ( is_wp_error($rss) ) {
+                               $widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed'));
+                       } else {
+                               $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title()));
+                               $rss->__destruct();
+                               unset($rss);
+                       }
+               }
+               update_option( 'dashboard_widget_options', $widget_options );
+               $cache_key = 'dash_' . md5( $widget_id );
+               delete_transient( $cache_key );
+       }
+
+       wp_widget_rss_form( $widget_options[$widget_id], $form_inputs );
+}
+
+/**
</ins><span class="cx">  * WordPress News dashboard widget.
</span><span class="cx">  *
</span><span class="cx">  * @since 2.7.0
</span><span class="lines">@@ -744,7 +782,7 @@
</span><span class="cx">          'news'   => array(
</span><span class="cx">                  'link'         => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/news/' ) ),
</span><span class="cx">                  'url'          => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ),
</span><del>-                       'title'        => '',
</del><ins>+                        'title'        => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ),
</ins><span class="cx">                   'items'        => 1,
</span><span class="cx">                  'show_summary' => 1,
</span><span class="cx">                  'show_author'  => 0,
</span><span class="lines">@@ -753,7 +791,7 @@
</span><span class="cx">          'planet' => array(
</span><span class="cx">                  'link'         => apply_filters( 'dashboard_secondary_link', __( 'http://planet.wordpress.org/' ) ),
</span><span class="cx">                  'url'          => apply_filters( 'dashboard_secondary_feed', __( 'http://planet.wordpress.org/feed/' ) ),
</span><del>-                       'title'        => '',
</del><ins>+                        'title'        => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ),
</ins><span class="cx">                   'items'        => 3,
</span><span class="cx">                  'show_summary' => 0,
</span><span class="cx">                  'show_author'  => 0,
</span></span></pre></div>
<a id="trunksrcwpadminincludesdeprecatedphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/deprecated.php (26689 => 26690)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/deprecated.php       2013-12-05 21:02:11 UTC (rev 26689)
+++ trunk/src/wp-admin/includes/deprecated.php  2013-12-05 21:22:20 UTC (rev 26690)
</span><span class="lines">@@ -1149,3 +1149,28 @@
</span><span class="cx">  return '<!-- Screen icons are no longer used as of WordPress 3.8. -->';
</span><span class="cx"> }
</span><span class="cx"> /**#@-*/
</span><ins>+
+/**#@+
+ * Deprecated dashboard widget controls.
+ *
+ * @since 2.5.0
+ * @deprecated 3.8.0
+ */
+function wp_dashboard_incoming_links_output() {}
+function wp_dashboard_secondary_output() {}
+/**#@-*/
+
+/**#@+
+ * Deprecated dashboard widget controls.
+ *
+ * @since 2.7.0
+ * @deprecated 3.8.0
+ */
+function wp_dashboard_incoming_links() {}
+function wp_dashboard_incoming_links_control() {}
+function wp_dashboard_plugins() {}
+function wp_dashboard_primary_control() {}
+function wp_dashboard_recent_comments_control() {}
+function wp_dashboard_secondary() {}
+function wp_dashboard_secondary_control() {}
+/**#@-*/
</ins></span></pre>
</div>
</div>

</body>
</html>