Media from FTP - Version 10.03

Version Description

Add server path status.

Download this release

Release Info

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

Code changes from version 10.02 to 10.03

inc/MediaFromFtp.php CHANGED
@@ -287,7 +287,7 @@ class MediaFromFtp {
287
  $cash_thumb2->save( $cash_thumb_filename );
288
  $view_thumb_url = $this->plugin_tmp_url.'/'.$cash_thumb_key.'-pdf.jpg';
289
  } else {
290
- $view_thumb_url = $this->siteurl(). WPINC . '/images/media/'.$filetype2.'.png';
291
  }
292
  } else {
293
  $cash_thumb->resize( 40 ,40, true );
@@ -295,13 +295,13 @@ class MediaFromFtp {
295
  $view_thumb_url = $this->plugin_tmp_url.'/'.$cash_thumb_key.'.'.$ext;
296
  }
297
  } else {
298
- $view_thumb_url = $this->siteurl(). WPINC . '/images/media/'.$filetype2.'.png';
299
  }
300
  } else {
301
  if ( file_exists( $cash_thumb_filename )) {
302
  $view_thumb_url = $this->plugin_tmp_url.'/'.$cash_thumb_key.'.'.$ext;
303
  } else {
304
- $view_thumb_url = $this->siteurl(). WPINC . '/images/media/'.$filetype2.'.png';
305
  }
306
  }
307
  set_transient( $cash_thumb_key, $view_thumb_url, DAY_IN_SECONDS);
@@ -477,13 +477,13 @@ class MediaFromFtp {
477
  if ( wp_ext2type($ext) === 'image' || strtolower($ext) === 'pdf' ){
478
  $view_thumb_url = $this->create_cash($ext, $file, $new_url);
479
  } else if ( wp_ext2type($ext) === 'audio' ) {
480
- $view_thumb_url = $this->siteurl(). WPINC . '/images/media/audio.png';
481
  $metadata_audio = wp_read_audio_metadata( $file );
482
  $file_size = size_format($metadata_audio['filesize']);
483
  $mimetype = $metadata_audio['fileformat'].'('.$metadata_audio['mime_type'].')';
484
  $length = $metadata_audio['length_formatted'];
485
  } else if ( wp_ext2type($ext) === 'video' ) {
486
- $view_thumb_url = $this->siteurl(). WPINC . '/images/media/video.png';
487
  $metadata_video = wp_read_video_metadata( $file );
488
  $file_size = size_format($metadata_video['filesize']);
489
  $mimetype = $metadata_video['fileformat'].'('.$metadata_video['mime_type'].')';
@@ -491,7 +491,7 @@ class MediaFromFtp {
491
  } else {
492
  $filetype2 = wp_ext2type($ext);
493
  if ( empty($filetype2) ) { $filetype2 = 'default'; }
494
- $view_thumb_url = $this->siteurl(). WPINC . '/images/media/'.$filetype2.'.png';
495
  }
496
  $input_html .= '<img width="40" height="40" src="'.$view_thumb_url.'" style="float: left; margin: 5px;">';
497
  }
@@ -1189,12 +1189,12 @@ class MediaFromFtp {
1189
  * @return $siteurl
1190
  * @since 8.5
1191
  */
1192
- private function siteurl(){
1193
  if ( is_multisite() ) {
1194
  global $blog_id;
1195
- $siteurl = trailingslashit(get_blog_details($blog_id)->siteurl);
1196
  } else {
1197
- $siteurl = site_url('/');
1198
  }
1199
  return $siteurl;
1200
  }
287
  $cash_thumb2->save( $cash_thumb_filename );
288
  $view_thumb_url = $this->plugin_tmp_url.'/'.$cash_thumb_key.'-pdf.jpg';
289
  } else {
290
+ $view_thumb_url = $this->siteurl().'/'.WPINC . '/images/media/'.$filetype2.'.png';
291
  }
292
  } else {
293
  $cash_thumb->resize( 40 ,40, true );
295
  $view_thumb_url = $this->plugin_tmp_url.'/'.$cash_thumb_key.'.'.$ext;
296
  }
297
  } else {
298
+ $view_thumb_url = $this->siteurl().'/'.WPINC . '/images/media/'.$filetype2.'.png';
299
  }
300
  } else {
301
  if ( file_exists( $cash_thumb_filename )) {
302
  $view_thumb_url = $this->plugin_tmp_url.'/'.$cash_thumb_key.'.'.$ext;
303
  } else {
304
+ $view_thumb_url = $this->siteurl().'/'.WPINC . '/images/media/'.$filetype2.'.png';
305
  }
306
  }
307
  set_transient( $cash_thumb_key, $view_thumb_url, DAY_IN_SECONDS);
477
  if ( wp_ext2type($ext) === 'image' || strtolower($ext) === 'pdf' ){
478
  $view_thumb_url = $this->create_cash($ext, $file, $new_url);
479
  } else if ( wp_ext2type($ext) === 'audio' ) {
480
+ $view_thumb_url = $this->siteurl().'/'.WPINC . '/images/media/audio.png';
481
  $metadata_audio = wp_read_audio_metadata( $file );
482
  $file_size = size_format($metadata_audio['filesize']);
483
  $mimetype = $metadata_audio['fileformat'].'('.$metadata_audio['mime_type'].')';
484
  $length = $metadata_audio['length_formatted'];
485
  } else if ( wp_ext2type($ext) === 'video' ) {
486
+ $view_thumb_url = $this->siteurl().'/'.WPINC . '/images/media/video.png';
487
  $metadata_video = wp_read_video_metadata( $file );
488
  $file_size = size_format($metadata_video['filesize']);
489
  $mimetype = $metadata_video['fileformat'].'('.$metadata_video['mime_type'].')';
491
  } else {
492
  $filetype2 = wp_ext2type($ext);
493
  if ( empty($filetype2) ) { $filetype2 = 'default'; }
494
+ $view_thumb_url = $this->siteurl().'/'.WPINC . '/images/media/'.$filetype2.'.png';
495
  }
496
  $input_html .= '<img width="40" height="40" src="'.$view_thumb_url.'" style="float: left; margin: 5px;">';
497
  }
1189
  * @return $siteurl
1190
  * @since 8.5
1191
  */
1192
+ public function siteurl(){
1193
  if ( is_multisite() ) {
1194
  global $blog_id;
1195
+ $siteurl = get_blog_details($blog_id)->siteurl;
1196
  } else {
1197
+ $siteurl = site_url();
1198
  }
1199
  return $siteurl;
1200
  }
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: 10.02
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: 10.03
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: 10.02
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -126,6 +126,9 @@ Register to media library from files that have been uploaded by FTP.
126
 
127
  == Changelog ==
128
 
 
 
 
129
  = 10.02 =
130
  Fixed problem of cache at search.
131
  Fixed problem of translation.
5
  Requires at least: 3.6.0
6
  Requires PHP: 5.3.0
7
  Tested up to: 4.9
8
+ Stable tag: 10.03
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
126
 
127
  == Changelog ==
128
 
129
+ = 10.03 =
130
+ Add server path status.
131
+
132
  = 10.02 =
133
  Fixed problem of cache at search.
134
  Fixed problem of translation.
req/MediaFromFtpAdmin.php CHANGED
@@ -30,6 +30,7 @@ class MediaFromFtpAdmin {
30
  private $plugin_base_url;
31
  private $plugin_dir;
32
  private $upload_dir;
 
33
  private $upload_path;
34
  private $plugin_tmp_url;
35
  private $plugin_tmp_dir;
@@ -56,11 +57,11 @@ class MediaFromFtpAdmin {
56
  require_once( $plugin_base_dir.'/req/MediaFromFtpListTable.php' );
57
  }
58
  $mediafromftp = new MediaFromFtp();
59
- list($this->upload_dir, $upload_url, $this->upload_path) = $mediafromftp->upload_dir_url_path();
60
 
61
- $this->plugin_tmp_url = $upload_url.'/media-from-ftp-tmp';
62
  $this->plugin_tmp_dir = $this->upload_dir.'/media-from-ftp-tmp';
63
- $this->plugin_disallow_tmp_dir = str_replace(home_url(), '', site_url()).'/'.$this->upload_path.'/media-from-ftp-tmp/';
64
 
65
  $category_active = FALSE;
66
  if( function_exists('media_from_ftp_add_on_category_load_textdomain') ){
@@ -453,6 +454,8 @@ class MediaFromFtpAdmin {
453
  <h3><?php _e('Register to media library from files that have been uploaded by FTP.', 'media-from-ftp'); ?></h3>
454
 
455
  <?php $this->credit(); ?>
 
 
456
 
457
  </div>
458
  <?php
@@ -518,6 +521,39 @@ class MediaFromFtpAdmin {
518
 
519
  }
520
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
521
  /* ==================================================
522
  * Sub Menu
523
  */
30
  private $plugin_base_url;
31
  private $plugin_dir;
32
  private $upload_dir;
33
+ private $upload_url;
34
  private $upload_path;
35
  private $plugin_tmp_url;
36
  private $plugin_tmp_dir;
57
  require_once( $plugin_base_dir.'/req/MediaFromFtpListTable.php' );
58
  }
59
  $mediafromftp = new MediaFromFtp();
60
+ list($this->upload_dir, $this->upload_url, $this->upload_path) = $mediafromftp->upload_dir_url_path();
61
 
62
+ $this->plugin_tmp_url = $this->upload_url.'/media-from-ftp-tmp';
63
  $this->plugin_tmp_dir = $this->upload_dir.'/media-from-ftp-tmp';
64
+ $this->plugin_disallow_tmp_dir = str_replace(home_url(), '', $mediafromftp->siteurl()).'/'.$this->upload_path.'/media-from-ftp-tmp/';
65
 
66
  $category_active = FALSE;
67
  if( function_exists('media_from_ftp_add_on_category_load_textdomain') ){
454
  <h3><?php _e('Register to media library from files that have been uploaded by FTP.', 'media-from-ftp'); ?></h3>
455
 
456
  <?php $this->credit(); ?>
457
+ <hr>
458
+ <?php $this->server_path_status(); ?>
459
 
460
  </div>
461
  <?php
521
 
522
  }
523
 
524
+ /* ==================================================
525
+ * Server Path Status
526
+ */
527
+ private function server_path_status() {
528
+
529
+ ?>
530
+ <h3><?php _e('Server path status', 'media-from-ftp'); ?></h3>
531
+ <h4><?php _e('If something goes wrong, please report the following to the support forum. If you do not want to show the Url or Path, please hide it part.', 'media-from-ftp'); ?></h4>
532
+ <?php
533
+ $wp_uploads = wp_upload_dir();
534
+ $mediafromftp = new MediaFromFtp();
535
+ $status = "\n";
536
+ $status .= 'WordPress'."\n";
537
+ $status .= 'Home Url: '.home_url()."\n";
538
+ $status .= 'ABSPATH: '.wp_normalize_path(ABSPATH)."\n";
539
+ $status .= 'wp_upload_dir[basedir]: '.$wp_uploads['basedir']."\n";
540
+ $status .= 'wp_upload_dir[baseurl]: '.$wp_uploads['baseurl']."\n";
541
+ $status .= 'WPINC: '.WPINC."\n";
542
+ $status .= "\n";
543
+ $status .= 'Media from FTP'."\n";
544
+ $status .= 'Upload Dir: '.$this->upload_dir."\n";
545
+ $status .= 'Upload Url: '.$this->upload_url."\n";
546
+ $status .= 'Upload Path: '.$this->upload_path."\n";
547
+ $status .= 'Plugin Disallow Tmp Dir: '.$this->plugin_disallow_tmp_dir."\n";
548
+ $status .= 'Site Url: '.$mediafromftp->siteurl()."\n";
549
+ ?>
550
+ <textarea readonly rows="14" style="font-size: 12px; width: 100%;">
551
+ <?php echo $status; ?>
552
+ </textarea>
553
+ <?php
554
+
555
+ }
556
+
557
  /* ==================================================
558
  * Sub Menu
559
  */