1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
- <!-- EN-Revision: 4f5e2b22575131fa5e9c3004b1c874e1acb06573 Maintainer: nilgun Status: ready -->
2
+ <!-- EN-Revision: c1f37a6c270aadbbb3da56a3973ffd62197adf2b Maintainer: nilgun Status: ready -->
3
3
<refentry xml : id =" domxpath.registerphpfunctions" xmlns =" http://docbook.org/ns/docbook" xmlns : xlink =" http://www.w3.org/1999/xlink" >
4
4
<refnamediv >
5
5
<refname >DOMXPath::registerPhpFunctions</refname >
27
27
<term ><parameter >sınırla</parameter ></term >
28
28
<listitem >
29
29
<para >
30
- XPath ifadelerinde kullanmak üzere sadece belli işlevlere izin vermek için kullanılır.
30
+ XPath ifadelerinde kullanmak üzere sadece belli işlevlere izin vermek
31
+ için kullanılır.
31
32
</para >
32
33
<para >
33
- Ya bir dizge (işlev ismi) ya da işlev isimlerini içeren bir dizi
34
- olabilir.
34
+ Değer şunlardan biri olabilir:
35
+ <type >string</type > türünde bir işlev adı, işlev adlarını içeren
36
+ indisli bir dizi veya anahtarları işlev isimlerinden, ilişkili
37
+ değerleri <type >callable</type > türünde değerlerden oluşan bir
38
+ ilişkisel dizi.
35
39
</para >
36
40
</listitem >
37
41
</varlistentry >
46
50
</para >
47
51
</refsect1 >
48
52
53
+ <refsect1 role =" errors" xml : id =" domxpath.registerphpfunctions..errors" >
54
+ &reftitle.errors;
55
+ <itemizedlist >
56
+ <listitem >
57
+ <simpara >
58
+ Geri çağırım işlevinin adı geçersiz ise
59
+ <exceptionname >ValueError</exceptionname > istisnası oluşur.
60
+ </simpara >
61
+ </listitem >
62
+ &dom.errors.compliant.common;
63
+ <listitem >
64
+ <simpara >
65
+ Belirtilen .
66
+ </simpara >
67
+ </listitem >
68
+ </itemizedlist >
69
+ </refsect1 >
70
+
71
+ <refsect1 role =" changelog" >
72
+ &reftitle.changelog;
73
+ <informaltable >
74
+ <tgroup cols =" 2" >
75
+ <thead >
76
+ <row >
77
+ <entry >&Version; </entry >
78
+ <entry >&Description; </entry >
79
+ </row >
80
+ </thead >
81
+ <tbody >
82
+ <row xml : id =" domxpath.registerphpfunctions..changelog.errors" >
83
+ <entry >8.4.0</entry >
84
+ <entry >
85
+ Geçersiz geri çağırım işlevi adları artık
86
+ <exceptionname >ValueError</exceptionname > istisnası oluşturuyor.
87
+ Geri çağırım işlevi <type >callable</type > türünde değilse artık
88
+ <exceptionname >TypeError</exceptionname > istisnası oluşuyor.
89
+ </entry >
90
+ </row >
91
+ <row >
92
+ <entry >8.4.0</entry >
93
+ <entry >
94
+ Geri çağırım işlevlerinin <type >callable</type > kısmı
95
+ <parameter >sınırla</parameter > değeri olarak bir ilişkisel diziye
96
+ belirtilebiliyor.
97
+ </entry >
98
+ </row >
99
+ </tbody >
100
+ </tgroup >
101
+ </informaltable >
102
+ </refsect1 >
103
+
49
104
<refsect1 role =" examples" >
50
105
&reftitle.examples;
51
106
<para >
79
134
</para >
80
135
<para >
81
136
<example >
82
- <title >- <methodname >DOMXPath::registerPHPFunctions </methodname > ve <literal >php:functionString</literal > kullanımı</title >
137
+ <title >- <methodname >DOMXPath::registerPhpFunctions </methodname > ve <literal >php:functionString</literal > kullanımı</title >
83
138
<programlisting role =" php" >
84
139
<![CDATA[
85
140
<?php
@@ -92,7 +147,7 @@ $xpath = new DOMXPath($doc);
92
147
$xpath->registerNamespace("php", "http://php.net/xpath");
93
148
94
149
// PHP işlevlerini tanıt (sınırlama yok)
95
- $xpath->registerPHPFunctions ();
150
+ $xpath->registerPhpFunctions ();
96
151
97
152
// substr işlevini book/title üzerinde kullan
98
153
$nodes = $xpath->query('//book[php:functionString("substr", title, 0, 3) = "PHP"]');
@@ -119,7 +174,7 @@ Jenny Smythe tarafından yazılan 'PHP Secrets'
119
174
</para >
120
175
<para >
121
176
<example >
122
- <title >- <methodname >DOMXPath::registerPHPFunctions </methodname > ve <literal >php:function</literal > kullanımı</title >
177
+ <title >- <methodname >DOMXPath::registerPhpFunctions </methodname > ve <literal >php:function</literal > kullanımı</title >
123
178
<programlisting role =" php" >
124
179
<![CDATA[
125
180
<?php
@@ -132,7 +187,7 @@ $xpath = new DOMXPath($doc);
132
187
$xpath->registerNamespace("php", "http://php.net/xpath");
133
188
134
189
// PHP işlevlerini tanıt (sadece birden_fazla işlevi)
135
- $xpath->registerPHPFunctions ("birden_fazla");
190
+ $xpath->registerPhpFunctions ("birden_fazla");
136
191
137
192
function birden_fazla($nodes) {
138
193
// Bir yazardan fazla varsa true dönsün
@@ -158,6 +213,36 @@ PHP Basics
158
213
</screen >
159
214
</example >
160
215
</para >
216
+ <para >
217
+ <example >
218
+ <title >- Geri çağırımlı <methodname >DOMXPath::registerPhpFunctions</methodname ></title >
219
+ <programlisting role =" php" >
220
+ <![CDATA[
221
+ <?php
222
+ $doc = new DOMDocument;
223
+ $doc->load('examples/book-simple.xml');
224
+
225
+ $xpath = new DOMXPath($doc);
226
+
227
+ // php: isim alanını tanıt (gerekli)
228
+ $xpath->registerNamespace("php", "http://php.net/xpath");
229
+
230
+ // PHP işlevlerini tanıt (yalnızca birden_fazla)
231
+ $xpath->registerPhpFunctions(["birden_fazla" => fn ($nodes) => count($nodes) > 1]);
232
+
233
+ // Birden fazla yazarlı kitapları ayır
234
+ $books = $xpath->query('//book[php:function("birden_fazla", author)]');
235
+
236
+ echo "Birden fazla yazarlı kitaplar:\n";
237
+ foreach ($books as $book) {
238
+ echo $book->getElementsByTagName("title")->item(0)->nodeValue . "\n";
239
+ }
240
+
241
+ ?>
242
+ ]]>
243
+ </programlisting >
244
+ </example >
245
+ </para >
161
246
</refsect1 >
162
247
163
248
<refsect1 role =" seealso" >
@@ -167,6 +252,7 @@ PHP Basics
167
252
<member ><methodname >DOMXPath::registerNamespace</methodname ></member >
168
253
<member ><methodname >DOMXPath::query</methodname ></member >
169
254
<member ><methodname >DOMXPath::evaluate</methodname ></member >
255
+ <member ><methodname >XSLTProcessor::registerPHPFunctions</methodname ></member >
170
256
</simplelist >
171
257
</para >
172
258
</refsect1 >
0 commit comments