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_Util.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\Utils; |
| 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 |