diff --git a/src/wp-admin/css/colors-fresh.css b/src/wp-admin/css/colors-fresh.css index 1c828d91b3..bff24ca0ed 100644 --- a/src/wp-admin/css/colors-fresh.css +++ b/src/wp-admin/css/colors-fresh.css @@ -126,13 +126,7 @@ ul#adminmenu > li.current > a.current:after { border-right-color: #eee; } -#dashboard_right_now .t, -#dashboard_right_now .b { - color: #777; -} - #the-comment-list .comment-item p.row-actions, -#dashboard_recent_comments .subsubsub, .plugins .row-actions-visible, .row-actions { color: #ddd; @@ -552,8 +546,7 @@ div.dashboard-widget-submit input:hover, color: #2ea2cc; } -#the-comment-list .comment-item, -#dashboard-widgets #dashboard_quick_press form p.submit { +#the-comment-list .comment-item { border: none; } @@ -580,9 +573,6 @@ p.submit { table.widefat span.delete a, table.widefat span.trash a, table.widefat span.spam a, -#dashboard_recent_comments .delete a, -#dashboard_recent_comments .trash a, -#dashboard_recent_comments .spam a, .plugins a.delete, #all-plugins-table .plugins a.delete, #search-plugins-table .plugins a.delete, @@ -596,9 +586,6 @@ table.widefat span.spam a, table.widefat span.delete a:hover, table.widefat span.trash a:hover, table.widefat span.spam a:hover, -#dashboard_recent_comments .delete a:hover, -#dashboard_recent_comments .trash a:hover, -#dashboard_recent_comments .spam a:hover, .plugins a.delete:hover, #all-plugins-table .plugins a.delete:hover, #search-plugins-table .plugins a.delete:hover, @@ -771,10 +758,6 @@ div#plugin-information-header { border-color: #666; } -#dashboard_secondary div.dashboard-widget-content ul li a { - background-color: #f9f9f9; -} - input.readonly, textarea.readonly { background-color: #ddd; } @@ -929,20 +912,14 @@ a.post-format-icon:hover:before { } #the-comment-list .unapproved th, -#the-comment-list .unapproved td, -#dashboard_recent_comments #the-comment-list .unapproved { +#the-comment-list .unapproved td { background-color: #fefaf7; } -#the-comment-list .unapproved th.check-column, -#dashboard_recent_comments #the-comment-list .unapproved { +#the-comment-list .unapproved th.check-column { border-left: 4px solid #d54e21; } -#dashboard_recent_comments #the-comment-list .unapproved .avatar { - margin-left: -4px; -} - #the-comment-list .approve a { color: #006505; } @@ -1038,8 +1015,7 @@ p.popular-tags, .postbox h3, #namediv h3, -#submitdiv h3, -#dashboard_recent_comments .comment { +#submitdiv h3 { color: #555; border-bottom: 1px solid #eeeeee; } @@ -1144,11 +1120,11 @@ span.wp-media-buttons-icon:before { color: #333; } -#screen-meta-links a:focus { - border-color: #aaa; - color: #333; - -webkit-box-shadow: 0 2px 3px rgba(0,0,0,0.15); - box-shadow: 0 2px 3px rgba(0,0,0,0.15); +#screen-meta-links a:focus { + border-color: #aaa; + color: #333; + -webkit-box-shadow: 0 2px 3px rgba(0,0,0,0.15); + box-shadow: 0 2px 3px rgba(0,0,0,0.15); } /* end screen options and help tabs */ @@ -1165,10 +1141,7 @@ abbr.required, .widget-control-remove:hover, table.widefat .delete a:hover, table.widefat .trash a:hover, -table.widefat .spam a:hover, -#dashboard_recent_comments .delete a:hover, -#dashboard_recent_comments .trash a:hover -#dashboard_recent_comments .spam a:hover { +table.widefat .spam a:hover { color: #f00; } @@ -2197,13 +2170,7 @@ body.login { border-right: 4px solid #d54e21; } -.rtl #the-comment-list .unapproved th.check-column, -.rtl #dashboard_recent_comments #the-comment-list .unapproved { +.rtl #the-comment-list .unapproved th.check-column { border-left: none; border-right: 4px solid #d54e21; } - -.rtl #dashboard_recent_comments #the-comment-list .unapproved .avatar { - margin-left: 10px; - margin-right: -4px; -} diff --git a/src/wp-admin/css/ie.css b/src/wp-admin/css/ie.css index 7aa668590d..88266891ce 100644 --- a/src/wp-admin/css/ie.css +++ b/src/wp-admin/css/ie.css @@ -141,10 +141,6 @@ table.fixed td { overflow: visible; } -#dashboard-widgets #dashboard_quick_press form p.submit #publish { - float: none; -} - #dashboard-widgets h3 a { height: 14px; line-height: 14px; diff --git a/src/wp-admin/css/wp-admin.css b/src/wp-admin/css/wp-admin.css index d7ffc1eece..ba937b4adf 100644 --- a/src/wp-admin/css/wp-admin.css +++ b/src/wp-admin/css/wp-admin.css @@ -904,7 +904,6 @@ input[readonly] { div.sidebar-name h3, #menu-management .nav-tab, -#dashboard_plugins h5, a.rsswidget, #dashboard_right_now td.b, #dashboard-widgets h4, @@ -1527,8 +1526,8 @@ form.upgrade .hint { margin: 0 20px 0 0; } -#screen-meta-links a { - padding: 3px 6px 3px 16px; +#screen-meta-links a { + padding: 3px 6px 3px 16px; } #screen-meta-links a:focus { @@ -2439,6 +2438,18 @@ html.wp-toolbar { min-height: 250px; } +#dashboard-widgets .postbox-container { + width: 25%; +} + +#dashboard-widgets-wrap .columns-3 #postbox-container-4 .empty-container { + border: none !important; +} + +#dashboard-widgets-wrap { + overflow: hidden; +} + /* one column on the dash */ @media only screen and (max-width: 799px) { #wpbody-content #dashboard-widgets .postbox-container { @@ -2453,7 +2464,7 @@ html.wp-toolbar { } /* two columns on the dash, but keep the setting if one is selected */ -@media only screen and (min-width: 800px) and (max-width: 1200px) { +@media only screen and (min-width: 800px) and (max-width: 1399px) { #wpbody-content #dashboard-widgets .postbox-container { width: 49.5%; } @@ -2494,6 +2505,28 @@ html.wp-toolbar { } } +/* three columns on the dash */ +@media only screen and (min-width: 1400px) and (max-width: 1800px) { + #wpbody-content #dashboard-widgets .postbox-container { + width: 33.5%; + } + + #wpbody-content #dashboard-widgets #postbox-container-1 { + width: 33%; + } + + #wpbody-content #dashboard-widgets #postbox-container-3, + #wpbody-content #dashboard-widgets #postbox-container-4 { + float: right; + } + + #dashboard-widgets #postbox-container-4 .empty-container { + border: 0 none; + height: 0; + min-height: 0; + } +} + /* one column on the post write/edit screen */ @media only screen and (max-width: 850px) { #poststuff { @@ -2633,20 +2666,6 @@ html.wp-toolbar { margin: 0 8px; } -#dashboard_recent_comments div.undo { - margin: 0 -12px; - padding: 6px 12px; - font-size: 11px; -} - -#dashboard_recent_comments div.undo .avatar { - float: left; -} - -#dashboard_recent_comments div.undo div { - min-height: 20px; -} - #the-comment-list td.comment p.comment-author { margin-top: 0; margin-left: 0; @@ -2834,6 +2853,491 @@ html.wp-toolbar { list-style-type: none; } +/* Dashboard WordPress news */ + +#dashboard_rss .inside { + margin: 0; + padding: 0; +} + +#dashboard_rss .widget-loading, +#dashboard_rss .dashboard-widget-control-form { + padding: 12px 12px 0; +} + +body #dashboard-widgets .postbox form .submit { + margin: 0; +} + +.dashboard-widget-control-form { + overflow: hidden; +} + +.dashboard-widget-control-form p { + margin-top: 0; +} + +.rssSummary { + color: #999; + margin-top: 4px; +} + +.rss-widget { + border-bottom: 1px solid #eee; + font-size: 13px; + padding: 8px 12px 12px; +} + +.rss-widget:last-child { + border-bottom: none; + padding-bottom: 0; +} + +.rss-widget a { + font-weight: normal; +} + +.rss-widget span, +.rss-widget span.rss-date { + color: #bbb; +} + +.rss-widget span.rss-date { + margin-left: 12px; +} + +.rss-widget ul li { + margin-bottom: 8px; +} + +/* Dashboard right now */ + +#dash-right-now ul { + margin: 0; + overflow: hidden; +} + +#dash-right-now li { + width: 50%; + float: left; + margin-bottom: 10px; +} + +#dash-right-now .inside { + margin-bottom: 0; + overflow: hidden; + padding: 0; +} + +#dash-right-now .main { + padding: 0 12px; +} + +#dash-right-now .main p { + margin: 0; +} + +.mu-storage { + overflow: hidden; +} + +/* Dashboard right now - Colors */ + +#dash-right-now li a:before { + color: #888; +} + +#dash-right-now .sub { + color: #bfbbbb; + background: #f5f5f5; + border-top-color: #dedede; + padding: 12px 12px 6px 12px; + border-top: 1px solid; +} + +#dash-right-now .sub h4 { + color: #555; +} + +#dash-right-now .sub p { + margin: 0 0 .5em; + font-size: 11px; +} + +#dash-right-now .warning a:before { + color: #d54e21; +} + +/* Dashboard right now - Icons */ +#dash-right-now li a:before { + content: '\f159'; + font: normal 20px/1 'dashicons'; + speak: none; + display: block; + float: left; + margin: 0 5px 0 0; + padding: 0; + text-indent: 0; + text-align: center; + position: relative; + -webkit-font-smoothing: antialiased; + text-decoration: none !important; +} + +#dash-right-now .page-count a:before { + content: '\f105'; +} + +#dash-right-now .post-count a:before { + content: '\f109'; +} + +#dash-right-now .comment-count a:before { + content: '\f101'; +} + +#dash-right-now .comment-mod-count a:before { + content: '\f125'; +} + +#dash-right-now .storage-count a:before { + content: '\f104'; +} + +#dash-right-now .storage-count.warning a:before { + content: '\f153'; +} + +/* Dashboard Quick Draft */ + +#dashboard_quick_draft div.updated { + margin-bottom: 10px; + border: 1px solid #eee; + border-width: 1px 1px 1px 0; +} + +#dashboard_quick_draft form { + padding: 0 12px 1px 12px; + overflow: hidden; +} + +#dashboard_quick_draft .drafts, +#dashboard_quick_draft .easy-blogging { + padding: 8px 12px 0; +} + +#dashboard-widgets .postbox .inside { + margin: 10px 0; + padding: 0; +} + +/* Dashboard Quick Draft - Form styling */ + +input#save-post { + float: right; +} + +form.initial-form label.prompt { + font-style: italic; +} + +form.initial-form input#title { + height: 3em; +} + +form.initial-form.quickpress-open label.prompt { + font-style: normal; +} + +form.initial-form.quickpress-open input#title { + height: auto; +} + +#dashboard_quick_draft input, +#dashboard_quick_draft textarea { + box-sizing: border-box; + -moz-box-sizing:border-box; + -webkit-box-sizing:border-box; + margin: 0; +} + +#dashboard_quick_draft textarea { + resize: vertical; +} + +#dashboard-widgets .postbox form .submit { + margin: -39px 0; + float: right; +} + +#description-wrap { + margin-top: 12px; +} + +#title-wrap #title-prompt-text, +.textarea-wrap #content-prompt-text { + color: #BBB; +} + +#title-wrap #title-prompt-text { + font-size: 1.1em; + padding: 7px 8px; +} + +.initial-form #description-wrap, +.initial-form p.submit { + display: none; +} + +.input-text-wrap, +.textarea-wrap { + position: relative; +} + +.input-text-wrap .prompt, +.textarea-wrap .prompt { + position: absolute; +} + +.textarea-wrap #content-prompt-text { + font-size: 1.1em; + padding: 7px 8px; +} + +.textarea-wrap textarea#content { + margin: 0 0 8px; + padding: 6px 7px; +} + +/* Dashboard Quick Draft - Drafts list */ + +#dashboard_quick_draft .drafts { + border-top: 1px solid #eee; + margin-top: 12px; +} + +#dashboard_quick_draft .drafts abbr { + border: none; +} + +#dashboard_quick_draft .drafts h4 { + margin: 0 0 8px 0; + font-weight: normal; +} + +#dashboard_quick_draft .drafts .view-all { + float: right; + margin-top: 0; +} + +#dashboard_rss a.rsswidget { + font-weight: normal; +} + +#draft-list { + margin: 0; +} + +#draft-list li { + margin-bottom: 1em; +} +#draft-list li time { + color: #bbb; +} + +#draft-list p { + margin: 0; +} + +#draft-list .draft-title { + overflow: hidden; +} + +#draft-list .draft-title a, +#draft-list .draft-title time { + float: left; + margin: 0 5px 0 0; +} + +/* Dashboard activity widget */ + +#dashboard-widgets #dashboard_activity h4 { + margin: 0 0 8px 12px; + font-weight: normal; +} + +#dashboard-widgets #dashboard_activity h4.comment-meta { + margin: 0; +} + +#dashboard_activity h4.comment-meta { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + margin-bottom: 4px; +} + +#dashboard_activity ul { + padding: 0 12px; +} + +#dashboard_activity .comment-meta span.approve:before { + content: '\f227'; + font: 20px/.5 "dashicons"; + margin-left: 12px; + vertical-align: middle; + position: relative; + top: -1px; + margin-right: 2px; +} + +#dashboard_activity .inside { + padding: 0; + margin: 0; +} + +#dashboard_activity .no-activity { + overflow: hidden; + padding: 0 12px 12px; + text-align: center; +} + +#dashboard_activity .no-activity p { + color: #999; + font-size: 16px; +} + +#dashboard_activity .no-activity .smiley { + margin-top: 0; +} + +#dashboard_activity .no-activity .smiley:before { + content: '\f328'; + font: normal 120px/1 'dashicons'; + speak: none; + display: block; + margin: 0 5px 0 0; + padding: 0; + text-indent: 0; + text-align: center; + position: relative; + -webkit-font-smoothing: antialiased; + text-decoration: none !important; +} + +#dashboard_activity .subsubsub { + float: none; + border-top: 1px solid #eeeeee; + margin-top: 0; + padding: 8px 12px 0 12px; +} + +#future-posts .show-more, +#published-posts .show-more { + float: right; +} + +#future-posts ul, +#published-posts ul { + clear: both; + margin-bottom: 0; +} + +#future-posts li, +#published-posts li { + overflow: hidden; + margin-bottom: 8px; +} + +#future-posts ul span, +#published-posts ul span { + color: #bbb; + float: left; + margin-right: 8px; + min-width: 150px; +} + +.activity-block { + border-bottom: 1px solid #eee; + overflow: hidden; + padding: 8px 0 0; +} + +.activity-block:last-child { + border-bottom: none; +} + +.activity-block .subsubsub li { + color: #ddd; +} + +/* Dashboard activity widget - Comments */ + +#the-comment-list tr.undo, #the-comment-list div.undo { + background: none; + padding: 6px 0; +} + +#the-comment-list .alternate, +#the-comment-list .alt { + background: none; +} + +#the-comment-list .comment { + background: #f5f5f5; + padding: 12px; + position: relative; + border-top: 1px solid #eeeeee; +} + +#the-comment-list img { + position: absolute; + left: 13px; + top: 13px; +} + +#the-comment-list .dashboard-comment-wrap { + padding-left: 63px; +} + +#the-comment-list .dashboard-comment-wrap blockquote { + margin: 1em 0; +} + +#the-comment-list .comment-item h4 { + font-size: 13px; + color: #999; +} + +#the-comment-list .comment-item p.row-actions { + margin: 4px 0 0 0; +} + +#the-comment-list .comment-item:first-child { + border-top: 1px solid #eeeeee; +} + +#the-comment-list .unapproved { + background: #f7fcfe; +} + +#the-comment-list .unapproved:before { + content: ""; + display: block; + position: absolute; + left: 0; + top: 0; + bottom: 0; + background: #d54e21; + width: 4px; +} + +/* Browse happy box */ + +#dashboard-widgets #dashboard_browser_nag.postbox .inside { + margin: 10px; +} + @media screen and (max-width: 870px) { .welcome-panel .welcome-panel-column, .welcome-panel .welcome-panel-column:first-child { @@ -7752,122 +8256,51 @@ h3:hover .edit-box { } /* Recent Comments */ -#dashboard_recent_comments h3 { - margin-bottom: 0; -} -#dashboard_recent_comments .inside { - margin-top: 0; -} - -#dashboard_recent_comments .comment-meta .approve { - font-family: "Open Sans", sans-serif; - font-size: 13px; - line-height: 1; - margin: 0 10px; -} - -#dashboard_recent_comments .subsubsub { - float: none; - white-space: normal; -} - -#the-comment-list { +#latest-comments #the-comment-list { position: relative; } -#the-comment-list .comment-item { +#activity-widget #latest-comments #the-comment-list .comment-item { padding: 1em 12px; - border-top: 1px solid; + border-top: 1px solid #eee; } -#the-comment-list .pingback { +#latest-comments #the-comment-list .pingback { padding-left: 12px !important; } -#the-comment-list .comment-item, -#the-comment-list #replyrow { - margin: 0 -12px; -} - -#the-comment-list .comment-item:first-child { +#latest-comments #the-comment-list .comment-item:first-child { border-top: none; } -#the-comment-list .comment-item .avatar { - float: left; - margin: 0 10px 5px 0; -} - -#the-comment-list .comment-item h4 { +#latest-comments #the-comment-list .comment-item h4 { line-height: 1.5em; margin-top: 0; color: #999; } -#the-comment-list .comment-item h4 cite { +#latest-comments #the-comment-list .comment-item h4 cite { font-style: normal; font-weight: normal; } -#the-comment-list .comment-item blockquote, -#the-comment-list .comment-item blockquote p { +#latest-comments #the-comment-list .comment-item blockquote, +#latest-comments #the-comment-list .comment-item blockquote p { margin: 0; padding: 0; display: inline; } -#dashboard_recent_comments #the-comment-list .trackback blockquote, -#dashboard_recent_comments #the-comment-list .pingback blockquote { - display: block; -} - -#the-comment-list .comment-item p.row-actions { +#latest-comments #the-comment-list .comment-item p.row-actions { margin: 3px 0 0; padding: 0; font-size: 13px; } -/* QuickPress */ -#header-logo { - display: none; -} +/* QuickDraft */ -#site-heading:before { - top: 3px; - position: relative; - display: inline-block; - font: normal 18px/1 'dashicons'; - speak: none; - color: #727272; - content: '\f120'; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} -.no-js #dashboard_quick_press { - display: none; -} - -#dashboard_quick_press .easy-blogging { - padding: 0 8px; - text-align: left; -} - -#dashboard_quick_press .input-text-wrap { - position: relative; -} - -#dashboard_quick_press .prompt { - color: #bbb; - position: absolute; -} - -#dashboard_quick_press div.updated { - padding: 0 5px; -} - -#title-wrap label, -#tags-input-wrap label { +#title-wrap label { cursor: text; } @@ -7878,90 +8311,11 @@ h3:hover .edit-box { outline: none; } -#tags-input-wrap #tags-input { - outline: none; - padding: 3px 6px; -} - #title-wrap #title-prompt-text { - font-size: 1.3em; - padding: 5px 8px; -} - -#tags-input-wrap #tags-input-prompt-text { font-size: 1em; padding: 5px 8px; } -#dashboard_quick_press .input-text-wrap, -#dashboard_quick_press .textarea-wrap { - margin: 0 0 .7em 0; -} - -#dashboard_quick_press .input-text-wrap { - margin-right: 1px; -} - -#dashboard_quick_press .textarea-wrap { - margin-left: 1px; -} - -#dashboard_quick_press .wp-media-buttons { - margin: 0 0 2px 1px; - padding: 0; -} - -#dashboard_quick_press .wp-media-buttons a { - color: #777; - margin-bottom: 0; -} - -#dashboard-widgets #dashboard_quick_press form p.submit input { - float: left; -} - -#dashboard-widgets #dashboard_quick_press form p.submit #save-post { - margin: 0 0.7em 0 1px; -} - -#dashboard-widgets #dashboard_quick_press form p.submit #publish { - float: right; -} - -#dashboard-widgets #dashboard_quick_press form p.submit .spinner { - vertical-align: middle; - margin: 4px 6px 0 0; -} - -/* Recent Drafts */ -#dashboard_recent_drafts ul, -#dashboard_recent_drafts p { - margin: 0; - padding: 0; - word-wrap: break-word; -} - -#dashboard_recent_drafts ul { - list-style: none; -} - -#dashboard_recent_drafts ul li { - margin-bottom: 1em; -} - -#dashboard_recent_drafts h4 { - line-height: 1.7em; - word-wrap: break-word; -} - -#dashboard_recent_drafts h4 abbr { - font-weight: normal; - font-family: "Open Sans", sans-serif; - font-size: 12px; - color: #999; - margin-left: 3px; -} - /* Feeds */ .rss-widget ul { margin: 0; @@ -7997,33 +8351,6 @@ a.rsswidget { content: '\2014'; } -/* Plugins */ -#dashboard_plugins h4 { - line-height: 1.7em; -} - -#dashboard_plugins h5 { - font-weight: normal; - font-size: 13px; - margin: 0; - display: inline; - line-height: 1.4em; -} - -#dashboard_plugins h5 a { - line-height: 1.4em; -} - -#dashboard_plugins .inside span { - font-size: 12px; - padding-left: 5px; -} - -#dashboard_plugins p { - margin: 0.3em 0 1.4em; - line-height: 1.4em; -} - .dashboard-comment-wrap { overflow: hidden; word-wrap: break-word; diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index f2deaf1df7..2533dd6fa5 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -234,17 +234,8 @@ function wp_ajax_dashboard_widgets() { require_once ABSPATH . 'wp-admin/includes/dashboard.php'; switch ( $_GET['widget'] ) { - case 'dashboard_incoming_links' : - wp_dashboard_incoming_links(); - break; - case 'dashboard_primary' : - wp_dashboard_primary(); - break; - case 'dashboard_secondary' : - wp_dashboard_secondary(); - break; - case 'dashboard_plugins' : - wp_dashboard_plugins(); + case 'dashboard_rss' : + wp_dashboard_rss(); break; } wp_die(); diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index 1f71f243a0..0991dd3cf5 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -37,80 +37,20 @@ function wp_dashboard_setup() { // Right Now if ( is_blog_admin() && current_user_can('edit_posts') ) - wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' ); + add_meta_box( 'dash-right-now', 'Site Content', 'dashboard_new_right_now', 'dashboard', 'normal', 'high' ); if ( is_network_admin() ) wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' ); - // Recent Comments Widget - if ( is_blog_admin() && current_user_can('moderate_comments') ) { - if ( !isset( $widget_options['dashboard_recent_comments'] ) || !isset( $widget_options['dashboard_recent_comments']['items'] ) ) { - $update = true; - $widget_options['dashboard_recent_comments'] = array( - 'items' => 5, - ); - } - $recent_comments_title = __( 'Recent Comments' ); - wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments', 'wp_dashboard_recent_comments_control' ); - } - - // Incoming Links Widget - if ( is_blog_admin() && current_user_can('publish_posts') ) { - if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) { - $update = true; - $num_items = isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10; - $widget_options['dashboard_incoming_links'] = array( - 'home' => get_option('home'), - 'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ), - 'url' => isset($widget_options['dashboard_incoming_links']['url']) ? apply_filters( 'dashboard_incoming_links_feed', $widget_options['dashboard_incoming_links']['url'] ) : apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?scoring=d&ie=utf-8&num=' . $num_items . '&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ), - 'items' => $num_items, - 'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false - ); - } - wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' ); - } - - // WP Plugins Widget - if ( ( ! is_multisite() && is_blog_admin() && current_user_can( 'install_plugins' ) ) || ( is_network_admin() && current_user_can( 'manage_network_plugins' ) && current_user_can( 'install_plugins' ) ) ) - wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' ); + // Activity Widget + add_meta_box( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_activity', 'dashboard', 'normal', 'high' ); // QuickPress Widget - if ( is_blog_admin() && current_user_can('edit_posts') ) - wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press' ); + if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) + add_meta_box( 'dashboard_quick_draft', __( 'Quick Draft' ), 'wp_dashboard_quick_draft', 'dashboard', 'side', 'high' ); - // Recent Drafts - if ( is_blog_admin() && current_user_can('edit_posts') ) - wp_add_dashboard_widget( 'dashboard_recent_drafts', __('Recent Drafts'), 'wp_dashboard_recent_drafts' ); - - // Primary feed (Dev Blog) Widget - if ( !isset( $widget_options['dashboard_primary'] ) ) { - $update = true; - $widget_options['dashboard_primary'] = array( - 'link' => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/news/' ) ), - 'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ), - 'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ), - 'items' => 2, - 'show_summary' => 1, - 'show_author' => 0, - 'show_date' => 1, - ); - } - wp_add_dashboard_widget( 'dashboard_primary', $widget_options['dashboard_primary']['title'], 'wp_dashboard_primary', 'wp_dashboard_primary_control' ); - - // Secondary Feed (Planet) Widget - if ( !isset( $widget_options['dashboard_secondary'] ) ) { - $update = true; - $widget_options['dashboard_secondary'] = array( - 'link' => apply_filters( 'dashboard_secondary_link', __( 'http://planet.wordpress.org/' ) ), - 'url' => apply_filters( 'dashboard_secondary_feed', __( 'http://planet.wordpress.org/feed/' ) ), - 'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ), - 'items' => 5, - 'show_summary' => 0, - 'show_author' => 0, - 'show_date' => 0, - ); - } - wp_add_dashboard_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_secondary', 'wp_dashboard_secondary_control' ); + // WordPress News + add_meta_box( 'dashboard_rss', __( 'WordPress News' ), 'wp_dashboard_rss', 'dashboard', 'side', 'low' ); // Hook to register new widgets // Filter widget order @@ -165,9 +105,9 @@ function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_ } if ( is_blog_admin () ) - $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary'); + $side_widgets = array('dashboard_quick_draft'); else if (is_network_admin() ) - $side_widgets = array('dashboard_primary', 'dashboard_secondary'); + $side_widgets = array(); else $side_widgets = array(); @@ -224,191 +164,68 @@ function wp_dashboard() { /* Dashboard Widgets */ -function wp_dashboard_right_now() { - global $wp_registered_sidebars; - - $num_posts = wp_count_posts( 'post' ); - $num_pages = wp_count_posts( 'page' ); - - $num_cats = wp_count_terms('category'); - - $num_tags = wp_count_terms('post_tag'); - - $num_comm = wp_count_comments(); - - echo "\n\t".'
'; - echo "\n\t".'

' . __('Content') . '

'."\n\t".''; - echo "\n\t".''; - - // Posts - $num = number_format_i18n( $num_posts->publish ); - $text = _n( 'Post', 'Posts', intval($num_posts->publish) ); - if ( current_user_can( 'edit_posts' ) ) { - $num = "$num"; - $text = "$text"; - } - echo ''; - echo ''; - - echo ''; - /* TODO: Show status breakdown on hover - if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds. Don't show if !current_user_can - $post_type_texts[] = ''.sprintf( _n( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).''; - } - if ( $can_edit_posts && !empty($num_posts->draft) ) { - $post_type_texts[] = ''.sprintf( _n( '%s draft', '%s drafts', $num_posts->draft ), number_format_i18n( $num_posts->draft ) ).''; - } - if ( $can_edit_posts && !empty($num_posts->future) ) { - $post_type_texts[] = ''.sprintf( _n( '%s scheduled post', '%s scheduled posts', $num_posts->future ), number_format_i18n( $num_posts->future ) ).''; - } - if ( current_user_can('publish_posts') && !empty($num_posts->pending) ) { - $pending_text = sprintf( _n( 'There is %2$s post pending your review.', 'There are %2$s posts pending your review.', $num_posts->pending ), 'edit.php?post_status=pending', number_format_i18n( $num_posts->pending ) ); - } else { - $pending_text = ''; - } - */ - - // Pages - $num = number_format_i18n( $num_pages->publish ); - $text = _n( 'Page', 'Pages', $num_pages->publish ); - if ( current_user_can( 'edit_pages' ) ) { - $num = "$num"; - $text = "$text"; - } - echo ''; - echo ''; - - echo ''; - - // Categories - $num = number_format_i18n( $num_cats ); - $text = _n( 'Category', 'Categories', $num_cats ); - if ( current_user_can( 'manage_categories' ) ) { - $num = "$num"; - $text = "$text"; - } - echo ''; - echo ''; - - echo ''; - - // Tags - $num = number_format_i18n( $num_tags ); - $text = _n( 'Tag', 'Tags', $num_tags ); - if ( current_user_can( 'manage_categories' ) ) { - $num = "$num"; - $text = "$text"; - } - echo ''; - echo ''; - - echo ""; - do_action('right_now_content_table_end'); - echo "\n\t
' . $num . '' . $text . '
' . $num . '' . $text . '
' . $num . '' . $text . '
' . $num . '' . $text . '
\n\t
"; - - echo "\n\t".'
'; - echo "\n\t".'

' . __('Discussion') . '

'."\n\t".''; - echo "\n\t".''; - - // Total Comments - $num = '' . number_format_i18n($num_comm->total_comments) . ''; - $text = _n( 'Comment', 'Comments', $num_comm->total_comments ); - if ( current_user_can( 'moderate_comments' ) ) { - $num = '' . $num . ''; - $text = '' . $text . ''; - } - echo ''; - echo ''; - - echo ''; - - // Approved Comments - $num = '' . number_format_i18n($num_comm->approved) . ''; - $text = _nx( 'Approved', 'Approved', $num_comm->approved, 'Right Now' ); - if ( current_user_can( 'moderate_comments' ) ) { - $num = "$num"; - $text = "$text"; - } - echo ''; - echo ''; - - echo "\n\t"; - - // Pending Comments - $num = '' . number_format_i18n($num_comm->moderated) . ''; - $text = _n( 'Pending', 'Pending', $num_comm->moderated ); - if ( current_user_can( 'moderate_comments' ) ) { - $num = "$num"; - $text = "$text"; - } - echo ''; - echo ''; - - echo "\n\t"; - - // Spam Comments - $num = number_format_i18n($num_comm->spam); - $text = _nx( 'Spam', 'Spam', $num_comm->spam, 'comment' ); - if ( current_user_can( 'moderate_comments' ) ) { - $num = "$num"; - $text = "$text"; - } - echo ''; - echo ''; - - echo ""; - do_action('right_now_table_end'); - do_action('right_now_discussion_table_end'); - echo "\n\t
' . $num . '' . $text . '
' . $num . '' . $text . '
' . $num . '' . $text . '
' . $num . '' . $text . '
\n\t
"; - - echo "\n\t".'
'; +function dashboard_new_right_now() { $theme = wp_get_theme(); - - echo "\n\t

"; - - if ( $theme->errors() ) { - if ( ! is_multisite() || is_super_admin() ) - echo '' . sprintf( __( 'ERROR: %s' ), $theme->errors()->get_error_message() ) . ''; - } elseif ( ! empty($wp_registered_sidebars) ) { - $sidebars_widgets = wp_get_sidebars_widgets(); - $num_widgets = 0; - foreach ( (array) $sidebars_widgets as $k => $v ) { - if ( 'wp_inactive_widgets' == $k || 'orphaned_widgets' == substr( $k, 0, 16 ) ) - continue; - if ( is_array($v) ) - $num_widgets = $num_widgets + count($v); + if ( current_user_can( 'switch_themes' ) ) + $theme_name = sprintf( '%1$s', $theme->display('Name') ); + else + $theme_name = $theme->display('Name'); +?> +

+ +

+
- // Check if search engines are asked not to index this site. - if ( !is_network_admin() && !is_user_admin() && current_user_can('manage_options') && '1' != get_option('blog_public') ) { - $title = apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content') ); - $content = apply_filters('privacy_on_link_text', __('Search Engines Discouraged') ); - - echo "

$content

"; - } - - update_right_now_message(); - - echo "\n\t".'
'; + +
+ +
+

' . __( 'Post published. View post | Edit post' ) . '

', esc_url( $view ), $edit ); - else - printf( '

' . __( 'Post submitted. Preview post | Edit post' ) . '

', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit ); - } else { - printf( '

' . __( 'Draft saved. Preview post | Edit post' ) . '

', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit ); - $drafts_query = new WP_Query( array( - 'post_type' => 'post', - 'post_status' => 'draft', - 'author' => $GLOBALS['current_user']->ID, - 'posts_per_page' => 1, - 'orderby' => 'modified', - 'order' => 'DESC' - ) ); - - if ( $drafts_query->posts ) - $drafts =& $drafts_query->posts; - } - printf('

' . __('You can also try %s, easy blogging from anywhere on the Web.') . '

', '' . __('Press This') . '' ); - $_REQUEST = array(); // hack for get_default_post_to_edit() - } - /* Check if a new auto-draft (= no new post_ID) is needed or if the old can be used */ $last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID if ( $last_post_id ) { $post = get_post( $last_post_id ); if ( empty( $post ) || $post->post_status != 'auto-draft' ) { // auto-draft doesn't exists anymore - $post = get_default_post_to_edit('post', true); + $post = get_default_post_to_edit( 'post', true ); update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID } else { $post->post_title = ''; // Remove the auto draft title @@ -508,150 +306,94 @@ function wp_dashboard_quick_press() { $post_ID = (int) $post->ID; - $media_settings = array( - 'id' => $post->ID, - 'nonce' => wp_create_nonce( 'update-post_' . $post->ID ), - ); - - if ( current_theme_supports( 'post-thumbnails', $post->post_type ) && post_type_supports( $post->post_type, 'thumbnail' ) ) { - $featured_image_id = get_post_meta( $post->ID, '_thumbnail_id', true ); - $media_settings['featuredImageId'] = $featured_image_id ? $featured_image_id : -1; - } + do_action( 'dashboard_quickdraft_beginning', $post ); ?> -
+ + + +
+ +
- - + +
- -
- -
- - -
- - -
- - - -
- - +
+ +

- - - - - + - - 'save-post' ) ); ?> - + + 'save-post' ) ); ?>

'post', - 'post_status' => 'draft', - 'author' => $GLOBALS['current_user']->ID, - 'posts_per_page' => 5, - 'orderby' => 'modified', - 'order' => 'DESC' - ) ); - $drafts =& $drafts_query->posts; - } +/** + * Show `Recent Drafts` below Quick Draft form + * + * + * + * @since 3.8.0 + * + */ +function wp_dashboard_recent_quickdrafts() { + + $query_args = array( + 'post_type' => 'post', + 'post_status' => 'draft', + 'author' => $GLOBALS['current_user']->ID, + 'posts_per_page' => 4, + 'orderby' => 'modified', + 'order' => 'DESC' + ); + $query_args = apply_filters( 'dash_recent_quickdrafts_query_args', $query_args ); + $drafts_query = new WP_Query( $query_args ); + $drafts =& $drafts_query->posts; + if ( $drafts && is_array( $drafts ) ) { $list = array(); + $draft_count = 0; foreach ( $drafts as $draft ) { + if ( 3 == $draft_count ) + break; + + $draft_count++; + $url = get_edit_post_link( $draft->ID ); $title = _draft_or_post_title( $draft->ID ); - $item = "

" . esc_html($title) . " " . get_the_time( get_option( 'date_format' ), $draft ) . '

'; + $item = '
' . esc_html( $title ) . '
'; if ( $the_content = wp_trim_words( $draft->post_content, 10 ) ) $item .= '

' . $the_content . '

'; $list[] = $item; } + + do_action( 'dashboard_quickdraft_drafts_list', $drafts ); ?> - -

- $total_items * 5, 'offset' => 0 ); - if ( ! current_user_can( 'edit_posts' ) ) - $comments_query['status'] = 'approve'; - - while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) { - foreach ( $possible as $comment ) { - if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) ) - continue; - $comments[] = $comment; - if ( count( $comments ) == $total_items ) - break 2; - } - $comments_query['offset'] += $comments_query['number']; - $comments_query['number'] = $total_items * 10; - } - - if ( $comments ) { - echo '
'; - foreach ( $comments as $comment ) - _wp_dashboard_recent_comments_row( $comment ); - echo '
'; - - if ( current_user_can('edit_posts') ) - _get_list_table('WP_Comments_List_Table')->views(); - - wp_comment_reply( -1, false, 'dashboard', false ); - wp_comment_trashnotice(); - } else { - echo '

' . __( 'No comments yet.' ) . '

'; - } +
+ +

+ +

+
    +
  • \n
  • ", $list ); ?>
  • +
+
+'; - if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-recent-comments']) ) { - $number = absint( $_POST['widget-recent-comments']['items'] ); - $widget_options['dashboard_recent_comments']['items'] = $number; - update_option( 'dashboard_widget_options', $widget_options ); - } + do_action( 'dashboard_activity_beginning' ); - $number = isset( $widget_options['dashboard_recent_comments']['items'] ) ? (int) $widget_options['dashboard_recent_comments']['items'] : ''; - - echo '

'; - echo '

'; -} - -function wp_dashboard_incoming_links() { - wp_dashboard_cached_rss_widget( 'dashboard_incoming_links', 'wp_dashboard_incoming_links_output' ); -} - -/** - * Display incoming links dashboard widget content. - * - * @since 2.5.0 - */ -function wp_dashboard_incoming_links_output() { - $widgets = get_option( 'dashboard_widget_options' ); - @extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP ); - $rss = fetch_feed( $url ); - - if ( is_wp_error($rss) ) { - if ( is_admin() || current_user_can('manage_options') ) { - echo '

'; - printf(__('RSS Error: %s'), $rss->get_error_message()); - echo '

'; - } - return; - } - - if ( !$rss->get_item_quantity() ) { - echo '

' . __('This dashboard widget queries Google Blog Search so that when another blog links to your site it will show up here. It has found no incoming links… yet. It’s okay — there is no rush.') . "

\n"; - $rss->__destruct(); - unset($rss); - return; - } - - echo "\n"; - $rss->__destruct(); - unset($rss); -} - -function wp_dashboard_incoming_links_control() { - wp_dashboard_rss_control( 'dashboard_incoming_links', array( 'title' => false, 'show_summary' => false, 'show_author' => false ) ); -} - -function wp_dashboard_primary() { - wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_rss_output' ); -} - -function wp_dashboard_primary_control() { - wp_dashboard_rss_control( 'dashboard_primary' ); -} - -/** - * Display primary dashboard RSS widget feed. - * - * @since 2.5.0 - * - * @param string $widget_id - */ -function wp_dashboard_rss_output( $widget_id ) { - $widgets = get_option( 'dashboard_widget_options' ); - echo '
'; - wp_widget_rss_output( $widgets[$widget_id] ); - echo "
"; -} - -function wp_dashboard_secondary() { - wp_dashboard_cached_rss_widget( 'dashboard_secondary', 'wp_dashboard_secondary_output' ); -} - -function wp_dashboard_secondary_control() { - wp_dashboard_rss_control( 'dashboard_secondary' ); -} - -/** - * Display secondary dashboard RSS widget feed. - * - * @since 2.5.0 - * - * @return unknown - */ -function wp_dashboard_secondary_output() { - $widgets = get_option( 'dashboard_widget_options' ); - @extract( @$widgets['dashboard_secondary'], EXTR_SKIP ); - $rss = @fetch_feed( $url ); - - if ( is_wp_error($rss) ) { - if ( is_admin() || current_user_can('manage_options') ) { - echo '

'; - printf(__('RSS Error: %s'), $rss->get_error_message()); - echo '

'; - } - } elseif ( !$rss->get_item_quantity() ) { - $rss->__destruct(); - unset($rss); - return false; - } else { - echo '
'; - wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] ); - echo '
'; - $rss->__destruct(); - unset($rss); - } -} - -function wp_dashboard_plugins() { - wp_dashboard_cached_rss_widget( 'dashboard_plugins', 'wp_dashboard_plugins_output', array( - 'http://wordpress.org/plugins/rss/browse/popular/', - 'http://wordpress.org/plugins/rss/browse/new/' + $future_posts = dashboard_show_published_posts( array( + 'display' => 2, + 'max' => 5, + 'status' => 'future', + 'order' => 'ASC', + 'title' => __( 'Publishing Soon' ), + 'id' => 'future-posts', ) ); + $recent_posts = dashboard_show_published_posts( array( + 'display' => 2, + 'max' => 5, + 'status' => 'publish', + 'order' => 'DESC', + 'title' => __( 'Recently Published' ), + 'id' => 'published-posts', + ) ); + + do_action( 'dashboard_activity_middle' ); + + $recent_comments = dashboard_comments(); + + if ( !$future_posts && !$recent_posts && !$recent_comments ) { + echo '
'; + echo '

'; + echo '

' . __( 'No activity yet!' ) . '

'; + echo '
'; + } + + do_action( 'dashboard_activity_end' ); + + echo '
'; } /** - * Display plugins most popular, newest plugins, and recently updated widget text. + * Generates `Publishing Soon` and `Recently Published` sections + * + * + * + * @since 3.8.0 * - * @since 2.5.0 */ -function wp_dashboard_plugins_output() { - $popular = fetch_feed( 'http://wordpress.org/plugins/rss/browse/popular/' ); - $new = fetch_feed( 'http://wordpress.org/plugins/rss/browse/new/' ); +function dashboard_show_published_posts( $args ) { - if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) { - $plugin_slugs = array_keys( get_plugins() ); - set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS ); - } + $query_args = array( + 'post_type' => 'post', + 'post_status' => $args['status'], + 'orderby' => 'date', + 'order' => $args['order'], + 'posts_per_page' => intval( $args['max'] ), + 'no_found_rows' => true, + 'cache_results' => false + ); + $query_args = apply_filters( 'dash_show_published_posts_query_args', $query_args ); + $posts = new WP_Query( $query_args ); - foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins') ) as $feed => $label ) { - if ( is_wp_error($$feed) || !$$feed->get_item_quantity() ) - continue; + if ( $posts->have_posts() ) { - $items = $$feed->get_items(0, 5); + echo '
'; - // Pick a random, non-installed plugin - while ( true ) { - // Abort this foreach loop iteration if there's no plugins left of this type - if ( 0 == count($items) ) - continue 2; - - $item_key = array_rand($items); - $item = $items[$item_key]; - - list($link, $frag) = explode( '#', $item->get_link() ); - - $link = esc_url($link); - if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) ) - $slug = $matches[1]; - else { - unset( $items[$item_key] ); - continue; - } - - // Is this random plugin's slug already installed? If so, try again. - reset( $plugin_slugs ); - foreach ( $plugin_slugs as $plugin_slug ) { - if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) { - unset( $items[$item_key] ); - continue 2; - } - } - - // If we get to this point, then the random plugin isn't installed and we can stop the while(). - break; + if ( $posts->post_count > $args['display'] ) { + echo '' . sprintf( __( 'See %s more…'), $posts->post_count - intval( $args['display'] ) ) . ''; } - // Eliminate some common badly formed plugin descriptions - while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) ) - unset($items[$item_key]); + echo '

' . $args['title'] . '

'; - if ( !isset($items[$item_key]) ) - continue; + echo ''; + echo '
'; - $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . - '&TB_iframe=true&width=600&height=800'; - - echo "

$label

\n"; - echo "
$title
 (" . __( 'Install' ) . ")\n"; - echo "

$description

\n"; - - $$feed->__destruct(); - unset($$feed); + } else { + return false; } + + wp_reset_postdata(); + + return true; +} + +/** + * Show `Comments` section + * + * + * + * @since 3.8.0 + * + */ +function dashboard_comments( $total_items = 5 ) { + global $wpdb; + + // Select all comment types and filter out spam later for better query performance. + $comments = array(); + $start = 0; + + $comments_query = array( + 'number' => $total_items * 5, + 'offset' => 0 + ); + if ( ! current_user_can( 'edit_posts' ) ) + $comments_query['status'] = 'approve'; + + while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) { + foreach ( $possible as $comment ) { + if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) ) + continue; + $comments[] = $comment; + if ( count( $comments ) == $total_items ) + break 2; + } + $comments_query['offset'] += $comments_query['number']; + $comments_query['number'] = $total_items * 10; + } + + + + if ( $comments ) { + echo '
'; + echo '

' . __( 'Comments' ) . '

'; + + echo '
'; + foreach ( $comments as $comment ) + _wp_dashboard_recent_comments_row( $comment ); + echo '
'; + + if ( current_user_can('edit_posts') ) + _get_list_table('WP_Comments_List_Table')->views(); + + wp_comment_reply( -1, false, 'dashboard', false ); + wp_comment_trashnotice(); + + echo '
'; + } else { + return false; + } + return true; +} + +/** + * return relative date for given timestamp + * + * + * + * @since 3.8.0 + * + */ +function dashboard_relative_date( $time ) { + + $diff = floor( ( $time - time() ) / DAY_IN_SECONDS ); + + if ( $diff == 0 ) + return __( 'Today' ); + + if ( $diff == 1 ) + return __( 'Tomorrow' ); + + return date( 'M jS', $time); + } /** @@ -1074,47 +745,187 @@ function wp_dashboard_trigger_widget_control( $widget_control_id = false ) { } /** - * The RSS dashboard widget control. + * Returns default WordPress News feeds * - * 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 + * @since 3.8.0 + * */ -function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { - if ( !$widget_options = get_option( 'dashboard_widget_options' ) ) +function wp_dashboard_default_feeds() { + return array( + 'news' => array( + 'link' => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/news/' ) ), + 'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ), + 'title' => '', + 'items' => 1, + 'show_summary' => 1, + 'show_author' => 0, + 'show_date' => 1, + ), + 'planet' => array( + 'link' => apply_filters( 'dashboard_secondary_link', __( 'http://planet.wordpress.org/' ) ), + 'url' => apply_filters( 'dashboard_secondary_feed', __( 'http://planet.wordpress.org/feed/' ) ), + 'title' => '', + 'items' => 3, + 'show_summary' => 0, + 'show_author' => 0, + 'show_date' => 0, + ), + 'plugins' => array( + 'link' => '', + 'url' => array( + 'popular' => 'http://wordpress.org/plugins/rss/browse/popular/' + ), + 'title' => '', + 'items' => 1, + 'show_summary' => 0, + 'show_author' => 0, + 'show_date' => 0, + ) + ); +} + +/** + * Check for cached feeds + * + * + * + * @since 3.8.0 + * + */ +function wp_dashboard_rss() { + $default_feeds = wp_dashboard_default_feeds(); + + $widget_options = get_option( 'dashboard_widget_options' ); + + if ( !$widget_options || !is_array($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); - } - } + //if ( ! isset( $widget_options['dashboard_rss'] ) ) { + $widget_options['dashboard_rss'] = $default_feeds; update_option( 'dashboard_widget_options', $widget_options ); - $cache_key = 'dash_' . md5( $widget_id ); - delete_transient( $cache_key ); + //} + + foreach( $default_feeds as $key => $value ) { + $default_urls[] = $value['url']; } - wp_widget_rss_form( $widget_options[$widget_id], $form_inputs ); + $cache_key = 'dash_' . md5( 'dashboard_rss' ); + delete_transient( $cache_key ); + + do_action( 'dashboard_news_beginning' ); + + wp_dashboard_cached_rss_widget( 'dashboard_rss', 'wp_dashboard_news_output', $default_urls ); + + do_action( 'dashboard_news_end' ); +} + +/** + * Display news feeds + * + * + * + * @since 3.8.0 + * + */ +function wp_dashboard_news_output() { + $widgets = get_option( 'dashboard_widget_options' ); + + foreach( $widgets['dashboard_rss'] as $type => $args ) { + $args['type'] = $type; + echo '
'; + wp_widget_news_output( $args['url'], $args ); + echo "
"; + } +} + +/** + * Generate code for each news feed + * + * + * + * @since 3.8.0 + * + */ +function wp_widget_news_output( $rss, $args = array() ) { + + // Regular RSS feeds + if ( isset( $args['type'] ) && 'plugins' != $args['type'] ) + return wp_widget_rss_output( $rss, $args ); + + // Plugin feeds plus link to install them + if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) { + $popular = fetch_feed( $args['url']['popular'] ); + + if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) { + $plugin_slugs = array_keys( get_plugins() ); + set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS ); + } + + echo ''; + } } /** @@ -1127,7 +938,7 @@ function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { * @return bool True if not multisite, user can't upload files, or the space check option is disabled. */ function wp_dashboard_quota() { - if ( !is_multisite() || !current_user_can('upload_files') || get_site_option( 'upload_space_check_disabled' ) ) + if ( !is_multisite() || !current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) ) return true; $quota = get_space_allowed(); @@ -1137,29 +948,34 @@ function wp_dashboard_quota() { $percentused = '100'; else $percentused = ( $used / $quota ) * 100; - $used_color = ( $percentused >= 70 ) ? ' spam' : ''; + $used_class = ( $percentused >= 70 ) ? ' warning' : ''; $used = round( $used, 2 ); $percentused = number_format( $percentused ); ?> -

-
- - - - - -
%2$sMB' ), esc_url( admin_url( 'upload.php' ) ), number_format_i18n( $quota ) ); ?>
+

+
+
-
- - - - - -
%2$sMB (%3$s%%)' ), esc_url( admin_url( 'upload.php' ) ), number_format_i18n( $used, 2 ), $percentused ); ?>
-
-
4, 'default' => 1) ); -else - add_screen_option('layout_columns', array('max' => 4, 'default' => 2) ); - $help = '

' . __( 'Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab in the upper corner.' ) . '

'; // Not using chaining here, so as to be parseable by PHP4. @@ -47,47 +42,42 @@ $screen->add_help_tab( array( // Help tabs -$help = '

' . __('The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.') . '

'; -$help .= '

' . __('Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.') . '

'; +$help = '

' . __( 'The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.' ) . '

'; +$help .= '

' . __( 'Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.' ) . '

'; $screen->add_help_tab( array( 'id' => 'help-navigation', - 'title' => __('Navigation'), + 'title' => __( 'Navigation' ), 'content' => $help, ) ); -$help = '

' . __('You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.') . '

'; -$help .= '

' . __('Screen Options - Use the Screen Options tab to choose which Dashboard boxes to show, and how many columns to display.') . '

'; -$help .= '

' . __('Drag and Drop - To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.') . '

'; -$help .= '

' . __('Box Controls - Click the title bar of the box to expand or collapse it. In addition, some boxes have configurable content, and will show a “Configure” link in the title bar if you hover over it.') . '

'; +$help = '

' . __( 'You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.' ) . '

'; +$help .= '

' . __( 'Screen Options - Use the Screen Options tab to choose which Dashboard boxes to show.' ) . '

'; +$help .= '

' . __( 'Drag and Drop - To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.' ) . '

'; +$help .= '

' . __( 'Box Controls - Click the title bar of the box to expand or collapse it. In addition, some boxes have configurable content, and will show a “Configure” link in the title bar if you hover over it.' ) . '

'; $screen->add_help_tab( array( 'id' => 'help-layout', - 'title' => __('Layout'), + 'title' => __( 'Layout' ), 'content' => $help, ) ); -$help = '

' . __('The boxes on your Dashboard screen are:') . '

'; +$help = '

' . __( 'The boxes on your Dashboard screen are:' ) . '

'; if ( current_user_can( 'edit_posts' ) ) - $help .= '

' . __('Right Now - Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.') . '

'; -if ( current_user_can( 'moderate_comments' ) ) - $help .= '

' . __('Recent Comments - Shows the most recent comments on your posts (configurable, up to 30) and allows you to moderate them.') . '

'; -if ( current_user_can( 'publish_posts' ) ) - $help .= '

' . __('Incoming Links - Shows links to your site found by Google Blog Search.') . '

'; -if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { - $help .= '

' . __('QuickPress - Allows you to create a new post and either publish it or save it as a draft.') . '

'; - $help .= '

' . __('Recent Drafts - Displays links to the 5 most recent draft posts you’ve started.') . '

'; -} -$help .= '

' . __('WordPress Blog - Latest news from the official WordPress project.') . '

'; -$help .= '

' . __('Other WordPress News - Shows the WordPress Planet feed. You can configure it to show a different feed of your choosing.') . '

'; + $help .= '

' . __( 'Site Content - Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '

'; +$help .= '

' . __( 'Activity - Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.' ) . '

'; +if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) + $help .= '

' . __( "Quick Draft - Allows you to create a new post and save it as a draft. Also displays links to the 5 most recent draft posts you've started." ) . '

'; if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) - $help .= '

' . __('Plugins - Features the most popular, newest, and recently updated plugins from the WordPress.org Plugin Directory.') . '

'; + $help .= '

' . __( 'WordPress News - Latest news from the official WordPress project, the WordPress Planet, and popular and recent plugins.' ) . '

'; +else + $help .= '

' . __( 'WordPress News - Latest news from the official WordPress project, the WordPress Planet.' ) . '

'; if ( current_user_can( 'edit_theme_options' ) ) - $help .= '

' . __('Welcome - Shows links for some of the most common tasks when setting up a new site.') . '

'; + $help .= '

' . __( 'Welcome - Shows links for some of the most common tasks when setting up a new site.' ) . '

'; $screen->add_help_tab( array( 'id' => 'help-content', - 'title' => __('Content'), + 'title' => __( 'Content' ), 'content' => $help, ) ); @@ -99,16 +89,16 @@ $screen->set_help_sidebar( '

' . __( 'Support Forums' ) . '

' ); -include (ABSPATH . 'wp-admin/admin-header.php'); +include ( ABSPATH . 'wp-admin/admin-header.php' ); -$today = current_time('mysql', 1); +$today = current_time( 'mysql', 1 ); ?>
- -

+ +

- -
- +
+
- + -
- - - -
-
+
+ +
- + \ No newline at end of file diff --git a/src/wp-admin/js/dashboard.js b/src/wp-admin/js/dashboard.js index 50a17f85eb..34e6dad229 100644 --- a/src/wp-admin/js/dashboard.js +++ b/src/wp-admin/js/dashboard.js @@ -29,10 +29,7 @@ jQuery(document).ready( function($) { // These widgets are sometimes populated via ajax ajaxWidgets = [ - 'dashboard_incoming_links', - 'dashboard_primary', - 'dashboard_secondary', - 'dashboard_plugins' + 'dashboard_rss' ]; ajaxPopulateWidgets = function(el) { @@ -66,28 +63,32 @@ jQuery(document).ready( function($) { quickPressLoad = function() { var act = $('#quickpost-action'), t; t = $('#quick-press').submit( function() { - $('#dashboard_quick_press #publishing-action .spinner').show(); + $('#dashboard_quick_draft #publishing-action .spinner').show(); $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop('disabled', true); - if ( 'post' == act.val() ) { - act.val( 'post-quickpress-publish' ); + $.post( t.attr( 'action' ), t.serializeArray(), function( data ) { + // Replace the form, and prepend the published post. + $('#dashboard_quick_draft .inside').html( data ); + $('#quick-press').removeClass('initial-form'); + quickPressLoad(); + highlightLatestPost(); + $('#title').focus(); + }); + + function highlightLatestPost () { + var latestPost = $('#draft-list li').first(); + latestPost.css('background', '#fffbe5'); + setTimeout(function () { + latestPost.css('background', 'none'); + }, 1000); } - $('#dashboard_quick_press div.inside').load( t.attr( 'action' ), t.serializeArray(), function() { - $('#dashboard_quick_press #publishing-action .spinner').hide(); - $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop('disabled', false); - $('#dashboard_quick_press ul').next('p').remove(); - $('#dashboard_quick_press ul').find('li').each( function() { - $('#dashboard_recent_drafts ul').prepend( this ); - } ).end().remove(); - quickPressLoad(); - } ); return false; } ); $('#publish').click( function() { act.val( 'post-quickpress-publish' ); } ); - $('#title, #tags-input').each( function() { + $('#title, #tags-input, #content').each( function() { var input = $(this), prompt = $('#' + this.id + '-prompt-text'); if ( '' === this.value ) @@ -109,9 +110,39 @@ jQuery(document).ready( function($) { }); $('#quick-press').on( 'click focusin', function() { + $(this).addClass("quickpress-open"); + $("#description-wrap, p.submit").slideDown(200); wpActiveEditor = 'content'; }); }; quickPressLoad(); + // Activity Widget + $( '.show-more a' ).on( 'click', function(e) { + $( this ).fadeOut().closest('.activity-block').find( 'li.hidden' ).fadeIn().removeClass( 'hidden' ); + e.preventDefault(); + }) + + // Dashboard columns + jQuery(document).ready(function ($) { + // Update main column count on load + updateColumnCount(); + }); + + jQuery(window).resize( _.debounce( function(){ + updateColumnCount(); + }, 30) ); + + function updateColumnCount() { + var cols = 1, + windowWidth = parseInt(jQuery(window).width()); + if (799 < windowWidth && 1299 > windowWidth) + cols = 2; + if (1300 < windowWidth && 1799 > windowWidth) + cols = 3; + if (1800 < windowWidth) + cols = 4; + jQuery('.metabox-holder').attr('class', jQuery('.metabox-holder').attr('class').replace(/columns-\d+/, 'columns-' + cols)); + } + } ); diff --git a/src/wp-admin/js/plugin-install.js b/src/wp-admin/js/plugin-install.js index 26e9982e28..a8d44673d9 100644 --- a/src/wp-admin/js/plugin-install.js +++ b/src/wp-admin/js/plugin-install.js @@ -27,7 +27,7 @@ jQuery(document).ready(function($) { $(window).resize(function(){ tb_position(); }); - $('#dashboard_plugins, .plugins').on( 'click', 'a.thickbox', function() { + $('.plugins').on( 'click', 'a.thickbox', function() { tb_click.call(this); $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'}); diff --git a/src/wp-admin/post.php b/src/wp-admin/post.php index b832004ff7..536c18c0bf 100644 --- a/src/wp-admin/post.php +++ b/src/wp-admin/post.php @@ -66,8 +66,6 @@ function redirect_post($post_id = '') { $location = add_query_arg( 'message', 3, wp_get_referer() ); $location = explode('#', $location); $location = $location[0] . '#postcustom'; - } elseif ( 'post-quickpress-save-cont' == $_POST['action'] ) { - $location = "post.php?action=edit&post=$post_id&message=7"; } else { $location = add_query_arg( 'message', 4, get_edit_post_link( $post_id, 'url' ) ); } @@ -96,30 +94,40 @@ if ( ! $sendback || } switch($action) { +case 'post-quickdraft-save': + // Check nonce and capabilities + $nonce = $_REQUEST['_wpnonce']; + $error_msg = false; + if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) + $error_msg = 'Unable to submit this form, please refresh and try again.'; + + if ( ! current_user_can( 'edit_posts' ) ) + $error_msg = "Oops, you don't have access to add new drafts."; + + if ( $error_msg ) + return wp_dashboard_quick_draft( $error_msg ); + + $post = get_post( $_REQUEST['post_ID'] ); + check_admin_referer( 'add-' . $post->post_type ); + edit_post(); + // output the quickdraft dashboard widget + require_once(ABSPATH . 'wp-admin/includes/dashboard.php'); + wp_dashboard_quick_draft(); + exit; + break; + case 'postajaxpost': case 'post': -case 'post-quickpress-publish': -case 'post-quickpress-save': - check_admin_referer('add-' . $post_type); + // Check nonce and capabilities + $nonce = $_REQUEST['_wpnonce']; + $error_msg = false; + if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) + $error_msg = 'Unable to submit this form, please refresh and try again.'; - if ( 'post-quickpress-publish' == $action ) - $_POST['publish'] = 'publish'; // tell write_post() to publish + if ( ! current_user_can( 'edit_posts' ) ) + $error_msg = "Oops, you don't have access to add new drafts."; - if ( 'post-quickpress-publish' == $action || 'post-quickpress-save' == $action ) { - $_POST['comment_status'] = get_option('default_comment_status'); - $_POST['ping_status'] = get_option('default_ping_status'); - $post_id = edit_post(); - } else { - $post_id = 'postajaxpost' == $action ? edit_post() : write_post(); - } - - if ( 0 === strpos( $action, 'post-quickpress' ) ) { - $_POST['post_ID'] = $post_id; - // output the quickpress dashboard widget - require_once(ABSPATH . 'wp-admin/includes/dashboard.php'); - wp_dashboard_quick_press(); - exit; - } + $post_id = 'postajaxpost' == $action ? edit_post() : write_post(); redirect_post($post_id); exit(); diff --git a/src/wp-includes/default-widgets.php b/src/wp-includes/default-widgets.php index 84bc7af686..cda66c0457 100644 --- a/src/wp-includes/default-widgets.php +++ b/src/wp-includes/default-widgets.php @@ -904,7 +904,7 @@ function wp_widget_rss_output( $rss, $args = array() ) { if ( $link == '' ) { echo "
  • $title{$date}{$summary}{$author}
  • "; } else { - echo "
  • $title{$date}{$summary}{$author}
  • "; + echo "
  • $title{$date}
    {$summary}{$author}
  • "; } } echo '';