| @@ -125,9 +125,9 @@ | ||
| 125 | 125 | ); |
| 126 | 126 | $html = preg_replace_callback( |
| 127 | 127 | '#<pre\b[^>]*>(.*?)</pre>#is', |
| 128 | 128 | function ($m) { |
| 129 | - $code = html_entity_decode(strip_tags($m[1]), ENT_QUOTES | ENT_HTML5, 'UTF-8'); | |
| 129 | + $code = html_entity_decode(wp_strip_all_tags($m[1]), ENT_QUOTES | ENT_HTML5, 'UTF-8'); | |
| 130 | 130 | return "\n\n```\n" . trim($code) . "\n```\n\n"; |
| 131 | 131 | }, |
| 132 | 132 | $html |
| 133 | 133 | ); |
| @@ -135,9 +135,9 @@ | ||
| 135 | 135 | // Inline code. |
| 136 | 136 | $html = preg_replace_callback( |
| 137 | 137 | '#<code\b[^>]*>(.*?)</code>#is', |
| 138 | 138 | function ($m) { |
| 139 | - $code = html_entity_decode(strip_tags($m[1]), ENT_QUOTES | ENT_HTML5, 'UTF-8'); | |
| 139 | + $code = html_entity_decode(wp_strip_all_tags($m[1]), ENT_QUOTES | ENT_HTML5, 'UTF-8'); | |
| 140 | 140 | return '`' . $code . '`'; |
| 141 | 141 | }, |
| 142 | 142 | $html |
| 143 | 143 | ); |
| @@ -290,9 +290,9 @@ | ||
| 290 | 290 | // Replace block-ish containers with newlines so stripping doesn't mash content. |
| 291 | 291 | $html = preg_replace('#</(?:div|section|article|aside|header|footer|main|nav|figure|figcaption)>#i', "\n", $html); |
| 292 | 292 | $html = preg_replace('#<(?:div|section|article|aside|header|footer|main|nav|figure|figcaption)\b[^>]*>#i', '', $html); |
| 293 | 293 | // Strip remaining tags. |
| 294 | - return strip_tags($html); | |
| 294 | + return strip_tags($html); // phpcs:ignore WordPress.WP.AlternativeFunctions.strip_tags_strip_tags -- wp_strip_all_tags() also strips script/style contents and trims; plain strip_tags() is required | |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
| 298 | 298 | * Convert a <table> block into a pipe-style markdown table. |