1 /* 2 +----------------------------------------------------------------------+ 3 | This source file is subject to version 3.01 of the PHP license, | 4 | that is bundled with this package in the file LICENSE, and is | 5 | available through the world-wide-web at the following url: | 6 | http://www.php.net/license/3_01.txt | 7 | If you did not receive a copy of the PHP license and are unable to | 8 | obtain it through the world-wide-web, please send a note to | 9 | license@php.net so we can mail you a copy immediately. | 10 +----------------------------------------------------------------------+ 11 | Authors: Scott MacVicar <scottmac@php.net> | 12 +----------------------------------------------------------------------+ 13 */ 14 15 #ifdef HAVE_CONFIG_H 16 #include "config.h" 17 #endif 18 19 #include "spoofchecker_class.h" 20 #include "spoofchecker.h" 21 22 #include <unicode/uspoof.h> 23 24 25 /* {{{ spoofchecker_register_constants 26 * Register constants 27 */ spoofchecker_register_constants(INIT_FUNC_ARGS)28void spoofchecker_register_constants(INIT_FUNC_ARGS) 29 { 30 if (!Spoofchecker_ce_ptr) 31 { 32 zend_error(E_ERROR, "Spoofchecker class not defined"); 33 return; 34 } 35 36 #define SPOOFCHECKER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long(Spoofchecker_ce_ptr, ZEND_STRS( #x ) - 1, USPOOF_##x); 37 38 SPOOFCHECKER_EXPOSE_CLASS_CONST(SINGLE_SCRIPT_CONFUSABLE) 39 SPOOFCHECKER_EXPOSE_CLASS_CONST(MIXED_SCRIPT_CONFUSABLE) 40 SPOOFCHECKER_EXPOSE_CLASS_CONST(WHOLE_SCRIPT_CONFUSABLE) 41 SPOOFCHECKER_EXPOSE_CLASS_CONST(ANY_CASE) 42 SPOOFCHECKER_EXPOSE_CLASS_CONST(SINGLE_SCRIPT) 43 SPOOFCHECKER_EXPOSE_CLASS_CONST(INVISIBLE) 44 SPOOFCHECKER_EXPOSE_CLASS_CONST(CHAR_LIMIT) 45 46 #if U_ICU_VERSION_MAJOR_NUM >= 58 47 SPOOFCHECKER_EXPOSE_CLASS_CONST(ASCII) 48 SPOOFCHECKER_EXPOSE_CLASS_CONST(HIGHLY_RESTRICTIVE) 49 SPOOFCHECKER_EXPOSE_CLASS_CONST(MODERATELY_RESTRICTIVE) 50 SPOOFCHECKER_EXPOSE_CLASS_CONST(MINIMALLY_RESTRICTIVE) 51 SPOOFCHECKER_EXPOSE_CLASS_CONST(UNRESTRICTIVE) 52 SPOOFCHECKER_EXPOSE_CLASS_CONST(SINGLE_SCRIPT_RESTRICTIVE) 53 #endif 54 55 #undef SPOOFCHECKER_EXPOSE_CLASS_CONST 56 } 57 /* }}} */ 58