Make WordPress Core


Ignore:
Timestamp:
03/16/2010 08:17:22 PM (16 years ago)
Author:
iammattthomas
Message:

Coding standards cleanup in twentyten, see #9015. Props sivel

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyten/functions.php

    r13552 r13720  
    99        // Your Changeable header business starts here
    1010        // No CSS, just IMG call
    11         define( 'HEADER_TEXTCOLOR', '');
    12         define( 'HEADER_IMAGE', '%s/images/headers/forestfloor.jpg'); // %s is theme dir uri
     11        define( 'HEADER_TEXTCOLOR', '' );
     12        define( 'HEADER_IMAGE', '%s/images/headers/forestfloor.jpg' ); // %s is theme dir uri
    1313        define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width',  940 ) );
    1414        define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height',  198 ) );
     
    1818        // and thus ends the changeable header business
    1919
    20         register_default_headers( array('berries' => array('url' => '%s/images/headers/berries.jpg', 'thumbnail_url' => '%s/images/headers/berries-thumbnail.jpg', 'description' => __('Berries')),
    21                                                                         'cherryblossom' => array( 'url' => '%s/images/headers/cherryblossoms.jpg', 'thumbnail_url' => '%s/images/headers/cherryblossoms-thumbnail.jpg', 'description' => __('Cherry Blossoms')),
    22                                                                         'concave' => array('url' => '%s/images/headers/concave.jpg', 'thumbnail_url' => '%s/images/headers/concave-thumbnail.jpg', 'description' => __('Concave')),
    23                                                                         'fern' => array('url' => '%s/images/headers/fern.jpg', 'thumbnail_url' => '%s/images/headers/fern-thumbnail.jpg', 'description' => __('Fern')),
    24                                                                         'forestfloor' => array('url' => '%s/images/headers/forestfloor.jpg', 'thumbnail_url' => '%s/images/headers/forestfloor-thumbnail.jpg', 'description' => __('Forest Floor')),
    25                                                                         'inkwell' => array('url' => '%s/images/headers/inkwell.jpg', 'thumbnail_url' => '%s/images/headers/inkwell-thumbnail.jpg', 'description' => __('Ink Well')),
    26                                                                         'path' => array('url' => '%s/images/headers/path.jpg', 'thumbnail_url' => '%s/images/headers/path-thumbnail.jpg', 'description' => __('Path')),
    27                                                                         'sunset' => array('url' => '%s/images/headers/sunset.jpg', 'thumbnail_url' => '%s/images/headers/sunset-thumbnail.jpg', 'description' => __('Sunset')) ) );
     20        register_default_headers( array (
     21                'berries' => array (
     22                        'url' => '%s/images/headers/berries.jpg',
     23                        'thumbnail_url' => '%s/images/headers/berries-thumbnail.jpg',
     24                        'description' => __( 'Berries' )
     25                ),
     26                'cherryblossom' => array (
     27                        'url' => '%s/images/headers/cherryblossoms.jpg',
     28                        'thumbnail_url' => '%s/images/headers/cherryblossoms-thumbnail.jpg',
     29                        'description' => __( 'Cherry Blossoms' )
     30                ),
     31                'concave' => array (
     32                        'url' => '%s/images/headers/concave.jpg',
     33                        'thumbnail_url' => '%s/images/headers/concave-thumbnail.jpg',
     34                        'description' => __( 'Concave' )
     35                ),
     36                'fern' => array (
     37                        'url' => '%s/images/headers/fern.jpg',
     38                        'thumbnail_url' => '%s/images/headers/fern-thumbnail.jpg',
     39                        'description' => __( 'Fern' )
     40                ),
     41                'forestfloor' => array (
     42                        'url' => '%s/images/headers/forestfloor.jpg',
     43                        'thumbnail_url' => '%s/images/headers/forestfloor-thumbnail.jpg',
     44                        'description' => __( 'Forest Floor' )
     45                ),
     46                'inkwell' => array (
     47                        'url' => '%s/images/headers/inkwell.jpg',
     48                        'thumbnail_url' => '%s/images/headers/inkwell-thumbnail.jpg',
     49                        'description' => __( 'Ink Well' )
     50                ),
     51                'path' => array (
     52                        'url' => '%s/images/headers/path.jpg',
     53                        'thumbnail_url' => '%s/images/headers/path-thumbnail.jpg',
     54                        'description' => __( 'Path' )
     55                ),
     56                'sunset' => array (
     57                        'url' => '%s/images/headers/sunset.jpg',
     58                        'thumbnail_url' => '%s/images/headers/sunset-thumbnail.jpg',
     59                        'description' => __( 'Sunset' )
     60                )
     61        ) );
    2862
    2963        add_custom_background();
     
    76110if ( ! function_exists( 'twentyten_get_page_number' ) ) :
    77111function twentyten_get_page_number() {
    78         if ( get_query_var('paged') )
    79                 return ' | ' . __( 'Page ' , 'twentyten') . get_query_var('paged');
     112        if ( get_query_var( 'paged' ) )
     113                return ' | ' . __( 'Page ' , 'twentyten' ) . get_query_var( 'paged' );
    80114}
    81115endif;
     
    99133// Make a nice read more link on excerpts
    100134if ( ! function_exists( 'twentyten_excerpt_more' ) ) :
    101 function twentyten_excerpt_more($more) {
     135function twentyten_excerpt_more( $more ) {
    102136        return '&nbsp;&hellip; <a href="'. get_permalink() . '">' . 'Continue&nbsp;reading&nbsp;<span class="meta-nav">&rarr;</span>' . '</a>';
    103137}
     
    122156                <?php endif; ?>
    123157
    124                 <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"><?php printf( __( '%1$s at %2$s' ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ),'  ','' ); ?></div>
     158                <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"><?php printf( __( '%1$s at %2$s' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ),'  ','' ); ?></div>
    125159
    126160                <div class="comment-body"><?php comment_text(); ?></div>
     
    148182if ( ! function_exists( 'twentyten_cat_list' ) ) :
    149183function twentyten_cat_list() {
    150         return twentyten_term_list('category', ', ', __('Posted in %s', 'twentyten'), __('Also posted in %s', 'twentyten') );
     184        return twentyten_term_list( 'category', ', ', __( 'Posted in %s', 'twentyten' ), __( 'Also posted in %s', 'twentyten' ) );
    151185}
    152186endif;
     
    154188if ( ! function_exists( 'twentyten_tag_list' ) ) :
    155189function twentyten_tag_list() {
    156         return twentyten_term_list('post_tag', ', ', __('Tagged %s', 'twentyten'), __('Also tagged %s', 'twentyten') );
     190        return twentyten_term_list( 'post_tag', ', ', __( 'Tagged %s', 'twentyten' ), __( 'Also tagged %s', 'twentyten' ) );
    157191}
    158192endif;
    159193
    160194if ( ! function_exists( 'twentyten_term_list' ) ) :
    161 function twentyten_term_list($taxonomy, $glue = ', ', $text = '', $also_text = '') {
     195function twentyten_term_list( $taxonomy, $glue = ', ', $text = '', $also_text = '' ) {
    162196        global $wp_query, $post;
    163197        $current_term = $wp_query->get_queried_object();
    164         $terms = wp_get_object_terms($post->ID, $taxonomy);
     198        $terms = wp_get_object_terms( $post->ID, $taxonomy );
    165199        // If we're viewing a Taxonomy page..
    166         if ( isset($current_term->taxonomy) && $taxonomy == $current_term->taxonomy ) {
     200        if ( isset( $current_term->taxonomy ) && $taxonomy == $current_term->taxonomy ) {
    167201                // Remove the term from display.
    168                 foreach ( (array)$terms as $key => $term ) {
     202                foreach ( (array) $terms as $key => $term ) {
    169203                        if ( $term->term_id == $current_term->term_id ) {
    170                                 unset($terms[$key]);
     204                                unset( $terms[$key] );
    171205                                break;
    172206                        }
     
    177211        $tlist = array();
    178212        $rel = 'category' == $taxonomy ? 'rel="category"' : 'rel="tag"';
    179         foreach ( (array)$terms as $term ) {
     213        foreach ( (array) $terms as $term ) {
    180214                $tlist[] = '<a href="' . get_term_link( $term, $taxonomy ) . '" title="' . esc_attr( sprintf( __( 'View all posts in %s', 'twentyten' ), $term->name ) ) . '" ' . $rel . '>' . $term->name . '</a>';
    181215        }
    182         if ( !empty($tlist) )
    183                 return sprintf($text, join($glue, $tlist));
     216        if ( ! empty( $tlist ) )
     217                return sprintf( $text, join( $glue, $tlist ) );
    184218        return '';
    185219}
Note: See TracChangeset for help on using the changeset viewer.