1 /* 2 +----------------------------------------------------------------------+ 3 | Copyright (c) The PHP Group | 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 | https://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 | Author: | 14 +----------------------------------------------------------------------+ 15 */ 16 17 #ifndef PHP_XSL_H 18 #define PHP_XSL_H 19 20 extern zend_module_entry xsl_module_entry; 21 #define phpext_xsl_ptr &xsl_module_entry 22 23 #include "php_version.h" 24 #define PHP_XSL_VERSION PHP_VERSION 25 26 #ifdef ZTS 27 #include "TSRM.h" 28 #endif 29 30 #include <libxslt/xsltconfig.h> 31 #include <libxslt/xsltInternals.h> 32 #include <libxslt/xsltutils.h> 33 #include <libxslt/transform.h> 34 #include <libxslt/security.h> 35 #ifdef HAVE_XSL_EXSLT 36 #include <libexslt/exslt.h> 37 #include <libexslt/exsltconfig.h> 38 #endif 39 40 #include "ext/dom/xml_common.h" 41 #include "ext/dom/xpath_callbacks.h" 42 43 #include <libxslt/extensions.h> 44 #include <libxml/xpathInternals.h> 45 46 #define XSL_SECPREF_NONE 0 47 #define XSL_SECPREF_READ_FILE 2 48 #define XSL_SECPREF_WRITE_FILE 4 49 #define XSL_SECPREF_CREATE_DIRECTORY 8 50 #define XSL_SECPREF_READ_NETWORK 16 51 #define XSL_SECPREF_WRITE_NETWORK 32 52 /* Default == disable all write access */ 53 #define XSL_SECPREF_DEFAULT (XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE) 54 55 typedef struct xsl_object { 56 void *ptr; 57 HashTable *parameter; 58 bool hasKeys; 59 php_libxml_ref_obj *sheet_ref_obj; 60 zend_long securityPrefs; 61 php_dom_xpath_callbacks xpath_callbacks; 62 php_libxml_node_object *doc; 63 zend_string *profiling; 64 zend_object std; 65 } xsl_object; 66 php_xsl_fetch_object(zend_object * obj)67static inline xsl_object *php_xsl_fetch_object(zend_object *obj) { 68 return (xsl_object *)((char*)(obj) - XtOffsetOf(xsl_object, std)); 69 } 70 71 #define Z_XSL_P(zv) php_xsl_fetch_object(Z_OBJ_P((zv))) 72 73 void php_xsl_set_object(zval *wrapper, void *obj); 74 void xsl_free_sheet(xsl_object *intern); 75 void xsl_objects_free_storage(zend_object *object); 76 77 void xsl_ext_function_string_php(xmlXPathParserContextPtr ctxt, int nargs); 78 void xsl_ext_function_object_php(xmlXPathParserContextPtr ctxt, int nargs); 79 80 zval *xsl_prop_max_template_depth(zend_object *object); 81 zval *xsl_prop_max_template_vars(zend_object *object); 82 83 PHP_MINIT_FUNCTION(xsl); 84 PHP_MSHUTDOWN_FUNCTION(xsl); 85 PHP_RINIT_FUNCTION(xsl); 86 PHP_RSHUTDOWN_FUNCTION(xsl); 87 PHP_MINFO_FUNCTION(xsl); 88 89 #endif /* PHP_XSL_H */ 90