-
-
Save graste/56b67490ce5bad4bcf67 to your computer and use it in GitHub Desktop.
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
| // intl/spoofchecker/spoofchecker.c | |
| void spoofchecker_register_constants(INIT_FUNC_ARGS) | |
| { | |
| #define SPOOFCHECKER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long(Spoofchecker_ce_ptr, ZEND_STRS( #x ) - 1, USPOOF_##x); | |
| SPOOFCHECKER_EXPOSE_CLASS_CONST(ASCII) | |
| SPOOFCHECKER_EXPOSE_CLASS_CONST(SINGLE_SCRIPT_RESTRICTIVE) | |
| SPOOFCHECKER_EXPOSE_CLASS_CONST(HIGHLY_RESTRICTIVE) | |
| SPOOFCHECKER_EXPOSE_CLASS_CONST(MODERATELY_RESTRICTIVE) | |
| SPOOFCHECKER_EXPOSE_CLASS_CONST(MINIMALLY_RESTRICTIVE) | |
| SPOOFCHECKER_EXPOSE_CLASS_CONST(UNRESTRICTIVE) | |
| SPOOFCHECKER_EXPOSE_CLASS_CONST(RESTRICTION_LEVEL_MASK) | |
| #undef SPOOFCHECKER_EXPOSE_CLASS_CONST | |
| } | |
| // spoofchecker/spoofchecker_class.c | |
| ZEND_BEGIN_ARG_INFO_EX(spoofchecker_set_restriction_level, 0, 0, 1) | |
| ZEND_ARG_INFO(0, checks) | |
| ZEND_END_ARG_INFO() | |
| zend_function_entry Spoofchecker_class_functions[] = { | |
| PHP_ME(Spoofchecker, __construct, spoofchecker_0_args, | |
| ... | |
| PHP_ME(Spoofchecker, setRestrictionLevel, spoofchecker_set_restriction_level, ZEND_ACC_PUBLIC) | |
| PHP_FE_END | |
| }; | |
| // spoofchecker/spoofchecker_main.h | |
| PHP_METHOD(Spoofchecker, setRestrictionLevel); | |
| // spoofchecker/spoofchecker_main.c | |
| PHP_METHOD(Spoofchecker, setRestrictionLevel) | |
| { | |
| zend_long level; | |
| SPOOFCHECKER_METHOD_INIT_VARS; | |
| if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "l", &level)) { | |
| return; | |
| } | |
| SPOOFCHECKER_METHOD_FETCH_OBJECT; | |
| uspoof_setRestrictionLevel(co->uspoof, level); | |
| } |
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
| $checker = new Spoofchecker; | |
| $checker->setChecks(Spoofchecker::SINGLE_SCRIPT); | |
| var_dump( | |
| true === $checker->isSuspicious("latinதமிழ்") | |
| ); | |
| $checker->setRestrictionLevel(0x40000000); | |
| var_dump( | |
| false === $checker->isSuspicious("latinதமிழ்") | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment