Add From Server - Version 3.3.3

Version Description

  • Fixes some scenario's where the translation warning sticks around for translated (and other english locales)
    • Fixes a PHP Warning
    • Support per-user locales
    • Bumps required version of WordPress to 4.5+
Download this release

Release Info

Developer dd32
Plugin Icon wp plugin Add From Server
Version 3.3.3
Comparing to
See all releases

Code changes from version 3.3.2 to 3.3.3

Files changed (4) hide show
  1. add-from-server.php +3 -3
  2. changelog.txt +7 -1
  3. class.add-from-server.php +15 -8
  4. readme.txt +24 -9
add-from-server.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  * Plugin Name: Add From Server
4
- * Version: 3.3.2
5
  * Plugin URI: https://dd32.id.au/wordpress-plugins/add-from-server/
6
  * Description: Plugin to allow the Media Manager to add files from the webservers filesystem. <strong>Note:</strong> All files are copied to the uploads directory.
7
  * Author: Dion Hulse
@@ -13,7 +13,7 @@ if ( !is_admin() ) {
13
  return;
14
  }
15
 
16
- define( 'ADD_FROM_SERVER_WP_REQUIREMENT', '4.0' );
17
  define( 'ADD_FROM_SERVER_PHP_REQUIREMENT', '5.4' );
18
 
19
  // Old versions of WordPress or PHP
@@ -23,4 +23,4 @@ if ( version_compare( $GLOBALS['wp_version'], ADD_FROM_SERVER_WP_REQUIREMENT, '<
23
  include __DIR__ . '/class.add-from-server.php';
24
  }
25
 
26
- $add_from_server = new Add_From_Server( plugin_basename( __FILE__ ) );
1
  <?php
2
  /*
3
  * Plugin Name: Add From Server
4
+ * Version: 3.3.3
5
  * Plugin URI: https://dd32.id.au/wordpress-plugins/add-from-server/
6
  * Description: Plugin to allow the Media Manager to add files from the webservers filesystem. <strong>Note:</strong> All files are copied to the uploads directory.
7
  * Author: Dion Hulse
13
  return;
14
  }
15
 
16
+ define( 'ADD_FROM_SERVER_WP_REQUIREMENT', '4.5' );
17
  define( 'ADD_FROM_SERVER_PHP_REQUIREMENT', '5.4' );
18
 
19
  // Old versions of WordPress or PHP
23
  include __DIR__ . '/class.add-from-server.php';
24
  }
25
 
26
+ $add_from_server = new Add_From_Server( plugin_basename( __FILE__ ) );
changelog.txt CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  = 3.3.2 =
2
  * Security Fix: Fixes a CSRF vulnerability which could be used to trick a user into importing a large file to their site. Props to Edwin Molenaar (https://www.linkedin.com/in/edwinmolenaar)
3
  * Fix a typo that caused subsequent plugin activations to fail if the server doesn't meet the Add From Server requirements
@@ -98,4 +104,4 @@
98
  * Fixed a bug which causes the original import file to be deleted upon removing from the media library, The file in /uploads/2008/03/ remains however. Will now delete the file in the uploads folder instead of the original imported file, However, Be warned, files previously imported WILL remain as they are, and the original import file will be deleted(if you delete from the media library)
99
 
100
  = 1.0 =
101
- * Initial Release
1
+ = 3.3.3 =
2
+ * Fixes some scenario's where the translation warning sticks around for translated (and other english locales)
3
+ * Fixes a PHP Warning
4
+ * Support per-user locales
5
+ * Bumps required version of WordPress to 4.5+
6
+
7
  = 3.3.2 =
8
  * Security Fix: Fixes a CSRF vulnerability which could be used to trick a user into importing a large file to their site. Props to Edwin Molenaar (https://www.linkedin.com/in/edwinmolenaar)
9
  * Fix a typo that caused subsequent plugin activations to fail if the server doesn't meet the Add From Server requirements
104
  * Fixed a bug which causes the original import file to be deleted upon removing from the media library, The file in /uploads/2008/03/ remains however. Will now delete the file in the uploads folder instead of the original imported file, However, Be warned, files previously imported WILL remain as they are, and the original import file will be deleted(if you delete from the media library)
105
 
106
  = 1.0 =
107
+ * Initial Release
class.add-from-server.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  class Add_From_Server {
4
 
5
- var $version = '3.3.2';
6
  var $basename = '';
7
 
8
  function __construct( $plugin ) {
@@ -523,17 +523,19 @@ class Add_From_Server {
523
  $parts = array_merge( (array)'', $parts );
524
  }
525
 
526
- array_walk( $parts, function( &$item, $index ) use( $url, $parts ) {
527
- $path = implode( '/', array_slice( $parts, 0, $index + 1 ) );
528
- $path = ltrim( $path, '/' ) ?: '/';
529
- $item_url = add_query_arg( array( 'adirectory' => $path ), $url );
 
530
 
531
  if ( $index == count( $parts ) - 1 ) {
532
  $item = esc_html( $item ) . '/';
533
  } else {
534
  $item = sprintf( '<a href="%s">%s/</a>', esc_url( $item_url ), esc_html( $item ) );
535
  }
536
- } );
 
537
  $dirparts = implode( '', $parts );
538
 
539
  ?>
@@ -736,8 +738,13 @@ I notice you use WordPress in a Language other than English (US), Did you know y
736
  If you\'d like to help out with translating this plugin into %1$s you can head over to <a href="%2$s">translate.WordPress.org</a> and suggest translations for any languages which you know.
737
  Thanks! Dion.', 'add-from-server' );
738
 
739
- // Don't display the message for English (US) or what we'll assume to be fully translated localised builds.
740
- if ( 'en_US' === get_locale() || ( $message == $message_english && ! $force ) ) {
 
 
 
 
 
741
  return false;
742
  }
743
 
2
 
3
  class Add_From_Server {
4
 
5
+ var $version = '3.3.3';
6
  var $basename = '';
7
 
8
  function __construct( $plugin ) {
523
  $parts = array_merge( (array)'', $parts );
524
  }
525
 
526
+ // array_walk() + eAccelerator + anonymous function = bad news
527
+ foreach ( $parts as $index => &$item ) {
528
+ $this_path = implode( '/', array_slice( $parts, 0, $index + 1 ) );
529
+ $this_path = ltrim( $this_path, '/' ) ?: '/';
530
+ $item_url = add_query_arg( array( 'adirectory' => $this_path ), $url );
531
 
532
  if ( $index == count( $parts ) - 1 ) {
533
  $item = esc_html( $item ) . '/';
534
  } else {
535
  $item = sprintf( '<a href="%s">%s/</a>', esc_url( $item_url ), esc_html( $item ) );
536
  }
537
+ }
538
+
539
  $dirparts = implode( '', $parts );
540
 
541
  ?>
738
  If you\'d like to help out with translating this plugin into %1$s you can head over to <a href="%2$s">translate.WordPress.org</a> and suggest translations for any languages which you know.
739
  Thanks! Dion.', 'add-from-server' );
740
 
741
+ $locale = get_locale();
742
+ if ( function_exists( 'get_user_locale' ) ) {
743
+ $locale = get_user_locale();
744
+ }
745
+
746
+ // Don't display the message for English (Any) or what we'll assume to be fully translated localised builds.
747
+ if ( 'en_' === substr( $locale, 0, 3 ) || ( $message != $message_english && ! $force ) ) {
748
  return false;
749
  }
750
 
readme.txt CHANGED
@@ -1,18 +1,29 @@
1
  === Add From Server ===
2
  Contributors: dd32
3
  Tags: admin, media, uploads, post, import, files
4
- Requires at least: 4.0
 
5
  Stable tag: 3.3.2
6
 
7
  "Add From Server" is a quick plugin which allows you to import media & files into the WordPress uploads manager from the Webservers filesystem
8
 
9
  == Description ==
10
 
 
 
 
 
11
  The heart of a CMS is the ability to upload and insert content, WordPress does a fantastic job at this, unfortunately, some web hosts have limited servers, or users simply do not have the ability to upload large files through their web browser.
12
  Add From Server is designed to help ease this pain, You can upload a bunch of files via FTP (Or your favourite transmission method) and simply import those files from the webserver directly into WordPress.
13
 
14
  == Changelog ==
15
 
 
 
 
 
 
 
16
  = 3.3.2 =
17
  * Security Fix: Fixes a CSRF vulnerability which could be used to trick a user into importing a large file to their site. Props to Edwin Molenaar (https://www.linkedin.com/in/edwinmolenaar)
18
  * Fix a typo that caused subsequent plugin activations to fail if the server doesn't meet the Add From Server requirements
@@ -36,17 +47,21 @@ Warning: This plugin now requires WordPress 4.0 & PHP 5.4. Updates to support Wo
36
  Warning: This plugin now requires WordPress 4.0 & PHP 5.4. Updates to support WordPress 4.3 & WordPress.org Language Pack Translations
37
 
38
  == FAQ ==
39
- Q: What placeholders can I use in the Root path option?
40
- You can use %role% and %username% only. In the case of Role, The first role which the user has is used, This can mean that in complex installs, that using %role% is unreliable.
41
 
42
- Q: Why does the file I want to import have a red background?
43
- WordPress only allows the importing/uploading of certain file types to improve your security. If you wish to add extra file types, you can use a plugin such as: http://wordpress.org/extend/plugins/pjw-mime-config/ You can also enable "Unfiltered uploads" globally for WordPress if you'd like to override this security function. Please see the WordPress support forum for details.
 
 
 
 
 
44
 
45
- Q: Where are the files saved?
46
- If you import a file which is outside your standard upload directory (usually wp-content/uploads/) then it will be copied to your current upload directory setting as normal. If you however import a file which -is already within the uploads directory- (for example, wp-content/uploads/2011/02/superplugin.zip) then the file will not be copied, and will be used as-is.
 
47
 
48
- Q: I have a a bug report
49
- Then please email me! wordpress at dd32.id.au is best.
50
 
51
  == Screenshots ==
52
 
1
  === Add From Server ===
2
  Contributors: dd32
3
  Tags: admin, media, uploads, post, import, files
4
+ Requires at least: 4.5
5
+ Tested up to: 4.9
6
  Stable tag: 3.3.2
7
 
8
  "Add From Server" is a quick plugin which allows you to import media & files into the WordPress uploads manager from the Webservers filesystem
9
 
10
  == Description ==
11
 
12
+ ** Support for this plugin is NOT offered, This plugin still however works. Please don't expect support requests to be answered, or "This doesn't work" reviews to be responded to. **
13
+
14
+ Please Note: This plugin is not designed to replace the media uploader. This plugin is not designed to be used for migration of sites. This plugin is not designed to re-import your media upload history. This plugin is not designed to Batch import your media. Etc. This plugin is 8 years old and designed for importing singular large files which could not be uploaded through the administration interface.
15
+
16
  The heart of a CMS is the ability to upload and insert content, WordPress does a fantastic job at this, unfortunately, some web hosts have limited servers, or users simply do not have the ability to upload large files through their web browser.
17
  Add From Server is designed to help ease this pain, You can upload a bunch of files via FTP (Or your favourite transmission method) and simply import those files from the webserver directly into WordPress.
18
 
19
  == Changelog ==
20
 
21
+ = 3.3.3 =
22
+ * Fixes some scenario's where the translation warning sticks around for translated (and other english locales)
23
+ * Fixes a PHP Warning
24
+ * Support per-user locales
25
+ * Bumps required version of WordPress to 4.5+
26
+
27
  = 3.3.2 =
28
  * Security Fix: Fixes a CSRF vulnerability which could be used to trick a user into importing a large file to their site. Props to Edwin Molenaar (https://www.linkedin.com/in/edwinmolenaar)
29
  * Fix a typo that caused subsequent plugin activations to fail if the server doesn't meet the Add From Server requirements
47
  Warning: This plugin now requires WordPress 4.0 & PHP 5.4. Updates to support WordPress 4.3 & WordPress.org Language Pack Translations
48
 
49
  == FAQ ==
 
 
50
 
51
+ = What placeholders can I use in the Root path option? =
52
+ You can use `%role%` and `%username%` only.
53
+ In the case of `%role%`, the first role which the user has is used, this can mean that in complex installs where a user has many roles that using %role% could be unreliable.
54
+
55
+ = Why does the file I want to import have a red background? =
56
+ WordPress only allows the importing/uploading of certain file types to improve your security.
57
+ If you wish to add extra file types, you can use a plugin such as: http://wordpress.org/extend/plugins/pjw-mime-config/ You can also enable "Unfiltered uploads" globally for WordPress if you'd like to override this security function. Please see the WordPress support forum for details.
58
 
59
+ = Where are the files saved? =
60
+ If you import a file which is outside your standard upload directory (usually wp-content/uploads/) then it will be copied to your current upload directory setting as normal.
61
+ If you however import a file which **is already within the uploads directory** (for example, wp-content/uploads/2011/02/superplugin.zip) then the file will not be copied, and will be used as-is.
62
 
63
+ = I have a a bug report =
64
+ You can report bugs in the <a href="https://wordpress.org/support/plugin/add-from-server">plugins Support Forum here</a>
65
 
66
  == Screenshots ==
67