WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/23/2017 04:08:42 AM (20 months 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-includes/functions.php

    r42207 r42217  
    27562756        elseif ( function_exists( 'is_rtl' ) && is_rtl() )
    27572757            $text_direction = 'rtl';
     2758
     2759            if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) {
     2760                $dir_attr = get_language_attributes();
     2761            } else {
     2762                $dir_attr = "dir='$text_direction'";
     2763            }
    27582764?>
    27592765<!DOCTYPE html>
    2760 <html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) language_attributes(); else echo "dir='$text_direction'"; ?>>
     2766<html xmlns="http://www.w3.org/1999/xhtml" <?php echo $dir_attr; ?>>
    27612767<head>
    27622768    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
    37693775    nocache_headers();
    37703776    header( 'Content-Type: text/html; charset=utf-8' );
     3777
     3778    $dir_attr = '';
     3779    if ( is_rtl() ) {
     3780        $dir_attr = ' dir="rtl"';
     3781    }
    37713782?>
    37723783<!DOCTYPE html>
    3773 <html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
     3784<html xmlns="http://www.w3.org/1999/xhtml"<?php echo $dir_attr; ?>>
    37743785<head>
    37753786<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Note: See TracChangeset for help on using the changeset viewer.