Enhanced Media Library - Version 1.1.2

Version Description

Download this release

Release Info

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

Code changes from version 1.1.1 to 1.1.2

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 Popup / Grid View','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 Popup / Grid View','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 Popup / Grid View','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 Popup / Grid View','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,531 +1,521 @@
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
  ?>
1
+ <?php
2
+
3
+ /**
4
+ * wpuxss_eml_unregister_taxonomy_for_object_type
5
+ *
6
+ * Unassign taxonomy (duplicates native WP(Since: WordPress 3.7.0) for back compatibility)
7
+ * Based on /wp-includes/taxonomy.php
8
+ *
9
+ * @since 1.0
10
+ * @created 10/10/13
11
+ */
12
+
13
+ function wpuxss_eml_unregister_taxonomy_for_object_type( $taxonomy, $object_type )
14
+ {
15
+ global $wp_taxonomies;
16
+
17
+ if ( ! isset( $wp_taxonomies[ $taxonomy ] ) )
18
+ return false;
19
+
20
+ if ( ! get_post_type_object( $object_type ) )
21
+ return false;
22
+
23
+ $key = array_search( $object_type, $wp_taxonomies[ $taxonomy ]->object_type, true );
24
+ if ( false === $key )
25
+ return false;
26
+
27
+ unset( $wp_taxonomies[ $taxonomy ]->object_type[ $key ] );
28
+ return true;
29
+ }
30
+
31
+
32
+
33
+
34
+ /**
35
+ * wpuxss_eml_taxonomies_validate
36
+ *
37
+ * @type callback function
38
+ * @since 1.0
39
+ * @created 28/09/13
40
+ */
41
+
42
+ function wpuxss_eml_taxonomies_validate($input)
43
+ {
44
+ if ( !$input ) $input = array();
45
+
46
+ foreach ( $input as $taxonomy => $params )
47
+ {
48
+ $sanitized_taxonomy = sanitize_key($taxonomy);
49
+
50
+ if ( $sanitized_taxonomy !== $taxonomy )
51
+ {
52
+ $input[$sanitized_taxonomy] = $input[$taxonomy];
53
+ unset($input[$taxonomy]);
54
+ $taxonomy = $sanitized_taxonomy;
55
+ }
56
+
57
+ if ( !isset($params['hierarchical']) )
58
+ $input[$taxonomy]['hierarchical'] = 0;
59
+
60
+ if ( !isset($params['sort']) )
61
+ $input[$taxonomy]['sort'] = 0;
62
+
63
+ if ( !isset($params['show_admin_column']) )
64
+ $input[$taxonomy]['show_admin_column'] = 0;
65
+
66
+ if ( !isset($params['show_in_nav_menus']) )
67
+ $input[$taxonomy]['show_in_nav_menus'] = 0;
68
+
69
+ if ( !isset($params['assigned']) )
70
+ $input[$taxonomy]['assigned'] = 0;
71
+
72
+ if ( !isset($params['admin_filter']) )
73
+ $input[$taxonomy]['admin_filter'] = 0;
74
+
75
+ if ( !isset($params['media_uploader_filter']) )
76
+ $input[$taxonomy]['media_uploader_filter'] = 0;
77
+
78
+ $input[$taxonomy]['hierarchical'] = intval($input[$taxonomy]['hierarchical']);
79
+ $input[$taxonomy]['sort'] = intval($input[$taxonomy]['sort']);
80
+ $input[$taxonomy]['show_admin_column'] = intval($input[$taxonomy]['show_admin_column']);
81
+ $input[$taxonomy]['show_in_nav_menus'] = intval($input[$taxonomy]['show_in_nav_menus']);
82
+ $input[$taxonomy]['assigned'] = intval($input[$taxonomy]['assigned']);
83
+ $input[$taxonomy]['admin_filter'] = intval($input[$taxonomy]['admin_filter']);
84
+ $input[$taxonomy]['media_uploader_filter'] = intval($input[$taxonomy]['media_uploader_filter']);
85
+
86
+ if ( isset($params['labels']) )
87
+ {
88
+ $default_labels = array(
89
+ 'menu_name' => $params['labels']['name'],
90
+ 'all_items' => 'All ' . $params['labels']['name'],
91
+ 'edit_item' => 'Edit ' . $params['labels']['singular_name'],
92
+ 'view_item' => 'View ' . $params['labels']['singular_name'],
93
+ 'update_item' => 'Update ' . $params['labels']['singular_name'],
94
+ 'add_new_item' => 'Add New ' . $params['labels']['singular_name'],
95
+ 'new_item_name' => 'New ' . $params['labels']['singular_name'] . ' Name',
96
+ 'parent_item' => 'Parent ' . $params['labels']['singular_name'],
97
+ 'search_items' => 'Search ' . $params['labels']['name']
98
+ );
99
+
100
+ foreach ( $params['labels'] as $label => $value )
101
+ {
102
+ $input[$taxonomy]['labels'][$label] = sanitize_text_field($value);
103
+
104
+ if ( empty($value) && isset($default_labels[$label]) )
105
+ {
106
+ $input[$taxonomy]['labels'][$label] = sanitize_text_field($default_labels[$label]);
107
+ }
108
+ }
109
+ }
110
+
111
+ if ( isset($params['rewrite']['slug']) )
112
+ $input[$taxonomy]['rewrite']['slug'] = sanitize_key($params['rewrite']['slug']);
113
+ }
114
+
115
+ return $input;
116
+ }
117
+
118
+
119
+
120
+
121
+ /**
122
+ * wpuxss_eml_ajax_query_attachments
123
+ *
124
+ * Based on /wp-admin/includes/ajax-actions.php
125
+ *
126
+ * @since 1.0
127
+ * @created 03/08/13
128
+ */
129
+
130
+ add_action( 'wp_ajax_query-attachments', 'wpuxss_eml_ajax_query_attachments', 0 );
131
+
132
+ function wpuxss_eml_ajax_query_attachments()
133
+ {
134
+ if ( ! current_user_can( 'upload_files' ) )
135
+ wp_send_json_error();
136
+
137
+ $taxonomies = get_object_taxonomies('attachment','names');
138
+
139
+ $query = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array();
140
+
141
+ $defaults = array(
142
+ 's', 'order', 'orderby', 'posts_per_page', 'paged', 'post_mime_type',
143
+ 'post_parent', 'post__in', 'post__not_in'
144
+ );
145
+ $query = array_intersect_key( $query, array_flip( array_merge($defaults, $taxonomies) ) );
146
+
147
+ $query['post_type'] = 'attachment';
148
+ $query['post_status'] = 'inherit';
149
+ if ( current_user_can( get_post_type_object( 'attachment' )->cap->read_private_posts ) )
150
+ $query['post_status'] .= ',private';
151
+
152
+ $query['tax_query'] = array( 'relation' => 'AND' );
153
+
154
+ foreach ( $taxonomies as $taxonomy )
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 ( 'upload.php' == $pagenow )
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 ( 'upload.php' == $pagenow )
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
+ * Based on /wp-admin/includes/media.php
294
+ *
295
+ * @since 1.0
296
+ * @created 14/08/13
297
+ */
298
+
299
+ add_filter( 'attachment_fields_to_edit', 'wpuxss_eml_attachment_fields_to_edit', 10, 2 );
300
+
301
+ function wpuxss_eml_attachment_fields_to_edit( $form_fields, $post )
302
+ {
303
+ foreach ( get_attachment_taxonomies($post->ID) as $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
+ $t['show_in_edit'] = false;
314
+
315
+ if ( $t['hierarchical'] )
316
+ {
317
+ ob_start();
318
+
319
+ wp_terms_checklist( $post->ID, array( 'taxonomy' => $taxonomy, 'checked_ontop' => false, 'walker' => new Walker_Media_Taxonomy_Checklist() ) );
320
+
321
+ if ( ob_get_contents() != false )
322
+ $html = '<ul class="term-list">' . ob_get_contents() . '</ul>';
323
+ else
324
+ $html = '<ul class="term-list"><li>No ' . $t['label'] . '</li></ul>';
325
+
326
+ ob_end_clean();
327
+
328
+ $t['input'] = 'html';
329
+ $t['html'] = $html;
330
+ }
331
+
332
+ $form_fields[$taxonomy] = $t;
333
+ }
334
+
335
+ return $form_fields;
336
+ }
337
+
338
+
339
+
340
+
341
+ /**
342
+ * Walker_Media_Taxonomy_Checklist
343
+ *
344
+ * Based on /wp-includes/category-template.php
345
+ *
346
+ * @since 1.0
347
+ * @created 09/09/13
348
+ */
349
+
350
+ class Walker_Media_Taxonomy_Checklist extends Walker
351
+ {
352
+ var $tree_type = 'category';
353
+ var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
354
+
355
+ function start_lvl( &$output, $depth = 0, $args = array() )
356
+ {
357
+ $indent = str_repeat("\t", $depth);
358
+ $output .= "$indent<ul class='children'>\n";
359
+ }
360
+
361
+ function end_lvl( &$output, $depth = 0, $args = array() )
362
+ {
363
+ $indent = str_repeat("\t", $depth);
364
+ $output .= "$indent</ul>\n";
365
+ }
366
+
367
+ function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 )
368
+ {
369
+ extract($args);
370
+
371
+ if ( empty($taxonomy) )
372
+ $taxonomy = 'category';
373
+
374
+ $name = 'tax_input['.$taxonomy.']';
375
+
376
+ $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
377
+ $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>';
378
+ }
379
+
380
+ function end_el( &$output, $category, $depth = 0, $args = array() )
381
+ {
382
+ $output .= "</li>\n";
383
+ }
384
+ }
385
+
386
+
387
+
388
+
389
+ /**
390
+ * Walker_Media_Taxonomy_Uploader_Filter
391
+ *
392
+ * Based on /wp-includes/category-template.php
393
+ *
394
+ * @since 1.0.1
395
+ * @created 05/11/13
396
+ */
397
+
398
+ class Walker_Media_Taxonomy_Uploader_Filter extends Walker
399
+ {
400
+ var $tree_type = 'category';
401
+ var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
402
+
403
+ function start_lvl( &$output, $depth = 0, $args = array() )
404
+ {
405
+ $output .= "";
406
+ }
407
+
408
+ function end_lvl( &$output, $depth = 0, $args = array() )
409
+ {
410
+ $output .= "";
411
+ }
412
+
413
+ function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 )
414
+ {
415
+ extract($args);
416
+
417
+ $indent = str_repeat('&nbsp;&nbsp;&nbsp;', $depth);
418
+ $output .= $category->term_id . '>' . $indent . esc_html( apply_filters('the_category', $category->name )) . '|';
419
+ }
420
+
421
+ function end_el( &$output, $category, $depth = 0, $args = array() )
422
+ {
423
+ $output .= "";
424
+ }
425
+ }
426
+
427
+
428
+
429
+
430
+
431
+ /**
432
+ * wpuxss_eml_save_attachment_compat
433
+ *
434
+ * Based on /wp-admin/includes/ajax-actions.php
435
+ *
436
+ * @since 1.0.6
437
+ * @created 06/14/14
438
+ */
439
+
440
+ add_action( 'wp_ajax_save-attachment-compat', 'wpuxss_eml_save_attachment_compat', 0 );
441
+
442
+ function wpuxss_eml_save_attachment_compat()
443
+ {
444
+ if ( ! isset( $_REQUEST['id'] ) )
445
+ wp_send_json_error();
446
+
447
+ if ( ! $id = absint( $_REQUEST['id'] ) )
448
+ wp_send_json_error();
449
+
450
+ if ( empty( $_REQUEST['attachments'] ) || empty( $_REQUEST['attachments'][ $id ] ) )
451
+ wp_send_json_error();
452
+ $attachment_data = $_REQUEST['attachments'][ $id ];
453
+
454
+ check_ajax_referer( 'update-post_' . $id, 'nonce' );
455
+
456
+ if ( ! current_user_can( 'edit_post', $id ) )
457
+ wp_send_json_error();
458
+
459
+ $post = get_post( $id, ARRAY_A );
460
+
461
+ if ( 'attachment' != $post['post_type'] )
462
+ wp_send_json_error();
463
+
464
+ /** This filter is documented in wp-admin/includes/media.php */
465
+ $post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data );
466
+
467
+ if ( isset( $post['errors'] ) ) {
468
+ $errors = $post['errors']; // @todo return me and display me!
469
+ unset( $post['errors'] );
470
+ }
471
+
472
+ wp_update_post( $post );
473
+
474
+ foreach ( get_attachment_taxonomies( $post ) as $taxonomy )
475
+ {
476
+ if ( isset( $attachment_data[ $taxonomy ] ) )
477
+ wp_set_object_terms( $id, array_map( 'trim', preg_split( '/,+/', $attachment_data[ $taxonomy ] ) ), $taxonomy, false );
478
+ else if ( isset($_REQUEST['tax_input']) && isset( $_REQUEST['tax_input'][ $taxonomy ] ) )
479
+ wp_set_object_terms( $id, $_REQUEST['tax_input'][ $taxonomy ], $taxonomy, false );
480
+ else
481
+ wp_set_object_terms( $id, '', $taxonomy, false );
482
+ }
483
+
484
+ if ( ! $attachment = wp_prepare_attachment_for_js( $id ) )
485
+ wp_send_json_error();
486
+
487
+ wp_send_json_success( $attachment );
488
+ }
489
+
490
+
491
+
492
+
493
+ /**
494
+ * wpuxss_eml_pre_get_posts
495
+ *
496
+ * Taxonomy archive specific query (front-end)
497
+ *
498
+ * @since 1.0
499
+ * @created 03/08/13
500
+ */
501
+
502
+ add_action( 'pre_get_posts', 'wpuxss_eml_pre_get_posts', 99 );
503
+
504
+ function wpuxss_eml_pre_get_posts( $query )
505
+ {
506
+ $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
507
+
508
+ if ( is_array($wpuxss_eml_taxonomies) )
509
+ {
510
+ foreach ( $wpuxss_eml_taxonomies as $taxonomy => $params )
511
+ {
512
+ if ( $params['assigned'] && $params['eml_media'] && $query->is_main_query() && is_tax($taxonomy) && !is_admin() )
513
+ {
514
+ $query->set( 'post_type', 'attachment' );
515
+ $query->set( 'post_status', 'inherit' );
516
+ }
517
+ }
518
+ }
519
+ }
520
+
 
 
 
 
 
 
 
 
 
 
521
  ?>
css/eml-admin.css CHANGED
@@ -1,262 +1,303 @@
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
-
35
- /* == Media Uploader Boxes' Positions == */
36
-
37
- .attachments-browser .media-toolbar {
38
- height: auto;
39
- position: relative;
40
- margin-right: 300px;
41
- }
42
- .attachments-browser .media-toolbar-primary,
43
- .attachments-browser .media-toolbar-secondary {
44
- float: none;
45
- height: auto;
46
- }
47
- .attachments-browser .media-toolbar-secondary select,
48
- .attachments-browser .media-toolbar-secondary .instructions {
49
- float: left;
50
- }
51
- .media-frame .spinner {
52
- float: none;
53
- position: absolute;
54
- z-index: 100;
55
- top: 0;
56
- right: 10px;
57
- }
58
-
59
- @media only screen and (max-width: 900px)
60
- {
61
- .attachments-browser .media-toolbar {
62
- margin-right: 180px;
63
- height: auto;
64
- }
65
- }
66
-
67
- @media only screen and (max-width: 640px), screen and (max-height: 400px)
68
- {
69
- .attachments-browser .attachments {
70
- top: 20px;
71
- }
72
- .media-frame .attachments-browser {
73
- padding-bottom: 20px;
74
- height: auto;
75
- }
76
- .media-sidebar .attachment-details h3 {
77
- margin-top: 24px;
78
- }
79
- }
80
-
81
-
82
- /* == MIME types Option Page Styles == */
83
-
84
- .wpuxss-eml-mime-type-list {
85
- table-layout: fixed;
86
- }
87
- .wpuxss-eml-mime-type-list td {
88
- padding: 8px 7px;
89
- }
90
- .wpuxss-eml-mime-type-list .checkbox_td {
91
- text-align: center;
92
- }
93
- .wpuxss-eml-mime-type-list input[type="text"] {
94
- width: 120px;
95
- }
96
- .wpuxss-eml-column-extension {
97
- width: 130px;
98
- }
99
- .wpuxss-eml-column-singular,
100
- .wpuxss-eml-column-plural {
101
- width:120px;
102
- }
103
- .wpuxss-eml-column-filter {
104
- width: 70px;
105
- }
106
- .wpuxss-eml-column-upload {
107
- width: 90px;
108
- }
109
- .wpuxss-eml-column-delete {
110
- width: 30px;
111
- }
112
-
113
-
114
- /* == Taxonomies Option Page Styles == */
115
-
116
- .wpuxss-eml-settings-list {
117
- border-top: 1px solid #dfdfdf;
118
- }
119
- .wpuxss-eml-settings-list > li {
120
- border-bottom: 1px solid #dfdfdf;
121
- padding: 8px 7px;
122
- margin: 0;
123
- position: relative;
124
- overflow: hidden;
125
- }
126
- .wpuxss-eml-settings-list > li > label {
127
- font-size: 14px;
128
- display: inline-block;
129
- margin-right: 100px;
130
- }
131
- .wpuxss-eml-settings-list input {
132
- margin: 0;
133
- }
134
- .wpuxss-eml-settings-list > li .wpuxss-eml-button-edit {
135
- position: absolute;
136
- right: 40px;
137
- top: 7px;
138
- text-decoration: none;
139
- height: 14px;
140
- line-height: 14px;
141
- border-radius: 10px;
142
- box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
143
- padding: 3px 10px;
144
- }
145
- .wpuxss-eml-settings-list.wpuxss-eml-non-media-taxonomy-list > li .wpuxss-eml-button-edit {
146
- right: 10px;
147
- }
148
- .wpuxss-eml-settings-list > li .wpuxss-eml-button-remove {
149
- position: absolute;
150
- right: 10px;
151
- top: 7px;
152
- }
153
- .wpuxss-eml-settings-list .wpuxss-eml-assigned {
154
- margin-right:10px;
155
- }
156
-
157
- .wpuxss-eml-taxonomy-edit label {
158
- display: inline-block;
159
- width: 160px;
160
- }
161
- .wpuxss-eml-taxonomy-edit .wpuxss-eml-labels-edit {
162
- float: left;
163
- width: 49%;
164
- margin-right: 1%;
165
- }
166
- .wpuxss-eml-taxonomy-edit .wpuxss-eml-settings-edit {
167
- float: left;
168
- width: 49%;
169
- margin-left: 1%;
170
- }
171
- .wpuxss-eml-taxonomy-edit .wpuxss-eml-settings-edit li {
172
- padding: 3px 0;
173
- }
174
- .wpuxss-eml-taxonomy-edit .wpuxss-eml-labels-edit label {
175
- display: inline-block;
176
- width: 100px;
177
- }
178
- .wpuxss-eml-taxonomy-edit .wpuxss-eml-labels-edit input {
179
- min-width: 150px;
180
- }
181
-
182
-
183
- /* == Buttons Styles == */
184
-
185
- .wpuxss-eml-button-remove {
186
- display: inline-block;
187
- text-align: center;
188
- text-decoration: none;
189
- line-height: 1em;
190
- font-size: 18px;
191
- font-family: Arial, Helvetica, sans-serif;
192
- height: 20px;
193
- width: 20px;
194
- border-radius: 10px;
195
- box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
196
- }
197
- .wpuxss-eml-button-remove:hover {
198
- box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
199
- }
200
- .wpuxss-eml-button-container-right {
201
- text-align: right;
202
- margin: 20px 0 0;
203
- }
204
-
205
-
206
- /* == Option Page Generic Styles == */
207
-
208
- #toplevel_page_media-library .wp-menu-image {
209
- background-position: -119px -33px !important;
210
- }
211
-
212
- #wpuxss-eml-global-options-wrap .postbox {
213
- background-image:none !important;
214
- background-color:#f9f9f9 !important;
215
- position: relative;
216
- }
217
-
218
- #wpuxss-eml-global-options-wrap .postbox#wpuxss-credits {
219
- background-color: #fff !important;
220
- }
221
- #wpuxss-credits .author {
222
- font-style: italic;
223
- margin: 30px 0 0;
224
- padding: 10px 0 5px;
225
- border-top: 1px solid #e0e5e9;
226
- }
227
- #wpuxss-credits .logo-webbistro {
228
- font-style: italic;
229
- text-decoration: none;
230
- }
231
- #wpuxss-credits .icon-webbistro {
232
- font-family: 'webbistro';
233
- speak: none;
234
- font-style: normal;
235
- font-weight: normal;
236
- font-variant: normal;
237
- text-transform: none;
238
- line-height: 1;
239
- -webkit-font-smoothing: antialiased;
240
- }
241
- #wpuxss-credits h4 {
242
- margin: 20px 0 4px;
243
- }
244
- #wpuxss-credits p,
245
- #wpuxss-credits ul {
246
- margin-top: 0;
247
- }
248
- #wpuxss-credits li {
249
- list-style: disc;
250
- margin-left: 1.4em;
251
- }
252
-
253
- @font-face {
254
- font-family: 'webbistro';
255
- src:url('../fonts/webbistro.eot');
256
- src:url('../fonts/webbistro.eot?#iefix') format('embedded-opentype'),
257
- url('../fonts/webbistro.woff') format('woff'),
258
- url('../fonts/webbistro.ttf') format('truetype'),
259
- url('../fonts/webbistro.svg#webbistro') format('svg');
260
- font-weight: normal;
261
- font-style: normal;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  }
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
+ height: 28px;
30
+ }
31
+
32
+
33
+ /* == Media Uploader Boxes' Positions == */
34
+
35
+ .attachments-browser .media-toolbar {
36
+ height: auto;
37
+ position: relative;
38
+ margin-right: 300px;
39
+ }
40
+ .attachments-browser .media-toolbar.wp-filter {
41
+ margin-right: 0;
42
+ }
43
+ .attachments-browser .media-toolbar .media-toolbar-primary,
44
+ .attachments-browser .media-toolbar .search-form {
45
+ float: none;
46
+ height: auto;
47
+ }
48
+ .attachments-browser .media-toolbar.wp-filter .search-form input[type=search] {
49
+ margin: 0 10px 10px 0;
50
+ }
51
+ .attachments-browser .media-toolbar .media-toolbar-secondary select,
52
+ .attachments-browser .media-toolbar .media-toolbar-secondary .instructions {
53
+ float: left;
54
+ }
55
+ .attachments-browser .media-toolbar .media-toolbar-secondary select {
56
+ margin-top: 11px;
57
+ margin-right: 10px;
58
+ max-width: 140px;
59
+ }
60
+ .attachments-browser .media-toolbar.wp-filter .media-toolbar-secondary select,
61
+ .attachments-browser .media-toolbar.wp-filter .media-toolbar-secondary .instructions {
62
+ float: none;
63
+ }
64
+ .attachments-browser .media-toolbar.wp-filter .media-toolbar-secondary select {
65
+ margin: 0 10px 0 0;
66
+ }
67
+
68
+ .media-frame .spinner,
69
+ .media-modal .attachments-browser .media-toolbar .spinner {
70
+ float: none;
71
+ position: absolute;
72
+ z-index: 100;
73
+ top: 0;
74
+ right: 10px;
75
+ }
76
+
77
+ @media only screen and (max-width: 900px)
78
+ {
79
+ .media-modal .attachments-browser .media-toolbar {
80
+ margin-right: 262px;
81
+ height: auto;
82
+ }
83
+
84
+ .media-modal .attachments-browser .media-toolbar-primary,
85
+ .media-modal .attachments-browser .media-toolbar-secondary {
86
+ width: auto;
87
+ }
88
+ .media-modal .attachments-browser .media-toolbar .attachment-filters {
89
+ margin-top: 11px;
90
+ margin-right: 10px;
91
+ height: 28px;
92
+ }
93
+ .media-modal .attachments-browser .media-toolbar .search {
94
+ float: none;
95
+ }
96
+ }
97
+
98
+ @media only screen and (max-width: 640px), screen and (max-height: 400px)
99
+ {
100
+ .attachments-browser .attachments {
101
+ top: 20px;
102
+ position: relative;
103
+ margin-right: 262px;
104
+ }
105
+ .media-frame .attachments-browser {
106
+ padding-bottom: 20px;
107
+ height: auto;
108
+ }
109
+ .media-sidebar .attachment-details h3 {
110
+ margin-top: 24px;
111
+ }
112
+ }
113
+
114
+ /*@media only screen and (max-width: 1120px)
115
+ {
116
+ .attachments-browser .media-toolbar.wp-filter .search-form {
117
+ float: none;
118
+ margin: 20px 0;
119
+ }
120
+ }*/
121
+
122
+
123
+ /* == MIME types Option Page Styles == */
124
+
125
+ .wpuxss-eml-mime-type-list {
126
+ table-layout: fixed;
127
+ }
128
+ .wpuxss-eml-mime-type-list td {
129
+ padding: 8px 7px;
130
+ }
131
+ .wpuxss-eml-mime-type-list .checkbox_td {
132
+ text-align: center;
133
+ }
134
+ .wpuxss-eml-mime-type-list input[type="text"] {
135
+ width: 120px;
136
+ }
137
+ .wpuxss-eml-column-extension {
138
+ width: 130px;
139
+ }
140
+ .wpuxss-eml-column-singular,
141
+ .wpuxss-eml-column-plural {
142
+ width:120px;
143
+ }
144
+ .wpuxss-eml-column-filter {
145
+ width: 70px;
146
+ }
147
+ .wpuxss-eml-column-upload {
148
+ width: 90px;
149
+ }
150
+ .wpuxss-eml-column-delete {
151
+ width: 30px;
152
+ }
153
+
154
+
155
+ /* == Taxonomies Option Page Styles == */
156
+
157
+ .wpuxss-eml-settings-list {
158
+ border-top: 1px solid #dfdfdf;
159
+ }
160
+ .wpuxss-eml-settings-list > li {
161
+ border-bottom: 1px solid #dfdfdf;
162
+ padding: 8px 7px;
163
+ margin: 0;
164
+ position: relative;
165
+ overflow: hidden;
166
+ }
167
+ .wpuxss-eml-settings-list > li > label {
168
+ font-size: 14px;
169
+ display: inline-block;
170
+ margin-right: 100px;
171
+ }
172
+ .wpuxss-eml-settings-list input {
173
+ margin: 0;
174
+ }
175
+ .wpuxss-eml-settings-list > li .wpuxss-eml-button-edit {
176
+ position: absolute;
177
+ right: 40px;
178
+ top: 7px;
179
+ text-decoration: none;
180
+ height: 14px;
181
+ line-height: 14px;
182
+ border-radius: 10px;
183
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
184
+ padding: 3px 10px;
185
+ }
186
+ .wpuxss-eml-settings-list.wpuxss-eml-non-media-taxonomy-list > li .wpuxss-eml-button-edit {
187
+ right: 10px;
188
+ }
189
+ .wpuxss-eml-settings-list > li .wpuxss-eml-button-remove {
190
+ position: absolute;
191
+ right: 10px;
192
+ top: 7px;
193
+ }
194
+ .wpuxss-eml-settings-list .wpuxss-eml-assigned {
195
+ margin-right:10px;
196
+ }
197
+
198
+ .wpuxss-eml-taxonomy-edit label {
199
+ display: inline-block;
200
+ width: 210px;
201
+ }
202
+ .wpuxss-eml-taxonomy-edit .wpuxss-eml-labels-edit {
203
+ float: left;
204
+ width: 49%;
205
+ margin-right: 1%;
206
+ }
207
+ .wpuxss-eml-taxonomy-edit .wpuxss-eml-settings-edit {
208
+ float: left;
209
+ width: 49%;
210
+ margin-left: 1%;
211
+ }
212
+ .wpuxss-eml-taxonomy-edit .wpuxss-eml-settings-edit li {
213
+ padding: 3px 0;
214
+ }
215
+ .wpuxss-eml-taxonomy-edit .wpuxss-eml-labels-edit label {
216
+ display: inline-block;
217
+ width: 100px;
218
+ }
219
+ .wpuxss-eml-taxonomy-edit .wpuxss-eml-labels-edit input {
220
+ min-width: 150px;
221
+ }
222
+
223
+
224
+ /* == Buttons Styles == */
225
+
226
+ .wpuxss-eml-button-remove {
227
+ display: inline-block;
228
+ text-align: center;
229
+ text-decoration: none;
230
+ line-height: 1em;
231
+ font-size: 18px;
232
+ font-family: Arial, Helvetica, sans-serif;
233
+ height: 20px;
234
+ width: 20px;
235
+ border-radius: 10px;
236
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
237
+ }
238
+ .wpuxss-eml-button-remove:hover {
239
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
240
+ }
241
+ .wpuxss-eml-button-container-right {
242
+ text-align: right;
243
+ margin: 20px 0 0;
244
+ }
245
+
246
+
247
+ /* == Option Page Generic Styles == */
248
+
249
+ #toplevel_page_media-library .wp-menu-image {
250
+ background-position: -119px -33px !important;
251
+ }
252
+
253
+ #wpuxss-eml-global-options-wrap .postbox {
254
+ background-image:none !important;
255
+ background-color:#f9f9f9 !important;
256
+ position: relative;
257
+ }
258
+
259
+ #wpuxss-eml-global-options-wrap .postbox#wpuxss-credits {
260
+ background-color: #fff !important;
261
+ }
262
+ #wpuxss-credits .author {
263
+ font-style: italic;
264
+ margin: 30px 0 0;
265
+ padding: 10px 0 5px;
266
+ border-top: 1px solid #e0e5e9;
267
+ }
268
+ #wpuxss-credits .logo-webbistro {
269
+ font-style: italic;
270
+ text-decoration: none;
271
+ }
272
+ #wpuxss-credits .icon-webbistro {
273
+ font-family: 'webbistro';
274
+ speak: none;
275
+ font-style: normal;
276
+ font-weight: normal;
277
+ font-variant: normal;
278
+ text-transform: none;
279
+ line-height: 1;
280
+ -webkit-font-smoothing: antialiased;
281
+ }
282
+ #wpuxss-credits h4 {
283
+ margin: 20px 0 4px;
284
+ }
285
+ #wpuxss-credits p,
286
+ #wpuxss-credits ul {
287
+ margin-top: 0;
288
+ }
289
+ #wpuxss-credits li {
290
+ list-style: disc;
291
+ margin-left: 1.4em;
292
+ }
293
+
294
+ @font-face {
295
+ font-family: 'webbistro';
296
+ src:url('../fonts/webbistro.eot');
297
+ src:url('../fonts/webbistro.eot?#iefix') format('embedded-opentype'),
298
+ url('../fonts/webbistro.woff') format('woff'),
299
+ url('../fonts/webbistro.ttf') format('truetype'),
300
+ url('../fonts/webbistro.svg#webbistro') format('svg');
301
+ font-weight: normal;
302
+ font-style: normal;
303
  }
enhanced-media-library.php CHANGED
@@ -1,417 +1,406 @@
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.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.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
-
180
- function wpuxss_eml_on_admin_init()
181
- {
182
-
183
- // plugin settings: taxonomies
184
- register_setting(
185
- 'wpuxss_eml_taxonomies', //option_group
186
- 'wpuxss_eml_taxonomies', //option_name
187
- 'wpuxss_eml_taxonomies_validate' //sanitize_callback
188
- );
189
-
190
- // plugin settings: mime types
191
- register_setting(
192
- 'wpuxss_eml_mimes', //option_group
193
- 'wpuxss_eml_mimes', //option_name
194
- 'wpuxss_eml_mimes_validate' //sanitize_callback
195
- );
196
-
197
- // plugin settings: mime types backup
198
- register_setting(
199
- 'wpuxss_eml_mimes_backup', //option_group
200
- 'wpuxss_eml_mimes_backup' //option_name
201
- );
202
- }
203
-
204
-
205
-
206
-
207
- /**
208
- * wpuxss_eml_admin_enqueue_scripts
209
- *
210
- * @since 1.1.1
211
- * @created 07/04/14
212
- */
213
-
214
- add_action( 'admin_enqueue_scripts', 'wpuxss_eml_admin_enqueue_scripts' );
215
-
216
- function wpuxss_eml_admin_enqueue_scripts()
217
- {
218
- global $wpuxss_eml_version,
219
- $wpuxss_eml_dir,
220
- $pagenow;
221
-
222
-
223
- // generic scripts
224
- wp_enqueue_script(
225
- 'wpuxss-eml-media-models-script',
226
- $wpuxss_eml_dir . 'js/eml-media-models.js',
227
- array('jquery','backbone','media-models'),
228
- $wpuxss_eml_version,
229
- true
230
- );
231
-
232
- wp_enqueue_script(
233
- 'wpuxss-eml-media-views-script',
234
- $wpuxss_eml_dir . 'js/eml-media-views.js',
235
- array('jquery','backbone','media-views'),
236
- $wpuxss_eml_version,
237
- true
238
- );
239
-
240
-
241
- // pass taxonomies to media uploader's filter
242
- $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
243
- if ( empty($wpuxss_eml_taxonomies) ) $wpuxss_eml_taxonomies = array();
244
-
245
- $taxonomies_array = array();
246
- foreach ( get_object_taxonomies('attachment','object') as $taxonomy )
247
- {
248
- $terms_array = array();
249
- $terms = array();
250
-
251
- if ( $wpuxss_eml_taxonomies[$taxonomy->name]['media_uploader_filter'] )
252
- {
253
-
254
- ob_start();
255
-
256
- wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'checked_ontop' => false, 'walker' => new Walker_Media_Taxonomy_Uploader_Filter() ) );
257
-
258
- $html = '';
259
- if ( ob_get_contents() != false )
260
- $html = ob_get_contents();
261
-
262
- ob_end_clean();
263
-
264
- $terms = array_filter( explode('|', $html) );
265
-
266
- if ( !empty($terms) )
267
- {
268
- foreach ($terms as $term)
269
- {
270
- $term = explode('>', $term);
271
- array_push($terms_array, array('term_id' => $term[0], 'term_name' => $term[1]));
272
- }
273
- $taxonomies_array[$taxonomy->name] = array(
274
- 'list_title' => $taxonomy->labels->all_items,
275
- 'term_list' => $terms_array
276
- );
277
- }
278
- }
279
- }
280
-
281
- wp_localize_script(
282
- 'wpuxss-eml-media-views-script',
283
- 'wpuxss_eml_taxonomies',
284
- $taxonomies_array
285
- );
286
-
287
-
288
- // Filters for /wp-admin/theme.php
289
- if ( 'themes.php' == $pagenow )
290
- {
291
- wp_enqueue_script(
292
- 'wpuxss-eml-custom-header-script',
293
- $wpuxss_eml_dir . 'js/eml-custom-header.js',
294
- array('jquery','backbone','custom-header'),
295
- $wpuxss_eml_version,
296
- true
297
- );
298
-
299
- wp_enqueue_script(
300
- 'wpuxss-eml-custom-background-script',
301
- $wpuxss_eml_dir . 'js/eml-custom-background.js',
302
- array('jquery','backbone','custom-background'),
303
- $wpuxss_eml_version,
304
- true
305
- );
306
- }
307
-
308
-
309
- // admin styles
310
- wp_enqueue_style(
311
- 'wpuxss-eml-admin-custom-style',
312
- $wpuxss_eml_dir . 'css/eml-admin.css',
313
- array('media-views'),
314
- $wpuxss_eml_version,
315
- 'all'
316
- );
317
-
318
- }
319
-
320
-
321
-
322
-
323
- /**
324
- * wpuxss_eml_customize_controls_scripts
325
- *
326
- * Filters for /wp-admin/customize.php
327
- *
328
- * @since 1.1.1
329
- * @created 07/04/14
330
- */
331
-
332
- add_action( 'customize_controls_enqueue_scripts', 'wpuxss_eml_customize_controls_scripts' );
333
-
334
- function wpuxss_eml_customize_controls_scripts()
335
- {
336
- global $wpuxss_eml_version,
337
- $wpuxss_eml_dir;
338
-
339
- wp_enqueue_script(
340
- 'wpuxss-eml-customize-controls-script',
341
- $wpuxss_eml_dir . 'js/eml-customize-controls.js',
342
- array('jquery','backbone','customize-controls'),
343
- $wpuxss_eml_version,
344
- true
345
- );
346
- }
347
-
348
-
349
-
350
-
351
- /**
352
- * wpuxss_eml_on_activation
353
- *
354
- * @since 1.0
355
- * @created 28/09/13
356
- */
357
-
358
- function wpuxss_eml_on_activation()
359
- {
360
- global $wpuxss_eml_version, $wpuxss_eml_old_version;
361
-
362
- if( $wpuxss_eml_version != $wpuxss_eml_old_version )
363
- update_option('wpuxss_eml_version', $wpuxss_eml_version );
364
-
365
- if( empty($wpuxss_eml_old_version) || $wpuxss_eml_old_version == '0.0.3' )
366
- {
367
- $wpuxss_eml_taxonomies['media_category'] = array(
368
- 'assigned' => 1,
369
- 'eml_media' => 1,
370
- 'admin_filter' => 1,
371
- 'media_uploader_filter' => 1,
372
- 'labels' => array(
373
- 'name' => 'Media Categories',
374
- 'singular_name' => 'Media Category',
375
- 'menu_name' => 'Media Categories',
376
- 'all_items' => 'All Media Categories',
377
- 'edit_item' => 'Edit Media Category',
378
- 'view_item' => 'View Media Category',
379
- 'update_item' => 'Update Media Category',
380
- 'add_new_item' => 'Add New Media Category',
381
- 'new_item_name' => 'New Media Category Name',
382
- 'parent_item' => 'Parent Media Category',
383
- 'parent_item_colon' => 'Parent Media Category:',
384
- 'search_items' => 'Search Media Categories'
385
- ),
386
- 'public' => true,
387
- 'show_admin_column' => true,
388
- 'show_in_nav_menus' => true,
389
- 'hierarchical' => true,
390
- 'rewrite' => array( 'slug' => 'media_category' ),
391
- 'sort' => 0
392
- );
393
-
394
- $allowed_mimes = get_allowed_mime_types();
395
-
396
- foreach ( wp_get_mime_types() as $type => $mime )
397
- {
398
- $wpuxss_eml_mimes[$type] = array(
399
- 'mime' => $mime,
400
- 'singular' => $mime,
401
- 'plural' => $mime,
402
- 'filter' => 0,
403
- 'upload' => isset($allowed_mimes[$type]) ? 1 : 0
404
- );
405
- }
406
-
407
- $wpuxss_eml_mimes['pdf']['singular'] = 'PDF';
408
- $wpuxss_eml_mimes['pdf']['plural'] = 'PDFs';
409
- $wpuxss_eml_mimes['pdf']['filter'] = 1;
410
-
411
- update_option( 'wpuxss_eml_taxonomies', $wpuxss_eml_taxonomies );
412
- update_option( 'wpuxss_eml_mimes', $wpuxss_eml_mimes );
413
- update_option( 'wpuxss_eml_mimes_backup', $wpuxss_eml_mimes );
414
- }
415
- }
416
-
417
  ?>
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.2
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.2';
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
+
76
+ // on activation
77
+ wpuxss_eml_on_activation();
78
+
79
+ $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
80
+ if ( empty($wpuxss_eml_taxonomies) ) $wpuxss_eml_taxonomies = array();
81
+
82
+ // register eml taxonomies
83
+ foreach ( $wpuxss_eml_taxonomies as $taxonomy => $params )
84
+ {
85
+ if ( $params['eml_media'] && !empty($params['labels']['singular_name']) && !empty($params['labels']['name']) )
86
+ {
87
+ register_taxonomy(
88
+ $taxonomy,
89
+ 'attachment',
90
+ array(
91
+ 'labels' => $params['labels'],
92
+ 'public' => true,
93
+ 'show_admin_column' => $params['show_admin_column'],
94
+ 'show_in_nav_menus' => $params['show_in_nav_menus'],
95
+ 'hierarchical' => $params['hierarchical'],
96
+ 'update_count_callback' => '_update_generic_term_count',
97
+ 'sort' => $params['sort'],
98
+ 'rewrite' => array( 'slug' => $params['rewrite']['slug'] )
99
+ )
100
+ );
101
+ }
102
+ }
103
+ }
104
+
105
+
106
+
107
+
108
+ /**
109
+ * wpuxss_eml_on_wp_loaded
110
+ *
111
+ * @since 1.0
112
+ * @created 03/11/13
113
+ */
114
+ add_action( 'wp_loaded', 'wpuxss_eml_on_wp_loaded' );
115
+
116
+ function wpuxss_eml_on_wp_loaded()
117
+ {
118
+
119
+ $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
120
+ if ( empty($wpuxss_eml_taxonomies) ) $wpuxss_eml_taxonomies = array();
121
+ $taxonomies = get_taxonomies(array(),'object');
122
+
123
+ // discover 'foreign' taxonomies
124
+ foreach ( $taxonomies as $taxonomy => $params )
125
+ {
126
+ 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' )
127
+ {
128
+ $wpuxss_eml_taxonomies[$taxonomy] = array(
129
+ 'eml_media' => 0,
130
+ 'admin_filter' => 0,
131
+ 'media_uploader_filter' => 0,
132
+ 'show_admin_column' => isset($params->show_admin_column) ? $params->show_admin_column : 0,
133
+ 'show_in_nav_menus' => isset($params->show_in_nav_menus) ? $params->show_in_nav_menus : 0,
134
+ 'hierarchical' => $params->hierarchical ? 1 : 0,
135
+ 'sort' => isset($params->sort) ? $params->sort : 0
136
+ );
137
+
138
+ if ( in_array('attachment',$params->object_type) )
139
+ $wpuxss_eml_taxonomies[$taxonomy]['assigned'] = 1;
140
+ else
141
+ $wpuxss_eml_taxonomies[$taxonomy]['assigned'] = 0;
142
+ }
143
+ }
144
+
145
+ // assign/unassign taxonomies to atachment
146
+ foreach ( $wpuxss_eml_taxonomies as $taxonomy => $params )
147
+ {
148
+ if ( $params['assigned'] )
149
+ register_taxonomy_for_object_type( $taxonomy, 'attachment' );
150
+
151
+ if ( ! $params['assigned'] )
152
+ wpuxss_eml_unregister_taxonomy_for_object_type( $taxonomy, 'attachment' );
153
+ }
154
+
155
+ // update_count_callback for attachment taxonomies if needed
156
+ foreach ( $taxonomies as $taxonomy => $params )
157
+ {
158
+ if ( in_array('attachment',$params->object_type) )
159
+ {
160
+ global $wp_taxonomies;
161
+
162
+ if ( !isset($wp_taxonomies[$taxonomy]->update_count_callback) || empty($wp_taxonomies[$taxonomy]->update_count_callback) )
163
+ $wp_taxonomies[$taxonomy]->update_count_callback = '_update_generic_term_count';
164
+ }
165
+ }
166
+
167
+ update_option( 'wpuxss_eml_taxonomies', $wpuxss_eml_taxonomies );
168
+ }
169
+
170
+
171
+
172
+
173
+ /**
174
+ * wpuxss_eml_on_admin_init
175
+ *
176
+ * @since 1.0
177
+ * @created 03/08/13
178
+ */
179
+
180
+ add_action( 'admin_init', 'wpuxss_eml_on_admin_init' );
181
+
182
+ function wpuxss_eml_on_admin_init()
183
+ {
184
+
185
+ // plugin settings: taxonomies
186
+ register_setting(
187
+ 'wpuxss_eml_taxonomies', //option_group
188
+ 'wpuxss_eml_taxonomies', //option_name
189
+ 'wpuxss_eml_taxonomies_validate' //sanitize_callback
190
+ );
191
+
192
+ // plugin settings: mime types
193
+ register_setting(
194
+ 'wpuxss_eml_mimes', //option_group
195
+ 'wpuxss_eml_mimes', //option_name
196
+ 'wpuxss_eml_mimes_validate' //sanitize_callback
197
+ );
198
+
199
+ // plugin settings: mime types backup
200
+ register_setting(
201
+ 'wpuxss_eml_mimes_backup', //option_group
202
+ 'wpuxss_eml_mimes_backup' //option_name
203
+ );
204
+ }
205
+
206
+
207
+
208
+
209
+ /**
210
+ * wpuxss_eml_admin_enqueue_scripts
211
+ *
212
+ * @since 1.1.1
213
+ * @created 07/04/14
214
+ */
215
+
216
+ add_action( 'admin_enqueue_scripts', 'wpuxss_eml_admin_enqueue_scripts' );
217
+
218
+ function wpuxss_eml_admin_enqueue_scripts()
219
+ {
220
+
221
+ global $wpuxss_eml_version,
222
+ $wpuxss_eml_dir,
223
+ $pagenow;
224
+
225
+
226
+ // generic scripts
227
+ if ( wp_script_is( 'media-editor' ) || wp_script_is( 'media-grid' ) || 'themes.php' == $pagenow || 'customize.php' == $pagenow )
228
+ {
229
+ // taxonomies for passing to media uploader's filter
230
+ $wpuxss_eml_taxonomies = get_option('wpuxss_eml_taxonomies');
231
+ if ( empty($wpuxss_eml_taxonomies) ) $wpuxss_eml_taxonomies = array();
232
+
233
+ $taxonomies_array = array();
234
+ foreach ( get_object_taxonomies('attachment','object') as $taxonomy )
235
+ {
236
+ $terms_array = array();
237
+ $terms = array();
238
+
239
+ if ( $wpuxss_eml_taxonomies[$taxonomy->name]['media_uploader_filter'] )
240
+ {
241
+
242
+ ob_start();
243
+
244
+ wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'checked_ontop' => false, 'walker' => new Walker_Media_Taxonomy_Uploader_Filter() ) );
245
+
246
+ $html = '';
247
+ if ( ob_get_contents() != false )
248
+ $html = ob_get_contents();
249
+
250
+ ob_end_clean();
251
+
252
+ $terms = array_filter( explode('|', $html) );
253
+
254
+ if ( !empty($terms) )
255
+ {
256
+ foreach ($terms as $term)
257
+ {
258
+ $term = explode('>', $term);
259
+ array_push($terms_array, array('term_id' => $term[0], 'term_name' => $term[1]));
260
+ }
261
+ $taxonomies_array[$taxonomy->name] = array(
262
+ 'list_title' => $taxonomy->labels->all_items,
263
+ 'term_list' => $terms_array
264
+ );
265
+ }
266
+ }
267
+ }
268
+
269
+ wp_enqueue_script(
270
+ 'wpuxss-eml-media-models-script',
271
+ $wpuxss_eml_dir . 'js/eml-media-models.js',
272
+ array('media-models'),
273
+ $wpuxss_eml_version,
274
+ true
275
+ );
276
+
277
+ wp_enqueue_script(
278
+ 'wpuxss-eml-media-views-script',
279
+ $wpuxss_eml_dir . 'js/eml-media-views.js',
280
+ array('media-views'),
281
+ $wpuxss_eml_version,
282
+ true
283
+ );
284
+
285
+ wp_localize_script(
286
+ 'wpuxss-eml-media-views-script',
287
+ 'wpuxss_eml_taxonomies',
288
+ $taxonomies_array
289
+ );
290
+ }
291
+
292
+
293
+ // scripts for /wp-admin/theme.php
294
+ if ( 'themes.php' == $pagenow )
295
+ {
296
+ wp_enqueue_script(
297
+ 'wpuxss-eml-custom-header-script',
298
+ $wpuxss_eml_dir . 'js/eml-custom-header.js',
299
+ array('custom-header'),
300
+ $wpuxss_eml_version,
301
+ true
302
+ );
303
+
304
+ wp_enqueue_script(
305
+ 'wpuxss-eml-custom-background-script',
306
+ $wpuxss_eml_dir . 'js/eml-custom-background.js',
307
+ array('custom-background'),
308
+ $wpuxss_eml_version,
309
+ true
310
+ );
311
+ }
312
+
313
+
314
+ // scripts for /wp-admin/customize.php
315
+ if ( 'customize.php' == $pagenow )
316
+ {
317
+ wp_enqueue_script(
318
+ 'wpuxss-eml-customize-controls-script',
319
+ $wpuxss_eml_dir . 'js/eml-customize-controls.js',
320
+ array('customize-controls'),
321
+ $wpuxss_eml_version,
322
+ true
323
+ );
324
+ }
325
+
326
+
327
+ // admin styles
328
+ wp_enqueue_style(
329
+ 'wpuxss-eml-admin-custom-style',
330
+ $wpuxss_eml_dir . 'css/eml-admin.css',
331
+ array('media-views'),
332
+ $wpuxss_eml_version,
333
+ 'all'
334
+ );
335
+ }
336
+
337
+
338
+
339
+
340
+ /**
341
+ * wpuxss_eml_on_activation
342
+ *
343
+ * @since 1.0
344
+ * @created 28/09/13
345
+ */
346
+
347
+ function wpuxss_eml_on_activation()
348
+ {
349
+ global $wpuxss_eml_version, $wpuxss_eml_old_version;
350
+
351
+ if( $wpuxss_eml_version != $wpuxss_eml_old_version )
352
+ update_option('wpuxss_eml_version', $wpuxss_eml_version );
353
+
354
+ if( empty($wpuxss_eml_old_version) || $wpuxss_eml_old_version == '0.0.3' )
355
+ {
356
+ $wpuxss_eml_taxonomies['media_category'] = array(
357
+ 'assigned' => 1,
358
+ 'eml_media' => 1,
359
+ 'admin_filter' => 1,
360
+ 'media_uploader_filter' => 1,
361
+ 'labels' => array(
362
+ 'name' => 'Media Categories',
363
+ 'singular_name' => 'Media Category',
364
+ 'menu_name' => 'Media Categories',
365
+ 'all_items' => 'All Media Categories',
366
+ 'edit_item' => 'Edit Media Category',
367
+ 'view_item' => 'View Media Category',
368
+ 'update_item' => 'Update Media Category',
369
+ 'add_new_item' => 'Add New Media Category',
370
+ 'new_item_name' => 'New Media Category Name',
371
+ 'parent_item' => 'Parent Media Category',
372
+ 'parent_item_colon' => 'Parent Media Category:',
373
+ 'search_items' => 'Search Media Categories'
374
+ ),
375
+ 'public' => true,
376
+ 'show_admin_column' => true,
377
+ 'show_in_nav_menus' => true,
378
+ 'hierarchical' => true,
379
+ 'rewrite' => array( 'slug' => 'media_category' ),
380
+ 'sort' => 0
381
+ );
382
+
383
+ $allowed_mimes = get_allowed_mime_types();
384
+
385
+ foreach ( wp_get_mime_types() as $type => $mime )
386
+ {
387
+ $wpuxss_eml_mimes[$type] = array(
388
+ 'mime' => $mime,
389
+ 'singular' => $mime,
390
+ 'plural' => $mime,
391
+ 'filter' => 0,
392
+ 'upload' => isset($allowed_mimes[$type]) ? 1 : 0
393
+ );
394
+ }
395
+
396
+ $wpuxss_eml_mimes['pdf']['singular'] = 'PDF';
397
+ $wpuxss_eml_mimes['pdf']['plural'] = 'PDFs';
398
+ $wpuxss_eml_mimes['pdf']['filter'] = 1;
399
+
400
+ update_option( 'wpuxss_eml_taxonomies', $wpuxss_eml_taxonomies );
401
+ update_option( 'wpuxss_eml_mimes', $wpuxss_eml_mimes );
402
+ update_option( 'wpuxss_eml_mimes_backup', $wpuxss_eml_mimes );
403
+ }
404
+ }
405
+
 
 
 
 
 
 
 
 
 
 
 
406
  ?>
js/eml-media-models.js CHANGED
@@ -1,343 +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));
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-views.js CHANGED
@@ -1,111 +1,120 @@
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
-
73
-
74
- function correctAttachmentsListCSS()
75
- {
76
- if ( 'absolute' == $('.attachments-browser .attachments').css('position') && $('.attachments-browser').height() > $('.attachments-browser .media-toolbar').height()+20 )
77
- {
78
- $('.attachments-browser .attachments').css('top',$('.attachments-browser .media-toolbar').height()+20);
79
-
80
- }
81
- else if ( 'absolute' == $('.attachments-browser .attachments').css('position') )
82
- {
83
- $('.attachments-browser .attachments').css('top','50px');
84
- }
85
- else if ( 'relative' == $('.attachments-browser .attachments').css('position') )
86
- {
87
- $('.attachments-browser .attachments').css('top','0');
88
- }
89
-
90
- return false;
91
- };
92
-
93
- $(document).on('change', '.media-toolbar-secondary select', function(e)
94
- {
95
- correctAttachmentsListCSS();
96
- });
97
-
98
- wp.media.view.Modal.prototype.on('open', function()
99
- {
100
- correctAttachmentsListCSS();
101
- });
102
-
103
- $(window).on('resize',function(e)
104
- {
105
- if ( typeof wp !== 'undefined' && wp.media && wp.media.editor )
106
- {
107
- correctAttachmentsListCSS();
108
- }
109
- })
110
-
 
 
 
 
 
 
 
 
 
111
  })( jQuery );
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
+
73
+
74
+ function correctAttachmentsListCSS()
75
+ {
76
+ if ( 'absolute' == $('.attachments-browser .attachments').css('position') && $('.attachments-browser').height() > $('.attachments-browser .media-toolbar').height()+20 )
77
+ {
78
+ $('.attachments-browser .attachments').css('top',$('.attachments-browser .media-toolbar').height()+20);
79
+
80
+ }
81
+ else if ( 'absolute' == $('.attachments-browser .attachments').css('position') )
82
+ {
83
+ $('.attachments-browser .attachments').css('top','50px');
84
+ }
85
+ else if ( 'relative' == $('.attachments-browser .attachments').css('position') )
86
+ {
87
+ $('.attachments-browser .attachments').css('top','0');
88
+ }
89
+
90
+ return false;
91
+ };
92
+
93
+ $(document).on('change', '.media-toolbar-secondary select', function(e)
94
+ {
95
+ correctAttachmentsListCSS();
96
+ });
97
+
98
+ wp.media.view.Modal.prototype.on('open', function()
99
+ {
100
+ correctAttachmentsListCSS();
101
+
102
+ $('.media-toolbar .media-toolbar-secondary').prepend( $('.media-toolbar .instructions') );
103
+ });
104
+
105
+ $(window).on('resize',function(e)
106
+ {
107
+ if ( typeof wp !== 'undefined' && wp.media && wp.media.editor )
108
+ {
109
+ correctAttachmentsListCSS();
110
+ }
111
+ });
112
+
113
+
114
+
115
+ $(function()
116
+ {
117
+ $('.media-toolbar.wp-filter .media-grid-view-switch').after( $('.media-toolbar.wp-filter .select-mode-toggle-button') );
118
+ });
119
+
120
  })( jQuery );
languages/eml.pot CHANGED
@@ -1,14 +1,14 @@
1
- # Copyright (C) 2013 Enhanced Media Library
2
  # This file is distributed under the same license as the Enhanced Media Library package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Enhanced Media Library 1.0.2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/enhanced-media-library\n"
7
- "POT-Creation-Date: 2013-11-16 20:40:44+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
@@ -178,7 +178,7 @@ msgstr ""
178
 
179
  #: core/options-pages.php:191 core/options-pages.php:208
180
  #: core/options-pages.php:255 core/options-pages.php:318
181
- msgid "Filter in Media Uploader"
182
  msgstr ""
183
 
184
  #: core/options-pages.php:192 core/options-pages.php:256
@@ -239,10 +239,11 @@ msgstr ""
239
  msgid "Restore default MIME Types"
240
  msgstr ""
241
 
242
- #. Plugin Name
243
  msgid "Enhanced Media Library"
244
  msgstr ""
245
 
246
- #. Description of the plugin
247
- msgid "Better management for WordPress Media Library."
 
248
  msgstr ""
1
+ # Copyright (C) 2014 Enhanced Media Library
2
  # This file is distributed under the same license as the Enhanced Media Library package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Enhanced Media Library 1.1.2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/enhanced-media-library\n"
7
+ "POT-Creation-Date: 2014-09-04 18:35:44+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
178
 
179
  #: core/options-pages.php:191 core/options-pages.php:208
180
  #: core/options-pages.php:255 core/options-pages.php:318
181
+ msgid "Filter in Media Popup / Grid View"
182
  msgstr ""
183
 
184
  #: core/options-pages.php:192 core/options-pages.php:256
239
  msgid "Restore default MIME Types"
240
  msgstr ""
241
 
242
+ #. Plugin Name of the plugin/theme
243
  msgid "Enhanced Media Library"
244
  msgstr ""
245
 
246
+ #. Description of the plugin/theme
247
+ msgid ""
248
+ "This plugin will be handy for those who need to manage a lot of media files."
249
  msgstr ""
readme.txt CHANGED
@@ -1,145 +1,174 @@
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.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
-
83
- = 1.1.1 =
84
- * **Improvements**
85
- * Filters added for Appearance -> Header and Appearance -> Background [Support Request](https://wordpress.org/support/topic/missing-category-filter-on-media-select-window)
86
-
87
- * **Bugfixes**
88
- * Fixed EML 1.1 bug with disappearing widgets on Appearance -> Customize [Support Request](http://wordpress.org/support/topic/customize-missing-widgets)
89
- * Fixed EML 1.1 bug with disappearing scrollbar [Support Request](http://wordpress.org/support/topic/scroll-bar-disappeared-in-media-window)
90
-
91
-
92
- = 1.1 =
93
-
94
- * **Improvements**
95
- * Filters added to /wp-admin/customize.php page [Support Request](https://wordpress.org/support/topic/missing-category-filter-on-media-select-window)
96
- * 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)
97
- * Media Uploader filters now work without page refreshing when you change category for you images
98
-
99
- * **Bugfixes**
100
- * Fixed "Uploads not showing" issue [Support Request](http://wordpress.org/support/topic/uploads-not-showing)
101
- * Reconsidered CSS for filters area [Support Request](http://wordpress.org/support/topic/missing-search-box)
102
- * Fixed CSS and JS files wrong path definitions [Support Request](http://wordpress.org/support/topic/little-bug-2)
103
-
104
-
105
- = 1.0.5 =
106
-
107
- * Bugfixes
108
- * 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)
109
- * Added WP 3.9 compatibility [Support Request](https://wordpress.org/support/topic/great-plugin-but-breaks-the-new-add-media-in-39)
110
-
111
-
112
- = 1.0.4 =
113
-
114
- * Bugfixes
115
- * Fixed filter mechanism in Media Library [Support Request](http://wordpress.org/support/topic/filter-in-media-not-working-properly)
116
- * Fixed the bug with saving of assigned post categories and tags in Media Uploader
117
-
118
-
119
- = 1.0.3 =
120
-
121
- * Improvements
122
- * Better term sorting in Media Uploader
123
- * Minor code improvements
124
-
125
- * Bugfixes
126
- * Fixed the bug with sorting of post categories and tags assigned to Media Library
127
-
128
-
129
- = 1.0.2 =
130
-
131
- * Bugfixes
132
- * Fixed assigned non-media taxonomies archive page [Support Request](http://wordpress.org/support/topic/plugin-woocommerce-products-stopped-displaying)
133
-
134
-
135
- = 1.0.1 =
136
-
137
- * Bugfixes
138
- * Media Uploader filter now shows nested terms.
139
- * Media Uploader filter now works correctly with multiple taxonomies.
140
-
141
-
142
- = 1.0 =
143
-
144
- * New:
145
- * 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: 4.0
6
+ Stable tag: 1.1.2
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
+ == Frequently Asked Questions ==
59
+
60
+ = Why my custom media taxonomy's page is 404? =
61
+
62
+ Try to just re-save permalinks settings. Go to Settings -> Permalinks and push "Save Changes" button.
63
+
64
+ = Why Media Popup of some themes/plugins does not show taxonomy filters? =
65
+
66
+ EML adds its filters to **any** media popup that already contains native WordPress filters. We chose NOT to force adding filters to ANY media popup because there are a lot of cases when filters are not acceptable and theme's/plugin's author did not add them intentionally.
67
+
68
+ If you believe that a third-party plugin shoud have filters in its Media Popup please contact its author with a request to add **native** WordPress filters ([example of the code](http://wordpress.org/support/topic/how-can-we-use-this-plugin-features-in-my-custom-plugin-media-uploader?replies=15#post-5753212) for theme's/plugin's authors).
69
+
70
+
71
+
72
+ == Screenshots ==
73
+
74
+ 1. Enhanced Media Library Taxonomies Settings
75
+
76
+ 2. Taxonomies in Nav Menu
77
+
78
+ 3. Edit media taxonomies just like any others
79
+
80
+ 4. Edit media taxonomies just like any others
81
+
82
+ 5. Taxonomy columns and filters, sorting by MIME types in Media Library
83
+
84
+ 6. MIME type filter in Media Uploader
85
+
86
+ 7. Taxonomy filter in Media Uploader
87
+
88
+ 8. Set taxonomy term right in Media Uploader
89
+
90
+ 9. MIME type manager
91
+
92
+
93
+
94
+ == Changelog ==
95
+
96
+
97
+ = 1.1.2 =
98
+
99
+ = Improvements =
100
+ * Wordpress 4.0 compatibility ensured
101
+
102
+
103
+ &nbsp;
104
+ = 1.1.1 =
105
+
106
+ = Improvements =
107
+ * Filters added for Appearance -> Header and Appearance -> Background [Support Request](https://wordpress.org/support/topic/missing-category-filter-on-media-select-window)
108
+
109
+ = Bugfixes =
110
+ * Fixed EML 1.1 bug with disappearing widgets on Appearance -> Customize [Support Request](http://wordpress.org/support/topic/customize-missing-widgets)
111
+ * Fixed EML 1.1 bug with disappearing scrollbar [Support Request](http://wordpress.org/support/topic/scroll-bar-disappeared-in-media-window)
112
+
113
+
114
+ &nbsp;
115
+ = 1.1 =
116
+
117
+ = Improvements =
118
+ * Filters added to /wp-admin/customize.php page [Support Request](https://wordpress.org/support/topic/missing-category-filter-on-media-select-window)
119
+ * 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)
120
+ * Media Uploader filters now work without page refreshing when you change category for you images
121
+
122
+ = Bugfixes =
123
+ * Fixed "Uploads not showing" issue [Support Request](http://wordpress.org/support/topic/uploads-not-showing)
124
+ * Reconsidered CSS for filters area [Support Request](http://wordpress.org/support/topic/missing-search-box)
125
+ * Fixed CSS and JS files wrong path definitions [Support Request](http://wordpress.org/support/topic/little-bug-2)
126
+
127
+
128
+ &nbsp;
129
+ = 1.0.5 =
130
+
131
+ = Bugfixes =
132
+ * 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)
133
+ * Added WP 3.9 compatibility [Support Request](https://wordpress.org/support/topic/great-plugin-but-breaks-the-new-add-media-in-39)
134
+
135
+
136
+ &nbsp;
137
+ = 1.0.4 =
138
+
139
+ = Bugfixes =
140
+ * Fixed filter mechanism in Media Library [Support Request](http://wordpress.org/support/topic/filter-in-media-not-working-properly)
141
+ * Fixed the bug with saving of assigned post categories and tags in Media Uploader
142
+
143
+
144
+ &nbsp;
145
+ = 1.0.3 =
146
+
147
+ = Improvements =
148
+ * Better term sorting in Media Uploader
149
+ * Minor code improvements
150
+
151
+ = Bugfixes =
152
+ * Fixed the bug with sorting of post categories and tags assigned to Media Library
153
+
154
+
155
+ &nbsp;
156
+ = 1.0.2 =
157
+
158
+ = Bugfixes =
159
+ * Fixed assigned non-media taxonomies archive page [Support Request](http://wordpress.org/support/topic/plugin-woocommerce-products-stopped-displaying)
160
+
161
+
162
+ &nbsp;
163
+ = 1.0.1 =
164
+
165
+ = Bugfixes =
166
+ * Media Uploader filter now shows nested terms.
167
+ * Media Uploader filter now works correctly with multiple taxonomies.
168
+
169
+
170
+ &nbsp;
171
+ = 1.0 =
172
+
173
+ = New =
174
+ * Enhanced Media Library initial release.
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
screenshot-3.png DELETED
Binary file
screenshot-4.png DELETED
Binary file
screenshot-5.png DELETED
Binary file
screenshot-6.png DELETED
Binary file
screenshot-7.png DELETED
Binary file
screenshot-8.png DELETED
Binary file
screenshot-9.png DELETED
Binary file