Changeset 9103
- Timestamp:
- 10/08/08 23:32:34 (2 months ago)
- Files:
-
- trunk/wp-admin/admin-ajax.php (modified) (2 diffs)
- trunk/wp-admin/admin-header.php (modified) (1 diff)
- trunk/wp-admin/css/colors-classic-rtl.css (modified) (1 diff)
- trunk/wp-admin/css/colors-classic.css (modified) (3 diffs)
- trunk/wp-admin/css/colors-fresh-rtl.css (modified) (1 diff)
- trunk/wp-admin/css/colors-fresh.css (modified) (3 diffs)
- trunk/wp-admin/css/dashboard-rtl.css (modified) (1 diff)
- trunk/wp-admin/css/dashboard.css (modified) (3 diffs)
- trunk/wp-admin/css/ie-rtl.css (modified) (2 diffs)
- trunk/wp-admin/css/ie.css (modified) (3 diffs)
- trunk/wp-admin/edit-form-advanced.php (modified) (1 diff)
- trunk/wp-admin/edit-form-comment.php (modified) (1 diff)
- trunk/wp-admin/edit-link-form.php (modified) (1 diff)
- trunk/wp-admin/edit-page-form.php (modified) (1 diff)
- trunk/wp-admin/includes/dashboard.php (modified) (15 diffs)
- trunk/wp-admin/includes/post.php (modified) (1 diff)
- trunk/wp-admin/includes/template.php (modified) (4 diffs)
- trunk/wp-admin/index-extra.php (modified) (1 diff)
- trunk/wp-admin/index.php (modified) (2 diffs)
- trunk/wp-admin/js/dashboard.js (added)
- trunk/wp-admin/js/postbox.js (modified) (5 diffs)
- trunk/wp-admin/post.php (modified) (2 diffs)
- trunk/wp-admin/press-this.php (modified) (1 diff)
- trunk/wp-admin/wp-admin.css (modified) (5 diffs)
- trunk/wp-includes/script-loader.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/admin-ajax.php
r9098 r9103 466 466 if ( ! $comment ) die('1'); 467 467 468 $mode = ( isset($_POST['mode']) && 'single' == $_POST['mode'] ) ? 'single' : 'detail'; 468 $modes = array( 'single', 'detail', 'dashboard' ); 469 $mode = isset($_POST['mode']) && in_array( $_POST['mode'], $modes ) ? $_POST['mode'] : 'detail'; 469 470 $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1'; 470 471 $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0; … … 476 477 477 478 ob_start(); 478 _wp_comment_row( $comment->comment_ID, $mode, false, $checkbox ); 479 if ( 'dashboard' == $mode ) { 480 require_once( ABSPATH . 'wp-admin/includes/dashboard.php' ); 481 _wp_dashboard_recent_comments_row( $comment, false ); 482 } else { 483 _wp_comment_row( $comment->comment_ID, $mode, false, $checkbox ); 484 } 479 485 $comment_list_item = ob_get_contents(); 480 486 ob_end_clean(); trunk/wp-admin/admin-header.php
r9068 r9103 81 81 } 82 82 83 $settings_pages = array( 'categories.php', 'edit.php', 'edit-comments.php', 'edit-form-advanced.php', 'edit-link-categories.php', 'edit-link-form.php', 'edit-page-form.php', 'edit-tags.php', 'link-manager.php', 'upload.php', 'users.php', 'edit-pages.php', 'post-new.php', 'post.php', 'page-new.php', 'page.php' );83 $settings_pages = array( 'categories.php', 'edit.php', 'edit-comments.php', 'edit-form-advanced.php', 'edit-link-categories.php', 'edit-link-form.php', 'edit-page-form.php', 'edit-tags.php', 'link-manager.php', 'upload.php', 'users.php', 'edit-pages.php', 'post-new.php', 'post.php', 'page-new.php', 'page.php', 'index.php' ); 84 84 ?> 85 85 trunk/wp-admin/css/colors-classic-rtl.css
r8632 r9103 8 8 background-position:99% 10px; 9 9 } 10 #poststuff .closed .togbox, #poststuff .togbox {10 .metabox-holder .closed .togbox, .metabox-holder .togbox, #poststuff .closed .togbox, #poststuff .togbox { 11 11 background-image: url(../images/toggle-arrow-rtl.gif) !important; 12 12 } trunk/wp-admin/css/colors-classic.css
r9098 r9103 63 63 64 64 li.widget-list-control-item, div.nav, .tablenav, #dashboard-widgets p.dashboard-widget-links, 65 .form-table tr, #poststuff h3, #replyhandle,65 .form-table tr, #poststuff h3, .metabox-holder h3, #replyhandle, 66 66 .login form, h3.info-box-title, #post-status-info, #edit-settings-wrap, 67 67 #wpbody-content .describe tr, #edithead, #replyhead { … … 499 499 } 500 500 501 #poststuff .closed .togbox {501 .metabox-holder .closed .togbox, #poststuff .closed .togbox { 502 502 background-color: #2583ad; 503 503 background-image: url(../images/toggle-arrow.gif); 504 504 } 505 505 506 #poststuff .postbox, #titlediv, #poststuff .postarea, #poststuff .stuffbox {506 .metabox-holder .postbox, #poststuff .postbox, #titlediv, #poststuff .postarea, #poststuff .stuffbox { 507 507 border-color: #ebebeb; 508 508 border-right-color: #ccc; … … 510 510 } 511 511 512 #poststuff .togbox {512 .metabox-holder .togbox, #poststuff .togbox { 513 513 background-color: #b2b2b2; 514 514 background-image: url(../images/toggle-arrow.gif); 515 515 } 516 516 517 #poststuff .postbox {517 .metabox-holder .postbox, #poststuff .postbox { 518 518 background-color: #FFF; 519 519 } trunk/wp-admin/css/colors-fresh-rtl.css
r8632 r9103 16 16 border-left-color: #ccc; 17 17 } 18 #poststuff .closed .togbox, #poststuff .togbox {18 .metabox-holder .closed .togbox, .metabox-holder .togbox, #poststuff .closed .togbox, #poststuff .togbox { 19 19 background-image: url(../images/toggle-arrow-rtl.gif); 20 20 } trunk/wp-admin/css/colors-fresh.css
r9098 r9103 63 63 64 64 li.widget-list-control-item, div.nav, .tablenav, #dashboard-widgets p.dashboard-widget-links, 65 .form-table tr, #poststuff h3, #replyhandle,65 .form-table tr, #poststuff h3, .metabox-holder h3, #replyhandle, 66 66 .login form, h3.info-box-title, #post-status-info, #edit-settings-wrap, 67 67 #wpbody-content .describe tr, #edithead, #replyhead { … … 483 483 } 484 484 485 #poststuff .closed .togbox {485 .metabox-holder .closed .togbox, #poststuff .closed .togbox { 486 486 background-color: #2583ad; 487 487 background-image: url(../images/toggle-arrow.gif); 488 488 } 489 489 490 #poststuff .postbox, #titlediv, #poststuff .postarea, #poststuff .stuffbox {490 .metabox-holder .postbox, #poststuff .postbox, #titlediv, #poststuff .postarea, #poststuff .stuffbox { 491 491 border-color: #ebebeb; 492 492 border-right-color: #ccc; … … 494 494 } 495 495 496 #poststuff .togbox {496 .metabox-holder .togbox, #poststuff .togbox { 497 497 background-color: #b2b2b2; 498 498 background-image: url(../images/toggle-arrow.gif); 499 499 } 500 500 501 #poststuff .postbox {501 .metabox-holder .postbox, #poststuff .postbox { 502 502 background-color: #FFF; 503 503 } trunk/wp-admin/css/dashboard-rtl.css
r8632 r9103 1 /* Right Now */ 2 #rightnow { 3 margin-right:0; 4 margin-left: 7px; 5 } 6 #rightnow .reallynow span { 7 text-align: right; 8 float: right; 9 } 10 #rightnow .reallynow a { 11 text-align: left; 12 float: left; 13 margin: 1px 0 0 6px; 14 } 15 /* Widgets */ 16 div#dashboard-widgets-wrap { 17 margin-right:0; 18 margin-left:-13px; 19 } 20 div.dashboard-widget-holder { 21 float:right; 22 } 23 div.dashboard-widget { 24 margin-right:0; 25 margin-left: 20px; 26 } 27 h3.dashboard-widget-title span { 28 text-align: right; 29 float: right; 30 } 31 h3.dashboard-widget-title small { 32 text-align: left; 33 float:left; 34 } 35 div.dashboard-widget-submit input { 36 font-family: Tahoma; 37 } 38 div.dashboard-widget-content ul, div.dashboard-widget-content ol, div.dashboard-widget-content dl { 39 padding-left:0; 40 padding-right:15px; 41 } 42 #dashboard_secondary div.dashboard-widget-content ul li { 43 float:right; 44 } 45 #dashboard_secondary div.dashboard-widget-content ul li .post { 46 font-family:arial; 47 } 48 #dashboard_secondary div.dashboard-widget-content ul li a { 49 border-right:0 none; 50 border-left: 1px solid #dadada; 51 height:110px; 52 } 53 #dashboard_secondary div.dashboard-widget-content ul li a cite { 54 font-family: Tahoma; 55 } 56 #dashboard-widgets .widget_rss ul li span.rss-date { 57 float:right; 58 } 59 #dashboard-widgets .widget_rss ul li a { 60 float: right; 61 margin: 0 0 .2em .5em; 62 } 1 /* TODO */ trunk/wp-admin/css/dashboard.css
r9061 r9103 30 30 } 31 31 32 33 /* Widgets */ 34 35 div#dashboard-widgets-wrap { 36 margin-right: -13px; /* 20 (div.dashboard-widget margin-right) - 7 (#rightnow margin-right) */ 37 } 38 39 div#dashboard-widgets { 40 width: 100%; 41 } 42 43 div.dashboard-widget-holder { 44 margin-bottom: 20px; 45 width: 50%; 46 float: left; 47 } 48 49 div.dashboard-widget-holder.third { 50 width: 33.3%; 51 } 52 53 div.dashboard-widget-holder.fourth { 54 width: 25%; 55 } 56 57 div.dashboard-widget-holder.full { 58 width: 100%; 59 } 60 61 div.dashboard-widget-holder.double div.dashboard-widget { 62 height: 54em; 63 padding-bottom: 28px /* lame */ 64 } 65 66 div.dashboard-widget { 67 position: relative; 68 margin-right: 20px; 69 border-width: 1px; 70 border-style: solid; 71 height: 27em; 72 overflow: auto; 73 font-size: 11px; 74 } 75 76 #dashboard-widgets p.dashboard-widget-links { 77 padding: 2px; 78 font-size: 11px; 79 line-height: 2; 80 border-width: 1px; 81 margin: 0 20px 0 0; 82 padding: 0 7px; 83 border: 1px solid; 84 border-top: none; 85 } 86 87 h3.dashboard-widget-title { 88 margin: 2px; 89 padding: 0 7px; 90 font-size: 14px; 91 line-height: 2; 92 } 93 94 h3.dashboard-widget-title span { 95 display: block; 96 text-align: left; 97 float: left; 98 } 99 100 h3.dashboard-widget-title small { 101 display: block; 102 text-align: right; 103 float: right; 104 font-size: 75%; 105 line-height: 2.67; /* math: it works, bitches */ 106 } 107 108 p.dashboard-widget-links img.rss-icon { 109 vertical-align: middle; 110 } 111 112 div.dashboard-widget-notice { 113 padding: 0 14px; 114 font-size: 1.2em; 115 line-height: 2; 116 } 117 118 div.dashboard-widget-error { 119 padding: 0 20px; 120 font-size: 1.2em; 121 line-height: 2; 122 } 123 124 div.dashboard-widget-content { 125 padding: 10px 15px; 126 } 127 128 div.dashboard-widget-submit { 129 border-top: 1px solid #ccc; 130 padding: 1em 0 0 0; 131 margin: 10px 0 0 0; 132 } 133 div.dashboard-widget-submit input { 134 font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif; 135 padding: 4px 6px; 136 border: none; 137 font-size: 13px; 138 -moz-border-radius: 3px; 139 -khtml-border-radius: 3px; 140 -webkit-border-radius: 3px; 141 border-radius: 3px; 142 cursor: pointer; 143 text-decoration: none; 144 } 145 146 div.dashboard-widget-content ul, div.dashboard-widget-content ol, div.dashboard-widget-content dl { 32 form p.field-tip { 33 font-size: .9em; 34 font-style: italic; 147 35 margin: 0; 148 text-indent: 0;149 padding-left: 15px;150 }151 div.dashboard-widget-content li {152 margin: .5em 0 1em;153 }154 155 div.dashboard-widget-content blockquote {156 margin: -1em 0;157 }158 159 div#dashboard_recent_comments p {160 font-size: 14px;161 }162 163 div.dashboard-widget-content p.comment-meta {164 font-size: 11px !important;165 }166 167 #dashboard_secondary div.dashboard-widget {168 height: auto;169 }170 171 #dashboard_secondary div.dashboard-widget-content ul {172 list-style: none;173 36 padding: 0; 174 37 } 175 38 176 #dashboard_secondary div.dashboard-widget-content ul li { 177 display: block; 178 width: 19.95%; 179 padding-bottom: 10px; 180 margin: 0; 181 float: left; 182 font-size: 95%; 39 #dashboard-widgets .postbox form .submit { 40 float: none; 41 margin: .5em 0 0; 42 padding: 0; 43 border: none; 183 44 } 184 45 185 #dashboard_secondary div.dashboard-widget-content { 186 margin: 10px 5px; 46 #dashboard-widgets-wrap #dashboard-widgets .postbox form .submit input { 47 margin: 0; 48 } 49 50 #dashboard-widgets-wrap #dashboard-widgets .postbox form .submit #publish { 51 min-width: 0; 52 } 53 54 div.postbox div.inside { 55 margin: 0 10px 10px; 56 position: relative; 57 } 58 59 .view-all { 60 position: absolute; 61 top: 0; 62 right: 0; 63 padding: 0; 64 margin: 0; 65 } 66 67 #dashboard-widgets h4 { 68 font-size: 1em; 69 margin: 0 0 .2em; 187 70 padding: 0; 188 71 } 189 72 190 #dashboard_secondary div.dashboard-widget-content ul li .post { 191 display:block; 192 font-family:Georgia,"Times New Roman",Times,serif; 193 font-size:18px; 194 line-height: 1.2em; 195 height:90px; 196 overflow:hidden; 73 /* Recent Comments */ 74 75 #the-comment-list { 76 position: relative; 197 77 } 198 78 199 #dashboard_secondary div.dashboard-widget-content ul li a { 200 display: block; 201 height:100%; 202 overflow:hidden; 203 margin: 5px 10px; 204 text-decoration: none; 205 padding: .5em; 206 border-right: 1px solid #dadada; 207 border-bottom: 1px solid #dadada; 79 #the-comment-list .comment-item { 80 padding: 5px 5px 5px 47px; 208 81 } 209 82 210 # dashboard_secondary div.dashboard-widget-content ul li a cite{211 display: block;212 font-family: "Lucida Sans", "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;83 #the-comment-list .comment-item .avatar { 84 position: absolute; 85 left: 5px; 213 86 } 214 87 215 #dashboard-widgets .widget_rss ul { 216 list-style: none; 88 #the-comment-list .comment-item blockquote, #the-comment-list .comment-item blockquote p { 89 margin: 0; 90 padding: 0; 91 display: inline; 92 } 93 94 #dashboard_recent_comments #the-comment-list .trackback blockquote, #dashboard_recent_comments #the-comment-list .pingback blockquote { 95 display: block; 96 } 97 98 #the-comment-list .comment-item p.comment-actions { 99 margin: 0; 217 100 padding: 0; 218 101 } 219 102 220 #dashboard-widgets .widget_rss ul li { 221 clear: both; 222 } 223 224 #dashboard-widgets .widget_rss ul li span.rss-date { 225 float: left; 226 margin: 0; 227 } 228 229 #dashboard-widgets .widget_rss ul li a { 230 float: left; 231 margin: 0 .5em .2em 0; 232 font-weight: bold; 233 } 234 235 #dashboard-widgets .widget_rss ul li div { 236 clear: both; 237 line-height: 1.5em; 238 } 103 /* Primary Feed */ 239 104 240 105 #dashboard_primary a.rsswidget, #dashboard_plugins h5 { … … 246 111 } 247 112 248 #dashboard_plugins h4 { 249 font-size: 1em; 250 margin: 0 0 .1em; 251 } 113 /* Plugins */ 252 114 253 115 #dashboard_plugins h5 { … … 261 123 line-height: 1.5em; 262 124 } 263 264 #dashboard_inbox div.dashboard-widget, #dashboard_quick_press div.dashboard-widget {265 height: 35em;266 padding-bottom: 0;267 }268 269 #dashboard_quick_press div.dashboard-widget-content {270 padding-bottom: 0;271 }272 273 #dashboard_inbox p.actions {274 margin-bottom:0pt;275 margin-top: 0;276 float:left;277 }278 279 #dashboard_quick_press h3 {280 margin-bottom: 3px;281 }282 283 #dashboard_quick_press h3#quick-post-title {284 margin-top: 0;285 }286 287 #dashboard_quick_press p.field-tip {288 margin-top: 0;289 font-style: italic;290 }291 292 #dashboard_quick_press .submit {293 padding: 0 0 1em 0;294 border-top: none;295 border-bottom: 1px solid #ccc;296 }297 298 #dashboard_quick_press p#recent-drafts {299 margin: 0;300 }trunk/wp-admin/css/ie-rtl.css
r9018 r9103 1 #poststuff .postbox h3 {1 .metabox-holder .postbox h3, #poststuff .postbox h3 { 2 2 padding-left:0; 3 3 padding-right: 23px; … … 21 21 margin: 4px -9px 0 0; 22 22 } 23 #poststuff .togbox {23 .metabox-holder .togbox, #poststuff .togbox { 24 24 margin-left:0; 25 25 margin-right: -19px; trunk/wp-admin/css/ie.css
r9073 r9103 1 1 /* Fixes for IE bugs */ 2 2 3 #poststuff .postbox h3 {3 .metabox-holder .postbox h3, #poststuff .postbox h3 { 4 4 padding-left: 23px; 5 5 } … … 32 32 } 33 33 34 #wpwrap, #wpcontent, #post, #wrap, #postdivrich, #postdiv, #poststuff, #titlediv, #post-body, #editorcontainer, .tablenav, .widget-control-list, li.widget-list-control-item, #dragHelper, li.widget-list-control-item h4, .widget-sortable, .widget-control-actions {34 #wpwrap, #wpcontent, #post, #wrap, #postdivrich, #postdiv, #poststuff, .metabox-holder, #titlediv, #post-body, #editorcontainer, .tablenav, .widget-control-list, li.widget-list-control-item, #dragHelper, li.widget-list-control-item h4, .widget-sortable, .widget-control-actions { 35 35 display: block; 36 36 zoom: 100%; … … 89 89 } 90 90 91 #poststuff .togbox {91 .metabox-holder .togbox, #poststuff .togbox { 92 92 margin-left: -19px; 93 93 } trunk/wp-admin/edit-form-advanced.php
r9055 r9103 446 446 <?php echo $form_extra ?> 447 447 448 <div id="poststuff" >448 <div id="poststuff" class="metabox-holder"> 449 449 450 450 <div id="side-info" style="display: none;"><?php // TODO ?> trunk/wp-admin/edit-form-comment.php
r9099 r9103 20 20 <div class="wrap"> 21 21 22 <div id="poststuff" >22 <div id="poststuff" class="metabox-holder"> 23 23 <input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" /> 24 24 <input type="hidden" name="action" value='<?php echo $form_action . $form_extra ?>' /> trunk/wp-admin/edit-link-form.php
r9054 r9103 310 310 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> 311 311 312 <div id="poststuff" >312 <div id="poststuff" class="metabox-holder"> 313 313 314 314 <div id="side-info-column" class="inner-sidebar"> trunk/wp-admin/edit-page-form.php
r9054 r9103 348 348 --> 349 349 350 <div id="poststuff" >350 <div id="poststuff" class="metabox-holder"> 351 351 352 352 <div id="side-info-column" class="inner-sidebar"> trunk/wp-admin/includes/dashboard.php
r9078 r9103 15 15 */ 16 16 function wp_dashboard_setup() { 17 global $wpdb, $wp_dashboard_sidebars; 17 global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks; 18 $wp_dashboard_control_callbacks = array(); 19 18 20 $update = false; 19 21 $widget_options = get_option( 'dashboard_widget_options' ); … … 21 23 $widget_options = array(); 22 24 23 24 /* Register WP Dashboard Dynamic Sidebar */25 register_sidebar( array(26 'name' => 'WordPress Dashboard',27 'id' => 'wp_dashboard',28 'before_widget' => "\t<div class='dashboard-widget-holder %2\$s' id='%1\$s'>\n\n\t\t<div class='dashboard-widget'>\n\n",29 'after_widget' => "\t\t</div>\n\n\t</div>\n\n",30 'before_title' => "\t\t\t<h3 class='dashboard-widget-title'>",31 'after_title' => "</h3>\n\n"32 ) );33 34 35 25 /* Register Widgets and Controls */ 36 26 37 27 // Recent Comments Widget 38 $mod_comments = wp_count_comments(); 39 $mod_comments = $mod_comments->moderated; 40 if ( current_user_can( 'moderate_comments' ) && $mod_comments ) { 41 $notice = sprintf( __ngettext( '%d comment awaiting moderation', '%d comments awaiting moderation', $mod_comments ), $mod_comments ); 42 $notice = "<a href='edit-comments.php?comment_status=moderated'>$notice</a>"; 43 } else { 44 $notice = ''; 45 } 46 wp_register_sidebar_widget( 'dashboard_recent_comments', __( 'Recent Comments' ), 'wp_dashboard_recent_comments', 47 array( 'all_link' => 'edit-comments.php', 'notice' => $notice, 'width' => 'half' ) 48 ); 49 28 wp_add_dashboard_widget( 'dashboard_recent_comments', __( 'Recent Comments' ), 'wp_dashboard_recent_comments' ); 50 29 51 30 // QuickPress Widget 52 if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'post-quickpress' ) ) { 53 $view = get_permalink( $_POST['post_ID'] ); 54 $edit = clean_url( get_edit_post_link( $_POST['post_ID'] ) ); 55 if ( 'post-quickpress-publish' == $_POST['action'] ) 56 $notice = sprintf( __( 'Post Published. <a href="%s">View post</a> | <a href="%s">Edit post</a>' ), clean_url( $view ), $edit ); 57 else 58 $notice = sprintf( __( 'Draft Saved. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ), clean_url( add_query_arg( 'preview', 1, $view ) ), $edit ); 59 } else { 60 $notice = ''; 61 } 62 wp_register_sidebar_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press', 63 array( 'all_link' => array( 'edit.php?post_status=draft', __('View All Drafts') ), 'width' => 'half', 'height' => 'double', 'notice' => $notice ) 64 ); 65 wp_register_widget_control( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_empty_control', 66 array( 'widget_id' => 'dashboard_quick_press' ) 67 ); 31 wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press', 'wp_dashboard_empty_control' ); 32 33 // Recent Drafts 34 wp_add_dashboard_widget( 'dashboard_recent_drafts', __( 'Recent Drafts' ), 'wp_dashboard_recent_drafts' ); 68 35 69 36 // Incoming Links Widget … … 78 45 ); 79 46 } 80 wp_register_sidebar_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_empty', 81 array( 'all_link' => $widget_options['dashboard_incoming_links']['link'], 'feed_link' => $widget_options['dashboard_incoming_links']['url'], 'width' => 'half' ), 82 'wp_dashboard_cached_rss_widget', 'wp_dashboard_incoming_links_output' 83 ); 84 wp_register_widget_control( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_rss_control', array(), 85 array( 'widget_id' => 'dashboard_incoming_links', 'form_inputs' => array( 'title' => false, 'show_summary' => false, 'show_author' => false ) ) 86 ); 87 47 wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' ); 88 48 89 49 // WP Plugins Widget 90 wp_register_sidebar_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_empty', 91 array( 'all_link' => 'http://wordpress.org/extend/plugins/', 'feed_link' => 'http://wordpress.org/extend/plugins/rss/topics/', 'width' => 'half' ), 92 'wp_dashboard_cached_rss_widget', 'wp_dashboard_plugins_output', 93 array( 'http://wordpress.org/extend/plugins/rss/browse/popular/', 'http://wordpress.org/extend/plugins/rss/browse/new/', 'http://wordpress.org/extend/plugins/rss/browse/updated/' ) 94 ); 50 if ( current_user_can( 'activate_plugins' ) ) 51 wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' ); 95 52 96 53 // Primary feed (Dev Blog) Widget … … 107 64 ); 108 65 } 109 wp_register_sidebar_widget( 'dashboard_primary', $widget_options['dashboard_primary']['title'], 'wp_dashboard_empty', 110 array( 'all_link' => $widget_options['dashboard_primary']['link'], 'feed_link' => $widget_options['dashboard_primary']['url'], 'width' => 'half', 'class' => 'widget_rss' ), 111 'wp_dashboard_cached_rss_widget', 'wp_dashboard_rss_output' 112 ); 113 wp_register_widget_control( 'dashboard_primary', __( 'Primary Feed' ), 'wp_dashboard_rss_control', array(), 114 array( 'widget_id' => 'dashboard_primary' ) 115 ); 116 66 wp_add_dashboard_widget( 'dashboard_primary', $widget_options['dashboard_primary']['title'], 'wp_dashboard_primary', 'wp_dashboard_primary_control' ); 117 67 118 68 // Secondary Feed (Planet) Widget … … 126 76 ); 127 77 } 128 wp_register_sidebar_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_empty', 129 array( 'all_link' => $widget_options['dashboard_secondary']['link'], 'feed_link' => $widget_options['dashboard_secondary']['url'], 'width' => 'full' ), 130 'wp_dashboard_cached_rss_widget', 'wp_dashboard_secondary_output' 131 ); 132 wp_register_widget_control( 'dashboard_secondary', __( 'Secondary Feed' ), 'wp_dashboard_rss_control', array(), 133 array( 'widget_id' => 'dashboard_secondary', 'form_inputs' => array( 'show_summary' => false, 'show_author' => false, 'show_date' => false ) ) 134 ); 135 136 137 /* Dashboard Widget Template 138 wp_register_sidebar_widget( $widget_id (unique slug) , $widget_title, $output_callback, 139 array( 140 'all_link' => full url for "View All" link, 141 'feed_link' => full url for "RSS" link, 142 'width' => 'fourth', 'third', 'half', 'full' (defaults to 'half'), 143 'height' => 'single', 'double' (defaults to 'single'), 144 ), 145 $wp_dashboard_empty_callback (only needed if using 'wp_dashboard_empty' as your $output_callback), 146 $arg, $arg, $arg... (further args passed to callbacks) 147 ); 148 149 // optional: if you want users to be able to edit the settings of your widget, you need to register a widget_control 150 wp_register_widget_control( $widget_id, $widget_control_title, $control_output_callback, 151 array(), // leave an empty array here: oddity in widget code 152 array( 153 'widget_id' => $widget_id, // Yes - again. This is required: oddity in widget code 154 'arg' => an arg to pass to the $control_output_callback, 155 'another' => another arg to pass to the $control_output_callback, 156 ... 157 ) 158 ); 159 */ 78 wp_add_dashboard_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_secondary', 'wp_dashboard_secondary_control' ); 160 79 161 80 // Hook to register new widgets 162 81 do_action( 'wp_dashboard_setup' ); 163 82 164 // Hard code the sidebar's widgets and order165 $dashboard_widgets = array();166 $dashboard_widgets[] = 'dashboard_quick_press';167 $dashboard_widgets[] = 'dashboard_recent_comments';168 /*169 $dashboard_widgets[] = 'dashboard_incoming_links';170 $dashboard_widgets[] = 'dashboard_primary';171 if ( current_user_can( 'activate_plugins' ) )172 $dashboard_widgets[] = 'dashboard_plugins';173 */174 $dashboard_widgets[] = 'dashboard_secondary';175 176 83 // Filter widget order 177 $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', $dashboard_widgets ); 178 if ( in_array( 'dashboard_quick_press', $dashboard_widgets ) ) { 179 // add_action( 'admin_head', 'wp_teeny_mce' ); 180 add_action( 'admin_head', 'wp_dashboard_quick_press_js' ); 181 } 182 183 $wp_dashboard_sidebars = array( 'wp_dashboard' => $dashboard_widgets, 'array_version' => 3.5 ); 184 185 add_filter( 'dynamic_sidebar_params', 'wp_dashboard_dynamic_sidebar_params' ); 84 $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() ); 186 85 187 86 if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) { … … 195 94 if ( $update ) 196 95 update_option( 'dashboard_widget_options', $widget_options ); 96 97 foreach ( $dashboard_widgets as $widget_id ) 98 wp_add_dashboard_widget( $widget_id, $wp_registered_widgets[$widget_id]['name'], $wp_registered_widgets[$widget_id]['callback'], $wp_registered_widget_controls[$widget_id]['callback'] ); 99 } 100 101 function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null ) { 102 global $wp_dashboard_control_callbacks; 103 if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) { 104 $wp_dashboard_control_callbacks[$widget_id] = $control_callback; 105 if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) { 106 list($url) = explode( '#', add_query_arg( 'edit', false ), 2 ); 107 $widget_name .= ' <a href="' . clean_url( $url ) . '">' . __( 'Cancel' ) . '</a>'; 108 add_meta_box( $widget_id, $widget_name, '_wp_dashboard_control_callback', 'dashboard', 'normal', 'core' ); 109 return; 110 } 111 list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 ); 112 $widget_name .= ' <a href="' . clean_url( "$url#$widget_id" ) . '" class="open-box">' . __( 'Edit' ) . '</a>'; 113 } 114 add_meta_box( $widget_id, $widget_name , $callback, 'dashboard', 'normal', 'core' ); 115 } 116 117 function _wp_dashboard_control_callback( $dashboard, $meta_box ) { 118 echo '<form action="" method="post">'; 119 wp_dashboard_trigger_widget_control( $meta_box['id'] ); 120 echo "<p class='submit'><input type='hidden' name='widget_id' value='$meta_box[id]' /><input type='submit' value='" . __( 'Sumbit' ) . "' /></p>"; 121 122 echo '</form>'; 197 123 } 198 124 … … 203 129 */ 204 130 function wp_dashboard() { 205 echo "<div id='dashboard-widgets'>\n\n"; 206 207 // We're already filtering dynamic_sidebar_params obove 208 add_filter( 'option_sidebars_widgets', 'wp_dashboard_sidebars_widgets' ); // here there be hackery 209 dynamic_sidebar( 'wp_dashboard' ); 210 remove_filter( 'option_sidebars_widgets', 'wp_dashboard_sidebars_widgets' ); 211 212 echo "<br class='clear' />\n</div>\n\n\n"; 213 } 214 215 /** 216 * Makes sidebar_widgets option reflect the dashboard settings. 217 * 218 * @since unknown 219 * 220 * @return array WordPress Dashboard Widgets list. 221 */ 222 function wp_dashboard_sidebars_widgets() { // hackery 223 return $GLOBALS['wp_dashboard_sidebars']; 224 } 225 226 // Modifies sidbar params on the fly to set up ids, class names, titles for each widget (called once per widget) 227 // Switches widget to edit mode if $_GET['edit'] 228 /** 229 * {@internal Missing Short Description}} 230 * 231 * @since unknown 232 * 233 * @param unknown_type $params 234 * @return unknown 235 */ 236 function wp_dashboard_dynamic_sidebar_params( $params ) { 237 global $wp_registered_widgets, $wp_registered_widget_controls; 238 239 $sidebar_defaults = array('widget_id' => 0, 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => ''); 240 extract( $sidebar_defaults, EXTR_PREFIX_ALL, 'sidebar' ); 241 extract( $params[0], EXTR_PREFIX_ALL, 'sidebar' ); 242 243 if ( !isset($wp_registered_widgets[$sidebar_widget_id]) || !is_array($wp_registered_widgets[$sidebar_widget_id]) ) { 244 return $params; 245 } 246 $widget_defaults = array('id' => '', 'width' => '', 'height' => '', 'class' => '', 'feed_link' => '', 'all_link' => '', 'notice' => false, 'error' => false); 247 extract( $widget_defaults, EXTR_PREFIX_ALL, 'widget' ); 248 extract( $wp_registered_widgets[$sidebar_widget_id], EXTR_PREFIX_ALL, 'widget' ); 249 250 $the_classes = array(); 251 if ( in_array($widget_width, array( 'third', 'fourth', 'full' ) ) ) 252 $the_classes[] = $widget_width; 253 254 if ( 'double' == $widget_height ) 255 $the_classes[] = 'double'; 256 257 if ( $widget_class ) 258 $the_classes[] = $widget_class; 259 260 // Add classes to the widget holder 261 if ( $the_classes ) 262 $sidebar_before_widget = str_replace( "<div class='dashboard-widget-holder ", "<div class='dashboard-widget-holder " . join( ' ', $the_classes ) . ' ', $sidebar_before_widget ); 263 264 $top_links = $bottom_links = array(); 265 if ( $widget_all_link ) { 266 $widget_all_link = (array) $widget_all_link; 267 $bottom_links[] = '<a href="' . clean_url( $widget_all_link[0] ) . '">' . ( isset($widget_all_link[1]) ? $widget_all_link[1] : __( 'View All' ) ) . '</a>'; 268 } 269 270 $content_class = 'dashboard-widget-content'; 271 if ( current_user_can( 'edit_dashboard' ) && isset($wp_registered_widget_controls[$widget_id]) && is_callable($wp_registered_widget_controls[$widget_id]['callback']) ) { 272 // Switch this widget to edit mode 273 if ( isset($_GET['edit']) && $_GET['edit'] == $widget_id ) { 274 $content_class .= ' dashboard-widget-control'; 275 $wp_registered_widgets[$widget_id]['callback'] = 'wp_dashboard_empty'; 276 $sidebar_widget_name = $wp_registered_widget_controls[$widget_id]['name']; 277 $params[1] = 'wp_dashboard_trigger_widget_control'; 278 $sidebar_before_widget .= '<form action="' . clean_url(remove_query_arg( 'edit' )) . '" method="post">'; 279 $sidebar_after_widget = "<div class='dashboard-widget-submit'><input type='hidden' name='sidebar' value='wp_dashboard' /><input type='hidden' name='widget_id' value='$widget_id' /><input type='submit' value='" . __( 'Save' ) . "' /></div></form>$sidebar_after_widget"; 280 $top_links[] = '<a href="' . clean_url(remove_query_arg( 'edit' )) . '">' . __( 'Cancel' ) . '</a>'; 131 echo "<div id='dashboard-widgets' class='metabox-holder'>\n\n"; 132 133 echo "<div id='side-info-column' class='inner-sidebar'>\n\n"; 134 $class = do_meta_boxes( 'dashboard', 'side', '' ) ? ' class="has-sidebar"' : ''; 135 echo "</div>\n\n"; 136 137 echo "<div id='post-body'$class>\n\n"; 138 echo "<div id='dashboard-widgets-main-content' class='has-sidebar-content'>\n\n"; 139 do_meta_boxes( 'dashboard', 'normal', '' ); 140 echo "</div>\n\n"; 141 echo "</div>\n\n"; 142 143 echo "<form style='display: none' method='get' action=''>\n<p>\n"; 144 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); 145 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); 146 echo "</p>\n</form>\n"; 147 } 148 149 /* Dashboard Widgets */ 150 151 function wp_dashboard_quick_press( $dashboard, $meta_box ) { 152 $drafts = false; 153 if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'post-quickpress' ) ) { 154 $view = get_permalink( $_POST['post_ID'] ); 155 $edit = clean_url( get_edit_post_link( $_POST['post_ID'] ) ); 156 if ( 'post-quickpress-publish' == $_POST['action'] ) { 157 printf( __( 'Post Published. <a href="%s">View post</a> | <a href="%s">Edit post</a>' ), clean_url( $view ), $edit ); 281 158 } else { 282 $top_links[] = '<a href="' . clean_url(add_query_arg( 'edit', $widget_id )) . "#$widget_id" . '">' . __( 'Edit' ) . '</a>'; 283 } 284 } 285 286 if ( $widget_feed_link ) 287 $bottom_links[] = '<img class="rss-icon" src="' . includes_url('images/rss.png') . '" alt="' . __( 'rss icon' ) . '" /> <a href="' . clean_url( $widget_feed_link ) . '">' . __( 'RSS' ) . '</a>'; 288 289 $bottom_links = apply_filters( "wp_dashboard_widget_links_$widget_id", $bottom_links ); 290 291 // Could have put this in widget-content. Doesn't really matter 292 if ( $widget_notice ) 293 $sidebar_after_title .= "\t\t\t<div class='dashboard-widget-notice'>$widget_notice</div>\n\n"; 294 295 if ( $widget_error ) 296 $sidebar_after_title .= "\t\t\t<div class='dashboard-widget-error'>$widget_error</div>\n\n"; 297 298 $sidebar_after_title .= "\t\t\t<div class='$content_class'>\n\n"; 299 300 // Add links to widget's title bar 301 if ( $top_links ) { 302 $sidebar_before_title .= '<span>'; 303 $sidebar_after_title = '</span><small>' . join( ' | ', $top_links ) . "</small><br class='clear' />$sidebar_after_title"; 304 } 305 306 // Add links to bottom of widget 307 if ( $bottom_links ) 308 $sidebar_after_widget .= "<p class='dashboard-widget-links'>" . join( ' | ', $bottom_links ) . "</p>"; 309 310 $sidebar_after_widget .= "\t\t\t</div>\n\n"; 311 312 foreach( array_keys( $params[0] ) as $key ) 313 $$key = ${'sidebar_' . $key}; 314 315 $params[0] = compact( array_keys( $params[0] ) ); 316 317 return $params; 318 } 319 320 321 /* Dashboard Widgets */ 322 323 function wp_dashboard_quick_press( $sidebar_args ) { 324 extract( $sidebar_args, EXTR_SKIP ); 325 326 echo $before_widget; 327 328 echo $before_title; 329 echo $widget_name; 330 echo $after_title; 331 332 if ( ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) ) && 'post-quickpress-save-cont' === $_POST['action'] ) { 333 $post = get_post_to_edit( $_POST['post_ID'] ); 334 } else { 335 $_REQUEST = array(); // hack 336 $post = get_default_post_to_edit(); 337 } 159 printf( __( 'Draft Saved. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ), clean_url( add_query_arg( 'preview', 1, $view ) ), $edit ); 160 $drafts_query = new WP_Query( array( 161 'post_type' => 'post', 162 'what_to_show' => 'posts', 163 'post_status' => 'draft', 164 'author' => $GLOBALS['current_user']->ID, 165 'posts_per_page' => 1, 166 'orderby' => 'modified', 167 'order' => 'DESC' 168 ) ); 169 170 if ( $drafts_query->posts ) 171 $drafts =& $drafts_query->posts; 172 } 173 $_REQUEST = array(); // hack for get_default_post_to_edit() 174 } 175 176 $post = get_default_post_to_edit(); 338 177 ?> 339 178 340 179 <form name="post" action="<?php echo clean_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press"> 341 <h 3 id="quick-post-title"><label for="title"><?php _e('Title') ?></label></h3>180 <h4 id="quick-post-title"><label for="title"><?php _e('Title') ?></label></h4> 342 181 <div class="input-text-wrap"> 343 182 <input type="text" name="post_title" id="title" autocomplete="off" value="<?php echo attribute_escape( $post->post_title ); ?>" /> 344 183 </div> 345 184 346 <h 3><label for="content"><?php _e('Post') ?></label></h3>185 <h4><label for="content"><?php _e('Post') ?></label></h4> 347 186 <div class="textarea-wrap"> 348 187 <textarea name="content" id="quickpress-content" class="mceEditor" rows="3" cols="15"><?php echo $post->post_content; ?></textarea> 349 188 </div> 350 189 351 <h 3><label for="tags-input"><?php _e('Tags') ?></label></h3>190 <h4><label for="tags-input"><?php _e('Tags') ?></label></h4> 352 191 <div class="input-text-wrap"> 353 192 <input type="text" name="tags_input" id="tags-input" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /> … … 359 198 <input type="hidden" name="quickpress_post_ID" value="<?php echo (int) $post->ID; ?>" /> 360 199 <?php wp_nonce_field('add-post'); ?> 361 <input type="submit" name="save" id="save-post" class="button " value="<?php _e('Save'); ?>" />362 <input type="submit" name=" save-cont" id="save-cont" class="button" value="<?php _e('Save and Continue'); ?>" />363 < input type="submit" name="publish" id="publish" accesskey="p" class="button button-highlighted" value="<?php _e('Publish'); ?>" />200 <input type="submit" name="save" id="save-post" class="button alignleft" value="<?php _e('Save Draft'); ?>" /> 201 <input type="submit" name="publish" id="publish" accesskey="p" class="button button-
