diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php
index d22131b35..1558d0254 100644
--- a/wp-admin/includes/dashboard.php
+++ b/wp-admin/includes/dashboard.php
@@ -14,57 +14,24 @@
* @since unknown
*/
function wp_dashboard_setup() {
- global $wpdb, $wp_dashboard_sidebars;
+ global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks;
+ $wp_dashboard_control_callbacks = array();
+
$update = false;
$widget_options = get_option( 'dashboard_widget_options' );
if ( !$widget_options || !is_array($widget_options) )
$widget_options = array();
-
- /* Register WP Dashboard Dynamic Sidebar */
- register_sidebar( array(
- 'name' => 'WordPress Dashboard',
- 'id' => 'wp_dashboard',
- 'before_widget' => "\t
\n\n",
- 'before_title' => "\t\t\t
\n\n"
- ) );
-
-
/* Register Widgets and Controls */
// Recent Comments Widget
- $mod_comments = wp_count_comments();
- $mod_comments = $mod_comments->moderated;
- if ( current_user_can( 'moderate_comments' ) && $mod_comments ) {
- $notice = sprintf( __ngettext( '%d comment awaiting moderation', '%d comments awaiting moderation', $mod_comments ), $mod_comments );
- $notice = "
$notice";
- } else {
- $notice = '';
- }
- wp_register_sidebar_widget( 'dashboard_recent_comments', __( 'Recent Comments' ), 'wp_dashboard_recent_comments',
- array( 'all_link' => 'edit-comments.php', 'notice' => $notice, 'width' => 'half' )
- );
-
+ wp_add_dashboard_widget( 'dashboard_recent_comments', __( 'Recent Comments' ), 'wp_dashboard_recent_comments' );
// QuickPress Widget
- if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'post-quickpress' ) ) {
- $view = get_permalink( $_POST['post_ID'] );
- $edit = clean_url( get_edit_post_link( $_POST['post_ID'] ) );
- if ( 'post-quickpress-publish' == $_POST['action'] )
- $notice = sprintf( __( 'Post Published.
View post |
Edit post' ), clean_url( $view ), $edit );
- else
- $notice = sprintf( __( 'Draft Saved.
Preview post |
Edit post' ), clean_url( add_query_arg( 'preview', 1, $view ) ), $edit );
- } else {
- $notice = '';
- }
- wp_register_sidebar_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press',
- array( 'all_link' => array( 'edit.php?post_status=draft', __('View All Drafts') ), 'width' => 'half', 'height' => 'double', 'notice' => $notice )
- );
- wp_register_widget_control( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_empty_control',
- array( 'widget_id' => 'dashboard_quick_press' )
- );
+ wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press', 'wp_dashboard_empty_control' );
+
+ // Recent Drafts
+ wp_add_dashboard_widget( 'dashboard_recent_drafts', __( 'Recent Drafts' ), 'wp_dashboard_recent_drafts' );
// Incoming Links Widget
if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
@@ -77,21 +44,11 @@ function wp_dashboard_setup() {
'show_date' => 0
);
}
- wp_register_sidebar_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_empty',
- array( 'all_link' => $widget_options['dashboard_incoming_links']['link'], 'feed_link' => $widget_options['dashboard_incoming_links']['url'], 'width' => 'half' ),
- 'wp_dashboard_cached_rss_widget', 'wp_dashboard_incoming_links_output'
- );
- wp_register_widget_control( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_rss_control', array(),
- array( 'widget_id' => 'dashboard_incoming_links', 'form_inputs' => array( 'title' => false, 'show_summary' => false, 'show_author' => false ) )
- );
-
+ wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' );
// WP Plugins Widget
- wp_register_sidebar_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_empty',
- array( 'all_link' => 'http://wordpress.org/extend/plugins/', 'feed_link' => 'http://wordpress.org/extend/plugins/rss/topics/', 'width' => 'half' ),
- 'wp_dashboard_cached_rss_widget', 'wp_dashboard_plugins_output',
- 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/' )
- );
+ if ( current_user_can( 'activate_plugins' ) )
+ wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' );
// Primary feed (Dev Blog) Widget
if ( !isset( $widget_options['dashboard_primary'] ) ) {
@@ -106,14 +63,7 @@ function wp_dashboard_setup() {
'show_date' => 1
);
}
- wp_register_sidebar_widget( 'dashboard_primary', $widget_options['dashboard_primary']['title'], 'wp_dashboard_empty',
- array( 'all_link' => $widget_options['dashboard_primary']['link'], 'feed_link' => $widget_options['dashboard_primary']['url'], 'width' => 'half', 'class' => 'widget_rss' ),
- 'wp_dashboard_cached_rss_widget', 'wp_dashboard_rss_output'
- );
- wp_register_widget_control( 'dashboard_primary', __( 'Primary Feed' ), 'wp_dashboard_rss_control', array(),
- array( 'widget_id' => 'dashboard_primary' )
- );
-
+ 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'] ) ) {
@@ -125,64 +75,13 @@ function wp_dashboard_setup() {
'items' => 15
);
}
- wp_register_sidebar_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_empty',
- array( 'all_link' => $widget_options['dashboard_secondary']['link'], 'feed_link' => $widget_options['dashboard_secondary']['url'], 'width' => 'full' ),
- 'wp_dashboard_cached_rss_widget', 'wp_dashboard_secondary_output'
- );
- wp_register_widget_control( 'dashboard_secondary', __( 'Secondary Feed' ), 'wp_dashboard_rss_control', array(),
- array( 'widget_id' => 'dashboard_secondary', 'form_inputs' => array( 'show_summary' => false, 'show_author' => false, 'show_date' => false ) )
- );
-
-
- /* Dashboard Widget Template
- wp_register_sidebar_widget( $widget_id (unique slug) , $widget_title, $output_callback,
- array(
- 'all_link' => full url for "View All" link,
- 'feed_link' => full url for "RSS" link,
- 'width' => 'fourth', 'third', 'half', 'full' (defaults to 'half'),
- 'height' => 'single', 'double' (defaults to 'single'),
- ),
- $wp_dashboard_empty_callback (only needed if using 'wp_dashboard_empty' as your $output_callback),
- $arg, $arg, $arg... (further args passed to callbacks)
- );
-
- // optional: if you want users to be able to edit the settings of your widget, you need to register a widget_control
- wp_register_widget_control( $widget_id, $widget_control_title, $control_output_callback,
- array(), // leave an empty array here: oddity in widget code
- array(
- 'widget_id' => $widget_id, // Yes - again. This is required: oddity in widget code
- 'arg' => an arg to pass to the $control_output_callback,
- 'another' => another arg to pass to the $control_output_callback,
- ...
- )
- );
- */
+ wp_add_dashboard_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_secondary', 'wp_dashboard_secondary_control' );
// Hook to register new widgets
do_action( 'wp_dashboard_setup' );
- // Hard code the sidebar's widgets and order
- $dashboard_widgets = array();
- $dashboard_widgets[] = 'dashboard_quick_press';
- $dashboard_widgets[] = 'dashboard_recent_comments';
-/*
- $dashboard_widgets[] = 'dashboard_incoming_links';
- $dashboard_widgets[] = 'dashboard_primary';
- if ( current_user_can( 'activate_plugins' ) )
- $dashboard_widgets[] = 'dashboard_plugins';
-*/
- $dashboard_widgets[] = 'dashboard_secondary';
-
// Filter widget order
- $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', $dashboard_widgets );
- if ( in_array( 'dashboard_quick_press', $dashboard_widgets ) ) {
-// add_action( 'admin_head', 'wp_teeny_mce' );
- add_action( 'admin_head', 'wp_dashboard_quick_press_js' );
- }
-
- $wp_dashboard_sidebars = array( 'wp_dashboard' => $dashboard_widgets, 'array_version' => 3.5 );
-
- add_filter( 'dynamic_sidebar_params', 'wp_dashboard_dynamic_sidebar_params' );
+ $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) {
ob_start(); // hack - but the same hack wp-admin/widgets.php uses
@@ -194,6 +93,33 @@ function wp_dashboard_setup() {
if ( $update )
update_option( 'dashboard_widget_options', $widget_options );
+
+ foreach ( $dashboard_widgets as $widget_id )
+ 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'] );
+}
+
+function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null ) {
+ global $wp_dashboard_control_callbacks;
+ if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) {
+ $wp_dashboard_control_callbacks[$widget_id] = $control_callback;
+ if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) {
+ list($url) = explode( '#', add_query_arg( 'edit', false ), 2 );
+ $widget_name .= '
' . __( 'Cancel' ) . '';
+ add_meta_box( $widget_id, $widget_name, '_wp_dashboard_control_callback', 'dashboard', 'normal', 'core' );
+ return;
+ }
+ list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
+ $widget_name .= '
' . __( 'Edit' ) . '';
+ }
+ add_meta_box( $widget_id, $widget_name , $callback, 'dashboard', 'normal', 'core' );
+}
+
+function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
+ echo '
';
}
/**
@@ -202,153 +128,66 @@ function wp_dashboard_setup() {
* @since unknown
*/
function wp_dashboard() {
- echo "
\n\n";
+ echo "
\n\n\n";
+ echo "
\n\n";
+ echo "
\n\n";
+ do_meta_boxes( 'dashboard', 'normal', '' );
+ echo "
\n\n";
+ echo "
\n\n";
+
+ echo "
\n";
}
-/**
- * Makes sidebar_widgets option reflect the dashboard settings.
- *
- * @since unknown
- *
- * @return array WordPress Dashboard Widgets list.
- */
-function wp_dashboard_sidebars_widgets() { // hackery
- return $GLOBALS['wp_dashboard_sidebars'];
-}
-
-// Modifies sidbar params on the fly to set up ids, class names, titles for each widget (called once per widget)
-// Switches widget to edit mode if $_GET['edit']
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $params
- * @return unknown
- */
-function wp_dashboard_dynamic_sidebar_params( $params ) {
- global $wp_registered_widgets, $wp_registered_widget_controls;
-
- $sidebar_defaults = array('widget_id' => 0, 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '');
- extract( $sidebar_defaults, EXTR_PREFIX_ALL, 'sidebar' );
- extract( $params[0], EXTR_PREFIX_ALL, 'sidebar' );
-
- if ( !isset($wp_registered_widgets[$sidebar_widget_id]) || !is_array($wp_registered_widgets[$sidebar_widget_id]) ) {
- return $params;
- }
- $widget_defaults = array('id' => '', 'width' => '', 'height' => '', 'class' => '', 'feed_link' => '', 'all_link' => '', 'notice' => false, 'error' => false);
- extract( $widget_defaults, EXTR_PREFIX_ALL, 'widget' );
- extract( $wp_registered_widgets[$sidebar_widget_id], EXTR_PREFIX_ALL, 'widget' );
-
- $the_classes = array();
- if ( in_array($widget_width, array( 'third', 'fourth', 'full' ) ) )
- $the_classes[] = $widget_width;
-
- if ( 'double' == $widget_height )
- $the_classes[] = 'double';
-
- if ( $widget_class )
- $the_classes[] = $widget_class;
-
- // Add classes to the widget holder
- if ( $the_classes )
- $sidebar_before_widget = str_replace( "
' . ( isset($widget_all_link[1]) ? $widget_all_link[1] : __( 'View All' ) ) . '';
- }
-
- $content_class = 'dashboard-widget-content';
- if ( current_user_can( 'edit_dashboard' ) && isset($wp_registered_widget_controls[$widget_id]) && is_callable($wp_registered_widget_controls[$widget_id]['callback']) ) {
- // Switch this widget to edit mode
- if ( isset($_GET['edit']) && $_GET['edit'] == $widget_id ) {
- $content_class .= ' dashboard-widget-control';
- $wp_registered_widgets[$widget_id]['callback'] = 'wp_dashboard_empty';
- $sidebar_widget_name = $wp_registered_widget_controls[$widget_id]['name'];
- $params[1] = 'wp_dashboard_trigger_widget_control';
- $sidebar_before_widget .= '
$sidebar_after_widget";
- $top_links[] = '
' . __( 'Cancel' ) . '';
- } else {
- $top_links[] = '
' . __( 'Edit' ) . '';
- }
- }
-
- if ( $widget_feed_link )
- $bottom_links[] = '
' . __( 'RSS' ) . '';
-
- $bottom_links = apply_filters( "wp_dashboard_widget_links_$widget_id", $bottom_links );
-
- // Could have put this in widget-content. Doesn't really matter
- if ( $widget_notice )
- $sidebar_after_title .= "\t\t\t
$widget_notice
\n\n";
-
- if ( $widget_error )
- $sidebar_after_title .= "\t\t\t
$widget_error
\n\n";
-
- $sidebar_after_title .= "\t\t\t
\n\n";
-
- // Add links to widget's title bar
- if ( $top_links ) {
- $sidebar_before_title .= '
';
- $sidebar_after_title = '' . join( ' | ', $top_links ) . "$sidebar_after_title";
- }
-
- // Add links to bottom of widget
- if ( $bottom_links )
- $sidebar_after_widget .= "
" . join( ' | ', $bottom_links ) . "
";
-
- $sidebar_after_widget .= "\t\t\t
\n\n";
-
- foreach( array_keys( $params[0] ) as $key )
- $$key = ${'sidebar_' . $key};
-
- $params[0] = compact( array_keys( $params[0] ) );
-
- return $params;
-}
-
-
/* Dashboard Widgets */
-function wp_dashboard_quick_press( $sidebar_args ) {
- extract( $sidebar_args, EXTR_SKIP );
-
- echo $before_widget;
-
- echo $before_title;
- echo $widget_name;
- echo $after_title;
-
- if ( ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) ) && 'post-quickpress-save-cont' === $_POST['action'] ) {
- $post = get_post_to_edit( $_POST['post_ID'] );
- } else {
- $_REQUEST = array(); // hack
- $post = get_default_post_to_edit();
+function wp_dashboard_quick_press( $dashboard, $meta_box ) {
+ $drafts = false;
+ if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'post-quickpress' ) ) {
+ $view = get_permalink( $_POST['post_ID'] );
+ $edit = clean_url( get_edit_post_link( $_POST['post_ID'] ) );
+ if ( 'post-quickpress-publish' == $_POST['action'] ) {
+ printf( __( 'Post Published.
View post |
Edit post' ), clean_url( $view ), $edit );
+ } else {
+ printf( __( 'Draft Saved.
Preview post |
Edit post' ), clean_url( add_query_arg( 'preview', 1, $view ) ), $edit );
+ $drafts_query = new WP_Query( array(
+ 'post_type' => 'post',
+ 'what_to_show' => 'posts',
+ 'post_status' => 'draft',
+ 'author' => $GLOBALS['current_user']->ID,
+ 'posts_per_page' => 1,
+ 'orderby' => 'modified',
+ 'order' => 'DESC'
+ ) );
+
+ if ( $drafts_query->posts )
+ $drafts =& $drafts_query->posts;
+ }
+ $_REQUEST = array(); // hack for get_default_post_to_edit()
}
+
+ $post = get_default_post_to_edit();
?>
- if ( $drafts_query->posts ) :
+ 'post',
+ 'what_to_show' => 'posts',
+ 'post_status' => 'draft',
+ 'author' => $GLOBALS['current_user']->ID,
+ 'posts_per_page' => 5,
+ 'orderby' => 'modified',
+ 'order' => 'DESC'
+ ) );
+ $drafts =& $drafts_query->posts;
+ }
+
+ if ( $drafts && is_array( $drafts ) ) :
$list = array();
- foreach ( $drafts_query->posts as $draft ) {
+ foreach ( $drafts as $draft ) {
$url = get_edit_post_link( $draft->ID );
$title = _draft_or_post_title( $draft->ID );
$list[] = "
$title";
}
?>
-
-
-
-
-
+
-
-
-
-
-
-
- 'rss2', 'withcomments' => 1));
- remove_filter( 'option_posts_per_rss', $lambda );
-
- $is_first = true;
-
- if ( $comments_query->have_comments() ) {
- while ( $comments_query->have_comments() ) { $comments_query->the_comment();
-
- $comment_post_url = get_permalink( $comment->comment_post_ID );
- $comment_post_title = get_the_title( $comment->comment_post_ID );
- $comment_post_link = "
$comment_post_title";
- $comment_link = '';
- $comment_meta = sprintf( __( 'From
%1$s on %2$s %3$s' ), get_comment_author(), $comment_post_link, $comment_link );
-
- if ( $is_first ) : $is_first = false;
-?>
-
“”
-
-comment_count > 1 ) : ?>
-
-comment_post_ID );
+ $comment_post_title = get_the_title( $comment->comment_post_ID );
+ $comment_post_link = "
$comment_post_title";
+ $comment_link = '';
+
+ $delete_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
+ $approve_url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
+ $unapprove_url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) );
+ $spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
+
+ $actions = array();
+
+ if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
+ $actions['approve'] = "';
+ $actions['unapprove'] = "';
+ $actions['edit'] = "
". __('Edit') . '';
+ $actions['spam'] = "';
+ $actions['delete'] = "';
+ $actions['reply'] = '
' . __('Reply') . '';
+
+ $actions = apply_filters( 'comment_row_actions', $actions, $comment );
+
+ $i = 0;
+ $actions_string = '';
+ foreach ( $actions as $action => $link ) {
+ ++$i;
+ ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
+
+ // Reply and quickedit need a hide-if-no-js span
+ if ( 'reply' == $action || 'quickedit' == $action )
+ $action .= ' hide-if-no-js';
+
+ $actions_string .= "
$sep$link";
+ }
+ }
+
+?>
+
+
+ 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' );
+}
+
/**
* {@internal Missing Short Description}}
*
- * $sidebar_args are handled by wp_dashboard_empty().
- *
* @since unknown
*
* @param int $widget_id
@@ -579,11 +454,17 @@ function wp_dashboard_rss_output( $widget_id ) {
wp_widget_rss_output( $widgets[$widget_id] );
}
+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', array( 'show_summary' => false, 'show_author' => false, 'show_date' => false ) );
+}
+
/**
* Display secondary dashboard RSS widget feed.
*
- * $sidebar_args are handled by wp_dashboard_empty().
- *
* @since unknown
*
* @return unknown
@@ -609,11 +490,17 @@ function wp_dashboard_secondary_output() {
echo "\n
\n";
}
+function wp_dashboard_plugins() {
+ wp_dashboard_cached_rss_widget( 'dashboard_plugins', 'wp_dashboard_plugins_output', 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/'
+ ) );
+}
+
/**
* Display plugins most popular, newest plugins, and recently updated widget text.
*
- * $sidebar_args are handled by wp_dashboard_empty().
- *
* @since unknown
*/
function wp_dashboard_plugins_output() {
@@ -713,37 +600,7 @@ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = ar
return true;
}
-/**
- * Empty widget used for JS/AJAX created output.
- *
- * Callback inserts content between before_widget and after_widget. Used when
- * widget is in edit mode. Can also be used for custom widgets.
- *
- * @since unknown
- *
- * @param array $sidebar_args
- * @param callback $callback Optional. Only used in edit mode.
- */
-function wp_dashboard_empty( $sidebar_args, $callback = false ) {
- extract( $sidebar_args, EXTR_SKIP );
-
- echo $before_widget;
-
- echo $before_title;
- echo $widget_name;
- echo $after_title;
-
- // When in edit mode, the callback passed to this function is the widget_control callback
- if ( $callback && is_callable( $callback ) ) {
- $args = array_slice( func_get_args(), 2 );
- array_unshift( $args, $widget_id );
- call_user_func_array( $callback, $args );
- }
-
- echo $after_widget;
-}
-
-/* Dashboard Widgets Controls. See also wp_dashboard_empty() */
+/* Dashboard Widgets Controls */
// Temp
function wp_dashboard_empty_control() {
@@ -759,9 +616,11 @@ function wp_dashboard_empty_control() {
* @param int $widget_control_id Registered Widget ID.
*/
function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
- global $wp_registered_widget_controls;
- if ( is_scalar($widget_control_id) && $widget_control_id && isset($wp_registered_widget_controls[$widget_control_id]) && is_callable($wp_registered_widget_controls[$widget_control_id]['callback']) )
- call_user_func_array( $wp_registered_widget_controls[$widget_control_id]['callback'], $wp_registered_widget_controls[$widget_control_id]['params'] );
+ global $wp_dashboard_control_callbacks;
+
+ if ( is_scalar($widget_control_id) && $widget_control_id && isset($wp_dashboard_control_callbacks[$widget_control_id]) && is_callable($wp_dashboard_control_callbacks[$widget_control_id]) ) {
+ call_user_func( $wp_dashboard_control_callbacks[$widget_control_id], '', array( 'id' => $widget_control_id, 'callback' => $wp_dashboard_control_callbacks[$widget_control_id] ) );
+ }
}
/**
@@ -772,14 +631,10 @@ function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
*
* @since unknown
*
- * @param array $args Expects 'widget_id' and 'form_inputs'.
- * @return bool|null False if no widget_id is given. Null on success.
+ * @param string widget_id
+ * @param array form_inputs
*/
-function wp_dashboard_rss_control( $args ) {
- extract( $args );
- if ( !$widget_id )
- return false;
-
+function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
if ( !$widget_options = get_option( 'dashboard_widget_options' ) )
$widget_options = array();
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index d9249e462..e6d5e3bcf 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -819,6 +819,8 @@ function wp_edit_attachments_query( $q = false ) {
* @return unknown
*/
function postbox_classes( $id, $page ) {
+ if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id )
+ return '';
$current_user = wp_get_current_user();
if ( $closed = get_usermeta( $current_user->ID, 'closedpostboxes_'.$page ) ) {
if ( !is_array( $closed ) ) return '';
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index a2de3148a..2af19238c 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -2058,7 +2058,7 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
* @param unknown_type $checkbox
* @param unknown_type $mode
*/
-function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single') {
+function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', $table_row = true) {
global $current_user;
// allow plugin to replace the popup content
@@ -2069,8 +2069,12 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single')
return;
}
?>
-
+
+
+
-
-
+
+
diff --git a/wp-admin/js/dashboard.js b/wp-admin/js/dashboard.js
new file mode 100644
index 000000000..89990f5de
--- /dev/null
+++ b/wp-admin/js/dashboard.js
@@ -0,0 +1,48 @@
+jQuery( function($) {
+
+// close postboxes that should be closed
+jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
+
+// These widgets are sometimes populated via ajax
+var ajaxWidgets = [
+ 'dashboard_incoming_links',
+ 'dashboard_primary',
+ 'dashboard_secondary',
+ 'dashboard_plugins'
+];
+
+var ajaxPopulateWidgets = function() {
+ $.each( ajaxWidgets, function() {
+ var e = jQuery('#' + this + ':visible div.inside').find('.widget-loading');
+ if ( e.size() ) { e.parent().load('index-extra.php?jax=' + this); }
+ } );
+};
+ajaxPopulateWidgets();
+
+postboxes.add_postbox_toggles('dashboard', { onShow: ajaxPopulateWidgets } );
+
+/* QuickPress */
+var quickPressLoad = function() {
+ var act = $('#quickpost-action');
+ var t = $('#quick-press').submit( function() {
+ $('#dashboard_quick_press h3').append( '
' );
+
+ if ( 'post' == act.val() ) {
+ act.val( 'post-quickpress-publish' );
+ }
+
+ $('#dashboard_quick_press div.inside').load( t.attr( 'action' ), t.serializeArray(), function() {
+ $('#dashboard_quick_press h3 img').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' ); } );
+};
+quickPressLoad();
+
+} );
diff --git a/wp-admin/js/postbox.js b/wp-admin/js/postbox.js
index 2eb27406b..5f6d42d36 100644
--- a/wp-admin/js/postbox.js
+++ b/wp-admin/js/postbox.js
@@ -1,18 +1,22 @@
-
(function($) {
postboxes = {
- add_postbox_toggles : function(page) {
+ add_postbox_toggles : function(page,args) {
$('.postbox h3').before('
+ ');
$('.postbox h3, .postbox a.togbox').click( function() {
$($(this).parent().get(0)).toggleClass('closed');
postboxes.save_state(page);
});
+ $('.postbox h3 a').click( function(e) {
+ e.stopPropagation();
+ } );
$('.hide-postbox-tog').click( function() {
var box = jQuery(this).val();
- var show = jQuery(this).attr('checked');
- if ( show ) {
+ if ( jQuery(this).attr('checked') ) {
jQuery('#' + box).show();
+ if ( $.isFunction( postboxes.onShow ) ) {
+ postboxes.onShow( box );
+ }
} else {
jQuery('#' + box).hide();
}
@@ -26,7 +30,7 @@
}
$('#wpbody-content').css( 'overflow', 'hidden' );
- this.init(page);
+ this.init(page,args);
},
expandSidebar : function( doIt ) {
@@ -39,7 +43,8 @@
}
},
- init : function(page) {
+ init : function(page,args) {
+ $.extend( this, args || {} );
jQuery('.meta-box-sortables').sortable( {
connectWith: [ '.meta-box-sortables' ],
items: '> .postbox',
@@ -83,7 +88,10 @@
closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
page: page
});
- }
+ },
+
+ /* Callbacks */
+ onShow : false
};
$(document).ready(function(){postboxes.expandSidebar();});
diff --git a/wp-admin/post.php b/wp-admin/post.php
index d1dba117f..79824bf08 100644
--- a/wp-admin/post.php
+++ b/wp-admin/post.php
@@ -86,7 +86,6 @@ case 'postajaxpost':
case 'post':
case 'post-quickpress-publish':
case 'post-quickpress-save':
-case 'post-quickpress-save-cont':
check_admin_referer('add-post');
if ( 'post-quickpress-publish' == $action )
@@ -104,13 +103,11 @@ case 'post-quickpress-save-cont':
$post_ID = 'postajaxpost' == $action ? edit_post() : write_post();
}
- if ( 'post-quickpress-save-cont' != $action && 0 === strpos( $action, 'post-quickpress' ) ) {
+ if ( 0 === strpos( $action, 'post-quickpress' ) ) {
$_POST['post_ID'] = $post_ID;
// output the quickpress dashboard widget
require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
- add_filter( 'wp_dashboard_widgets', create_function( '$a', 'return array( "dashboard_quick_press" );' ) );
- wp_dashboard_setup();
- wp_dashboard();
+ wp_dashboard_quick_press();
exit;
}
diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php
index e90520196..cc9e55175 100644
--- a/wp-admin/press-this.php
+++ b/wp-admin/press-this.php
@@ -420,7 +420,7 @@ die;
-
+
diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css
index 37dc736cb..8ed293c40 100644
--- a/wp-admin/wp-admin.css
+++ b/wp-admin/wp-admin.css
@@ -1222,14 +1222,14 @@ table.form-table td .updated {
clear: left;
}
-#poststuff h3 {
+#poststuff h3, .metabox-holder h3 {
font-size: 14px;
font-weight: bold;
padding: 7px;
margin: 0 0 10px;
}
-#poststuff .postbox, #poststuff .stuffbox {
+.metabox-holder .postbox, #poststuff .postbox, #poststuff .stuffbox {
padding: 2px;
margin-bottom: 20px;
border-width: 1px;
@@ -1368,7 +1368,7 @@ table.form-table td .updated {
vertical-align: middle;
}
-#poststuff .togbox {
+.metabox-holder .togbox, #poststuff .togbox {
background-position: -10px 16px;
background-repeat: no-repeat;
display: block;
@@ -1388,15 +1388,15 @@ table.form-table td .updated {
border-bottom-left-radius: 3px;
}
-#poststuff .closed .inside {
+.metabox-holder .closed .inside, #poststuff .closed .inside {
display: none;
}
-#poststuff .closed h3 {
+.metabox-holder .closed h3, #poststuff .closed h3 {
margin: 0;
}
-#poststuff .closed .togbox {
+.metabox-holder .closed .togbox, #poststuff .closed .togbox {
background-position: 4px 15px;
}
@@ -2125,6 +2125,9 @@ a.togbox {
margin: 0 5px 0 2px;
}
+.metabox-prefs label a {
+ display: none;
+}
/* Inline Editor */
.inline-editor {
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index dbda27a52..aaf8d1a81 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -279,6 +279,8 @@ function wp_default_scripts( &$scripts ) {
) );
$scripts->add( 'settings-box', '/wp-admin/js/settings-box.js', array( 'jquery' ), '20080925' );
+
+ $scripts->add( 'dashboard', '/wp-admin/js/dashboard.js', array( 'jquery', 'admin-comments', 'postbox', 'settings-box' ), '20081008' );
}
}
@@ -309,7 +311,7 @@ function wp_default_styles( &$styles ) {
$rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'press-this-ie' );
- $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20081001' );
+ $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20081008' );
$styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' );
$styles->add( 'ie', '/wp-admin/css/ie.css' );
@@ -322,7 +324,7 @@ function wp_default_styles( &$styles ) {
$styles->add( 'global', '/wp-admin/css/global.css', array(), '20081001' );
$styles->add( 'media', '/wp-admin/css/media.css', array(), '20080709' );
$styles->add( 'widgets', '/wp-admin/css/widgets.css' );
- $styles->add( 'dashboard', '/wp-admin/css/dashboard.css', array(), '20081001' );
+ $styles->add( 'dashboard', '/wp-admin/css/dashboard.css', array(), '20081008' );
$styles->add( 'install', '/wp-admin/css/install.css', array(), '20080708' );
$styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css' );
$styles->add( 'press-this', '/wp-admin/css/press-this.css', array(), '20080922' );
@@ -427,4 +429,4 @@ add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' );
add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
add_action( 'wp_default_styles', 'wp_default_styles' );
-add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 );
+add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 );
\ No newline at end of file