Enhanced Media Library - Version 1.1

Version Description

  • Improvements

    • Filters added to /wp-admin/customize.php page Support Request
    • Reconsidered the mechanism of checkboxes' checking in Media Uploader for more stable operation Support Request
    • Media Uploader filters now work without page refreshing when you change category for you images
  • Bugfixes

    • Fixed "Uploads not showing" issue Support Request
    • Reconsidered CSS for filters area Support Request
    • Fixed CSS and JS files wrong path definitions Support Request
Download this release

Release Info

Developer webbistro
Plugin Icon 128x128 Enhanced Media Library
Version 1.1
Comparing to
See all releases

Code changes from version 1.0.5 to 1.1

core/mime-types.php CHANGED
@@ -1,174 +1,174 @@
1
- <?php
2
-
3
- /**
4
- * wpuxss_eml_mimes_validate
5
- *
6
- * @type callback function
7
- * @since 1.0
8
- * @created 15/10/13
9
- */
10
-
11
- function wpuxss_eml_mimes_validate($input)
12
- {
13
- if ( !$input ) $input = array();
14
-
15
- if ( isset($_REQUEST['wpuxss_eml_restore_mimes_backup']) )
16
- {
17
- $_REQUEST['_wp_http_referer'] .= '&settings-restored=true';
18
- $wpuxss_eml_mimes_backup = get_option('wpuxss_eml_mimes_backup');
19
- $input = $wpuxss_eml_mimes_backup;
20
- }
21
- else
22
- {
23
- foreach ( $input as $type => $mime )
24
- {
25
- $sanitized_type = wpuxss_eml_sanitize_extension($type);
26
-
27
- if ( $sanitized_type !== $type )
28
- {
29
- $input[$sanitized_type] = $input[$type];
30
- unset($input[$type]);
31
- $type = $sanitized_type;
32
- }
33
-
34
- if ( !isset($input[$type]['filter']) )
35
- $input[$type]['filter'] = 0;
36
-
37
- if ( !isset($input[$type]['upload']) )
38
- $input[$type]['upload'] = 0;
39
-
40
- $input[$type]['filter'] = intval($input[$type]['filter']);
41
- $input[$type]['upload'] = intval($input[$type]['upload']);
42
-
43
- $input[$type]['mime'] = sanitize_mime_type($mime['mime']);
44
- $input[$type]['singular'] = sanitize_text_field($mime['singular']);
45
- $input[$type]['plural'] = sanitize_text_field($mime['plural']);
46
- }
47
- }
48
-
49
- return $input;
50
- }
51
-
52
-
53
-
54
-
55
- /**
56
- * wpuxss_eml_sanitize_extension
57
- *
58
- * Based on the original sanitize_key
59
- *
60
- * @since 1.0
61
- * @created 24/10/13
62
- */
63
-
64
- function wpuxss_eml_sanitize_extension( $key )
65
- {
66
- $raw_key = $key;
67
- $key = strtolower( $key );
68
- $key = preg_replace( '/[^a-z0-9|]/', '', $key );
69
- return apply_filters( 'sanitize_key', $key, $raw_key );
70
- }
71
-
72
-
73
-
74
-
75
- /**
76
- * wpuxss_eml_post_mime_types
77
- *
78
- * @since 1.0
79
- * @created 03/08/13
80
- */
81
-
82
- add_filter('post_mime_types', 'wpuxss_eml_post_mime_types');
83
-
84
- function wpuxss_eml_post_mime_types( $post_mime_types )
85
- {
86
- $wpuxss_eml_mimes = get_option('wpuxss_eml_mimes');
87
-
88
- if ( !empty($wpuxss_eml_mimes) )
89
- {
90
- foreach ( $wpuxss_eml_mimes as $type => $mime )
91
- {
92
- if ( $mime['filter'] == 1 )
93
- $post_mime_types[$mime['mime']] = array(
94
- $mime['singular'],
95
- 'Manage ' . $mime['singular'],
96
- _n_noop($mime['singular'] . ' <span class="count">(%s)</span>', $mime['plural'] . ' <span class="count">(%s)</span>')
97
- );
98
- }
99
- }
100
-
101
- return $post_mime_types;
102
- }
103
-
104
-
105
-
106
-
107
- /**
108
- * wpuxss_eml_upload_mimes
109
- *
110
- * @since 1.0
111
- * @created 03/08/13
112
- */
113
-
114
- add_filter('upload_mimes', 'wpuxss_eml_upload_mimes');
115
-
116
- function wpuxss_eml_upload_mimes ( $existing_mimes=array() )
117
- {
118
- $wpuxss_eml_mimes = get_option('wpuxss_eml_mimes');
119
-
120
- if ( !empty($wpuxss_eml_mimes) )
121
- {
122
- foreach ( $wpuxss_eml_mimes as $type => $mime )
123
- {
124
- if ( $mime['upload'] == 1 )
125
- {
126
- if ( !isset($existing_mimes[$type]) )
127
- $existing_mimes[$type] = $mime['mime'];
128
- }
129
- else
130
- {
131
- if ( isset($existing_mimes[$type]) )
132
- unset($existing_mimes[$type]);
133
- }
134
- }
135
- }
136
-
137
- return $existing_mimes;
138
- }
139
-
140
-
141
-
142
-
143
- /**
144
- * wpuxss_eml_mime_types
145
- *
146
- * @since 1.0
147
- * @created 03/08/13
148
- */
149
-
150
- add_filter( 'mime_types', 'wpuxss_eml_mime_types' );
151
-
152
- function wpuxss_eml_mime_types( $existing_mimes )
153
- {
154
- $wpuxss_eml_mimes = get_option('wpuxss_eml_mimes');
155
-
156
- if ( !empty($wpuxss_eml_mimes) )
157
- {
158
- foreach ( $wpuxss_eml_mimes as $type => $mime )
159
- {
160
- if ( !isset($existing_mimes[$type]) )
161
- $existing_mimes[$type] = $mime['mime'];
162
- }
163
-
164
- foreach ( $existing_mimes as $type => $mime )
165
- {
166
- if ( !isset($wpuxss_eml_mimes[$type]) && isset($existing_mimes[$type]) )
167
- unset($existing_mimes[$type]);
168
- }
169
- }
170
-
171
- return $existing_mimes;
172
- }
173
-
174
  ?>
1
+ <?php
2
+
3
+ /**
4
+ * wpuxss_eml_mimes_validate
5
+ *
6
+ * @type callback function
7
+ * @since 1.0
8
+ * @created 15/10/13
9
+ */
10
+
11
+ function wpuxss_eml_mimes_validate($input)
12
+ {
13
+ if ( !$input ) $input = array();
14
+
15
+ if ( isset($_REQUEST['wpuxss_eml_restore_mimes_backup']) )
16
+ {
17
+ $_REQUEST['_wp_http_referer'] .= '&settings-restored=true';
18
+ $wpuxss_eml_mimes_backup = get_option('wpuxss_eml_mimes_backup');
19
+ $input = $wpuxss_eml_mimes_backup;
20
+ }
21
+ else
22
+ {
23
+ foreach ( $input as $type => $mime )
24
+ {
25
+ $sanitized_type = wpuxss_eml_sanitize_extension($type);
26
+
27
+ if ( $sanitized_type !== $type )
28
+ {
29
+ $input[$sanitized_type] = $input[$type];
30
+ unset($input[$type]);
31
+ $type = $sanitized_type;
32
+ }
33
+
34
+ if ( !isset($input[$type]['filter']) )
35
+ $input[$type]['filter'] = 0;
36
+
37
+ if ( !isset($input[$type]['upload']) )
38
+ $input[$type]['upload'] = 0;
39
+
40
+ $input[$type]['filter'] = intval($input[$type]['filter']);
41
+ $input[$type]['upload'] = intval($input[$type]['upload']);
42
+
43
+ $input[$type]['mime'] = sanitize_mime_type($mime['mime']);
44
+ $input[$type]['singular'] = sanitize_text_field($mime['singular']);
45
+ $input[$type]['plural'] = sanitize_text_field($mime['plural']);
46
+ }
47
+ }
48
+
49
+ return $input;
50
+ }
51
+
52
+
53
+
54
+
55
+ /**
56
+ * wpuxss_eml_sanitize_extension
57
+ *
58
+ * Based on the original sanitize_key
59
+ *
60
+ * @since 1.0
61
+ * @created 24/10/13
62
+ */
63
+
64
+ function wpuxss_eml_sanitize_extension( $key )
65
+ {
66
+ $raw_key = $key;
67
+ $key = strtolower( $key );
68
+ $key = preg_replace( '/[^a-z0-9|]/', '', $key );
69
+ return apply_filters( 'sanitize_key', $key, $raw_key );
70
+ }
71
+
72
+
73
+
74
+
75
+ /**
76
+ * wpuxss_eml_post_mime_types
77
+ *
78
+ * @since 1.0
79
+ * @created 03/08/13
80
+ */
81
+
82
+ add_filter('post_mime_types', 'wpuxss_eml_post_mime_types');
83
+
84
+ function wpuxss_eml_post_mime_types( $post_mime_types )
85
+ {
86
+ $wpuxss_eml_mimes = get_option('wpuxss_eml_mimes');
87
+
88
+ if ( !empty($wpuxss_eml_mimes) )
89
+ {
90
+ foreach ( $wpuxss_eml_mimes as $type => $mime )
91
+ {
92
+ if ( $mime['filter'] == 1 )
93
+ $post_mime_types[$mime['mime']] = array(
94
+ $mime['singular'],
95
+ 'Manage ' . $mime['singular'],
96
+ _n_noop($mime['singular'] . ' <span class="count">(%s)</span>', $mime['plural'] . ' <span class="count">(%s)</span>')
97
+ );
98
+ }
99
+ }
100
+
101
+ return $post_mime_types;
102
+ }
103
+
104
+
105
+
106
+
107
+ /**
108
+ * wpuxss_eml_upload_mimes
109
+ *
110
+ * @since 1.0
111
+ * @created 03/08/13
112
+ */
113
+
114
+ add_filter('upload_mimes', 'wpuxss_eml_upload_mimes');
115
+
116
+ function wpuxss_eml_upload_mimes ( $existing_mimes=array() )
117
+ {
118
+ $wpuxss_eml_mimes = get_option('wpuxss_eml_mimes');
119
+
120
+ if ( !empty($wpuxss_eml_mimes) )
121
+ {
122
+ foreach ( $wpuxss_eml_mimes as $type => $mime )
123
+ {
124
+ if ( $mime['upload'] == 1 )
125
+ {
126
+ if ( !isset($existing_mimes[$type]) )
127
+ $existing_mimes[$type] = $mime['mime'];
128
+ }
129
+ else
130
+ {
131
+ if ( isset($existing_mimes[$type]) )
132
+ unset($existing_mimes[$type]);
133
+ }
134
+ }
135
+ }
136
+
137
+ return $existing_mimes;
138
+ }
139
+
140
+
141
+
142
+
143
+ /**
144
+ * wpuxss_eml_mime_types
145
+ *
146
+ * @since 1.0
147
+ * @created 03/08/13
148
+ */
149
+
150
+ add_filter( 'mime_types', 'wpuxss_eml_mime_types' );
151
+
152
+ function wpuxss_eml_mime_types( $existing_mimes )
153
+ {
154
+ $wpuxss_eml_mimes = get_option('wpuxss_eml_mimes');
155
+
156
+ if ( !empty($wpuxss_eml_mimes) )
157
+ {
158
+ foreach ( $wpuxss_eml_mimes as $type => $mime )
159
+ {
160
+ if ( !isset($existing_mimes[$type]) )
161
+ $existing_mimes[$type] = $mime['mime'];
162
+ }
163
+
164
+ foreach ( $existing_mimes as $type => $mime )
165
+ {
166
+ if ( !isset($wpuxss_eml_mimes[$type]) && isset($existing_mimes[$type]) )
167
+ unset($existing_mimes[$type]);
168
+ }
169
+ }
170
+
171
+ return $existing_mimes;
172
+ }
173
+
174
  ?>
core/options-pages.php CHANGED
@@ -1,546 +1,546 @@
1
- <?php
2
-
3
- /**
4
- * wpuxss_eml_admin_menu
5
- *
6
- * @since 1.0
7
- * @created 28/09/13
8
- */
9
-
10
- add_action('admin_menu', 'wpuxss_eml_admin_menu');
11
-
12
- function wpuxss_eml_admin_menu()
13
- {
14
- add_utility_page(
15
- __('Enhanced Media Library Options','eml'), //page_title
16
- __('Media Settings','eml'), //menu_title
17
- 'manage_options', //capability
18
- 'eml-taxonomies-options', //page
19
- 'wpuxss_eml_print_taxonomies_options' //callback
20
- );
21
-
22
- $eml_taxonomies_options_suffix = add_submenu_page(
23
- 'eml-taxonomies-options',
24
- __('Taxonomies','eml'),
25
- __('Taxonomies','eml'),
26
- 'manage_options',
27
- 'eml-taxonomies-options'
28
- );
29
-
30
- $eml_mimetype_options_suffix = add_submenu_page(
31
- 'eml-taxonomies-options',
32
- __('MIME Types','eml'),
33
- __('MIME Types','eml'),
34
- 'manage_options',
35
- 'eml-mimetype-options',
36
- 'wpuxss_eml_print_mimetypes_options'
37
- );
38
-
39
- add_action('admin_print_scripts-' . $eml_taxonomies_options_suffix, 'wpuxss_eml_admin_settings_pages_scripts');
40
- add_action('admin_print_scripts-' . $eml_mimetype_options_suffix, 'wpuxss_eml_admin_settings_pages_scripts');
41
- }
42
-
43
-
44
-
45
-
46
- /**
47
- * wpuxss_eml_admin_settings_scripts
48
- *
49
- * @since 1.0
50
- * @created 28/10/13
51
- */
52
-
53
- function wpuxss_eml_admin_settings_pages_scripts()
54
- {
55
- global $wpuxss_eml_version,
56
- $wpuxss_eml_dir;
57
-
58
- wp_enqueue_script(
59
- 'wpuxss-eml-options-script',
60
- $wpuxss_eml_dir . '/js/eml-options.js',
61
- array('jquery'),
62
- $wpuxss_eml_version,
63
- true
64
- );
65
-
66
- $i18n_data = array(
67
- 'edit' => __( 'Edit', 'eml' ),
68
- 'close' => __( 'Close', 'eml' ),
69
- 'view' => __( 'View', 'eml' ),
70
- 'update' => __( 'Update', 'eml' ),
71
- 'add_new' => __( 'Add New', 'eml' ),
72
- 'new' => __( 'New', 'eml' ),
73
- 'name' => __( 'Name', 'eml' ),
74
- 'parent' => __( 'Parent', 'eml' ),
75
- 'all' => __( 'All', 'eml' ),
76
- 'search' => __( 'Search', 'eml' ),
77
-
78
- 'tax_deletion_confirm' => __( 'Taxonomy will be deleted permanently! Your media files will remain intacted, but all the connections with this taxonomy and its terms will be lost.', 'eml' ),
79
- 'tax_error_duplicate' => __( 'There is already a taxonomy with the same name. Please chose other one.', 'eml' ),
80
- 'tax_new' => __( 'New Taxonomy', 'eml' ),
81
- 'tax_error_empty_both' => __( 'Please choose Singular and Plural names for all your new taxomonies.', 'eml' ),
82
- 'tax_error_empty_singular' => __( 'Please choose Singilar name for all your new taxomonies.', 'eml' ),
83
- 'tax_error_empty_plural' => __( 'Please choose Plural Name for all your new taxomonies.', 'eml' ),
84
-
85
- 'mime_deletion_confirm' => __( 'Warning! All your custom MIME Types will be deleted by this operation.', 'eml' ),
86
- 'mime_error_empty_fields' => __( 'Please fill into all fields.', 'eml' ),
87
- 'mime_error_duplicate' => __( 'Duplicate extensions or MIME types. Please chose other one.', 'eml' )
88
- );
89
-
90
- wp_localize_script(
91
- 'wpuxss-eml-options-script',
92
- 'wpuxss_eml_i18n_data',
93
- $i18n_data
94
- );
95
- }
96
-
97
-
98
-
99
-
100
- /**
101
- * wpuxss_eml_print_taxonomies_options
102
- *
103
- * @type callback function
104
- * @since 1.0
105
- * @created 28/09/13
106
- */
107
-
108
- function wpuxss_eml_print_taxonomies_options()
109
- {
110
- if (!current_user_can('manage_options'))
111
- wp_die( __('You do not have sufficient permissions to access this page.','eml') );
112
-
113
- $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
114
- $taxonomies = get_taxonomies(array(),'names');
115
- ?>
116
-
117
- <div id="wpuxss-eml-global-options-wrap" class="wrap">
118
- <?php screen_icon('options-general'); ?>
119
- <h2><?php _e('Taxonomies','eml'); ?></h2>
120
-
121
- <?php settings_errors(); ?>
122
-
123
- <div id="poststuff">
124
-
125
- <div id="post-body" class="metabox-holder columns-2">
126
-
127
- <div id="postbox-container-2" class="postbox-container">
128
-
129
- <form id="wpuxss-eml-form-taxonomies" method="post" action="options.php">
130
-
131
- <?php settings_fields( 'wpuxss_eml_taxonomies' ); ?>
132
-
133
- <div class="postbox">
134
-
135
- <h3><?php _e('Media Taxonomies','eml'); ?></h3>
136
-
137
- <div class="inside">
138
-
139
- <p><?php _e('Assign following taxonomies to Media Library:','eml'); ?></p>
140
-
141
- <?php
142
-
143
- $html = '';
144
- foreach ( get_taxonomies(array(),'object') as $taxonomy )
145
- {
146
- if ( (in_array('attachment',$taxonomy->object_type) && count($taxonomy->object_type) == 1) || empty($taxonomy->object_type) )
147
- {
148
- $assigned = intval($wpuxss_eml_taxonomies[$taxonomy->name]['assigned']);
149
- $eml_media = intval($wpuxss_eml_taxonomies[$taxonomy->name]['eml_media']);
150
-
151
- if ($eml_media)
152
- $li_class = 'wpuxss-eml-taxonomy';
153
- else
154
- $li_class = 'wpuxss-non-eml-taxonomy';
155
-
156
- $html .= '<li class="' . $li_class . '" id="' . $taxonomy->name . '">';
157
-
158
- $html .= '<input class="wpuxss-eml-assigned" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][assigned]" type="checkbox" value="1" ' . checked( true, $assigned, false ) . ' title="' . __('Assign Taxonomy','eml') . '" />';
159
- $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][eml_media]" type="hidden" value="' . $eml_media . '" />';
160
- $html .= ' <label>' . $taxonomy->label . '</label>';
161
- $html .= '<a class="wpuxss-eml-button-edit" title="' . __('Edit Taxonomy','eml') . '" href="javascript:;">' . __('Edit','eml') . ' &darr;</a>';
162
- if ( $wpuxss_eml_taxonomies[$taxonomy->name]['eml_media'] == 1 )
163
- {
164
- $html .= '<a class="wpuxss-eml-button-remove" title="' . __('Delete Taxonomy','eml') . '" href="javascript:;">&ndash;</a>';
165
-
166
- $html .= '<div class="wpuxss-eml-taxonomy-edit" style="display:none;">';
167
-
168
- $html .= '<div class="wpuxss-eml-labels-edit">';
169
- $html .= '<h4>' . __('Labels','eml') . '</h4>';
170
- $html .= '<ul>';
171
- $html .= '<li><label>' . __('Singular','eml') . '</label><input type="text" class="wpuxss-eml-singular_name" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][singular_name]" value="' . esc_html($taxonomy->labels->singular_name) . '" /></li>';
172
- $html .= '<li><label>' . __('Plural','eml') . '</label><input type="text" class="wpuxss-eml-name" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][name]" value="' . esc_html($taxonomy->labels->name) . '" /></li>';
173
- $html .= '<li><label>' . __('Menu Name','eml') . '</label><input type="text" class="wpuxss-eml-menu_name" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][menu_name]" value="' . esc_html($taxonomy->labels->menu_name) . '" /></li>';
174
- $html .= '<li><label>' . __('All','eml') . '</label><input type="text" class="wpuxss-eml-all_items" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][all_items]" value="' . esc_html($taxonomy->labels->all_items) . '" /></li>';
175
- $html .= '<li><label>' . __('Edit','eml') . '</label><input type="text" class="wpuxss-eml-edit_item" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][edit_item]" value="' . esc_html($taxonomy->labels->edit_item) . '" /></li>';
176
- $html .= '<li><label>' . __('View','eml') . '</label><input type="text" class="wpuxss-eml-view_item" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][view_item]" value="' . esc_html($taxonomy->labels->view_item) . '" /></li>';
177
- $html .= '<li><label>' . __('Update','eml') . '</label><input type="text" class="wpuxss-eml-update_item" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][update_item]" value="' . esc_html($taxonomy->labels->update_item) . '" /></li>';
178
- $html .= '<li><label>' . __('Add New','eml') . '</label><input type="text" class="wpuxss-eml-add_new_item" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][add_new_item]" value="' . esc_html($taxonomy->labels->add_new_item) . '" /></li>';
179
- $html .= '<li><label>' . __('New','eml') . '</label><input type="text" class="wpuxss-eml-new_item_name" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][new_item_name]" value="' . esc_html($taxonomy->labels->new_item_name) . '" /></li>';
180
- $html .= '<li><label>' . __('Parent','eml') . '</label><input type="text" class="wpuxss-eml-parent_item" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][parent_item]" value="' . esc_html($taxonomy->labels->parent_item) . '" /></li>';
181
- $html .= '<li><label>' . __('Search','eml') . '</label><input type="text" class="wpuxss-eml-search_items" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][search_items]" value="' . esc_html($taxonomy->labels->search_items) . '" /></li>';
182
- $html .= '</ul>';
183
- $html .= '</div>';
184
-
185
- $html .= '<div class="wpuxss-eml-settings-edit">';
186
- $html .= '<h4>' . __('Settings','eml') . '</h4>';
187
- $html .= '<ul>';
188
- $html .= '<li><label>' . __('Hierarchical','eml') . '</label><input type="checkbox" class="wpuxss-eml-hierarchical" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][hierarchical]" value="1" ' . checked( 1, $taxonomy->hierarchical, false ) . ' /></li>';
189
- $html .= '<li><label>' . __('Column in Media Library','eml') . '</label><input type="checkbox" class="wpuxss-eml-show_admin_column" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][show_admin_column]" value="1" ' . checked( 1, $taxonomy->show_admin_column, false ) . ' /></li>';
190
- $html .= '<li><label>' . __('Filter in Media Library','eml') . '</label><input type="checkbox" class="wpuxss-eml-admin_filter" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][admin_filter]" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['admin_filter'], false ) . ' /></li>';
191
- $html .= '<li><label>' . __('Filter in Media Uploader','eml') . '</label><input type="checkbox" class="wpuxss-eml-media_uploader_filter" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][media_uploader_filter]" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['media_uploader_filter'], false ) . ' /></li>';
192
- $html .= '<li><label>' . __('Show in Nav Menu','eml') . '</label><input type="checkbox" class="wpuxss-eml-show_in_nav_menus" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][show_in_nav_menus]" value="1" ' . checked( 1, $taxonomy->show_in_nav_menus, false ) . ' /></li>';
193
- $html .= '<li><label>' . __('Remember terms order (sort)','eml') . '</label><input type="checkbox" class="wpuxss-eml-sort" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][sort]" value="1" ' . checked( 1, $taxonomy->sort, false ) . ' /></li>';
194
- $html .= '<li><label>' . __('Slug','eml') . '</label><input type="text" class="wpuxss-eml-slug" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][rewrite][slug]" value="' . esc_attr($taxonomy->rewrite['slug']) . '" /></li>';
195
- $html .= '</ul>';
196
- $html .= '</div>';
197
-
198
- $html .= '</div>';
199
- }
200
- else
201
- {
202
- $html .= '<div class="wpuxss-eml-taxonomy-edit" style="display:none;">';
203
-
204
- $html .= '<div class="wpuxss-eml-settings-edit">';
205
- $html .= '<h4>' . __('Settings','eml') . '</h4>';
206
- $html .= '<ul>';
207
- $html .= '<li><label>' . __('Filter in Media Library','eml') . '</label><input type="checkbox" class="wpuxss-eml-admin_filter" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][admin_filter]" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['admin_filter'], false ) . ' /></li>';
208
- $html .= '<li><label>' . __('Filter in Media Uploader','eml') . '</label><input type="checkbox" class="wpuxss-eml-media_uploader_filter" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][media_uploader_filter]" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['media_uploader_filter'], false ) . ' /></li>';
209
- $html .= '</ul>';
210
-
211
- $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][show_admin_column]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['show_admin_column'] . '" />';
212
- $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][show_in_nav_menus]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['show_in_nav_menus'] . '" />';
213
- $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][hierarchical]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['hierarchical'] . '" />';
214
- $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][sort]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['sort'] . '" />';
215
- $html .= '</div>';
216
-
217
- $html .= '</div>';
218
- }
219
- $html .= '</li>';
220
- }
221
- }
222
-
223
- $html .= '<li class="wpuxss-eml-clone" style="display:none">';
224
- $html .= '<input class="wpuxss-eml-assigned" name="" type="checkbox" class="wpuxss-eml-assigned" value="1" checked="checked" title="' . __('Assign Taxonomy','eml') . '" />';
225
- $html .= '<input name="" type="hidden" class="wpuxss-eml-eml_media" value="1" />';
226
- $html .= ' <label class="wpuxss-eml-taxonomy-label">' . __('New Taxonomy','eml') . '</label>';
227
-
228
- $html .= '<a class="wpuxss-eml-button-remove" title="' . __('Delete Taxonomy','eml') . '" href="javascript:;">&ndash;</a>';
229
-
230
- $html .= '<div class="wpuxss-eml-taxonomy-edit">';
231
-
232
- $html .= '<div class="wpuxss-eml-labels-edit">';
233
- $html .= '<h4>' . __('Labels','eml') . '</h4>';
234
- $html .= '<ul>';
235
- $html .= '<li><label>' . __('Singular','eml') . '</label><input type="text" class="wpuxss-eml-singular_name" name="" value="" /></li>';
236
- $html .= '<li><label>' . __('Plural','eml') . '</label><input type="text" class="wpuxss-eml-name" name="" value="" /></li>';
237
- $html .= '<li><label>' . __('Menu Name','eml') . '</label><input type="text" class="wpuxss-eml-menu_name" name="" value="" /></li>';
238
- $html .= '<li><label>' . __('All','eml') . '</label><input type="text" class="wpuxss-eml-all_items" name="" value="" /></li>';
239
- $html .= '<li><label>' . __('Edit','eml') . '</label><input type="text" class="wpuxss-eml-edit_item" name="" value="" /></li>';
240
- $html .= '<li><label>' . __('View','eml') . '</label><input type="text" class="wpuxss-eml-view_item" name="" value="" /></li>';
241
- $html .= '<li><label>' . __('Update','eml') . '</label><input type="text" class="wpuxss-eml-update_item" name="" value="" /></li>';
242
- $html .= '<li><label>' . __('Add New','eml') . '</label><input type="text" class="wpuxss-eml-add_new_item" name="" value="" /></li>';
243
- $html .= '<li><label>' . __('New','eml') . '</label><input type="text" class="wpuxss-eml-new_item_name" name="" value="" /></li>';
244
- $html .= '<li><label>' . __('Parent','eml') . '</label><input type="text" class="wpuxss-eml-parent_item" name="" value="" /></li>';
245
- $html .= '<li><label>' . __('Search','eml') . '</label><input type="text" class="wpuxss-eml-search_items" name="" value="" /></li>';
246
- $html .= '</ul>';
247
- $html .= '</div>';
248
-
249
- $html .= '<div class="wpuxss-eml-settings-edit">';
250
- $html .= '<h4>' . __('Settings','eml') . '</h4>';
251
- $html .= '<ul>';
252
- $html .= '<li><label>' . __('Hierarchical','eml') . '</label><input type="checkbox" class="wpuxss-eml-hierarchical" name="" value="1" checked="checked" /></li>';
253
- $html .= '<li><label>' . __('Column in Media Library','eml') . '</label><input class="wpuxss-eml-show_admin_column" type="checkbox" name="" value="1" /></li>';
254
- $html .= '<li><label>' . __('Filter in Media Library','eml') . '</label><input class="wpuxss-eml-admin_filter" type="checkbox" name="" value="1" /></li>';
255
- $html .= '<li><label>' . __('Filter in Media Uploader','eml') . '</label><input class="wpuxss-eml-media_uploader_filter" type="checkbox" name="" value="1" /></li>';
256
- $html .= '<li><label>' . __('Show in Nav Menu','eml') . '</label><input type="checkbox" class="wpuxss-eml-show_in_nav_menus" name="" value="1" /></li>';
257
- $html .= '<li><label>' . __('Remember terms order (sort)','eml') . '</label><input type="checkbox" class="wpuxss-eml-sort" name="" value="1" /></li>';
258
- $html .= '<li><label>' . __('Slug','eml') . '</label><input type="text" class="wpuxss-eml-slug" name="" value="" /></li>';
259
- $html .= '</ul>';
260
- $html .= '</div>';
261
-
262
- $html .= '</div>';
263
- $html .= '</li>';
264
-
265
- if ( !empty($html) )
266
- {
267
- ?>
268
- <ul class="wpuxss-eml-settings-list wpuxss-eml-media-taxonomy-list">
269
- <?php echo $html; ?>
270
- </ul>
271
- <div class="wpuxss-eml-button-container-right"><a class="add-new-h2 wpuxss-eml-button-create-taxonomy" href="javascript:;">+ <?php _e('Add New Taxonomy','eml'); ?></a></div>
272
- <?php
273
- }
274
-
275
- submit_button();
276
- ?>
277
-
278
- </div>
279
-
280
- </div>
281
-
282
- <div class="postbox">
283
-
284
- <h3><?php _e('Non-Media Taxonomies','eml'); ?></h3>
285
-
286
- <div class="inside">
287
-
288
- <p><?php _e('Assign following taxonomies to Media Library:','eml'); ?></p>
289
-
290
- <?php
291
- $unuse = array('revision','nav_menu_item','attachment');
292
- foreach ( get_post_types(array(),'object') as $post_type )
293
- {
294
- if ( !in_array($post_type->name,$unuse) )
295
- {
296
- $taxonomies = get_object_taxonomies($post_type->name,'object');
297
- if ( !empty($taxonomies) )
298
- {
299
- $html = '';
300
- foreach ( $taxonomies as $taxonomy )
301
- {
302
- if ( $taxonomy->name != 'post_format' )
303
- {
304
- $html .= '<li>';
305
- $html .= '<input class="wpuxss-eml-assigned" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][assigned]" type="checkbox" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['assigned'], false ) . ' title="' . __('Assign Taxonomy','eml') . '" />';
306
- $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][eml_media]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['eml_media'] . '" />';
307
- $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][show_admin_column]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['show_admin_column'] . '" />';
308
- $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][show_in_nav_menus]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['show_in_nav_menus'] . '" />';
309
- $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][hierarchical]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['hierarchical'] . '" />';
310
- $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][sort]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['sort'] . '" />';
311
- $html .= ' <label>' . $taxonomy->label . '</label>';
312
- $html .= '<a class="wpuxss-eml-button-edit" title="' . __('Edit Taxonomy','eml') . '" href="javascript:;">' . __('Edit','eml') . ' &darr;</a>';
313
- $html .= '<div class="wpuxss-eml-taxonomy-edit" style="display:none;">';
314
-
315
- $html .= '<h4>' . __('Settings','eml') . '</h4>';
316
- $html .= '<ul>';
317
- $html .= '<li><label>' . __('Filter in Media Library','eml') . '</label><input type="checkbox" class="wpuxss-eml-admin_filter" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][admin_filter]" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['admin_filter'], false ) . ' /></li>';
318
- $html .= '<li><label>' . __('Filter in Media Uploader','eml') . '</label><input type="checkbox" class="wpuxss-eml-media_uploader_filter" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][media_uploader_filter]" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['media_uploader_filter'], false ) . ' /></li>';
319
- $html .= '</ul>';
320
-
321
- $html .= '</div>';
322
- $html .= '</li>';
323
-
324
- }
325
- }
326
- if ( !empty($html) )
327
- {
328
- ?>
329
- <h4><?php echo $post_type->label; ?></h4>
330
- <ul class="wpuxss-eml-settings-list wpuxss-eml-non-media-taxonomy-list">
331
- <?php echo $html; ?>
332
- </ul>
333
- <?php
334
- }
335
- }
336
- }
337
- }
338
-
339
- submit_button();
340
- ?>
341
-
342
- </div>
343
-
344
- </div>
345
-
346
- </form>
347
-
348
- </div>
349
-
350
- <div id="postbox-container-1" class="postbox-container">
351
-
352
- <?php wpuxss_eml_print_credits(); ?>
353
-
354
- </div>
355
-
356
- </div>
357
-
358
- </div>
359
-
360
- </div>
361
-
362
- <?php
363
- }
364
-
365
-
366
-
367
-
368
- /**
369
- * wpuxss_eml_print_mimetypes_options
370
- *
371
- * @type callback function
372
- * @since 1.0
373
- * @created 28/09/13
374
- */
375
-
376
- function wpuxss_eml_print_mimetypes_options()
377
- {
378
- if (!current_user_can('manage_options'))
379
- wp_die( __('You do not have sufficient permissions to access this page.','eml') );
380
-
381
- $wpuxss_eml_mimes = get_option('wpuxss_eml_mimes');
382
- $wpuxss_eml_mimes_backup = get_option('wpuxss_eml_mimes_backup');
383
- ?>
384
-
385
- <div id="wpuxss-eml-global-options-wrap" class="wrap">
386
- <?php screen_icon('options-general'); ?>
387
- <h2>
388
- <?php _e('MIME Types','eml'); ?>
389
- <a class="add-new-h2 wpuxss-eml-button-create-mime" href="javascript:;">+ <?php _e('Add New MIME Type','eml'); ?></a>
390
- </h2>
391
-
392
- <?php settings_errors(); ?>
393
-
394
- <div id="poststuff">
395
-
396
- <div id="post-body" class="metabox-holder columns-2">
397
-
398
- <div id="postbox-container-2" class="postbox-container">
399
-
400
- <form method="post" action="options.php" id="wpuxss-eml-form-mimetypes">
401
-
402
- <?php settings_fields( 'wpuxss_eml_mimes' ); ?>
403
-
404
- <table class="wpuxss-eml-mime-type-list wp-list-table widefat" cellspacing="0">
405
- <thead>
406
- <tr>
407
- <th scope="col" class="manage-column wpuxss-eml-column-extension"><?php _e('Extension','eml'); ?></th>
408
- <th scope="col" class="manage-column wpuxss-eml-column-mime"><?php _e('MIME Type','eml'); ?></th>
409
- <th scope="col" class="manage-column wpuxss-eml-column-singular"><?php _e('Singular Label','eml'); ?></th>
410
- <th scope="col" class="manage-column wpuxss-eml-column-plural"><?php _e('Plural Label','eml'); ?></th>
411
- <th scope="col" class="manage-column wpuxss-eml-column-filter"><?php _e('Add Filter','eml'); ?></th>
412
- <th scope="col" class="manage-column wpuxss-eml-column-upload"><?php _e('Allow Upload','eml'); ?></th>
413
- <th scope="col" class="manage-column wpuxss-eml-column-delete"></th>
414
- </tr>
415
- </thead>
416
-
417
-
418
- <tbody>
419
-
420
- <?php
421
- $allowed_mimes = get_allowed_mime_types();
422
- $all_mimes = wp_get_mime_types();
423
- ksort($all_mimes,SORT_STRING);
424
-
425
- foreach ( $all_mimes as $type => $mime )
426
- {
427
- if ( isset($wpuxss_eml_mimes[$type]) )
428
- {
429
- $label = '<code>'. str_replace( '|', '</code>, <code>', $type ) .'</code>';
430
-
431
- $allowed = false;
432
- if ( array_key_exists( $type,$allowed_mimes ) )
433
- $allowed = true;
434
- ?>
435
-
436
- <tr>
437
- <td id="<?php echo $type; ?>"><?php echo $label; ?></td>
438
- <td><code><?php echo $mime; ?></code><input type="hidden" class="wpuxss-eml-mime" name="wpuxss_eml_mimes[<?php echo $type; ?>][mime]" value="<?php echo $wpuxss_eml_mimes[$type]['mime']; ?>" /></td>
439
- <td><input type="text" name="wpuxss_eml_mimes[<?php echo $type; ?>][singular]" value="<?php echo esc_html($wpuxss_eml_mimes[$type]['singular']); ?>" /></td>
440
- <td><input type="text" name="wpuxss_eml_mimes[<?php echo $type; ?>][plural]" value="<?php echo esc_html($wpuxss_eml_mimes[$type]['plural']); ?>" /></td>
441
- <td class="checkbox_td"><input type="checkbox" name="wpuxss_eml_mimes[<?php echo $type; ?>][filter]" title="<?php _e('Add Filter','eml'); ?>" value="1" <?php checked(1, $wpuxss_eml_mimes[$type]['filter']); ?> /></td>
442
- <td class="checkbox_td"><input type="checkbox" name="wpuxss_eml_mimes[<?php echo $type; ?>][upload]" title="<?php _e('Allow Upload','eml'); ?>" value="1" <?php checked(true, $allowed); ?> /></td>
443
- <td><a class="wpuxss-eml-button-remove" title="Delete MIME Type" href="javascript:;">&ndash;</a></td>
444
- </tr>
445
-
446
- <?php
447
- }
448
- }
449
- ?>
450
-
451
- <tr class="wpuxss-eml-clone" style="display:none;">
452
- <td><input type="text" class="wpuxss-eml-type" placeholder="jpg|jpeg|jpe" /></td>
453
- <td><input type="text" class="wpuxss-eml-mime" placeholder="image/jpeg" /></td>
454
- <td><input type="text" class="wpuxss-eml-singular" placeholder="Image" /></td>
455
- <td><input type="text" class="wpuxss-eml-plural" placeholder="Images" /></td>
456
- <td class="checkbox_td"><input type="checkbox" class="wpuxss-eml-filter" title="<?php _e('Add Filter','eml'); ?>" value="1" /></td>
457
- <td class="checkbox_td"><input type="checkbox" class="wpuxss-eml-upload" title="<?php _e('Allow Upload','eml'); ?>" value="1" /></td>
458
- <td><a class="wpuxss-eml-button-remove" title="<?php _e('Delete MIME Type','eml'); ?>" href="javascript:;">&ndash;</a></td>
459
- </tr>
460
-
461
- </tbody>
462
- <tfoot>
463
- <tr>
464
- <th scope="col" class="manage-column wpuxss-eml-column-extension"><?php _e('Extension','eml'); ?></th>
465
- <th scope="col" class="manage-column wpuxss-eml-column-mime"><?php _e('MIME Type','eml'); ?></th>
466
- <th scope="col" class="manage-column wpuxss-eml-column-singular"><?php _e('Singular Label','eml'); ?></th>
467
- <th scope="col" class="manage-column wpuxss-eml-column-plural"><?php _e('Plural Label','eml'); ?></th>
468
- <th scope="col" class="manage-column wpuxss-eml-column-filter"><?php _e('Add Filter','eml'); ?></th>
469
- <th scope="col" class="manage-column wpuxss-eml-column-upload"><?php _e('Allow Upload','eml'); ?></th>
470
- <th scope="col" class="manage-column wpuxss-eml-column-delete"></th>
471
- </tr>
472
- </tfoot>
473
- </table>
474
-
475
- <?php submit_button(__('Restore default MIME Types','eml'),'secondary','wpuxss_eml_restore_mimes_backup'); ?>
476
-
477
- <?php submit_button(); ?>
478
-
479
- </form>
480
-
481
- </div>
482
-
483
- <div id="postbox-container-1" class="postbox-container">
484
-
485
- <?php wpuxss_eml_print_credits(); ?>
486
-
487
- </div>
488
-
489
- </div>
490
-
491
- </div>
492
-
493
- </div>
494
-
495
- <?php
496
- }
497
-
498
-
499
-
500
-
501
-
502
- /**
503
- * wpuxss_eml_print_credits
504
- *
505
- * @since 1.0
506
- * @created 28/09/13
507
- */
508
-
509
- function wpuxss_eml_print_credits()
510
- {
511
- global $wpuxss_eml_version;
512
- ?>
513
-
514
- <div class="postbox" id="wpuxss-credits">
515
-
516
- <h3>Enhanced Media Library <?php echo $wpuxss_eml_version; ?></h3>
517
-
518
- <div class="inside">
519
-
520
- <h4>Changelog</h4>
521
- <p>What's new in <a href="http://wordpress.org/plugins/enhanced-media-library/changelog/">version <?php echo $wpuxss_eml_version; ?></a>.</p>
522
-
523
- <h4>Support</h4>
524
- <p>Feel free to ask for support on the <a href="http://wordpress.org/support/plugin/enhanced-media-library">wordpress.org</a>.</p>
525
-
526
- <h4>Plugin rating</h4>
527
- <p>Please <a href="http://wordpress.org/support/view/plugin-reviews/enhanced-media-library">vote for the plugin</a>. Thanks!</p>
528
-
529
- <h4>Other plugins you may find useful</h4>
530
- <ul>
531
- <li><a href="http://wordpress.org/plugins/toolbar-publish-button/">Toolbar Publish Button</a></li>
532
- </ul>
533
-
534
- <div class="author">
535
- <span><a href="http://wordpressuxsolutions.com/">WordPress UX Solutions</a> by <a class="logo-webbistro" href="http://twitter.com/webbistro"><span class="icon-webbistro">@</span>webbistro</a></span>
536
- </div>
537
-
538
- </div>
539
-
540
- </div>
541
-
542
- <?php
543
- }
544
-
545
-
546
  ?>
1
+ <?php
2
+
3
+ /**
4
+ * wpuxss_eml_admin_menu
5
+ *
6
+ * @since 1.0
7
+ * @created 28/09/13
8
+ */
9
+
10
+ add_action('admin_menu', 'wpuxss_eml_admin_menu');
11
+
12
+ function wpuxss_eml_admin_menu()
13
+ {
14
+ add_utility_page(
15
+ __('Enhanced Media Library Options','eml'), //page_title
16
+ __('Media Settings','eml'), //menu_title
17
+ 'manage_options', //capability
18
+ 'eml-taxonomies-options', //page
19
+ 'wpuxss_eml_print_taxonomies_options' //callback
20
+ );
21
+
22
+ $eml_taxonomies_options_suffix = add_submenu_page(
23
+ 'eml-taxonomies-options',
24
+ __('Taxonomies','eml'),
25
+ __('Taxonomies','eml'),
26
+ 'manage_options',
27
+ 'eml-taxonomies-options'
28
+ );
29
+
30
+ $eml_mimetype_options_suffix = add_submenu_page(
31
+ 'eml-taxonomies-options',
32
+ __('MIME Types','eml'),
33
+ __('MIME Types','eml'),
34
+ 'manage_options',
35
+ 'eml-mimetype-options',
36
+ 'wpuxss_eml_print_mimetypes_options'
37
+ );
38
+
39
+ add_action('admin_print_scripts-' . $eml_taxonomies_options_suffix, 'wpuxss_eml_admin_settings_pages_scripts');
40
+ add_action('admin_print_scripts-' . $eml_mimetype_options_suffix, 'wpuxss_eml_admin_settings_pages_scripts');
41
+ }
42
+
43
+
44
+
45
+
46
+ /**
47
+ * wpuxss_eml_admin_settings_scripts
48
+ *
49
+ * @since 1.0
50
+ * @created 28/10/13
51
+ */
52
+
53
+ function wpuxss_eml_admin_settings_pages_scripts()
54
+ {
55
+ global $wpuxss_eml_version,
56
+ $wpuxss_eml_dir;
57
+
58
+ wp_enqueue_script(
59
+ 'wpuxss-eml-options-script',
60
+ $wpuxss_eml_dir . 'js/eml-options.js',
61
+ array('jquery'),
62
+ $wpuxss_eml_version,
63
+ true
64
+ );
65
+
66
+ $i18n_data = array(
67
+ 'edit' => __( 'Edit', 'eml' ),
68
+ 'close' => __( 'Close', 'eml' ),
69
+ 'view' => __( 'View', 'eml' ),
70
+ 'update' => __( 'Update', 'eml' ),
71
+ 'add_new' => __( 'Add New', 'eml' ),
72
+ 'new' => __( 'New', 'eml' ),
73
+ 'name' => __( 'Name', 'eml' ),
74
+ 'parent' => __( 'Parent', 'eml' ),
75
+ 'all' => __( 'All', 'eml' ),
76
+ 'search' => __( 'Search', 'eml' ),
77
+
78
+ 'tax_deletion_confirm' => __( 'Taxonomy will be deleted permanently! Your media files will remain intacted, but all the connections with this taxonomy and its terms will be lost.', 'eml' ),
79
+ 'tax_error_duplicate' => __( 'There is already a taxonomy with the same name. Please chose other one.', 'eml' ),
80
+ 'tax_new' => __( 'New Taxonomy', 'eml' ),
81
+ 'tax_error_empty_both' => __( 'Please choose Singular and Plural names for all your new taxomonies.', 'eml' ),
82
+ 'tax_error_empty_singular' => __( 'Please choose Singilar name for all your new taxomonies.', 'eml' ),
83
+ 'tax_error_empty_plural' => __( 'Please choose Plural Name for all your new taxomonies.', 'eml' ),
84
+
85
+ 'mime_deletion_confirm' => __( 'Warning! All your custom MIME Types will be deleted by this operation.', 'eml' ),
86
+ 'mime_error_empty_fields' => __( 'Please fill into all fields.', 'eml' ),
87
+ 'mime_error_duplicate' => __( 'Duplicate extensions or MIME types. Please chose other one.', 'eml' )
88
+ );
89
+
90
+ wp_localize_script(
91
+ 'wpuxss-eml-options-script',
92
+ 'wpuxss_eml_i18n_data',
93
+ $i18n_data
94
+ );
95
+ }
96
+
97
+
98
+
99
+
100
+ /**
101
+ * wpuxss_eml_print_taxonomies_options
102
+ *
103
+ * @type callback function
104
+ * @since 1.0
105
+ * @created 28/09/13
106
+ */
107
+
108
+ function wpuxss_eml_print_taxonomies_options()
109
+ {
110
+ if (!current_user_can('manage_options'))
111
+ wp_die( __('You do not have sufficient permissions to access this page.','eml') );
112
+
113
+ $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
114
+ $taxonomies = get_taxonomies(array(),'names');
115
+ ?>
116
+
117
+ <div id="wpuxss-eml-global-options-wrap" class="wrap">
118
+ <?php screen_icon('options-general'); ?>
119
+ <h2><?php _e('Taxonomies','eml'); ?></h2>
120
+
121
+ <?php settings_errors(); ?>
122
+
123
+ <div id="poststuff">
124
+
125
+ <div id="post-body" class="metabox-holder columns-2">
126
+
127
+ <div id="postbox-container-2" class="postbox-container">
128
+
129
+ <form id="wpuxss-eml-form-taxonomies" method="post" action="options.php">
130
+
131
+ <?php settings_fields( 'wpuxss_eml_taxonomies' ); ?>
132
+
133
+ <div class="postbox">
134
+
135
+ <h3><?php _e('Media Taxonomies','eml'); ?></h3>
136
+
137
+ <div class="inside">
138
+
139
+ <p><?php _e('Assign following taxonomies to Media Library:','eml'); ?></p>
140
+
141
+ <?php
142
+
143
+ $html = '';
144
+ foreach ( get_taxonomies(array(),'object') as $taxonomy )
145
+ {
146
+ if ( (in_array('attachment',$taxonomy->object_type) && count($taxonomy->object_type) == 1) || empty($taxonomy->object_type) )
147
+ {
148
+ $assigned = intval($wpuxss_eml_taxonomies[$taxonomy->name]['assigned']);
149
+ $eml_media = intval($wpuxss_eml_taxonomies[$taxonomy->name]['eml_media']);
150
+
151
+ if ($eml_media)
152
+ $li_class = 'wpuxss-eml-taxonomy';
153
+ else
154
+ $li_class = 'wpuxss-non-eml-taxonomy';
155
+
156
+ $html .= '<li class="' . $li_class . '" id="' . $taxonomy->name . '">';
157
+
158
+ $html .= '<input class="wpuxss-eml-assigned" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][assigned]" type="checkbox" value="1" ' . checked( true, $assigned, false ) . ' title="' . __('Assign Taxonomy','eml') . '" />';
159
+ $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][eml_media]" type="hidden" value="' . $eml_media . '" />';
160
+ $html .= ' <label>' . $taxonomy->label . '</label>';
161
+ $html .= '<a class="wpuxss-eml-button-edit" title="' . __('Edit Taxonomy','eml') . '" href="javascript:;">' . __('Edit','eml') . ' &darr;</a>';
162
+ if ( $wpuxss_eml_taxonomies[$taxonomy->name]['eml_media'] == 1 )
163
+ {
164
+ $html .= '<a class="wpuxss-eml-button-remove" title="' . __('Delete Taxonomy','eml') . '" href="javascript:;">&ndash;</a>';
165
+
166
+ $html .= '<div class="wpuxss-eml-taxonomy-edit" style="display:none;">';
167
+
168
+ $html .= '<div class="wpuxss-eml-labels-edit">';
169
+ $html .= '<h4>' . __('Labels','eml') . '</h4>';
170
+ $html .= '<ul>';
171
+ $html .= '<li><label>' . __('Singular','eml') . '</label><input type="text" class="wpuxss-eml-singular_name" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][singular_name]" value="' . esc_html($taxonomy->labels->singular_name) . '" /></li>';
172
+ $html .= '<li><label>' . __('Plural','eml') . '</label><input type="text" class="wpuxss-eml-name" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][name]" value="' . esc_html($taxonomy->labels->name) . '" /></li>';
173
+ $html .= '<li><label>' . __('Menu Name','eml') . '</label><input type="text" class="wpuxss-eml-menu_name" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][menu_name]" value="' . esc_html($taxonomy->labels->menu_name) . '" /></li>';
174
+ $html .= '<li><label>' . __('All','eml') . '</label><input type="text" class="wpuxss-eml-all_items" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][all_items]" value="' . esc_html($taxonomy->labels->all_items) . '" /></li>';
175
+ $html .= '<li><label>' . __('Edit','eml') . '</label><input type="text" class="wpuxss-eml-edit_item" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][edit_item]" value="' . esc_html($taxonomy->labels->edit_item) . '" /></li>';
176
+ $html .= '<li><label>' . __('View','eml') . '</label><input type="text" class="wpuxss-eml-view_item" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][view_item]" value="' . esc_html($taxonomy->labels->view_item) . '" /></li>';
177
+ $html .= '<li><label>' . __('Update','eml') . '</label><input type="text" class="wpuxss-eml-update_item" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][update_item]" value="' . esc_html($taxonomy->labels->update_item) . '" /></li>';
178
+ $html .= '<li><label>' . __('Add New','eml') . '</label><input type="text" class="wpuxss-eml-add_new_item" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][add_new_item]" value="' . esc_html($taxonomy->labels->add_new_item) . '" /></li>';
179
+ $html .= '<li><label>' . __('New','eml') . '</label><input type="text" class="wpuxss-eml-new_item_name" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][new_item_name]" value="' . esc_html($taxonomy->labels->new_item_name) . '" /></li>';
180
+ $html .= '<li><label>' . __('Parent','eml') . '</label><input type="text" class="wpuxss-eml-parent_item" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][parent_item]" value="' . esc_html($taxonomy->labels->parent_item) . '" /></li>';
181
+ $html .= '<li><label>' . __('Search','eml') . '</label><input type="text" class="wpuxss-eml-search_items" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][labels][search_items]" value="' . esc_html($taxonomy->labels->search_items) . '" /></li>';
182
+ $html .= '</ul>';
183
+ $html .= '</div>';
184
+
185
+ $html .= '<div class="wpuxss-eml-settings-edit">';
186
+ $html .= '<h4>' . __('Settings','eml') . '</h4>';
187
+ $html .= '<ul>';
188
+ $html .= '<li><label>' . __('Hierarchical','eml') . '</label><input type="checkbox" class="wpuxss-eml-hierarchical" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][hierarchical]" value="1" ' . checked( 1, $taxonomy->hierarchical, false ) . ' /></li>';
189
+ $html .= '<li><label>' . __('Column in Media Library','eml') . '</label><input type="checkbox" class="wpuxss-eml-show_admin_column" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][show_admin_column]" value="1" ' . checked( 1, $taxonomy->show_admin_column, false ) . ' /></li>';
190
+ $html .= '<li><label>' . __('Filter in Media Library','eml') . '</label><input type="checkbox" class="wpuxss-eml-admin_filter" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][admin_filter]" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['admin_filter'], false ) . ' /></li>';
191
+ $html .= '<li><label>' . __('Filter in Media Uploader','eml') . '</label><input type="checkbox" class="wpuxss-eml-media_uploader_filter" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][media_uploader_filter]" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['media_uploader_filter'], false ) . ' /></li>';
192
+ $html .= '<li><label>' . __('Show in Nav Menu','eml') . '</label><input type="checkbox" class="wpuxss-eml-show_in_nav_menus" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][show_in_nav_menus]" value="1" ' . checked( 1, $taxonomy->show_in_nav_menus, false ) . ' /></li>';
193
+ $html .= '<li><label>' . __('Remember terms order (sort)','eml') . '</label><input type="checkbox" class="wpuxss-eml-sort" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][sort]" value="1" ' . checked( 1, $taxonomy->sort, false ) . ' /></li>';
194
+ $html .= '<li><label>' . __('Slug','eml') . '</label><input type="text" class="wpuxss-eml-slug" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][rewrite][slug]" value="' . esc_attr($taxonomy->rewrite['slug']) . '" /></li>';
195
+ $html .= '</ul>';
196
+ $html .= '</div>';
197
+
198
+ $html .= '</div>';
199
+ }
200
+ else
201
+ {
202
+ $html .= '<div class="wpuxss-eml-taxonomy-edit" style="display:none;">';
203
+
204
+ $html .= '<div class="wpuxss-eml-settings-edit">';
205
+ $html .= '<h4>' . __('Settings','eml') . '</h4>';
206
+ $html .= '<ul>';
207
+ $html .= '<li><label>' . __('Filter in Media Library','eml') . '</label><input type="checkbox" class="wpuxss-eml-admin_filter" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][admin_filter]" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['admin_filter'], false ) . ' /></li>';
208
+ $html .= '<li><label>' . __('Filter in Media Uploader','eml') . '</label><input type="checkbox" class="wpuxss-eml-media_uploader_filter" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][media_uploader_filter]" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['media_uploader_filter'], false ) . ' /></li>';
209
+ $html .= '</ul>';
210
+
211
+ $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][show_admin_column]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['show_admin_column'] . '" />';
212
+ $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][show_in_nav_menus]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['show_in_nav_menus'] . '" />';
213
+ $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][hierarchical]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['hierarchical'] . '" />';
214
+ $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][sort]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['sort'] . '" />';
215
+ $html .= '</div>';
216
+
217
+ $html .= '</div>';
218
+ }
219
+ $html .= '</li>';
220
+ }
221
+ }
222
+
223
+ $html .= '<li class="wpuxss-eml-clone" style="display:none">';
224
+ $html .= '<input class="wpuxss-eml-assigned" name="" type="checkbox" class="wpuxss-eml-assigned" value="1" checked="checked" title="' . __('Assign Taxonomy','eml') . '" />';
225
+ $html .= '<input name="" type="hidden" class="wpuxss-eml-eml_media" value="1" />';
226
+ $html .= ' <label class="wpuxss-eml-taxonomy-label">' . __('New Taxonomy','eml') . '</label>';
227
+
228
+ $html .= '<a class="wpuxss-eml-button-remove" title="' . __('Delete Taxonomy','eml') . '" href="javascript:;">&ndash;</a>';
229
+
230
+ $html .= '<div class="wpuxss-eml-taxonomy-edit">';
231
+
232
+ $html .= '<div class="wpuxss-eml-labels-edit">';
233
+ $html .= '<h4>' . __('Labels','eml') . '</h4>';
234
+ $html .= '<ul>';
235
+ $html .= '<li><label>' . __('Singular','eml') . '</label><input type="text" class="wpuxss-eml-singular_name" name="" value="" /></li>';
236
+ $html .= '<li><label>' . __('Plural','eml') . '</label><input type="text" class="wpuxss-eml-name" name="" value="" /></li>';
237
+ $html .= '<li><label>' . __('Menu Name','eml') . '</label><input type="text" class="wpuxss-eml-menu_name" name="" value="" /></li>';
238
+ $html .= '<li><label>' . __('All','eml') . '</label><input type="text" class="wpuxss-eml-all_items" name="" value="" /></li>';
239
+ $html .= '<li><label>' . __('Edit','eml') . '</label><input type="text" class="wpuxss-eml-edit_item" name="" value="" /></li>';
240
+ $html .= '<li><label>' . __('View','eml') . '</label><input type="text" class="wpuxss-eml-view_item" name="" value="" /></li>';
241
+ $html .= '<li><label>' . __('Update','eml') . '</label><input type="text" class="wpuxss-eml-update_item" name="" value="" /></li>';
242
+ $html .= '<li><label>' . __('Add New','eml') . '</label><input type="text" class="wpuxss-eml-add_new_item" name="" value="" /></li>';
243
+ $html .= '<li><label>' . __('New','eml') . '</label><input type="text" class="wpuxss-eml-new_item_name" name="" value="" /></li>';
244
+ $html .= '<li><label>' . __('Parent','eml') . '</label><input type="text" class="wpuxss-eml-parent_item" name="" value="" /></li>';
245
+ $html .= '<li><label>' . __('Search','eml') . '</label><input type="text" class="wpuxss-eml-search_items" name="" value="" /></li>';
246
+ $html .= '</ul>';
247
+ $html .= '</div>';
248
+
249
+ $html .= '<div class="wpuxss-eml-settings-edit">';
250
+ $html .= '<h4>' . __('Settings','eml') . '</h4>';
251
+ $html .= '<ul>';
252
+ $html .= '<li><label>' . __('Hierarchical','eml') . '</label><input type="checkbox" class="wpuxss-eml-hierarchical" name="" value="1" checked="checked" /></li>';
253
+ $html .= '<li><label>' . __('Column in Media Library','eml') . '</label><input class="wpuxss-eml-show_admin_column" type="checkbox" name="" value="1" /></li>';
254
+ $html .= '<li><label>' . __('Filter in Media Library','eml') . '</label><input class="wpuxss-eml-admin_filter" type="checkbox" name="" value="1" /></li>';
255
+ $html .= '<li><label>' . __('Filter in Media Uploader','eml') . '</label><input class="wpuxss-eml-media_uploader_filter" type="checkbox" name="" value="1" /></li>';
256
+ $html .= '<li><label>' . __('Show in Nav Menu','eml') . '</label><input type="checkbox" class="wpuxss-eml-show_in_nav_menus" name="" value="1" /></li>';
257
+ $html .= '<li><label>' . __('Remember terms order (sort)','eml') . '</label><input type="checkbox" class="wpuxss-eml-sort" name="" value="1" /></li>';
258
+ $html .= '<li><label>' . __('Slug','eml') . '</label><input type="text" class="wpuxss-eml-slug" name="" value="" /></li>';
259
+ $html .= '</ul>';
260
+ $html .= '</div>';
261
+
262
+ $html .= '</div>';
263
+ $html .= '</li>';
264
+
265
+ if ( !empty($html) )
266
+ {
267
+ ?>
268
+ <ul class="wpuxss-eml-settings-list wpuxss-eml-media-taxonomy-list">
269
+ <?php echo $html; ?>
270
+ </ul>
271
+ <div class="wpuxss-eml-button-container-right"><a class="add-new-h2 wpuxss-eml-button-create-taxonomy" href="javascript:;">+ <?php _e('Add New Taxonomy','eml'); ?></a></div>
272
+ <?php
273
+ }
274
+
275
+ submit_button();
276
+ ?>
277
+
278
+ </div>
279
+
280
+ </div>
281
+
282
+ <div class="postbox">
283
+
284
+ <h3><?php _e('Non-Media Taxonomies','eml'); ?></h3>
285
+
286
+ <div class="inside">
287
+
288
+ <p><?php _e('Assign following taxonomies to Media Library:','eml'); ?></p>
289
+
290
+ <?php
291
+ $unuse = array('revision','nav_menu_item','attachment');
292
+ foreach ( get_post_types(array(),'object') as $post_type )
293
+ {
294
+ if ( !in_array($post_type->name,$unuse) )
295
+ {
296
+ $taxonomies = get_object_taxonomies($post_type->name,'object');
297
+ if ( !empty($taxonomies) )
298
+ {
299
+ $html = '';
300
+ foreach ( $taxonomies as $taxonomy )
301
+ {
302
+ if ( $taxonomy->name != 'post_format' )
303
+ {
304
+ $html .= '<li>';
305
+ $html .= '<input class="wpuxss-eml-assigned" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][assigned]" type="checkbox" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['assigned'], false ) . ' title="' . __('Assign Taxonomy','eml') . '" />';
306
+ $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][eml_media]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['eml_media'] . '" />';
307
+ $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][show_admin_column]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['show_admin_column'] . '" />';
308
+ $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][show_in_nav_menus]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['show_in_nav_menus'] . '" />';
309
+ $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][hierarchical]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['hierarchical'] . '" />';
310
+ $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][sort]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['sort'] . '" />';
311
+ $html .= ' <label>' . $taxonomy->label . '</label>';
312
+ $html .= '<a class="wpuxss-eml-button-edit" title="' . __('Edit Taxonomy','eml') . '" href="javascript:;">' . __('Edit','eml') . ' &darr;</a>';
313
+ $html .= '<div class="wpuxss-eml-taxonomy-edit" style="display:none;">';
314
+
315
+ $html .= '<h4>' . __('Settings','eml') . '</h4>';
316
+ $html .= '<ul>';
317
+ $html .= '<li><label>' . __('Filter in Media Library','eml') . '</label><input type="checkbox" class="wpuxss-eml-admin_filter" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][admin_filter]" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['admin_filter'], false ) . ' /></li>';
318
+ $html .= '<li><label>' . __('Filter in Media Uploader','eml') . '</label><input type="checkbox" class="wpuxss-eml-media_uploader_filter" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][media_uploader_filter]" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['media_uploader_filter'], false ) . ' /></li>';
319
+ $html .= '</ul>';
320
+
321
+ $html .= '</div>';
322
+ $html .= '</li>';
323
+
324
+ }
325
+ }
326
+ if ( !empty($html) )
327
+ {
328
+ ?>
329
+ <h4><?php echo $post_type->label; ?></h4>
330
+ <ul class="wpuxss-eml-settings-list wpuxss-eml-non-media-taxonomy-list">
331
+ <?php echo $html; ?>
332
+ </ul>
333
+ <?php
334
+ }
335
+ }
336
+ }
337
+ }
338
+
339
+ submit_button();
340
+ ?>
341
+
342
+ </div>
343
+
344
+ </div>
345
+
346
+ </form>
347
+
348
+ </div>
349
+
350
+ <div id="postbox-container-1" class="postbox-container">
351
+
352
+ <?php wpuxss_eml_print_credits(); ?>
353
+
354
+ </div>
355
+
356
+ </div>
357
+
358
+ </div>
359
+
360
+ </div>
361
+
362
+ <?php
363
+ }
364
+
365
+
366
+
367
+
368
+ /**
369
+ * wpuxss_eml_print_mimetypes_options
370
+ *
371
+ * @type callback function
372
+ * @since 1.0
373
+ * @created 28/09/13
374
+ */
375
+
376
+ function wpuxss_eml_print_mimetypes_options()
377
+ {
378
+ if (!current_user_can('manage_options'))
379
+ wp_die( __('You do not have sufficient permissions to access this page.','eml') );
380
+
381
+ $wpuxss_eml_mimes = get_option('wpuxss_eml_mimes');
382
+ $wpuxss_eml_mimes_backup = get_option('wpuxss_eml_mimes_backup');
383
+ ?>
384
+
385
+ <div id="wpuxss-eml-global-options-wrap" class="wrap">
386
+ <?php screen_icon('options-general'); ?>
387
+ <h2>
388
+ <?php _e('MIME Types','eml'); ?>
389
+ <a class="add-new-h2 wpuxss-eml-button-create-mime" href="javascript:;">+ <?php _e('Add New MIME Type','eml'); ?></a>
390
+ </h2>
391
+
392
+ <?php settings_errors(); ?>
393
+
394
+ <div id="poststuff">
395
+
396
+ <div id="post-body" class="metabox-holder columns-2">
397
+
398
+ <div id="postbox-container-2" class="postbox-container">
399
+
400
+ <form method="post" action="options.php" id="wpuxss-eml-form-mimetypes">
401
+
402
+ <?php settings_fields( 'wpuxss_eml_mimes' ); ?>
403
+
404
+ <table class="wpuxss-eml-mime-type-list wp-list-table widefat" cellspacing="0">
405
+ <thead>
406
+ <tr>
407
+ <th scope="col" class="manage-column wpuxss-eml-column-extension"><?php _e('Extension','eml'); ?></th>
408
+ <th scope="col" class="manage-column wpuxss-eml-column-mime"><?php _e('MIME Type','eml'); ?></th>
409
+ <th scope="col" class="manage-column wpuxss-eml-column-singular"><?php _e('Singular Label','eml'); ?></th>
410
+ <th scope="col" class="manage-column wpuxss-eml-column-plural"><?php _e('Plural Label','eml'); ?></th>
411
+ <th scope="col" class="manage-column wpuxss-eml-column-filter"><?php _e('Add Filter','eml'); ?></th>
412
+ <th scope="col" class="manage-column wpuxss-eml-column-upload"><?php _e('Allow Upload','eml'); ?></th>
413
+ <th scope="col" class="manage-column wpuxss-eml-column-delete"></th>
414
+ </tr>
415
+ </thead>
416
+
417
+
418
+ <tbody>
419
+
420
+ <?php
421
+ $allowed_mimes = get_allowed_mime_types();
422
+ $all_mimes = wp_get_mime_types();
423
+ ksort($all_mimes,SORT_STRING);
424
+
425
+ foreach ( $all_mimes as $type => $mime )
426
+ {
427
+ if ( isset($wpuxss_eml_mimes[$type]) )
428
+ {
429
+ $label = '<code>'. str_replace( '|', '</code>, <code>', $type ) .'</code>';
430
+
431
+ $allowed = false;
432
+ if ( array_key_exists( $type,$allowed_mimes ) )
433
+ $allowed = true;
434
+ ?>
435
+
436
+ <tr>
437
+ <td id="<?php echo $type; ?>"><?php echo $label; ?></td>
438
+ <td><code><?php echo $mime; ?></code><input type="hidden" class="wpuxss-eml-mime" name="wpuxss_eml_mimes[<?php echo $type; ?>][mime]" value="<?php echo $wpuxss_eml_mimes[$type]['mime']; ?>" /></td>
439
+ <td><input type="text" name="wpuxss_eml_mimes[<?php echo $type; ?>][singular]" value="<?php echo esc_html($wpuxss_eml_mimes[$type]['singular']); ?>" /></td>
440
+ <td><input type="text" name="wpuxss_eml_mimes[<?php echo $type; ?>][plural]" value="<?php echo esc_html($wpuxss_eml_mimes[$type]['plural']); ?>" /></td>
441
+ <td class="checkbox_td"><input type="checkbox" name="wpuxss_eml_mimes[<?php echo $type; ?>][filter]" title="<?php _e('Add Filter','eml'); ?>" value="1" <?php checked(1, $wpuxss_eml_mimes[$type]['filter']); ?> /></td>
442
+ <td class="checkbox_td"><input type="checkbox" name="wpuxss_eml_mimes[<?php echo $type; ?>][upload]" title="<?php _e('Allow Upload','eml'); ?>" value="1" <?php checked(true, $allowed); ?> /></td>
443
+ <td><a class="wpuxss-eml-button-remove" title="Delete MIME Type" href="javascript:;">&ndash;</a></td>
444
+ </tr>
445
+
446
+ <?php
447
+ }
448
+ }
449
+ ?>
450
+
451
+ <tr class="wpuxss-eml-clone" style="display:none;">
452
+ <td><input type="text" class="wpuxss-eml-type" placeholder="jpg|jpeg|jpe" /></td>
453
+ <td><input type="text" class="wpuxss-eml-mime" placeholder="image/jpeg" /></td>
454
+ <td><input type="text" class="wpuxss-eml-singular" placeholder="Image" /></td>
455
+ <td><input type="text" class="wpuxss-eml-plural" placeholder="Images" /></td>
456
+ <td class="checkbox_td"><input type="checkbox" class="wpuxss-eml-filter" title="<?php _e('Add Filter','eml'); ?>" value="1" /></td>
457
+ <td class="checkbox_td"><input type="checkbox" class="wpuxss-eml-upload" title="<?php _e('Allow Upload','eml'); ?>" value="1" /></td>
458
+ <td><a class="wpuxss-eml-button-remove" title="<?php _e('Delete MIME Type','eml'); ?>" href="javascript:;">&ndash;</a></td>
459
+ </tr>
460
+
461
+ </tbody>
462
+ <tfoot>
463
+ <tr>
464
+ <th scope="col" class="manage-column wpuxss-eml-column-extension"><?php _e('Extension','eml'); ?></th>
465
+ <th scope="col" class="manage-column wpuxss-eml-column-mime"><?php _e('MIME Type','eml'); ?></th>
466
+ <th scope="col" class="manage-column wpuxss-eml-column-singular"><?php _e('Singular Label','eml'); ?></th>
467
+ <th scope="col" class="manage-column wpuxss-eml-column-plural"><?php _e('Plural Label','eml'); ?></th>
468
+ <th scope="col" class="manage-column wpuxss-eml-column-filter"><?php _e('Add Filter','eml'); ?></th>
469
+ <th scope="col" class="manage-column wpuxss-eml-column-upload"><?php _e('Allow Upload','eml'); ?></th>
470
+ <th scope="col" class="manage-column wpuxss-eml-column-delete"></th>
471
+ </tr>
472
+ </tfoot>
473
+ </table>
474
+
475
+ <?php submit_button(__('Restore default MIME Types','eml'),'secondary','wpuxss_eml_restore_mimes_backup'); ?>
476
+
477
+ <?php submit_button(); ?>
478
+
479
+ </form>
480
+
481
+ </div>
482
+
483
+ <div id="postbox-container-1" class="postbox-container">
484
+
485
+ <?php wpuxss_eml_print_credits(); ?>
486
+
487
+ </div>
488
+
489
+ </div>
490
+
491
+ </div>
492
+
493
+ </div>
494
+
495
+ <?php
496
+ }
497
+
498
+
499
+
500
+
501
+
502
+ /**
503
+ * wpuxss_eml_print_credits
504
+ *
505
+ * @since 1.0
506
+ * @created 28/09/13
507
+ */
508
+
509
+ function wpuxss_eml_print_credits()
510
+ {
511
+ global $wpuxss_eml_version;
512
+ ?>
513
+
514
+ <div class="postbox" id="wpuxss-credits">
515
+
516
+ <h3>Enhanced Media Library <?php echo $wpuxss_eml_version; ?></h3>
517
+
518
+ <div class="inside">
519
+
520
+ <h4>Changelog</h4>
521
+ <p>What's new in <a href="http://wordpress.org/plugins/enhanced-media-library/changelog/">version <?php echo $wpuxss_eml_version; ?></a>.</p>
522
+
523
+ <h4>Support</h4>
524
+ <p>Feel free to ask for support on the <a href="http://wordpress.org/support/plugin/enhanced-media-library">wordpress.org</a>.</p>
525
+
526
+ <h4>Plugin rating</h4>
527
+ <p>Please <a href="http://wordpress.org/support/view/plugin-reviews/enhanced-media-library">vote for the plugin</a>. Thanks!</p>
528
+
529
+ <h4>Other plugins you may find useful</h4>
530
+ <ul>
531
+ <li><a href="http://wordpress.org/plugins/toolbar-publish-button/">Toolbar Publish Button</a></li>
532
+ </ul>
533
+
534
+ <div class="author">
535
+ <span><a href="http://wordpressuxsolutions.com/">WordPress UX Solutions</a> by <a class="logo-webbistro" href="http://twitter.com/webbistro"><span class="icon-webbistro">@</span>webbistro</a></span>
536
+ </div>
537
+
538
+ </div>
539
+
540
+ </div>
541
+
542
+ <?php
543
+ }
544
+
545
+
546
  ?>
core/taxonomies.php CHANGED
@@ -1,463 +1,531 @@
1
- <?php
2
-
3
- /**
4
- * wpuxss_eml_unregister_taxonomy_for_object_type
5
- *
6
- * Unassign taxonomy
7
- *
8
- * @since 1.0
9
- * @created 10/10/13
10
- */
11
-
12
- function wpuxss_eml_unregister_taxonomy_for_object_type( $taxonomy, $object_type )
13
- {
14
- global $wp_taxonomies;
15
-
16
- if ( ! isset( $wp_taxonomies[ $taxonomy ] ) )
17
- return false;
18
-
19
- if ( ! get_post_type_object( $object_type ) )
20
- return false;
21
-
22
- $key = array_search( $object_type, $wp_taxonomies[ $taxonomy ]->object_type, true );
23
- if ( false === $key )
24
- return false;
25
-
26
- unset( $wp_taxonomies[ $taxonomy ]->object_type[ $key ] );
27
- return true;
28
- }
29
-
30
-
31
-
32
-
33
- /**
34
- * wpuxss_eml_taxonomies_validate
35
- *
36
- * @type callback function
37
- * @since 1.0
38
- * @created 28/09/13
39
- */
40
-
41
- function wpuxss_eml_taxonomies_validate($input)
42
- {
43
- if ( !$input ) $input = array();
44
-
45
- foreach ( $input as $taxonomy => $params )
46
- {
47
- $sanitized_taxonomy = sanitize_key($taxonomy);
48
-
49
- if ( $sanitized_taxonomy !== $taxonomy )
50
- {
51
- $input[$sanitized_taxonomy] = $input[$taxonomy];
52
- unset($input[$taxonomy]);
53
- $taxonomy = $sanitized_taxonomy;
54
- }
55
-
56
- if ( !isset($params['hierarchical']) )
57
- $input[$taxonomy]['hierarchical'] = 0;
58
-
59
- if ( !isset($params['sort']) )
60
- $input[$taxonomy]['sort'] = 0;
61
-
62
- if ( !isset($params['show_admin_column']) )
63
- $input[$taxonomy]['show_admin_column'] = 0;
64
-
65
- if ( !isset($params['show_in_nav_menus']) )
66
- $input[$taxonomy]['show_in_nav_menus'] = 0;
67
-
68
- if ( !isset($params['assigned']) )
69
- $input[$taxonomy]['assigned'] = 0;
70
-
71
- if ( !isset($params['admin_filter']) )
72
- $input[$taxonomy]['admin_filter'] = 0;
73
-
74
- if ( !isset($params['media_uploader_filter']) )
75
- $input[$taxonomy]['media_uploader_filter'] = 0;
76
-
77
- $input[$taxonomy]['hierarchical'] = intval($input[$taxonomy]['hierarchical']);
78
- $input[$taxonomy]['sort'] = intval($input[$taxonomy]['sort']);
79
- $input[$taxonomy]['show_admin_column'] = intval($input[$taxonomy]['show_admin_column']);
80
- $input[$taxonomy]['show_in_nav_menus'] = intval($input[$taxonomy]['show_in_nav_menus']);
81
- $input[$taxonomy]['assigned'] = intval($input[$taxonomy]['assigned']);
82
- $input[$taxonomy]['admin_filter'] = intval($input[$taxonomy]['admin_filter']);
83
- $input[$taxonomy]['media_uploader_filter'] = intval($input[$taxonomy]['media_uploader_filter']);
84
-
85
- if ( isset($params['labels']) )
86
- {
87
- $default_labels = array(
88
- 'menu_name' => $params['labels']['name'],
89
- 'all_items' => 'All ' . $params['labels']['name'],
90
- 'edit_item' => 'Edit ' . $params['labels']['singular_name'],
91
- 'view_item' => 'View ' . $params['labels']['singular_name'],
92
- 'update_item' => 'Update ' . $params['labels']['singular_name'],
93
- 'add_new_item' => 'Add New ' . $params['labels']['singular_name'],
94
- 'new_item_name' => 'New ' . $params['labels']['singular_name'] . ' Name',
95
- 'parent_item' => 'Parent ' . $params['labels']['singular_name'],
96
- 'search_items' => 'Search ' . $params['labels']['name']
97
- );
98
-
99
- foreach ( $params['labels'] as $label => $value )
100
- {
101
- $input[$taxonomy]['labels'][$label] = sanitize_text_field($value);
102
-
103
- if ( empty($value) && isset($default_labels[$label]) )
104
- {
105
- $input[$taxonomy]['labels'][$label] = sanitize_text_field($default_labels[$label]);
106
- }
107
- }
108
- }
109
-
110
- if ( isset($params['rewrite']['slug']) )
111
- $input[$taxonomy]['rewrite']['slug'] = sanitize_key($params['rewrite']['slug']);
112
- }
113
-
114
- return $input;
115
- }
116
-
117
-
118
-
119
-
120
- /**
121
- * wpuxss_eml_ajax_query_attachments
122
- *
123
- * Based on /wp-admin/includes/ajax-actions.php
124
- *
125
- * @since 1.0
126
- * @created 03/08/13
127
- */
128
-
129
- add_action( 'wp_ajax_query-attachments', 'wpuxss_eml_ajax_query_attachments', 0 );
130
-
131
- function wpuxss_eml_ajax_query_attachments()
132
- {
133
- if ( ! current_user_can( 'upload_files' ) )
134
- wp_send_json_error();
135
-
136
- $taxonomies = get_object_taxonomies('attachment','names');
137
- $valid = array('s', 'order', 'orderby', 'posts_per_page', 'paged', 'post_mime_type','post_parent', 'post__in', 'post__not_in');
138
- $valid = array_merge($valid,$taxonomies);
139
-
140
- $query = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array();
141
- $query = array_intersect_key( $query, array_flip( $valid ) );
142
-
143
- $query['post_type'] = 'attachment';
144
- $query['post_status'] = 'inherit';
145
-
146
- if ( current_user_can( get_post_type_object( 'attachment' )->cap->read_private_posts ) )
147
- $query['post_status'] .= ',private';
148
-
149
- $query['tax_query'] = array( 'relation' => 'AND' );
150
-
151
- foreach ( $taxonomies as $taxonomy )
152
- {
153
- if ( isset($query[$taxonomy]) && is_numeric($query[$taxonomy]) && $query[$taxonomy] != 0 )
154
- {
155
- array_push($query['tax_query'],array(
156
- 'taxonomy' => $taxonomy,
157
- 'field' => 'id',
158
- 'terms' => $query[$taxonomy]
159
- ));
160
-
161
- unset ( $query[$taxonomy] );
162
- }
163
- }
164
-
165
- $query = new WP_Query( $query );
166
-
167
- $posts = array_map( 'wp_prepare_attachment_for_js', $query->posts );
168
- $posts = array_filter( $posts );
169
-
170
- wp_send_json_success( $posts );
171
- }
172
-
173
-
174
-
175
-
176
- /**
177
- * wpuxss_eml_restrict_manage_posts
178
- *
179
- * Filter media by category
180
- *
181
- * @since 1.0
182
- * @created 11/08/13
183
- */
184
-
185
- add_action('restrict_manage_posts','wpuxss_eml_restrict_manage_posts');
186
-
187
- function wpuxss_eml_restrict_manage_posts()
188
- {
189
- global $pagenow, $wp_query;
190
-
191
- $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
192
-
193
- if ( $pagenow == 'upload.php' )
194
- {
195
- foreach ( get_object_taxonomies('attachment','object') as $taxonomy )
196
- {
197
- if ( $wpuxss_eml_taxonomies[$taxonomy->name]['admin_filter'] )
198
- {
199
- $selected = 0;
200
-
201
- foreach ( $wp_query->tax_query->queries as $taxonomy_var )
202
- {
203
- if ( $taxonomy_var['taxonomy'] == $taxonomy->name && $taxonomy_var['field'] == 'slug' )
204
- {
205
- $term = get_term_by('slug', $taxonomy_var['terms'][0], $taxonomy->name);
206
- if ($term) $selected = $term->term_id;
207
- }
208
- }
209
-
210
- wp_dropdown_categories(
211
- array(
212
- 'show_option_all' => $taxonomy->labels->all_items,
213
- 'taxonomy' => $taxonomy->name,
214
- 'name' => $taxonomy->name,
215
- 'orderby' => 'name',
216
- 'selected' => $selected,
217
- 'hierarchical' => true,
218
- 'depth' => 3,
219
- 'show_count' => false,
220
- 'hide_if_empty' => true
221
- )
222
- );
223
- }
224
- }
225
- }
226
- }
227
-
228
-
229
-
230
-
231
- /**
232
- * wpuxss_eml_parse_query
233
- *
234
- * @since 1.0
235
- * @created 11/08/13
236
- */
237
-
238
- add_filter('parse_query', 'wpuxss_eml_parse_query');
239
-
240
- function wpuxss_eml_parse_query($query)
241
- {
242
- global $pagenow;
243
-
244
- if ( $pagenow=='upload.php' )
245
- {
246
- $qv = &$query->query_vars;
247
-
248
- foreach ( get_object_taxonomies('attachment','object') as $taxonomy )
249
- {
250
- if ( isset( $qv['taxonomy']) && isset($qv['term'] ) )
251
- {
252
- $tax = $qv['taxonomy'];
253
-
254
- if ( $tax == 'category' )
255
- $tax = 'category_name';
256
-
257
- if ( $tax == 'post_tag' )
258
- $tax = 'tag';
259
-
260
- $qv[$tax] = $qv['term'];
261
- unset($qv['taxonomy']);
262
- unset($qv['term']);
263
- }
264
-
265
- if ( isset($_REQUEST[$taxonomy->name]) && $_REQUEST[$taxonomy->name] && is_numeric($_REQUEST[$taxonomy->name]) )
266
- {
267
- $tax = $taxonomy->name;
268
-
269
- if ( $tax == 'category' )
270
- $tax = 'category_name';
271
-
272
- if ( $tax == 'post_tag' )
273
- $tax = 'tag';
274
-
275
- $term = get_term_by('id', $_REQUEST[$taxonomy->name], $taxonomy->name);
276
-
277
- if ($term)
278
- $qv[$tax] = $term->slug;
279
- }
280
- }
281
- }
282
- }
283
-
284
-
285
-
286
-
287
- /**
288
- * wpuxss_eml_attachment_fields_to_edit
289
- *
290
- * @since 1.0
291
- * @created 14/08/13
292
- */
293
-
294
- add_filter( 'attachment_fields_to_edit', 'wpuxss_eml_attachment_fields_to_edit', 10, 2 );
295
-
296
- function wpuxss_eml_attachment_fields_to_edit( $form_fields, $post )
297
- {
298
- foreach ( get_attachment_taxonomies($post->ID) as $taxonomy )
299
- {
300
- $terms = get_object_term_cache($post->ID, $taxonomy);
301
-
302
- $t = (array) get_taxonomy($taxonomy);
303
- if ( ! $t['public'] || ! $t['show_ui'] )
304
- continue;
305
- if ( empty($t['label']) )
306
- $t['label'] = $taxonomy;
307
- if ( empty($t['args']) )
308
- $t['args'] = array();
309
-
310
-
311
- if ( false === $terms )
312
- $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
313
-
314
- $values = array();
315
-
316
- foreach ( $terms as $term )
317
- $values[] = $term->slug;
318
-
319
- $t['value'] = join(', ', $values);
320
- $t['show_in_edit'] = false;
321
-
322
- if ( $t['hierarchical'] )
323
- {
324
- ob_start();
325
-
326
- wp_terms_checklist( $post->ID, array( 'taxonomy' => $taxonomy, 'checked_ontop' => false, 'walker' => new Walker_Media_Taxonomy_Checklist() ) );
327
-
328
- if ( ob_get_contents() != false )
329
- $html = '<ul class="term-list">' . ob_get_contents() . '</ul>';
330
- else
331
- $html = '<ul class="term-list"><li>No ' . $t['label'] . '</li></ul>';
332
-
333
- ob_end_clean();
334
-
335
- $html .= '<input type="hidden" class="text" id="attachments-'.$post->ID.'-'.$taxonomy.'" name="attachments['.$post->ID.']['.$taxonomy.']" value="'.$t['value'].'">';
336
-
337
- $t['input'] = 'html';
338
- $t['html'] = $html;
339
- }
340
-
341
- $form_fields[$taxonomy] = $t;
342
- }
343
-
344
- return $form_fields;
345
- }
346
-
347
-
348
-
349
-
350
- /**
351
- * Walker_Media_Taxonomy_Checklist
352
- *
353
- * Based on /wp-includes/category-template.php
354
- *
355
- * @since 1.0
356
- * @created 09/09/13
357
- */
358
-
359
- class Walker_Media_Taxonomy_Checklist extends Walker
360
- {
361
- var $tree_type = 'category';
362
- var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
363
-
364
- function start_lvl( &$output, $depth = 0, $args = array() )
365
- {
366
- $indent = str_repeat("\t", $depth);
367
- $output .= "$indent<ul class='children'>\n";
368
- }
369
-
370
- function end_lvl( &$output, $depth = 0, $args = array() )
371
- {
372
- $indent = str_repeat("\t", $depth);
373
- $output .= "$indent</ul>\n";
374
- }
375
-
376
- function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 )
377
- {
378
- extract($args);
379
-
380
- if ( empty($taxonomy) )
381
- $taxonomy = 'category';
382
-
383
- $name = 'tax_input['.$taxonomy.']';
384
-
385
- $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
386
- $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->slug . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . checked( in_array( $category->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
387
- }
388
-
389
- function end_el( &$output, $category, $depth = 0, $args = array() )
390
- {
391
- $output .= "</li>\n";
392
- }
393
- }
394
-
395
-
396
-
397
-
398
- /**
399
- * Walker_Media_Taxonomy_Uploader_Filter
400
- *
401
- * Based on /wp-includes/category-template.php
402
- *
403
- * @since 1.0.1
404
- * @created 05/11/13
405
- */
406
-
407
- class Walker_Media_Taxonomy_Uploader_Filter extends Walker
408
- {
409
- var $tree_type = 'category';
410
- var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
411
-
412
- function start_lvl( &$output, $depth = 0, $args = array() )
413
- {
414
- $output .= "";
415
- }
416
-
417
- function end_lvl( &$output, $depth = 0, $args = array() )
418
- {
419
- $output .= "";
420
- }
421
-
422
- function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 )
423
- {
424
- extract($args);
425
-
426
- $indent = str_repeat('&nbsp;&nbsp;&nbsp;', $depth);
427
- $output .= $category->term_id . '>' . $indent . esc_html( apply_filters('the_category', $category->name )) . '|';
428
- }
429
-
430
- function end_el( &$output, $category, $depth = 0, $args = array() )
431
- {
432
- $output .= "";
433
- }
434
- }
435
-
436
-
437
-
438
-
439
- /**
440
- * wpuxss_eml_pre_get_posts
441
- *
442
- * Taxonomy archive specific query (front-end)
443
- *
444
- * @since 1.0
445
- * @created 03/08/13
446
- */
447
-
448
- add_action( 'pre_get_posts', 'wpuxss_eml_pre_get_posts' );
449
-
450
- function wpuxss_eml_pre_get_posts( $query )
451
- {
452
- $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
453
-
454
- foreach ( $wpuxss_eml_taxonomies as $taxonomy => $params )
455
- {
456
- if ( $params['assigned'] && $params['eml_media'] && $query->is_main_query() && is_tax($taxonomy) && !is_admin() )
457
- {
458
- $query->set( 'post_status', 'inherit' );
459
- }
460
- }
461
- }
462
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
463
  ?>
1
+ <?php
2
+
3
+ /**
4
+ * wpuxss_eml_unregister_taxonomy_for_object_type
5
+ *
6
+ * Unassign taxonomy
7
+ *
8
+ * @since 1.0
9
+ * @created 10/10/13
10
+ */
11
+
12
+ function wpuxss_eml_unregister_taxonomy_for_object_type( $taxonomy, $object_type )
13
+ {
14
+ global $wp_taxonomies;
15
+
16
+ if ( ! isset( $wp_taxonomies[ $taxonomy ] ) )
17
+ return false;
18
+
19
+ if ( ! get_post_type_object( $object_type ) )
20
+ return false;
21
+
22
+ $key = array_search( $object_type, $wp_taxonomies[ $taxonomy ]->object_type, true );
23
+ if ( false === $key )
24
+ return false;
25
+
26
+ unset( $wp_taxonomies[ $taxonomy ]->object_type[ $key ] );
27
+ return true;
28
+ }
29
+
30
+
31
+
32
+
33
+ /**
34
+ * wpuxss_eml_taxonomies_validate
35
+ *
36
+ * @type callback function
37
+ * @since 1.0
38
+ * @created 28/09/13
39
+ */
40
+
41
+ function wpuxss_eml_taxonomies_validate($input)
42
+ {
43
+ if ( !$input ) $input = array();
44
+
45
+ foreach ( $input as $taxonomy => $params )
46
+ {
47
+ $sanitized_taxonomy = sanitize_key($taxonomy);
48
+
49
+ if ( $sanitized_taxonomy !== $taxonomy )
50
+ {
51
+ $input[$sanitized_taxonomy] = $input[$taxonomy];
52
+ unset($input[$taxonomy]);
53
+ $taxonomy = $sanitized_taxonomy;
54
+ }
55
+
56
+ if ( !isset($params['hierarchical']) )
57
+ $input[$taxonomy]['hierarchical'] = 0;
58
+
59
+ if ( !isset($params['sort']) )
60
+ $input[$taxonomy]['sort'] = 0;
61
+
62
+ if ( !isset($params['show_admin_column']) )
63
+ $input[$taxonomy]['show_admin_column'] = 0;
64
+
65
+ if ( !isset($params['show_in_nav_menus']) )
66
+ $input[$taxonomy]['show_in_nav_menus'] = 0;
67
+
68
+ if ( !isset($params['assigned']) )
69
+ $input[$taxonomy]['assigned'] = 0;
70
+
71
+ if ( !isset($params['admin_filter']) )
72
+ $input[$taxonomy]['admin_filter'] = 0;
73
+
74
+ if ( !isset($params['media_uploader_filter']) )
75
+ $input[$taxonomy]['media_uploader_filter'] = 0;
76
+
77
+ $input[$taxonomy]['hierarchical'] = intval($input[$taxonomy]['hierarchical']);
78
+ $input[$taxonomy]['sort'] = intval($input[$taxonomy]['sort']);
79
+ $input[$taxonomy]['show_admin_column'] = intval($input[$taxonomy]['show_admin_column']);
80
+ $input[$taxonomy]['show_in_nav_menus'] = intval($input[$taxonomy]['show_in_nav_menus']);
81
+ $input[$taxonomy]['assigned'] = intval($input[$taxonomy]['assigned']);
82
+ $input[$taxonomy]['admin_filter'] = intval($input[$taxonomy]['admin_filter']);
83
+ $input[$taxonomy]['media_uploader_filter'] = intval($input[$taxonomy]['media_uploader_filter']);
84
+
85
+ if ( isset($params['labels']) )
86
+ {
87
+ $default_labels = array(
88
+ 'menu_name' => $params['labels']['name'],
89
+ 'all_items' => 'All ' . $params['labels']['name'],
90
+ 'edit_item' => 'Edit ' . $params['labels']['singular_name'],
91
+ 'view_item' => 'View ' . $params['labels']['singular_name'],
92
+ 'update_item' => 'Update ' . $params['labels']['singular_name'],
93
+ 'add_new_item' => 'Add New ' . $params['labels']['singular_name'],
94
+ 'new_item_name' => 'New ' . $params['labels']['singular_name'] . ' Name',
95
+ 'parent_item' => 'Parent ' . $params['labels']['singular_name'],
96
+ 'search_items' => 'Search ' . $params['labels']['name']
97
+ );
98
+
99
+ foreach ( $params['labels'] as $label => $value )
100
+ {
101
+ $input[$taxonomy]['labels'][$label] = sanitize_text_field($value);
102
+
103
+ if ( empty($value) && isset($default_labels[$label]) )
104
+ {
105
+ $input[$taxonomy]['labels'][$label] = sanitize_text_field($default_labels[$label]);
106
+ }
107
+ }
108
+ }
109
+
110
+ if ( isset($params['rewrite']['slug']) )
111
+ $input[$taxonomy]['rewrite']['slug'] = sanitize_key($params['rewrite']['slug']);
112
+ }
113
+
114
+ return $input;
115
+ }
116
+
117
+
118
+
119
+
120
+ /**
121
+ * wpuxss_eml_ajax_query_attachments
122
+ *
123
+ * Based on /wp-admin/includes/ajax-actions.php
124
+ *
125
+ * @since 1.0
126
+ * @created 03/08/13
127
+ */
128
+
129
+ add_action( 'wp_ajax_query-attachments', 'wpuxss_eml_ajax_query_attachments', 0 );
130
+
131
+ function wpuxss_eml_ajax_query_attachments()
132
+ {
133
+ if ( ! current_user_can( 'upload_files' ) )
134
+ wp_send_json_error();
135
+
136
+ $taxonomies = get_object_taxonomies('attachment','names');
137
+
138
+ $query = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array();
139
+
140
+ $defaults = array(
141
+ 's', 'order', 'orderby', 'posts_per_page', 'paged', 'post_mime_type',
142
+ 'post_parent', 'post__in', 'post__not_in'
143
+ );
144
+ $query = array_intersect_key( $query, array_flip( array_merge($defaults, $taxonomies) ) );
145
+
146
+ $query['post_type'] = 'attachment';
147
+ $query['post_status'] = 'inherit';
148
+ if ( current_user_can( get_post_type_object( 'attachment' )->cap->read_private_posts ) )
149
+ $query['post_status'] .= ',private';
150
+
151
+ $query['tax_query'] = array( 'relation' => 'AND' );
152
+
153
+ foreach ( $taxonomies as $taxonomy )
154
+ {
155
+
156
+ if ( isset($query[$taxonomy]) && is_numeric($query[$taxonomy]) )
157
+ {
158
+ array_push($query['tax_query'],array(
159
+ 'taxonomy' => $taxonomy,
160
+ 'field' => 'id',
161
+ 'terms' => $query[$taxonomy]
162
+ ));
163
+ }
164
+ unset ( $query[$taxonomy] );
165
+ }
166
+
167
+ $query = apply_filters( 'ajax_query_attachments_args', $query );
168
+ $query = new WP_Query( $query );
169
+
170
+ $posts = array_map( 'wp_prepare_attachment_for_js', $query->posts );
171
+ $posts = array_filter( $posts );
172
+
173
+ wp_send_json_success( $posts );
174
+ }
175
+
176
+
177
+
178
+
179
+ /**
180
+ * wpuxss_eml_restrict_manage_posts
181
+ *
182
+ * Filter media by category
183
+ *
184
+ * @since 1.0
185
+ * @created 11/08/13
186
+ */
187
+
188
+ add_action('restrict_manage_posts','wpuxss_eml_restrict_manage_posts');
189
+
190
+ function wpuxss_eml_restrict_manage_posts()
191
+ {
192
+ global $pagenow, $wp_query;
193
+
194
+ $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
195
+
196
+ if ( $pagenow == 'upload.php' )
197
+ {
198
+ foreach ( get_object_taxonomies('attachment','object') as $taxonomy )
199
+ {
200
+ if ( $wpuxss_eml_taxonomies[$taxonomy->name]['admin_filter'] )
201
+ {
202
+ $selected = 0;
203
+
204
+ foreach ( $wp_query->tax_query->queries as $taxonomy_var )
205
+ {
206
+ if ( $taxonomy_var['taxonomy'] == $taxonomy->name && $taxonomy_var['field'] == 'slug' )
207
+ {
208
+ $term = get_term_by('slug', $taxonomy_var['terms'][0], $taxonomy->name);
209
+ if ($term) $selected = $term->term_id;
210
+ }
211
+ }
212
+
213
+ wp_dropdown_categories(
214
+ array(
215
+ 'show_option_all' => $taxonomy->labels->all_items,
216
+ 'taxonomy' => $taxonomy->name,
217
+ 'name' => $taxonomy->name,
218
+ 'orderby' => 'name',
219
+ 'selected' => $selected,
220
+ 'hierarchical' => true,
221
+ 'show_count' => false,
222
+ 'hide_empty' => false,
223
+ 'hide_if_empty' => true
224
+ )
225
+ );
226
+ }
227
+ }
228
+ }
229
+ }
230
+
231
+
232
+
233
+
234
+ /**
235
+ * wpuxss_eml_parse_query
236
+ *
237
+ * @since 1.0
238
+ * @created 11/08/13
239
+ */
240
+
241
+ add_filter('parse_query', 'wpuxss_eml_parse_query');
242
+
243
+ function wpuxss_eml_parse_query($query)
244
+ {
245
+ global $pagenow;
246
+
247
+ if ( $pagenow=='upload.php' )
248
+ {
249
+ $qv = &$query->query_vars;
250
+
251
+ foreach ( get_object_taxonomies('attachment','object') as $taxonomy )
252
+ {
253
+ if ( isset( $qv['taxonomy']) && isset($qv['term'] ) )
254
+ {
255
+ $tax = $qv['taxonomy'];
256
+
257
+ if ( $tax == 'category' )
258
+ $tax = 'category_name';
259
+
260
+ if ( $tax == 'post_tag' )
261
+ $tax = 'tag';
262
+
263
+ $qv[$tax] = $qv['term'];
264
+ unset($qv['taxonomy']);
265
+ unset($qv['term']);
266
+ }
267
+
268
+ if ( isset($_REQUEST[$taxonomy->name]) && $_REQUEST[$taxonomy->name] && is_numeric($_REQUEST[$taxonomy->name]) )
269
+ {
270
+ $tax = $taxonomy->name;
271
+
272
+ if ( $tax == 'category' )
273
+ $tax = 'category_name';
274
+
275
+ if ( $tax == 'post_tag' )
276
+ $tax = 'tag';
277
+
278
+ $term = get_term_by('id', $_REQUEST[$taxonomy->name], $taxonomy->name);
279
+
280
+ if ($term)
281
+ $qv[$tax] = $term->slug;
282
+ }
283
+ }
284
+ }
285
+ }
286
+
287
+
288
+
289
+
290
+ /**
291
+ * wpuxss_eml_attachment_fields_to_edit
292
+ *
293
+ * @since 1.0
294
+ * @created 14/08/13
295
+ */
296
+
297
+ add_filter( 'attachment_fields_to_edit', 'wpuxss_eml_attachment_fields_to_edit', 10, 2 );
298
+
299
+ function wpuxss_eml_attachment_fields_to_edit( $form_fields, $post )
300
+ {
301
+ foreach ( get_attachment_taxonomies($post->ID) as $taxonomy )
302
+ {
303
+ $terms = get_object_term_cache($post->ID, $taxonomy);
304
+
305
+ $t = (array) get_taxonomy($taxonomy);
306
+ if ( ! $t['public'] || ! $t['show_ui'] )
307
+ continue;
308
+ if ( empty($t['label']) )
309
+ $t['label'] = $taxonomy;
310
+ if ( empty($t['args']) )
311
+ $t['args'] = array();
312
+
313
+
314
+ if ( false === $terms )
315
+ $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
316
+
317
+ $values = array();
318
+
319
+ foreach ( $terms as $term )
320
+ $values[] = $term->slug;
321
+
322
+ $t['value'] = join(', ', $values);
323
+ $t['show_in_edit'] = false;
324
+
325
+ if ( $t['hierarchical'] )
326
+ {
327
+ ob_start();
328
+
329
+ wp_terms_checklist( $post->ID, array( 'taxonomy' => $taxonomy, 'checked_ontop' => false, 'walker' => new Walker_Media_Taxonomy_Checklist() ) );
330
+
331
+ if ( ob_get_contents() != false )
332
+ $html = '<ul class="term-list">' . ob_get_contents() . '</ul>';
333
+ else
334
+ $html = '<ul class="term-list"><li>No ' . $t['label'] . '</li></ul>';
335
+
336
+ ob_end_clean();
337
+
338
+ $t['input'] = 'html';
339
+ $t['html'] = $html;
340
+ }
341
+
342
+ $form_fields[$taxonomy] = $t;
343
+ }
344
+
345
+ return $form_fields;
346
+ }
347
+
348
+
349
+
350
+
351
+ /**
352
+ * Walker_Media_Taxonomy_Checklist
353
+ *
354
+ * Based on /wp-includes/category-template.php
355
+ *
356
+ * @since 1.0
357
+ * @created 09/09/13
358
+ */
359
+
360
+ class Walker_Media_Taxonomy_Checklist extends Walker
361
+ {
362
+ var $tree_type = 'category';
363
+ var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
364
+
365
+ function start_lvl( &$output, $depth = 0, $args = array() )
366
+ {
367
+ $indent = str_repeat("\t", $depth);
368
+ $output .= "$indent<ul class='children'>\n";
369
+ }
370
+
371
+ function end_lvl( &$output, $depth = 0, $args = array() )
372
+ {
373
+ $indent = str_repeat("\t", $depth);
374
+ $output .= "$indent</ul>\n";
375
+ }
376
+
377
+ function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 )
378
+ {
379
+ extract($args);
380
+
381
+ if ( empty($taxonomy) )
382
+ $taxonomy = 'category';
383
+
384
+ $name = 'tax_input['.$taxonomy.']';
385
+
386
+ $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
387
+ $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->slug . '" type="checkbox" name="'.$name.'['. $category->slug.']" id="in-'.$taxonomy.'-' . $category->term_id . '"' . checked( in_array( $category->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
388
+ }
389
+
390
+ function end_el( &$output, $category, $depth = 0, $args = array() )
391
+ {
392
+ $output .= "</li>\n";
393
+ }
394
+ }
395
+
396
+
397
+
398
+
399
+ /**
400
+ * Walker_Media_Taxonomy_Uploader_Filter
401
+ *
402
+ * Based on /wp-includes/category-template.php
403
+ *
404
+ * @since 1.0.1
405
+ * @created 05/11/13
406
+ */
407
+
408
+ class Walker_Media_Taxonomy_Uploader_Filter extends Walker
409
+ {
410
+ var $tree_type = 'category';
411
+ var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
412
+
413
+ function start_lvl( &$output, $depth = 0, $args = array() )
414
+ {
415
+ $output .= "";
416
+ }
417
+
418
+ function end_lvl( &$output, $depth = 0, $args = array() )
419
+ {
420
+ $output .= "";
421
+ }
422
+
423
+ function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 )
424
+ {
425
+ extract($args);
426
+
427
+ $indent = str_repeat('&nbsp;&nbsp;&nbsp;', $depth);
428
+ $output .= $category->term_id . '>' . $indent . esc_html( apply_filters('the_category', $category->name )) . '|';
429
+ }
430
+
431
+ function end_el( &$output, $category, $depth = 0, $args = array() )
432
+ {
433
+ $output .= "";
434
+ }
435
+ }
436
+
437
+
438
+
439
+
440
+
441
+ /**
442
+ * wpuxss_eml_save_attachment_compat
443
+ *
444
+ * Based on /wp-admin/includes/ajax-actions.php
445
+ *
446
+ * @since 1.0.6
447
+ * @created 06/14/14
448
+ */
449
+
450
+ add_action( 'wp_ajax_save-attachment-compat', 'wpuxss_eml_save_attachment_compat', 0 );
451
+
452
+ function wpuxss_eml_save_attachment_compat()
453
+ {
454
+ if ( ! isset( $_REQUEST['id'] ) )
455
+ wp_send_json_error();
456
+
457
+ if ( ! $id = absint( $_REQUEST['id'] ) )
458
+ wp_send_json_error();
459
+
460
+ if ( empty( $_REQUEST['attachments'] ) || empty( $_REQUEST['attachments'][ $id ] ) )
461
+ wp_send_json_error();
462
+ $attachment_data = $_REQUEST['attachments'][ $id ];
463
+
464
+ check_ajax_referer( 'update-post_' . $id, 'nonce' );
465
+
466
+ if ( ! current_user_can( 'edit_post', $id ) )
467
+ wp_send_json_error();
468
+
469
+ $post = get_post( $id, ARRAY_A );
470
+
471
+ if ( 'attachment' != $post['post_type'] )
472
+ wp_send_json_error();
473
+
474
+ /** This filter is documented in wp-admin/includes/media.php */
475
+ $post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data );
476
+
477
+ if ( isset( $post['errors'] ) ) {
478
+ $errors = $post['errors']; // @todo return me and display me!
479
+ unset( $post['errors'] );
480
+ }
481
+
482
+ wp_update_post( $post );
483
+
484
+ foreach ( get_attachment_taxonomies( $post ) as $taxonomy )
485
+ {
486
+ if ( isset( $attachment_data[ $taxonomy ] ) )
487
+ wp_set_object_terms( $id, array_map( 'trim', preg_split( '/,+/', $attachment_data[ $taxonomy ] ) ), $taxonomy, false );
488
+ else if ( isset($_REQUEST['tax_input']) && isset( $_REQUEST['tax_input'][ $taxonomy ] ) )
489
+ wp_set_object_terms( $id, $_REQUEST['tax_input'][ $taxonomy ], $taxonomy, false );
490
+ else
491
+ wp_set_object_terms( $id, '', $taxonomy, false );
492
+ }
493
+
494
+ if ( ! $attachment = wp_prepare_attachment_for_js( $id ) )
495
+ wp_send_json_error();
496
+
497
+ wp_send_json_success( $attachment );
498
+ }
499
+
500
+
501
+
502
+
503
+ /**
504
+ * wpuxss_eml_pre_get_posts
505
+ *
506
+ * Taxonomy archive specific query (front-end)
507
+ *
508
+ * @since 1.0
509
+ * @created 03/08/13
510
+ */
511
+
512
+ add_action( 'pre_get_posts', 'wpuxss_eml_pre_get_posts', 99 );
513
+
514
+ function wpuxss_eml_pre_get_posts( $query )
515
+ {
516
+ $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
517
+
518
+ if ( is_array($wpuxss_eml_taxonomies) )
519
+ {
520
+ foreach ( $wpuxss_eml_taxonomies as $taxonomy => $params )
521
+ {
522
+ if ( $params['assigned'] && $params['eml_media'] && $query->is_main_query() && is_tax($taxonomy) && !is_admin() )
523
+ {
524
+ $query->set( 'post_type', 'attachment' );
525
+ $query->set( 'post_status', 'inherit' );
526
+ }
527
+ }
528
+ }
529
+ }
530
+
531
  ?>
css/eml-admin.css CHANGED
@@ -1,235 +1,263 @@
1
-
2
- /* == Attachment Fields == */
3
-
4
- .compat-item .field input[type="checkbox"] {
5
- width: auto;
6
- }
7
-
8
- .term-list {
9
- background-color: #fff;
10
- border: 1px solid #dfdfdf;
11
- border-radius: 3px;
12
- padding: 10px 10px 5px;
13
- margin: 0 0 10px;
14
- }
15
- .term-list li {
16
- line-height: 22px;
17
- }
18
- .term-list li input[type="checkbox"] {
19
- margin: -4px 4px 0 0 !important;
20
- }
21
- .term-list .children {
22
- margin: 5px 0 0 20px;
23
- }
24
-
25
-
26
- /* == Taxonomy Filters == */
27
-
28
- .media-frame select[class^="attachment"] {
29
- margin-top: 11px !important;
30
- margin-right: 10px !important;
31
- max-width: 140px !important;
32
- }
33
-
34
- .media-frame .search {
35
- line-height: 14px;
36
- }
37
-
38
-
39
- /* == Media Uploader Boxes' Positions == */
40
-
41
- .attachments-browser .media-toolbar {
42
- height: 80px;
43
- }
44
-
45
- .attachments-browser .attachments {
46
- top: 80px;
47
- }
48
- .attachments-browser .media-toolbar-secondary {
49
- width:75%;
50
- }
51
-
52
-
53
- /* == MIME types Option Page Styles == */
54
-
55
- .wpuxss-eml-mime-type-list {
56
- table-layout: fixed;
57
- }
58
- .wpuxss-eml-mime-type-list td {
59
- padding: 8px 7px;
60
- }
61
- .wpuxss-eml-mime-type-list .checkbox_td {
62
- text-align: center;
63
- }
64
- .wpuxss-eml-mime-type-list input[type="text"] {
65
- width: 120px;
66
- }
67
- .wpuxss-eml-column-extension {
68
- width: 130px;
69
- }
70
- .wpuxss-eml-column-singular,
71
- .wpuxss-eml-column-plural {
72
- width:120px;
73
- }
74
- .wpuxss-eml-column-filter {
75
- width: 70px;
76
- }
77
- .wpuxss-eml-column-upload {
78
- width: 90px;
79
- }
80
- .wpuxss-eml-column-delete {
81
- width: 30px;
82
- }
83
-
84
-
85
- /* == Taxonomies Option Page Styles == */
86
-
87
- .wpuxss-eml-settings-list {
88
- border-top: 1px solid #dfdfdf;
89
- }
90
- .wpuxss-eml-settings-list > li {
91
- border-bottom: 1px solid #dfdfdf;
92
- padding: 8px 7px;
93
- margin: 0;
94
- position: relative;
95
- overflow: hidden;
96
- }
97
- .wpuxss-eml-settings-list > li > label {
98
- font-size: 14px;
99
- display: inline-block;
100
- margin-right: 100px;
101
- }
102
- .wpuxss-eml-settings-list input {
103
- margin: 0;
104
- }
105
- .wpuxss-eml-settings-list > li .wpuxss-eml-button-edit {
106
- position: absolute;
107
- right: 40px;
108
- top: 7px;
109
- text-decoration: none;
110
- height: 14px;
111
- line-height: 14px;
112
- border-radius: 10px;
113
- box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
114
- padding: 3px 10px;
115
- }
116
- .wpuxss-eml-settings-list.wpuxss-eml-non-media-taxonomy-list > li .wpuxss-eml-button-edit {
117
- right: 10px;
118
- }
119
- .wpuxss-eml-settings-list > li .wpuxss-eml-button-remove {
120
- position: absolute;
121
- right: 10px;
122
- top: 7px;
123
- }
124
- .wpuxss-eml-settings-list .wpuxss-eml-assigned {
125
- margin-right:10px;
126
- }
127
-
128
- .wpuxss-eml-taxonomy-edit label {
129
- display: inline-block;
130
- width: 160px;
131
- }
132
- .wpuxss-eml-taxonomy-edit .wpuxss-eml-labels-edit {
133
- float: left;
134
- width: 49%;
135
- margin-right: 1%;
136
- }
137
- .wpuxss-eml-taxonomy-edit .wpuxss-eml-settings-edit {
138
- float: left;
139
- width: 49%;
140
- margin-left: 1%;
141
- }
142
- .wpuxss-eml-taxonomy-edit .wpuxss-eml-settings-edit li {
143
- padding: 3px 0;
144
- }
145
- .wpuxss-eml-taxonomy-edit .wpuxss-eml-labels-edit label {
146
- display: inline-block;
147
- width: 100px;
148
- }
149
- .wpuxss-eml-taxonomy-edit .wpuxss-eml-labels-edit input {
150
- min-width: 150px;
151
- }
152
-
153
-
154
-
155
-
156
- /* == Buttons Styles == */
157
-
158
- .wpuxss-eml-button-remove {
159
- display: inline-block;
160
- text-align: center;
161
- text-decoration: none;
162
- line-height: 1em;
163
- font-size: 18px;
164
- font-family: Arial, Helvetica, sans-serif;
165
- height: 20px;
166
- width: 20px;
167
- border-radius: 10px;
168
- box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
169
- }
170
- .wpuxss-eml-button-remove:hover {
171
- box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
172
- }
173
- .wpuxss-eml-button-container-right {
174
- text-align: right;
175
- margin: 20px 0 0;
176
- }
177
-
178
-
179
- /* == Option Page Generic Styles == */
180
-
181
- #toplevel_page_media-library .wp-menu-image {
182
- background-position: -119px -33px !important;
183
- }
184
-
185
- #wpuxss-eml-global-options-wrap .postbox {
186
- background-image:none !important;
187
- background-color:#f9f9f9 !important;
188
- position: relative;
189
- }
190
-
191
- #wpuxss-eml-global-options-wrap .postbox#wpuxss-credits {
192
- background-color: #fff !important;
193
- }
194
- #wpuxss-credits .author {
195
- font-style: italic;
196
- margin: 30px 0 0;
197
- padding: 10px 0 5px;
198
- border-top: 1px solid #e0e5e9;
199
- }
200
- #wpuxss-credits .logo-webbistro {
201
- font-style: italic;
202
- text-decoration: none;
203
- }
204
- #wpuxss-credits .icon-webbistro {
205
- font-family: 'webbistro';
206
- speak: none;
207
- font-style: normal;
208
- font-weight: normal;
209
- font-variant: normal;
210
- text-transform: none;
211
- line-height: 1;
212
- -webkit-font-smoothing: antialiased;
213
- }
214
- #wpuxss-credits h4 {
215
- margin: 20px 0 4px;
216
- }
217
- #wpuxss-credits p,
218
- #wpuxss-credits ul {
219
- margin-top: 0;
220
- }
221
- #wpuxss-credits li {
222
- list-style: disc;
223
- margin-left: 1.4em;
224
- }
225
-
226
- @font-face {
227
- font-family: 'webbistro';
228
- src:url('../fonts/webbistro.eot');
229
- src:url('../fonts/webbistro.eot?#iefix') format('embedded-opentype'),
230
- url('../fonts/webbistro.woff') format('woff'),
231
- url('../fonts/webbistro.ttf') format('truetype'),
232
- url('../fonts/webbistro.svg#webbistro') format('svg');
233
- font-weight: normal;
234
- font-style: normal;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  }
1
+
2
+ /* == Attachment Fields == */
3
+
4
+ .compat-item .field input[type="checkbox"] {
5
+ width: auto;
6
+ }
7
+
8
+ .term-list {
9
+ background-color: #fff;
10
+ border: 1px solid #dfdfdf;
11
+ border-radius: 3px;
12
+ padding: 10px 10px 5px;
13
+ margin: 0 0 10px;
14
+ }
15
+ .term-list li {
16
+ line-height: 22px;
17
+ }
18
+ .term-list li input[type="checkbox"] {
19
+ margin: -4px 4px 0 0 !important;
20
+ }
21
+ .term-list .children {
22
+ margin: 5px 0 0 20px;
23
+ }
24
+
25
+
26
+ /* == Taxonomy Filters == */
27
+
28
+ .media-frame select[class^="attachment"] {
29
+ margin-top: 11px !important;
30
+ margin-right: 10px !important;
31
+ max-width: 140px !important;
32
+ }
33
+
34
+ .media-frame .search {
35
+ line-height: 14px;
36
+ }
37
+
38
+
39
+ /* == Media Uploader Boxes' Positions == */
40
+
41
+
42
+ .attachments-browser .media-toolbar {
43
+ height: auto;
44
+ position: relative;
45
+ margin-right: 300px;
46
+ }
47
+ .attachments-browser .attachments {
48
+ position: relative;
49
+ margin-right: 300px;
50
+ top: 20px;
51
+ }
52
+ .attachments-browser .media-toolbar-primary,
53
+ .attachments-browser .media-toolbar-secondary {
54
+ float: none;
55
+ height: auto;
56
+ }
57
+ .attachments-browser .media-toolbar-secondary select,
58
+ .attachments-browser .media-toolbar-secondary ,instruction {
59
+ float: left;
60
+ }
61
+
62
+ @media only screen and (max-width: 640px), screen and (max-height: 400px)
63
+ {
64
+ .attachments-browser .media-toolbar {
65
+ margin-right: 180px;
66
+ height: auto;
67
+ }
68
+ .attachments-browser .attachments {
69
+ top: 20px;
70
+ }
71
+ .media-frame .search {
72
+ line-height: 20px;
73
+ }
74
+ .media-sidebar .attachment-details h3 {
75
+ margin-top: 24px;
76
+ }
77
+ }
78
+
79
+
80
+
81
+ /* == MIME types Option Page Styles == */
82
+
83
+ .wpuxss-eml-mime-type-list {
84
+ table-layout: fixed;
85
+ }
86
+ .wpuxss-eml-mime-type-list td {
87
+ padding: 8px 7px;
88
+ }
89
+ .wpuxss-eml-mime-type-list .checkbox_td {
90
+ text-align: center;
91
+ }
92
+ .wpuxss-eml-mime-type-list input[type="text"] {
93
+ width: 120px;
94
+ }
95
+ .wpuxss-eml-column-extension {
96
+ width: 130px;
97
+ }
98
+ .wpuxss-eml-column-singular,
99
+ .wpuxss-eml-column-plural {
100
+ width:120px;
101
+ }
102
+ .wpuxss-eml-column-filter {
103
+ width: 70px;
104
+ }
105
+ .wpuxss-eml-column-upload {
106
+ width: 90px;
107
+ }
108
+ .wpuxss-eml-column-delete {
109
+ width: 30px;
110
+ }
111
+
112
+
113
+ /* == Taxonomies Option Page Styles == */
114
+
115
+ .wpuxss-eml-settings-list {
116
+ border-top: 1px solid #dfdfdf;
117
+ }
118
+ .wpuxss-eml-settings-list > li {
119
+ border-bottom: 1px solid #dfdfdf;
120
+ padding: 8px 7px;
121
+ margin: 0;
122
+ position: relative;
123
+ overflow: hidden;
124
+ }
125
+ .wpuxss-eml-settings-list > li > label {
126
+ font-size: 14px;
127
+ display: inline-block;
128
+ margin-right: 100px;
129
+ }
130
+ .wpuxss-eml-settings-list input {
131
+ margin: 0;
132
+ }
133
+ .wpuxss-eml-settings-list > li .wpuxss-eml-button-edit {
134
+ position: absolute;
135
+ right: 40px;
136
+ top: 7px;
137
+ text-decoration: none;
138
+ height: 14px;
139
+ line-height: 14px;
140
+ border-radius: 10px;
141
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
142
+ padding: 3px 10px;
143
+ }
144
+ .wpuxss-eml-settings-list.wpuxss-eml-non-media-taxonomy-list > li .wpuxss-eml-button-edit {
145
+ right: 10px;
146
+ }
147
+ .wpuxss-eml-settings-list > li .wpuxss-eml-button-remove {
148
+ position: absolute;
149
+ right: 10px;
150
+ top: 7px;
151
+ }
152
+ .wpuxss-eml-settings-list .wpuxss-eml-assigned {
153
+ margin-right:10px;
154
+ }
155
+
156
+ .wpuxss-eml-taxonomy-edit label {
157
+ display: inline-block;
158
+ width: 160px;
159
+ }
160
+ .wpuxss-eml-taxonomy-edit .wpuxss-eml-labels-edit {
161
+ float: left;
162
+ width: 49%;
163
+ margin-right: 1%;
164
+ }
165
+ .wpuxss-eml-taxonomy-edit .wpuxss-eml-settings-edit {
166
+ float: left;
167
+ width: 49%;
168
+ margin-left: 1%;
169
+ }
170
+ .wpuxss-eml-taxonomy-edit .wpuxss-eml-settings-edit li {
171
+ padding: 3px 0;
172
+ }
173
+ .wpuxss-eml-taxonomy-edit .wpuxss-eml-labels-edit label {
174
+ display: inline-block;
175
+ width: 100px;
176
+ }
177
+ .wpuxss-eml-taxonomy-edit .wpuxss-eml-labels-edit input {
178
+ min-width: 150px;
179
+ }
180
+
181
+
182
+
183
+
184
+ /* == Buttons Styles == */
185
+
186
+ .wpuxss-eml-button-remove {
187
+ display: inline-block;
188
+ text-align: center;
189
+ text-decoration: none;
190
+ line-height: 1em;
191
+ font-size: 18px;
192
+ font-family: Arial, Helvetica, sans-serif;
193
+ height: 20px;
194
+ width: 20px;
195
+ border-radius: 10px;
196
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
197
+ }
198
+ .wpuxss-eml-button-remove:hover {
199
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
200
+ }
201
+ .wpuxss-eml-button-container-right {
202
+ text-align: right;
203
+ margin: 20px 0 0;
204
+ }
205
+
206
+
207
+ /* == Option Page Generic Styles == */
208
+
209
+ #toplevel_page_media-library .wp-menu-image {
210
+ background-position: -119px -33px !important;
211
+ }
212
+
213
+ #wpuxss-eml-global-options-wrap .postbox {
214
+ background-image:none !important;
215
+ background-color:#f9f9f9 !important;
216
+ position: relative;
217
+ }
218
+
219
+ #wpuxss-eml-global-options-wrap .postbox#wpuxss-credits {
220
+ background-color: #fff !important;
221
+ }
222
+ #wpuxss-credits .author {
223
+ font-style: italic;
224
+ margin: 30px 0 0;
225
+ padding: 10px 0 5px;
226
+ border-top: 1px solid #e0e5e9;
227
+ }
228
+ #wpuxss-credits .logo-webbistro {
229
+ font-style: italic;
230
+ text-decoration: none;
231
+ }
232
+ #wpuxss-credits .icon-webbistro {
233
+ font-family: 'webbistro';
234
+ speak: none;
235
+ font-style: normal;
236
+ font-weight: normal;
237
+ font-variant: normal;
238
+ text-transform: none;
239
+ line-height: 1;
240
+ -webkit-font-smoothing: antialiased;
241
+ }
242
+ #wpuxss-credits h4 {
243
+ margin: 20px 0 4px;
244
+ }
245
+ #wpuxss-credits p,
246
+ #wpuxss-credits ul {
247
+ margin-top: 0;
248
+ }
249
+ #wpuxss-credits li {
250
+ list-style: disc;
251
+ margin-left: 1.4em;
252
+ }
253
+
254
+ @font-face {
255
+ font-family: 'webbistro';
256
+ src:url('../fonts/webbistro.eot');
257
+ src:url('../fonts/webbistro.eot?#iefix') format('embedded-opentype'),
258
+ url('../fonts/webbistro.woff') format('woff'),
259
+ url('../fonts/webbistro.ttf') format('truetype'),
260
+ url('../fonts/webbistro.svg#webbistro') format('svg');
261
+ font-weight: normal;
262
+ font-style: normal;
263
  }
enhanced-media-library.php CHANGED
@@ -1,340 +1,377 @@
1
- <?php
2
- /*
3
- Plugin Name: Enhanced Media Library
4
- Plugin URI: http://wordpressuxsolutions.com
5
- Description: This plugin will be handy for those who need to manage a lot of media files.
6
- Version: 1.0.5
7
- Author: WordPress UX Solutions
8
- Author URI: http://wordpressuxsolutions.com
9
- License: GPLv2 or later
10
- Text Domain: eml
11
- Domain Path: /languages
12
-
13
-
14
- Copyright 2013 WordPress UX Solutions (email : WordPressUXSolutions@gmail.com)
15
-
16
- This program is free software; you can redistribute it and/or modify
17
- it under the terms of the GNU General Public License, version 2, as
18
- published by the Free Software Foundation.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
-
29
- */
30
-
31
-
32
-
33
-
34
- $wpuxss_eml_version = '1.0.5';
35
- $wpuxss_eml_old_version = get_option('wpuxss_eml_version', false);
36
- $wpuxss_eml_dir = plugin_dir_url( __FILE__ );
37
-
38
-
39
-
40
-
41
- include_once( 'core/mime-types.php' );
42
- include_once( 'core/taxonomies.php' );
43
-
44
- if( is_admin() )
45
- {
46
- include_once( 'core/options-pages.php' );
47
- }
48
-
49
-
50
-
51
-
52
- /**
53
- * Load plugin text domain
54
- *
55
- * @since 1.0
56
- * @created 03/08/13
57
- */
58
-
59
- load_plugin_textdomain('eml', false, basename( dirname( __FILE__ ) ) . '/languages' );
60
-
61
-
62
-
63
-
64
- /**
65
- * wpuxss_eml_on_init
66
- *
67
- * @since 1.0
68
- * @created 03/08/13
69
- */
70
-
71
- add_action('init', 'wpuxss_eml_on_init', 12);
72
-
73
- function wpuxss_eml_on_init()
74
- {
75
- // on activation
76
- wpuxss_eml_on_activation();
77
-
78
- $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
79
- if ( empty($wpuxss_eml_taxonomies) ) $wpuxss_eml_taxonomies = array();
80
-
81
- // register eml taxonomies
82
- foreach ( $wpuxss_eml_taxonomies as $taxonomy => $params )
83
- {
84
- if ( $params['eml_media'] && !empty($params['labels']['singular_name']) && !empty($params['labels']['name']) )
85
- {
86
- register_taxonomy(
87
- $taxonomy,
88
- 'attachment',
89
- array(
90
- 'labels' => $params['labels'],
91
- 'public' => true,
92
- 'show_admin_column' => $params['show_admin_column'],
93
- 'show_in_nav_menus' => $params['show_in_nav_menus'],
94
- 'hierarchical' => $params['hierarchical'],
95
- 'update_count_callback' => '_update_generic_term_count',
96
- 'sort' => $params['sort'],
97
- 'rewrite' => array( 'slug' => $params['rewrite']['slug'] )
98
- )
99
- );
100
- }
101
- }
102
- }
103
-
104
-
105
-
106
-
107
- /**
108
- * wpuxss_eml_on_wp_loaded
109
- *
110
- * @since 1.0
111
- * @created 03/11/13
112
- */
113
- add_action( 'wp_loaded', 'wpuxss_eml_on_wp_loaded' );
114
-
115
- function wpuxss_eml_on_wp_loaded()
116
- {
117
- $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
118
- if ( empty($wpuxss_eml_taxonomies) ) $wpuxss_eml_taxonomies = array();
119
- $taxonomies = get_taxonomies(array(),'object');
120
-
121
- // discover 'foreign' taxonomies
122
- foreach ( $taxonomies as $taxonomy => $params )
123
- {
124
- if ( !empty($params->object_type) && !array_key_exists($taxonomy,$wpuxss_eml_taxonomies) && !in_array('revision',$params->object_type) && !in_array('nav_menu_item',$params->object_type) && $taxonomy != 'post_format' )
125
- {
126
- $wpuxss_eml_taxonomies[$taxonomy] = array(
127
- 'eml_media' => 0,
128
- 'admin_filter' => 0,
129
- 'media_uploader_filter' => 0,
130
- 'show_admin_column' => isset($params->show_admin_column) ? $params->show_admin_column : 0,
131
- 'show_in_nav_menus' => isset($params->show_in_nav_menus) ? $params->show_in_nav_menus : 0,
132
- 'hierarchical' => $params->hierarchical ? 1 : 0,
133
- 'sort' => isset($params->sort) ? $params->sort : 0
134
- );
135
-
136
- if ( in_array('attachment',$params->object_type) )
137
- $wpuxss_eml_taxonomies[$taxonomy]['assigned'] = 1;
138
- else
139
- $wpuxss_eml_taxonomies[$taxonomy]['assigned'] = 0;
140
- }
141
- }
142
-
143
- // assign/unassign taxonomies to atachment
144
- foreach ( $wpuxss_eml_taxonomies as $taxonomy => $params )
145
- {
146
- if ( $params['assigned'] )
147
- register_taxonomy_for_object_type( $taxonomy, 'attachment' );
148
-
149
- if ( ! $params['assigned'] )
150
- wpuxss_eml_unregister_taxonomy_for_object_type( $taxonomy, 'attachment' );
151
- }
152
-
153
- // update_count_callback for attachment taxonomies if needed
154
- foreach ( $taxonomies as $taxonomy => $params )
155
- {
156
- if ( in_array('attachment',$params->object_type) )
157
- {
158
- global $wp_taxonomies;
159
-
160
- if ( !isset($wp_taxonomies[$taxonomy]->update_count_callback) || empty($wp_taxonomies[$taxonomy]->update_count_callback) )
161
- $wp_taxonomies[$taxonomy]->update_count_callback = '_update_generic_term_count';
162
- }
163
- }
164
-
165
- update_option( 'wpuxss_eml_taxonomies', $wpuxss_eml_taxonomies );
166
- }
167
-
168
-
169
-
170
-
171
- /**
172
- * wpuxss_eml_on_admin_init
173
- *
174
- * @since 1.0
175
- * @created 03/08/13
176
- */
177
-
178
- add_action( 'admin_init', 'wpuxss_eml_on_admin_init' );
179
-
180
- function wpuxss_eml_on_admin_init()
181
- {
182
- global $wpuxss_eml_version,
183
- $wpuxss_eml_dir;
184
-
185
- // plugin scripts
186
- wp_enqueue_script(
187
- 'wpuxss-eml-media-uploader-script',
188
- $wpuxss_eml_dir . 'js/eml-media-uploader.js',
189
- array('jquery','backbone','media-views'),
190
- $wpuxss_eml_version,
191
- true
192
- );
193
-
194
- // admin styles
195
- wp_enqueue_style(
196
- 'wpuxss-eml-admin-custom-style',
197
- $wpuxss_eml_dir . 'css/eml-admin.css',
198
- array(),
199
- $wpuxss_eml_version,
200
- 'all'
201
- );
202
-
203
-
204
- // pass taxonomies to media uploader's filter
205
- $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
206
- if ( empty($wpuxss_eml_taxonomies) ) $wpuxss_eml_taxonomies = array();
207
-
208
- $taxonomies_array = array();
209
- foreach ( get_object_taxonomies('attachment','object') as $taxonomy )
210
- {
211
- $terms_array = array();
212
- $terms = array();
213
-
214
- if ( $wpuxss_eml_taxonomies[$taxonomy->name]['media_uploader_filter'] )
215
- {
216
- ob_start();
217
-
218
- wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'checked_ontop' => false, 'walker' => new Walker_Media_Taxonomy_Uploader_Filter() ) );
219
-
220
- $html = '';
221
- if ( ob_get_contents() != false )
222
- $html = ob_get_contents();
223
-
224
- ob_end_clean();
225
-
226
- $terms = array_filter( explode('|', $html) );
227
-
228
- if ( !empty($terms) )
229
- {
230
- foreach ($terms as $term)
231
- {
232
- $term = explode('>', $term);
233
- array_push($terms_array, array('term_id' => $term[0], 'term_name' => $term[1]));
234
- }
235
- $taxonomies_array[$taxonomy->name] = array(
236
- 'list_title' => $taxonomy->labels->all_items,
237
- 'term_list' => $terms_array
238
- );
239
- }
240
- }
241
- }
242
-
243
- wp_localize_script(
244
- 'wpuxss-eml-media-uploader-script',
245
- 'wpuxss_eml_taxonomies',
246
- $taxonomies_array
247
- );
248
-
249
-
250
- // plugin settings: taxonomies
251
- register_setting(
252
- 'wpuxss_eml_taxonomies', //option_group
253
- 'wpuxss_eml_taxonomies', //option_name
254
- 'wpuxss_eml_taxonomies_validate' //sanitize_callback
255
- );
256
-
257
- // plugin settings: mime types
258
- register_setting(
259
- 'wpuxss_eml_mimes', //option_group
260
- 'wpuxss_eml_mimes', //option_name
261
- 'wpuxss_eml_mimes_validate' //sanitize_callback
262
- );
263
-
264
- // plugin settings: mime types backup
265
- register_setting(
266
- 'wpuxss_eml_mimes_backup', //option_group
267
- 'wpuxss_eml_mimes_backup' //option_name
268
- );
269
- }
270
-
271
-
272
-
273
-
274
- /**
275
- * wpuxss_eml_on_activation
276
- *
277
- * @since 1.0
278
- * @created 28/09/13
279
- */
280
-
281
- function wpuxss_eml_on_activation()
282
- {
283
- global $wpuxss_eml_version, $wpuxss_eml_old_version;
284
-
285
- if( $wpuxss_eml_version != $wpuxss_eml_old_version )
286
- update_option('wpuxss_eml_version', $wpuxss_eml_version );
287
-
288
- if( empty($wpuxss_eml_old_version) || $wpuxss_eml_old_version == '0.0.3' )
289
- {
290
- $wpuxss_eml_taxonomies['media_category'] = array(
291
- 'assigned' => 1,
292
- 'eml_media' => 1,
293
- 'admin_filter' => 1,
294
- 'media_uploader_filter' => 1,
295
- 'labels' => array(
296
- 'name' => 'Media Categories',
297
- 'singular_name' => 'Media Category',
298
- 'menu_name' => 'Media Categories',
299
- 'all_items' => 'All Media Categories',
300
- 'edit_item' => 'Edit Media Category',
301
- 'view_item' => 'View Media Category',
302
- 'update_item' => 'Update Media Category',
303
- 'add_new_item' => 'Add New Media Category',
304
- 'new_item_name' => 'New Media Category Name',
305
- 'parent_item' => 'Parent Media Category',
306
- 'parent_item_colon' => 'Parent Media Category:',
307
- 'search_items' => 'Search Media Categories'
308
- ),
309
- 'public' => true,
310
- 'show_admin_column' => true,
311
- 'show_in_nav_menus' => true,
312
- 'hierarchical' => true,
313
- 'rewrite' => array( 'slug' => 'media_category' ),
314
- 'sort' => 0
315
- );
316
-
317
- $allowed_mimes = get_allowed_mime_types();
318
-
319
- foreach ( wp_get_mime_types() as $type => $mime )
320
- {
321
- $wpuxss_eml_mimes[$type] = array(
322
- 'mime' => $mime,
323
- 'singular' => $mime,
324
- 'plural' => $mime,
325
- 'filter' => 0,
326
- 'upload' => isset($allowed_mimes[$type]) ? 1 : 0
327
- );
328
- }
329
-
330
- $wpuxss_eml_mimes['pdf']['singular'] = 'PDF';
331
- $wpuxss_eml_mimes['pdf']['plural'] = 'PDFs';
332
- $wpuxss_eml_mimes['pdf']['filter'] = 1;
333
-
334
- update_option( 'wpuxss_eml_taxonomies', $wpuxss_eml_taxonomies );
335
- update_option( 'wpuxss_eml_mimes', $wpuxss_eml_mimes );
336
- update_option( 'wpuxss_eml_mimes_backup', $wpuxss_eml_mimes );
337
- }
338
- }
339
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  ?>
1
+ <?php
2
+ /*
3
+ Plugin Name: Enhanced Media Library
4
+ Plugin URI: http://wordpressuxsolutions.com
5
+ Description: This plugin will be handy for those who need to manage a lot of media files.
6
+ Version: 1.1
7
+ Author: WordPress UX Solutions
8
+ Author URI: http://wordpressuxsolutions.com
9
+ License: GPLv2 or later
10
+ Text Domain: eml
11
+ Domain Path: /languages
12
+
13
+
14
+ Copyright 2013 WordPress UX Solutions (email : WordPressUXSolutions@gmail.com)
15
+
16
+ This program is free software; you can redistribute it and/or modify
17
+ it under the terms of the GNU General Public License, version 2, as
18
+ published by the Free Software Foundation.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
+
29
+ */
30
+
31
+
32
+
33
+
34
+ $wpuxss_eml_version = '1.1';
35
+ $wpuxss_eml_old_version = get_option('wpuxss_eml_version', false);
36
+ $wpuxss_eml_dir = plugin_dir_url( __FILE__ );
37
+
38
+
39
+
40
+
41
+ include_once( 'core/mime-types.php' );
42
+ include_once( 'core/taxonomies.php' );
43
+
44
+ if( is_admin() )
45
+ {
46
+ include_once( 'core/options-pages.php' );
47
+ }
48
+
49
+
50
+
51
+
52
+ /**
53
+ * Load plugin text domain
54
+ *
55
+ * @since 1.0
56
+ * @created 03/08/13
57
+ */
58
+
59
+ load_plugin_textdomain('eml', false, basename( dirname( __FILE__ ) ) . '/languages' );
60
+
61
+
62
+
63
+
64
+ /**
65
+ * wpuxss_eml_on_init
66
+ *
67
+ * @since 1.0
68
+ * @created 03/08/13
69
+ */
70
+
71
+ add_action('init', 'wpuxss_eml_on_init', 12);
72
+
73
+ function wpuxss_eml_on_init()
74
+ {
75
+ // on activation
76
+ wpuxss_eml_on_activation();
77
+
78
+ $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
79
+ if ( empty($wpuxss_eml_taxonomies) ) $wpuxss_eml_taxonomies = array();
80
+
81
+ // register eml taxonomies
82
+ foreach ( $wpuxss_eml_taxonomies as $taxonomy => $params )
83
+ {
84
+ if ( $params['eml_media'] && !empty($params['labels']['singular_name']) && !empty($params['labels']['name']) )
85
+ {
86
+ register_taxonomy(
87
+ $taxonomy,
88
+ 'attachment',
89
+ array(
90
+ 'labels' => $params['labels'],
91
+ 'public' => true,
92
+ 'show_admin_column' => $params['show_admin_column'],
93
+ 'show_in_nav_menus' => $params['show_in_nav_menus'],
94
+ 'hierarchical' => $params['hierarchical'],
95
+ 'update_count_callback' => '_update_generic_term_count',
96
+ 'sort' => $params['sort'],
97
+ 'rewrite' => array( 'slug' => $params['rewrite']['slug'] )
98
+ )
99
+ );
100
+ }
101
+ }
102
+ }
103
+
104
+
105
+
106
+
107
+ /**
108
+ * wpuxss_eml_on_wp_loaded
109
+ *
110
+ * @since 1.0
111
+ * @created 03/11/13
112
+ */
113
+ add_action( 'wp_loaded', 'wpuxss_eml_on_wp_loaded' );
114
+
115
+ function wpuxss_eml_on_wp_loaded()
116
+ {
117
+ $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
118
+ if ( empty($wpuxss_eml_taxonomies) ) $wpuxss_eml_taxonomies = array();
119
+ $taxonomies = get_taxonomies(array(),'object');
120
+
121
+ // discover 'foreign' taxonomies
122
+ foreach ( $taxonomies as $taxonomy => $params )
123
+ {
124
+ if ( !empty($params->object_type) && !array_key_exists($taxonomy,$wpuxss_eml_taxonomies) && !in_array('revision',$params->object_type) && !in_array('nav_menu_item',$params->object_type) && $taxonomy != 'post_format' )
125
+ {
126
+ $wpuxss_eml_taxonomies[$taxonomy] = array(
127
+ 'eml_media' => 0,
128
+ 'admin_filter' => 0,
129
+ 'media_uploader_filter' => 0,
130
+ 'show_admin_column' => isset($params->show_admin_column) ? $params->show_admin_column : 0,
131
+ 'show_in_nav_menus' => isset($params->show_in_nav_menus) ? $params->show_in_nav_menus : 0,
132
+ 'hierarchical' => $params->hierarchical ? 1 : 0,
133
+ 'sort' => isset($params->sort) ? $params->sort : 0
134
+ );
135
+
136
+ if ( in_array('attachment',$params->object_type) )
137
+ $wpuxss_eml_taxonomies[$taxonomy]['assigned'] = 1;
138
+ else
139
+ $wpuxss_eml_taxonomies[$taxonomy]['assigned'] = 0;
140
+ }
141
+ }
142
+
143
+ // assign/unassign taxonomies to atachment
144
+ foreach ( $wpuxss_eml_taxonomies as $taxonomy => $params )
145
+ {
146
+ if ( $params['assigned'] )
147
+ register_taxonomy_for_object_type( $taxonomy, 'attachment' );
148
+
149
+ if ( ! $params['assigned'] )
150
+ wpuxss_eml_unregister_taxonomy_for_object_type( $taxonomy, 'attachment' );
151
+ }
152
+
153
+ // update_count_callback for attachment taxonomies if needed
154
+ foreach ( $taxonomies as $taxonomy => $params )
155
+ {
156
+ if ( in_array('attachment',$params->object_type) )
157
+ {
158
+ global $wp_taxonomies;
159
+
160
+ if ( !isset($wp_taxonomies[$taxonomy]->update_count_callback) || empty($wp_taxonomies[$taxonomy]->update_count_callback) )
161
+ $wp_taxonomies[$taxonomy]->update_count_callback = '_update_generic_term_count';
162
+ }
163
+ }
164
+
165
+ update_option( 'wpuxss_eml_taxonomies', $wpuxss_eml_taxonomies );
166
+ }
167
+
168
+
169
+
170
+
171
+ /**
172
+ * wpuxss_eml_on_admin_init
173
+ *
174
+ * @since 1.0
175
+ * @created 03/08/13
176
+ */
177
+
178
+ add_action( 'admin_init', 'wpuxss_eml_on_admin_init' );
179
+ add_action( 'customize_controls_enqueue_scripts', 'wpuxss_eml_on_admin_init' );
180
+
181
+ function wpuxss_eml_on_admin_init()
182
+ {
183
+ global $wpuxss_eml_version,
184
+ $wpuxss_eml_dir;
185
+
186
+ // plugin scripts
187
+ wp_enqueue_script(
188
+ 'wpuxss-eml-media-models-script',
189
+ $wpuxss_eml_dir . 'js/eml-media-models.js',
190
+ array('jquery','backbone','media-models'),
191
+ $wpuxss_eml_version,
192
+ true
193
+ );
194
+
195
+ wp_enqueue_script(
196
+ 'wpuxss-eml-media-views-script',
197
+ $wpuxss_eml_dir . 'js/eml-media-views.js',
198
+ array('jquery','backbone','media-views'),
199
+ $wpuxss_eml_version,
200
+ true
201
+ );
202
+
203
+ // admin styles
204
+ wp_enqueue_style(
205
+ 'wpuxss-eml-admin-custom-style',
206
+ $wpuxss_eml_dir . 'css/eml-admin.css',
207
+ array('media-views'),
208
+ $wpuxss_eml_version,
209
+ 'all'
210
+ );
211
+
212
+
213
+
214
+ // pass taxonomies to media uploader's filter
215
+ $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
216
+ if ( empty($wpuxss_eml_taxonomies) ) $wpuxss_eml_taxonomies = array();
217
+
218
+ $taxonomies_array = array();
219
+ foreach ( get_object_taxonomies('attachment','object') as $taxonomy )
220
+ {
221
+ $terms_array = array();
222
+ $terms = array();
223
+
224
+ if ( $wpuxss_eml_taxonomies[$taxonomy->name]['media_uploader_filter'] )
225
+ {
226
+
227
+ ob_start();
228
+
229
+ wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'checked_ontop' => false, 'walker' => new Walker_Media_Taxonomy_Uploader_Filter() ) );
230
+
231
+ $html = '';
232
+ if ( ob_get_contents() != false )
233
+ $html = ob_get_contents();
234
+
235
+ ob_end_clean();
236
+
237
+ $terms = array_filter( explode('|', $html) );
238
+
239
+ if ( !empty($terms) )
240
+ {
241
+ foreach ($terms as $term)
242
+ {
243
+ $term = explode('>', $term);
244
+ array_push($terms_array, array('term_id' => $term[0], 'term_name' => $term[1]));
245
+ }
246
+ $taxonomies_array[$taxonomy->name] = array(
247
+ 'list_title' => $taxonomy->labels->all_items,
248
+ 'term_list' => $terms_array
249
+ );
250
+ }
251
+ }
252
+ }
253
+
254
+ wp_localize_script(
255
+ 'wpuxss-eml-media-views-script',
256
+ 'wpuxss_eml_taxonomies',
257
+ $taxonomies_array
258
+ );
259
+
260
+
261
+ // plugin settings: taxonomies
262
+ register_setting(
263
+ 'wpuxss_eml_taxonomies', //option_group
264
+ 'wpuxss_eml_taxonomies', //option_name
265
+ 'wpuxss_eml_taxonomies_validate' //sanitize_callback
266
+ );
267
+
268
+ // plugin settings: mime types
269
+ register_setting(
270
+ 'wpuxss_eml_mimes', //option_group
271
+ 'wpuxss_eml_mimes', //option_name
272
+ 'wpuxss_eml_mimes_validate' //sanitize_callback
273
+ );
274
+
275
+ // plugin settings: mime types backup
276
+ register_setting(
277
+ 'wpuxss_eml_mimes_backup', //option_group
278
+ 'wpuxss_eml_mimes_backup' //option_name
279
+ );
280
+ }
281
+
282
+
283
+ /**
284
+ * wpuxss_eml_customize_controls_scripts
285
+ *
286
+ * Modification of WP customize-controls.js script in order to turn on Media Uploader filters for customize.php
287
+ *
288
+ * @since 1.1.0
289
+ * @created 07/02/14
290
+ */
291
+
292
+ add_action( 'customize_controls_enqueue_scripts', 'wpuxss_eml_customize_controls_scripts' );
293
+
294
+ function wpuxss_eml_customize_controls_scripts()
295
+ {
296
+ global $wpuxss_eml_version,
297
+ $wpuxss_eml_dir;
298
+
299
+ wp_enqueue_script(
300
+ 'wpuxss-eml-customize-controls-script',
301
+ $wpuxss_eml_dir . 'js/eml-customize-controls.js',
302
+ array('jquery','backbone','customize-controls'),
303
+ $wpuxss_eml_version,
304
+ true
305
+ );
306
+ }
307
+
308
+
309
+
310
+
311
+ /**
312
+ * wpuxss_eml_on_activation
313
+ *
314
+ * @since 1.0
315
+ * @created 28/09/13
316
+ */
317
+
318
+ function wpuxss_eml_on_activation()
319
+ {
320
+ global $wpuxss_eml_version, $wpuxss_eml_old_version;
321
+
322
+ if( $wpuxss_eml_version != $wpuxss_eml_old_version )
323
+ update_option('wpuxss_eml_version', $wpuxss_eml_version );
324
+
325
+ if( empty($wpuxss_eml_old_version) || $wpuxss_eml_old_version == '0.0.3' )
326
+ {
327
+ $wpuxss_eml_taxonomies['media_category'] = array(
328
+ 'assigned' => 1,
329
+ 'eml_media' => 1,
330
+ 'admin_filter' => 1,
331
+ 'media_uploader_filter' => 1,
332
+ 'labels' => array(
333
+ 'name' => 'Media Categories',
334
+ 'singular_name' => 'Media Category',
335
+ 'menu_name' => 'Media Categories',
336
+ 'all_items' => 'All Media Categories',
337
+ 'edit_item' => 'Edit Media Category',
338
+ 'view_item' => 'View Media Category',
339
+ 'update_item' => 'Update Media Category',
340
+ 'add_new_item' => 'Add New Media Category',
341
+ 'new_item_name' => 'New Media Category Name',
342
+ 'parent_item' => 'Parent Media Category',
343
+ 'parent_item_colon' => 'Parent Media Category:',
344
+ 'search_items' => 'Search Media Categories'
345
+ ),
346
+ 'public' => true,
347
+ 'show_admin_column' => true,
348
+ 'show_in_nav_menus' => true,
349
+ 'hierarchical' => true,
350
+ 'rewrite' => array( 'slug' => 'media_category' ),
351
+ 'sort' => 0
352
+ );
353
+
354
+ $allowed_mimes = get_allowed_mime_types();
355
+
356
+ foreach ( wp_get_mime_types() as $type => $mime )
357
+ {
358
+ $wpuxss_eml_mimes[$type] = array(
359
+ 'mime' => $mime,
360
+ 'singular' => $mime,
361
+ 'plural' => $mime,
362
+ 'filter' => 0,
363
+ 'upload' => isset($allowed_mimes[$type]) ? 1 : 0
364
+ );
365
+ }
366
+
367
+ $wpuxss_eml_mimes['pdf']['singular'] = 'PDF';
368
+ $wpuxss_eml_mimes['pdf']['plural'] = 'PDFs';
369
+ $wpuxss_eml_mimes['pdf']['filter'] = 1;
370
+
371
+ update_option( 'wpuxss_eml_taxonomies', $wpuxss_eml_taxonomies );
372
+ update_option( 'wpuxss_eml_mimes', $wpuxss_eml_mimes );
373
+ update_option( 'wpuxss_eml_mimes_backup', $wpuxss_eml_mimes );
374
+ }
375
+ }
376
+
377
  ?>
js/eml-customize-controls.js ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ window.wp = window.wp || {};
2
+
3
+ (function($) {
4
+
5
+ wp.customize.HeaderControl = wp.customize.HeaderControl.extend({
6
+
7
+ openMedia: function(event) {
8
+ var l10n = _wpMediaViewsL10n;
9
+
10
+ event.preventDefault();
11
+
12
+ this.frame = wp.media({
13
+ button: {
14
+ text: l10n.selectAndCrop,
15
+ close: false
16
+ },
17
+ states: [
18
+ new wp.media.controller.Library({
19
+ title: l10n.chooseImage,
20
+ library: wp.media.query({ type: 'image' }),
21
+ multiple: false,
22
+ priority: 20,
23
+ suggestedWidth: _wpCustomizeHeader.data.width,
24
+ suggestedHeight: _wpCustomizeHeader.data.height,
25
+ filterable: 'all' // turn on filters
26
+ }),
27
+ new wp.media.controller.Cropper({
28
+ imgSelectOptions: this.calculateImageSelectOptions
29
+ })
30
+ ]
31
+ });
32
+
33
+ this.frame.on('select', this.onSelect, this);
34
+ this.frame.on('cropped', this.onCropped, this);
35
+ this.frame.on('skippedcrop', this.onSkippedCrop, this);
36
+
37
+ this.frame.open();
38
+ }
39
+ });
40
+
41
+ wp.customize.controlConstructor = {
42
+ color: wp.customize.ColorControl,
43
+ upload: wp.customize.UploadControl,
44
+ image: wp.customize.ImageControl,
45
+ header: wp.customize.HeaderControl
46
+ };
47
+
48
+ }(jQuery));
js/eml-media-models.js ADDED
@@ -0,0 +1,343 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ window.wp = window.wp || {};
2
+
3
+ (function($){
4
+
5
+ var media = wp.media;
6
+
7
+
8
+
9
+ media.model.Attachment = media.model.Attachment.extend({
10
+
11
+ saveCompat: function( data, options ) {
12
+ var model = this;
13
+
14
+ // If we do not have the necessary nonce, fail immeditately.
15
+ if ( ! this.get('nonces') || ! this.get('nonces').update ) {
16
+ return $.Deferred().rejectWith( this ).promise();
17
+ }
18
+
19
+ // Clean queries' cache
20
+ media.model.Query.cleanQueries();
21
+
22
+ return media.post( 'save-attachment-compat', _.defaults({
23
+ id: this.id,
24
+ nonce: this.get('nonces').update,
25
+ post_id: media.model.settings.post.id
26
+ }, data ) ).done( function( resp, status, xhr ) {
27
+ model.set( model.parse( resp, xhr ), options );
28
+ });
29
+ }
30
+ }, {
31
+
32
+ create: function( attrs ) {
33
+ return media.model.Attachments.all.push( attrs );
34
+ },
35
+
36
+ get: _.memoize( function( id, attachment ) {
37
+ return media.model.Attachments.all.push( attachment || { id: id } );
38
+ })
39
+ });
40
+
41
+
42
+
43
+ media.model.Attachments = media.model.Attachments.extend({
44
+
45
+ model: media.model.Attachment,
46
+
47
+ parse: function( resp, xhr ) {
48
+
49
+ if ( ! _.isArray( resp ) ) {
50
+ resp = [resp];
51
+ }
52
+
53
+ return _.map( resp, function( attrs ) {
54
+ var id, attachment, newAttributes;
55
+
56
+ if ( attrs instanceof Backbone.Model ) {
57
+ id = attrs.get( 'id' );
58
+ attrs = attrs.attributes;
59
+ } else {
60
+ id = attrs.id;
61
+ }
62
+
63
+ attachment = media.model.Attachment.get( id );
64
+ newAttributes = attachment.parse( attrs, xhr );
65
+
66
+ if ( ! _.isEqual( attachment.attributes, newAttributes ) ) {
67
+ attachment.set( newAttributes );
68
+ }
69
+
70
+ return attachment;
71
+ });
72
+ },
73
+
74
+ _requery: function() {
75
+ if ( this.props.get('query') ) {
76
+ this.mirror( media.model.Query.get( this.props.toJSON() ) );
77
+ }
78
+ }
79
+ });
80
+
81
+
82
+
83
+ delete media.model.Attachments.all;
84
+ media.model.Attachments.all = new media.model.Attachments();
85
+
86
+
87
+
88
+ media.query = function( props ) {
89
+ return new media.model.Attachments( null, {
90
+ props: _.extend( _.defaults( props || {}, { orderby: 'date' } ), { query: true } )
91
+ });
92
+ };
93
+
94
+
95
+
96
+ media.model.Query = media.model.Attachments.extend({
97
+ /**
98
+ * @global wp.Uploader
99
+ *
100
+ * @param {Array} [models=[]] Array of models used to populate the collection.
101
+ * @param {Object} [options={}]
102
+ */
103
+ initialize: function( models, options ) {
104
+ var allowed;
105
+
106
+ options = options || {};
107
+ media.model.Attachments.prototype.initialize.apply( this, arguments );
108
+
109
+ this.args = options.args;
110
+ this._hasMore = true;
111
+ this.created = new Date();
112
+
113
+ this.filters.order = function( attachment ) {
114
+ var orderby = this.props.get('orderby'),
115
+ order = this.props.get('order');
116
+
117
+ if ( ! this.comparator ) {
118
+ return true;
119
+ }
120
+
121
+ // We want any items that can be placed before the last
122
+ // item in the set. If we add any items after the last
123
+ // item, then we can't guarantee the set is complete.
124
+ if ( this.length ) {
125
+ return 1 !== this.comparator( attachment, this.last(), { ties: true });
126
+
127
+ // Handle the case where there are no items yet and
128
+ // we're sorting for recent items. In that case, we want
129
+ // changes that occurred after we created the query.
130
+ } else if ( 'DESC' === order && ( 'date' === orderby || 'modified' === orderby ) ) {
131
+ return attachment.get( orderby ) >= this.created;
132
+
133
+ // If we're sorting by menu order and we have no items,
134
+ // accept any items that have the default menu order (0).
135
+ } else if ( 'ASC' === order && 'menuOrder' === orderby ) {
136
+ return attachment.get( orderby ) === 0;
137
+ }
138
+
139
+ // Otherwise, we don't want any items yet.
140
+ return false;
141
+ };
142
+
143
+ // Observe the central `wp.Uploader.queue` collection to watch for
144
+ // new matches for the query.
145
+ //
146
+ // Only observe when a limited number of query args are set. There
147
+ // are no filters for other properties, so observing will result in
148
+ // false positives in those queries.
149
+ allowed = [ 's', 'order', 'orderby', 'posts_per_page', 'post_mime_type', 'post_parent' ];
150
+ if ( wp.Uploader && _( this.args ).chain().keys().difference( allowed ).isEmpty().value() ) {
151
+ this.observe( wp.Uploader.queue );
152
+ }
153
+ },
154
+ /**
155
+ * @returns {Boolean}
156
+ */
157
+ hasMore: function() {
158
+ return this._hasMore;
159
+ },
160
+ /**
161
+ * @param {Object} [options={}]
162
+ * @returns {Promise}
163
+ */
164
+ more: function( options ) {
165
+ var query = this;
166
+
167
+ if ( this._more && 'pending' === this._more.state() ) {
168
+ return this._more;
169
+ }
170
+
171
+ if ( ! this.hasMore() ) {
172
+ return $.Deferred().resolveWith( this ).promise();
173
+ }
174
+
175
+ options = options || {};
176
+ options.remove = false;
177
+
178
+ return this._more = this.fetch( options ).done( function( resp ) {
179
+ if ( _.isEmpty( resp ) || -1 === this.args.posts_per_page || resp.length < this.args.posts_per_page ) {
180
+ query._hasMore = false;
181
+ }
182
+ });
183
+ },
184
+ /**
185
+ * Overrides Backbone.Collection.sync
186
+ * Overrides wp.media.model.Attachments.sync
187
+ *
188
+ * @param {String} method
189
+ * @param {Backbone.Model} model
190
+ * @param {Object} [options={}]
191
+ * @returns {Promise}
192
+ */
193
+ sync: function( method, model, options ) {
194
+ var args, fallback;
195
+
196
+ // Overload the read method so Attachment.fetch() functions correctly.
197
+ if ( 'read' === method ) {
198
+ options = options || {};
199
+ options.context = this;
200
+ options.data = _.extend( options.data || {}, {
201
+ action: 'query-attachments',
202
+ post_id: media.model.settings.post.id
203
+ });
204
+
205
+ // Clone the args so manipulation is non-destructive.
206
+ args = _.clone( this.args );
207
+
208
+ // Determine which page to query.
209
+ if ( -1 !== args.posts_per_page ) {
210
+ args.paged = Math.floor( this.length / args.posts_per_page ) + 1;
211
+ }
212
+
213
+ options.data.query = args;
214
+ return media.ajax( options );
215
+
216
+ // Otherwise, fall back to Backbone.sync()
217
+ } else {
218
+ /**
219
+ * Call wp.media.model.Attachments.sync or Backbone.sync
220
+ */
221
+ fallback = media.model.Attachments.prototype.sync ? media.model.Attachments.prototype : Backbone;
222
+ return fallback.sync.apply( this, arguments );
223
+ }
224
+ }
225
+ }, {
226
+ /**
227
+ * @readonly
228
+ */
229
+ defaultProps: {
230
+ orderby: 'date',
231
+ order: 'DESC'
232
+ },
233
+ /**
234
+ * @readonly
235
+ */
236
+ defaultArgs: {
237
+ posts_per_page: 40
238
+ },
239
+ /**
240
+ * @readonly
241
+ */
242
+ orderby: {
243
+ allowed: [ 'name', 'author', 'date', 'title', 'modified', 'uploadedTo', 'id', 'post__in', 'menuOrder' ],
244
+ valuemap: {
245
+ 'id': 'ID',
246
+ 'uploadedTo': 'parent',
247
+ 'menuOrder': 'menu_order ID'
248
+ }
249
+ },
250
+ /**
251
+ * @readonly
252
+ */
253
+ propmap: {
254
+ 'search': 's',
255
+ 'type': 'post_mime_type',
256
+ 'perPage': 'posts_per_page',
257
+ 'menuOrder': 'menu_order',
258
+ 'uploadedTo': 'post_parent'
259
+ },
260
+
261
+ queries: [],
262
+
263
+ cleanQueries: function(){
264
+
265
+ this.queries = [];
266
+ },
267
+
268
+ /**
269
+ * @static
270
+ * @method
271
+ *
272
+ * @returns {wp.media.model.Query} A new query.
273
+ */
274
+ // Caches query objects so queries can be easily reused.
275
+ get: (function(){
276
+
277
+ /**
278
+ * @param {Object} props
279
+ * @param {Object} options
280
+ * @returns {Query}
281
+ */
282
+ return function( props, options ) {
283
+ var args = {},
284
+ orderby = media.model.Query.orderby,
285
+ defaults = media.model.Query.defaultProps,
286
+ query,
287
+ queries = this.queries;;
288
+
289
+ // Remove the `query` property. This isn't linked to a query,
290
+ // this *is* the query.
291
+ delete props.query;
292
+
293
+ // Fill default args.
294
+ _.defaults( props, defaults );
295
+
296
+ // Normalize the order.
297
+ props.order = props.order.toUpperCase();
298
+ if ( 'DESC' !== props.order && 'ASC' !== props.order ) {
299
+ props.order = defaults.order.toUpperCase();
300
+ }
301
+
302
+ // Ensure we have a valid orderby value.
303
+ if ( ! _.contains( orderby.allowed, props.orderby ) ) {
304
+ props.orderby = defaults.orderby;
305
+ }
306
+
307
+ // Generate the query `args` object.
308
+ // Correct any differing property names.
309
+ _.each( props, function( value, prop ) {
310
+ if ( _.isNull( value ) ) {
311
+ return;
312
+ }
313
+
314
+ args[ media.model.Query.propmap[ prop ] || prop ] = value;
315
+ });
316
+
317
+ // Fill any other default query args.
318
+ _.defaults( args, media.model.Query.defaultArgs );
319
+
320
+ // `props.orderby` does not always map directly to `args.orderby`.
321
+ // Substitute exceptions specified in orderby.keymap.
322
+ args.orderby = orderby.valuemap[ props.orderby ] || props.orderby;
323
+
324
+ // Search the query cache for matches.
325
+ query = _.find( queries, function( query ) {
326
+ return _.isEqual( query.args, args );
327
+ });
328
+
329
+ // Otherwise, create a new query and add it to the cache.
330
+ if ( ! query ) {
331
+ query = new media.model.Query( [], _.extend( options || {}, {
332
+ props: props,
333
+ args: args
334
+ } ) );
335
+ queries.push( query );
336
+ }
337
+
338
+ return query;
339
+ };
340
+ }())
341
+ });
342
+
343
+ }(jQuery));
js/eml-media-uploader.js DELETED
@@ -1,89 +0,0 @@
1
- (function($){
2
-
3
- if ( typeof wp.media !== 'undefined' )
4
- {
5
- var media = wp.media,
6
- l10n = media.view.l10n;
7
-
8
- // Taxonomy AttachmentFilters
9
- media.view.AttachmentFilters.Taxonomy = media.view.AttachmentFilters.extend({
10
- tagName: 'select',
11
-
12
- createFilters: function() {
13
- var filters = {};
14
- var that = this;
15
-
16
- _.each( that.options.termList || {}, function( term, key ) {
17
- var term_id = term['term_id'];
18
- var term_name = $("<div/>").html(term['term_name']).text();
19
- filters[ term_id ] = {
20
- text: term_name,
21
- priority: key+2
22
- };
23
- filters[term_id]['props'] = {};
24
- filters[term_id]['props'][that.options.taxonomy] = term_id;
25
- });
26
-
27
- filters.all = {
28
- text: that.options.termListTitle,
29
- priority: 1
30
- };
31
- filters['all']['props'] = {};
32
- filters['all']['props'][that.options.taxonomy] = 0;
33
-
34
- this.filters = filters;
35
- }
36
- });
37
-
38
-
39
- // Enhanced AttachmentBrowser
40
-
41
- var curAttachmentsBrowser = media.view.AttachmentsBrowser;
42
-
43
- media.view.AttachmentsBrowser = media.view.AttachmentsBrowser.extend({
44
- createToolbar: function() {
45
-
46
- curAttachmentsBrowser.prototype.createToolbar.apply(this,arguments);
47
-
48
- var that = this,
49
- filters = this.options.filters;
50
- i = 1;
51
- $.each(wpuxss_eml_taxonomies, function(taxonomy, values)
52
- {
53
- if ( filters && values.term_list )
54
- {
55
- that.toolbar.set( taxonomy+'-filters', new media.view.AttachmentFilters.Taxonomy({
56
- controller: that.controller,
57
- model: that.collection.props,
58
- priority: -80 + 10*i++,
59
- taxonomy: taxonomy,
60
- termList: values.term_list,
61
- termListTitle: values.list_title,
62
- className: 'attachment-'+taxonomy+'-filters'
63
- }).render() );
64
-
65
-
66
- }
67
- });
68
- }
69
- });
70
-
71
- }
72
-
73
-
74
- $(document).on('change', 'input[name^="tax_input"]', function()
75
- {
76
- var tax_list = [];
77
- var parent = $(this).closest('.term-list');
78
-
79
- parent.find('input[name^="tax_input"]:checked').each(function(i)
80
- {
81
- tax_list[i] = $(this).val();
82
- });
83
-
84
- var tax_string = tax_list.join(', ');
85
-
86
- parent.next('input[name^="attachments"]').val(tax_string).change();
87
- });
88
-
89
- })( jQuery );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/eml-media-views.js ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ window.wp = window.wp || {};
2
+
3
+ (function($){
4
+
5
+ var media = wp.media;
6
+
7
+
8
+
9
+ media.view.AttachmentFilters.Taxonomy = media.view.AttachmentFilters.extend({
10
+
11
+ tagName: 'select',
12
+
13
+ createFilters: function() {
14
+ var filters = {};
15
+ var that = this;
16
+
17
+ _.each( that.options.termList || {}, function( term, key ) {
18
+ var term_id = term['term_id'];
19
+ var term_name = $("<div/>").html(term['term_name']).text();
20
+ filters[ term_id ] = {
21
+ text: term_name,
22
+ priority: key+2
23
+ };
24
+ filters[term_id]['props'] = {};
25
+ filters[term_id]['props'][that.options.taxonomy] = term_id;
26
+ });
27
+
28
+ filters.all = {
29
+ text: that.options.termListTitle,
30
+ priority: 1
31
+ };
32
+ filters['all']['props'] = {};
33
+ filters['all']['props'][that.options.taxonomy] = null;
34
+
35
+ this.filters = filters;
36
+ }
37
+ });
38
+
39
+
40
+
41
+ var curAttachmentsBrowser = media.view.AttachmentsBrowser;
42
+
43
+ media.view.AttachmentsBrowser = media.view.AttachmentsBrowser.extend({
44
+
45
+ createToolbar: function() {
46
+
47
+ var filters = this.options.filters;
48
+
49
+ curAttachmentsBrowser.prototype.createToolbar.apply(this,arguments);
50
+
51
+ var that = this,
52
+ i = 1;
53
+
54
+ $.each(wpuxss_eml_taxonomies, function(taxonomy, values)
55
+ {
56
+ if ( values.term_list && filters )
57
+ {
58
+ that.toolbar.set( taxonomy+'-filter', new media.view.AttachmentFilters.Taxonomy({
59
+ controller: that.controller,
60
+ model: that.collection.props,
61
+ priority: -80 + 10*i++,
62
+ taxonomy: taxonomy,
63
+ termList: values.term_list,
64
+ termListTitle: values.list_title,
65
+ className: 'attachment-'+taxonomy+'-filter'
66
+ }).render() );
67
+ }
68
+ });
69
+ }
70
+ });
71
+
72
+ })( jQuery );
js/eml-options.js CHANGED
@@ -1,345 +1,345 @@
1
- (function($){
2
-
3
- // remove taxonomy
4
- $(document).on('click', 'li .wpuxss-eml-button-remove', function()
5
- {
6
- target = $(this).parent();
7
-
8
- if ( target.hasClass('wpuxss-eml-clone-taxonomy') )
9
- {
10
- target.hide( 300, function() {
11
- $(this).remove();
12
- });
13
- }
14
- else
15
- {
16
- if ( confirm(wpuxss_eml_i18n_data.tax_deletion_confirm) )
17
- {
18
- target.hide( 300, function() {
19
- $(this).remove();
20
- });
21
- }
22
- }
23
-
24
- return false;
25
- });
26
-
27
- // create new taxonomy
28
- $(document).on('click', '.wpuxss-eml-button-create-taxonomy', function()
29
- {
30
- $('.wpuxss-eml-media-taxonomy-list').find('.wpuxss-eml-clone').clone().attr('class','wpuxss-eml-clone-taxonomy').appendTo('.wpuxss-eml-media-taxonomy-list').show(300);
31
-
32
- return false;
33
- });
34
-
35
- // edit taxonomy parameters
36
- $(document).on('click', '.wpuxss-eml-button-edit', function()
37
- {
38
- $(this).parent().find('.wpuxss-eml-taxonomy-edit').toggle(300);
39
-
40
- $(this).html(function(i, html)
41
- {
42
- return html == wpuxss_eml_i18n_data.edit+' \u2193' ? wpuxss_eml_i18n_data.close+' \u2191' : wpuxss_eml_i18n_data.edit+' \u2193';
43
- });
44
-
45
- return false;
46
- });
47
-
48
- // on change of a singular taxonomy name during creation
49
- $(document).on('blur', '.wpuxss-eml-clone-taxonomy .wpuxss-eml-singular_name', function()
50
- {
51
- var dictionary,
52
- taxonomy_name = $(this).val().toLowerCase(),
53
- taxonomy_edit_box = $(this).parents('.wpuxss-eml-taxonomy-edit');
54
-
55
- taxonomy_name = taxonomy_name.replace(/(<([^>]+)>)/g,'');
56
-
57
- if ( taxonomy_name != '' )
58
- {
59
- // thanks to
60
- // https://github.com/borodean/jquery-translit
61
- // https://gist.github.com/richardsweeney/5317392
62
- // http://www.advancedcustomfields.com/
63
- // for the 'dictionary' code!
64
- dictionary = {
65
- 'а': 'a',
66
- 'б': 'b',
67
- 'в': 'v',
68
- 'г': 'g',
69
- 'д': 'd',
70
- 'е': 'e',
71
- 'ё': 'e',
72
- 'ж': 'zh',
73
- 'з': 'z',
74
- 'и': 'i',
75
- 'й': 'i',
76
- 'к': 'k',
77
- 'л': 'l',
78
- 'м': 'm',
79
- 'н': 'n',
80
- 'о': 'o',
81
- 'п': 'p',
82
- 'р': 'r',
83
- 'с': 's',
84
- 'т': 't',
85
- 'у': 'u',
86
- 'ф': 'f',
87
- 'х': 'kh',
88
- 'ц': 'tc',
89
- 'ч': 'ch',
90
- 'ш': 'sh',
91
- 'щ': 'shch',
92
- 'ъ': '',
93
- 'ы': 'y',
94
- 'ь': '',
95
- 'э': 'e',
96
- 'ю': 'iu',
97
- 'я': 'ia',
98
- 'ä': 'a',
99
- 'æ': 'a',
100
- 'å': 'a',
101
- 'ö': 'o',
102
- 'ø': 'o',
103
- 'é': 'e',
104
- 'ë': 'e',
105
- 'ü': 'u',
106
- 'ó': 'o',
107
- 'ő': 'o',
108
- 'ú': 'u',
109
- 'é': 'e',
110
- 'á': 'a',
111
- 'ű': 'u',
112
- 'í': 'i',
113
- ' ' : '_',
114
- '-' : '_',
115
- '\'' : '',
116
- '&' : '_'
117
- };
118
-
119
- $.each( dictionary, function(k, v)
120
- {
121
- var regex = new RegExp( k, 'g' );
122
- taxonomy_name = taxonomy_name.replace( regex, v );
123
- });
124
-
125
- taxonomy_name = taxonomy_name.replace(/[^a-z0-9_\s]/g, '');
126
-
127
- $(this).closest('.wpuxss-eml-clone-taxonomy').attr('id',taxonomy_name);
128
-
129
- if ( $('.wpuxss-eml-clone-taxonomy[id='+taxonomy_name+'], .wpuxss-eml-taxonomy[id='+taxonomy_name+'], .wpuxss-non-eml-taxonomy[id='+taxonomy_name+']').length > 1 )
130
- {
131
- alert(wpuxss_eml_i18n_data.tax_error_duplicate);
132
- }
133
-
134
- $(this).attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][singular_name]');
135
- taxonomy_edit_box.find('.wpuxss-eml-name').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][name]');
136
- taxonomy_edit_box.find('.wpuxss-eml-menu_name').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][menu_name]');
137
- taxonomy_edit_box.find('.wpuxss-eml-all_items').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][all_items]');
138
- taxonomy_edit_box.find('.wpuxss-eml-edit_item').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][edit_item]');
139
- taxonomy_edit_box.find('.wpuxss-eml-view_item').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][view_item]');
140
- taxonomy_edit_box.find('.wpuxss-eml-update_item').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][update_item]');
141
- taxonomy_edit_box.find('.wpuxss-eml-add_new_item').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][add_new_item]');
142
- taxonomy_edit_box.find('.wpuxss-eml-new_item_name').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][new_item_name]');
143
- taxonomy_edit_box.find('.wpuxss-eml-parent_item').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][parent_item]');
144
- taxonomy_edit_box.find('.wpuxss-eml-search_items').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][search_items]');
145
-
146
- if( taxonomy_edit_box.find('.wpuxss-eml-edit_item').val() == '' )
147
- taxonomy_edit_box.find('.wpuxss-eml-edit_item').val(wpuxss_eml_i18n_data.edit+' '+$(this).val());
148
-
149
- if( taxonomy_edit_box.find('.wpuxss-eml-view_item').val() == '' )
150
- taxonomy_edit_box.find('.wpuxss-eml-view_item').val(wpuxss_eml_i18n_data.view+' '+$(this).val());
151
-
152
- if( taxonomy_edit_box.find('.wpuxss-eml-update_item').val() == '' )
153
- taxonomy_edit_box.find('.wpuxss-eml-update_item').val(wpuxss_eml_i18n_data.update+' '+$(this).val());
154
-
155
- if( taxonomy_edit_box.find('.wpuxss-eml-add_new_item').val() == '' )
156
- taxonomy_edit_box.find('.wpuxss-eml-add_new_item').val(wpuxss_eml_i18n_data.add_new+' '+$(this).val());
157
-
158
- if( taxonomy_edit_box.find('.wpuxss-eml-new_item_name').val() == '' )
159
- taxonomy_edit_box.find('.wpuxss-eml-new_item_name').val(wpuxss_eml_i18n_data.new+' '+$(this).val()+' '+wpuxss_eml_i18n_data.name);
160
-
161
- if( taxonomy_edit_box.find('.wpuxss-eml-parent_item').val() == '' )
162
- taxonomy_edit_box.find('.wpuxss-eml-parent_item').val(wpuxss_eml_i18n_data.parent+' '+$(this).val());
163
-
164
- taxonomy_edit_box.find('.wpuxss-eml-hierarchical').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][hierarchical]');
165
- taxonomy_edit_box.find('.wpuxss-eml-public').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][public]');
166
- taxonomy_edit_box.find('.wpuxss-eml-show_admin_column').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][show_admin_column]');
167
- taxonomy_edit_box.find('.wpuxss-eml-show_in_nav_menus').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][show_in_nav_menus]');
168
- taxonomy_edit_box.find('.wpuxss-eml-sort').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][sort]');
169
- taxonomy_edit_box.find('.wpuxss-eml-slug').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][rewrite][slug]').val(taxonomy_name);
170
-
171
- taxonomy_edit_box.find('.wpuxss-eml-admin_filter').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][admin_filter]');
172
- taxonomy_edit_box.find('.wpuxss-eml-media_uploader_filter').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][media_uploader_filter]');
173
-
174
- $(this).closest('.wpuxss-eml-clone-taxonomy').find('.wpuxss-eml-assigned').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][assigned]');
175
- $(this).closest('.wpuxss-eml-clone-taxonomy').find('.wpuxss-eml-eml_media').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][eml_media]');
176
- }
177
- else
178
- {
179
- $(this).val('');
180
- taxonomy_edit_box.find('.wpuxss-eml-edit_item').val('');
181
- taxonomy_edit_box.find('.wpuxss-eml-view_item').val('');
182
- taxonomy_edit_box.find('.wpuxss-eml-update_item').val('');
183
- taxonomy_edit_box.find('.wpuxss-eml-add_new_item').val('');
184
- taxonomy_edit_box.find('.wpuxss-eml-new_item_name').val('');
185
- taxonomy_edit_box.find('.wpuxss-eml-parent_item').val('');
186
- taxonomy_edit_box.find('.wpuxss-eml-slug').val('');
187
- }
188
- });
189
-
190
- // on change of a plural taxonomy name during creation
191
- $(document).on('blur', '.wpuxss-eml-clone-taxonomy .wpuxss-eml-name', function()
192
- {
193
- var taxonomy_plural_name = $(this).val();
194
- taxonomy_edit_box = $(this).parents('.wpuxss-eml-taxonomy-edit');
195
-
196
- taxonomy_plural_name = taxonomy_plural_name.replace(/(<([^>]+)>)/g,'');
197
-
198
- if ( taxonomy_plural_name != '' )
199
- {
200
- if( taxonomy_edit_box.find('.wpuxss-eml-menu_name').val() == '' )
201
- taxonomy_edit_box.find('.wpuxss-eml-menu_name').val($(this).val());
202
-
203
- if( taxonomy_edit_box.find('.wpuxss-eml-all_items').val() == '' )
204
- taxonomy_edit_box.find('.wpuxss-eml-all_items').val(wpuxss_eml_i18n_data.all+' '+$(this).val());
205
-
206
- if( taxonomy_edit_box.find('.wpuxss-eml-search_items').val() == '' )
207
- taxonomy_edit_box.find('.wpuxss-eml-search_items').val(wpuxss_eml_i18n_data.search+' '+$(this).val());
208
-
209
- $(this).closest('.wpuxss-eml-clone-taxonomy').find('.wpuxss-eml-taxonomy-label').text($(this).val());
210
- }
211
- else
212
- {
213
- $(this).val('');
214
- taxonomy_edit_box.find('.wpuxss-eml-menu_name').val('');
215
- taxonomy_edit_box.find('.wpuxss-eml-all_items').val('');
216
- taxonomy_edit_box.find('.wpuxss-eml-search_items').val('');
217
- $(this).closest('.wpuxss-eml-clone-taxonomy').find('.wpuxss-eml-taxonomy-label').text(wpuxss_eml_i18n_data.tax_new);
218
- }
219
- });
220
-
221
- // on taxonomy form submit
222
- $('#wpuxss-eml-form-taxonomies').submit(function( event )
223
- {
224
- submit_it = true;
225
- alert_text = '';
226
-
227
- $('.wpuxss-eml-clone-taxonomy, .wpuxss-eml-taxonomy').each(function( index )
228
- {
229
- current_taxonomy = $(this).attr('id');
230
-
231
- if ( !$('.wpuxss-eml-singular_name',this).val() && !$('.wpuxss-eml-name',this).val() )
232
- {
233
- submit_it = false;
234
- alert_text = wpuxss_eml_i18n_data.tax_error_empty_both;
235
- }
236
- else if ( !$('.wpuxss-eml-singular_name',this).val() )
237
- {
238
- submit_it = false;
239
- alert_text = wpuxss_eml_i18n_data.tax_error_empty_singular;
240
- }
241
- else if ( !$('.wpuxss-eml-name',this).val() )
242
- {
243
- submit_it = false;
244
- alert_text = wpuxss_eml_i18n_data.tax_error_empty_plural;
245
- }
246
- else if ( $('.wpuxss-eml-clone-taxonomy[id='+current_taxonomy+'], .wpuxss-eml-taxonomy[id='+current_taxonomy+'], .wpuxss-non-eml-taxonomy[id='+current_taxonomy+']').length > 1 )
247
- {
248
- submit_it = false;
249
- alert_text = wpuxss_eml_i18n_data.tax_error_duplicate;
250
- }
251
- });
252
-
253
- if ( !submit_it ) alert(alert_text);
254
-
255
- return submit_it;
256
- });
257
-
258
-
259
-
260
- // create new mime type
261
- $(document).on('click', '.wpuxss-eml-button-create-mime', function()
262
- {
263
- $('.wpuxss-eml-mime-type-list').find('.wpuxss-eml-clone').clone().attr('class','wpuxss-eml-clone-mime').prependTo('.wpuxss-eml-mime-type-list tbody').show(300);
264
-
265
- return false;
266
- });
267
-
268
- // remove mime type
269
- $(document).on('click', 'tr .wpuxss-eml-button-remove', function()
270
- {
271
- $(this).closest('tr').hide( 300, function() {
272
- $(this).remove();
273
- });
274
-
275
- return false;
276
- });
277
-
278
- // on change of an extension during creation
279
- $(document).on('blur', '.wpuxss-eml-clone-mime .wpuxss-eml-type', function()
280
- {
281
- var extension = $(this).val().toLowerCase(),
282
- mime_type_tr = $(this).closest('tr');
283
-
284
- $(this).val(extension);
285
-
286
- mime_type_tr.find('.wpuxss-eml-mime').attr('name','wpuxss_eml_mimes['+extension+'][mime]');
287
- mime_type_tr.find('.wpuxss-eml-singular').attr('name','wpuxss_eml_mimes['+extension+'][singular]');
288
- mime_type_tr.find('.wpuxss-eml-plural').attr('name','wpuxss_eml_mimes['+extension+'][plural]');
289
- mime_type_tr.find('.wpuxss-eml-filter').attr('name','wpuxss_eml_mimes['+extension+'][filter]');
290
- mime_type_tr.find('.wpuxss-eml-upload').attr('name','wpuxss_eml_mimes['+extension+'][upload]');
291
- });
292
-
293
-
294
- // on change of a mime type during creation
295
- $(document).on('blur', '.wpuxss-eml-clone-mime .wpuxss-eml-mime', function()
296
- {
297
- var mime_type = $(this).val().toLowerCase(),
298
- mime_type_tr = $(this).closest('tr');
299
-
300
- $(this).val(mime_type);
301
- });
302
-
303
- // mime types restoration warning
304
- $(document).on('click', '#wpuxss_eml_restore_mimes_backup', function()
305
- {
306
- if ( confirm(wpuxss_eml_i18n_data.mime_deletion_confirm) )
307
- {
308
- return true;
309
- }
310
-
311
- return false;
312
- });
313
-
314
- // on mime types form submit
315
- $('#wpuxss-eml-form-mimetypes').submit(function( event )
316
- {
317
- submit_it = true;
318
- alert_text = '';
319
-
320
- $('.wpuxss-eml-clone-mime').each(function( index )
321
- {
322
- if ( !$('.wpuxss-eml-type',this).val() || $('.wpuxss-eml-type',this).val() == '' || !$('.wpuxss-eml-mime',this).val() || $('.wpuxss-eml-mime',this).val() == '' )
323
- {
324
- submit_it = false;
325
- alert_text = wpuxss_eml_i18n_data.mime_error_empty_fields;
326
- }
327
- else if ( $('[id="'+$('.wpuxss-eml-type',this).val()+'"]').length > 0 || $('.wpuxss-eml-mime[value="'+$('.wpuxss-eml-mime',this).val()+'"]').length > 0 )
328
- {
329
- submit_it = false;
330
- alert_text = wpuxss_eml_i18n_data.mime_error_duplicate;
331
- }
332
-
333
- if ( !$('.wpuxss-eml-singular',this).val() || $('.wpuxss-eml-singular',this).val() == '' || !$('.wpuxss-eml-plural',this).val() || $('.wpuxss-eml-plural',this).val() == '' )
334
- {
335
- $('.wpuxss-eml-singular',this).val($('.wpuxss-eml-mime',this).val());
336
- $('.wpuxss-eml-plural',this).val($('.wpuxss-eml-mime',this).val());
337
- }
338
- });
339
-
340
- if ( !submit_it && alert_text != '' ) alert(alert_text);
341
-
342
- return submit_it;
343
- });
344
-
345
  })( jQuery );
1
+ (function($){
2
+
3
+ // remove taxonomy
4
+ $(document).on('click', 'li .wpuxss-eml-button-remove', function()
5
+ {
6
+ target = $(this).parent();
7
+
8
+ if ( target.hasClass('wpuxss-eml-clone-taxonomy') )
9
+ {
10
+ target.hide( 300, function() {
11
+ $(this).remove();
12
+ });
13
+ }
14
+ else
15
+ {
16
+ if ( confirm(wpuxss_eml_i18n_data.tax_deletion_confirm) )
17
+ {
18
+ target.hide( 300, function() {
19
+ $(this).remove();
20
+ });
21
+ }
22
+ }
23
+
24
+ return false;
25
+ });
26
+
27
+ // create new taxonomy
28
+ $(document).on('click', '.wpuxss-eml-button-create-taxonomy', function()
29
+ {
30
+ $('.wpuxss-eml-media-taxonomy-list').find('.wpuxss-eml-clone').clone().attr('class','wpuxss-eml-clone-taxonomy').appendTo('.wpuxss-eml-media-taxonomy-list').show(300);
31
+
32
+ return false;
33
+ });
34
+
35
+ // edit taxonomy parameters
36
+ $(document).on('click', '.wpuxss-eml-button-edit', function()
37
+ {
38
+ $(this).parent().find('.wpuxss-eml-taxonomy-edit').toggle(300);
39
+
40
+ $(this).html(function(i, html)
41
+ {
42
+ return html == wpuxss_eml_i18n_data.edit+' \u2193' ? wpuxss_eml_i18n_data.close+' \u2191' : wpuxss_eml_i18n_data.edit+' \u2193';
43
+ });
44
+
45
+ return false;
46
+ });
47
+
48
+ // on change of a singular taxonomy name during creation
49
+ $(document).on('blur', '.wpuxss-eml-clone-taxonomy .wpuxss-eml-singular_name', function()
50
+ {
51
+ var dictionary,
52
+ taxonomy_name = $(this).val().toLowerCase(),
53
+ taxonomy_edit_box = $(this).parents('.wpuxss-eml-taxonomy-edit');
54
+
55
+ taxonomy_name = taxonomy_name.replace(/(<([^>]+)>)/g,'');
56
+
57
+ if ( taxonomy_name != '' )
58
+ {
59
+ // thanks to
60
+ // https://github.com/borodean/jquery-translit
61
+ // https://gist.github.com/richardsweeney/5317392
62
+ // http://www.advancedcustomfields.com/
63
+ // for the 'dictionary' code!
64
+ dictionary = {
65
+ 'а': 'a',
66
+ 'б': 'b',
67
+ 'в': 'v',
68
+ 'г': 'g',
69
+ 'д': 'd',
70
+ 'е': 'e',
71
+ 'ё': 'e',
72
+ 'ж': 'zh',
73
+ 'з': 'z',
74
+ 'и': 'i',
75
+ 'й': 'i',
76
+ 'к': 'k',
77
+ 'л': 'l',
78
+ 'м': 'm',
79
+ 'н': 'n',
80
+ 'о': 'o',
81
+ 'п': 'p',
82
+ 'р': 'r',
83
+ 'с': 's',
84
+ 'т': 't',
85
+ 'у': 'u',
86
+ 'ф': 'f',
87
+ 'х': 'kh',
88
+ 'ц': 'tc',
89
+ 'ч': 'ch',
90
+ 'ш': 'sh',
91
+ 'щ': 'shch',
92
+ 'ъ': '',
93
+ 'ы': 'y',
94
+ 'ь': '',
95
+ 'э': 'e',
96
+ 'ю': 'iu',
97
+ 'я': 'ia',
98
+ 'ä': 'a',
99
+ 'æ': 'a',
100
+ 'å': 'a',
101
+ 'ö': 'o',
102
+ 'ø': 'o',
103
+ 'é': 'e',
104
+ 'ë': 'e',
105
+ 'ü': 'u',
106
+ 'ó': 'o',
107
+ 'ő': 'o',
108
+ 'ú': 'u',
109
+ 'é': 'e',
110
+ 'á': 'a',
111
+ 'ű': 'u',
112
+ 'í': 'i',
113
+ ' ' : '_',
114
+ '-' : '_',
115
+ '\'' : '',
116
+ '&' : '_'
117
+ };
118
+
119
+ $.each( dictionary, function(k, v)
120
+ {
121
+ var regex = new RegExp( k, 'g' );
122
+ taxonomy_name = taxonomy_name.replace( regex, v );
123
+ });
124
+
125
+ taxonomy_name = taxonomy_name.replace(/[^a-z0-9_\s]/g, '');
126
+
127
+ $(this).closest('.wpuxss-eml-clone-taxonomy').attr('id',taxonomy_name);
128
+
129
+ if ( $('.wpuxss-eml-clone-taxonomy[id='+taxonomy_name+'], .wpuxss-eml-taxonomy[id='+taxonomy_name+'], .wpuxss-non-eml-taxonomy[id='+taxonomy_name+']').length > 1 )
130
+ {
131
+ alert(wpuxss_eml_i18n_data.tax_error_duplicate);
132
+ }
133
+
134
+ $(this).attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][singular_name]');
135
+ taxonomy_edit_box.find('.wpuxss-eml-name').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][name]');
136
+ taxonomy_edit_box.find('.wpuxss-eml-menu_name').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][menu_name]');
137
+ taxonomy_edit_box.find('.wpuxss-eml-all_items').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][all_items]');
138
+ taxonomy_edit_box.find('.wpuxss-eml-edit_item').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][edit_item]');
139
+ taxonomy_edit_box.find('.wpuxss-eml-view_item').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][view_item]');
140
+ taxonomy_edit_box.find('.wpuxss-eml-update_item').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][update_item]');
141
+ taxonomy_edit_box.find('.wpuxss-eml-add_new_item').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][add_new_item]');
142
+ taxonomy_edit_box.find('.wpuxss-eml-new_item_name').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][new_item_name]');
143
+ taxonomy_edit_box.find('.wpuxss-eml-parent_item').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][parent_item]');
144
+ taxonomy_edit_box.find('.wpuxss-eml-search_items').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][labels][search_items]');
145
+
146
+ if( taxonomy_edit_box.find('.wpuxss-eml-edit_item').val() == '' )
147
+ taxonomy_edit_box.find('.wpuxss-eml-edit_item').val(wpuxss_eml_i18n_data.edit+' '+$(this).val());
148
+
149
+ if( taxonomy_edit_box.find('.wpuxss-eml-view_item').val() == '' )
150
+ taxonomy_edit_box.find('.wpuxss-eml-view_item').val(wpuxss_eml_i18n_data.view+' '+$(this).val());
151
+
152
+ if( taxonomy_edit_box.find('.wpuxss-eml-update_item').val() == '' )
153
+ taxonomy_edit_box.find('.wpuxss-eml-update_item').val(wpuxss_eml_i18n_data.update+' '+$(this).val());
154
+
155
+ if( taxonomy_edit_box.find('.wpuxss-eml-add_new_item').val() == '' )
156
+ taxonomy_edit_box.find('.wpuxss-eml-add_new_item').val(wpuxss_eml_i18n_data.add_new+' '+$(this).val());
157
+
158
+ if( taxonomy_edit_box.find('.wpuxss-eml-new_item_name').val() == '' )
159
+ taxonomy_edit_box.find('.wpuxss-eml-new_item_name').val(wpuxss_eml_i18n_data.new+' '+$(this).val()+' '+wpuxss_eml_i18n_data.name);
160
+
161
+ if( taxonomy_edit_box.find('.wpuxss-eml-parent_item').val() == '' )
162
+ taxonomy_edit_box.find('.wpuxss-eml-parent_item').val(wpuxss_eml_i18n_data.parent+' '+$(this).val());
163
+
164
+ taxonomy_edit_box.find('.wpuxss-eml-hierarchical').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][hierarchical]');
165
+ taxonomy_edit_box.find('.wpuxss-eml-public').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][public]');
166
+ taxonomy_edit_box.find('.wpuxss-eml-show_admin_column').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][show_admin_column]');
167
+ taxonomy_edit_box.find('.wpuxss-eml-show_in_nav_menus').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][show_in_nav_menus]');
168
+ taxonomy_edit_box.find('.wpuxss-eml-sort').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][sort]');
169
+ taxonomy_edit_box.find('.wpuxss-eml-slug').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][rewrite][slug]').val(taxonomy_name);
170
+
171
+ taxonomy_edit_box.find('.wpuxss-eml-admin_filter').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][admin_filter]');
172
+ taxonomy_edit_box.find('.wpuxss-eml-media_uploader_filter').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][media_uploader_filter]');
173
+
174
+ $(this).closest('.wpuxss-eml-clone-taxonomy').find('.wpuxss-eml-assigned').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][assigned]');
175
+ $(this).closest('.wpuxss-eml-clone-taxonomy').find('.wpuxss-eml-eml_media').attr('name','wpuxss_eml_taxonomies['+taxonomy_name+'][eml_media]');
176
+ }
177
+ else
178
+ {
179
+ $(this).val('');
180
+ taxonomy_edit_box.find('.wpuxss-eml-edit_item').val('');
181
+ taxonomy_edit_box.find('.wpuxss-eml-view_item').val('');
182
+ taxonomy_edit_box.find('.wpuxss-eml-update_item').val('');
183
+ taxonomy_edit_box.find('.wpuxss-eml-add_new_item').val('');
184
+ taxonomy_edit_box.find('.wpuxss-eml-new_item_name').val('');
185
+ taxonomy_edit_box.find('.wpuxss-eml-parent_item').val('');
186
+ taxonomy_edit_box.find('.wpuxss-eml-slug').val('');
187
+ }
188
+ });
189
+
190
+ // on change of a plural taxonomy name during creation
191
+ $(document).on('blur', '.wpuxss-eml-clone-taxonomy .wpuxss-eml-name', function()
192
+ {
193
+ var taxonomy_plural_name = $(this).val();
194
+ taxonomy_edit_box = $(this).parents('.wpuxss-eml-taxonomy-edit');
195
+
196
+ taxonomy_plural_name = taxonomy_plural_name.replace(/(<([^>]+)>)/g,'');
197
+
198
+ if ( taxonomy_plural_name != '' )
199
+ {
200
+ if( taxonomy_edit_box.find('.wpuxss-eml-menu_name').val() == '' )
201
+ taxonomy_edit_box.find('.wpuxss-eml-menu_name').val($(this).val());
202
+
203
+ if( taxonomy_edit_box.find('.wpuxss-eml-all_items').val() == '' )
204
+ taxonomy_edit_box.find('.wpuxss-eml-all_items').val(wpuxss_eml_i18n_data.all+' '+$(this).val());
205
+
206
+ if( taxonomy_edit_box.find('.wpuxss-eml-search_items').val() == '' )
207
+ taxonomy_edit_box.find('.wpuxss-eml-search_items').val(wpuxss_eml_i18n_data.search+' '+$(this).val());
208
+
209
+ $(this).closest('.wpuxss-eml-clone-taxonomy').find('.wpuxss-eml-taxonomy-label').text($(this).val());
210
+ }
211
+ else
212
+ {
213
+ $(this).val('');
214
+ taxonomy_edit_box.find('.wpuxss-eml-menu_name').val('');
215
+ taxonomy_edit_box.find('.wpuxss-eml-all_items').val('');
216
+ taxonomy_edit_box.find('.wpuxss-eml-search_items').val('');
217
+ $(this).closest('.wpuxss-eml-clone-taxonomy').find('.wpuxss-eml-taxonomy-label').text(wpuxss_eml_i18n_data.tax_new);
218
+ }
219
+ });
220
+
221
+ // on taxonomy form submit
222
+ $('#wpuxss-eml-form-taxonomies').submit(function( event )
223
+ {
224
+ submit_it = true;
225
+ alert_text = '';
226
+
227
+ $('.wpuxss-eml-clone-taxonomy, .wpuxss-eml-taxonomy').each(function( index )
228
+ {
229
+ current_taxonomy = $(this).attr('id');
230
+
231
+ if ( !$('.wpuxss-eml-singular_name',this).val() && !$('.wpuxss-eml-name',this).val() )
232
+ {
233
+ submit_it = false;
234
+ alert_text = wpuxss_eml_i18n_data.tax_error_empty_both;
235
+ }
236
+ else if ( !$('.wpuxss-eml-singular_name',this).val() )
237
+ {
238
+ submit_it = false;
239
+ alert_text = wpuxss_eml_i18n_data.tax_error_empty_singular;
240
+ }
241
+ else if ( !$('.wpuxss-eml-name',this).val() )
242
+ {
243
+ submit_it = false;
244
+ alert_text = wpuxss_eml_i18n_data.tax_error_empty_plural;
245
+ }
246
+ else if ( $('.wpuxss-eml-clone-taxonomy[id='+current_taxonomy+'], .wpuxss-eml-taxonomy[id='+current_taxonomy+'], .wpuxss-non-eml-taxonomy[id='+current_taxonomy+']').length > 1 )
247
+ {
248
+ submit_it = false;
249
+ alert_text = wpuxss_eml_i18n_data.tax_error_duplicate;
250
+ }
251
+ });
252
+
253
+ if ( !submit_it ) alert(alert_text);
254
+
255
+ return submit_it;
256
+ });
257
+
258
+
259
+
260
+ // create new mime type
261
+ $(document).on('click', '.wpuxss-eml-button-create-mime', function()
262
+ {
263
+ $('.wpuxss-eml-mime-type-list').find('.wpuxss-eml-clone').clone().attr('class','wpuxss-eml-clone-mime').prependTo('.wpuxss-eml-mime-type-list tbody').show(300);
264
+
265
+ return false;
266
+ });
267
+
268
+ // remove mime type
269
+ $(document).on('click', 'tr .wpuxss-eml-button-remove', function()
270
+ {
271
+ $(this).closest('tr').hide( 300, function() {
272
+ $(this).remove();
273
+ });
274
+
275
+ return false;
276
+ });
277
+
278
+ // on change of an extension during creation
279
+ $(document).on('blur', '.wpuxss-eml-clone-mime .wpuxss-eml-type', function()
280
+ {
281
+ var extension = $(this).val().toLowerCase(),
282
+ mime_type_tr = $(this).closest('tr');
283
+
284
+ $(this).val(extension);
285
+
286
+ mime_type_tr.find('.wpuxss-eml-mime').attr('name','wpuxss_eml_mimes['+extension+'][mime]');
287
+ mime_type_tr.find('.wpuxss-eml-singular').attr('name','wpuxss_eml_mimes['+extension+'][singular]');
288
+ mime_type_tr.find('.wpuxss-eml-plural').attr('name','wpuxss_eml_mimes['+extension+'][plural]');
289
+ mime_type_tr.find('.wpuxss-eml-filter').attr('name','wpuxss_eml_mimes['+extension+'][filter]');
290
+ mime_type_tr.find('.wpuxss-eml-upload').attr('name','wpuxss_eml_mimes['+extension+'][upload]');
291
+ });
292
+
293
+
294
+ // on change of a mime type during creation
295
+ $(document).on('blur', '.wpuxss-eml-clone-mime .wpuxss-eml-mime', function()
296
+ {
297
+ var mime_type = $(this).val().toLowerCase(),
298
+ mime_type_tr = $(this).closest('tr');
299
+
300
+ $(this).val(mime_type);
301
+ });
302
+
303
+ // mime types restoration warning
304
+ $(document).on('click', '#wpuxss_eml_restore_mimes_backup', function()
305
+ {
306
+ if ( confirm(wpuxss_eml_i18n_data.mime_deletion_confirm) )
307
+ {
308
+ return true;
309
+ }
310
+
311
+ return false;
312
+ });
313
+
314
+ // on mime types form submit
315
+ $('#wpuxss-eml-form-mimetypes').submit(function( event )
316
+ {
317
+ submit_it = true;
318
+ alert_text = '';
319
+
320
+ $('.wpuxss-eml-clone-mime').each(function( index )
321
+ {
322
+ if ( !$('.wpuxss-eml-type',this).val() || $('.wpuxss-eml-type',this).val() == '' || !$('.wpuxss-eml-mime',this).val() || $('.wpuxss-eml-mime',this).val() == '' )
323
+ {
324
+ submit_it = false;
325
+ alert_text = wpuxss_eml_i18n_data.mime_error_empty_fields;
326
+ }
327
+ else if ( $('[id="'+$('.wpuxss-eml-type',this).val()+'"]').length > 0 || $('.wpuxss-eml-mime[value="'+$('.wpuxss-eml-mime',this).val()+'"]').length > 0 )
328
+ {
329
+ submit_it = false;
330
+ alert_text = wpuxss_eml_i18n_data.mime_error_duplicate;
331
+ }
332
+
333
+ if ( !$('.wpuxss-eml-singular',this).val() || $('.wpuxss-eml-singular',this).val() == '' || !$('.wpuxss-eml-plural',this).val() || $('.wpuxss-eml-plural',this).val() == '' )
334
+ {
335
+ $('.wpuxss-eml-singular',this).val($('.wpuxss-eml-mime',this).val());
336
+ $('.wpuxss-eml-plural',this).val($('.wpuxss-eml-mime',this).val());
337
+ }
338
+ });
339
+
340
+ if ( !submit_it && alert_text != '' ) alert(alert_text);
341
+
342
+ return submit_it;
343
+ });
344
+
345
  })( jQuery );
readme.txt CHANGED
@@ -1,108 +1,135 @@
1
- === Enhanced Media Library ===
2
- Contributors: webbistro
3
- Tags: media library, taxonomy, taxonomies, mime, mime type, attachment, media category, media categories, media tag, media tags, media taxonomy, media taxonomies, media filter, media organizer, file types, media types, media uploader, custom, media management, attachment management, files management, ux, user experience, wp-admin, admin
4
- Requires at least: 3.5
5
- Tested up to: 3.9
6
- Stable tag: 1.0.5
7
- License: GPLv2 or later
8
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
-
10
-
11
-
12
- A better management for WordPress Media Library
13
-
14
-
15
-
16
- == Description ==
17
-
18
- This plugin will be handy for those who need to manage a lot of media files.
19
-
20
- = Taxonomies =
21
-
22
- * create unlimited amount of media taxonomies (like categories and tags),
23
- * be in total control of your custom taxonomies' parameters via admin,
24
- * edit and delete your custom media taxonomies,
25
- * assign existed taxonomies to Media Library (for example, you can use post categories as a taxonomy for your media files),
26
- * unassign any media taxonomy from Media Library via admin,
27
- * immediately set taxonomy term to any media file during upload via Media Uploader,
28
- * filter media files in Media Library by your custom taxonomies, and choose which taxonomies you are willing to use for that filter,
29
- * filter media files in Media Uploader by your custom taxonomies, and choose which taxonomies you are willing to use for that filter,
30
- * have you attachment post type's archive page (front-end) working by default
31
-
32
- = MIME Types =
33
-
34
- * create new MIME types (media file types),
35
- * delete any MIME type,
36
- * allow/disallow uploading for any MIME type,
37
- * filter media files by MIME types in Media Library / Media Uploader (for example, PDFs, Documents, V-Cards, etc),
38
- * be in total control of the names of your MIME type filters
39
-
40
- = Coming =
41
-
42
- New features and improvements coming...
43
-
44
-
45
-
46
- == Installation ==
47
-
48
- 1. Upload plugin folder to '/wp-content/plugins/' directory
49
-
50
- 2. Activate the plugin through 'Plugins' menu in WordPress admin
51
-
52
- 3. Adjust plugin's settings on **Media Settings -> Taxonomies** or **Media Settings -> MIME Types**
53
-
54
- 4. Enjoy Enhanced Media Library!
55
-
56
-
57
-
58
- == Screenshots ==
59
-
60
- 1. Enhanced Media Library Taxonomies Settings
61
-
62
- 2. Taxonomies in Nav Menu
63
-
64
- 3. Edit media taxonomies just like any others
65
-
66
- 4. Edit media taxonomies just like any others
67
-
68
- 5. Taxonomy columns and filters, sorting by MIME types in Media Library
69
-
70
- 6. MIME type filter in Media Uploader
71
-
72
- 7. Taxonomy filter in Media Uploader
73
-
74
- 8. Set taxonomy term right in Media Uploader
75
-
76
- 9. MIME type manager
77
-
78
-
79
-
80
- == Changelog ==
81
-
82
- = 1.0.5 =
83
- * Fixed: Added WP 3.9 compatibility [Support Request](https://wordpress.org/support/topic/great-plugin-but-breaks-the-new-add-media-in-39)
84
- * Fixed: Bug with disappearing filter in Media Uploader [Support Request](https://wordpress.org/support/topic/any-chance-of-adding-a-drop-down-in-the-insert-media-screen)
85
-
86
- = 1.0.4 =
87
-
88
- * Fixed: Filter mechanism in Media Library [Support Request](http://wordpress.org/support/topic/filter-in-media-not-working-properly)
89
- * Fixed: Bug with saving of assigned post categories and tags in Media Uploader
90
-
91
- = 1.0.3 =
92
-
93
- * Update: Better term sorting in Media Uploader
94
- * Update: Minor code improvements
95
- * Fixed: Bug with sorting of post categories and tags assigned to Media Library
96
-
97
- = 1.0.2 =
98
-
99
- * Fix: Assigned non-media taxonomies archive page fixed: [Support Request](http://wordpress.org/support/topic/plugin-woocommerce-products-stopped-displaying)
100
-
101
- = 1.0.1 =
102
-
103
- * Fix: Media Uploader filter now shows nested terms.
104
- * Fix: Media Uploader filter now works correctly with multiple taxonomies.
105
-
106
- = 1.0 =
107
-
108
- * New: Enhanced Media Library initial release.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Enhanced Media Library ===
2
+ Contributors: webbistro
3
+ Tags: media library, taxonomy, taxonomies, mime, mime type, attachment, media category, media categories, media tag, media tags, media taxonomy, media taxonomies, media filter, media organizer, file types, media types, media uploader, custom, media management, attachment management, files management, ux, user experience, wp-admin, admin
4
+ Requires at least: 3.5
5
+ Tested up to: 3.9.1
6
+ Stable tag: 1.1
7
+ License: GPLv2 or later
8
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
+
10
+
11
+
12
+ A better management for WordPress Media Library
13
+
14
+
15
+
16
+ == Description ==
17
+
18
+ This plugin will be handy for those who need to manage a lot of media files.
19
+
20
+ = Taxonomies =
21
+
22
+ * create unlimited amount of media taxonomies (like categories and tags),
23
+ * be in total control of your custom taxonomies' parameters via admin,
24
+ * edit and delete your custom media taxonomies,
25
+ * assign existed taxonomies to Media Library (for example, you can use post categories as a taxonomy for your media files),
26
+ * unassign any media taxonomy from Media Library via admin,
27
+ * immediately set taxonomy term to any media file during upload via Media Uploader,
28
+ * filter media files in Media Library by your custom taxonomies, and choose which taxonomies you are willing to use for that filter,
29
+ * filter media files in Media Uploader by your custom taxonomies, and choose which taxonomies you are willing to use for that filter,
30
+ * have you attachment post type's archive page (front-end) working by default
31
+
32
+ = MIME Types =
33
+
34
+ * create new MIME types (media file types),
35
+ * delete any MIME type,
36
+ * allow/disallow uploading for any MIME type,
37
+ * filter media files by MIME types in Media Library / Media Uploader (for example, PDFs, Documents, V-Cards, etc),
38
+ * be in total control of the names of your MIME type filters
39
+
40
+ = Coming =
41
+
42
+ New features and improvements coming...
43
+
44
+
45
+
46
+ == Installation ==
47
+
48
+ 1. Upload plugin folder to '/wp-content/plugins/' directory
49
+
50
+ 2. Activate the plugin through 'Plugins' menu in WordPress admin
51
+
52
+ 3. Adjust plugin's settings on **Media Settings -> Taxonomies** or **Media Settings -> MIME Types**
53
+
54
+ 4. Enjoy Enhanced Media Library!
55
+
56
+
57
+
58
+ == Screenshots ==
59
+
60
+ 1. Enhanced Media Library Taxonomies Settings
61
+
62
+ 2. Taxonomies in Nav Menu
63
+
64
+ 3. Edit media taxonomies just like any others
65
+
66
+ 4. Edit media taxonomies just like any others
67
+
68
+ 5. Taxonomy columns and filters, sorting by MIME types in Media Library
69
+
70
+ 6. MIME type filter in Media Uploader
71
+
72
+ 7. Taxonomy filter in Media Uploader
73
+
74
+ 8. Set taxonomy term right in Media Uploader
75
+
76
+ 9. MIME type manager
77
+
78
+
79
+
80
+ == Changelog ==
81
+
82
+ = 1.1 =
83
+
84
+ * **Improvements**
85
+ * Filters added to /wp-admin/customize.php page [Support Request](https://wordpress.org/support/topic/missing-category-filter-on-media-select-window)
86
+ * Reconsidered the mechanism of checkboxes' checking in Media Uploader for more stable operation [Support Request](https://wordpress.org/support/topic/instability-in-the-media-insertion-panel)
87
+ * Media Uploader filters now work without page refreshing when you change category for you images
88
+
89
+ * **Bugfixes**
90
+ * Fixed "Uploads not showing" issue [Support Request](http://wordpress.org/support/topic/uploads-not-showing)
91
+ * Reconsidered CSS for filters area [Support Request](http://wordpress.org/support/topic/missing-search-box)
92
+ * Fixed CSS and JS files wrong path definitions [Support Request](http://wordpress.org/support/topic/little-bug-2)
93
+
94
+
95
+ = 1.0.5 =
96
+
97
+ * Bugfixes
98
+ * Fixed disappearing filter in Media Uploader [Support Request](https://wordpress.org/support/topic/any-chance-of-adding-a-drop-down-in-the-insert-media-screen)
99
+ * Added WP 3.9 compatibility [Support Request](https://wordpress.org/support/topic/great-plugin-but-breaks-the-new-add-media-in-39)
100
+
101
+
102
+ = 1.0.4 =
103
+
104
+ * Bugfixes
105
+ * Fixed filter mechanism in Media Library [Support Request](http://wordpress.org/support/topic/filter-in-media-not-working-properly)
106
+ * Fixed the bug with saving of assigned post categories and tags in Media Uploader
107
+
108
+
109
+ = 1.0.3 =
110
+
111
+ * Improvements
112
+ * Better term sorting in Media Uploader
113
+ * Minor code improvements
114
+
115
+ * Bugfixes
116
+ * Fixed the bug with sorting of post categories and tags assigned to Media Library
117
+
118
+
119
+ = 1.0.2 =
120
+
121
+ * Bugfixes
122
+ * Fixed assigned non-media taxonomies archive page [Support Request](http://wordpress.org/support/topic/plugin-woocommerce-products-stopped-displaying)
123
+
124
+
125
+ = 1.0.1 =
126
+
127
+ * Bugfixes
128
+ * Media Uploader filter now shows nested terms.
129
+ * Media Uploader filter now works correctly with multiple taxonomies.
130
+
131
+
132
+ = 1.0 =
133
+
134
+ * New:
135
+ * Enhanced Media Library initial release.