Skip to content

Commit

Permalink
Merge pull request #347 from pattonwebz/v4-dev
Browse files Browse the repository at this point in the history
Update to 4.0.2
  • Loading branch information
pattonwebz committed Feb 25, 2018
2 parents 6620271 + 815eefe commit 11e3e90
Show file tree
Hide file tree
Showing 5 changed files with 345 additions and 35 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ branches:
php:
- 5.6
- 7.0
- 7.1
- 7.2
- nightly

env:
Expand All @@ -24,9 +26,6 @@ matrix:
- dist: precise
php: 5.3
env: WP_VERSION=latest WP_MULTISITE=0
- dist: precise
php: 5.3
env: WP_VERSION=latest WP_MULTISITE=1
allow_failures:
- php: nightly

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

## [4.0.1]
- Fix untranslated string in fallback (this was lost in transition between v3 and v4, fixed again).
Expand Down
16 changes: 8 additions & 8 deletions class-wp-bootstrap-navwalker.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Plugin URI: https://github.com/wp-bootstrap/wp-bootstrap-navwalker
* 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.
* Author: Edward McIntyre - @twittem, WP Bootstrap, William Patton - @pattonwebz
* Version: 4.0.1
* Version: 4.0.2
* Author URI: https://github.com/wp-bootstrap
* GitHub Plugin URI: https://github.com/wp-bootstrap/wp-bootstrap-navwalker
* GitHub Branch: master
Expand Down Expand Up @@ -189,7 +189,7 @@ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0
$atts['class'] = 'dropdown-toggle nav-link';
$atts['id'] = 'menu-item-dropdown-' . $item->ID;
} else {
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
$atts['href'] = ! empty( $item->url ) ? $item->url : '#';
// Items in dropdowns use .dropdown-item instead of .nav-link.
if ( $depth > 0 ) {
$atts['class'] = 'dropdown-item';
Expand Down Expand Up @@ -377,7 +377,7 @@ public static function fallback( $args ) {
} else {
return $fallback_output;
}
} // End if().
}
}

/**
Expand All @@ -403,20 +403,20 @@ private function seporate_linkmods_and_icons_from_classes( $classes, &$linkmod_c
foreach ( $classes as $key => $class ) {
// If any special classes are found, store the class in it's
// holder array and and unset the item from $classes.
if ( preg_match( '/disabled|sr-only/', $class ) ) {
if ( preg_match( '/^disabled|^sr-only/i', $class ) ) {
// Test for .disabled or .sr-only classes.
$linkmod_classes[] = $class;
unset( $classes[ $key ] );
} elseif ( preg_match( '/dropdown-header|dropdown-divider/', $class ) && $depth > 0 ) {
} elseif ( preg_match( '/^dropdown-header|^dropdown-divider/i', $class ) && $depth > 0 ) {
// Test for .dropdown-header or .dropdown-divider and a
// depth greater than 0 - IE inside a dropdown.
$linkmod_classes[] = $class;
unset( $classes[ $key ] );
} elseif ( preg_match( '/fa-(\S*)?|fas(\s?)|far(\s?)|fal(\s?)|fab(\s?)|fa(\s?)/', $class ) ) {
} elseif ( preg_match( '/^fa-(\S*)?|^fa(s|r|l|b)?(\s?)?$/i', $class ) ) {
// Font Awesome.
$icon_classes[] = $class;
unset( $classes[ $key ] );
} elseif ( preg_match( '/glyphicons-(\S*)?|glyphicons(\s?)/', $class ) ) {
} elseif ( preg_match( '/^glyphicon-(\S*)?|^glyphicon(\s?)$/i', $class ) ) {
// Glyphicons.
$icon_classes[] = $class;
unset( $classes[ $key ] );
Expand Down Expand Up @@ -550,4 +550,4 @@ private function linkmod_element_close( $linkmod_type ) {
return $output;
}
}
} // End if().
}
13 changes: 8 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
{
"name": "wp-bootstrap/wp-bootstrap-navwalker",
"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.",
"type": "wordpress-plugin",
"type": "library",
"license": "GPL-3.0+",
"authors": [
{
"name": "Brandon Hubbard"
},
{
"name": "William Patton",
"email": "will@pattonwebz.com"
}
{
"name": "William Patton",
"email": "will@pattonwebz.com"
}
],
"support": {
"issues": "https://github.com/wp-bootstrap/wp-bootstrap-navwalker/issues/",
"source": "https://github.com/wp-bootstrap/wp-bootstrap-navwalker/"
},
"autoload": {
"files": ["class-wp-bootstrap-navwalker.php"]
},
"require": {
"composer/installers": "~1.0"
},
Expand Down
Loading

0 comments on commit 11e3e90

Please sign in to comment.