mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-04 20:54:29 +00:00
Hooks: Standardize naming of dynamic hooks to use interpolation vs concatenation.
Benefits gained in discoverability and self-documentation throughout core trump the negligible performance hit in using interpolation in hook names. Props ramiy. See #37748. git-svn-id: https://develop.svn.wordpress.org/trunk@38307 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -83,7 +83,7 @@ do_action( 'admin_footer', '' );
|
||||
*
|
||||
* @param string $hook_suffix The current admin page.
|
||||
*/
|
||||
do_action( "admin_print_footer_scripts-$hook_suffix" );
|
||||
do_action( "admin_print_footer_scripts-{$hook_suffix}" );
|
||||
|
||||
/**
|
||||
* Prints any scripts and data queued for the footer.
|
||||
@@ -103,7 +103,7 @@ do_action( 'admin_print_footer_scripts' );
|
||||
* @global string $hook_suffix
|
||||
* @param string $hook_suffix The current admin page.
|
||||
*/
|
||||
do_action( "admin_footer-$hook_suffix" );
|
||||
do_action( "admin_footer-{$hook_suffix}" );
|
||||
|
||||
// get_site_option() won't exist when auto upgrading from <= 2.7
|
||||
if ( function_exists('get_site_option') ) {
|
||||
|
||||
@@ -96,7 +96,7 @@ do_action( 'admin_enqueue_scripts', $hook_suffix );
|
||||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
do_action( "admin_print_styles-$hook_suffix" );
|
||||
do_action( "admin_print_styles-{$hook_suffix}" );
|
||||
|
||||
/**
|
||||
* Fires when styles are printed for all admin pages.
|
||||
@@ -110,7 +110,7 @@ do_action( 'admin_print_styles' );
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
do_action( "admin_print_scripts-$hook_suffix" );
|
||||
do_action( "admin_print_scripts-{$hook_suffix}" );
|
||||
|
||||
/**
|
||||
* Fires when scripts are printed for all admin pages.
|
||||
@@ -127,7 +127,7 @@ do_action( 'admin_print_scripts' );
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
do_action( "admin_head-$hook_suffix" );
|
||||
do_action( "admin_head-{$hook_suffix}" );
|
||||
|
||||
/**
|
||||
* Fires in head section for all admin pages.
|
||||
|
||||
@@ -209,7 +209,7 @@ if ( isset($plugin_page) ) {
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
do_action( 'load-' . $page_hook );
|
||||
do_action( "load-{$page_hook}" );
|
||||
if (! isset($_GET['noheader']))
|
||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||
|
||||
@@ -239,7 +239,7 @@ if ( isset($plugin_page) ) {
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
do_action( 'load-' . $plugin_page );
|
||||
do_action( "load-{$plugin_page}" );
|
||||
|
||||
if ( !isset($_GET['noheader']))
|
||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||
@@ -278,7 +278,7 @@ if ( isset($plugin_page) ) {
|
||||
*
|
||||
* @since 3.5.0
|
||||
*/
|
||||
do_action( 'load-importer-' . $importer );
|
||||
do_action( "load-importer-{$importer}" );
|
||||
|
||||
$parent_file = 'tools.php';
|
||||
$submenu_file = 'import.php';
|
||||
@@ -326,7 +326,7 @@ if ( isset($plugin_page) ) {
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
do_action( 'load-' . $pagenow );
|
||||
do_action( "load-{$pagenow}" );
|
||||
|
||||
/*
|
||||
* The following hooks are fired to ensure backward compatibility.
|
||||
|
||||
@@ -331,7 +331,7 @@ do_action( 'add_meta_boxes', $post_type, $post );
|
||||
*
|
||||
* @param WP_Post $post Post object.
|
||||
*/
|
||||
do_action( 'add_meta_boxes_' . $post_type, $post );
|
||||
do_action( "add_meta_boxes_{$post_type}", $post );
|
||||
|
||||
/**
|
||||
* Fires after meta boxes have been added.
|
||||
|
||||
@@ -176,7 +176,7 @@ class WP_Automatic_Updater {
|
||||
* @param bool $update Whether to update.
|
||||
* @param object $item The update offer.
|
||||
*/
|
||||
$update = apply_filters( 'auto_update_' . $type, $update, $item );
|
||||
$update = apply_filters( "auto_update_{$type}", $update, $item );
|
||||
|
||||
if ( ! $update ) {
|
||||
if ( 'core' == $type )
|
||||
|
||||
@@ -518,7 +518,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
||||
* @param WP_Theme $theme The current WP_Theme object.
|
||||
* @param string $context Status of the theme.
|
||||
*/
|
||||
$actions = apply_filters( "theme_action_links_$stylesheet", $actions, $theme, $context );
|
||||
$actions = apply_filters( "theme_action_links_{$stylesheet}", $actions, $theme, $context );
|
||||
|
||||
echo $this->row_actions( $actions, true );
|
||||
}
|
||||
@@ -726,6 +726,6 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
||||
* @param WP_Theme $theme Current WP_Theme object.
|
||||
* @param string $status Status of the theme.
|
||||
*/
|
||||
do_action( "after_theme_row_$stylesheet", $stylesheet, $theme, $status );
|
||||
do_action( "after_theme_row_{$stylesheet}", $stylesheet, $theme, $status );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
|
||||
*
|
||||
* @param array|bool $args Plugin Install API arguments.
|
||||
*/
|
||||
$args = apply_filters( "install_plugins_table_api_args_$tab", $args );
|
||||
$args = apply_filters( "install_plugins_table_api_args_{$tab}", $args );
|
||||
|
||||
if ( !$args )
|
||||
return;
|
||||
|
||||
@@ -864,7 +864,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||
* 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
|
||||
* 'Drop-ins', 'Search'.
|
||||
*/
|
||||
do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status );
|
||||
do_action( "after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -134,7 +134,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
|
||||
*
|
||||
* @param array $args An array of themes API arguments.
|
||||
*/
|
||||
$args = apply_filters( 'install_themes_table_api_args_' . $tab, $args );
|
||||
$args = apply_filters( "install_themes_table_api_args_{$tab}", $args );
|
||||
|
||||
if ( ! $args )
|
||||
return;
|
||||
|
||||
@@ -618,7 +618,7 @@ function get_upload_iframe_src( $type = null, $post_id = null, $tab = null ) {
|
||||
*
|
||||
* @param string $upload_iframe_src The upload iframe source URL by type.
|
||||
*/
|
||||
$upload_iframe_src = apply_filters( $type . '_upload_iframe_src', $upload_iframe_src );
|
||||
$upload_iframe_src = apply_filters( "{$type}_upload_iframe_src", $upload_iframe_src );
|
||||
|
||||
return add_query_arg('TB_iframe', true, $upload_iframe_src);
|
||||
}
|
||||
@@ -786,7 +786,7 @@ function wp_media_upload_handler() {
|
||||
* @param string $src Media source URL.
|
||||
* @param string $title Media title.
|
||||
*/
|
||||
$html = apply_filters( $type . '_send_to_editor_url', $html, esc_url_raw( $src ), $title );
|
||||
$html = apply_filters( "{$type}_send_to_editor_url", $html, esc_url_raw( $src ), $title );
|
||||
} else {
|
||||
$align = '';
|
||||
$alt = esc_attr( wp_unslash( $_POST['alt'] ) );
|
||||
|
||||
@@ -588,7 +588,7 @@ function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silen
|
||||
* @param bool $network_wide Whether to enable the plugin for all sites in the network
|
||||
* or just the current site. Multisite only. Default is false.
|
||||
*/
|
||||
do_action( 'activate_' . $plugin, $network_wide );
|
||||
do_action( "activate_{$plugin}", $network_wide );
|
||||
}
|
||||
|
||||
if ( $network_wide ) {
|
||||
@@ -701,7 +701,7 @@ function deactivate_plugins( $plugins, $silent = false, $network_wide = null ) {
|
||||
* @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network
|
||||
* or just the current site. Multisite only. Default is false.
|
||||
*/
|
||||
do_action( 'deactivate_' . $plugin, $network_deactivating );
|
||||
do_action( "deactivate_{$plugin}", $network_deactivating );
|
||||
|
||||
/**
|
||||
* Fires after a plugin is deactivated.
|
||||
|
||||
@@ -70,10 +70,10 @@ function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
|
||||
* @param string null The context of whether the current revision is the old
|
||||
* or the new one. Values are 'to' or 'from'.
|
||||
*/
|
||||
$content_from = $compare_from ? apply_filters( "_wp_post_revision_field_$field", $compare_from->$field, $field, $compare_from, 'from' ) : '';
|
||||
$content_from = $compare_from ? apply_filters( "_wp_post_revision_field_{$field}", $compare_from->$field, $field, $compare_from, 'from' ) : '';
|
||||
|
||||
/** This filter is documented in wp-admin/includes/revision.php */
|
||||
$content_to = apply_filters( "_wp_post_revision_field_$field", $compare_to->$field, $field, $compare_to, 'to' );
|
||||
$content_to = apply_filters( "_wp_post_revision_field_{$field}", $compare_to->$field, $field, $compare_to, 'to' );
|
||||
|
||||
$args = array(
|
||||
'show_split_view' => true
|
||||
|
||||
@@ -95,7 +95,7 @@ if ( $tab == 'type' || $tab == 'type_url' || ! array_key_exists( $tab , media_up
|
||||
*
|
||||
* @since 2.5.0
|
||||
*/
|
||||
do_action( "media_upload_$type" );
|
||||
do_action( "media_upload_{$type}" );
|
||||
} else {
|
||||
/**
|
||||
* Fires inside limited and specific upload-tab views in the legacy
|
||||
@@ -107,6 +107,6 @@ if ( $tab == 'type' || $tab == 'type_url' || ! array_key_exists( $tab , media_up
|
||||
*
|
||||
* @since 2.5.0
|
||||
*/
|
||||
do_action( "media_upload_$tab" );
|
||||
do_action( "media_upload_{$tab}" );
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ wp_enqueue_script( 'updates' );
|
||||
*
|
||||
* @since 2.7.0
|
||||
*/
|
||||
do_action( "install_plugins_pre_$tab" );
|
||||
do_action( "install_plugins_pre_{$tab}" );
|
||||
|
||||
/*
|
||||
* Call the pre upload action on every non-upload plugin install screen
|
||||
@@ -155,7 +155,7 @@ if ( $tab !== 'upload' ) {
|
||||
*
|
||||
* @param int $paged The current page number of the plugins list table.
|
||||
*/
|
||||
do_action( "install_plugins_$tab", $paged ); ?>
|
||||
do_action( "install_plugins_{$tab}", $paged ); ?>
|
||||
|
||||
<span class="spinner"></span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user