Enhanced Media Library - Version 2.1.5

Version Description

Release Date - January 14, 2016

Download this release

Release Info

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

Code changes from version 2.1.4 to 2.1.5

core/gallery.php CHANGED
@@ -3,87 +3,47 @@
3
 
4
 
5
  /**
6
- * wpuxss_eml_get_gallery_attachments
7
  *
8
- * 'eml_gallery_attachments' filter callback
9
- *
10
- * @since 2.1.4
11
- * @created 26/12/15
12
- */
13
-
14
- add_filter( 'eml_gallery_attachments', 'wpuxss_eml_get_gallery_attachments', 10, 2 );
15
-
16
- if ( ! function_exists( 'wpuxss_eml_get_gallery_attachments' ) ) {
17
-
18
- function wpuxss_eml_get_gallery_attachments( $attachments, $attr ) {
19
-
20
- $attachments = eml_get_gallery_attachments( $attr );
21
-
22
- return $attachments;
23
- }
24
- }
25
-
26
-
27
-
28
- /**
29
- * eml_get_gallery_attachments
30
- *
31
- * Retrive attachments for a gallery, for future API
32
- *
33
- * @since 2.1.4
34
- * @created 08/01/16
35
  */
36
 
37
- if ( ! function_exists( 'eml_get_gallery_attachments' ) ) {
38
 
39
- function eml_get_gallery_attachments( $attr ) {
40
 
41
- $post = get_post();
42
 
43
  $is_filter_based = false;
 
44
 
45
- $atts = array_merge( array(
46
- 'ids' => '',
47
- 'order' => 'ASC',
48
- 'orderby' => 'menu_order ID',
49
- 'include' => '',
50
- 'exclude' => ''
51
- ), $attr );
52
 
53
- if ( ! isset( $attr['id'] ) ) {
54
- $atts['id'] = 0;
55
- }
56
- else {
57
- $atts['id'] = isset( $post->ID ) ? intval( $post->ID ) : 0;
58
- }
59
-
60
- $id = intval( $atts['id'] );
61
 
62
- $query = array(
63
- 'post_status' => 'inherit',
64
- 'post_type' => 'attachment',
65
- 'post_mime_type' => 'image',
66
- 'order' => $atts['order'],
67
- 'orderby' => $atts['orderby'],
68
- 'posts_per_page' => isset( $atts['limit'] ) ? intval( $atts['limit'] ) : -1, //TODO: add pagination
69
- );
70
 
71
- if ( isset( $attr['monthnum'] ) && isset( $attr['year'] ) ) {
 
 
 
 
 
72
 
73
- $query['monthnum'] = $attr['monthnum'];
74
- $query['year'] = $attr['year'];
75
 
 
76
  $is_filter_based = true;
77
  }
78
 
79
 
80
  $tax_query = array();
81
 
82
- foreach ( get_object_taxonomies( 'attachment', 'names' ) as $taxonomy ) {
83
 
84
- if ( isset( $attr[$taxonomy] ) ) {
85
 
86
- $terms = explode( ',', $attr[$taxonomy] );
87
 
88
  $tax_query[] = array(
89
  'taxonomy' => $taxonomy,
@@ -97,490 +57,51 @@ if ( ! function_exists( 'eml_get_gallery_attachments' ) ) {
97
  }
98
 
99
 
100
- if ( $is_filter_based ) {
101
-
102
- if ( 'post__in' === $atts['orderby'] ) {
103
- $query['orderby'] = 'menu_order ID';
104
- }
105
-
106
- if ( ! empty( $tax_query ) ) {
107
-
108
- $tax_query['relation'] = 'AND';
109
- $query['tax_query'] = $tax_query;
110
- }
111
-
112
- if ( $id ) {
113
- $query['post_parent'] = $id;
114
- }
115
-
116
- $_attachments = get_posts( $query );
117
-
118
- $attachments = array();
119
- foreach ( $_attachments as $key => $val )
120
- $attachments[$val->ID] = $_attachments[$key];
121
- }
122
- elseif ( ! empty( $atts['include'] ) ) {
123
-
124
- $query['include'] = $atts['include'];
125
-
126
- $_attachments = get_posts( $query );
127
-
128
- $attachments = array();
129
- foreach ( $_attachments as $key => $val )
130
- $attachments[$val->ID] = $_attachments[$key];
131
- }
132
- elseif ( ! empty( $atts['exclude'] ) ) {
133
-
134
- $query['exclude'] = $atts['exclude'];
135
- $query['post_parent'] = isset( $atts['id'] ) ? $atts['id'] : 0;
136
-
137
- $attachments = get_children( $query );
138
  }
139
- elseif ( $id ) {
140
-
141
- $query['post_parent'] = $id;
142
-
143
- $attachments = get_children( $query );
144
- }
145
- else {
146
-
147
- $attachments = array();
148
- }
149
-
150
- return $attachments;
151
- }
152
- }
153
-
154
 
155
 
156
- /**
157
- * wpuxss_eml_get_gallery_html
158
- *
159
- * @since 2.1.4
160
- * @created 26/12/15
161
- */
162
-
163
- add_filter( 'eml_gallery_output', 'wpuxss_eml_get_gallery_html', 10, 4 );
164
-
165
- if ( ! function_exists( 'wpuxss_eml_get_gallery_html' ) ) {
166
 
167
- function wpuxss_eml_get_gallery_html( $output, $attachments, $attr, $instance ) {
 
 
 
 
 
 
 
 
168
 
169
- $html5 = current_theme_supports( 'html5', 'gallery' );
170
- $atts = array_merge( array(
171
- 'itemtag' => $html5 ? 'figure' : 'dl',
172
- 'icontag' => $html5 ? 'div' : 'dt',
173
- 'captiontag' => $html5 ? 'figcaption' : 'dd',
174
- 'columns' => 3,
175
- 'size' => 'thumbnail',
176
- 'link' => ''
177
- ), $attr );
178
 
179
- $itemtag = tag_escape( $atts['itemtag'] );
180
- $captiontag = tag_escape( $atts['captiontag'] );
181
- $icontag = tag_escape( $atts['icontag'] );
182
- $valid_tags = wp_kses_allowed_html( 'post' );
183
- if ( ! isset( $valid_tags[ $itemtag ] ) ) {
184
- $itemtag = 'dl';
185
- }
186
- if ( ! isset( $valid_tags[ $captiontag ] ) ) {
187
- $captiontag = 'dd';
188
- }
189
- if ( ! isset( $valid_tags[ $icontag ] ) ) {
190
- $icontag = 'dt';
191
  }
192
 
193
- $columns = intval( $atts['columns'] );
194
- $itemwidth = $columns > 0 ? floor(100/$columns) : 100;
195
- $float = is_rtl() ? 'right' : 'left';
196
-
197
- $selector = "gallery-{$instance}";
198
-
199
- $gallery_style = '';
200
-
201
-
202
- if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) {
203
- $gallery_style = "
204
- <style type='text/css'>
205
- #{$selector} {
206
- margin: auto;
207
- }
208
- #{$selector} .gallery-item {
209
- float: {$float};
210
- margin-top: 10px;
211
- text-align: center;
212
- width: {$itemwidth}%;
213
- }
214
- #{$selector} img {
215
- border: 2px solid #cfcfcf;
216
- }
217
- #{$selector} .gallery-caption {
218
- margin-left: 0;
219
- }
220
- /* see gallery_shortcode() in wp-includes/media.php */
221
- </style>\n\t\t";
222
  }
223
 
224
- $size_class = sanitize_html_class( $atts['size'] );
225
- $gallery_div = "<div id='$selector' class='gallery galleryid-{$instance} gallery-columns-{$columns} gallery-size-{$size_class}'>";
226
-
227
-
228
- $output = apply_filters( 'gallery_style', $gallery_style . $gallery_div );
229
-
230
- $i = 0;
231
- foreach ( $attachments as $id => $attachment ) {
232
-
233
- $attr = ( trim( $attachment->post_excerpt ) ) ? array( 'aria-describedby' => "$selector-$id" ) : '';
234
- if ( ! empty( $atts['link'] ) && 'file' === $atts['link'] ) {
235
- $image_output = wp_get_attachment_link( $id, $atts['size'], false, false, false, $attr );
236
- } elseif ( ! empty( $atts['link'] ) && 'none' === $atts['link'] ) {
237
- $image_output = wp_get_attachment_image( $id, $atts['size'], false, $attr );
238
- } else {
239
- $image_output = wp_get_attachment_link( $id, $atts['size'], true, false, false, $attr );
240
- }
241
- $image_meta = wp_get_attachment_metadata( $id );
242
-
243
- $orientation = '';
244
- if ( isset( $image_meta['height'], $image_meta['width'] ) ) {
245
- $orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
246
- }
247
- $output .= "<{$itemtag} class='gallery-item'>";
248
- $output .= "
249
- <{$icontag} class='gallery-icon {$orientation}'>
250
- $image_output
251
- </{$icontag}>";
252
- if ( $captiontag && trim($attachment->post_excerpt) ) {
253
- $output .= "
254
- <{$captiontag} class='wp-caption-text gallery-caption' id='$selector-$id'>
255
- " . wptexturize($attachment->post_excerpt) . "
256
- </{$captiontag}>";
257
- }
258
- $output .= "</{$itemtag}>";
259
- if ( ! $html5 && $columns > 0 && ++$i % $columns == 0 ) {
260
- $output .= '<br style="clear: both" />';
261
- }
262
- }
263
 
264
- if ( ! $html5 && $columns > 0 && $i % $columns !== 0 ) {
265
- $output .= "
266
- <br style='clear: both' />";
267
  }
268
 
269
- $output .= "
270
- </div>\n";
271
-
272
- return $output;
273
- }
274
- }
275
-
276
-
277
-
278
- /**
279
- * wpuxss_get_eml_gallery_feed
280
- *
281
- * @since 2.1.4
282
- * @created 26/12/15
283
- */
284
-
285
- if ( ! function_exists( 'wpuxss_get_eml_gallery_feed' ) ) {
286
-
287
- function wpuxss_get_eml_gallery_feed( $attachments, $attr ) {
288
-
289
- $atts = array_merge( array(
290
- 'size' => 'thumbnail',
291
- ), $attr );
292
-
293
- $output = "\n";
294
- foreach ( $attachments as $att_id => $attachment ) {
295
- $output .= wp_get_attachment_link( $att_id, $atts['size'], true ) . "\n";
296
  }
297
- return $output;
298
- }
299
- }
300
-
301
-
302
-
303
- /**
304
- * wpuxss_eml_gallery_shortcode
305
- *
306
- * @since 2.1
307
- * @created 24/11/15
308
- */
309
-
310
- add_filter( 'post_gallery', 'wpuxss_eml_gallery_shortcode', 12, 3 );
311
-
312
- if ( ! function_exists( 'wpuxss_eml_gallery_shortcode' ) ) {
313
-
314
- function wpuxss_eml_gallery_shortcode( $output, $attr, $instance = 0 ) {
315
-
316
- $attr = apply_filters( 'eml_gallery_attributes', $attr );
317
-
318
- $attachments = apply_filters( 'eml_gallery_attachments', array(), $attr );
319
 
 
320
 
321
- if ( empty( $attachments ) ) {
322
- return '';
323
  }
324
 
325
- if ( is_feed() ) {
326
- $output = wpuxss_get_eml_gallery_feed( $attachments, $attr );
327
- return $output;
328
- }
329
-
330
- $output = apply_filters( 'eml_gallery_output', '', $attachments, $attr, $instance );
331
-
332
- return $output;
333
- }
334
- }
335
-
336
-
337
-
338
- /**
339
- * wpuxss_eml_jp_carousel_force_enable
340
- *
341
- * Jetpack Carousel compatibility
342
- *
343
- * @since 2.1
344
- * @created 16/12/15
345
- */
346
-
347
- add_filter( 'jp_carousel_force_enable', 'wpuxss_eml_jp_carousel_force_enable' );
348
-
349
- if ( ! function_exists( 'wpuxss_eml_jp_carousel_force_enable' ) ) {
350
-
351
- function wpuxss_eml_jp_carousel_force_enable( $enabled ) {
352
- return true;
353
  }
354
  }
355
 
356
-
357
-
358
- /**
359
- * wpuxss_eml_jp_tiled_gallery_force_enable
360
- *
361
- * Jetpack (3.8.2) Tiled Galleries compatibility
362
- *
363
- * @since 2.1
364
- * @created 16/12/15
365
- */
366
-
367
- add_filter( 'eml_gallery_output', 'wpuxss_eml_jp_tiled_gallery_force_enable', 10, 4 );
368
-
369
- function wpuxss_eml_jp_tiled_gallery_force_enable( $output, $attachments, $attr, $instance ) {
370
-
371
- if ( ! class_exists( 'Jetpack_Tiled_Gallery' ) ) {
372
- return $output;
373
- }
374
-
375
- $html5 = current_theme_supports( 'html5', 'gallery' );
376
- $atts = array_merge( array(
377
- 'itemtag' => $html5 ? 'figure' : 'dl',
378
- 'icontag' => $html5 ? 'div' : 'dt',
379
- 'captiontag' => $html5 ? 'figcaption' : 'dd',
380
- 'columns' => 3,
381
- 'size' => 'thumbnail',
382
- 'link' => ''
383
- ), $attr );
384
-
385
-
386
- $gallery = new eml_Jetpack_Tiled_Gallery;
387
- $output = $gallery->gallery_output( $attachments, $atts );
388
-
389
- return $output;
390
- }
391
-
392
-
393
-
394
- add_action( 'init', 'wpuxss_eml_jetpack_tiled_gallery_override' );
395
-
396
- if ( ! function_exists( 'wpuxss_eml_jetpack_tiled_gallery_override' ) ) {
397
-
398
- function wpuxss_eml_jetpack_tiled_gallery_override() {
399
-
400
- if ( ! class_exists( 'Jetpack_Tiled_Gallery' ) ) {
401
- return;
402
- }
403
-
404
- class eml_Jetpack_Tiled_Gallery extends Jetpack_Tiled_Gallery {
405
-
406
- private static $talaveras = array( 'rectangular', 'square', 'circle', 'rectangle', 'columns' );
407
-
408
- public function gallery_output( $attachments, $atts ) {
409
-
410
- $this->set_atts( $atts );
411
-
412
- if (
413
- in_array(
414
- $this->atts['type'],
415
- $talaveras = apply_filters( 'jetpack_tiled_gallery_types', self::$talaveras )
416
- )
417
- ) {
418
- // Enqueue styles and scripts
419
- self::default_scripts_and_styles();
420
-
421
- // Generate gallery HTML
422
- $gallery_class = 'Jetpack_Tiled_Gallery_Layout_' . ucfirst( $this->atts['type'] );
423
- $gallery = new $gallery_class( $attachments, $this->atts['link'], $this->atts['grayscale'], (int) $this->atts['columns'] );
424
- $gallery_html = $gallery->HTML();
425
-
426
- if ( $gallery_html && class_exists( 'Jetpack' ) && class_exists( 'Jetpack_Photon' ) ) {
427
- // Tiled Galleries in Jetpack require that Photon be active.
428
- // If it's not active, run it just on the gallery output.
429
- if ( ! in_array( 'photon', Jetpack::get_active_modules() ) && ! Jetpack::is_development_mode() )
430
- $gallery_html = Jetpack_Photon::filter_the_content( $gallery_html );
431
- }
432
-
433
- return trim( preg_replace( '/\s+/', ' ', $gallery_html ) ); // remove any new lines from the output so that the reader parses it better
434
- }
435
-
436
- return '';
437
- }
438
- }
439
- }
440
- }
441
-
442
-
443
-
444
- /**
445
- * wpuxss_eml_print_media_gallery_templates
446
- *
447
- * @since 2.1
448
- * @created 10/12/15
449
- */
450
-
451
- add_action( 'print_media_templates', 'wpuxss_eml_print_media_gallery_templates' );
452
-
453
- if ( ! function_exists( 'wpuxss_eml_print_media_gallery_templates' ) ) {
454
-
455
- function wpuxss_eml_print_media_gallery_templates() { ?>
456
-
457
- <script type="text/html" id="tmpl-eml-gallery-settings">
458
-
459
- <div class="eml-info-box">
460
-
461
- <h3><?php _e('Gallery Settings'); ?></h3>
462
-
463
- <label class="setting">
464
- <span><?php _e('Link To'); ?></span>
465
- <select class="link-to"
466
- data-setting="link"
467
- <# if ( data.userSettings ) { #>
468
- data-user-setting="urlbutton"
469
- <# } #>>
470
-
471
- <option value="post" <# if ( ! wp.media.galleryDefaults.link || 'post' == wp.media.galleryDefaults.link ) {
472
- #>selected="selected"<# }
473
- #>>
474
- <?php esc_attr_e('Attachment Page'); ?>
475
- </option>
476
- <option value="file" <# if ( 'file' == wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>>
477
- <?php esc_attr_e('Media File'); ?>
478
- </option>
479
- <option value="none" <# if ( 'none' == wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>>
480
- <?php esc_attr_e('None'); ?>
481
- </option>
482
- </select>
483
- </label>
484
-
485
- <label class="setting">
486
- <span><?php _e('Columns'); ?></span>
487
- <select class="columns" name="columns"
488
- data-setting="columns">
489
- <?php for ( $i = 1; $i <= 9; $i++ ) : ?>
490
- <option value="<?php echo esc_attr( $i ); ?>" <#
491
- if ( <?php echo $i ?> == wp.media.galleryDefaults.columns ) { #>selected="selected"<# }
492
- #>>
493
- <?php echo esc_html( $i ); ?>
494
- </option>
495
- <?php endfor; ?>
496
- </select>
497
- </label>
498
-
499
- <label class="setting _orderbyRandom">
500
- <span><?php _e( 'Random Order' ); ?></span>
501
- <input type="checkbox" data-setting="_orderbyRandom" />
502
- </label>
503
-
504
- <label class="setting size">
505
- <span><?php _e( 'Size' ); ?></span>
506
- <select class="size" name="size"
507
- data-setting="size"
508
- <# if ( data.userSettings ) { #>
509
- data-user-setting="imgsize"
510
- <# } #>
511
- >
512
- <?php
513
- // This filter is documented in wp-admin/includes/media.php
514
- $size_names = apply_filters( 'image_size_names_choose', array(
515
- 'thumbnail' => __( 'Thumbnail' ),
516
- 'medium' => __( 'Medium' ),
517
- 'large' => __( 'Large' ),
518
- 'full' => __( 'Full Size' ),
519
- ) );
520
-
521
- foreach ( $size_names as $size => $label ) : ?>
522
- <option value="<?php echo esc_attr( $size ); ?>">
523
- <?php echo esc_html( $label ); ?>
524
- </option>
525
- <?php endforeach; ?>
526
- </select>
527
- </label>
528
-
529
- </div>
530
-
531
- <#
532
- var library = data.controller.frame.state().get( 'library' ),
533
- isFilterBased = emlIsGalleryFilterBased( library.props.toJSON() );
534
-
535
- if ( isFilterBased ) { #>
536
-
537
- <div class="eml-info-box">
538
-
539
- <h3><?php _e( 'Based On', 'eml' ); ?></h3>
540
- <label class="setting filter-based">
541
-
542
- <ul class="eml-filter-based">
543
-
544
- <#
545
- _.each( eml.l10n.all_taxonomies, function( attrs, taxonomy ) {
546
-
547
- var ids = library.props.get( taxonomy ),
548
- taxonomy_string;
549
-
550
- if ( ids ) {
551
-
552
- taxonomy_string = attrs.singular_name + ': ' + _.values( _.pick( attrs.terms, ids ) ).join(', ');
553
-
554
- #><li>{{taxonomy_string}}</li><#
555
- }
556
- });
557
-
558
- var months = wp.media.view.settings.months,
559
- monthnum = library.props.get( 'monthnum' ),
560
- year = library.props.get( 'year' ),
561
- uploadedTo = library.props.get( 'uploadedTo' );
562
-
563
- if ( monthnum && year ) {
564
- date = _.first( _.where( months, { month: monthnum, year: year } ) ).text;
565
- #><li>{{date}}</li><#
566
- }
567
-
568
- if ( ! _.isUndefined( uploadedTo ) ) {
569
-
570
- if ( uploadedTo == wp.media.view.settings.post.id ) {
571
- #><li>{{wp.media.view.l10n.uploadedToThisPost}}</li><#
572
- }
573
- else if ( parseInt( uploadedTo ) ) {
574
- #><li>{{window.eml.l10n.uploaded_to}}{{uploadedTo}}</li><#
575
- }
576
- }
577
- #>
578
- </ul>
579
- </label>
580
- </div>
581
- <# } #>
582
- </script>
583
- <?php }
584
- }
585
-
586
  ?>
3
 
4
 
5
  /**
6
+ * wpuxss_eml_shortcode_atts_gallery
7
  *
8
+ * @since 2.1.5
9
+ * @created 12/01/16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  */
11
 
12
+ add_filter( 'shortcode_atts_gallery', 'wpuxss_eml_shortcode_atts_gallery', 10, 3 );
13
 
14
+ if ( ! function_exists( 'wpuxss_eml_shortcode_atts_gallery' ) ) {
15
 
16
+ function wpuxss_eml_shortcode_atts_gallery( $out, $pairs, $atts ) {
17
 
18
  $is_filter_based = false;
19
+ $id = isset( $atts['id'] ) ? intval( $atts['id'] ) : 0;
20
 
 
 
 
 
 
 
 
21
 
22
+ // enforce order defaults
23
+ $pairs['order'] = 'ASC';
24
+ $pairs['orderby'] = 'menu_order ID';
 
 
 
 
 
25
 
 
 
 
 
 
 
 
 
26
 
27
+ foreach ( $pairs as $name => $default ) {
28
+ if ( array_key_exists( $name, $atts ) )
29
+ $out[$name] = $atts[$name];
30
+ else
31
+ $out[$name] = $default;
32
+ }
33
 
 
 
34
 
35
+ if ( isset( $atts['monthnum'] ) && isset( $atts['year'] ) ) {
36
  $is_filter_based = true;
37
  }
38
 
39
 
40
  $tax_query = array();
41
 
42
+ foreach ( get_taxonomies_for_attachments( 'names' ) as $taxonomy ) {
43
 
44
+ if ( isset( $atts[$taxonomy] ) ) {
45
 
46
+ $terms = explode( ',', $atts[$taxonomy] );
47
 
48
  $tax_query[] = array(
49
  'taxonomy' => $taxonomy,
57
  }
58
 
59
 
60
+ if ( ! $is_filter_based ) {
61
+ return $out;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
 
65
+ $ids = array();
 
 
 
 
 
 
 
 
 
66
 
67
+ $query = array(
68
+ 'post_status' => 'inherit',
69
+ 'post_type' => 'attachment',
70
+ 'post_mime_type' => 'image',
71
+ 'order' => $out['order'],
72
+ 'orderby' => $out['orderby'],
73
+ 'posts_per_page' => isset( $atts['limit'] ) ? intval( $atts['limit'] ) : -1, //TODO: add pagination
74
+ 'fields' => 'ids'
75
+ );
76
 
77
+ if ( isset( $atts['monthnum'] ) && isset( $atts['year'] ) ) {
 
 
 
 
 
 
 
 
78
 
79
+ $query['monthnum'] = $atts['monthnum'];
80
+ $query['year'] = $atts['year'];
 
 
 
 
 
 
 
 
 
 
81
  }
82
 
83
+ if ( 'post__in' === $out['orderby'] ) {
84
+ $query['orderby'] = 'menu_order ID';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  }
86
 
87
+ if ( ! empty( $tax_query ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
+ $tax_query['relation'] = 'AND';
90
+ $query['tax_query'] = $tax_query;
 
91
  }
92
 
93
+ if ( $id ) {
94
+ $query['post_parent'] = $id;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
+ $ids = get_posts( $query );
98
 
99
+ if ( ! empty( $ids ) ) {
100
+ $out['include'] = implode( ',', $ids );
101
  }
102
 
103
+ return $out;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  }
105
  }
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  ?>
core/options-pages.php CHANGED
@@ -823,7 +823,12 @@ if ( ! function_exists( 'wpuxss_eml_print_taxonomies_options' ) ) {
823
  <legend class="screen-reader-text"><span><?php _e('Enhanced gallery','eml'); ?></span></legend>
824
  <label for="wpuxss_eml_tax_options[enhance_gallery_shortcode]"><input name="wpuxss_eml_tax_options[enhance_gallery_shortcode]" type="hidden" value="0" /><input name="wpuxss_eml_tax_options[enhance_gallery_shortcode]" type="checkbox" value="1" <?php checked( true, $wpuxss_eml_tax_options['enhance_gallery_shortcode'], true ); ?> /> <?php _e('Enhance WordPress native gallery shortcode to make it understand media taxonomies, date, and image number limit','eml'); ?></label>
825
  <p class="description"><?php _e( 'The example: [gallery media_category="5" limit="10" monthnum="12" year="2015"]', 'eml' ); ?></p>
826
- <p class="description"><?php _e( '<strong style="color:red">Warning:</strong> Incompatibility with other gallery plugins or themes possible! <a href="http://www.wpuxsolutions.com/documents/enhanced-media-library/enhanced-gallery-issues/">Learn more.</a> Please check out your gallery front-end and back-end functionality once this option activated. If you find an issue please inform plugin authors at <a href="https://wordpress.org/support/plugin/enhanced-media-library">wordpress.org</a> or <a href="http://www.wpuxsolutions.com/support/create-new-ticket/">wpuxsolutions.com</a>.', 'eml' ); ?></p>
 
 
 
 
 
827
  </fieldset>
828
  </td>
829
  </tr>
823
  <legend class="screen-reader-text"><span><?php _e('Enhanced gallery','eml'); ?></span></legend>
824
  <label for="wpuxss_eml_tax_options[enhance_gallery_shortcode]"><input name="wpuxss_eml_tax_options[enhance_gallery_shortcode]" type="hidden" value="0" /><input name="wpuxss_eml_tax_options[enhance_gallery_shortcode]" type="checkbox" value="1" <?php checked( true, $wpuxss_eml_tax_options['enhance_gallery_shortcode'], true ); ?> /> <?php _e('Enhance WordPress native gallery shortcode to make it understand media taxonomies, date, and image number limit','eml'); ?></label>
825
  <p class="description"><?php _e( 'The example: [gallery media_category="5" limit="10" monthnum="12" year="2015"]', 'eml' ); ?></p>
826
+ <p class="description"><?php
827
+ printf( __( '%sWarning:%s Incompatibility with other gallery plugins or themes possible!', 'eml' ), '<strong style="color:red">', '</strong>' );
828
+
829
+ printf( __( '%sLearn more%s.', 'eml' ), ' <a href="http://www.wpuxsolutions.com/documents/enhanced-media-library/enhanced-gallery-possible-conflicts/">', '</a> ' );
830
+
831
+ printf( __( 'Please check out your gallery front-end and back-end functionality once this option activated. If you find an issue please inform plugin authors at %s or %s.', 'eml' ), '<a href="https://wordpress.org/support/plugin/enhanced-media-library">wordpress.org</a>', '<a href="http://www.wpuxsolutions.com/support/create-new-ticket/">wpuxsolutions.com</a>' ); ?></p>
832
  </fieldset>
833
  </td>
834
  </tr>
css/eml-admin.css CHANGED
@@ -89,10 +89,7 @@ body.eml-media-css .attachments-browser .instructions {
89
  display: block;
90
  }
91
 
92
- body.eml-media-css .eml-info-box {
93
- overflow: hidden;
94
- }
95
- body.eml-media-css .eml-info-box ul {
96
  margin: 0;
97
  }
98
 
@@ -312,6 +309,9 @@ body.eml-media-css .media-modal.acf-expanded .attachments-browser .media-toolbar
312
  .mode-select #reset-all-filters {
313
  margin: 11px 0 0;
314
  }
 
 
 
315
 
316
 
317
 
89
  display: block;
90
  }
91
 
92
+ body.eml-media-css .media-sidebar ul.eml-filter-based {
 
 
 
93
  margin: 0;
94
  }
95
 
309
  .mode-select #reset-all-filters {
310
  margin: 11px 0 0;
311
  }
312
+ .wp-customizer .mode-select #reset-all-filters {
313
+ margin: 0;
314
+ }
315
 
316
 
317
 
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.1.4
7
  Author: wpUXsolutions
8
  Author URI: http://wpUXsolutions.com
9
  Text Domain: eml
@@ -22,7 +22,7 @@ global $wp_version,
22
 
23
 
24
 
25
- $wpuxss_eml_version = '2.1.4';
26
 
27
 
28
 
@@ -423,19 +423,20 @@ if ( ! function_exists( 'wpuxss_eml_enqueue_media' ) ) {
423
  );
424
 
425
  $media_views_l10n = array(
426
- 'taxonomies' => $taxonomies_array,
427
- 'compat_taxonomies' => $compat_taxonomies,
428
  'compat_taxonomies_to_hide' => $compat_taxonomies_to_hide,
429
- 'is_tax_compat' => count( $compat_taxonomies_to_show ) ? 1 : 0,
430
- 'force_filters' => $wpuxss_eml_tax_options['force_filters'],
431
- 'media_orderby' => $wpuxss_eml_tax_options['media_orderby'],
432
- 'media_order' => $wpuxss_eml_tax_options['media_order'],
433
- 'wp_version' => $wp_version,
434
- 'uncategorized' => __( 'All Uncategorized', 'eml' ),
435
- 'filter_by' => __( 'Filter by ', 'eml' ),
436
- 'in' => __( 'All ', 'eml' ),
437
- 'not_in' => __( 'Not in ', 'eml' ),
438
- 'reset_filters' => __( 'Reset All Filters', 'eml' )
 
439
  );
440
 
441
  wp_localize_script(
@@ -465,7 +466,8 @@ if ( ! function_exists( 'wpuxss_eml_enqueue_media' ) ) {
465
 
466
  $enhanced_gallery_l10n = array(
467
  'all_taxonomies' => $all_taxonomies_array,
468
- 'uploaded_to' => __( 'Uploaded to post #', 'eml' )
 
469
  );
470
 
471
  wp_localize_script(
@@ -487,43 +489,6 @@ if ( ! function_exists( 'wpuxss_eml_enqueue_media' ) ) {
487
  true
488
  );
489
  }
490
-
491
- // scripts for Appearance -> Header
492
- if ( isset( $current_screen ) && 'appearance_page_custom-header' === $current_screen->base ) {
493
-
494
- wp_enqueue_script(
495
- 'wpuxss-eml-custom-header-script',
496
- $wpuxss_eml_dir . 'js/eml-custom-header.js',
497
- array('custom-header'),
498
- $wpuxss_eml_version,
499
- true
500
- );
501
- }
502
-
503
- // scripts for Appearance -> Background
504
- if ( isset( $current_screen ) && 'appearance_page_custom-background' === $current_screen->base ) {
505
-
506
- wp_enqueue_script(
507
- 'wpuxss-eml-custom-background-script',
508
- $wpuxss_eml_dir . 'js/eml-custom-background.js',
509
- array('custom-background'),
510
- $wpuxss_eml_version,
511
- true
512
- );
513
- }
514
-
515
-
516
- // scripts for /wp-admin/customize.php
517
- if ( isset( $current_screen ) && 'customize' === $current_screen->base ) {
518
-
519
- wp_enqueue_script(
520
- 'wpuxss-eml-customize-controls-script',
521
- $wpuxss_eml_dir . 'js/eml-customize-controls.js',
522
- array('customize-controls'),
523
- $wpuxss_eml_version,
524
- true
525
- );
526
- }
527
  }
528
  }
529
 
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.1.5
7
  Author: wpUXsolutions
8
  Author URI: http://wpUXsolutions.com
9
  Text Domain: eml
22
 
23
 
24
 
25
+ $wpuxss_eml_version = '2.1.5';
26
 
27
 
28
 
423
  );
424
 
425
  $media_views_l10n = array(
426
+ 'taxonomies' => $taxonomies_array,
427
+ 'compat_taxonomies' => $compat_taxonomies,
428
  'compat_taxonomies_to_hide' => $compat_taxonomies_to_hide,
429
+ 'is_tax_compat' => count( $compat_taxonomies_to_show ) ? 1 : 0,
430
+ 'force_filters' => $wpuxss_eml_tax_options['force_filters'],
431
+ 'media_orderby' => $wpuxss_eml_tax_options['media_orderby'],
432
+ 'media_order' => $wpuxss_eml_tax_options['media_order'],
433
+ 'wp_version' => $wp_version,
434
+ 'uncategorized' => __( 'All Uncategorized', 'eml' ),
435
+ 'filter_by' => __( 'Filter by ', 'eml' ),
436
+ 'in' => __( 'All ', 'eml' ),
437
+ 'not_in' => __( 'Not in ', 'eml' ),
438
+ 'reset_filters' => __( 'Reset All Filters', 'eml' ),
439
+ 'current_screen' => $current_screen->id
440
  );
441
 
442
  wp_localize_script(
466
 
467
  $enhanced_gallery_l10n = array(
468
  'all_taxonomies' => $all_taxonomies_array,
469
+ 'uploaded_to' => __( 'Uploaded to post #', 'eml' ),
470
+ 'based_on' => __( 'Based On', 'eml' )
471
  );
472
 
473
  wp_localize_script(
489
  true
490
  );
491
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
492
  }
493
  }
494
 
js/eml-custom-background.js DELETED
@@ -1,63 +0,0 @@
1
- ( function( $ ) {
2
-
3
- var frame;
4
-
5
- $( document ).ready(function() {
6
-
7
- $('#choose-from-library-link').unbind('click').click( function( event ) {
8
-
9
- var $el = $(this);
10
-
11
- event.preventDefault();
12
-
13
- // If the media frame already exists, reopen it.
14
- if ( frame ) {
15
- frame.open();
16
- return;
17
- }
18
-
19
- // Create the media frame.
20
- frame = wp.media.frames.customBackground = wp.media({
21
-
22
- // Customize the submit button.
23
- button: {
24
- // Set the text of the button.
25
- text: $el.data('update'),
26
- // Tell the button not to close the modal, since we're
27
- // going to refresh the page when the image is selected.
28
- close: false
29
- },
30
-
31
- states: [
32
- new wp.media.controller.Library({
33
- title: $el.data('choose'),
34
- library: wp.media.query({ type: 'image' }),
35
- multiple: false,
36
- priority: 20,
37
- filterable: 'eml' // turn on filters
38
- })
39
- ]
40
- });
41
-
42
- // When an image is selected, run a callback.
43
- frame.on( 'select', function() {
44
- // Grab the selected attachment.
45
- var attachment = frame.state().get('selection').first();
46
-
47
- // Run an AJAX request to set the background image.
48
- $.post( ajaxurl, {
49
- action: 'set-background-image',
50
- attachment_id: attachment.id,
51
- size: 'full'
52
- }).done( function() {
53
- // When the request completes, reload the window.
54
- window.location.reload();
55
- });
56
- });
57
-
58
- // Finally, open the modal.
59
- frame.open();
60
- });
61
- });
62
-
63
- })( jQuery );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/eml-custom-header.js DELETED
@@ -1,56 +0,0 @@
1
- ( function( $ ) {
2
-
3
- var frame;
4
-
5
- $( document ).ready(function() {
6
-
7
- $("#choose-from-library-link").unbind('click').click( function( event ) {
8
-
9
- var $el = $(this);
10
-
11
- event.preventDefault();
12
-
13
- // If the media frame already exists, reopen it.
14
- if ( frame ) {
15
- frame.open();
16
- return;
17
- }
18
-
19
- // Create the media frame.
20
- frame = wp.media.frames.customHeader = wp.media({
21
-
22
- // Customize the submit button.
23
- button: {
24
- // Set the text of the button.
25
- text: $el.data('update'),
26
- // Tell the button not to close the modal, since we're
27
- // going to refresh the page when the image is selected.
28
- close: false
29
- },
30
-
31
- states: [
32
- new wp.media.controller.Library({
33
- title: $el.data('choose'),
34
- library: wp.media.query({ type: 'image' }),
35
- multiple: false,
36
- priority: 20,
37
- filterable: 'eml' // turn on filters
38
- })
39
- ]
40
- });
41
-
42
- // When an image is selected, run a callback.
43
- frame.on( 'select', function() {
44
- // Grab the selected attachment.
45
- var attachment = frame.state().get('selection').first(),
46
- link = $el.data('updateLink');
47
-
48
- // Tell the browser to navigate to the crop step.
49
- window.location = link + '&file=' + attachment.id;
50
- });
51
-
52
- frame.open();
53
- });
54
- });
55
-
56
- })( jQuery );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/eml-customize-controls.js DELETED
@@ -1,46 +0,0 @@
1
- window.wp = window.wp || {};
2
-
3
- ( function( $ ) {
4
-
5
- wp.customize.HeaderControl = wp.customize.HeaderControl.extend({
6
-
7
- openMedia: function(event) {
8
-
9
- var l10n = _wpMediaViewsL10n;
10
-
11
- event.preventDefault();
12
-
13
- this.frame = wp.media({
14
- button: {
15
- text: l10n.selectAndCrop,
16
- close: false
17
- },
18
- states: [
19
- new wp.media.controller.Library({
20
- title: l10n.chooseImage,
21
- library: wp.media.query({ type: 'image' }),
22
- multiple: false,
23
- priority: 20,
24
- suggestedWidth: _wpCustomizeHeader.data.width,
25
- suggestedHeight: _wpCustomizeHeader.data.height,
26
- filterable: 'eml' // turn on filters
27
- }),
28
- new wp.media.controller.Cropper({
29
- imgSelectOptions: this.calculateImageSelectOptions
30
- })
31
- ]
32
- });
33
-
34
- this.frame.on('select', this.onSelect, this);
35
- this.frame.on('cropped', this.onCropped, this);
36
- this.frame.on('skippedcrop', this.onSkippedCrop, this);
37
-
38
- this.frame.open();
39
- }
40
- });
41
-
42
- $.extend( wp.customize.controlConstructor, {
43
- header: wp.customize.HeaderControl
44
- });
45
-
46
- })( jQuery );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/eml-enhanced-gallery.js CHANGED
@@ -86,13 +86,32 @@ function emlIsGalleryFilterBased( attrs ) {
86
  * wp.media.view.Settings.Gallery
87
  *
88
  */
 
 
 
 
 
 
 
89
  _.extend( media.view.Settings.Gallery.prototype.events, {
90
- 'change ._orderbyRandom' : 'change_orderbyRandom',
91
  });
92
 
93
  _.extend( media.view.Settings.Gallery.prototype, {
94
 
95
- template: media.template('eml-gallery-settings'),
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
  change_orderbyRandom: function( event ) {
98
 
@@ -100,7 +119,54 @@ function emlIsGalleryFilterBased( attrs ) {
100
  reverse = content.get().toolbar.get( 'reverse' );
101
 
102
  reverse.model.set( 'disabled', $( event.target ).is(':checked') );
103
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  });
105
 
106
 
86
  * wp.media.view.Settings.Gallery
87
  *
88
  */
89
+ original.Settings = {
90
+
91
+ Gallery: {
92
+ render: media.view.Settings.Gallery.prototype.render
93
+ }
94
+ };
95
+
96
  _.extend( media.view.Settings.Gallery.prototype.events, {
97
+ 'change [data-setting=_orderbyRandom]' : 'change_orderbyRandom',
98
  });
99
 
100
  _.extend( media.view.Settings.Gallery.prototype, {
101
 
102
+ render: function() {
103
+
104
+ var append = this.basedOnHTML();
105
+
106
+
107
+ original.Settings.Gallery.render.apply( this, arguments );
108
+
109
+ if ( append ) {
110
+ this.$el.append( append );
111
+ }
112
+
113
+ return this;
114
+ },
115
 
116
  change_orderbyRandom: function( event ) {
117
 
119
  reverse = content.get().toolbar.get( 'reverse' );
120
 
121
  reverse.model.set( 'disabled', $( event.target ).is(':checked') );
122
+ },
123
+
124
+ basedOnHTML: function() {
125
+
126
+ var library = this.controller.frame.state().get('library'),
127
+ isFilterBased = emlIsGalleryFilterBased( library.props.toJSON() ),
128
+ append = '',
129
+ date,
130
+ months = media.view.settings.months,
131
+ monthnum = library.props.get( 'monthnum' ),
132
+ year = library.props.get( 'year' ),
133
+ uploadedTo = library.props.get( 'uploadedTo' );
134
+
135
+ if ( isFilterBased ) {
136
+
137
+ append = '<br class="clear" /><h3>' + eml.l10n.based_on + '</h3><label class="setting eml-filter-based"><ul class="eml-filter-based">';
138
+
139
+ _.each( eml.l10n.all_taxonomies, function( attrs, taxonomy ) {
140
+
141
+ var ids = library.props.get( taxonomy ),
142
+ taxonomy_string;
143
+
144
+ if ( ids ) {
145
+
146
+ taxonomy_string = attrs.singular_name + ': ' + _.values( _.pick( attrs.terms, ids ) ).join(', ');
147
+ append += '<li>' + taxonomy_string + '</li>';
148
+ }
149
+ });
150
+
151
+ if ( monthnum && year ) {
152
+ date = _.first( _.where( months, { month: monthnum, year: year } ) ).text;
153
+ append += '<li>' + date + '</li>';
154
+ }
155
+
156
+ if ( ! _.isUndefined( uploadedTo ) ) {
157
+
158
+ if ( uploadedTo == media.view.settings.post.id ) {
159
+ append += '<li>' + media.view.l10n.uploadedToThisPost + '</li>';
160
+ }
161
+ else if ( parseInt( uploadedTo ) ) {
162
+ append += '<li>' + eml.l10n.uploaded_to + uploadedTo + '</li>';
163
+ }
164
+ }
165
+ append += '</ul></label>';
166
+ }
167
+
168
+ return append;
169
+ },
170
  });
171
 
172
 
js/eml-media-editor.js CHANGED
@@ -15,7 +15,7 @@ window.eml = window.eml || { l10n: {} };
15
  *
16
  */
17
  _.extend( media.gallery.defaults, {
18
- orderby : 'menuOrder'
19
  });
20
 
21
  delete media.gallery.defaults.id;
@@ -36,7 +36,8 @@ window.eml = window.eml || { l10n: {} };
36
 
37
  delete collections[ shortcodeString ];
38
 
39
- if ( result && ! isFilterBased && ! shortcode.attrs.named.limit ) {
 
40
  return result;
41
  }
42
 
@@ -44,12 +45,15 @@ window.eml = window.eml || { l10n: {} };
44
  attrs = _.defaults( shortcode.attrs.named, this.defaults );
45
  args = _.pick( attrs, 'orderby', 'order' );
46
 
47
- if ( ! attrs.limit || _.isNaN( parseInt( attrs.limit ) ) || parseInt( attrs.limit ) < 1 ) {
48
  delete attrs.limit;
49
  }
 
 
 
50
 
51
- args.type = this.type;
52
- args.perPage = attrs.limit ? attrs.limit : -1;
53
 
54
 
55
  if ( 'rand' === attrs.orderby ) {
@@ -128,6 +132,8 @@ window.eml = window.eml || { l10n: {} };
128
  others[ key ] = self.coerce( others, key );
129
  });
130
 
 
 
131
  query = wp.media.query( args );
132
  query[ this.tag ] = new Backbone.Model( others );
133
 
@@ -152,7 +158,7 @@ window.eml = window.eml || { l10n: {} };
152
  _.extend( attrs, attachments[this.tag].toJSON() );
153
  }
154
 
155
- if ( ! isFilterBased || 'menuOrder' === attrs.orderby ) {
156
  // Convert all gallery shortcodes to use the `ids` property.
157
  // Ignore `post__in` and `post__not_in`; the attachments in
158
  // the collection will already reflect those properties.
@@ -192,8 +198,12 @@ window.eml = window.eml || { l10n: {} };
192
  delete attrs.order;
193
  }
194
 
195
- if ( ! attrs.limit || _.isNaN( parseInt( attrs.limit ) ) || parseInt( attrs.limit ) < 1 ) {
196
  delete attrs.limit;
 
 
 
 
197
  }
198
 
199
  attrs = this.setDefaults( attrs );
@@ -215,9 +225,10 @@ window.eml = window.eml || { l10n: {} };
215
  },
216
 
217
  edit: function( content ) {
 
218
  var shortcode = wp.shortcode.next( this.tag, content ),
219
  defaultPostId = this.defaults.id,
220
- attachments, selection, state;
221
 
222
  // Bail if we didn't match the shortcode or all of the content.
223
  if ( ! shortcode || shortcode.content !== content ) {
@@ -232,6 +243,7 @@ window.eml = window.eml || { l10n: {} };
232
  }
233
 
234
  attachments = this.attachments( shortcode );
 
235
 
236
  selection = new wp.media.model.Selection( attachments.models, {
237
  props: attachments.props.toJSON(),
15
  *
16
  */
17
  _.extend( media.gallery.defaults, {
18
+ orderby : 'menuOrder',
19
  });
20
 
21
  delete media.gallery.defaults.id;
36
 
37
  delete collections[ shortcodeString ];
38
 
39
+
40
+ if ( result && ! isFilterBased && _.isUndefined( shortcode.attrs.named.limit ) ) {
41
  return result;
42
  }
43
 
45
  attrs = _.defaults( shortcode.attrs.named, this.defaults );
46
  args = _.pick( attrs, 'orderby', 'order' );
47
 
48
+ if ( ! attrs.limit || _.isNaN( parseInt( attrs.limit, 10 ) ) || parseInt( attrs.limit, 10 ) < 1 ) {
49
  delete attrs.limit;
50
  }
51
+ else {
52
+ attrs.limit = parseInt( attrs.limit, 10 );
53
+ }
54
 
55
+ args.type = this.type;
56
+ args.perPage = attrs.limit || -1;
57
 
58
 
59
  if ( 'rand' === attrs.orderby ) {
132
  others[ key ] = self.coerce( others, key );
133
  });
134
 
135
+ media.model.Query.cleanQueries();
136
+
137
  query = wp.media.query( args );
138
  query[ this.tag ] = new Backbone.Model( others );
139
 
158
  _.extend( attrs, attachments[this.tag].toJSON() );
159
  }
160
 
161
+ if ( ! isFilterBased ) {
162
  // Convert all gallery shortcodes to use the `ids` property.
163
  // Ignore `post__in` and `post__not_in`; the attachments in
164
  // the collection will already reflect those properties.
198
  delete attrs.order;
199
  }
200
 
201
+ if ( ! attrs.limit || _.isNaN( parseInt( attrs.limit, 10 ) ) || parseInt( attrs.limit, 10 ) < 1 ) {
202
  delete attrs.limit;
203
+ delete media.galleryDefaults.limit;
204
+ }
205
+ else {
206
+ attrs.limit = parseInt( attrs.limit, 10 ).toString();
207
  }
208
 
209
  attrs = this.setDefaults( attrs );
225
  },
226
 
227
  edit: function( content ) {
228
+
229
  var shortcode = wp.shortcode.next( this.tag, content ),
230
  defaultPostId = this.defaults.id,
231
+ attachments, selection, state, props;
232
 
233
  // Bail if we didn't match the shortcode or all of the content.
234
  if ( ! shortcode || shortcode.content !== content ) {
243
  }
244
 
245
  attachments = this.attachments( shortcode );
246
+ attachments.props.set( 'perPage', -1 );
247
 
248
  selection = new wp.media.model.Selection( attachments.models, {
249
  props: attachments.props.toJSON(),
js/eml-media-models.js CHANGED
@@ -22,6 +22,7 @@ window.wp = window.wp || {};
22
  this.created = new Date();
23
 
24
  this.filters.order = function( attachment ) {
 
25
  var orderby = this.props.get('orderby'),
26
  order = this.props.get('order');
27
 
22
  this.created = new Date();
23
 
24
  this.filters.order = function( attachment ) {
25
+
26
  var orderby = this.props.get('orderby'),
27
  order = this.props.get('order');
28
 
js/eml-media-views.js CHANGED
@@ -477,7 +477,8 @@ window.eml = window.eml || { l10n: {} };
477
 
478
 
479
  if ( -1 !== $.inArray( this.options.filters, [ 'uploaded', 'all' ] ) ||
480
- parseInt( eml.l10n.force_filters ) && 'gallery-edit' !== this.controller._state ) {
 
481
 
482
 
483
  this.toolbar.set( 'filtersLabel', new media.view.Label({
477
 
478
 
479
  if ( -1 !== $.inArray( this.options.filters, [ 'uploaded', 'all' ] ) ||
480
+ ( parseInt( eml.l10n.force_filters ) && 'gallery-edit' !== this.controller._state ) ||
481
+ 'customize' === eml.l10n.current_screen ) {
482
 
483
 
484
  this.toolbar.set( 'filtersLabel', new media.view.Label({
languages/eml.pot CHANGED
@@ -4,7 +4,7 @@
4
  msgid ""
5
  msgstr ""
6
  "Project-Id-Version: Enhanced Media Library PRO\n"
7
- "POT-Creation-Date: 2016-01-10 01:44+0200\n"
8
  "Last-Translator: \n"
9
  "Language-Team: \n"
10
  "MIME-Version: 1.0\n"
@@ -36,7 +36,7 @@ msgid_plural "Unattached (%s)"
36
  msgstr[0] ""
37
  msgstr[1] ""
38
 
39
- #: core/class-eml-media-list-table.php:65 enhanced-media-library.php:449
40
  msgid "All Uncategorized"
41
  msgstr ""
42
 
@@ -52,7 +52,7 @@ msgstr[1] ""
52
  msgid "Filter"
53
  msgstr ""
54
 
55
- #: core/class-eml-media-list-table.php:90 enhanced-media-library.php:453
56
  msgid "Reset All Filters"
57
  msgstr ""
58
 
@@ -340,58 +340,6 @@ msgid_plural "%d media attachments restored from the trash."
340
  msgstr[0] ""
341
  msgstr[1] ""
342
 
343
- #: core/gallery.php:461 pro/core/gallery.php:22
344
- msgid "Gallery Settings"
345
- msgstr ""
346
-
347
- #: core/gallery.php:464 pro/core/gallery.php:25
348
- msgid "Link To"
349
- msgstr ""
350
-
351
- #: core/gallery.php:474 pro/core/gallery.php:34
352
- msgid "Attachment Page"
353
- msgstr ""
354
-
355
- #: core/gallery.php:477 pro/core/gallery.php:37
356
- msgid "Media File"
357
- msgstr ""
358
-
359
- #: core/gallery.php:480 pro/core/gallery.php:40
360
- msgid "None"
361
- msgstr ""
362
-
363
- #: core/gallery.php:486 pro/core/gallery.php:46
364
- msgid "Columns"
365
- msgstr ""
366
-
367
- #: core/gallery.php:500
368
- msgid "Random Order"
369
- msgstr ""
370
-
371
- #: core/gallery.php:505 pro/core/gallery.php:106
372
- msgid "Size"
373
- msgstr ""
374
-
375
- #: core/gallery.php:515 pro/core/gallery.php:116
376
- msgid "Thumbnail"
377
- msgstr ""
378
-
379
- #: core/gallery.php:516 pro/core/gallery.php:117
380
- msgid "Medium"
381
- msgstr ""
382
-
383
- #: core/gallery.php:517 pro/core/gallery.php:118
384
- msgid "Large"
385
- msgstr ""
386
-
387
- #: core/gallery.php:518 pro/core/gallery.php:119
388
- msgid "Full Size"
389
- msgstr ""
390
-
391
- #: core/gallery.php:539 pro/core/gallery.php:143
392
- msgid "Based On"
393
- msgstr ""
394
-
395
  #: core/mime-types.php:27
396
  msgid "MIME type settings restored."
397
  msgstr ""
@@ -418,7 +366,7 @@ msgstr ""
418
 
419
  #: core/options-pages.php:90 core/options-pages.php:561
420
  #: core/options-pages.php:583 core/options-pages.php:629
421
- #: core/options-pages.php:694 core/options-pages.php:1049
422
  msgid "Settings"
423
  msgstr ""
424
 
@@ -428,7 +376,7 @@ msgid "Taxonomies"
428
  msgstr ""
429
 
430
  #: core/options-pages.php:106 core/options-pages.php:107
431
- #: core/options-pages.php:877
432
  msgid "MIME Types"
433
  msgstr ""
434
 
@@ -520,7 +468,7 @@ msgid "Duplicate extensions or MIME types. Please chose other one."
520
  msgstr ""
521
 
522
  #: core/options-pages.php:189 core/options-pages.php:486
523
- #: core/options-pages.php:869
524
  msgid "You do not have sufficient permissions to access this page."
525
  msgstr ""
526
 
@@ -770,57 +718,64 @@ msgid ""
770
  "\"2015\"]"
771
  msgstr ""
772
 
773
- #: core/options-pages.php:826
 
 
 
 
 
 
 
 
 
 
 
 
774
  msgid ""
775
- "<strong style=\"color:red\">Warning:</strong> Incompatibility with other "
776
- "gallery plugins or themes possible! <a href=\"http://www.wpuxsolutions.com/"
777
- "documents/enhanced-media-library/enhanced-gallery-issues/\">Learn more.</a> "
778
  "Please check out your gallery front-end and back-end functionality once this "
779
- "option activated. If you find an issue please inform plugin authors at <a "
780
- "href=\"https://wordpress.org/support/plugin/enhanced-media-library"
781
- "\">wordpress.org</a> or <a href=\"http://www.wpuxsolutions.com/support/"
782
- "create-new-ticket/\">wpuxsolutions.com</a>."
783
  msgstr ""
784
 
785
- #: core/options-pages.php:878
786
  msgid "Add New MIME Type"
787
  msgstr ""
788
 
789
- #: core/options-pages.php:896 core/options-pages.php:951
790
  msgid "Extension"
791
  msgstr ""
792
 
793
- #: core/options-pages.php:897 core/options-pages.php:952
794
  msgid "MIME Type"
795
  msgstr ""
796
 
797
- #: core/options-pages.php:898 core/options-pages.php:953
798
  msgid "Singular Label"
799
  msgstr ""
800
 
801
- #: core/options-pages.php:899 core/options-pages.php:954
802
  msgid "Plural Label"
803
  msgstr ""
804
 
805
- #: core/options-pages.php:900 core/options-pages.php:930
806
- #: core/options-pages.php:943 core/options-pages.php:955
807
  msgid "Add Filter"
808
  msgstr ""
809
 
810
- #: core/options-pages.php:901 core/options-pages.php:931
811
- #: core/options-pages.php:944 core/options-pages.php:956
812
  msgid "Allow Upload"
813
  msgstr ""
814
 
815
- #: core/options-pages.php:945
816
  msgid "Delete MIME Type"
817
  msgstr ""
818
 
819
- #: core/options-pages.php:962
820
  msgid "Restore WordPress default MIME Types"
821
  msgstr ""
822
 
823
- #: core/options-pages.php:964 pro/enhanced-media-library-pro.php:179
824
  msgid "Save Changes"
825
  msgstr ""
826
 
@@ -829,15 +784,15 @@ msgid "Taxonomy settings saved."
829
  msgstr ""
830
 
831
  #: core/taxonomies.php:340 core/taxonomies.php:346
832
- #: enhanced-media-library.php:450
833
  msgid "Filter by "
834
  msgstr ""
835
 
836
- #: core/taxonomies.php:347 enhanced-media-library.php:451
837
  msgid "All "
838
  msgstr ""
839
 
840
- #: core/taxonomies.php:348 enhanced-media-library.php:452
841
  msgid "Not in "
842
  msgstr ""
843
 
@@ -845,6 +800,10 @@ msgstr ""
845
  msgid "Uploaded to post #"
846
  msgstr ""
847
 
 
 
 
 
848
  #: pro/core/bulk-edit.php:55 pro/core/bulk-edit.php:62
849
  msgid "Remove"
850
  msgstr ""
@@ -889,39 +848,39 @@ msgstr ""
889
  msgid "Delete Selected"
890
  msgstr ""
891
 
892
- #: pro/core/gallery.php:68
893
  msgid "Order By"
894
  msgstr ""
895
 
896
- #: pro/core/gallery.php:72
897
  msgid "Date"
898
  msgstr ""
899
 
900
- #: pro/core/gallery.php:75
901
  msgid "Title"
902
  msgstr ""
903
 
904
- #: pro/core/gallery.php:78
905
  msgid "Custom Order"
906
  msgstr ""
907
 
908
- #: pro/core/gallery.php:81
909
  msgid "Random"
910
  msgstr ""
911
 
912
- #: pro/core/gallery.php:93
913
  msgid "Order"
914
  msgstr ""
915
 
916
- #: pro/core/gallery.php:97
917
  msgid "Ascending"
918
  msgstr ""
919
 
920
- #: pro/core/gallery.php:100
921
  msgid "Descending"
922
  msgstr ""
923
 
924
- #: pro/core/gallery.php:131
925
  msgid "Limit"
926
  msgstr ""
927
 
@@ -943,19 +902,19 @@ msgstr ""
943
  msgid "You license has been activated."
944
  msgstr ""
945
 
946
- #: pro/core/options-pages.php:130 pro/enhanced-media-library-pro.php:182
947
  msgid "Bulk Edit"
948
  msgstr ""
949
 
950
- #: pro/core/options-pages.php:138 pro/core/options-pages.php:141
951
  msgid "Turn off 'Save Changes' button"
952
  msgstr ""
953
 
954
- #: pro/core/options-pages.php:142
955
  msgid "Save changes on the fly"
956
  msgstr ""
957
 
958
- #: pro/core/options-pages.php:143
959
  msgid ""
960
  "Any click on a taxonomy checkbox during media files bulk edition will lead "
961
  "to an <strong style=\"color:red\">immediate saving</strong> of the data. "
@@ -964,17 +923,17 @@ msgid ""
964
  "files / taxonomies with this option turned on."
965
  msgstr ""
966
 
967
- #: pro/core/options-pages.php:144
968
  msgid ""
969
  "Strongly NOT recommended option if you work with more than hundred of files "
970
  "at a time."
971
  msgstr ""
972
 
973
- #: pro/core/options-pages.php:183 pro/core/options-pages.php:201
974
  msgid "License Key"
975
  msgstr ""
976
 
977
- #: pro/core/options-pages.php:194
978
  #, php-format
979
  msgid ""
980
  "To unlock updates please enter your license key below. You can get your "
@@ -982,32 +941,32 @@ msgid ""
982
  "license, you are welcome to <a href=\"%s\">purchase it</a>."
983
  msgstr ""
984
 
985
- #: pro/core/options-pages.php:204
986
  msgid "Activate License"
987
  msgstr ""
988
 
989
- #: pro/core/options-pages.php:211
990
  msgid "Your license is active!"
991
  msgstr ""
992
 
993
- #: pro/core/options-pages.php:215
994
  msgid "Deactivate License"
995
  msgstr ""
996
 
997
- #: pro/core/update.php:92 pro/core/update.php:98 pro/core/update.php:104
998
  msgid ""
999
  "An unexpected error occurred. Something may be wrong with WordPress.org or "
1000
  "this server&#8217;s configuration. If you continue to have problems, please "
1001
  "try the <a href=\"https://wordpress.org/support/\">support forums</a>."
1002
  msgstr ""
1003
 
1004
- #: pro/core/update.php:92
1005
  msgid ""
1006
  "(WordPress could not establish a secure connection to WordPress.org. Please "
1007
  "contact your server administrator.)"
1008
  msgstr ""
1009
 
1010
- #: pro/core/update.php:159
1011
  #, php-format
1012
  msgid ""
1013
  "To unlock updates, please <a href=\"%s\">activate your license</a>. You can "
4
  msgid ""
5
  msgstr ""
6
  "Project-Id-Version: Enhanced Media Library PRO\n"
7
+ "POT-Creation-Date: 2016-01-14 21:05+0200\n"
8
  "Last-Translator: \n"
9
  "Language-Team: \n"
10
  "MIME-Version: 1.0\n"
36
  msgstr[0] ""
37
  msgstr[1] ""
38
 
39
+ #: core/class-eml-media-list-table.php:65 enhanced-media-library.php:448
40
  msgid "All Uncategorized"
41
  msgstr ""
42
 
52
  msgid "Filter"
53
  msgstr ""
54
 
55
+ #: core/class-eml-media-list-table.php:90 enhanced-media-library.php:452
56
  msgid "Reset All Filters"
57
  msgstr ""
58
 
340
  msgstr[0] ""
341
  msgstr[1] ""
342
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
  #: core/mime-types.php:27
344
  msgid "MIME type settings restored."
345
  msgstr ""
366
 
367
  #: core/options-pages.php:90 core/options-pages.php:561
368
  #: core/options-pages.php:583 core/options-pages.php:629
369
+ #: core/options-pages.php:694 core/options-pages.php:1054
370
  msgid "Settings"
371
  msgstr ""
372
 
376
  msgstr ""
377
 
378
  #: core/options-pages.php:106 core/options-pages.php:107
379
+ #: core/options-pages.php:882
380
  msgid "MIME Types"
381
  msgstr ""
382
 
468
  msgstr ""
469
 
470
  #: core/options-pages.php:189 core/options-pages.php:486
471
+ #: core/options-pages.php:874
472
  msgid "You do not have sufficient permissions to access this page."
473
  msgstr ""
474
 
718
  "\"2015\"]"
719
  msgstr ""
720
 
721
+ #: core/options-pages.php:827
722
+ #, php-format
723
+ msgid ""
724
+ "%sWarning:%s Incompatibility with other gallery plugins or themes possible!"
725
+ msgstr ""
726
+
727
+ #: core/options-pages.php:829
728
+ #, php-format
729
+ msgid "%sLearn more%s."
730
+ msgstr ""
731
+
732
+ #: core/options-pages.php:831
733
+ #, php-format
734
  msgid ""
 
 
 
735
  "Please check out your gallery front-end and back-end functionality once this "
736
+ "option activated. If you find an issue please inform plugin authors at %s or "
737
+ "%s."
 
 
738
  msgstr ""
739
 
740
+ #: core/options-pages.php:883
741
  msgid "Add New MIME Type"
742
  msgstr ""
743
 
744
+ #: core/options-pages.php:901 core/options-pages.php:956
745
  msgid "Extension"
746
  msgstr ""
747
 
748
+ #: core/options-pages.php:902 core/options-pages.php:957
749
  msgid "MIME Type"
750
  msgstr ""
751
 
752
+ #: core/options-pages.php:903 core/options-pages.php:958
753
  msgid "Singular Label"
754
  msgstr ""
755
 
756
+ #: core/options-pages.php:904 core/options-pages.php:959
757
  msgid "Plural Label"
758
  msgstr ""
759
 
760
+ #: core/options-pages.php:905 core/options-pages.php:935
761
+ #: core/options-pages.php:948 core/options-pages.php:960
762
  msgid "Add Filter"
763
  msgstr ""
764
 
765
+ #: core/options-pages.php:906 core/options-pages.php:936
766
+ #: core/options-pages.php:949 core/options-pages.php:961
767
  msgid "Allow Upload"
768
  msgstr ""
769
 
770
+ #: core/options-pages.php:950
771
  msgid "Delete MIME Type"
772
  msgstr ""
773
 
774
+ #: core/options-pages.php:967
775
  msgid "Restore WordPress default MIME Types"
776
  msgstr ""
777
 
778
+ #: core/options-pages.php:969 pro/enhanced-media-library-pro.php:179
779
  msgid "Save Changes"
780
  msgstr ""
781
 
784
  msgstr ""
785
 
786
  #: core/taxonomies.php:340 core/taxonomies.php:346
787
+ #: enhanced-media-library.php:449
788
  msgid "Filter by "
789
  msgstr ""
790
 
791
+ #: core/taxonomies.php:347 enhanced-media-library.php:450
792
  msgid "All "
793
  msgstr ""
794
 
795
+ #: core/taxonomies.php:348 enhanced-media-library.php:451
796
  msgid "Not in "
797
  msgstr ""
798
 
800
  msgid "Uploaded to post #"
801
  msgstr ""
802
 
803
+ #: enhanced-media-library.php:484
804
+ msgid "Based On"
805
+ msgstr ""
806
+
807
  #: pro/core/bulk-edit.php:55 pro/core/bulk-edit.php:62
808
  msgid "Remove"
809
  msgstr ""
848
  msgid "Delete Selected"
849
  msgstr ""
850
 
851
+ #: pro/core/gallery.php:21
852
  msgid "Order By"
853
  msgstr ""
854
 
855
+ #: pro/core/gallery.php:25
856
  msgid "Date"
857
  msgstr ""
858
 
859
+ #: pro/core/gallery.php:28
860
  msgid "Title"
861
  msgstr ""
862
 
863
+ #: pro/core/gallery.php:31
864
  msgid "Custom Order"
865
  msgstr ""
866
 
867
+ #: pro/core/gallery.php:34
868
  msgid "Random"
869
  msgstr ""
870
 
871
+ #: pro/core/gallery.php:40
872
  msgid "Order"
873
  msgstr ""
874
 
875
+ #: pro/core/gallery.php:44
876
  msgid "Ascending"
877
  msgstr ""
878
 
879
+ #: pro/core/gallery.php:47
880
  msgid "Descending"
881
  msgstr ""
882
 
883
+ #: pro/core/gallery.php:57
884
  msgid "Limit"
885
  msgstr ""
886
 
902
  msgid "You license has been activated."
903
  msgstr ""
904
 
905
+ #: pro/core/options-pages.php:156 pro/enhanced-media-library-pro.php:182
906
  msgid "Bulk Edit"
907
  msgstr ""
908
 
909
+ #: pro/core/options-pages.php:164 pro/core/options-pages.php:167
910
  msgid "Turn off 'Save Changes' button"
911
  msgstr ""
912
 
913
+ #: pro/core/options-pages.php:168
914
  msgid "Save changes on the fly"
915
  msgstr ""
916
 
917
+ #: pro/core/options-pages.php:169
918
  msgid ""
919
  "Any click on a taxonomy checkbox during media files bulk edition will lead "
920
  "to an <strong style=\"color:red\">immediate saving</strong> of the data. "
923
  "files / taxonomies with this option turned on."
924
  msgstr ""
925
 
926
+ #: pro/core/options-pages.php:170
927
  msgid ""
928
  "Strongly NOT recommended option if you work with more than hundred of files "
929
  "at a time."
930
  msgstr ""
931
 
932
+ #: pro/core/options-pages.php:209 pro/core/options-pages.php:227
933
  msgid "License Key"
934
  msgstr ""
935
 
936
+ #: pro/core/options-pages.php:220
937
  #, php-format
938
  msgid ""
939
  "To unlock updates please enter your license key below. You can get your "
941
  "license, you are welcome to <a href=\"%s\">purchase it</a>."
942
  msgstr ""
943
 
944
+ #: pro/core/options-pages.php:230
945
  msgid "Activate License"
946
  msgstr ""
947
 
948
+ #: pro/core/options-pages.php:237
949
  msgid "Your license is active!"
950
  msgstr ""
951
 
952
+ #: pro/core/options-pages.php:241
953
  msgid "Deactivate License"
954
  msgstr ""
955
 
956
+ #: pro/core/update.php:110 pro/core/update.php:116 pro/core/update.php:122
957
  msgid ""
958
  "An unexpected error occurred. Something may be wrong with WordPress.org or "
959
  "this server&#8217;s configuration. If you continue to have problems, please "
960
  "try the <a href=\"https://wordpress.org/support/\">support forums</a>."
961
  msgstr ""
962
 
963
+ #: pro/core/update.php:110
964
  msgid ""
965
  "(WordPress could not establish a secure connection to WordPress.org. Please "
966
  "contact your server administrator.)"
967
  msgstr ""
968
 
969
+ #: pro/core/update.php:177
970
  #, php-format
971
  msgid ""
972
  "To unlock updates, please <a href=\"%s\">activate your license</a>. You can "
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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.4
5
  Tested up to: 4.4.1
6
- Stable tag: 2.1.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -18,41 +18,35 @@ A better management for WordPress Media Library
18
  The plugin will be handy for those who need to manage a lot of media files.
19
 
20
 
21
- = Media Taxonomies (Categories and Tags for media items) =
 
 
22
 
23
  **Various media categories.** With the plugin installed you immediately obtain Media Categories for categorizing and filtering media items in WordPress admin. This feature alone will save you hours of searching through a media library with even as few as 100 images.
24
 
25
- Whether you have a lot of images that need to be organized into complex structures or simply dislike the name of the default taxonomy - Media Categories - you can create and (un)assign to the media library as many taxonomies as you wish without writing a single line of code.
26
 
27
- You can also assign to the media library built-in WordPress taxonomies - Categories and Tags - as well as any other taxonomy created by third-party plugin, theme, or hand-coded - with only plugin's UI.
28
 
29
  **For both new and existing media items.** Categorize both new and existing media items. You can assign a category to a media item during the upload process, in the media library (preferably in the Grid Mode), in post/page editor media popup ("Add Media" button). If you need to manage a lot of media items at once, there is the PRO version of the plugin that allows to do it in bulk.
30
 
31
  **Filter media items in WP admin.** Every media library screen is enhanced with the plugin's filters to search and sort your media files. With flexible plugin's options you can adjust what filters you will see in Grid and List modes of the media library and in post/page editor media popups, and what taxonomies you would like to edit when inserting media to posts/pages. The plugin works with custom post types as well. The options can also help you to force plugin's filters for third-party plugins or themes, manage media taxonomies archive pages, etc.
32
 
33
- **Order options.** Since version 2.1.4 you can control the orderby and order options for your media library. With "Custom Order" you can re-order media items within a category with drag and drop. This order will be used, in particular, for the gallery based on this category.
34
-
35
 
36
- = Filter-Based Image Galleries (Fully compatible with WordPress native gallery shortcode) =
37
 
38
- Image categorizing can be useful for the front-end as well. To insert media galleries based on media categories you have to use the familiar format like `[gallery media_category="5" category="2" limit="10" monthnum="12" year="2015" orderby="title" order="DESC"]`. The PRO version of the plugin allows to manage gallery shortcode without "coding" at all. Just choose the settings with the plugin's UI in the familiar gallery edit popup and see your gallery live immediately in the post/page editor.
39
 
40
- To turn on the feature set "Enhanced gallery" option from Media Settings > Taxonomies > Options > Gallery. Please be advised that conflicts with other gallery plugins or themes are possible. Check your front-end and back-end gallery functionality after activating the feature.
41
 
42
- Compatibility ensured for plugins:
43
-
44
- * Jetpack Carousel
45
- * Jetpack Tiled Galleries
46
- * Simple Lightbox
47
- * Responsive Lightbox by dFactory
48
 
49
- Compatibility's possible with additional code ([learn more](http://www.wpuxsolutions.com/documents/enhanced-media-library/enhanced-gallery-issues/#s5)):
50
 
51
- * Photoswipe Masonry Gallery
52
- * Lightbox Gallery
53
 
 
54
 
55
- = MIME Types (Media File Types) =
56
 
57
  Another feature of the plugin is the MIME Types control. You can add new MIME types, delete existing ones, and point what file types are allowed for uploading. Initially, the plugin shows up the WordPress default MIME Type settings and creates the backup of them. The column "Add Filter" allows to add a MIME Type to plugin's filters so that you will be able to filter your media items not only by categories but also by the file type. You can set any label you wish to see in a filter with columns "Singular Label" and "Plural Label".
58
 
@@ -116,7 +110,7 @@ Please notice that you use the Enhanced Media Library with other plugins that ad
116
  = Useful Links =
117
 
118
  * [Where to start? (The complete beginners guide)](http://wpuxsolutions.com/documents/enhanced-media-library/eml-where-to-start/)
119
- * [Enhanced Gallery Issues](http://www.wpuxsolutions.com/documents/enhanced-media-library/enhanced-gallery-issues/)
120
 
121
 
122
 
@@ -124,9 +118,9 @@ Please notice that you use the Enhanced Media Library with other plugins that ad
124
 
125
  1. Upload plugin folder to '/wp-content/plugins/' directory
126
 
127
- 2. Activate the plugin through 'Plugins' menu in WordPress admin
128
 
129
- 3. Adjust plugin's settings on **Media Settings > Taxonomies** or **Media Settings > MIME Types**
130
 
131
  4. Enjoy Enhanced Media Library!
132
 
@@ -136,27 +130,29 @@ Please notice that you use the Enhanced Media Library with other plugins that ad
136
 
137
  = Why my custom media taxonomy's page is 404? =
138
 
139
- Try to just re-save permalinks settings. Go to Settings >> Permalinks and push "Save Changes" button.
140
 
141
  = Why Media Popup of some theme/plugin does not show taxonomy filters? =
142
 
143
- By default EML adds its filters to ANY media popup that already contains native WordPress filters. If a third-party plugin or theme supports native WordPress filters, EML will enhances them.
144
 
145
- If a third-party plugin or theme does not support WordPress native filters, but you believe that you need them, try 'Force filters' option (Media Settings > Taxonomies > Options > Filters). It allows forcing media filters for ANY media popup regardless of what was intended by the author of a third-party plugin or theme.
146
 
147
  = How to show images per media category on a webpage? =
148
 
149
- Since EML 2.1 you can use gallery shortcode with taxonomy parameters like this: `[gallery media_category="5" category="2" limit="10" monthnum="12" year="2015" orderby="title" order="DESC"]` to show filter-based gallery on the front-end. The feature should be activated on Media Settings > Taxonomies > Options > Gallery.
150
 
151
  Also, you can use WP_Query ([example of the code](http://wordpress.org/support/topic/php-displaying-an-array-of-images-per-category-or-categories)).
152
 
153
- = My gallery behavior is strange | My ligthbox/carousel plugin no longer works =
154
 
155
- The Enhanced Media Library enhances the WordPress gallery shortcode with the 'post_gallery' filter. It does this in the most gentle manner possible. It overrides the database query and leaves HTML/CSS code generating intact.
156
 
157
- But many other plugins do the same. Since, currently in WordPress it is not possible to separate a pure database request and generating gallery's HTML/CSS, the plugin conflicts are inevitable ([learn more](http://www.wpuxsolutions.com/documents/enhanced-media-library/enhanced-gallery-issues)).
158
 
159
- The solution: If your version is less than 2.1.4 please upgrade to 2.1.4. Unset "Enhanced gallery" option on Media Settings > Taxonomies > Options > Gallery and let us know what functionality was broken. We would like to find a solution!
 
 
160
 
161
  = I get "Something went wrong" error when bulk-editing in PRO =
162
 
@@ -192,6 +188,18 @@ No, all your data will remain intact. Your created media categories and their ti
192
 
193
  == Changelog ==
194
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  = 2.1.4 =
196
  *Release Date - January 10, 2016*
197
 
@@ -201,7 +209,6 @@ No, all your data will remain intact. Your created media categories and their ti
201
 
202
  = Improvements =
203
  * Bulk edit is now 3 times faster and less server resources consuming! [PRO only]
204
- * Filter "eml_gallery_output" added ([learn more](http://www.wpuxsolutions.com/documents/enhanced-media-library/enhanced-gallery-issues/#s4))
205
  * Gallery feature are now turned off by default. Option "Turn off enhanced gallery" replaced with "Enhanced gallery"
206
  * Minor CSS improvements
207
 
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.4
5
  Tested up to: 4.4.1
6
+ Stable tag: 2.1.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
18
  The plugin will be handy for those who need to manage a lot of media files.
19
 
20
 
21
+ = Media Taxonomies =
22
+
23
+ **Categories and Tags for media items**
24
 
25
  **Various media categories.** With the plugin installed you immediately obtain Media Categories for categorizing and filtering media items in WordPress admin. This feature alone will save you hours of searching through a media library with even as few as 100 images.
26
 
27
+ Whether you have a lot of images that need to be organized into complex structures or simply dislike the name of the default taxonomy Media Categories you can create and (un)assign to the media library as many taxonomies as you wish without writing a single line of code.
28
 
29
+ You can also assign to the media library built-in WordPress taxonomies Categories and Tags as well as any other taxonomy created by third-party plugin, theme, or hand-coded with only plugin's UI.
30
 
31
  **For both new and existing media items.** Categorize both new and existing media items. You can assign a category to a media item during the upload process, in the media library (preferably in the Grid Mode), in post/page editor media popup ("Add Media" button). If you need to manage a lot of media items at once, there is the PRO version of the plugin that allows to do it in bulk.
32
 
33
  **Filter media items in WP admin.** Every media library screen is enhanced with the plugin's filters to search and sort your media files. With flexible plugin's options you can adjust what filters you will see in Grid and List modes of the media library and in post/page editor media popups, and what taxonomies you would like to edit when inserting media to posts/pages. The plugin works with custom post types as well. The options can also help you to force plugin's filters for third-party plugins or themes, manage media taxonomies archive pages, etc.
34
 
35
+ **Order options.** With two options "Order media items by" (Date, Title, and Custom Order) and "Sort order" (Ascending and Descending) you can control media items order for all screens of the media library in WP admin. "Custom Order" allows to re-order media items within a category with drag and drop. This order will be used, in particular, for the gallery based on this category. See `Media Settings > Taxonomies > Options > Filters`.
 
36
 
 
37
 
38
+ = Filter-Based Image Galleries =
39
 
40
+ **Fully compatible with WordPress native gallery shortcode**
41
 
42
+ Image categorizing can be useful for the front-end as well. To insert media galleries based on media categories you have to use the familiar format like `[gallery media_category="5" category="2" limit="10" monthnum="12" year="2015" orderby="title" order="DESC"]`. The PRO version of the plugin allows to manage gallery shortcode without "coding" at all. Just choose the settings with the plugin's UI in the familiar gallery edit popup and see your gallery live immediately in the post/page editor.
 
 
 
 
 
43
 
44
+ To turn on the feature set "Enhanced gallery" option on `Media Settings > Taxonomies > Options > Gallery`. Please be advised that conflicts with other gallery plugins or themes are possible. Check your front-end and back-end gallery functionality after activating the feature.
45
 
 
 
46
 
47
+ = MIME Types =
48
 
49
+ **Media File Types**
50
 
51
  Another feature of the plugin is the MIME Types control. You can add new MIME types, delete existing ones, and point what file types are allowed for uploading. Initially, the plugin shows up the WordPress default MIME Type settings and creates the backup of them. The column "Add Filter" allows to add a MIME Type to plugin's filters so that you will be able to filter your media items not only by categories but also by the file type. You can set any label you wish to see in a filter with columns "Singular Label" and "Plural Label".
52
 
110
  = Useful Links =
111
 
112
  * [Where to start? (The complete beginners guide)](http://wpuxsolutions.com/documents/enhanced-media-library/eml-where-to-start/)
113
+ * [Enhanced Gallery Possible Conflicts](http://www.wpuxsolutions.com/documents/enhanced-media-library/enhanced-gallery-possible-conflicts/)
114
 
115
 
116
 
118
 
119
  1. Upload plugin folder to '/wp-content/plugins/' directory
120
 
121
+ 2. Activate the plugin through `Plugins` menu in WordPress admin
122
 
123
+ 3. Adjust plugin's settings on `Media Settings > Taxonomies` or `Media Settings > MIME Types`
124
 
125
  4. Enjoy Enhanced Media Library!
126
 
130
 
131
  = Why my custom media taxonomy's page is 404? =
132
 
133
+ Try to just re-save permalinks settings. Go to `Settings > Permalinks` and push "Save Changes" button.
134
 
135
  = Why Media Popup of some theme/plugin does not show taxonomy filters? =
136
 
137
+ By default EML adds its filters to any media popup that already contains native WordPress filters. If a third-party plugin or theme supports native WordPress filters, EML will enhance them.
138
 
139
+ If a third-party plugin or theme does not support WordPress native filters, but you believe that you need them, try "Force filters" option (`Media Settings > Taxonomies > Options > Filters`). It allows forcing media filters for ANY media popup regardless of what was intended by its creator.
140
 
141
  = How to show images per media category on a webpage? =
142
 
143
+ Since EML 2.1 you can use gallery shortcode with taxonomy parameters like this: `[gallery media_category="5" category="2" limit="10" monthnum="12" year="2015" orderby="title" order="DESC"]` to show filter-based gallery on the front-end. The feature should be activated on Media `Settings > Taxonomies > Options > Gallery`.
144
 
145
  Also, you can use WP_Query ([example of the code](http://wordpress.org/support/topic/php-displaying-an-array-of-images-per-category-or-categories)).
146
 
147
+ = My gallery behavior is strange | Wrong or none media items displayed | Ligtbox/carousel/slideshow/mosaic looks broken =
148
 
149
+ The plugin enhances WordPress gallery shortcode in most gentle manner possible. Since v2.1.5 the mechanism of the enhancement is dramatically improved to avoid possible conflicts. In most cases Enhanced Media Library is compatible with any plugin that changes *native* WP gallery template in order to provide lightbox, carousel, slideshow, grid/mosaic functionality.
150
 
151
+ That said, other plugins might override WP gallery attributes or database query for media items in a way that would prevent Enhanced Media Library from displaying correct set of media items for gallery.
152
 
153
+ If you find a possible conflict and prefer third-party features to taxonomy-based gallery of the plugin, please deactivate the feature (unset "Enhanced gallery" option on `Media Settings > Taxonomies > Options > Gallery`) and let us know about the issue. We would like to find a solution!
154
+
155
+ If you are a plugin/theme developer please read [Enhanced Gallery Possible Conflicts](http://www.wpuxsolutions.com/documents/enhanced-media-library/enhanced-gallery-possible-conflicts/)
156
 
157
  = I get "Something went wrong" error when bulk-editing in PRO =
158
 
188
 
189
  == Changelog ==
190
 
191
+ = 2.1.5 =
192
+ *Release Date - January 14, 2016*
193
+
194
+ = Improvements =
195
+ * Gallery enhancement is dramatically (!) improved to avoid possible conflicts ([learn more](http://www.wpuxsolutions.com/documents/enhanced-media-library/enhanced-gallery-possible-conflicts/))
196
+ * Few code improvements
197
+
198
+ = Bugfixes =
199
+ Filters returned to Customizer
200
+
201
+
202
+ &nbsp;
203
  = 2.1.4 =
204
  *Release Date - January 10, 2016*
205
 
209
 
210
  = Improvements =
211
  * Bulk edit is now 3 times faster and less server resources consuming! [PRO only]
 
212
  * Gallery feature are now turned off by default. Option "Turn off enhanced gallery" replaced with "Enhanced gallery"
213
  * Minor CSS improvements
214