Make WordPress Core


Ignore:
Timestamp:
11/23/2017 04:08:42 AM (7 years ago)
Author:
pento
Message:

General: Reformat inline if () statements inside HTML tags.

This pattern occurs a handful of times across the codebase:

<div class="foo<?php if ( $bar ) { echo ' baz'; } ?>">

Unfortunately, it doesn't really play nicely with phpcbf, so all instances need to be removed in preperation for auto code formatting.

See #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/nav-menu.php

    r41987 r42217  
    391391    );
    392392
     393    $most_recent_url = $view_all_url = $search_url = '';
     394    if ( $nav_menu_selected_id ) {
     395        $most_recent_url = esc_url(add_query_arg($post_type_name . '-tab', 'most-recent', remove_query_arg($removed_args)));
     396        $view_all_url    = esc_url(add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args)));
     397        $search_url      = esc_url(add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args)));
     398    }
    393399    ?>
    394400    <div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv">
    395401        <ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs">
    396402            <li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>>
    397                 <a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-most-recent" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'most-recent', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent">
     403                <a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-most-recent" href="<?php echo $most_recent_url; ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent">
    398404                    <?php _e( 'Most Recent' ); ?>
    399405                </a>
    400406            </li>
    401407            <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>>
    402                 <a class="nav-tab-link" data-type="<?php echo esc_attr( $post_type_name ); ?>-all" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#<?php echo $post_type_name; ?>-all">
     408                <a class="nav-tab-link" data-type="<?php echo esc_attr( $post_type_name ); ?>-all" href="<?php echo $view_all_url; ?>#<?php echo $post_type_name; ?>-all">
    403409                    <?php _e( 'View All' ); ?>
    404410                </a>
    405411            </li>
    406412            <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>>
    407                 <a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-search" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
     413                <a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-search" href="<?php echo $search_url; ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
    408414                    <?php _e( 'Search'); ?>
    409415                </a>
     
    679685    );
    680686
     687    $most_used_url = $view_all_url = $search_url = '';
     688    if ( $nav_menu_selected_id ) {
     689        $most_used_url = esc_url(add_query_arg($taxonomy_name . '-tab', 'most-used', remove_query_arg($removed_args)));
     690        $view_all_url  = esc_url(add_query_arg($taxonomy_name . '-tab', 'all', remove_query_arg($removed_args)));
     691        $search_url    = esc_url(add_query_arg($taxonomy_name . '-tab', 'search', remove_query_arg($removed_args)));
     692    }
    681693    ?>
    682694    <div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv">
    683695        <ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs">
    684696            <li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>>
    685                 <a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-pop" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'most-used', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop">
     697                <a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-pop" href="<?php echo $most_used_url; ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop">
    686698                    <?php echo esc_html( $taxonomy->labels->most_used ); ?>
    687699                </a>
    688700            </li>
    689701            <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>>
    690                 <a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-all" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all">
     702                <a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-all" href="<?php echo $view_all_url; ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all">
    691703                    <?php _e( 'View All' ); ?>
    692704                </a>
    693705            </li>
    694706            <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>>
    695                 <a class="nav-tab-link" data-type="tabs-panel-search-taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
     707                <a class="nav-tab-link" data-type="tabs-panel-search-taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>" href="<?php echo $search_url; ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
    696708                    <?php _e( 'Search' ); ?>
    697709                </a>
Note: See TracChangeset for help on using the changeset viewer.