--- a/wp/wp-includes/class-walker-page.php Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/class-walker-page.php Tue Dec 15 13:49:49 2020 +0100
@@ -122,15 +122,17 @@
if ( ! empty( $current_page ) ) {
$_current_page = get_post( $current_page );
- if ( $_current_page && in_array( $page->ID, $_current_page->ancestors ) ) {
+
+ if ( $_current_page && in_array( $page->ID, $_current_page->ancestors, true ) ) {
$css_class[] = 'current_page_ancestor';
}
+
if ( $page->ID == $current_page ) {
$css_class[] = 'current_page_item';
- } elseif ( $_current_page && $page->ID == $_current_page->post_parent ) {
+ } elseif ( $_current_page && $page->ID === $_current_page->post_parent ) {
$css_class[] = 'current_page_parent';
}
- } elseif ( $page->ID == get_option( 'page_for_posts' ) ) {
+ } elseif ( get_option( 'page_for_posts' ) == $page->ID ) {
$css_class[] = 'current_page_parent';
}
@@ -151,7 +153,7 @@
$css_classes = $css_classes ? ' class="' . esc_attr( $css_classes ) . '"' : '';
if ( '' === $page->post_title ) {
- /* translators: %d: ID of a post */
+ /* translators: %d: ID of a post. */
$page->post_title = sprintf( __( '#%d (no title)' ), $page->ID );
}
@@ -182,7 +184,7 @@
$attributes = '';
foreach ( $atts as $attr => $value ) {
- if ( ! empty( $value ) ) {
+ if ( is_scalar( $value ) && '' !== $value && false !== $value ) {
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
$attributes .= ' ' . $attr . '="' . $value . '"';
}
@@ -199,7 +201,7 @@
);
if ( ! empty( $args['show_date'] ) ) {
- if ( 'modified' == $args['show_date'] ) {
+ if ( 'modified' === $args['show_date'] ) {
$time = $page->post_modified;
} else {
$time = $page->post_date;