Edit File by line
/home/barbar84/public_h.../wp-admin/includes
File: dashboard.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WordPress Dashboard Widget Administration Screen API
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Administration
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
/**
[8] Fix | Delete
* Registers dashboard widgets.
[9] Fix | Delete
*
[10] Fix | Delete
* Handles POST data, sets up filters.
[11] Fix | Delete
*
[12] Fix | Delete
* @since 2.5.0
[13] Fix | Delete
*
[14] Fix | Delete
* @global array $wp_registered_widgets
[15] Fix | Delete
* @global array $wp_registered_widget_controls
[16] Fix | Delete
* @global callable[] $wp_dashboard_control_callbacks
[17] Fix | Delete
*/
[18] Fix | Delete
function wp_dashboard_setup() {
[19] Fix | Delete
global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks;
[20] Fix | Delete
$wp_dashboard_control_callbacks = array();
[21] Fix | Delete
$screen = get_current_screen();
[22] Fix | Delete
[23] Fix | Delete
/* Register Widgets and Controls */
[24] Fix | Delete
[25] Fix | Delete
$response = wp_check_browser_version();
[26] Fix | Delete
[27] Fix | Delete
if ( $response && $response['upgrade'] ) {
[28] Fix | Delete
add_filter( 'postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class' );
[29] Fix | Delete
if ( $response['insecure'] ) {
[30] Fix | Delete
wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' );
[31] Fix | Delete
} else {
[32] Fix | Delete
wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' );
[33] Fix | Delete
}
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
// PHP Version.
[37] Fix | Delete
$response = wp_check_php_version();
[38] Fix | Delete
if ( $response && isset( $response['is_acceptable'] ) && ! $response['is_acceptable'] && current_user_can( 'update_php' ) ) {
[39] Fix | Delete
add_filter( 'postbox_classes_dashboard_dashboard_php_nag', 'dashboard_php_nag_class' );
[40] Fix | Delete
wp_add_dashboard_widget( 'dashboard_php_nag', __( 'PHP Update Recommended' ), 'wp_dashboard_php_nag' );
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
// Site Health.
[44] Fix | Delete
if ( current_user_can( 'view_site_health_checks' ) && ! is_network_admin() ) {
[45] Fix | Delete
if ( ! class_exists( 'WP_Site_Health' ) ) {
[46] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
WP_Site_Health::get_instance();
[50] Fix | Delete
[51] Fix | Delete
wp_enqueue_style( 'site-health' );
[52] Fix | Delete
wp_enqueue_script( 'site-health' );
[53] Fix | Delete
[54] Fix | Delete
wp_add_dashboard_widget( 'dashboard_site_health', __( 'Site Health Status' ), 'wp_dashboard_site_health' );
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
// Right Now.
[58] Fix | Delete
if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) {
[59] Fix | Delete
wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' );
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
if ( is_network_admin() ) {
[63] Fix | Delete
wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' );
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
// Activity Widget.
[67] Fix | Delete
if ( is_blog_admin() ) {
[68] Fix | Delete
wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_site_activity' );
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
// QuickPress Widget.
[72] Fix | Delete
if ( is_blog_admin() && current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
[73] Fix | Delete
$quick_draft_title = sprintf( '<span class="hide-if-no-js">%1$s</span> <span class="hide-if-js">%2$s</span>', __( 'Quick Draft' ), __( 'Your Recent Drafts' ) );
[74] Fix | Delete
wp_add_dashboard_widget( 'dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press' );
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
// WordPress Events and News.
[78] Fix | Delete
wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress Events and News' ), 'wp_dashboard_events_news' );
[79] Fix | Delete
[80] Fix | Delete
if ( is_network_admin() ) {
[81] Fix | Delete
[82] Fix | Delete
/**
[83] Fix | Delete
* Fires after core widgets for the Network Admin dashboard have been registered.
[84] Fix | Delete
*
[85] Fix | Delete
* @since 3.1.0
[86] Fix | Delete
*/
[87] Fix | Delete
do_action( 'wp_network_dashboard_setup' );
[88] Fix | Delete
[89] Fix | Delete
/**
[90] Fix | Delete
* Filters the list of widgets to load for the Network Admin dashboard.
[91] Fix | Delete
*
[92] Fix | Delete
* @since 3.1.0
[93] Fix | Delete
*
[94] Fix | Delete
* @param string[] $dashboard_widgets An array of dashboard widget IDs.
[95] Fix | Delete
*/
[96] Fix | Delete
$dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() );
[97] Fix | Delete
} elseif ( is_user_admin() ) {
[98] Fix | Delete
[99] Fix | Delete
/**
[100] Fix | Delete
* Fires after core widgets for the User Admin dashboard have been registered.
[101] Fix | Delete
*
[102] Fix | Delete
* @since 3.1.0
[103] Fix | Delete
*/
[104] Fix | Delete
do_action( 'wp_user_dashboard_setup' );
[105] Fix | Delete
[106] Fix | Delete
/**
[107] Fix | Delete
* Filters the list of widgets to load for the User Admin dashboard.
[108] Fix | Delete
*
[109] Fix | Delete
* @since 3.1.0
[110] Fix | Delete
*
[111] Fix | Delete
* @param string[] $dashboard_widgets An array of dashboard widget IDs.
[112] Fix | Delete
*/
[113] Fix | Delete
$dashboard_widgets = apply_filters( 'wp_user_dashboard_widgets', array() );
[114] Fix | Delete
} else {
[115] Fix | Delete
[116] Fix | Delete
/**
[117] Fix | Delete
* Fires after core widgets for the admin dashboard have been registered.
[118] Fix | Delete
*
[119] Fix | Delete
* @since 2.5.0
[120] Fix | Delete
*/
[121] Fix | Delete
do_action( 'wp_dashboard_setup' );
[122] Fix | Delete
[123] Fix | Delete
/**
[124] Fix | Delete
* Filters the list of widgets to load for the admin dashboard.
[125] Fix | Delete
*
[126] Fix | Delete
* @since 2.5.0
[127] Fix | Delete
*
[128] Fix | Delete
* @param string[] $dashboard_widgets An array of dashboard widget IDs.
[129] Fix | Delete
*/
[130] Fix | Delete
$dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
[131] Fix | Delete
}
[132] Fix | Delete
[133] Fix | Delete
foreach ( $dashboard_widgets as $widget_id ) {
[134] Fix | Delete
$name = empty( $wp_registered_widgets[ $widget_id ]['all_link'] ) ? $wp_registered_widgets[ $widget_id ]['name'] : $wp_registered_widgets[ $widget_id ]['name'] . " <a href='{$wp_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>" . __( 'View all' ) . '</a>';
[135] Fix | Delete
wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[ $widget_id ]['callback'], $wp_registered_widget_controls[ $widget_id ]['callback'] );
[136] Fix | Delete
}
[137] Fix | Delete
[138] Fix | Delete
if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget_id'] ) ) {
[139] Fix | Delete
check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' );
[140] Fix | Delete
ob_start(); // Hack - but the same hack wp-admin/widgets.php uses.
[141] Fix | Delete
wp_dashboard_trigger_widget_control( $_POST['widget_id'] );
[142] Fix | Delete
ob_end_clean();
[143] Fix | Delete
wp_redirect( remove_query_arg( 'edit' ) );
[144] Fix | Delete
exit;
[145] Fix | Delete
}
[146] Fix | Delete
[147] Fix | Delete
/** This action is documented in wp-admin/includes/meta-boxes.php */
[148] Fix | Delete
do_action( 'do_meta_boxes', $screen->id, 'normal', '' );
[149] Fix | Delete
[150] Fix | Delete
/** This action is documented in wp-admin/includes/meta-boxes.php */
[151] Fix | Delete
do_action( 'do_meta_boxes', $screen->id, 'side', '' );
[152] Fix | Delete
}
[153] Fix | Delete
[154] Fix | Delete
/**
[155] Fix | Delete
* Adds a new dashboard widget.
[156] Fix | Delete
*
[157] Fix | Delete
* @since 2.7.0
[158] Fix | Delete
* @since 5.6.0 The `$context` and `$priority` parameters were added.
[159] Fix | Delete
*
[160] Fix | Delete
* @global callable[] $wp_dashboard_control_callbacks
[161] Fix | Delete
*
[162] Fix | Delete
* @param string $widget_id Widget ID (used in the 'id' attribute for the widget).
[163] Fix | Delete
* @param string $widget_name Title of the widget.
[164] Fix | Delete
* @param callable $callback Function that fills the widget with the desired content.
[165] Fix | Delete
* The function should echo its output.
[166] Fix | Delete
* @param callable $control_callback Optional. Function that outputs controls for the widget. Default null.
[167] Fix | Delete
* @param array $callback_args Optional. Data that should be set as the $args property of the widget array
[168] Fix | Delete
* (which is the second parameter passed to your callback). Default null.
[169] Fix | Delete
* @param string $context Optional. The context within the screen where the box should display.
[170] Fix | Delete
* Accepts 'normal', 'side', 'column3', or 'column4'. Default 'normal'.
[171] Fix | Delete
* @param string $priority Optional. The priority within the context where the box should show.
[172] Fix | Delete
* Accepts 'high', 'core', 'default', or 'low'. Default 'core'.
[173] Fix | Delete
*/
[174] Fix | Delete
function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null, $context = 'normal', $priority = 'core' ) {
[175] Fix | Delete
$screen = get_current_screen();
[176] Fix | Delete
global $wp_dashboard_control_callbacks;
[177] Fix | Delete
[178] Fix | Delete
$private_callback_args = array( '__widget_basename' => $widget_name );
[179] Fix | Delete
[180] Fix | Delete
if ( is_null( $callback_args ) ) {
[181] Fix | Delete
$callback_args = $private_callback_args;
[182] Fix | Delete
} elseif ( is_array( $callback_args ) ) {
[183] Fix | Delete
$callback_args = array_merge( $callback_args, $private_callback_args );
[184] Fix | Delete
}
[185] Fix | Delete
[186] Fix | Delete
if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) {
[187] Fix | Delete
$wp_dashboard_control_callbacks[ $widget_id ] = $control_callback;
[188] Fix | Delete
if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) {
[189] Fix | Delete
list($url) = explode( '#', add_query_arg( 'edit', false ), 2 );
[190] Fix | Delete
$widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( $url ) . '">' . __( 'Cancel' ) . '</a></span>';
[191] Fix | Delete
$callback = '_wp_dashboard_control_callback';
[192] Fix | Delete
} else {
[193] Fix | Delete
list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
[194] Fix | Delete
$widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>';
[195] Fix | Delete
}
[196] Fix | Delete
}
[197] Fix | Delete
[198] Fix | Delete
$side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' );
[199] Fix | Delete
[200] Fix | Delete
if ( in_array( $widget_id, $side_widgets, true ) ) {
[201] Fix | Delete
$context = 'side';
[202] Fix | Delete
}
[203] Fix | Delete
[204] Fix | Delete
$high_priority_widgets = array( 'dashboard_browser_nag', 'dashboard_php_nag' );
[205] Fix | Delete
[206] Fix | Delete
if ( in_array( $widget_id, $high_priority_widgets, true ) ) {
[207] Fix | Delete
$priority = 'high';
[208] Fix | Delete
}
[209] Fix | Delete
[210] Fix | Delete
if ( empty( $context ) ) {
[211] Fix | Delete
$context = 'normal';
[212] Fix | Delete
}
[213] Fix | Delete
if ( empty( $priority ) ) {
[214] Fix | Delete
$priority = 'core';
[215] Fix | Delete
}
[216] Fix | Delete
[217] Fix | Delete
add_meta_box( $widget_id, $widget_name, $callback, $screen, $context, $priority, $callback_args );
[218] Fix | Delete
}
[219] Fix | Delete
[220] Fix | Delete
/**
[221] Fix | Delete
* Outputs controls for the current dashboard widget.
[222] Fix | Delete
*
[223] Fix | Delete
* @access private
[224] Fix | Delete
* @since 2.7.0
[225] Fix | Delete
*
[226] Fix | Delete
* @param mixed $dashboard
[227] Fix | Delete
* @param array $meta_box
[228] Fix | Delete
*/
[229] Fix | Delete
function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
[230] Fix | Delete
echo '<form method="post" class="dashboard-widget-control-form wp-clearfix">';
[231] Fix | Delete
wp_dashboard_trigger_widget_control( $meta_box['id'] );
[232] Fix | Delete
wp_nonce_field( 'edit-dashboard-widget_' . $meta_box['id'], 'dashboard-widget-nonce' );
[233] Fix | Delete
echo '<input type="hidden" name="widget_id" value="' . esc_attr( $meta_box['id'] ) . '" />';
[234] Fix | Delete
submit_button( __( 'Submit' ) );
[235] Fix | Delete
echo '</form>';
[236] Fix | Delete
}
[237] Fix | Delete
[238] Fix | Delete
/**
[239] Fix | Delete
* Displays the dashboard.
[240] Fix | Delete
*
[241] Fix | Delete
* @since 2.5.0
[242] Fix | Delete
*/
[243] Fix | Delete
function wp_dashboard() {
[244] Fix | Delete
$screen = get_current_screen();
[245] Fix | Delete
$columns = absint( $screen->get_columns() );
[246] Fix | Delete
$columns_css = '';
[247] Fix | Delete
if ( $columns ) {
[248] Fix | Delete
$columns_css = " columns-$columns";
[249] Fix | Delete
}
[250] Fix | Delete
[251] Fix | Delete
?>
[252] Fix | Delete
<div id="dashboard-widgets" class="metabox-holder<?php echo $columns_css; ?>">
[253] Fix | Delete
<div id="postbox-container-1" class="postbox-container">
[254] Fix | Delete
<?php do_meta_boxes( $screen->id, 'normal', '' ); ?>
[255] Fix | Delete
</div>
[256] Fix | Delete
<div id="postbox-container-2" class="postbox-container">
[257] Fix | Delete
<?php do_meta_boxes( $screen->id, 'side', '' ); ?>
[258] Fix | Delete
</div>
[259] Fix | Delete
<div id="postbox-container-3" class="postbox-container">
[260] Fix | Delete
<?php do_meta_boxes( $screen->id, 'column3', '' ); ?>
[261] Fix | Delete
</div>
[262] Fix | Delete
<div id="postbox-container-4" class="postbox-container">
[263] Fix | Delete
<?php do_meta_boxes( $screen->id, 'column4', '' ); ?>
[264] Fix | Delete
</div>
[265] Fix | Delete
</div>
[266] Fix | Delete
[267] Fix | Delete
<?php
[268] Fix | Delete
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
[269] Fix | Delete
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
[270] Fix | Delete
[271] Fix | Delete
}
[272] Fix | Delete
[273] Fix | Delete
//
[274] Fix | Delete
// Dashboard Widgets.
[275] Fix | Delete
//
[276] Fix | Delete
[277] Fix | Delete
/**
[278] Fix | Delete
* Dashboard widget that displays some basic stats about the site.
[279] Fix | Delete
*
[280] Fix | Delete
* Formerly 'Right Now'. A streamlined 'At a Glance' as of 3.8.
[281] Fix | Delete
*
[282] Fix | Delete
* @since 2.7.0
[283] Fix | Delete
*/
[284] Fix | Delete
function wp_dashboard_right_now() {
[285] Fix | Delete
?>
[286] Fix | Delete
<div class="main">
[287] Fix | Delete
<ul>
[288] Fix | Delete
<?php
[289] Fix | Delete
// Posts and Pages.
[290] Fix | Delete
foreach ( array( 'post', 'page' ) as $post_type ) {
[291] Fix | Delete
$num_posts = wp_count_posts( $post_type );
[292] Fix | Delete
if ( $num_posts && $num_posts->publish ) {
[293] Fix | Delete
if ( 'post' === $post_type ) {
[294] Fix | Delete
/* translators: %s: Number of posts. */
[295] Fix | Delete
$text = _n( '%s Post', '%s Posts', $num_posts->publish );
[296] Fix | Delete
} else {
[297] Fix | Delete
/* translators: %s: Number of pages. */
[298] Fix | Delete
$text = _n( '%s Page', '%s Pages', $num_posts->publish );
[299] Fix | Delete
}
[300] Fix | Delete
$text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
[301] Fix | Delete
$post_type_object = get_post_type_object( $post_type );
[302] Fix | Delete
if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) {
[303] Fix | Delete
printf( '<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text );
[304] Fix | Delete
} else {
[305] Fix | Delete
printf( '<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text );
[306] Fix | Delete
}
[307] Fix | Delete
}
[308] Fix | Delete
}
[309] Fix | Delete
// Comments.
[310] Fix | Delete
$num_comm = wp_count_comments();
[311] Fix | Delete
if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) {
[312] Fix | Delete
/* translators: %s: Number of comments. */
[313] Fix | Delete
$text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->approved ), number_format_i18n( $num_comm->approved ) );
[314] Fix | Delete
?>
[315] Fix | Delete
<li class="comment-count"><a href="edit-comments.php"><?php echo $text; ?></a></li>
[316] Fix | Delete
<?php
[317] Fix | Delete
$moderated_comments_count_i18n = number_format_i18n( $num_comm->moderated );
[318] Fix | Delete
/* translators: %s: Number of comments. */
[319] Fix | Delete
$text = sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $num_comm->moderated ), $moderated_comments_count_i18n );
[320] Fix | Delete
?>
[321] Fix | Delete
<li class="comment-mod-count
[322] Fix | Delete
<?php
[323] Fix | Delete
if ( ! $num_comm->moderated ) {
[324] Fix | Delete
echo ' hidden';
[325] Fix | Delete
}
[326] Fix | Delete
?>
[327] Fix | Delete
"><a href="edit-comments.php?comment_status=moderated" class="comments-in-moderation-text"><?php echo $text; ?></a></li>
[328] Fix | Delete
<?php
[329] Fix | Delete
}
[330] Fix | Delete
[331] Fix | Delete
/**
[332] Fix | Delete
* Filters the array of extra elements to list in the 'At a Glance'
[333] Fix | Delete
* dashboard widget.
[334] Fix | Delete
*
[335] Fix | Delete
* Prior to 3.8.0, the widget was named 'Right Now'. Each element
[336] Fix | Delete
* is wrapped in list-item tags on output.
[337] Fix | Delete
*
[338] Fix | Delete
* @since 3.8.0
[339] Fix | Delete
*
[340] Fix | Delete
* @param string[] $items Array of extra 'At a Glance' widget items.
[341] Fix | Delete
*/
[342] Fix | Delete
$elements = apply_filters( 'dashboard_glance_items', array() );
[343] Fix | Delete
[344] Fix | Delete
if ( $elements ) {
[345] Fix | Delete
echo '<li>' . implode( "</li>\n<li>", $elements ) . "</li>\n";
[346] Fix | Delete
}
[347] Fix | Delete
[348] Fix | Delete
?>
[349] Fix | Delete
</ul>
[350] Fix | Delete
<?php
[351] Fix | Delete
update_right_now_message();
[352] Fix | Delete
[353] Fix | Delete
// Check if search engines are asked not to index this site.
[354] Fix | Delete
if ( ! is_network_admin() && ! is_user_admin() && current_user_can( 'manage_options' ) && '0' == get_option( 'blog_public' ) ) {
[355] Fix | Delete
[356] Fix | Delete
/**
[357] Fix | Delete
* Filters the link title attribute for the 'Search engines discouraged'
[358] Fix | Delete
* message displayed in the 'At a Glance' dashboard widget.
[359] Fix | Delete
*
[360] Fix | Delete
* Prior to 3.8.0, the widget was named 'Right Now'.
[361] Fix | Delete
*
[362] Fix | Delete
* @since 3.0.0
[363] Fix | Delete
* @since 4.5.0 The default for `$title` was updated to an empty string.
[364] Fix | Delete
*
[365] Fix | Delete
* @param string $title Default attribute text.
[366] Fix | Delete
*/
[367] Fix | Delete
$title = apply_filters( 'privacy_on_link_title', '' );
[368] Fix | Delete
[369] Fix | Delete
/**
[370] Fix | Delete
* Filters the link label for the 'Search engines discouraged' message
[371] Fix | Delete
* displayed in the 'At a Glance' dashboard widget.
[372] Fix | Delete
*
[373] Fix | Delete
* Prior to 3.8.0, the widget was named 'Right Now'.
[374] Fix | Delete
*
[375] Fix | Delete
* @since 3.0.0
[376] Fix | Delete
*
[377] Fix | Delete
* @param string $content Default text.
[378] Fix | Delete
*/
[379] Fix | Delete
$content = apply_filters( 'privacy_on_link_text', __( 'Search engines discouraged' ) );
[380] Fix | Delete
$title_attr = '' === $title ? '' : " title='$title'";
[381] Fix | Delete
[382] Fix | Delete
echo "<p class='search-engines-info'><a href='options-reading.php'$title_attr>$content</a></p>";
[383] Fix | Delete
}
[384] Fix | Delete
?>
[385] Fix | Delete
</div>
[386] Fix | Delete
<?php
[387] Fix | Delete
/*
[388] Fix | Delete
* activity_box_end has a core action, but only prints content when multisite.
[389] Fix | Delete
* Using an output buffer is the only way to really check if anything's displayed here.
[390] Fix | Delete
*/
[391] Fix | Delete
ob_start();
[392] Fix | Delete
[393] Fix | Delete
/**
[394] Fix | Delete
* Fires at the end of the 'At a Glance' dashboard widget.
[395] Fix | Delete
*
[396] Fix | Delete
* Prior to 3.8.0, the widget was named 'Right Now'.
[397] Fix | Delete
*
[398] Fix | Delete
* @since 2.5.0
[399] Fix | Delete
*/
[400] Fix | Delete
do_action( 'rightnow_end' );
[401] Fix | Delete
[402] Fix | Delete
/**
[403] Fix | Delete
* Fires at the end of the 'At a Glance' dashboard widget.
[404] Fix | Delete
*
[405] Fix | Delete
* Prior to 3.8.0, the widget was named 'Right Now'.
[406] Fix | Delete
*
[407] Fix | Delete
* @since 2.0.0
[408] Fix | Delete
*/
[409] Fix | Delete
do_action( 'activity_box_end' );
[410] Fix | Delete
[411] Fix | Delete
$actions = ob_get_clean();
[412] Fix | Delete
[413] Fix | Delete
if ( ! empty( $actions ) ) :
[414] Fix | Delete
?>
[415] Fix | Delete
<div class="sub">
[416] Fix | Delete
<?php echo $actions; ?>
[417] Fix | Delete
</div>
[418] Fix | Delete
<?php
[419] Fix | Delete
endif;
[420] Fix | Delete
}
[421] Fix | Delete
[422] Fix | Delete
/**
[423] Fix | Delete
* @since 3.1.0
[424] Fix | Delete
*/
[425] Fix | Delete
function wp_network_dashboard_right_now() {
[426] Fix | Delete
$actions = array();
[427] Fix | Delete
if ( current_user_can( 'create_sites' ) ) {
[428] Fix | Delete
$actions['create-site'] = '<a href="' . network_admin_url( 'site-new.php' ) . '">' . __( 'Create a New Site' ) . '</a>';
[429] Fix | Delete
}
[430] Fix | Delete
if ( current_user_can( 'create_users' ) ) {
[431] Fix | Delete
$actions['create-user'] = '<a href="' . network_admin_url( 'user-new.php' ) . '">' . __( 'Create a New User' ) . '</a>';
[432] Fix | Delete
}
[433] Fix | Delete
[434] Fix | Delete
$c_users = get_user_count();
[435] Fix | Delete
$c_blogs = get_blog_count();
[436] Fix | Delete
[437] Fix | Delete
/* translators: %s: Number of users on the network. */
[438] Fix | Delete
$user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) );
[439] Fix | Delete
/* translators: %s: Number of sites on the network. */
[440] Fix | Delete
$blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) );
[441] Fix | Delete
[442] Fix | Delete
/* translators: 1: Text indicating the number of sites on the network, 2: Text indicating the number of users on the network. */
[443] Fix | Delete
$sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text );
[444] Fix | Delete
[445] Fix | Delete
if ( $actions ) {
[446] Fix | Delete
echo '<ul class="subsubsub">';
[447] Fix | Delete
foreach ( $actions as $class => $action ) {
[448] Fix | Delete
$actions[ $class ] = "\t<li class='$class'>$action";
[449] Fix | Delete
}
[450] Fix | Delete
echo implode( " |</li>\n", $actions ) . "</li>\n";
[451] Fix | Delete
echo '</ul>';
[452] Fix | Delete
}
[453] Fix | Delete
?>
[454] Fix | Delete
<br class="clear" />
[455] Fix | Delete
[456] Fix | Delete
<p class="youhave"><?php echo $sentence; ?></p>
[457] Fix | Delete
[458] Fix | Delete
[459] Fix | Delete
<?php
[460] Fix | Delete
/**
[461] Fix | Delete
* Fires in the Network Admin 'Right Now' dashboard widget
[462] Fix | Delete
* just before the user and site search form fields.
[463] Fix | Delete
*
[464] Fix | Delete
* @since MU (3.0.0)
[465] Fix | Delete
*/
[466] Fix | Delete
do_action( 'wpmuadminresult' );
[467] Fix | Delete
?>
[468] Fix | Delete
[469] Fix | Delete
<form action="<?php echo network_admin_url( 'users.php' ); ?>" method="get">
[470] Fix | Delete
<p>
[471] Fix | Delete
<label class="screen-reader-text" for="search-users"><?php _e( 'Search Users' ); ?></label>
[472] Fix | Delete
<input type="search" name="s" value="" size="30" autocomplete="off" id="search-users"/>
[473] Fix | Delete
<?php submit_button( __( 'Search Users' ), '', false, false, array( 'id' => 'submit_users' ) ); ?>
[474] Fix | Delete
</p>
[475] Fix | Delete
</form>
[476] Fix | Delete
[477] Fix | Delete
<form action="<?php echo network_admin_url( 'sites.php' ); ?>" method="get">
[478] Fix | Delete
<p>
[479] Fix | Delete
<label class="screen-reader-text" for="search-sites"><?php _e( 'Search Sites' ); ?></label>
[480] Fix | Delete
<input type="search" name="s" value="" size="30" autocomplete="off" id="search-sites"/>
[481] Fix | Delete
<?php submit_button( __( 'Search Sites' ), '', false, false, array( 'id' => 'submit_sites' ) ); ?>
[482] Fix | Delete
</p>
[483] Fix | Delete
</form>
[484] Fix | Delete
<?php
[485] Fix | Delete
/**
[486] Fix | Delete
* Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
[487] Fix | Delete
*
[488] Fix | Delete
* @since MU (3.0.0)
[489] Fix | Delete
*/
[490] Fix | Delete
do_action( 'mu_rightnow_end' );
[491] Fix | Delete
[492] Fix | Delete
/**
[493] Fix | Delete
* Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
[494] Fix | Delete
*
[495] Fix | Delete
* @since MU (3.0.0)
[496] Fix | Delete
*/
[497] Fix | Delete
do_action( 'mu_activity_box_end' );
[498] Fix | Delete
}
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function