// WordPress News
wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress News' ), 'wp_dashboard_primary' );
- // Hook to register new widgets
- // Filter widget order
if ( is_network_admin() ) {
+
+ /**
+ * Fires after core widgets for the Network Admin dashboard have been registered.
+ *
+ * @since 3.1.0
+ */
do_action( 'wp_network_dashboard_setup' );
+
+ /**
+ * Filter the list of widgets to load for the Network Admin dashboard.
+ *
+ * @since 3.1.0
+ *
+ * @param array $dashboard_widgets An array of dashboard widgets.
+ */
$dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() );
} elseif ( is_user_admin() ) {
+
+ /**
+ * Fires after core widgets for the User Admin dashboard have been registered.
+ *
+ * @since 3.1.0
+ */
do_action( 'wp_user_dashboard_setup' );
+
+ /**
+ * Filter the list of widgets to load for the User Admin dashboard.
+ *
+ * @since 3.1.0
+ *
+ * @param array $dashboard_widgets An array of dashboard widgets.
+ */
$dashboard_widgets = apply_filters( 'wp_user_dashboard_widgets', array() );
} else {
+
+ /**
+ * Fires after core widgets for the admin dashboard have been registered.
+ *
+ * @since 2.5.0
+ */
do_action( 'wp_dashboard_setup' );
+
+ /**
+ * Filter the list of widgets to load for the admin dashboard.
+ *
+ * @since 2.5.0
+ *
+ * @param array $dashboard_widgets An array of dashboard widgets.
+ */
$dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
}
update_option( 'dashboard_widget_options', $widget_options );
/** This action is documented in wp-admin/edit-form-advanced.php */
- do_action('do_meta_boxes', $screen->id, 'normal', '');
+ do_action( 'do_meta_boxes', $screen->id, 'normal', '' );
+
/** This action is documented in wp-admin/edit-form-advanced.php */
- do_action('do_meta_boxes', $screen->id, 'side', '');
+ do_action( 'do_meta_boxes', $screen->id, 'side', '' );
}
function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null ) {
}
-/* Dashboard Widgets */
+//
+// Dashboard Widgets
+//
/**
* Dashboard widget that displays some basic stats about the site.
}
/**
- * Include additional elements in the 'At a Glance' dashboard widget.
- * This widget was previously 'Right Now'.
+ * Filter the array of extra elements to list in the 'At a Glance'
+ * dashboard widget.
+ *
+ * Prior to 3.8.0, the widget was named 'Right Now'. Each element
+ * is wrapped in list-item tags on output.
*
* @since 3.8.0
- * @param array $items Array of items.
+ *
+ * @param array $items Array of extra 'At a Glance' widget items.
*/
$elements = apply_filters( 'dashboard_glance_items', array() );
+
if ( $elements ) {
echo '<li>' . implode( "</li>\n<li>", $elements ) . "</li>\n";
}
?>
</ul>
- <p><?php printf( __( 'WordPress %1$s running %2$s theme.' ), get_bloginfo( 'version', 'display' ), $theme_name ); ?></p>
<?php
+ update_right_now_message();
// 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' ) ) {
/**
- * Filter the title attribute for the link displayed in Site Content metabox when search engines are discouraged from indexing the site.
+ * Filter the link title attribute for the 'Search Engines Discouraged'
+ * message displayed in the 'At a Glance' dashboard widget.
+ *
+ * Prior to 3.8.0, the widget was named 'Right Now'.
*
* @since 3.0.0
*
- * @param string Default attribute text.
+ * @param string $title Default attribute text.
*/
$title = apply_filters( 'privacy_on_link_title', __( 'Your site is asking search engines not to index its content' ) );
/**
- * Filter the text for the link displayed in Site Content metabox when search engines are discouraged from indexing the site.
+ * Filter the link label for the 'Search Engines Discouraged' message
+ * displayed in the 'At a Glance' dashboard widget.
+ *
+ * Prior to 3.8.0, the widget was named 'Right Now'.
*
* @since 3.0.0
*
- * @param string Default text.
+ * @param string $content Default text.
*/
$content = apply_filters( 'privacy_on_link_text' , __( 'Search Engines Discouraged' ) );
?>
</div>
<?php
- // activity_box_end has a core action, but only prints content when multisite.
- // Using an output buffer is the only way to really check if anything's displayed here.
+ /*
+ * activity_box_end has a core action, but only prints content when multisite.
+ * Using an output buffer is the only way to really check if anything's displayed here.
+ */
ob_start();
+
+ /**
+ * Fires at the end of the 'At a Glance' dashboard widget.
+ *
+ * Prior to 3.8.0, the widget was named 'Right Now'.
+ *
+ * @since 2.5.0
+ */
do_action( 'rightnow_end' );
+
+ /**
+ * Fires at the end of the 'At a Glance' dashboard widget.
+ *
+ * Prior to 3.8.0, the widget was named 'Right Now'.
+ *
+ * @since 2.0.0
+ */
do_action( 'activity_box_end' );
+
$actions = ob_get_clean();
if ( !empty( $actions ) ) : ?>
<br class="clear" />
<p class="youhave"><?php echo $sentence; ?></p>
- <?php do_action( 'wpmuadminresult', '' ); ?>
+
+
+ <?php
+ /**
+ * Fires in the Network Admin 'Right Now' dashboard widget
+ * just before the user and site search form fields.
+ *
+ * @since MU
+ *
+ * @param null $unused
+ */
+ do_action( 'wpmuadminresult', '' );
+ ?>
<form action="<?php echo network_admin_url('users.php'); ?>" method="get">
<p>
</p>
</form>
<?php
+ /**
+ * Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
+ *
+ * @since MU
+ */
do_action( 'mu_rightnow_end' );
+
+ /**
+ * Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
+ *
+ * @since MU
+ */
do_action( 'mu_activity_box_end' );
}
<?php endif; ?>
<div class="input-text-wrap" id="title-wrap">
- <label class="screen-reader-text prompt" for="title" id="title-prompt-text"><?php echo apply_filters( 'enter_title_here', __( 'Title' ), $post ); ?></label>
+ <label class="screen-reader-text prompt" for="title" id="title-prompt-text">
+
+ <?php
+ /** This filter is documented in wp-admin/edit-form-advanced.php */
+ echo apply_filters( 'enter_title_here', __( 'Title' ), $post );
+ ?>
+ </label>
<input type="text" name="post_title" id="title" autocomplete="off" />
</div>
function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
$GLOBALS['comment'] =& $comment;
- $comment_post_url = get_edit_post_link( $comment->comment_post_ID );
$comment_post_title = strip_tags(get_the_title( $comment->comment_post_ID ));
- $comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
+
+ if ( current_user_can( 'edit_post', $comment->comment_post_ID ) ) {
+ $comment_post_url = get_edit_post_link( $comment->comment_post_ID );
+ $comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
+ } else {
+ $comment_post_link = $comment_post_title;
+ }
+
$comment_link = '<a class="comment-link" href="' . esc_url(get_comment_link()) . '">#</a>';
$actions_string = '';
$actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
$actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
$actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . esc_attr__('Edit comment') . "'>". __('Edit') . '</a>';
- $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.esc_attr__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
+ $actions['reply'] = '<a onclick="window.commentReply && commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.esc_attr__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
$actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
if ( !EMPTY_TRASH_DAYS )
$actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
else
$actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>';
+ /**
+ * Filter the action links displayed for each comment in the 'Recent Comments'
+ * dashboard widget.
+ *
+ * @since 2.6.0
+ *
+ * @param array $actions An array of comment actions. Default actions include:
+ * 'Approve', 'Unapprove', 'Edit', 'Reply', 'Spam',
+ * 'Delete', and 'Trash'.
+ * @param object $comment The comment object.
+ */
$actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment );
$i = 0;
?>
<div id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status($comment->comment_ID) ) ); ?>>
- <?php if ( !$comment->comment_type || 'comment' == $comment->comment_type ) : ?>
<?php echo get_avatar( $comment, 50, 'mystery' ); ?>
+ <?php if ( !$comment->comment_type || 'comment' == $comment->comment_type ) : ?>
+
<div class="dashboard-comment-wrap">
<h4 class="comment-meta">
<?php printf( /* translators: 1: comment author, 2: post link, 3: notification if the comment is pending */__( 'From %1$s on %2$s%3$s' ),
echo '<div id="activity-widget">';
$future_posts = wp_dashboard_recent_posts( array(
- 'display' => 2,
'max' => 5,
'status' => 'future',
'order' => 'ASC',
'id' => 'future-posts',
) );
$recent_posts = wp_dashboard_recent_posts( array(
- 'display' => 2,
'max' => 5,
'status' => 'publish',
'order' => 'DESC',
* @param array $args {
* An array of query and display arguments.
*
- * @type int $display Number of posts to display.
- * @type int $max Maximum number of posts to query.
+ * @type int $max Number of posts to display.
* @type string $status Post status.
* @type string $order Designates ascending ('ASC') or descending ('DESC') order.
* @type string $title Section title.
'order' => $args['order'],
'posts_per_page' => intval( $args['max'] ),
'no_found_rows' => true,
- 'cache_results' => false
+ 'cache_results' => false,
+ 'perm' => ( 'future' === $args['status'] ) ? 'editable' : 'readable',
);
$posts = new WP_Query( $query_args );
echo '<div id="' . $args['id'] . '" class="activity-block">';
- if ( $posts->post_count > $args['display'] ) {
- echo '<small class="show-more hide-if-no-js"><a href="#">' . sprintf( __( 'See %s more…'), $posts->post_count - intval( $args['display'] ) ) . '</a></small>';
- }
-
echo '<h4>' . $args['title'] . '</h4>';
echo '<ul>';
$relative = date_i18n( __( 'M jS' ), $time );
}
- $text = sprintf(
- /* translators: 1: relative date, 2: time, 4: post title */
- __( '<span>%1$s, %2$s</span> <a href="%3$s">%4$s</a>' ),
- $relative,
- get_the_time(),
- get_edit_post_link(),
- _draft_or_post_title()
- );
-
- $hidden = $i >= $args['display'] ? ' class="hidden"' : '';
- echo "<li{$hidden}>$text</li>";
- $i++;
+ if ( current_user_can( 'edit_post', get_the_ID() ) ) {
+ /* translators: 1: relative date, 2: time, 3: post edit link, 4: post title */
+ $format = __( '<span>%1$s, %2$s</span> <a href="%3$s">%4$s</a>' );
+ printf( "<li>$format</li>", $relative, get_the_time(), get_edit_post_link(), _draft_or_post_title() );
+ } else {
+ /* translators: 1: relative date, 2: time, 3: post title */
+ $format = __( '<span>%1$s, %2$s</span> %3$s' );
+ printf( "<li>$format</li>", $relative, get_the_time(), _draft_or_post_title() );
+ }
}
echo '</ul>';
*/
function wp_dashboard_primary() {
$feeds = array(
- 'news' => array(
- 'link' => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/news/' ) ),
- 'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ),
+ 'news' => array(
+
+ /**
+ * Filter the primary link URL for the 'WordPress News' dashboard widget.
+ *
+ * @since 2.5.0
+ *
+ * @param string $link The widget's primary link URL.
+ */
+ 'link' => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/news/' ) ),
+
+ /**
+ * Filter the primary feed URL for the 'WordPress News' dashboard widget.
+ *
+ * @since 2.3.0
+ *
+ * @param string $url The widget's primary feed URL.
+ */
+ 'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ),
+
+ /**
+ * Filter the primary link title for the 'WordPress News' dashboard widget.
+ *
+ * @since 2.3.0
+ *
+ * @param string $title Title attribute for the widget's primary link.
+ */
'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ),
'items' => 1,
'show_summary' => 1,
'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/' ) ),
+
+ /**
+ * Filter the secondary link URL for the 'WordPress News' dashboard widget.
+ *
+ * @since 2.3.0
+ *
+ * @param string $link The widget's secondary link URL.
+ */
+ 'link' => apply_filters( 'dashboard_secondary_link', __( 'http://planet.wordpress.org/' ) ),
+
+ /**
+ * Filter the secondary feed URL for the 'WordPress News' dashboard widget.
+ *
+ * @since 2.3.0
+ *
+ * @param string $url The widget's secondary feed URL.
+ */
+ 'url' => apply_filters( 'dashboard_secondary_feed', __( 'http://planet.wordpress.org/feed/' ) ),
+
+ /**
+ * Filter the secondary link title for the 'WordPress News' dashboard widget.
+ *
+ * @since 2.3.0
+ *
+ * @param string $title Title attribute for the widget's secondary link.
+ */
'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ),
'items' => 3,
'show_summary' => 0,
$ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&TB_iframe=true&width=600&height=800';
- echo "<li class='dashboard-news-plugin'><span>$label:</span> <a href='$link' class='dashboard-news-plugin-link'>$title</a></h5> <span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span></li>";
+ echo "<li class='dashboard-news-plugin'><span>$label:</span> <a href='$link' class='dashboard-news-plugin-link'>$title</a> <span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span></li>";
$$feed->__destruct();
unset( $$feed );
$notice .= '<div class="clear"></div>';
}
+ /**
+ * Filter the notice output for the 'Browse Happy' nag meta box.
+ *
+ * @since 3.2.0
+ *
+ * @param string $notice The notice content.
+ * @param array $response An array containing web browser information.
+ */
echo apply_filters( 'browse-happy-notice', $notice, $response );
}
<div class="welcome-panel-column welcome-panel-last">
<h4><?php _e( 'More Actions' ); ?></h4>
<ul>
- <li><?php printf( '<div class="welcome-icon welcome-widgets-menus">' . __( 'Manage <a href="%1$s">widgets</a> or <a href="%2$s">menus</a>' ) . '</div>', admin_url( 'widgets.php' ), admin_url( 'nav-menus.php' ) ); ?></li>
+ <?php if ( current_theme_supports( 'widgets' ) || current_theme_supports( 'menus' ) ) : ?>
+ <li><div class="welcome-icon welcome-widgets-menus"><?php
+ if ( current_theme_supports( 'widgets' ) && current_theme_supports( 'menus' ) ) {
+ printf( __( 'Manage <a href="%1$s">widgets</a> or <a href="%2$s">menus</a>' ),
+ admin_url( 'widgets.php' ), admin_url( 'nav-menus.php' ) );
+ } elseif ( current_theme_supports( 'widgets' ) ) {
+ echo '<a href="' . admin_url( 'widgets.php' ) . '">' . __( 'Manage widgets' ) . '</a>';
+ } else {
+ echo '<a href="' . admin_url( 'nav-menus.php' ) . '">' . __( 'Manage menus' ) . '</a>';
+ }
+ ?></div></li>
+ <?php endif; ?>
+ <?php if ( current_user_can( 'manage_options' ) ) : ?>
<li><?php printf( '<a href="%s" class="welcome-icon welcome-comments">' . __( 'Turn comments on or off' ) . '</a>', admin_url( 'options-discussion.php' ) ); ?></li>
+ <?php endif; ?>
<li><?php printf( '<a href="%s" class="welcome-icon welcome-learn-more">' . __( 'Learn more about getting started' ) . '</a>', __( 'http://codex.wordpress.org/First_Steps_With_WordPress' ) ); ?></li>
</ul>
</div>