xref: /php-src/ext/standard/html.h (revision ed0f1f04)
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: Rasmus Lerdorf <rasmus@lerdorf.on.ca>                        |
14    +----------------------------------------------------------------------+
15 */
16 
17 #ifndef HTML_H
18 #define HTML_H
19 
20 #define ENT_HTML_QUOTE_NONE			0
21 #define ENT_HTML_QUOTE_SINGLE		1
22 #define ENT_HTML_QUOTE_DOUBLE		2
23 #define ENT_HTML_IGNORE_ERRORS		4
24 #define ENT_HTML_SUBSTITUTE_ERRORS	8
25 #define ENT_HTML_DOC_TYPE_MASK		(16|32)
26 #define ENT_HTML_DOC_HTML401		0
27 #define ENT_HTML_DOC_XML1			16
28 #define ENT_HTML_DOC_XHTML			32
29 #define ENT_HTML_DOC_HTML5			(16|32)
30 /* reserve bit 6 */
31 #define ENT_HTML_SUBSTITUTE_DISALLOWED_CHARS	128
32 
33 #define PHP_HTML_SPECIALCHARS 	0
34 #define PHP_HTML_ENTITIES	 	1
35 
36 #define ENT_COMPAT		ENT_HTML_QUOTE_DOUBLE
37 #define ENT_QUOTES		(ENT_HTML_QUOTE_DOUBLE | ENT_HTML_QUOTE_SINGLE)
38 #define ENT_NOQUOTES	ENT_HTML_QUOTE_NONE
39 #define ENT_IGNORE		ENT_HTML_IGNORE_ERRORS
40 #define ENT_SUBSTITUTE	ENT_HTML_SUBSTITUTE_ERRORS
41 #define ENT_HTML401		0
42 #define ENT_XML1		16
43 #define ENT_XHTML		32
44 #define ENT_HTML5		(16|32)
45 #define ENT_DISALLOWED	128
46 
47 PHPAPI zend_string *php_escape_html_entities(const unsigned char *old, size_t oldlen, int all, int flags, const char *hint_charset);
48 PHPAPI zend_string *php_escape_html_entities_ex(const unsigned char *old, size_t oldlen, int all, int flags, const char *hint_charset, bool double_encode, bool quiet);
49 PHPAPI zend_string *php_unescape_html_entities(zend_string *str, int all, int flags, const char *hint_charset);
50 PHPAPI unsigned int php_next_utf8_char(const unsigned char *str, size_t str_len, size_t *cursor, zend_result *status);
51 
52 #endif /* HTML_H */
53