I presume that the config.m4 stuff needs to be ported to the config.w32 file, but I don't know the syntax.
Anyway the libtidy in the build machine should also be updated because only the newer versions of it support the tidyOptGetDoc() function.
Nuno
----- Original Message -----
john Mon Apr 25 16:46:17 2005 EDT
Modified files:
/php-src/ext/tidy config.m4 php_tidy.def php_tidy.h tidy.c
Log:
Adding new function tidy_get_opt_doc() to return option documentation at runtime. Thanks to nlopess for the patch
http://cvs.php.net/diff.php/php-src/ext/tidy/config.m4?r1=1.3&r2=1.4&ty=u Index: php-src/ext/tidy/config.m4 diff -u php-src/ext/tidy/config.m4:1.3 php-src/ext/tidy/config.m4:1.4 --- php-src/ext/tidy/config.m4:1.3 Thu Dec 18 14:59:58 2003 +++ php-src/ext/tidy/config.m4 Mon Apr 25 16:46:16 2005 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.3 2003/12/18 19:59:58 sniper Exp $ +dnl $Id: config.m4,v 1.4 2005/04/25 20:46:16 john Exp $ dnl
PHP_ARG_WITH(tidy,for TIDY support, @@ -32,6 +32,12 @@ PHP_ADD_LIBRARY_WITH_PATH(tidy, $TIDY_LIBDIR, TIDY_SHARED_LIBADD) PHP_ADD_INCLUDE($TIDY_INCDIR)
+ PHP_CHECK_LIBRARY(tidy,tidyOptGetDoc,
+ [
+ AC_DEFINE(HAVE_TIDYOPTGETDOC,1,[ ])
+ ],[],[])
+
+
PHP_NEW_EXTENSION(tidy, tidy.c, $ext_shared)
PHP_SUBST(TIDY_SHARED_LIBADD)
AC_DEFINE(HAVE_TIDY,1,[ ])
http://cvs.php.net/diff.php/php-src/ext/tidy/php_tidy.def?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/tidy/php_tidy.def
diff -u php-src/ext/tidy/php_tidy.def:1.1 php-src/ext/tidy/php_tidy.def:1.2
--- php-src/ext/tidy/php_tidy.def:1.1 Mon Mar 22 18:07:55 2004
+++ php-src/ext/tidy/php_tidy.def Mon Apr 25 16:46:16 2005
@@ -45,6 +45,7 @@
tidyOptGetDefault
tidyOptGetDefaultInt
tidyOptGetDefaultBool
+tidyOptGetDoc
tidyOptGetPickList
tidyOptGetNextPick
tidyOptGetValue
http://cvs.php.net/diff.php/php-src/ext/tidy/php_tidy.h?r1=1.24&r2=1.25&ty=u
Index: php-src/ext/tidy/php_tidy.h
diff -u php-src/ext/tidy/php_tidy.h:1.24 php-src/ext/tidy/php_tidy.h:1.25
--- php-src/ext/tidy/php_tidy.h:1.24 Tue Feb 8 00:25:48 2005
+++ php-src/ext/tidy/php_tidy.h Mon Apr 25 16:46:16 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_tidy.h,v 1.24 2005/02/08 05:25:48 rasmus Exp $ */ +/* $Id: php_tidy.h,v 1.25 2005/04/25 20:46:16 john Exp $ */
#ifndef PHP_TIDY_H #define PHP_TIDY_H @@ -57,6 +57,9 @@ PHP_FUNCTION(tidy_get_config); PHP_FUNCTION(tidy_get_status); PHP_FUNCTION(tidy_get_html_ver); +#if HAVE_TIDYOPTGETDOC +PHP_FUNCTION(tidy_get_opt_doc); +#endif PHP_FUNCTION(tidy_is_xhtml); PHP_FUNCTION(tidy_is_xml); PHP_FUNCTION(tidy_error_count); http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.64&r2=1.65&ty=u Index: php-src/ext/tidy/tidy.c diff -u php-src/ext/tidy/tidy.c:1.64 php-src/ext/tidy/tidy.c:1.65 --- php-src/ext/tidy/tidy.c:1.64 Sun Mar 20 22:54:29 2005 +++ php-src/ext/tidy/tidy.c Mon Apr 25 16:46:16 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */
-/* $Id: tidy.c,v 1.64 2005/03/21 03:54:29 john Exp $ */ +/* $Id: tidy.c,v 1.65 2005/04/25 20:46:16 john Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -245,6 +245,9 @@
PHP_FE(tidy_warning_count, NULL)
PHP_FE(tidy_access_count, NULL)
PHP_FE(tidy_config_count, NULL)
+#if HAVE_TIDYOPTGETDOC
+ PHP_FE(tidy_get_opt_doc, NULL)
+#endif
PHP_FE(tidy_get_root, NULL)
PHP_FE(tidy_get_head, NULL)
PHP_FE(tidy_get_html, NULL)
@@ -265,6 +268,9 @@
TIDY_METHOD_MAP(getConfig, tidy_get_config, NULL)
TIDY_METHOD_MAP(getStatus, tidy_get_status, NULL)
TIDY_METHOD_MAP(getHtmlVer, tidy_get_html_ver, NULL)
+#if HAVE_TIDYOPTGETDOC
+ TIDY_METHOD_MAP(getOptDoc, tidy_get_opt_doc, NULL)
+#endif
TIDY_METHOD_MAP(isXhtml, tidy_is_xhtml, NULL)
TIDY_METHOD_MAP(isXml, tidy_is_xml, NULL)
TIDY_METHOD_MAP(root, tidy_get_root, NULL)
@@ -956,7 +962,7 @@
php_info_print_table_start();
php_info_print_table_header(2, "Tidy support", "enabled");
php_info_print_table_row(2, "libTidy Release", (char *)tidyReleaseDate());
- php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.64 2005/03/21 03:54:29 john Exp $)");
+ php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.65 2005/04/25 20:46:16 john Exp $)");
php_info_print_table_end();
DISPLAY_INI_ENTRIES(); @@ -1169,6 +1175,47 @@ } /* }}} */
+
+#if HAVE_TIDYOPTGETDOC
+/* {{{ proto string tidy_get_opt_doc(tidy resource, string optname)
+ Returns the documentation for the given option name */
+PHP_FUNCTION(tidy_get_opt_doc)
+{
+ PHPTidyObj *obj;
+ char *optname, *optval;
+ int optname_len;
+ TidyOption opt;
+
+ TIDY_SET_CONTEXT;
+
+ if (object) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &optname, &optname_len) == FAILURE) {
+ RETURN_FALSE;
+ }
+ } else {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, NULL, "Os", &object, tidy_ce_doc, &optname, &optname_len) == FAILURE) {
+ RETURN_FALSE;
+ }
+ }
+
+ obj = (PHPTidyObj *) zend_object_store_get_object(object TSRMLS_CC);
+
+ opt = tidyGetOptionByName(obj->ptdoc->doc, optname);
+
+ if (!opt) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown Tidy Configuration Option '%s'", optname);
+ RETURN_FALSE;
+ }
+
+ if (optval = (char *) tidyOptGetDoc(obj->ptdoc->doc, opt))
+ RETURN_STRING(optval, 1);
+
+ RETURN_FALSE;
+}
+/* }}} */
+#endif
+
+
/* {{{ proto array tidy_get_config()
Get current Tidy configuarion */
PHP_FUNCTION(tidy_get_config)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php