WP Add Mime Types - Version 2.5.5

Version Description

  • Fixed the error "the "Too few argument" for WordPress 5.0 or previous versions.
Download this release

Release Info

Developer kimipooh
Plugin Icon wp plugin WP Add Mime Types
Version 2.5.5
Comparing to
See all releases

Code changes from version 2.5.4 to 2.5.5

Files changed (2) hide show
  1. readme.txt +4 -2
  2. wp-add-mime-types.php +11 -4
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Kimiya Kitani
3
  Tags: mime,file extention
4
  Requires at least: 4.0
5
  Requires PHP: 5.6
6
- Tested up to: 5.3.2
7
- Stable tag: 2.5.4
8
  License: GPL v2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -78,6 +78,8 @@ Yes, each setting values are saved as the other setting items.
78
 
79
 
80
  == Changelog ==
 
 
81
 
82
  = 2.5.4 =
83
  * Added the function for removing this plugin's settings in the database when this plugin is uninstall.
3
  Tags: mime,file extention
4
  Requires at least: 4.0
5
  Requires PHP: 5.6
6
+ Tested up to: 5.4.2
7
+ Stable tag: 2.5.5
8
  License: GPL v2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
78
 
79
 
80
  == Changelog ==
81
+ = 2.5.5 =
82
+ * Fixed the error "the "Too few argument" for WordPress 5.0 or previous versions.
83
 
84
  = 2.5.4 =
85
  * Added the function for removing this plugin's settings in the database when this plugin is uninstall.
wp-add-mime-types.php CHANGED
@@ -3,13 +3,13 @@
3
  Plugin Name: WP Add Mime Types
4
  Plugin URI:
5
  Description: The plugin additionally allows the mime types and file extensions to WordPress.
6
- Version: 2.5.4
7
  Author: Kimiya Kitani
8
  Author URI: http://kitaney-wordpress.blogspot.jp/
9
  Text Domain: wp-add-mime-types
10
  Domain Path: /lang
11
  */
12
- define('WAMT_DEFAULT_VAR', '2.5.4');
13
  define('WAMT_PLUGIN_DIR', 'wp-add-mime-types');
14
  define('WAMT_PLUGIN_NAME', 'wp-add-mime-types');
15
  define('WAMT_PLUGIN_BASENAME', WAMT_PLUGIN_DIR . '/' . WAMT_PLUGIN_NAME . '.php');
@@ -83,7 +83,8 @@ function wamt_remove_underscore($filename, $filename_raw){
83
  }
84
  // Exception for WordPress 4.7.1 file contents check system using finfo_file (wp-includes/functions.php)
85
  // In case of custom extension in this plugins' setting, the WordPress 4.7.1 file contents check system is always true.
86
- function wamt_add_allow_upload_extension_exception( $data, $file, $filename,$mimes,$real_mime) {
 
87
  $mime_type_values = false;
88
 
89
  if(is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME))
@@ -160,4 +161,10 @@ function wamt_add_allow_upload_extension_exception( $data, $file, $filename,$mim
160
  return $data;
161
  }
162
 
163
- add_filter( 'wp_check_filetype_and_ext', 'wamt_add_allow_upload_extension_exception',10,5);
 
 
 
 
 
 
3
  Plugin Name: WP Add Mime Types
4
  Plugin URI:
5
  Description: The plugin additionally allows the mime types and file extensions to WordPress.
6
+ Version: 2.5.5
7
  Author: Kimiya Kitani
8
  Author URI: http://kitaney-wordpress.blogspot.jp/
9
  Text Domain: wp-add-mime-types
10
  Domain Path: /lang
11
  */
12
+ define('WAMT_DEFAULT_VAR', '2.5.5');
13
  define('WAMT_PLUGIN_DIR', 'wp-add-mime-types');
14
  define('WAMT_PLUGIN_NAME', 'wp-add-mime-types');
15
  define('WAMT_PLUGIN_BASENAME', WAMT_PLUGIN_DIR . '/' . WAMT_PLUGIN_NAME . '.php');
83
  }
84
  // Exception for WordPress 4.7.1 file contents check system using finfo_file (wp-includes/functions.php)
85
  // In case of custom extension in this plugins' setting, the WordPress 4.7.1 file contents check system is always true.
86
+
87
+ function wamt_add_allow_upload_extension_exception( $data, $file, $filename,$mimes,$real_mime=null) {
88
  $mime_type_values = false;
89
 
90
  if(is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME))
161
  return $data;
162
  }
163
 
164
+ // It's different arguments between WordPress 5.1 and previous versions.
165
+ global $wp_version;
166
+ if ( version_compare( $wp_version, '5.1') >= 0):
167
+ add_filter( 'wp_check_filetype_and_ext', 'wamt_add_allow_upload_extension_exception',10,5);
168
+ else:
169
+ add_filter( 'wp_check_filetype_and_ext', 'wamt_add_allow_upload_extension_exception',10,4);
170
+ endif;