reference/xsl/xsltprocessor/registerphpfunctions.xml
01904e809eaf0aa60e7ce0524400ddd5681c9541
01904e809eaf0aa60e7ce0524400ddd5681c9541
...
...
@@ -1,16 +1,15 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xml:id="xsltprocessor.registerphpfunctions" xmlns="http://docbook.org/ns/docbook">
3
+
<refentry xml:id="xsltprocessor.registerphpfunctions" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
4
4
<refnamediv>
5
5
<refname>XSLTProcessor::registerPHPFunctions</refname>
6
6
<refpurpose>Enables the ability to use PHP functions as XSLT functions</refpurpose>
7
7
</refnamediv>
8
8
<refsect1 role="description">
9
9
&reftitle.description;
10
-
<methodsynopsis>
11
-
<type>void</type>
12
-
<methodname>XSLTProcessor::registerPHPFunctions</methodname>
13
-
<methodparam choice="opt"><type>mixed</type><parameter>restrict</parameter></methodparam>
10
+
<methodsynopsis role="XSLTProcessor">
11
+
<modifier>public</modifier> <type>void</type><methodname>XSLTProcessor::registerPHPFunctions</methodname>
12
+
<methodparam choice="opt"><type class="union"><type>array</type><type>string</type><type>null</type></type><parameter>functions</parameter><initializer>&null;</initializer></methodparam>
14
13
</methodsynopsis>
15
14
<para>
16
15
This method enables the ability to use PHP functions as XSLT functions
...
...
@@ -22,27 +21,59 @@
22
21
<para>
23
22
<variablelist>
24
23
<varlistentry>
25
-
<term><parameter>restrict</parameter></term>
24
+
<term><parameter>functions</parameter></term>
26
25
<listitem>
27
26
<para>
28
27
Use this parameter to only allow certain functions to be called from
29
28
XSLT.
30
29
</para>
31
30
<para>
32
-
This parameter can be either a string (a function name) or an array of
33
-
functions.
31
+
This parameter can be one of the following:
32
+
a <type>string</type> (a function name),
33
+
an indexed <type>array</type> of function names,
34
+
or an associative <type>array</type> with keys being the function name
35
+
and the associated value being the <type>callable</type>.
34
36
</para>
35
37
</listitem>
36
38
</varlistentry>
37
39
</variablelist>
38
40
</para>
39
41
</refsect1>
42
+
43
+
<xi:include xpointer="domxpath.registerphpfunctions..errors" />
44
+
40
45
<refsect1 role="returnvalues">
41
46
&reftitle.returnvalues;
42
47
<para>
43
48
&return.void;
44
49
</para>
45
50
</refsect1>
51
+
52
+
<refsect1 role="changelog">
53
+
&reftitle.changelog;
54
+
<informaltable>
55
+
<tgroup cols="2">
56
+
<thead>
57
+
<row>
58
+
<entry>&Version;</entry>
59
+
<entry>&Description;</entry>
60
+
</row>
61
+
</thead>
62
+
<tbody>
63
+
<xi:include xpointer="domxpath.registerphpfunctions..changelog.errors" />
64
+
<row>
65
+
<entry>8.4.0</entry>
66
+
<entry>
67
+
It is now possible to use <type>callable</type>s for callbacks
68
+
when using <parameter>functions</parameter> with <type>array</type>
69
+
entries.
70
+
</entry>
71
+
</row>
72
+
</tbody>
73
+
</tgroup>
74
+
</informaltable>
75
+
</refsect1>
76
+
46
77
<refsect1 role="examples">
47
78
&reftitle.examples;
48
79
<para>
...
...
@@ -80,8 +111,10 @@ $xsl = <<<EOB
80
111
</xsl:template>
81
112
</xsl:stylesheet>
82
113
EOB;
83
-
$xmldoc = DOMDocument::loadXML($xml);
84
-
$xsldoc = DOMDocument::loadXML($xsl);
114
+
$xmldoc = new DOMDocument();
115
+
$xmldoc->loadXML($xml);
116
+
$xsldoc = new DOMDocument();
117
+
$xsldoc->loadXML($xsl);
85
118
86
119
$proc = new XSLTProcessor();
87
120
$proc->registerPHPFunctions();
...
...
@@ -91,8 +124,15 @@ echo $proc->transformToXML($xmldoc);
91
124
</example>
92
125
</para>
93
126
</refsect1>
94
-
</refentry>
95
127
128
+
<refsect1 role="seealso">
129
+
&reftitle.seealso;
130
+
<simplelist>
131
+
<member><methodname>DOMXPath::registerPhpFunctions</methodname></member>
132
+
</simplelist>
133
+
</refsect1>
134
+
135
+
</refentry>
96
136
<!-- Keep this comment at the end of the file
97
137
Local variables:
98
138
mode: sgml
99
139