Version Description
- Added the mime type restriction function by using '-' prefix. If the head in each line is set to '-', then the MIME type restricts. In case of "-bmp
Download this release
Release Info
Developer | kimipooh |
Plugin | WP Add Mime Types |
Version | 3.0.0 |
Comparing to | |
See all releases |
Code changes from version 2.5.8 to 3.0.0
- includes/admin.php +5 -2
- includes/network-admin.php +2 -1
- readme.txt +16 -2
- wp-add-mime-types.php +15 -4
includes/admin.php
CHANGED
@@ -146,7 +146,8 @@ if(!empty($allowed_mime_values)){
|
|
146 |
<fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px; padding-bottom: 1em;">
|
147 |
<legend><h3><?php _e('Add Values','wp-add-mime-types'); ?></h3></legend>
|
148 |
<p><?php _e('* About the mime type value for the file extension, please search "mime type [file extension name] using a search engine.<br/>Ex. epub = application/epub+zip<br/>Reference: <a href="http://www.iana.org/assignments/media-types/media-types.xhtml" target="_blank">Media Types on the Internet Assigned Numbers Authority (IANA)</a><br/>* If the added mime type does not work, please deactivate other mime type plugins or the setting of other mime type plugins.','wp-add-mime-types'); ?>
|
149 |
-
<br/><?php _e('* Ignore to the right of "#" on a line. ','wp-add-mime-types');
|
|
|
150 |
<p><span style="color:red;"><?php if(is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME)) _e('* The site administrator cannot add the value for mime type because the multisite is enabled. <br/>Please contact the multisite administrator if you would like to add the value.','wp-add-mime-types'); ?></span></p>
|
151 |
|
152 |
<?php // If the permission is not allowed, the user can only read the setting. ?>
|
@@ -155,7 +156,9 @@ if(!empty($allowed_mime_values)){
|
|
155 |
|
156 |
<?php
|
157 |
if(is_multisite() && current_user_can('manage_network_options')){
|
158 |
-
$past_mime_type_values =
|
|
|
|
|
159 |
if(!empty($past_mime_type_values)){
|
160 |
|
161 |
?>
|
146 |
<fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px; padding-bottom: 1em;">
|
147 |
<legend><h3><?php _e('Add Values','wp-add-mime-types'); ?></h3></legend>
|
148 |
<p><?php _e('* About the mime type value for the file extension, please search "mime type [file extension name] using a search engine.<br/>Ex. epub = application/epub+zip<br/>Reference: <a href="http://www.iana.org/assignments/media-types/media-types.xhtml" target="_blank">Media Types on the Internet Assigned Numbers Authority (IANA)</a><br/>* If the added mime type does not work, please deactivate other mime type plugins or the setting of other mime type plugins.','wp-add-mime-types'); ?>
|
149 |
+
<br/><?php _e('* Ignore to the right of "#" on a line. ','wp-add-mime-types'); ?>
|
150 |
+
<br/><?php _e('* If the head in each line is set to "-", then the MIME type restricts.<br/>ex. -bmp = image/bmp<br/>The files which has "bmp" file extention becomes not to be able to upload.','wp-add-mime-types'); ?></p>
|
151 |
<p><span style="color:red;"><?php if(is_multisite() && is_plugin_active_for_network(WAMT_PLUGIN_BASENAME)) _e('* The site administrator cannot add the value for mime type because the multisite is enabled. <br/>Please contact the multisite administrator if you would like to add the value.','wp-add-mime-types'); ?></span></p>
|
152 |
|
153 |
<?php // If the permission is not allowed, the user can only read the setting. ?>
|
156 |
|
157 |
<?php
|
158 |
if(is_multisite() && current_user_can('manage_network_options')){
|
159 |
+
$past_mime_type_values = "";
|
160 |
+
if(isset($past_settings['mime_type_values']))
|
161 |
+
$past_mime_type_values = unserialize($past_settings['mime_type_values']);
|
162 |
if(!empty($past_mime_type_values)){
|
163 |
|
164 |
?>
|
includes/network-admin.php
CHANGED
@@ -138,7 +138,8 @@ if(!empty($allowed_mime_values)){
|
|
138 |
<fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px;">
|
139 |
<legend><h3><?php _e('Add Values','wp-add-mime-types'); ?></h3></legend>
|
140 |
<p><?php _e('* About the mime type value for the file extension, please search "mime type [file extension name] using a search engine.<br/>Ex. epub = application/epub+zip<br/>Reference: <a href="http://www.iana.org/assignments/media-types/media-types.xhtml" target="_blank">Media Types on the Internet Assigned Numbers Authority (IANA)</a><br/>* If the added mime type does not work, please deactivate other mime type plugins or the setting of other mime type plugins.','wp-add-mime-types'); ?>
|
141 |
-
<br/><?php _e('* Ignore to the right of "#" on a line. ','wp-add-mime-types');
|
|
|
142 |
|
143 |
<?php // If the permission is not allowed, the user can only read the setting. ?>
|
144 |
<textarea name="mime_type_values" cols="100" rows="10" <?php if(!$permission) echo "disabled"; ?>><?php if(isset($mimes) && is_array($mimes)) foreach ($mimes as $m_type=>$m_value) echo $m_type . "\t= " .$m_value . "\n"; ?></textarea>
|
138 |
<fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px;">
|
139 |
<legend><h3><?php _e('Add Values','wp-add-mime-types'); ?></h3></legend>
|
140 |
<p><?php _e('* About the mime type value for the file extension, please search "mime type [file extension name] using a search engine.<br/>Ex. epub = application/epub+zip<br/>Reference: <a href="http://www.iana.org/assignments/media-types/media-types.xhtml" target="_blank">Media Types on the Internet Assigned Numbers Authority (IANA)</a><br/>* If the added mime type does not work, please deactivate other mime type plugins or the setting of other mime type plugins.','wp-add-mime-types'); ?>
|
141 |
+
<br/><?php _e('* Ignore to the right of "#" on a line. ','wp-add-mime-types'); ?>
|
142 |
+
<br/><?php _e('* If the head in each line is set to "-", then the MIME type restricts.<br/>ex. -bmp = image/bmp<br/>The files which has "bmp" file extention becomes not to be able to upload.','wp-add-mime-types'); ?></p>
|
143 |
|
144 |
<?php // If the permission is not allowed, the user can only read the setting. ?>
|
145 |
<textarea name="mime_type_values" cols="100" rows="10" <?php if(!$permission) echo "disabled"; ?>><?php if(isset($mimes) && is_array($mimes)) foreach ($mimes as $m_type=>$m_value) echo $m_type . "\t= " .$m_value . "\n"; ?></textarea>
|
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:
|
7 |
-
Stable tag:
|
8 |
License: GPL v2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -74,6 +74,13 @@ The setting values in each site administration dashboard in case of activating t
|
|
74 |
|
75 |
Yes, each setting values are saved as the other setting items.
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
== Screenshots ==
|
78 |
1. Setting Menu
|
79 |
2. Setting Menu in case of the multisite
|
@@ -81,6 +88,13 @@ Yes, each setting values are saved as the other setting items.
|
|
81 |
4. Security Options
|
82 |
|
83 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
= 2.5.8 =
|
85 |
* Fixed the issue of the media uploads failing when activating this plugin for the first time, if the plugin settings are not saved whenever.
|
86 |
|
3 |
Tags: mime,file extention
|
4 |
Requires at least: 4.0
|
5 |
Requires PHP: 5.6
|
6 |
+
Tested up to: 6.0
|
7 |
+
Stable tag: 3.0.0
|
8 |
License: GPL v2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
74 |
|
75 |
Yes, each setting values are saved as the other setting items.
|
76 |
|
77 |
+
= Is it possible to restrict the extensions? =
|
78 |
+
|
79 |
+
Yes, it is available on the version 3.0.0.
|
80 |
+
If the head in each line is set to '-', then the MIME type restricts.
|
81 |
+
ex. -bmp = image/bmp
|
82 |
+
The files which has "bmp" file extention becomes not to be able to upload.
|
83 |
+
|
84 |
== Screenshots ==
|
85 |
1. Setting Menu
|
86 |
2. Setting Menu in case of the multisite
|
88 |
4. Security Options
|
89 |
|
90 |
== Changelog ==
|
91 |
+
= 3.0.0 =
|
92 |
+
- Added the mime type restriction function by using '-' prefix. If the head in each line is set to '-', then the MIME type restricts. In case of "-bmp = image/bmp", the files which has "bmp" file extention becomes not to be able to upload.
|
93 |
+
- Fixed the warning on the multisite.
|
94 |
+
- Tested up WordPress 5.6.2 with PHP 8.0.0.
|
95 |
+
- Tested up WordPress 5.8
|
96 |
+
- Tested up WordPress 6.0
|
97 |
+
|
98 |
= 2.5.8 =
|
99 |
* Fixed the issue of the media uploads failing when activating this plugin for the first time, if the plugin settings are not saved whenever.
|
100 |
|
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:
|
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', '
|
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');
|
@@ -66,8 +66,19 @@ function wamt_add_allow_upload_extension( $mimes ) {
|
|
66 |
// If 2 or more "=" character in the line data, it will be ignored.
|
67 |
$line_value = explode("=", $line);
|
68 |
if(count($line_value) != 2) continue;
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
72 |
}
|
73 |
|
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: 3.0.0
|
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', '3.0.0');
|
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');
|
66 |
// If 2 or more "=" character in the line data, it will be ignored.
|
67 |
$line_value = explode("=", $line);
|
68 |
if(count($line_value) != 2) continue;
|
69 |
+
|
70 |
+
// If the head in each line is set to '-', then the MIME type restricts.
|
71 |
+
// ex. -bmp = image/bmp
|
72 |
+
// The files which has "bmp" file extention becomes not to be able to upload.
|
73 |
+
$line_pref_str = explode("-", $line_value[0]);
|
74 |
+
if(count($line_pref_str) === 2):
|
75 |
+
if(isset($mimes[trim($line_pref_str[1])])):
|
76 |
+
unset($mimes[trim($line_pref_str[1])]);
|
77 |
+
endif;
|
78 |
+
else:
|
79 |
+
// " " is the Japanese multi-byte space. If the character is found out, it automatically change the space.
|
80 |
+
$mimes[trim($line_value[0])] = trim(str_replace(" ", " ", $line_value[1]));
|
81 |
+
endif;
|
82 |
}
|
83 |
}
|
84 |
|