Media Library Assistant - Version 2.51

Version Description

  • Fix: For the MLA UI Elements Example plugin, some defects in handling simple taxonomy parameters such as tax_operator have been corrected.
  • Fix: Change "primary column" handling for WP 4.3+ to be more like Media/Library submenu table.
Download this release

Release Info

Developer dglingren
Plugin Icon 128x128 Media Library Assistant
Version 2.51
Comparing to
See all releases

Code changes from version 2.50 to 2.51

examples/plugins/mla-ui-elements-example.php CHANGED
@@ -65,7 +65,7 @@
65
  * https://wordpress.org/support/topic/shortcode-456/
66
  *
67
  * @package MLA UI Elements Example
68
- * @version 1.07
69
  */
70
 
71
  /*
@@ -73,10 +73,10 @@ Plugin Name: MLA UI Elements Example
73
  Plugin URI: http://fairtradejudaica.org/media-library-assistant-a-wordpress-plugin/
74
  Description: Provides shortcodes to improve user experience for [mla_term_list], [mla_tag_cloud] and [mla_gallery] shortcodes
75
  Author: David Lingren
76
- Version: 1.07
77
  Author URI: http://fairtradejudaica.org/our-story/staff/
78
 
79
- Copyright 2016 David Lingren
80
 
81
  This program is free software; you can redistribute it and/or modify
82
  it under the terms of the GNU General Public License as published by
@@ -387,6 +387,31 @@ class MLAUIElementsExample {
387
  if ( ! ( empty( $shortcode_attributes[ $filter_taxonomy ] ) && empty( $tax_input ) ) ) {
388
  $tax_query = '';
389
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
390
  // Look for the optional "simple taxonomy query" as an initial filter
391
  if ( !empty( $shortcode_attributes[ $filter_taxonomy ] ) ) {
392
  if ( 'muie-no-terms' !== $shortcode_attributes[ $filter_taxonomy ] ) {
@@ -404,30 +429,13 @@ class MLAUIElementsExample {
404
 
405
  if ( !empty( $terms ) ) {
406
  $values = "array( '" . implode( "', '", $terms ) . "' )";
407
- $tax_query .= "array('taxonomy' => '{$filter_taxonomy}' ,'field' => 'slug','terms' => {$values}, 'operator' => 'IN'), ";
408
  }
409
  }
410
 
411
  unset( $shortcode_attributes[ $filter_taxonomy ] );
412
  }
413
 
414
- // Validate other tax_query parameters or set defaults
415
- $tax_relation = 'AND';
416
- if ( isset( $shortcode_attributes['tax_relation'] ) ) {
417
- $attr_value = strtoupper( $shortcode_attributes['tax_relation'] );
418
- if ( in_array( $attr_value, array( 'AND', 'OR' ) ) ) {
419
- $tax_relation = $attr_value;
420
- }
421
- }
422
-
423
- $default_operator = 'IN';
424
- if ( isset( $shortcode_attributes['tax_operator'] ) ) {
425
- $attr_value = strtoupper( $shortcode_attributes['tax_operator'] );
426
- if ( in_array( $attr_value, array( 'IN', 'NOT IN', 'AND' ) ) ) {
427
- $default_operator = $attr_value;
428
- }
429
- }
430
-
431
  foreach ( $tax_input as $taxonomy => $terms ) {
432
  // simple taxonomy query overrides tax_input
433
  if ( $taxonomy == $filter_taxonomy ) {
@@ -471,7 +479,7 @@ class MLAUIElementsExample {
471
  }
472
 
473
  // Taxonomy-specific "include_children"
474
- $tax_children = 'true';
475
  if ( isset( $shortcode_attributes[ $taxonomy . '_children' ] ) ) {
476
  $attr_value = strtolower( $shortcode_attributes[ $taxonomy . '_children' ] );
477
  if ( in_array( $attr_value, array( 'false', 'true' ) ) ) {
65
  * https://wordpress.org/support/topic/shortcode-456/
66
  *
67
  * @package MLA UI Elements Example
68
+ * @version 1.08
69
  */
70
 
71
  /*
73
  Plugin URI: http://fairtradejudaica.org/media-library-assistant-a-wordpress-plugin/
74
  Description: Provides shortcodes to improve user experience for [mla_term_list], [mla_tag_cloud] and [mla_gallery] shortcodes
75
  Author: David Lingren
76
+ Version: 1.08
77
  Author URI: http://fairtradejudaica.org/our-story/staff/
78
 
79
+ Copyright 2016-2017 David Lingren
80
 
81
  This program is free software; you can redistribute it and/or modify
82
  it under the terms of the GNU General Public License as published by
387
  if ( ! ( empty( $shortcode_attributes[ $filter_taxonomy ] ) && empty( $tax_input ) ) ) {
388
  $tax_query = '';
389
 
390
+ // Validate other tax_query parameters or set defaults
391
+ $tax_relation = 'AND';
392
+ if ( isset( $shortcode_attributes['tax_relation'] ) ) {
393
+ $attr_value = strtoupper( $shortcode_attributes['tax_relation'] );
394
+ if ( in_array( $attr_value, array( 'AND', 'OR' ) ) ) {
395
+ $tax_relation = $attr_value;
396
+ }
397
+ }
398
+
399
+ $default_operator = 'IN';
400
+ if ( isset( $shortcode_attributes['tax_operator'] ) ) {
401
+ $attr_value = strtoupper( $shortcode_attributes['tax_operator'] );
402
+ if ( in_array( $attr_value, array( 'IN', 'NOT IN', 'AND' ) ) ) {
403
+ $default_operator = $attr_value;
404
+ }
405
+ }
406
+
407
+ $default_children = 'true';
408
+ if ( isset( $shortcode_attributes[ 'tax_include_children' ] ) ) {
409
+ $attr_value = strtolower( $shortcode_attributes[ 'tax_include_children' ] );
410
+ if ( in_array( $attr_value, array( 'false', 'true' ) ) ) {
411
+ $default_children = $attr_value;
412
+ }
413
+ }
414
+
415
  // Look for the optional "simple taxonomy query" as an initial filter
416
  if ( !empty( $shortcode_attributes[ $filter_taxonomy ] ) ) {
417
  if ( 'muie-no-terms' !== $shortcode_attributes[ $filter_taxonomy ] ) {
429
 
430
  if ( !empty( $terms ) ) {
431
  $values = "array( '" . implode( "', '", $terms ) . "' )";
432
+ $tax_query .= "array('taxonomy' => '{$filter_taxonomy}' ,'field' => 'slug','terms' => {$values}, 'operator' => '{$default_operator}', 'include_children' => {$default_children} ), ";
433
  }
434
  }
435
 
436
  unset( $shortcode_attributes[ $filter_taxonomy ] );
437
  }
438
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439
  foreach ( $tax_input as $taxonomy => $terms ) {
440
  // simple taxonomy query overrides tax_input
441
  if ( $taxonomy == $filter_taxonomy ) {
479
  }
480
 
481
  // Taxonomy-specific "include_children"
482
+ $tax_children = $default_children;
483
  if ( isset( $shortcode_attributes[ $taxonomy . '_children' ] ) ) {
484
  $attr_value = strtolower( $shortcode_attributes[ $taxonomy . '_children' ] );
485
  if ( in_array( $attr_value, array( 'false', 'true' ) ) ) {
includes/class-mla-core.php CHANGED
@@ -21,7 +21,7 @@ class MLACore {
21
  *
22
  * @var string
23
  */
24
- const CURRENT_MLA_VERSION = '2.50';
25
 
26
  /**
27
  * Slug for registering and enqueueing plugin style sheets (moved from class-mla-main.php)
21
  *
22
  * @var string
23
  */
24
+ const CURRENT_MLA_VERSION = '2.51';
25
 
26
  /**
27
  * Slug for registering and enqueueing plugin style sheets (moved from class-mla-main.php)
includes/class-mla-list-table.php CHANGED
@@ -937,9 +937,37 @@ class MLA_List_Table extends WP_List_Table {
937
  return $column_content;
938
  }
939
 
 
940
  list( $mime ) = explode( '/', $item->post_mime_type );
941
- $final_content = "<div class=\"attachment-icon {$mime}-icon\">\n" . $this->column_icon( $item ) . "\n</div>\n";
942
- return $final_content . "<div class=\"attachment-info\">\n" . $column_content . "\n</div>\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
943
  }
944
 
945
  $actions = $this->row_actions( $this->_build_rollover_actions( $item, $column_name ) );
937
  return $column_content;
938
  }
939
 
940
+ $add_link = ( !$this->is_trash ) && current_user_can( 'edit_post', $item->ID );
941
  list( $mime ) = explode( '/', $item->post_mime_type );
942
+ $thumb = self::_build_item_thumbnail( $item );
943
+ $title = _draft_or_post_title( $item );
944
+
945
+ $final_content = "<strong class=\"has-media-icon\">\n";
946
+
947
+ if ( $add_link ) {
948
+ // Use the WordPress Edit Media screen
949
+ $view_args = self::mla_submenu_arguments();
950
+ if ( isset( $view_args['lang'] ) ) {
951
+ $edit_url = 'post.php?post=' . $item->ID . '&action=edit&mla_source=edit&lang=' . $view_args['lang'];
952
+ } else {
953
+ $edit_url = 'post.php?post=' . $item->ID . '&action=edit&mla_source=edit';
954
+ }
955
+
956
+ $final_content .= sprintf( '<a href="%1$s" title="' . __( 'Edit', 'media-library-assistant' ) . ' &#8220;%2$s&#8221;">', admin_url( $edit_url ), $title ) . "\n";
957
+ }
958
+
959
+ $final_content .= "<span class=\"media-icon {$mime}-icon\">\n";
960
+ $final_content .= $thumb;
961
+ $final_content .= "</span>\n";
962
+ $final_content .= '<span aria-hidden="true">' . $column_content . "</span>\n";
963
+ $final_content .= '<span class="screen-reader-text">' . __( 'Edit', 'media-library-assistant' ) . ' ' . $title . "</span>\n";
964
+
965
+ if ( $add_link ) {
966
+ $final_content .= "</a>\n";
967
+ }
968
+
969
+ $final_content .= "</strong>\n";
970
+ return $final_content;
971
  }
972
 
973
  $actions = $this->row_actions( $this->_build_rollover_actions( $item, $column_name ) );
includes/class-mla-main.php CHANGED
@@ -233,6 +233,8 @@ class MLA {
233
  * Optional - change the size of the thumbnail/icon images
234
  */
235
  $icon_value = MLACore::mla_get_option( MLACoreOptions::MLA_TABLE_ICON_SIZE );
 
 
236
  if ( 'checked' == MLACore::mla_get_option( MLACoreOptions::MLA_ENABLE_MLA_ICONS ) ) {
237
  if ( empty( $icon_value ) ) {
238
  $icon_value = 64;
@@ -244,7 +246,8 @@ class MLA {
244
 
245
  $icon_width = $icon_height = $icon_value . 'px';
246
 
247
- echo " width: auto;\n";
 
248
  echo " height: auto;\n";
249
  echo " max-width: {$icon_width};\n";
250
  echo " max-height: {$icon_height};\n";
@@ -271,29 +274,22 @@ class MLA {
271
  echo " }\n";
272
 
273
  if ( MLATest::$wp_4dot3_plus ) {
274
- /*
275
- * Primary column including icon and some margin
276
- */
277
- $icon_width = ( $icon_value + 10 ) . 'px';
278
- $column_width = ( $icon_value + 30 ) . 'px';
279
-
280
- echo " table.attachments th.column-primary {\n";
281
- echo " width: {$column_width};\n";
282
- echo " }\n";
283
  echo " table.attachments td.column-primary {\n";
284
  echo " position: relative;\n";
285
- echo " width: {$column_width};\n";
286
- echo " }\n";
287
- echo " table.attachments div.attachment-icon {\n";
288
- echo " position: absolute;\n";
289
- echo " top: 8px;\n";
290
- echo " left: 10px;\n";
291
- echo " }\n";
292
- echo " table.attachments div.attachment-info {\n";
293
- echo " margin-left: {$icon_width};\n";
294
- echo " min-height: {$icon_width};\n";
295
- // echo " margin-top: 0px;\n";
296
- // echo " min-height: 0px;\n";
297
  echo " }\n";
298
  } else {
299
  /*
233
  * Optional - change the size of the thumbnail/icon images
234
  */
235
  $icon_value = MLACore::mla_get_option( MLACoreOptions::MLA_TABLE_ICON_SIZE );
236
+ $set_column_width = !empty( $icon_value ) && is_numeric( $icon_value ) && ( 64 < $icon_value );
237
+
238
  if ( 'checked' == MLACore::mla_get_option( MLACoreOptions::MLA_ENABLE_MLA_ICONS ) ) {
239
  if ( empty( $icon_value ) ) {
240
  $icon_value = 64;
246
 
247
  $icon_width = $icon_height = $icon_value . 'px';
248
 
249
+ //echo " width: auto;\n";
250
+ //echo " vertical-align: top;\n";
251
  echo " height: auto;\n";
252
  echo " max-width: {$icon_width};\n";
253
  echo " max-height: {$icon_height};\n";
274
  echo " }\n";
275
 
276
  if ( MLATest::$wp_4dot3_plus ) {
277
+ // Explicit primary column width including icon and some margin
278
+ if ( $set_column_width ) {
279
+ $column_width = ( $icon_value + 30 ) . 'px';
280
+
281
+ echo " table.attachments th.column-primary {\n";
282
+ echo " width: {$column_width};\n";
283
+ echo " }\n";
284
+ }
285
+
286
  echo " table.attachments td.column-primary {\n";
287
  echo " position: relative;\n";
288
+
289
+ if ( $set_column_width ) {
290
+ echo " width: {$column_width};\n";
291
+ }
292
+
 
 
 
 
 
 
 
293
  echo " }\n";
294
  } else {
295
  /*
index.php CHANGED
@@ -6,7 +6,7 @@
6
  * will the rest of the plugin be loaded and run.
7
  *
8
  * @package Media Library Assistant
9
- * @version 2.50
10
  */
11
 
12
  /*
@@ -16,7 +16,7 @@ Description: Enhances the Media Library; powerful [mla_gallery] [mla_tag_cloud]
16
  Author: David Lingren, Fair Trade Judaica
17
  Text Domain: media-library-assistant
18
  Domain Path: /languages
19
- Version: 2.50
20
  Author URI: http://fairtradejudaica.org/our-story/staff/
21
 
22
  Copyright 2011-2017 David Lingren
6
  * will the rest of the plugin be loaded and run.
7
  *
8
  * @package Media Library Assistant
9
+ * @version 2.51
10
  */
11
 
12
  /*
16
  Author: David Lingren, Fair Trade Judaica
17
  Text Domain: media-library-assistant
18
  Domain Path: /languages
19
+ Version: 2.51
20
  Author URI: http://fairtradejudaica.org/our-story/staff/
21
 
22
  Copyright 2011-2017 David Lingren
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://fairtradejudaica.org/make-a-difference/donate/
4
  Tags: attachments, gallery, images, media, media library, tag cloud, media-tags, media tags, tags, media categories, categories, IPTC, EXIF, XMP, GPS, PDF, metadata, photos, photographs, photoblog, photo albums, lightroom, MIME, mime-type, icon, upload, file extensions, WPML, Polylang
5
  Requires at least: 3.5.0
6
  Tested up to: 4.7.3
7
- Stable tag: 2.50
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -172,6 +172,10 @@ All of the MLA source code has been annotated with "DocBlocks", a special type o
172
 
173
  == Changelog ==
174
 
 
 
 
 
175
  = 2.50 =
176
  * New: The Settings/Media Library Assistant <strong>Custom Fields tab has been completely re-written</strong>, with a more WordPress-like user interface and new capabilities.
177
  * New: The "MLA BuddyPress & rtMedia Example" example plugin has been enhanced with an `rtmedia_ids` prameter that translates rtMedia ID values to attachment ID values, and an `rtmedia_source` parameter that filters the items returned by an `[mla_gallery]` query and uses the parameter value as a content template to extract rtMedia IDs from the items. The rtMedia IDs are translated to attachment IDs so `[mla_gallery]` can process the items.
@@ -280,8 +284,8 @@ All of the MLA source code has been annotated with "DocBlocks", a special type o
280
 
281
  == Upgrade Notice ==
282
 
283
- = 2.50 =
284
- Completely new Settings/Custom Fields tab, [mla_term_list] and example plugin enhancements. Fourteen enhancements in all, sixteen fixes.
285
 
286
  == Other Notes ==
287
 
4
  Tags: attachments, gallery, images, media, media library, tag cloud, media-tags, media tags, tags, media categories, categories, IPTC, EXIF, XMP, GPS, PDF, metadata, photos, photographs, photoblog, photo albums, lightroom, MIME, mime-type, icon, upload, file extensions, WPML, Polylang
5
  Requires at least: 3.5.0
6
  Tested up to: 4.7.3
7
+ Stable tag: 2.51
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
172
 
173
  == Changelog ==
174
 
175
+ = 2.51 =
176
+ * Fix: For the MLA UI Elements Example plugin, some defects in handling simple taxonomy parameters such as tax_operator have been corrected.
177
+ * Fix: Change "primary column" handling for WP 4.3+ to be more like Media/Library submenu table.
178
+
179
  = 2.50 =
180
  * New: The Settings/Media Library Assistant <strong>Custom Fields tab has been completely re-written</strong>, with a more WordPress-like user interface and new capabilities.
181
  * New: The "MLA BuddyPress & rtMedia Example" example plugin has been enhanced with an `rtmedia_ids` prameter that translates rtMedia ID values to attachment ID values, and an `rtmedia_source` parameter that filters the items returned by an `[mla_gallery]` query and uses the parameter value as a content template to extract rtMedia IDs from the items. The rtMedia IDs are translated to attachment IDs so `[mla_gallery]` can process the items.
284
 
285
  == Upgrade Notice ==
286
 
287
+ = 2.51 =
288
+ Change "primary column" handling for WP 4.3+ to be more like Media/Library submenu table. Some MLA UI Elements Example plugin fixes.
289
 
290
  == Other Notes ==
291