X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/784f914b1e4b1c62d6657e86397c2e83bcee4295..HEAD:/wp-includes/class-walker-page.php
diff --git a/wp-includes/class-walker-page.php b/wp-includes/class-walker-page.php
index f4667c57..3fcaa67a 100644
--- a/wp-includes/class-walker-page.php
+++ b/wp-includes/class-walker-page.php
@@ -49,12 +49,19 @@ class Walker_Page extends Walker {
*
* @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
\n";
+ if ( 'preserve' === $args['item_spacing'] ) {
+ $t = "\t";
+ $n = "\n";
+ } else {
+ $t = '';
+ $n = '';
+ }
+ $indent = str_repeat( $t, $depth );
+ $output .= "{$n}{$indent}{$n}";
}
/**
@@ -71,8 +78,15 @@ class Walker_Page extends Walker {
* Default empty array.
*/
public function end_lvl( &$output, $depth = 0, $args = array() ) {
- $indent = str_repeat("\t", $depth);
- $output .= "$indent
\n";
+ if ( 'preserve' === $args['item_spacing'] ) {
+ $t = "\t";
+ $n = "\n";
+ } else {
+ $t = '';
+ $n = '';
+ }
+ $indent = str_repeat( $t, $depth );
+ $output .= "{$indent}
{$n}";
}
/**
@@ -89,8 +103,15 @@ class Walker_Page extends Walker {
* @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 = '';
}
@@ -116,7 +137,7 @@ class Walker_Page extends Walker {
}
/**
- * Filter the list of CSS classes to include with each page item in the list.
+ * Filters the list of CSS classes to include with each page item in the list.
*
* @since 2.8.0
*
@@ -175,7 +196,14 @@ class Walker_Page extends Walker {
* @param array $args Optional. Array of arguments. Default empty array.
*/
public function end_el( &$output, $page, $depth = 0, $args = array() ) {
- $output .= "\n";
+ if ( 'preserve' === $args['item_spacing'] ) {
+ $t = "\t";
+ $n = "\n";
+ } else {
+ $t = '';
+ $n = '';
+ }
+ $output .= "{$n}";
}
}