Make WordPress Core


Ignore:
Timestamp:
02/14/2010 01:00:22 AM (16 years ago)
Author:
dd32
Message:

Formatting, Translations & Whitespace. Props ptahdunbar. See #9015

File:
1 edited

Legend:

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

    r13112 r13128  
    22
    33// Set the content width based on the Theme CSS
    4 $content_width = apply_filters('twentyten_content_width', 640 );
     4$content_width = apply_filters( 'twentyten_content_width', 640 );
    55
    66// Your Changeable header business starts here
     
    2626}
    2727
    28 add_custom_image_header('', 'twentyten_admin_header_style');
     28add_custom_image_header( '', 'twentyten_admin_header_style' );
    2929// and thus ends the changeable header business
    3030
     
    4545$locale_file = TEMPLATEPATH . "/languages/$locale.php";
    4646if ( is_readable($locale_file) )
    47     require_once($locale_file);
     47    require_once( $locale_file );
    4848
    4949// Get the page number
    50 function get_page_number() {
     50function twentyten_get_page_number() {
    5151    if ( get_query_var('paged') )
    52         echo ' | ' . __( 'Page ' , 'twentyten') . get_query_var('paged');
     52        echo ' | ' . __( 'Page ' , 'twentyten' ) . get_query_var('paged');
    5353}
    5454
    5555// Control excerpt length
    56 function new_excerpt_length($length) {
     56function twentyten_new_excerpt_length( $length ) {
    5757    return 40;
    5858}
    59 add_filter('excerpt_length', 'new_excerpt_length');
     59add_filter( 'excerpt_length', 'twentyten_new_excerpt_length' );
    6060
    6161
    6262// Make a nice read more link on excerpts
    63 function new_excerpt_more($more) {
     63function twentyten_new_excerpt_more($more) {
    6464    return '&nbsp;&hellip; <a href="'. get_permalink() . '">' . 'Continue&nbsp;reading&nbsp;<span class="meta-nav">&rarr;</span>' . '</a>';
    6565}
    66 add_filter('excerpt_more', 'new_excerpt_more');
     66add_filter( 'excerpt_more', 'twentyten_new_excerpt_more' );
    6767
    6868
    6969// Template for comments and pingbacks
    70 function twentyten_comment($comment, $args, $depth) {
    71     $GLOBALS ['comment'] = $comment; ?>
    72     <?php if ('' == $comment->comment_type) { ?>
    73     <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
     70function twentyten_list_comment( $comment, $args, $depth ) {
     71    $GLOBALS['comment'] = $comment; ?>
     72    <?php if ( '' == $comment->comment_type ) { ?>
     73    <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
    7474        <div id="comment-<?php comment_ID(); ?>">
    7575        <div class="comment-author vcard">
    76             <?php echo get_avatar($comment, 40); ?>
    77 
    78             <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
     76            <?php echo get_avatar( $comment, 40 ); ?>
     77            <?php printf( __('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link() ); ?>
    7978        </div>
    80         <?php if ($comment->comment_approved == '0') : ?>
    81             <em><?php _e('Your comment is awaiting moderation.') ?></em>
     79        <?php if ( $comment->comment_approved == '0' ) : ?>
     80            <em><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em>
    8281            <br />
    8382        <?php endif; ?>
    8483
    85         <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)'),'  ','') ?></div>
    86 
    87         <div class="comment-body"><?php comment_text() ?></div>
     84        <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>
     85
     86        <div class="comment-body"><?php comment_text(); ?></div>
    8887
    8988        <div class="reply">
    90             <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
     89            <?php comment_reply_link( array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth'])) ); ?>
    9190        </div>
    9291    </div>
     
    9493    <?php } else { ?>
    9594    <li class="post pingback">
    96         <p><?php _e('Pingback:') ?> <?php comment_author_link ()?><?php edit_comment_link ( 'edit', '&nbsp;&nbsp;', '' ); ?></p>
     95        <p><?php _e( 'Pingback: ', 'twentyten' ); ?><?php comment_author_link(); ?><?php edit_comment_link ( __('edit', 'twentyten'), '&nbsp;&nbsp;', '' ); ?></p>
    9796    <?php }
    9897}
    9998
    10099// Make the Visual Editor styles match the theme's styles
    101 function my_editor_style($url) {
    102     if ( !empty($url) )
    103         $url .= ',';
    104 
     100function twentyten_my_editor_style( $url ) {
     101        if ( !empty($url) )
     102            $url .= ',';
    105103    // Change the path here if using sub-directory
    106104    $url .= trailingslashit( get_stylesheet_directory_uri() ) . 'editor-style.css';
     
    108106    return $url;
    109107}
    110 add_filter('mce_css', 'my_editor_style');
     108add_filter( 'mce_css', 'twentyten_my_editor_style' );
     109
    111110
    112111// Remove inline styles on gallery shortcode
    113 function remove_gallery_css() {
     112function twentyten_remove_gallery_css() {
    114113    return "<div class='gallery'>";
    115114}
    116 add_filter('gallery_style', 'remove_gallery_css');
     115add_filter( 'gallery_style', 'twentyten_remove_gallery_css' );
     116
    117117
    118118// For category lists on category archives: Returns other categories except the current one (redundant)
    119 function cats_meow($glue) {
     119function cats_meow( $glue ) {
    120120    $current_cat = single_cat_title( '', false );
    121121    $separator = "\n";
     
    123123    foreach ( $cats as $i => $str ) {
    124124        if ( strstr( $str, ">$current_cat<" ) ) {
    125             unset($cats[$i]);
     125            unset( $cats[$i] );
    126126            break;
    127127        }
     
    130130        return false;
    131131
    132     return trim(join( $glue, $cats ));
     132    return trim( join( $glue, $cats ) );
    133133} // end cats_meow
    134134
     135
    135136// For tag lists on tag archives: Returns other tags except the current one (redundant)
    136 function tag_ur_it($glue) {
     137function tag_ur_it( $glue ) {
    137138    $current_tag = single_tag_title( '', '',  false );
    138139    $separator = "\n";
     
    140141    foreach ( $tags as $i => $str ) {
    141142        if ( strstr( $str, ">$current_tag<" ) ) {
    142             unset($tags[$i]);
     143            unset( $tags[$i] );
    143144            break;
    144145        }
     
    147148        return false;
    148149
    149     return trim(join( $glue, $tags ));
     150    return trim( join( $glue, $tags ) );
    150151} // end tag_ur_it
    151152
    152153// Register widgetized areas
    153 function theme_widgets_init() {
     154function twentyten_widgets_init() {
    154155    // Area 1
    155     register_sidebar( array (
     156    register_sidebar( array(
    156157        'name' => 'Primary Widget Area',
    157158        'id' => 'primary-widget-area',
    158         'description' => __('The primary widget area' , 'twentyten'),
     159        'description' => __( 'The primary widget area' , 'twentyten' ),
    159160        'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
    160161        'after_widget' => "</li>",
     
    164165
    165166    // Area 2
    166     register_sidebar( array (
     167    register_sidebar( array(
    167168        'name' => 'Secondary Widget Area',
    168169        'id' => 'secondary-widget-area',
    169         'description' => __('The secondary widget area' , 'twentyten'),
     170        'description' => __( 'The secondary widget area' , 'twentyten' ),
    170171        'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
    171172        'after_widget' => "</li>",
     
    175176
    176177    // Area 3
    177     register_sidebar( array (
     178    register_sidebar( array(
    178179        'name' => 'First Footer Widget Area',
    179180        'id' => 'first-footer-widget-area',
    180         'description' => __('The first footer widget area' , 'twentyten'),
     181        'description' => __( 'The first footer widget area' , 'twentyten' ),
    181182        'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
    182183        'after_widget' => "</li>",
     
    186187
    187188    // Area 4
    188     register_sidebar( array (
     189    register_sidebar( array(
    189190        'name' => 'Second Footer Widget Area',
    190191        'id' => 'second-footer-widget-area',
    191         'description' => __('The second footer widget area' , 'twentyten'),
     192        'description' => __( 'The second footer widget area' , 'twentyten' ),
    192193        'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
    193194        'after_widget' => "</li>",
     
    197198
    198199    // Area 5
    199     register_sidebar( array (
     200    register_sidebar( array(
    200201        'name' => 'Third Footer Widget Area',
    201202        'id' => 'third-footer-widget-area',
    202         'description' => __('The third footer widget area' , 'twentyten'),
     203        'description' => __( 'The third footer widget area' , 'twentyten' ),
    203204        'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
    204205        'after_widget' => "</li>",
     
    208209
    209210    // Area 6
    210     register_sidebar( array (
     211    register_sidebar( array(
    211212        'name' => 'Fourth Footer Widget Area',
    212213        'id' => 'fourth-footer-widget-area',
    213         'description' => __('The fourth footer widget area' , 'twentyten'),
     214        'description' => __( 'The fourth footer widget area' , 'twentyten' ),
    214215        'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
    215216        'after_widget' => "</li>",
     
    221222
    222223// Add all the groovy widget areas
    223 add_action( 'init', 'theme_widgets_init' );
     224add_action( 'init', 'twentyten_widgets_init' );
Note: See TracChangeset for help on using the changeset viewer.