array-to-csv.php
4 years ago
date-format.php
4 years ago
request.php
4 years ago
security.php
4 years ago
security.php
59 lines
| 1 | <?php |
| 2 | |
| 3 | if (!class_exists('IAWP_Security')) { |
| 4 | class IAWP_Security |
| 5 | { |
| 6 | public static function json_encode($object) |
| 7 | { |
| 8 | return json_encode($object, JSON_HEX_QUOT | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS); |
| 9 | } |
| 10 | |
| 11 | public static function string($string) |
| 12 | { |
| 13 | return sanitize_text_field($string); |
| 14 | } |
| 15 | |
| 16 | public static function hex($hex) |
| 17 | { |
| 18 | return sanitize_hex_color($hex); |
| 19 | } |
| 20 | |
| 21 | public static function html($html) |
| 22 | { |
| 23 | return wp_kses_post($html); |
| 24 | } |
| 25 | |
| 26 | public static function form($html) |
| 27 | { |
| 28 | return wp_kses($html, [ |
| 29 | 'div' => [ |
| 30 | 'class' => [], |
| 31 | ], |
| 32 | 'select' => [ |
| 33 | 'class' => [], |
| 34 | ], |
| 35 | 'option' => [ |
| 36 | 'class' => [], |
| 37 | 'value' => [], |
| 38 | 'data-datatype' => [], |
| 39 | ], |
| 40 | 'input' => [ |
| 41 | 'class' => [], |
| 42 | 'type' => [], |
| 43 | 'data-css' => [], |
| 44 | 'data-dow' => [], |
| 45 | 'data-format' => [], |
| 46 | 'readonly', |
| 47 | ], |
| 48 | 'button' => [ |
| 49 | 'class' => [], |
| 50 | ], |
| 51 | 'span' => [ |
| 52 | 'class' => [], |
| 53 | 'style' => [], |
| 54 | ], |
| 55 | ]); |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 |