PluginProbe
Polylang / 1.8
Polylang v1.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
polylang / include / walker-list.php

walker-list.php in Polylang 1.8, at include/walker-list.php

54 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * displays a language list
5 *
6 * @since 1.2
7 */
8 class PLL_Walker_List extends Walker {
9 var $db_fields = array( 'parent' => 'parent', 'id' => 'id' );
10
11 /*
12 * outputs one element
13 *
14 * @since 1.2
15 *
16 * @see Walker::start_el
17 */
18 function start_el( &$output, $element, $depth = 0, $args = array(), $current_object_id = 0 ) {
19 $output .= sprintf(
20 "\t".'<li class="%s"><a hreflang="%s" href="%s">%s</a></li>'."\n",
21 esc_attr( implode( ' ', $element->classes ) ),
22 esc_attr( $element->locale ),
23 esc_url( $element->url ),
24 $args['show_flags'] && $args['show_names'] ? $element->flag.'&nbsp;'.esc_html( $element->name ) : $element->flag.esc_html( $element->name )
25 );
26 }
27
28 /*
29 * overrides Walker::display_element as it expects an object with a parent property
30 *
31 * @since 1.2
32 *
33 * @see Walker::display_element
34 */
35 function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
36 $element = (object) $element; // make sure we have an object
37 $element->parent = $element->id = 0; // don't care about this
38 parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
39 }
40
41 /*
42 * overrides Walker:walk to set depth argument
43 *
44 * @since 1.2
45 *
46 * @param array $elements elements to display
47 * @param array $args
48 * @return string
49 */
50 function walk( $elements, $args = array() ) {
51 return parent::walk( $elements, -1, $args );
52 }
53 }
54