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

Built from https://develop.svn.wordpress.org/trunk@39600


git-svn-id: http://core.svn.wordpress.org/trunk@39540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn
2016-12-14 04:18:42 +00:00
parent efa99585e3
commit 4548b08236
13 changed files with 32 additions and 22 deletions

View File

@@ -148,7 +148,7 @@ function get_the_author_meta( $field = '', $user_id = false ) {
* @param int $user_id The user ID for the value.
* @param int|bool $original_user_id The original user ID, as passed to the function.
*/
return apply_filters( 'get_the_author_' . $field, $value, $user_id, $original_user_id );
return apply_filters( "get_the_author_{$field}", $value, $user_id, $original_user_id );
}
/**
@@ -174,7 +174,7 @@ function the_author_meta( $field = '', $user_id = false ) {
* @param string $author_meta The value of the metadata.
* @param int $user_id The user ID.
*/
echo apply_filters( 'the_author_' . $field, $author_meta, $user_id );
echo apply_filters( "the_author_{$field}", $author_meta, $user_id );
}
/**

View File

@@ -383,7 +383,7 @@ function sanitize_bookmark_field( $field, $value, $bookmark_id, $context ) {
if ( 'edit' == $context ) {
/** This filter is documented in wp-includes/post.php */
$value = apply_filters( "edit_$field", $value, $bookmark_id );
$value = apply_filters( "edit_{$field}", $value, $bookmark_id );
if ( 'link_notes' == $field ) {
$value = esc_html( $value ); // textarea_escaped
@@ -392,10 +392,10 @@ function sanitize_bookmark_field( $field, $value, $bookmark_id, $context ) {
}
} elseif ( 'db' == $context ) {
/** This filter is documented in wp-includes/post.php */
$value = apply_filters( "pre_$field", $value );
$value = apply_filters( "pre_{$field}", $value );
} else {
/** This filter is documented in wp-includes/post.php */
$value = apply_filters( $field, $value, $bookmark_id, $context );
$value = apply_filters( "{$field}", $value, $bookmark_id, $context );
if ( 'attribute' == $context ) {
$value = esc_attr( $value );

View File

@@ -480,17 +480,19 @@ class WP_Customize_Setting {
return false;
}
$id_base = $this->id_data['base'];
/**
* Fires when the WP_Customize_Setting::save() method is called.
*
* The dynamic portion of the hook name, `$this->id_data['base']` refers to
* The dynamic portion of the hook name, `$id_base` refers to
* the base slug of the setting name.
*
* @since 3.4.0
*
* @param WP_Customize_Setting $this WP_Customize_Setting instance.
*/
do_action( 'customize_save_' . $this->id_data['base'], $this );
do_action( "customize_save_{$id_base}", $this );
$this->update( $value );
}

View File

@@ -102,7 +102,7 @@ function get_option( $option, $default = false ) {
wp_cache_set( 'notoptions', $notoptions, 'options' );
/** This filter is documented in wp-includes/option.php */
return apply_filters( 'default_option_' . $option, $default, $option, $passed_default );
return apply_filters( "default_option_{$option}", $default, $option, $passed_default );
}
}
}
@@ -114,7 +114,7 @@ function get_option( $option, $default = false ) {
$value = $row->option_value;
} else {
/** This filter is documented in wp-includes/option.php */
return apply_filters( 'default_option_' . $option, $default, $option, $passed_default );
return apply_filters( "default_option_{$option}", $default, $option, $passed_default );
}
}
@@ -309,7 +309,7 @@ function update_option( $option, $value, $autoload = null ) {
}
/** This filter is documented in wp-includes/option.php */
if ( apply_filters( 'default_option_' . $option, false, $option, false ) === $old_value ) {
if ( apply_filters( "default_option_{$option}", false, $option, false ) === $old_value ) {
// Default setting for new options is 'yes'.
if ( null === $autoload ) {
$autoload = 'yes';
@@ -430,7 +430,7 @@ function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' )
$notoptions = wp_cache_get( 'notoptions', 'options' );
if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) )
/** This filter is documented in wp-includes/option.php */
if ( apply_filters( 'default_option_' . $option, false, $option, false ) !== get_option( $option ) )
if ( apply_filters( "default_option_{$option}", false, $option, false ) !== get_option( $option ) )
return false;
$serialized_value = maybe_serialize( $value );

View File

@@ -2061,7 +2061,7 @@ function sanitize_post_field( $field, $value, $post_id, $context = 'display' ) {
* values include 'raw', 'edit', 'db', 'display',
* 'attribute' and 'js'.
*/
$value = apply_filters( $field, $value, $post_id, $context );
$value = apply_filters( "{$field}", $value, $post_id, $context );
} else {
$value = apply_filters( "post_{$field}", $value, $post_id, $context );
}

View File

@@ -1208,7 +1208,7 @@ function sanitize_user_field($field, $value, $user_id, $context) {
if ( $prefixed ) {
/** This filter is documented in wp-includes/post.php */
$value = apply_filters( $field, $value, $user_id, $context );
$value = apply_filters( "{$field}", $value, $user_id, $context );
} else {
/**

View File

@@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-alpha-39599';
$wp_version = '4.8-alpha-39600';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.