Making WordPress.org

Changeset 13717


Ignore:
Timestamp:
05/16/2024 06:47:51 AM (18 months ago)
Author:
dd32
Message:

Plugin Directory: Blocks: Don't be greedy in the regex. Fixes multiple block registrations close together merging together.

See [13716].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php

    r13716 r13717  
    10111011            // Note that this only works with literal strings for the block name and title, and assumes that order.
    10121012            $contents = file_get_contents( $filename );
    1013             if ( $contents && preg_match_all( "#registerBlockType[^{}]{0,500}[(]\s*[\"']([-\w]+/[-\w]+)[\"']\s*,\s*[{][^;]{0,500}\s*title\s*:[\s\w(.]*[\"']([^\"']*)[\"'](?!\s*[+])#ms", $contents, $matches, PREG_SET_ORDER ) ) {
     1013            if ( $contents && preg_match_all( "#registerBlockType[^{}]{0,500}[(]\s*[\"']([-\w]+/[-\w]+)[\"']\s*,\s*[{][^;]{0,500}?\s*title\s*:[\s\w(.]*[\"']([^\"']*)[\"'](?!\s*[+])#ms", $contents, $matches, PREG_SET_ORDER ) ) {
    10141014                foreach ( $matches as $match ) {
    10151015                    $blocks[] = (object) [
Note: See TracChangeset for help on using the changeset viewer.