WordPress.org

Make WordPress Core

Changeset 17989


Ignore:
Timestamp:
05/22/2011 10:30:05 PM (10 years ago)
Author:
nacin
Message:

Code readability improvements. props niallkennedy, fixes #17166, #17182, #17231, #16474.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/export.php

    r17700 r17989  
    5050        $post_types = get_post_types( array( 'can_export' => true ) );
    5151        $esses = array_fill( 0, count($post_types), '%s' );
    52         $where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (". implode(',',$esses) .")", $post_types );
     52        $where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types );
    5353    }
    5454
     
    124124
    125125        // $str = ent2ncr(esc_html($str));
    126         $str = "<![CDATA[$str" . ( ( substr( $str, -1 ) == ']' ) ? ' ' : '') . "]]>";
     126        $str = "<![CDATA[$str" . ( ( substr( $str, -1 ) == ']' ) ? ' ' : '' ) . ']]>';
    127127
    128128        return $str;
     
    351351    // fetch 20 posts at a time rather than loading the entire table into memory
    352352    while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
    353     $where = "WHERE ID IN (" . join( ',', $next_posts ) . ")";
     353    $where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')';
    354354    $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
    355355
  • trunk/wp-includes/general-template.php

    r17966 r17989  
    2929        $templates[] = "header-{$name}.php";
    3030
    31     $templates[] = "header.php";
     31    $templates[] = 'header.php';
    3232
    3333    // Backward compat code will be removed in a future release
     
    5858        $templates[] = "footer-{$name}.php";
    5959
    60     $templates[] = "footer.php";
     60    $templates[] = 'footer.php';
    6161
    6262    // Backward compat code will be removed in a future release
     
    8787        $templates[] = "sidebar-{$name}.php";
    8888
    89     $templates[] = "sidebar.php";
     89    $templates[] = 'sidebar.php';
    9090
    9191    // Backward compat code will be removed in a future release
     
    570570        $my_month = $wp_locale->get_month(substr($m, 4, 2));
    571571        $my_day = intval(substr($m, 6, 2));
    572         $title = $my_year . ($my_month ? $t_sep . $my_month : "") . ($my_day ? $t_sep . $my_day : "");
     572        $title = $my_year . ( $my_month ? $t_sep . $my_month : '' ) . ( $my_day ? $t_sep . $my_day : '' );
    573573    }
    574574
     
    844844        $link_html = "\t$before<a href='$url' title='$title_text'>$text</a>$after\n";
    845845
    846     $link_html = apply_filters( "get_archives_link", $link_html );
     846    $link_html = apply_filters( 'get_archives_link', $link_html );
    847847
    848848    return $link_html;
     
    916916
    917917    //filters
    918     $where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r );
    919     $join = apply_filters('getarchives_join', "", $r);
     918    $where = apply_filters( 'getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r );
     919    $join = apply_filters( 'getarchives_join', '', $r );
    920920
    921921    $output = '';
     
    10171017        }
    10181018    } elseif ( ( 'postbypost' == $type ) || ('alpha' == $type) ) {
    1019         $orderby = ('alpha' == $type) ? "post_title ASC " : "post_date DESC ";
     1019        $orderby = ('alpha' == $type) ? 'post_title ASC ' : 'post_date DESC ';
    10201020        $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
    10211021        $key = md5($query);
     
    12491249
    12501250        if ( in_array($day, $daywithpost) ) // any posts today?
    1251                 $calendar_output .= '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"" . esc_attr($ak_titles_for_day[$day]) . "\">$day</a>";
     1251                $calendar_output .= '<a href="' . get_day_link( $thisyear, $thismonth, $day ) . '" title="' . esc_attr( $ak_titles_for_day[ $day ] ) . "\">$day</a>";
    12521252        else
    12531253            $calendar_output .= $day;
     
    19981998            $link = add_query_arg( $add_args, $link );
    19991999        $link .= $add_fragment;
    2000         $page_links[] = "<a class='prev page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>$prev_text</a>";
     2000        $page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $prev_text . '</a>';
    20012001    endif;
    20022002    for ( $n = 1; $n <= $total; $n++ ) :
     
    20152015                $dots = true;
    20162016            elseif ( $dots && !$show_all ) :
    2017                 $page_links[] = "<span class='page-numbers dots'>...</span>";
     2017                $page_links[] = '<span class="page-numbers dots">...</span>';
    20182018                $dots = false;
    20192019            endif;
     
    20262026            $link = add_query_arg( $add_args, $link );
    20272027        $link .= $add_fragment;
    2028         $page_links[] = "<a class='next page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>$next_text</a>";
     2028        $page_links[] = '<a class="next page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $next_text . '</a>';
    20292029    endif;
    20302030    switch ( $type ) :
  • trunk/wp-includes/theme.php

    r17770 r17989  
    8080function get_stylesheet_uri() {
    8181    $stylesheet_dir_uri = get_stylesheet_directory_uri();
    82     $stylesheet_uri = $stylesheet_dir_uri . "/style.css";
     82    $stylesheet_uri = $stylesheet_dir_uri . '/style.css';
    8383    return apply_filters('stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
    8484}
     
    828828    $templates[] = "category-{$category->slug}.php";
    829829    $templates[] = "category-{$category->term_id}.php";
    830     $templates[] = "category.php";
     830    $templates[] = 'category.php';
    831831
    832832    return get_query_template( 'category', $templates );
     
    852852    $templates[] = "tag-{$tag->slug}.php";
    853853    $templates[] = "tag-{$tag->term_id}.php";
    854     $templates[] = "tag.php";
     854    $templates[] = 'tag.php';
    855855
    856856    return get_query_template( 'tag', $templates );
     
    882882    $templates[] = "taxonomy-$taxonomy-{$term->slug}.php";
    883883    $templates[] = "taxonomy-$taxonomy.php";
    884     $templates[] = "taxonomy.php";
     884    $templates[] = 'taxonomy.php';
    885885
    886886    return get_query_template( 'taxonomy', $templates );
     
    964964    if ( $id )
    965965        $templates[] = "page-$id.php";
    966     $templates[] = "page.php";
     966    $templates[] = 'page.php';
    967967
    968968    return get_query_template( 'page', $templates );
  • trunk/wp-signup.php

    r16755 r17989  
    1414
    1515function do_signup_header() {
    16     do_action("signup_header");
     16    do_action( 'signup_header' );
    1717}
    1818add_action( 'wp_head', 'do_signup_header' );
     
    189189    <form id="setupform" method="post" action="wp-signup.php">
    190190        <input type="hidden" name="stage" value="gimmeanotherblog" />
    191         <?php do_action( "signup_hidden_fields" ); ?>
     191        <?php do_action( 'signup_hidden_fields' ); ?>
    192192        <?php show_blog_form($blogname, $blog_title, $errors); ?>
    193193        <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ) ?>" /></p>
     
    253253    <form id="setupform" method="post" action="wp-signup.php">
    254254        <input type="hidden" name="stage" value="validate-user-signup" />
    255         <?php do_action( "signup_hidden_fields" ); ?>
     255        <?php do_action( 'signup_hidden_fields' ); ?>
    256256        <?php show_user_form($user_name, $user_email, $errors); ?>
    257257
     
    289289    }
    290290
    291     wpmu_signup_user($user_name, $user_email, apply_filters( "add_signup_meta", array() ) );
     291    wpmu_signup_user($user_name, $user_email, apply_filters( 'add_signup_meta', array() ) );
    292292
    293293    confirm_user_signup($user_name, $user_email);
     
    324324        <input type="hidden" name="user_name" value="<?php echo esc_attr($user_name) ?>" />
    325325        <input type="hidden" name="user_email" value="<?php echo esc_attr($user_email) ?>" />
    326         <?php do_action( "signup_hidden_fields" ); ?>
     326        <?php do_action( 'signup_hidden_fields' ); ?>
    327327        <?php show_blog_form($blogname, $blog_title, $errors); ?>
    328328        <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Signup') ?>" /></p>
     
    351351    $public = (int) $_POST['blog_public'];
    352352    $meta = array ('lang_id' => 1, 'public' => $public);
    353     $meta = apply_filters( "add_signup_meta", $meta );
     353    $meta = apply_filters( 'add_signup_meta', $meta );
    354354
    355355    wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
     
    397397
    398398$current_user = wp_get_current_user();
    399 if ( $active_signup == "none" ) {
     399if ( $active_signup == 'none' ) {
    400400    _e( 'Registration has been disabled.' );
    401401} elseif ( $active_signup == 'blog' && !is_user_logged_in() ) {
     
    427427        default :
    428428            $user_email = isset( $_POST[ 'user_email' ] ) ? $_POST[ 'user_email' ] : '';
    429             do_action( "preprocess_signup_form" ); // populate the form from invites, elsewhere?
     429            do_action( 'preprocess_signup_form' ); // populate the form from invites, elsewhere?
    430430            if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) )
    431431                signup_another_blog($newblogname);
Note: See TracChangeset for help on using the changeset viewer.