]> granicus.if.org Git - php/commitdiff
linked with libexpat. it's necessary to use sablot-0.50. added xslt_set_encoding...
authorRui Hirokawa <hirokawa@php.net>
Sat, 6 Jan 2001 08:37:00 +0000 (08:37 +0000)
committerRui Hirokawa <hirokawa@php.net>
Sat, 6 Jan 2001 08:37:00 +0000 (08:37 +0000)
ext/sablot/config.m4
ext/sablot/php_sablot.h
ext/sablot/sablot.c

index 665d3015ec4dcdb0e4761cf3e784591029e4dfdb..038dad7563ecff4f820d076fdabeca5300610f3e 100644 (file)
@@ -26,8 +26,15 @@ if test "$PHP_SABLOT" != "no"; then
 
   PHP_SUBST(SABLOT_SHARED_LIBADD)
   AC_ADD_LIBRARY_WITH_PATH(sablot, $SABLOT_DIR/lib, SABLOT_SHARED_LIBADD)
-  AC_ADD_LIBRARY(xmlparse)
-  AC_ADD_LIBRARY(xmltok)
+
+  if test -f $SABLOT_DIR/lib/libexpat.a -o -f $SABLOT_DIR/lib/libexpat.so ; then
+       AC_ADD_LIBRARY(expat)
+       AC_CHECK_LIB(sablot, SablotSetEncoding,
+               AC_DEFINE(HAVE_SABLOT_SET_ENCODING,1,[ ]))
+  else
+       AC_ADD_LIBRARY(xmlparse)
+       AC_ADD_LIBRARY(xmltok)
+  fi
   
   AC_DEFINE(HAVE_SABLOT,1,[ ])
 
index 79f9566b13eac62b2a837b9c277841f79208c3df..6e1d1f3007e899bbf9b857543b51a4e3f765de89 100644 (file)
@@ -53,6 +53,9 @@ PHP_FUNCTION(xslt_create);
 PHP_FUNCTION(xslt_run);
 PHP_FUNCTION(xslt_set_sax_handler);
 PHP_FUNCTION(xslt_set_error_handler);
+#ifdef HAVE_SABLOT_SET_ENCODING
+PHP_FUNCTION(xslt_set_encoding);
+#endif
 PHP_FUNCTION(xslt_fetch_result);
 PHP_FUNCTION(xslt_free);
 
index e0f1c6ae280eb32c33056ff08ebac409f8032901..5e607b3827064c2340ee597bf6e3230e409053a9 100644 (file)
@@ -150,6 +150,9 @@ function_entry sablot_functions[] = {
     PHP_FE(xslt_closelog,                 NULL)
     PHP_FE(xslt_set_sax_handler,          NULL)
     PHP_FE(xslt_set_error_handler,        NULL)
+#ifdef HAVE_SABLOT_SET_ENCODING
+    PHP_FE(xslt_set_encoding,             NULL)
+#endif
     PHP_FE(xslt_free,                     NULL)
     PHP_FE(xslt_error,                    NULL)
     PHP_FE(xslt_errno,                    NULL)
@@ -976,6 +979,33 @@ static void _php_sablot_handler_pair(php_sablot *handle, zval **first_func, zval
 }
 /* }}} */
 
+#ifdef HAVE_SABLOT_SET_ENCODING
+/* {{{ proto void xslt_set_encoding(resource xh, string encoding)
+   Sets output encoding to be used for Sablotron regardless of the 
+   encoding specified by the stylesheet. To unset, call with 
+   encoding_ NULL. */
+PHP_FUNCTION(xslt_set_encoding)
+{
+    zval **xh, **encoding;
+    php_sablot *handle;
+    int ret      = 0, 
+        loglevel = 0, 
+        argc     = ZEND_NUM_ARGS();
+    SABLOTLS_FETCH();
+    
+    if (argc != 2  ||
+        zend_get_parameters_ex(argc, &xh, &encoding) == FAILURE) {
+        WRONG_PARAM_COUNT;
+    }
+    ZEND_FETCH_RESOURCE(handle, php_sablot *, xh, -1, "PHP-Sablotron", le_sablot);
+    convert_to_string_ex(encoding);
+    
+    SablotSetEncoding(handle->p, (char *)Z_STRVAL_PP(encoding));
+
+}
+/* }}} */
+#endif
+
 /* {{{ _php_sablot_call_handler_function()
    Call a sablot call handler function, wrapper for call_user_function() */
 static void _php_sablot_call_handler_function(zval *handlerName, int argc, zval **args, char *function_name)