Media Library Assistant - Version 2.12

Version Description

  • New: For [mla_gallery] and [mla_tag_cloud], the mla_debug=log parameter writes debug information to the error log instead of the page or post containing the shortcode.
  • New: On the Settings/Media Library Assistant Debug tab, a new option lets you limit the amount of error log content displayed in the text area.
  • Fix: For [mla_gallery], a defect in the default template's caption processing (using the "captiontag_content" attachment-specific substitution parameter) has been corrected. The defect caused improper handling of the mla_caption parameter in some cases.
Download this release

Release Info

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

Code changes from version 2.11 to 2.12

examples/mla-custom-field-search-example.php.txt CHANGED
@@ -3,7 +3,7 @@
3
  * Extends the Media/Assistant "Search Media" box to custom field values
4
  *
5
  * @package MLA Custom Field Search Example
6
- * @version 1.02
7
  */
8
 
9
  /*
@@ -11,7 +11,7 @@ Plugin Name: MLA Custom Field Search Example
11
  Plugin URI: http://fairtradejudaica.org/media-library-assistant-a-wordpress-plugin/
12
  Description: Extends the Media/Assistant "Search Media" box to custom field values
13
  Author: David Lingren
14
- Version: 1.02
15
  Author URI: http://fairtradejudaica.org/our-story/staff/
16
 
17
  Copyright 2014 - 2015 David Lingren
@@ -97,12 +97,14 @@ class MLACustomFieldSearchExample {
97
  unset( $_REQUEST['mla_search_connector'] );
98
  self::$custom_field_parameters['mla_search_fields'] = $_REQUEST['mla_search_fields'];
99
  unset( $_REQUEST['mla_search_fields'] );
100
- } // custom: prefix
 
 
101
  } // isset s=custom:
102
 
103
  return $mla_list_table;
104
  } // mla_list_table_new_instance
105
-
106
  /**
107
  * Custom Field Search "parameters"
108
  *
@@ -146,7 +148,7 @@ class MLACustomFieldSearchExample {
146
 
147
  // Apply default field name?
148
  if ( '=' == substr( self::$custom_field_parameters['s'], 0, 1 ) ) {
149
- $tokens = array( 'File Size', substr( self::$custom_field_parameters['s'], 1 ) );
150
  } else {
151
  $tokens = explode( '=', self::$custom_field_parameters['s'] ) ;
152
  }
@@ -157,7 +159,7 @@ class MLACustomFieldSearchExample {
157
  $value = implode( '=', $tokens );
158
  } else {
159
  // Supply a default custom field name
160
- $field = 'File Size';
161
  $value = $tokens[0];
162
  }
163
 
3
  * Extends the Media/Assistant "Search Media" box to custom field values
4
  *
5
  * @package MLA Custom Field Search Example
6
+ * @version 1.03
7
  */
8
 
9
  /*
11
  Plugin URI: http://fairtradejudaica.org/media-library-assistant-a-wordpress-plugin/
12
  Description: Extends the Media/Assistant "Search Media" box to custom field values
13
  Author: David Lingren
14
+ Version: 1.03
15
  Author URI: http://fairtradejudaica.org/our-story/staff/
16
 
17
  Copyright 2014 - 2015 David Lingren
97
  unset( $_REQUEST['mla_search_connector'] );
98
  self::$custom_field_parameters['mla_search_fields'] = $_REQUEST['mla_search_fields'];
99
  unset( $_REQUEST['mla_search_fields'] );
100
+ } else {
101
+ self::$custom_field_parameters = array();
102
+ }
103
  } // isset s=custom:
104
 
105
  return $mla_list_table;
106
  } // mla_list_table_new_instance
107
+
108
  /**
109
  * Custom Field Search "parameters"
110
  *
148
 
149
  // Apply default field name?
150
  if ( '=' == substr( self::$custom_field_parameters['s'], 0, 1 ) ) {
151
+ $tokens = array( 'Orientation', substr( self::$custom_field_parameters['s'], 1 ) );
152
  } else {
153
  $tokens = explode( '=', self::$custom_field_parameters['s'] ) ;
154
  }
159
  $value = implode( '=', $tokens );
160
  } else {
161
  // Supply a default custom field name
162
+ $field = 'Orientation';
163
  $value = $tokens[0];
164
  }
165
 
includes/class-mla-data.php CHANGED
@@ -1515,7 +1515,6 @@ class MLAData {
1515
  * ['sentence'] => entire string must match as one "keyword"
1516
  * ['exact'] => entire string must match entire field value
1517
  * ['debug'] => internal element, console/log/shortcode/none
1518
- * ['mla_debug_messages'] => internal element, added when debug = 'shortcode'
1519
  * ['tax_terms_count'] => internal element, shared with JOIN and GROUP BY filters
1520
  *
1521
  * @since 2.00
@@ -1760,6 +1759,7 @@ class MLAData {
1760
  if ( isset( $clean_request['debug'] ) ) {
1761
  self::$query_parameters['debug'] = $clean_request['debug'];
1762
  self::$search_parameters['debug'] = $clean_request['debug'];
 
1763
  unset( $clean_request['debug'] );
1764
  }
1765
 
@@ -1982,13 +1982,8 @@ class MLAData {
1982
  global $wp_filter;
1983
  $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'] );
1984
 
1985
- if ( 'console' == self::$query_parameters['debug'] ) {
1986
- /* translators: 1: DEBUG tag 2: query filter details */
1987
- trigger_error( sprintf( __( '%1$s: _execute_list_table_query $wp_filter = "%2$s".', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ), E_USER_WARNING );
1988
- } else {
1989
- /* translators: 1: DEBUG tag 2: query filter details */
1990
- error_log( 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 ) ), 0 );
1991
- }
1992
 
1993
  add_filter( 'posts_clauses', 'MLAData::mla_query_posts_clauses_filter', 0x7FFFFFFF, 1 );
1994
  add_filter( 'posts_clauses_request', 'MLAData::mla_query_posts_clauses_request_filter', 0x7FFFFFFF, 1 );
@@ -2002,17 +1997,10 @@ class MLAData {
2002
 
2003
  $debug_array = array( 'request' => $request, 'query_parameters' => self::$query_parameters, 'post_count' => $results->post_count, 'found_posts' => $results->found_posts );
2004
 
2005
- if ( 'console' == self::$query_parameters['debug'] ) {
2006
- /* translators: 1: DEBUG tag 2: query details */
2007
- trigger_error( sprintf( __( '%1$s: _execute_list_table_query WP_Query = "%2$s".', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ), E_USER_WARNING );
2008
- /* translators: 1: DEBUG tag 2: SQL statement */
2009
- trigger_error( sprintf( __( '%1$s: _execute_list_table_query SQL_request = "%2$s".', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $results->request, true ) ), E_USER_WARNING );
2010
- } else {
2011
- /* translators: 1: DEBUG tag 2: query details */
2012
- error_log( sprintf( _x( '%1$s: _execute_list_table_query WP_Query = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ), 0 );
2013
- /* translators: 1: DEBUG tag 2: SQL statement */
2014
- error_log( sprintf( _x( '%1$s: _execute_list_table_query SQL_request = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $results->request, true ) ), 0 );
2015
- }
2016
  } // debug
2017
 
2018
  if ( function_exists( 'relevanssi_prevent_default_request' ) ) {
@@ -2381,13 +2369,10 @@ class MLAData {
2381
  $debug_array['search_clause'] = $search_clause;
2382
 
2383
  if ( 'shortcode' == self::$search_parameters['debug'] ) {
2384
- self::$search_parameters['mla_debug_messages'] = '<p><strong>mla_debug posts_search filter</strong> = ' . var_export( $debug_array, true ) . '</p>';
2385
- } elseif ( 'console' == self::$search_parameters['debug'] ) {
2386
- /* translators: 1: DEBUG tag 2: search filter details */
2387
- trigger_error( sprintf( __( '%1$s: mla_query_posts_search_filter = "%2$s".', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ), E_USER_WARNING );
2388
  } else {
2389
  /* translators: 1: DEBUG tag 2: search filter details */
2390
- error_log( sprintf( _x( '%1$s: mla_query_posts_search_filter = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ), 0 );
2391
  }
2392
  } // debug
2393
 
@@ -2457,13 +2442,8 @@ class MLAData {
2457
  if ( isset( self::$query_parameters['debug'] ) ) {
2458
  $debug_array['where_clause'] = $where_clause;
2459
 
2460
- if ( 'console' == self::$query_parameters['debug'] ) {
2461
- /* translators: 1: DEBUG tag 2: where filter details */
2462
- trigger_error( sprintf( __( '%1$s: mla_query_posts_where_filter = "%2$s".', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ), E_USER_WARNING );
2463
- } else {
2464
- /* translators: 1: DEBUG tag 2: where filter details */
2465
- error_log( sprintf( _x( '%1$s: mla_query_posts_where_filter = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ), 0 );
2466
- }
2467
  } // debug
2468
 
2469
  return $where_clause;
@@ -2511,13 +2491,8 @@ class MLAData {
2511
  if ( isset( self::$query_parameters['debug'] ) ) {
2512
  $debug_array['join_clause'] = $join_clause;
2513
 
2514
- if ( 'console' == self::$query_parameters['debug'] ) {
2515
- /* translators: 1: DEBUG tag 2: join filter details */
2516
- trigger_error( sprintf( __( '%1$s: mla_query_posts_join_filter = "%2$s".', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ), E_USER_WARNING );
2517
- } else {
2518
- /* translators: 1: DEBUG tag 2: join filter details */
2519
- error_log( sprintf( _x( '%1$s: mla_query_posts_join_filter = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ), 0 );
2520
- }
2521
  } // debug
2522
 
2523
  return $join_clause;
@@ -2613,13 +2588,8 @@ class MLAData {
2613
  if ( isset( self::$query_parameters['debug'] ) ) {
2614
  $debug_array['orderby_clause'] = $orderby_clause;
2615
 
2616
- if ( 'console' == self::$query_parameters['debug'] ) {
2617
- /* translators: 1: DEBUG tag 2: orderby details details */
2618
- trigger_error( sprintf( __( '%1$s: mla_query_posts_orderby_filter = "%2$s".', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ), E_USER_WARNING );
2619
- } else {
2620
- /* translators: 1: DEBUG tag 2: orderby details details */
2621
- error_log( sprintf( _x( '%1$s: mla_query_posts_orderby_filter = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ), 0 );
2622
- }
2623
  } // debug
2624
 
2625
  return $orderby_clause;
@@ -2652,13 +2622,8 @@ class MLAData {
2652
  * @return array query clauses after modification (none)
2653
  */
2654
  public static function mla_query_posts_clauses_filter( $pieces ) {
2655
- if ( 'console' == self::$query_parameters['debug'] ) {
2656
- /* translators: 1: DEBUG tag 2: SQL clauses */
2657
- trigger_error( sprintf( __( '%1$s: mla_query_posts_clauses_filter = "%2$s".', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $pieces, true ) ), E_USER_WARNING );
2658
- } else {
2659
- /* translators: 1: DEBUG tag 2: SQL clauses */
2660
- error_log( sprintf( _x( '%1$s: mla_query_posts_clauses_filter = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $pieces, true ) ), 0 );
2661
- }
2662
 
2663
  return $pieces;
2664
  }
@@ -2676,13 +2641,8 @@ class MLAData {
2676
  * @return array query clauses after modification (none)
2677
  */
2678
  public static function mla_query_posts_clauses_request_filter( $pieces ) {
2679
- if ( 'console' == self::$query_parameters['debug'] ) {
2680
- /* translators: 1: DEBUG tag 2: SQL clauses */
2681
- trigger_error( sprintf( __( '%1$s: mla_query_posts_clauses_request_filter = "%2$s".', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $pieces, true ) ), E_USER_WARNING );
2682
- } else {
2683
- /* translators: 1: DEBUG tag 2: SQL clauses */
2684
- error_log( sprintf( _x( '%1$s: mla_query_posts_clauses_request_filter = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $pieces, true ) ), 0 );
2685
- }
2686
 
2687
  return $pieces;
2688
  }
1515
  * ['sentence'] => entire string must match as one "keyword"
1516
  * ['exact'] => entire string must match entire field value
1517
  * ['debug'] => internal element, console/log/shortcode/none
 
1518
  * ['tax_terms_count'] => internal element, shared with JOIN and GROUP BY filters
1519
  *
1520
  * @since 2.00
1759
  if ( isset( $clean_request['debug'] ) ) {
1760
  self::$query_parameters['debug'] = $clean_request['debug'];
1761
  self::$search_parameters['debug'] = $clean_request['debug'];
1762
+ MLA::mla_debug_mode( $clean_request['debug'] );
1763
  unset( $clean_request['debug'] );
1764
  }
1765
 
1982
  global $wp_filter;
1983
  $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'] );
1984
 
1985
+ /* translators: 1: DEBUG tag 2: query filter details */
1986
+ MLA::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 ) ) );
 
 
 
 
 
1987
 
1988
  add_filter( 'posts_clauses', 'MLAData::mla_query_posts_clauses_filter', 0x7FFFFFFF, 1 );
1989
  add_filter( 'posts_clauses_request', 'MLAData::mla_query_posts_clauses_request_filter', 0x7FFFFFFF, 1 );
1997
 
1998
  $debug_array = array( 'request' => $request, 'query_parameters' => self::$query_parameters, 'post_count' => $results->post_count, 'found_posts' => $results->found_posts );
1999
 
2000
+ /* translators: 1: DEBUG tag 2: query details */
2001
+ MLA::mla_debug_add( sprintf( _x( '%1$s: _execute_list_table_query WP_Query = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ) );
2002
+ /* translators: 1: DEBUG tag 2: SQL statement */
2003
+ MLA::mla_debug_add( sprintf( _x( '%1$s: _execute_list_table_query SQL_request = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $results->request, true ) ) );
 
 
 
 
 
 
 
2004
  } // debug
2005
 
2006
  if ( function_exists( 'relevanssi_prevent_default_request' ) ) {
2369
  $debug_array['search_clause'] = $search_clause;
2370
 
2371
  if ( 'shortcode' == self::$search_parameters['debug'] ) {
2372
+ MLA::mla_debug_add( '<strong>mla_debug posts_search filter</strong> = ' . var_export( $debug_array, true ) );
 
 
 
2373
  } else {
2374
  /* translators: 1: DEBUG tag 2: search filter details */
2375
+ MLA::mla_debug_add( sprintf( _x( '%1$s: mla_query_posts_search_filter = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ) );
2376
  }
2377
  } // debug
2378
 
2442
  if ( isset( self::$query_parameters['debug'] ) ) {
2443
  $debug_array['where_clause'] = $where_clause;
2444
 
2445
+ /* translators: 1: DEBUG tag 2: where filter details */
2446
+ MLA::mla_debug_add( sprintf( _x( '%1$s: mla_query_posts_where_filter = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ) );
 
 
 
 
 
2447
  } // debug
2448
 
2449
  return $where_clause;
2491
  if ( isset( self::$query_parameters['debug'] ) ) {
2492
  $debug_array['join_clause'] = $join_clause;
2493
 
2494
+ /* translators: 1: DEBUG tag 2: join filter details */
2495
+ MLA::mla_debug_add( sprintf( _x( '%1$s: mla_query_posts_join_filter = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ) );
 
 
 
 
 
2496
  } // debug
2497
 
2498
  return $join_clause;
2588
  if ( isset( self::$query_parameters['debug'] ) ) {
2589
  $debug_array['orderby_clause'] = $orderby_clause;
2590
 
2591
+ /* translators: 1: DEBUG tag 2: orderby details details */
2592
+ MLA::mla_debug_add( sprintf( _x( '%1$s: mla_query_posts_orderby_filter = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $debug_array, true ) ) );
 
 
 
 
 
2593
  } // debug
2594
 
2595
  return $orderby_clause;
2622
  * @return array query clauses after modification (none)
2623
  */
2624
  public static function mla_query_posts_clauses_filter( $pieces ) {
2625
+ /* translators: 1: DEBUG tag 2: SQL clauses */
2626
+ MLA::mla_debug_add( sprintf( _x( '%1$s: mla_query_posts_clauses_filter = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $pieces, true ) ) );
 
 
 
 
 
2627
 
2628
  return $pieces;
2629
  }
2641
  * @return array query clauses after modification (none)
2642
  */
2643
  public static function mla_query_posts_clauses_request_filter( $pieces ) {
2644
+ /* translators: 1: DEBUG tag 2: SQL clauses */
2645
+ MLA::mla_debug_add( sprintf( _x( '%1$s: mla_query_posts_clauses_request_filter = "%2$s".', 'error_log', 'media-library-assistant' ), __( 'DEBUG', 'media-library-assistant' ), var_export( $pieces, true ) ) );
 
 
 
 
 
2646
 
2647
  return $pieces;
2648
  }
includes/class-mla-main.php CHANGED
@@ -29,7 +29,7 @@ class MLA {
29
  *
30
  * @var string
31
  */
32
- const CURRENT_MLA_VERSION = '2.11';
33
 
34
  /**
35
  * Current date for Development Version, empty for production versions
@@ -2306,5 +2306,119 @@ class MLA {
2306
  'body' => ''
2307
  );
2308
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2309
  } // class MLA
2310
  ?>
29
  *
30
  * @var string
31
  */
32
+ const CURRENT_MLA_VERSION = '2.12';
33
 
34
  /**
35
  * Current date for Development Version, empty for production versions
2306
  'body' => ''
2307
  );
2308
  }
2309
+
2310
+ /**
2311
+ * Accumulates debug messages
2312
+ *
2313
+ * @since 2.12
2314
+ *
2315
+ * @var string
2316
+ */
2317
+ private static $mla_debug_messages = array();
2318
+
2319
+ /**
2320
+ * Debug information collection mode
2321
+ *
2322
+ * @since 2.12
2323
+ *
2324
+ * @var string
2325
+ */
2326
+ private static $mla_debug_mode = 'none';
2327
+
2328
+ /**
2329
+ * Set debug information collection mode
2330
+ *
2331
+ * @since 2.12
2332
+ *
2333
+ * @param string $mode Collection mode: 'buffer' (default), 'console', 'log' or 'none'
2334
+ *
2335
+ * @return boolean true if success else false
2336
+ */
2337
+ public static function mla_debug_mode( $mode = 'buffer' ) {
2338
+ self::$mla_debug_mode = $mode;
2339
+ return true;
2340
+ }
2341
+
2342
+ /**
2343
+ * Get debug information without clearing the buffer
2344
+ *
2345
+ * @since 2.12
2346
+ *
2347
+ * @param string $format Return data type: 'string' (default) or 'array'
2348
+ * @param string $glue Join array elements with '\n' or '<p>' (default)
2349
+ *
2350
+ * @return boolean true if success else false
2351
+ */
2352
+ public static function mla_debug_content( $format = 'string', $glue = '<p>' ) {
2353
+ if ( 'array' == $format ) {
2354
+ return self::$mla_debug_messages;
2355
+ }
2356
+
2357
+ // format == 'string'
2358
+ if ( '<p>' == $glue ) {
2359
+ return '<p>' . implode( '</p><p>', self::$mla_debug_messages ) . '</p>';
2360
+ }
2361
+
2362
+ return implode( "\n", self::$mla_debug_messages ) . "\n";
2363
+ }
2364
+
2365
+ /**
2366
+ * Flush debug information and clear buffer
2367
+ *
2368
+ * @since 2.12
2369
+ *
2370
+ * @param string $destination Destination: 'buffer' (default), 'console', 'log' or 'none'
2371
+ * @param boolean $stop_collecting true (default) to stop, false to continue collection
2372
+ *
2373
+ * @return string debug content if $destination == 'buffer' else empty string
2374
+ */
2375
+ public static function mla_debug_flush( $destination = 'buffer', $stop_collecting = true ) {
2376
+ $results = '';
2377
+
2378
+ switch ( $destination ) {
2379
+ case 'buffer':
2380
+ $results = self::mla_debug_content();
2381
+ break;
2382
+ case 'console':
2383
+ foreach( self::$mla_debug_messages as $message ) {
2384
+ trigger_error( $message, E_USER_WARNING );
2385
+ }
2386
+ break;
2387
+ case 'log':
2388
+ foreach( self::$mla_debug_messages as $message ) {
2389
+ error_log( $message, 0 );
2390
+ }
2391
+ break;
2392
+ }
2393
+
2394
+ self::$mla_debug_messages = array();
2395
+
2396
+ if ( $stop_collecting ) {
2397
+ self::$mla_debug_mode = 'none';
2398
+ }
2399
+
2400
+ return $results;
2401
+ }
2402
+
2403
+ /**
2404
+ * Add a debug message to the collection
2405
+ *
2406
+ * @since 2.12
2407
+ *
2408
+ * @param string $message Message text
2409
+ */
2410
+ public static function mla_debug_add( $message ) {
2411
+ switch ( self::$mla_debug_mode ) {
2412
+ case 'buffer':
2413
+ self::$mla_debug_messages[] = $message;
2414
+ break;
2415
+ case 'console':
2416
+ trigger_error( $message, E_USER_WARNING );
2417
+ break;
2418
+ case 'log':
2419
+ error_log( $message, 0 );
2420
+ break;
2421
+ }
2422
+ }
2423
  } // class MLA
2424
  ?>
includes/class-mla-options.php CHANGED
@@ -245,6 +245,11 @@ class MLAOptions {
245
  */
246
  const MLA_ENABLE_MLA_ICONS = 'enable_mla_icons';
247
 
 
 
 
 
 
248
  /**
249
  * Option setting for "Featured in" reporting
250
  *
@@ -382,10 +387,10 @@ class MLAOptions {
382
  * Load the default templates
383
  */
384
  if ( is_null( self::$mla_option_templates ) ) {
385
- MLAShortcodes::$mla_debug_messages .= '<p><strong>mla_debug _load_option_templates()</strong> ' . __( 'error loading tpls/mla-option-templates.tpl', 'media-library-assistant' );
386
  return;
387
  } elseif ( !self::$mla_option_templates ) {
388
- MLAShortcodes::$mla_debug_messages .= '<p><strong>mla_debug _load_option_templates()</strong> ' . __( 'tpls/mla-option-templates.tpl not found', 'media-library-assistant' );
389
  $mla_option_templates = null;
390
  return;
391
  }
@@ -1243,6 +1248,14 @@ class MLAOptions {
1243
  'std' => 'checked',
1244
  'help' => __( 'Check/uncheck this option to enable/disable MLA File Type Icons Support, then click <strong>Save Changes</strong> to record the new setting.', 'media-library-assistant' )),
1245
 
 
 
 
 
 
 
 
 
1246
  /* Here are examples of the other option types
1247
  'textarea' =>
1248
  array('tab' => '',
@@ -1293,7 +1306,7 @@ class MLAOptions {
1293
  */
1294
  public static function mla_fetch_gallery_template( $key, $type = 'style' ) {
1295
  if ( ! is_array( self::$mla_option_templates ) ) {
1296
- MLAShortcodes::$mla_debug_messages .= '<p><strong>mla_debug mla_fetch_gallery_template()</strong> ' . __( 'no templates exist', 'media-library-assistant' );
1297
  return null;
1298
  }
1299
 
@@ -1301,7 +1314,7 @@ class MLAOptions {
1301
  if ( array_key_exists( $array_key, self::$mla_option_templates ) ) {
1302
  return self::$mla_option_templates[ $array_key ];
1303
  } else {
1304
- MLAShortcodes::$mla_debug_messages .= "<p><strong>mla_fetch_gallery_template( {$key}, {$type} )</strong> " . __( 'not found', 'media-library-assistant' );
1305
  return false;
1306
  }
1307
  }
@@ -1315,7 +1328,7 @@ class MLAOptions {
1315
  */
1316
  public static function mla_get_style_templates() {
1317
  if ( ! is_array( self::$mla_option_templates ) ) {
1318
- MLAShortcodes::$mla_debug_messages .= '<p><strong>mla_debug mla_get_style_templates()</strong> ' . __( 'no templates exist', 'media-library-assistant' );
1319
  return null;
1320
  }
1321
 
@@ -1357,7 +1370,7 @@ class MLAOptions {
1357
  */
1358
  public static function mla_get_markup_templates() {
1359
  if ( ! is_array( self::$mla_option_templates ) ) {
1360
- MLAShortcodes::$mla_debug_messages .= '<p><strong>mla_debug mla_get_markup_templates()</strong> ' . __( 'no templates exist', 'media-library-assistant' );
1361
  return null;
1362
  }
1363
 
245
  */
246
  const MLA_ENABLE_MLA_ICONS = 'enable_mla_icons';
247
 
248
+ /**
249
+ * Provides a unique name for the Debug display limit option
250
+ */
251
+ const MLA_DEBUG_DISPLAY_LIMIT = 'debug_display_limit';
252
+
253
  /**
254
  * Option setting for "Featured in" reporting
255
  *
387
  * Load the default templates
388
  */
389
  if ( is_null( self::$mla_option_templates ) ) {
390
+ MLA::mla_debug_add( '<strong>mla_debug _load_option_templates()</strong> ' . __( 'error loading tpls/mla-option-templates.tpl', 'media-library-assistant' ) );
391
  return;
392
  } elseif ( !self::$mla_option_templates ) {
393
+ MLA::mla_debug_add( '<strong>mla_debug _load_option_templates()</strong> ' . __( 'tpls/mla-option-templates.tpl not found', 'media-library-assistant' ) );
394
  $mla_option_templates = null;
395
  return;
396
  }
1248
  'std' => 'checked',
1249
  'help' => __( 'Check/uncheck this option to enable/disable MLA File Type Icons Support, then click <strong>Save Changes</strong> to record the new setting.', 'media-library-assistant' )),
1250
 
1251
+ self::MLA_DEBUG_DISPLAY_LIMIT =>
1252
+ array('tab' => 'debug',
1253
+ 'name' => __( 'Display Limit', 'media-library-assistant' ),
1254
+ 'type' => 'text',
1255
+ 'std' => '',
1256
+ 'size' => 5,
1257
+ 'help' => __( 'Enter the maximum number of debug log characters to display; enter zero for no limit.', 'media-library-assistant' )),
1258
+
1259
  /* Here are examples of the other option types
1260
  'textarea' =>
1261
  array('tab' => '',
1306
  */
1307
  public static function mla_fetch_gallery_template( $key, $type = 'style' ) {
1308
  if ( ! is_array( self::$mla_option_templates ) ) {
1309
+ MLA::mla_debug_add( '<strong>mla_debug mla_fetch_gallery_template()</strong> ' . __( 'no templates exist', 'media-library-assistant' ) );
1310
  return null;
1311
  }
1312
 
1314
  if ( array_key_exists( $array_key, self::$mla_option_templates ) ) {
1315
  return self::$mla_option_templates[ $array_key ];
1316
  } else {
1317
+ MLA::mla_debug_add( "<strong>mla_fetch_gallery_template( {$key}, {$type} )</strong> " . __( 'not found', 'media-library-assistant' ) );
1318
  return false;
1319
  }
1320
  }
1328
  */
1329
  public static function mla_get_style_templates() {
1330
  if ( ! is_array( self::$mla_option_templates ) ) {
1331
+ MLA::mla_debug_add( '<strong>mla_debug mla_get_style_templates()</strong> ' . __( 'no templates exist', 'media-library-assistant' ) );
1332
  return null;
1333
  }
1334
 
1370
  */
1371
  public static function mla_get_markup_templates() {
1372
  if ( ! is_array( self::$mla_option_templates ) ) {
1373
+ MLA::mla_debug_add( '<strong>mla_debug mla_get_markup_templates()</strong> ' . __( 'no templates exist', 'media-library-assistant' ) );
1374
  return null;
1375
  }
1376
 
includes/class-mla-settings.php CHANGED
@@ -3018,7 +3018,10 @@ class MLASettings {
3018
  $page_content['message'] = sprintf( __( '%1$s: Reading the %2$s file ( %3$s ) "%4$s".', 'media-library-assistant' ), __( 'ERROR', 'media-library-assistant' ), __( 'Error Log', 'media-library-assistant' ), $error_log_name, $php_errormsg );
3019
  $error_log_contents = '';
3020
  } else {
3021
- //$error_log_contents = esc_html( $error_log_contents );
 
 
 
3022
  }
3023
 
3024
  if ( current_user_can( 'upload_files' ) ) {
3018
  $page_content['message'] = sprintf( __( '%1$s: Reading the %2$s file ( %3$s ) "%4$s".', 'media-library-assistant' ), __( 'ERROR', 'media-library-assistant' ), __( 'Error Log', 'media-library-assistant' ), $error_log_name, $php_errormsg );
3019
  $error_log_contents = '';
3020
  } else {
3021
+ $display_limit = absint( MLAOptions::mla_get_option( MLAOptions::MLA_DEBUG_DISPLAY_LIMIT ) );
3022
+ if ( 0 < $display_limit ) {
3023
+ $error_log_contents = substr( $error_log_contents, 0 - $display_limit );
3024
+ }
3025
  }
3026
 
3027
  if ( current_user_can( 'upload_files' ) ) {
includes/class-mla-shortcodes.php CHANGED
@@ -21,7 +21,6 @@ class MLAShortcodes {
21
  * @return void
22
  */
23
  public static function initialize() {
24
- add_shortcode( 'mla_attachment_list', 'MLAShortcodes::mla_attachment_list_shortcode' );
25
  add_shortcode( 'mla_gallery', 'MLAShortcodes::mla_gallery_shortcode' );
26
  add_shortcode( 'mla_tag_cloud', 'MLAShortcodes::mla_tag_cloud_shortcode' );
27
 
@@ -53,21 +52,6 @@ class MLAShortcodes {
53
  return $no_texturize_shortcodes;
54
  }
55
 
56
- /**
57
- * Obsolete; no longer supported
58
- *
59
- * @since 0.1
60
- *
61
- * @return void echoes HTML markup for the error message
62
- */
63
- public static function mla_attachment_list_shortcode() {
64
- /*
65
- * This shortcode is not documented and no longer supported.
66
- */
67
- echo 'The [mla_attachment_list] shortcode is no longer supported.';
68
- return;
69
- }
70
-
71
  /**
72
  * Verify the presence of Ghostscript for mla_viewer
73
  *
@@ -82,10 +66,12 @@ class MLAShortcodes {
82
  static $ghostscript_present = NULL;
83
 
84
  if ( isset( $ghostscript_present ) ) {
 
85
  return $ghostscript_present;
86
  }
87
 
88
  if ( 'checked' != MLAOptions::mla_get_option( 'enable_ghostscript_check' ) ) {
 
89
  return $ghostscript_present = true;
90
  }
91
 
@@ -93,6 +79,7 @@ class MLAShortcodes {
93
  * Imagick must be installed as well
94
  */
95
  if ( ! class_exists( 'Imagick' ) ) {
 
96
  return $ghostscript_present = false;
97
  }
98
 
@@ -100,17 +87,20 @@ class MLAShortcodes {
100
  * Look for exec() - from http://stackoverflow.com/a/12980534/866618
101
  */
102
  if ( ini_get('safe_mode') ) {
 
103
  return $ghostscript_present = false;
104
  }
105
 
106
  $blacklist = preg_split( '/,\s*/', ini_get('disable_functions') . ',' . ini_get('suhosin.executor.func.blacklist') );
107
  if ( in_array('exec', $blacklist) ) {
 
108
  return $ghostscript_present = false;
109
  }
110
 
111
  if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3) ) ) {
112
  if ( ! empty( $explicit_path ) ) {
113
  $return = exec( 'dir /o:n/s/b "' . $explicit_path . '"' );
 
114
  if ( ! empty( $return ) ) {
115
  return $ghostscript_present = true;
116
  } else {
@@ -138,11 +128,13 @@ class MLAShortcodes {
138
  return $ghostscript_present = true;
139
  }
140
 
 
141
  return $ghostscript_present = false;
142
  } // Windows platform
143
 
144
  if ( ! empty( $explicit_path ) ) {
145
  exec( 'test -e ' . $explicit_path, $dummy, $ghostscript_path );
 
146
  return ( $explicit_path === $ghostscript_path );
147
  }
148
 
@@ -153,6 +145,7 @@ class MLAShortcodes {
153
 
154
  $test_path = '/usr/bin/gs';
155
  exec('test -e ' . $test_path, $dummy, $ghostscript_path);
 
156
  return $ghostscript_present = ( $test_path === $ghostscript_path );
157
  }
158
 
@@ -209,15 +202,6 @@ class MLAShortcodes {
209
  return shortcode_parse_atts( $new_attr );
210
  }
211
 
212
- /**
213
- * Accumulates debug messages
214
- *
215
- * @since 0.60
216
- *
217
- * @var string
218
- */
219
- public static $mla_debug_messages = '';
220
-
221
  /**
222
  * Turn debug collection and display on or off
223
  *
@@ -418,8 +402,17 @@ class MLAShortcodes {
418
  $arguments = shortcode_atts( $default_arguments, $attr );
419
  $arguments = apply_filters( 'mla_gallery_arguments', $arguments );
420
 
421
- self::$mla_debug = !empty( $arguments['mla_debug'] ) && ( 'true' == strtolower( $arguments['mla_debug'] ) );
422
-
 
 
 
 
 
 
 
 
 
423
  /*
424
  * Determine output type
425
  */
@@ -439,9 +432,8 @@ class MLAShortcodes {
439
 
440
  if ( empty($attachments) ) {
441
  if ( self::$mla_debug ) {
442
- $output = '<p><strong>' . __( 'mla_debug empty gallery', 'media-library-assistant' ) . '</strong>, query = ' . var_export( $attr, true ) . '</p>';
443
- $output .= self::$mla_debug_messages;
444
- self::$mla_debug_messages = '';
445
  } else {
446
  $output = '';
447
  }
@@ -485,8 +477,7 @@ class MLAShortcodes {
485
  $new_ids = $arguments['mla_alt_ids_name'] . '="' . $new_ids . '"';
486
 
487
  if ( self::$mla_debug ) {
488
- $output = self::$mla_debug_messages;
489
- self::$mla_debug_messages = '';
490
  } else {
491
  $output = '';
492
  }
@@ -562,7 +553,16 @@ class MLAShortcodes {
562
  }
563
 
564
  if ( $arguments['mla_viewer'] ) {
565
- $arguments['mla_viewer_extensions'] = array_filter( array_map( 'trim', explode( ',', $arguments['mla_viewer_extensions'] ) ) );
 
 
 
 
 
 
 
 
 
566
  // convert limit (in MB) to float
567
  $arguments['mla_viewer_limit'] = abs( 0.0 + $arguments['mla_viewer_limit'] );
568
 
@@ -742,8 +742,7 @@ class MLAShortcodes {
742
 
743
  $markup_values = MLAData::mla_expand_field_level_parameters( $new_text, $attr, $markup_values );
744
  if ( self::$mla_debug ) {
745
- $output = self::$mla_debug_messages;
746
- self::$mla_debug_messages = '';
747
  } else {
748
  $output = '';
749
  }
@@ -866,6 +865,7 @@ class MLAShortcodes {
866
  $item_values['description'] = wptexturize( $attachment->post_content );
867
  $item_values['file_url'] = wptexturize( $attachment->guid );
868
  $item_values['author_id'] = $attachment->post_author;
 
869
 
870
  $user = get_user_by( 'id', $attachment->post_author );
871
  if ( isset( $user->data->display_name ) ) {
@@ -1256,6 +1256,10 @@ class MLAShortcodes {
1256
  'mla_stream_file' => urlencode( $upload_dir['basedir'] . '/' . $item_values['base_file'] ),
1257
  );
1258
 
 
 
 
 
1259
  if ( $arguments['mla_single_thread'] ) {
1260
  $args['mla_single_thread'] = 'true';
1261
  }
@@ -1610,10 +1614,20 @@ class MLAShortcodes {
1610
 
1611
  $arguments = apply_filters( 'mla_tag_cloud_arguments', $arguments );
1612
 
1613
- self::$mla_debug = !empty( $arguments['mla_debug'] ) && ( 'true' == strtolower( $arguments['mla_debug'] ) );
 
 
 
 
 
 
 
 
 
 
1614
  if ( self::$mla_debug ) {
1615
- self::$mla_debug_messages .= '<p><strong>' . __( 'mla_debug attributes', 'media-library-assistant' ) . '</strong> = ' . var_export( $attr, true ) . '</p>';
1616
- self::$mla_debug_messages .= '<p><strong>' . __( 'mla_debug arguments', 'media-library-assistant' ) . '</strong> = ' . var_export( $arguments, true ) . '</p>';
1617
  }
1618
 
1619
  /*
@@ -1679,8 +1693,7 @@ class MLAShortcodes {
1679
  $tags = self::mla_get_terms( $arguments );
1680
 
1681
  if ( self::$mla_debug ) {
1682
- $cloud = self::$mla_debug_messages;
1683
- self::$mla_debug_messages = '';
1684
  } else {
1685
  $cloud = '';
1686
  }
@@ -1705,7 +1718,8 @@ class MLAShortcodes {
1705
 
1706
  if ( empty( $tags ) ) {
1707
  if ( self::$mla_debug ) {
1708
- $cloud .= '<p><strong>' . __( 'mla_debug empty cloud', 'media-library-assistant' ) . '</strong>, query = ' . var_export( $arguments, true ) . '</p>';
 
1709
  }
1710
 
1711
  $cloud .= $arguments['mla_nolink_text'];
@@ -3599,19 +3613,19 @@ class MLAShortcodes {
3599
  global $wp_filter;
3600
 
3601
  foreach( $wp_filter['posts_where'] as $priority => $filters ) {
3602
- self::$mla_debug_messages .= '<p><strong>mla_debug $wp_filter[posts_where]</strong> priority = ' . var_export( $priority, true ) . '<br />';
3603
  foreach ( $filters as $name => $descriptor ) {
3604
- self::$mla_debug_messages .= 'filter name = ' . var_export( $name, true ) . '<br />';
3605
  }
3606
- self::$mla_debug_messages .= '</p>';
3607
  }
3608
 
3609
  foreach( $wp_filter['posts_orderby'] as $priority => $filters ) {
3610
- self::$mla_debug_messages .= '<p><strong>mla_debug $wp_filter[posts_orderby]</strong> priority = ' . var_export( $priority, true ) . '<br />';
3611
  foreach ( $filters as $name => $descriptor ) {
3612
- self::$mla_debug_messages .= 'filter name = ' . var_export( $name, true ) . '<br />';
3613
  }
3614
- self::$mla_debug_messages .= '</p>';
3615
  }
3616
  }
3617
 
@@ -3643,10 +3657,6 @@ class MLAShortcodes {
3643
 
3644
  if ( ! empty( MLAData::$search_parameters ) ) {
3645
  remove_filter( 'posts_search', 'MLAData::mla_query_posts_search_filter' );
3646
-
3647
- if ( self::$mla_debug && isset( MLAData::$search_parameters['mla_debug_messages'] ) ) {
3648
- self::$mla_debug_messages .= MLAData::$search_parameters['mla_debug_messages'];
3649
- }
3650
  }
3651
 
3652
  if ( function_exists( 'relevanssi_prevent_default_request' ) ) {
@@ -3661,10 +3671,10 @@ class MLAShortcodes {
3661
  remove_filter( 'posts_clauses', 'MLAShortcodes::mla_shortcode_query_posts_clauses_filter', 0x7FFFFFFF );
3662
  remove_filter( 'posts_clauses_request', 'MLAShortcodes::mla_shortcode_query_posts_clauses_request_filter', 0x7FFFFFFF );
3663
 
3664
- self::$mla_debug_messages .= '<p><strong>' . __( 'mla_debug query', 'media-library-assistant' ) . '</strong> = ' . var_export( $query_arguments, true ) . '</p>';
3665
- self::$mla_debug_messages .= '<p><strong>' . __( 'mla_debug request', 'media-library-assistant' ) . '</strong> = ' . var_export( self::$mla_gallery_wp_query_object->request, true ) . '</p>';
3666
- self::$mla_debug_messages .= '<p><strong>' . __( 'mla_debug query_vars', 'media-library-assistant' ) . '</strong> = ' . var_export( self::$mla_gallery_wp_query_object->query_vars, true ) . '</p>';
3667
- self::$mla_debug_messages .= '<p><strong>' . __( 'mla_debug post_count', 'media-library-assistant' ) . '</strong> = ' . var_export( self::$mla_gallery_wp_query_object->post_count, true ) . '</p>';
3668
  }
3669
 
3670
  self::$mla_gallery_wp_query_object = NULL;
@@ -3732,7 +3742,7 @@ class MLAShortcodes {
3732
 
3733
  if ( self::$mla_debug ) {
3734
  $old_clause = $where_clause;
3735
- self::$mla_debug_messages .= '<p><strong>' . __( 'mla_debug WHERE filter', 'media-library-assistant' ) . '</strong> = ' . var_export( $where_clause, true ) . '</p>';
3736
  }
3737
 
3738
  if ( strpos( $where_clause, "post_type = 'attachment'" ) ) {
@@ -3751,7 +3761,7 @@ class MLAShortcodes {
3751
  }
3752
 
3753
  if ( self::$mla_debug && ( $old_clause != $where_clause ) ) {
3754
- self::$mla_debug_messages .= '<p><strong>' . __( 'mla_debug modified WHERE filter', 'media-library-assistant' ) . '</strong> = ' . var_export( $where_clause, true ) . '</p>';
3755
  }
3756
 
3757
  return $where_clause;
@@ -3774,7 +3784,7 @@ class MLAShortcodes {
3774
 
3775
  if ( self::$mla_debug ) {
3776
  $replacement = isset( self::$query_parameters['orderby'] ) ? var_export( self::$query_parameters['orderby'], true ) : 'none';
3777
- self::$mla_debug_messages .= '<p><strong>' . __( 'mla_debug ORDER BY filter, incoming', 'media-library-assistant' ) . '</strong> = ' . var_export( $orderby_clause, true ) . '<br>' . __( 'Replacement ORDER BY clause', 'media-library-assistant' ) . ' = ' . $replacement . '</p>';
3778
  }
3779
 
3780
  if ( isset( self::$query_parameters['orderby'] ) ) {
@@ -3797,7 +3807,7 @@ class MLAShortcodes {
3797
  * @return array query clauses after modification (none)
3798
  */
3799
  public static function mla_shortcode_query_posts_clauses_filter( $pieces ) {
3800
- self::$mla_debug_messages .= '<p><strong>' . __( 'mla_debug posts_clauses filter', 'media-library-assistant' ) . '</strong> = ' . var_export( $pieces, true ) . '</p>';
3801
 
3802
  return $pieces;
3803
  }
@@ -3815,7 +3825,7 @@ class MLAShortcodes {
3815
  * @return array query clauses after modification (none)
3816
  */
3817
  public static function mla_shortcode_query_posts_clauses_request_filter( $pieces ) {
3818
- self::$mla_debug_messages .= '<p><strong>' . __( 'mla_debug posts_clauses_request filter', 'media-library-assistant' ) . '</strong> = ' . var_export( $pieces, true ) . '</p>';
3819
 
3820
  return $pieces;
3821
  }
@@ -4211,11 +4221,11 @@ class MLAShortcodes {
4211
  }
4212
 
4213
  if ( self::$mla_debug ) {
4214
- self::$mla_debug_messages .= '<p><strong>' . __( 'mla_debug query arguments', 'media-library-assistant' ) . '</strong> = ' . var_export( $arguments, true ) . '</p>';
4215
- self::$mla_debug_messages .= '<p><strong>' . __( 'mla_debug last_query', 'media-library-assistant' ) . '</strong> = ' . var_export( $wpdb->last_query, true ) . '</p>';
4216
- self::$mla_debug_messages .= '<p><strong>' . __( 'mla_debug last_error', 'media-library-assistant' ) . '</strong> = ' . var_export( $wpdb->last_error, true ) . '</p>';
4217
- self::$mla_debug_messages .= '<p><strong>' . __( 'mla_debug num_rows', 'media-library-assistant' ) . '</strong> = ' . var_export( $wpdb->num_rows, true ) . '</p>';
4218
- self::$mla_debug_messages .= '<p><strong>' . __( 'mla_debug found_rows', 'media-library-assistant' ) . '</strong> = ' . var_export( $found_rows, true ) . '</p>';
4219
  }
4220
 
4221
  if ( 'true' == strtolower( trim( $arguments['pad_counts'] ) ) ) {
21
  * @return void
22
  */
23
  public static function initialize() {
 
24
  add_shortcode( 'mla_gallery', 'MLAShortcodes::mla_gallery_shortcode' );
25
  add_shortcode( 'mla_tag_cloud', 'MLAShortcodes::mla_tag_cloud_shortcode' );
26
 
52
  return $no_texturize_shortcodes;
53
  }
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  /**
56
  * Verify the presence of Ghostscript for mla_viewer
57
  *
66
  static $ghostscript_present = NULL;
67
 
68
  if ( isset( $ghostscript_present ) ) {
69
+ MLA::mla_debug_add( '<strong>_ghostscript_present</strong>, ghostscript_present = ' . var_export( $ghostscript_present, true ) );
70
  return $ghostscript_present;
71
  }
72
 
73
  if ( 'checked' != MLAOptions::mla_get_option( 'enable_ghostscript_check' ) ) {
74
+ MLA::mla_debug_add( '<strong>_ghostscript_present</strong>, disabled' );
75
  return $ghostscript_present = true;
76
  }
77
 
79
  * Imagick must be installed as well
80
  */
81
  if ( ! class_exists( 'Imagick' ) ) {
82
+ MLA::mla_debug_add( '<strong>_ghostscript_present</strong>, Imagick missing' );
83
  return $ghostscript_present = false;
84
  }
85
 
87
  * Look for exec() - from http://stackoverflow.com/a/12980534/866618
88
  */
89
  if ( ini_get('safe_mode') ) {
90
+ MLA::mla_debug_add( '<strong>_ghostscript_present</strong>, safe_mode' );
91
  return $ghostscript_present = false;
92
  }
93
 
94
  $blacklist = preg_split( '/,\s*/', ini_get('disable_functions') . ',' . ini_get('suhosin.executor.func.blacklist') );
95
  if ( in_array('exec', $blacklist) ) {
96
+ MLA::mla_debug_add( '<strong>_ghostscript_present</strong>, exec in blacklist' );
97
  return $ghostscript_present = false;
98
  }
99
 
100
  if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3) ) ) {
101
  if ( ! empty( $explicit_path ) ) {
102
  $return = exec( 'dir /o:n/s/b "' . $explicit_path . '"' );
103
+ MLA::mla_debug_add( '<strong>_ghostscript_present</strong>, WIN explicit path = ' . var_export( $return, true ) );
104
  if ( ! empty( $return ) ) {
105
  return $ghostscript_present = true;
106
  } else {
128
  return $ghostscript_present = true;
129
  }
130
 
131
+ MLA::mla_debug_add( '<strong>_ghostscript_present</strong>, WIN detection failed' );
132
  return $ghostscript_present = false;
133
  } // Windows platform
134
 
135
  if ( ! empty( $explicit_path ) ) {
136
  exec( 'test -e ' . $explicit_path, $dummy, $ghostscript_path );
137
+ MLA::mla_debug_add( '<strong>_ghostscript_present</strong>, explicit path = ' . var_export( $explicit_path, true ) . ', ghostscript_path = ' . var_export( $ghostscript_path, true ) );
138
  return ( $explicit_path === $ghostscript_path );
139
  }
140
 
145
 
146
  $test_path = '/usr/bin/gs';
147
  exec('test -e ' . $test_path, $dummy, $ghostscript_path);
148
+ MLA::mla_debug_add( '<strong>_ghostscript_present</strong>, test_path = ' . var_export( $test_path, true ) . ', ghostscript_path = ' . var_export( $ghostscript_path, true ) );
149
  return $ghostscript_present = ( $test_path === $ghostscript_path );
150
  }
151
 
202
  return shortcode_parse_atts( $new_attr );
203
  }
204
 
 
 
 
 
 
 
 
 
 
205
  /**
206
  * Turn debug collection and display on or off
207
  *
402
  $arguments = shortcode_atts( $default_arguments, $attr );
403
  $arguments = apply_filters( 'mla_gallery_arguments', $arguments );
404
 
405
+ self::$mla_debug = ( ! empty( $arguments['mla_debug'] ) ) ? trim( strtolower( $arguments['mla_debug'] ) ) : false;
406
+ if ( self::$mla_debug ) {
407
+ if ( 'true' == self::$mla_debug ) {
408
+ MLA::mla_debug_mode( 'buffer' );
409
+ } elseif ( 'log' == self::$mla_debug ) {
410
+ MLA::mla_debug_mode( 'log' );
411
+ } else {
412
+ self::$mla_debug = false;
413
+ }
414
+ }
415
+
416
  /*
417
  * Determine output type
418
  */
432
 
433
  if ( empty($attachments) ) {
434
  if ( self::$mla_debug ) {
435
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug empty gallery', 'media-library-assistant' ) . '</strong>, query = ' . var_export( $attr, true ) );
436
+ $output = MLA::mla_debug_flush();
 
437
  } else {
438
  $output = '';
439
  }
477
  $new_ids = $arguments['mla_alt_ids_name'] . '="' . $new_ids . '"';
478
 
479
  if ( self::$mla_debug ) {
480
+ $output = MLA::mla_debug_flush();
 
481
  } else {
482
  $output = '';
483
  }
553
  }
554
 
555
  if ( $arguments['mla_viewer'] ) {
556
+ /*
557
+ * Test for Ghostscript here so debug messages can be recorded
558
+ */
559
+ $ghostscript_path = MLAOptions::mla_get_option( 'ghostscript_path' );
560
+ if ( self::_ghostscript_present( $ghostscript_path ) ) {
561
+ $arguments['mla_viewer_extensions'] = array_filter( array_map( 'trim', explode( ',', $arguments['mla_viewer_extensions'] ) ) );
562
+ } else {
563
+ $arguments['mla_viewer_extensions'] = array();
564
+ }
565
+
566
  // convert limit (in MB) to float
567
  $arguments['mla_viewer_limit'] = abs( 0.0 + $arguments['mla_viewer_limit'] );
568
 
742
 
743
  $markup_values = MLAData::mla_expand_field_level_parameters( $new_text, $attr, $markup_values );
744
  if ( self::$mla_debug ) {
745
+ $output = MLA::mla_debug_flush();
 
746
  } else {
747
  $output = '';
748
  }
865
  $item_values['description'] = wptexturize( $attachment->post_content );
866
  $item_values['file_url'] = wptexturize( $attachment->guid );
867
  $item_values['author_id'] = $attachment->post_author;
868
+ $item_values['captiontag_content'] = '';
869
 
870
  $user = get_user_by( 'id', $attachment->post_author );
871
  if ( isset( $user->data->display_name ) ) {
1256
  'mla_stream_file' => urlencode( $upload_dir['basedir'] . '/' . $item_values['base_file'] ),
1257
  );
1258
 
1259
+ if ( 'log' == $arguments['mla_debug'] ) {
1260
+ $args['mla_debug'] = 'log';
1261
+ }
1262
+
1263
  if ( $arguments['mla_single_thread'] ) {
1264
  $args['mla_single_thread'] = 'true';
1265
  }
1614
 
1615
  $arguments = apply_filters( 'mla_tag_cloud_arguments', $arguments );
1616
 
1617
+ self::$mla_debug = ( ! empty( $arguments['mla_debug'] ) ) ? trim( strtolower( $arguments['mla_debug'] ) ) : false;
1618
+ if ( self::$mla_debug ) {
1619
+ if ( 'true' == self::$mla_debug ) {
1620
+ MLA::mla_debug_mode( 'buffer' );
1621
+ } elseif ( 'log' == self::$mla_debug ) {
1622
+ MLA::mla_debug_mode( 'log' );
1623
+ } else {
1624
+ self::$mla_debug = false;
1625
+ }
1626
+ }
1627
+
1628
  if ( self::$mla_debug ) {
1629
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug attributes', 'media-library-assistant' ) . '</strong> = ' . var_export( $attr, true ) );
1630
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug arguments', 'media-library-assistant' ) . '</strong> = ' . var_export( $arguments, true ) );
1631
  }
1632
 
1633
  /*
1693
  $tags = self::mla_get_terms( $arguments );
1694
 
1695
  if ( self::$mla_debug ) {
1696
+ $cloud = MLA::mla_debug_flush();
 
1697
  } else {
1698
  $cloud = '';
1699
  }
1718
 
1719
  if ( empty( $tags ) ) {
1720
  if ( self::$mla_debug ) {
1721
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug empty cloud', 'media-library-assistant' ) . '</strong>, query = ' . var_export( $arguments, true ) );
1722
+ $cloud = MLA::mla_debug_flush();
1723
  }
1724
 
1725
  $cloud .= $arguments['mla_nolink_text'];
3613
  global $wp_filter;
3614
 
3615
  foreach( $wp_filter['posts_where'] as $priority => $filters ) {
3616
+ $debug_message = '<strong>mla_debug $wp_filter[posts_where]</strong> priority = ' . var_export( $priority, true ) . '<br />';
3617
  foreach ( $filters as $name => $descriptor ) {
3618
+ $debug_message .= 'filter name = ' . var_export( $name, true ) . '<br />';
3619
  }
3620
+ MLA::mla_debug_add( $debug_message );
3621
  }
3622
 
3623
  foreach( $wp_filter['posts_orderby'] as $priority => $filters ) {
3624
+ $debug_message = '<strong>mla_debug $wp_filter[posts_orderby]</strong> priority = ' . var_export( $priority, true ) . '<br />';
3625
  foreach ( $filters as $name => $descriptor ) {
3626
+ $debug_message .= 'filter name = ' . var_export( $name, true ) . '<br />';
3627
  }
3628
+ MLA::mla_debug_add( $debug_message );
3629
  }
3630
  }
3631
 
3657
 
3658
  if ( ! empty( MLAData::$search_parameters ) ) {
3659
  remove_filter( 'posts_search', 'MLAData::mla_query_posts_search_filter' );
 
 
 
 
3660
  }
3661
 
3662
  if ( function_exists( 'relevanssi_prevent_default_request' ) ) {
3671
  remove_filter( 'posts_clauses', 'MLAShortcodes::mla_shortcode_query_posts_clauses_filter', 0x7FFFFFFF );
3672
  remove_filter( 'posts_clauses_request', 'MLAShortcodes::mla_shortcode_query_posts_clauses_request_filter', 0x7FFFFFFF );
3673
 
3674
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug query', 'media-library-assistant' ) . '</strong> = ' . var_export( $query_arguments, true ) );
3675
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug request', 'media-library-assistant' ) . '</strong> = ' . var_export( self::$mla_gallery_wp_query_object->request, true ) );
3676
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug query_vars', 'media-library-assistant' ) . '</strong> = ' . var_export( self::$mla_gallery_wp_query_object->query_vars, true ) );
3677
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug post_count', 'media-library-assistant' ) . '</strong> = ' . var_export( self::$mla_gallery_wp_query_object->post_count, true ) );
3678
  }
3679
 
3680
  self::$mla_gallery_wp_query_object = NULL;
3742
 
3743
  if ( self::$mla_debug ) {
3744
  $old_clause = $where_clause;
3745
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug WHERE filter', 'media-library-assistant' ) . '</strong> = ' . var_export( $where_clause, true ) );
3746
  }
3747
 
3748
  if ( strpos( $where_clause, "post_type = 'attachment'" ) ) {
3761
  }
3762
 
3763
  if ( self::$mla_debug && ( $old_clause != $where_clause ) ) {
3764
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug modified WHERE filter', 'media-library-assistant' ) . '</strong> = ' . var_export( $where_clause, true ) );
3765
  }
3766
 
3767
  return $where_clause;
3784
 
3785
  if ( self::$mla_debug ) {
3786
  $replacement = isset( self::$query_parameters['orderby'] ) ? var_export( self::$query_parameters['orderby'], true ) : 'none';
3787
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug ORDER BY filter, incoming', 'media-library-assistant' ) . '</strong> = ' . var_export( $orderby_clause, true ) . '<br>' . __( 'Replacement ORDER BY clause', 'media-library-assistant' ) . ' = ' . $replacement );
3788
  }
3789
 
3790
  if ( isset( self::$query_parameters['orderby'] ) ) {
3807
  * @return array query clauses after modification (none)
3808
  */
3809
  public static function mla_shortcode_query_posts_clauses_filter( $pieces ) {
3810
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug posts_clauses filter', 'media-library-assistant' ) . '</strong> = ' . var_export( $pieces, true ) );
3811
 
3812
  return $pieces;
3813
  }
3825
  * @return array query clauses after modification (none)
3826
  */
3827
  public static function mla_shortcode_query_posts_clauses_request_filter( $pieces ) {
3828
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug posts_clauses_request filter', 'media-library-assistant' ) . '</strong> = ' . var_export( $pieces, true ) );
3829
 
3830
  return $pieces;
3831
  }
4221
  }
4222
 
4223
  if ( self::$mla_debug ) {
4224
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug query arguments', 'media-library-assistant' ) . '</strong> = ' . var_export( $arguments, true ) );
4225
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug last_query', 'media-library-assistant' ) . '</strong> = ' . var_export( $wpdb->last_query, true ) );
4226
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug last_error', 'media-library-assistant' ) . '</strong> = ' . var_export( $wpdb->last_error, true ) );
4227
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug num_rows', 'media-library-assistant' ) . '</strong> = ' . var_export( $wpdb->num_rows, true ) );
4228
+ MLA::mla_debug_add( '<strong>' . __( 'mla_debug found_rows', 'media-library-assistant' ) . '</strong> = ' . var_export( $found_rows, true ) );
4229
  }
4230
 
4231
  if ( 'true' == strtolower( trim( $arguments['pad_counts'] ) ) ) {
includes/mla-stream-image.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Stream image handler for the mla_viewer
4
  *
5
  * @package Media Library Assistant
6
  * @since 2.10
@@ -9,9 +9,10 @@
9
  /*
10
  * Process mla_viewer image stream requests
11
  */
12
- @ini_set('error_log','C:\Program Files (x86)\Apache Software Foundation\Apache2.2\logs\php-errors.log');
13
 
14
  if ( isset( $_REQUEST['mla_stream_file'] ) ) {
 
15
  MLAStreamImage::mla_process_stream_image();
16
  }
17
 
@@ -25,6 +26,15 @@ MLAStreamImage::_mla_die( 'mla_stream_file not set', __LINE__, 500 );
25
  * @since 2.10
26
  */
27
  class MLAStreamImage {
 
 
 
 
 
 
 
 
 
28
  /**
29
  * Generate a unique, writable file in the temporary directory
30
  *
@@ -53,6 +63,7 @@ class MLAStreamImage {
53
  } else {
54
  $temp = '/tmp/';
55
  if ( false == @is_dir( $temp ) ) {
 
56
  return false;
57
  }
58
  }
@@ -65,6 +76,7 @@ class MLAStreamImage {
65
  $path = $temp . uniqid( mt_rand() ) . $extension;
66
  $f = @fopen( $path, 'a' );
67
  if ( $f === false ) {
 
68
  return false;
69
  }
70
 
@@ -99,11 +111,13 @@ class MLAStreamImage {
99
  * Look for exec() - from http://stackoverflow.com/a/12980534/866618
100
  */
101
  if ( ini_get('safe_mode') ) {
 
102
  return false;
103
  }
104
 
105
  $blacklist = preg_split( '/,\s*/', ini_get('disable_functions') . ',' . ini_get('suhosin.executor.func.blacklist') );
106
  if ( in_array('exec', $blacklist) ) {
 
107
  return false;
108
  }
109
 
@@ -187,8 +201,8 @@ class MLAStreamImage {
187
  $cmd = sprintf( $cmd, $device, $resolution, ( $frame + 1 ), escapeshellarg( $output_file ), escapeshellarg( $file ) );
188
  exec( $cmd, $stdout, $return );
189
  if ( 0 != $return ) {
190
- error_log( "ERROR: _ghostscript_convert exec returned '{$return}, cmd = " . var_export( $cmd, true ), 0 );
191
- error_log( "ERROR: _ghostscript_convert exec returned '{$return}, details = " . var_export( $stdout, true ), 0 );
192
  return false;
193
  }
194
 
@@ -196,7 +210,7 @@ class MLAStreamImage {
196
  self::$image->readImage( $output_file );
197
  }
198
  catch ( Exception $e ) {
199
- error_log( "ERROR: _ghostscript_convert readImage Exception = " . var_export( $e->getMessage(), true ), 0 );
200
  return false;
201
  }
202
 
@@ -204,6 +218,7 @@ class MLAStreamImage {
204
  return true;
205
  } // found Ghostscript
206
 
 
207
  return false;
208
  }
209
 
@@ -391,6 +406,19 @@ class MLAStreamImage {
391
  exit();
392
  }
393
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  /**
395
  * Abort the operation and exit
396
  *
@@ -403,7 +431,7 @@ class MLAStreamImage {
403
  * @return void echos page content and calls exit();
404
  */
405
  private static function _mla_die( $message, $title = '', $response = 500 ) {
406
- error_log( __LINE__ . " _mla_die( '{$message}', '{$title}', '{$response}' )", 0 );
407
  exit();
408
  }
409
  } // Class MLAStreamImage
1
  <?php
2
  /**
3
+ * Stand-alone stream image handler for the mla_viewer
4
  *
5
  * @package Media Library Assistant
6
  * @since 2.10
9
  /*
10
  * Process mla_viewer image stream requests
11
  */
12
+ //@ini_set('error_log','C:\Program Files (x86)\Apache Software Foundation\Apache2.2\logs\php-errors.log');
13
 
14
  if ( isset( $_REQUEST['mla_stream_file'] ) ) {
15
+ MLAStreamImage::$mla_debug = isset( $_REQUEST['mla_debug'] ) && 'log' == $_REQUEST['mla_debug'];
16
  MLAStreamImage::mla_process_stream_image();
17
  }
18
 
26
  * @since 2.10
27
  */
28
  class MLAStreamImage {
29
+ /**
30
+ * Log debug information if true
31
+ *
32
+ * @since 2.12
33
+ *
34
+ * @var boolean
35
+ */
36
+ public static $mla_debug = false;
37
+
38
  /**
39
  * Generate a unique, writable file in the temporary directory
40
  *
63
  } else {
64
  $temp = '/tmp/';
65
  if ( false == @is_dir( $temp ) ) {
66
+ self::_mla_debug_add( 'Temp directory failure' );
67
  return false;
68
  }
69
  }
76
  $path = $temp . uniqid( mt_rand() ) . $extension;
77
  $f = @fopen( $path, 'a' );
78
  if ( $f === false ) {
79
+ self::_mla_debug_add( 'Temp file failure' );
80
  return false;
81
  }
82
 
111
  * Look for exec() - from http://stackoverflow.com/a/12980534/866618
112
  */
113
  if ( ini_get('safe_mode') ) {
114
+ self::_mla_debug_add( 'safe_mode failure' );
115
  return false;
116
  }
117
 
118
  $blacklist = preg_split( '/,\s*/', ini_get('disable_functions') . ',' . ini_get('suhosin.executor.func.blacklist') );
119
  if ( in_array('exec', $blacklist) ) {
120
+ self::_mla_debug_add( 'blacklist failure' );
121
  return false;
122
  }
123
 
201
  $cmd = sprintf( $cmd, $device, $resolution, ( $frame + 1 ), escapeshellarg( $output_file ), escapeshellarg( $file ) );
202
  exec( $cmd, $stdout, $return );
203
  if ( 0 != $return ) {
204
+ self::_mla_debug_add( "ERROR: _ghostscript_convert exec returned '{$return}, cmd = " . var_export( $cmd, true ) );
205
+ self::_mla_debug_add( "ERROR: _ghostscript_convert exec returned '{$return}, details = " . var_export( $stdout, true ) );
206
  return false;
207
  }
208
 
210
  self::$image->readImage( $output_file );
211
  }
212
  catch ( Exception $e ) {
213
+ self::_mla_debug_add( "ERROR: _ghostscript_convert readImage Exception = " . var_export( $e->getMessage(), true ) );
214
  return false;
215
  }
216
 
218
  return true;
219
  } // found Ghostscript
220
 
221
+ self::_mla_debug_add( 'Ghostscript detection failure' );
222
  return false;
223
  }
224
 
406
  exit();
407
  }
408
 
409
+ /**
410
+ * Log debug information
411
+ *
412
+ * @since 2.12
413
+ *
414
+ * @param string $message Error message.
415
+ */
416
+ private static function _mla_debug_add( $message ) {
417
+ if ( self::$mla_debug ) {
418
+ error_log( $message, 0);
419
+ }
420
+ }
421
+
422
  /**
423
  * Abort the operation and exit
424
  *
431
  * @return void echos page content and calls exit();
432
  */
433
  private static function _mla_die( $message, $title = '', $response = 500 ) {
434
+ self::_mla_debug_add( __LINE__ . " _mla_die( '{$message}', '{$title}', '{$response}' )" );
435
  exit();
436
  }
437
  } // Class MLAStreamImage
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.11
10
  */
11
 
12
  /*
@@ -16,7 +16,7 @@ Description: Enhances the Media Library; powerful [mla_gallery], taxonomy suppor
16
  Author: David Lingren, Fair Trade Judaica
17
  Text Domain: media-library-assistant
18
  Domain Path: /languages
19
- Version: 2.11
20
  Author URI: http://fairtradejudaica.org/our-story/staff/
21
 
22
  Copyright 2011-2014 David Lingren
6
  * will the rest of the plugin be loaded and run.
7
  *
8
  * @package Media Library Assistant
9
+ * @version 2.12
10
  */
11
 
12
  /*
16
  Author: David Lingren, Fair Trade Judaica
17
  Text Domain: media-library-assistant
18
  Domain Path: /languages
19
+ Version: 2.12
20
  Author URI: http://fairtradejudaica.org/our-story/staff/
21
 
22
  Copyright 2011-2014 David Lingren
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://fairtradejudaica.org/make-a-difference/donate/
4
  Tags: attachment, attachments, documents, gallery, image, images, media, library, media library, tag cloud, media-tags, media tags, tags, media categories, categories, IPTC, EXIF, XMP, GPS, PDF, meta, metadata, photo, photos, photograph, photographs, photoblog, photo albums, lightroom, photoshop, MIME, mime-type, icon, upload, file extensions, WPML, Polylang, multilanguage, multilingual, localization
5
  Requires at least: 3.5.0
6
  Tested up to: 4.2.2
7
- Stable tag: 2.11
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -170,6 +170,11 @@ All of the MLA source code has been annotated with "DocBlocks", a special type o
170
 
171
  == Changelog ==
172
 
 
 
 
 
 
173
  = 2.11 =
174
  * New: **Polylang support has been added.** See the [Other Notes section](http://wordpress.org/extend/plugins/media-library-assistant/other_notes/ "Click here, then scroll down") section or the Settings/Media Library Assistant Documentation tab for more information.
175
  * New: **WPML support has been enhanced.** In particular, 1) all taxonomy term assignments are verified/adjusted to be valid for the item's language, 2) taxonomy term assignments are synchronized across all the item's translations, 3) the Media/Assistant submenu table will include a "language management" column showing each item's translation status by language; you can click on an item's "pencil" or "plus" icon to edit an existing translation or duplicate the item in a new language, 4) when "All Languages" is selected, the Media/Assistant submenu table will include a "Language" column showing each item's language, and 5) the Settings/Media Library Assistant "Language" tab lets you select the enhancements you want. See the [Other Notes section](http://wordpress.org/extend/plugins/media-library-assistant/other_notes/ "Click here, then scroll down") section or the Settings/Media Library Assistant Documentation tab for more information.
@@ -288,8 +293,8 @@ All of the MLA source code has been annotated with "DocBlocks", a special type o
288
 
289
  == Upgrade Notice ==
290
 
291
- = 2.11 =
292
- Enhanced WPML and new Polylang support. "Attached" Media/Assistant table view. Eight other enhancements, fifteen fixes.
293
 
294
  == Other Notes ==
295
 
4
  Tags: attachment, attachments, documents, gallery, image, images, media, library, media library, tag cloud, media-tags, media tags, tags, media categories, categories, IPTC, EXIF, XMP, GPS, PDF, meta, metadata, photo, photos, photograph, photographs, photoblog, photo albums, lightroom, photoshop, MIME, mime-type, icon, upload, file extensions, WPML, Polylang, multilanguage, multilingual, localization
5
  Requires at least: 3.5.0
6
  Tested up to: 4.2.2
7
+ Stable tag: 2.12
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
170
 
171
  == Changelog ==
172
 
173
+ = 2.12 =
174
+ * New: For `[mla_gallery]` and `[mla_tag_cloud]`, the `mla_debug=log` parameter writes debug information to the error log instead of the page or post containing the shortcode.
175
+ * New: On the Settings/Media Library Assistant Debug tab, a new option lets you limit the amount of error log content displayed in the text area.
176
+ * Fix: For `[mla_gallery]`, **a defect in the default template's caption processing** (using the "captiontag_content" attachment-specific substitution parameter) has been corrected. The defect caused improper handling of the `mla_caption` parameter in some cases.
177
+
178
  = 2.11 =
179
  * New: **Polylang support has been added.** See the [Other Notes section](http://wordpress.org/extend/plugins/media-library-assistant/other_notes/ "Click here, then scroll down") section or the Settings/Media Library Assistant Documentation tab for more information.
180
  * New: **WPML support has been enhanced.** In particular, 1) all taxonomy term assignments are verified/adjusted to be valid for the item's language, 2) taxonomy term assignments are synchronized across all the item's translations, 3) the Media/Assistant submenu table will include a "language management" column showing each item's translation status by language; you can click on an item's "pencil" or "plus" icon to edit an existing translation or duplicate the item in a new language, 4) when "All Languages" is selected, the Media/Assistant submenu table will include a "Language" column showing each item's language, and 5) the Settings/Media Library Assistant "Language" tab lets you select the enhancements you want. See the [Other Notes section](http://wordpress.org/extend/plugins/media-library-assistant/other_notes/ "Click here, then scroll down") section or the Settings/Media Library Assistant Documentation tab for more information.
293
 
294
  == Upgrade Notice ==
295
 
296
+ = 2.12 =
297
+ Fixes a defect in [mla_gallery] handling of the mla_caption parameter. Adds mla_debug=log option.
298
 
299
  == Other Notes ==
300
 
tpls/documentation-settings-tab.tpl CHANGED
@@ -901,6 +901,9 @@ In general you won't need these, since adding to the cache is the right thing to
901
  <h4>Debugging Output</h4>
902
  <p>
903
  The "mla_debug" parameter controls the display of information about the query parameters and SQL statements used to retrieve gallery items. If you code <code>mla_debug=true</code> you will see a lot of information added to the post or page containing the gallery. Of course, this parameter should <strong><em>ONLY</em></strong> be used in a development/debugging environment; it's quite ugly.
 
 
 
904
  <a name="mla_gallery_hooks"></a>
905
  </p>
906
  <h4>MLA Gallery Filters and Actions (Hooks)</h4>
@@ -1283,6 +1286,9 @@ The order parameter (default ASC) can give an ASC/DESC default for any value tha
1283
  <h4>Debugging Output</h4>
1284
  <p>
1285
  The "mla_debug" parameter controls the display of information about the query parameters and SQL statements used to retrieve tag cloud items. If you code <code>mla_debug=true</code> you will see a lot of information added to the post or page containing the cloud. Of course, this parameter should <strong><em>ONLY</em></strong> be used in a development/debugging environment; it's quite ugly.
 
 
 
1286
  <a name="tag_cloud_substitution"></a>
1287
  </p>
1288
  <h4>Tag Cloud Substitution Parameters</h4>
901
  <h4>Debugging Output</h4>
902
  <p>
903
  The "mla_debug" parameter controls the display of information about the query parameters and SQL statements used to retrieve gallery items. If you code <code>mla_debug=true</code> you will see a lot of information added to the post or page containing the gallery. Of course, this parameter should <strong><em>ONLY</em></strong> be used in a development/debugging environment; it's quite ugly.
904
+ </p>
905
+ <p>
906
+ If you code <code>mla_debug=log</code> all of the information will be written to the error log. You can use the <a href="#mla_debug_tab">MLA Debug Tab</a> to view and download the information in the error log.
907
  <a name="mla_gallery_hooks"></a>
908
  </p>
909
  <h4>MLA Gallery Filters and Actions (Hooks)</h4>
1286
  <h4>Debugging Output</h4>
1287
  <p>
1288
  The "mla_debug" parameter controls the display of information about the query parameters and SQL statements used to retrieve tag cloud items. If you code <code>mla_debug=true</code> you will see a lot of information added to the post or page containing the cloud. Of course, this parameter should <strong><em>ONLY</em></strong> be used in a development/debugging environment; it's quite ugly.
1289
+ </p>
1290
+ <p>
1291
+ If you code <code>mla_debug=log</code> all of the information will be written to the error log. You can use the <a href="#mla_debug_tab">MLA Debug Tab</a> to view and download the information in the error log.
1292
  <a name="tag_cloud_substitution"></a>
1293
  </p>
1294
  <h4>Tag Cloud Substitution Parameters</h4>