Conditions | 1 |
Paths | 1 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
29 | public static function sanitize_an( $string, $length ) { |
||
30 | /** |
||
31 | * Remove HTML tags. |
||
32 | * |
||
33 | * @link https://stackoverflow.com/questions/5732758/detect-html-tags-in-a-string |
||
34 | */ |
||
35 | |||
36 | // phpcs:ignore WordPress.WP.AlternativeFunctions.strip_tags_strip_tags -- We don't want the `trim` in `wp_strip_all_tags`. |
||
37 | $sanitized = \strip_tags( $string ); |
||
38 | |||
39 | $sanitized = \mb_substr( $sanitized, 0, $length ); |
||
40 | |||
41 | return $sanitized; |
||
42 | } |
||
43 | } |
||
44 |