PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / trunk
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress vtrunk
4.17.2 4.17.1 4.17.0 4.16.19 4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / third-party / vendor / thecodingmachine / safe / generated / ftp.php
wp-user-avatar / third-party / vendor / thecodingmachine / safe / generated Last commit date
Exceptions 6 days ago apache.php 6 days ago apcu.php 6 days ago array.php 6 days ago bzip2.php 6 days ago calendar.php 6 days ago classobj.php 6 days ago com.php 6 days ago cubrid.php 6 days ago curl.php 6 days ago datetime.php 6 days ago dir.php 6 days ago eio.php 6 days ago errorfunc.php 6 days ago exec.php 6 days ago fileinfo.php 6 days ago filesystem.php 6 days ago filter.php 6 days ago fpm.php 6 days ago ftp.php 6 days ago funchand.php 6 days ago functionsList.php 6 days ago gmp.php 6 days ago gnupg.php 6 days ago hash.php 6 days ago ibase.php 6 days ago ibmDb2.php 6 days ago iconv.php 6 days ago image.php 6 days ago imap.php 6 days ago info.php 6 days ago ingres-ii.php 6 days ago inotify.php 6 days ago json.php 6 days ago ldap.php 6 days ago libxml.php 6 days ago lzf.php 6 days ago mailparse.php 6 days ago mbstring.php 6 days ago misc.php 6 days ago msql.php 6 days ago mysql.php 6 days ago mysqli.php 6 days ago mysqlndMs.php 6 days ago mysqlndQc.php 6 days ago network.php 6 days ago oci8.php 6 days ago opcache.php 6 days ago openssl.php 6 days ago outcontrol.php 6 days ago password.php 6 days ago pcntl.php 6 days ago pcre.php 6 days ago pdf.php 6 days ago pgsql.php 6 days ago posix.php 6 days ago ps.php 6 days ago pspell.php 6 days ago readline.php 6 days ago rpminfo.php 6 days ago rrd.php 6 days ago sem.php 6 days ago session.php 6 days ago shmop.php 6 days ago simplexml.php 6 days ago sockets.php 6 days ago sodium.php 6 days ago solr.php 6 days ago spl.php 6 days ago sqlsrv.php 6 days ago ssdeep.php 6 days ago ssh2.php 6 days ago stream.php 6 days ago strings.php 6 days ago swoole.php 6 days ago uodbc.php 6 days ago uopz.php 6 days ago url.php 6 days ago var.php 6 days ago xdiff.php 6 days ago xml.php 6 days ago xmlrpc.php 6 days ago yaml.php 6 days ago yaz.php 6 days ago zip.php 6 days ago zlib.php 6 days ago
ftp.php
452 lines
1 <?php
2
3 namespace ProfilePressVendor\Safe;
4
5 use ProfilePressVendor\Safe\Exceptions\FtpException;
6 /**
7 * Sends an ALLO command to the remote FTP server to
8 * allocate space for a file to be uploaded.
9 *
10 * @param resource $ftp_stream The link identifier of the FTP connection.
11 * @param int $filesize The number of bytes to allocate.
12 * @param string $result A textual representation of the servers response will be returned by
13 * reference in result if a variable is provided.
14 * @throws FtpException
15 *
16 */
17 function ftp_alloc($ftp_stream, int $filesize, string &$result = null): void
18 {
19 error_clear_last();
20 $result = \ftp_alloc($ftp_stream, $filesize, $result);
21 if ($result === \false) {
22 throw FtpException::createFromPhpError();
23 }
24 }
25 /**
26 *
27 *
28 * @param resource $ftp
29 * @param string $remote_file
30 * @param string $local_file
31 * @param int $mode
32 * @throws FtpException
33 *
34 */
35 function ftp_append($ftp, string $remote_file, string $local_file, int $mode = \FTP_BINARY): void
36 {
37 error_clear_last();
38 $result = \ftp_append($ftp, $remote_file, $local_file, $mode);
39 if ($result === \false) {
40 throw FtpException::createFromPhpError();
41 }
42 }
43 /**
44 * Changes to the parent directory.
45 *
46 * @param resource $ftp_stream The link identifier of the FTP connection.
47 * @throws FtpException
48 *
49 */
50 function ftp_cdup($ftp_stream): void
51 {
52 error_clear_last();
53 $result = \ftp_cdup($ftp_stream);
54 if ($result === \false) {
55 throw FtpException::createFromPhpError();
56 }
57 }
58 /**
59 * Changes the current directory to the specified one.
60 *
61 * @param resource $ftp_stream The link identifier of the FTP connection.
62 * @param string $directory The target directory.
63 * @throws FtpException
64 *
65 */
66 function ftp_chdir($ftp_stream, string $directory): void
67 {
68 error_clear_last();
69 $result = \ftp_chdir($ftp_stream, $directory);
70 if ($result === \false) {
71 throw FtpException::createFromPhpError();
72 }
73 }
74 /**
75 * Sets the permissions on the specified remote file to
76 * mode.
77 *
78 * @param resource $ftp_stream The link identifier of the FTP connection.
79 * @param int $mode The new permissions, given as an octal value.
80 * @param string $filename The remote file.
81 * @return int Returns the new file permissions on success.
82 * @throws FtpException
83 *
84 */
85 function ftp_chmod($ftp_stream, int $mode, string $filename): int
86 {
87 error_clear_last();
88 $result = \ftp_chmod($ftp_stream, $mode, $filename);
89 if ($result === \false) {
90 throw FtpException::createFromPhpError();
91 }
92 return $result;
93 }
94 /**
95 * ftp_close closes the given link identifier
96 * and releases the resource.
97 *
98 * @param resource $ftp_stream The link identifier of the FTP connection.
99 * @throws FtpException
100 *
101 */
102 function ftp_close($ftp_stream): void
103 {
104 error_clear_last();
105 $result = \ftp_close($ftp_stream);
106 if ($result === \false) {
107 throw FtpException::createFromPhpError();
108 }
109 }
110 /**
111 * ftp_connect opens an FTP connection to the
112 * specified host.
113 *
114 * @param string $host The FTP server address. This parameter shouldn't have any trailing
115 * slashes and shouldn't be prefixed with ftp://.
116 * @param int $port This parameter specifies an alternate port to connect to. If it is
117 * omitted or set to zero, then the default FTP port, 21, will be used.
118 * @param int $timeout This parameter specifies the timeout in seconds for all subsequent network operations.
119 * If omitted, the default value is 90 seconds. The timeout can be changed and
120 * queried at any time with ftp_set_option and
121 * ftp_get_option.
122 * @return resource Returns a FTP stream on success.
123 * @throws FtpException
124 *
125 */
126 function ftp_connect(string $host, int $port = 21, int $timeout = 90)
127 {
128 error_clear_last();
129 $result = \ftp_connect($host, $port, $timeout);
130 if ($result === \false) {
131 throw FtpException::createFromPhpError();
132 }
133 return $result;
134 }
135 /**
136 * ftp_delete deletes the file specified by
137 * path from the FTP server.
138 *
139 * @param resource $ftp_stream The link identifier of the FTP connection.
140 * @param string $path The file to delete.
141 * @throws FtpException
142 *
143 */
144 function ftp_delete($ftp_stream, string $path): void
145 {
146 error_clear_last();
147 $result = \ftp_delete($ftp_stream, $path);
148 if ($result === \false) {
149 throw FtpException::createFromPhpError();
150 }
151 }
152 /**
153 * ftp_fget retrieves remote_file
154 * from the FTP server, and writes it to the given file pointer.
155 *
156 * @param resource $ftp_stream The link identifier of the FTP connection.
157 * @param resource $handle An open file pointer in which we store the data.
158 * @param string $remote_file The remote file path.
159 * @param int $mode The transfer mode. Must be either FTP_ASCII or
160 * FTP_BINARY.
161 * @param int $resumepos The position in the remote file to start downloading from.
162 * @throws FtpException
163 *
164 */
165 function ftp_fget($ftp_stream, $handle, string $remote_file, int $mode = \FTP_BINARY, int $resumepos = 0): void
166 {
167 error_clear_last();
168 $result = \ftp_fget($ftp_stream, $handle, $remote_file, $mode, $resumepos);
169 if ($result === \false) {
170 throw FtpException::createFromPhpError();
171 }
172 }
173 /**
174 * ftp_fput uploads the data from a file pointer
175 * to a remote file on the FTP server.
176 *
177 * @param resource $ftp_stream The link identifier of the FTP connection.
178 * @param string $remote_file The remote file path.
179 * @param resource $handle An open file pointer on the local file. Reading stops at end of file.
180 * @param int $mode The transfer mode. Must be either FTP_ASCII or
181 * FTP_BINARY.
182 * @param int $startpos The position in the remote file to start uploading to.
183 * @throws FtpException
184 *
185 */
186 function ftp_fput($ftp_stream, string $remote_file, $handle, int $mode = \FTP_BINARY, int $startpos = 0): void
187 {
188 error_clear_last();
189 $result = \ftp_fput($ftp_stream, $remote_file, $handle, $mode, $startpos);
190 if ($result === \false) {
191 throw FtpException::createFromPhpError();
192 }
193 }
194 /**
195 * ftp_get retrieves a remote file from the FTP server,
196 * and saves it into a local file.
197 *
198 * @param resource $ftp_stream The link identifier of the FTP connection.
199 * @param string $local_file The local file path (will be overwritten if the file already exists).
200 * @param string $remote_file The remote file path.
201 * @param int $mode The transfer mode. Must be either FTP_ASCII or
202 * FTP_BINARY.
203 * @param int $resumepos The position in the remote file to start downloading from.
204 * @throws FtpException
205 *
206 */
207 function ftp_get($ftp_stream, string $local_file, string $remote_file, int $mode = \FTP_BINARY, int $resumepos = 0): void
208 {
209 error_clear_last();
210 $result = \ftp_get($ftp_stream, $local_file, $remote_file, $mode, $resumepos);
211 if ($result === \false) {
212 throw FtpException::createFromPhpError();
213 }
214 }
215 /**
216 * Logs in to the given FTP stream.
217 *
218 * @param resource $ftp_stream The link identifier of the FTP connection.
219 * @param string $username The username (USER).
220 * @param string $password The password (PASS).
221 * @throws FtpException
222 *
223 */
224 function ftp_login($ftp_stream, string $username, string $password): void
225 {
226 error_clear_last();
227 $result = \ftp_login($ftp_stream, $username, $password);
228 if ($result === \false) {
229 throw FtpException::createFromPhpError();
230 }
231 }
232 /**
233 * Creates the specified directory on the FTP server.
234 *
235 * @param resource $ftp_stream The link identifier of the FTP connection.
236 * @param string $directory The name of the directory that will be created.
237 * @return string Returns the newly created directory name on success.
238 * @throws FtpException
239 *
240 */
241 function ftp_mkdir($ftp_stream, string $directory): string
242 {
243 error_clear_last();
244 $result = \ftp_mkdir($ftp_stream, $directory);
245 if ($result === \false) {
246 throw FtpException::createFromPhpError();
247 }
248 return $result;
249 }
250 /**
251 *
252 *
253 * @param resource $ftp_stream The link identifier of the FTP connection.
254 * @param string $directory The directory to be listed.
255 * @return array Returns an array of arrays with file infos from the specified directory on success.
256 * @throws FtpException
257 *
258 */
259 function ftp_mlsd($ftp_stream, string $directory): array
260 {
261 error_clear_last();
262 $result = \ftp_mlsd($ftp_stream, $directory);
263 if ($result === \false) {
264 throw FtpException::createFromPhpError();
265 }
266 return $result;
267 }
268 /**
269 *
270 *
271 * @param resource $ftp_stream The link identifier of the FTP connection.
272 * @param string $directory The directory to be listed. This parameter can also include arguments, eg.
273 * ftp_nlist($conn_id, "-la /your/dir");
274 * Note that this parameter isn't escaped so there may be some issues with
275 * filenames containing spaces and other characters.
276 * @return array Returns an array of filenames from the specified directory on success.
277 * @throws FtpException
278 *
279 */
280 function ftp_nlist($ftp_stream, string $directory): array
281 {
282 error_clear_last();
283 $result = \ftp_nlist($ftp_stream, $directory);
284 if ($result === \false) {
285 throw FtpException::createFromPhpError();
286 }
287 return $result;
288 }
289 /**
290 * ftp_pasv turns on or off passive mode. In
291 * passive mode, data connections are initiated by the client,
292 * rather than by the server.
293 * It may be needed if the client is behind firewall.
294 *
295 * Please note that ftp_pasv can only be called after a
296 * successful login or otherwise it will fail.
297 *
298 * @param resource $ftp_stream The link identifier of the FTP connection.
299 * @param bool $pasv If TRUE, the passive mode is turned on, else it's turned off.
300 * @throws FtpException
301 *
302 */
303 function ftp_pasv($ftp_stream, bool $pasv): void
304 {
305 error_clear_last();
306 $result = \ftp_pasv($ftp_stream, $pasv);
307 if ($result === \false) {
308 throw FtpException::createFromPhpError();
309 }
310 }
311 /**
312 * ftp_put stores a local file on the FTP server.
313 *
314 * @param resource $ftp_stream The link identifier of the FTP connection.
315 * @param string $remote_file The remote file path.
316 * @param string $local_file The local file path.
317 * @param int $mode The transfer mode. Must be either FTP_ASCII or
318 * FTP_BINARY.
319 * @param int $startpos The position in the remote file to start uploading to.
320 * @throws FtpException
321 *
322 */
323 function ftp_put($ftp_stream, string $remote_file, string $local_file, int $mode = \FTP_BINARY, int $startpos = 0): void
324 {
325 error_clear_last();
326 $result = \ftp_put($ftp_stream, $remote_file, $local_file, $mode, $startpos);
327 if ($result === \false) {
328 throw FtpException::createFromPhpError();
329 }
330 }
331 /**
332 *
333 *
334 * @param resource $ftp_stream The link identifier of the FTP connection.
335 * @return string Returns the current directory name.
336 * @throws FtpException
337 *
338 */
339 function ftp_pwd($ftp_stream): string
340 {
341 error_clear_last();
342 $result = \ftp_pwd($ftp_stream);
343 if ($result === \false) {
344 throw FtpException::createFromPhpError();
345 }
346 return $result;
347 }
348 /**
349 * ftp_rename renames a file or a directory on the FTP
350 * server.
351 *
352 * @param resource $ftp_stream The link identifier of the FTP connection.
353 * @param string $oldname The old file/directory name.
354 * @param string $newname The new name.
355 * @throws FtpException
356 *
357 */
358 function ftp_rename($ftp_stream, string $oldname, string $newname): void
359 {
360 error_clear_last();
361 $result = \ftp_rename($ftp_stream, $oldname, $newname);
362 if ($result === \false) {
363 throw FtpException::createFromPhpError();
364 }
365 }
366 /**
367 * Removes the specified directory on the FTP server.
368 *
369 * @param resource $ftp_stream The link identifier of the FTP connection.
370 * @param string $directory The directory to delete. This must be either an absolute or relative
371 * path to an empty directory.
372 * @throws FtpException
373 *
374 */
375 function ftp_rmdir($ftp_stream, string $directory): void
376 {
377 error_clear_last();
378 $result = \ftp_rmdir($ftp_stream, $directory);
379 if ($result === \false) {
380 throw FtpException::createFromPhpError();
381 }
382 }
383 /**
384 * ftp_site sends the given SITE
385 * command to the FTP server.
386 *
387 * SITE commands are not standardized, and vary from server
388 * to server. They are useful for handling such things as file permissions and
389 * group membership.
390 *
391 * @param resource $ftp_stream The link identifier of the FTP connection.
392 * @param string $command The SITE command. Note that this parameter isn't escaped so there may
393 * be some issues with filenames containing spaces and other characters.
394 * @throws FtpException
395 *
396 */
397 function ftp_site($ftp_stream, string $command): void
398 {
399 error_clear_last();
400 $result = \ftp_site($ftp_stream, $command);
401 if ($result === \false) {
402 throw FtpException::createFromPhpError();
403 }
404 }
405 /**
406 * ftp_ssl_connect opens an explicit SSL-FTP connection to the
407 * specified host. That implies that
408 * ftp_ssl_connect will succeed even if the server is not
409 * configured for SSL-FTP, or its certificate is invalid. Only when
410 * ftp_login is called, the client will send the
411 * appropriate AUTH FTP command, so ftp_login will fail in
412 * the mentioned cases.
413 *
414 * @param string $host The FTP server address. This parameter shouldn't have any trailing
415 * slashes and shouldn't be prefixed with ftp://.
416 * @param int $port This parameter specifies an alternate port to connect to. If it is
417 * omitted or set to zero, then the default FTP port, 21, will be used.
418 * @param int $timeout This parameter specifies the timeout for all subsequent network operations.
419 * If omitted, the default value is 90 seconds. The timeout can be changed and
420 * queried at any time with ftp_set_option and
421 * ftp_get_option.
422 * @return resource Returns a SSL-FTP stream on success.
423 * @throws FtpException
424 *
425 */
426 function ftp_ssl_connect(string $host, int $port = 21, int $timeout = 90)
427 {
428 error_clear_last();
429 $result = \ftp_ssl_connect($host, $port, $timeout);
430 if ($result === \false) {
431 throw FtpException::createFromPhpError();
432 }
433 return $result;
434 }
435 /**
436 * Returns the system type identifier of the remote FTP server.
437 *
438 * @param resource $ftp_stream The link identifier of the FTP connection.
439 * @return string Returns the remote system type.
440 * @throws FtpException
441 *
442 */
443 function ftp_systype($ftp_stream): string
444 {
445 error_clear_last();
446 $result = \ftp_systype($ftp_stream);
447 if ($result === \false) {
448 throw FtpException::createFromPhpError();
449 }
450 return $result;
451 }
452