From 6bdfc319f0d169cce63909ce827ae47b46f4049e Mon Sep 17 00:00:00 2001 From: Eric Rihlmann Date: Tue, 14 Mar 2017 18:46:11 -0400 Subject: [PATCH 1/3] Fix Travis CI Build Errors Errors are from recent updates to WordPress Coding Standards. Majority of the errors are related to missing translation comments for placeholders such as '%s'. --- 404.php | 10 +- comments.php | 33 ++++- functions.php | 8 +- library/class-foundationpress-comments.php | 116 +++++++++++++++++ .../class-foundationpress-mobile-walker.php | 20 +++ ...npress-protocol-relative-theme-assets.php} | 0 .../class-foundationpress-top-bar-walker.php | 20 +++ library/entry-meta.php | 1 + library/foundation.php | 122 ++---------------- library/menu-walkers.php | 30 ----- library/responsive-images.php | 16 ++- page-templates/front.php | 9 +- page-templates/page-full-width.php | 9 +- page-templates/page-sidebar-left.php | 9 +- page.php | 11 +- single.php | 9 +- template-parts/content-none.php | 10 +- woocommerce.php | 9 +- 18 files changed, 283 insertions(+), 159 deletions(-) create mode 100644 library/class-foundationpress-comments.php create mode 100644 library/class-foundationpress-mobile-walker.php rename library/{protocol-relative-theme-assets.php => class-foundationpress-protocol-relative-theme-assets.php} (100%) create mode 100644 library/class-foundationpress-top-bar-walker.php delete mode 100644 library/menu-walkers.php diff --git a/404.php b/404.php index fe3cbde8c..e9a57f941 100644 --- a/404.php +++ b/404.php @@ -22,7 +22,15 @@

diff --git a/comments.php b/comments.php index 6d0436b2d..e2dc2c606 100644 --- a/comments.php +++ b/comments.php @@ -51,7 +51,7 @@ Prevent access to this file directly */ - defined( 'ABSPATH' ) or die( __( 'Please do not load this page directly. Thanks!', 'foundationpress' ) ); + defined( 'ABSPATH' ) || die( __( 'Please do not load this page directly. Thanks!', 'foundationpress' ) ); if ( post_password_required() ) { ?>
@@ -69,14 +69,39 @@ if ( (is_page() || is_single()) && ( ! is_home() && ! is_front_page()) ) : ?>
-

+

+ +

-

logged in to post a comment.', 'foundationpress' ), wp_login_url( get_permalink() ) ); ?>

+

+ logged in to post a comment.', 'foundationpress' ), + wp_login_url( get_permalink() ) + ); + ?> +

-

%2$s.', 'foundationpress' ), get_option( 'siteurl' ), $user_identity ); ?>

+

+ %2$s.', 'foundationpress' ), + get_option( 'siteurl' ), + $user_identity + ); + ?> +

+
    + + + +
      + + +
    + + + +
  1. id="comment-"> +
    + + + +
    + + + +
    + + %s', 'foundationpress' ), + get_comment_author_link() + ); + ?> + + +
    + +
    + +
    + comment_approved ) : ?> +
    +

    +
    + + +
    + + + +
    + $depth, + 'max_depth' => $args['max_depth'], + ); + + comment_reply_link( array_merge( $args, $reply_args ) ); ?> +
    +
    + + + +
  2. + + + +
+ + \n"; + } + } +endif; diff --git a/library/protocol-relative-theme-assets.php b/library/class-foundationpress-protocol-relative-theme-assets.php similarity index 100% rename from library/protocol-relative-theme-assets.php rename to library/class-foundationpress-protocol-relative-theme-assets.php diff --git a/library/class-foundationpress-top-bar-walker.php b/library/class-foundationpress-top-bar-walker.php new file mode 100644 index 000000000..1d8b6cd8b --- /dev/null +++ b/library/class-foundationpress-top-bar-walker.php @@ -0,0 +1,20 @@ +\n"; + } + } +endif; diff --git a/library/entry-meta.php b/library/entry-meta.php index 4f451f785..cc4c8cdb7 100644 --- a/library/entry-meta.php +++ b/library/entry-meta.php @@ -8,6 +8,7 @@ if ( ! function_exists( 'foundationpress_entry_meta' ) ) : function foundationpress_entry_meta() { + /* translators: %1$s: current date, %2$s: current time */ echo ''; echo ''; } diff --git a/library/foundation.php b/library/foundation.php index 015ffbfd7..f7229b883 100644 --- a/library/foundation.php +++ b/library/foundation.php @@ -49,16 +49,18 @@ function foundationpress_pagination() { if ( ! function_exists( 'foundationpress_menu_fallback' ) ) : function foundationpress_menu_fallback() { echo '
'; - // Translators 1: Link to Menus, 2: Link to Customize. - printf( __( 'Please assign a menu to the primary menu location under %1$s or %2$s the design.', 'foundationpress' ), - sprintf( __( 'Menus', 'foundationpress' ), - get_admin_url( get_current_blog_id(), 'nav-menus.php' ) - ), - sprintf( __( 'Customize', 'foundationpress' ), - get_admin_url( get_current_blog_id(), 'customize.php' ) - ) - ); - echo '
'; + // translators %1$s: link to menus, %2$s: link to customize. + printf( __( 'Please assign a menu to the primary menu location under %1$s or %2$s the design.', 'foundationpress' ), + /* translators: %s: menu url */ + sprintf( __( 'Menus', 'foundationpress' ), + get_admin_url( get_current_blog_id(), 'nav-menus.php' ) + ), + /* translators: %s: customize url */ + sprintf( __( 'Customize', 'foundationpress' ), + get_admin_url( get_current_blog_id(), 'customize.php' ) + ) + ); + echo ''; } endif; @@ -90,103 +92,3 @@ function foundationpress_active_list_pages_class( $input ) { add_filter( 'wp_list_pages', 'foundationpress_active_list_pages_class', 10, 2 ); endif; -if ( ! class_exists( 'Foundationpress_Comments' ) ) : -class Foundationpress_Comments extends Walker_Comment { - - // Init classwide variables. - var $tree_type = 'comment'; - - // Comment ID - var $db_fields = array( 'parent' => 'comment_parent', 'id' => 'comment_ID' ); - - /** CONSTRUCTOR - * You'll have to use this if you plan to get to the top of the comments list, as - * start_lvl() only goes as high as 1 deep nested comments */ - function __construct() { ?> - -

-
    - - - -
      - - -
    - - - -
  1. id="comment-"> -
    - - - -
    - - - -
    - - %s', 'foundationpress' ), get_comment_author_link() ) ?> - - -
    - -
    - -
    - comment_approved ) : ?> -
    -

    -
    - - -
    - - - -
    - $depth, - 'max_depth' => $args['max_depth'], - ); - - comment_reply_link( array_merge( $args, $reply_args ) ); ?> -
    -
    - - - -
  2. - - - -
- - \n"; - } - } - - - if ( ! class_exists( 'Foundationpress_Mobile_Walker' ) ) : - class Foundationpress_Mobile_Walker extends Walker_Nav_Menu { - function start_lvl( &$output, $depth = 0, $args = array() ) { - $indent = str_repeat("\t", $depth); - $output .= "\n$indent
    \n"; - } - } - endif; - -endif; diff --git a/library/responsive-images.php b/library/responsive-images.php index cb87a596d..223a7328a 100644 --- a/library/responsive-images.php +++ b/library/responsive-images.php @@ -41,13 +41,21 @@ function foundationpress_adjust_image_sizes_attr( $sizes, $size ) { // Full width page template if ( is_page_template( 'page-templates/page-full-width.php' ) ) { - 1200 < $width && $sizes = '(max-width: 1199px) 98vw, 1200px'; - 1200 > $width && $sizes = '(max-width: 1199px) 98vw, ' . $width . 'px'; + if ( 1200 < $width ) { + $sizes = '(max-width: 1199px) 98vw, 1200px'; + } + if ( 1200 > $width ) { + $sizes = '(max-width: 1199px) 98vw, ' . $width . 'px'; + } // Default 3/4 column post/page layout } else { - 770 < $width && $sizes = '(max-width: 639px) 98vw, (max-width: 1199px) 64vw, 770px'; - 770 > $width && $sizes = '(max-width: 639px) 98vw, (max-width: 1199px) 64vw, ' . $width . 'px'; + if ( 770 < $width ) { + $sizes = '(max-width: 639px) 98vw, (max-width: 1199px) 64vw, 770px'; + } + if ( 770 > $width ) { + $sizes = '(max-width: 639px) 98vw, (max-width: 1199px) 64vw, ' . $width . 'px'; + } } return $sizes; diff --git a/page-templates/front.php b/page-templates/front.php index 5ccb8ac0b..bd9a34417 100644 --- a/page-templates/front.php +++ b/page-templates/front.php @@ -35,7 +35,14 @@
    - '' ) ); ?> + '', + ) + ); + ?>

    diff --git a/page-templates/page-full-width.php b/page-templates/page-full-width.php index cb7f4391b..8e44165e6 100644 --- a/page-templates/page-full-width.php +++ b/page-templates/page-full-width.php @@ -19,7 +19,14 @@
    - '' ) ); ?> + '', + ) + ); + ?>

    diff --git a/page-templates/page-sidebar-left.php b/page-templates/page-sidebar-left.php index 740e8ef11..ef7b50af8 100644 --- a/page-templates/page-sidebar-left.php +++ b/page-templates/page-sidebar-left.php @@ -19,7 +19,14 @@
    - '' ) ); ?> + '', + ) + ); + ?>

    diff --git a/page.php b/page.php index 84e0c2310..b3f8a6d9d 100644 --- a/page.php +++ b/page.php @@ -28,8 +28,15 @@ ', '' ); ?>
    - '' ) ); ?> -

    + '', + ) + ); + ?> +

    diff --git a/single.php b/single.php index e3935607a..90a9f06e7 100644 --- a/single.php +++ b/single.php @@ -25,7 +25,14 @@ ', '' ); ?>
    - '' ) ); ?> + '', + ) + ); + ?>

    diff --git a/template-parts/content-none.php b/template-parts/content-none.php index 89e944265..b540d7a99 100644 --- a/template-parts/content-none.php +++ b/template-parts/content-none.php @@ -17,7 +17,15 @@
    -

    Get started here.', 'foundationpress' ), admin_url( 'post-new.php' ) ); ?>

    +

    + Get started here.', 'foundationpress' ), + admin_url( 'post-new.php' ) + ); + ?> +

    diff --git a/woocommerce.php b/woocommerce.php index 75a3b38bb..88a0366fe 100644 --- a/woocommerce.php +++ b/woocommerce.php @@ -23,7 +23,14 @@
    - '' ) ); ?> + '', + ) + ); + ?>

    From 7940a162ebe0ca483ec9703b5d180729a7e2356e Mon Sep 17 00:00:00 2001 From: Eric Rihlmann Date: Tue, 14 Mar 2017 19:25:39 -0400 Subject: [PATCH 2/3] Fixed More Travis CI Build Errors --- library/class-foundationpress-comments.php | 4 ++-- library/foundation.php | 2 +- library/responsive-images.php | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/library/class-foundationpress-comments.php b/library/class-foundationpress-comments.php index 4b883c85e..ad0f796e7 100644 --- a/library/class-foundationpress-comments.php +++ b/library/class-foundationpress-comments.php @@ -9,10 +9,10 @@ class Foundationpress_Comments extends Walker_Comment { // Init classwide variables. - var $tree_type = 'comment'; + public $tree_type = 'comment'; // Comment ID - var $db_fields = array( + public $db_fields = array( 'parent' => 'comment_parent', 'id' => 'comment_ID', ); diff --git a/library/foundation.php b/library/foundation.php index f7229b883..1a0cf14cf 100644 --- a/library/foundation.php +++ b/library/foundation.php @@ -49,7 +49,7 @@ function foundationpress_pagination() { if ( ! function_exists( 'foundationpress_menu_fallback' ) ) : function foundationpress_menu_fallback() { echo '
    '; - // translators %1$s: link to menus, %2$s: link to customize. + /* translators: %1$s: link to menus, %2$s: link to customize. */ printf( __( 'Please assign a menu to the primary menu location under %1$s or %2$s the design.', 'foundationpress' ), /* translators: %s: menu url */ sprintf( __( 'Menus', 'foundationpress' ), diff --git a/library/responsive-images.php b/library/responsive-images.php index 223a7328a..788e2fcc6 100644 --- a/library/responsive-images.php +++ b/library/responsive-images.php @@ -47,7 +47,6 @@ function foundationpress_adjust_image_sizes_attr( $sizes, $size ) { if ( 1200 > $width ) { $sizes = '(max-width: 1199px) 98vw, ' . $width . 'px'; } - // Default 3/4 column post/page layout } else { if ( 770 < $width ) { From 1169293dd90c0d4c63d3ea6b0a4230733b0a123a Mon Sep 17 00:00:00 2001 From: Eric Rihlmann Date: Tue, 14 Mar 2017 19:51:41 -0400 Subject: [PATCH 3/3] One More Travis Fix --- library/responsive-images.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/library/responsive-images.php b/library/responsive-images.php index 788e2fcc6..323ef93ee 100644 --- a/library/responsive-images.php +++ b/library/responsive-images.php @@ -43,16 +43,13 @@ function foundationpress_adjust_image_sizes_attr( $sizes, $size ) { if ( is_page_template( 'page-templates/page-full-width.php' ) ) { if ( 1200 < $width ) { $sizes = '(max-width: 1199px) 98vw, 1200px'; - } - if ( 1200 > $width ) { + } else { $sizes = '(max-width: 1199px) 98vw, ' . $width . 'px'; } - // Default 3/4 column post/page layout - } else { + } else { // Default 3/4 column post/page layout if ( 770 < $width ) { $sizes = '(max-width: 639px) 98vw, (max-width: 1199px) 64vw, 770px'; - } - if ( 770 > $width ) { + } else { $sizes = '(max-width: 639px) 98vw, (max-width: 1199px) 64vw, ' . $width . 'px'; } }