Skip to content

Commit f16ea9f

Browse files
authored
Merge pull request #328 from szepeviktor/master
Fix Travis builds
2 parents 7b5176d + da4b74a commit f16ea9f

File tree

2 files changed

+39
-27
lines changed

2 files changed

+39
-27
lines changed

.travis.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: php
2+
dist: trusty
23

34
notifications:
45
email:
@@ -10,24 +11,31 @@ branches:
1011
- master
1112

1213
php:
13-
- 5.3
1414
- 5.6
1515
- 7.0
16+
- nightly
1617

1718
env:
1819
- WP_VERSION=latest WP_MULTISITE=0
20+
- WP_VERSION=latest WP_MULTISITE=1
1921

2022
matrix:
2123
include:
22-
- php: 5.3
24+
- dist: precise
25+
php: 5.3
26+
env: WP_VERSION=latest WP_MULTISITE=0
27+
- dist: precise
28+
php: 5.3
2329
env: WP_VERSION=latest WP_MULTISITE=1
30+
allow_failures:
31+
- php: nightly
2432

2533
before_script:
26-
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
34+
- bash bin/install-wp-tests.sh wordpress_test root "" localhost $WP_VERSION
2735
- export PATH="$HOME/.composer/vendor/bin:$PATH"
2836
- |
29-
if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.0" ]]; then
30-
composer global require "phpunit/phpunit=5.6.*"
37+
if [[ ${TRAVIS_PHP_VERSION:0:1} == "7" ]]; then
38+
composer global require "phpunit/phpunit=^5.6"
3139
else
3240
composer global require "phpunit/phpunit=4.8.*"
3341
fi
@@ -36,5 +44,9 @@ before_script:
3644
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
3745
3846
script:
39-
- phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php')
47+
- phpcs --standard=phpcs.ruleset.xml $(find -name "*.php")
4048
- phpunit
49+
50+
cache:
51+
directories:
52+
- $HOME/.composer/cache

wp-bootstrap-navwalker.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class WP_Bootstrap_Navwalker extends Walker_Nav_Menu {
4141
* @return void
4242
*/
4343
public function start_lvl( &$output, $depth = 0, $args = array() ) {
44-
$indent = str_repeat( "\t", $depth );
44+
$indent = str_repeat( "\t", $depth );
4545
$output .= "\n$indent<ul role=\"menu\" class=\" dropdown-menu\" >\n";
4646
}
4747

@@ -79,10 +79,10 @@ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0
7979
} elseif ( 0 === strcasecmp( $item->attr_title, 'disabled' ) ) {
8080
$output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr( $item->title ) . '</a>';
8181
} else {
82-
$value = '';
82+
$value = '';
8383
$class_names = $value;
84-
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
85-
$classes[] = 'menu-item-' . $item->ID;
84+
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
85+
$classes[] = 'menu-item-' . $item->ID;
8686
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
8787
if ( $args->has_children ) {
8888
$class_names .= ' dropdown';
@@ -91,33 +91,33 @@ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0
9191
$class_names .= ' active';
9292
}
9393
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
94-
$id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args );
95-
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
96-
$output .= $indent . '<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement"' . $id . $value . $class_names . '>';
97-
$atts = array();
94+
$id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args );
95+
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
96+
$output .= $indent . '<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement"' . $id . $value . $class_names . '>';
97+
$atts = array();
9898

9999
if ( empty( $item->attr_title ) ) {
100-
$atts['title'] = ! empty( $item->title ) ? strip_tags( $item->title ) : '';
100+
$atts['title'] = ! empty( $item->title ) ? strip_tags( $item->title ) : '';
101101
} else {
102102
$atts['title'] = $item->attr_title;
103103
}
104104

105105
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
106-
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
106+
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
107107
// If item has_children add atts to a.
108108
if ( $args->has_children && 0 === $depth ) {
109-
$atts['href'] = '#';
110-
$atts['data-toggle'] = 'dropdown';
111-
$atts['class'] = 'dropdown-toggle';
112-
$atts['aria-haspopup'] = 'true';
109+
$atts['href'] = '#';
110+
$atts['data-toggle'] = 'dropdown';
111+
$atts['class'] = 'dropdown-toggle';
112+
$atts['aria-haspopup'] = 'true';
113113
} else {
114114
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
115115
}
116-
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );
116+
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );
117117
$attributes = '';
118118
foreach ( $atts as $attr => $value ) {
119119
if ( ! empty( $value ) ) {
120-
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
120+
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
121121
$attributes .= ' ' . $attr . '="' . $value . '"';
122122
}
123123
}
@@ -143,7 +143,7 @@ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0
143143
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
144144
$item_output .= ( $args->has_children && 0 === $depth ) ? ' <span class="caret"></span></a>' : '</a>';
145145
$item_output .= $args->after;
146-
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
146+
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
147147
} // End if().
148148
}
149149

@@ -192,11 +192,11 @@ public static function fallback( $args ) {
192192
if ( current_user_can( 'edit_theme_options' ) ) {
193193

194194
/* Get Arguments. */
195-
$container = $args['container'];
196-
$container_id = $args['container_id'];
195+
$container = $args['container'];
196+
$container_id = $args['container_id'];
197197
$container_class = $args['container_class'];
198-
$menu_class = $args['menu_class'];
199-
$menu_id = $args['menu_id'];
198+
$menu_class = $args['menu_class'];
199+
$menu_id = $args['menu_id'];
200200

201201
if ( $container ) {
202202
echo '<' . esc_attr( $container );

0 commit comments

Comments
 (0)