WordPress.org

Make WordPress Core

Changeset 44360


Ignore:
Timestamp:
12/24/2018 01:44:05 PM (16 months ago)
Author:
atimmer
Message:

Build tools: Fix the grunt format:php build.

Re-add variable that was removed on accident by [44359]. Also run grunt format:php to adjust the code style.
.--This line, and those below, will be ignored--

M Gruntfile.js
M src/index.php
M src/wp-admin/index.php
M src/wp-includes/class-wp-block-parser.php

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Gruntfile.js

    r44359 r44360  
    2626            'wp-content/plugins/hello.php',
    2727            'wp-content/plugins/akismet/**'
    28         ];
     28        ],
     29        changedFiles = {
     30            php: []
     31        };
    2932
    3033    if ( 'watch:phpunit' === grunt.cli.tasks[ 0 ] && ! phpUnitWatchGroup ) {
  • trunk/src/index.php

    r44359 r44360  
    3737) . '</p>';
    3838
    39 $die .= '<p>' . __( 'Before running any grunt tasks you need to make sure the dependencies are installed. You can install these by running ');
     39$die .= '<p>' . __( 'Before running any grunt tasks you need to make sure the dependencies are installed. You can install these by running ' );
    4040$die .= '<code style="color: green;">npm install</code>.</p>';
    4141
     
    4444    /* translators: %s: WordPress */
    4545        __( 'To build %s while developing run:' ),
    46         'WordPress'
    47     ) . '<br /><br />';
     46    'WordPress'
     47) . '<br /><br />';
    4848$die .= '<code style="color: green;">grunt build --dev</code></li>';
    4949$die .= '<li>' . sprintf(
    50         __( 'To build files automatically when changing the source files run:' ),
    51         'WordPress'
    52     ) . '<br /><br />';
     50    __( 'To build files automatically when changing the source files run:' ),
     51    'WordPress'
     52) . '<br /><br />';
    5353$die .= '<code style="color: green;">grunt watch</code></li>';
    5454$die .= '<li>' . sprintf(
    55         __( 'To create a production build of %s run:' ),
    56         'WordPress'
    57     ) . '<br /><br />';
     55    __( 'To create a production build of %s run:' ),
     56    'WordPress'
     57) . '<br /><br />';
    5858$die .= '<code style="color: green;">grunt build</code></li>';
    5959$die .= '</ul>';
  • trunk/src/wp-admin/index.php

    r44359 r44360  
    3737) . '</p>';
    3838
    39 $die .= '<p>' . __( 'Before running any grunt tasks you need to make sure the dependencies are installed. You can install these by running ');
     39$die .= '<p>' . __( 'Before running any grunt tasks you need to make sure the dependencies are installed. You can install these by running ' );
    4040$die .= '<code style="color: green;">npm install</code>.</p>';
    4141
     
    4444    /* translators: %s: WordPress */
    4545        __( 'To build %s while developing run:' ),
    46         'WordPress'
    47     ) . '<br /><br />';
     46    'WordPress'
     47) . '<br /><br />';
    4848$die .= '<code style="color: green;">grunt build --dev</code></li>';
    4949$die .= '<li>' . sprintf(
    50         __( 'To build files automatically when changing the source files run:' ),
    51         'WordPress'
    52     ) . '<br /><br />';
     50    __( 'To build files automatically when changing the source files run:' ),
     51    'WordPress'
     52) . '<br /><br />';
    5353$die .= '<code style="color: green;">grunt watch</code></li>';
    5454$die .= '<li>' . sprintf(
    55         __( 'To create a production build of %s run:' ),
    56         'WordPress'
    57     ) . '<br /><br />';
     55    __( 'To create a production build of %s run:' ),
     56    'WordPress'
     57) . '<br /><br />';
    5858$die .= '<code style="color: green;">grunt build</code></li>';
    5959$die .= '</ul>';
     
    6363    /* translators: %1$s: NPM URL, %2$s: Grunt URL */
    6464        __( 'This requires <a href="%1$s">NPM</a> and <a href="%2$s">Grunt</a>. <a href="%3$s">Read more about setting up your local development environment</a>.' ),
    65         'https://www.npmjs.com/',
    66         'https://gruntjs.com/',
    67         __( 'https://make.wordpress.org/core/handbook/tutorials/installing-wordpress-locally/' )
    68     ) . '</p>';
     65    'https://www.npmjs.com/',
     66    'https://gruntjs.com/',
     67    __( 'https://make.wordpress.org/core/handbook/tutorials/installing-wordpress-locally/' )
     68) . '</p>';
    6969
    7070wp_die( $die, __( 'WordPress &rsaquo; Error' ) );
  • trunk/src/wp-includes/class-wp-block-parser.php

    r44359 r44360  
    6464
    6565    function __construct( $name, $attrs, $innerBlocks, $innerHTML, $innerContent ) {
    66         $this->blockName   = $name;
    67         $this->attrs       = $attrs;
    68         $this->innerBlocks = $innerBlocks;
    69         $this->innerHTML   = $innerHTML;
     66        $this->blockName    = $name;
     67        $this->attrs        = $attrs;
     68        $this->innerBlocks  = $innerBlocks;
     69        $this->innerHTML    = $innerHTML;
    7070        $this->innerContent = $innerContent;
    7171    }
     
    270270                if ( 0 === $stack_depth ) {
    271271                    if ( isset( $leading_html_start ) ) {
    272                         $this->output[] = (array) self::freeform( substr(
    273                             $this->document,
    274                             $leading_html_start,
    275                             $start_offset - $leading_html_start
    276                         ) );
     272                        $this->output[] = (array) self::freeform(
     273                            substr(
     274                                $this->document,
     275                                $leading_html_start,
     276                                $start_offset - $leading_html_start
     277                            )
     278                        );
    277279                    }
    278280
    279281                    $this->output[] = (array) new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() );
    280                     $this->offset = $start_offset + $token_length;
     282                    $this->offset   = $start_offset + $token_length;
    281283                    return true;
    282284                }
     
    293295            case 'block-opener':
    294296                // track all newly-opened blocks on the stack
    295                 array_push( $this->stack, new WP_Block_Parser_Frame(
    296                     new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ),
    297                     $start_offset,
    298                     $token_length,
    299                     $start_offset + $token_length,
    300                     $leading_html_start
    301                 ) );
     297                array_push(
     298                    $this->stack,
     299                    new WP_Block_Parser_Frame(
     300                        new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ),
     301                        $start_offset,
     302                        $token_length,
     303                        $start_offset + $token_length,
     304                        $leading_html_start
     305                    )
     306                );
    302307                $this->offset = $start_offset + $token_length;
    303308                return true;
     
    330335                 * block and add it as a new innerBlock to the parent
    331336                 */
    332                 $stack_top = array_pop( $this->stack );
    333                 $html = substr( $this->document, $stack_top->prev_offset, $start_offset - $stack_top->prev_offset );
    334                 $stack_top->block->innerHTML .= $html;
     337                $stack_top                        = array_pop( $this->stack );
     338                $html                             = substr( $this->document, $stack_top->prev_offset, $start_offset - $stack_top->prev_offset );
     339                $stack_top->block->innerHTML     .= $html;
    335340                $stack_top->block->innerContent[] = $html;
    336                 $stack_top->prev_offset = $start_offset + $token_length;
     341                $stack_top->prev_offset           = $start_offset + $token_length;
    337342
    338343                $this->add_inner_block(
     
    392397        }
    393398
    394         list( $match, $started_at ) = $matches[ 0 ];
     399        list( $match, $started_at ) = $matches[0];
    395400
    396401        $length    = strlen( $match );
    397         $is_closer = isset( $matches[ 'closer' ] ) && -1 !== $matches[ 'closer' ][ 1 ];
    398         $is_void   = isset( $matches[ 'void' ] ) && -1 !== $matches[ 'void' ][ 1 ];
    399         $namespace = $matches[ 'namespace' ];
    400         $namespace = ( isset( $namespace ) && -1 !== $namespace[ 1 ] ) ? $namespace[ 0 ] : 'core/';
    401         $name      = $namespace . $matches[ 'name' ][ 0 ];
    402         $has_attrs = isset( $matches[ 'attrs' ] ) && -1 !== $matches[ 'attrs' ][ 1 ];
     402        $is_closer = isset( $matches['closer'] ) && -1 !== $matches['closer'][1];
     403        $is_void   = isset( $matches['void'] ) && -1 !== $matches['void'][1];
     404        $namespace = $matches['namespace'];
     405        $namespace = ( isset( $namespace ) && -1 !== $namespace[1] ) ? $namespace[0] : 'core/';
     406        $name      = $namespace . $matches['name'][0];
     407        $has_attrs = isset( $matches['attrs'] ) && -1 !== $matches['attrs'][1];
    403408
    404409        /*
     
    407412         */
    408413        $attrs = $has_attrs
    409             ? json_decode( $matches[ 'attrs' ][ 0 ], /* as-associative */ true )
     414            ? json_decode( $matches['attrs'][0], /* as-associative */ true )
    410415            : $this->empty_attrs;
    411416
     
    472477     */
    473478    function add_inner_block( WP_Block_Parser_Block $block, $token_start, $token_length, $last_offset = null ) {
    474         $parent = $this->stack[ count( $this->stack ) - 1 ];
     479        $parent                       = $this->stack[ count( $this->stack ) - 1 ];
    475480        $parent->block->innerBlocks[] = (array) $block;
    476         $html = substr( $this->document, $parent->prev_offset, $token_start - $parent->prev_offset );
     481        $html                         = substr( $this->document, $parent->prev_offset, $token_start - $parent->prev_offset );
    477482
    478483        if ( ! empty( $html ) ) {
    479             $parent->block->innerHTML .= $html;
     484            $parent->block->innerHTML     .= $html;
    480485            $parent->block->innerContent[] = $html;
    481486        }
    482487
    483488        $parent->block->innerContent[] = null;
    484         $parent->prev_offset = $last_offset ? $last_offset : $token_start + $token_length;
     489        $parent->prev_offset           = $last_offset ? $last_offset : $token_start + $token_length;
    485490    }
    486491
     
    501506
    502507        if ( ! empty( $html ) ) {
    503             $stack_top->block->innerHTML .= $html;
     508            $stack_top->block->innerHTML     .= $html;
    504509            $stack_top->block->innerContent[] = $html;
    505510        }
    506511
    507512        if ( isset( $stack_top->leading_html_start ) ) {
    508             $this->output[] = (array) self::freeform( substr(
    509                 $this->document,
    510                 $stack_top->leading_html_start,
    511                 $stack_top->token_start - $stack_top->leading_html_start
    512             ) );
     513            $this->output[] = (array) self::freeform(
     514                substr(
     515                    $this->document,
     516                    $stack_top->leading_html_start,
     517                    $stack_top->token_start - $stack_top->leading_html_start
     518                )
     519            );
    513520        }
    514521
Note: See TracChangeset for help on using the changeset viewer.