Enhanced Media Library - Version 2.3.2

Version Description

Release Date - November 11, 2016

Download this release

Release Info

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

Code changes from version 2.3.1 to 2.3.2

core/medialist.php CHANGED
@@ -7,6 +7,7 @@ if ( ! defined( 'ABSPATH' ) )
7
 
8
  add_filter( 'shortcode_atts_gallery', 'wpuxss_eml_shortcode_atts', 10, 3 );
9
  add_filter( 'shortcode_atts_playlist', 'wpuxss_eml_shortcode_atts', 10, 3 );
 
10
 
11
 
12
 
@@ -105,7 +106,7 @@ if ( ! function_exists( 'wpuxss_eml_shortcode_atts' ) ) {
105
  $ids = get_posts( $query );
106
 
107
  if ( ! empty( $ids ) ) {
108
- $out['include'] = implode( ',', $ids );
109
  }
110
 
111
  return $out;
7
 
8
  add_filter( 'shortcode_atts_gallery', 'wpuxss_eml_shortcode_atts', 10, 3 );
9
  add_filter( 'shortcode_atts_playlist', 'wpuxss_eml_shortcode_atts', 10, 3 );
10
+ add_filter( 'shortcode_atts_slideshow', 'wpuxss_eml_shortcode_atts', 10, 3 );
11
 
12
 
13
 
106
  $ids = get_posts( $query );
107
 
108
  if ( ! empty( $ids ) ) {
109
+ $out['ids'] = $out['include'] = implode( ',', $ids );
110
  }
111
 
112
  return $out;
core/options-pages.php CHANGED
@@ -1124,7 +1124,6 @@ if ( ! function_exists( 'wpuxss_eml_print_taxonomies_options' ) ) {
1124
  wp_die( __( 'You do not have sufficient permissions to access this page.', 'enhanced-media-library' ) );
1125
 
1126
  $wpuxss_eml_taxonomies = get_option( 'wpuxss_eml_taxonomies' );
1127
- $taxonomies = get_taxonomies( array(),'names' );
1128
  $title = __('Media Settings'); ?>
1129
 
1130
 
@@ -1312,28 +1311,30 @@ if ( ! function_exists( 'wpuxss_eml_print_taxonomies_options' ) ) {
1312
 
1313
  foreach ( $taxonomies as $taxonomy ) {
1314
 
1315
- if ( $taxonomy->name != 'post_format' ) {
 
 
1316
 
1317
- $html .= '<li class="wpuxss-non-eml-taxonomy" id="' . $taxonomy->name . '">';
1318
- $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][eml_media]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['eml_media'] . '" />';
1319
- $html .= '<label><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','enhanced-media-library') . '" />' . $taxonomy->label . '</label>';
1320
- $html .= '<a class="wpuxss-eml-button-edit" title="' . __('Edit Taxonomy','enhanced-media-library') . '" href="javascript:;">' . __('Edit','enhanced-media-library') . ' &darr;</a>';
1321
- $html .= '<div class="wpuxss-eml-taxonomy-edit" style="display:none;">';
1322
 
1323
- $html .= '<h4>' . __('Settings','enhanced-media-library') . '</h4>';
1324
- $html .= '<ul>';
1325
- $html .= '<li><input type="checkbox" class="wpuxss-eml-admin_filter" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][admin_filter]" id="wpuxss_eml_taxonomies-' . $taxonomy->name . '-admin_filter" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['admin_filter'], false ) . ' /><label for="wpuxss_eml_taxonomies-' . $taxonomy->name . '-admin_filter">' . __('Filter for List View','enhanced-media-library') . '</label></li>';
1326
- $html .= '<li><input type="checkbox" class="wpuxss-eml-media_uploader_filter" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][media_uploader_filter]" id="wpuxss_eml_taxonomies-' . $taxonomy->name . '-media_uploader_filter" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['media_uploader_filter'], false ) . ' /><label for="wpuxss_eml_taxonomies-' . $taxonomy->name . '-media_uploader_filter">' . __('Filter for Grid View / Media Popup','enhanced-media-library') . '</label></li>';
1327
- $html .= '<li><input type="checkbox" class="wpuxss-eml-media_popup_taxonomy_edit" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][media_popup_taxonomy_edit]" id="wpuxss_eml_taxonomies-' . $taxonomy->name . '-media_popup_taxonomy_edit" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['media_popup_taxonomy_edit'], false ) . ' /><label for="wpuxss_eml_taxonomies-' . $taxonomy->name . '-media_popup_taxonomy_edit">' . __('Edit in Media Popup','enhanced-media-library') . '</label></li>';
1328
 
1329
- $options = '';
1330
- $html .= apply_filters( 'wpuxss_eml_extend_non_media_taxonomy_options', $options, $taxonomy, $post_type, $wpuxss_eml_taxonomies );
 
 
 
1331
 
1332
- $html .= '</ul>';
 
1333
 
1334
- $html .= '</div>';
1335
- $html .= '</li>';
1336
- }
 
1337
  } ?>
1338
 
1339
  <?php if ( ! empty( $html ) ) : ?>
1124
  wp_die( __( 'You do not have sufficient permissions to access this page.', 'enhanced-media-library' ) );
1125
 
1126
  $wpuxss_eml_taxonomies = get_option( 'wpuxss_eml_taxonomies' );
 
1127
  $title = __('Media Settings'); ?>
1128
 
1129
 
1311
 
1312
  foreach ( $taxonomies as $taxonomy ) {
1313
 
1314
+ if ( $taxonomy->name == 'post_format' ) {
1315
+ continue;
1316
+ }
1317
 
 
 
 
 
 
1318
 
1319
+ $html .= '<li class="wpuxss-non-eml-taxonomy" id="' . $taxonomy->name . '">';
1320
+ $html .= '<input name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][eml_media]" type="hidden" value="' . $wpuxss_eml_taxonomies[$taxonomy->name]['eml_media'] . '" />';
1321
+ $html .= '<label><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','enhanced-media-library') . '" />' . $taxonomy->label . '</label>';
1322
+ $html .= '<a class="wpuxss-eml-button-edit" title="' . __('Edit Taxonomy','enhanced-media-library') . '" href="javascript:;">' . __('Edit','enhanced-media-library') . ' &darr;</a>';
1323
+ $html .= '<div class="wpuxss-eml-taxonomy-edit" style="display:none;">';
1324
 
1325
+ $html .= '<h4>' . __('Settings','enhanced-media-library') . '</h4>';
1326
+ $html .= '<ul>';
1327
+ $html .= '<li><input type="checkbox" class="wpuxss-eml-admin_filter" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][admin_filter]" id="wpuxss_eml_taxonomies-' . $taxonomy->name . '-admin_filter" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['admin_filter'], false ) . ' /><label for="wpuxss_eml_taxonomies-' . $taxonomy->name . '-admin_filter">' . __('Filter for List View','enhanced-media-library') . '</label></li>';
1328
+ $html .= '<li><input type="checkbox" class="wpuxss-eml-media_uploader_filter" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][media_uploader_filter]" id="wpuxss_eml_taxonomies-' . $taxonomy->name . '-media_uploader_filter" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['media_uploader_filter'], false ) . ' /><label for="wpuxss_eml_taxonomies-' . $taxonomy->name . '-media_uploader_filter">' . __('Filter for Grid View / Media Popup','enhanced-media-library') . '</label></li>';
1329
+ $html .= '<li><input type="checkbox" class="wpuxss-eml-media_popup_taxonomy_edit" name="wpuxss_eml_taxonomies[' . $taxonomy->name . '][media_popup_taxonomy_edit]" id="wpuxss_eml_taxonomies-' . $taxonomy->name . '-media_popup_taxonomy_edit" value="1" ' . checked( 1, $wpuxss_eml_taxonomies[$taxonomy->name]['media_popup_taxonomy_edit'], false ) . ' /><label for="wpuxss_eml_taxonomies-' . $taxonomy->name . '-media_popup_taxonomy_edit">' . __('Edit in Media Popup','enhanced-media-library') . '</label></li>';
1330
 
1331
+ $options = '';
1332
+ $html .= apply_filters( 'wpuxss_eml_extend_non_media_taxonomy_options', $options, $taxonomy, $post_type, $wpuxss_eml_taxonomies );
1333
 
1334
+ $html .= '</ul>';
1335
+
1336
+ $html .= '</div>';
1337
+ $html .= '</li>';
1338
  } ?>
1339
 
1340
  <?php if ( ! empty( $html ) ) : ?>
core/taxonomies.php CHANGED
@@ -189,78 +189,70 @@ if ( ! function_exists( 'wpuxss_eml_tax_options_validate' ) ) {
189
 
190
 
191
  /**
192
- * wpuxss_eml_ajax_query_attachments
193
  *
194
- * Based on /wp-admin/includes/ajax-actions.php
195
- *
196
- * @since 1.0
197
- * @created 03/08/13
198
  */
199
 
200
- add_action( 'wp_ajax_query-attachments', 'wpuxss_eml_ajax_query_attachments', 0 );
201
-
202
- if ( ! function_exists( 'wpuxss_eml_ajax_query_attachments' ) ) {
203
 
204
- function wpuxss_eml_ajax_query_attachments() {
205
 
206
- global $wp_version;
207
-
208
- if ( ! current_user_can( 'upload_files' ) )
209
- wp_send_json_error();
210
-
211
- $query = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array();
212
 
 
213
  $uncategorized = ( isset( $query['uncategorized'] ) && $query['uncategorized'] ) ? 1 : 0;
 
214
 
215
 
216
- $query = array_intersect_key( $query, array_flip( array(
217
- 's', 'order', 'orderby', 'posts_per_page', 'paged', 'post_mime_type',
218
- 'post_parent', 'post__in', 'post__not_in', 'year', 'monthnum'
219
- ) ) );
220
 
221
- foreach ( get_object_taxonomies( 'attachment', 'names' ) as $taxonomy ) {
 
 
222
 
223
  if ( $uncategorized ) {
224
 
225
- $terms = get_terms( $taxonomy, array( 'fields' => 'ids', 'get' => 'all' ) );
226
 
227
  $tax_query[] = array(
228
- 'taxonomy' => $taxonomy,
229
  'field' => 'term_id',
230
  'terms' => $terms,
231
- 'operator' => 'NOT IN',
232
  );
233
  }
234
  else {
235
 
236
- if ( isset( $_REQUEST['query'][$taxonomy] ) && $_REQUEST['query'][$taxonomy] ) {
237
 
238
- if( is_numeric( $_REQUEST['query'][$taxonomy] ) ||
239
- is_array( $_REQUEST['query'][$taxonomy] ) ) {
240
 
241
  $tax_query[] = array(
242
- 'taxonomy' => $taxonomy,
243
  'field' => 'term_id',
244
- 'terms' => (array) $_REQUEST['query'][$taxonomy]
245
  );
246
  }
247
- elseif ( 'not_in' === $_REQUEST['query'][$taxonomy] ) {
248
 
249
- $terms = get_terms( $taxonomy, array('fields'=>'ids','get'=>'all') );
250
 
251
  $tax_query[] = array(
252
- 'taxonomy' => $taxonomy,
253
  'field' => 'term_id',
254
  'terms' => $terms,
255
  'operator' => 'NOT IN',
256
  );
257
  }
258
- elseif ( 'in' === $_REQUEST['query'][$taxonomy] ) {
259
 
260
- $terms = get_terms( $taxonomy, array('fields'=>'ids','get'=>'all') );
261
 
262
  $tax_query[] = array(
263
- 'taxonomy' => $taxonomy,
264
  'field' => 'term_id',
265
  'terms' => $terms,
266
  'operator' => 'IN',
@@ -268,36 +260,20 @@ if ( ! function_exists( 'wpuxss_eml_ajax_query_attachments' ) ) {
268
  }
269
  }
270
  }
 
 
 
 
 
271
  } // endforeach
272
 
273
  if ( ! empty( $tax_query ) ) {
 
274
  $tax_query['relation'] = 'AND';
275
  $query['tax_query'] = $tax_query;
276
  }
277
 
278
- $query['post_type'] = 'attachment';
279
-
280
- if ( MEDIA_TRASH
281
- && ! empty( $_REQUEST['query']['post_status'] )
282
- && 'trash' === $_REQUEST['query']['post_status'] ) {
283
-
284
- $query['post_status'] = 'trash';
285
- }
286
- else {
287
-
288
- $query['post_status'] = 'inherit';
289
- }
290
-
291
- if ( current_user_can( get_post_type_object( 'attachment' )->cap->read_private_posts ) )
292
- $query['post_status'] .= ',private';
293
-
294
- $query = apply_filters( 'ajax_query_attachments_args', $query );
295
- $query = new WP_Query( $query );
296
-
297
- $posts = array_map( 'wp_prepare_attachment_for_js', $query->posts );
298
- $posts = array_filter( $posts );
299
-
300
- wp_send_json_success( $posts );
301
  }
302
  }
303
 
@@ -587,31 +563,37 @@ if ( ! function_exists( 'wpuxss_eml_attachment_fields_to_edit' ) ) {
587
 
588
  $wpuxss_eml_tax_options = get_option('wpuxss_eml_tax_options');
589
 
590
- foreach( $form_fields as $field => $args ) {
591
 
592
- if ( isset( $args['hierarchical'] ) &&
593
- function_exists( 'wp_terms_checklist' ) &&
594
- ( (bool) $wpuxss_eml_tax_options['edit_all_as_hierarchical'] || (bool) $args['hierarchical'] ) ) {
595
 
596
- ob_start();
597
 
598
- wp_terms_checklist( $post->ID, array( 'taxonomy' => $field, 'checked_ontop' => false, 'walker' => new Walker_Media_Taxonomy_Checklist() ) );
599
 
600
- $content = ob_get_contents();
601
 
602
- if ( $content )
603
- $html = '<ul class="term-list">' . $content . '</ul>';
604
- else
605
- $html = '<ul class="term-list"><li>No ' . $args['label'] . ' found.</li></ul>';
606
 
607
- ob_end_clean();
608
 
609
- unset( $form_fields[$field]['value'] );
 
 
 
610
 
611
- $form_fields[$field]['input'] = 'html';
612
- $form_fields[$field]['html'] = $html;
613
- }
614
- }
 
 
 
 
 
 
 
 
 
615
 
616
  return $form_fields;
617
  }
189
 
190
 
191
  /**
192
+ * wpuxss_eml_ajax_query_attachments_args
193
  *
194
+ * @since 2.3.2
195
+ * @created 24/09/16
 
 
196
  */
197
 
198
+ add_filter( 'ajax_query_attachments_args', 'wpuxss_eml_ajax_query_attachments_args' );
 
 
199
 
200
+ if ( ! function_exists( 'wpuxss_eml_ajax_query_attachments_args' ) ) {
201
 
202
+ function wpuxss_eml_ajax_query_attachments_args( $query ) {
 
 
 
 
 
203
 
204
+ $wpuxss_eml_taxonomies = get_option( 'wpuxss_eml_taxonomies', array() );
205
  $uncategorized = ( isset( $query['uncategorized'] ) && $query['uncategorized'] ) ? 1 : 0;
206
+ $tax_query = array();
207
 
208
 
209
+ foreach ( get_object_taxonomies( 'attachment', 'object' ) as $taxonomy ) {
 
 
 
210
 
211
+ if ( ! array_key_exists( $taxonomy->name, $wpuxss_eml_taxonomies ) ) {
212
+ continue;
213
+ }
214
 
215
  if ( $uncategorized ) {
216
 
217
+ $terms = get_terms( $taxonomy->name, array( 'fields' => 'ids', 'get' => 'all' ) );
218
 
219
  $tax_query[] = array(
220
+ 'taxonomy' => $taxonomy->name,
221
  'field' => 'term_id',
222
  'terms' => $terms,
223
+ 'operator' => 'NOT IN'
224
  );
225
  }
226
  else {
227
 
228
+ if ( isset( $query[$taxonomy->query_var] ) && $query[$taxonomy->query_var] ) {
229
 
230
+ if( is_numeric( $query[$taxonomy->query_var] ) ||
231
+ is_array( $query[$taxonomy->query_var] ) ) {
232
 
233
  $tax_query[] = array(
234
+ 'taxonomy' => $taxonomy->name,
235
  'field' => 'term_id',
236
+ 'terms' => (array) $query[$taxonomy->query_var]
237
  );
238
  }
239
+ elseif ( 'not_in' === $query[$taxonomy->query_var] ) {
240
 
241
+ $terms = get_terms( $taxonomy->name, array('fields'=>'ids','get'=>'all') );
242
 
243
  $tax_query[] = array(
244
+ 'taxonomy' => $taxonomy->name,
245
  'field' => 'term_id',
246
  'terms' => $terms,
247
  'operator' => 'NOT IN',
248
  );
249
  }
250
+ elseif ( 'in' === $query[$taxonomy->query_var] ) {
251
 
252
+ $terms = get_terms( $taxonomy->name, array('fields'=>'ids','get'=>'all') );
253
 
254
  $tax_query[] = array(
255
+ 'taxonomy' => $taxonomy->name,
256
  'field' => 'term_id',
257
  'terms' => $terms,
258
  'operator' => 'IN',
260
  }
261
  }
262
  }
263
+
264
+ if ( isset( $query[$taxonomy->query_var] ) ) {
265
+ unset( $query[$taxonomy->query_var] );
266
+ }
267
+
268
  } // endforeach
269
 
270
  if ( ! empty( $tax_query ) ) {
271
+
272
  $tax_query['relation'] = 'AND';
273
  $query['tax_query'] = $tax_query;
274
  }
275
 
276
+ return $query;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  }
278
  }
279
 
563
 
564
  $wpuxss_eml_tax_options = get_option('wpuxss_eml_tax_options');
565
 
 
566
 
567
+ if ( function_exists( 'wp_terms_checklist' ) ) {
 
 
568
 
569
+ foreach( $form_fields as $field => $args ) {
570
 
571
+ if ( (bool) $wpuxss_eml_tax_options['edit_all_as_hierarchical'] || (bool) $args['hierarchical'] ) {
572
 
573
+ ob_start();
574
 
575
+ wp_terms_checklist( $post->ID, array( 'taxonomy' => $field, 'checked_ontop' => false, 'walker' => new Walker_Media_Taxonomy_Checklist() ) );
 
 
 
576
 
577
+ $content = ob_get_contents();
578
 
579
+ if ( $content )
580
+ $html = '<ul class="term-list">' . $content . '</ul>';
581
+ else
582
+ $html = '<ul class="term-list"><li>No ' . $args['label'] . ' found.</li></ul>';
583
 
584
+ ob_end_clean();
585
+
586
+ unset( $form_fields[$field]['value'] );
587
+
588
+ $form_fields[$field]['input'] = 'html';
589
+ $form_fields[$field]['html'] = $html;
590
+ }
591
+ else {
592
+ $values = wp_get_object_terms( $post->ID, $field, array( 'fields' => 'names' ) );
593
+ $form_fields[$field]['value'] = join(', ', $values);
594
+ } // if
595
+ } // foreach
596
+ } // if
597
 
598
  return $form_fields;
599
  }
enhanced-media-library.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Enhanced Media Library
4
  Plugin URI: http://wpUXsolutions.com
5
  Description: This plugin will be handy for those who need to manage a lot of media files.
6
- Version: 2.3.1
7
  Author: wpUXsolutions
8
  Author URI: http://wpUXsolutions.com
9
  Text Domain: enhanced-media-library
@@ -27,7 +27,7 @@ global $wp_version,
27
 
28
 
29
 
30
- $wpuxss_eml_version = '2.3.1';
31
 
32
 
33
 
@@ -83,7 +83,7 @@ if ( ! function_exists( 'wpuxss_eml_enhance_media_shortcodes' ) ) {
83
 
84
  $wpuxss_eml_lib_options = get_option('wpuxss_eml_lib_options');
85
 
86
- $enhance_media_shortcodes = isset( $wpuxss_eml_lib_options['enhance_media_shortcodes'] ) ? (bool)$wpuxss_eml_lib_options['enhance_media_shortcodes'] : false;
87
 
88
  return $enhance_media_shortcodes;
89
  }
@@ -152,14 +152,15 @@ if ( ! function_exists( 'wpuxss_eml_on_init' ) ) {
152
  $wpuxss_eml_old_version = get_option( 'wpuxss_eml_version', null );
153
 
154
  if ( version_compare( $wpuxss_eml_version, $wpuxss_eml_old_version, '<>' ) ) {
 
155
  update_option( 'wpuxss_eml_version', $wpuxss_eml_version );
156
- }
157
 
158
- if ( is_null( $wpuxss_eml_old_version ) ) {
159
- wpuxss_eml_on_activation();
160
- }
161
- else {
162
- wpuxss_eml_on_update();
 
163
  }
164
 
165
 
@@ -214,10 +215,15 @@ if ( ! function_exists( 'wpuxss_eml_on_wp_loaded' ) ) {
214
  $wpuxss_eml_taxonomies = get_option( 'wpuxss_eml_taxonomies', array() );
215
  $taxonomies = get_taxonomies( array(), 'object' );
216
 
 
217
  // discover 'foreign' taxonomies
218
  foreach ( $taxonomies as $taxonomy => $params ) {
219
 
220
- 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' && $taxonomy !== 'link_category' ) {
 
 
 
 
221
 
222
  $wpuxss_eml_taxonomies[$taxonomy] = array(
223
  'eml_media' => 0,
@@ -390,42 +396,45 @@ if ( ! function_exists( 'wpuxss_eml_enqueue_media' ) ) {
390
  $terms_id_name_ready_for_script = wpuxss_eml_get_media_term_pairs( $terms, 'id=>name' );
391
 
392
 
393
- foreach ( $media_taxonomies as $taxonomy ) {
394
 
395
- $taxonomy_terms = array();
396
 
 
397
 
398
- ob_start();
399
 
400
- wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'checked_ontop' => false, 'walker' => new Walker_Media_Taxonomy_Uploader_Filter() ) );
401
 
402
- $html = '';
403
- if ( ob_get_contents() != false ) {
404
- $html = ob_get_contents();
405
- }
406
 
407
- ob_end_clean();
 
 
 
408
 
 
409
 
410
- $html = str_replace( '}{', '},{', $html );
411
- $html = '[' . $html . ']';
412
- $taxonomy_terms = json_decode( $html, true );
413
 
414
- $media_taxonomies_ready_for_script[$taxonomy->name] = array(
415
- 'singular_name' => $taxonomy->labels->singular_name,
416
- 'plural_name' => $taxonomy->labels->name,
417
- 'term_list' => $taxonomy_terms,
418
- 'terms' => $terms_id_name_ready_for_script
419
- );
420
 
 
 
 
 
 
 
421
 
422
- if ( (bool) $wpuxss_eml_taxonomies[$taxonomy->name]['media_uploader_filter'] ) {
423
- $filter_taxonomy_names_ready_for_script[] = $taxonomy->name;
424
- }
425
 
426
- if ( ! (bool) $wpuxss_eml_taxonomies[$taxonomy->name]['media_popup_taxonomy_edit'] ) {
427
- $compat_taxonomies_to_hide[] = $taxonomy->name;
428
- }
 
 
 
 
 
429
  }
430
 
431
 
3
  Plugin Name: Enhanced Media Library
4
  Plugin URI: http://wpUXsolutions.com
5
  Description: This plugin will be handy for those who need to manage a lot of media files.
6
+ Version: 2.3.2
7
  Author: wpUXsolutions
8
  Author URI: http://wpUXsolutions.com
9
  Text Domain: enhanced-media-library
27
 
28
 
29
 
30
+ $wpuxss_eml_version = '2.3.2';
31
 
32
 
33
 
83
 
84
  $wpuxss_eml_lib_options = get_option('wpuxss_eml_lib_options');
85
 
86
+ $enhance_media_shortcodes = isset( $wpuxss_eml_lib_options['enhance_media_shortcodes'] ) ? (bool) $wpuxss_eml_lib_options['enhance_media_shortcodes'] : false;
87
 
88
  return $enhance_media_shortcodes;
89
  }
152
  $wpuxss_eml_old_version = get_option( 'wpuxss_eml_version', null );
153
 
154
  if ( version_compare( $wpuxss_eml_version, $wpuxss_eml_old_version, '<>' ) ) {
155
+
156
  update_option( 'wpuxss_eml_version', $wpuxss_eml_version );
 
157
 
158
+ if ( is_null( $wpuxss_eml_old_version ) ) {
159
+ wpuxss_eml_on_activation();
160
+ }
161
+ else {
162
+ wpuxss_eml_on_update();
163
+ }
164
  }
165
 
166
 
215
  $wpuxss_eml_taxonomies = get_option( 'wpuxss_eml_taxonomies', array() );
216
  $taxonomies = get_taxonomies( array(), 'object' );
217
 
218
+
219
  // discover 'foreign' taxonomies
220
  foreach ( $taxonomies as $taxonomy => $params ) {
221
 
222
+ if ( ! empty( $params->object_type ) && ! array_key_exists( $taxonomy,$wpuxss_eml_taxonomies ) &&
223
+ ! in_array( 'revision', $params->object_type ) &&
224
+ ! in_array( 'nav_menu_item', $params->object_type ) &&
225
+ $taxonomy !== 'post_format' &&
226
+ $taxonomy !== 'link_category' ) {
227
 
228
  $wpuxss_eml_taxonomies[$taxonomy] = array(
229
  'eml_media' => 0,
396
  $terms_id_name_ready_for_script = wpuxss_eml_get_media_term_pairs( $terms, 'id=>name' );
397
 
398
 
399
+ if ( function_exists( 'wp_terms_checklist' ) ) {
400
 
401
+ foreach ( $media_taxonomies as $taxonomy ) {
402
 
403
+ $taxonomy_terms = array();
404
 
 
405
 
406
+ ob_start();
407
 
408
+ wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'checked_ontop' => false, 'walker' => new Walker_Media_Taxonomy_Uploader_Filter() ) );
 
 
 
409
 
410
+ $html = '';
411
+ if ( ob_get_contents() != false ) {
412
+ $html = ob_get_contents();
413
+ }
414
 
415
+ ob_end_clean();
416
 
 
 
 
417
 
418
+ $html = str_replace( '}{', '},{', $html );
419
+ $html = '[' . $html . ']';
420
+ $taxonomy_terms = json_decode( $html, true );
 
 
 
421
 
422
+ $media_taxonomies_ready_for_script[$taxonomy->name] = array(
423
+ 'singular_name' => $taxonomy->labels->singular_name,
424
+ 'plural_name' => $taxonomy->labels->name,
425
+ 'term_list' => $taxonomy_terms,
426
+ 'terms' => $terms_id_name_ready_for_script
427
+ );
428
 
 
 
 
429
 
430
+ if ( (bool) $wpuxss_eml_taxonomies[$taxonomy->name]['media_uploader_filter'] ) {
431
+ $filter_taxonomy_names_ready_for_script[] = $taxonomy->name;
432
+ }
433
+
434
+ if ( ! (bool) $wpuxss_eml_taxonomies[$taxonomy->name]['media_popup_taxonomy_edit'] ) {
435
+ $compat_taxonomies_to_hide[] = $taxonomy->name;
436
+ }
437
+ } // foreach
438
  }
439
 
440
 
js/eml-media-views.js CHANGED
@@ -29,9 +29,17 @@ window.eml = window.eml || { l10n: {} };
29
 
30
  original.controllerLibrary.activate.apply( this, arguments );
31
 
 
32
  wp.Uploader.queue.on( 'reset', this.afterUpload, this );
33
  },
34
 
 
 
 
 
 
 
 
35
  afterUpload: function() {
36
 
37
  var library = this.get( 'library' ),
@@ -43,8 +51,6 @@ window.eml = window.eml || { l10n: {} };
43
  library.saveMenuOrder();
44
  }
45
 
46
- $('.attachment-filters:has(option[value!="all"]:selected)').val( 'all' ).change();
47
-
48
  library.reset( library.models );
49
 
50
  selection.trigger( 'selection:unsingle', selection.model, selection );
29
 
30
  original.controllerLibrary.activate.apply( this, arguments );
31
 
32
+ wp.Uploader.queue.on( 'add', this.beforeUpload, this );
33
  wp.Uploader.queue.on( 'reset', this.afterUpload, this );
34
  },
35
 
36
+ beforeUpload: function() {
37
+
38
+ if ( wp.Uploader.queue.length == 1 ) {
39
+ $('.attachment-filters:has(option[value!="all"]:selected)').val( 'all' ).change();
40
+ }
41
+ },
42
+
43
  afterUpload: function() {
44
 
45
  var library = this.get( 'library' ),
51
  library.saveMenuOrder();
52
  }
53
 
 
 
54
  library.reset( library.models );
55
 
56
  selection.trigger( 'selection:unsingle', selection.model, selection );
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: webbistro
3
  Tags: media library, media category, media categories, media gallery, gallery shortcode, media tag, media tags, media taxonomy, media taxonomies, media uploader, mime type, mime, mime types, file types, media types, media filter, attachment, gallery, image, images, media, ux, user experience, wp-admin, admin, taxonomy, taxonomies
4
  Requires at least: 4.5
5
- Tested up to: 4.6
6
- Stable tag: 2.3.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -73,7 +73,7 @@ You can see available translations and their progress here: https://translate.wo
73
  Assistance with translating is highly appreciated! If you'd like to be a translation editor of the PRO version please contact us on [wpuxsolutions.com](https://www.wpuxsolutions.com/support/create-new-ticket/)
74
 
75
 
76
- = Compatibility with Other Plugins =
77
 
78
  * Advanced Custom Fields
79
  * WooCommerce
@@ -85,6 +85,7 @@ Assistance with translating is highly appreciated! If you'd like to be a transla
85
  * Jetpack Tiled Galleries
86
  * Simple Lightbox
87
  * Responsive Lightbox by dFactory
 
88
 
89
 
90
  Please let us know if you find any issue with the plugins from the list above or others.
@@ -161,6 +162,21 @@ Please notice that you use the Enhanced Media Library with other plugins that ad
161
 
162
  == Changelog ==
163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  = 2.3.1 =
165
  *Release Date - August 9, 2016*
166
 
2
  Contributors: webbistro
3
  Tags: media library, media category, media categories, media gallery, gallery shortcode, media tag, media tags, media taxonomy, media taxonomies, media uploader, mime type, mime, mime types, file types, media types, media filter, attachment, gallery, image, images, media, ux, user experience, wp-admin, admin, taxonomy, taxonomies
4
  Requires at least: 4.5
5
+ Tested up to: 4.6.1
6
+ Stable tag: 2.3.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
73
  Assistance with translating is highly appreciated! If you'd like to be a translation editor of the PRO version please contact us on [wpuxsolutions.com](https://www.wpuxsolutions.com/support/create-new-ticket/)
74
 
75
 
76
+ = Compatible with the Plugins: =
77
 
78
  * Advanced Custom Fields
79
  * WooCommerce
85
  * Jetpack Tiled Galleries
86
  * Simple Lightbox
87
  * Responsive Lightbox by dFactory
88
+ * Justified Gallery
89
 
90
 
91
  Please let us know if you find any issue with the plugins from the list above or others.
162
 
163
  == Changelog ==
164
 
165
+ = 2.3.2 =
166
+ *Release Date - November 11, 2016*
167
+
168
+ = Improvements =
169
+ * Tag names are being used instead of slugs for non-hierarchical taxonomies to assign to media items
170
+
171
+ = Bugfixes =
172
+ * The bug preventing taxonomy filters to switch correctly on upload fixed
173
+ * A few minor bugs fixed
174
+
175
+ = Compatibility =
176
+ * Compatibility with the Jetpack Slideshow added
177
+
178
+
179
+ &nbsp;
180
  = 2.3.1 =
181
  *Release Date - August 9, 2016*
182