PluginProbe
Polylang / 2.3.6
Polylang v2.3.6
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | include/walker-list.php +9 -27 2.72.3.6 View file →
@@ -5,9 +5,9 @@
5 5 *
6 6 * @since 1.2
7 7 */
8 8 class PLL_Walker_List extends Walker {
9 - public $db_fields = array( 'parent' => 'parent', 'id' => 'id' );
9 + var $db_fields = array( 'parent' => 'parent', 'id' => 'id' );
10 10
11 11 /**
12 12 * Outputs one element
13 13 *
@@ -18,9 +18,9 @@
18 18 * @param int $depth Depth of the item.
19 19 * @param array $args An array of additional arguments.
20 20 * @param int $current_object_id ID of the current item.
21 21 */
22 - public function start_el( &$output, $element, $depth = 0, $args = array(), $current_object_id = 0 ) {
22 + function start_el( &$output, $element, $depth = 0, $args = array(), $current_object_id = 0 ) {
23 23 $output .= sprintf(
24 24 '%6$s<li class="%1$s"><a lang="%2$s" hreflang="%2$s" href="%3$s">%4$s%5$s</a></li>%7$s',
25 25 esc_attr( implode( ' ', $element->classes ) ),
26 26 esc_attr( $element->locale ),
@@ -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 }
@@ -43,9 +43,9 @@
43 43 * @param int $depth Depth of current element.
44 44 * @param array $args An array of arguments.
45 45 * @param string $output Passed by reference. Used to append additional content.
46 46 */
47 - public function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
47 + function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
48 48 $element = (object) $element; // Make sure we have an object
49 49 $element->parent = $element->id = 0; // Don't care about this
50 50 parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
51 51 }
@@ -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 + function walk( $elements, $args = array() ) {
63 + return parent::walk( $elements, -1, $args );
82 64 }
83 65 }