General: Use interpolation instead of concatenation for all dynamic hook names.

This fixes the rendering of the hook names on developer.wordpress.org.

Props keesiemeijer
Fixes #39148


git-svn-id: https://develop.svn.wordpress.org/trunk@39600 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn
2016-12-14 04:17:38 +00:00
parent c0bb5e4972
commit ca92da24da
12 changed files with 31 additions and 21 deletions

View File

@@ -83,19 +83,23 @@ if ( $doaction ) {
}
if ( ! in_array( $doaction, array( 'approve', 'unapprove', 'spam', 'unspam', 'trash', 'delete' ), true ) ) {
$screen = get_current_screen()->id;
/**
* Fires when a custom bulk action should be handled.
*
* The redirect link should be modified with success or failure feedback
* from the action to be used to display feedback to the user.
*
* The dynamic portion of the hook name, `$screen`, refers to the current screen ID.
*
* @since 4.7.0
*
* @param string $redirect_url The redirect URL.
* @param string $doaction The action being taken.
* @param array $items The items to take the action on.
*/
$redirect_to = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $redirect_to, $doaction, $comment_ids );
$redirect_to = apply_filters( "handle_bulk_actions-{$screen}", $redirect_to, $doaction, $comment_ids );
}
wp_defer_comment_counting( false );

View File

@@ -2702,7 +2702,7 @@ function wp_ajax_send_link_to_editor() {
$type = $ext_type;
/** This filter is documented in wp-admin/includes/media.php */
$html = apply_filters( $type . '_send_to_editor_url', $html, $src, $link_text );
$html = apply_filters( "{$type}_send_to_editor_url", $html, $src, $link_text );
wp_send_json_success( $html );
}

View File

@@ -732,7 +732,7 @@ class WP_List_Table {
*
* @param int $per_page Number of items to be displayed. Default 20.
*/
return (int) apply_filters( $option, $per_page );
return (int) apply_filters( "{$option}", $per_page );
}
/**

View File

@@ -1162,7 +1162,7 @@ final class WP_Screen {
$per_page = apply_filters( 'edit_categories_per_page', $per_page );
} else {
/** This filter is documented in wp-admin/includes/class-wp-list-table.php */
$per_page = apply_filters( $option, $per_page );
$per_page = apply_filters( "{$option}", $per_page );
}
// Back compat

View File

@@ -1025,7 +1025,7 @@ function uninstall_plugin($plugin) {
wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $file );
include( WP_PLUGIN_DIR . '/' . $file );
add_action( 'uninstall_' . $file, $callable );
add_action( "uninstall_{$file}", $callable );
/**
* Fires in uninstall_plugin() once the plugin has been uninstalled.
@@ -1035,7 +1035,7 @@ function uninstall_plugin($plugin) {
*
* @since 2.7.0
*/
do_action( 'uninstall_' . $file );
do_action( "uninstall_{$file}" );
}
}

View File

@@ -124,20 +124,24 @@ if ( $action ) {
check_admin_referer( 'bulk-themes' );
$themes = (array) $_POST['checked'];
$n = count( $themes );
$screen = get_current_screen()->id;
/**
* Fires when a custom bulk action should be handled.
*
* The redirect link should be modified with success or failure feedback
* from the action to be used to display feedback to the user.
*
* The dynamic portion of the hook name, `$screen`, refers to the current screen ID.
*
* @since 4.7.0
*
* @param string $redirect_url The redirect URL.
* @param string $action The action being taken.
* @param array $items The items to take the action on.
* @param int $site_id The site id.
* @param int $site_id The site ID.
*/
$referer = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $referer, $action, $themes, $id );
$referer = apply_filters( "handle_network_bulk_actions-{$screen}", $referer, $action, $themes, $id );
} else {
$action = 'error';
$n = 'none';