Skip to content

Commit 11e3e90

Browse files
authored
Merge pull request #347 from pattonwebz/v4-dev
Update to 4.0.2
2 parents 6620271 + 815eefe commit 11e3e90

File tree

5 files changed

+345
-35
lines changed

5 files changed

+345
-35
lines changed

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ branches:
1313
php:
1414
- 5.6
1515
- 7.0
16+
- 7.1
17+
- 7.2
1618
- nightly
1719

1820
env:
@@ -24,9 +26,6 @@ matrix:
2426
- dist: precise
2527
php: 5.3
2628
env: WP_VERSION=latest WP_MULTISITE=0
27-
- dist: precise
28-
php: 5.3
29-
env: WP_VERSION=latest WP_MULTISITE=1
3029
allow_failures:
3130
- php: nightly
3231

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
#CHANGELOG
2+
## [4.0.2]
3+
- Fix dropdown opener having empty string for href value.
4+
- More accurate regex matching of icon and linkmod classnames.
5+
- Changed composer package type to `library` from `wordpress-plugin` again.
6+
- Tests: Add unit tests for the function that separates classnames for the walker.
7+
- Fix case sensitive matching to now match mixes of upper and lower case.
28

39
## [4.0.1]
410
- Fix untranslated string in fallback (this was lost in transition between v3 and v4, fixed again).

class-wp-bootstrap-navwalker.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Plugin URI: https://github.com/wp-bootstrap/wp-bootstrap-navwalker
1212
* Description: A custom WordPress nav walker class to implement the Bootstrap 4 navigation style in a custom theme using the WordPress built in menu manager.
1313
* Author: Edward McIntyre - @twittem, WP Bootstrap, William Patton - @pattonwebz
14-
* Version: 4.0.1
14+
* Version: 4.0.2
1515
* Author URI: https://github.com/wp-bootstrap
1616
* GitHub Plugin URI: https://github.com/wp-bootstrap/wp-bootstrap-navwalker
1717
* GitHub Branch: master
@@ -189,7 +189,7 @@ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0
189189
$atts['class'] = 'dropdown-toggle nav-link';
190190
$atts['id'] = 'menu-item-dropdown-' . $item->ID;
191191
} else {
192-
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
192+
$atts['href'] = ! empty( $item->url ) ? $item->url : '#';
193193
// Items in dropdowns use .dropdown-item instead of .nav-link.
194194
if ( $depth > 0 ) {
195195
$atts['class'] = 'dropdown-item';
@@ -377,7 +377,7 @@ public static function fallback( $args ) {
377377
} else {
378378
return $fallback_output;
379379
}
380-
} // End if().
380+
}
381381
}
382382

383383
/**
@@ -403,20 +403,20 @@ private function seporate_linkmods_and_icons_from_classes( $classes, &$linkmod_c
403403
foreach ( $classes as $key => $class ) {
404404
// If any special classes are found, store the class in it's
405405
// holder array and and unset the item from $classes.
406-
if ( preg_match( '/disabled|sr-only/', $class ) ) {
406+
if ( preg_match( '/^disabled|^sr-only/i', $class ) ) {
407407
// Test for .disabled or .sr-only classes.
408408
$linkmod_classes[] = $class;
409409
unset( $classes[ $key ] );
410-
} elseif ( preg_match( '/dropdown-header|dropdown-divider/', $class ) && $depth > 0 ) {
410+
} elseif ( preg_match( '/^dropdown-header|^dropdown-divider/i', $class ) && $depth > 0 ) {
411411
// Test for .dropdown-header or .dropdown-divider and a
412412
// depth greater than 0 - IE inside a dropdown.
413413
$linkmod_classes[] = $class;
414414
unset( $classes[ $key ] );
415-
} elseif ( preg_match( '/fa-(\S*)?|fas(\s?)|far(\s?)|fal(\s?)|fab(\s?)|fa(\s?)/', $class ) ) {
415+
} elseif ( preg_match( '/^fa-(\S*)?|^fa(s|r|l|b)?(\s?)?$/i', $class ) ) {
416416
// Font Awesome.
417417
$icon_classes[] = $class;
418418
unset( $classes[ $key ] );
419-
} elseif ( preg_match( '/glyphicons-(\S*)?|glyphicons(\s?)/', $class ) ) {
419+
} elseif ( preg_match( '/^glyphicon-(\S*)?|^glyphicon(\s?)$/i', $class ) ) {
420420
// Glyphicons.
421421
$icon_classes[] = $class;
422422
unset( $classes[ $key ] );
@@ -550,4 +550,4 @@ private function linkmod_element_close( $linkmod_type ) {
550550
return $output;
551551
}
552552
}
553-
} // End if().
553+
}

composer.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
{
22
"name": "wp-bootstrap/wp-bootstrap-navwalker",
33
"description": "A custom WordPress nav walker class to fully implement the Bootstrap 4 navigation style in a custom theme using the WordPress built in menu manager.",
4-
"type": "wordpress-plugin",
4+
"type": "library",
55
"license": "GPL-3.0+",
66
"authors": [
77
{
88
"name": "Brandon Hubbard"
99
},
10-
{
11-
"name": "William Patton",
12-
"email": "[email protected]"
13-
}
10+
{
11+
"name": "William Patton",
12+
"email": "[email protected]"
13+
}
1414
],
1515
"support": {
1616
"issues": "https://github.com/wp-bootstrap/wp-bootstrap-navwalker/issues/",
1717
"source": "https://github.com/wp-bootstrap/wp-bootstrap-navwalker/"
1818
},
19+
"autoload": {
20+
"files": ["class-wp-bootstrap-navwalker.php"]
21+
},
1922
"require": {
2023
"composer/installers": "~1.0"
2124
},

0 commit comments

Comments
 (0)