diff options
Diffstat (limited to 'ext/tidy')
| -rw-r--r-- | ext/tidy/config.m4 | 15 | ||||
| -rw-r--r-- | ext/tidy/php_tidy.h | 11 | ||||
| -rw-r--r-- | ext/tidy/tests/005-mb.phpt | 2 | ||||
| -rw-r--r-- | ext/tidy/tests/005.phpt | 2 | ||||
| -rw-r--r-- | ext/tidy/tests/007.phpt | 2 | ||||
| -rw-r--r-- | ext/tidy/tests/013.phpt | 2 | ||||
| -rw-r--r-- | ext/tidy/tests/015.phpt | 2 | ||||
| -rw-r--r-- | ext/tidy/tests/016.phpt | 4 | ||||
| -rw-r--r-- | ext/tidy/tests/027.phpt | 4 | ||||
| -rw-r--r-- | ext/tidy/tidy.c | 65 |
10 files changed, 66 insertions, 43 deletions
diff --git a/ext/tidy/config.m4 b/ext/tidy/config.m4 index ef9aa02195..dab58787d4 100644 --- a/ext/tidy/config.m4 +++ b/ext/tidy/config.m4 @@ -1,7 +1,7 @@ -dnl config.m4 for extension tidy - -PHP_ARG_WITH(tidy,for TIDY support, -[ --with-tidy[=DIR] Include TIDY support]) +PHP_ARG_WITH([tidy], + [for TIDY support], + [AS_HELP_STRING([[--with-tidy[=DIR]]], + [Include TIDY support])]) if test "$PHP_TIDY" != "no"; then @@ -30,10 +30,9 @@ if test "$PHP_TIDY" != "no"; then if test -z "$TIDY_DIR"; then AC_MSG_ERROR(Cannot find libtidy) else - dnl Check for tidybuffio.h (as opposed to simply buffio.h) - dnl which indicates that we are building against tidy-html5 - dnl and not the legacy htmltidy. The two are compatible, - dnl except for with regard to this header file. + dnl Check for tidybuffio.h (as opposed to simply buffio.h) which indicates + dnl that we are building against tidy-html5 and not the legacy htmltidy. The + dnl two are compatible, except for with regard to this header file. if test -f "$TIDY_INCDIR/tidybuffio.h"; then AC_DEFINE(HAVE_TIDYBUFFIO_H,1,[defined if tidybuffio.h exists]) fi diff --git a/ext/tidy/php_tidy.h b/ext/tidy/php_tidy.h index 24605e5ae8..3be6bf4388 100644 --- a/ext/tidy/php_tidy.h +++ b/ext/tidy/php_tidy.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -47,12 +47,3 @@ ZEND_TSRMLS_CACHE_EXTERN() #endif #endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/ext/tidy/tests/005-mb.phpt b/ext/tidy/tests/005-mb.phpt index d19104ab29..c7b8e20676 100644 --- a/ext/tidy/tests/005-mb.phpt +++ b/ext/tidy/tests/005-mb.phpt @@ -4,7 +4,7 @@ tidy_parse_file() <?php if (!extension_loaded("tidy")) print "skip"; ?> --FILE-- <?php - $a = tidy_parse_file(dirname(__FILE__)."/005私はガラスを食べられます.html"); + $a = tidy_parse_file(__DIR__."/005私はガラスを食べられます.html"); echo tidy_get_output($a); ?> diff --git a/ext/tidy/tests/005.phpt b/ext/tidy/tests/005.phpt index ea4aab3125..49b0a2ad4d 100644 --- a/ext/tidy/tests/005.phpt +++ b/ext/tidy/tests/005.phpt @@ -4,7 +4,7 @@ tidy_parse_file() <?php if (!extension_loaded("tidy")) print "skip"; ?> --FILE-- <?php - $a = tidy_parse_file(dirname(__FILE__)."/005.html"); + $a = tidy_parse_file(__DIR__."/005.html"); echo tidy_get_output($a); ?> diff --git a/ext/tidy/tests/007.phpt b/ext/tidy/tests/007.phpt index f6bb13d556..bae8918625 100644 --- a/ext/tidy/tests/007.phpt +++ b/ext/tidy/tests/007.phpt @@ -6,7 +6,7 @@ Verbose tidy_getopt() tidy.default_config= --FILE-- <?php - $a = new tidy(dirname(__FILE__)."/007.html"); + $a = new tidy(__DIR__."/007.html"); echo "Current Value of 'tidy-mark': "; var_dump($a->getopt("tidy-mark")); echo "Current Value of 'error-file': "; diff --git a/ext/tidy/tests/013.phpt b/ext/tidy/tests/013.phpt index 8f1ac94ef4..a43a88d585 100644 --- a/ext/tidy/tests/013.phpt +++ b/ext/tidy/tests/013.phpt @@ -4,7 +4,7 @@ Parsing a file using constructor <?php if (!extension_loaded("tidy")) print "skip"; ?> --FILE-- <?php - $tidy = new tidy(dirname(__FILE__)."/013.html", array("show-body-only"=>true)); + $tidy = new tidy(__DIR__."/013.html", array("show-body-only"=>true)); $tidy->cleanRepair(); echo $tidy; diff --git a/ext/tidy/tests/015.phpt b/ext/tidy/tests/015.phpt index 5b8255c52b..c5bc1dc4d3 100644 --- a/ext/tidy/tests/015.phpt +++ b/ext/tidy/tests/015.phpt @@ -4,7 +4,7 @@ Passing configuration options through tidy_parse_file(). <?php if (!extension_loaded("tidy")) print "skip"; ?> --FILE-- <?php - $tidy = tidy_parse_file(dirname(__FILE__)."/015.html", array('show-body-only'=>true)); + $tidy = tidy_parse_file(__DIR__."/015.html", array('show-body-only'=>true)); tidy_clean_repair($tidy); echo tidy_get_output($tidy); diff --git a/ext/tidy/tests/016.phpt b/ext/tidy/tests/016.phpt index 05b7cc18f9..9b9718ec25 100644 --- a/ext/tidy/tests/016.phpt +++ b/ext/tidy/tests/016.phpt @@ -4,8 +4,8 @@ Passing configuration file through tidy_parse_file() (may fail with buggy libtid <?php if (!extension_loaded("tidy")) print "skip"; ?> --FILE-- <?php - $tidy = tidy_parse_file(dirname(__FILE__)."/016.html", - dirname(__FILE__)."/016.tcfg"); + $tidy = tidy_parse_file(__DIR__."/016.html", + __DIR__."/016.tcfg"); $cfg = $tidy->getConfig(); echo $cfg["clean"]; ?> diff --git a/ext/tidy/tests/027.phpt b/ext/tidy/tests/027.phpt index cd984dd9e7..fb26a70f86 100644 --- a/ext/tidy/tests/027.phpt +++ b/ext/tidy/tests/027.phpt @@ -11,7 +11,7 @@ abstract class BaseClass { private static $tidyconfig; public function __construct() { - $this->tidyconfig = array( + self::$tidyconfig = array( 'indent' => false, 'clean' => true, 'merge-divs' => false, @@ -29,7 +29,7 @@ abstract class BaseClass { $data = "awerawer"; // in my code, $data is downloaded from a site $tidy = new tidy; - $tidy->parseString($data, $this->tidyconfig, 'utf8'); + $tidy->parseString($data, self::$tidyconfig, 'utf8'); $tidy->cleanRepair(); return $tidy; diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 0fde23cb11..295ca8d8f0 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -379,17 +379,25 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_config_count, 0, 0, 1) ZEND_ARG_INFO(0, object) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_getopt, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_getopt_method, 0, 0, 1) ZEND_ARG_INFO(0, option) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_tidy_get_root, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_getopt, 0, 0, 2) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, option) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_root, 0, 0, 1) + ZEND_ARG_INFO(0, object) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_tidy_get_html, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_html, 0, 0, 1) + ZEND_ARG_INFO(0, object) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_tidy_get_head, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_head, 0, 0, 1) + ZEND_ARG_INFO(0, object) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_body, 0, 0, 1) @@ -435,7 +443,7 @@ static const zend_function_entry tidy_functions[] = { }; static const zend_function_entry tidy_funcs_doc[] = { - TIDY_METHOD_MAP(getOpt, tidy_getopt, arginfo_tidy_getopt) + TIDY_METHOD_MAP(getOpt, tidy_getopt, arginfo_tidy_getopt_method) TIDY_METHOD_MAP(cleanRepair, tidy_clean_repair, NULL) TIDY_DOC_ME(parseFile, arginfo_tidy_parse_file) TIDY_DOC_ME(parseString, arginfo_tidy_parse_string) @@ -775,7 +783,11 @@ static int tidy_doc_cast_handler(zval *in, zval *out, int type) obj = Z_TIDY_P(in); tidyBufInit(&output); tidySaveBuffer (obj->ptdoc->doc, &output); - ZVAL_STRINGL(out, (char *) output.bp, output.size ? output.size-1 : 0); + if (output.size) { + ZVAL_STRINGL(out, (char *) output.bp, output.size-1); + } else { + ZVAL_EMPTY_STRING(out); + } tidyBufFree(&output); break; @@ -2021,15 +2033,36 @@ static void _php_tidy_register_tags(INIT_FUNC_ARGS) TIDY_TAG_CONST(VAR); TIDY_TAG_CONST(WBR); TIDY_TAG_CONST(XMP); +# if HAVE_TIDYBUFFIO_H + TIDY_TAG_CONST(ARTICLE); + TIDY_TAG_CONST(ASIDE); + TIDY_TAG_CONST(AUDIO); + TIDY_TAG_CONST(BDI); + TIDY_TAG_CONST(CANVAS); + TIDY_TAG_CONST(COMMAND); + TIDY_TAG_CONST(DATALIST); + TIDY_TAG_CONST(DETAILS); + TIDY_TAG_CONST(DIALOG); + TIDY_TAG_CONST(FIGCAPTION); + TIDY_TAG_CONST(FIGURE); + TIDY_TAG_CONST(FOOTER); + TIDY_TAG_CONST(HEADER); + TIDY_TAG_CONST(HGROUP); + TIDY_TAG_CONST(MAIN); + TIDY_TAG_CONST(MARK); + TIDY_TAG_CONST(MENUITEM); + TIDY_TAG_CONST(METER); + TIDY_TAG_CONST(NAV); + TIDY_TAG_CONST(OUTPUT); + TIDY_TAG_CONST(PROGRESS); + TIDY_TAG_CONST(SECTION); + TIDY_TAG_CONST(SOURCE); + TIDY_TAG_CONST(SUMMARY); + TIDY_TAG_CONST(TEMPLATE); + TIDY_TAG_CONST(TIME); + TIDY_TAG_CONST(TRACK); + TIDY_TAG_CONST(VIDEO); +# endif } #endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ |
