Index: wp-content/themes/twentyten/functions.php
===================================================================
--- wp-content/themes/twentyten/functions.php	(revision 13127)
+++ wp-content/themes/twentyten/functions.php	(working copy)
@@ -1,16 +1,47 @@
 <?php
 
-// Set the content width based on the Theme CSS
-$content_width = apply_filters('twentyten_content_width', 640 );
+if ( ! function_exists( 'twentyten_content_width' ) ) :
+function twentyten_content_width() {
+    // Set the content width based on the Theme CSS
+    return apply_filters('twentyten_content_width', 640 );
+}
+endif;
 
-// Your Changeable header business starts here
-// No CSS, just IMG call
-define( 'HEADER_TEXTCOLOR', '');
-define( 'HEADER_IMAGE', '%s/images/header-1.jpg'); // %s is theme dir uri
-define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width',  940 ) );
-define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height',  198 ) );
-define( 'NO_HEADER_TEXT', true );
+if ( ! function_exists( 'twentyten_init' ) ) :
+function twentyten_init() {
+	// Your Changeable header business starts here
+	// No CSS, just IMG call
+	define( 'HEADER_TEXTCOLOR', '');
+	define( 'HEADER_IMAGE', '%s/images/header-1.jpg'); // %s is theme dir uri
+	define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width',  940 ) );
+	define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height',  198 ) );
+	define( 'NO_HEADER_TEXT', true );
 
+	add_custom_image_header( '', 'twentyten_admin_header_style' );
+	// and thus ends the changeable header business
+
+	add_custom_background();
+
+	// This theme needs post thumbnails
+	add_theme_support( 'post-thumbnails' );
+
+	// We'll be using them for custom header images on posts and pages
+	// so we want them to be 940 pixels wide by 198 pixels tall (larger images will be auto-cropped to fit)
+	set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );
+
+	// Make theme available for translation
+	// Translations can be filed in the /languages/ directory
+	load_theme_textdomain( 'twentyten', TEMPLATEPATH . '/languages' );
+
+	$locale = get_locale();
+	$locale_file = TEMPLATEPATH . "/languages/$locale.php";
+	if ( is_readable( $locale_file ) )
+	    require_once( $locale_file );
+}
+endif;
+add_action( 'init', 'twentyten_init' );
+
+if ( ! function_exists( 'twentyten_admin_header_style' ) ) :
 function twentyten_admin_header_style() {
 ?>
 <style type="text/css">
@@ -24,82 +55,78 @@
 </style>
 <?php
 }
+endif;
 
-add_custom_image_header('', 'twentyten_admin_header_style');
-// and thus ends the changeable header business
-
-add_custom_background();
-
-// This theme needs post thumbnails
-add_theme_support( 'post-thumbnails' );
-
-// We'll be using them for custom header images on posts and pages
-// so we want them to be 940 pixels wide by 198 pixels tall (larger images will be auto-cropped to fit)
-set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );
-
-// Make theme available for translation
-// Translations can be filed in the /languages/ directory
-load_theme_textdomain( 'twentyten', TEMPLATEPATH . '/languages' );
-
-$locale = get_locale();
-$locale_file = TEMPLATEPATH . "/languages/$locale.php";
-if ( is_readable($locale_file) )
-	require_once($locale_file);
-
 // Get the page number
+if ( ! function_exists( 'get_page_number' ) ) :
 function get_page_number() {
 	if ( get_query_var('paged') )
-		echo ' | ' . __( 'Page ' , 'twentyten') . get_query_var('paged');
+		return ' | ' . __( 'Page ' , 'twentyten') . get_query_var('paged');
 }
+endif;
 
+// Echo the page number
+if ( ! function_exists( 'the_page_number' ) ) :
+function the_page_number() {
+	echo get_page_number();
+}
+endif;
+
 // Control excerpt length
-function new_excerpt_length($length) {
+if ( ! function_exists( 'twentyten_excerpt_length' ) ) :
+function twentyten_excerpt_length( $length ) {
 	return 40;
 }
-add_filter('excerpt_length', 'new_excerpt_length');
+endif;
+add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
 
 
 // Make a nice read more link on excerpts
-function new_excerpt_more($more) {
+if ( ! function_exists( 'twentyten_excerpt_more' ) ) :
+function twentyten_excerpt_more($more) {
 	return '&nbsp;&hellip; <a href="'. get_permalink() . '">' . 'Continue&nbsp;reading&nbsp;<span class="meta-nav">&rarr;</span>' . '</a>';
 }
-add_filter('excerpt_more', 'new_excerpt_more');
+endif;
+add_filter( 'excerpt_more', 'twentyten_excerpt_more' );
 
 
 // Template for comments and pingbacks
-function twentyten_comment($comment, $args, $depth) {
+if ( ! function_exists( 'twentyten_comment' ) ) :
+function twentyten_comment( $comment, $args, $depth ) {
 	$GLOBALS ['comment'] = $comment; ?>
-	<?php if ('' == $comment->comment_type) { ?>
-	<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
+	<?php if ( '' == $comment->comment_type ) : ?>
+	<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, 40); ?>
+			<?php echo get_avatar( $comment, 40 ); ?>
 
-			<?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
+			<?php printf( __( '<cite class="fn">%s</cite> <span class="says">says:</span>' ), get_comment_author_link() ); ?>
 		</div>
-		<?php if ($comment->comment_approved == '0') : ?>
-			<em><?php _e('Your comment is awaiting moderation.') ?></em>
+		<?php if ( $comment->comment_approved == '0' ) : ?>
+			<em><?php _e( 'Your comment is awaiting moderation.' ); ?></em>
 			<br />
 		<?php endif; ?>
 
-		<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-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>
+		<div class="comment-body"><?php comment_text(); ?></div>
 
 		<div class="reply">
-			<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
+			<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
 		</div>
 	</div>
 
-	<?php } else { ?>
+	<?php else : ?>
 	<li class="post pingback">
-		<p><?php _e('Pingback:') ?> <?php comment_author_link ()?><?php edit_comment_link ( 'edit', '&nbsp;&nbsp;', '' ); ?></p>
-	<?php }
+		<p><?php _e( 'Pingback:' ); ?> <?php comment_author_link (); ?><?php edit_comment_link( 'edit', '&nbsp;&nbsp;', '' ); ?></p>
+	<?php endif;
 }
+endif;
 
 // Make the Visual Editor styles match the theme's styles
-function my_editor_style($url) {
-	if ( !empty($url) )
+if ( ! function_exists( 'twentyten_editor_style' ) ) :
+function twentyten_editor_style( $url ) {
+	if ( ! empty( $url ) )
 		$url .= ',';
 
 	// Change the path here if using sub-directory
@@ -107,55 +134,63 @@
 
 	return $url;
 }
-add_filter('mce_css', 'my_editor_style');
+endif;
+add_filter( 'mce_css', 'twentyten_editor_style' );
 
 // Remove inline styles on gallery shortcode
-function remove_gallery_css() {
-	return "<div class='gallery'>";
+if ( ! function_exists( 'twentyten_remove_gallery_css' ) ) :
+function twentyten_remove_gallery_css() {
+	return "\t\t<div class='gallery'>\n\t\t";
 }
-add_filter('gallery_style', 'remove_gallery_css');
+endif;
+add_filter( 'gallery_style', 'twentyten_remove_gallery_css' );
 
 // For category lists on category archives: Returns other categories except the current one (redundant)
-function cats_meow($glue) {
+if ( ! function_exists( 'twentyten_cats_meow' ) ) :
+function twentyten_cats_meow( $glue ) {
 	$current_cat = single_cat_title( '', false );
 	$separator = "\n";
-	$cats = explode( $separator, get_the_category_list($separator) );
+	$cats = explode( $separator, get_the_category_list( $separator ) );
 	foreach ( $cats as $i => $str ) {
 		if ( strstr( $str, ">$current_cat<" ) ) {
-			unset($cats[$i]);
+			unset( $cats[$i] );
 			break;
 		}
 	}
-	if ( empty($cats) )
+	if ( empty( $cats ) )
 		return false;
 
-	return trim(join( $glue, $cats ));
-} // end cats_meow
+	return trim( join( $glue, $cats ) );
+}
+endif;
 
 // For tag lists on tag archives: Returns other tags except the current one (redundant)
-function tag_ur_it($glue) {
+if ( ! function_exists( 'twentyten_tag_ur_it' ) ) :
+function twentyten_tag_ur_it( $glue ) {
 	$current_tag = single_tag_title( '', '',  false );
 	$separator = "\n";
 	$tags = explode( $separator, get_the_tag_list( "", "$separator", "" ) );
 	foreach ( $tags as $i => $str ) {
 		if ( strstr( $str, ">$current_tag<" ) ) {
-			unset($tags[$i]);
+			unset( $tags[$i] );
 			break;
 		}
 	}
-	if ( empty($tags) )
+	if ( empty( $tags ) )
 		return false;
 
-	return trim(join( $glue, $tags ));
-} // end tag_ur_it
+	return trim( join( $glue, $tags ) );
+}
+endif;
 
 // Register widgetized areas
-function theme_widgets_init() {
+if ( ! function_exists( 'twentyten_widgets_init' ) ) :
+function twentyten_widgets_init() {
 	// Area 1
 	register_sidebar( array (
 		'name' => 'Primary Widget Area',
 		'id' => 'primary-widget-area',
-		'description' => __('The primary widget area' , 'twentyten'),
+		'description' => __( 'The primary widget area' , 'twentyten' ),
 		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
 		'after_widget' => "</li>",
 		'before_title' => '<h3 class="widget-title">',
@@ -166,7 +201,7 @@
 	register_sidebar( array (
 		'name' => 'Secondary Widget Area',
 		'id' => 'secondary-widget-area',
-		'description' => __('The secondary widget area' , 'twentyten'),
+		'description' => __( 'The secondary widget area' , 'twentyten' ),
 		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
 		'after_widget' => "</li>",
 		'before_title' => '<h3 class="widget-title">',
@@ -177,7 +212,7 @@
 	register_sidebar( array (
 		'name' => 'First Footer Widget Area',
 		'id' => 'first-footer-widget-area',
-		'description' => __('The first footer widget area' , 'twentyten'),
+		'description' => __( 'The first footer widget area' , 'twentyten' ),
 		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
 		'after_widget' => "</li>",
 		'before_title' => '<h3 class="widget-title">',
@@ -188,7 +223,7 @@
 	register_sidebar( array (
 		'name' => 'Second Footer Widget Area',
 		'id' => 'second-footer-widget-area',
-		'description' => __('The second footer widget area' , 'twentyten'),
+		'description' => __( 'The second footer widget area' , 'twentyten' ),
 		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
 		'after_widget' => "</li>",
 		'before_title' => '<h3 class="widget-title">',
@@ -199,7 +234,7 @@
 	register_sidebar( array (
 		'name' => 'Third Footer Widget Area',
 		'id' => 'third-footer-widget-area',
-		'description' => __('The third footer widget area' , 'twentyten'),
+		'description' => __( 'The third footer widget area' , 'twentyten' ),
 		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
 		'after_widget' => "</li>",
 		'before_title' => '<h3 class="widget-title">',
@@ -210,14 +245,13 @@
 	register_sidebar( array (
 		'name' => 'Fourth Footer Widget Area',
 		'id' => 'fourth-footer-widget-area',
-		'description' => __('The fourth footer widget area' , 'twentyten'),
+		'description' => __( 'The fourth footer widget area' , 'twentyten' ),
 		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
 		'after_widget' => "</li>",
 		'before_title' => '<h3 class="widget-title">',
 		'after_title' => '</h3>',
 	) );
 
-} // end theme_widgets_init
-
-// Add all the groovy widget areas
-add_action( 'init', 'theme_widgets_init' );
\ No newline at end of file
+}
+endif;
+add_action( 'init', 'twentyten_widgets_init' );
Index: wp-content/themes/twentyten/tag.php
===================================================================
--- wp-content/themes/twentyten/tag.php	(revision 13127)
+++ wp-content/themes/twentyten/tag.php	(working copy)
@@ -35,7 +35,7 @@
 					<div class="entry-utility">
 						<span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'twentyten' ); ?></span><?php echo get_the_category_list(', '); ?></span>
 						<span class="meta-sep"> | </span>
-<?php if ( $tag_ur_it = tag_ur_it(', ') ) : // Returns tags other than the one queried ?>
+<?php if ( $tag_ur_it = twentyten_tag_ur_it(', ') ) : // Returns tags other than the one queried ?>
 						<span class="tag-links"><?php printf( __( 'Also tagged %s', 'twentyten' ), $tag_ur_it ) ?></span>
 <?php endif; ?>
 						<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ) ?></span>
@@ -56,4 +56,4 @@
 		</div><!-- #container -->
 
 <?php get_sidebar(); ?>
-<?php get_footer(); ?>
\ No newline at end of file
+<?php get_footer(); ?>
Index: wp-content/themes/twentyten/category.php
===================================================================
--- wp-content/themes/twentyten/category.php	(revision 13127)
+++ wp-content/themes/twentyten/category.php	(working copy)
@@ -36,7 +36,7 @@
 					</div><!-- .entry-summary -->
 
 					<div class="entry-utility">
-<?php if ( $cats_meow = cats_meow(', ') ) : // Returns categories other than the one queried ?>
+<?php if ( $cats_meow = twentyten_cats_meow(', ') ) : // Returns categories other than the one queried ?>
 						<span class="cat-links"><?php printf( __( 'Also posted in %s', 'twentyten' ), $cats_meow ) ?></span>
 						<span class="meta-sep"> | </span>
 <?php endif ?>
@@ -59,4 +59,4 @@
 		</div><!-- #container -->
 
 <?php get_sidebar(); ?>
-<?php get_footer(); ?>
\ No newline at end of file
+<?php get_footer(); ?>
Index: wp-content/themes/twentyten/header.php
===================================================================
--- wp-content/themes/twentyten/header.php	(revision 13127)
+++ wp-content/themes/twentyten/header.php	(working copy)
@@ -5,15 +5,15 @@
         if ( is_single() ) {
 			single_post_title(); echo ' | '; bloginfo('name');
 		} elseif ( is_home() || is_front_page() ) {
-			bloginfo('name'); echo ' | '; bloginfo('description'); get_page_number();
+			bloginfo('name'); echo ' | '; bloginfo('description'); the_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'); 
+			printf(__('Search results for "%s"', 'twentyten'), esc_html($s)); the_page_number(); echo ' | '; bloginfo('name'); 
 		} elseif ( is_404() ) {
 			_e('Not Found', 'twentyten'); echo ' | '; bloginfo('name');
 		} else {
-			wp_title(''); echo ' | '; bloginfo('name'); get_page_number();
+			wp_title(''); echo ' | '; bloginfo('name'); the_page_number();
 		}
     ?></title>
 
Index: wp-content/themes/twentyten/attachment.php
===================================================================
--- wp-content/themes/twentyten/attachment.php	(revision 13127)
+++ wp-content/themes/twentyten/attachment.php	(working copy)
@@ -5,13 +5,13 @@
 
 <?php the_post(); ?>
 
-				<p class="page-title"><a href="<?php echo get_permalink($post->post_parent) ?>" title="<?php printf( esc_attr__( 'Return to %s', 'twentyten' ), esc_html( get_the_title($post->post_parent), 1 ) ) ?>" rel="gallery">&larr; <?php echo get_the_title($post->post_parent) ?></a></p>
+				<p class="page-title"><a href="<?php echo get_permalink( $post->post_parent ) ?>" title="<?php printf( esc_attr__( 'Return to %s', 'twentyten' ), esc_html( get_the_title( $post->post_parent ), 1 ) ) ?>" rel="gallery">&larr; <?php echo get_the_title( $post->post_parent ) ?></a></p>
 
 				<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
 					<h2 class="entry-title"><?php the_title(); ?></h2>
 
 					<div class="entry-meta">
-						<span class="meta-prep meta-prep-author"><?php _e('By ', 'twentyten'); ?></span>
+						<span class="meta-prep meta-prep-author"><?php _e( 'By ', 'twentyten' ); ?></span>
 						<span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( $authordata->ID, $authordata->user_nicename ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), $authordata->display_name ); ?>"><?php the_author(); ?></a></span>
 						<span class="meta-sep"> | </span>
 						<span class="meta-prep meta-prep-entry-date"><?php _e('Published ', 'twentyten'); ?></span>
@@ -22,8 +22,8 @@
 					<div class="entry-content">
 						<div class="entry-attachment">
 <?php if ( wp_attachment_is_image( $post->ID ) ) : ?>
-						<p class="attachment"><a href="<?php echo wp_get_attachment_url($post->ID); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
-							echo wp_get_attachment_image( $post->ID, array($content_width, $content_width) ); // max $content_width wide or high.
+						<p class="attachment"><a href="<?php echo wp_get_attachment_url( $post->ID ); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
+							echo wp_get_attachment_image( $post->ID, array( twentyten_content_width(), twentyten_content_width() ) ); // max $content_width wide or high.
 						?></a></p>
 
 
@@ -32,13 +32,13 @@
 					<div class="nav-next"><?php next_image_link( false ); ?></div>
 				</div><!-- #nav-below -->
 <?php else : ?>
-						<a href="<?php echo wp_get_attachment_url($post->ID) ?>" title="<?php echo esc_attr( get_the_title($post->ID) ); ?>" rel="attachment"><?php echo basename(get_permalink()) ?></a>
+						<a href="<?php echo wp_get_attachment_url( $post->ID ) ?>" title="<?php echo esc_attr( get_the_title( $post->ID ) ); ?>" rel="attachment"><?php echo basename( get_permalink() ) ?></a>
 <?php endif; ?>
 						</div>
-						<div class="entry-caption"><?php if ( !empty($post->post_excerpt) ) the_excerpt() ?></div>
+						<div class="entry-caption"><?php if ( ! empty( $post->post_excerpt ) ) the_excerpt() ?></div>
 
 <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' )  ); ?>
-<?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'twentyten' ) . '&after=</div>') ?>
+<?php wp_link_pages( 'before=<div class="page-link">' . __( 'Pages:', 'twentyten' ) . '&after=</div>' ) ?>
 
 					</div><!-- .entry-content -->
 
@@ -69,4 +69,4 @@
 		</div><!-- #container -->
 
 <?php get_sidebar(); ?>
-<?php get_footer(); ?>
\ No newline at end of file
+<?php get_footer(); ?>
