WP Add Mime Types - Version 1.0.0

Version Description

  • First Released.
  • Language: English, Japanese

=

Download this release

Release Info

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

Version 1.0.0

lang/wp-add-mime-types-ja.mo ADDED
Binary file
lang/wp-add-mime-types-ja.po ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2013 WP Add Mime Types
2
+ # This file is distributed under the same license as the WP Add Mime Types package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: WP Add Mime Types 1.0\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-add-mime-types\n"
7
+ "POT-Creation-Date: 2013-08-09 09:21:50+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2013-08-09 18:43+0900\n"
12
+ "Last-Translator: \n"
13
+ "Language-Team: Kimiya Kitani <kitani@cseas.kyoto-u.ac.jp>\n"
14
+ "X-Generator: Poedit 1.5.7\n"
15
+ "Language: Japanese\n"
16
+
17
+ #: wp-add-mime-types.php:24 wp-add-mime-types.php:56
18
+ msgid "WP Add Mime Types Admin Settings"
19
+ msgstr "WP Add Mime Types 管理設定"
20
+
21
+ #: wp-add-mime-types.php:24
22
+ msgid "Mime Type Settings"
23
+ msgstr "Mime Type設定"
24
+
25
+ #: wp-add-mime-types.php:53
26
+ msgid "Updated"
27
+ msgstr "更新しました"
28
+
29
+ #: wp-add-mime-types.php:60
30
+ msgid "List of allowed mime types and file extensions by WordPress"
31
+ msgstr "WordPressによって許可された「Mime Type」「拡張子」一覧"
32
+
33
+ #: wp-add-mime-types.php:96
34
+ msgid "Add Values"
35
+ msgstr "追加の項目"
36
+
37
+ #: wp-add-mime-types.php:97
38
+ msgid ""
39
+ "* About the mime type value for the file extension, please search \"mime "
40
+ "type [file extension name] using a search engine.<br/> Ex. \"epub = "
41
+ "application/epub+zip in http://ja.wikipedia.org/wiki/EPUB.\""
42
+ msgstr ""
43
+ "※ Mime Typeや拡張子については、「mime type 拡張子名」等で検索して調べてみてく"
44
+ "ださい。<br/> 例)epub = application/epub+zip(情報源:http://ja.wikipedia."
45
+ "org/wiki/EPUB)"
46
+
47
+ #: wp-add-mime-types.php:105
48
+ msgid "Save"
49
+ msgstr "設定の保存"
50
+
51
+ #. Plugin Name of the plugin/theme
52
+ msgid "WP Add Mime Types"
53
+ msgstr "WP Add Mime Types"
54
+
55
+ #. Description of the plugin/theme
56
+ msgid ""
57
+ "The plugin additionally allows the mime types and file extensions to "
58
+ "WordPress."
59
+ msgstr "このプラグインは、「Mime Type」や「拡張子」をWordPressに追加します。"
60
+
61
+ #. Author of the plugin/theme
62
+ msgid "Kimiya Kitani"
63
+ msgstr "木谷 公哉"
64
+
65
+ #. Author URI of the plugin/theme
66
+ msgid "http://kitaney.jp/~kitani"
67
+ msgstr "http://kitaney.jp/~kitani"
lang/wp-add-mime-types.pot ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2013 WP Add Mime Types
2
+ # This file is distributed under the same license as the WP Add Mime Types package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: WP Add Mime Types 1.0\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-add-mime-types\n"
7
+ "POT-Creation-Date: 2013-08-09 09:21:50+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+
15
+ #: wp-add-mime-types.php:24 wp-add-mime-types.php:56
16
+ msgid "WP Add Mime Types Admin Settings"
17
+ msgstr ""
18
+
19
+ #: wp-add-mime-types.php:24
20
+ msgid "Mime Type Settings"
21
+ msgstr ""
22
+
23
+ #: wp-add-mime-types.php:53
24
+ msgid "Updated"
25
+ msgstr ""
26
+
27
+ #: wp-add-mime-types.php:60
28
+ msgid "List of allowed mime types and file extensions by WordPress"
29
+ msgstr ""
30
+
31
+ #: wp-add-mime-types.php:96
32
+ msgid "Add Values"
33
+ msgstr ""
34
+
35
+ #: wp-add-mime-types.php:97
36
+ msgid ""
37
+ "* About the mime type value for the file extension, please search \"mime "
38
+ "type [file extension name] using a search engine.<br/> Ex. \"epub = "
39
+ "application/epub+zip in http://ja.wikipedia.org/wiki/EPUB.\""
40
+ msgstr ""
41
+
42
+ #: wp-add-mime-types.php:105
43
+ msgid "Save"
44
+ msgstr ""
45
+
46
+ #. Plugin Name of the plugin/theme
47
+ msgid "WP Add Mime Types"
48
+ msgstr ""
49
+
50
+ #. Description of the plugin/theme
51
+ msgid ""
52
+ "The plugin additionally allows the mime types and file extensions to "
53
+ "WordPress."
54
+ msgstr ""
55
+
56
+ #. Author of the plugin/theme
57
+ msgid "Kimiya Kitani"
58
+ msgstr ""
59
+
60
+ #. Author URI of the plugin/theme
61
+ msgid "http://kitaney.jp/~kitani"
62
+ msgstr ""
readme.txt ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WP Add Mime Types ===
2
+ Contributors: Kimiya Kitani
3
+ Tags: mime,file extention
4
+ Requires at least: 3.0
5
+ Tested up to: 3.5.2
6
+ Stable tag: 1.0.0
7
+
8
+ The plugin additionally allows the mime types and file extensions to WordPress.
9
+
10
+ == Description ==
11
+
12
+ The plugin additionally allows the mime types and file extensions to WordPress. In other words, your WordPress site can upload various file extensions. The support language is English and Japanese.
13
+
14
+
15
+ == Installation ==
16
+
17
+ The operation is the simple.
18
+ Please install this plugin and activate it.
19
+
20
+
21
+ = Usage =
22
+
23
+ First of all, please check the "Media Type Settings" in the "Settings".
24
+ You can see the list of allowed mime types and file extensions by WordPress.
25
+
26
+ When you add the mime type or file extension, the data will be added to last item in this list at the red color.
27
+
28
+ About the mime type list, please see the list of mime types in the information of the Internet.
29
+ Ex. http://www.freeformatter.com/mime-types-list.html
30
+
31
+ The user who have the [manage_options](http://codex.wordpress.org/Roles_and_Capabilities#manage_options) permission can only add the setting.
32
+
33
+ == Frequently Asked Questions ==
34
+
35
+
36
+ == Screenshots ==
37
+ 1. Setting Menu
38
+
39
+ == Changelog ==
40
+
41
+ = 1.0.0 =
42
+ * First Released.
43
+ * Language: English, Japanese
44
+
45
+ == Upgrade Notice ==
46
+
screenshot-1.png ADDED
Binary file
wp-add-mime-types.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
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: 1.0.0
7
+ Author: Kimiya Kitani
8
+ Author URI: http://kitaney.jp/~kitani
9
+ */
10
+
11
+ // Multi-language support.
12
+ load_plugin_textdomain('wp-add-mime-types', '/'.str_replace(ABSPATH, '', dirname(__FILE__)) . 'lang/');
13
+
14
+ $default_var = array(
15
+ 'wp_add_mime_types' => '1.0.0',
16
+ );
17
+
18
+ // Add Setting to WordPress 'Settings' menu.
19
+ add_action('admin_menu', 'add_to_settings_menu');
20
+
21
+ function add_to_settings_menu(){
22
+
23
+ // add_options_page (Title, Setting Title, Permission, Special Definition, function name);
24
+ add_options_page(__('WP Add Mime Types Admin Settings', 'wp-add-mime-types'), __('Mime Type Settings','wp-add-mime-types'), 'manage_options', __FILE__,'admin_settings_page');
25
+
26
+ }
27
+
28
+ // Processing Setting menu for the plugin.
29
+ function admin_settings_page(){
30
+ // Loading the stored setting data (wp_add_mime_types_array) from WordPress database.
31
+ $settings = get_option('wp_add_mime_types_array');
32
+
33
+ $permission = false;
34
+ // The user who can manage the WordPress option can only access the Setting menu of this plugin.
35
+ if(current_user_can('manage_options')) $permission = true;
36
+ // If the adding data is not set, the value "mime_type_values" sets "empty".
37
+ if(!isset($settings['mime_type_values'])) $settings['mime_type_values'] = '';
38
+ // When the adding data is saved (posted) at the setting menu, the data will update to the WordPress database after the security check
39
+ if(isset($_POST['mime_type_values'])){
40
+ $p_set = esc_attr(strip_tags(html_entity_decode($_POST['mime_type_values']),ENT_QUOTES));
41
+ $mime_type_values = explode("\n", $p_set);
42
+ foreach($mime_type_values as $m_type=>$m_value)
43
+ // " " is the Japanese multi-byte space. If the character is found out, it automatically change the space.
44
+ $mime_type_values[$m_type] = trim(str_replace(" ", " ", $m_value));
45
+ $settings['mime_type_values'] = serialize($mime_type_values);
46
+ }else
47
+ $mime_type_values = unserialize($settings['mime_type_values']);
48
+
49
+ // Update to WordPress Data.
50
+ update_option('wp_add_mime_types_array', $settings);
51
+
52
+ ?>
53
+ <div class="add_mime_media_admin_setting_page_updated"><p><strong><?php _e('Updated', 'wp-add-mime-types'); ?></strong></p></div>
54
+
55
+ <div id="add_mime_media_admin_menu">
56
+ <h2><?php _e('WP Add Mime Types Admin Settings', 'wp-add-mime-types'); ?></h2>
57
+
58
+ <form method="post" action="">
59
+ <fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px;">
60
+ <legend><h3><?php _e('List of allowed mime types and file extensions by WordPress','wp-add-mime-types'); ?></h3></legend>
61
+ <div style="overflow:scroll; height: 500px;">
62
+ <table>
63
+ <?php
64
+ // Get the list of the file extensions which WordPress allows the upload.
65
+ $allowed_mime_values = get_allowed_mime_types();
66
+
67
+ // Getting the extension name in the saved data
68
+ foreach ($mime_type_values as $line){
69
+ $line_value = explode("=", $line);
70
+ if(count($line_value) != 2) continue;
71
+ $mimes[trim($line_value[0])] = trim($line_value[1]);
72
+ }
73
+
74
+ // List view of the allowed mime types including the addition (red color) in the admin settings.
75
+ foreach($allowed_mime_values as $type=>$value){
76
+ if(isset($mimes)){
77
+ $add_mime_type_check = "";
78
+ foreach($mimes as $a_type=>$a_value){
79
+ if(!strcmp($type, $a_type)){
80
+ $add_mime_type_check = " style='color:red;'";
81
+ break;
82
+ }
83
+ }
84
+
85
+ echo "<tr><td$add_mime_type_check>$type</td><td$add_mime_type_check>=</td><td$add_mime_type_check>$value</td></tr>\n";
86
+ }else
87
+ echo "<tr><td>$type</td><td>=</td><td>$value</td></tr>\n";
88
+ }
89
+ ?>
90
+ </table>
91
+ </div>
92
+ </fieldset>
93
+ <br/>
94
+
95
+ <fieldset style="border:1px solid #777777; width: 750px; padding-left: 6px;">
96
+ <legend><h3><?php _e('Add Values','wp-add-mime-types'); ?></h3></legend>
97
+ <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 in http://ja.wikipedia.org/wiki/EPUB."','wp-add-mime-types'); ?></p>
98
+
99
+ <?php // If the permission is not allowed, the user can only read the setting. ?>
100
+ <textarea name="mime_type_values" cols="100" rows="10" <?php if(!$permission) echo "disabled"; ?>><?php foreach ($mimes as $m_type=>$m_value) echo $m_type . "\t= " .$m_value . "\n"; ?></textarea>
101
+ </fieldset>
102
+
103
+ <br/>
104
+
105
+ <input type="submit" value="<?php _e('Save', 'wp-add-mime-types'); ?>" />
106
+ </form>
107
+
108
+ </div>
109
+
110
+ <?php
111
+ }
112
+ // Procedure for adding the mime types and file extensions to WordPress.
113
+ function add_allow_upload_extension( $mimes ) {
114
+ $settings = get_option('wp_add_mime_types_array');
115
+
116
+ if(!isset($settings['mime_type_values']) || empty($settings['mime_type_values'])) return $mimes;
117
+ else
118
+ $mime_type_values = unserialize($settings['mime_type_values']);
119
+
120
+ foreach ($mime_type_values as $line){
121
+ // If 2 or more "=" character in the line data, it will be ignored.
122
+ $line_value = explode("=", $line);
123
+ if(count($line_value) != 2) continue;
124
+
125
+ // " " is the Japanese multi-byte space. If the character is found out, it automatically change the space.
126
+ $mimes[trim($line_value[0])] = trim(str_replace(" ", " ", $line_value[1]));
127
+ }
128
+
129
+ //$mimes['dot'] = 'application/word';
130
+
131
+ return $mimes;
132
+ }
133
+
134
+ // Register the Procedure process to WordPress.
135
+ add_filter( 'upload_mimes', 'add_allow_upload_extension' );
136
+
137
+
138
+ ?>