PluginProbe
Polylang / 2.8
Polylang v2.8
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 +14 -23 3.0.12.8 View file →
@@ -8,15 +8,8 @@
8 8 *
9 9 * @since 1.2
10 10 */
11 11 class PLL_Walker_List extends Walker {
12 - /**
13 - * Database fields to use.
14 - *
15 - * @see https://developer.wordpress.org/reference/classes/walker/#properties Walker::$db_fields.
16 - *
17 - * @var array
18 - */
19 12 public $db_fields = array( 'parent' => 'parent', 'id' => 'id' );
20 13
21 14 /**
22 15 * Outputs one element
@@ -22,16 +15,15 @@
22 15 * Outputs one element
23 16 *
24 17 * @since 1.2
25 18 *
26 - * @param string $output Passed by reference. Used to append additional content.
27 - * @param stdClass $element The data object.
28 - * @param int $depth Depth of the item.
29 - * @param array $args An array of additional arguments.
30 - * @param int $current_object_id ID of the current item.
31 - * @return void
19 + * @param string $output Passed by reference. Used to append additional content.
20 + * @param object $element The data object.
21 + * @param int $depth Depth of the item.
22 + * @param array $args An array of additional arguments.
23 + * @param int $current_object_id ID of the current item.
32 24 */
33 - public function start_el( &$output, $element, $depth = 0, $args = array(), $current_object_id = 0 ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
25 + public function start_el( &$output, $element, $depth = 0, $args = array(), $current_object_id = 0 ) {
34 26 $output .= sprintf(
35 27 '%6$s<li class="%1$s"><a lang="%2$s" hreflang="%2$s" href="%3$s">%4$s%5$s</a></li>%7$s',
36 28 esc_attr( implode( ' ', $element->classes ) ),
37 29 esc_attr( $element->locale ),
@@ -47,17 +39,16 @@
47 39 * Overrides Walker::display_element as it expects an object with a parent property
48 40 *
49 41 * @since 1.2
50 42 *
51 - * @param stdClass $element Data object.
52 - * @param array $children_elements List of elements to continue traversing.
53 - * @param int $max_depth Max depth to traverse.
54 - * @param int $depth Depth of current element.
55 - * @param array $args An array of arguments.
56 - * @param string $output Passed by reference. Used to append additional content.
57 - * @return void
43 + * @param object $element Data object.
44 + * @param array $children_elements List of elements to continue traversing.
45 + * @param int $max_depth Max depth to traverse.
46 + * @param int $depth Depth of current element.
47 + * @param array $args An array of arguments.
48 + * @param string $output Passed by reference. Used to append additional content.
58 49 */
59 - public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
50 + public function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
60 51 $element = (object) $element; // Make sure we have an object
61 52 $element->parent = $element->id = 0; // Don't care about this
62 53 parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
63 54 }
@@ -73,9 +64,9 @@
73 64 * @param mixed ...$args Additional arguments.
74 65 * @return string The hierarchical item output.
75 66 */
76 67 public function walk( $elements, $max_depth, ...$args ) { // phpcs:ignore WordPressVIPMinimum.Classes.DeclarationCompatibility.DeclarationCompatibility
77 - if ( is_array( $max_depth ) ) { // @phpstan-ignore-line
68 + if ( is_array( $max_depth ) ) {
78 69 // Backward compatibility with Polylang < 2.6.7
79 70 if ( WP_DEBUG ) {
80 71 trigger_error( // phpcs:ignore WordPress.PHP.DevelopmentFunctions
81 72 sprintf(