Skip to content

Commit

Permalink
WPCIVIUX-165 Remove regex filter for security
Browse files Browse the repository at this point in the history
  • Loading branch information
agileware-iris committed Sep 26, 2024
1 parent 7ddb96e commit 10262bf
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,9 @@ abstract public function shortcode_callback( $atts = [], $content = null, $tag =
*/
public function clean_content_output($content = '') {
// Default regex patterns to remove empty and misconfigured <p> tags and <br> tags
$default_regex = '/<p>(\s*&nbsp;\s*|\s*)<\/p>|<\/p>\s*<p>|<br\s*\/?>/';

// Apply a filter so users can change the regex pattern
$custom_regex = apply_filters('ux_shortcode_clean_content_output_regex', $default_regex);
$regex = '/<p>(\s*&nbsp;\s*|\s*)<\/p>|<\/p>\s*<p>|<br\s*\/?>/';

$cleaned = preg_replace($custom_regex, '', $content);
$cleaned = preg_replace($regex, '', $content);

return $cleaned;
}
Expand Down

0 comments on commit 10262bf

Please sign in to comment.