diff --git a/src/wp-content/themes/twentyfourteen/comments.php b/src/wp-content/themes/twentyfourteen/comments.php index f2036d20a4..9802a2440a 100644 --- a/src/wp-content/themes/twentyfourteen/comments.php +++ b/src/wp-content/themes/twentyfourteen/comments.php @@ -13,8 +13,9 @@ * If the current post is protected by a password and the visitor has not yet * entered the password we will return early without loading the comments. */ -if ( post_password_required() ) +if ( post_password_required() ) { return; +} ?>
diff --git a/src/wp-content/themes/twentyfourteen/content-featured-post.php b/src/wp-content/themes/twentyfourteen/content-featured-post.php index b838b33208..8de189281c 100644 --- a/src/wp-content/themes/twentyfourteen/content-featured-post.php +++ b/src/wp-content/themes/twentyfourteen/content-featured-post.php @@ -12,10 +12,11 @@ diff --git a/src/wp-content/themes/twentyfourteen/functions.php b/src/wp-content/themes/twentyfourteen/functions.php index 4929be16db..1c7e73d966 100644 --- a/src/wp-content/themes/twentyfourteen/functions.php +++ b/src/wp-content/themes/twentyfourteen/functions.php @@ -31,14 +31,16 @@ * * @since Twenty Fourteen 1.0 */ -if ( ! isset( $content_width ) ) +if ( ! isset( $content_width ) ) { $content_width = 474; +} /** * Twenty Fourteen only works in WordPress 3.6 or later. */ -if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) +if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) { require get_template_directory() . '/inc/back-compat.php'; +} if ( ! function_exists( 'twentyfourteen_setup' ) ) : /** @@ -122,8 +124,9 @@ add_action( 'after_setup_theme', 'twentyfourteen_setup' ); * @return void */ function twentyfourteen_content_width() { - if ( is_attachment() && wp_attachment_is_image() ) + if ( is_attachment() && wp_attachment_is_image() ) { $GLOBALS['content_width'] = 810; + } } add_action( 'template_redirect', 'twentyfourteen_content_width' ); @@ -203,8 +206,9 @@ function twentyfourteen_font_url() { * Translators: If there are characters in your language that are not supported * by Lato, translate this to 'off'. Do not translate into your own language. */ - if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) + if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) { $font_url = add_query_arg( 'family', urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ), "//fonts.googleapis.com/css" ); + } return $font_url; } @@ -230,14 +234,17 @@ function twentyfourteen_scripts() { wp_enqueue_style( 'twentyfourteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfourteen-style' ), '20131110' ); wp_style_add_data( 'twentyfourteen-ie', 'conditional', 'lt IE 9' ); - if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) + if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); + } - if ( is_singular() && wp_attachment_is_image() ) + if ( is_singular() && wp_attachment_is_image() ) { wp_enqueue_script( 'twentyfourteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20130402' ); + } - if ( is_active_sidebar( 'sidebar-3' ) ) + if ( is_active_sidebar( 'sidebar-3' ) ) { wp_enqueue_script( 'jquery-masonry' ); + } if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) { wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131109', true ); @@ -303,12 +310,14 @@ function twentyfourteen_the_attached_image() { } // get the URL of the next image attachment... - if ( $next_id ) + if ( $next_id ) { $next_attachment_url = get_attachment_link( $next_id ); + } // or get the URL of the first image attachment. - else + else { $next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) ); + } } printf( '%2$s', @@ -337,8 +346,9 @@ function twentyfourteen_list_authors() { $post_count = count_user_posts( $contributor_id ); // Move on if user has not published a post (yet). - if ( ! $post_count ) + if ( ! $post_count ) { continue; + } ?>
@@ -379,33 +389,40 @@ endif; * @return array The filtered body class list. */ function twentyfourteen_body_classes( $classes ) { - if ( is_multi_author() ) + if ( is_multi_author() ) { $classes[] = 'group-blog'; + } - if ( get_header_image() ) + if ( get_header_image() ) { $classes[] = 'header-image'; - else + } else { $classes[] = 'masthead-fixed'; + } - if ( is_archive() || is_search() || is_home() ) + if ( is_archive() || is_search() || is_home() ) { $classes[] = 'list-view'; + } if ( ( ! is_active_sidebar( 'sidebar-2' ) ) || is_page_template( 'page-templates/full-width.php' ) || is_page_template( 'page-templates/contributors.php' ) - || is_attachment() ) + || is_attachment() ) { $classes[] = 'full-width'; + } - if ( is_active_sidebar( 'sidebar-3' ) ) + if ( is_active_sidebar( 'sidebar-3' ) ) { $classes[] = 'footer-widgets'; + } - if ( is_singular() && ! is_front_page() ) + if ( is_singular() && ! is_front_page() ) { $classes[] = 'singular'; + } - if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) + if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) { $classes[] = 'slider'; - elseif ( is_front_page() ) + } elseif ( is_front_page() ) { $classes[] = 'grid'; + } return $classes; } @@ -423,8 +440,9 @@ add_filter( 'body_class', 'twentyfourteen_body_classes' ); * @return array The filtered post class list. */ function twentyfourteen_post_classes( $classes ) { - if ( ! post_password_required() && has_post_thumbnail() ) + if ( ! post_password_required() && has_post_thumbnail() ) { $classes[] = 'has-post-thumbnail'; + } return $classes; } @@ -443,20 +461,23 @@ add_filter( 'post_class', 'twentyfourteen_post_classes' ); function twentyfourteen_wp_title( $title, $sep ) { global $paged, $page; - if ( is_feed() ) + if ( is_feed() ) { return $title; + } // Add the site name. $title .= get_bloginfo( 'name' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); - if ( $site_description && ( is_home() || is_front_page() ) ) + if ( $site_description && ( is_home() || is_front_page() ) ) { $title = "$title $sep $site_description"; + } // Add a page number if necessary. - if ( $paged >= 2 || $page >= 2 ) + if ( $paged >= 2 || $page >= 2 ) { $title = "$title $sep " . sprintf( __( 'Page %s', 'twentyfourteen' ), max( $paged, $page ) ); + } return $title; } @@ -477,5 +498,6 @@ require get_template_directory() . '/inc/customizer.php'; * To overwrite in a plugin, define your own Featured_Content class on or * before the 'setup_theme' hook. */ -if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) +if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) { require get_template_directory() . '/inc/featured-content.php'; +} diff --git a/src/wp-content/themes/twentyfourteen/inc/customizer.php b/src/wp-content/themes/twentyfourteen/inc/customizer.php index d63e83a0e8..3a35d94c63 100644 --- a/src/wp-content/themes/twentyfourteen/inc/customizer.php +++ b/src/wp-content/themes/twentyfourteen/inc/customizer.php @@ -97,10 +97,11 @@ function twentyfourteen_adjust_color( $color, $steps ) { $hex = '#'; foreach ( $rgb as $value ) { $value += $steps; - if ( $value > 255 ) + if ( $value > 255 ) { $value = 255; - elseif ( $value < 0 ) + } elseif ( $value < 0 ) { $value = 0; + } $hex .= str_pad( dechex( $value ), 2, '0', STR_PAD_LEFT); } @@ -154,8 +155,9 @@ function twentyfourteen_customizer_styles() { $accent_color = get_theme_mod( 'accent_color', '#24890d' ); // Don't do anything if the current color is the default. - if ( '#24890d' === $accent_color ) + if ( '#24890d' === $accent_color ) { return; + } $accent_mid = get_theme_mod( 'accent_mid' ); $accent_light = get_theme_mod( 'accent_light' ); diff --git a/src/wp-content/themes/twentyfourteen/inc/featured-content.php b/src/wp-content/themes/twentyfourteen/inc/featured-content.php index bb1f692748..a85b66ff17 100644 --- a/src/wp-content/themes/twentyfourteen/inc/featured-content.php +++ b/src/wp-content/themes/twentyfourteen/inc/featured-content.php @@ -46,25 +46,29 @@ class Featured_Content { $theme_support = get_theme_support( 'featured-content' ); // Return early if theme does not support Featured Content. - if ( ! $theme_support ) + if ( ! $theme_support ) { return; + } /* * An array of named arguments must be passed as the second parameter * of add_theme_support(). */ - if ( ! isset( $theme_support[0] ) ) + if ( ! isset( $theme_support[0] ) ) { return; + } // Return early if "featured_content_filter" has not been defined. - if ( ! isset( $theme_support[0]['featured_content_filter'] ) ) + if ( ! isset( $theme_support[0]['featured_content_filter'] ) ) { return; + } $filter = $theme_support[0]['featured_content_filter']; // Theme can override the number of max posts. - if ( isset( $theme_support[0]['max_posts'] ) ) + if ( isset( $theme_support[0]['max_posts'] ) ) { self::$max_posts = absint( $theme_support[0]['max_posts'] ); + } add_filter( $filter, array( __CLASS__, 'get_featured_posts' ) ); add_action( 'customize_register', array( __CLASS__, 'customize_register' ), 9 ); @@ -100,8 +104,9 @@ class Featured_Content { $post_ids = self::get_featured_post_ids(); // No need to query if there is are no featured posts. - if ( empty( $post_ids ) ) + if ( empty( $post_ids ) ) { return array(); + } $featured_posts = get_posts( array( 'include' => $post_ids, @@ -124,17 +129,19 @@ class Featured_Content { public static function get_featured_post_ids() { // Return array of cached results if they exist. $featured_ids = get_transient( 'featured_content_ids' ); - if ( ! empty( $featured_ids ) ) + if ( ! empty( $featured_ids ) ) { return array_map( 'absint', (array) $featured_ids ); + } $settings = self::get_setting(); // Return sticky post ids if no tag name is set. $term = get_term_by( 'name', $settings['tag-name'], 'post_tag' ); - if ( $term ) + if ( $term ) { $tag = $term->term_id; - else + } else { return self::get_sticky_posts(); + } // Query for featured posts. $featured = get_posts( array( @@ -149,8 +156,9 @@ class Featured_Content { ) ); // Return array with sticky posts if no Featured Content exists. - if ( ! $featured ) + if ( ! $featured ) { return self::get_sticky_posts(); + } // Ensure correct format before save/return. $featured_ids = wp_list_pluck( (array) $featured, 'ID' ); @@ -195,20 +203,23 @@ class Featured_Content { public static function pre_get_posts( $query ) { // Bail if not home or not main query. - if ( ! $query->is_home() || ! $query->is_main_query() ) + if ( ! $query->is_home() || ! $query->is_main_query() ) { return; + } $page_on_front = get_option( 'page_on_front' ); // Bail if the blog page is not the front page. - if ( ! empty( $page_on_front ) ) + if ( ! empty( $page_on_front ) ) { return; + } $featured = self::get_featured_post_ids(); // Bail if no featured posts. - if ( ! $featured ) + if ( ! $featured ) { return; + } // We need to respect post ids already in the blacklist. $post__not_in = $query->get( 'post__not_in' ); @@ -237,8 +248,9 @@ class Featured_Content { public static function delete_post_tag( $tag_id ) { $settings = self::get_setting(); - if ( empty( $settings['tag-id'] ) || $tag_id != $settings['tag-id'] ) + if ( empty( $settings['tag-id'] ) || $tag_id != $settings['tag-id'] ) { return; + } $settings['tag-id'] = 0; $settings = self::validate_settings( $settings ); @@ -259,20 +271,24 @@ class Featured_Content { public static function hide_featured_term( $terms, $taxonomies ) { // This filter is only appropriate on the front-end. - if ( is_admin() ) + if ( is_admin() ) { return $terms; + } // We only want to hide the featured tag. - if ( ! in_array( 'post_tag', $taxonomies ) ) + if ( ! in_array( 'post_tag', $taxonomies ) ) { return $terms; + } // Bail if no terms were returned. - if ( empty( $terms ) ) + if ( empty( $terms ) ) { return $terms; + } foreach( $terms as $order => $term ) { - if ( self::get_setting( 'tag-id' ) == $term->term_id && 'post_tag' == $term->taxonomy ) + if ( self::get_setting( 'tag-id' ) == $term->term_id && 'post_tag' == $term->taxonomy ) { unset( $terms[ $order ] ); + } } return $terms; @@ -293,20 +309,24 @@ class Featured_Content { public static function hide_the_featured_term( $terms, $id, $taxonomy ) { // This filter is only appropriate on the front-end. - if ( is_admin() ) + if ( is_admin() ) { return $terms; + } // Make sure we are in the correct taxonomy. - if ( 'post_tag' != $taxonomy ) + if ( 'post_tag' != $taxonomy ) { return $terms; + } // No terms? Return early! - if ( empty( $terms ) ) + if ( empty( $terms ) ) { return $terms; + } foreach( $terms as $order => $term ) { - if ( self::get_setting( 'tag-id' ) == $term->term_id ) + if ( self::get_setting( 'tag-id' ) == $term->term_id ) { unset( $terms[ $term->term_id ] ); + } } return $terms; @@ -401,8 +421,9 @@ class Featured_Content { $options = array_intersect_key( $options, $defaults ); $options['quantity'] = self::sanitize_quantity( $options['quantity'] ); - if ( 'all' != $key ) + if ( 'all' != $key ) { return isset( $options[ $key ] ) ? $options[ $key ] : false; + } return $options; } @@ -437,8 +458,9 @@ class Featured_Content { $output['tag-name'] = $input['tag-name']; } - if ( isset( $input['quantity'] ) ) + if ( isset( $input['quantity'] ) ) { $output['quantity'] = self::sanitize_quantity( $input['quantity'] ); + } $output['hide-tag'] = isset( $input['hide-tag'] ) && $input['hide-tag'] ? 1 : 0; @@ -458,10 +480,11 @@ class Featured_Content { public static function sanitize_quantity( $input ) { $quantity = absint( $input ); - if ( $quantity > self::$max_posts ) + if ( $quantity > self::$max_posts ) { $quantity = self::$max_posts; - else if ( 1 > $quantity ) + } else if ( 1 > $quantity ) { $quantity = 1; + } return $quantity; } diff --git a/src/wp-content/themes/twentyfourteen/inc/template-tags.php b/src/wp-content/themes/twentyfourteen/inc/template-tags.php index 22845a3306..48fdbd1a89 100644 --- a/src/wp-content/themes/twentyfourteen/inc/template-tags.php +++ b/src/wp-content/themes/twentyfourteen/inc/template-tags.php @@ -17,16 +17,18 @@ if ( ! function_exists( 'twentyfourteen_paging_nav' ) ) : */ function twentyfourteen_paging_nav() { // Don't print empty markup if there's only one page. - if ( $GLOBALS['wp_query']->max_num_pages < 2 ) + if ( $GLOBALS['wp_query']->max_num_pages < 2 ) { return; + } $paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1; $pagenum_link = html_entity_decode( get_pagenum_link() ); $query_args = array(); $url_parts = explode( '?', $pagenum_link ); - if ( isset( $url_parts[1] ) ) + if ( isset( $url_parts[1] ) ) { wp_parse_str( $url_parts[1], $query_args ); + } $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link ); $pagenum_link = trailingslashit( $pagenum_link ) . '%_%'; @@ -72,8 +74,9 @@ function twentyfourteen_post_nav() { $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); - if ( ! $next && ! $previous ) + if ( ! $next && ! $previous ) { return; + } ?>