PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / lib / packages / Safe / generated / yaz.php

yaz.php in Defender Security – Malware Scanner, Login Security & Firewall 6.3.0, at lib/packages/Safe/generated/yaz.php

440 lines 10.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WP_DEFENDER_VENDOR\Safe;
4
5 use WP_DEFENDER_VENDOR\Safe\Exceptions\YazException;
6
7 /**
8 * This function invokes a CCL parser. It converts a given CCL FIND query to
9 * an RPN query which may be passed to the yaz_search
10 * function to perform a search.
11 *
12 * To define a set of valid CCL fields call yaz_ccl_conf
13 * prior to this function.
14 *
15 * @param resource $id The connection resource returned by yaz_connect.
16 * @param string $query The CCL FIND query.
17 * @param array|null $result If the function was executed successfully, this will be an array
18 * containing the valid RPN query under the key rpn.
19 *
20 * Upon failure, three indexes are set in this array to indicate the cause
21 * of failure:
22 *
23 *
24 *
25 * errorcode - the CCL error code (integer)
26 *
27 *
28 *
29 *
30 * errorstring - the CCL error string
31 *
32 *
33 *
34 *
35 * errorpos - approximate position in query of failure
36 * (integer is character position)
37 *
38 *
39 *
40 *
41 * errorcode - the CCL error code (integer)
42 *
43 * errorstring - the CCL error string
44 *
45 * errorpos - approximate position in query of failure
46 * (integer is character position)
47 * @throws YazException
48 *
49 */
50 function yaz_ccl_parse($id, string $query, ?array &$result): void
51 {
52 error_clear_last();
53 $result = \yaz_ccl_parse($id, $query, $result);
54 if ($result === false) {
55 throw YazException::createFromPhpError();
56 }
57 }
58
59
60 /**
61 * Closes the connection given by parameter id.
62 *
63 * @param resource $id The connection resource returned by yaz_connect.
64 * @throws YazException
65 *
66 */
67 function yaz_close($id): void
68 {
69 error_clear_last();
70 $result = \yaz_close($id);
71 if ($result === false) {
72 throw YazException::createFromPhpError();
73 }
74 }
75
76
77 /**
78 * This function returns a connection resource on success, zero on
79 * failure.
80 *
81 * yaz_connect prepares for a connection to a
82 * Z39.50 server.
83 * This function is non-blocking and does not attempt to establish
84 * a connection - it merely prepares a connect to be performed later when
85 * yaz_wait is called.
86 *
87 * @param string $zurl A string that takes the form host[:port][/database].
88 * If port is omitted, port 210 is used. If database is omitted
89 * Default is used.
90 * @param mixed $options If given as a string, it is treated as the Z39.50 V2 authentication
91 * string (OpenAuth).
92 *
93 * If given as an array, the contents of the array serves as options.
94 *
95 *
96 * user
97 *
98 *
99 * Username for authentication.
100 *
101 *
102 *
103 *
104 * group
105 *
106 *
107 * Group for authentication.
108 *
109 *
110 *
111 *
112 * password
113 *
114 *
115 * Password for authentication.
116 *
117 *
118 *
119 *
120 * cookie
121 *
122 *
123 * Cookie for session (YAZ proxy).
124 *
125 *
126 *
127 *
128 * proxy
129 *
130 *
131 * Proxy for connection (YAZ proxy).
132 *
133 *
134 *
135 *
136 * persistent
137 *
138 *
139 * A boolean. If TRUE the connection is persistent; If FALSE the
140 * connection is not persistent. By default connections are persistent.
141 *
142 *
143 *
144 * If you open a persistent connection, you won't be able to close
145 * it later with yaz_close.
146 *
147 *
148 *
149 *
150 *
151 * piggyback
152 *
153 *
154 * A boolean. If TRUE piggyback is enabled for searches; If FALSE
155 * piggyback is disabled. By default piggyback is enabled.
156 *
157 *
158 * Enabling piggyback is more efficient and usually saves a
159 * network-round-trip for first time fetches of records. However, a
160 * few Z39.50 servers do not support piggyback or they ignore element
161 * set names. For those, piggyback should be disabled.
162 *
163 *
164 *
165 *
166 * charset
167 *
168 *
169 * A string that specifies character set to be used in Z39.50
170 * language and character set negotiation. Use strings such as:
171 * ISO-8859-1, UTF-8,
172 * UTF-16.
173 *
174 *
175 * Most Z39.50 servers do not support this feature (and thus, this is
176 * ignored). Many servers use the ISO-8859-1 encoding for queries and
177 * messages. MARC21/USMARC records are not affected by this setting.
178 *
179 *
180 *
181 *
182 *
183 * preferredMessageSize
184 *
185 *
186 * An integer that specifies the maximum byte size of all records
187 * to be returned by a target during retrieval. See the
188 * Z39.50 standard for more
189 * information.
190 *
191 *
192 *
193 * This option is supported in PECL YAZ 1.0.5 or later.
194 *
195 *
196 *
197 *
198 *
199 *
200 * maximumRecordSize
201 *
202 *
203 * An integer that specifies the maximum byte size of a single record
204 * to be returned by a target during retrieval. This
205 * entity is referred to as Exceptional-record-size in the
206 * Z39.50 standard.
207 *
208 *
209 *
210 * This option is supported in PECL YAZ 1.0.5 or later.
211 *
212 *
213 *
214 *
215 *
216 *
217 *
218 * Username for authentication.
219 *
220 * Group for authentication.
221 *
222 * Password for authentication.
223 *
224 * Cookie for session (YAZ proxy).
225 *
226 * Proxy for connection (YAZ proxy).
227 *
228 * A boolean. If TRUE the connection is persistent; If FALSE the
229 * connection is not persistent. By default connections are persistent.
230 *
231 * If you open a persistent connection, you won't be able to close
232 * it later with yaz_close.
233 *
234 * A boolean. If TRUE piggyback is enabled for searches; If FALSE
235 * piggyback is disabled. By default piggyback is enabled.
236 *
237 * Enabling piggyback is more efficient and usually saves a
238 * network-round-trip for first time fetches of records. However, a
239 * few Z39.50 servers do not support piggyback or they ignore element
240 * set names. For those, piggyback should be disabled.
241 *
242 * A string that specifies character set to be used in Z39.50
243 * language and character set negotiation. Use strings such as:
244 * ISO-8859-1, UTF-8,
245 * UTF-16.
246 *
247 * Most Z39.50 servers do not support this feature (and thus, this is
248 * ignored). Many servers use the ISO-8859-1 encoding for queries and
249 * messages. MARC21/USMARC records are not affected by this setting.
250 *
251 * An integer that specifies the maximum byte size of all records
252 * to be returned by a target during retrieval. See the
253 * Z39.50 standard for more
254 * information.
255 *
256 * This option is supported in PECL YAZ 1.0.5 or later.
257 *
258 * An integer that specifies the maximum byte size of a single record
259 * to be returned by a target during retrieval. This
260 * entity is referred to as Exceptional-record-size in the
261 * Z39.50 standard.
262 *
263 * This option is supported in PECL YAZ 1.0.5 or later.
264 * @return mixed A connection resource on success, FALSE on error.
265 * @throws YazException
266 *
267 */
268 function yaz_connect(string $zurl, $options = null)
269 {
270 error_clear_last();
271 if ($options !== null) {
272 $result = \yaz_connect($zurl, $options);
273 } else {
274 $result = \yaz_connect($zurl);
275 }
276 if ($result === false) {
277 throw YazException::createFromPhpError();
278 }
279 return $result;
280 }
281
282
283 /**
284 * This function allows you to change databases within a session by
285 * specifying one or more databases to be used in search, retrieval, etc.
286 * - overriding databases specified in call to
287 * yaz_connect.
288 *
289 * @param resource $id The connection resource returned by yaz_connect.
290 * @param string $databases A string containing one or more databases. Multiple databases are
291 * separated by a plus sign +.
292 * @throws YazException
293 *
294 */
295 function yaz_database($id, string $databases): void
296 {
297 error_clear_last();
298 $result = \yaz_database($id, $databases);
299 if ($result === false) {
300 throw YazException::createFromPhpError();
301 }
302 }
303
304
305 /**
306 * This function sets the element set name for retrieval.
307 *
308 * Call this function before yaz_search or
309 * yaz_present to specify the element set name for
310 * records to be retrieved.
311 *
312 * @param resource $id The connection resource returned by yaz_connect.
313 * @param string $elementset Most servers support F (for full records) and
314 * B (for brief records).
315 * @throws YazException
316 *
317 */
318 function yaz_element($id, string $elementset): void
319 {
320 error_clear_last();
321 $result = \yaz_element($id, $elementset);
322 if ($result === false) {
323 throw YazException::createFromPhpError();
324 }
325 }
326
327
328 /**
329 * This function prepares for retrieval of records after a successful search.
330 *
331 * The yaz_range function should be called prior to this
332 * function to specify the range of records to be retrieved.
333 *
334 * @param resource $id The connection resource returned by yaz_connect.
335 * @throws YazException
336 *
337 */
338 function yaz_present($id): void
339 {
340 error_clear_last();
341 $result = \yaz_present($id);
342 if ($result === false) {
343 throw YazException::createFromPhpError();
344 }
345 }
346
347
348 /**
349 * yaz_search prepares for a search on the given
350 * connection.
351 *
352 * Like yaz_connect this function is non-blocking and
353 * only prepares for a search to be executed later when
354 * yaz_wait is called.
355 *
356 * @param resource $id The connection resource returned by yaz_connect.
357 * @param string $type This parameter represents the query type - only "rpn"
358 * is supported now in which case the third argument specifies a Type-1
359 * query in prefix query notation.
360 * @param string $query The RPN query is a textual representation of the Type-1 query as
361 * defined by the Z39.50 standard. However, in the text representation
362 * as used by YAZ a prefix notation is used, that is the operator
363 * precedes the operands. The query string is a sequence of tokens where
364 * white space is ignored unless surrounded by double quotes. Tokens beginning
365 * with an at-character (@) are considered operators,
366 * otherwise they are treated as search terms.
367 *
368 * You can find information about attributes at the
369 * Z39.50 Maintenance Agency
370 * site.
371 *
372 * If you would like to use a more friendly notation,
373 * use the CCL parser - functions yaz_ccl_conf and
374 * yaz_ccl_parse.
375 * @throws YazException
376 *
377 */
378 function yaz_search($id, string $type, string $query): void
379 {
380 error_clear_last();
381 $result = \yaz_search($id, $type, $query);
382 if ($result === false) {
383 throw YazException::createFromPhpError();
384 }
385 }
386
387
388 /**
389 * This function carries out networked (blocked) activity for outstanding
390 * requests which have been prepared by the functions
391 * yaz_connect, yaz_search,
392 * yaz_present, yaz_scan and
393 * yaz_itemorder.
394 *
395 * yaz_wait returns when all servers have either
396 * completed all requests or aborted (in case of errors).
397 *
398 * @param array|null $options An associative array of options:
399 *
400 *
401 * timeout
402 *
403 *
404 * Sets timeout in seconds. If a server has not responded within the
405 * timeout it is considered dead and yaz_wait
406 * returns. The default value for timeout is 15 seconds.
407 *
408 *
409 *
410 *
411 * event
412 *
413 *
414 * A boolean.
415 *
416 *
417 *
418 *
419 *
420 * Sets timeout in seconds. If a server has not responded within the
421 * timeout it is considered dead and yaz_wait
422 * returns. The default value for timeout is 15 seconds.
423 *
424 * A boolean.
425 *
426 * @return mixed Returns TRUE on success.
427 * In event mode, returns resource.
428 * @throws YazException
429 *
430 */
431 function yaz_wait(?array &$options = null)
432 {
433 error_clear_last();
434 $result = \yaz_wait($options);
435 if ($result === false) {
436 throw YazException::createFromPhpError();
437 }
438 return $result;
439 }
440