php_xsl.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2016 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. /* $Id$ */
  19. #ifndef PHP_XSL_H
  20. #define PHP_XSL_H
  21. extern zend_module_entry xsl_module_entry;
  22. #define phpext_xsl_ptr &xsl_module_entry
  23. #ifdef ZTS
  24. #include "TSRM.h"
  25. #endif
  26. #include <libxslt/xsltconfig.h>
  27. #include <libxslt/xsltInternals.h>
  28. #include <libxslt/xsltutils.h>
  29. #include <libxslt/transform.h>
  30. #include <libxslt/security.h>
  31. #if HAVE_XSL_EXSLT
  32. #include <libexslt/exslt.h>
  33. #include <libexslt/exsltconfig.h>
  34. #endif
  35. #include "../dom/xml_common.h"
  36. #include "xsl_fe.h"
  37. #include <libxslt/extensions.h>
  38. #include <libxml/xpathInternals.h>
  39. #define XSL_SECPREF_NONE 0
  40. #define XSL_SECPREF_READ_FILE 2
  41. #define XSL_SECPREF_WRITE_FILE 4
  42. #define XSL_SECPREF_CREATE_DIRECTORY 8
  43. #define XSL_SECPREF_READ_NETWORK 16
  44. #define XSL_SECPREF_WRITE_NETWORK 32
  45. /* Default == disable all write access == XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE */
  46. #define XSL_SECPREF_DEFAULT 44
  47. typedef struct _xsl_object {
  48. zend_object std;
  49. void *ptr;
  50. HashTable *prop_handler;
  51. zend_object_handle 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. long securityPrefs;
  60. int securityPrefsSet;
  61. } xsl_object;
  62. void php_xsl_set_object(zval *wrapper, void *obj TSRMLS_DC);
  63. void xsl_objects_free_storage(void *object TSRMLS_DC);
  64. zval *php_xsl_create_object(xsltStylesheetPtr obj, int *found, zval *wrapper_in, zval *return_value TSRMLS_DC);
  65. void xsl_ext_function_string_php(xmlXPathParserContextPtr ctxt, int nargs);
  66. void xsl_ext_function_object_php(xmlXPathParserContextPtr ctxt, int nargs);
  67. #define REGISTER_XSL_CLASS(ce, name, parent_ce, funcs, entry) \
  68. INIT_CLASS_ENTRY(ce, name, funcs); \
  69. ce.create_object = xsl_objects_new; \
  70. entry = zend_register_internal_class_ex(&ce, parent_ce, NULL TSRMLS_CC);
  71. #define XSL_DOMOBJ_NEW(zval, obj, ret) \
  72. if (NULL == (zval = php_xsl_create_object(obj, ret, zval, return_value TSRMLS_CC))) { \
  73. php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object"); \
  74. RETURN_FALSE; \
  75. }
  76. PHP_MINIT_FUNCTION(xsl);
  77. PHP_MSHUTDOWN_FUNCTION(xsl);
  78. PHP_RINIT_FUNCTION(xsl);
  79. PHP_RSHUTDOWN_FUNCTION(xsl);
  80. PHP_MINFO_FUNCTION(xsl);
  81. /*
  82. Declare any global variables you may need between the BEGIN
  83. and END macros here:
  84. ZEND_BEGIN_MODULE_GLOBALS(xsl)
  85. long global_value;
  86. char *global_string;
  87. ZEND_END_MODULE_GLOBALS(xsl)
  88. */
  89. /* In every utility function you add that needs to use variables
  90. in php_xsl_globals, call TSRM_FETCH(); after declaring other
  91. variables used by that function, or better yet, pass in TSRMLS_CC
  92. after the last function argument and declare your utility function
  93. with TSRMLS_DC after the last declared argument. Always refer to
  94. the globals in your function as XSL_G(variable). You are
  95. encouraged to rename these macros something shorter, see
  96. examples in any other php module directory.
  97. */
  98. #ifdef ZTS
  99. #define XSL_G(v) TSRMG(xsl_globals_id, zend_xsl_globals *, v)
  100. #else
  101. #define XSL_G(v) (xsl_globals.v)
  102. #endif
  103. #endif /* PHP_XSL_H */
  104. /*
  105. * Local variables:
  106. * tab-width: 4
  107. * c-basic-offset: 4
  108. * End:
  109. * vim600: noet sw=4 ts=4 fdm=marker
  110. * vim<600: noet sw=4 ts=4
  111. */