Skip to content

Commit

Permalink
sanitize content server side
Browse files Browse the repository at this point in the history
  • Loading branch information
randhirexpresstech committed Feb 23, 2024
1 parent f8a12b2 commit 85d99f0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion php/classes/class-qsm-results-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,16 @@ public static function convert_to_new_system( $quiz_id ) {
}

public static function sanitize_html( $html = '' ) {


//Decode Html
$html = htmlspecialchars_decode( $html, ENT_QUOTES );

// Remove unwanted html tags
$html = preg_replace('/<(script|form|textarea|div|body|title|svg|link|meta)[^>]*>.*?<\/\1>/is', '', $html);

// Remove styles attributes
$html = preg_replace('/(<[^>]+) style=".*?"/i', '$1', $html);

// Remove input tags
$html = preg_replace('/<input\b[^>]*>/i', '', $html);

Expand Down

0 comments on commit 85d99f0

Please sign in to comment.