<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[16365] trunk: Improve hook readability via curly brackets.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16365">16365</a></dd>
<dt>Author</dt> <dd>scribu</dd>
<dt>Date</dt> <dd>2010-11-14 15:50:02 +0000 (Sun, 14 Nov 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Improve hook readability via curly brackets. Props jjj for initial patch. Fixes <a href="http://trac.wordpress.org/ticket/15422">#15422</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesclasswptermslisttablephp">trunk/wp-admin/includes/class-wp-terms-list-table.php</a></li>
<li><a href="#trunkwpadminincludespostphp">trunk/wp-admin/includes/post.php</a></li>
<li><a href="#trunkwpadminincludeswidgetsphp">trunk/wp-admin/includes/widgets.php</a></li>
<li><a href="#trunkwpincludescommentphp">trunk/wp-includes/comment.php</a></li>
<li><a href="#trunkwpincludesfunctionsphp">trunk/wp-includes/functions.php</a></li>
<li><a href="#trunkwpincludesgeneraltemplatephp">trunk/wp-includes/general-template.php</a></li>
<li><a href="#trunkwpincludespostphp">trunk/wp-includes/post.php</a></li>
<li><a href="#trunkwpincludestaxonomyphp">trunk/wp-includes/taxonomy.php</a></li>
<li><a href="#trunkwpincludesuserphp">trunk/wp-includes/user.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesclasswptermslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-terms-list-table.php (16364 => 16365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-terms-list-table.php        2010-11-14 01:46:49 UTC (rev 16364)
+++ trunk/wp-admin/includes/class-wp-terms-list-table.php        2010-11-14 15:50:02 UTC (rev 16365)
</span><span class="lines">@@ -250,7 +250,7 @@
</span><span class="cx">                         $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>";
</span><span class="cx">
</span><span class="cx">                 $actions = apply_filters( 'tag_row_actions', $actions, $tag );
</span><del>-                $actions = apply_filters( "${taxonomy}_row_actions", $actions, $tag );
</del><ins>+                $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
</ins><span class="cx">
</span><span class="cx">                 $out .= $this->row_actions( $actions );
</span><span class="cx">                 $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
</span></span></pre></div>
<a id="trunkwpadminincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/post.php (16364 => 16365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/post.php        2010-11-14 01:46:49 UTC (rev 16364)
+++ trunk/wp-admin/includes/post.php        2010-11-14 15:50:02 UTC (rev 16365)
</span><span class="lines">@@ -1022,7 +1022,7 @@
</span><span class="cx">                 $uri = untrailingslashit($uri);
</span><span class="cx">                 if ( !empty($uri) )
</span><span class="cx">                         $uri .= '/';
</span><del>-                $permalink = str_replace('%pagename%', "${uri}%pagename%", $permalink);
</del><ins>+                $permalink = str_replace('%pagename%', "{$uri}%pagename%", $permalink);
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         $permalink = array($permalink, apply_filters('editable_slug', $post->post_name));
</span></span></pre></div>
<a id="trunkwpadminincludeswidgetsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/widgets.php (16364 => 16365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/widgets.php        2010-11-14 01:46:49 UTC (rev 16364)
+++ trunk/wp-admin/includes/widgets.php        2010-11-14 15:50:02 UTC (rev 16365)
</span><span class="lines">@@ -98,7 +98,7 @@
</span><span class="cx">         $id = isset($params[0]['_temp_id']) ? $params[0]['_temp_id'] : $widget_id;
</span><span class="cx">         $hidden = isset($params[0]['_hide']) ? ' style="display:none;"' : '';
</span><span class="cx">
</span><del>-        $params[0]['before_widget'] = "<div id='widget-${i}_$id' class='widget'$hidden>";
</del><ins>+        $params[0]['before_widget'] = "<div id='widget-{$i}_{$id}' class='widget'$hidden>";
</ins><span class="cx">         $params[0]['after_widget'] = "</div>";
</span><span class="cx">         $params[0]['before_title'] = "%BEG_OF_TITLE%"; // deprecated
</span><span class="cx">         $params[0]['after_title'] = "%END_OF_TITLE%"; // deprecated
</span></span></pre></div>
<a id="trunkwpincludescommentphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/comment.php (16364 => 16365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/comment.php        2010-11-14 01:46:49 UTC (rev 16364)
+++ trunk/wp-includes/comment.php        2010-11-14 15:50:02 UTC (rev 16365)
</span><span class="lines">@@ -1161,9 +1161,9 @@
</span><span class="cx">         // Call the hooks
</span><span class="cx">         if ( $new_status != $old_status ) {
</span><span class="cx">                 do_action('transition_comment_status', $new_status, $old_status, $comment);
</span><del>-                do_action("comment_${old_status}_to_$new_status", $comment);
</del><ins>+                do_action("comment_{$old_status}_to_{$new_status}", $comment);
</ins><span class="cx">         }
</span><del>-        do_action("comment_${new_status}_$comment->comment_type", $comment->comment_ID, $comment);
</del><ins>+        do_action("comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkwpincludesfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/functions.php (16364 => 16365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/functions.php        2010-11-14 01:46:49 UTC (rev 16364)
+++ trunk/wp-includes/functions.php        2010-11-14 15:50:02 UTC (rev 16365)
</span><span class="lines">@@ -4226,7 +4226,7 @@
</span><span class="cx">         fclose( $fp );
</span><span class="cx">
</span><span class="cx">         if ( $context != '' ) {
</span><del>-                $extra_headers = apply_filters( "extra_$context".'_headers', array() );
</del><ins>+                $extra_headers = apply_filters( "extra_{$context}".'_headers', array() );
</ins><span class="cx">
</span><span class="cx">                 $extra_headers = array_flip( $extra_headers );
</span><span class="cx">                 foreach( $extra_headers as $key=>$value ) {
</span></span></pre></div>
<a id="trunkwpincludesgeneraltemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/general-template.php (16364 => 16365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/general-template.php        2010-11-14 01:46:49 UTC (rev 16364)
+++ trunk/wp-includes/general-template.php        2010-11-14 15:50:02 UTC (rev 16365)
</span><span class="lines">@@ -1121,7 +1121,7 @@
</span><span class="cx">                 // We need to get the month from MySQL
</span><span class="cx">                 $thisyear = ''.intval(substr($m, 0, 4));
</span><span class="cx">                 $d = (($w - 1) * 7) + 6; //it seems MySQL's weeks disagree with PHP's
</span><del>-                $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('${thisyear}0101', INTERVAL $d DAY) ), '%m')");
</del><ins>+                $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')");
</ins><span class="cx">         } elseif ( !empty($m) ) {
</span><span class="cx">                 $thisyear = ''.intval(substr($m, 0, 4));
</span><span class="cx">                 if ( strlen($m) < 6 )
</span></span></pre></div>
<a id="trunkwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post.php (16364 => 16365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post.php        2010-11-14 01:46:49 UTC (rev 16364)
+++ trunk/wp-includes/post.php        2010-11-14 15:50:02 UTC (rev 16365)
</span><span class="lines">@@ -1608,12 +1608,12 @@
</span><span class="cx"> * when calling filters.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.3.0
</span><del>- * @uses apply_filters() Calls 'edit_$field' and '${field_no_prefix}_edit_pre' passing $value and
</del><ins>+ * @uses apply_filters() Calls 'edit_$field' and '{$field_no_prefix}_edit_pre' passing $value and
</ins><span class="cx"> * $post_id if $context == 'edit' and field name prefix == 'post_'.
</span><span class="cx"> *
</span><span class="cx"> * @uses apply_filters() Calls 'edit_post_$field' passing $value and $post_id if $context == 'db'.
</span><span class="cx"> * @uses apply_filters() Calls 'pre_$field' passing $value if $context == 'db' and field name prefix == 'post_'.
</span><del>- * @uses apply_filters() Calls '${field}_pre' passing $value if $context == 'db' and field name prefix != 'post_'.
</del><ins>+ * @uses apply_filters() Calls '{$field}_pre' passing $value if $context == 'db' and field name prefix != 'post_'.
</ins><span class="cx"> *
</span><span class="cx"> * @uses apply_filters() Calls '$field' passing $value, $post_id and $context if $context == anything
</span><span class="cx"> * other than 'raw', 'edit' and 'db' and field name prefix == 'post_'.
</span><span class="lines">@@ -1652,11 +1652,11 @@
</span><span class="cx">                 $format_to_edit = array('post_content', 'post_excerpt', 'post_title', 'post_password');
</span><span class="cx">
</span><span class="cx">                 if ( $prefixed ) {
</span><del>-                        $value = apply_filters("edit_$field", $value, $post_id);
</del><ins>+                        $value = apply_filters("edit_{$field}", $value, $post_id);
</ins><span class="cx">                         // Old school
</span><del>-                        $value = apply_filters("${field_no_prefix}_edit_pre", $value, $post_id);
</del><ins>+                        $value = apply_filters("{$field_no_prefix}_edit_pre", $value, $post_id);
</ins><span class="cx">                 } else {
</span><del>-                        $value = apply_filters("edit_post_$field", $value, $post_id);
</del><ins>+                        $value = apply_filters("edit_post_{$field}", $value, $post_id);
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 if ( in_array($field, $format_to_edit) ) {
</span><span class="lines">@@ -1669,18 +1669,18 @@
</span><span class="cx">                 }
</span><span class="cx">         } else if ( 'db' == $context ) {
</span><span class="cx">                 if ( $prefixed ) {
</span><del>-                        $value = apply_filters("pre_$field", $value);
-                        $value = apply_filters("${field_no_prefix}_save_pre", $value);
</del><ins>+                        $value = apply_filters("pre_{$field}", $value);
+                        $value = apply_filters("{$field_no_prefix}_save_pre", $value);
</ins><span class="cx">                 } else {
</span><del>-                        $value = apply_filters("pre_post_$field", $value);
-                        $value = apply_filters("${field}_pre", $value);
</del><ins>+                        $value = apply_filters("pre_post_{$field}", $value);
+                        $value = apply_filters("{$field}_pre", $value);
</ins><span class="cx">                 }
</span><span class="cx">         } else {
</span><span class="cx">                 // Use display filters by default.
</span><span class="cx">                 if ( $prefixed )
</span><span class="cx">                         $value = apply_filters($field, $value, $post_id, $context);
</span><span class="cx">                 else
</span><del>-                        $value = apply_filters("post_$field", $value, $post_id, $context);
</del><ins>+                        $value = apply_filters("post_{$field}", $value, $post_id, $context);
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( 'attribute' == $context )
</span><span class="lines">@@ -2923,8 +2923,8 @@
</span><span class="cx"> *
</span><span class="cx"> * @uses do_action() Calls 'transition_post_status' on $new_status, $old_status and
</span><span class="cx"> * $post if there is a status change.
</span><del>- * @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.
</del><ins>+ * @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.
</ins><span class="cx"> *
</span><span class="cx"> * @param string $new_status Transition to this post status.
</span><span class="cx"> * @param string $old_status Previous post status.
</span><span class="lines">@@ -2932,8 +2932,8 @@
</span><span class="cx"> */
</span><span class="cx"> function wp_transition_post_status($new_status, $old_status, $post) {
</span><span class="cx">         do_action('transition_post_status', $new_status, $old_status, $post);
</span><del>-        do_action("${old_status}_to_$new_status", $post);
-        do_action("${new_status}_$post->post_type", $post->ID, $post);
</del><ins>+        do_action("{$old_status}_to_{$new_status}", $post);
+        do_action("{$new_status}_{$post->post_type}", $post->ID, $post);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> //
</span><span class="lines">@@ -5257,4 +5257,4 @@
</span><span class="cx">         return ( isset( $strings[$slug] ) ) ? $strings[$slug] : '';
</span><span class="cx"> }
</span><span class="cx">
</span><del>-?>
</del><span class="cx">\ No newline at end of file
</span><ins>+?>
</ins></span></pre></div>
<a id="trunkwpincludestaxonomyphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/taxonomy.php (16364 => 16365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/taxonomy.php        2010-11-14 01:46:49 UTC (rev 16364)
+++ trunk/wp-includes/taxonomy.php        2010-11-14 15:50:02 UTC (rev 16365)
</span><span class="lines">@@ -1383,26 +1383,26 @@
</span><span class="cx">                 return $value;
</span><span class="cx">
</span><span class="cx">         if ( 'edit' == $context ) {
</span><del>-                $value = apply_filters("edit_term_$field", $value, $term_id, $taxonomy);
-                $value = apply_filters("edit_${taxonomy}_$field", $value, $term_id);
</del><ins>+                $value = apply_filters("edit_term_{$field}", $value, $term_id, $taxonomy);
+                $value = apply_filters("edit_{$taxonomy}_{$field}", $value, $term_id);
</ins><span class="cx">                 if ( 'description' == $field )
</span><span class="cx">                         $value = format_to_edit($value);
</span><span class="cx">                 else
</span><span class="cx">                         $value = esc_attr($value);
</span><span class="cx">         } else if ( 'db' == $context ) {
</span><del>-                $value = apply_filters("pre_term_$field", $value, $taxonomy);
-                $value = apply_filters("pre_${taxonomy}_$field", $value);
</del><ins>+                $value = apply_filters("pre_term_{$field}", $value, $taxonomy);
+                $value = apply_filters("pre_{$taxonomy}_{$field}", $value);
</ins><span class="cx">                 // Back compat filters
</span><span class="cx">                 if ( 'slug' == $field )
</span><span class="cx">                         $value = apply_filters('pre_category_nicename', $value);
</span><span class="cx">
</span><span class="cx">         } else if ( 'rss' == $context ) {
</span><del>-                $value = apply_filters("term_${field}_rss", $value, $taxonomy);
-                $value = apply_filters("${taxonomy}_${field}_rss", $value);
</del><ins>+                $value = apply_filters("term_{$field}_rss", $value, $taxonomy);
+                $value = apply_filters("{$taxonomy}_{$field}_rss", $value);
</ins><span class="cx">         } else {
</span><span class="cx">                 // Use display filters by default.
</span><del>-                $value = apply_filters("term_$field", $value, $term_id, $taxonomy, $context);
-                $value = apply_filters("${taxonomy}_$field", $value, $term_id, $context);
</del><ins>+                $value = apply_filters("term_{$field}", $value, $term_id, $taxonomy, $context);
+                $value = apply_filters("{$taxonomy}_{$field}", $value, $term_id, $context);
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( 'attribute' == $context )
</span></span></pre></div>
<a id="trunkwpincludesuserphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/user.php (16364 => 16365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/user.php        2010-11-14 01:46:49 UTC (rev 16364)
+++ trunk/wp-includes/user.php        2010-11-14 15:50:02 UTC (rev 16365)
</span><span class="lines">@@ -1148,12 +1148,12 @@
</span><span class="cx"> * when calling filters.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.3.0
</span><del>- * @uses apply_filters() Calls 'edit_$field' and '${field_no_prefix}_edit_pre' passing $value and
</del><ins>+ * @uses apply_filters() Calls 'edit_$field' and '{$field_no_prefix}_edit_pre' passing $value and
</ins><span class="cx"> * $user_id if $context == 'edit' and field name prefix == 'user_'.
</span><span class="cx"> *
</span><span class="cx"> * @uses apply_filters() Calls 'edit_user_$field' passing $value and $user_id if $context == 'db'.
</span><span class="cx"> * @uses apply_filters() Calls 'pre_$field' passing $value if $context == 'db' and field name prefix == 'user_'.
</span><del>- * @uses apply_filters() Calls '${field}_pre' passing $value if $context == 'db' and field name prefix != 'user_'.
</del><ins>+ * @uses apply_filters() Calls '{$field}_pre' passing $value if $context == 'db' and field name prefix != 'user_'.
</ins><span class="cx"> *
</span><span class="cx"> * @uses apply_filters() Calls '$field' passing $value, $user_id and $context if $context == anything
</span><span class="cx"> * other than 'raw', 'edit' and 'db' and field name prefix == 'user_'.
</span><span class="lines">@@ -1186,9 +1186,9 @@
</span><span class="cx">
</span><span class="cx">         if ( 'edit' == $context ) {
</span><span class="cx">                 if ( $prefixed ) {
</span><del>-                        $value = apply_filters("edit_$field", $value, $user_id);
</del><ins>+                        $value = apply_filters("edit_{$field}", $value, $user_id);
</ins><span class="cx">                 } else {
</span><del>-                        $value = apply_filters("edit_user_$field", $value, $user_id);
</del><ins>+                        $value = apply_filters("edit_user_{$field}", $value, $user_id);
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 if ( 'description' == $field )
</span><span class="lines">@@ -1197,16 +1197,16 @@
</span><span class="cx">                         $value = esc_attr($value);
</span><span class="cx">         } else if ( 'db' == $context ) {
</span><span class="cx">                 if ( $prefixed ) {
</span><del>-                        $value = apply_filters("pre_$field", $value);
</del><ins>+                        $value = apply_filters("pre_{$field}", $value);
</ins><span class="cx">                 } else {
</span><del>-                        $value = apply_filters("pre_user_$field", $value);
</del><ins>+                        $value = apply_filters("pre_user_{$field}", $value);
</ins><span class="cx">                 }
</span><span class="cx">         } else {
</span><span class="cx">                 // Use display filters by default.
</span><span class="cx">                 if ( $prefixed )
</span><span class="cx">                         $value = apply_filters($field, $value, $user_id, $context);
</span><span class="cx">                 else
</span><del>-                        $value = apply_filters("user_$field", $value, $user_id, $context);
</del><ins>+                        $value = apply_filters("user_{$field}", $value, $user_id, $context);
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( 'user_url' == $field )
</span></span></pre>
</div>
</div>
</body>
</html>