From c4f2aa32ce18db79e6b9cd1d01d1894fedd90d5e Mon Sep 17 00:00:00 2001 From: obenland Date: Mon, 4 Mar 2013 16:41:38 -0800 Subject: [PATCH] _s: Formatting changes: - Reduce element comments to either the element id or the first element class. - Tabs > Spaces. - Improve adherence to formatting guidelines. --- 404.php | 4 +- archive.php | 128 ++++++++++++------------ comments.php | 4 +- content-page.php | 2 +- content-single.php | 2 +- content.php | 2 +- footer.php | 6 +- functions.php | 14 +-- header.php | 4 +- image.php | 198 +++++++++++++++++++------------------- inc/wpcom.php | 8 +- index.php | 38 ++++---- js/skip-link-focus-fix.js | 40 ++++---- page.php | 24 ++--- search.php | 32 +++--- sidebar.php | 44 ++++----- single.php | 26 ++--- style.css | 32 +++--- 18 files changed, 301 insertions(+), 307 deletions(-) diff --git a/404.php b/404.php index ab124bd1..cfee157e 100644 --- a/404.php +++ b/404.php @@ -41,7 +41,7 @@ get_header(); ?> - - + + \ No newline at end of file diff --git a/archive.php b/archive.php index deabc698..79120d07 100644 --- a/archive.php +++ b/archive.php @@ -10,86 +10,86 @@ get_header(); ?> -
-
+
+
- + -
' ); + printf( __( 'Category Archives: %s', '_s' ), '' . single_cat_title( '', false ) . '' ); } elseif ( is_tag() ) { - // show an optional tag description - $tag_description = tag_description(); - if ( ! empty( $tag_description ) ) - echo apply_filters( 'tag_archive_meta', '
' . $tag_description . '
' ); + printf( __( 'Tag Archives: %s', '_s' ), '' . single_tag_title( '', false ) . '' ); + + } elseif ( is_author() ) { + /* Queue the first post, that way we know + * what author we're dealing with (if that is the case). + */ + the_post(); + printf( __( 'Author Archives: %s', '_s' ), '' . get_the_author() . '' ); + /* Since we called the_post() above, we need to + * rewind the loop back to the beginning that way + * we can run the loop properly, in full. + */ + rewind_posts(); + + } elseif ( is_day() ) { + printf( __( 'Daily Archives: %s', '_s' ), '' . get_the_date() . '' ); + + } elseif ( is_month() ) { + printf( __( 'Monthly Archives: %s', '_s' ), '' . get_the_date( 'F Y' ) . '' ); + + } elseif ( is_year() ) { + printf( __( 'Yearly Archives: %s', '_s' ), '' . get_the_date( 'Y' ) . '' ); + + } else { + _e( 'Archives', '_s' ); + } ?> - + + ' . $category_description . '
' ); - - + } elseif ( is_tag() ) { + // show an optional tag description + $tag_description = tag_description(); + if ( ! empty( $tag_description ) ) + echo apply_filters( 'tag_archive_meta', '
' . $tag_description . '
' ); + } + ?> + - + + - + - + - + - + - + - -
+ + + + \ No newline at end of file diff --git a/comments.php b/comments.php index d7b6b08f..aec4d54b 100644 --- a/comments.php +++ b/comments.php @@ -52,7 +52,7 @@ */ wp_list_comments( array( 'callback' => '_s_comment' ) ); ?> - + 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?> - + +
diff --git a/image.php b/image.php index 4b6e8f45..6889594c 100644 --- a/image.php +++ b/image.php @@ -9,115 +9,115 @@ get_header(); ?> -
-
+
+
- + -
> -
-

+
> +
+

-
+ +
+ +
+
at %4$s × %5$s in %8$s', '_s' ), - esc_attr( get_the_date( 'c' ) ), - esc_html( get_the_date() ), - wp_get_attachment_url(), - $metadata['width'], - $metadata['height'], - get_permalink( $post->post_parent ), - esc_attr( get_the_title( $post->post_parent ) ), - get_the_title( $post->post_parent ) - ); + /** + * Grab the IDs of all the image attachments in a gallery so we can get the URL of the next adjacent image in a gallery, + * or the first image (if we're looking at the last image in a gallery), or, in a gallery of one, just the link to that image file + */ + $attachments = array_values( get_children( array( + 'post_parent' => $post->post_parent, + 'post_status' => 'inherit', + 'post_type' => 'attachment', + 'post_mime_type' => 'image', + 'order' => 'ASC', + 'orderby' => 'menu_order ID' + ) ) ); + foreach ( $attachments as $k => $attachment ) { + if ( $attachment->ID == $post->ID ) + break; + } + $k++; + // If there is more than 1 attachment in a gallery + if ( count( $attachments ) > 1 ) { + if ( isset( $attachments[ $k ] ) ) + // get the URL of the next image attachment + $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID ); + else + // or get the URL of the first image attachment + $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID ); + } else { + // or, if there's only 1 image, get the URL of the image + $next_attachment_url = wp_get_attachment_url(); + } ?> - | ', '' ); ?> -
- -
+ ID, $attachment_size ); + ?> +
-
- -
-
- $post->post_parent, - 'post_status' => 'inherit', - 'post_type' => 'attachment', - 'post_mime_type' => 'image', - 'order' => 'ASC', - 'orderby' => 'menu_order ID' - ) ) ); - foreach ( $attachments as $k => $attachment ) { - if ( $attachment->ID == $post->ID ) - break; - } - $k++; - // If there is more than 1 attachment in a gallery - if ( count( $attachments ) > 1 ) { - if ( isset( $attachments[ $k ] ) ) - // get the URL of the next image attachment - $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID ); - else - // or get the URL of the first image attachment - $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID ); - } else { - // or, if there's only 1 image, get the URL of the image - $next_attachment_url = wp_get_attachment_url(); - } - ?> - - ID, $attachment_size ); - ?> -
- - post_excerpt ) ) : ?> -
- -
- -
- - - '' ) ); ?> - -
- -
- - Post a comment or leave a trackback: Trackback URL.', '_s' ), get_trackback_url() ); ?> - - Trackback URL.', '_s' ), get_trackback_url() ); ?> - - post a comment.', '_s' ); ?> - - + post_excerpt ) ) : ?> +
+ +
- ', '' ); ?> -
- +
- + + '' ) ); ?> - +
-
-
+ + + + + + + + + \ No newline at end of file diff --git a/inc/wpcom.php b/inc/wpcom.php index d90dbb64..010f7309 100644 --- a/inc/wpcom.php +++ b/inc/wpcom.php @@ -15,9 +15,9 @@ global $themecolors; * @since _s 1.0 */ $themecolors = array( - 'bg' => '', + 'bg' => '', 'border' => '', - 'text' => '', - 'link' => '', - 'url' => '', + 'text' => '', + 'link' => '', + 'url' => '', ); diff --git a/index.php b/index.php index e6e94568..51901e9d 100644 --- a/index.php +++ b/index.php @@ -14,34 +14,34 @@ get_header(); ?> -
-
+
+
- + - - + + - + - + - + - + - + - + -
-
+
+
\ No newline at end of file diff --git a/js/skip-link-focus-fix.js b/js/skip-link-focus-fix.js index 7b11cd9b..47bc65cd 100644 --- a/js/skip-link-focus-fix.js +++ b/js/skip-link-focus-fix.js @@ -1,25 +1,19 @@ ( function() { -var is_webkit = navigator.userAgent.toLowerCase().indexOf('webkit') > -1; -var is_opera = navigator.userAgent.toLowerCase().indexOf('opera') > -1; -var is_ie = navigator.userAgent.toLowerCase().indexOf('msie') > -1; - -if((is_webkit || is_opera || is_ie ) && typeof(document.getElementById) !== 'undefined' ) { - var eventMethod = (window.addEventListener) ? 'addEventListener' : 'attachEvent' ; - window[eventMethod]("hashchange", function(event) { - - var element = document.getElementById(location.hash.substring(1)); - - if (element) { - - if (!/^(?:a|select|input|button|textarea)$/i.test(element.tagName)) { - element.tabIndex = -1; - } - - element.focus(); - } - - }, false); - -} - + var is_webkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1, + is_opera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1, + is_ie = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1; + + if ( ( is_webkit || is_opera || is_ie ) && 'undefined' !== typeof( document.getElementById ) ) { + var eventMethod = ( window.addEventListener ) ? 'addEventListener' : 'attachEvent'; + window[ eventMethod ]( 'hashchange', function() { + var element = document.getElementById( location.hash.substring( 1 ) ); + + if ( element ) { + if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) + element.tabIndex = -1; + + element.focus(); + } + }, false ); + } })(); diff --git a/page.php b/page.php index 075a0985..38577393 100644 --- a/page.php +++ b/page.php @@ -13,23 +13,23 @@ get_header(); ?> -
-
+
+
- + - + - + - + -
-
+
+
diff --git a/search.php b/search.php index 23f9440b..9ef4da48 100644 --- a/search.php +++ b/search.php @@ -8,32 +8,32 @@ get_header(); ?> -
-
+
+
- + - + - - + + - + - + - + - + - + - + -
-
+
+
\ No newline at end of file diff --git a/sidebar.php b/sidebar.php index 28df898f..2ccb0b75 100644 --- a/sidebar.php +++ b/sidebar.php @@ -6,29 +6,29 @@ * @since _s 1.0 */ ?> - diff --git a/single.php b/single.php index 44d20a1f..924d2ae3 100644 --- a/single.php +++ b/single.php @@ -8,25 +8,25 @@ get_header(); ?> -
-
+
+
- + - + - + - + - + -
-
+
+
\ No newline at end of file diff --git a/style.css b/style.css index d64c4710..87681821 100644 --- a/style.css +++ b/style.css @@ -227,26 +227,26 @@ input[type="submit"] { border-color: #ccc #ccc #bbb #ccc; border-radius: 3px; background: #e6e6e6; - -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), inset 0 15px 17px rgba(255,255,255,0.5), inset 0 -5px 12px rgba(0,0,0,0.05); - -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), inset 0 15px 17px rgba(255,255,255,0.5), inset 0 -5px 12px rgba(0,0,0,0.05); - box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), inset 0 15px 17px rgba(255,255,255,0.5), inset 0 -5px 12px rgba(0,0,0,0.05); - color: rgba(0,0,0,.8); + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 15px 17px rgba(255, 255, 255, 0.5), inset 0 -5px 12px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 15px 17px rgba(255, 255, 255, 0.5), inset 0 -5px 12px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 15px 17px rgba(255, 255, 255, 0.5), inset 0 -5px 12px rgba(0, 0, 0, 0.05); + color: rgba(0, 0, 0, .8); cursor: pointer; /* Improves usability and consistency of cursor style between image-type 'input' and others */ -webkit-appearance: button; /* Corrects inability to style clickable 'input' types in iOS */ font-size: 12px; font-size: 1.2rem; line-height: 1; padding: .6em 1em .4em; - text-shadow: 0 1px 0 rgba(255,255,255,.8); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8); } button:hover, html input[type="button"]:hover, input[type="reset"]:hover, input[type="submit"]:hover { border-color: #ccc #bbb #aaa #bbb; - -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), inset 0 15px 17px rgba(255,255,255,0.8), inset 0 -5px 12px rgba(0,0,0,0.02); - -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), inset 0 15px 17px rgba(255,255,255,0.8), inset 0 -5px 12px rgba(0,0,0,0.02); - box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), inset 0 15px 17px rgba(255,255,255,0.8), inset 0 -5px 12px rgba(0,0,0,0.02); + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), inset 0 15px 17px rgba(255, 255, 255, 0.8), inset 0 -5px 12px rgba(0, 0, 0, 0.02); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), inset 0 15px 17px rgba(255, 255, 255, 0.8), inset 0 -5px 12px rgba(0, 0, 0, 0.02); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), inset 0 15px 17px rgba(255, 255, 255, 0.8), inset 0 -5px 12px rgba(0, 0, 0, 0.02); } button:focus, html input[type="button"]:focus, @@ -257,9 +257,9 @@ html input[type="button"]:active, input[type="reset"]:active, input[type="submit"]:active { border-color: #aaa #bbb #bbb #bbb; - -webkit-box-shadow: inset 0 -1px 0 rgba(255,255,255,0.5), inset 0 2px 5px rgba(0,0,0,0.15); - -moz-box-shadow: inset 0 -1px 0 rgba(255,255,255,0.5), inset 0 2px 5px rgba(0,0,0,0.15); - box-shadow: inset 0 -1px 0 rgba(255,255,255,0.5), inset 0 2px 5px rgba(0,0,0,0.15); + -webkit-box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.5), inset 0 2px 5px rgba(0, 0, 0, 0.15); + -moz-box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.5), inset 0 2px 5px rgba(0, 0, 0, 0.15); + box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.5), inset 0 2px 5px rgba(0, 0, 0, 0.15); } input[type="checkbox"], input[type="radio"] { @@ -268,9 +268,9 @@ input[type="radio"] { } input[type="search"] { -webkit-appearance: textfield; /* Addresses appearance set to searchfield in S5, Chrome */ - -moz-box-sizing: content-box; -webkit-box-sizing: content-box; /* Addresses box sizing set to border-box in S5, Chrome (include -moz to future-proof) */ - box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; } input[type="search"]::-webkit-search-decoration { /* Corrects inner padding displayed oddly in S5, Chrome on OSX */ -webkit-appearance: none; @@ -370,9 +370,9 @@ a:active { text-decoration: none; } .navigation-main ul ul { - -moz-box-shadow: 0 3px 3px rgba(0,0,0,0.2); - -webkit-box-shadow: 0 3px 3px rgba(0,0,0,0.2); - box-shadow: 0 3px 3px rgba(0,0,0,0.2); + -webkit-box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2); + box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2); display: none; float: left; position: absolute;