Media Library Assistant - Version 2.74

Version Description

  • New: The "MLA Substitution Parameter Hooks Example" plugin has been enhanced with a current_term: prefix that returns values from the term(s) present in the $_REQUEST variables.
  • Fix: Cross-Site Scripting vulnerabilities have been removed from the Media/Assistant and Settings/Media Library assistant admin submenu screens.
  • Fix: For [mla_gallery], support for mla_search_fields=alt-text has been added.
  • Fix: For [mla_gallery], support for mla_search_fields=file has been fixed.
  • Fix: The Settings/Media Library Assistant Documentation/Example Plugins "Download" rollover action has been restored.
  • Fix: For [mla_term_list] and [mla_tag_cloud], current_item values can contain accented and special characters, e.g., Cryllic script.
  • Fix: For [mla_gallery], substitution parameters are supported in the mla_nolink_text parameter.
  • Fix: Improved debug logging of $wp_filter content, avoiding circular references.
Download this release

Release Info

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

Code changes from version 2.73 to 2.74

examples/plugins/mla-copy-item-example/mla-copy-item-scripts.min.js ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global ajaxurl */
2
+
3
+ var jQuery,
4
+ mla_copy_item_support_vars,
5
+ mlaCopyItem = {
6
+ // Properties
7
+ // mlaCopyItem.settings.noTitle
8
+ // mlaCopyItem.settings.ntdelTitle
9
+ // mlaCopyItem.settings.fields
10
+ // mlaCopyItem.settings.comma
11
+ // mlaCopyItem.settings.useSpinnerClass
12
+ settings: {},
13
+
14
+ // Utility functions
15
+ utility: {
16
+ getId : function( o ) {
17
+ var id = jQuery( o ).closest( 'tr' ).attr( 'id' ),
18
+ parts = id.split( '-' );
19
+ return parts[ parts.length - 1 ];
20
+ }
21
+ },
22
+
23
+ // Components
24
+ inlineCopyItem: null
25
+ };
26
+
27
+ ( function( $ ) {
28
+ /**
29
+ * Localized settings and strings
30
+ */
31
+ mlaCopyItem.settings = typeof mla_copy_item_support_vars === 'undefined' ? {} : mla_copy_item_support_vars;
32
+ mla_copy_item_support_vars = void 0; // delete won't work on Globals
33
+
34
+ mlaCopyItem.inlineCopyItem = {
35
+ init : function(){
36
+ var t = this, bgRow = $( '#mla-bulk-copy-item' );
37
+
38
+ t.type = 'attachment';
39
+ t.what = '#attachment-';
40
+
41
+ // prepare the bulk-generate row
42
+ bgRow.keyup( function( e ){
43
+ if ( e.which == 27 )
44
+ return mlaCopyItem.inlineCopyItem.revert();
45
+ });
46
+
47
+ $( 'a.cancel', bgRow ).click( function(){
48
+ return mlaCopyItem.inlineCopyItem.revert();
49
+ });
50
+
51
+ $( '#doaction, #doaction2' ).click( function( e ){
52
+ var n = $( this ).attr( 'id' ).substr( 2 );
53
+
54
+ if ( $( 'select[name="'+n+'"]' ).val() == 'mla-copy-item-example' ) {
55
+ e.preventDefault();
56
+ t.openCopyItem();
57
+ }
58
+ });
59
+
60
+ // Filter button (dates, categories) in top nav bar
61
+ $( '#post-query-submit' ).mousedown( function(){
62
+ t.revert();
63
+ $( 'select[name^="action"]' ).val( '-1' );
64
+ });
65
+ },
66
+
67
+ openCopyItem : function(){
68
+ var te = '', c = true;
69
+ this.revert();
70
+
71
+ // Open up the Bulk Translate area
72
+ $( '#mla-bulk-copy-item td' ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length );
73
+ $( 'table.widefat tbody' ).prepend( $( '#mla-bulk-copy-item' ) );
74
+ $( '#mla-bulk-copy-item' ).addClass( 'inline-translator' ).show();
75
+
76
+ // Make sure at least one item has been selected
77
+ $( 'tbody th.check-column input[type="checkbox"]' ).each( function(){
78
+ if ( $( this ).prop( 'checked' ) ) {
79
+ c = false;
80
+ var id = $( this ).val(), theTitle;
81
+ theTitle = $( '#inline_'+id+' .post_title' ).text() || mlaCopyItem.settings.noTitle;
82
+ te += '<div id="ttle'+id+'"><a id="_'+id+'" class="ntdelbutton" title="'+mlaCopyItem.settings.ntdelTitle+'">X</a>'+theTitle+'</div>';
83
+ }
84
+ });
85
+
86
+ if ( c ) {
87
+ return this.revert();
88
+ }
89
+
90
+ // Populate the list of selected items
91
+ $( '#mla-copy-item-titles' ).html( te );
92
+ $( '#mla-copy-item-titles a' ).click(function(){
93
+ var id = $( this ).attr( 'id' ).substr( 1 );
94
+
95
+ $( 'table.widefat input[value="' + id + '"]' ).prop( 'checked', false );
96
+ $( '#ttle'+id ).remove();
97
+ });
98
+
99
+ $( 'html, body' ).animate( { scrollTop: 0 }, 'fast' );
100
+ },
101
+
102
+ revert : function(){
103
+ var id = $( 'table.widefat tr.inline-translator ').attr( 'id' );
104
+
105
+ if ( id ) {
106
+ if ( mlaCopyItem.settings.useSpinnerClass ) {
107
+ $( 'table.widefat .pll-quick-translate-save .spinner' ).removeClass("is-active");
108
+ } else {
109
+ $( 'table.widefat .pll-quick-translate-save .spinner' ).hide();
110
+ }
111
+
112
+ if ( 'mla-bulk-copy-item' == id ) {
113
+ $( 'table.widefat #mla-bulk-copy-item ').removeClass( 'inline-translator' ).hide();
114
+ $( '#mla-copy-item-titles' ).html( '' );
115
+ $( '#pll-inline-translate' ).append( $('#mla-bulk-copy-item') );
116
+ } else {
117
+ $( '#'+id ).remove();
118
+ id = id.substr( id.lastIndexOf( '-' ) + 1 );
119
+ $( this.what+id ).show();
120
+ }
121
+ }
122
+
123
+ return false;
124
+ }
125
+ }; // mlaCopyItem.inlineCopyItem
126
+
127
+ $( document ).ready( function() {
128
+ mlaCopyItem.inlineCopyItem.init();
129
+ });
130
+ })( jQuery );
examples/plugins/mla-substitution-parameter-hooks-example.php CHANGED
@@ -9,6 +9,8 @@
9
  * - an "author:" prefix accesses all of the WP_User properties for an item's author
10
  * - an "conditional:" prefix returns a value when a condition is true, e.g., during the upload process
11
  * - a "wp_query_vars:" prefix accesses all of the "global $wp_query->query_vars" properties
 
 
12
  *
13
  * Created for support topic "Parent category tag"
14
  * opened on 5/20/2016 by "Levy":
@@ -38,19 +40,23 @@
38
  * opened on 3/1/2017 by "mbruxelle":
39
  * https://wordpress.org/support/topic/wp_query-query_vars-in-query/
40
  *
 
 
 
 
41
  * @package MLA Substitution Parameter Hooks Example
42
- * @version 1.08
43
  */
44
 
45
  /*
46
  Plugin Name: MLA Substitution Parameter Hooks Example
47
  Plugin URI: http://fairtradejudaica.org/media-library-assistant-a-wordpress-plugin/
48
- Description: Adds "parent_terms:", "page_terms:", "parent:", "author:" and "conditional:" Field-level Substitution Parameters
49
  Author: David Lingren
50
- Version: 1.08
51
  Author URI: http://fairtradejudaica.org/our-story/staff/
52
 
53
- Copyright 2016-2017 David Lingren
54
 
55
  This program is free software; you can redistribute it and/or modify
56
  it under the terms of the GNU General Public License as published by
@@ -88,18 +94,14 @@ class MLASubstitutionParameterExample {
88
  * @return void
89
  */
90
  public static function initialize() {
91
- /*
92
- * Defined in /media-library-assistant/includes/class-mla-data.php
93
- */
94
  //add_filter( 'mla_expand_custom_data_source', 'MLASubstitutionParameterExample::mla_expand_custom_data_source', 10, 9 );
95
  add_filter( 'mla_expand_custom_prefix', 'MLASubstitutionParameterExample::mla_expand_custom_prefix', 10, 8 );
96
  //add_filter( 'mla_apply_custom_format', 'MLASubstitutionParameterExample::mla_apply_custom_format', 10, 2 );
97
 
98
- /*
99
- * Defined in /media-library-assistant/includes/class-mla-data-source.php
100
- */
101
  //add_filter( 'mla_evaluate_custom_data_source', 'MLASubstitutionParameterExample::mla_evaluate_custom_data_source', 10, 5 );
102
-
103
  /*
104
  * Additional hooks defined in "MLA Custom Field and IPTC/EXIF Mapping Actions and Filters (Hooks)".
105
  * These are only required for the "conditional:is_upload" prefix processing.
@@ -148,7 +150,7 @@ class MLASubstitutionParameterExample {
148
  */
149
  public static function mla_update_attachment_metadata_postfilter( $data, $post_id, $options ) {
150
  self::$is_upload = false;
151
-
152
  return $data;
153
  } // mla_update_attachment_metadata_postfilter
154
 
@@ -170,9 +172,7 @@ class MLASubstitutionParameterExample {
170
  * @param string default option value
171
  */
172
  public static function mla_expand_custom_data_source( $custom_value, $key, $candidate, $value, $query, $markup_values, $post_id, $keep_existing, $default_option ) {
173
- /*
174
- * Uncomment the error_log statements in any of the filters to see what's passed in
175
- */
176
  //error_log( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_data_source( {$key}, {$candidate}, {$post_id}, {$keep_existing}, {$default_option} ) value = " . var_export( $value, true ), 0 );
177
  //error_log( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_data_source( {$candidate}, {$post_id} ) query = " . var_export( $query, true ), 0 );
178
  //error_log( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_data_source( {$candidate}, {$post_id} ) markup_values = " . var_export( $markup_values, true ), 0 );
@@ -239,7 +239,7 @@ class MLASubstitutionParameterExample {
239
  }
240
  }
241
  }
242
-
243
  return $custom_value;
244
  } // _evaluate_terms
245
 
@@ -261,7 +261,7 @@ class MLASubstitutionParameterExample {
261
  */
262
  public static function mla_expand_custom_prefix( $custom_value, $key, $value, $query, $markup_values, $post_id, $keep_existing, $default_option ) {
263
  static $parent_cache = array(), $author_cache = array();
264
-
265
  //error_log( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_prefix( {$key}, {$post_id}, {$keep_existing}, {$default_option} ) value = " . var_export( $value, true ), 0 );
266
  //error_log( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_prefix( {$key}, {$post_id} ) query = " . var_export( $query, true ), 0 );
267
  //error_log( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_prefix( {$key}, {$post_id} ) markup_values = " . var_export( $markup_values, true ), 0 );
@@ -276,6 +276,16 @@ class MLASubstitutionParameterExample {
276
  $qualifier = '';
277
  }
278
 
 
 
 
 
 
 
 
 
 
 
279
  if ( 'page_terms' == $value['prefix'] ) {
280
  if ( isset( $markup_values['page_ID'] ) ) {
281
  $post_id = absint( $markup_values['page_ID'] );
@@ -288,7 +298,7 @@ class MLASubstitutionParameterExample {
288
  $post_id = 0;
289
  }
290
  }
291
-
292
  $custom_value = self::_evaluate_terms( $custom_value, $post_id, $field, $qualifier, $value['option'] );
293
  } elseif ( 'page' == $value['prefix'] ) {
294
  if ( 'featured' == $value['value'] ) {
@@ -297,6 +307,64 @@ class MLASubstitutionParameterExample {
297
  $custom_value = (string) $featured;
298
  }
299
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  }
301
 
302
  if ( 0 == absint( $post_id ) ) {
@@ -310,7 +378,7 @@ class MLASubstitutionParameterExample {
310
  $item = get_post( $post_id );
311
  $post_parent = absint( $item->post_parent );
312
  }
313
-
314
  $custom_value = self::_evaluate_terms( $custom_value, $post_parent, $field, $qualifier, $value['option'] );
315
  } elseif ( 'parent' == $value['prefix'] ) {
316
  if ( isset( $markup_values['parent'] ) ) {
@@ -319,7 +387,7 @@ class MLASubstitutionParameterExample {
319
  $item = get_post( $post_id );
320
  $parent_id = absint( $item->post_parent );
321
  }
322
-
323
  if ( 0 == $parent_id ) {
324
  return $custom_value;
325
  }
@@ -335,7 +403,7 @@ class MLASubstitutionParameterExample {
335
  return $custom_value;
336
  }
337
  }
338
-
339
  if ( property_exists( $parent, $value['value'] ) ) {
340
  $custom_value = $parent->{$value['value']};
341
  } elseif ( 'permalink' == $value['value'] ) {
@@ -348,7 +416,7 @@ class MLASubstitutionParameterExample {
348
  $custom_value = $meta_value;
349
  }
350
  }
351
-
352
  //error_log( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_prefix( {$key}, {$post_id}, {$parent_id} ) custom_value = " . var_export( $custom_value, true ), 0 );
353
 
354
  if ( is_array( $custom_value ) ) {
@@ -365,14 +433,14 @@ class MLASubstitutionParameterExample {
365
 
366
  foreach ( $custom_value as $element ) {
367
  $field_value = sanitize_text_field( $element );
368
-
369
  if ( 'array' == $value['option'] ) {
370
  $new_value[] = $field_value;
371
  } else {
372
  $new_value .= strlen( $custom_value ) ? ', ' . $field_value : $field_value;
373
  }
374
  }
375
-
376
  $custom_value = $new_value;
377
  }
378
  }
@@ -383,7 +451,7 @@ class MLASubstitutionParameterExample {
383
  $item = get_post( $post_id );
384
  $item_author = absint( $item->post_author );
385
  }
386
-
387
  if ( isset( $author_cache[ $item_author ] ) ) {
388
  $author = $author_cache[ $item_author ];
389
  } else {
@@ -395,13 +463,13 @@ class MLASubstitutionParameterExample {
395
  return $custom_value;
396
  }
397
  }
398
-
399
  if ( property_exists( $author, $value['value'] ) ) {
400
  $custom_value = $author->{$value['value']};
401
  } else {
402
  $custom_value = $author->get( $value['value'] );
403
  }
404
-
405
  //error_log( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_prefix( {$key}, {$post_id} ) custom_value = " . var_export( $custom_value, true ), 0 );
406
 
407
  if ( is_array( $custom_value ) ) {
@@ -418,14 +486,14 @@ class MLASubstitutionParameterExample {
418
 
419
  foreach ( $custom_value as $element ) {
420
  $field_value = sanitize_text_field( $element );
421
-
422
  if ( 'array' == $value['option'] ) {
423
  $new_value[] = $field_value;
424
  } else {
425
  $new_value .= strlen( $custom_value ) ? ', ' . $field_value : $field_value;
426
  }
427
  }
428
-
429
  $custom_value = $new_value;
430
  }
431
  }
@@ -433,11 +501,11 @@ class MLASubstitutionParameterExample {
433
  if ( empty( $value['args'] ) ) {
434
  return $custom_value;
435
  }
436
-
437
  $true_value = ( isset( $value['args'][0] ) && !empty( $value['args'][0] ) ) ? $value['args'][0] : '';
438
  $false_value = ( isset( $value['args'][1] ) && !empty( $value['args'][1] ) ) ? $value['args'][1] : '';
439
  $qualifier = ( isset( $value['args'][2] ) && !empty( $value['args'][2] ) ) ? $value['args'][2] : '';
440
-
441
  switch ( $value['value'] ) {
442
  case 'is_upload':
443
  if ( self::$is_upload ) {
@@ -459,7 +527,7 @@ class MLASubstitutionParameterExample {
459
  break;
460
  }
461
  }
462
-
463
  $custom_value = $true_value;
464
  } else {
465
  $custom_value = $false_value;
9
  * - an "author:" prefix accesses all of the WP_User properties for an item's author
10
  * - an "conditional:" prefix returns a value when a condition is true, e.g., during the upload process
11
  * - a "wp_query_vars:" prefix accesses all of the "global $wp_query->query_vars" properties
12
+ * - a "current_term:" prefix accesses the term named in a $_REQUEST variable
13
+ * e.g. {+current_term:taxonomy.default_value(term_field)+}
14
  *
15
  * Created for support topic "Parent category tag"
16
  * opened on 5/20/2016 by "Levy":
40
  * opened on 3/1/2017 by "mbruxelle":
41
  * https://wordpress.org/support/topic/wp_query-query_vars-in-query/
42
  *
43
+ * Enhanced for support topic "Sorting items in Tag cloud by parent/child?"
44
+ * opened on 5/9/2018 by "antonstepichev":
45
+ * https://wordpress.org/support/topic/sorting-items-in-tag-cloud-by-parent-child/
46
+ *
47
  * @package MLA Substitution Parameter Hooks Example
48
+ * @version 1.11
49
  */
50
 
51
  /*
52
  Plugin Name: MLA Substitution Parameter Hooks Example
53
  Plugin URI: http://fairtradejudaica.org/media-library-assistant-a-wordpress-plugin/
54
+ Description: Adds "parent_terms:", "page_terms:", "parent:", "author:", "conditional:", "wp_query_vars" and "current_term" Field-level Substitution Parameters
55
  Author: David Lingren
56
+ Version: 1.11
57
  Author URI: http://fairtradejudaica.org/our-story/staff/
58
 
59
+ Copyright 2016-2018 David Lingren
60
 
61
  This program is free software; you can redistribute it and/or modify
62
  it under the terms of the GNU General Public License as published by
94
  * @return void
95
  */
96
  public static function initialize() {
97
+ // Defined in /media-library-assistant/includes/class-mla-data.php
 
 
98
  //add_filter( 'mla_expand_custom_data_source', 'MLASubstitutionParameterExample::mla_expand_custom_data_source', 10, 9 );
99
  add_filter( 'mla_expand_custom_prefix', 'MLASubstitutionParameterExample::mla_expand_custom_prefix', 10, 8 );
100
  //add_filter( 'mla_apply_custom_format', 'MLASubstitutionParameterExample::mla_apply_custom_format', 10, 2 );
101
 
102
+ // Defined in /media-library-assistant/includes/class-mla-data-source.php
 
 
103
  //add_filter( 'mla_evaluate_custom_data_source', 'MLASubstitutionParameterExample::mla_evaluate_custom_data_source', 10, 5 );
104
+
105
  /*
106
  * Additional hooks defined in "MLA Custom Field and IPTC/EXIF Mapping Actions and Filters (Hooks)".
107
  * These are only required for the "conditional:is_upload" prefix processing.
150
  */
151
  public static function mla_update_attachment_metadata_postfilter( $data, $post_id, $options ) {
152
  self::$is_upload = false;
153
+
154
  return $data;
155
  } // mla_update_attachment_metadata_postfilter
156
 
172
  * @param string default option value
173
  */
174
  public static function mla_expand_custom_data_source( $custom_value, $key, $candidate, $value, $query, $markup_values, $post_id, $keep_existing, $default_option ) {
175
+ // Uncomment the error_log statements in any of the filters to see what's passed in
 
 
176
  //error_log( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_data_source( {$key}, {$candidate}, {$post_id}, {$keep_existing}, {$default_option} ) value = " . var_export( $value, true ), 0 );
177
  //error_log( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_data_source( {$candidate}, {$post_id} ) query = " . var_export( $query, true ), 0 );
178
  //error_log( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_data_source( {$candidate}, {$post_id} ) markup_values = " . var_export( $markup_values, true ), 0 );
239
  }
240
  }
241
  }
242
+
243
  return $custom_value;
244
  } // _evaluate_terms
245
 
261
  */
262
  public static function mla_expand_custom_prefix( $custom_value, $key, $value, $query, $markup_values, $post_id, $keep_existing, $default_option ) {
263
  static $parent_cache = array(), $author_cache = array();
264
+
265
  //error_log( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_prefix( {$key}, {$post_id}, {$keep_existing}, {$default_option} ) value = " . var_export( $value, true ), 0 );
266
  //error_log( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_prefix( {$key}, {$post_id} ) query = " . var_export( $query, true ), 0 );
267
  //error_log( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_prefix( {$key}, {$post_id} ) markup_values = " . var_export( $markup_values, true ), 0 );
276
  $qualifier = '';
277
  }
278
 
279
+ // Set debug mode
280
+ $debug_active = isset( $query['mla_debug'] ) && ( 'false' !== trim( strtolower( $query['mla_debug'] ) ) );
281
+ if ( $debug_active ) {
282
+ $old_mode = MLACore::mla_debug_mode( 'log' );
283
+ MLACore::mla_debug_add( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_prefix( {$key}, {$post_id}, {$keep_existing}, {$default_option} ) \$_REQUEST = " . var_export( $_REQUEST, true ) );
284
+ MLACore::mla_debug_add( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_prefix( {$field}, {$qualifier} ) \$value = " . var_export( $value, true ) );
285
+ MLACore::mla_debug_add( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_prefix() \$query = " . var_export( $query, true ) );
286
+ MLACore::mla_debug_add( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_prefix() \$markup_values = " . var_export( $markup_values, true ) );
287
+ }
288
+
289
  if ( 'page_terms' == $value['prefix'] ) {
290
  if ( isset( $markup_values['page_ID'] ) ) {
291
  $post_id = absint( $markup_values['page_ID'] );
298
  $post_id = 0;
299
  }
300
  }
301
+
302
  $custom_value = self::_evaluate_terms( $custom_value, $post_id, $field, $qualifier, $value['option'] );
303
  } elseif ( 'page' == $value['prefix'] ) {
304
  if ( 'featured' == $value['value'] ) {
307
  $custom_value = (string) $featured;
308
  }
309
  }
310
+ } elseif ( 'current_term' == $value['prefix'] ) {
311
+ // Look for compound names, e.g., taxonomy.default_value
312
+ $key_array = explode( '.', $field );
313
+ if ( 1 < count( $key_array ) ) {
314
+ $field = $key_array[0];
315
+ $custom_value = $key_array[1];
316
+ } else {
317
+ $custom_value = '';
318
+ }
319
+
320
+ // Look in $_REQUEST for simple taxonomy query, then tax_input query
321
+ if ( isset( $_REQUEST[ $field ] ) ) {
322
+ $current_terms = explode( ',', trim( $_REQUEST[ $field ] ) );
323
+ } elseif ( isset( $_REQUEST['tax_input'] ) && isset( $_REQUEST['tax_input'][ $field ] )) {
324
+ $current_terms = $_REQUEST['tax_input'][ $field ];
325
+ } else {
326
+ return $custom_value;
327
+ }
328
+
329
+ if ( empty( $qualifier ) ) {
330
+ $qualifier = 'name';
331
+ }
332
+
333
+ if ( $debug_active ) {
334
+ MLACore::mla_debug_add( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_prefix( {$field}, {$qualifier} ) \$current_terms = " . var_export( $current_terms, true ) );
335
+ }
336
+
337
+ $results = '';
338
+ foreach( $current_terms as $current_term ) {
339
+ // Find the current term
340
+ if ( ctype_digit( $current_term ) ) {
341
+ $current_term = get_term_by( 'id', absint( $current_term ), $field, 'ARRAY_A' );
342
+ } else {
343
+ $current_term = get_term_by( 'slug', sanitize_title_for_query( $current_term ), $field, 'ARRAY_A' );
344
+ }
345
+
346
+ // If the terms does not exist, skip it
347
+ if ( false === $current_term ) {
348
+ continue;
349
+ }
350
+
351
+ // Extract the desired term field
352
+ $new_value = isset( $current_term[ $qualifier ] ) ? $current_term[ $qualifier ] : $current_term['name'];
353
+ $new_value = sanitize_term_field( $qualifier, $new_value, absint( $current_term['term_id'] ), $field, 'display' );
354
+ $results .= strlen( $results ) ? ',' . $new_value : $new_value;
355
+ } // foreach term
356
+
357
+ if ( $debug_active ) {
358
+ MLACore::mla_debug_add( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_prefix( {$field}, {$qualifier} ) \$results = " . var_export( $results, true ) );
359
+ }
360
+
361
+ if ( strlen( $results ) ) {
362
+ $custom_value = $results;
363
+ }
364
+ }
365
+
366
+ if ( $debug_active ) {
367
+ MLACore::mla_debug_mode( $old_mode );
368
  }
369
 
370
  if ( 0 == absint( $post_id ) ) {
378
  $item = get_post( $post_id );
379
  $post_parent = absint( $item->post_parent );
380
  }
381
+
382
  $custom_value = self::_evaluate_terms( $custom_value, $post_parent, $field, $qualifier, $value['option'] );
383
  } elseif ( 'parent' == $value['prefix'] ) {
384
  if ( isset( $markup_values['parent'] ) ) {
387
  $item = get_post( $post_id );
388
  $parent_id = absint( $item->post_parent );
389
  }
390
+
391
  if ( 0 == $parent_id ) {
392
  return $custom_value;
393
  }
403
  return $custom_value;
404
  }
405
  }
406
+
407
  if ( property_exists( $parent, $value['value'] ) ) {
408
  $custom_value = $parent->{$value['value']};
409
  } elseif ( 'permalink' == $value['value'] ) {
416
  $custom_value = $meta_value;
417
  }
418
  }
419
+
420
  //error_log( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_prefix( {$key}, {$post_id}, {$parent_id} ) custom_value = " . var_export( $custom_value, true ), 0 );
421
 
422
  if ( is_array( $custom_value ) ) {
433
 
434
  foreach ( $custom_value as $element ) {
435
  $field_value = sanitize_text_field( $element );
436
+
437
  if ( 'array' == $value['option'] ) {
438
  $new_value[] = $field_value;
439
  } else {
440
  $new_value .= strlen( $custom_value ) ? ', ' . $field_value : $field_value;
441
  }
442
  }
443
+
444
  $custom_value = $new_value;
445
  }
446
  }
451
  $item = get_post( $post_id );
452
  $item_author = absint( $item->post_author );
453
  }
454
+
455
  if ( isset( $author_cache[ $item_author ] ) ) {
456
  $author = $author_cache[ $item_author ];
457
  } else {
463
  return $custom_value;
464
  }
465
  }
466
+
467
  if ( property_exists( $author, $value['value'] ) ) {
468
  $custom_value = $author->{$value['value']};
469
  } else {
470
  $custom_value = $author->get( $value['value'] );
471
  }
472
+
473
  //error_log( __LINE__ . " MLASubstitutionParameterExample::mla_expand_custom_prefix( {$key}, {$post_id} ) custom_value = " . var_export( $custom_value, true ), 0 );
474
 
475
  if ( is_array( $custom_value ) ) {
486
 
487
  foreach ( $custom_value as $element ) {
488
  $field_value = sanitize_text_field( $element );
489
+
490
  if ( 'array' == $value['option'] ) {
491
  $new_value[] = $field_value;
492
  } else {
493
  $new_value .= strlen( $custom_value ) ? ', ' . $field_value : $field_value;
494
  }
495
  }
496
+
497
  $custom_value = $new_value;
498
  }
499
  }
501
  if ( empty( $value['args'] ) ) {
502
  return $custom_value;
503
  }
504
+
505
  $true_value = ( isset( $value['args'][0] ) && !empty( $value['args'][0] ) ) ? $value['args'][0] : '';
506
  $false_value = ( isset( $value['args'][1] ) && !empty( $value['args'][1] ) ) ? $value['args'][1] : '';
507
  $qualifier = ( isset( $value['args'][2] ) && !empty( $value['args'][2] ) ) ? $value['args'][2] : '';
508
+
509
  switch ( $value['value'] ) {
510
  case 'is_upload':
511
  if ( self::$is_upload ) {
527
  break;
528
  }
529
  }
530
+
531
  $custom_value = $true_value;
532
  } else {
533
  $custom_value = $false_value;
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.08
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.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
@@ -455,7 +455,7 @@ class MLAUIElementsExample {
455
 
456
  if ( !empty( $terms ) ) {
457
  // Numeric values could still be a slug
458
- $field = self::$mla_option_values[ $taxonomy ];
459
  foreach ( $terms as $term ) {
460
  if ( ! ctype_digit( $term ) ) {
461
  $field = 'slug';
65
  * https://wordpress.org/support/topic/shortcode-456/
66
  *
67
  * @package MLA UI Elements Example
68
+ * @version 1.09
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.09
77
  Author URI: http://fairtradejudaica.org/our-story/staff/
78
 
79
+ Copyright 2016-2018 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
455
 
456
  if ( !empty( $terms ) ) {
457
  // Numeric values could still be a slug
458
+ $field = ( !empty( self::$mla_option_values[ $taxonomy ] ) ) ? self::$mla_option_values[ $taxonomy ] : 'term_id';
459
  foreach ( $terms as $term ) {
460
  if ( ! ctype_digit( $term ) ) {
461
  $field = 'slug';
includes/class-mla-core.php CHANGED
@@ -21,7 +21,7 @@ class MLACore {
21
  *
22
  * @var string
23
  */
24
- const CURRENT_MLA_VERSION = '2.73';
25
 
26
  /**
27
  * Slug for registering and enqueueing plugin style sheets (moved from class-mla-main.php)
@@ -1447,6 +1447,50 @@ class MLACore {
1447
  <?php
1448
  } // mla_checklist_meta_box
1449
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1450
  /**
1451
  * Effective MLA Debug Level, from MLA_DEBUG_LEVEL or override option
1452
  *
21
  *
22
  * @var string
23
  */
24
+ const CURRENT_MLA_VERSION = '2.74';
25
 
26
  /**
27
  * Slug for registering and enqueueing plugin style sheets (moved from class-mla-main.php)
1447
  <?php
1448
  } // mla_checklist_meta_box
1449
 
1450
+ /**
1451
+ * Decode the list of functions hooking an action/filter
1452
+ *
1453
+ * @since 2.74
1454
+ *
1455
+ * @param string $filter The name of the action/filter to be decoded
1456
+ *
1457
+ * @return string List of functions hooking the action/filter
1458
+ */
1459
+ public static function mla_decode_wp_filter( $filter ) {
1460
+ global $wp_filter;
1461
+ //error_log( __LINE__ . " mla_decode_wp_filter( $filter ) wp_filter = " . var_export( $wp_filter[ $filter ], true ), 0 );
1462
+
1463
+ $hook_list = '';
1464
+ if ( isset( $wp_filter[ $filter ] ) ) {
1465
+ // WordPress 4.7+ uses WP_Hook, earlier versions use an array
1466
+ if ( is_object( $wp_filter[ $filter ] ) ) {
1467
+ $callback_array = $wp_filter[ $filter ]->callbacks;
1468
+ } else {
1469
+ $callback_array = $wp_filter[ $filter ];
1470
+ }
1471
+
1472
+ foreach ( $callback_array as $priority => $callbacks ) {
1473
+ $hook_list .= "Priority: {$priority}\n";
1474
+ foreach ( $callbacks as $tag => $reference ) {
1475
+ $hook_list .= "{$tag} => ";
1476
+ if ( is_string( $reference['function'] ) ) {
1477
+ $hook_list .= $reference['function'] . "()\n";
1478
+ } else {
1479
+ if ( is_object( $reference['function'][0] ) ) {
1480
+ $hook_list .= get_class( $reference['function'][0] ) . '->';
1481
+ } else {
1482
+ $hook_list .= $reference['function'][0] . '::';
1483
+ }
1484
+
1485
+ $hook_list .= $reference['function'][1] . "()\n";
1486
+ }
1487
+ } // foreach tag
1488
+ } // foreach proprity
1489
+ } // filters exist
1490
+
1491
+ return $hook_list;
1492
+ }
1493
+
1494
  /**
1495
  * Effective MLA Debug Level, from MLA_DEBUG_LEVEL or override option
1496
  *
includes/class-mla-data-query.php CHANGED
@@ -881,7 +881,7 @@ class MLAQuery {
881
  break;
882
  case 'mla-metakey':
883
  case 'mla-metavalue':
884
- $clean_request[ $key ] = stripslashes( $value );
885
  break;
886
  case 'meta_query':
887
  if ( ! empty( $value ) ) {
@@ -1135,9 +1135,7 @@ class MLAQuery {
1135
  add_filter( 'relevanssi_admin_search_ok', 'MLAQuery::mla_query_relevanssi_admin_search_ok_filter' );
1136
  }
1137
 
1138
- /*
1139
- * Remove WP Media Folders actions from MLA queries for the Media/Assistant submenu table
1140
- */
1141
  if ( isset( $GLOBALS['wp_media_folder'] ) && isset( $_REQUEST['page'] ) && ( MLACore::ADMIN_PAGE_SLUG == $_REQUEST['page'] ) ) {
1142
  $wpmf_pre_get_posts_priority = has_filter( 'pre_get_posts', array( $GLOBALS['wp_media_folder'], 'wpmf_pre_get_posts' ) );
1143
  $wpmf_pre_get_posts1_priority = has_filter( 'pre_get_posts', array( $GLOBALS['wp_media_folder'], 'wpmf_pre_get_posts1' ) );
@@ -1152,8 +1150,7 @@ class MLAQuery {
1152
  }
1153
 
1154
  if ( isset( self::$query_parameters['debug'] ) ) {
1155
- global $wp_filter;
1156
- $debug_array = array( 'posts_search' => $wp_filter['posts_search'], 'posts_join' => $wp_filter['posts_join'], 'posts_where' => $wp_filter['posts_where'], 'posts_orderby' => $wp_filter['posts_orderby'] );
1157
 
1158
  /* translators: 1: DEBUG tag 2: query filter details */
1159
  MLACore::mla_debug_add( sprintf( _x( '%1$s: _execute_list_table_query $wp_filter = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ) );
881
  break;
882
  case 'mla-metakey':
883
  case 'mla-metavalue':
884
+ $clean_request[ $key ] = stripslashes( html_entity_decode( $value ) );
885
  break;
886
  case 'meta_query':
887
  if ( ! empty( $value ) ) {
1135
  add_filter( 'relevanssi_admin_search_ok', 'MLAQuery::mla_query_relevanssi_admin_search_ok_filter' );
1136
  }
1137
 
1138
+ // Remove WP Media Folders actions from MLA queries for the Media/Assistant submenu table
 
 
1139
  if ( isset( $GLOBALS['wp_media_folder'] ) && isset( $_REQUEST['page'] ) && ( MLACore::ADMIN_PAGE_SLUG == $_REQUEST['page'] ) ) {
1140
  $wpmf_pre_get_posts_priority = has_filter( 'pre_get_posts', array( $GLOBALS['wp_media_folder'], 'wpmf_pre_get_posts' ) );
1141
  $wpmf_pre_get_posts1_priority = has_filter( 'pre_get_posts', array( $GLOBALS['wp_media_folder'], 'wpmf_pre_get_posts1' ) );
1150
  }
1151
 
1152
  if ( isset( self::$query_parameters['debug'] ) ) {
1153
+ $debug_array = array( 'posts_search' => MLACore::mla_decode_wp_filter('posts_search'), 'posts_join' => MLACore::mla_decode_wp_filter('posts_join'), 'posts_where' => MLACore::mla_decode_wp_filter('posts_where'), 'posts_orderby' => MLACore::mla_decode_wp_filter('posts_orderby') );
 
1154
 
1155
  /* translators: 1: DEBUG tag 2: query filter details */
1156
  MLACore::mla_debug_add( sprintf( _x( '%1$s: _execute_list_table_query $wp_filter = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ) );
includes/class-mla-list-table.php CHANGED
@@ -264,92 +264,93 @@ class MLA_List_Table extends WP_List_Table {
264
  $submenu_arguments = array();
265
  $has_filters = $include_filters;
266
 
267
- /*
268
- * View arguments
269
- */
270
  if ( isset( $_REQUEST['post_mime_type'] ) ) {
271
- $submenu_arguments['post_mime_type'] = $_REQUEST['post_mime_type'];
272
  }
273
 
274
  if ( isset( $_REQUEST['detached'] ) ) {
275
- $submenu_arguments['detached'] = $_REQUEST['detached'];
 
 
276
  }
277
 
278
  if ( isset( $_REQUEST['status'] ) ) {
279
- $submenu_arguments['status'] = $_REQUEST['status'];
 
 
280
  }
281
 
282
  if ( isset( $_REQUEST['meta_query'] ) ) {
283
  $submenu_arguments['meta_query'] = urlencode( stripslashes( $_REQUEST['meta_query'] ) );
284
  }
285
 
286
- /*
287
- * Search box arguments
288
- */
289
  if ( !empty( $_REQUEST['s'] ) ) {
290
  $submenu_arguments['s'] = urlencode( stripslashes( $_REQUEST['s'] ) );
291
 
292
  if ( isset( $_REQUEST['mla_search_connector'] ) ) {
293
- $submenu_arguments['mla_search_connector'] = $_REQUEST['mla_search_connector'];
294
  }
295
 
296
  if ( isset( $_REQUEST['mla_search_fields'] ) ) {
297
- $submenu_arguments['mla_search_fields'] = $_REQUEST['mla_search_fields'];
 
 
 
298
  }
299
  }
300
 
301
- /*
302
- * Filter arguments (from table header)
303
- */
304
  if ( isset( $_REQUEST['m'] ) && ( '0' != $_REQUEST['m'] ) ) {
305
- $submenu_arguments['m'] = $_REQUEST['m'];
 
306
  }
307
 
308
  if ( isset( $_REQUEST['mla_filter_term'] ) && ( '0' != $_REQUEST['mla_filter_term'] ) ) {
309
- $submenu_arguments['mla_filter_term'] = $_REQUEST['mla_filter_term'];
 
310
  }
311
 
312
- /*
313
- * Sort arguments (from column header)
314
- */
315
  if ( isset( $_REQUEST['order'] ) ) {
316
- $submenu_arguments['order'] = $_REQUEST['order'];
317
  }
318
 
319
  if ( isset( $_REQUEST['orderby'] ) ) {
320
- $submenu_arguments['orderby'] = $_REQUEST['orderby'];
 
 
321
  }
322
 
323
- /*
324
- * Filter arguments (from interior table cells)
325
- */
326
  if ( $include_filters ) {
327
  if ( isset( $_REQUEST['heading_suffix'] ) ) {
328
- $submenu_arguments['heading_suffix'] = $_REQUEST['heading_suffix'];
329
  }
330
 
331
  if ( isset( $_REQUEST['parent'] ) ) {
332
- $submenu_arguments['parent'] = $_REQUEST['parent'];
333
  }
334
 
335
  if ( isset( $_REQUEST['author'] ) ) {
336
- $submenu_arguments['author'] = $_REQUEST['author'];
337
  }
338
 
339
  if ( isset( $_REQUEST['mla-tax'] ) ) {
340
- $submenu_arguments['mla-tax'] = $_REQUEST['mla-tax'];
341
  }
342
 
343
  if ( isset( $_REQUEST['mla-term'] ) ) {
344
- $submenu_arguments['mla-term'] = $_REQUEST['mla-term'];
345
  }
346
 
347
  if ( isset( $_REQUEST['mla-metakey'] ) ) {
348
- $submenu_arguments['mla-metakey'] = $_REQUEST['mla-metakey'];
349
  }
350
 
351
  if ( isset( $_REQUEST['mla-metavalue'] ) ) {
352
- $submenu_arguments['mla-metavalue'] = $_REQUEST['mla-metavalue'];
353
  }
354
  }
355
 
264
  $submenu_arguments = array();
265
  $has_filters = $include_filters;
266
 
267
+ // View arguments
 
 
268
  if ( isset( $_REQUEST['post_mime_type'] ) ) {
269
+ $submenu_arguments['post_mime_type'] = urlencode( $_REQUEST['post_mime_type'] );
270
  }
271
 
272
  if ( isset( $_REQUEST['detached'] ) ) {
273
+ if ( ( '0' === $_REQUEST['detached'] ) || ( '1' === $_REQUEST['detached'] ) ) {
274
+ $submenu_arguments['detached'] = $_REQUEST['detached'];
275
+ }
276
  }
277
 
278
  if ( isset( $_REQUEST['status'] ) ) {
279
+ if ( 'trash' === $_REQUEST['status'] ) {
280
+ $submenu_arguments['status'] = $_REQUEST['status'];
281
+ }
282
  }
283
 
284
  if ( isset( $_REQUEST['meta_query'] ) ) {
285
  $submenu_arguments['meta_query'] = urlencode( stripslashes( $_REQUEST['meta_query'] ) );
286
  }
287
 
288
+ // Search box arguments
 
 
289
  if ( !empty( $_REQUEST['s'] ) ) {
290
  $submenu_arguments['s'] = urlencode( stripslashes( $_REQUEST['s'] ) );
291
 
292
  if ( isset( $_REQUEST['mla_search_connector'] ) ) {
293
+ $submenu_arguments['mla_search_connector'] = ( 'OR' === strtoupper( $_REQUEST['mla_search_connector'] ) ) ? 'OR' : 'AND';
294
  }
295
 
296
  if ( isset( $_REQUEST['mla_search_fields'] ) ) {
297
+ $submenu_arguments['mla_search_fields'] = array();
298
+ foreach ( $_REQUEST['mla_search_fields'] as $key => $value ) {
299
+ $submenu_arguments['mla_search_fields'][ $key ] = urlencode( stripslashes( $value ) );
300
+ }
301
  }
302
  }
303
 
304
+ // Filter arguments (from table header)
 
 
305
  if ( isset( $_REQUEST['m'] ) && ( '0' != $_REQUEST['m'] ) ) {
306
+ // Format yyyymm
307
+ $submenu_arguments['m'] = absint( $_REQUEST['m'] );
308
  }
309
 
310
  if ( isset( $_REQUEST['mla_filter_term'] ) && ( '0' != $_REQUEST['mla_filter_term'] ) ) {
311
+ // Format numeric, can be negative
312
+ $submenu_arguments['mla_filter_term'] = intval( $_REQUEST['mla_filter_term'] );
313
  }
314
 
315
+ // Sort arguments (from column header)
 
 
316
  if ( isset( $_REQUEST['order'] ) ) {
317
+ $submenu_arguments['order'] = ( 'desc' === strtolower( $_REQUEST['order'] ) ) ? 'desc' : 'asc';
318
  }
319
 
320
  if ( isset( $_REQUEST['orderby'] ) ) {
321
+ if ( array_key_exists( $_REQUEST['orderby'], MLAQuery::$default_sortable_columns ) ) {
322
+ $submenu_arguments['orderby'] = urlencode( $_REQUEST['orderby'] );
323
+ }
324
  }
325
 
326
+ // Filter arguments (from interior table cells)
 
 
327
  if ( $include_filters ) {
328
  if ( isset( $_REQUEST['heading_suffix'] ) ) {
329
+ $submenu_arguments['heading_suffix'] = urlencode( stripslashes( $_REQUEST['heading_suffix'] ) );
330
  }
331
 
332
  if ( isset( $_REQUEST['parent'] ) ) {
333
+ $submenu_arguments['parent'] = absint( $_REQUEST['parent'] );
334
  }
335
 
336
  if ( isset( $_REQUEST['author'] ) ) {
337
+ $submenu_arguments['author'] = absint( $_REQUEST['author'] );
338
  }
339
 
340
  if ( isset( $_REQUEST['mla-tax'] ) ) {
341
+ $submenu_arguments['mla-tax'] = urlencode( $_REQUEST['mla-tax'] );
342
  }
343
 
344
  if ( isset( $_REQUEST['mla-term'] ) ) {
345
+ $submenu_arguments['mla-term'] = urlencode( $_REQUEST['mla-term'] );
346
  }
347
 
348
  if ( isset( $_REQUEST['mla-metakey'] ) ) {
349
+ $submenu_arguments['mla-metakey'] = urlencode( $_REQUEST['mla-metakey'] );
350
  }
351
 
352
  if ( isset( $_REQUEST['mla-metavalue'] ) ) {
353
+ $submenu_arguments['mla-metavalue'] = urlencode( $_REQUEST['mla-metavalue'] );
354
  }
355
  }
356
 
includes/class-mla-main.php CHANGED
@@ -6,9 +6,7 @@
6
  * @since 0.1
7
  */
8
 
9
- /*
10
- * The Meta Boxes functions are't automatically available to plugins.
11
- */
12
  if ( !function_exists( 'post_categories_meta_box' ) ) {
13
  require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' );
14
  }
@@ -144,7 +142,6 @@ class MLA {
144
  public static function mla_admin_init_action() {
145
  //static $count = 0;
146
  //error_log( __LINE__ . ' MLA::mla_admin_init_action $count = ' . var_export( $count++, true ), 0 );
147
-
148
  //error_log( __LINE__ . ' MLA::mla_admin_init_action referer = ' . var_export( wp_get_referer(), true ), 0 );
149
  //error_log( __LINE__ . ' MLA::mla_admin_init_action $_REQUEST = ' . var_export( $_REQUEST, true ), 0 );
150
  //error_log( __LINE__ . ' MLA::mla_admin_init_action $_POST = ' . var_export( $_POST, true ), 0 );
@@ -157,6 +154,19 @@ class MLA {
157
  exit();
158
  }
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  // Process error log download requests from the Debug tab
161
  if ( isset( $_REQUEST['mla_download_error_log'] ) ) {
162
  check_admin_referer( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME );
@@ -178,7 +188,7 @@ class MLA {
178
  $request = array (
179
  'mla_download_file' => addslashes( $error_log_name ),
180
  'mla_download_type' => 'text/plain',
181
- );
182
 
183
  self::_process_mla_download_file( $request, false );
184
  }
@@ -693,18 +703,9 @@ class MLA {
693
  * @return mixed New value if this is our option, otherwise original status
694
  */
695
  public static function mla_set_screen_option_filter( $status, $option, $value ) {
696
- global $wp_filter;
697
-
698
  MLACore::mla_debug_add( __LINE__ . " MLA::mla_set_screen_option_filter( {$option} ) status = " . var_export( $status, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
699
  MLACore::mla_debug_add( __LINE__ . " MLA::mla_set_screen_option_filter( {$option} ) value = " . var_export( $value, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
700
-
701
- foreach( $wp_filter['set-screen-option'] as $priority => $filters ) {
702
- $debug_message = __LINE__ . ' MLA::mla_set_screen_option_filter $wp_filter[set-screen-option] priority = ' . var_export( $priority, true ) . '<br />';
703
- foreach ( $filters as $name => $descriptor ) {
704
- $debug_message .= 'filter name = ' . var_export( $name, true ) . '<br />';
705
- }
706
- MLACore::mla_debug_add( $debug_message, MLACore::MLA_DEBUG_CATEGORY_ANY );
707
- }
708
 
709
  if ( ( MLA_OPTION_PREFIX . 'entries_per_page' ) == $option ) {
710
  return $value;
6
  * @since 0.1
7
  */
8
 
9
+ // The Meta Boxes functions are't automatically available to plugins.
 
 
10
  if ( !function_exists( 'post_categories_meta_box' ) ) {
11
  require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' );
12
  }
142
  public static function mla_admin_init_action() {
143
  //static $count = 0;
144
  //error_log( __LINE__ . ' MLA::mla_admin_init_action $count = ' . var_export( $count++, true ), 0 );
 
145
  //error_log( __LINE__ . ' MLA::mla_admin_init_action referer = ' . var_export( wp_get_referer(), true ), 0 );
146
  //error_log( __LINE__ . ' MLA::mla_admin_init_action $_REQUEST = ' . var_export( $_REQUEST, true ), 0 );
147
  //error_log( __LINE__ . ' MLA::mla_admin_init_action $_POST = ' . var_export( $_POST, true ), 0 );
154
  exit();
155
  }
156
 
157
+ // Process example plugin download requests from the Documentation tab
158
+ if ( isset( $_REQUEST['mla_download_example_plugin'] ) ) {
159
+ check_admin_referer( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME );
160
+
161
+ $request = array (
162
+ 'mla_download_file' => str_replace( '\\', '/', MLA_PLUGIN_PATH . 'examples/plugins/' . stripslashes( $_REQUEST['mla_download_example_plugin'] ) ),
163
+ 'mla_download_type' => 'text/plain',
164
+ );
165
+
166
+ self::_process_mla_download_file( $request, false );
167
+ exit();
168
+ }
169
+
170
  // Process error log download requests from the Debug tab
171
  if ( isset( $_REQUEST['mla_download_error_log'] ) ) {
172
  check_admin_referer( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME );
188
  $request = array (
189
  'mla_download_file' => addslashes( $error_log_name ),
190
  'mla_download_type' => 'text/plain',
191
+ );
192
 
193
  self::_process_mla_download_file( $request, false );
194
  }
703
  * @return mixed New value if this is our option, otherwise original status
704
  */
705
  public static function mla_set_screen_option_filter( $status, $option, $value ) {
 
 
706
  MLACore::mla_debug_add( __LINE__ . " MLA::mla_set_screen_option_filter( {$option} ) status = " . var_export( $status, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
707
  MLACore::mla_debug_add( __LINE__ . " MLA::mla_set_screen_option_filter( {$option} ) value = " . var_export( $value, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
708
+ MLACore::mla_debug_add( __LINE__ . " MLA::mla_set_screen_option_filter( {$option} ) wp_filter = " . MLACore::mla_decode_wp_filter('set-screen-option'), MLACore::MLA_DEBUG_CATEGORY_ANY );
 
 
 
 
 
 
 
709
 
710
  if ( ( MLA_OPTION_PREFIX . 'entries_per_page' ) == $option ) {
711
  return $value;
includes/class-mla-mime-types.php CHANGED
@@ -116,9 +116,7 @@ class MLAMime {
116
  */
117
  public static function mla_sanitize_mime_type_filter( $sanitized_mime_type, $raw_mime_type ) {
118
  if ( self::$mla_debug_active ) {
119
- global $wp_filter;
120
-
121
- MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_sanitize_mime_type_filter( $sanitized_mime_type, $raw_mime_type ) wp_filter = " . var_export( $wp_filter['sanitize_mime_type'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
122
  }
123
 
124
  return $sanitized_mime_type;
@@ -156,10 +154,8 @@ class MLAMime {
156
  */
157
  public static function mla_ext2type_filter( $standard_types ) {
158
  if ( self::$mla_debug_active ) {
159
- global $wp_filter;
160
-
161
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_ext2type_filter standard_types = " . var_export( $standard_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
162
- MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_ext2type_filter wp_filter = " . var_export( $wp_filter['ext2type'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
163
  }
164
 
165
  if ( self::$disable_mla_filtering ) {
@@ -228,10 +224,9 @@ class MLAMime {
228
  */
229
  public static function mla_wp_check_filetype_and_ext_filter( $validate, $file, $filename, $mimes ) {
230
  if ( self::$mla_debug_active ) {
231
- global $wp_filter;
232
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_wp_check_filetype_and_ext_filter( $file, $filename ) validate = " . var_export( $validate, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
233
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_wp_check_filetype_and_ext_filter mimes = " . var_export( $mimes, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
234
- MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_wp_check_filetype_and_ext_filter wp_filter = " . var_export( $wp_filter['wp_check_filetype_and_ext'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
235
  }
236
 
237
  return $validate;
@@ -257,9 +252,8 @@ class MLAMime {
257
  static $first_call = true;
258
 
259
  if ( self::$mla_debug_active && $first_call ) {
260
- global $wp_filter;
261
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_mime_types_filter mime_types = " . var_export( $mime_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
262
- MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_mime_types_filter wp_filter = " . var_export( $wp_filter['mime_types'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
263
  }
264
 
265
  if ( self::$disable_mla_filtering || ! self::_get_upload_mime_templates() ) {
@@ -340,9 +334,8 @@ class MLAMime {
340
  static $first_call = true;
341
 
342
  if ( self::$mla_debug_active && $first_call ) {
343
- global $wp_filter;
344
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_upload_mimes_filter mime_types = " . var_export( $mime_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
345
- MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_upload_mimes_filter wp_filter = " . var_export( $wp_filter['upload_mimes'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
346
  }
347
 
348
  if ( self::$disable_mla_filtering || ! self::_get_upload_mime_templates() ) {
@@ -422,9 +415,8 @@ class MLAMime {
422
  static $first_call = true;
423
 
424
  if ( self::$mla_debug_active && $first_call ) {
425
- global $wp_filter;
426
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_post_mime_types_filter post_mime_types = " . var_export( $post_mime_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
427
- MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_post_mime_types_filter wp_filter = " . var_export( $wp_filter['upload_mimes'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
428
  }
429
 
430
  if ( self::$disable_mla_filtering || ! self::_get_post_mime_templates() ) {
116
  */
117
  public static function mla_sanitize_mime_type_filter( $sanitized_mime_type, $raw_mime_type ) {
118
  if ( self::$mla_debug_active ) {
119
+ MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_sanitize_mime_type_filter( $sanitized_mime_type, $raw_mime_type ) wp_filter = " . MLACore::mla_decode_wp_filter('sanitize_mime_type'), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
 
 
120
  }
121
 
122
  return $sanitized_mime_type;
154
  */
155
  public static function mla_ext2type_filter( $standard_types ) {
156
  if ( self::$mla_debug_active ) {
 
 
157
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_ext2type_filter standard_types = " . var_export( $standard_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
158
+ MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_ext2type_filter wp_filter = " . MLACore::mla_decode_wp_filter('ext2type'), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
159
  }
160
 
161
  if ( self::$disable_mla_filtering ) {
224
  */
225
  public static function mla_wp_check_filetype_and_ext_filter( $validate, $file, $filename, $mimes ) {
226
  if ( self::$mla_debug_active ) {
 
227
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_wp_check_filetype_and_ext_filter( $file, $filename ) validate = " . var_export( $validate, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
228
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_wp_check_filetype_and_ext_filter mimes = " . var_export( $mimes, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
229
+ MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_wp_check_filetype_and_ext_filter wp_filter = " . MLACore::mla_decode_wp_filter('wp_check_filetype_and_ext'), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
230
  }
231
 
232
  return $validate;
252
  static $first_call = true;
253
 
254
  if ( self::$mla_debug_active && $first_call ) {
 
255
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_mime_types_filter mime_types = " . var_export( $mime_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
256
+ MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_mime_types_filter wp_filter = " . MLACore::mla_decode_wp_filter('mime_types'), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
257
  }
258
 
259
  if ( self::$disable_mla_filtering || ! self::_get_upload_mime_templates() ) {
334
  static $first_call = true;
335
 
336
  if ( self::$mla_debug_active && $first_call ) {
 
337
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_upload_mimes_filter mime_types = " . var_export( $mime_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
338
+ MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_upload_mimes_filter wp_filter = " . MLACore::mla_decode_wp_filter('upload_mimes'), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
339
  }
340
 
341
  if ( self::$disable_mla_filtering || ! self::_get_upload_mime_templates() ) {
415
  static $first_call = true;
416
 
417
  if ( self::$mla_debug_active && $first_call ) {
 
418
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_post_mime_types_filter post_mime_types = " . var_export( $post_mime_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
419
+ MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_post_mime_types_filter wp_filter = " . MLACore::mla_decode_wp_filter('post_mime_types'), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
420
  }
421
 
422
  if ( self::$disable_mla_filtering || ! self::_get_post_mime_templates() ) {
includes/class-mla-options.php CHANGED
@@ -524,7 +524,7 @@ class MLAOptions {
524
  case 'render':
525
  $current_value = get_user_option( $key );
526
 
527
- if ( false === $current_value ) {
528
  $current_value = get_option( 'posts_per_page', $value['std'] );
529
  }
530
 
524
  case 'render':
525
  $current_value = get_user_option( $key );
526
 
527
+ if ( empty( $current_value ) ) {
528
  $current_value = get_option( 'posts_per_page', $value['std'] );
529
  }
530
 
includes/class-mla-settings-custom-fields-tab.php CHANGED
@@ -1121,9 +1121,11 @@ class MLA_Custom_Fields_List_Table extends WP_List_Table {
1121
  $submenu_arguments = array();
1122
  $has_filters = $include_filters;
1123
 
1124
- // View arguments
1125
  if ( isset( $_REQUEST['mla_custom_field_view'] ) ) {
1126
- $submenu_arguments['mla_custom_field_view'] = $_REQUEST['mla_custom_field_view'];
 
 
1127
  }
1128
 
1129
  // Search box arguments
@@ -1133,16 +1135,20 @@ class MLA_Custom_Fields_List_Table extends WP_List_Table {
1133
 
1134
  // Filter arguments (from table header)
1135
  if ( isset( $_REQUEST['mla_custom_field_status'] ) && ( 'any' != $_REQUEST['mla_custom_field_status'] ) ) {
1136
- $submenu_arguments['mla_custom_field_status'] = $_REQUEST['mla_custom_field_status'];
 
 
1137
  }
1138
 
1139
  // Sort arguments (from column header)
1140
  if ( isset( $_REQUEST['order'] ) ) {
1141
- $submenu_arguments['order'] = $_REQUEST['order'];
1142
  }
1143
 
1144
  if ( isset( $_REQUEST['orderby'] ) ) {
1145
- $submenu_arguments['orderby'] = $_REQUEST['orderby'];
 
 
1146
  }
1147
 
1148
  return $submenu_arguments;
@@ -1319,10 +1325,7 @@ class MLA_Custom_Fields_List_Table extends WP_List_Table {
1319
  private function _build_rollover_actions( $item, $column ) {
1320
  $actions = array();
1321
 
1322
- /*
1323
- * Compose view arguments
1324
- */
1325
-
1326
  $view_args = array_merge( array(
1327
  'page' => MLACoreOptions::MLA_SETTINGS_SLUG . '-custom_field',
1328
  'mla_tab' => 'custom_field',
@@ -1330,15 +1333,17 @@ class MLA_Custom_Fields_List_Table extends WP_List_Table {
1330
  ), MLA_Custom_Fields_List_Table::mla_submenu_arguments() );
1331
 
1332
  if ( isset( $_REQUEST['paged'] ) ) {
1333
- $view_args['paged'] = $_REQUEST['paged'];
1334
  }
1335
 
1336
  if ( isset( $_REQUEST['order'] ) ) {
1337
- $view_args['order'] = $_REQUEST['order'];
1338
  }
1339
 
1340
  if ( isset( $_REQUEST['orderby'] ) ) {
1341
- $view_args['orderby'] = $_REQUEST['orderby'];
 
 
1342
  }
1343
 
1344
  $actions['edit'] = '<a href="' . add_query_arg( $view_args, MLACore::mla_nonce_url( '?mla_admin_action=' . MLACore::MLA_ADMIN_SINGLE_EDIT_DISPLAY, MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME ) ) . '" title="' . __( 'Edit this item', 'media-library-assistant' ) . '">' . __( 'Edit', 'media-library-assistant' ) . '</a>';
@@ -2449,6 +2454,7 @@ class MLA_Custom_Field_Query {
2449
 
2450
  $items = self::mla_query_custom_field_rules( $request, 0, 0 );
2451
 
 
2452
  $template_items = array(
2453
  'all' => array(
2454
  'singular' => _x( 'All', 'table_view_singular', 'media_library-assistant' ),
1121
  $submenu_arguments = array();
1122
  $has_filters = $include_filters;
1123
 
1124
+ // View arguments - see also mla_tabulate_custom_field_items
1125
  if ( isset( $_REQUEST['mla_custom_field_view'] ) ) {
1126
+ if ( in_array( $_REQUEST['mla_custom_field_view'], array( 'all', 'mla_column', 'quick_edit', 'bulk_edit', 'read_only' ) ) ) {
1127
+ $submenu_arguments['mla_custom_field_view'] = $_REQUEST['mla_custom_field_view'];
1128
+ }
1129
  }
1130
 
1131
  // Search box arguments
1135
 
1136
  // Filter arguments (from table header)
1137
  if ( isset( $_REQUEST['mla_custom_field_status'] ) && ( 'any' != $_REQUEST['mla_custom_field_status'] ) ) {
1138
+ if ( in_array( $_REQUEST['mla_custom_field_status'], array( 'active', 'inactive' ) ) ) {
1139
+ $submenu_arguments['mla_custom_field_status'] = $_REQUEST['mla_custom_field_status'];
1140
+ }
1141
  }
1142
 
1143
  // Sort arguments (from column header)
1144
  if ( isset( $_REQUEST['order'] ) ) {
1145
+ $submenu_arguments['order'] = ( 'desc' === strtolower( $_REQUEST['order'] ) ) ? 'desc' : 'asc';
1146
  }
1147
 
1148
  if ( isset( $_REQUEST['orderby'] ) ) {
1149
+ if ( array_key_exists( $_REQUEST['orderby'], self::$default_sortable_columns ) ) {
1150
+ $submenu_arguments['orderby'] = $_REQUEST['orderby'];
1151
+ }
1152
  }
1153
 
1154
  return $submenu_arguments;
1325
  private function _build_rollover_actions( $item, $column ) {
1326
  $actions = array();
1327
 
1328
+ // Compose view arguments
 
 
 
1329
  $view_args = array_merge( array(
1330
  'page' => MLACoreOptions::MLA_SETTINGS_SLUG . '-custom_field',
1331
  'mla_tab' => 'custom_field',
1333
  ), MLA_Custom_Fields_List_Table::mla_submenu_arguments() );
1334
 
1335
  if ( isset( $_REQUEST['paged'] ) ) {
1336
+ $view_args['paged'] = absint( $_REQUEST['paged'] );
1337
  }
1338
 
1339
  if ( isset( $_REQUEST['order'] ) ) {
1340
+ $view_args['order'] = ( 'desc' === strtolower( $_REQUEST['order'] ) ) ? 'desc' : 'asc';
1341
  }
1342
 
1343
  if ( isset( $_REQUEST['orderby'] ) ) {
1344
+ if ( array_key_exists( $_REQUEST['orderby'], self::$default_sortable_columns ) ) {
1345
+ $view_args['orderby'] = urlencode( $_REQUEST['orderby'] );
1346
+ }
1347
  }
1348
 
1349
  $actions['edit'] = '<a href="' . add_query_arg( $view_args, MLACore::mla_nonce_url( '?mla_admin_action=' . MLACore::MLA_ADMIN_SINGLE_EDIT_DISPLAY, MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME ) ) . '" title="' . __( 'Edit this item', 'media-library-assistant' ) . '">' . __( 'Edit', 'media-library-assistant' ) . '</a>';
2454
 
2455
  $items = self::mla_query_custom_field_rules( $request, 0, 0 );
2456
 
2457
+ // See also mla_submenu_arguments
2458
  $template_items = array(
2459
  'all' => array(
2460
  'singular' => _x( 'All', 'table_view_singular', 'media_library-assistant' ),
includes/class-mla-settings-documentation-tab.php CHANGED
@@ -83,6 +83,40 @@ class MLASettings_Documentation {
83
  return $page_content;
84
  }
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  $source_path = MLA_PLUGIN_PATH . 'examples/plugins/' . $plugin->file;
87
  $file_contents = @file_get_contents( $source_path, false );
88
  if ( false === $file_contents ) {
@@ -102,7 +136,7 @@ class MLASettings_Documentation {
102
  $page_template_array = MLACore::mla_load_template( 'admin-display-settings-example-tab.tpl' );
103
  $page_values = array (
104
  'View Plugin' => __( 'View Plugin', 'media-library-assistant' ),
105
- 'form_url' => admin_url( 'options-general.php' ) . '?page=mla-settings-menu-documentation&mla_tab=documentation&mla-example-search=Search',
106
  'plugin_text' => $file_contents,
107
  'Close' => __( 'Close', 'media-library-assistant' ),
108
  '_wpnonce' => wp_nonce_field( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME, true, false ),
@@ -124,9 +158,7 @@ class MLASettings_Documentation {
124
  private static function _compose_example_tab() {
125
  $page_template_array = MLACore::mla_load_template( 'admin-display-settings-example-tab.tpl' );
126
 
127
- /*
128
- * Display the Example Plugin Table
129
- */
130
  $_SERVER['REQUEST_URI'] = add_query_arg( array( 'mla-example-display' => 'true' ), remove_query_arg( array(
131
  'mla_admin_action',
132
  'mla_item_slug',
@@ -405,7 +437,7 @@ class MLA_Example_List_Table extends WP_List_Table {
405
  *
406
  * @var array
407
  */
408
- private static $default_sortable_columns = array(
409
  'name' => array('name',false),
410
  'version' => array('version',false),
411
  'installed_version' => array('installed_version',true),
@@ -532,7 +564,7 @@ class MLA_Example_List_Table extends WP_List_Table {
532
  * @return void
533
  */
534
  public static function mla_admin_init( ) {
535
- //error_log( __LINE__ . ' mla_admin_init request = ' . var_export( $_REQUEST, true ), 0 );
536
  if ( isset( $_REQUEST['mla-example-cancel'] ) ) {
537
  unset( $_REQUEST['mla-example-display'] );
538
  }
@@ -602,11 +634,9 @@ class MLA_Example_List_Table extends WP_List_Table {
602
  */
603
  private function _build_rollover_actions( $item, $column ) {
604
  $actions = array();
 
605
 
606
- /*
607
- * Compose view arguments
608
- */
609
-
610
  $view_args = array(
611
  'page' => MLACoreOptions::MLA_SETTINGS_SLUG . '-documentation',
612
  'mla_tab' => 'documentation',
@@ -614,17 +644,31 @@ class MLA_Example_List_Table extends WP_List_Table {
614
  'mla_item_ID' => urlencode( $item->post_ID )
615
  );
616
 
617
- if ( isset( $_REQUEST['paged'] ) ) {
618
- $view_args['paged'] = $_REQUEST['paged'];
619
  }
620
 
621
- if ( isset( $_REQUEST['order'] ) ) {
622
- $view_args['order'] = $_REQUEST['order'];
 
 
 
623
  }
624
 
625
  if ( isset( $_REQUEST['orderby'] ) ) {
626
- $view_args['orderby'] = $_REQUEST['orderby'];
 
 
 
 
 
 
 
 
 
 
627
  }
 
628
 
629
  if ( empty( $item->installed_version ) ) {
630
  if ( current_user_can( 'install_plugins' ) ) {
@@ -639,8 +683,7 @@ class MLA_Example_List_Table extends WP_List_Table {
639
  if ( current_user_can( 'upload_files' ) && ( false === strpos( $item->file, '/' ) ) ) {
640
  $args = array(
641
  'page' => MLACore::ADMIN_PAGE_SLUG,
642
- 'mla_download_file' => urlencode( MLA_PLUGIN_PATH . 'examples/plugins/' . $item->file ),
643
- 'mla_download_type' => 'text/plain'
644
  );
645
  $actions['download'] = '<a href="' . add_query_arg( $args, MLACore::mla_nonce_url( 'upload.php', MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME ) ) . '" title="' . __( 'Download', 'media-library-assistant' ) . ' &#8220;' . esc_attr( $item->file ) . '&#8221;">' . __( 'Download', 'media-library-assistant' ) . '</a>';
646
  }
@@ -863,9 +906,7 @@ class MLA_Example_List_Table extends WP_List_Table {
863
  $this->get_sortable_columns()
864
  );
865
 
866
- /*
867
- * REQUIRED for pagination.
868
- */
869
  $total_items = self::_count_example_items( $_REQUEST );
870
  $user = get_current_user_id();
871
  $screen = get_current_screen();
@@ -880,9 +921,7 @@ class MLA_Example_List_Table extends WP_List_Table {
880
  $per_page = $screen->get_option( 'per_page', 'default' );
881
  }
882
 
883
- /*
884
- * REQUIRED. We also have to register our pagination options & calculations.
885
- */
886
  $this->set_pagination_args( array(
887
  'total_items' => $total_items,
888
  'per_page' => $per_page,
@@ -963,9 +1002,7 @@ class MLA_Example_List_Table extends WP_List_Table {
963
  return sprintf( __( 'Example plugin "%1$s" fs_connect failed; no action taken', 'media-library-assistant' ), $plugin->name );
964
  }
965
 
966
- /*
967
- * Convert a single-file plugin to (temporary) directory-based plugin
968
- */
969
  if ( !$source_is_dir ) {
970
  global $wp_filesystem;
971
 
@@ -997,7 +1034,6 @@ class MLA_Example_List_Table extends WP_List_Table {
997
  if ( ! $wp_filesystem->delete( WP_PLUGIN_DIR . '/' . $source_file, false, 'f' ) ) {
998
  /* translators: 1: plugin name, 2: WP_Error message */
999
  return sprintf( __( 'Example plugin "%1$s" remove old single file failed.', 'media-library-assistant' ), $plugin->name );
1000
- return new WP_Error( 'remove_old_failed', $this->strings['remove_old_failed'] );
1001
  }
1002
  }
1003
 
@@ -1292,9 +1328,7 @@ class MLA_Example_List_Table extends WP_List_Table {
1292
  $clean_request[ $key ] = 'ASC';
1293
  }
1294
  break;
1295
- /*
1296
- * ['s'] - Search items by one or more keywords
1297
- */
1298
  case 's':
1299
  $clean_request[ $key ] = stripslashes( trim( $value ) );
1300
  break;
@@ -1303,9 +1337,7 @@ class MLA_Example_List_Table extends WP_List_Table {
1303
  } // switch $key
1304
  } // foreach $raw_request
1305
 
1306
- /*
1307
- * Ignore incoming paged value; use offset and count instead
1308
- */
1309
  if ( ( (int) $count ) > 0 ) {
1310
  $clean_request['offset'] = $offset;
1311
  $clean_request['posts_per_page'] = $count;
@@ -1328,9 +1360,7 @@ class MLA_Example_List_Table extends WP_List_Table {
1328
  return array ();
1329
  }
1330
 
1331
- /*
1332
- * Sort and filter the list
1333
- */
1334
  $keywords = isset( $request['s'] ) ? $request['s'] : '';
1335
  preg_match_all('/".*?("|$)|((?<=[\t ",+])|^)[^\t ",+]+/', $keywords, $matches);
1336
  $keywords = array_map( 'MLAQuery::mla_search_terms_tidy', $matches[0]);
@@ -1530,6 +1560,7 @@ class MLA_Example_List_Table extends WP_List_Table {
1530
 
1531
  $items = self::_query_example_items( $request, 0, 0 );
1532
 
 
1533
  $example_items = array(
1534
  'all' => array(
1535
  'singular' => _x( 'All', 'table_view_singular', 'media_library-assistant' ),
83
  return $page_content;
84
  }
85
 
86
+ // Compose view arguments
87
+ $view_args = array(
88
+ 'page' => MLACoreOptions::MLA_SETTINGS_SLUG . '-documentation',
89
+ 'mla_tab' => 'documentation',
90
+ 'mla-example-search' => 'Search'
91
+ );
92
+
93
+ if ( isset( $_REQUEST['s'] ) ) {
94
+ $view_args['s'] = urlencode( stripslashes( $_REQUEST['s'] ) );
95
+ }
96
+
97
+ // See also _build_rollover_actions, _tabulate_example_items
98
+ if ( isset( $_REQUEST['mla_example_view'] ) ) {
99
+ if ( in_array( $_REQUEST['mla_example_view'], array( 'all', 'installed', 'active', 'inactive', 'network', 'uninstalled' ) ) ) {
100
+ $view_args['mla_example_view'] = urlencode( $_REQUEST['mla_example_view'] );
101
+ }
102
+ }
103
+
104
+ if ( isset( $_REQUEST['orderby'] ) ) {
105
+ if ( array_key_exists( $_REQUEST['orderby'], MLA_Example_List_Table::$default_sortable_columns ) ) {
106
+ $view_args['orderby'] = urlencode( $_REQUEST['orderby'] );
107
+ }
108
+ }
109
+
110
+ if ( isset( $_REQUEST['order'] ) ) {
111
+ $view_args['order'] = ( 'desc' === strtolower( $_REQUEST['order'] ) ) ? 'desc' : 'asc';
112
+ }
113
+
114
+ if ( isset( $_REQUEST['paged'] ) && absint( $_REQUEST['paged'] ) ) {
115
+ $view_args['paged'] = absint( $_REQUEST['paged'] );
116
+ }
117
+
118
+ $form_url = add_query_arg( $view_args, admin_url( 'options-general.php' ) );
119
+
120
  $source_path = MLA_PLUGIN_PATH . 'examples/plugins/' . $plugin->file;
121
  $file_contents = @file_get_contents( $source_path, false );
122
  if ( false === $file_contents ) {
136
  $page_template_array = MLACore::mla_load_template( 'admin-display-settings-example-tab.tpl' );
137
  $page_values = array (
138
  'View Plugin' => __( 'View Plugin', 'media-library-assistant' ),
139
+ 'form_url' => $form_url, // admin_url( 'options-general.php' ) . '?page=mla-settings-menu-documentation&mla_tab=documentation&mla-example-search=Search',
140
  'plugin_text' => $file_contents,
141
  'Close' => __( 'Close', 'media-library-assistant' ),
142
  '_wpnonce' => wp_nonce_field( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME, true, false ),
158
  private static function _compose_example_tab() {
159
  $page_template_array = MLACore::mla_load_template( 'admin-display-settings-example-tab.tpl' );
160
 
161
+ // Display the Example Plugin Table
 
 
162
  $_SERVER['REQUEST_URI'] = add_query_arg( array( 'mla-example-display' => 'true' ), remove_query_arg( array(
163
  'mla_admin_action',
164
  'mla_item_slug',
437
  *
438
  * @var array
439
  */
440
+ public static $default_sortable_columns = array(
441
  'name' => array('name',false),
442
  'version' => array('version',false),
443
  'installed_version' => array('installed_version',true),
564
  * @return void
565
  */
566
  public static function mla_admin_init( ) {
567
+ //error_log( __LINE__ . ' MLA_Example_List_Table::mla_admin_init request = ' . var_export( $_REQUEST, true ), 0 );
568
  if ( isset( $_REQUEST['mla-example-cancel'] ) ) {
569
  unset( $_REQUEST['mla-example-display'] );
570
  }
634
  */
635
  private function _build_rollover_actions( $item, $column ) {
636
  $actions = array();
637
+ //error_log( __LINE__ . " MLASettings_Documentation::_build_rollover_actions( {$column} ) _REQUEST = " . var_export( $_REQUEST, true ), 0 );
638
 
639
+ // Compose view arguments
 
 
 
640
  $view_args = array(
641
  'page' => MLACoreOptions::MLA_SETTINGS_SLUG . '-documentation',
642
  'mla_tab' => 'documentation',
644
  'mla_item_ID' => urlencode( $item->post_ID )
645
  );
646
 
647
+ if ( isset( $_REQUEST['s'] ) ) {
648
+ $view_args['s'] = urlencode( $_REQUEST['s'] );
649
  }
650
 
651
+ // See also _display_example_plugin, _tabulate_example_items
652
+ if ( isset( $_REQUEST['mla_example_view'] ) ) {
653
+ if ( in_array( $_REQUEST['mla_example_view'], array( 'all', 'installed', 'active', 'inactive', 'network', 'uninstalled' ) ) ) {
654
+ $view_args['mla_example_view'] = urlencode( $_REQUEST['mla_example_view'] );
655
+ }
656
  }
657
 
658
  if ( isset( $_REQUEST['orderby'] ) ) {
659
+ if ( array_key_exists( $_REQUEST['orderby'], self::$default_sortable_columns ) ) {
660
+ $view_args['orderby'] = urlencode( $_REQUEST['orderby'] );
661
+ }
662
+ }
663
+
664
+ if ( isset( $_REQUEST['order'] ) ) {
665
+ $view_args['order'] = ( 'desc' === strtolower( $_REQUEST['order'] ) ) ? 'desc' : 'asc';
666
+ }
667
+
668
+ if ( isset( $_REQUEST['paged'] ) && absint( $_REQUEST['paged'] ) ) {
669
+ $view_args['paged'] = absint( $_REQUEST['paged'] );
670
  }
671
+ //error_log( __LINE__ . " MLASettings_Documentation::_build_rollover_actions( {$column} ) view_args = " . var_export( $view_args, true ), 0 );
672
 
673
  if ( empty( $item->installed_version ) ) {
674
  if ( current_user_can( 'install_plugins' ) ) {
683
  if ( current_user_can( 'upload_files' ) && ( false === strpos( $item->file, '/' ) ) ) {
684
  $args = array(
685
  'page' => MLACore::ADMIN_PAGE_SLUG,
686
+ 'mla_download_example_plugin' => urlencode( $item->file ),
 
687
  );
688
  $actions['download'] = '<a href="' . add_query_arg( $args, MLACore::mla_nonce_url( 'upload.php', MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME ) ) . '" title="' . __( 'Download', 'media-library-assistant' ) . ' &#8220;' . esc_attr( $item->file ) . '&#8221;">' . __( 'Download', 'media-library-assistant' ) . '</a>';
689
  }
906
  $this->get_sortable_columns()
907
  );
908
 
909
+ // REQUIRED for pagination.
 
 
910
  $total_items = self::_count_example_items( $_REQUEST );
911
  $user = get_current_user_id();
912
  $screen = get_current_screen();
921
  $per_page = $screen->get_option( 'per_page', 'default' );
922
  }
923
 
924
+ // REQUIRED. We also have to register our pagination options & calculations.
 
 
925
  $this->set_pagination_args( array(
926
  'total_items' => $total_items,
927
  'per_page' => $per_page,
1002
  return sprintf( __( 'Example plugin "%1$s" fs_connect failed; no action taken', 'media-library-assistant' ), $plugin->name );
1003
  }
1004
 
1005
+ // Convert a single-file plugin to (temporary) directory-based plugin
 
 
1006
  if ( !$source_is_dir ) {
1007
  global $wp_filesystem;
1008
 
1034
  if ( ! $wp_filesystem->delete( WP_PLUGIN_DIR . '/' . $source_file, false, 'f' ) ) {
1035
  /* translators: 1: plugin name, 2: WP_Error message */
1036
  return sprintf( __( 'Example plugin "%1$s" remove old single file failed.', 'media-library-assistant' ), $plugin->name );
 
1037
  }
1038
  }
1039
 
1328
  $clean_request[ $key ] = 'ASC';
1329
  }
1330
  break;
1331
+ // ['s'] - Search items by one or more keywords
 
 
1332
  case 's':
1333
  $clean_request[ $key ] = stripslashes( trim( $value ) );
1334
  break;
1337
  } // switch $key
1338
  } // foreach $raw_request
1339
 
1340
+ // Ignore incoming paged value; use offset and count instead
 
 
1341
  if ( ( (int) $count ) > 0 ) {
1342
  $clean_request['offset'] = $offset;
1343
  $clean_request['posts_per_page'] = $count;
1360
  return array ();
1361
  }
1362
 
1363
+ // Sort and filter the list
 
 
1364
  $keywords = isset( $request['s'] ) ? $request['s'] : '';
1365
  preg_match_all('/".*?("|$)|((?<=[\t ",+])|^)[^\t ",+]+/', $keywords, $matches);
1366
  $keywords = array_map( 'MLAQuery::mla_search_terms_tidy', $matches[0]);
1560
 
1561
  $items = self::_query_example_items( $request, 0, 0 );
1562
 
1563
+ // See also _display_example_plugin, _build_rollover_actions
1564
  $example_items = array(
1565
  'all' => array(
1566
  'singular' => _x( 'All', 'table_view_singular', 'media_library-assistant' ),
includes/class-mla-settings-iptc-exif-tab.php CHANGED
@@ -1197,9 +1197,11 @@ class MLA_IPTC_EXIF_List_Table extends WP_List_Table {
1197
  $submenu_arguments = array();
1198
  $has_filters = $include_filters;
1199
 
1200
- // View arguments
1201
  if ( isset( $_REQUEST['mla_iptc_exif_view'] ) ) {
1202
- $submenu_arguments['mla_iptc_exif_view'] = $_REQUEST['mla_iptc_exif_view'];
 
 
1203
  }
1204
 
1205
  // Search box arguments
@@ -1209,16 +1211,20 @@ class MLA_IPTC_EXIF_List_Table extends WP_List_Table {
1209
 
1210
  // Filter arguments (from table header)
1211
  if ( isset( $_REQUEST['mla_iptc_exif_status'] ) && ( 'any' != $_REQUEST['mla_iptc_exif_status'] ) ) {
1212
- $submenu_arguments['mla_iptc_exif_status'] = $_REQUEST['mla_iptc_exif_status'];
 
 
1213
  }
1214
 
1215
  // Sort arguments (from column header)
1216
  if ( isset( $_REQUEST['order'] ) ) {
1217
- $submenu_arguments['order'] = $_REQUEST['order'];
1218
  }
1219
 
1220
  if ( isset( $_REQUEST['orderby'] ) ) {
1221
- $submenu_arguments['orderby'] = $_REQUEST['orderby'];
 
 
1222
  }
1223
 
1224
  return $submenu_arguments;
@@ -1397,10 +1403,7 @@ class MLA_IPTC_EXIF_List_Table extends WP_List_Table {
1397
  private function _build_rollover_actions( $item, $column ) {
1398
  $actions = array();
1399
 
1400
- /*
1401
- * Compose view arguments
1402
- */
1403
-
1404
  $view_args = array_merge( array(
1405
  'page' => MLACoreOptions::MLA_SETTINGS_SLUG . '-iptc_exif',
1406
  'mla_tab' => 'iptc_exif',
@@ -1408,15 +1411,17 @@ class MLA_IPTC_EXIF_List_Table extends WP_List_Table {
1408
  ), MLA_IPTC_EXIF_List_Table::mla_submenu_arguments() );
1409
 
1410
  if ( isset( $_REQUEST['paged'] ) ) {
1411
- $view_args['paged'] = $_REQUEST['paged'];
1412
  }
1413
 
1414
  if ( isset( $_REQUEST['order'] ) ) {
1415
- $view_args['order'] = $_REQUEST['order'];
1416
  }
1417
 
1418
  if ( isset( $_REQUEST['orderby'] ) ) {
1419
- $view_args['orderby'] = $_REQUEST['orderby'];
 
 
1420
  }
1421
 
1422
  $actions['edit'] = '<a href="' . add_query_arg( $view_args, MLACore::mla_nonce_url( '?mla_admin_action=' . MLACore::MLA_ADMIN_SINGLE_EDIT_DISPLAY, MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME ) ) . '" title="' . __( 'Edit this item', 'media-library-assistant' ) . '">' . __( 'Edit', 'media-library-assistant' ) . '</a>';
1197
  $submenu_arguments = array();
1198
  $has_filters = $include_filters;
1199
 
1200
+ // View arguments - see also mla_tabulate_iptc_exif_items
1201
  if ( isset( $_REQUEST['mla_iptc_exif_view'] ) ) {
1202
+ if ( in_array( $_REQUEST['mla_iptc_exif_view'], array( 'all', 'standard', 'taxonomy', 'custom', 'read_only' ) ) ) {
1203
+ $submenu_arguments['mla_iptc_exif_view'] = $_REQUEST['mla_iptc_exif_view'];
1204
+ }
1205
  }
1206
 
1207
  // Search box arguments
1211
 
1212
  // Filter arguments (from table header)
1213
  if ( isset( $_REQUEST['mla_iptc_exif_status'] ) && ( 'any' != $_REQUEST['mla_iptc_exif_status'] ) ) {
1214
+ if ( in_array( $_REQUEST['mla_iptc_exif_status'], array( 'active', 'inactive' ) ) ) {
1215
+ $submenu_arguments['mla_iptc_exif_status'] = $_REQUEST['mla_iptc_exif_status'];
1216
+ }
1217
  }
1218
 
1219
  // Sort arguments (from column header)
1220
  if ( isset( $_REQUEST['order'] ) ) {
1221
+ $submenu_arguments['order'] = ( 'desc' === strtolower( $_REQUEST['order'] ) ) ? 'desc' : 'asc';
1222
  }
1223
 
1224
  if ( isset( $_REQUEST['orderby'] ) ) {
1225
+ if ( array_key_exists( $_REQUEST['orderby'], self::$default_sortable_columns ) ) {
1226
+ $submenu_arguments['orderby'] = $_REQUEST['orderby'];
1227
+ }
1228
  }
1229
 
1230
  return $submenu_arguments;
1403
  private function _build_rollover_actions( $item, $column ) {
1404
  $actions = array();
1405
 
1406
+ // Compose view arguments
 
 
 
1407
  $view_args = array_merge( array(
1408
  'page' => MLACoreOptions::MLA_SETTINGS_SLUG . '-iptc_exif',
1409
  'mla_tab' => 'iptc_exif',
1411
  ), MLA_IPTC_EXIF_List_Table::mla_submenu_arguments() );
1412
 
1413
  if ( isset( $_REQUEST['paged'] ) ) {
1414
+ $view_args['paged'] = absint( $_REQUEST['paged'] );
1415
  }
1416
 
1417
  if ( isset( $_REQUEST['order'] ) ) {
1418
+ $view_args['order'] = ( 'desc' === strtolower( $_REQUEST['order'] ) ) ? 'desc' : 'asc';
1419
  }
1420
 
1421
  if ( isset( $_REQUEST['orderby'] ) ) {
1422
+ if ( array_key_exists( $_REQUEST['orderby'], self::$default_sortable_columns ) ) {
1423
+ $view_args['orderby'] = $_REQUEST['orderby'];
1424
+ }
1425
  }
1426
 
1427
  $actions['edit'] = '<a href="' . add_query_arg( $view_args, MLACore::mla_nonce_url( '?mla_admin_action=' . MLACore::MLA_ADMIN_SINGLE_EDIT_DISPLAY, MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME ) ) . '" title="' . __( 'Edit this item', 'media-library-assistant' ) . '">' . __( 'Edit', 'media-library-assistant' ) . '</a>';
includes/class-mla-settings-shortcodes-tab.php CHANGED
@@ -871,9 +871,11 @@ class MLA_Template_List_Table extends WP_List_Table {
871
  $submenu_arguments = array();
872
  $has_filters = $include_filters;
873
 
874
- // View arguments
875
  if ( isset( $_REQUEST['mla_template_view'] ) ) {
876
- $submenu_arguments['mla_template_view'] = $_REQUEST['mla_template_view'];
 
 
877
  }
878
 
879
  // Search box arguments
@@ -883,16 +885,20 @@ class MLA_Template_List_Table extends WP_List_Table {
883
 
884
  // Filter arguments (from table header)
885
  if ( isset( $_REQUEST['mla_template_status'] ) && ( 'any' != $_REQUEST['mla_template_status'] ) ) {
886
- $submenu_arguments['mla_template_status'] = $_REQUEST['mla_template_status'];
 
 
887
  }
888
 
889
  // Sort arguments (from column header)
890
  if ( isset( $_REQUEST['order'] ) ) {
891
- $submenu_arguments['order'] = $_REQUEST['order'];
892
  }
893
 
894
  if ( isset( $_REQUEST['orderby'] ) ) {
895
- $submenu_arguments['orderby'] = $_REQUEST['orderby'];
 
 
896
  }
897
 
898
  return $submenu_arguments;
@@ -1051,10 +1057,7 @@ class MLA_Template_List_Table extends WP_List_Table {
1051
  private function _build_rollover_actions( $item, $column ) {
1052
  $actions = array();
1053
 
1054
- /*
1055
- * Compose view arguments
1056
- */
1057
-
1058
  $view_args = array_merge( array(
1059
  'page' => MLACoreOptions::MLA_SETTINGS_SLUG . '-shortcodes',
1060
  'mla_tab' => 'shortcodes',
@@ -1062,7 +1065,7 @@ class MLA_Template_List_Table extends WP_List_Table {
1062
  ), MLA_Template_List_Table::mla_submenu_arguments() );
1063
 
1064
  if ( isset( $_REQUEST['paged'] ) ) {
1065
- $view_args['paged'] = $_REQUEST['paged'];
1066
  }
1067
 
1068
  if ( $item->default ) {
871
  $submenu_arguments = array();
872
  $has_filters = $include_filters;
873
 
874
+ // View arguments - see also mla_tabulate_template_items
875
  if ( isset( $_REQUEST['mla_template_view'] ) ) {
876
+ if ( in_array( $_REQUEST['mla_template_view'], array( 'all', 'style', 'markup', 'gallery', 'tag-cloud', 'term-list' ) ) ) {
877
+ $submenu_arguments['mla_template_view'] = $_REQUEST['mla_template_view'];
878
+ }
879
  }
880
 
881
  // Search box arguments
885
 
886
  // Filter arguments (from table header)
887
  if ( isset( $_REQUEST['mla_template_status'] ) && ( 'any' != $_REQUEST['mla_template_status'] ) ) {
888
+ if ( in_array( $_REQUEST['mla_template_status'], array( 'default', 'custom' ) ) ) {
889
+ $submenu_arguments['mla_template_status'] = $_REQUEST['mla_template_status'];
890
+ }
891
  }
892
 
893
  // Sort arguments (from column header)
894
  if ( isset( $_REQUEST['order'] ) ) {
895
+ $submenu_arguments['order'] = ( 'desc' === strtolower( $_REQUEST['order'] ) ) ? 'desc' : 'asc';
896
  }
897
 
898
  if ( isset( $_REQUEST['orderby'] ) ) {
899
+ if ( array_key_exists( $_REQUEST['orderby'], self::$default_sortable_columns ) ) {
900
+ $submenu_arguments['orderby'] = $_REQUEST['orderby'];
901
+ }
902
  }
903
 
904
  return $submenu_arguments;
1057
  private function _build_rollover_actions( $item, $column ) {
1058
  $actions = array();
1059
 
1060
+ // Compose view arguments
 
 
 
1061
  $view_args = array_merge( array(
1062
  'page' => MLACoreOptions::MLA_SETTINGS_SLUG . '-shortcodes',
1063
  'mla_tab' => 'shortcodes',
1065
  ), MLA_Template_List_Table::mla_submenu_arguments() );
1066
 
1067
  if ( isset( $_REQUEST['paged'] ) ) {
1068
+ $view_args['paged'] = absint( $_REQUEST['paged'] );
1069
  }
1070
 
1071
  if ( $item->default ) {
includes/class-mla-settings-upload-tab.php CHANGED
@@ -898,10 +898,7 @@ class MLA_Upload_List_Table extends WP_List_Table {
898
  private function _build_rollover_actions( $item, $column ) {
899
  $actions = array();
900
 
901
- /*
902
- * Compose view arguments
903
- */
904
-
905
  $view_args = array(
906
  'page' => MLACoreOptions::MLA_SETTINGS_SLUG . '-upload',
907
  'mla_tab' => 'upload',
@@ -909,15 +906,17 @@ class MLA_Upload_List_Table extends WP_List_Table {
909
  );
910
 
911
  if ( isset( $_REQUEST['paged'] ) ) {
912
- $view_args['paged'] = $_REQUEST['paged'];
913
  }
914
 
915
  if ( isset( $_REQUEST['order'] ) ) {
916
- $view_args['order'] = $_REQUEST['order'];
917
  }
918
 
919
  if ( isset( $_REQUEST['orderby'] ) ) {
920
- $view_args['orderby'] = $_REQUEST['orderby'];
 
 
921
  }
922
 
923
  $actions['edit'] = '<a href="' . add_query_arg( $view_args, MLACore::mla_nonce_url( '?mla_admin_action=' . MLACore::MLA_ADMIN_SINGLE_EDIT_DISPLAY, MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME ) ) . '" title="' . __( 'Edit this item', 'media-library-assistant' ) . '">' . __( 'Edit', 'media-library-assistant' ) . '</a>';
@@ -1444,10 +1443,7 @@ class MLA_Upload_Optional_List_Table extends WP_List_Table {
1444
  private function _build_rollover_actions( $item, $column ) {
1445
  $actions = array();
1446
 
1447
- /*
1448
- * Compose view arguments
1449
- */
1450
-
1451
  $view_args = array(
1452
  'page' => MLACoreOptions::MLA_SETTINGS_SLUG . '-upload',
1453
  'mla_tab' => 'upload',
@@ -1455,15 +1451,17 @@ class MLA_Upload_Optional_List_Table extends WP_List_Table {
1455
  );
1456
 
1457
  if ( isset( $_REQUEST['paged'] ) ) {
1458
- $view_args['paged'] = $_REQUEST['paged'];
1459
  }
1460
 
1461
  if ( isset( $_REQUEST['order'] ) ) {
1462
- $view_args['order'] = $_REQUEST['order'];
1463
  }
1464
 
1465
  if ( isset( $_REQUEST['orderby'] ) ) {
1466
- $view_args['orderby'] = $_REQUEST['orderby'];
 
 
1467
  }
1468
 
1469
  $actions['select'] = '<a href="' . add_query_arg( $view_args, MLACore::mla_nonce_url( '?mla_admin_action=' . MLACore::MLA_ADMIN_SINGLE_EDIT_UPDATE, MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME ) ) . '" title="' . __( 'Select this entry', 'media-library-assistant' ) . '">' . __( 'Select', 'media-library-assistant' ) . '</a>';
898
  private function _build_rollover_actions( $item, $column ) {
899
  $actions = array();
900
 
901
+ // Compose view arguments
 
 
 
902
  $view_args = array(
903
  'page' => MLACoreOptions::MLA_SETTINGS_SLUG . '-upload',
904
  'mla_tab' => 'upload',
906
  );
907
 
908
  if ( isset( $_REQUEST['paged'] ) ) {
909
+ $view_args['paged'] = absint( $_REQUEST['paged'] );
910
  }
911
 
912
  if ( isset( $_REQUEST['order'] ) ) {
913
+ $view_args['order'] = ( 'desc' === strtolower( $_REQUEST['order'] ) ) ? 'desc' : 'asc';
914
  }
915
 
916
  if ( isset( $_REQUEST['orderby'] ) ) {
917
+ if ( array_key_exists( $_REQUEST['orderby'], MLAMime::$default_sortable_upload_columns ) ) {
918
+ $view_args['orderby'] = urlencode( $_REQUEST['orderby'] );
919
+ }
920
  }
921
 
922
  $actions['edit'] = '<a href="' . add_query_arg( $view_args, MLACore::mla_nonce_url( '?mla_admin_action=' . MLACore::MLA_ADMIN_SINGLE_EDIT_DISPLAY, MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME ) ) . '" title="' . __( 'Edit this item', 'media-library-assistant' ) . '">' . __( 'Edit', 'media-library-assistant' ) . '</a>';
1443
  private function _build_rollover_actions( $item, $column ) {
1444
  $actions = array();
1445
 
1446
+ // Compose view arguments
 
 
 
1447
  $view_args = array(
1448
  'page' => MLACoreOptions::MLA_SETTINGS_SLUG . '-upload',
1449
  'mla_tab' => 'upload',
1451
  );
1452
 
1453
  if ( isset( $_REQUEST['paged'] ) ) {
1454
+ $view_args['paged'] = absint( $_REQUEST['paged'] );
1455
  }
1456
 
1457
  if ( isset( $_REQUEST['order'] ) ) {
1458
+ $view_args['order'] = ( 'desc' === strtolower( $_REQUEST['order'] ) ) ? 'desc' : 'asc';
1459
  }
1460
 
1461
  if ( isset( $_REQUEST['orderby'] ) ) {
1462
+ if ( array_key_exists( $_REQUEST['orderby'], MLAMime::$default_upload_optional_sortable_columns ) ) {
1463
+ $view_args['orderby'] = urlencode( $_REQUEST['orderby'] );
1464
+ }
1465
  }
1466
 
1467
  $actions['select'] = '<a href="' . add_query_arg( $view_args, MLACore::mla_nonce_url( '?mla_admin_action=' . MLACore::MLA_ADMIN_SINGLE_EDIT_UPDATE, MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME ) ) . '" title="' . __( 'Select this entry', 'media-library-assistant' ) . '">' . __( 'Select', 'media-library-assistant' ) . '</a>';
includes/class-mla-settings-view-tab.php CHANGED
@@ -682,10 +682,7 @@ class MLA_View_List_Table extends WP_List_Table {
682
  private function _build_rollover_actions( $item, $column ) {
683
  $actions = array();
684
 
685
- /*
686
- * Compose view arguments
687
- */
688
-
689
  $view_args = array(
690
  'page' => MLACoreOptions::MLA_SETTINGS_SLUG . '-view',
691
  'mla_tab' => 'view',
@@ -693,20 +690,20 @@ class MLA_View_List_Table extends WP_List_Table {
693
  );
694
 
695
  if ( isset( $_REQUEST['paged'] ) ) {
696
- $view_args['paged'] = $_REQUEST['paged'];
697
  }
698
 
699
  if ( isset( $_REQUEST['order'] ) ) {
700
- $view_args['order'] = $_REQUEST['order'];
701
  }
702
 
703
  if ( isset( $_REQUEST['orderby'] ) ) {
704
- $view_args['orderby'] = $_REQUEST['orderby'];
 
 
705
  }
706
 
707
- /*
708
- * Get the standard and custom types
709
- */
710
  $mla_types = MLACore::mla_get_option( MLACoreOptions::MLA_POST_MIME_TYPES, true );
711
  if ( ! is_array( $mla_types ) ) {
712
  $mla_types = array ();
682
  private function _build_rollover_actions( $item, $column ) {
683
  $actions = array();
684
 
685
+ // Compose view arguments
 
 
 
686
  $view_args = array(
687
  'page' => MLACoreOptions::MLA_SETTINGS_SLUG . '-view',
688
  'mla_tab' => 'view',
690
  );
691
 
692
  if ( isset( $_REQUEST['paged'] ) ) {
693
+ $view_args['paged'] = absint( $_REQUEST['paged'] );
694
  }
695
 
696
  if ( isset( $_REQUEST['order'] ) ) {
697
+ $view_args['order'] = ( 'desc' === strtolower( $_REQUEST['order'] ) ) ? 'desc' : 'asc';
698
  }
699
 
700
  if ( isset( $_REQUEST['orderby'] ) ) {
701
+ if ( array_key_exists( $_REQUEST['orderby'], MLAMime::$default_sortable_view_columns ) ) {
702
+ $view_args['orderby'] = urlencode( $_REQUEST['orderby'] );
703
+ }
704
  }
705
 
706
+ // Get the standard and custom types
 
 
707
  $mla_types = MLACore::mla_get_option( MLACoreOptions::MLA_POST_MIME_TYPES, true );
708
  if ( ! is_array( $mla_types ) ) {
709
  $mla_types = array ();
includes/class-mla-shortcode-support.php CHANGED
@@ -48,9 +48,7 @@ class MLAShortcode_Support {
48
  public static function mla_ghostscript_present( $explicit_path = '', $ghostscript_only = false ) {
49
  static $ghostscript_present = NULL;
50
 
51
- /*
52
- * If $ghostscript_only = false, let the mla_debug parameter control logging
53
- */
54
  if ( $ghostscript_only ) {
55
  $mla_debug_category = MLACore::MLA_DEBUG_CATEGORY_THUMBNAIL;
56
  } else {
@@ -71,18 +69,14 @@ class MLAShortcode_Support {
71
  return $ghostscript_present = true;
72
  }
73
 
74
- /*
75
- * Imagick must be installed as well
76
- */
77
  if ( ! class_exists( 'Imagick' ) ) {
78
  MLACore::mla_debug_add( '<strong>MLAShortcode_Support::mla_ghostscript_present</strong>, Imagick missing', $mla_debug_category );
79
  return $ghostscript_present = false;
80
  }
81
  } // not ghostscript_only
82
 
83
- /*
84
- * Look for exec() - from http://stackoverflow.com/a/12980534/866618
85
- */
86
  $blacklist = preg_split( '/,\s*/', ini_get('disable_functions') . ',' . ini_get('suhosin.executor.func.blacklist') );
87
  if ( in_array('exec', $blacklist) ) {
88
  MLACore::mla_debug_add( '<strong>MLAShortcode_Support::mla_ghostscript_present</strong>, exec in blacklist', $mla_debug_category );
@@ -223,9 +217,7 @@ class MLAShortcode_Support {
223
 
224
  $attr = shortcode_parse_atts( $new_attr );
225
 
226
- /*
227
- * Remove empty values and still-invalid parameters
228
- */
229
  $new_attr = '';
230
  foreach ( $attr as $key => $value ) {
231
  if ( is_numeric( $key ) || empty( $value ) ) {
@@ -238,9 +230,7 @@ class MLAShortcode_Support {
238
  $attr = $new_attr;
239
  } // not_valid
240
 
241
- /*
242
- * Look for parameters in an enclosing shortcode
243
- */
244
  if ( ! ( empty( $content ) || isset( $attr['mla_alt_shortcode'] ) ) ) {
245
  $content = str_replace( array( '&#038;', '&#8216;', '&#8217;', '&#8221;', '&#8243;', '<br />', '<p>', '</p>', "\r", "\n" ), array( '&', '\'', '\'', '"', '"', ' ', ' ', ' ', ' ', ' ' ), $content );
246
  $new_attr = shortcode_parse_atts( $content );
@@ -310,9 +300,7 @@ class MLAShortcode_Support {
310
  public static function mla_gallery_shortcode( $attr, $content = NULL ) {
311
  global $post;
312
 
313
- /*
314
- * Some do_shortcode callers may not have a specific post in mind
315
- */
316
  if ( ! is_object( $post ) ) {
317
  $post = (object) self::$empty_post;
318
  }
@@ -321,9 +309,7 @@ class MLAShortcode_Support {
321
  static $instance = 0;
322
  $instance++;
323
 
324
- /*
325
- * Some values are already known, and can be used in data selection parameters
326
- */
327
  $upload_dir = wp_upload_dir();
328
  $page_values = array(
329
  'instance' => $instance,
@@ -354,10 +340,7 @@ class MLAShortcode_Support {
354
  */
355
  $attr = self::_validate_attributes( $attr, $content );
356
 
357
- /*
358
- * Filter the attributes before $mla_page_parameter and "request:" prefix processing.
359
- */
360
-
361
  $attr = apply_filters( 'mla_gallery_raw_attributes', $attr );
362
 
363
  /*
@@ -383,9 +366,7 @@ class MLAShortcode_Support {
383
  }
384
  }
385
 
386
- /*
387
- * These are the parameters for gallery display
388
- */
389
  $mla_item_specific_arguments = array(
390
  'mla_link_attributes' => '',
391
  'mla_link_class' => '',
@@ -399,9 +380,7 @@ class MLAShortcode_Support {
399
  'mla_caption' => ''
400
  );
401
 
402
- /*
403
- * These arguments must not be passed on to alternate gallery shortcodes
404
- */
405
  $mla_arguments = array_merge( array(
406
  'mla_output' => 'gallery',
407
  'mla_style' => MLACore::mla_get_option('default_style'),
@@ -500,18 +479,13 @@ class MLAShortcode_Support {
500
  $attr[ $attr_key ] = MLAData::mla_parse_template( $attr_value, $replacement_values );
501
  }
502
 
503
- /*
504
- * Merge gallery arguments with defaults, pass the query arguments on to mla_get_shortcode_attachments.
505
- */
506
-
507
  $attr = apply_filters( 'mla_gallery_attributes', $attr );
508
  $content = apply_filters( 'mla_gallery_initial_content', $content, $attr );
509
  $arguments = shortcode_atts( $default_arguments, $attr );
510
  $arguments = apply_filters( 'mla_gallery_arguments', $arguments );
511
 
512
- /*
513
- * Decide which templates to use
514
- */
515
  if ( ( 'none' !== $arguments['mla_style'] ) && ( 'theme' !== $arguments['mla_style'] ) ) {
516
  if ( !MLATemplate_Support::mla_fetch_custom_template( $arguments['mla_style'], 'gallery', 'style', '[exists]' ) ) {
517
  MLACore::mla_debug_add( '<strong>mla_gallery mla_style</strong> "' . $arguments['mla_style'] . '" ' . __( 'not found', 'media-library-assistant' ), MLACore::MLA_DEBUG_CATEGORY_ANY );
@@ -524,9 +498,7 @@ class MLAShortcode_Support {
524
  $arguments['mla_markup'] = $default_arguments['mla_markup'];
525
  }
526
 
527
- /*
528
- * Look for "no effect" alternate gallery shortcode to support plugins such as Justified Image Grid
529
- */
530
  if ( is_string( $arguments['mla_alt_shortcode'] ) && ( in_array( $arguments['mla_alt_shortcode'], array( 'mla_gallery', 'no' ) ) ) ) {
531
  $arguments['mla_alt_shortcode'] = NULL;
532
  $arguments['mla_alt_ids_name'] = 'ids';
@@ -550,9 +522,7 @@ class MLAShortcode_Support {
550
  MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug arguments', 'media-library-assistant' ) . '</strong> = ' . var_export( $arguments, true ) );
551
  }
552
 
553
- /*
554
- * Determine output type
555
- */
556
  $output_parameters = array_map( 'strtolower', array_map( 'trim', explode( ',', $arguments['mla_output'] ) ) );
557
  if ( ! in_array( $output_parameters[0], array( 'gallery', 'next_link', 'current_link', 'previous_link', 'next_page', 'previous_page', 'paginate_links' ) ) ) {
558
  $output_parameters[0] = 'gallery';
@@ -597,13 +567,16 @@ class MLAShortcode_Support {
597
  $output = '';
598
  }
599
 
600
- $output .= $arguments['mla_nolink_text'];
 
 
 
 
 
601
  return $output;
602
  } // empty $attachments
603
 
604
- /*
605
- * Look for Photonic-enhanced gallery; use the [gallery] shortcode if found
606
- */
607
  global $photonic;
608
 
609
  if ( is_object( $photonic ) && ! empty( $arguments['style'] ) && empty( $arguments['mla_alt_shortcode'] ) ) {
@@ -618,13 +591,9 @@ class MLAShortcode_Support {
618
  $arguments['mla_alt_shortcode'] = 'gallery';
619
  }
620
 
621
- /*
622
- * Look for user-specified alternate gallery shortcode
623
- */
624
  if ( is_string( $arguments['mla_alt_shortcode'] ) ) {
625
- /*
626
- * Replace data-selection parameters with the "ids" list
627
- */
628
  $blacklist = array_merge( self::$mla_get_shortcode_attachments_parameters, self::$mla_get_shortcode_dynamic_attachments_parameters );
629
  if ( 'mla_tag_cloud' !== $arguments['mla_alt_shortcode'] ) {
630
  $blacklist = array_merge( $mla_arguments, $blacklist );
@@ -673,9 +642,7 @@ class MLAShortcode_Support {
673
  $output = '';
674
  }
675
 
676
- /*
677
- * Execute the alternate gallery shortcode with the new parameters
678
- */
679
  $content = apply_filters( 'mla_gallery_final_content', $content );
680
  if ( ! empty( $content ) ) {
681
  $output .= do_shortcode( sprintf( '[%1$s %2$s %3$s]%4$s[/%1$s]', $arguments['mla_alt_shortcode'], $mla_alt_shortcode_ids, $mla_alt_shortcode_args, $content ) );
@@ -708,9 +675,7 @@ class MLAShortcode_Support {
708
  $show_icon = false;
709
  }
710
 
711
- /*
712
- * Feeds such as RSS, Atom or RDF do not require styled and formatted output
713
- */
714
  if ( is_feed() ) {
715
  $output = "\n";
716
  foreach ( $attachments as $att_id => $attachment )
@@ -718,9 +683,7 @@ class MLAShortcode_Support {
718
  return $output;
719
  }
720
 
721
- /*
722
- * Check for Imagick thumbnail generation arguments
723
- */
724
  $mla_viewer_required = false;
725
  if ( 'checked' == MLACore::mla_get_option( 'enable_mla_viewer' ) ) {
726
  if ( ! empty( $arguments['mla_viewer'] ) ) {
@@ -745,9 +708,7 @@ class MLAShortcode_Support {
745
  }
746
 
747
  if ( $arguments['mla_viewer'] ) {
748
- /*
749
- * Test for Ghostscript here so debug messages can be recorded
750
- */
751
  $ghostscript_path = MLACore::mla_get_option( 'ghostscript_path' );
752
  if ( self::mla_ghostscript_present( $ghostscript_path ) ) {
753
  $arguments['mla_viewer_extensions'] = array_filter( array_map( 'trim', explode( ',', $arguments['mla_viewer_extensions'] ) ) );
@@ -843,14 +804,10 @@ class MLAShortcode_Support {
843
  }
844
 
845
  if ( ! empty ( $style_template ) ) {
846
- /*
847
- * Look for 'query' and 'request' substitution parameters
848
- */
849
  $style_values = MLAData::mla_expand_field_level_parameters( $style_template, $attr, $style_values );
850
 
851
- /*
852
- * Clean up the template to resolve width or margin == 'none'
853
- */
854
  if ( 'none' == $margin_string ) {
855
  $style_values['margin'] = '0';
856
  $style_template = preg_replace( '/margin:[\s]*\[\+margin\+\][\%]*[\;]*/', '', $style_template );
@@ -866,9 +823,7 @@ class MLAShortcode_Support {
866
  $gallery_style = MLAData::mla_parse_template( $style_template, $style_values );
867
  $gallery_style = apply_filters( 'mla_gallery_style_parse', $gallery_style, $style_template, $style_values );
868
 
869
- /*
870
- * Clean up the styles to resolve extra "%" suffixes on width or margin (pre v1.42 values)
871
- */
872
  $preg_pattern = array( '/([margin|width]:[^\%]*)\%\%/', '/([margin|width]:.*)auto\%/', '/([margin|width]:.*)inherit\%/' );
873
  $preg_replacement = array( '${1}%', '${1}auto', '${1}inherit', );
874
  $gallery_style = preg_replace( $preg_pattern, $preg_replacement, $gallery_style );
@@ -882,9 +837,7 @@ class MLAShortcode_Support {
882
  $open_template = '';
883
  }
884
 
885
- /*
886
- * Emulate [gallery] handling of row open markup for the default template only
887
- */
888
  if ( $html5 && ( 'default' == $markup_values['mla_markup'] ) ) {
889
  $row_open_template = '';
890
  } else{
@@ -900,9 +853,7 @@ class MLAShortcode_Support {
900
  $item_template = '';
901
  }
902
 
903
- /*
904
- * Emulate [gallery] handling of row close markup for the default template only
905
- */
906
  if ( $html5 && ( 'default' == $markup_values['mla_markup'] ) ) {
907
  $row_close_template = '';
908
  } else{
@@ -918,9 +869,7 @@ class MLAShortcode_Support {
918
  $close_template = '';
919
  }
920
 
921
- /*
922
- * Look for gallery-level markup substitution parameters
923
- */
924
  $new_text = $open_template . $row_open_template . $row_close_template . $close_template;
925
  $markup_values = MLAData::mla_expand_field_level_parameters( $new_text, $attr, $markup_values );
926
 
@@ -930,9 +879,7 @@ class MLAShortcode_Support {
930
  $mla_alt_ids_output = $output = '';
931
  }
932
 
933
- /*
934
- * These $markup_values are used for both pagination and gallery output
935
- */
936
  $markup_values = apply_filters( 'mla_gallery_open_values', $markup_values );
937
 
938
  if ( $is_gallery ) {
@@ -946,9 +893,7 @@ class MLAShortcode_Support {
946
  $gallery_open = apply_filters( 'mla_gallery_open_parse', $gallery_open, $open_template, $markup_values );
947
  $output .= apply_filters( 'mla_gallery_style', $gallery_style . $gallery_open, $style_values, $markup_values, $style_template, $open_template );
948
  } else {
949
- /*
950
- * Handle 'previous_page', 'next_page', and 'paginate_links'
951
- */
952
  $pagination_result = self::_process_pagination_output_types( $output_parameters, $markup_values, $arguments, $attr, $found_rows, $output );
953
  if ( false !== $pagination_result ) {
954
  return $pagination_result;
@@ -1913,16 +1858,12 @@ class MLAShortcode_Support {
1913
  }
1914
  }
1915
 
1916
- /*
1917
- * Process the pagination parameter, if present
1918
- */
1919
  if ( isset( $arguments[ $mla_page_parameter ] ) ) {
1920
  $arguments['offset'] = $arguments['limit'] * ( $arguments[ $mla_page_parameter ] - 1);
1921
  }
1922
 
1923
- /*
1924
- * Clean up the current_item to separate term_id from slug
1925
- */
1926
  if ( ! empty( $arguments['current_item'] ) && ctype_digit( $arguments['current_item'] ) ) {
1927
  $arguments['current_item'] = absint( $arguments['current_item'] );
1928
  }
@@ -1946,9 +1887,7 @@ class MLAShortcode_Support {
1946
  MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug arguments', 'media-library-assistant' ) . '</strong> = ' . var_export( $arguments, true ) );
1947
  }
1948
 
1949
- /*
1950
- * Determine templates and output type
1951
- */
1952
  if ( $arguments['mla_style'] && ( 'none' !== $arguments['mla_style'] ) ) {
1953
  if ( !MLATemplate_Support::mla_fetch_custom_template( $arguments['mla_style'], 'tag-cloud', 'style', '[exists]' ) ) {
1954
  MLACore::mla_debug_add( '<strong>mla_tag_cloud mla_style</strong> "' . $arguments['mla_style'] . '" ' . __( 'not found', 'media-library-assistant' ), MLACore::MLA_DEBUG_CATEGORY_ANY );
@@ -2477,15 +2416,14 @@ class MLAShortcode_Support {
2477
  $item_values['current_item_class'] = $arguments['current_item_class'];
2478
  }
2479
  } else {
2480
- if ( $arguments['current_item'] == $tag->slug ) {
 
2481
  $item_values['current_item_class'] = $arguments['current_item_class'];
2482
  }
2483
  }
2484
  }
2485
 
2486
- /*
2487
- * Add item_specific field-level substitution parameters
2488
- */
2489
  $new_text = isset( $item_template ) ? $item_template : '';
2490
  foreach( $mla_item_specific_arguments as $index => $value ) {
2491
  $new_text .= str_replace( '{+', '[+', str_replace( '+}', '+]', $arguments[ $index ] ) );
@@ -2502,9 +2440,7 @@ class MLAShortcode_Support {
2502
  $item_values['caption'] = '';
2503
  }
2504
 
2505
- /*
2506
- * Apply the Display Content parameters.
2507
- */
2508
  if ( ! empty( $arguments['mla_target'] ) ) {
2509
  $link_attributes = 'target="' . $arguments['mla_target'] . '" ';
2510
  } else {
@@ -2855,7 +2791,8 @@ class MLAShortcode_Support {
2855
  }
2856
 
2857
  if ( $current_is_slug || !( ctype_digit( $current_item ) || is_int( $current_item ) ) ) {
2858
- if ( $current_item == $term->slug ) {
 
2859
  $is_active = true;
2860
  $item_values['current_item_class'] = $arguments['current_item_class'];
2861
  break;
@@ -3192,7 +3129,6 @@ class MLAShortcode_Support {
3192
  $arguments[ $mla_item_parameter ] = $attr[ $mla_item_parameter ];
3193
  } else {
3194
  $arguments[ $mla_item_parameter ] = $defaults['current_item'];
3195
-
3196
  }
3197
  }
3198
 
@@ -3870,18 +3806,14 @@ class MLAShortcode_Support {
3870
 
3871
  $new_target = ( ! empty( $arguments['mla_target'] ) ) ? 'target="' . $arguments['mla_target'] . '" ' : '';
3872
 
3873
- /*
3874
- * these will add to the default classes
3875
- */
3876
  $new_class = ( ! empty( $arguments['mla_link_class'] ) ) ? ' ' . esc_attr( self::_process_shortcode_parameter( $arguments['mla_link_class'], $markup_values ) ) : '';
3877
 
3878
  $new_attributes = ( ! empty( $arguments['mla_link_attributes'] ) ) ? esc_attr( self::_process_shortcode_parameter( $arguments['mla_link_attributes'], $markup_values ) ) . ' ' : '';
3879
 
3880
  $new_base = ( ! empty( $arguments['mla_link_href'] ) ) ? self::_process_shortcode_parameter( $arguments['mla_link_href'], $markup_values ) : $markup_values['new_url'];
3881
 
3882
- /*
3883
- * Build the array of page links
3884
- */
3885
  $page_links = array();
3886
  $dots = false;
3887
 
@@ -4459,8 +4391,8 @@ class MLAShortcode_Support {
4459
  public static function mla_get_shortcode_attachments( $post_parent, $attr, $return_found_rows = NULL ) {
4460
  global $wp_query;
4461
 
4462
- // Parameters passed to the where and orderby filter functions
4463
- self::$query_parameters = array();
4464
 
4465
  // Parameters passed to the posts_search filter function in MLAData
4466
  MLAQuery::$search_parameters = array( 'debug' => 'none' );
@@ -4538,9 +4470,7 @@ class MLAShortcode_Support {
4538
  $arguments = apply_filters( 'mla_gallery_query_arguments', $arguments );
4539
  }
4540
 
4541
- /*
4542
- * Extract taxonomy arguments
4543
- */
4544
  self::$mla_get_shortcode_dynamic_attachments_parameters = array();
4545
  $query_arguments = array();
4546
  $no_terms_assigned_query = false;
@@ -5222,11 +5152,17 @@ class MLAShortcode_Support {
5222
  MLAQuery::$search_parameters['mla_search_fields'] = array( 'title', 'content' );
5223
  } else {
5224
  MLAQuery::$search_parameters['mla_search_fields'] = array_filter( array_map( 'trim', explode( ',', MLAQuery::$search_parameters['mla_search_fields'] ) ) );
5225
- MLAQuery::$search_parameters['mla_search_fields'] = array_intersect( array( 'title', 'content', 'excerpt', 'name', 'terms' ), MLAQuery::$search_parameters['mla_search_fields'] );
5226
 
5227
- /*
5228
- * Look for keyword search including 'terms'
5229
- */
 
 
 
 
 
 
5230
  foreach ( MLAQuery::$search_parameters['mla_search_fields'] as $index => $field ) {
5231
  if ( 'terms' == $field ) {
5232
  if ( isset( MLAQuery::$search_parameters['mla_terms_search']['phrases'] ) ) {
@@ -5261,23 +5197,8 @@ class MLAShortcode_Support {
5261
  }
5262
 
5263
  if ( self::$mla_debug ) {
5264
- global $wp_filter;
5265
-
5266
- foreach( $wp_filter['posts_where'] as $priority => $filters ) {
5267
- $debug_message = '<strong>mla_debug $wp_filter[posts_where]</strong> priority = ' . var_export( $priority, true ) . '<br />';
5268
- foreach ( $filters as $name => $descriptor ) {
5269
- $debug_message .= 'filter name = ' . var_export( $name, true ) . '<br />';
5270
- }
5271
- MLACore::mla_debug_add( $debug_message );
5272
- }
5273
-
5274
- foreach( $wp_filter['posts_orderby'] as $priority => $filters ) {
5275
- $debug_message = '<strong>mla_debug $wp_filter[posts_orderby]</strong> priority = ' . var_export( $priority, true ) . '<br />';
5276
- foreach ( $filters as $name => $descriptor ) {
5277
- $debug_message .= 'filter name = ' . var_export( $name, true ) . '<br />';
5278
- }
5279
- MLACore::mla_debug_add( $debug_message );
5280
- }
5281
  }
5282
 
5283
  /*
@@ -5361,6 +5282,11 @@ class MLAShortcode_Support {
5361
  public static function mla_shortcode_query_posts_join_filter( $join_clause ) {
5362
  global $wpdb;
5363
 
 
 
 
 
 
5364
  /*
5365
  * Set for taxonomy queries unless post_parent=current. If true, we must disable
5366
  * the LEFT JOIN clause that get_posts() adds to taxonomy queries.
@@ -5370,9 +5296,7 @@ class MLAShortcode_Support {
5370
  $join_clause = str_replace( " LEFT JOIN {$wpdb->posts} AS p2 ON ({$wpdb->posts}.post_parent = p2.ID) ", " LEFT JOIN {$wpdb->posts} AS p2 ON (p2.ID = p2.ID) ", $join_clause );
5371
  }
5372
 
5373
- /*
5374
- * These joins support the 'terms' search_field
5375
- */
5376
  if ( isset( MLAQuery::$search_parameters['tax_terms_count'] ) ) {
5377
  $tax_index = 0;
5378
  $tax_clause = '';
@@ -5385,6 +5309,23 @@ class MLAShortcode_Support {
5385
  $join_clause .= $tax_clause;
5386
  }
5387
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5388
 
5389
  return $join_clause;
5390
  }
48
  public static function mla_ghostscript_present( $explicit_path = '', $ghostscript_only = false ) {
49
  static $ghostscript_present = NULL;
50
 
51
+ // If $ghostscript_only = false, let the mla_debug parameter control logging
 
 
52
  if ( $ghostscript_only ) {
53
  $mla_debug_category = MLACore::MLA_DEBUG_CATEGORY_THUMBNAIL;
54
  } else {
69
  return $ghostscript_present = true;
70
  }
71
 
72
+ // Imagick must be installed as well
 
 
73
  if ( ! class_exists( 'Imagick' ) ) {
74
  MLACore::mla_debug_add( '<strong>MLAShortcode_Support::mla_ghostscript_present</strong>, Imagick missing', $mla_debug_category );
75
  return $ghostscript_present = false;
76
  }
77
  } // not ghostscript_only
78
 
79
+ // Look for exec() - from http://stackoverflow.com/a/12980534/866618
 
 
80
  $blacklist = preg_split( '/,\s*/', ini_get('disable_functions') . ',' . ini_get('suhosin.executor.func.blacklist') );
81
  if ( in_array('exec', $blacklist) ) {
82
  MLACore::mla_debug_add( '<strong>MLAShortcode_Support::mla_ghostscript_present</strong>, exec in blacklist', $mla_debug_category );
217
 
218
  $attr = shortcode_parse_atts( $new_attr );
219
 
220
+ // Remove empty values and still-invalid parameters
 
 
221
  $new_attr = '';
222
  foreach ( $attr as $key => $value ) {
223
  if ( is_numeric( $key ) || empty( $value ) ) {
230
  $attr = $new_attr;
231
  } // not_valid
232
 
233
+ // Look for parameters in an enclosing shortcode
 
 
234
  if ( ! ( empty( $content ) || isset( $attr['mla_alt_shortcode'] ) ) ) {
235
  $content = str_replace( array( '&#038;', '&#8216;', '&#8217;', '&#8221;', '&#8243;', '<br />', '<p>', '</p>', "\r", "\n" ), array( '&', '\'', '\'', '"', '"', ' ', ' ', ' ', ' ', ' ' ), $content );
236
  $new_attr = shortcode_parse_atts( $content );
300
  public static function mla_gallery_shortcode( $attr, $content = NULL ) {
301
  global $post;
302
 
303
+ // Some do_shortcode callers may not have a specific post in mind
 
 
304
  if ( ! is_object( $post ) ) {
305
  $post = (object) self::$empty_post;
306
  }
309
  static $instance = 0;
310
  $instance++;
311
 
312
+ // Some values are already known, and can be used in data selection parameters
 
 
313
  $upload_dir = wp_upload_dir();
314
  $page_values = array(
315
  'instance' => $instance,
340
  */
341
  $attr = self::_validate_attributes( $attr, $content );
342
 
343
+ // Filter the attributes before $mla_page_parameter and "request:" prefix processing.
 
 
 
344
  $attr = apply_filters( 'mla_gallery_raw_attributes', $attr );
345
 
346
  /*
366
  }
367
  }
368
 
369
+ // These are the parameters for gallery display
 
 
370
  $mla_item_specific_arguments = array(
371
  'mla_link_attributes' => '',
372
  'mla_link_class' => '',
380
  'mla_caption' => ''
381
  );
382
 
383
+ // These arguments must not be passed on to alternate gallery shortcodes
 
 
384
  $mla_arguments = array_merge( array(
385
  'mla_output' => 'gallery',
386
  'mla_style' => MLACore::mla_get_option('default_style'),
479
  $attr[ $attr_key ] = MLAData::mla_parse_template( $attr_value, $replacement_values );
480
  }
481
 
482
+ // Merge gallery arguments with defaults, pass the query arguments on to mla_get_shortcode_attachments.
 
 
 
483
  $attr = apply_filters( 'mla_gallery_attributes', $attr );
484
  $content = apply_filters( 'mla_gallery_initial_content', $content, $attr );
485
  $arguments = shortcode_atts( $default_arguments, $attr );
486
  $arguments = apply_filters( 'mla_gallery_arguments', $arguments );
487
 
488
+ // Decide which templates to use
 
 
489
  if ( ( 'none' !== $arguments['mla_style'] ) && ( 'theme' !== $arguments['mla_style'] ) ) {
490
  if ( !MLATemplate_Support::mla_fetch_custom_template( $arguments['mla_style'], 'gallery', 'style', '[exists]' ) ) {
491
  MLACore::mla_debug_add( '<strong>mla_gallery mla_style</strong> "' . $arguments['mla_style'] . '" ' . __( 'not found', 'media-library-assistant' ), MLACore::MLA_DEBUG_CATEGORY_ANY );
498
  $arguments['mla_markup'] = $default_arguments['mla_markup'];
499
  }
500
 
501
+ // Look for "no effect" alternate gallery shortcode to support plugins such as Justified Image Grid
 
 
502
  if ( is_string( $arguments['mla_alt_shortcode'] ) && ( in_array( $arguments['mla_alt_shortcode'], array( 'mla_gallery', 'no' ) ) ) ) {
503
  $arguments['mla_alt_shortcode'] = NULL;
504
  $arguments['mla_alt_ids_name'] = 'ids';
522
  MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug arguments', 'media-library-assistant' ) . '</strong> = ' . var_export( $arguments, true ) );
523
  }
524
 
525
+ // Determine output type
 
 
526
  $output_parameters = array_map( 'strtolower', array_map( 'trim', explode( ',', $arguments['mla_output'] ) ) );
527
  if ( ! in_array( $output_parameters[0], array( 'gallery', 'next_link', 'current_link', 'previous_link', 'next_page', 'previous_page', 'paginate_links' ) ) ) {
528
  $output_parameters[0] = 'gallery';
567
  $output = '';
568
  }
569
 
570
+ if ( ! empty( $arguments['mla_nolink_text'] ) ) {
571
+ $attr_value = str_replace( '{+', '[+', str_replace( '+}', '+]', $arguments['mla_nolink_text'] ) );
572
+ $replacement_values = MLAData::mla_expand_field_level_parameters( $attr_value, $attr, $page_values );
573
+ $output .= MLAData::mla_parse_template( $attr_value, $replacement_values );
574
+ }
575
+
576
  return $output;
577
  } // empty $attachments
578
 
579
+ // Look for Photonic-enhanced gallery; use the [gallery] shortcode if found
 
 
580
  global $photonic;
581
 
582
  if ( is_object( $photonic ) && ! empty( $arguments['style'] ) && empty( $arguments['mla_alt_shortcode'] ) ) {
591
  $arguments['mla_alt_shortcode'] = 'gallery';
592
  }
593
 
594
+ // Look for user-specified alternate gallery shortcode
 
 
595
  if ( is_string( $arguments['mla_alt_shortcode'] ) ) {
596
+ // Replace data-selection parameters with the "ids" list
 
 
597
  $blacklist = array_merge( self::$mla_get_shortcode_attachments_parameters, self::$mla_get_shortcode_dynamic_attachments_parameters );
598
  if ( 'mla_tag_cloud' !== $arguments['mla_alt_shortcode'] ) {
599
  $blacklist = array_merge( $mla_arguments, $blacklist );
642
  $output = '';
643
  }
644
 
645
+ // Execute the alternate gallery shortcode with the new parameters
 
 
646
  $content = apply_filters( 'mla_gallery_final_content', $content );
647
  if ( ! empty( $content ) ) {
648
  $output .= do_shortcode( sprintf( '[%1$s %2$s %3$s]%4$s[/%1$s]', $arguments['mla_alt_shortcode'], $mla_alt_shortcode_ids, $mla_alt_shortcode_args, $content ) );
675
  $show_icon = false;
676
  }
677
 
678
+ // Feeds such as RSS, Atom or RDF do not require styled and formatted output
 
 
679
  if ( is_feed() ) {
680
  $output = "\n";
681
  foreach ( $attachments as $att_id => $attachment )
683
  return $output;
684
  }
685
 
686
+ // Check for Imagick thumbnail generation arguments
 
 
687
  $mla_viewer_required = false;
688
  if ( 'checked' == MLACore::mla_get_option( 'enable_mla_viewer' ) ) {
689
  if ( ! empty( $arguments['mla_viewer'] ) ) {
708
  }
709
 
710
  if ( $arguments['mla_viewer'] ) {
711
+ // Test for Ghostscript here so debug messages can be recorded
 
 
712
  $ghostscript_path = MLACore::mla_get_option( 'ghostscript_path' );
713
  if ( self::mla_ghostscript_present( $ghostscript_path ) ) {
714
  $arguments['mla_viewer_extensions'] = array_filter( array_map( 'trim', explode( ',', $arguments['mla_viewer_extensions'] ) ) );
804
  }
805
 
806
  if ( ! empty ( $style_template ) ) {
807
+ // Look for 'query' and 'request' substitution parameters
 
 
808
  $style_values = MLAData::mla_expand_field_level_parameters( $style_template, $attr, $style_values );
809
 
810
+ // Clean up the template to resolve width or margin == 'none'
 
 
811
  if ( 'none' == $margin_string ) {
812
  $style_values['margin'] = '0';
813
  $style_template = preg_replace( '/margin:[\s]*\[\+margin\+\][\%]*[\;]*/', '', $style_template );
823
  $gallery_style = MLAData::mla_parse_template( $style_template, $style_values );
824
  $gallery_style = apply_filters( 'mla_gallery_style_parse', $gallery_style, $style_template, $style_values );
825
 
826
+ // Clean up the styles to resolve extra "%" suffixes on width or margin (pre v1.42 values)
 
 
827
  $preg_pattern = array( '/([margin|width]:[^\%]*)\%\%/', '/([margin|width]:.*)auto\%/', '/([margin|width]:.*)inherit\%/' );
828
  $preg_replacement = array( '${1}%', '${1}auto', '${1}inherit', );
829
  $gallery_style = preg_replace( $preg_pattern, $preg_replacement, $gallery_style );
837
  $open_template = '';
838
  }
839
 
840
+ // Emulate [gallery] handling of row open markup for the default template only
 
 
841
  if ( $html5 && ( 'default' == $markup_values['mla_markup'] ) ) {
842
  $row_open_template = '';
843
  } else{
853
  $item_template = '';
854
  }
855
 
856
+ // Emulate [gallery] handling of row close markup for the default template only
 
 
857
  if ( $html5 && ( 'default' == $markup_values['mla_markup'] ) ) {
858
  $row_close_template = '';
859
  } else{
869
  $close_template = '';
870
  }
871
 
872
+ // Look for gallery-level markup substitution parameters
 
 
873
  $new_text = $open_template . $row_open_template . $row_close_template . $close_template;
874
  $markup_values = MLAData::mla_expand_field_level_parameters( $new_text, $attr, $markup_values );
875
 
879
  $mla_alt_ids_output = $output = '';
880
  }
881
 
882
+ // These $markup_values are used for both pagination and gallery output
 
 
883
  $markup_values = apply_filters( 'mla_gallery_open_values', $markup_values );
884
 
885
  if ( $is_gallery ) {
893
  $gallery_open = apply_filters( 'mla_gallery_open_parse', $gallery_open, $open_template, $markup_values );
894
  $output .= apply_filters( 'mla_gallery_style', $gallery_style . $gallery_open, $style_values, $markup_values, $style_template, $open_template );
895
  } else {
896
+ // Handle 'previous_page', 'next_page', and 'paginate_links'
 
 
897
  $pagination_result = self::_process_pagination_output_types( $output_parameters, $markup_values, $arguments, $attr, $found_rows, $output );
898
  if ( false !== $pagination_result ) {
899
  return $pagination_result;
1858
  }
1859
  }
1860
 
1861
+ // Process the pagination parameter, if present
 
 
1862
  if ( isset( $arguments[ $mla_page_parameter ] ) ) {
1863
  $arguments['offset'] = $arguments['limit'] * ( $arguments[ $mla_page_parameter ] - 1);
1864
  }
1865
 
1866
+ // Clean up the current_item to separate term_id from slug
 
 
1867
  if ( ! empty( $arguments['current_item'] ) && ctype_digit( $arguments['current_item'] ) ) {
1868
  $arguments['current_item'] = absint( $arguments['current_item'] );
1869
  }
1887
  MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug arguments', 'media-library-assistant' ) . '</strong> = ' . var_export( $arguments, true ) );
1888
  }
1889
 
1890
+ // Determine templates and output type
 
 
1891
  if ( $arguments['mla_style'] && ( 'none' !== $arguments['mla_style'] ) ) {
1892
  if ( !MLATemplate_Support::mla_fetch_custom_template( $arguments['mla_style'], 'tag-cloud', 'style', '[exists]' ) ) {
1893
  MLACore::mla_debug_add( '<strong>mla_tag_cloud mla_style</strong> "' . $arguments['mla_style'] . '" ' . __( 'not found', 'media-library-assistant' ), MLACore::MLA_DEBUG_CATEGORY_ANY );
2416
  $item_values['current_item_class'] = $arguments['current_item_class'];
2417
  }
2418
  } else {
2419
+ // if ( $arguments['current_item'] == $tag->slug ) {
2420
+ if ( $tag->slug == sanitize_title_for_query( $arguments['current_item'] ) ) {
2421
  $item_values['current_item_class'] = $arguments['current_item_class'];
2422
  }
2423
  }
2424
  }
2425
 
2426
+ // Add item_specific field-level substitution parameters
 
 
2427
  $new_text = isset( $item_template ) ? $item_template : '';
2428
  foreach( $mla_item_specific_arguments as $index => $value ) {
2429
  $new_text .= str_replace( '{+', '[+', str_replace( '+}', '+]', $arguments[ $index ] ) );
2440
  $item_values['caption'] = '';
2441
  }
2442
 
2443
+ // Apply the Display Content parameters.
 
 
2444
  if ( ! empty( $arguments['mla_target'] ) ) {
2445
  $link_attributes = 'target="' . $arguments['mla_target'] . '" ';
2446
  } else {
2791
  }
2792
 
2793
  if ( $current_is_slug || !( ctype_digit( $current_item ) || is_int( $current_item ) ) ) {
2794
+ // if ( $current_item == $term->slug ) {
2795
+ if ( $term->slug == sanitize_title_for_query( $current_item ) ) {
2796
  $is_active = true;
2797
  $item_values['current_item_class'] = $arguments['current_item_class'];
2798
  break;
3129
  $arguments[ $mla_item_parameter ] = $attr[ $mla_item_parameter ];
3130
  } else {
3131
  $arguments[ $mla_item_parameter ] = $defaults['current_item'];
 
3132
  }
3133
  }
3134
 
3806
 
3807
  $new_target = ( ! empty( $arguments['mla_target'] ) ) ? 'target="' . $arguments['mla_target'] . '" ' : '';
3808
 
3809
+ // these will add to the default classes
 
 
3810
  $new_class = ( ! empty( $arguments['mla_link_class'] ) ) ? ' ' . esc_attr( self::_process_shortcode_parameter( $arguments['mla_link_class'], $markup_values ) ) : '';
3811
 
3812
  $new_attributes = ( ! empty( $arguments['mla_link_attributes'] ) ) ? esc_attr( self::_process_shortcode_parameter( $arguments['mla_link_attributes'], $markup_values ) ) . ' ' : '';
3813
 
3814
  $new_base = ( ! empty( $arguments['mla_link_href'] ) ) ? self::_process_shortcode_parameter( $arguments['mla_link_href'], $markup_values ) : $markup_values['new_url'];
3815
 
3816
+ // Build the array of page links
 
 
3817
  $page_links = array();
3818
  $dots = false;
3819
 
4391
  public static function mla_get_shortcode_attachments( $post_parent, $attr, $return_found_rows = NULL ) {
4392
  global $wp_query;
4393
 
4394
+ // Parameters passed to the join, where and orderby filter functions
4395
+ self::$query_parameters = array( MLAQuery::MLA_ALT_TEXT_SUBQUERY => false, MLAQuery::MLA_FILE_SUBQUERY => false, );
4396
 
4397
  // Parameters passed to the posts_search filter function in MLAData
4398
  MLAQuery::$search_parameters = array( 'debug' => 'none' );
4470
  $arguments = apply_filters( 'mla_gallery_query_arguments', $arguments );
4471
  }
4472
 
4473
+ // Extract taxonomy arguments
 
 
4474
  self::$mla_get_shortcode_dynamic_attachments_parameters = array();
4475
  $query_arguments = array();
4476
  $no_terms_assigned_query = false;
5152
  MLAQuery::$search_parameters['mla_search_fields'] = array( 'title', 'content' );
5153
  } else {
5154
  MLAQuery::$search_parameters['mla_search_fields'] = array_filter( array_map( 'trim', explode( ',', MLAQuery::$search_parameters['mla_search_fields'] ) ) );
5155
+ MLAQuery::$search_parameters['mla_search_fields'] = array_intersect( array( 'title', 'name', 'excerpt', 'content', 'alt-text', 'file', 'terms' ), MLAQuery::$search_parameters['mla_search_fields'] );
5156
 
5157
+ if ( in_array( 'alt-text', MLAQuery::$search_parameters['mla_search_fields'] ) ) {
5158
+ self::$query_parameters[MLAQuery::MLA_ALT_TEXT_SUBQUERY] = true;
5159
+ }
5160
+
5161
+ if ( in_array( 'file', MLAQuery::$search_parameters['mla_search_fields'] ) ) {
5162
+ self::$query_parameters[MLAQuery::MLA_FILE_SUBQUERY] = true;
5163
+ }
5164
+
5165
+ // Look for keyword search including 'terms'
5166
  foreach ( MLAQuery::$search_parameters['mla_search_fields'] as $index => $field ) {
5167
  if ( 'terms' == $field ) {
5168
  if ( isset( MLAQuery::$search_parameters['mla_terms_search']['phrases'] ) ) {
5197
  }
5198
 
5199
  if ( self::$mla_debug ) {
5200
+ MLACore::mla_debug_add( '<strong>mla_debug $wp_filter[posts_where]</strong> = ' . MLACore::mla_decode_wp_filter('posts_where') );
5201
+ MLACore::mla_debug_add( '<strong>mla_debug $wp_filter[posts_orderby]</strong> = ' . MLACore::mla_decode_wp_filter('posts_orderby') );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5202
  }
5203
 
5204
  /*
5282
  public static function mla_shortcode_query_posts_join_filter( $join_clause ) {
5283
  global $wpdb;
5284
 
5285
+ if ( self::$mla_debug ) {
5286
+ $old_clause = $join_clause;
5287
+ MLACore::mla_debug_add( '<strong>' . __( 'mla_debug JOIN filter', 'media-library-assistant' ) . '</strong> = ' . var_export( $join_clause, true ) );
5288
+ }
5289
+
5290
  /*
5291
  * Set for taxonomy queries unless post_parent=current. If true, we must disable
5292
  * the LEFT JOIN clause that get_posts() adds to taxonomy queries.
5296
  $join_clause = str_replace( " LEFT JOIN {$wpdb->posts} AS p2 ON ({$wpdb->posts}.post_parent = p2.ID) ", " LEFT JOIN {$wpdb->posts} AS p2 ON (p2.ID = p2.ID) ", $join_clause );
5297
  }
5298
 
5299
+ // These joins support the 'terms' search_field
 
 
5300
  if ( isset( MLAQuery::$search_parameters['tax_terms_count'] ) ) {
5301
  $tax_index = 0;
5302
  $tax_clause = '';
5309
  $join_clause .= $tax_clause;
5310
  }
5311
 
5312
+ /*
5313
+ * ALT Text and File Name searches use a subquery to build an intermediate table and
5314
+ * modify the JOIN to include posts with no value for the metadata field.
5315
+ */
5316
+ if ( self::$query_parameters[MLAQuery::MLA_ALT_TEXT_SUBQUERY] ) {
5317
+ $sub_query = sprintf( 'SELECT post_id, meta_value FROM %1$s WHERE %1$s.meta_key = \'%2$s\'', $wpdb->postmeta, '_wp_attachment_image_alt' );
5318
+ $join_clause .= sprintf( ' LEFT JOIN ( %1$s ) %2$s ON (%3$s.ID = %2$s.post_id)', $sub_query, MLAQuery::MLA_ALT_TEXT_SUBQUERY, $wpdb->posts );
5319
+ }
5320
+
5321
+ if ( self::$query_parameters[MLAQuery::MLA_FILE_SUBQUERY] ) {
5322
+ $sub_query = sprintf( 'SELECT post_id, meta_value FROM %1$s WHERE %1$s.meta_key = \'%2$s\'', $wpdb->postmeta, '_wp_attached_file' );
5323
+ $join_clause .= sprintf( ' LEFT JOIN ( %1$s ) %2$s ON (%3$s.ID = %2$s.post_id)', $sub_query, MLAQuery::MLA_FILE_SUBQUERY, $wpdb->posts );
5324
+ }
5325
+
5326
+ if ( self::$mla_debug && ( $old_clause != $join_clause ) ) {
5327
+ MLACore::mla_debug_add( '<strong>' . __( 'mla_debug modified JOIN filter', 'media-library-assistant' ) . '</strong> = ' . var_export( $join_clause, true ) );
5328
+ }
5329
 
5330
  return $join_clause;
5331
  }
includes/mla-plugin-loader.php CHANGED
@@ -95,6 +95,10 @@ if ( ! empty( $mla_plugin_loader_error_messages ) ) {
95
 
96
  if( defined('DOING_AJAX') && DOING_AJAX ) {
97
  //error_log( __LINE__ . " mla-plugin-loader.php DOING_AJAX \$_REQUEST = " . var_export( $_REQUEST, true ), 0 );
 
 
 
 
98
 
99
  // Ajax handlers
100
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-ajax.php' );
@@ -141,9 +145,7 @@ if ( ! empty( $mla_plugin_loader_error_messages ) ) {
141
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-data-query.php' );
142
  add_action( 'init', 'MLAQuery::initialize', 0x7FFFFFFF );
143
 
144
- /*
145
- * Other plugins such as "No Cache AJAX Widgets" might need shortcodes
146
- */
147
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-shortcodes.php' );
148
  add_action( 'init', 'MLAShortcodes::initialize', 0x7FFFFFFF );
149
 
@@ -151,50 +153,36 @@ if ( ! empty( $mla_plugin_loader_error_messages ) ) {
151
  }
152
  }
153
 
154
- /*
155
- * Template file and database access functions.
156
- */
157
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-data-query.php' );
158
  add_action( 'init', 'MLAQuery::initialize', 0x7FFFFFFF );
159
 
160
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-data.php' );
161
  add_action( 'init', 'MLAData::initialize', 0x7FFFFFFF );
162
 
163
- /*
164
- * Shortcode shim functions
165
- */
166
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-shortcodes.php' );
167
  add_action( 'init', 'MLAShortcodes::initialize', 0x7FFFFFFF );
168
 
169
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-shortcode-support.php' );
170
 
171
- /*
172
- * Plugin settings management
173
- */
174
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-options.php' );
175
  add_action( 'init', 'MLAOptions::initialize', 0x7FFFFFFF );
176
 
177
- /*
178
- * Plugin settings management page
179
- */
180
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-settings.php' );
181
  add_action( 'init', 'MLASettings::initialize', 0x7FFFFFFF );
182
 
183
- /*
184
- * Main program
185
- */
186
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-main.php' );
187
  add_action( 'init', 'MLA::initialize', 0x7FFFFFFF );
188
 
189
- /*
190
- * Edit Media screen additions, e.g., meta boxes
191
- */
192
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-edit-media.php' );
193
  add_action( 'init', 'MLAEdit::initialize', 0x7FFFFFFF );
194
 
195
- /*
196
- * Media Manager (Modal window) additions
197
- */
198
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-media-modal.php' );
199
  add_action( 'init', 'MLAModal::initialize', 0x7FFFFFFF );
200
 
95
 
96
  if( defined('DOING_AJAX') && DOING_AJAX ) {
97
  //error_log( __LINE__ . " mla-plugin-loader.php DOING_AJAX \$_REQUEST = " . var_export( $_REQUEST, true ), 0 );
98
+ //error_log( __LINE__ . ' MEMORY mla-plugin-loader.php memory_get_peak_usage( true ) ' . number_format( memory_get_peak_usage( true ) ), 0);
99
+ //error_log( __LINE__ . ' MEMORY mla-plugin-loader.php memory_get_peak_usage( false ) ' . number_format( memory_get_peak_usage( false ) ), 0);
100
+ //error_log( __LINE__ . ' MEMORY mla-plugin-loader.php memory_get_usage( true ) ' . number_format( memory_get_usage( true ) ), 0);
101
+ //error_log( __LINE__ . ' MEMORY mla-plugin-loader.php memory_get_usage( false ) ' . number_format( memory_get_usage( false ) ), 0);
102
 
103
  // Ajax handlers
104
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-ajax.php' );
145
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-data-query.php' );
146
  add_action( 'init', 'MLAQuery::initialize', 0x7FFFFFFF );
147
 
148
+ // Other plugins such as "No Cache AJAX Widgets" might need shortcodes
 
 
149
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-shortcodes.php' );
150
  add_action( 'init', 'MLAShortcodes::initialize', 0x7FFFFFFF );
151
 
153
  }
154
  }
155
 
156
+ // Template file and database access functions.
 
 
157
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-data-query.php' );
158
  add_action( 'init', 'MLAQuery::initialize', 0x7FFFFFFF );
159
 
160
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-data.php' );
161
  add_action( 'init', 'MLAData::initialize', 0x7FFFFFFF );
162
 
163
+ // Shortcode shim functions
 
 
164
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-shortcodes.php' );
165
  add_action( 'init', 'MLAShortcodes::initialize', 0x7FFFFFFF );
166
 
167
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-shortcode-support.php' );
168
 
169
+ // Plugin settings management
 
 
170
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-options.php' );
171
  add_action( 'init', 'MLAOptions::initialize', 0x7FFFFFFF );
172
 
173
+ // Plugin settings management page
 
 
174
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-settings.php' );
175
  add_action( 'init', 'MLASettings::initialize', 0x7FFFFFFF );
176
 
177
+ // Main program
 
 
178
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-main.php' );
179
  add_action( 'init', 'MLA::initialize', 0x7FFFFFFF );
180
 
181
+ // Edit Media screen additions, e.g., meta boxes
 
 
182
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-edit-media.php' );
183
  add_action( 'init', 'MLAEdit::initialize', 0x7FFFFFFF );
184
 
185
+ // Media Manager (Modal window) additions
 
 
186
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-media-modal.php' );
187
  add_action( 'init', 'MLAModal::initialize', 0x7FFFFFFF );
188
 
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.73
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.73
20
  Author URI: http://fairtradejudaica.org/our-story/staff/
21
 
22
  Copyright 2011-2018 David Lingren
6
  * will the rest of the plugin be loaded and run.
7
  *
8
  * @package Media Library Assistant
9
+ * @version 2.74
10
  */
11
 
12
  /*
16
  Author: David Lingren, Fair Trade Judaica
17
  Text Domain: media-library-assistant
18
  Domain Path: /languages
19
+ Version: 2.74
20
  Author URI: http://fairtradejudaica.org/our-story/staff/
21
 
22
  Copyright 2011-2018 David Lingren
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: dglingren
3
  Donate link: http://fairtradejudaica.org/media-library-assistant-a-wordpress-plugin/
4
  Tags: attachments, gallery, images, media, media library, tags, categories, IPTC, EXIF, XMP, GPS, PDF, metadata, photos, photographs, photo albums, MIME, mime-type, icon, upload, file extensions, WPML, Polylang
5
  Requires at least: 3.5.0
6
- Tested up to: 4.9.5
7
  Requires PHP: 5.3
8
- Stable tag: 2.73
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -183,52 +183,21 @@ All of the MLA source code has been annotated with "DocBlocks", a special type o
183
 
184
  == Changelog ==
185
 
186
- = 2.73 =
187
- * New: The (optional) "checklist-style" formatting of flat taxonomies has been extended to the Media/Assistant Quick Edit and Bulk Edit areas.
188
- * New: The (optional) "checked-on-top" formatting of checklist taxonomies has been extended to the Media/Assistant Quick Edit and Bulk Edit areas.
189
- * New: A new "MLA Parent Search Example" plugin has been added. It adds a `parent:` prefix to the Media/Assistant Search Media text box that allows searches for items whose parent post/page matches the specified values.
190
- * New: A new "MLA JavaScript Example" plugin has been added. It shows a simple method of adding and localizing scripts, using the WP Featherlight lightbox plugin as a sample application.
191
- * New: For the `[mla_gallery]` shortcode, the `post_type` and `post_status` parameters now accept multiple values.
192
- * Fix: For the Media/Assistant admin submenu, the correct SERVER_URI value is now generated for multisite and "subdirectory" WordPress installs.
193
- * Fix: For "checklist style" flat taxonomy metaboxes, terms with quote marks in the name are now handled properly.
194
- * Fix: For the `[mla_tag_cloud]` shortcode, the "Tag Cloud Pagination Parameters" have been restored.
195
- * Fix: Restore Admin Columns Pro "default column" support for columns such as EXIF values.
196
-
197
- = 2.72 =
198
- * Fix: Remove "Circular Reference" PHP Warnings in class-mla-mime-types.php.
199
-
200
- = 2.71 =
201
- * New: For Admin Columns Pro v4.2.3+, **Media/Assistant submenu table now supports CSV Export**.
202
- * New: Powerful **regular expression match/replace functions** are now available within MLA shortcodes, custom markup templates, mapping rules and the Bulk Edit area. Of course, they can be used within Content Templates in any of these areas as well.
203
- * New: You can replace the "Uploaded on" date in the Media/Assistant Bulk Edit area, and you can define a mapping rule for the date in the Settings/Media Library Assistant IPTC/EXIF tab. Both of these support Content Templates, so you can compose values from a variety of sources.
204
- * New: You can edit/change the "Uploaded on" date on the Media/Edit Media screen and in the Media/Assistant Quick Edit area.
205
- * New: The "MLA Insert Fixit" example plugin has a new "Parent Terms to item" tool that will copy terms assigned to a parent post/page to the items attached to the parent. You can select the source and target taxonomies for the tool.
206
- * New: The "MLA Insert Fixit" example plugin has a new "Attach Referenced In" tool that attaches items to the first post/page where they appear in a "class-wp-image-" or "ids=" element.
207
- * New: The "MLA Insert Fixit" example plugin is enhanced so the "Attach Media Library items" tools will (optionally) replace existing parent assignments. You can also specify the oldest or the most recent post/page to become the parent.
208
- * New: A new "MLA Uploaded on Example" plugin reformats Media/Assistant column display for Uploaded on and Modified dates.
209
- * New: For the Media/Assistant Bulk Edit function, an offset can be added to the `[+index+]` data source. For example, `[+index,99+]` will give a starting value of 100.
210
- * New: The Media/Assistant Bulk Edit and Quick Edit functions are now compatible with the "Media File Renamer" plugin, by Jordy Meow.
211
- * New: You can change the Media/Assistant "Entries per page" value on the Settings/Media LIbrary Assistant General tab. This gives a recovery method when the setting is too high to successfully load the Media/Assistant submenu table.
212
- * New: A new "MLA Path Mapping Example" plugin adds hierarchical path specification support to the IPTC/EXIF taxonomy mapping rules.
213
- * New: A new Debug logging category has been created for Views and Uploads MIME Type processing.
214
- * Fix: When WPML is active, handling of the "current language" on the Media/Assistant admin submenu has been improved.
215
- * Fix: NONCE URL handling for WP 3.5.x has been restored, e.g., for the Settings/Media Library Assistant Documentation tab's "Example Plugins" link.
216
- * Fix: PHP `stripslashes` is now applied to new IPTC/EXIF and Custom Field rule templates so special characters like backslash are handled correctly.
217
- * Fix: The PHP error log can once again be downloaded from the Settings/Media Library Assistant Debug tab.
218
- * Fix: A file extension problem (jpe Vs jpg) has been fixed for PDF thumbnail generation using older versions of ImageMagick.
219
- * Fix: PDF Thumbnail files generated by MLA are now placed in the correct directory, i.e., tha same directory as the original PDF document.
220
- * Fix: For `[mla_gallery]`, processing file names with special characters such as quotes no longer creates PHP Warning messages.
221
-
222
- = 2.70 =
223
- * New: A new Debug logging category has been created for "where-used" reporting.
224
- * New: The Att. Categories and Att. Tags taxonomies can now be displayed a columns on the Media/Library list mode admin submenu.
225
- * Fix: File downloads originating from a Bulk Action are now restricted to the site's uploads directory tree.
226
- * Fix: The "MLA Download ZIP Example" plugin has been updated to work with the current MLA version.
227
- * Fix: References to the FTJ Donate page now go to the plugin description page.
228
- * Fix: References to the WordPress `get_terms()` function have been updated to accomodate changes made in WP 4.5.0.
229
- * Fix: When Polylang is active, term assignment for "untranslated" taxonomies is no longer restricted to the default language.
230
- * Fix: On the Settings/Media Library Assistant Debug tab, the "Save Changes" button has been moved up for easier access when changing option settings.
231
- * Fix: For the Media/Edit Media admin submenu, duplicate database queries for the "Months" dropdown control have been eliminated.
232
 
233
  = 2.60 - 2.65 =
234
  * 2.65 - Corrects an "ajax.fail error" in the Media/Assistant "Set Parent" function and the Media/Edit Media screen. One other enhancement, two other fixes.
@@ -321,8 +290,8 @@ All of the MLA source code has been annotated with "DocBlocks", a special type o
321
 
322
  == Upgrade Notice ==
323
 
324
- = 2.73 =
325
- Checklist-style flat taxonomy improvements, Admin Columns Pro fix, new and improved example plugins, e.g., "parent search". Five enhancements, four fixes.
326
 
327
  == Other Notes ==
328
 
3
  Donate link: http://fairtradejudaica.org/media-library-assistant-a-wordpress-plugin/
4
  Tags: attachments, gallery, images, media, media library, tags, categories, IPTC, EXIF, XMP, GPS, PDF, metadata, photos, photographs, photo albums, MIME, mime-type, icon, upload, file extensions, WPML, Polylang
5
  Requires at least: 3.5.0
6
+ Tested up to: 4.9.6
7
  Requires PHP: 5.3
8
+ Stable tag: 2.74
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
183
 
184
  == Changelog ==
185
 
186
+ = 2.74 =
187
+ * New: The "MLA Substitution Parameter Hooks Example" plugin has been enhanced with a `current_term:` prefix that returns values from the term(s) present in the `$_REQUEST` variables.
188
+ * Fix: Cross-Site Scripting vulnerabilities have been removed from the Media/Assistant and Settings/Media Library assistant admin submenu screens.
189
+ * Fix: For `[mla_gallery]`, support for mla_search_fields=alt-text has been added.
190
+ * Fix: For `[mla_gallery]`, support for mla_search_fields=file has been fixed.
191
+ * Fix: The Settings/Media Library Assistant Documentation/Example Plugins "Download" rollover action has been restored.
192
+ * Fix: For `[mla_term_list]` and `[mla_tag_cloud]`, current_item values can contain accented and special characters, e.g., Cryllic script.
193
+ * Fix: For `[mla_gallery]`, substitution parameters are supported in the `mla_nolink_text` parameter.
194
+ * Fix: Improved debug logging of `$wp_filter` content, avoiding circular references.
195
+
196
+ = 2.70 - 2.73 =
197
+ * 2.73 - Checklist-style flat taxonomy improvements, Admin Columns Pro fix, new and improved example plugins, e.g., "parent search". Five enhancements, four fixes.
198
+ * 2.72 - Remove "Circular Reference" PHP Warnings in class-mla-mime-types.php.
199
+ * 2.71 - Admin Columns Pro CSV Export support, Uploaded on date editing, regular expression match/replace functions in shortcodes, new and improved example plugins. Thirteen enhancements, seven fixes.
200
+ * 2.70 - Improved file download security, Polylang fixes. Two enhancements, seven fixes.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
 
202
  = 2.60 - 2.65 =
203
  * 2.65 - Corrects an "ajax.fail error" in the Media/Assistant "Set Parent" function and the Media/Edit Media screen. One other enhancement, two other fixes.
290
 
291
  == Upgrade Notice ==
292
 
293
+ = 2.74 =
294
+ Cross-Site Scripting vulnerabilities have been removed from the Media/Assistant and Settings/Media Library assistant admin submenu screens. One enhancement, seven fixes.
295
 
296
  == Other Notes ==
297
 
tpls/documentation-settings-tab.tpl CHANGED
@@ -1132,7 +1132,7 @@ You can use the <code>mla_search_connector</code> and <code>mla_search_fields</c
1132
  </tr>
1133
  <tr>
1134
  <td class="mla-doc-table-label">mla_search_fields</td>
1135
- <td>The fields in which to search. Choose from title, name, excerpt, content, file, terms. Searching on alt-text is not supported.</td>
1136
  </tr>
1137
  <tr>
1138
  <td class="mla-doc-table-label">mla_terms_taxonomies</td>
@@ -4201,9 +4201,9 @@ There are fourteen prefix values for field-level parameters. Prefix values must
4201
  <br />&nbsp;<br />
4202
  You can change the term field by adding the field name in parentheses after the taxonomy name. For example, <code>[+terms:attachment_category(slug)+]</code> or <code>[+terms:attachment_category(term_id)+]</code>.
4203
  <br />&nbsp;<br />
4204
- You can access fields from a specific term, independent of terms assigned to an item, with a compound name. Append the term slug to the taxonomy slug separated by a period ("."), e.g. <code>[+terms:attachment_category.my-term(slug)+]</code>. You can also pass a term slug to the parameter from the <code>request:</code> or <code>query:</code> arguments. For example, if your shortcode is something like <code>[mla_gallery attachment_category=my-term]</code> you can access the query value as <code>[+terms:attachment_category.[\+query:attachment_category+\](name)+}(slug)+]</code> in a custom markup template. The backslash ("\") characters are required to prevent parsing confusion when a substitution parameter is embedded in another substitution parameter.
4205
  <br />&nbsp;<br />
4206
- You can use this form in a shortcode parameter such as <code>mla_caption</code> by coding <code>[mla_gallery attachment_category=my-term mla_caption="{+terms:attachment_category.{\\+query:attachment_category+\\}(name)+}(slug)+}" ]</code>. The extra backslash characters are required to pass the parameter through the WordPress shortcode parameter parsing process.
4207
  </td>
4208
  </tr>
4209
  <tr>
1132
  </tr>
1133
  <tr>
1134
  <td class="mla-doc-table-label">mla_search_fields</td>
1135
+ <td>The fields in which to search. Choose from title, name, excerpt, content, alt-text, file, terms.</td>
1136
  </tr>
1137
  <tr>
1138
  <td class="mla-doc-table-label">mla_terms_taxonomies</td>
4201
  <br />&nbsp;<br />
4202
  You can change the term field by adding the field name in parentheses after the taxonomy name. For example, <code>[+terms:attachment_category(slug)+]</code> or <code>[+terms:attachment_category(term_id)+]</code>.
4203
  <br />&nbsp;<br />
4204
+ You can access fields from a specific term, independent of terms assigned to an item, with a compound name. Append the term slug to the taxonomy slug separated by a period ("."), e.g. <code>[+terms:attachment_category.my-term(term_id)+]</code>. <span style="display:none">You can also pass a term slug to the parameter from the <code>request:</code> or <code>query:</code> arguments. For example, if your shortcode is something like <code>[mla_gallery attachment_category=my-term]</code> you can access the query value as <code>[+terms:attachment_category.[\+query:attachment_category+\](name)+}(slug)+]</code> in a custom markup template. The backslash ("\") characters are required to prevent parsing confusion when a substitution parameter is embedded in another substitution parameter.
4205
  <br />&nbsp;<br />
4206
+ You can use this form in a shortcode parameter such as <code>mla_caption</code> by coding <code>[mla_gallery attachment_category=my-term mla_caption="{+terms:attachment_category.{\\+query:attachment_category+\\}(name)+}(slug)+}" ]</code>. The extra backslash characters are required to pass the parameter through the WordPress shortcode parameter parsing process.</span>
4207
  </td>
4208
  </tr>
4209
  <tr>