2121
2222#include "php.h"
2323#include "php_xsl.h"
24+ #include "xsltprocessor_arginfo.h"
2425#include "ext/libxml/php_libxml.h"
2526
26- /* {{{ arginfo */
27- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_import_stylesheet , 0 , 0 , 1 )
28- ZEND_ARG_INFO (0 , doc )
29- ZEND_END_ARG_INFO ();
30-
31- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_transform_to_doc , 0 , 0 , 1 )
32- ZEND_ARG_INFO (0 , doc )
33- ZEND_END_ARG_INFO ();
34-
35- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_transform_to_uri , 0 , 0 , 2 )
36- ZEND_ARG_INFO (0 , doc )
37- ZEND_ARG_INFO (0 , uri )
38- ZEND_END_ARG_INFO ();
39-
40- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_transform_to_xml , 0 , 0 , 1 )
41- ZEND_ARG_INFO (0 , doc )
42- ZEND_END_ARG_INFO ();
43-
44- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_set_parameter , 0 , 0 , 2 )
45- ZEND_ARG_INFO (0 , namespace )
46- ZEND_ARG_INFO (0 , name )
47- ZEND_ARG_INFO (0 , value )
48- ZEND_END_ARG_INFO ();
49-
50- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_get_parameter , 0 , 0 , 2 )
51- ZEND_ARG_INFO (0 , namespace )
52- ZEND_ARG_INFO (0 , name )
53- ZEND_END_ARG_INFO ();
54-
55- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_remove_parameter , 0 , 0 , 2 )
56- ZEND_ARG_INFO (0 , namespace )
57- ZEND_ARG_INFO (0 , name )
58- ZEND_END_ARG_INFO ();
59-
60- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_has_exslt_support , 0 , 0 , 0 )
61- ZEND_END_ARG_INFO ();
62-
63- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_register_php_functions , 0 , 0 , 0 )
64- ZEND_ARG_INFO (0 , restrict )
65- ZEND_END_ARG_INFO ();
66-
67- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_set_profiling , 0 , 0 , 1 )
68- ZEND_ARG_INFO (0 , filename )
69- ZEND_END_ARG_INFO ();
70-
71- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_set_security_prefs , 0 , 0 , 1 )
72- ZEND_ARG_INFO (0 , securityPrefs )
73- ZEND_END_ARG_INFO ();
74-
75- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_get_security_prefs , 0 , 0 , 0 )
76- ZEND_END_ARG_INFO ();
77- /* }}} */
78-
7927/*
8028* class xsl_xsltprocessor
8129*
@@ -84,18 +32,18 @@ ZEND_END_ARG_INFO();
8432*/
8533
8634const zend_function_entry php_xsl_xsltprocessor_class_functions [] = {
87- PHP_FALIAS ( importStylesheet , xsl_xsltprocessor_import_stylesheet , arginfo_xsl_xsltprocessor_import_stylesheet )
88- PHP_FALIAS ( transformToDoc , xsl_xsltprocessor_transform_to_doc , arginfo_xsl_xsltprocessor_transform_to_doc )
89- PHP_FALIAS ( transformToUri , xsl_xsltprocessor_transform_to_uri , arginfo_xsl_xsltprocessor_transform_to_uri )
90- PHP_FALIAS ( transformToXml , xsl_xsltprocessor_transform_to_xml , arginfo_xsl_xsltprocessor_transform_to_xml )
91- PHP_FALIAS ( setParameter , xsl_xsltprocessor_set_parameter , arginfo_xsl_xsltprocessor_set_parameter )
92- PHP_FALIAS ( getParameter , xsl_xsltprocessor_get_parameter , arginfo_xsl_xsltprocessor_get_parameter )
93- PHP_FALIAS ( removeParameter , xsl_xsltprocessor_remove_parameter , arginfo_xsl_xsltprocessor_remove_parameter )
94- PHP_FALIAS ( hasExsltSupport , xsl_xsltprocessor_has_exslt_support , arginfo_xsl_xsltprocessor_has_exslt_support )
95- PHP_FALIAS ( registerPHPFunctions , xsl_xsltprocessor_register_php_functions , arginfo_xsl_xsltprocessor_register_php_functions )
96- PHP_FALIAS ( setProfiling , xsl_xsltprocessor_set_profiling , arginfo_xsl_xsltprocessor_set_profiling )
97- PHP_FALIAS ( setSecurityPrefs , xsl_xsltprocessor_set_security_prefs , arginfo_xsl_xsltprocessor_set_security_prefs )
98- PHP_FALIAS ( getSecurityPrefs , xsl_xsltprocessor_get_security_prefs , arginfo_xsl_xsltprocessor_get_security_prefs )
35+ PHP_ME ( XSLTProcessor , importStylesheet , arginfo_class_XSLTProcessor_importStylesheet , ZEND_ACC_PUBLIC )
36+ PHP_ME ( XSLTProcessor , transformToDoc , arginfo_class_XSLTProcessor_transformToDoc , ZEND_ACC_PUBLIC )
37+ PHP_ME ( XSLTProcessor , transformToUri , arginfo_class_XSLTProcessor_transformToUri , ZEND_ACC_PUBLIC )
38+ PHP_ME ( XSLTProcessor , transformToXml , arginfo_class_XSLTProcessor_transformToXml , ZEND_ACC_PUBLIC )
39+ PHP_ME ( XSLTProcessor , setParameter , arginfo_class_XSLTProcessor_setParameter , ZEND_ACC_PUBLIC )
40+ PHP_ME ( XSLTProcessor , getParameter , arginfo_class_XSLTProcessor_getParameter , ZEND_ACC_PUBLIC )
41+ PHP_ME ( XSLTProcessor , removeParameter , arginfo_class_XSLTProcessor_removeParameter , ZEND_ACC_PUBLIC )
42+ PHP_ME ( XSLTProcessor , hasExsltSupport , arginfo_class_XSLTProcessor_hasExsltSupport , ZEND_ACC_PUBLIC )
43+ PHP_ME ( XSLTProcessor , registerPHPFunctions , arginfo_class_XSLTProcessor_registerPHPFunctions , ZEND_ACC_PUBLIC )
44+ PHP_ME ( XSLTProcessor , setProfiling , arginfo_class_XSLTProcessor_setProfiling , ZEND_ACC_PUBLIC )
45+ PHP_ME ( XSLTProcessor , setSecurityPrefs , arginfo_class_XSLTProcessor_setSecurityPrefs , ZEND_ACC_PUBLIC )
46+ PHP_ME ( XSLTProcessor , getSecurityPrefs , arginfo_class_XSLTProcessor_getSecurityPrefs , ZEND_ACC_PUBLIC )
9947 PHP_FE_END
10048};
10149
@@ -386,11 +334,11 @@ void xsl_ext_function_object_php(xmlXPathParserContextPtr ctxt, int nargs) /* {{
386334}
387335/* }}} */
388336
389- /* {{{ proto void xsl_xsltprocessor_import_stylesheet (domdocument doc)
337+ /* {{{ proto void XSLTProcessor::importStylesheet (domdocument doc)
390338URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#
391339Since:
392340*/
393- PHP_FUNCTION ( xsl_xsltprocessor_import_stylesheet )
341+ PHP_METHOD ( XSLTProcessor , importStylesheet )
394342{
395343 zval * id , * docp = NULL ;
396344 xmlDoc * doc = NULL , * newdoc = NULL ;
@@ -470,7 +418,7 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
470418 php_xsl_set_object (id , sheetp );
471419 RETVAL_TRUE ;
472420}
473- /* }}} end xsl_xsltprocessor_import_stylesheet */
421+ /* }}} end XSLTProcessor::importStylesheet */
474422
475423static xmlDocPtr php_xsl_apply_stylesheet (zval * id , xsl_object * intern , xsltStylesheetPtr style , zval * docp ) /* {{{ */
476424{
@@ -613,11 +561,11 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
613561}
614562/* }}} */
615563
616- /* {{{ proto domdocument xsl_xsltprocessor_transform_to_doc (domnode doc)
564+ /* {{{ proto domdocument XSLTProcessor::transformToDoc (domnode doc)
617565URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#
618566Since:
619567*/
620- PHP_FUNCTION ( xsl_xsltprocessor_transform_to_doc )
568+ PHP_METHOD ( XSLTProcessor , transformToDoc )
621569{
622570 zval * id , * docp = NULL ;
623571 xmlDoc * newdocp ;
@@ -668,11 +616,11 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_doc)
668616 }
669617
670618}
671- /* }}} end xsl_xsltprocessor_transform_to_doc */
619+ /* }}} end XSLTProcessor::transformToDoc */
672620
673- /* {{{ proto int xsl_xsltprocessor_transform_to_uri (domdocument doc, string uri)
621+ /* {{{ proto int XSLTProcessor::transformToUri (domdocument doc, string uri)
674622*/
675- PHP_FUNCTION ( xsl_xsltprocessor_transform_to_uri )
623+ PHP_METHOD ( XSLTProcessor , transformToUri )
676624{
677625 zval * id , * docp = NULL ;
678626 xmlDoc * newdocp ;
@@ -700,11 +648,11 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri)
700648
701649 RETVAL_LONG (ret );
702650}
703- /* }}} end xsl_xsltprocessor_transform_to_uri */
651+ /* }}} end XSLTProcessor::transformToUri */
704652
705- /* {{{ proto string xsl_xsltprocessor_transform_to_xml (domdocument doc)
653+ /* {{{ proto string XSLTProcessor::transformToXml (domdocument doc)
706654*/
707- PHP_FUNCTION ( xsl_xsltprocessor_transform_to_xml )
655+ PHP_METHOD ( XSLTProcessor , transformToXml )
708656{
709657 zval * id , * docp = NULL ;
710658 xmlDoc * newdocp ;
@@ -738,11 +686,11 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_xml)
738686 RETURN_FALSE ;
739687 }
740688}
741- /* }}} end xsl_xsltprocessor_transform_to_xml */
689+ /* }}} end XSLTProcessor::transformToXml */
742690
743- /* {{{ proto bool xsl_xsltprocessor_set_parameter (string namespace, mixed name [, string value])
691+ /* {{{ proto bool XSLTProcessor::setParameter (string namespace, mixed name [, string value])
744692*/
745- PHP_FUNCTION ( xsl_xsltprocessor_set_parameter )
693+ PHP_METHOD ( XSLTProcessor , setParameter )
746694{
747695
748696 zval * id = ZEND_THIS ;
@@ -764,7 +712,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter)
764712 }
765713 str = zval_try_get_string (entry );
766714 if (UNEXPECTED (!str )) {
767- return ;
715+ RETURN_THROWS () ;
768716 }
769717 ZVAL_STR (& tmp , str );
770718 zend_hash_update (intern -> parameter , string_key , & tmp );
@@ -783,11 +731,11 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter)
783731 }
784732
785733}
786- /* }}} end xsl_xsltprocessor_set_parameter */
734+ /* }}} end XSLTProcessor::setParameter */
787735
788- /* {{{ proto string xsl_xsltprocessor_get_parameter (string namespace, string name)
736+ /* {{{ proto string XSLTProcessor::getParameter (string namespace, string name)
789737*/
790- PHP_FUNCTION ( xsl_xsltprocessor_get_parameter )
738+ PHP_METHOD ( XSLTProcessor , getParameter )
791739{
792740 zval * id = ZEND_THIS ;
793741 char * namespace ;
@@ -806,11 +754,11 @@ PHP_FUNCTION(xsl_xsltprocessor_get_parameter)
806754 RETURN_FALSE ;
807755 }
808756}
809- /* }}} end xsl_xsltprocessor_get_parameter */
757+ /* }}} end XSLTProcessor::getParameter */
810758
811- /* {{{ proto bool xsl_xsltprocessor_remove_parameter (string namespace, string name)
759+ /* {{{ proto bool XSLTProcessor::removeParameter (string namespace, string name)
812760*/
813- PHP_FUNCTION ( xsl_xsltprocessor_remove_parameter )
761+ PHP_METHOD ( XSLTProcessor , removeParameter )
814762{
815763 zval * id = ZEND_THIS ;
816764 size_t namespace_len = 0 ;
@@ -828,11 +776,11 @@ PHP_FUNCTION(xsl_xsltprocessor_remove_parameter)
828776 RETURN_FALSE ;
829777 }
830778}
831- /* }}} end xsl_xsltprocessor_remove_parameter */
779+ /* }}} end XSLTProcessor::removeParameter */
832780
833- /* {{{ proto void xsl_xsltprocessor_register_php_functions ([mixed $restrict])
781+ /* {{{ proto void XSLTProcessor::registerPHPFunctions ([mixed $restrict])
834782*/
835- PHP_FUNCTION ( xsl_xsltprocessor_register_php_functions )
783+ PHP_METHOD ( XSLTProcessor , registerPHPFunctions )
836784{
837785 zval * id = ZEND_THIS ;
838786 xsl_object * intern ;
@@ -860,41 +808,41 @@ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions)
860808 zend_hash_update (intern -> registered_phpfunctions , name , & new_string );
861809 intern -> registerPhpFunctions = 2 ;
862810
863- } else {
811+ } else if ( zend_parse_parameters_none () == SUCCESS ) {
864812 intern = Z_XSL_P (id );
865813 intern -> registerPhpFunctions = 1 ;
866814 }
867-
868815}
869- /* }}} end xsl_xsltprocessor_register_php_functions (); */
816+ /* }}} end XSLTProcessor::registerPHPFunctions (); */
870817
871- /* {{{ proto bool xsl_xsltprocessor_set_profiling (string filename) */
872- PHP_FUNCTION ( xsl_xsltprocessor_set_profiling )
818+ /* {{{ proto bool XSLTProcessor::setProfiling (string filename) */
819+ PHP_METHOD ( XSLTProcessor , setProfiling )
873820{
874821 zval * id = ZEND_THIS ;
875822 xsl_object * intern ;
876823 char * filename = NULL ;
877824 size_t filename_len ;
878825
879- if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "p!" , & filename , & filename_len ) == SUCCESS ) {
880- intern = Z_XSL_P (id );
881- if (intern -> profiling ) {
882- efree (intern -> profiling );
883- }
884- if (filename != NULL ) {
885- intern -> profiling = estrndup (filename , filename_len );
886- } else {
887- intern -> profiling = NULL ;
888- }
889- RETURN_TRUE ;
826+ if (zend_parse_parameters (ZEND_NUM_ARGS (), "p!" , & filename , & filename_len ) == FAILURE ) {
827+ RETURN_THROWS ();
828+ }
829+
830+ intern = Z_XSL_P (id );
831+ if (intern -> profiling ) {
832+ efree (intern -> profiling );
833+ }
834+ if (filename != NULL ) {
835+ intern -> profiling = estrndup (filename , filename_len );
890836 } else {
891- WRONG_PARAM_COUNT ;
837+ intern -> profiling = NULL ;
892838 }
839+
840+ RETURN_TRUE ;
893841}
894- /* }}} end xsl_xsltprocessor_set_profiling */
842+ /* }}} end XSLTProcessor::setProfiling */
895843
896- /* {{{ proto int xsl_xsltprocessor_set_security_prefs (int securityPrefs) */
897- PHP_FUNCTION ( xsl_xsltprocessor_set_security_prefs )
844+ /* {{{ proto int XSLTProcessor::setSecurityPrefs (int securityPrefs) */
845+ PHP_METHOD ( XSLTProcessor , setSecurityPrefs )
898846{
899847 zval * id = ZEND_THIS ;
900848 xsl_object * intern ;
@@ -910,31 +858,36 @@ PHP_FUNCTION(xsl_xsltprocessor_set_security_prefs)
910858 intern -> securityPrefsSet = 1 ;
911859 RETURN_LONG (oldSecurityPrefs );
912860}
913- /* }}} end xsl_xsltprocessor_set_security_prefs */
861+ /* }}} end XSLTProcessor::setSecurityPrefs */
914862
915- /* {{{ proto int xsl_xsltprocessor_get_security_prefs () */
916- PHP_FUNCTION ( xsl_xsltprocessor_get_security_prefs )
863+ /* {{{ proto int XSLTProcessor::getSecurityPrefs () */
864+ PHP_METHOD ( XSLTProcessor , getSecurityPrefs )
917865{
918866 zval * id = ZEND_THIS ;
919867 xsl_object * intern ;
920868
921- if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "" ) == SUCCESS ) {
922- intern = Z_XSL_P (id );
923- RETURN_LONG (intern -> securityPrefs );
924- } else {
925- WRONG_PARAM_COUNT ;
869+ if (zend_parse_parameters_none () == FAILURE ) {
870+ RETURN_THROWS ();
926871 }
872+
873+ intern = Z_XSL_P (id );
874+
875+ RETURN_LONG (intern -> securityPrefs );
927876}
928- /* }}} end xsl_xsltprocessor_get_security_prefs */
877+ /* }}} end XSLTProcessor::getSecurityPrefs */
929878
930- /* {{{ proto bool xsl_xsltprocessor_has_exslt_support ()
879+ /* {{{ proto bool XSLTProcessor::hasExsltSupport ()
931880*/
932- PHP_FUNCTION ( xsl_xsltprocessor_has_exslt_support )
881+ PHP_METHOD ( XSLTProcessor , hasExsltSupport )
933882{
883+ if (zend_parse_parameters_none () == FAILURE ) {
884+ RETURN_THROWS ();
885+ }
886+
934887#if HAVE_XSL_EXSLT
935888 RETURN_TRUE ;
936889#else
937890 RETURN_FALSE ;
938891#endif
939892}
940- /* }}} end xsl_xsltprocessor_has_exslt_support (); */
893+ /* }}} end XSLTProcessor::hasExsltSupport (); */
0 commit comments