array_to_csv.php
3 years ago
date_format.php
3 years ago
exact_range.php
3 years ago
number_formatter.php
3 years ago
relative_range.php
3 years ago
request.php
3 years ago
salt.php
3 years ago
security.php
3 years ago
singleton.php
3 years ago
string.php
3 years ago
timezone.php
3 years ago
url.php
3 years ago
wp-async-request.php
3 years ago
security.php
64 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP; |
| 4 | |
| 5 | class Security |
| 6 | { |
| 7 | public static function json_encode($object) |
| 8 | { |
| 9 | return json_encode($object, JSON_HEX_QUOT | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS); |
| 10 | } |
| 11 | |
| 12 | public static function string($string) |
| 13 | { |
| 14 | return sanitize_text_field($string); |
| 15 | } |
| 16 | |
| 17 | public static function attr($att) |
| 18 | { |
| 19 | return esc_attr($att); |
| 20 | } |
| 21 | |
| 22 | public static function hex($hex) |
| 23 | { |
| 24 | return sanitize_hex_color($hex); |
| 25 | } |
| 26 | |
| 27 | public static function html($html) |
| 28 | { |
| 29 | return wp_kses_post($html); |
| 30 | } |
| 31 | |
| 32 | public static function form($html) |
| 33 | { |
| 34 | return wp_kses($html, [ |
| 35 | 'div' => [ |
| 36 | 'class' => [], |
| 37 | ], |
| 38 | 'select' => [ |
| 39 | 'class' => [], |
| 40 | ], |
| 41 | 'option' => [ |
| 42 | 'class' => [], |
| 43 | 'value' => [], |
| 44 | 'data-datatype' => [], |
| 45 | ], |
| 46 | 'input' => [ |
| 47 | 'class' => [], |
| 48 | 'type' => [], |
| 49 | 'data-css' => [], |
| 50 | 'data-dow' => [], |
| 51 | 'data-format' => [], |
| 52 | 'readonly', |
| 53 | ], |
| 54 | 'button' => [ |
| 55 | 'class' => [], |
| 56 | ], |
| 57 | 'span' => [ |
| 58 | 'class' => [], |
| 59 | 'style' => [], |
| 60 | ], |
| 61 | ]); |
| 62 | } |
| 63 | } |
| 64 |