*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Optional. Depth of page. Used for padding. Default 0.
- * @param array $args Optional. Arguments for outputing the next level.
+ * @param array $args Optional. Arguments for outputting the next level.
* Default empty array.
*/
public function start_lvl( &$output, $depth = 0, $args = array() ) {
- $indent = str_repeat("\t", $depth);
- $output .= "\n$indent<ul class='children'>\n";
+ if ( 'preserve' === $args['item_spacing'] ) {
+ $t = "\t";
+ $n = "\n";
+ } else {
+ $t = '';
+ $n = '';
+ }
+ $indent = str_repeat( $t, $depth );
+ $output .= "{$n}{$indent}<ul class='children'>{$n}";
}
/**
* Default empty array.
*/
public function end_lvl( &$output, $depth = 0, $args = array() ) {
- $indent = str_repeat("\t", $depth);
- $output .= "$indent</ul>\n";
+ if ( 'preserve' === $args['item_spacing'] ) {
+ $t = "\t";
+ $n = "\n";
+ } else {
+ $t = '';
+ $n = '';
+ }
+ $indent = str_repeat( $t, $depth );
+ $output .= "{$indent}</ul>{$n}";
}
/**
* @param int $current_page Optional. Page ID. Default 0.
*/
public function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
+ if ( 'preserve' === $args['item_spacing'] ) {
+ $t = "\t";
+ $n = "\n";
+ } else {
+ $t = '';
+ $n = '';
+ }
if ( $depth ) {
- $indent = str_repeat( "\t", $depth );
+ $indent = str_repeat( $t, $depth );
} else {
$indent = '';
}
* @param array $args Optional. Array of arguments. Default empty array.
*/
public function end_el( &$output, $page, $depth = 0, $args = array() ) {
- $output .= "</li>\n";
+ if ( 'preserve' === $args['item_spacing'] ) {
+ $t = "\t";
+ $n = "\n";
+ } else {
+ $t = '';
+ $n = '';
+ }
+ $output .= "</li>{$n}";
}
}