Permalink
Browse files

Code readability improvements. props niallkennedy, fixes #17166, #171…

…82, #17231, #16474.

git-svn-id: http://svn.automattic.com/wordpress/trunk@17989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent d96d3a7 commit fad60afa23f6d7241cca6bcd712cb519f36a6908 nacin committed May 22, 2011
Showing with 28 additions and 28 deletions.
  1. +3 −3 wp-admin/includes/export.php
  2. +12 −12 wp-includes/general-template.php
  3. +5 −5 wp-includes/theme.php
  4. +8 −8 wp-signup.php
@@ -49,7 +49,7 @@ function export_wp( $args = array() ) {
} else {
$post_types = get_post_types( array( 'can_export' => true ) );
$esses = array_fill( 0, count($post_types), '%s' );
- $where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (". implode(',',$esses) .")", $post_types );
+ $where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types );
}
if ( $args['status'] && ( 'post' == $args['content'] || 'page' == $args['content'] ) )
@@ -123,7 +123,7 @@ function wxr_cdata( $str ) {
$str = utf8_encode( $str );
// $str = ent2ncr(esc_html($str));
- $str = "<![CDATA[$str" . ( ( substr( $str, -1 ) == ']' ) ? ' ' : '') . "]]>";
+ $str = "<![CDATA[$str" . ( ( substr( $str, -1 ) == ']' ) ? ' ' : '' ) . ']]>';
return $str;
}
@@ -350,7 +350,7 @@ function wxr_post_taxonomy() {
// fetch 20 posts at a time rather than loading the entire table into memory
while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
- $where = "WHERE ID IN (" . join( ',', $next_posts ) . ")";
+ $where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')';
$posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
// Begin Loop
@@ -28,7 +28,7 @@ function get_header( $name = null ) {
if ( isset($name) )
$templates[] = "header-{$name}.php";
- $templates[] = "header.php";
+ $templates[] = 'header.php';
// Backward compat code will be removed in a future release
if ('' == locate_template($templates, true))
@@ -57,7 +57,7 @@ function get_footer( $name = null ) {
if ( isset($name) )
$templates[] = "footer-{$name}.php";
- $templates[] = "footer.php";
+ $templates[] = 'footer.php';
// Backward compat code will be removed in a future release
if ('' == locate_template($templates, true))
@@ -86,7 +86,7 @@ function get_sidebar( $name = null ) {
if ( isset($name) )
$templates[] = "sidebar-{$name}.php";
- $templates[] = "sidebar.php";
+ $templates[] = 'sidebar.php';
// Backward compat code will be removed in a future release
if ('' == locate_template($templates, true))
@@ -569,7 +569,7 @@ function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
$my_year = substr($m, 0, 4);
$my_month = $wp_locale->get_month(substr($m, 4, 2));
$my_day = intval(substr($m, 6, 2));
- $title = $my_year . ($my_month ? $t_sep . $my_month : "") . ($my_day ? $t_sep . $my_day : "");
+ $title = $my_year . ( $my_month ? $t_sep . $my_month : '' ) . ( $my_day ? $t_sep . $my_day : '' );
}
// If there's a year
@@ -843,7 +843,7 @@ function get_archives_link($url, $text, $format = 'html', $before = '', $after =
else // custom
$link_html = "\t$before<a href='$url' title='$title_text'>$text</a>$after\n";
- $link_html = apply_filters( "get_archives_link", $link_html );
+ $link_html = apply_filters( 'get_archives_link', $link_html );
return $link_html;
}
@@ -915,8 +915,8 @@ function wp_get_archives($args = '') {
}
//filters
- $where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r );
- $join = apply_filters('getarchives_join', "", $r);
+ $where = apply_filters( 'getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r );
+ $join = apply_filters( 'getarchives_join', '', $r );
$output = '';
@@ -1016,7 +1016,7 @@ function wp_get_archives($args = '') {
}
}
} elseif ( ( 'postbypost' == $type ) || ('alpha' == $type) ) {
- $orderby = ('alpha' == $type) ? "post_title ASC " : "post_date DESC ";
+ $orderby = ('alpha' == $type) ? 'post_title ASC ' : 'post_date DESC ';
$query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
$key = md5($query);
$cache = wp_cache_get( 'wp_get_archives' , 'general');
@@ -1248,7 +1248,7 @@ function get_calendar($initial = true, $echo = true) {
$calendar_output .= '<td>';
if ( in_array($day, $daywithpost) ) // any posts today?
- $calendar_output .= '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"" . esc_attr($ak_titles_for_day[$day]) . "\">$day</a>";
+ $calendar_output .= '<a href="' . get_day_link( $thisyear, $thismonth, $day ) . '" title="' . esc_attr( $ak_titles_for_day[ $day ] ) . "\">$day</a>";
else
$calendar_output .= $day;
$calendar_output .= '</td>';
@@ -1997,7 +1997,7 @@ function paginate_links( $args = '' ) {
if ( $add_args )
$link = add_query_arg( $add_args, $link );
$link .= $add_fragment;
- $page_links[] = "<a class='prev page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>$prev_text</a>";
+ $page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $prev_text . '</a>';
endif;
for ( $n = 1; $n <= $total; $n++ ) :
$n_display = number_format_i18n($n);
@@ -2014,7 +2014,7 @@ function paginate_links( $args = '' ) {
$page_links[] = "<a class='page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>$n_display</a>";
$dots = true;
elseif ( $dots && !$show_all ) :
- $page_links[] = "<span class='page-numbers dots'>...</span>";
+ $page_links[] = '<span class="page-numbers dots">...</span>';
$dots = false;
endif;
endif;
@@ -2025,7 +2025,7 @@ function paginate_links( $args = '' ) {
if ( $add_args )
$link = add_query_arg( $add_args, $link );
$link .= $add_fragment;
- $page_links[] = "<a class='next page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>$next_text</a>";
+ $page_links[] = '<a class="next page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $next_text . '</a>';
endif;
switch ( $type ) :
case 'array' :
View
@@ -79,7 +79,7 @@ function get_stylesheet_directory_uri() {
*/
function get_stylesheet_uri() {
$stylesheet_dir_uri = get_stylesheet_directory_uri();
- $stylesheet_uri = $stylesheet_dir_uri . "/style.css";
+ $stylesheet_uri = $stylesheet_dir_uri . '/style.css';
return apply_filters('stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
}
@@ -827,7 +827,7 @@ function get_category_template() {
$templates[] = "category-{$category->slug}.php";
$templates[] = "category-{$category->term_id}.php";
- $templates[] = "category.php";
+ $templates[] = 'category.php';
return get_query_template( 'category', $templates );
}
@@ -851,7 +851,7 @@ function get_tag_template() {
$templates[] = "tag-{$tag->slug}.php";
$templates[] = "tag-{$tag->term_id}.php";
- $templates[] = "tag.php";
+ $templates[] = 'tag.php';
return get_query_template( 'tag', $templates );
}
@@ -881,7 +881,7 @@ function get_taxonomy_template() {
$templates[] = "taxonomy-$taxonomy-{$term->slug}.php";
$templates[] = "taxonomy-$taxonomy.php";
- $templates[] = "taxonomy.php";
+ $templates[] = 'taxonomy.php';
return get_query_template( 'taxonomy', $templates );
}
@@ -963,7 +963,7 @@ function get_page_template() {
$templates[] = "page-$pagename.php";
if ( $id )
$templates[] = "page-$id.php";
- $templates[] = "page.php";
+ $templates[] = 'page.php';
return get_query_template( 'page', $templates );
}
View
@@ -13,7 +13,7 @@
}
function do_signup_header() {
- do_action("signup_header");
+ do_action( 'signup_header' );
}
add_action( 'wp_head', 'do_signup_header' );
@@ -188,7 +188,7 @@ function signup_another_blog($blogname = '', $blog_title = '', $errors = '') {
<p><?php _e( 'If you&#8217;re not going to use a great site domain, leave it for a new user. Now have at it!' ) ?></p>
<form id="setupform" method="post" action="wp-signup.php">
<input type="hidden" name="stage" value="gimmeanotherblog" />
- <?php do_action( "signup_hidden_fields" ); ?>
+ <?php do_action( 'signup_hidden_fields' ); ?>
<?php show_blog_form($blogname, $blog_title, $errors); ?>
<p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ) ?>" /></p>
</form>
@@ -252,7 +252,7 @@ function signup_user($user_name = '', $user_email = '', $errors = '') {
<h2><?php printf( __( 'Get your own %s account in seconds' ), $current_site->site_name ) ?></h2>
<form id="setupform" method="post" action="wp-signup.php">
<input type="hidden" name="stage" value="validate-user-signup" />
- <?php do_action( "signup_hidden_fields" ); ?>
+ <?php do_action( 'signup_hidden_fields' ); ?>
<?php show_user_form($user_name, $user_email, $errors); ?>
<p>
@@ -288,7 +288,7 @@ function validate_user_signup() {
return false;
}
- wpmu_signup_user($user_name, $user_email, apply_filters( "add_signup_meta", array() ) );
+ wpmu_signup_user($user_name, $user_email, apply_filters( 'add_signup_meta', array() ) );
confirm_user_signup($user_name, $user_email);
return true;
@@ -323,7 +323,7 @@ function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_ti
<input type="hidden" name="stage" value="validate-blog-signup" />
<input type="hidden" name="user_name" value="<?php echo esc_attr($user_name) ?>" />
<input type="hidden" name="user_email" value="<?php echo esc_attr($user_email) ?>" />
- <?php do_action( "signup_hidden_fields" ); ?>
+ <?php do_action( 'signup_hidden_fields' ); ?>
<?php show_blog_form($blogname, $blog_title, $errors); ?>
<p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Signup') ?>" /></p>
</form>
@@ -350,7 +350,7 @@ function validate_blog_signup() {
$public = (int) $_POST['blog_public'];
$meta = array ('lang_id' => 1, 'public' => $public);
- $meta = apply_filters( "add_signup_meta", $meta );
+ $meta = apply_filters( 'add_signup_meta', $meta );
wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta);
@@ -396,7 +396,7 @@ function confirm_blog_signup($domain, $path, $blog_title, $user_name = '', $user
$newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
$current_user = wp_get_current_user();
-if ( $active_signup == "none" ) {
+if ( $active_signup == 'none' ) {
_e( 'Registration has been disabled.' );
} elseif ( $active_signup == 'blog' && !is_user_logged_in() ) {
if ( is_ssl() )
@@ -426,7 +426,7 @@ function confirm_blog_signup($domain, $path, $blog_title, $user_name = '', $user
case 'default':
default :
$user_email = isset( $_POST[ 'user_email' ] ) ? $_POST[ 'user_email' ] : '';
- do_action( "preprocess_signup_form" ); // populate the form from invites, elsewhere?
+ do_action( 'preprocess_signup_form' ); // populate the form from invites, elsewhere?
if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) )
signup_another_blog($newblogname);
elseif ( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) )

0 comments on commit fad60af

Please sign in to comment.