]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/class-walker-page.php
WordPress 4.7.2-scripts
[autoinstalls/wordpress.git] / wp-includes / class-walker-page.php
index fd55ccee4dd7c3fd4c8683273836b124a8371023..3fcaa67a86a7eee335369d693144edb26941c6f9 100644 (file)
@@ -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<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}";
        }
 
        /**
@@ -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</ul>\n";
+               if ( 'preserve' === $args['item_spacing'] ) {
+                       $t = "\t";
+                       $n = "\n";
+               } else {
+                       $t = '';
+                       $n = '';
+               }
+               $indent = str_repeat( $t, $depth );
+               $output .= "{$indent}</ul>{$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 = '';
                }
@@ -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 .= "</li>\n";
+               if ( 'preserve' === $args['item_spacing'] ) {
+                       $t = "\t";
+                       $n = "\n";
+               } else {
+                       $t = '';
+                       $n = '';
+               }
+               $output .= "</li>{$n}";
        }
 
 }