spoofchecker_create.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  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 "php_intl.h"
  20. #include "spoofchecker_class.h"
  21. #include "spoofchecker_create.h"
  22. #include "intl_data.h"
  23. /* {{{ proto Spoofchecker Spoofchecker::__construct()
  24. * Spoofchecker object constructor.
  25. */
  26. PHP_METHOD(Spoofchecker, __construct)
  27. {
  28. int checks;
  29. SPOOFCHECKER_METHOD_INIT_VARS;
  30. if (zend_parse_parameters_none() == FAILURE) {
  31. return;
  32. }
  33. SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK;
  34. co->uspoof = uspoof_open(SPOOFCHECKER_ERROR_CODE_P(co));
  35. INTL_CTOR_CHECK_STATUS(co, "spoofchecker: unable to open ICU Spoof Checker");
  36. /* Single-script enforcement is on by default. This fails for languages
  37. like Japanese that legally use multiple scripts within a single word,
  38. so we turn it off.
  39. */
  40. checks = uspoof_getChecks(co->uspoof, SPOOFCHECKER_ERROR_CODE_P(co));
  41. uspoof_setChecks(co->uspoof, checks & ~USPOOF_SINGLE_SCRIPT, SPOOFCHECKER_ERROR_CODE_P(co));
  42. }
  43. /* }}} */
  44. /*
  45. * Local variables:
  46. * tab-width: 4
  47. * c-basic-offset: 4
  48. * End:
  49. * vim600: noet sw=4 ts=4 fdm=marker
  50. * vim<600: noet sw=4 ts=4
  51. */