Make WordPress Core

Ticket #11331: 11331.b.diff

File 11331.b.diff, 3.5 KB (added by coffee2code, 16 years ago)

Same as 11331.diff, but with spaces added to calls in that function. Separate issue, sure, but it's localized, trivial, and one step towards coding standards compliance.

  • wp-includes/post-template.php

     
    371371
    372372        $classes = array();
    373373
    374         if ( 'rtl' == get_bloginfo('text_direction') )
     374        if ( 'rtl' == get_bloginfo( 'text_direction' ) )
    375375                $classes[] = 'rtl';
    376376
    377377        if ( is_front_page() )
     
    393393
    394394        if ( is_single() ) {
    395395                $wp_query->post = $wp_query->posts[0];
    396                 setup_postdata($wp_query->post);
     396                setup_postdata( $wp_query->post );
    397397
    398398                $postID = $wp_query->post->ID;
    399399                $classes[] = 'single postid-' . $postID;
     
    402402                        $mime_type = get_post_mime_type();
    403403                        $mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' );
    404404                        $classes[] = 'attachmentid-' . $postID;
    405                         $classes[] = 'attachment-' . str_replace($mime_prefix, '', $mime_type);
     405                        $classes[] = 'attachment-' . str_replace( $mime_prefix, '', $mime_type );
    406406                }
    407407        } elseif ( is_archive() ) {
    408408                if ( is_author() ) {
    409409                        $author = $wp_query->get_queried_object();
    410410                        $classes[] = 'author';
    411                         $classes[] = 'author-' . sanitize_html_class($author->user_nicename , $author->ID);
     411                        $classes[] = 'author-' . sanitize_html_class( $author->user_nicename , $author->ID );
    412412                } elseif ( is_category() ) {
    413413                        $cat = $wp_query->get_queried_object();
    414414                        $classes[] = 'category';
    415                         $classes[] = 'category-' . sanitize_html_class($cat->slug, $cat->cat_ID);
     415                        $classes[] = 'category-' . sanitize_html_class( $cat->slug, $cat->cat_ID );
    416416                } elseif ( is_tag() ) {
    417417                        $tags = $wp_query->get_queried_object();
    418418                        $classes[] = 'tag';
    419                         $classes[] = 'tag-' . sanitize_html_class($tags->slug, $tags->term_id);
     419                        $classes[] = 'tag-' . sanitize_html_class( $tags->slug, $tags->term_id );
    420420                }
    421421        } elseif ( is_page() ) {
    422422                $classes[] = 'page';
    423423
    424424                $wp_query->post = $wp_query->posts[0];
    425                 setup_postdata($wp_query->post);
     425                setup_postdata( $wp_query->post );
    426426
    427427                $pageID = $wp_query->post->ID;
    428428
    429429                $classes[] = 'page-id-' . $pageID;
     430                $classes[] = 'page-slug-' . sanitize_html_class( $wp_query->post->post_name, '' );
    430431
    431432                if ( $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' LIMIT 1", $pageID) ) )
    432433                        $classes[] = 'page-parent';
     
    440441                        $classes[] = 'page-template-' . sanitize_html_class( str_replace( '.', '-', get_post_meta( $pageID, '_wp_page_template', true ) ), '' );
    441442                }
    442443        } elseif ( is_search() ) {
    443                 if ( !empty($wp_query->posts) )
     444                if ( !empty( $wp_query->posts ) )
    444445                        $classes[] = 'search-results';
    445446                else
    446447                        $classes[] = 'search-no-results';
     
    449450        if ( is_user_logged_in() )
    450451                $classes[] = 'logged-in';
    451452
    452         $page = $wp_query->get('page');
     453        $page = $wp_query->get( 'page' );
    453454
    454455        if ( !$page || $page < 2)
    455                 $page = $wp_query->get('paged');
     456                $page = $wp_query->get( 'paged' );
    456457
    457458        if ( $page && $page > 1 ) {
    458459                $classes[] = 'paged-' . $page;
     
    473474                        $classes[] = 'search-paged-' . $page;
    474475        }
    475476
    476         if ( !empty($class) ) {
     477        if ( !empty( $class ) ) {
    477478                if ( !is_array( $class ) )
    478                         $class = preg_split('#\s+#', $class);
    479                 $classes = array_merge($classes, $class);
     479                        $class = preg_split( '#\s+#', $class );
     480                $classes = array_merge( $classes, $class );
    480481        }
    481482
    482         $classes = array_map('esc_attr', $classes);
     483        $classes = array_map( 'esc_attr', $classes );
    483484
    484         return apply_filters('body_class', $classes, $class);
     485        return apply_filters( 'body_class', $classes, $class );
    485486}
    486487
    487488/**