| | 227 | $bulk_counts = array( |
| | 228 | 'updated' => isset( $_REQUEST['updated'] ) ? absint( $_REQUEST['updated'] ) : 0, |
| | 229 | 'locked' => isset( $_REQUEST['locked'] ) ? absint( $_REQUEST['locked'] ) : 0, |
| | 230 | 'deleted' => isset( $_REQUEST['deleted'] ) ? absint( $_REQUEST['deleted'] ) : 0, |
| | 231 | 'trashed' => isset( $_REQUEST['trashed'] ) ? absint( $_REQUEST['trashed'] ) : 0, |
| | 232 | 'untrashed' => isset( $_REQUEST['untrashed'] ) ? absint( $_REQUEST['untrashed'] ) : 0, |
| | 233 | ); |
| | 234 | |
| | 235 | $bulk_messages = array(); |
| | 236 | $bulk_messages['post'] = array( |
| | 237 | 'updated' => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ), |
| | 238 | 'locked' => _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ), |
| | 239 | 'deleted' => _n( '%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted'] ), |
| | 240 | 'trashed' => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ), |
| | 241 | 'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed'] ), |
| | 242 | ); |
| | 243 | $bulk_messages['page'] = array( |
| | 244 | 'updated' => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ), |
| | 245 | 'locked' => _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ), |
| | 246 | 'deleted' => _n( '%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted'] ), |
| | 247 | 'trashed' => _n( '%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed'] ), |
| | 248 | 'untrashed' => _n( '%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed'] ), |
| | 249 | ); |
| | 250 | |
| | 251 | $bulk_messages = apply_filters( 'bulk_post_updated_messages', $bulk_messages, $bulk_counts ); |
| | 252 | $bulk_counts = array_filter( $bulk_counts ); |
| | 253 | |
| 239 | | <?php if ( isset( $_REQUEST['locked'] ) || isset( $_REQUEST['updated'] ) || isset( $_REQUEST['deleted'] ) || isset( $_REQUEST['trashed'] ) || isset( $_REQUEST['untrashed'] ) ) { |
| 240 | | $messages = array(); |
| 241 | | ?> |
| 242 | | <div id="message" class="updated"><p> |
| 243 | | <?php if ( isset( $_REQUEST['updated'] ) && $updated = absint( $_REQUEST['updated'] ) ) { |
| 244 | | $messages[] = sprintf( _n( '%s post updated.', '%s posts updated.', $updated ), number_format_i18n( $updated ) ); |
| 245 | | } |
| | 266 | <?php |
| | 267 | // If we have a bulk message to issue: |
| | 268 | $messages = array(); |
| | 269 | foreach ( $bulk_counts as $message => $count ) { |
| | 270 | if ( isset( $bulk_messages[ $post_type ][ $message ] ) ) |
| | 271 | $messages[] = sprintf( $bulk_messages[ $post_type ][ $message ], number_format_i18n( $count ) ); |
| | 272 | elseif ( isset( $bulk_messages['post'][ $message ] ) ) |
| | 273 | $messages[] = sprintf( $bulk_messages['post'][ $message ], number_format_i18n( $count ) ); |
| 247 | | if ( isset( $_REQUEST['locked'] ) && $locked = absint( $_REQUEST['locked'] ) ) { |
| 248 | | $messages[] = sprintf( _n( '%s item not updated, somebody is editing it.', '%s items not updated, somebody is editing them.', $locked ), number_format_i18n( $locked ) ); |
| | 275 | if ( $message == 'trashed' && isset( $_REQUEST['ids'] ) ) { |
| | 276 | $ids = preg_replace( '/[^0-9,]/', '', $_REQUEST['ids'] ); |
| | 277 | $messages[] = '<a href="' . esc_url( wp_nonce_url( "edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", "bulk-posts" ) ) . '">' . __('Undo') . '</a>'; |
| | 278 | } |
| 251 | | if ( isset( $_REQUEST['deleted'] ) && $deleted = absint( $_REQUEST['deleted'] ) ) { |
| 252 | | $messages[] = sprintf( _n( 'Item permanently deleted.', '%s items permanently deleted.', $deleted ), number_format_i18n( $deleted ) ); |
| 253 | | } |
| 254 | | |
| 255 | | if ( isset( $_REQUEST['trashed'] ) && $trashed = absint( $_REQUEST['trashed'] ) ) { |
| 256 | | $messages[] = sprintf( _n( 'Item moved to the Trash.', '%s items moved to the Trash.', $trashed ), number_format_i18n( $trashed ) ); |
| 257 | | $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; |
| 258 | | $messages[] = '<a href="' . esc_url( wp_nonce_url( "edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", "bulk-posts" ) ) . '">' . __('Undo') . '</a>'; |
| 259 | | } |
| 260 | | |
| 261 | | if ( isset( $_REQUEST['untrashed'] ) && $untrashed = absint( $_REQUEST['untrashed'] ) ) { |
| 262 | | $messages[] = sprintf( _n( 'Item restored from the Trash.', '%s items restored from the Trash.', $untrashed ), number_format_i18n( $untrashed ) ); |
| 263 | | } |
| 264 | | |