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