PluginProbe
Import WP – CSV & XML Import Export for WordPress / 2.15.0
Import WP – CSV & XML Import Export for WordPress v2.15.0
2.15.1 2.15.0 2.14.24 2.14.23 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 2.9.1 All 144 releases
← All changes | class/Common/Ftp/Ftp.php +18 -9 2.9.0 → 2.15.0 View file →
@@ -34,26 +34,35 @@
34 34 if ($this->_conn && $this->conn_hash !== md5($host . $user . $pass)) {
35 35 $this->disconnect();
36 36 }
37 37
38 + if (!function_exists('\ftp_connect')) {
39 + return new \WP_Error('IWP_FTP_3', __("To download via FTP please enable the php ftp extension.", 'jc-importer'));
40 + }
41 +
38 42 if (!$this->_conn) {
39 43 if (!$this->login($host, $user, $pass, $port)) {
40 - return new \WP_Error('IWP_FTP_0', "Unable to login to ftp server");
44 + return new \WP_Error('IWP_FTP_0', __("Unable to login to ftp server", 'jc-importer'));
41 45 }
42 46 }
43 47
44 48 if (!$this->_conn) {
45 - return new \WP_Error('IWP_FTP_0', "Unable to connect to ftp server");
49 + return new \WP_Error('IWP_FTP_0', __("Unable to connect to ftp server", 'jc-importer'));
46 50 }
47 51
48 - $size = ftp_size($this->_conn, $url);
49 - if ($size === -1) {
50 - return new \WP_Error('IWP_FTP_1', 'File doesn\'t exist on ftp server.');
51 - }
52 52
53 + // Note: Not all ftp servers support SIZE checks.
54 + $disable_filesize = apply_filters('iwp/ftp/disable_size_check', false);
55 + if(false === $disable_filesize){
56 +
57 + $size = ftp_size($this->_conn, $url);
58 + if ($size === -1) {
59 + return new \WP_Error('IWP_FTP_1', __('File doesn\'t exist on ftp server.', 'jc-importer'));
60 + }
53 61
54 - if ($size === 0) {
55 - return false;
62 + if ($size === 0) {
63 + return false;
64 + }
56 65 }
57 66
58 67 if (!empty($override_filename)) {
59 68
@@ -70,9 +79,9 @@
70 79 ftp_pasv($this->_conn, $passive_mode);
71 80
72 81 $result = ftp_get($this->_conn, $wp_dest, $url, FTP_BINARY);
73 82 if (false === $result) {
74 - return new \WP_Error('IWP_FTP_2', 'Unable to download: ' . $url . ' file via ftp.');
83 + return new \WP_Error('IWP_FTP_2', sprintf(__('Unable to download: %s file via ftp.', 'jc-importer'), $url));
75 84 }
76 85
77 86 return array(
78 87 'dest' => $wp_dest,