Media from FTP - Version 9.91

Version Description

Added file recursive search option.

Download this release

Release Info

Developer Katsushi Kawamori
Plugin Icon wp plugin Media from FTP
Version 9.91
Comparing to
See all releases

Code changes from version 9.90 to 9.91

inc/MediaFromFtp.php CHANGED
@@ -58,7 +58,7 @@ class MediaFromFtp {
58
  // for media-from-ftp-add-on-wpcron and mediafromftpcmd.php
59
  $cmdoptions = array();
60
  if ( $this->is_add_on_activate['cli'] ) {
61
- $cmdoptions = getopt("s:d:a:e:t:x:p:f:c:i:b:r:y:hgm");
62
  }
63
 
64
  if ( isset($cmdoptions['f']) ) {
@@ -78,6 +78,14 @@ class MediaFromFtp {
78
  } else {
79
  $excludefile = '-[0-9]+x[0-9]+\.|media-from-ftp-tmp'; // thumbnail & tmp dir file
80
  }
 
 
 
 
 
 
 
 
81
  global $blog_id;
82
  if ( is_multisite() && is_main_site($blog_id) ) {
83
  $excludefile .= '|\/sites\/';
@@ -138,7 +146,7 @@ class MediaFromFtp {
138
  }
139
  }
140
  }
141
- if (is_dir($fullpath)) {
142
  $list = array_merge($list, $this->scan_file($fullpath, $extpattern, $mediafromftp_settings));
143
  }
144
  }
58
  // for media-from-ftp-add-on-wpcron and mediafromftpcmd.php
59
  $cmdoptions = array();
60
  if ( $this->is_add_on_activate['cli'] ) {
61
+ $cmdoptions = getopt("s:d:a:e:t:x:p:f:c:i:b:r:y:hgmo");
62
  }
63
 
64
  if ( isset($cmdoptions['f']) ) {
78
  } else {
79
  $excludefile = '-[0-9]+x[0-9]+\.|media-from-ftp-tmp'; // thumbnail & tmp dir file
80
  }
81
+
82
+ $recursive_search = TRUE;
83
+ if ( isset($cmdoptions['o']) ) {
84
+ $recursive_search = FALSE;
85
+ } else {
86
+ $recursive_search = $mediafromftp_settings['recursive_search'];
87
+ }
88
+
89
  global $blog_id;
90
  if ( is_multisite() && is_main_site($blog_id) ) {
91
  $excludefile .= '|\/sites\/';
146
  }
147
  }
148
  }
149
+ if (is_dir($fullpath) && $recursive_search) {
150
  $list = array_merge($list, $this->scan_file($fullpath, $extpattern, $mediafromftp_settings));
151
  }
152
  }
mediafromftp.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Media from FTP
4
  Plugin URI: https://wordpress.org/plugins/media-from-ftp/
5
- Version: 9.90
6
  Description: Register to media library from files that have been uploaded by FTP.
7
  Author: Katsushi Kawamori
8
  Author URI: https://riverforest-wp.info/
2
  /*
3
  Plugin Name: Media from FTP
4
  Plugin URI: https://wordpress.org/plugins/media-from-ftp/
5
+ Version: 9.91
6
  Description: Register to media library from files that have been uploaded by FTP.
7
  Author: Katsushi Kawamori
8
  Author URI: https://riverforest-wp.info/
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: files, ftp, import, media, sync, uploads
5
  Requires at least: 3.6.0
6
  Requires PHP: 5.3.0
7
  Tested up to: 4.9
8
- Stable tag: 9.90
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -22,6 +22,8 @@ Register to media library from files that have been uploaded by FTP.
22
  * To Import the files to Media Library from a WordPress export file.
23
  * You can register a large number of files without timeout work with Ajax.
24
 
 
 
25
  = Why I made this? =
26
  * In the media uploader, you may not be able to upload by the environment of server. That's when the files are large. You do not mind the size of the file if FTP.
27
 
@@ -46,6 +48,12 @@ Register to media library from files that have been uploaded by FTP.
46
  * Media from FTP Settings -> Other -> Limit number of search files
47
  * Please reduce this number.
48
 
 
 
 
 
 
 
49
  = Certain file types can not be searched. =
50
  * If you want to add the mime type that can be used in the media library to each file type, Please use the <a href="https://wordpress.org/plugins/mime-types-plus/">Mime Types Plus</a>.
51
 
@@ -117,6 +125,9 @@ Register to media library from files that have been uploaded by FTP.
117
 
118
  == Changelog ==
119
 
 
 
 
120
  = 9.90 =
121
  Security measures.
122
  Fixed problem of "Date and time input assistance" settings.
5
  Requires at least: 3.6.0
6
  Requires PHP: 5.3.0
7
  Tested up to: 4.9
8
+ Stable tag: 9.91
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
22
  * To Import the files to Media Library from a WordPress export file.
23
  * You can register a large number of files without timeout work with Ajax.
24
 
25
+ [youtube https://www.youtube.com/watch?v=vdxPvOFZaDk]
26
+
27
  = Why I made this? =
28
  * In the media uploader, you may not be able to upload by the environment of server. That's when the files are large. You do not mind the size of the file if FTP.
29
 
48
  * Media from FTP Settings -> Other -> Limit number of search files
49
  * Please reduce this number.
50
 
51
+ * Media from FTP Settings -> Other -> Execution time
52
+ * Please increasing the number of seconds.
53
+
54
+ * Media from FTP Search & Register -> Screen Options -> Search method of files
55
+ * Check of "Search files only for specified directories."
56
+
57
  = Certain file types can not be searched. =
58
  * If you want to add the mime type that can be used in the media library to each file type, Please use the <a href="https://wordpress.org/plugins/mime-types-plus/">Mime Types Plus</a>.
59
 
125
 
126
  == Changelog ==
127
 
128
+ = 9.91 =
129
+ Added file recursive search option.
130
+
131
  = 9.90 =
132
  Security measures.
133
  Fixed problem of "Date and time input assistance" settings.
req/MediaFromFtpAdmin.php CHANGED
@@ -198,6 +198,26 @@ class MediaFromFtpAdmin {
198
  $return .= '</div>';
199
  $return .= '</div>';
200
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  $return .= '<div class="item-mediafromftp-settings">';
202
  $return .= '<legend>'.__('Search method for the exclusion of the thumbnail', 'media-from-ftp').'</legend>';
203
  $return .= '<div style="display: block;padding:5px 5px">';
@@ -1646,6 +1666,9 @@ class MediaFromFtpAdmin {
1646
  if (!empty($_POST['mediafromftp_exclude'])){
1647
  $mediafromftp_settings['exclude'] = sanitize_text_field(stripslashes($_POST['mediafromftp_exclude']));
1648
  }
 
 
 
1649
  if (isset($_POST['mediafromftp_thumb_deep_search'])){
1650
  $mediafromftp_settings['thumb_deep_search'] = sanitize_text_field($_POST['mediafromftp_thumb_deep_search']);
1651
  }
198
  $return .= '</div>';
199
  $return .= '</div>';
200
 
201
+ $return .= '<div class="item-mediafromftp-settings">';
202
+ $return .= '<legend>'.__('Search method of files', 'media-from-ftp').'</legend>';
203
+ $return .= '<div style="display: block;padding:5px 5px">';
204
+ if ($mediafromftp_settings['recursive_search'] == TRUE) {
205
+ $return .= '<input type="radio" name="mediafromftp_recursive_search" value="1" checked>';
206
+ } else {
207
+ $return .= '<input type="radio" name="mediafromftp_recursive_search" value="1">';
208
+ }
209
+ $return .= __('Recursively search files below specified directory.', 'media-from-ftp');
210
+ $return .= '</div>';
211
+ $return .= '<div style="display: block;padding:5px 5px">';
212
+ if ($mediafromftp_settings['recursive_search'] == FALSE) {
213
+ $return .= '<input type="radio" name="mediafromftp_recursive_search" value="0" checked>';
214
+ } else {
215
+ $return .= '<input type="radio" name="mediafromftp_recursive_search" value="0">';
216
+ }
217
+ $return .= __('Search files only for specified directories.', 'media-from-ftp');
218
+ $return .= '</div>';
219
+ $return .= '</div>';
220
+
221
  $return .= '<div class="item-mediafromftp-settings">';
222
  $return .= '<legend>'.__('Search method for the exclusion of the thumbnail', 'media-from-ftp').'</legend>';
223
  $return .= '<div style="display: block;padding:5px 5px">';
1666
  if (!empty($_POST['mediafromftp_exclude'])){
1667
  $mediafromftp_settings['exclude'] = sanitize_text_field(stripslashes($_POST['mediafromftp_exclude']));
1668
  }
1669
+ if (isset($_POST['mediafromftp_recursive_search'])){
1670
+ $mediafromftp_settings['recursive_search'] = sanitize_text_field($_POST['mediafromftp_recursive_search']);
1671
+ }
1672
  if (isset($_POST['mediafromftp_thumb_deep_search'])){
1673
  $mediafromftp_settings['thumb_deep_search'] = sanitize_text_field($_POST['mediafromftp_thumb_deep_search']);
1674
  }
req/MediaFromFtpRegist.php CHANGED
@@ -142,6 +142,7 @@ class MediaFromFtpRegist {
142
  $character_code = 'UTF-8';
143
  }
144
  $exclude = '(.ktai.)|(.backwpup_log.)|(.ps_auto_sitemap.)|\.php|\.js';
 
145
  $thumb_deep_search = FALSE;
146
  $search_limit_number = 100000;
147
  $cron_apply = FALSE;
@@ -212,6 +213,9 @@ class MediaFromFtpRegist {
212
  if ( array_key_exists( "exclude", $mediafromftp_settings ) ) {
213
  $exclude = $mediafromftp_settings['exclude'];
214
  }
 
 
 
215
  if ( array_key_exists( "thumb_deep_search", $mediafromftp_settings ) ) {
216
  $thumb_deep_search = $mediafromftp_settings['thumb_deep_search'];
217
  }
@@ -294,6 +298,9 @@ class MediaFromFtpRegist {
294
  if ( array_key_exists( "exclude", $mediafromftp_settings ) ) {
295
  $exclude = $mediafromftp_settings['exclude'];
296
  }
 
 
 
297
  if ( array_key_exists( "thumb_deep_search", $mediafromftp_settings ) ) {
298
  $thumb_deep_search = $mediafromftp_settings['thumb_deep_search'];
299
  }
@@ -349,6 +356,7 @@ class MediaFromFtpRegist {
349
  'max_execution_time' => $max_execution_time,
350
  'character_code' => $character_code,
351
  'exclude' => $exclude,
 
352
  'thumb_deep_search' => $thumb_deep_search,
353
  'search_limit_number' => $search_limit_number,
354
  'cron' => array(
142
  $character_code = 'UTF-8';
143
  }
144
  $exclude = '(.ktai.)|(.backwpup_log.)|(.ps_auto_sitemap.)|\.php|\.js';
145
+ $recursive_search = TRUE;
146
  $thumb_deep_search = FALSE;
147
  $search_limit_number = 100000;
148
  $cron_apply = FALSE;
213
  if ( array_key_exists( "exclude", $mediafromftp_settings ) ) {
214
  $exclude = $mediafromftp_settings['exclude'];
215
  }
216
+ if ( array_key_exists( "recursive_search", $mediafromftp_settings ) ) {
217
+ $recursive_search = $mediafromftp_settings['recursive_search'];
218
+ }
219
  if ( array_key_exists( "thumb_deep_search", $mediafromftp_settings ) ) {
220
  $thumb_deep_search = $mediafromftp_settings['thumb_deep_search'];
221
  }
298
  if ( array_key_exists( "exclude", $mediafromftp_settings ) ) {
299
  $exclude = $mediafromftp_settings['exclude'];
300
  }
301
+ if ( array_key_exists( "recursive_search", $mediafromftp_settings ) ) {
302
+ $recursive_search = $mediafromftp_settings['recursive_search'];
303
+ }
304
  if ( array_key_exists( "thumb_deep_search", $mediafromftp_settings ) ) {
305
  $thumb_deep_search = $mediafromftp_settings['thumb_deep_search'];
306
  }
356
  'max_execution_time' => $max_execution_time,
357
  'character_code' => $character_code,
358
  'exclude' => $exclude,
359
+ 'recursive_search' => $recursive_search,
360
  'thumb_deep_search' => $thumb_deep_search,
361
  'search_limit_number' => $search_limit_number,
362
  'cron' => array(