Last active
March 11, 2016 18:11
-
-
Save lenivene/31f503464d1d4d53f8e6 to your computer and use it in GitHub Desktop.
Escaping variables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* I used on a project. | |
* Author: Lenivene Bezerra | |
*/ | |
function esc_var( $t ){ | |
$e = 'UTF-8'; | |
return mb_convert_encoding( htmlentities( $t, ENT_QUOTES, $e ), $e, $e ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* I used on a project. | |
* Author: Lenivene Bezerra | |
*/ | |
function esc_var( $text ){ | |
$safe_text = mb_convert_encoding( $text, 'UTF-8', 'UTF-8' ); | |
$safe_text = htmlentities( $safe_text, ENT_QUOTES, 'UTF-8' ); | |
return $safe_text; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment