spoofchecker.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. | https://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. #ifdef HAVE_CONFIG_H
  15. #include "config.h"
  16. #endif
  17. #include "spoofchecker_class.h"
  18. #include "spoofchecker.h"
  19. #include <unicode/uspoof.h>
  20. /* {{{ spoofchecker_register_constants
  21. * Register constants
  22. */
  23. void spoofchecker_register_constants(INIT_FUNC_ARGS)
  24. {
  25. if (!Spoofchecker_ce_ptr)
  26. {
  27. zend_error(E_ERROR, "Spoofchecker class not defined");
  28. return;
  29. }
  30. #define SPOOFCHECKER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long(Spoofchecker_ce_ptr, ZEND_STRS( #x ) - 1, USPOOF_##x);
  31. SPOOFCHECKER_EXPOSE_CLASS_CONST(SINGLE_SCRIPT_CONFUSABLE)
  32. SPOOFCHECKER_EXPOSE_CLASS_CONST(MIXED_SCRIPT_CONFUSABLE)
  33. SPOOFCHECKER_EXPOSE_CLASS_CONST(WHOLE_SCRIPT_CONFUSABLE)
  34. SPOOFCHECKER_EXPOSE_CLASS_CONST(ANY_CASE)
  35. SPOOFCHECKER_EXPOSE_CLASS_CONST(SINGLE_SCRIPT)
  36. SPOOFCHECKER_EXPOSE_CLASS_CONST(INVISIBLE)
  37. SPOOFCHECKER_EXPOSE_CLASS_CONST(CHAR_LIMIT)
  38. #if U_ICU_VERSION_MAJOR_NUM >= 58
  39. SPOOFCHECKER_EXPOSE_CLASS_CONST(ASCII)
  40. SPOOFCHECKER_EXPOSE_CLASS_CONST(HIGHLY_RESTRICTIVE)
  41. SPOOFCHECKER_EXPOSE_CLASS_CONST(MODERATELY_RESTRICTIVE)
  42. SPOOFCHECKER_EXPOSE_CLASS_CONST(MINIMALLY_RESTRICTIVE)
  43. SPOOFCHECKER_EXPOSE_CLASS_CONST(UNRESTRICTIVE)
  44. SPOOFCHECKER_EXPOSE_CLASS_CONST(SINGLE_SCRIPT_RESTRICTIVE)
  45. #endif
  46. #undef SPOOFCHECKER_EXPOSE_CLASS_CONST
  47. }
  48. /* }}} */