Version Description
- Fixed the issue that the safe files in WordPress, such as jpg, png, pdf cannot be uploaded.
Download this release
Release Info
Developer | kimipooh |
Plugin | WP Add Mime Types |
Version | 2.1.1 |
Comparing to | |
See all releases |
Code changes from version 2.1.0 to 2.1.1
- readme.txt +4 -1
- wp-add-mime-types.php +10 -5
readme.txt
CHANGED
@@ -3,7 +3,7 @@ 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.
|
7 |
|
8 |
The plugin additionally allows the mime types and file extensions to WordPress.
|
9 |
|
@@ -60,6 +60,9 @@ Yes, each setting values are saved as the other setting items.
|
|
60 |
|
61 |
== Changelog ==
|
62 |
|
|
|
|
|
|
|
63 |
= 2.1.0 =
|
64 |
* Tested up to WordPress 4.7.1
|
65 |
* Fixed finfo_file issue. See FAQ section.
|
3 |
Tags: mime,file extention
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.7.1
|
6 |
+
Stable tag: 2.1.1
|
7 |
|
8 |
The plugin additionally allows the mime types and file extensions to WordPress.
|
9 |
|
60 |
|
61 |
== Changelog ==
|
62 |
|
63 |
+
= 2.1.1 =
|
64 |
+
* Fixed the issue that the safe files in WordPress, such as jpg, png, pdf cannot be uploaded.
|
65 |
+
|
66 |
= 2.1.0 =
|
67 |
* Tested up to WordPress 4.7.1
|
68 |
* Fixed finfo_file issue. See FAQ section.
|
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.1.
|
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.1.
|
23 |
);
|
24 |
|
25 |
// Add Setting to WordPress 'Settings' menu for Multisite.
|
@@ -65,8 +65,9 @@ add_filter( 'upload_mimes', 'add_allow_upload_extension');
|
|
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
|
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' );
|
@@ -80,6 +81,7 @@ function add_allow_upload_extension_exception( $file, $filename, $mimes ) {
|
|
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;
|
@@ -88,11 +90,14 @@ function add_allow_upload_extension_exception( $file, $filename, $mimes ) {
|
|
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 |
-
|
|
|
|
|
96 |
}
|
97 |
|
98 |
add_filter( 'wp_check_filetype_and_ext', 'add_allow_upload_extension_exception',10,3);
|
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.1
|
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.1',
|
23 |
);
|
24 |
|
25 |
// Add Setting to WordPress 'Settings' menu for Multisite.
|
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 |
+
list($ext, $type, $proper_filename) = explode($file);
|
69 |
list($f_name,$f_ext) = explode(".", $mimes);
|
70 |
+
if($ext != false && $type != false) return $file;
|
71 |
|
72 |
if ( ! function_exists( 'is_plugin_active_for_network' ) )
|
73 |
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
81 |
else
|
82 |
$mime_type_values = unserialize($settings['mime_type_values']);
|
83 |
|
84 |
+
$flag = false;
|
85 |
foreach ($mime_type_values as $line){
|
86 |
$line_value = explode("=", $line);
|
87 |
if(count($line_value) != 2) continue;
|
90 |
if(trim($line_value[0]) === $f_ext){
|
91 |
$ext = $f_ext;
|
92 |
$type = trim(str_replace(" ", " ", $line_value[1]));
|
93 |
+
$flag = true;
|
94 |
break;
|
95 |
}
|
96 |
}
|
97 |
+
if($flag)
|
98 |
+
return compact( 'ext', 'type', 'proper_filename' );
|
99 |
+
else
|
100 |
+
return $file;
|
101 |
}
|
102 |
|
103 |
add_filter( 'wp_check_filetype_and_ext', 'add_allow_upload_extension_exception',10,3);
|