- Timestamp:
- 02/02/2022 01:27:55 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/trac.wordpress.org/templates/update-headers.php
r11499 r11500 46 46 // Remove trailing whitespace. 47 47 $html = preg_replace( '#(\S)\s+$#m', '$1', $html ); 48 49 // Standardise container IDs, to make diffs simpler. 50 // The hash being replaced here is the result of `uniqid()` to privide unique element classes. 51 $html = preg_replace_callback( 52 '!(?P<class>(?P<prefix>wp-container|modal|wp-elements)-(?P<id>[a-f0-9]{13,14}))(?P<suffix>[^a-f0-9])!', 53 function( $m ) { 54 static $ids = []; 55 static $next_id = 1; 56 57 $prefix_id = $ids[ $m['class'] ] ?? ( $ids[ $m['class'] ] = $m['prefix'] . '-trac-' . ( $next_id++ ) ); 58 59 return $prefix_id . $m['suffix']; 60 }, 61 $html 62 ); 48 63 49 64 return file_put_contents( $file, $html );
Note: See TracChangeset
for help on using the changeset viewer.