PluginProbe
Polylang / 3.1.4
Polylang v3.1.4
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-dropdown.php +26 -14 2.73.1.4 View file →
@@ -1,5 +1,8 @@
1 1 <?php
2 +/**
3 + * @package Polylang
4 + */
2 5
3 6 /**
4 7 * Displays languages in a dropdown list
5 8 *
@@ -5,8 +8,15 @@
5 8 *
6 9 * @since 1.2
7 10 */
8 11 class PLL_Walker_Dropdown 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 + */
9 19 public $db_fields = array( 'parent' => 'parent', 'id' => 'id' );
10 20
11 21 /**
12 22 * Outputs one element
@@ -12,15 +22,16 @@
12 22 * Outputs one element
13 23 *
14 24 * @since 1.2
15 25 *
16 - * @param string $output Passed by reference. Used to append additional content.
17 - * @param object $element The data object.
18 - * @param int $depth Depth of the item.
19 - * @param array $args An array of additional arguments.
20 - * @param int $current_object_id ID of the current item.
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
21 32 */
22 - public function start_el( &$output, $element, $depth = 0, $args = array(), $current_object_id = 0 ) {
33 + public function start_el( &$output, $element, $depth = 0, $args = array(), $current_object_id = 0 ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
23 34 $value = $args['value'];
24 35 $output .= sprintf(
25 36 "\t" . '<option value="%1$s"%2$s%3$s>%4$s</option>' . "\n",
26 37 esc_attr( $element->$value ),
@@ -34,16 +45,17 @@
34 45 * Overrides Walker::display_element as expects an object with a parent property
35 46 *
36 47 * @since 1.2
37 48 *
38 - * @param object $element Data object.
39 - * @param array $children_elements List of elements to continue traversing.
40 - * @param int $max_depth Max depth to traverse.
41 - * @param int $depth Depth of current element.
42 - * @param array $args An array of arguments.
43 - * @param string $output Passed by reference. Used to append additional content.
49 + * @param stdClass $element Data object.
50 + * @param array $children_elements List of elements to continue traversing.
51 + * @param int $max_depth Max depth to traverse.
52 + * @param int $depth Depth of current element.
53 + * @param array $args An array of arguments.
54 + * @param string $output Passed by reference. Used to append additional content.
55 + * @return void
44 56 */
45 - public function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
57 + public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
46 58 $element = (object) $element; // Make sure we have an object
47 59 $element->parent = $element->id = 0; // Don't care about this
48 60 parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
49 61 }
@@ -71,9 +83,9 @@
71 83 */
72 84 public function walk( $elements, $max_depth, ...$args ) { // // phpcs:ignore WordPressVIPMinimum.Classes.DeclarationCompatibility.DeclarationCompatibility
73 85 $output = '';
74 86
75 - if ( is_array( $max_depth ) ) {
87 + if ( is_array( $max_depth ) ) { // @phpstan-ignore-line
76 88 // Backward compatibility with Polylang < 2.6.7
77 89 if ( WP_DEBUG ) {
78 90 trigger_error( // phpcs:ignore WordPress.PHP.DevelopmentFunctions
79 91 sprintf(