Version Description
- Added the "Enable to debug output for file types recognized by WordPress when a file is uploaded by the media." security option. In detail, please see "Frequently Asked Questions" section.
Download this release
Release Info
Developer | kimipooh |
Plugin | WP Add Mime Types |
Version | 2.5.6 |
Comparing to | |
See all releases |
Code changes from version 2.5.5 to 2.5.6
- includes/admin.php +12 -2
- includes/network-admin.php +10 -1
- readme.txt +8 -2
- wp-add-mime-types.php +10 -4
includes/admin.php
CHANGED
@@ -13,7 +13,7 @@ function wamt_admin_settings_page(){
|
|
13 |
$admin_permission = 'manage_options';
|
14 |
// Loading the stored setting data (wp_add_mime_types_array) from WordPress database.
|
15 |
if(is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME)){
|
16 |
-
$settings = get_site_option(WAMT_SITEADMIN_SETTING_FILE);
|
17 |
$past_settings = get_option(WAMT_SETTING_FILE);
|
18 |
}else
|
19 |
$settings = get_option(WAMT_SETTING_FILE);
|
@@ -54,11 +54,17 @@ function wamt_admin_settings_page(){
|
|
54 |
if(isset($_POST['filename_sanitized_enable']))
|
55 |
$settings['filename_sanitized_enable'] = wp_strip_all_tags($_POST['filename_sanitized_enable']);
|
56 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
}
|
59 |
// Update to WordPress Data.
|
60 |
if(is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME))
|
61 |
-
get_site_option(WAMT_SITEADMIN_SETTING_FILE, $settings);
|
62 |
else{
|
63 |
if(isset($_POST["wamt-form"]) && $_POST["wamt-form"])
|
64 |
if(check_admin_referer("wamt-nonce-key", "wamt-form"))
|
@@ -131,6 +137,10 @@ if(!empty($allowed_mime_values)){
|
|
131 |
<input type="hidden" name="filename_sanitized_enable" value="no" />
|
132 |
<input type="checkbox" name="filename_sanitized_enable" value="yes" <?php if( isset($settings['filename_sanitized_enable']) && $settings['filename_sanitized_enable'] === "yes" ) echo "checked"; ?> <?php if(!$permission || (is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME))) echo "disabled"; ?>/> <?php _e('Enable to sanitize the multiple file extensions within the filename by WordPress core.','wp-add-mime-types'); ?>
|
133 |
</p>
|
|
|
|
|
|
|
|
|
134 |
</fieldset>
|
135 |
|
136 |
<fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px; padding-bottom: 1em;">
|
13 |
$admin_permission = 'manage_options';
|
14 |
// Loading the stored setting data (wp_add_mime_types_array) from WordPress database.
|
15 |
if(is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME)){
|
16 |
+
$settings = get_site_option(WAMT_SITEADMIN_SETTING_FILE);
|
17 |
$past_settings = get_option(WAMT_SETTING_FILE);
|
18 |
}else
|
19 |
$settings = get_option(WAMT_SETTING_FILE);
|
54 |
if(isset($_POST['filename_sanitized_enable']))
|
55 |
$settings['filename_sanitized_enable'] = wp_strip_all_tags($_POST['filename_sanitized_enable']);
|
56 |
}
|
57 |
+
if(!isset($settings['file_type_debug']))
|
58 |
+
$settings['file_type_debug'] = "no";
|
59 |
+
else{
|
60 |
+
if(isset($_POST['file_type_debug']))
|
61 |
+
$settings['file_type_debug'] = wp_strip_all_tags($_POST['file_type_debug']);
|
62 |
+
}
|
63 |
}
|
64 |
}
|
65 |
// Update to WordPress Data.
|
66 |
if(is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME))
|
67 |
+
;//get_site_option(WAMT_SITEADMIN_SETTING_FILE, $settings);
|
68 |
else{
|
69 |
if(isset($_POST["wamt-form"]) && $_POST["wamt-form"])
|
70 |
if(check_admin_referer("wamt-nonce-key", "wamt-form"))
|
137 |
<input type="hidden" name="filename_sanitized_enable" value="no" />
|
138 |
<input type="checkbox" name="filename_sanitized_enable" value="yes" <?php if( isset($settings['filename_sanitized_enable']) && $settings['filename_sanitized_enable'] === "yes" ) echo "checked"; ?> <?php if(!$permission || (is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME))) echo "disabled"; ?>/> <?php _e('Enable to sanitize the multiple file extensions within the filename by WordPress core.','wp-add-mime-types'); ?>
|
139 |
</p>
|
140 |
+
<p>
|
141 |
+
<input type="hidden" name="file_type_debug" value="no" />
|
142 |
+
<input type="checkbox" name="file_type_debug" value="yes" <?php if( isset($settings['file_type_debug']) && $settings['file_type_debug'] === "yes" ) echo "checked"; ?> <?php if(!$permission || (is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME))) echo "disabled"; ?>/> <?php _e('Enable to debug output for file types recognized by WordPress when a file is uploaded by the media. <br/>* By enabling both this option and the "Enable the attempt to determine the real file type of a file by WordPress core.", the file type is displayed if it is uploaded from Media.<br/>* PLEASE keep in mind that a file uploads are stopped while they are being processed if the both of two options are enabled. Therefore, be sure to disable this debugging option after debugging.','wp-add-mime-types'); ?>
|
143 |
+
</p>
|
144 |
</fieldset>
|
145 |
|
146 |
<fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px; padding-bottom: 1em;">
|
includes/network-admin.php
CHANGED
@@ -53,7 +53,12 @@ function wamt_network_admin_settings_page(){
|
|
53 |
if(isset($_POST['filename_sanitized_enable']))
|
54 |
$settings['filename_sanitized_enable'] = wp_strip_all_tags($_POST['filename_sanitized_enable']);
|
55 |
}
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
57 |
// Update on wp_sitemeta
|
58 |
update_site_option(WAMT_SITEADMIN_SETTING_FILE, $settings);
|
59 |
}
|
@@ -124,6 +129,10 @@ if(!empty($allowed_mime_values)){
|
|
124 |
<input type="hidden" name="filename_sanitized_enable" value="no" />
|
125 |
<input type="checkbox" name="filename_sanitized_enable" value="yes" <?php if( isset($settings['filename_sanitized_enable']) && $settings['filename_sanitized_enable'] === "yes" ) echo "checked"; ?> <?php if(!$permission) echo "disabled"; ?>/> <?php _e('Enable to sanitize the multiple file extensions within the filename by WordPress core.','wp-add-mime-types'); ?>
|
126 |
</p>
|
|
|
|
|
|
|
|
|
127 |
</fieldset>
|
128 |
|
129 |
<fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px;">
|
53 |
if(isset($_POST['filename_sanitized_enable']))
|
54 |
$settings['filename_sanitized_enable'] = wp_strip_all_tags($_POST['filename_sanitized_enable']);
|
55 |
}
|
56 |
+
if(!isset($settings['file_type_debug']))
|
57 |
+
$settings['file_type_debug'] = "no";
|
58 |
+
else{
|
59 |
+
if(isset($_POST['file_type_debug']))
|
60 |
+
$settings['file_type_debug'] = wp_strip_all_tags($_POST['file_type_debug']);
|
61 |
+
}
|
62 |
// Update on wp_sitemeta
|
63 |
update_site_option(WAMT_SITEADMIN_SETTING_FILE, $settings);
|
64 |
}
|
129 |
<input type="hidden" name="filename_sanitized_enable" value="no" />
|
130 |
<input type="checkbox" name="filename_sanitized_enable" value="yes" <?php if( isset($settings['filename_sanitized_enable']) && $settings['filename_sanitized_enable'] === "yes" ) echo "checked"; ?> <?php if(!$permission) echo "disabled"; ?>/> <?php _e('Enable to sanitize the multiple file extensions within the filename by WordPress core.','wp-add-mime-types'); ?>
|
131 |
</p>
|
132 |
+
<p>
|
133 |
+
<input type="hidden" name="file_type_debug" value="no" />
|
134 |
+
<input type="checkbox" name="file_type_debug" value="yes" <?php if( isset($settings['file_type_debug']) && $settings['file_type_debug'] === "yes" ) echo "checked"; ?> <?php if(!$permission) echo "disabled"; ?>/> <?php _e('Enable to debug output for file types recognized by WordPress when a file is uploaded by the media. <br/>* By enabling both this option and the "Enable the attempt to determine the real file type of a file by WordPress core.", the file type is displayed if it is uploaded from Media.<br/>* PLEASE keep in mind that a file uploads are stopped while they are being processed if the both of two options are enabled. Therefore, be sure to disable this debugging option after debugging.','wp-add-mime-types'); ?>
|
135 |
+
</p>
|
136 |
</fieldset>
|
137 |
|
138 |
<fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px;">
|
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.
|
7 |
-
Stable tag: 2.5.
|
8 |
License: GPL v2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -40,6 +40,9 @@ You can see the list of allowed mime types and file extensions by WordPress.
|
|
40 |
|
41 |
== Frequently Asked Questions ==
|
42 |
|
|
|
|
|
|
|
43 |
= Cannot work =
|
44 |
If the added mime type does not work, please deactivate other mime type plugins or the setting of other mime type plugins.
|
45 |
|
@@ -78,6 +81,9 @@ Yes, each setting values are saved as the other setting items.
|
|
78 |
|
79 |
|
80 |
== Changelog ==
|
|
|
|
|
|
|
81 |
= 2.5.5 =
|
82 |
* Fixed the error "the "Too few argument" for WordPress 5.0 or previous versions.
|
83 |
|
3 |
Tags: mime,file extention
|
4 |
Requires at least: 4.0
|
5 |
Requires PHP: 5.6
|
6 |
+
Tested up to: 5.5.3
|
7 |
+
Stable tag: 2.5.6
|
8 |
License: GPL v2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
40 |
|
41 |
== Frequently Asked Questions ==
|
42 |
|
43 |
+
= How to check the uploaded file type from Media. =
|
44 |
+
WordPress recognizes the file mime type by finfo_file function (wp-includes/functions.php). However, sometimes, the standard MIME type of a file and the MIME type of a WordPress-recognized file are different. By enabling both this option (in setting menu) and the "Enable the attempt to determine the real file type of a file by WordPress core.", the file type is displayed if it is from Media. PLEASE keep in mind that a file uploads are stopped while they are being processed if the both of two options are enabled. Therefore, be sure to disable this debugging option after debugging.
|
45 |
+
|
46 |
= Cannot work =
|
47 |
If the added mime type does not work, please deactivate other mime type plugins or the setting of other mime type plugins.
|
48 |
|
81 |
|
82 |
|
83 |
== Changelog ==
|
84 |
+
= 2.5.6 =
|
85 |
+
* Added the "Enable to debug output for file types recognized by WordPress when a file is uploaded by the media." security option. In detail, please see "Frequently Asked Questions" section.
|
86 |
+
|
87 |
= 2.5.5 =
|
88 |
* Fixed the error "the "Too few argument" for WordPress 5.0 or previous versions.
|
89 |
|
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.
|
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.
|
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');
|
@@ -44,7 +44,7 @@ add_action('admin_menu', 'wamt_add_to_settings_menu');
|
|
44 |
// Procedure for adding the mime types and file extensions to WordPress.
|
45 |
function wamt_add_allow_upload_extension( $mimes ) {
|
46 |
$mime_type_values = false;
|
47 |
-
|
48 |
if ( ! function_exists( 'is_plugin_active_for_network' ) )
|
49 |
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
50 |
|
@@ -56,7 +56,7 @@ function wamt_add_allow_upload_extension( $mimes ) {
|
|
56 |
if(!isset($settings['mime_type_values']) || empty($settings['mime_type_values'])) return $mimes;
|
57 |
else
|
58 |
$mime_type_values = unserialize($settings['mime_type_values']);
|
59 |
-
|
60 |
if(!empty($mime_type_values)){
|
61 |
foreach ((array)$mime_type_values as $line){
|
62 |
// Ignore to the right of '#' on a line.
|
@@ -132,6 +132,12 @@ function wamt_add_allow_upload_extension_exception( $data, $file, $filename,$mim
|
|
132 |
|
133 |
// If "security_attempt_enable" option disables (default) in the admin menu, the plugin avoids the security check regarding a file extension by WordPress core because of flexible management.
|
134 |
if(isset($settings['security_attempt_enable']) && $settings['security_attempt_enable'] === "yes"){
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
return $data;
|
136 |
}
|
137 |
|
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.6
|
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.6');
|
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');
|
44 |
// Procedure for adding the mime types and file extensions to WordPress.
|
45 |
function wamt_add_allow_upload_extension( $mimes ) {
|
46 |
$mime_type_values = false;
|
47 |
+
|
48 |
if ( ! function_exists( 'is_plugin_active_for_network' ) )
|
49 |
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
50 |
|
56 |
if(!isset($settings['mime_type_values']) || empty($settings['mime_type_values'])) return $mimes;
|
57 |
else
|
58 |
$mime_type_values = unserialize($settings['mime_type_values']);
|
59 |
+
|
60 |
if(!empty($mime_type_values)){
|
61 |
foreach ((array)$mime_type_values as $line){
|
62 |
// Ignore to the right of '#' on a line.
|
132 |
|
133 |
// If "security_attempt_enable" option disables (default) in the admin menu, the plugin avoids the security check regarding a file extension by WordPress core because of flexible management.
|
134 |
if(isset($settings['security_attempt_enable']) && $settings['security_attempt_enable'] === "yes"){
|
135 |
+
if(isset($settings['file_type_debug']) && $settings['file_type_debug'] === "yes"):
|
136 |
+
$finfo = finfo_open( FILEINFO_MIME_TYPE );
|
137 |
+
$real_mime = finfo_file($finfo,$file);
|
138 |
+
var_dump(__("WordPress recognizes that the file type is [". finfo_file($finfo,$file) . "].",'wp-add-mime-types'));
|
139 |
+
finfo_close($finfo);
|
140 |
+
endif;
|
141 |
return $data;
|
142 |
}
|
143 |
|