| 1 |
<?php |
| 2 |
namespace Averta\WordPress\Utility; |
| 3 |
|
| 4 |
|
| 5 |
class Escape |
| 6 |
{ |
| 7 |
/** |
| 8 |
* Escape HTML. |
| 9 |
* |
| 10 |
* @param string $input |
| 11 |
* |
| 12 |
* @return string |
| 13 |
*/ |
| 14 |
public static function html( $input ) |
| 15 |
{ |
| 16 |
return esc_html( $input ); |
| 17 |
} |
| 18 |
|
| 19 |
/** |
| 20 |
* Escape Attribute. |
| 21 |
* |
| 22 |
* @param string $input |
| 23 |
* |
| 24 |
* @return string |
| 25 |
*/ |
| 26 |
public static function attribute( $input ) |
| 27 |
{ |
| 28 |
return esc_attr( $input ); |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* Escape URL. |
| 33 |
* |
| 34 |
* @param string $input |
| 35 |
* |
| 36 |
* @return string |
| 37 |
*/ |
| 38 |
public static function url( $input ) |
| 39 |
{ |
| 40 |
return esc_url( $input ); |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* Escape SQL. |
| 45 |
* |
| 46 |
* @param string $input |
| 47 |
* |
| 48 |
* @return string |
| 49 |
*/ |
| 50 |
public static function sql( $input ) |
| 51 |
{ |
| 52 |
return esc_sql( $input ); |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Escape Inline Javascript. |
| 57 |
* |
| 58 |
* @param string $input |
| 59 |
* |
| 60 |
* @return string |
| 61 |
*/ |
| 62 |
public static function js( $input ) |
| 63 |
{ |
| 64 |
return esc_js( $input ); |
| 65 |
} |
| 66 |
|
| 67 |
/** |
| 68 |
* Escape Inline Javascript. |
| 69 |
* |
| 70 |
* @param string $input |
| 71 |
* |
| 72 |
* @return string |
| 73 |
*/ |
| 74 |
public static function textarea( $input ) |
| 75 |
{ |
| 76 |
return esc_textarea( $input ); |
| 77 |
} |
| 78 |
|
| 79 |
/** |
| 80 |
* Escape post content. |
| 81 |
* |
| 82 |
* @param string $input |
| 83 |
* |
| 84 |
* @return string |
| 85 |
*/ |
| 86 |
public static function content( $input ) |
| 87 |
{ |
| 88 |
return wp_kses_post( $input ); |
| 89 |
} |
| 90 |
|
| 91 |
} |
| 92 |
|