Version Description
- Tested up to WordPress 4.7.1
- Fixed finfo_file issue. See FAQ section.
Download this release
Release Info
Developer | kimipooh |
Plugin | WP Add Mime Types |
Version | 2.1.0 |
Comparing to | |
See all releases |
Code changes from version 2.0.6 to 2.1.0
- readme.txt +8 -2
- wp-add-mime-types.php +39 -2
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: Kimiya Kitani
|
3 |
Tags: mime,file extention
|
4 |
Requires at least: 3.0
|
5 |
-
Tested up to: 4.7
|
6 |
-
Stable tag: 2.0
|
7 |
|
8 |
The plugin additionally allows the mime types and file extensions to WordPress.
|
9 |
|
@@ -36,6 +36,8 @@ You can see the list of allowed mime types and file extensions by WordPress.
|
|
36 |
|
37 |
== Frequently Asked Questions ==
|
38 |
|
|
|
|
|
39 |
= Cannot work =
|
40 |
If the added mime type does not work, please deactivate other mime type plugins or the setting of other mime type plugins.
|
41 |
|
@@ -58,6 +60,10 @@ Yes, each setting values are saved as the other setting items.
|
|
58 |
|
59 |
== Changelog ==
|
60 |
|
|
|
|
|
|
|
|
|
61 |
= 2.0.6 =
|
62 |
* Tested up to WordPress 4.7
|
63 |
|
2 |
Contributors: Kimiya Kitani
|
3 |
Tags: mime,file extention
|
4 |
Requires at least: 3.0
|
5 |
+
Tested up to: 4.7.1
|
6 |
+
Stable tag: 2.1.0
|
7 |
|
8 |
The plugin additionally allows the mime types and file extensions to WordPress.
|
9 |
|
36 |
|
37 |
== Frequently Asked Questions ==
|
38 |
|
39 |
+
* (Above 4.7.1) In case of custom extension in this plugins' setting, the WordPress 4.7.1 file contents check system using finfo_info function is always true.
|
40 |
+
|
41 |
= Cannot work =
|
42 |
If the added mime type does not work, please deactivate other mime type plugins or the setting of other mime type plugins.
|
43 |
|
60 |
|
61 |
== Changelog ==
|
62 |
|
63 |
+
= 2.1.0 =
|
64 |
+
* Tested up to WordPress 4.7.1
|
65 |
+
* Fixed finfo_file issue. See FAQ section.
|
66 |
+
|
67 |
= 2.0.6 =
|
68 |
* Tested up to WordPress 4.7
|
69 |
|
wp-add-mime-types.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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.0
|
7 |
Author: Kimiya Kitani
|
8 |
Author URI: http://kitaney-wordpress.blogspot.jp/
|
9 |
Text Domain: wp-add-mime-types
|
@@ -19,7 +19,7 @@ add_action('plugins_loaded', 'enable_language_translation');
|
|
19 |
$plugin_basename = plugin_basename ( __FILE__ );
|
20 |
|
21 |
$default_var = array(
|
22 |
-
'wp_add_mime_types' => '2.0
|
23 |
);
|
24 |
|
25 |
// Add Setting to WordPress 'Settings' menu for Multisite.
|
@@ -59,3 +59,40 @@ function add_allow_upload_extension( $mimes ) {
|
|
59 |
|
60 |
// Register the Procedure process to WordPress.
|
61 |
add_filter( 'upload_mimes', 'add_allow_upload_extension');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.1.0
|
7 |
Author: Kimiya Kitani
|
8 |
Author URI: http://kitaney-wordpress.blogspot.jp/
|
9 |
Text Domain: wp-add-mime-types
|
19 |
$plugin_basename = plugin_basename ( __FILE__ );
|
20 |
|
21 |
$default_var = array(
|
22 |
+
'wp_add_mime_types' => '2.1.0',
|
23 |
);
|
24 |
|
25 |
// Add Setting to WordPress 'Settings' menu for Multisite.
|
59 |
|
60 |
// Register the Procedure process to WordPress.
|
61 |
add_filter( 'upload_mimes', 'add_allow_upload_extension');
|
62 |
+
|
63 |
+
|
64 |
+
// Exception for WordPress 4.7.1 file contents check system using finfo_file (wp-include/functions.php)
|
65 |
+
// In case of custom extension in this plugins' setting, the WordPress 4.7.1 file contents check system is always true.
|
66 |
+
function add_allow_upload_extension_exception( $file, $filename, $mimes ) {
|
67 |
+
global $plugin_basename;
|
68 |
+
$ext = $type = $proper_filename = false;
|
69 |
+
list($f_name,$f_ext) = explode(".", $mimes);
|
70 |
+
|
71 |
+
if ( ! function_exists( 'is_plugin_active_for_network' ) )
|
72 |
+
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
73 |
+
|
74 |
+
if(is_multisite() && is_plugin_active_for_network($plugin_basename))
|
75 |
+
$settings = get_site_option('wp_add_mime_types_network_array');
|
76 |
+
else
|
77 |
+
$settings = get_option('wp_add_mime_types_array');
|
78 |
+
|
79 |
+
if(!isset($settings['mime_type_values']) || empty($settings['mime_type_values'])) return compact( 'ext', 'type', 'proper_filename' );
|
80 |
+
else
|
81 |
+
$mime_type_values = unserialize($settings['mime_type_values']);
|
82 |
+
|
83 |
+
foreach ($mime_type_values as $line){
|
84 |
+
$line_value = explode("=", $line);
|
85 |
+
if(count($line_value) != 2) continue;
|
86 |
+
|
87 |
+
// " " is the Japanese multi-byte space. If the character is found out, it automatically change the space.
|
88 |
+
if(trim($line_value[0]) === $f_ext){
|
89 |
+
$ext = $f_ext;
|
90 |
+
$type = trim(str_replace(" ", " ", $line_value[1]));
|
91 |
+
break;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
return compact( 'ext', 'type', 'proper_filename' );
|
96 |
+
}
|
97 |
+
|
98 |
+
add_filter( 'wp_check_filetype_and_ext', 'add_allow_upload_extension_exception',10,3);
|