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. Built from https://develop.svn.wordpress.org/trunk@42128 git-svn-id: http://core.svn.wordpress.org/trunk@41959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d7b49bbc3e
commit
bde3b95936
|
@ -434,11 +434,11 @@ class WP_Admin_Bar {
|
||||||
if ( $node->type != 'container' || empty( $node->children ) )
|
if ( $node->type != 'container' || empty( $node->children ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
?><div id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>" class="ab-group-container"><?php
|
echo '<div id="' . esc_attr( 'wp-admin-bar-' . $node->id ) . '" class="ab-group-container">';
|
||||||
foreach ( $node->children as $group ) {
|
foreach ( $node->children as $group ) {
|
||||||
$this->_render_group( $group );
|
$this->_render_group( $group );
|
||||||
}
|
}
|
||||||
?></div><?php
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -457,11 +457,11 @@ class WP_Admin_Bar {
|
||||||
else
|
else
|
||||||
$class = '';
|
$class = '';
|
||||||
|
|
||||||
?><ul id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>"<?php echo $class; ?>><?php
|
echo "<ul id='" . esc_attr( 'wp-admin-bar-' . $node->id ) . "'$class>";
|
||||||
foreach ( $node->children as $item ) {
|
foreach ( $node->children as $item ) {
|
||||||
$this->_render_item( $item );
|
$this->_render_item( $item );
|
||||||
}
|
}
|
||||||
?></ul><?php
|
echo '</ul>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -491,65 +491,46 @@ class WP_Admin_Bar {
|
||||||
if ( $menuclass )
|
if ( $menuclass )
|
||||||
$menuclass = ' class="' . esc_attr( trim( $menuclass ) ) . '"';
|
$menuclass = ' class="' . esc_attr( trim( $menuclass ) ) . '"';
|
||||||
|
|
||||||
?>
|
echo "<li id='" . esc_attr( 'wp-admin-bar-' . $node->id ) . "'$menuclass>";
|
||||||
|
|
||||||
<li id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>"<?php echo $menuclass; ?>><?php
|
if ( $has_link ) {
|
||||||
if ( $has_link ):
|
$attributes = array( 'onclick', 'target', 'title', 'rel', 'lang', 'dir' );
|
||||||
?><a class="ab-item"<?php echo $aria_attributes; ?> href="<?php echo esc_url( $node->href ) ?>"<?php
|
echo "<a class='ab-item'$aria_attributes href='" . esc_url( $node->href ) . "'>";
|
||||||
if ( ! empty( $node->meta['onclick'] ) ) :
|
if ( ! empty( $node->meta['onclick'] ) ) {
|
||||||
?> onclick="<?php echo esc_js( $node->meta['onclick'] ); ?>"<?php
|
echo ' onclick="' . esc_js( $node->meta['onclick'] ) . '"';
|
||||||
endif;
|
}
|
||||||
if ( ! empty( $node->meta['target'] ) ) :
|
} else {
|
||||||
?> target="<?php echo esc_attr( $node->meta['target'] ); ?>"<?php
|
$attributes = array( 'onclick', 'target', 'title', 'rel', 'lang', 'dir' );
|
||||||
endif;
|
echo '<div class="ab-item ab-empty-item"' . $aria_attributes;
|
||||||
if ( ! empty( $node->meta['title'] ) ) :
|
}
|
||||||
?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php
|
|
||||||
endif;
|
|
||||||
if ( ! empty( $node->meta['rel'] ) ) :
|
|
||||||
?> rel="<?php echo esc_attr( $node->meta['rel'] ); ?>"<?php
|
|
||||||
endif;
|
|
||||||
if ( ! empty( $node->meta['lang'] ) ) :
|
|
||||||
?> lang="<?php echo esc_attr( $node->meta['lang'] ); ?>"<?php
|
|
||||||
endif;
|
|
||||||
if ( ! empty( $node->meta['dir'] ) ) :
|
|
||||||
?> dir="<?php echo esc_attr( $node->meta['dir'] ); ?>"<?php
|
|
||||||
endif;
|
|
||||||
?>><?php
|
|
||||||
else:
|
|
||||||
?><div class="ab-item ab-empty-item"<?php echo $aria_attributes;
|
|
||||||
if ( ! empty( $node->meta['title'] ) ) :
|
|
||||||
?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php
|
|
||||||
endif;
|
|
||||||
if ( ! empty( $node->meta['lang'] ) ) :
|
|
||||||
?> lang="<?php echo esc_attr( $node->meta['lang'] ); ?>"<?php
|
|
||||||
endif;
|
|
||||||
if ( ! empty( $node->meta['dir'] ) ) :
|
|
||||||
?> dir="<?php echo esc_attr( $node->meta['dir'] ); ?>"<?php
|
|
||||||
endif;
|
|
||||||
?>><?php
|
|
||||||
endif;
|
|
||||||
|
|
||||||
echo $node->title;
|
foreach ( $attributes as $attribute ) {
|
||||||
|
if ( ! empty( $node->meta[ $attribute ] ) ) {
|
||||||
|
echo " $attribute='" . esc_attr( $node->meta[ $attribute ] ) . '"';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( $has_link ) :
|
echo ">{$node->title}";
|
||||||
?></a><?php
|
|
||||||
else:
|
|
||||||
?></div><?php
|
|
||||||
endif;
|
|
||||||
|
|
||||||
if ( $is_parent ) :
|
if ( $has_link ) {
|
||||||
?><div class="ab-sub-wrapper"><?php
|
echo '</a>';
|
||||||
|
} else {
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $is_parent ) {
|
||||||
|
echo '<div class="ab-sub-wrapper">';
|
||||||
foreach ( $node->children as $group ) {
|
foreach ( $node->children as $group ) {
|
||||||
$this->_render_group( $group );
|
$this->_render_group( $group );
|
||||||
}
|
}
|
||||||
?></div><?php
|
echo '</div>';
|
||||||
endif;
|
}
|
||||||
|
|
||||||
if ( ! empty( $node->meta['html'] ) )
|
if ( ! empty( $node->meta['html'] ) ) {
|
||||||
echo $node->meta['html'];
|
echo $node->meta['html'];
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
echo '</li>';
|
||||||
</li><?php
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.0-alpha-42127';
|
$wp_version = '5.0-alpha-42128';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue