spoofchecker.c 2.3 KB

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