<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[14541] trunk/wp-content/themes/twentyten: Clean up loop i18n.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/14541">14541</a></dd>
<dt>Author</dt> <dd>nbachiyski</dd>
<dt>Date</dt> <dd>2010-05-10 19:06:22 +0000 (Mon, 10 May 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Clean up loop i18n. Props zeo, see <a href="http://trac.wordpress.org/ticket/13198">#13198</a>
* Take out tags from strings
* Extract two common and complicatd strings into functions
* Whitespace</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpcontentthemestwentytenattachmentphp">trunk/wp-content/themes/twentyten/attachment.php</a></li>
<li><a href="#trunkwpcontentthemestwentytenfunctionsphp">trunk/wp-content/themes/twentyten/functions.php</a></li>
<li><a href="#trunkwpcontentthemestwentytenloopphp">trunk/wp-content/themes/twentyten/loop.php</a></li>
<li><a href="#trunkwpcontentthemestwentytensinglephp">trunk/wp-content/themes/twentyten/single.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpcontentthemestwentytenattachmentphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-content/themes/twentyten/attachment.php (14540 => 14541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-content/themes/twentyten/attachment.php 2010-05-10 16:06:46 UTC (rev 14540)
+++ trunk/wp-content/themes/twentyten/attachment.php 2010-05-10 19:06:22 UTC (rev 14541)
</span><span class="lines">@@ -80,23 +80,8 @@
</span><span class="cx"> </div><!-- .entry-content -->
</span><span class="cx">
</span><span class="cx"> <div class="entry-utility">
</span><del>- <?php
- $tag_list = get_the_tag_list();
- if ( $tag_list ) {
- $utility_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
- } else {
- $utility_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
- }
- printf(
- $utility_text,
- get_the_category_list( ', ' ),
- $tag_list,
- get_permalink(),
- the_title_attribute( 'echo=0' ),
- get_post_comments_feed_link()
- );
- ?>
-<?php edit_post_link( __( 'Edit', 'twentyten' ), ' <span class="edit-link">', '</span>' ); ?>
</del><ins>+ <?php echo twentyten_posted_in(); ?>
+ <?php edit_post_link( __( 'Edit', 'twentyten' ), ' <span class="edit-link">', '</span>' ); ?>
</ins><span class="cx"> </div><!-- .entry-utility -->
</span><span class="cx"> </div><!-- #post-<?php the_ID(); ?> -->
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpcontentthemestwentytenfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-content/themes/twentyten/functions.php (14540 => 14541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-content/themes/twentyten/functions.php 2010-05-10 16:06:46 UTC (rev 14540)
+++ trunk/wp-content/themes/twentyten/functions.php 2010-05-10 19:06:22 UTC (rev 14541)
</span><span class="lines">@@ -410,4 +410,45 @@
</span><span class="cx"> return get_attachment_link( $attachments[ $k ]->ID );
</span><span class="cx"> else
</span><span class="cx"> return get_permalink( $post->post_parent );
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
+
+/**
+ * Returns HTML with meta information for the current post—date/time and author.
+ */
+function twentyten_posted_on() {
+ return sprintf( __( '<span %1$s>Posted on</span> %2$s by %3$s', 'twentyten' ),
+ 'class="meta-prep meta-prep-author"',
+ sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a> <span class="meta-sep">',
+ get_permalink(),
+ esc_attr( get_the_time() ),
+ get_the_date()
+ ),
+ sprintf( '</span> <span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
+ get_author_posts_url( get_the_author_meta( 'ID' ) ),
+ sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
+ get_the_author()
+ )
+ );
+
+}
+
+/**
+ * Returns HTML with meta information for the current post—category, tags and permalink
+ */
+
+function twentyten_posted_in() {
+ $tag_list = get_the_tag_list();
+ if ( $tag_list ) {
+ $utility_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
+ } else {
+ $utility_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
+ }
+ return sprintf(
+ $utility_text,
+ get_the_category_list( ', ' ),
+ $tag_list,
+ get_permalink(),
+ the_title_attribute( 'echo=0' ),
+ get_post_comments_feed_link()
+ );
+}
</ins></span></pre></div>
<a id="trunkwpcontentthemestwentytenloopphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-content/themes/twentyten/loop.php (14540 => 14541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-content/themes/twentyten/loop.php 2010-05-10 16:06:46 UTC (rev 14540)
+++ trunk/wp-content/themes/twentyten/loop.php 2010-05-10 19:06:22 UTC (rev 14541)
</span><span class="lines">@@ -41,26 +41,18 @@
</span><span class="cx"> <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
</span><span class="cx">
</span><span class="cx"> <div class="entry-meta">
</span><del>- <?php
- printf( __( '<span class="meta-prep meta-prep-author">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a> <span class="meta-sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s">%6$s</a></span>', 'twentyten' ),
- get_permalink(),
- esc_attr( get_the_time() ),
- get_the_date(),
- get_author_posts_url( get_the_author_meta( 'ID' ) ),
- sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
- get_the_author()
- );
- ?>
</del><ins>+ <?php echo twentyten_posted_on(); ?>
</ins><span class="cx"> </div><!-- .entry-meta -->
</span><span class="cx">
</span><span class="cx"> <div class="entry-content">
</span><span class="cx"> <div class="gallery-thumb">
</span><del>- <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php
- $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
- $total_images = count( $images );
- $image = array_shift( $images );
- echo wp_get_attachment_image( $image->ID, 'thumbnail' );
- ?></a>
</del><ins>+<?php
+ $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
+ $total_images = count( $images );
+ $image = array_shift( $images );
+ $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
+?>
+ <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
</ins><span class="cx"> </div>
</span><span class="cx"> <p><em><?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.', 'twentyten' ),
</span><span class="cx"> 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
</span><span class="lines">@@ -72,7 +64,7 @@
</span><span class="cx">
</span><span class="cx"> <div class="entry-utility">
</span><span class="cx"> <a href="<?php echo get_term_link( _x('gallery', 'gallery category slug', 'twentyten'), 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a>
</span><del>- <span class="meta-sep"> | </span>
</del><ins>+ <span class="meta-sep">|</span>
</ins><span class="cx"> <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
</span><span class="cx"> <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
</span><span class="cx"> </div><!-- #entry-utility -->
</span><span class="lines">@@ -92,17 +84,8 @@
</span><span class="cx"> <?php endif; ?>
</span><span class="cx">
</span><span class="cx"> <div class="entry-utility">
</span><del>- <?php
- printf( __( '<span class="meta-prep meta-prep-author">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a> <span class="meta-sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s">%6$s</a></span>', 'twentyten' ),
- get_permalink(),
- esc_attr( get_the_time() ),
- get_the_date(),
- get_author_posts_url( get_the_author_meta( 'ID' ) ),
- sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
- get_the_author()
- );
- ?>
- <span class="meta-sep"> | </span>
</del><ins>+ <?php echo twentyten_posted_on(); ?>
+ <span class="meta-sep">|</span>
</ins><span class="cx"> <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
</span><span class="cx"> <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
</span><span class="cx"> </div><!-- #entry-utility -->
</span><span class="lines">@@ -114,16 +97,7 @@
</span><span class="cx"> <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
</span><span class="cx">
</span><span class="cx"> <div class="entry-meta">
</span><del>- <?php
- printf( __( '<span class="meta-prep meta-prep-author">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a> <span class="meta-sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s">%6$s</a></span>', 'twentyten' ),
- get_permalink(),
- esc_attr( get_the_time() ),
- get_the_date(),
- get_author_posts_url( get_the_author_meta( 'ID' ) ),
- sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
- get_the_author()
- );
- ?>
</del><ins>+ <?php echo twentyten_posted_on(); ?>
</ins><span class="cx"> </div><!-- .entry-meta -->
</span><span class="cx">
</span><span class="cx"> <?php if ( is_archive() || is_search() ) : // Only display Excerpts for archives & search ?>
</span><span class="lines">@@ -138,9 +112,14 @@
</span><span class="cx"> <?php endif; ?>
</span><span class="cx">
</span><span class="cx"> <div class="entry-utility">
</span><del>- <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'twentyten' ); ?></span><?php the_category( ', ' ); ?></span>
- <span class="meta-sep"> | </span>
- <?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __( 'Tagged ', 'twentyten' ) . '</span>', ', ', '<span class="meta-sep"> | </span>' ); ?>
</del><ins>+ <span class="cat-links">
+ <span class="entry-utility-prep entry-utility-prep-cat-links">
+ <?php
+ printf( __('Posted in %s', 'twentyten' ), '</span> '.get_the_category_list( ', ' ) );
+ ?>
+ </span>
+ <span class="meta-sep">|</span>
+ <?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __( 'Tagged ', 'twentyten' ) . '</span>', ', ', '<span class="meta-sep">|</span>' ); ?>
</ins><span class="cx"> <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
</span><span class="cx"> <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
</span><span class="cx"> </div><!-- #entry-utility -->
</span></span></pre></div>
<a id="trunkwpcontentthemestwentytensinglephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-content/themes/twentyten/single.php (14540 => 14541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-content/themes/twentyten/single.php 2010-05-10 16:06:46 UTC (rev 14540)
+++ trunk/wp-content/themes/twentyten/single.php 2010-05-10 19:06:22 UTC (rev 14541)
</span><span class="lines">@@ -24,10 +24,7 @@
</span><span class="cx"> <h1 class="entry-title"><?php the_title(); ?></h1>
</span><span class="cx">
</span><span class="cx"> <div class="entry-meta">
</span><del>- <span class="meta-prep meta-prep-author"><?php _e( 'Posted on ', 'twentyten' ); ?></span>
- <a href="<?php the_permalink(); ?>" title="<?php the_time(); ?>" rel="bookmark"><span class="entry-date"><?php echo get_the_date(); ?></span></a>
- <span class="meta-sep"><?php _e( ' by ', 'twentyten' ); ?></span>
- <span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ); ?>"><?php the_author(); ?></a></span>
</del><ins>+ <?php echo twentyten_posted_on(); ?>
</ins><span class="cx"> </div><!-- .entry-meta -->
</span><span class="cx">
</span><span class="cx"> <div class="entry-content">
</span><span class="lines">@@ -51,23 +48,8 @@
</span><span class="cx"> <?php endif; ?>
</span><span class="cx">
</span><span class="cx"> <div class="entry-utility">
</span><del>- <?php
- $tag_list = get_the_tag_list('', ', ');
- if ( '' != $tag_list ) {
- $utility_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
- } else {
- $utility_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
- }
- printf(
- $utility_text,
- get_the_category_list( ', ' ),
- $tag_list,
- get_permalink(),
- the_title_attribute( 'echo=0' )
- );
- ?>
-
-<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
</del><ins>+ <?php echo twentyten_posted_in(); ?>
+ <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
</ins><span class="cx"> </div><!-- .entry-utility -->
</span><span class="cx"> </div><!-- #post-<?php the_ID(); ?> -->
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>