|
| 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 | + | [email protected] so we can mail you a copy immediately. | |
| 12 | + +----------------------------------------------------------------------+ |
| 13 | + | Authors: Máté Kocsis <[email protected]> | |
| 14 | + +----------------------------------------------------------------------+ |
| 15 | +*/ |
| 16 | + |
| 17 | +#ifdef HAVE_CONFIG_H |
| 18 | +# include <config.h> |
| 19 | +#endif |
| 20 | + |
| 21 | +#include "php.h" |
| 22 | +#include "Zend/zend_interfaces.h" |
| 23 | +#include "Zend/zend_exceptions.h" |
| 24 | +#include "Zend/zend_attributes.h" |
| 25 | +#include "main/php_ini.h" |
| 26 | +#include "ext/standard/info.h" |
| 27 | + |
| 28 | +#include "php_uri.h" |
| 29 | +#include "php_uri_arginfo.h" |
| 30 | +#include "uriparser/src/UriConfig.h" |
| 31 | + |
| 32 | +zend_class_entry *uri_exception_ce; |
| 33 | +zend_class_entry *invalid_uri_exception_ce; |
| 34 | +zend_class_entry *whatwg_invalid_url_exception_ce; |
| 35 | + |
| 36 | +#define URIPARSER_VERSION PACKAGE_VERSION |
| 37 | + |
| 38 | +static const zend_module_dep uri_deps[] = { |
| 39 | + ZEND_MOD_REQUIRED("lexbor") |
| 40 | + ZEND_MOD_END |
| 41 | +}; |
| 42 | + |
| 43 | + |
| 44 | +static PHP_MINIT_FUNCTION(uri) |
| 45 | +{ |
| 46 | + uri_exception_ce = register_class_Uri_UriException(zend_ce_exception); |
| 47 | + invalid_uri_exception_ce = register_class_Uri_InvalidUriException(uri_exception_ce); |
| 48 | + whatwg_invalid_url_exception_ce = register_class_Uri_WhatWg_InvalidUrlException(invalid_uri_exception_ce); |
| 49 | + |
| 50 | + return SUCCESS; |
| 51 | +} |
| 52 | + |
| 53 | +static PHP_MINFO_FUNCTION(uri) |
| 54 | +{ |
| 55 | + php_info_print_table_start(); |
| 56 | + php_info_print_table_row(2, "uri support", "active"); |
| 57 | + php_info_print_table_row(2, "uriparser library version", URIPARSER_VERSION); |
| 58 | + php_info_print_table_end(); |
| 59 | +} |
| 60 | + |
| 61 | +static PHP_MSHUTDOWN_FUNCTION(uri) |
| 62 | +{ |
| 63 | + |
| 64 | + return SUCCESS; |
| 65 | +} |
| 66 | + |
| 67 | +PHP_RINIT_FUNCTION(uri) |
| 68 | +{ |
| 69 | + |
| 70 | + return SUCCESS; |
| 71 | +} |
| 72 | + |
| 73 | +PHP_RSHUTDOWN_FUNCTION(uri) |
| 74 | +{ |
| 75 | + return SUCCESS; |
| 76 | +} |
| 77 | + |
| 78 | +zend_module_entry uri_module_entry = { |
| 79 | + STANDARD_MODULE_HEADER_EX, NULL, |
| 80 | + uri_deps, |
| 81 | + "uri", /* Extension name */ |
| 82 | + NULL, /* zend_function_entry */ |
| 83 | + PHP_MINIT(uri), /* PHP_MINIT - Module initialization */ |
| 84 | + PHP_MSHUTDOWN(uri), /* PHP_MSHUTDOWN - Module shutdown */ |
| 85 | + PHP_RINIT(uri), /* PHP_RINIT - Request initialization */ |
| 86 | + PHP_RSHUTDOWN(uri), /* PHP_RSHUTDOWN - Request shutdown */ |
| 87 | + PHP_MINFO(uri), /* PHP_MINFO - Module info */ |
| 88 | + PHP_VERSION, /* Version */ |
| 89 | + STANDARD_MODULE_PROPERTIES |
| 90 | +}; |
0 commit comments