From e9282049e8472db9a1a6de9c7f32d999beefa9d5 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Wed, 8 Nov 2017 08:34:41 +0000 Subject: [PATCH] Admin Bar: Reformat the render methods. The admin bar render methods use some cute tricks which don't come close to the WordPress coding standards. So that we can more easily apply automated code fixing to the codebase, these tricks need to be removed. See #41057. git-svn-id: https://develop.svn.wordpress.org/trunk@42128 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-admin-bar.php | 107 ++++++++++--------------- 1 file changed, 44 insertions(+), 63 deletions(-) diff --git a/src/wp-includes/class-wp-admin-bar.php b/src/wp-includes/class-wp-admin-bar.php index 734a04827d..b7d07214bc 100644 --- a/src/wp-includes/class-wp-admin-bar.php +++ b/src/wp-includes/class-wp-admin-bar.php @@ -434,11 +434,11 @@ class WP_Admin_Bar { if ( $node->type != 'container' || empty( $node->children ) ) return; - ?>
children as $group ) { - $this->_render_group( $group ); - } - ?>
id ) . '" class="ab-group-container">'; + foreach ( $node->children as $group ) { + $this->_render_group( $group ); + } + echo ''; } /** @@ -457,11 +457,11 @@ class WP_Admin_Bar { else $class = ''; - ?>id ) . "'$class>"; + foreach ( $node->children as $item ) { + $this->_render_item( $item ); + } + echo ''; } /** @@ -491,65 +491,46 @@ class WP_Admin_Bar { if ( $menuclass ) $menuclass = ' class="' . esc_attr( trim( $menuclass ) ) . '"'; - ?> + echo "
  • id ) . "'$menuclass>"; -
  • > href="href ) ?>"meta['onclick'] ) ) : - ?> onclick="meta['onclick'] ); ?>"meta['target'] ) ) : - ?> target="meta['target'] ); ?>"meta['title'] ) ) : - ?> title="meta['title'] ); ?>"meta['rel'] ) ) : - ?> rel="meta['rel'] ); ?>"meta['lang'] ) ) : - ?> lang="meta['lang'] ); ?>"meta['dir'] ) ) : - ?> dir="meta['dir'] ); ?>">'; + } - if ( ! empty( $node->meta['html'] ) ) - echo $node->meta['html']; + if ( $is_parent ) { + echo '
    '; + foreach ( $node->children as $group ) { + $this->_render_group( $group ); + } + echo '
    '; + } - ?> -
  • meta['html'] ) ) { + echo $node->meta['html']; + } + + echo ''; } /**