Add From Server - Version 3.4.2

Version Description

Download this release

Release Info

Developer dd32-githubsync
Plugin Icon wp plugin Add From Server
Version 3.4.2
Comparing to
See all releases

Code changes from version 3.4.1 to 3.4.2

add-from-server.php CHANGED
@@ -2,7 +2,7 @@
2
  namespace dd32\WordPress\AddFromServer;
3
  /*
4
  * Plugin Name: Add From Server
5
- * Version: 3.4.1
6
  * Plugin URI: https://dd32.id.au/wordpress-plugins/add-from-server/
7
  * 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.
8
  * Author: Dion Hulse
@@ -16,7 +16,7 @@ if ( !is_admin() ) {
16
 
17
  const MIN_WP = '5.4';
18
  const MIN_PHP = '7.0';
19
- const VERSION = '3.4.1';
20
 
21
  // Dynamic constants must be define()'d.
22
  define( __NAMESPACE__ . '\PLUGIN', plugin_basename( __FILE__ ) );
2
  namespace dd32\WordPress\AddFromServer;
3
  /*
4
  * Plugin Name: Add From Server
5
+ * Version: 3.4.2
6
  * Plugin URI: https://dd32.id.au/wordpress-plugins/add-from-server/
7
  * 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.
8
  * Author: Dion Hulse
16
 
17
  const MIN_WP = '5.4';
18
  const MIN_PHP = '7.0';
19
+ const VERSION = '3.4.2';
20
 
21
  // Dynamic constants must be define()'d.
22
  define( __NAMESPACE__ . '\PLUGIN', plugin_basename( __FILE__ ) );
changelog.txt CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  = 3.4 =
2
  * The plugin now requires WordPress 5.1+ and PHP 7.0+. No reason other than why not.
3
  * Bumps the version to stop the invalid vulnerability warnings.
1
+ = 3.4.2 =
2
+ * Restore case insensitive alphabetical sorting
3
+
4
+ = 3.4.1 =
5
+ * Plugin now requires WordPress 5.4+
6
+
7
  = 3.4 =
8
  * The plugin now requires WordPress 5.1+ and PHP 7.0+. No reason other than why not.
9
  * Bumps the version to stop the invalid vulnerability warnings.
class.add-from-server.php CHANGED
@@ -366,6 +366,11 @@ class Plugin {
366
 
367
  $dirparts = implode( '', $dirparts );
368
 
 
 
 
 
 
369
  // Get a list of files to show.
370
  $nodes = glob( rtrim( $cwd, '/' ) . '/*' ) ?: [];
371
 
@@ -402,6 +407,9 @@ class Plugin {
402
  ];
403
  } );
404
 
 
 
 
405
  // Prefix the parent directory.
406
  if ( str_starts_with( dirname( $cwd ), $root ) ) {
407
  $directories = array_merge(
@@ -435,10 +443,8 @@ class Plugin {
435
  ];
436
  } );
437
 
438
- // Importable files first.
439
- uasort( $files, function( $a, $b ) {
440
- return $a['error'] <=> $b['error'];
441
- } );
442
 
443
  ?>
444
  <div class="frmsvr_wrap">
@@ -500,8 +506,8 @@ class Plugin {
500
  );
501
  }
502
 
503
- if ( isset( $file ) && $file['error'] ) {
504
- // The last file was an error, display a expander.
505
  printf(
506
  '<tr class="hidden-toggle">
507
  <td>&nbsp;</td>
366
 
367
  $dirparts = implode( '', $dirparts );
368
 
369
+ // Sort alphabetically correctly..
370
+ $sort_by_text = function( $a, $b ) {
371
+ return strtolower( $a['text'] ) <=> strtolower( $b['text'] );
372
+ };
373
+
374
  // Get a list of files to show.
375
  $nodes = glob( rtrim( $cwd, '/' ) . '/*' ) ?: [];
376
 
407
  ];
408
  } );
409
 
410
+ // Sort the directories case insensitively.
411
+ uasort( $directories, $sort_by_text );
412
+
413
  // Prefix the parent directory.
414
  if ( str_starts_with( dirname( $cwd ), $root ) ) {
415
  $directories = array_merge(
443
  ];
444
  } );
445
 
446
+ // Sort case insensitively.
447
+ uasort( $files, $sort_by_text );
 
 
448
 
449
  ?>
450
  <div class="frmsvr_wrap">
506
  );
507
  }
508
 
509
+ // If we have any files that are error flagged, add the hidden row.
510
+ if ( array_filter( array_column( $files, 'error' ) ) ) {
511
  printf(
512
  '<tr class="hidden-toggle">
513
  <td>&nbsp;</td>
old-versions.php CHANGED
@@ -1,7 +1,17 @@
1
  <?php
 
2
 
3
  class Plugin {
4
  function __construct() {
 
 
 
 
 
 
 
 
 
5
 
6
  // Handle activation gracefully with a block screen.
7
  if (
@@ -13,30 +23,15 @@ class Plugin {
13
  isset( $_REQUEST['plugin'] ) &&
14
  PLUGIN == $_REQUEST['plugin']
15
  ) {
16
- die( sprintf(
17
- __( 'This plugin requires WordPress %1$s or greater, and PHP %2$s or greater. You are currently running WordPress %3$s and PHP %4$s. Please contact your website host or server administrator for more information. The plugin has been deactivated.', 'add-from-server' ),
18
- MIN_WP,
19
- MIN_PHP,
20
- $GLOBALS['wp_version'],
21
- phpversion()
22
- ) );
23
  }
24
 
25
- add_action( 'pre_current_active_plugins', array( $this, 'unsupported_plugins_notice' ) );
26
- }
27
-
28
- function unsupported_plugins_notice( $var ) {
29
- printf(
30
- '<div class="error"><p><strong>%s</strong>: %s</p></div>',
31
- __( 'Add From Server', 'add-from-server' ),
32
- sprintf(
33
- __( 'This plugin requires WordPress %1$s or greater, and PHP %2$s or greater. You are currently running WordPress %3$s and PHP %4$s. Please contact your website host or server administrator for more information. The plugin has been deactivated.', 'add-from-server' ),
34
- MIN_WP,
35
- MIN_PHP,
36
- $GLOBALS['wp_version'],
37
- phpversion()
38
- )
39
- );
40
  }
41
-
42
  }
1
  <?php
2
+ namespace dd32\WordPress\AddFromServer;
3
 
4
  class Plugin {
5
  function __construct() {
6
+ global $wp_version;
7
+
8
+ $error = sprintf(
9
+ __( 'This plugin requires WordPress %1$s or greater, and PHP %2$s or greater. You are currently running WordPress %3$s and PHP %4$s. Please contact your website host or server administrator for more information. The plugin has been deactivated.', 'add-from-server' ),
10
+ MIN_WP,
11
+ MIN_PHP,
12
+ $wp_version,
13
+ phpversion()
14
+ );
15
 
16
  // Handle activation gracefully with a block screen.
17
  if (
23
  isset( $_REQUEST['plugin'] ) &&
24
  PLUGIN == $_REQUEST['plugin']
25
  ) {
26
+ die( $error );
 
 
 
 
 
 
27
  }
28
 
29
+ add_action( 'pre_current_active_plugins', function() use( $error ) {
30
+ printf(
31
+ '<div class="error"><p><strong>%s</strong>: %s</p></div>',
32
+ __( 'Add From Server', 'add-from-server' ),
33
+ $error
34
+ );
35
+ } );
 
 
 
 
 
 
 
 
36
  }
 
37
  }
readme.md CHANGED
@@ -5,7 +5,7 @@ Add From Server
5
  * Requires at least: 5.4
6
  * Tested up to: 5.5
7
  * Requires PHP: 7.0
8
- * Stable tag: 3.4.1
9
 
10
  Add From Server is designed to help ease the pain of bad web hosts, allowing you to upload files via FTP or SSH and later import them into WordPress.
11
 
@@ -32,6 +32,9 @@ https://developer.wordpress.org/cli/commands/media/import/
32
 
33
  ## Changelog
34
 
 
 
 
35
  ### 3.4.1
36
  * Plugin now requires WordPress 5.4+
37
 
5
  * Requires at least: 5.4
6
  * Tested up to: 5.5
7
  * Requires PHP: 7.0
8
+ * Stable tag: 3.4.2
9
 
10
  Add From Server is designed to help ease the pain of bad web hosts, allowing you to upload files via FTP or SSH and later import them into WordPress.
11
 
32
 
33
  ## Changelog
34
 
35
+ ### 3.4.2
36
+ * Restore case insensitive alphabetical sorting
37
+
38
  ### 3.4.1
39
  * Plugin now requires WordPress 5.4+
40