php_xsl.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 7 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2018 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Author: |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifndef PHP_XSL_H
  19. #define PHP_XSL_H
  20. extern zend_module_entry xsl_module_entry;
  21. #define phpext_xsl_ptr &xsl_module_entry
  22. #include "php_version.h"
  23. #define PHP_XSL_VERSION PHP_VERSION
  24. #ifdef ZTS
  25. #include "TSRM.h"
  26. #endif
  27. #include <libxslt/xsltconfig.h>
  28. #include <libxslt/xsltInternals.h>
  29. #include <libxslt/xsltutils.h>
  30. #include <libxslt/transform.h>
  31. #include <libxslt/security.h>
  32. #if HAVE_XSL_EXSLT
  33. #include <libexslt/exslt.h>
  34. #include <libexslt/exsltconfig.h>
  35. #endif
  36. #include "../dom/xml_common.h"
  37. #include "xsl_fe.h"
  38. #include <libxslt/extensions.h>
  39. #include <libxml/xpathInternals.h>
  40. #define XSL_SECPREF_NONE 0
  41. #define XSL_SECPREF_READ_FILE 2
  42. #define XSL_SECPREF_WRITE_FILE 4
  43. #define XSL_SECPREF_CREATE_DIRECTORY 8
  44. #define XSL_SECPREF_READ_NETWORK 16
  45. #define XSL_SECPREF_WRITE_NETWORK 32
  46. /* Default == disable all write access == XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE */
  47. #define XSL_SECPREF_DEFAULT 44
  48. typedef struct _xsl_object {
  49. void *ptr;
  50. HashTable *prop_handler;
  51. zval handle;
  52. HashTable *parameter;
  53. int hasKeys;
  54. int registerPhpFunctions;
  55. HashTable *registered_phpfunctions;
  56. HashTable *node_list;
  57. php_libxml_node_object *doc;
  58. char *profiling;
  59. zend_long securityPrefs;
  60. int securityPrefsSet;
  61. zend_object std;
  62. } xsl_object;
  63. static inline xsl_object *php_xsl_fetch_object(zend_object *obj) {
  64. return (xsl_object *)((char*)(obj) - XtOffsetOf(xsl_object, std));
  65. }
  66. #define Z_XSL_P(zv) php_xsl_fetch_object(Z_OBJ_P((zv)))
  67. void php_xsl_set_object(zval *wrapper, void *obj);
  68. void xsl_objects_free_storage(zend_object *object);
  69. void php_xsl_create_object(xsltStylesheetPtr obj, zval *wrapper_in, zval *return_value );
  70. void xsl_ext_function_string_php(xmlXPathParserContextPtr ctxt, int nargs);
  71. void xsl_ext_function_object_php(xmlXPathParserContextPtr ctxt, int nargs);
  72. #define REGISTER_XSL_CLASS(ce, name, parent_ce, funcs, entry) \
  73. INIT_CLASS_ENTRY(ce, name, funcs); \
  74. ce.create_object = xsl_objects_new; \
  75. entry = zend_register_internal_class_ex(&ce, parent_ce);
  76. #define XSL_DOMOBJ_NEW(zval, obj, ret) \
  77. zval = php_xsl_create_object(obj, ret, zval, return_value); \
  78. if (ZVAL_IS_NULL(zval)) { \
  79. php_error_docref(NULL, E_WARNING, "Cannot create required DOM object"); \
  80. RETURN_FALSE; \
  81. }
  82. PHP_MINIT_FUNCTION(xsl);
  83. PHP_MSHUTDOWN_FUNCTION(xsl);
  84. PHP_RINIT_FUNCTION(xsl);
  85. PHP_RSHUTDOWN_FUNCTION(xsl);
  86. PHP_MINFO_FUNCTION(xsl);
  87. /*
  88. Declare any global variables you may need between the BEGIN
  89. and END macros here:
  90. ZEND_BEGIN_MODULE_GLOBALS(xsl)
  91. long global_value;
  92. char *global_string;
  93. ZEND_END_MODULE_GLOBALS(xsl)
  94. */
  95. #ifdef ZTS
  96. #define XSL_G(v) TSRMG(xsl_globals_id, zend_xsl_globals *, v)
  97. #else
  98. #define XSL_G(v) (xsl_globals.v)
  99. #endif
  100. #endif /* PHP_XSL_H */
  101. /*
  102. * Local variables:
  103. * tab-width: 4
  104. * c-basic-offset: 4
  105. * End:
  106. * vim600: noet sw=4 ts=4 fdm=marker
  107. * vim<600: noet sw=4 ts=4
  108. */