| @@ -25,9 +25,9 @@ | ||
| 25 | 25 | esc_attr( implode( ' ', $element->classes ) ), |
| 26 | 26 | esc_attr( $element->locale ), |
| 27 | 27 | esc_url( $element->url ), |
| 28 | 28 | $element->flag, |
| 29 | - $args['show_flags'] && $args['show_names'] ? sprintf( '<span style="margin-%1$s:0.3em;">%2$s</span>', is_rtl() ? 'right' : 'left', esc_html( $element->name ) ) : esc_html( $element->name ), | |
| 29 | + $args['show_flags'] ? sprintf( '<span style="margin-%1$s:0.3em;">%2$s</span>', is_rtl() ? 'right' : 'left', esc_html( $element->name ) ) : esc_html( $element->name ), | |
| 30 | 30 | 'discard' === $args['item_spacing'] ? '' : "\t", |
| 31 | 31 | 'discard' === $args['item_spacing'] ? '' : "\n" |
| 32 | 32 | ); |
| 33 | 33 | } |
| @@ -53,31 +53,13 @@ | ||
| 53 | 53 | /** |
| 54 | 54 | * Overrides Walker:walk to set depth argument |
| 55 | 55 | * |
| 56 | 56 | * @since 1.2 |
| 57 | - * @since 2.6.7 Use $max_depth and ...$args parameters to follow the move of WP 5.3 | |
| 58 | 57 | * |
| 59 | - * @param array $elements An array of elements. | |
| 60 | - * @param int $max_depth The maximum hierarchical depth. | |
| 61 | - * @param mixed ...$args Additional arguments. | |
| 62 | - * @return string The hierarchical item output. | |
| 58 | + * @param array $elements elements to display | |
| 59 | + * @param array $args | |
| 60 | + * @return string | |
| 63 | 61 | */ |
| 64 | - public function walk( $elements, $max_depth, ...$args ) { // phpcs:ignore WordPressVIPMinimum.Classes.DeclarationCompatibility.DeclarationCompatibility | |
| 65 | - if ( is_array( $max_depth ) ) { | |
| 66 | - // Backward compatibility with Polylang < 2.6.7 | |
| 67 | - if ( WP_DEBUG ) { | |
| 68 | - trigger_error( // phpcs:ignore WordPress.PHP.DevelopmentFunctions | |
| 69 | - sprintf( | |
| 70 | - '%s was called incorrectly. The method expects an integer as second parameter since Polylang 2.6.7', | |
| 71 | - __METHOD__ | |
| 72 | - ) | |
| 73 | - ); | |
| 74 | - } | |
| 75 | - $args = $max_depth; | |
| 76 | - $max_depth = -1; | |
| 77 | - } else { | |
| 78 | - $args = isset( $args[0] ) ? $args[0] : array(); | |
| 79 | - } | |
| 80 | - | |
| 81 | - return parent::walk( $elements, $max_depth, $args ); | |
| 62 | + public function walk( $elements, $args = array() ) { | |
| 63 | + return parent::walk( $elements, -1, $args ); | |
| 82 | 64 | } |
| 83 | 65 | } |