Improve hook readability via curly brackets. Props jjj for initial patch. Fixes #15422

git-svn-id: http://svn.automattic.com/wordpress/trunk@16365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu 2010-11-14 15:50:02 +00:00
parent 5617a1b8b1
commit 03dd41a0d2
9 changed files with 37 additions and 37 deletions

View File

@ -250,7 +250,7 @@ class WP_Terms_List_Table extends WP_List_Table {
$actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>";
$actions = apply_filters( 'tag_row_actions', $actions, $tag );
$actions = apply_filters( "${taxonomy}_row_actions", $actions, $tag );
$actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
$out .= $this->row_actions( $actions );
$out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';

View File

@ -1022,7 +1022,7 @@ function get_sample_permalink($id, $title = null, $name = null) {
$uri = untrailingslashit($uri);
if ( !empty($uri) )
$uri .= '/';
$permalink = str_replace('%pagename%', "${uri}%pagename%", $permalink);
$permalink = str_replace('%pagename%', "{$uri}%pagename%", $permalink);
}
$permalink = array($permalink, apply_filters('editable_slug', $post->post_name));

View File

@ -98,7 +98,7 @@ function wp_list_widget_controls_dynamic_sidebar( $params ) {
$id = isset($params[0]['_temp_id']) ? $params[0]['_temp_id'] : $widget_id;
$hidden = isset($params[0]['_hide']) ? ' style="display:none;"' : '';
$params[0]['before_widget'] = "<div id='widget-${i}_$id' class='widget'$hidden>";
$params[0]['before_widget'] = "<div id='widget-{$i}_{$id}' class='widget'$hidden>";
$params[0]['after_widget'] = "</div>";
$params[0]['before_title'] = "%BEG_OF_TITLE%"; // deprecated
$params[0]['after_title'] = "%END_OF_TITLE%"; // deprecated

View File

@ -1161,9 +1161,9 @@ function wp_transition_comment_status($new_status, $old_status, $comment) {
// Call the hooks
if ( $new_status != $old_status ) {
do_action('transition_comment_status', $new_status, $old_status, $comment);
do_action("comment_${old_status}_to_$new_status", $comment);
do_action("comment_{$old_status}_to_{$new_status}", $comment);
}
do_action("comment_${new_status}_$comment->comment_type", $comment->comment_ID, $comment);
do_action("comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment);
}
/**

View File

@ -4226,7 +4226,7 @@ function get_file_data( $file, $default_headers, $context = '' ) {
fclose( $fp );
if ( $context != '' ) {
$extra_headers = apply_filters( "extra_$context".'_headers', array() );
$extra_headers = apply_filters( "extra_{$context}".'_headers', array() );
$extra_headers = array_flip( $extra_headers );
foreach( $extra_headers as $key=>$value ) {

View File

@ -1121,7 +1121,7 @@ function get_calendar($initial = true, $echo = true) {
// We need to get the month from MySQL
$thisyear = ''.intval(substr($m, 0, 4));
$d = (($w - 1) * 7) + 6; //it seems MySQL's weeks disagree with PHP's
$thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('${thisyear}0101', INTERVAL $d DAY) ), '%m')");
$thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')");
} elseif ( !empty($m) ) {
$thisyear = ''.intval(substr($m, 0, 4));
if ( strlen($m) < 6 )

View File

@ -1608,12 +1608,12 @@ function sanitize_post($post, $context = 'display') {
* when calling filters.
*
* @since 2.3.0
* @uses apply_filters() Calls 'edit_$field' and '${field_no_prefix}_edit_pre' passing $value and
* @uses apply_filters() Calls 'edit_$field' and '{$field_no_prefix}_edit_pre' passing $value and
* $post_id if $context == 'edit' and field name prefix == 'post_'.
*
* @uses apply_filters() Calls 'edit_post_$field' passing $value and $post_id if $context == 'db'.
* @uses apply_filters() Calls 'pre_$field' passing $value if $context == 'db' and field name prefix == 'post_'.
* @uses apply_filters() Calls '${field}_pre' passing $value if $context == 'db' and field name prefix != 'post_'.
* @uses apply_filters() Calls '{$field}_pre' passing $value if $context == 'db' and field name prefix != 'post_'.
*
* @uses apply_filters() Calls '$field' passing $value, $post_id and $context if $context == anything
* other than 'raw', 'edit' and 'db' and field name prefix == 'post_'.
@ -1652,11 +1652,11 @@ function sanitize_post_field($field, $value, $post_id, $context) {
$format_to_edit = array('post_content', 'post_excerpt', 'post_title', 'post_password');
if ( $prefixed ) {
$value = apply_filters("edit_$field", $value, $post_id);
$value = apply_filters("edit_{$field}", $value, $post_id);
// Old school
$value = apply_filters("${field_no_prefix}_edit_pre", $value, $post_id);
$value = apply_filters("{$field_no_prefix}_edit_pre", $value, $post_id);
} else {
$value = apply_filters("edit_post_$field", $value, $post_id);
$value = apply_filters("edit_post_{$field}", $value, $post_id);
}
if ( in_array($field, $format_to_edit) ) {
@ -1669,18 +1669,18 @@ function sanitize_post_field($field, $value, $post_id, $context) {
}
} else if ( 'db' == $context ) {
if ( $prefixed ) {
$value = apply_filters("pre_$field", $value);
$value = apply_filters("${field_no_prefix}_save_pre", $value);
$value = apply_filters("pre_{$field}", $value);
$value = apply_filters("{$field_no_prefix}_save_pre", $value);
} else {
$value = apply_filters("pre_post_$field", $value);
$value = apply_filters("${field}_pre", $value);
$value = apply_filters("pre_post_{$field}", $value);
$value = apply_filters("{$field}_pre", $value);
}
} else {
// Use display filters by default.
if ( $prefixed )
$value = apply_filters($field, $value, $post_id, $context);
else
$value = apply_filters("post_$field", $value, $post_id, $context);
$value = apply_filters("post_{$field}", $value, $post_id, $context);
}
if ( 'attribute' == $context )
@ -2923,8 +2923,8 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
*
* @uses do_action() Calls 'transition_post_status' on $new_status, $old_status and
* $post if there is a status change.
* @uses do_action() Calls '${old_status}_to_$new_status' on $post if there is a status change.
* @uses do_action() Calls '${new_status}_$post->post_type' on post ID and $post.
* @uses do_action() Calls '{$old_status}_to_{$new_status}' on $post if there is a status change.
* @uses do_action() Calls '{$new_status}_{$post->post_type}' on post ID and $post.
*
* @param string $new_status Transition to this post status.
* @param string $old_status Previous post status.
@ -2932,8 +2932,8 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
*/
function wp_transition_post_status($new_status, $old_status, $post) {
do_action('transition_post_status', $new_status, $old_status, $post);
do_action("${old_status}_to_$new_status", $post);
do_action("${new_status}_$post->post_type", $post->ID, $post);
do_action("{$old_status}_to_{$new_status}", $post);
do_action("{$new_status}_{$post->post_type}", $post->ID, $post);
}
//
@ -5257,4 +5257,4 @@ function get_post_format_string( $slug ) {
return ( isset( $strings[$slug] ) ) ? $strings[$slug] : '';
}
?>
?>

View File

@ -1383,26 +1383,26 @@ function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
return $value;
if ( 'edit' == $context ) {
$value = apply_filters("edit_term_$field", $value, $term_id, $taxonomy);
$value = apply_filters("edit_${taxonomy}_$field", $value, $term_id);
$value = apply_filters("edit_term_{$field}", $value, $term_id, $taxonomy);
$value = apply_filters("edit_{$taxonomy}_{$field}", $value, $term_id);
if ( 'description' == $field )
$value = format_to_edit($value);
else
$value = esc_attr($value);
} else if ( 'db' == $context ) {
$value = apply_filters("pre_term_$field", $value, $taxonomy);
$value = apply_filters("pre_${taxonomy}_$field", $value);
$value = apply_filters("pre_term_{$field}", $value, $taxonomy);
$value = apply_filters("pre_{$taxonomy}_{$field}", $value);
// Back compat filters
if ( 'slug' == $field )
$value = apply_filters('pre_category_nicename', $value);
} else if ( 'rss' == $context ) {
$value = apply_filters("term_${field}_rss", $value, $taxonomy);
$value = apply_filters("${taxonomy}_${field}_rss", $value);
$value = apply_filters("term_{$field}_rss", $value, $taxonomy);
$value = apply_filters("{$taxonomy}_{$field}_rss", $value);
} else {
// Use display filters by default.
$value = apply_filters("term_$field", $value, $term_id, $taxonomy, $context);
$value = apply_filters("${taxonomy}_$field", $value, $term_id, $context);
$value = apply_filters("term_{$field}", $value, $term_id, $taxonomy, $context);
$value = apply_filters("{$taxonomy}_{$field}", $value, $term_id, $context);
}
if ( 'attribute' == $context )

View File

@ -1148,12 +1148,12 @@ function sanitize_user_object($user, $context = 'display') {
* when calling filters.
*
* @since 2.3.0
* @uses apply_filters() Calls 'edit_$field' and '${field_no_prefix}_edit_pre' passing $value and
* @uses apply_filters() Calls 'edit_$field' and '{$field_no_prefix}_edit_pre' passing $value and
* $user_id if $context == 'edit' and field name prefix == 'user_'.
*
* @uses apply_filters() Calls 'edit_user_$field' passing $value and $user_id if $context == 'db'.
* @uses apply_filters() Calls 'pre_$field' passing $value if $context == 'db' and field name prefix == 'user_'.
* @uses apply_filters() Calls '${field}_pre' passing $value if $context == 'db' and field name prefix != 'user_'.
* @uses apply_filters() Calls '{$field}_pre' passing $value if $context == 'db' and field name prefix != 'user_'.
*
* @uses apply_filters() Calls '$field' passing $value, $user_id and $context if $context == anything
* other than 'raw', 'edit' and 'db' and field name prefix == 'user_'.
@ -1186,9 +1186,9 @@ function sanitize_user_field($field, $value, $user_id, $context) {
if ( 'edit' == $context ) {
if ( $prefixed ) {
$value = apply_filters("edit_$field", $value, $user_id);
$value = apply_filters("edit_{$field}", $value, $user_id);
} else {
$value = apply_filters("edit_user_$field", $value, $user_id);
$value = apply_filters("edit_user_{$field}", $value, $user_id);
}
if ( 'description' == $field )
@ -1197,16 +1197,16 @@ function sanitize_user_field($field, $value, $user_id, $context) {
$value = esc_attr($value);
} else if ( 'db' == $context ) {
if ( $prefixed ) {
$value = apply_filters("pre_$field", $value);
$value = apply_filters("pre_{$field}", $value);
} else {
$value = apply_filters("pre_user_$field", $value);
$value = apply_filters("pre_user_{$field}", $value);
}
} else {
// Use display filters by default.
if ( $prefixed )
$value = apply_filters($field, $value, $user_id, $context);
else
$value = apply_filters("user_$field", $value, $user_id, $context);
$value = apply_filters("user_{$field}", $value, $user_id, $context);
}
if ( 'user_url' == $field )