Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
update regex
Browse files Browse the repository at this point in the history
  • Loading branch information
gigitux committed Jan 6, 2022
1 parent e291dc3 commit 97ad7e7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/BlockTypes/LegacyTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,7 @@ public function add_alignment_class_to_wrapper( string $content, array $block )
// If there is a tag, but it doesn't have a class attribute, add the class attribute.
if ( isset( $matches[0] ) && strpos( $matches[0], ' class=' ) === false ) {
$pattern_before_tag_closing = '/.+?(?=>)/';
$matches = array();
preg_match( $pattern_before_tag_closing, $content, $matches );
return preg_replace( $pattern_before_tag_closing, $matches[0] . ' class="' . $align_class_and_style['class'] . '"', $content, 1 );
return preg_replace( $pattern_before_tag_closing, "$0" . ' class="' . $align_class_and_style['class'] . '"', $content, 1 );
}

// If there is a tag, and it has a class already, add the class attribute.
Expand Down

0 comments on commit 97ad7e7

Please sign in to comment.