From df2a293967f7cc4732ec1021ac8e8ba10f308336 Mon Sep 17 00:00:00 2001 From: dd32 Date: Sat, 13 Feb 2010 13:35:03 +0000 Subject: [PATCH] Whitespace cleanup, TwentyTen standardisation & gettext. See #9015 git-svn-id: http://svn.automattic.com/wordpress/trunk@13112 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-content/themes/twentyten/functions.php | 37 ++++++----------------- wp-content/themes/twentyten/header.php | 19 ++++++++---- 2 files changed, 22 insertions(+), 34 deletions(-) diff --git a/wp-content/themes/twentyten/functions.php b/wp-content/themes/twentyten/functions.php index 4774b1ac1..0e1e9dfee 100644 --- a/wp-content/themes/twentyten/functions.php +++ b/wp-content/themes/twentyten/functions.php @@ -46,15 +46,11 @@ $locale_file = TEMPLATEPATH . "/languages/$locale.php"; if ( is_readable($locale_file) ) require_once($locale_file); - - // Get the page number function get_page_number() { if ( get_query_var('paged') ) - print ' | ' . __( 'Page ' , 'twentyten') . get_query_var('paged'); -} // end get_page_number - - + echo ' | ' . __( 'Page ' , 'twentyten') . get_query_var('paged'); +} // Control excerpt length function new_excerpt_length($length) { @@ -63,7 +59,6 @@ function new_excerpt_length($length) { add_filter('excerpt_length', 'new_excerpt_length'); - // Make a nice read more link on excerpts function new_excerpt_more($more) { return ' … <a href="'. get_permalink() . '">' . 'Continue reading <span class="meta-nav">→</span>' . '</a>'; @@ -71,7 +66,6 @@ function new_excerpt_more($more) { add_filter('excerpt_more', 'new_excerpt_more'); - // Template for comments and pingbacks function twentyten_comment($comment, $args, $depth) { $GLOBALS ['comment'] = $comment; ?> @@ -79,7 +73,7 @@ function twentyten_comment($comment, $args, $depth) { <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>"> <div id="comment-<?php comment_ID(); ?>"> <div class="comment-author vcard"> - <?php echo get_avatar($comment,$size='40'); ?> + <?php echo get_avatar($comment, 40); ?> <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?> </div> @@ -88,7 +82,7 @@ function twentyten_comment($comment, $args, $depth) { <br /> <?php endif; ?> - <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( 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> + <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> <div class="comment-body"><?php comment_text() ?></div> @@ -103,32 +97,24 @@ function twentyten_comment($comment, $args, $depth) { <?php } } - - // Make the Visual Editor styles match the theme's styles - add_filter('mce_css', 'my_editor_style'); - function my_editor_style($url) { - - if ( !empty($url) ) - $url .= ','; +function my_editor_style($url) { + if ( !empty($url) ) + $url .= ','; // Change the path here if using sub-directory $url .= trailingslashit( get_stylesheet_directory_uri() ) . 'editor-style.css'; return $url; } - - +add_filter('mce_css', 'my_editor_style'); // Remove inline styles on gallery shortcode - function remove_gallery_css() { return "<div class='gallery'>"; } add_filter('gallery_style', 'remove_gallery_css'); - - // For category lists on category archives: Returns other categories except the current one (redundant) function cats_meow($glue) { $current_cat = single_cat_title( '', false ); @@ -146,8 +132,6 @@ function cats_meow($glue) { return trim(join( $glue, $cats )); } // end cats_meow - - // For tag lists on tag archives: Returns other tags except the current one (redundant) function tag_ur_it($glue) { $current_tag = single_tag_title( '', '', false ); @@ -165,7 +149,6 @@ function tag_ur_it($glue) { return trim(join( $glue, $tags )); } // end tag_ur_it - // Register widgetized areas function theme_widgets_init() { // Area 1 @@ -236,7 +219,5 @@ function theme_widgets_init() { } // end theme_widgets_init - - // Add all the groovy widget areas -add_action( 'init', 'theme_widgets_init' ); +add_action( 'init', 'theme_widgets_init' ); \ No newline at end of file diff --git a/wp-content/themes/twentyten/header.php b/wp-content/themes/twentyten/header.php index 328c215dd..5d10bf334 100644 --- a/wp-content/themes/twentyten/header.php +++ b/wp-content/themes/twentyten/header.php @@ -2,12 +2,19 @@ <html <?php language_attributes(); ?>> <head> <title><?php - if ( is_single() ) { single_post_title(); print ' | '; bloginfo('name'); } - elseif ( is_home() || is_front_page() ) { bloginfo('name'); print ' | '; bloginfo('description'); get_page_number(); } - elseif ( is_page() ) { single_post_title(''); print ' | '; bloginfo('name'); } - elseif ( is_search() ) { print 'Search results for ' . esc_html($s); get_page_number(); print ' | '; bloginfo('name'); } - elseif ( is_404() ) { print 'Not Found | '; bloginfo('name'); } - else { bloginfo('name'); wp_title('|'); get_page_number(); } + if ( is_single() ) { + single_post_title(); echo ' | '; bloginfo('name'); + } elseif ( is_home() || is_front_page() ) { + bloginfo('name'); echo ' | '; bloginfo('description'); get_page_number(); + } elseif ( is_page() ) { + single_post_title(''); echo ' | '; bloginfo('name'); + } elseif ( is_search() ) { + printf(__('Search results for "%s"', 'twentyten'), esc_html($s)); get_page_number(); echo ' | '; bloginfo('name'); + } elseif ( is_404() ) { + _e('Not Found', 'twentyten'); echo ' | '; bloginfo('name'); + } else { + wp_title(''); echo ' | '; bloginfo('name'); get_page_number(); + } ?>