Media Library Assistant - Version 2.82

Version Description

  • New: For the "MLA Insert Fixit" example plugin, new "Figure Caption" tools let you add or replace <figcaption> values for items and galleries in the body of a post/page.
  • New: For the "MLA Insert Fixit" example plugin, a new "Item fields to parent" tool lets you copy custom field values from attached items to their parent post/page.
  • New: For the "MLA Insert Fixit" example plugin, allow multiple taxonomy pairs for the "Item terms to parent" and "Parent terms to item" tools.
  • New: For the [mla_gallery] shortcode Taxonomy term keyword(s) search, a new whole_word=true parameter requires each entered word to match an entire word in the term name, e.g., entering "man" (without the quotes) will not match a portion of "woman" in the term name.
  • New: For the "MLA tax query Example" plugin, multiple taxonomies are allowed in my_custom_sql and a new tax_operator parameter within my_custom_sql supports "AND" to require a match on all of the terms in the taxonomy parameters..
  • New: For the "WooCommerce Fixit Tools" example plugin, new "Populate Product from Product Image" tool updates Product values from the Product Image.
  • New: For the "MLA Insert Fixit" example plugin, allow custom post types for the "Copy ALT Text between Media Library items and Post/Page inserts" tools.
  • Fix: For [mla_gallery], when mla_alt_ids_value is used the style template, gallery open and row open HTML markup is no longer generated. Only the output of the alternate shortcode is echoed to the browser.
  • Fix: For the Media Manager Modal (popup) Window, toolbar controls no longer overflow into the Attachmenta area..
  • Fix: For the Media Manager Modal (popup) Window, "Filter media" selections, e.g., search box contents, persist for two or more "Media Library" invocations on a post/page.
  • Fix: Corrected Chrome & Firefox issue with "Search Box" checkbox control changes not being recorded.
  • Fix: Corrected PHP 7.4 issue with deprecated curly braces in class-mla-data.php and class-mla-data-query.php.
  • Fix: For "MLA Gallery in" (where-used) reporting, shortcodes using the enclosing shortcode syntax are now included in the results.
  • Fix: For "search" text boxes in all Settings/Media Library Assistant tabs, properly escape values to prevent Reflected Cross Site Scripting attacks.
  • Fix: For [mla_gallery] link=download, restrict downloads to the WordPress Uploads directory subtree to prevent Local File Disclosure attacks. The old file downloader has been replaced by an AJAX-based WordPress request.
  • Fix: For [mla_gallery], validate content of tax_query, meta_query and date_query parameters to prevent Remote Code Execution attacks.
  • Fix: For the "MLA UI Elements Example" plugin, correct parameter handling defects in [mla_term_list] handler.
  • Fix: For WordPress 5.3+ "big image" handling, use the "original image" for sourcing IPTC/EXIF/XMP metadata, not the "scaled" image.
Download this release

Release Info

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

Code changes from version 2.81 to 2.82

css/mla-media-modal-style.css CHANGED
@@ -10,6 +10,7 @@
10
 
11
  .attachments-browser .media-toolbar {
12
  overflow: visible;
 
13
  }
14
 
15
  .attachments-browser .media-toolbar .media-toolbar-secondary {
10
 
11
  .attachments-browser .media-toolbar {
12
  overflow: visible;
13
+ height: auto;
14
  }
15
 
16
  .attachments-browser .media-toolbar .media-toolbar-secondary {
examples/plugins/mla-insert-fixit.php CHANGED
@@ -36,8 +36,16 @@
36
  * opened on 1/28/2019 by "scubarob"
37
  * https://wordpress.org/support/topic/updating-decsription-and-alternative-text-for-image-already-linked-to-a-post/
38
  *
 
 
 
 
 
 
 
 
39
  * @package Insert Fixit
40
- * @version 1.12
41
  */
42
 
43
  /*
@@ -45,10 +53,10 @@ Plugin Name: MLA Insert Fixit
45
  Plugin URI: http://davidlingren.com/
46
  Description: Synchronizes Media Library values to and from post/page inserted/featured/attached images
47
  Author: David Lingren
48
- Version: 1.12
49
  Author URI: http://davidlingren.com/
50
 
51
- Copyright 2015-2019 David Lingren
52
 
53
  This program is free software; you can redistribute it and/or modify
54
  it under the terms of the GNU General Public License as published by
@@ -78,7 +86,7 @@ class Insert_Fixit {
78
  *
79
  * @var string
80
  */
81
- const CURRENT_VERSION = '1.12';
82
 
83
  /**
84
  * Slug prefix for registering and enqueueing submenu pages, style sheets and scripts
@@ -171,7 +179,7 @@ class Insert_Fixit {
171
  * @return void Echoes HTML markup for the submenu page
172
  */
173
  public static function render_tools_page() {
174
- //error_log( __LINE__ . ' Insert_Fixit::render_tools_page() $_REQUEST = ' . var_export( $_REQUEST, true ), 0 );
175
  if ( !current_user_can( 'manage_options' ) ) {
176
  echo "Insert Fixit - Error</h2>\n";
177
  wp_die( 'You do not have permission to manage plugin settings.' );
@@ -186,13 +194,19 @@ class Insert_Fixit {
186
  $attachment_lower = isset( $_REQUEST[ self::SLUG_PREFIX . 'attachment_lower' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'attachment_lower' ] : '';
187
  $old_attachment_upper = isset( $_REQUEST[ self::SLUG_PREFIX . 'old_attachment_upper' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'old_attachment_upper' ] : '';
188
  $attachment_upper = isset( $_REQUEST[ self::SLUG_PREFIX . 'attachment_upper' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'attachment_upper' ] : '';
 
 
 
189
 
190
- // Post/Page Insert Image Tag Attribute Modification
191
  $old_data_source = isset( $_REQUEST[ self::SLUG_PREFIX . 'old_data_source' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'old_data_source' ] : '';
192
  $data_source = isset( $_REQUEST[ self::SLUG_PREFIX . 'data_source' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'data_source' ] : '[+alt_text+]';
193
  $old_attribute_name = isset( $_REQUEST[ self::SLUG_PREFIX . 'old_attribute_name' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'old_attribute_name' ] : '';
194
  $attribute_name = isset( $_REQUEST[ self::SLUG_PREFIX . 'attribute_name' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'attribute_name' ] : 'data-pin-description';
195
 
 
 
 
196
  // Attach Media Library items
197
  self::$attach_all = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_ATTACH_ALL ] ) ? true : false;
198
  $attach_all_attr = self::$attach_all ? ' checked="checked" ' : ' ';
@@ -212,18 +226,33 @@ class Insert_Fixit {
212
  $item_taxonomy = isset( $_REQUEST[ self::SLUG_PREFIX . 'item_taxonomy' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'item_taxonomy' ] : 'attachment_tag';
213
  $parent_taxonomy = isset( $_REQUEST[ self::SLUG_PREFIX . 'parent_taxonomy' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'parent_taxonomy' ] : 'post_tag';
214
 
 
 
 
 
 
 
 
215
  $setting_actions = array(
216
  'help' => array( 'handler' => '', 'comment' => '<strong>Enter first and (optional) last ID values above to restrict tool application range</strong>. To operate on one ID, enter just the "First ID". The default is to perform the operation on <strong>all posts/pages</strong> and <strong>all Media Library items (attachments)</strong>.<br />&nbsp;<br />You can find post/page ID values by hovering over the post/page title in the "Title" column of the All Posts/All Pages submenu tables; look for the number following <code>post=</code>.<br />' ),
217
  'warning' => array( 'handler' => '', 'comment' => '<strong>These tools make permanent updates to your database.</strong> Make a backup before you use the tools so you can restore your old values if you don&rsquo;t like the results.' ),
218
 
219
  'c00' => array( 'handler' => '', 'comment' => '<h3>Copy ALT Text between Media Library items and Post/Page inserts</h3>' ),
 
 
 
 
 
 
 
 
220
  'ALT from Item' => array( 'handler' => '_copy_alt_from_media_library',
221
  'comment' => 'Copy ALT Text from Media Library item to Post/Page inserts.' ),
222
  'ALT to Item' => array( 'handler' => '_copy_alt_to_media_library',
223
  'comment' => 'Copy ALT Text from Post/Page inserts to Media Library item' ),
224
- 'c01' => array( 'handler' => '', 'comment' => '<hr>' ),
225
- 'c02' => array( 'handler' => '', 'comment' => '<h3>Post/Page Insert Image Tag Attribute Modification</h3>' ),
226
- 'c03' => array( 'handler' => '', 'comment' => '<strong>NOTE:</strong> Tools in this section use the Data Source and Attribute values below.' ),
227
  't0101' => array( 'open' => '<table><tr>' ),
228
  't0102' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">Data Source</td>' ),
229
  't0103' => array( 'continue' => ' <td style="text-align: left; padding-right: 20px">' ),
@@ -242,9 +271,23 @@ class Insert_Fixit {
242
  'comment' => 'Replace (or add) an HTML attribute, e.g., data-pin-description=alt_text, to Post/Page inserts.' ),
243
  'Delete Attribute' => array( 'handler' => '_delete_attribute',
244
  'comment' => 'Delete an HTML attribute, e.g., data-pin-description, from Post/Page inserts' ),
245
- 'c04' => array( 'handler' => '', 'comment' => '<hr>' ),
246
- 'c05' => array( 'handler' => '', 'comment' => '<h3>Attach Media Library items</h3>' ),
247
- 'c06' => array( 'handler' => '', 'comment' => '<strong>NOTE:</strong> By default, tools in this section operate only on <strong>unattached</strong> Media Library items.<br />&nbsp;' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  't1201' => array( 'open' => '<table><tr>' ),
249
  't1202' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle"><input name="' . self::SLUG_PREFIX . self::INPUT_ATTACH_ALL . '" type="checkbox"' . $attach_all_attr . 'value="' . self::INPUT_ATTACH_ALL . '"></td>' ),
250
  't1203' => array( 'continue' => ' <td style="text-align: left; padding-right: 5px" valign="middle">Replace existing parent</td>' ),
@@ -267,9 +310,9 @@ class Insert_Fixit {
267
  'comment' => 'Attach items to the first Post/Page for which they are the Featured Image' ),
268
  'Attach Referenced In' => array( 'handler' => '_attach_referenced_in',
269
  'comment' => 'Attach items to the first Post/Page where they appear in a "class wp-image-" or "ids=" element' ),
270
- 'c07' => array( 'handler' => '', 'comment' => '<hr>' ),
271
- 'c08' => array( 'handler' => '', 'comment' => '<h3>Copy Post/Page values to inserted Media Library items</h3>' ),
272
- 'c09' => array( 'handler' => '', 'comment' => 'This tool finds items inserted in the body of a Post or Page and composes a new Title for the items based on values in the Post/Page, adding a sequence number (<code>[+index+]</code>) to make the Title unique. The number of inserted items is available in <code>[+found_rows+]</code>.<br>&nbsp;<br><strong>NOTE:</strong> The Post to Item Title tool uses the Template value below.' ),
273
  't0201' => array( 'open' => '<table><tr>' ),
274
  't0202' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">Template</td>' ),
275
  't0203' => array( 'continue' => ' <td style="text-align: left">' ),
@@ -278,9 +321,9 @@ class Insert_Fixit {
278
  't0207' => array( 'close' => '</tr></table>' ),
279
  'Post to Item Title' => array( 'handler' => '_copy_post_values_to_items',
280
  'comment' => 'Copy "Template" value from Post/Page inserts to Media Library item' ),
281
- 'c13' => array( 'handler' => '', 'comment' => '<hr>' ),
282
- 'c14' => array( 'handler' => '', 'comment' => '<h3>Copy Parent values to attached Media Library items</h3>' ),
283
- 'c15' => array( 'handler' => '', 'comment' => 'The "Parent to Item Title" tool finds items attached to a Post or Page and composes a new Title for the items based on values in the parent Post/Page, adding a sequence number (<code>[+index+]</code>) to make the Title unique. The number of attached items is available in <code>[+found_rows+]</code>.<br>&nbsp;<br><strong>NOTE:</strong> The Parent to Item Title tool uses the Template value below.' ),
284
  't0301' => array( 'open' => '<table><tr>' ),
285
  't0302' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">Template</td>' ),
286
  't0303' => array( 'continue' => ' <td style="text-align: left">' ),
@@ -289,7 +332,7 @@ class Insert_Fixit {
289
  't0307' => array( 'close' => '</tr></table>' ),
290
  'Parent to Item Title' => array( 'handler' => '_copy_parent_values_to_items',
291
  'comment' => 'Copy "Template" value from parent Post/Page to (attached) Media Library items' ),
292
- 'c39' => array( 'handler' => '', 'comment' => '&nbsp;<br />The "Parent Terms to Item" tool finds items attached to a Post or Page and copies terms assigned to the parent to the items.<br><strong>NOTE:</strong> The Parent Terms to Item tool uses the Taxonomy name/slug values below.' ),
293
  't1401' => array( 'open' => '<table><tr>' ),
294
  't1407' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">from Parent Taxonomy</td>' ),
295
  't1408' => array( 'continue' => ' <td style="text-align: left; padding-right: 15px">' ),
@@ -308,10 +351,10 @@ class Insert_Fixit {
308
  't1418' => array( 'close' => '</tr></table>' ),
309
  'Parent Terms to Item' => array( 'handler' => '_copy_parent_terms_to_items',
310
  'comment' => 'Copy assigned terms from the parent Post/Page to attached items' ),
311
- 'c17' => array( 'handler' => '', 'comment' => '<hr>' ),
312
- 'c18' => array( 'handler' => '', 'comment' => '<h3>Copy attached Media Library item values to Parent Post/Page</h3>' ),
313
- 'c19' => array( 'handler' => '', 'comment' => 'This tool finds items attached to a Post or Page and copies terms assigned to the items to the parent.' ),
314
- 'c16' => array( 'handler' => '', 'comment' => '<br><strong>NOTE:</strong> The Item Terms to Parent tool uses the Taxonomy name/slug values below.' ),
315
  't0401' => array( 'open' => '<table><tr>' ),
316
  't0402' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">from Item Taxonomy</td>' ),
317
  't0403' => array( 'continue' => ' <td style="text-align: left; padding-right: 15px">' ),
@@ -330,9 +373,27 @@ class Insert_Fixit {
330
  't0418' => array( 'close' => '</tr></table>' ),
331
  'Item Terms to Parent' => array( 'handler' => '_copy_item_terms_to_parent',
332
  'comment' => 'Copy assigned terms from attached items to the parent Post/Page' ),
333
- 'c10' => array( 'handler' => '', 'comment' => '<hr>' ),
334
- 'c11' => array( 'handler' => '', 'comment' => '<h3>Refresh Caches</h3>' ),
335
- 'c12' => array( 'handler' => '', 'comment' => 'If you have a large number of posts/pages and/or Media Library items you can use the cache refresh operation to break up processing into smaller steps. Try clicking the "Refresh Caches" button to build these intermediate data structures and save them in the WordPress cache for fifteen minutes. That will make the "Copy", "Modification" and "Attach" operations above go quicker.<br>&nbsp;' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  'Refresh Caches' => array( 'handler' => '_refresh_caches',
337
  'comment' => 'rebuild arrays and save in cache for fifteen minutes' ),
338
  );
@@ -360,10 +421,9 @@ class Insert_Fixit {
360
  }
361
  }
362
 
363
- /*
364
- * Invalidate the caches if anything has changed
365
- */
366
- if ( $old_post_lower !== $post_lower || $old_post_upper !== $post_upper || $old_attachment_lower !== $attachment_lower || $old_attachment_upper !== $attachment_upper || $old_data_source !== $data_source || $old_attribute_name !== $attribute_name ) {
367
  delete_transient( self::SLUG_PREFIX . 'image_inserts' );
368
  delete_transient( self::SLUG_PREFIX . 'image_objects' );
369
  }
@@ -536,7 +596,7 @@ class Insert_Fixit {
536
  if ( $use_cache ) {
537
  self::$image_inserts = get_transient( self::SLUG_PREFIX . 'image_inserts' );
538
  if ( is_array( self::$image_inserts ) ) {
539
- //error_log( __LINE__ . " Insert_Fixit::_build_image_inserts_cache using cached self::\$image_inserts " . var_export( self::$image_inserts, true ), 0 );
540
  return 'Using cached image inserts with ' . count( self::$image_inserts ) . ' post/page elements.';
541
  }
542
  }
@@ -558,22 +618,31 @@ class Insert_Fixit {
558
  $upper_bound = 0x7FFFFFFF;
559
  }
560
 
561
- $query = sprintf( 'SELECT ID, post_content FROM %1$s WHERE ( post_type IN ( \'post\', \'page\' ) AND ( post_status = \'publish\' ) AND ( ID >= %2$d ) AND ( ID <= %3$d ) AND ( post_content LIKE \'%4$s\' ) ) ORDER BY ID', $wpdb->posts, $lower_bound, $upper_bound, '%<img%' );
 
 
 
 
 
 
 
 
562
  $results = $wpdb->get_results( $query );
563
- //error_log( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $results = ' . var_export( $results, true ), 0 );
564
 
565
  $upload_dir = wp_upload_dir();
566
- //error_log( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $upload_dir = ' . var_export( $upload_dir, true ), 0 );
567
  $upload_dir = $upload_dir['baseurl'] . '/';
568
  $site_url = get_site_url();
569
- //error_log( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $site_url = ' . var_export( $site_url, true ), 0 );
570
  $upload_subdir = str_replace( $site_url, '', $upload_dir );
571
- //error_log( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $upload_subdir = ' . var_export( $upload_subdir, true ), 0 );
572
 
573
  $image_inserts = array();
574
  foreach ( $results as $result ) {
575
- $match_count = preg_match_all( '/\<img .*(src="([^"]*)")[^\>]*\>/', $result->post_content, $matches, PREG_OFFSET_CAPTURE );
576
- //error_log( __LINE__ . " Insert_Fixit::_build_image_inserts_cache( {$result->ID} ) \$matches = " . var_export( $matches, true ), 0 );
 
577
  if ( $match_count ) {
578
  $image_inserts[ $result->ID ]['content'] = $result->post_content;
579
 
@@ -600,7 +669,7 @@ class Insert_Fixit {
600
  // alt= value if present
601
  foreach ( $image_inserts[ $result->ID ]['inserts'] as $index => $insert ) {
602
  $match_count = preg_match( '/alt="([^"]*)"/', $insert['img'], $matches, PREG_OFFSET_CAPTURE );
603
- //error_log( __LINE__ . " Insert_Fixit::_build_image_inserts_cache( {$result->ID} ) \$matches = " . var_export( $matches, true ), 0 );
604
  if ( $match_count ) {
605
  $image_inserts[ $result->ID ]['inserts'][ $index ]['alt'] = $matches[1][0];
606
  $image_inserts[ $result->ID ]['inserts'][ $index ]['alt_offset'] = $insert['img_offset'] + $matches[1][1];
@@ -613,12 +682,146 @@ class Insert_Fixit {
613
 
614
  $return = set_transient( self::SLUG_PREFIX . 'image_inserts', $image_inserts, 900 ); // fifteen minutes
615
  //error_log( __LINE__ . " Insert_Fixit::_build_image_inserts_cache set_transient return = " . var_export( $return, true ), 0 );
616
- //error_log( __LINE__ . " Insert_Fixit::_build_image_inserts_cache self::\$image_inserts " . var_export($image_inserts, true ), 0 );
617
  self::$image_inserts = $image_inserts;
618
 
 
619
  return 'Image inserts cache refreshed with ' . count( self::$image_inserts ) . ' post/page elements.';
620
  } // _build_image_inserts_cache
621
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
622
  /**
623
  * Array of attachment IDs giving post_parent and Featured Image post/page IDs:
624
  * attachment ID => array( 'parent' => post_parent, post/page IDs => post/page IDs )
@@ -646,7 +849,7 @@ class Insert_Fixit {
646
  if ( $use_cache ) {
647
  self::$featured_objects = get_transient( self::SLUG_PREFIX . 'featured_objects' );
648
  if ( is_array( self::$featured_objects ) ) {
649
- //error_log( __LINE__ . " Insert_Fixit::_build_featured_objects_cache using cached self::\$featured_objects " . var_export( self::$featured_objects, true ), 0 );
650
  return 'Using cached featured objects with ' . count( self::$featured_objects ) . ' attachment elements.';
651
  }
652
  }
@@ -681,9 +884,9 @@ class Insert_Fixit {
681
  $query[] = "AND ( ID >= {$lower_bound} ) AND ( ID <= {$upper_bound} ) ) ORDER BY ID ) AS p ON m.meta_value = p.ID";
682
  $query[] = "WHERE m.meta_key = '_thumbnail_id'";
683
  $query = implode( ' ', $query );
684
- //error_log( __LINE__ . ' Insert_Fixit::_build_featured_objects_cache() $query = ' . var_export( $query, true ), 0 );
685
  $results = $wpdb->get_results( $query );
686
- //error_log( __LINE__ . ' Insert_Fixit::_build_featured_objects_cache() $results = ' . var_export( $results, true ), 0 );
687
 
688
  $references = array();
689
  if ( is_array( $results ) ) {
@@ -704,7 +907,7 @@ class Insert_Fixit {
704
 
705
  $return = set_transient( self::SLUG_PREFIX . 'featured_objects', $references, 900 ); // fifteen minutes
706
  //error_log( __LINE__ . " Insert_Fixit::_build_featured_objects_cache set_transient return = " . var_export( $return, true ), 0 );
707
- //error_log( __LINE__ . " Insert_Fixit::_build_featured_objects_cache references = " . var_export( $references, true ), 0 );
708
  self::$featured_objects = $references;
709
 
710
  return 'Featured objects cache refreshed with ' . count( self::$featured_objects ) . ' attachment elements.';
@@ -737,7 +940,7 @@ class Insert_Fixit {
737
  if ( $use_cache ) {
738
  self::$item_references = get_transient( self::SLUG_PREFIX . 'item_references' );
739
  if ( is_array( self::$item_references ) ) {
740
- //error_log( __LINE__ . " Insert_Fixit::_build_item_references_cache using cached self::\$item_references " . var_export( self::$item_references, true ), 0 );
741
  return 'Using cached item references with ' . count( self::$item_references ) . ' attachment elements.';
742
  }
743
  }
@@ -759,15 +962,23 @@ class Insert_Fixit {
759
  $upper_bound = 0x7FFFFFFF;
760
  }
761
 
762
- $query = sprintf( 'SELECT ID, post_content FROM %1$s WHERE ( post_type IN ( \'post\', \'page\' ) AND ( post_status = \'publish\' ) AND ( ID >= %2$d ) AND ( ID <= %3$d ) AND ( ( post_content LIKE \'%4$s\' ) OR ( post_content LIKE \'%5$s\' ) ) ) ORDER BY ID', $wpdb->posts, $lower_bound, $upper_bound, '%wp-image-%', '%ids=%' );
 
 
 
 
 
 
 
 
763
  $results = $wpdb->get_results( $query );
764
- //error_log( __LINE__ . ' Insert_Fixit::_build_item_references_cache() $results = ' . var_export( $results, true ), 0 );
765
 
766
  self::$item_references = array();
767
  foreach ( $results as $result ) {
768
  // Find the class="wp-image-" references
769
  $match_count = preg_match_all( '/wp-image-([0-9]{1,6})/', $result->post_content, $matches );
770
- //error_log( __LINE__ . " Insert_Fixit::_build_item_references_cache( {$result->ID} ) \$matches = " . var_export( $matches, true ), 0 );
771
  if ( $match_count ) {
772
  foreach ( $matches[1] as $match ) {
773
  self::$item_references[ absint( $match ) ][ absint( $result->ID ) ] = absint( $result->ID );
@@ -776,7 +987,7 @@ class Insert_Fixit {
776
 
777
  // Find the ids= references
778
  $match_count = preg_match_all( '/(\[gallery|\[mla_gallery)[^\]]*ids=([0-9,\\\'\"]*)/', $result->post_content, $matches );
779
- //error_log( __LINE__ . " Insert_Fixit::_build_item_references_cache( {$result->ID} ) \$matches = " . var_export( $matches, true ), 0 );
780
  if ( $match_count ) {
781
  foreach ( $matches[2] as $match ) {
782
  $items = explode( ',', trim( $match, '\'"' ) );
@@ -788,9 +999,9 @@ class Insert_Fixit {
788
  }
789
 
790
  $return = set_transient( self::SLUG_PREFIX . 'item_references', self::$item_references, 900 ); // fifteen minutes
791
- //error_log( __LINE__ . " Insert_Fixit::_build_item_references_cache set_transient return = " . var_export( $return, true ), 0 );
792
- //error_log( __LINE__ . " Insert_Fixit::_build_item_references_cache self::\$item_references " . var_export( self::$item_references, true ), 0 );
793
 
 
794
  return 'Item references cache refreshed with ' . count( self::$item_references ) . ' items referenced in ' . count( $results ) . ' post/page elements.';
795
  } // _build_item_references_cache
796
 
@@ -827,7 +1038,7 @@ class Insert_Fixit {
827
  if ( $use_cache ) {
828
  self::$image_objects = get_transient( self::SLUG_PREFIX . 'image_objects' );
829
  if ( is_array( self::$image_objects ) ) {
830
- //error_log( __LINE__ . " Insert_Fixit::_build_image_objects_cache using cached self::\$image_objects " . var_export( self::$image_objects, true ), 0 );
831
  return 'Using cached image objects with ' . count( self::$image_objects ) . ' attachment elements.';
832
  }
833
  }
@@ -856,8 +1067,9 @@ class Insert_Fixit {
856
  }
857
 
858
  $query = sprintf( 'SELECT ID, post_parent FROM %1$s WHERE ( ( post_type = \'attachment\' ) %2$s AND ( ID >= %3$d ) AND ( ID <= %4$d ) ) ORDER BY ID', $wpdb->posts, $where, $lower_bound, $upper_bound );
 
859
  $results = $wpdb->get_results( $query );
860
- //error_log( __LINE__ . ' Insert_Fixit::_build_image_objects_cache() $results = ' . var_export( $results, true ), 0 );
861
 
862
  // Load the image_inserts array
863
  self::_build_image_inserts_cache( true );
@@ -888,7 +1100,7 @@ class Insert_Fixit {
888
  }
889
 
890
  $sizes = isset( $attachment_metadata['sizes'] ) ? $attachment_metadata['sizes'] : NULL;
891
- //error_log( __LINE__ . " Insert_Fixit::_array_image_inserts_references( {$result->ID} ) sizes = " . var_export( $sizes, true ), 0 );
892
  if ( ! empty( $sizes ) && is_array( $sizes ) ) {
893
  // Using the path and name as the array key ensures each name is added only once
894
  foreach ( $sizes as $size => $size_info ) {
@@ -900,7 +1112,7 @@ class Insert_Fixit {
900
  //$files[ $path . $base_file ] = $path . $base_file;
901
  $files[ $base_file ] = $base_file;
902
  }
903
- //error_log( __LINE__ . " Insert_Fixit::_array_image_inserts_references( {$result->ID} ) files = " . var_export( $files, true ), 0 );
904
 
905
  /*
906
  * inserts Array of specific files (i.e., sizes) found in one or more posts/pages
@@ -910,9 +1122,9 @@ class Insert_Fixit {
910
  $inserts = array();
911
 
912
  foreach( $files as $file ) {
913
- //error_log( __LINE__ . " Insert_Fixit::_array_image_inserts_references( {$result->ID} ) file = " . var_export( $file, true ), 0 );
914
  foreach ( self::$image_inserts as $insert_id => $value ) {
915
- //error_log( __LINE__ . " Insert_Fixit::_array_image_inserts_references( {$insert_id} ) value = " . var_export( $value, true ), 0 );
916
  if ( in_array( $file, $value['files'] ) ) {
917
  $inserts[ $insert_id ][] = $file;
918
  }
@@ -935,10 +1147,10 @@ class Insert_Fixit {
935
  } // each result
936
 
937
  $return = set_transient( self::SLUG_PREFIX . 'image_objects', $references, 900 ); // fifteen minutes
938
- //error_log( __LINE__ . " Insert_Fixit::_build_image_objects_cache set_transient return = " . var_export( $return, true ), 0 );
939
- //error_log( __LINE__ . " Insert_Fixit::_build_image_objects_cache self::\$image_objects = " . var_export( $references, true ), 0 );
940
  self::$image_objects = $references;
941
 
 
942
  return 'Image objects cache refreshed with ' . count( self::$image_objects ) . ' attachment elements.';
943
  } // _build_image_objects_cache
944
 
@@ -987,6 +1199,8 @@ class Insert_Fixit {
987
  *
988
  * @since 1.02
989
  *
 
 
990
  * @return string HTML markup for results/messages
991
  */
992
  private static function _evaluate_add_attribute( $operation = 'Add' ) {
@@ -1166,12 +1380,12 @@ class Insert_Fixit {
1166
  $inserts = self::$image_inserts[ $post_id ];
1167
  foreach ( $files as $file ) {
1168
  foreach ( $inserts['inserts'] as $insert ) {
1169
- //error_log( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library file test '{$file}' == " . var_export( $insert['src'], true ), 0 );
1170
  if ( $file != $insert['src'] || ! isset( $insert['alt'] ) ) {
1171
  continue;
1172
  }
1173
 
1174
- //error_log( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library ALT text test '{$alt_text}' == " . var_export( $insert['alt'], true ), 0 );
1175
  if ( $alt_text == $insert['alt'] ) {
1176
  continue;
1177
  }
@@ -1188,21 +1402,23 @@ class Insert_Fixit {
1188
  $replacements = $inserts['replacements'];
1189
  if ( ! empty( $replacements ) ) {
1190
  krsort( $replacements );
1191
- //error_log( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library( {$post_id} ) replacements = " . var_export( $replacements, true ), 0 );
1192
  $post_content = $inserts['content'];
1193
  foreach ( $replacements as $offset => $replacement ) {
1194
  $post_content = substr_replace( $post_content, $replacement['text'], $offset, $replacement['length'] );
1195
  $updates++;
1196
  } // foreach replacement
1197
- //error_log( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library( {$post_id} ) new post_content = " . var_export( $post_content, true ), 0 );
1198
  $new_content = array( 'ID' => $post_id, 'post_content' => $post_content );
 
1199
  $result = wp_update_post( $new_content, true );
1200
- //error_log( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library( {$post_id} ) update result = " . var_export( $result, true ), 0 );
1201
  if ( is_wp_error( $result ) ) {
1202
  $errors++;
1203
  }
1204
  $updated_posts++;
1205
- } // has replacements
 
 
1206
  } // foreach post/page
1207
 
1208
  /*
@@ -1320,6 +1536,126 @@ class Insert_Fixit {
1320
  return self::_evaluate_add_attribute( 'Delete' );
1321
  } // _delete_attribute
1322
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1323
  /**
1324
  * Attach items to the first Post/Page they are inserted in
1325
  *
@@ -1412,7 +1748,7 @@ class Insert_Fixit {
1412
  private static function _attach_referenced_in() {
1413
  // Load the self::$item_references array
1414
  self::_build_item_references_cache( true );
1415
-
1416
  // Initialize statistics
1417
  $reference_count = 0;
1418
  $referenced_items = 0;
@@ -1428,7 +1764,7 @@ class Insert_Fixit {
1428
  if ( NULL === $attachment ) {
1429
  continue;
1430
  }
1431
-
1432
  if ( !self::$attach_all && $attachment->post_parent ) {
1433
  $skipped++;
1434
  continue;
@@ -1600,28 +1936,43 @@ class Insert_Fixit {
1600
  private static function _copy_parent_terms_to_items() {
1601
  self::_build_attached_items_cache();
1602
 
1603
- $item_taxonomy = isset( $_REQUEST[ self::SLUG_PREFIX . 'to_item_taxonomy' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'to_item_taxonomy' ] : 'attachment_category';
1604
- $parent_taxonomy = isset( $_REQUEST[ self::SLUG_PREFIX . 'from_parent_taxonomy' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'from_parent_taxonomy' ] : 'category';
1605
  $append = 'add' === ( isset( $_REQUEST[ self::SLUG_PREFIX . 'item_add_replace' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'item_add_replace' ] : 'add' );
1606
 
1607
- $attached_parents = count( self::$attached_items );
1608
- $attached_items = 0;
1609
- $updated_parents = 0;
1610
- $skipped = 0;
1611
- $errors = 0;
1612
 
1613
- $taxonomies = get_object_taxonomies( 'attachment', 'objects' );
1614
- //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items attachment taxonomies = " . var_export( $taxonomies, true ), 0 );
 
 
 
 
 
 
 
1615
 
1616
- if ( ! isset( $taxonomies[ $item_taxonomy ] ) ) {
1617
- return "ERROR - Item Taxonomy \"$item_taxonomy\" not valid for post_type \"attachment\".";
 
 
 
 
1618
  }
 
1619
 
1620
- $item_is_hierarchical = $taxonomies[ $item_taxonomy ]->hierarchical;
 
 
 
 
1621
 
1622
  $skipped_messages = array();
1623
  $parent_taxonomies = array();
1624
  foreach ( self::$attached_items as $post_id => $attachments ) {
 
 
1625
  // get the post/page object
1626
  $post = get_post( $post_id );
1627
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items attachment post = " . var_export( $post, true ), 0 );
@@ -1636,94 +1987,95 @@ class Insert_Fixit {
1636
  $taxonomies = $parent_taxonomies[ $post->post_type ];
1637
  } else {
1638
  $taxonomies = $parent_taxonomies[ $post->post_type ] = get_object_taxonomies( $post, 'objects' );
 
1639
  }
1640
 
1641
- if ( ! isset( $taxonomies[ $parent_taxonomy ] ) ) {
1642
- $skipped_messages[ $parent_taxonomy . $post->post_type ] = array( 'taxonomy' => $parent_taxonomy, 'post_type' => $post->post_type );
1643
- $skipped++;
1644
- continue;
1645
- }
1646
- //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items taxonomies = " . var_export( $taxonomies, true ), 0 );
1647
- //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items parent_taxonomies = " . var_export( $parent_taxonomies, true ), 0 );
1648
 
1649
- $parent_terms = wp_get_object_terms( $post_id, $parent_taxonomy );
1650
- $term_map = array();
1651
- $item_terms = array();
 
 
1652
 
1653
- // If both taxonomies are hiearchical we must add parent term(s) before adding item terms
1654
- if ( $item_is_hierarchical && $taxonomies[ $parent_taxonomy ]->hierarchical ) {
1655
- $ancestors = array();
1656
- foreach ( $parent_terms as $term ) {
1657
- $level = 0;
1658
- while ( $term->parent ) {
1659
- $term = get_term( $term->parent, $parent_taxonomy );
1660
- $ancestors[ $level++ ][ $term->term_id ] = $term;
 
 
 
 
 
1661
  }
1662
- }
1663
 
1664
- krsort( $ancestors, SORT_NUMERIC );
1665
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items ancestors = " . var_export( $ancestors, true ), 0 );
1666
 
1667
- foreach ( $ancestors as $level => $terms ) {
1668
- foreach ( $terms as $term_id => $term ) {
1669
- $ancestor = get_term_by( 'name', $term->name, $item_taxonomy );
1670
- if ( false !== $ancestor ) {
1671
- $term_map[ $term->term_id ] = $ancestor->term_id;
1672
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items( $level, $term->term_id ) found ancestor = " . var_export( $ancestor, true ), 0 );
1673
- } else {
1674
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items( $level, $term->term_id ) inserting = " . var_export( $term, true ), 0 );
1675
- if ( $term->parent && !empty( $term_map[ $term->parent ] ) ) {
1676
- $ancestor = wp_insert_term( $term->name, $item_taxonomy, array( 'parent' => $term_map[ $term->parent ] ) );
1677
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items child ancestor = " . var_export( $ancestor, true ), 0 );
1678
- } else {
1679
- $ancestor = wp_insert_term( $term->name, $item_taxonomy );
1680
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items root ancestor = " . var_export( $ancestor, true ), 0 );
 
 
 
 
1681
  }
1682
- if ( ( ! is_wp_error( $ancestor ) ) && isset( $ancestor['term_id'] ) ) {
1683
- $term_map[ $term->term_id ] = (integer) $ancestor['term_id'];
1684
- }
1685
- }
1686
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items updated term_map = " . var_export( $term_map, true ), 0 );
1687
- } // foreach term
1688
- } // foreach level
1689
- }
1690
 
1691
- foreach ( $parent_terms as $term ) {
1692
- if ( $item_is_hierarchical ) {
1693
- $item_term = term_exists( $term->name, $item_taxonomy );
1694
 
1695
- if ( $item_term !== 0 && $item_term !== NULL ) {
1696
- $item_terms[ $item_term['term_id'] ] = (integer) $item_term['term_id'];
1697
- } else {
1698
- if ( $term->parent && !empty( $term_map[ $term->parent ] ) ) {
1699
- $item_term = wp_insert_term( $term->name, $item_taxonomy, array( 'parent' => $term_map[ $term->parent ] ) );
1700
- //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items child item_term = " . var_export( $item_term, true ), 0 );
1701
  } else {
1702
- $item_term = wp_insert_term( $term->name, $item_taxonomy );
 
 
 
 
1703
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items root item_term = " . var_export( $item_term, true ), 0 );
1704
- }
1705
 
1706
- if ( ( ! is_wp_error( $item_term ) ) && isset( $item_term['term_id'] ) ) {
1707
- $item_terms[ $item_term['term_id'] ] = (integer) $item_term['term_id'];
 
1708
  }
 
 
1709
  }
1710
- } else {
1711
- $item_terms[ $term->term_taxonomy_id ] = $term->name;
1712
  }
1713
- }
1714
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items( {$post_id} ) item_terms = " . var_export( $item_terms, true ), 0 );
1715
 
1716
- foreach ( $attachments as $sequence => $attachment_id ) {
1717
- $attached_items++;
1718
-
1719
- $result = wp_set_object_terms( $attachment_id, $item_terms, $item_taxonomy, $append );
1720
- if ( is_array( $result) ) {
1721
- $updated_parents++;
1722
- } else {
1723
- $errors++;
1724
- }
1725
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items( {$post_id}, {$attachment_id}, {$append} ) result = " . var_export( $result, true ), 0 );
1726
- } // foreach attachment
 
1727
  } // foreach post
1728
 
1729
  $messages = '';
@@ -1734,9 +2086,9 @@ class Insert_Fixit {
1734
  }
1735
 
1736
  // Flush the Media/Edit Taxonomy Attachments column cache; see MLAObjects in class-mla-objects.php
1737
- delete_transient( MLA_OPTION_PREFIX . 't_term_counts_' . $item_taxonomy, $terms );
1738
 
1739
- return $messages . "<br>Item Terms to Parent matched {$attached_parents} posts/pages to {$attached_items} items and updated {$updated_parents} parent posts/pages. There were {$skipped} skipped parents and {$errors} error(s).\n";
1740
  } // _copy_parent_terms_to_items
1741
 
1742
  /**
@@ -1749,76 +2101,218 @@ class Insert_Fixit {
1749
  private static function _copy_item_terms_to_parent() {
1750
  self::_build_attached_items_cache();
1751
 
1752
- $item_taxonomy = isset( $_REQUEST[ self::SLUG_PREFIX . 'item_taxonomy' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'item_taxonomy' ] : 'attachment_tag';
1753
- $parent_taxonomy = isset( $_REQUEST[ self::SLUG_PREFIX . 'parent_taxonomy' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'parent_taxonomy' ] : 'post_tag';
1754
  $append = 'add' === ( isset( $_REQUEST[ self::SLUG_PREFIX . 'add_replace' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'add_replace' ] : 'add' );
 
 
1755
 
1756
- $attached_parents = count( self::$attached_items );
1757
- $attached_items = 0;
1758
- $updated_parents = 0;
1759
- $skipped = 0;
1760
- $errors = 0;
1761
 
1762
  $taxonomies = get_object_taxonomies( 'attachment', 'objects' );
1763
  //error_log( __LINE__ . " Insert_Fixit::_copy_item_terms_to_parent attachment taxonomies = " . var_export( $taxonomies, true ), 0 );
1764
 
1765
- if ( ! isset( $taxonomies[ $item_taxonomy ] ) ) {
1766
- return 'ERROR - Item Taxonomy not valid for post_type "attachment".';
 
 
 
 
 
 
 
1767
  }
 
 
 
 
 
 
 
1768
 
1769
  foreach ( self::$attached_items as $post_id => $attachments ) {
1770
  // get the post/page object
1771
  $post = get_post( $post_id );
1772
  $taxonomies = get_object_taxonomies( $post, 'objects' );
1773
 
1774
- if ( ! isset( $taxonomies[ $parent_taxonomy ] ) ) {
1775
- $skipped++;
1776
- continue;
1777
- }
 
1778
 
1779
- $parent_is_hierarchical = $taxonomies[ $parent_taxonomy ]->hierarchical;
1780
 
1781
- $item_terms = array();
1782
- foreach ( $attachments as $sequence => $attachment_id ) {
1783
- $attached_items++;
1784
 
1785
- $terms = wp_get_object_terms( $attachment_id, $item_taxonomy );
1786
- foreach( $terms as $term ) {
1787
- $item_terms[ $term->term_taxonomy_id ] = $term;
1788
- }
1789
- } // foreach attachment
1790
- //error_log( __LINE__ . " Insert_Fixit::_copy_item_terms_to_parent( {$post_id} ) item_terms = " . var_export( $item_terms, true ), 0 );
1791
 
1792
- $parent_terms = array();
1793
- foreach ( $item_terms as $term_taxonomy_id => $term ) {
1794
- if ( $parent_is_hierarchical ) {
1795
- $parent_term = term_exists( $term->name, $parent_taxonomy );
1796
 
1797
- if ( $parent_term !== 0 && $parent_term !== NULL ) {
1798
- $parent_terms[ $parent_term['term_id'] ] = (integer) $parent_term['term_id'];
1799
- } else {
1800
- $parent_term = wp_insert_term( $term->name, $parent_taxonomy );
1801
- if ( ( ! is_wp_error( $parent_term ) ) && isset( $parent_term['term_id'] ) ) {
1802
  $parent_terms[ $parent_term['term_id'] ] = (integer) $parent_term['term_id'];
 
 
 
 
 
1803
  }
 
 
1804
  }
1805
- } else {
1806
- $parent_terms[ $term->term_taxonomy_id ] = $term->name;
1807
  }
1808
- }
1809
- //error_log( __LINE__ . " Insert_Fixit::_copy_item_terms_to_parent( {$post_id} ) parent_terms = " . var_export( $parent_terms, true ), 0 );
1810
 
1811
- $result = wp_set_object_terms( $post_id, $parent_terms, $parent_taxonomy, $append );
1812
- if ( is_array( $result) ) {
1813
- $updated_parents++;
1814
- } else {
1815
- $errors++;
1816
- }
 
 
 
1817
  } // foreach post
1818
 
1819
  return "<br>Item Terms to Parent matched {$attached_parents} posts/pages to {$attached_items} items and updated {$updated_parents} parent posts/pages. There were {$skipped} skipped parents and {$errors} error(s).\n";
1820
  } // _copy_item_terms_to_parent
1821
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1822
  /**
1823
  * Rebuild the Image Inserts and Image Objects arrays and cache them
1824
  *
36
  * opened on 1/28/2019 by "scubarob"
37
  * https://wordpress.org/support/topic/updating-decsription-and-alternative-text-for-image-already-linked-to-a-post/
38
  *
39
+ * Enhanced for support topic "Custom Post Type Mapping with MLA"
40
+ * opened on 3/07/2020 by "visualsuplex"
41
+ * https://wordpress.org/support/topic/updating-decsription-and-alternative-text-for-image-already-linked-to-a-post/
42
+ *
43
+ * Enhanced for support topic "Update/Add/Replace Image figcaption on Post"
44
+ * opened on 3/28/2020 by "liaris"
45
+ * https://wordpress.org/support/topic/update-add-replace-image-figcaption-on-post/
46
+ *
47
  * @package Insert Fixit
48
+ * @version 1.16
49
  */
50
 
51
  /*
53
  Plugin URI: http://davidlingren.com/
54
  Description: Synchronizes Media Library values to and from post/page inserted/featured/attached images
55
  Author: David Lingren
56
+ Version: 1.16
57
  Author URI: http://davidlingren.com/
58
 
59
+ Copyright 2015-2020 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
86
  *
87
  * @var string
88
  */
89
+ const CURRENT_VERSION = '1.16';
90
 
91
  /**
92
  * Slug prefix for registering and enqueueing submenu pages, style sheets and scripts
179
  * @return void Echoes HTML markup for the submenu page
180
  */
181
  public static function render_tools_page() {
182
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::render_tools_page() $_REQUEST = ' . var_export( $_REQUEST, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
183
  if ( !current_user_can( 'manage_options' ) ) {
184
  echo "Insert Fixit - Error</h2>\n";
185
  wp_die( 'You do not have permission to manage plugin settings.' );
194
  $attachment_lower = isset( $_REQUEST[ self::SLUG_PREFIX . 'attachment_lower' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'attachment_lower' ] : '';
195
  $old_attachment_upper = isset( $_REQUEST[ self::SLUG_PREFIX . 'old_attachment_upper' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'old_attachment_upper' ] : '';
196
  $attachment_upper = isset( $_REQUEST[ self::SLUG_PREFIX . 'attachment_upper' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'attachment_upper' ] : '';
197
+ // Copy ALT Text between Media Library items and Post/Page inserts
198
+ $old_post_types = isset( $_REQUEST[ self::SLUG_PREFIX . 'old_post_types' ] ) ? stripslashes( $_REQUEST[ self::SLUG_PREFIX . 'old_post_types' ] ) : '';
199
+ $post_types = isset( $_REQUEST[ self::SLUG_PREFIX . 'post_types' ] ) ? stripslashes( $_REQUEST[ self::SLUG_PREFIX . 'post_types' ] ) : "'post', 'page'";
200
 
201
+ // Post/Page Item Insert Modification
202
  $old_data_source = isset( $_REQUEST[ self::SLUG_PREFIX . 'old_data_source' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'old_data_source' ] : '';
203
  $data_source = isset( $_REQUEST[ self::SLUG_PREFIX . 'data_source' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'data_source' ] : '[+alt_text+]';
204
  $old_attribute_name = isset( $_REQUEST[ self::SLUG_PREFIX . 'old_attribute_name' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'old_attribute_name' ] : '';
205
  $attribute_name = isset( $_REQUEST[ self::SLUG_PREFIX . 'attribute_name' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'attribute_name' ] : 'data-pin-description';
206
 
207
+ $old_figcaption_template = isset( $_REQUEST[ self::SLUG_PREFIX . 'old_figcaption_template' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'old_figcaption_template' ] : '';
208
+ $figcaption_template = isset( $_REQUEST[ self::SLUG_PREFIX . 'figcaption_template' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'figcaption_template' ] : '([+post_excerpt+])';
209
+
210
  // Attach Media Library items
211
  self::$attach_all = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_ATTACH_ALL ] ) ? true : false;
212
  $attach_all_attr = self::$attach_all ? ' checked="checked" ' : ' ';
226
  $item_taxonomy = isset( $_REQUEST[ self::SLUG_PREFIX . 'item_taxonomy' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'item_taxonomy' ] : 'attachment_tag';
227
  $parent_taxonomy = isset( $_REQUEST[ self::SLUG_PREFIX . 'parent_taxonomy' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'parent_taxonomy' ] : 'post_tag';
228
 
229
+ $item_fields = isset( $_REQUEST[ self::SLUG_PREFIX . 'item_fields' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'item_fields' ] : '';
230
+ $fields_option = isset( $_REQUEST[ self::SLUG_PREFIX . 'fields_option' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'fields_option' ] : 'text';
231
+ $fields_option_text = ( 'text' === $fields_option ) ? 'selected="selected" ' : '';
232
+ $fields_option_single = ( 'single' === $fields_option ) ? 'selected="selected" ' : '';
233
+ // $fields_option_export = ( 'export' === $fields_option ) ? 'selected="selected" ' : '';
234
+ $fields_option_multi = ( 'multi' === $fields_option ) ? 'selected="selected" ' : '';
235
+
236
  $setting_actions = array(
237
  'help' => array( 'handler' => '', 'comment' => '<strong>Enter first and (optional) last ID values above to restrict tool application range</strong>. To operate on one ID, enter just the "First ID". The default is to perform the operation on <strong>all posts/pages</strong> and <strong>all Media Library items (attachments)</strong>.<br />&nbsp;<br />You can find post/page ID values by hovering over the post/page title in the "Title" column of the All Posts/All Pages submenu tables; look for the number following <code>post=</code>.<br />' ),
238
  'warning' => array( 'handler' => '', 'comment' => '<strong>These tools make permanent updates to your database.</strong> Make a backup before you use the tools so you can restore your old values if you don&rsquo;t like the results.' ),
239
 
240
  'c00' => array( 'handler' => '', 'comment' => '<h3>Copy ALT Text between Media Library items and Post/Page inserts</h3>' ),
241
+ 'c01' => array( 'handler' => '', 'comment' => '<strong>NOTE:</strong> Tools in this section use the post type values below. Single quotes and commas are required.' ),
242
+ 't1501' => array( 'open' => '<table><tr>' ),
243
+ 't1502' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">Post Type(s)</td>' ),
244
+ 't1503' => array( 'continue' => ' <td style="text-align: left">' ),
245
+ 't1504' => array( 'continue' => ' <input name="' . self::SLUG_PREFIX . 'old_post_types" type="hidden" value="' . $post_types . '">' ),
246
+ 't1505' => array( 'continue' => ' <input name="' . self::SLUG_PREFIX . 'post_types" type="text" size="30" value="' . $post_types . '">' ),
247
+ 't1506' => array( 'continue' => ' </td>' ),
248
+ 't1507' => array( 'close' => '</tr></table>' ),
249
  'ALT from Item' => array( 'handler' => '_copy_alt_from_media_library',
250
  'comment' => 'Copy ALT Text from Media Library item to Post/Page inserts.' ),
251
  'ALT to Item' => array( 'handler' => '_copy_alt_to_media_library',
252
  'comment' => 'Copy ALT Text from Post/Page inserts to Media Library item' ),
253
+ 'c02' => array( 'handler' => '', 'comment' => '<hr>' ),
254
+ 'c03' => array( 'handler' => '', 'comment' => '<h3>Post/Page Item Insert Modification</h3>' ),
255
+ 'c04' => array( 'handler' => '', 'comment' => '<strong>NOTE:</strong> The Attribute tools in this section use the Data Source and Attribute values below.' ),
256
  't0101' => array( 'open' => '<table><tr>' ),
257
  't0102' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">Data Source</td>' ),
258
  't0103' => array( 'continue' => ' <td style="text-align: left; padding-right: 20px">' ),
271
  'comment' => 'Replace (or add) an HTML attribute, e.g., data-pin-description=alt_text, to Post/Page inserts.' ),
272
  'Delete Attribute' => array( 'handler' => '_delete_attribute',
273
  'comment' => 'Delete an HTML attribute, e.g., data-pin-description, from Post/Page inserts' ),
274
+
275
+ 'c31' => array( 'handler' => '', 'comment' => '&nbsp;<br>The Figure Caption tools find items inserted in the body of a Post or Page with <code>&lt;figure&gt;</code> tags and adds or replaces the content of the <code>&lt;figcaption&gt;</code> tag for each insert.<br>&nbsp;<br><strong>NOTE:</strong> The Figure Caption tools use the Template value below. Leave the text box empty to delete the Figure Caption(s).' ),
276
+ 't1601' => array( 'open' => '<table><tr>' ),
277
+ 't1602' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">Template</td>' ),
278
+ 't1603' => array( 'continue' => ' <td style="text-align: left">' ),
279
+ 't1604' => array( 'continue' => ' <input name="' . self::SLUG_PREFIX . 'old_figcaption_template" type="hidden" value="' . $figcaption_template . '">' ),
280
+ 't1605' => array( 'continue' => ' <input name="' . self::SLUG_PREFIX . 'figcaption_template" type="text" size="60" value="' . $figcaption_template . '">' ),
281
+ 't1606' => array( 'continue' => ' </td>' ),
282
+ 't1607' => array( 'close' => '</tr></table>' ),
283
+ 'Add Figure Caption' => array( 'handler' => '_add_figcaption',
284
+ 'comment' => 'Populate empty <code>&lt;figcaption&gt;</code> with "Template" value' ),
285
+ 'Replace Figure Caption' => array( 'handler' => '_replace_figcaption',
286
+ 'comment' => 'Replace (or add) <code>&lt;figcaption&gt;</code> with "Template" value' ),
287
+
288
+ 'c05' => array( 'handler' => '', 'comment' => '<hr>' ),
289
+ 'c06' => array( 'handler' => '', 'comment' => '<h3>Attach Media Library items</h3>' ),
290
+ 'c07' => array( 'handler' => '', 'comment' => '<strong>NOTE:</strong> By default, tools in this section operate only on <strong>unattached</strong> Media Library items.<br />&nbsp;' ),
291
  't1201' => array( 'open' => '<table><tr>' ),
292
  't1202' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle"><input name="' . self::SLUG_PREFIX . self::INPUT_ATTACH_ALL . '" type="checkbox"' . $attach_all_attr . 'value="' . self::INPUT_ATTACH_ALL . '"></td>' ),
293
  't1203' => array( 'continue' => ' <td style="text-align: left; padding-right: 5px" valign="middle">Replace existing parent</td>' ),
310
  'comment' => 'Attach items to the first Post/Page for which they are the Featured Image' ),
311
  'Attach Referenced In' => array( 'handler' => '_attach_referenced_in',
312
  'comment' => 'Attach items to the first Post/Page where they appear in a "class wp-image-" or "ids=" element' ),
313
+ 'c08' => array( 'handler' => '', 'comment' => '<hr>' ),
314
+ 'c09' => array( 'handler' => '', 'comment' => '<h3>Copy Post/Page values to inserted Media Library items</h3>' ),
315
+ 'c10' => array( 'handler' => '', 'comment' => 'This tool finds items inserted in the body of a Post or Page and composes a new Title for the items based on values in the Post/Page, adding a sequence number (<code>[+index+]</code>) to make the Title unique. The number of inserted items is available in <code>[+found_rows+]</code>.<br>&nbsp;<br><strong>NOTE:</strong> The Post to Item Title tool uses the Template value below.' ),
316
  't0201' => array( 'open' => '<table><tr>' ),
317
  't0202' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">Template</td>' ),
318
  't0203' => array( 'continue' => ' <td style="text-align: left">' ),
321
  't0207' => array( 'close' => '</tr></table>' ),
322
  'Post to Item Title' => array( 'handler' => '_copy_post_values_to_items',
323
  'comment' => 'Copy "Template" value from Post/Page inserts to Media Library item' ),
324
+ 'c11' => array( 'handler' => '', 'comment' => '<hr>' ),
325
+ 'c12' => array( 'handler' => '', 'comment' => '<h3>Copy Parent values to attached Media Library items</h3>' ),
326
+ 'c13' => array( 'handler' => '', 'comment' => 'The "Parent to Item Title" tool finds items attached to a Post or Page and composes a new Title for the items based on values in the parent Post/Page, adding a sequence number (<code>[+index+]</code>) to make the Title unique. The number of attached items is available in <code>[+found_rows+]</code>.<br>&nbsp;<br><strong>NOTE:</strong> The Parent to Item Title tool uses the Template value below.' ),
327
  't0301' => array( 'open' => '<table><tr>' ),
328
  't0302' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">Template</td>' ),
329
  't0303' => array( 'continue' => ' <td style="text-align: left">' ),
332
  't0307' => array( 'close' => '</tr></table>' ),
333
  'Parent to Item Title' => array( 'handler' => '_copy_parent_values_to_items',
334
  'comment' => 'Copy "Template" value from parent Post/Page to (attached) Media Library items' ),
335
+ 'c14' => array( 'handler' => '', 'comment' => '&nbsp;<br />The "Parent Terms to Item" tool finds items attached to a Post or Page and copies terms assigned to the parent to the items.<br><strong>NOTE:</strong> The Parent Terms to Item tool uses the Taxonomy name/slug values below. You can enter multiple taxonomy pairs separated by commas.' ),
336
  't1401' => array( 'open' => '<table><tr>' ),
337
  't1407' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">from Parent Taxonomy</td>' ),
338
  't1408' => array( 'continue' => ' <td style="text-align: left; padding-right: 15px">' ),
351
  't1418' => array( 'close' => '</tr></table>' ),
352
  'Parent Terms to Item' => array( 'handler' => '_copy_parent_terms_to_items',
353
  'comment' => 'Copy assigned terms from the parent Post/Page to attached items' ),
354
+ 'c15' => array( 'handler' => '', 'comment' => '<hr>' ),
355
+ 'c16' => array( 'handler' => '', 'comment' => '<h3>Copy attached Media Library item values to Parent Post/Page</h3>' ),
356
+ 'c17' => array( 'handler' => '', 'comment' => 'This tool finds items attached to a Post or Page and copies terms assigned to the items to the parent.' ),
357
+ 'c18' => array( 'handler' => '', 'comment' => '<strong>NOTE:</strong> The Item Terms to Parent tool uses the Taxonomy name/slug values below. You can enter multiple taxonomy pairs separated by commas.' ),
358
  't0401' => array( 'open' => '<table><tr>' ),
359
  't0402' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">from Item Taxonomy</td>' ),
360
  't0403' => array( 'continue' => ' <td style="text-align: left; padding-right: 15px">' ),
373
  't0418' => array( 'close' => '</tr></table>' ),
374
  'Item Terms to Parent' => array( 'handler' => '_copy_item_terms_to_parent',
375
  'comment' => 'Copy assigned terms from attached items to the parent Post/Page' ),
376
+ 'c19' => array( 'handler' => '', 'comment' => '<br>This tool finds items attached to a Post or Page and copies custom field values from the items to the parent.' ),
377
+ 'c20' => array( 'handler' => '', 'comment' => '<strong>NOTE:</strong> The Item Fields to Parent tool uses the custom field name values below. You can enter multiple field names separated by commas.' ),
378
+ 't1301' => array( 'open' => '<table><tr>' ),
379
+ 't1302' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">Custom field list</td>' ),
380
+ 't1303' => array( 'continue' => ' <td style="text-align: left; padding-right: 15px">' ),
381
+ 't1305' => array( 'continue' => ' <input name="' . self::SLUG_PREFIX . 'item_fields" type="text" size="40" value="' . $item_fields . '">' ),
382
+ 't1306' => array( 'continue' => ' </td>' ),
383
+ 't1307' => array( 'continue' => ' <td style="text-align: left;">' ),
384
+ 't1308' => array( 'continue' => ' <select name="' . self::SLUG_PREFIX . 'fields_option">' ),
385
+ 't1309' => array( 'continue' => ' <option ' . $fields_option_text . 'value="text">Text</option>' ),
386
+ 't1310' => array( 'continue' => ' <option ' . $fields_option_single . 'value="single">Single</option>' ),
387
+ // 't1311' => array( 'continue' => ' <option ' . $fields_option_export . 'value="export">Export</option>' ),
388
+ 't1312' => array( 'continue' => ' <option ' . $fields_option_multi . 'value="multi">Multi</option>' ),
389
+ 't1313' => array( 'continue' => ' </select>' ),
390
+ 't1314' => array( 'continue' => ' </td>' ),
391
+ 't1318' => array( 'close' => '</tr></table>' ),
392
+ 'Item Fields to Parent' => array( 'handler' => '_copy_item_fields_to_parent',
393
+ 'comment' => 'Copy custom fields from attached items to the parent Post/Page' ),
394
+ 'c21' => array( 'handler' => '', 'comment' => '<hr>' ),
395
+ 'c22' => array( 'handler' => '', 'comment' => '<h3>Refresh Caches</h3>' ),
396
+ 'c23' => array( 'handler' => '', 'comment' => 'If you have a large number of posts/pages and/or Media Library items you can use the cache refresh operation to break up processing into smaller steps. Try clicking the "Refresh Caches" button to build these intermediate data structures and save them in the WordPress cache for fifteen minutes. That will make the "Copy", "Modification" and "Attach" operations above go quicker.<br>&nbsp;' ),
397
  'Refresh Caches' => array( 'handler' => '_refresh_caches',
398
  'comment' => 'rebuild arrays and save in cache for fifteen minutes' ),
399
  );
421
  }
422
  }
423
 
424
+ // Invalidate the caches if anything has changed
425
+ if ( $old_post_lower !== $post_lower || $old_post_upper !== $post_upper || $old_attachment_lower !== $attachment_lower || $old_attachment_upper !== $attachment_upper || $old_post_types !== $post_types || $old_data_source !== $data_source || $old_attribute_name !== $attribute_name || $old_figcaption_template !== $figcaption_template ) {
426
+ delete_transient( self::SLUG_PREFIX . 'figure_inserts' );
 
427
  delete_transient( self::SLUG_PREFIX . 'image_inserts' );
428
  delete_transient( self::SLUG_PREFIX . 'image_objects' );
429
  }
596
  if ( $use_cache ) {
597
  self::$image_inserts = get_transient( self::SLUG_PREFIX . 'image_inserts' );
598
  if ( is_array( self::$image_inserts ) ) {
599
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_image_inserts_cache using cached self::\$image_inserts " . var_export( self::$image_inserts, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
600
  return 'Using cached image inserts with ' . count( self::$image_inserts ) . ' post/page elements.';
601
  }
602
  }
618
  $upper_bound = 0x7FFFFFFF;
619
  }
620
 
621
+ if ( ! empty( $_REQUEST[ self::SLUG_PREFIX . 'post_types' ] ) ) {
622
+ $post_types = stripslashes( $_REQUEST[ self::SLUG_PREFIX . 'post_types' ] );
623
+ } else {
624
+ $post_types = "'post', 'page'";
625
+ }
626
+ //error_log( __LINE__ . " Insert_Fixit::_build_image_inserts_cache post_types = " . var_export( $post_types, true ), 0 );
627
+
628
+ $query = sprintf( 'SELECT ID, post_content FROM %1$s WHERE ( post_type IN ( %2$s ) AND ( post_status = \'publish\' ) AND ( ID >= %3$d ) AND ( ID <= %4$d ) AND ( post_content LIKE \'%5$s\' ) ) ORDER BY ID', $wpdb->posts, $post_types, $lower_bound, $upper_bound, '%<img%' );
629
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $query = ' . var_export( $query, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
630
  $results = $wpdb->get_results( $query );
631
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $results = ' . var_export( $results, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
632
 
633
  $upload_dir = wp_upload_dir();
634
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $upload_dir = ' . var_export( $upload_dir, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
635
  $upload_dir = $upload_dir['baseurl'] . '/';
636
  $site_url = get_site_url();
637
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $site_url = ' . var_export( $site_url, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
638
  $upload_subdir = str_replace( $site_url, '', $upload_dir );
639
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $upload_subdir = ' . var_export( $upload_subdir, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
640
 
641
  $image_inserts = array();
642
  foreach ( $results as $result ) {
643
+ $match_count = preg_match_all( '/\<img .*?(src="([^"]*?)")[^\>]*?\>/', $result->post_content, $matches, PREG_OFFSET_CAPTURE );
644
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_image_inserts_cache( {$result->ID} ) count = {$match_count}, src \$matches = " . var_export( $matches, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
645
+ //error_log( __LINE__ . " Insert_Fixit::_build_image_inserts_cache( {$result->ID} ) count = {$match_count}, src \$matches = " . var_export( $matches, true ), 0 );
646
  if ( $match_count ) {
647
  $image_inserts[ $result->ID ]['content'] = $result->post_content;
648
 
669
  // alt= value if present
670
  foreach ( $image_inserts[ $result->ID ]['inserts'] as $index => $insert ) {
671
  $match_count = preg_match( '/alt="([^"]*)"/', $insert['img'], $matches, PREG_OFFSET_CAPTURE );
672
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_image_inserts_cache( {$result->ID} ) count = {$match_count}, alt \$matches = " . var_export( $matches, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
673
  if ( $match_count ) {
674
  $image_inserts[ $result->ID ]['inserts'][ $index ]['alt'] = $matches[1][0];
675
  $image_inserts[ $result->ID ]['inserts'][ $index ]['alt_offset'] = $insert['img_offset'] + $matches[1][1];
682
 
683
  $return = set_transient( self::SLUG_PREFIX . 'image_inserts', $image_inserts, 900 ); // fifteen minutes
684
  //error_log( __LINE__ . " Insert_Fixit::_build_image_inserts_cache set_transient return = " . var_export( $return, true ), 0 );
685
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_image_inserts_cache() return = {$return}, \$image_inserts = " . var_export( $image_inserts, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
686
  self::$image_inserts = $image_inserts;
687
 
688
+ //error_log( __LINE__ . " Insert_Fixit::_build_image_inserts_cache image_inserts = " . var_export( $image_inserts, true ), 0 );
689
  return 'Image inserts cache refreshed with ' . count( self::$image_inserts ) . ' post/page elements.';
690
  } // _build_image_inserts_cache
691
 
692
+ /**
693
+ * Array of post/page IDs giving inserted <figcaption> content:
694
+ * post/page ID => array(
695
+ * 'content' => post_content,
696
+ * 'inserts' => array(
697
+ * // array key 'ID' => ID value of the corresponding Media Library item,
698
+ * 'ID' => array (
699
+ * 'figcaption' => content of <figcaption> tag,
700
+ * 'figcaption_offset' => offset within post_content
701
+ * )
702
+ * )
703
+ * // For the add/replace <figcaption> tools:
704
+ * 'replacements' => array(
705
+ * new_offset => array (
706
+ * 'length' => strlen of the replacement
707
+ * 'text' => new value
708
+ * )
709
+ * )
710
+ * )
711
+ *
712
+ * @since 1.16
713
+ *
714
+ * @var array
715
+ */
716
+ private static $figcaption_inserts = array();
717
+
718
+ /**
719
+ * Compile array of <figcaption> content inserted in posts/pages
720
+ *
721
+ * @since 1.16
722
+ *
723
+ * @param boolean $use_cache True to use an existing cache, false to force rebuild
724
+ *
725
+ * @return string Cache or rebuild results
726
+ */
727
+ private static function _build_figcaption_inserts_cache( $use_cache = false ) {
728
+ global $wpdb;
729
+
730
+ if ( $use_cache ) {
731
+ self::$figcaption_inserts = get_transient( self::SLUG_PREFIX . 'figcaption_inserts' );
732
+ if ( is_array( self::$figcaption_inserts ) ) {
733
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache using cached self::\$figcaption_inserts " . var_export( self::$figcaption_inserts, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
734
+ return 'Using cached figcaption inserts with ' . count( self::$figcaption_inserts ) . ' post/page elements.';
735
+ }
736
+ }
737
+
738
+ $return = delete_transient( self::SLUG_PREFIX . 'figcaption_inserts' );
739
+ //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache delete_transient return = " . var_export( $return, true ), 0 );
740
+
741
+ if ( ! empty( $_REQUEST[ self::SLUG_PREFIX . 'post_lower' ] ) ) {
742
+ $lower_bound = (integer) $_REQUEST[ self::SLUG_PREFIX . 'post_lower' ];
743
+ } else {
744
+ $lower_bound = 0;
745
+ }
746
+
747
+ if ( ! empty( $_REQUEST[ self::SLUG_PREFIX . 'post_upper' ] ) ) {
748
+ $upper_bound = (integer) $_REQUEST[ self::SLUG_PREFIX . 'post_upper' ];
749
+ } elseif ( $lower_bound ) {
750
+ $upper_bound = $lower_bound;
751
+ } else {
752
+ $upper_bound = 0x7FFFFFFF;
753
+ }
754
+
755
+ if ( ! empty( $_REQUEST[ self::SLUG_PREFIX . 'post_types' ] ) ) {
756
+ $post_types = stripslashes( $_REQUEST[ self::SLUG_PREFIX . 'post_types' ] );
757
+ } else {
758
+ $post_types = "'post', 'page'";
759
+ }
760
+ //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache post_types = " . var_export( $post_types, true ), 0 );
761
+
762
+ $query = sprintf( 'SELECT ID, post_content FROM %1$s WHERE ( post_type IN ( %2$s ) AND ( post_status = \'publish\' ) AND ( ID >= %3$d ) AND ( ID <= %4$d ) AND ( post_content LIKE \'%5$s\' ) ) ORDER BY ID', $wpdb->posts, $post_types, $lower_bound, $upper_bound, '%<figcaption%' );
763
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_figcaption_inserts_cache() $query = ' . var_export( $query, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
764
+ $results = $wpdb->get_results( $query );
765
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_figcaption_inserts_cache() $results = ' . var_export( $results, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
766
+
767
+ $gallery_items = array();
768
+ $figcaption_inserts = array();
769
+ foreach ( $results as $result ) {
770
+
771
+ // Items within a gallery require a different <figcaption> tag
772
+ $match_count = preg_match_all( '/\<\!-- wp:gallery \{"ids":\[([^\]]*?)\]/', $result->post_content, $matches );
773
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache( {$result->ID} ) count = {$match_count}, src \$matches = " . var_export( $matches, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
774
+ //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache( {$result->ID} ) count = {$match_count}, src \$matches = " . var_export( $matches, true ), 0 );
775
+ if ( $match_count ) {
776
+ foreach( $matches[1] as $match ) {
777
+ $match = explode( ',', $match );
778
+ foreach( $match as $index ) {
779
+ $gallery_items[ $index ] = (integer) $index;
780
+ }
781
+ }
782
+ }
783
+ //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache( {$result->ID} ) count = {$match_count}, src \$gallery_items = " . var_export( $gallery_items, true ), 0 );
784
+
785
+ $match_count = preg_match_all( '/\<figure[^\>]*?\>\<img.*?(wp-image-([0-9]*)).*?(\<figcaption.*?\>(.*?)\<\/figcaption\>|)\<\/figure\>/', $result->post_content, $matches, PREG_OFFSET_CAPTURE );
786
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache( {$result->ID} ) count = {$match_count}, src \$matches = " . var_export( $matches, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
787
+ //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache( {$result->ID} ) count = {$match_count}, src \$matches = " . var_export( $matches, true ), 0 );
788
+
789
+ if ( $match_count ) {
790
+ $figcaption_inserts[ $result->ID ]['content'] = $result->post_content;
791
+
792
+ // media item ID
793
+ foreach( $matches[2] as $index => $match ) {
794
+ $item_id = (integer) $match[0];
795
+ $match = array();
796
+
797
+ // Missing figcaptions return an empty string in $matches[4], not an array
798
+ if ( empty( $matches[4][$index] ) ) {
799
+ $match['figcaption'] = $matches[3][$index][0];
800
+ $match['figcaption_offset'] = $matches[3][$index][1];
801
+ $match['add_tag'] = true;
802
+ } else {
803
+ $match['figcaption'] = $matches[4][$index][0];
804
+ $match['figcaption_offset'] = $matches[4][$index][1];
805
+ $match['add_tag'] = false;
806
+ }
807
+
808
+ $match['gallery_item'] = array_key_exists( $item_id, $gallery_items );
809
+ $figcaption_inserts[ $result->ID ]['inserts'][ $item_id ] = $match;
810
+ }
811
+
812
+ $figcaption_inserts[ $result->ID ]['replacements'] = array();
813
+ }
814
+ }
815
+
816
+ $return = set_transient( self::SLUG_PREFIX . 'figcaption_inserts', $figcaption_inserts, 900 ); // fifteen minutes
817
+ //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache set_transient return = " . var_export( $return, true ), 0 );
818
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache() return = {$return}, \$figcaption_inserts = " . var_export( $figcaption_inserts, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
819
+ self::$figcaption_inserts = $figcaption_inserts;
820
+
821
+ //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache figcaption_inserts = " . var_export( $figcaption_inserts, true ), 0 );
822
+ return 'Image inserts cache refreshed with ' . count( self::$figcaption_inserts ) . ' post/page elements.';
823
+ } // _build_figcaption_inserts_cache
824
+
825
  /**
826
  * Array of attachment IDs giving post_parent and Featured Image post/page IDs:
827
  * attachment ID => array( 'parent' => post_parent, post/page IDs => post/page IDs )
849
  if ( $use_cache ) {
850
  self::$featured_objects = get_transient( self::SLUG_PREFIX . 'featured_objects' );
851
  if ( is_array( self::$featured_objects ) ) {
852
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_featured_objects_cache using cached self::\$featured_objects " . var_export( self::$featured_objects, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
853
  return 'Using cached featured objects with ' . count( self::$featured_objects ) . ' attachment elements.';
854
  }
855
  }
884
  $query[] = "AND ( ID >= {$lower_bound} ) AND ( ID <= {$upper_bound} ) ) ORDER BY ID ) AS p ON m.meta_value = p.ID";
885
  $query[] = "WHERE m.meta_key = '_thumbnail_id'";
886
  $query = implode( ' ', $query );
887
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_featured_objects_cache() $query = ' . var_export( $query, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
888
  $results = $wpdb->get_results( $query );
889
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_featured_objects_cache() $results = ' . var_export( $results, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
890
 
891
  $references = array();
892
  if ( is_array( $results ) ) {
907
 
908
  $return = set_transient( self::SLUG_PREFIX . 'featured_objects', $references, 900 ); // fifteen minutes
909
  //error_log( __LINE__ . " Insert_Fixit::_build_featured_objects_cache set_transient return = " . var_export( $return, true ), 0 );
910
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_featured_objects_cache return = {$return}, references = " . var_export( $references, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
911
  self::$featured_objects = $references;
912
 
913
  return 'Featured objects cache refreshed with ' . count( self::$featured_objects ) . ' attachment elements.';
940
  if ( $use_cache ) {
941
  self::$item_references = get_transient( self::SLUG_PREFIX . 'item_references' );
942
  if ( is_array( self::$item_references ) ) {
943
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_item_references_cache using cached self::\$item_references " . var_export( self::$item_references, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
944
  return 'Using cached item references with ' . count( self::$item_references ) . ' attachment elements.';
945
  }
946
  }
962
  $upper_bound = 0x7FFFFFFF;
963
  }
964
 
965
+ if ( ! empty( $_REQUEST[ self::SLUG_PREFIX . 'post_types' ] ) ) {
966
+ $post_types = stripslashes( $_REQUEST[ self::SLUG_PREFIX . 'post_types' ] );
967
+ } else {
968
+ $post_types = "'post', 'page'";
969
+ }
970
+ //error_log( __LINE__ . " Insert_Fixit::_build_item_references_cache post_types = " . var_export( $post_types, true ), 0 );
971
+
972
+ $query = sprintf( 'SELECT ID, post_content FROM %1$s WHERE ( post_type IN ( %2$s ) AND ( post_status = \'publish\' ) AND ( ID >= %3$d ) AND ( ID <= %4$d ) AND ( ( post_content LIKE \'%5$s\' ) OR ( post_content LIKE \'%6$s\' ) ) ) ORDER BY ID', $wpdb->posts, $post_types, $lower_bound, $upper_bound, '%wp-image-%', '%ids=%' );
973
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_item_references_cache() $query = ' . var_export( $query, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
974
  $results = $wpdb->get_results( $query );
975
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_item_references_cache() $results = ' . var_export( $results, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
976
 
977
  self::$item_references = array();
978
  foreach ( $results as $result ) {
979
  // Find the class="wp-image-" references
980
  $match_count = preg_match_all( '/wp-image-([0-9]{1,6})/', $result->post_content, $matches );
981
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_item_references_cache( {$result->ID} ) class \$matches = " . var_export( $matches, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
982
  if ( $match_count ) {
983
  foreach ( $matches[1] as $match ) {
984
  self::$item_references[ absint( $match ) ][ absint( $result->ID ) ] = absint( $result->ID );
987
 
988
  // Find the ids= references
989
  $match_count = preg_match_all( '/(\[gallery|\[mla_gallery)[^\]]*ids=([0-9,\\\'\"]*)/', $result->post_content, $matches );
990
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_item_references_cache( {$result->ID} ) ids \$matches = " . var_export( $matches, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
991
  if ( $match_count ) {
992
  foreach ( $matches[2] as $match ) {
993
  $items = explode( ',', trim( $match, '\'"' ) );
999
  }
1000
 
1001
  $return = set_transient( self::SLUG_PREFIX . 'item_references', self::$item_references, 900 ); // fifteen minutes
1002
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_item_references_cache return = {$return}, self::\$item_references " . var_export( self::$item_references, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
 
1003
 
1004
+ //error_log( __LINE__ . " Insert_Fixit::_build_item_references_cache item_references = " . var_export( self::$item_references, true ), 0 );
1005
  return 'Item references cache refreshed with ' . count( self::$item_references ) . ' items referenced in ' . count( $results ) . ' post/page elements.';
1006
  } // _build_item_references_cache
1007
 
1038
  if ( $use_cache ) {
1039
  self::$image_objects = get_transient( self::SLUG_PREFIX . 'image_objects' );
1040
  if ( is_array( self::$image_objects ) ) {
1041
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_image_objects_cache using cached self::\$image_objects " . var_export( self::$image_objects, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1042
  return 'Using cached image objects with ' . count( self::$image_objects ) . ' attachment elements.';
1043
  }
1044
  }
1067
  }
1068
 
1069
  $query = sprintf( 'SELECT ID, post_parent FROM %1$s WHERE ( ( post_type = \'attachment\' ) %2$s AND ( ID >= %3$d ) AND ( ID <= %4$d ) ) ORDER BY ID', $wpdb->posts, $where, $lower_bound, $upper_bound );
1070
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_objects_cache() $query = ' . var_export( $query, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1071
  $results = $wpdb->get_results( $query );
1072
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_objects_cache() $results = ' . var_export( $results, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1073
 
1074
  // Load the image_inserts array
1075
  self::_build_image_inserts_cache( true );
1100
  }
1101
 
1102
  $sizes = isset( $attachment_metadata['sizes'] ) ? $attachment_metadata['sizes'] : NULL;
1103
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_array_image_inserts_references( {$result->ID} ) sizes = " . var_export( $sizes, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1104
  if ( ! empty( $sizes ) && is_array( $sizes ) ) {
1105
  // Using the path and name as the array key ensures each name is added only once
1106
  foreach ( $sizes as $size => $size_info ) {
1112
  //$files[ $path . $base_file ] = $path . $base_file;
1113
  $files[ $base_file ] = $base_file;
1114
  }
1115
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_array_image_inserts_references( {$result->ID} ) files = " . var_export( $files, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1116
 
1117
  /*
1118
  * inserts Array of specific files (i.e., sizes) found in one or more posts/pages
1122
  $inserts = array();
1123
 
1124
  foreach( $files as $file ) {
1125
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_array_image_inserts_references( {$result->ID} ) file = " . var_export( $file, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1126
  foreach ( self::$image_inserts as $insert_id => $value ) {
1127
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_array_image_inserts_references( {$insert_id} ) value = " . var_export( $value, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1128
  if ( in_array( $file, $value['files'] ) ) {
1129
  $inserts[ $insert_id ][] = $file;
1130
  }
1147
  } // each result
1148
 
1149
  $return = set_transient( self::SLUG_PREFIX . 'image_objects', $references, 900 ); // fifteen minutes
1150
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_image_objects_cache return = {$return}, self::\$image_objects = " . var_export( $references, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
 
1151
  self::$image_objects = $references;
1152
 
1153
+ //error_log( __LINE__ . " Insert_Fixit::_build_image_objects_cache image_objects = " . var_export( $references, true ), 0 );
1154
  return 'Image objects cache refreshed with ' . count( self::$image_objects ) . ' attachment elements.';
1155
  } // _build_image_objects_cache
1156
 
1199
  *
1200
  * @since 1.02
1201
  *
1202
+ * @param string Desired operation, 'Add', 'Replace', 'Delete'
1203
+ *
1204
  * @return string HTML markup for results/messages
1205
  */
1206
  private static function _evaluate_add_attribute( $operation = 'Add' ) {
1380
  $inserts = self::$image_inserts[ $post_id ];
1381
  foreach ( $files as $file ) {
1382
  foreach ( $inserts['inserts'] as $insert ) {
1383
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library file test '{$file}' == " . var_export( $insert['src'], true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1384
  if ( $file != $insert['src'] || ! isset( $insert['alt'] ) ) {
1385
  continue;
1386
  }
1387
 
1388
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library ALT text test '{$alt_text}' == " . var_export( $insert['alt'], true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1389
  if ( $alt_text == $insert['alt'] ) {
1390
  continue;
1391
  }
1402
  $replacements = $inserts['replacements'];
1403
  if ( ! empty( $replacements ) ) {
1404
  krsort( $replacements );
1405
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library( {$post_id} ) replacements = " . var_export( $replacements, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1406
  $post_content = $inserts['content'];
1407
  foreach ( $replacements as $offset => $replacement ) {
1408
  $post_content = substr_replace( $post_content, $replacement['text'], $offset, $replacement['length'] );
1409
  $updates++;
1410
  } // foreach replacement
 
1411
  $new_content = array( 'ID' => $post_id, 'post_content' => $post_content );
1412
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library( {$post_id} ) new post_content = " . var_export( $post_content, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1413
  $result = wp_update_post( $new_content, true );
1414
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library( {$post_id} ) update result = " . var_export( $result, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1415
  if ( is_wp_error( $result ) ) {
1416
  $errors++;
1417
  }
1418
  $updated_posts++;
1419
+ } else { // has replacements
1420
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library( {$post_id} ) no replacements = " . var_export( $replacements, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1421
+ } // no replacements
1422
  } // foreach post/page
1423
 
1424
  /*
1536
  return self::_evaluate_add_attribute( 'Delete' );
1537
  } // _delete_attribute
1538
 
1539
+ /**
1540
+ * Populate empty <figcaption> content from template
1541
+ * @since 1.16
1542
+ *
1543
+ * @param string Desired operation, 'Add', 'Replace'
1544
+ *
1545
+ * @return string HTML markup for results/messages
1546
+ */
1547
+ private static function _evaluate_figcaption( $operation = 'Add' ) {
1548
+ // Load the figcaption_inserts array
1549
+ self::_build_figcaption_inserts_cache( false );
1550
+
1551
+ $examined_posts = count( self::$figcaption_inserts );
1552
+ if ( 0 === $examined_posts ) {
1553
+ return 'No <figcaption> tags found; nothing updated.';
1554
+ }
1555
+
1556
+ $figcaption_template = isset( $_REQUEST[ self::SLUG_PREFIX . 'figcaption_template' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'figcaption_template' ] : '([+post_excerpt+])';
1557
+ if ( 'template:' == substr( $figcaption_template, 0, 9 ) ) {
1558
+ $figcaption_template = substr( $figcaption_template, 9 );
1559
+ } else {
1560
+ $figcaption_template = '(' . $figcaption_template . ')';
1561
+ }
1562
+
1563
+ $data_source = array(
1564
+ 'data_source' => 'template',
1565
+ 'meta_name' => $figcaption_template,
1566
+ 'option' => 'text',
1567
+ 'format' => 'raw',
1568
+ );
1569
+ //error_log( __LINE__ . " Insert_Fixit::_evaluate_figcaption( {$operation} ) data_source = " . var_export( $data_source, true ), 0 );
1570
+
1571
+ $examined_items = 0;
1572
+ $updated_posts = 0;
1573
+ $updates = 0;
1574
+ $errors = 0;
1575
+
1576
+ // Accumulate replacements
1577
+ foreach ( self::$figcaption_inserts as $post_id => $post_data ) {
1578
+ $post_updates = 0;
1579
+
1580
+ foreach ( $post_data['inserts'] as $attachment_id => $insert ) {
1581
+ $examined_items++;
1582
+ $old_value = $insert['figcaption'];
1583
+ //error_log( __LINE__ . " Insert_Fixit::_evaluate_figcaption( {$attachment_id} ) old_value = " . var_export( $old_value, true ), 0 );
1584
+ if ( strlen( trim( $old_value ) ) && 'Add' === $operation ) {
1585
+ continue;
1586
+ }
1587
+
1588
+ $new_value = MLAOptions::mla_get_data_source( $attachment_id, 'single_attachment_mapping', $data_source, NULL );
1589
+ //error_log( __LINE__ . " Insert_Fixit::_evaluate_figcaption( {$attachment_id} ) new_value = " . var_export( $new_value, true ), 0 );
1590
+ if ( empty( $new_value ) ) {
1591
+ $new_value = '';
1592
+ }
1593
+
1594
+ if ( $old_value === $new_value ) {
1595
+ continue;
1596
+ }
1597
+
1598
+ if ( $insert['add_tag'] ) {
1599
+ if ( $insert['gallery_item'] ) {
1600
+ $new_value = '<figcaption class="blocks-gallery-item__caption">' . $new_value . '</figcaption>';
1601
+ } else {
1602
+ $new_value = '<figcaption>' . $new_value . '</figcaption>';
1603
+ }
1604
+ }
1605
+
1606
+ self::$figcaption_inserts[ $post_id ]['replacements'][ $insert['figcaption_offset'] ] = array( 'text' => $new_value, 'length' => strlen( $old_value ) );
1607
+ } // foreach examined_item
1608
+
1609
+ //error_log( __LINE__ . " Insert_Fixit::_evaluate_figcaption replacements = " . var_export( self::$figcaption_inserts, true ), 0 );
1610
+
1611
+ // Apply the updates, if any
1612
+ $replacements = self::$figcaption_inserts[ $post_id ]['replacements'];
1613
+ if ( ! empty( $replacements ) ) {
1614
+ krsort( $replacements );
1615
+ $post_content = self::$figcaption_inserts[ $post_id ]['content'];
1616
+ foreach ( $replacements as $offset => $replacement ) {
1617
+ $post_updates ++;
1618
+ $post_content = substr_replace( $post_content, $replacement['text'], $offset, $replacement['length'] );
1619
+ } // foreach replacement
1620
+ }
1621
+
1622
+ if ( $post_updates ) {
1623
+ $new_content = array( 'ID' => $post_id, 'post_content' => $post_content );
1624
+ //error_log( __LINE__ . " Insert_Fixit::_evaluate_figcaption new_content = " . var_export( $new_content, true ), 0 );
1625
+ $result = wp_update_post( $new_content, true );
1626
+ //error_log( __LINE__ . " Insert_Fixit::_evaluate_figcaption( {$post_id} ) update result = " . var_export( $result, true ), 0 );
1627
+ if ( is_wp_error( $result ) ) {
1628
+ $errors++;
1629
+ } else {
1630
+ $updated_posts++;
1631
+ $updates += $post_updates;
1632
+ }
1633
+ }
1634
+ } // foreach examined_post
1635
+
1636
+ return "<br>{$operation} Figure Caption matched {$examined_posts} posts/pages to {$examined_items} attachments and made {$updates} update(s) in {$updated_posts} posts/pages. There were {$errors} error(s).\n";
1637
+ } // _evaluate_figcaption
1638
+
1639
+ /**
1640
+ * Populate empty <figcaption> content from template
1641
+ * @since 1.16
1642
+ *
1643
+ * @return string HTML markup for results/messages
1644
+ */
1645
+ private static function _add_figcaption() {
1646
+ return self::_evaluate_figcaption( 'Add' );
1647
+ } // _add_figcaption
1648
+
1649
+ /**
1650
+ * Replace <figcaption> content from template
1651
+ * @since 1.16
1652
+ *
1653
+ * @return string HTML markup for results/messages
1654
+ */
1655
+ private static function _replace_figcaption() {
1656
+ return self::_evaluate_figcaption( 'Replace' );
1657
+ } // _replace_figcaption
1658
+
1659
  /**
1660
  * Attach items to the first Post/Page they are inserted in
1661
  *
1748
  private static function _attach_referenced_in() {
1749
  // Load the self::$item_references array
1750
  self::_build_item_references_cache( true );
1751
+
1752
  // Initialize statistics
1753
  $reference_count = 0;
1754
  $referenced_items = 0;
1764
  if ( NULL === $attachment ) {
1765
  continue;
1766
  }
1767
+
1768
  if ( !self::$attach_all && $attachment->post_parent ) {
1769
  $skipped++;
1770
  continue;
1936
  private static function _copy_parent_terms_to_items() {
1937
  self::_build_attached_items_cache();
1938
 
1939
+ $item_taxonomy = isset( $_REQUEST[ self::SLUG_PREFIX . 'to_item_taxonomy' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'to_item_taxonomy' ] : '';
1940
+ $parent_taxonomy = isset( $_REQUEST[ self::SLUG_PREFIX . 'from_parent_taxonomy' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'from_parent_taxonomy' ] : '';
1941
  $append = 'add' === ( isset( $_REQUEST[ self::SLUG_PREFIX . 'item_add_replace' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'item_add_replace' ] : 'add' );
1942
 
1943
+ $item_taxonomies = explode( ',', $item_taxonomy );
1944
+ $parent_taxonomies = explode( ',', $parent_taxonomy );
 
 
 
1945
 
1946
+ if ( count( $item_taxonomies ) !== count( $parent_taxonomies ) ) {
1947
+ return 'ERROR - Parent and item taxonomy input counts are not equal.';
1948
+ }
1949
+
1950
+ $attachment_taxonomies = get_object_taxonomies( 'attachment', 'objects' );
1951
+ //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items attachment taxonomies = " . var_export( $attachment_taxonomies, true ), 0 );
1952
+
1953
+ // Hard-code additional taxonomy pairs ( item => parent ) here
1954
+ $taxonomy_pairs = array ();
1955
 
1956
+ foreach ( $item_taxonomies as $index => $item_taxonomy ) {
1957
+ if ( isset( $attachment_taxonomies[ $item_taxonomy ] ) ) {
1958
+ $taxonomy_pairs[ $item_taxonomy ] = $parent_taxonomies[ $index ];
1959
+ } else {
1960
+ return "ERROR - Item Taxonomy {$item_taxonomy} not valid for post_type 'attachment'.";
1961
+ }
1962
  }
1963
+ //error_log( __LINE__ . " Insert_Fixit::_copy_item_terms_to_parent taxonomy_pairs = " . var_export( $taxonomy_pairs, true ), 0 );
1964
 
1965
+ $attached_parents = count( self::$attached_items );
1966
+ $attached_items = 0;
1967
+ $updated_items = 0;
1968
+ $skipped = 0;
1969
+ $errors = 0;
1970
 
1971
  $skipped_messages = array();
1972
  $parent_taxonomies = array();
1973
  foreach ( self::$attached_items as $post_id => $attachments ) {
1974
+ $attached_items += count( $attachments );
1975
+
1976
  // get the post/page object
1977
  $post = get_post( $post_id );
1978
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items attachment post = " . var_export( $post, true ), 0 );
1987
  $taxonomies = $parent_taxonomies[ $post->post_type ];
1988
  } else {
1989
  $taxonomies = $parent_taxonomies[ $post->post_type ] = get_object_taxonomies( $post, 'objects' );
1990
+ //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items parent_taxonomies[ $post->post_type ] = " . var_export( $taxonomies, true ), 0 );
1991
  }
1992
 
1993
+ foreach ( $taxonomy_pairs as $item_taxonomy => $parent_taxonomy ) {
1994
+ $item_is_hierarchical = $attachment_taxonomies[ $item_taxonomy ]->hierarchical;
 
 
 
 
 
1995
 
1996
+ if ( ! isset( $taxonomies[ $parent_taxonomy ] ) ) {
1997
+ $skipped_messages[ $parent_taxonomy . $post->post_type ] = array( 'taxonomy' => $parent_taxonomy, 'post_type' => $post->post_type );
1998
+ $skipped++;
1999
+ continue;
2000
+ }
2001
 
2002
+ $parent_terms = wp_get_object_terms( $post_id, $parent_taxonomy );
2003
+ $term_map = array();
2004
+ $item_terms = array();
2005
+
2006
+ // If both taxonomies are hiearchical we must add parent term(s) before adding item terms
2007
+ if ( $item_is_hierarchical && $taxonomies[ $parent_taxonomy ]->hierarchical ) {
2008
+ $ancestors = array();
2009
+ foreach ( $parent_terms as $term ) {
2010
+ $level = 0;
2011
+ while ( $term->parent ) {
2012
+ $term = get_term( $term->parent, $parent_taxonomy );
2013
+ $ancestors[ $level++ ][ $term->term_id ] = $term;
2014
+ }
2015
  }
 
2016
 
2017
+ krsort( $ancestors, SORT_NUMERIC );
2018
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items ancestors = " . var_export( $ancestors, true ), 0 );
2019
 
2020
+ foreach ( $ancestors as $level => $terms ) {
2021
+ foreach ( $terms as $term_id => $term ) {
2022
+ $ancestor = get_term_by( 'name', $term->name, $item_taxonomy );
2023
+ if ( false !== $ancestor ) {
2024
+ $term_map[ $term->term_id ] = $ancestor->term_id;
2025
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items( $level, $term->term_id ) found ancestor = " . var_export( $ancestor, true ), 0 );
2026
+ } else {
2027
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items( $level, $term->term_id ) inserting = " . var_export( $term, true ), 0 );
2028
+ if ( $term->parent && !empty( $term_map[ $term->parent ] ) ) {
2029
+ $ancestor = wp_insert_term( $term->name, $item_taxonomy, array( 'parent' => $term_map[ $term->parent ] ) );
2030
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items child ancestor = " . var_export( $ancestor, true ), 0 );
2031
+ } else {
2032
+ $ancestor = wp_insert_term( $term->name, $item_taxonomy );
2033
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items root ancestor = " . var_export( $ancestor, true ), 0 );
2034
+ }
2035
+ if ( ( ! is_wp_error( $ancestor ) ) && isset( $ancestor['term_id'] ) ) {
2036
+ $term_map[ $term->term_id ] = (integer) $ancestor['term_id'];
2037
+ }
2038
  }
 
 
 
 
2039
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items updated term_map = " . var_export( $term_map, true ), 0 );
2040
+ } // foreach term
2041
+ } // foreach level
2042
+ }
2043
 
2044
+ foreach ( $parent_terms as $term ) {
2045
+ if ( $item_is_hierarchical ) {
2046
+ $item_term = term_exists( $term->name, $item_taxonomy );
2047
 
2048
+ if ( $item_term !== 0 && $item_term !== NULL ) {
2049
+ $item_terms[ $item_term['term_id'] ] = (integer) $item_term['term_id'];
 
 
 
 
2050
  } else {
2051
+ if ( $term->parent && !empty( $term_map[ $term->parent ] ) ) {
2052
+ $item_term = wp_insert_term( $term->name, $item_taxonomy, array( 'parent' => $term_map[ $term->parent ] ) );
2053
+ //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items child item_term = " . var_export( $item_term, true ), 0 );
2054
+ } else {
2055
+ $item_term = wp_insert_term( $term->name, $item_taxonomy );
2056
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items root item_term = " . var_export( $item_term, true ), 0 );
2057
+ }
2058
 
2059
+ if ( ( ! is_wp_error( $item_term ) ) && isset( $item_term['term_id'] ) ) {
2060
+ $item_terms[ $item_term['term_id'] ] = (integer) $item_term['term_id'];
2061
+ }
2062
  }
2063
+ } else {
2064
+ $item_terms[ $term->term_taxonomy_id ] = $term->name;
2065
  }
 
 
2066
  }
 
2067
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items( {$post_id} ) item_terms = " . var_export( $item_terms, true ), 0 );
2068
 
2069
+ foreach ( $attachments as $sequence => $attachment_id ) {
2070
+ $result = wp_set_object_terms( $attachment_id, $item_terms, $item_taxonomy, $append );
2071
+ if ( is_array( $result) ) {
2072
+ $updated_items++;
2073
+ } else {
2074
+ $errors++;
2075
+ }
 
 
2076
  //error_log( __LINE__ . " Insert_Fixit::_copy_parent_terms_to_items( {$post_id}, {$attachment_id}, {$append} ) result = " . var_export( $result, true ), 0 );
2077
+ } // foreach attachment
2078
+ } // foreach taxonomy pair
2079
  } // foreach post
2080
 
2081
  $messages = '';
2086
  }
2087
 
2088
  // Flush the Media/Edit Taxonomy Attachments column cache; see MLAObjects in class-mla-objects.php
2089
+ delete_transient( MLA_OPTION_PREFIX . 't_term_counts_' . $item_taxonomy );
2090
 
2091
+ return $messages . "<br>Parent Terms to Items matched {$attached_parents} posts/pages to {$attached_items} items and updated {$updated_items} item+taxonomy assignments. There were {$skipped} skipped parents and {$errors} error(s).\n";
2092
  } // _copy_parent_terms_to_items
2093
 
2094
  /**
2101
  private static function _copy_item_terms_to_parent() {
2102
  self::_build_attached_items_cache();
2103
 
2104
+ $item_taxonomy = isset( $_REQUEST[ self::SLUG_PREFIX . 'item_taxonomy' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'item_taxonomy' ] : '';
2105
+ $parent_taxonomy = isset( $_REQUEST[ self::SLUG_PREFIX . 'parent_taxonomy' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'parent_taxonomy' ] : '';
2106
  $append = 'add' === ( isset( $_REQUEST[ self::SLUG_PREFIX . 'add_replace' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'add_replace' ] : 'add' );
2107
+ $item_taxonomies = explode( ',', $item_taxonomy );
2108
+ $parent_taxonomies = explode( ',', $parent_taxonomy );
2109
 
2110
+ if ( count( $item_taxonomies ) !== count( $parent_taxonomies ) ) {
2111
+ return 'ERROR - Item and parent taxonomy input counts are not equal.';
2112
+ }
 
 
2113
 
2114
  $taxonomies = get_object_taxonomies( 'attachment', 'objects' );
2115
  //error_log( __LINE__ . " Insert_Fixit::_copy_item_terms_to_parent attachment taxonomies = " . var_export( $taxonomies, true ), 0 );
2116
 
2117
+ // Hard-code additional taxonomy pairs ( item => parent ) here
2118
+ $taxonomy_pairs = array ();
2119
+
2120
+ foreach ( $item_taxonomies as $index => $item_taxonomy ) {
2121
+ if ( isset( $taxonomies[ $item_taxonomy ] ) ) {
2122
+ $taxonomy_pairs[ $item_taxonomy ] = $parent_taxonomies[ $index ];
2123
+ } else {
2124
+ return "ERROR - Item Taxonomy {$item_taxonomy} not valid for post_type 'attachment'.";
2125
+ }
2126
  }
2127
+ //error_log( __LINE__ . " Insert_Fixit::_copy_item_terms_to_parent taxonomy_pairs = " . var_export( $taxonomy_pairs, true ), 0 );
2128
+
2129
+ $attached_parents = count( self::$attached_items );
2130
+ $attached_items = 0;
2131
+ $updated_parents = 0;
2132
+ $skipped = 0;
2133
+ $errors = 0;
2134
 
2135
  foreach ( self::$attached_items as $post_id => $attachments ) {
2136
  // get the post/page object
2137
  $post = get_post( $post_id );
2138
  $taxonomies = get_object_taxonomies( $post, 'objects' );
2139
 
2140
+ foreach ( $taxonomy_pairs as $item_taxonomy => $parent_taxonomy ) {
2141
+ if ( ! isset( $taxonomies[ $parent_taxonomy ] ) ) {
2142
+ $skipped++;
2143
+ continue;
2144
+ }
2145
 
2146
+ $parent_is_hierarchical = $taxonomies[ $parent_taxonomy ]->hierarchical;
2147
 
2148
+ $item_terms = array();
2149
+ foreach ( $attachments as $sequence => $attachment_id ) {
2150
+ $attached_items++;
2151
 
2152
+ $terms = wp_get_object_terms( $attachment_id, $item_taxonomy );
2153
+ foreach( $terms as $term ) {
2154
+ $item_terms[ $term->term_taxonomy_id ] = $term;
2155
+ }
2156
+ } // foreach attachment
2157
+ //error_log( __LINE__ . " Insert_Fixit::_copy_item_terms_to_parent( {$post_id} {$item_taxonomy} {$parent_taxonomy} ) item_terms = " . var_export( $item_terms, true ), 0 );
2158
 
2159
+ $parent_terms = array();
2160
+ foreach ( $item_terms as $term_taxonomy_id => $term ) {
2161
+ if ( $parent_is_hierarchical ) {
2162
+ $parent_term = term_exists( $term->name, $parent_taxonomy );
2163
 
2164
+ if ( $parent_term !== 0 && $parent_term !== NULL ) {
 
 
 
 
2165
  $parent_terms[ $parent_term['term_id'] ] = (integer) $parent_term['term_id'];
2166
+ } else {
2167
+ $parent_term = wp_insert_term( $term->name, $parent_taxonomy );
2168
+ if ( ( ! is_wp_error( $parent_term ) ) && isset( $parent_term['term_id'] ) ) {
2169
+ $parent_terms[ $parent_term['term_id'] ] = (integer) $parent_term['term_id'];
2170
+ }
2171
  }
2172
+ } else {
2173
+ $parent_terms[ $term->term_taxonomy_id ] = $term->name;
2174
  }
 
 
2175
  }
2176
+ //error_log( __LINE__ . " Insert_Fixit::_copy_item_terms_to_parent( {$post_id} {$item_taxonomy} {$parent_taxonomy} ) parent_terms = " . var_export( $parent_terms, true ), 0 );
 
2177
 
2178
+ if ( ( 0 < count( $parent_terms ) ) || ( false == $append ) ) {
2179
+ $result = wp_set_object_terms( $post_id, $parent_terms, $parent_taxonomy, $append );
2180
+ if ( is_array( $result) ) {
2181
+ $updated_parents++;
2182
+ } else {
2183
+ $errors++;
2184
+ }
2185
+ }
2186
+ } // foreach taxonomy_pair
2187
  } // foreach post
2188
 
2189
  return "<br>Item Terms to Parent matched {$attached_parents} posts/pages to {$attached_items} items and updated {$updated_parents} parent posts/pages. There were {$skipped} skipped parents and {$errors} error(s).\n";
2190
  } // _copy_item_terms_to_parent
2191
 
2192
+
2193
+ /**
2194
+ * Convert a custom field value to a string
2195
+ *
2196
+ * @since 1.15
2197
+ *
2198
+ * @param string Custom Field value
2199
+ *
2200
+ * @return string HTML markup for results/messages
2201
+ */
2202
+ private static function _custom_value_to_text( $field_value ) {
2203
+ if ( is_scalar( $field_value ) ) {
2204
+ $field_value = (string) $field_value;
2205
+ return trim( $field_value );
2206
+ }
2207
+
2208
+ if ( is_array( $field_value ) ) {
2209
+ $value_array = array();
2210
+ foreach ( $field_value as $value ) {
2211
+ $value = self::_custom_value_to_text( $value );
2212
+
2213
+ if ( !empty( $value ) ) {
2214
+ $value_array[] = self::_custom_value_to_text( $value );
2215
+ }
2216
+ }
2217
+
2218
+ return implode( ',', $value_array );
2219
+ }
2220
+
2221
+ return var_export( $field_value, true );
2222
+ } // _custom_value_to_text
2223
+
2224
+ /**
2225
+ * Copy assigned terms from attached items to the parent post/page
2226
+ *
2227
+ * @since 1.04
2228
+ *
2229
+ * @return string HTML markup for results/messages
2230
+ */
2231
+ private static function _copy_item_fields_to_parent() {
2232
+ self::_build_attached_items_cache();
2233
+
2234
+ $item_fields = isset( $_REQUEST[ self::SLUG_PREFIX . 'item_fields' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'item_fields' ] : '';
2235
+ $item_fields = explode( ',', $item_fields );
2236
+ $fields_option = isset( $_REQUEST[ self::SLUG_PREFIX . 'fields_option' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'fields_option' ] : 'text';
2237
+
2238
+ // Hard-code additional custom field names in the second array() here
2239
+ $item_fields = array_merge( $item_fields, array () );
2240
+
2241
+ if ( empty( $item_fields ) ) {
2242
+ return 'ERROR - Custom field list is empty.';
2243
+ }
2244
+
2245
+ $attached_parents = count( self::$attached_items );
2246
+ $attached_items = 0;
2247
+ $updated_parents = 0;
2248
+ $skipped = 0;
2249
+ $errors = 0;
2250
+
2251
+ foreach ( self::$attached_items as $post_id => $attachments ) {
2252
+ // get the post/page object
2253
+ $post = get_post( $post_id );
2254
+
2255
+ foreach ( $item_fields as $item_field_name ) {
2256
+ $item_field_values = array();
2257
+ foreach ( $attachments as $sequence => $attachment_id ) {
2258
+ $attached_items++;
2259
+
2260
+ $values = get_metadata( 'post', $attachment_id, $item_field_name, false );
2261
+ if ( false !== $values && !empty( $values ) ) {
2262
+ $item_field_values[ $attachment_id ] = get_metadata( 'post', $attachment_id, $item_field_name, false );
2263
+ }
2264
+ } // foreach attachment
2265
+ //error_log( __LINE__ . " Insert_Fixit::_copy_item_fields_to_parent( {$post_id} $item_field_name ) item_field_values = " . var_export( $item_field_values, true ), 0 );
2266
+
2267
+ if ( 0 < count( $item_field_values ) ) {
2268
+ $parent_value = array();
2269
+
2270
+ switch ( $fields_option ) {
2271
+ case 'single':
2272
+ reset( $item_field_values );
2273
+ $parent_value = self::_custom_value_to_text( current( $item_field_values ) );
2274
+ break;
2275
+ // case 'export':
2276
+ // break;
2277
+ case 'multi':
2278
+ foreach ( $item_field_values as $value ) {
2279
+ $parent_value = array_merge( $parent_value, $value );
2280
+ }
2281
+
2282
+ $parent_value = array_unique( $parent_value );
2283
+ break;
2284
+ case 'text':
2285
+ default:
2286
+ foreach ( $item_field_values as $value ) {
2287
+ $parent_value[] = self::_custom_value_to_text( $value );
2288
+ }
2289
+
2290
+ $parent_value = implode( ',', $parent_value );
2291
+ }
2292
+ //error_log( __LINE__ . " Insert_Fixit::_copy_item_fields_to_parent( {$post_id} $item_field_name ) parent_value = " . var_export( $parent_value, true ), 0 );
2293
+ $result = delete_metadata( 'post', $post_id, $item_field_name, NULL, false );
2294
+ //error_log( __LINE__ . " Insert_Fixit::_copy_item_fields_to_parent( {$post_id} $item_field_name ) delete result = " . var_export( $result, true ), 0 );
2295
+ if ( 'multi' === $fields_option ) {
2296
+ foreach ( $parent_value as $value ) {
2297
+ $result = add_post_meta( $post_id, $item_field_name, $value );
2298
+ }
2299
+ } else {
2300
+ $result = update_metadata( 'post', $post_id, $item_field_name, $parent_value );
2301
+ }
2302
+ //error_log( __LINE__ . " Insert_Fixit::_copy_item_fields_to_parent( {$post_id} $item_field_name ) update result = " . var_export( $result, true ), 0 );
2303
+
2304
+ if ( false !== $result ) {
2305
+ $updated_parents++;
2306
+ } else {
2307
+ $errors++;
2308
+ }
2309
+ }
2310
+ } // foreach item_field_name
2311
+ } // foreach post
2312
+
2313
+ return "<br>Item Fields to Parent matched {$attached_parents} posts/pages to {$attached_items} items and updated {$updated_parents} parent posts/pages. There were {$skipped} skipped parents and {$errors} error(s).\n";
2314
+ } // _copy_item_fields_to_parent
2315
+
2316
  /**
2317
  * Rebuild the Image Inserts and Image Objects arrays and cache them
2318
  *
examples/plugins/mla-tax-query-example.php CHANGED
@@ -7,8 +7,12 @@
7
  * A custom shortcode parameter, "my_custom_sql", activates the logic in this plugin.
8
  *
9
  * The "my_custom_sql" parameter accepts these query arguments:
10
- * - ONE taxonomy=(/)slug(,(/)slug)... argument, to INCLUDE or /EXCLUDE terms
11
- * i.e. put a slash in front of a term to EXCLUDE items assigned to it
 
 
 
 
12
  * - include_children=true
13
  * - author=ID(,ID...)
14
  * - order and/or orderby
@@ -53,8 +57,12 @@
53
  * opened on 10/19/2017 by "ratterizzo".
54
  * https://wordpress.org/support/topic/504-time-out-issue/
55
  *
 
 
 
 
56
  * @package MLA tax query Example
57
- * @version 1.09
58
  */
59
 
60
  /*
@@ -62,10 +70,10 @@ Plugin Name: MLA tax query Example
62
  Plugin URI: http://davidlingren.com/
63
  Description: Replaces the WP_Query tax_query with a more efficient, direct SQL query
64
  Author: David Lingren
65
- Version: 1.09
66
  Author URI: http://davidlingren.com/
67
 
68
- Copyright 2013 - 2017 David Lingren
69
 
70
  This program is free software; you can redistribute it and/or modify
71
  it under the terms of the GNU General Public License as published by
@@ -329,14 +337,15 @@ class MLATaxQueryExample {
329
  $exclude_ttids = array();
330
 
331
  // Find taxonomy argument, if present, and collect terms
332
- $taxonomies = get_object_taxonomies( 'attachment', 'names' );
333
- foreach( $taxonomies as $taxonomy ) {
 
334
  if ( empty( $my_query_vars[ $taxonomy ] ) ) {
335
  continue;
336
  }
337
 
338
- // Found the taxonomy; collect the terms
339
- $include_children = isset( $my_query_vars['include_children'] ) && 'true' == strtolower( trim( $my_query_vars['include_children'] ) );
340
 
341
  // Allow for multiple term slug values, separate includes from excludes
342
  $terms = array();
@@ -358,7 +367,7 @@ class MLATaxQueryExample {
358
 
359
  if ( $include_children ) {
360
  $args = array( 'child_of' => $term->term_id, 'hide_empty' => false );
361
- $children = MLAQuery::mla_wp_get_terms( 'attachment_category', $args );
362
  foreach( $children as $child ) {
363
  $include_ttids[] = $child->term_taxonomy_id;
364
  }
@@ -371,14 +380,14 @@ class MLATaxQueryExample {
371
 
372
  if ( $include_children ) {
373
  $args = array( 'child_of' => $exclude->term_id, 'hide_empty' => false );
374
- $children = MLAQuery::mla_wp_get_terms( 'attachment_category', $args );
375
  foreach( $children as $child ) {
376
  $exclude_ttids[] = $child->term_taxonomy_id;
377
  }
378
  } // include_children
379
  } // $exclude
380
 
381
- break;
382
  } // foreach $taxonomy
383
  } // _find_ttids
384
 
@@ -422,6 +431,13 @@ class MLATaxQueryExample {
422
  $my_query_vars = shortcode_parse_atts( $my_query_vars );
423
  }
424
 
 
 
 
 
 
 
 
425
  self::_find_ttids( $my_query_vars, $ttids, $exclude_ttids );
426
 
427
  // Build an array of SQL clauses
@@ -452,7 +468,14 @@ class MLATaxQueryExample {
452
  // No includes, only excludes
453
  $query[] = 'WHERE ( 1=1';
454
  } else {
455
- $query[] = 'WHERE ( tr.term_taxonomy_id IN (' . join( ',', $placeholders ) . ')';
 
 
 
 
 
 
 
456
  }
457
 
458
  if ( !empty( $exclude_ttids ) ) {
@@ -537,8 +560,10 @@ class MLATaxQueryExample {
537
  if ( $is_pagination ) {
538
  return $wpdb->get_var( $query );
539
  }
 
540
 
541
  $ids = $wpdb->get_results( $query );
 
542
  if ( is_array( $ids ) ) {
543
  $includes = array();
544
  foreach ( $ids as $id ) {
@@ -718,6 +743,13 @@ class MLATaxQueryExample {
718
  $my_query_vars = shortcode_parse_atts( $my_query_vars );
719
  }
720
 
 
 
 
 
 
 
 
721
  self::_find_ttids( $my_query_vars, $ttids, $exclude_ttids );
722
 
723
  // Build an array of SQL clauses for the term_relationships query
@@ -744,7 +776,14 @@ class MLATaxQueryExample {
744
  // No includes, only excludes
745
  $subquery[] = 'WHERE ( 1=1';
746
  } else {
747
- $subquery[] = 'WHERE ( tr.term_taxonomy_id IN (' . join( ',', $placeholders ) . ')';
 
 
 
 
 
 
 
748
  }
749
 
750
  if ( !empty( $exclude_ttids ) ) {
@@ -774,7 +813,10 @@ class MLATaxQueryExample {
774
  $query[] = "SELECT ID FROM {$wpdb->posts} as p";
775
  }
776
 
 
 
777
  $query[] = 'WHERE ( ( p.ID IN ( ' . $wpdb->prepare( $subquery, $subquery_parameters ) . ' ) )';
 
778
 
779
  if ( ! empty( self::$shortcode_attributes['post_mime_type'] ) ) {
780
  if ( 'all' != strtolower( self::$shortcode_attributes['post_mime_type'] ) ) {
@@ -882,8 +924,10 @@ class MLATaxQueryExample {
882
  if ( $is_pagination ) {
883
  return $wpdb->get_var( $query );
884
  }
 
885
 
886
  $ids = $wpdb->get_results( $query );
 
887
  if ( is_array( $ids ) ) {
888
  $includes = array();
889
  foreach ( $ids as $id ) {
7
  * A custom shortcode parameter, "my_custom_sql", activates the logic in this plugin.
8
  *
9
  * The "my_custom_sql" parameter accepts these query arguments:
10
+ * - taxonomy=(/)slug(,(/)slug)... argument, to INCLUDE or /EXCLUDE terms
11
+ * i.e. put a slash in front of a term to EXCLUDE items assigned to it.
12
+ * You can enter more than one taxonomy; all terms from all taxonomies are combined
13
+ * into one list. There is no tax_relation capability.
14
+ * - tax_operator=AND - changes the INCLUDE portion of the query to require a match
15
+ * on ALL of the assigned terms. The EXCLUDE portion is inchanged.
16
  * - include_children=true
17
  * - author=ID(,ID...)
18
  * - order and/or orderby
57
  * opened on 10/19/2017 by "ratterizzo".
58
  * https://wordpress.org/support/topic/504-time-out-issue/
59
  *
60
+ * Enhanced for support topic "MLA Tax Query Example plugin syntax"
61
+ * opened on 12/15/2019 by "feelee".
62
+ * https://wordpress.org/support/topic/mla-tax-query-example-plugin-syntax/
63
+ *
64
  * @package MLA tax query Example
65
+ * @version 1.10
66
  */
67
 
68
  /*
70
  Plugin URI: http://davidlingren.com/
71
  Description: Replaces the WP_Query tax_query with a more efficient, direct SQL query
72
  Author: David Lingren
73
+ Version: 1.10
74
  Author URI: http://davidlingren.com/
75
 
76
+ Copyright 2013 - 2019 David Lingren
77
 
78
  This program is free software; you can redistribute it and/or modify
79
  it under the terms of the GNU General Public License as published by
337
  $exclude_ttids = array();
338
 
339
  // Find taxonomy argument, if present, and collect terms
340
+ $taxonomies = get_object_taxonomies( 'attachment', 'objects' );
341
+ foreach( $taxonomies as $taxonomy_object ) {
342
+ $taxonomy = $taxonomy_object->name;
343
  if ( empty( $my_query_vars[ $taxonomy ] ) ) {
344
  continue;
345
  }
346
 
347
+ // Found a taxonomy; collect the terms
348
+ $include_children = isset( $my_query_vars['include_children'] ) && 'true' == strtolower( trim( $my_query_vars['include_children'] ) ) && $taxonomy_object->hierarchical;
349
 
350
  // Allow for multiple term slug values, separate includes from excludes
351
  $terms = array();
367
 
368
  if ( $include_children ) {
369
  $args = array( 'child_of' => $term->term_id, 'hide_empty' => false );
370
+ $children = MLAQuery::mla_wp_get_terms( $taxonomy, $args );
371
  foreach( $children as $child ) {
372
  $include_ttids[] = $child->term_taxonomy_id;
373
  }
380
 
381
  if ( $include_children ) {
382
  $args = array( 'child_of' => $exclude->term_id, 'hide_empty' => false );
383
+ $children = MLAQuery::mla_wp_get_terms( $taxonomy, $args );
384
  foreach( $children as $child ) {
385
  $exclude_ttids[] = $child->term_taxonomy_id;
386
  }
387
  } // include_children
388
  } // $exclude
389
 
390
+ //break; // Remove single-taxonomy restriction
391
  } // foreach $taxonomy
392
  } // _find_ttids
393
 
431
  $my_query_vars = shortcode_parse_atts( $my_query_vars );
432
  }
433
 
434
+ // Extract and validate tax_operator
435
+ $tax_operator = isset( $my_query_vars['tax_operator'] ) ? strtoupper( $my_query_vars['tax_operator'] ) : 'IN';
436
+ if ( ! in_array( $tax_operator, array( 'AND', 'IN' ) ) ) {
437
+ $tax_operator = 'IN';
438
+ }
439
+ //error_log( __LINE__ . " single_query( $tax_operator ) my_query_vars = " . var_export( $my_query_vars, true ), 0 );
440
+
441
  self::_find_ttids( $my_query_vars, $ttids, $exclude_ttids );
442
 
443
  // Build an array of SQL clauses
468
  // No includes, only excludes
469
  $query[] = 'WHERE ( 1=1';
470
  } else {
471
+ switch ( $tax_operator ) {
472
+ case 'AND':
473
+ $query[] = "WHERE ( ( SELECT COUNT(1) FROM {$wpdb->term_relationships} WHERE ( term_taxonomy_id IN (" . join( ',', $placeholders ) . ') ) AND object_id = tr.object_id ) = ' . count( $placeholders );
474
+ break;
475
+ case 'IN':
476
+ default:
477
+ $query[] = 'WHERE ( tr.term_taxonomy_id IN (' . join( ',', $placeholders ) . ')';
478
+ } // tax_operator
479
  }
480
 
481
  if ( !empty( $exclude_ttids ) ) {
560
  if ( $is_pagination ) {
561
  return $wpdb->get_var( $query );
562
  }
563
+ //error_log( __LINE__ . ' single_query query = ' . var_export( $query, true ), 0 );
564
 
565
  $ids = $wpdb->get_results( $query );
566
+ //error_log( __LINE__ . ' single_query ids = ' . var_export( $ids, true ), 0 );
567
  if ( is_array( $ids ) ) {
568
  $includes = array();
569
  foreach ( $ids as $id ) {
743
  $my_query_vars = shortcode_parse_atts( $my_query_vars );
744
  }
745
 
746
+ // Extract and validate tax_operator
747
+ $tax_operator = isset( $my_query_vars['tax_operator'] ) ? strtoupper( $my_query_vars['tax_operator'] ) : 'IN';
748
+ if ( ! in_array( $tax_operator, array( 'AND', 'IN' ) ) ) {
749
+ $tax_operator = 'IN';
750
+ }
751
+ //error_log( __LINE__ . " double_query( $tax_operator ) my_query_vars = " . var_export( $my_query_vars, true ), 0 );
752
+
753
  self::_find_ttids( $my_query_vars, $ttids, $exclude_ttids );
754
 
755
  // Build an array of SQL clauses for the term_relationships query
776
  // No includes, only excludes
777
  $subquery[] = 'WHERE ( 1=1';
778
  } else {
779
+ switch ( $tax_operator ) {
780
+ case 'AND':
781
+ $subquery[] = "WHERE ( ( SELECT COUNT(1) FROM {$wpdb->term_relationships} WHERE ( term_taxonomy_id IN (" . join( ',', $placeholders ) . ') ) AND object_id = tr.object_id ) = ' . count( $placeholders );
782
+ break;
783
+ case 'IN':
784
+ default:
785
+ $subquery[] = 'WHERE ( tr.term_taxonomy_id IN (' . join( ',', $placeholders ) . ')';
786
+ } // tax_operator
787
  }
788
 
789
  if ( !empty( $exclude_ttids ) ) {
813
  $query[] = "SELECT ID FROM {$wpdb->posts} as p";
814
  }
815
 
816
+ //error_log( __LINE__ . " double_query( $tax_operator ) subquery = " . var_export( $subquery, true ), 0 );
817
+ //error_log( __LINE__ . " double_query( $tax_operator ) subquery_parameters = " . var_export( $subquery_parameters, true ), 0 );
818
  $query[] = 'WHERE ( ( p.ID IN ( ' . $wpdb->prepare( $subquery, $subquery_parameters ) . ' ) )';
819
+ //error_log( __LINE__ . " double_query( $tax_operator ) query = " . var_export( $query, true ), 0 );
820
 
821
  if ( ! empty( self::$shortcode_attributes['post_mime_type'] ) ) {
822
  if ( 'all' != strtolower( self::$shortcode_attributes['post_mime_type'] ) ) {
924
  if ( $is_pagination ) {
925
  return $wpdb->get_var( $query );
926
  }
927
+ //error_log( __LINE__ . ' double_query query = ' . var_export( $query, true ), 0 );
928
 
929
  $ids = $wpdb->get_results( $query );
930
+ //error_log( __LINE__ . ' double_query ids = ' . var_export( $ids, true ), 0 );
931
  if ( is_array( $ids ) ) {
932
  $includes = array();
933
  foreach ( $ids as $id ) {
examples/plugins/mla-ui-elements-example.php CHANGED
@@ -68,8 +68,12 @@
68
  * opened on 3/28/2019 by "fabrizioarnone".
69
  * https://wordpress.org/support/topic/search-solution/
70
  *
 
 
 
 
71
  * @package MLA UI Elements Example
72
- * @version 1.11
73
  */
74
 
75
  /*
@@ -77,7 +81,7 @@ Plugin Name: MLA UI Elements Example
77
  Plugin URI: http://davidlingren.com/
78
  Description: Provides shortcodes to improve user experience for [mla_term_list], [mla_tag_cloud] and [mla_gallery] shortcodes
79
  Author: David Lingren
80
- Version: 1.11
81
  Author URI: http://davidlingren.com/
82
 
83
  Copyright 2016-2019 David Lingren
@@ -183,7 +187,12 @@ class MLAUIElementsExample {
183
  }
184
 
185
  // Pass "slug" overides to mla_gallery_attributes; using the slug is a common practice
186
- $mla_option_value = in_array( $shortcode_attributes['mla_option_value'], array( '{+slug+}', '[+slug+]' ) ) ? 'slug' : 'term_id';
 
 
 
 
 
187
  foreach( explode( ',', $shortcode_attributes['taxonomy'] ) as $taxonomy ) {
188
  self::$mla_option_values[ $taxonomy ] = $mla_option_value;
189
  }
@@ -241,7 +250,10 @@ class MLAUIElementsExample {
241
  }
242
 
243
  $terms = $_REQUEST['tax_input'][ $taxonomy ];
244
-
 
 
 
245
  // Check for a dropdown control with "All Terms" selected
246
  if ( empty( $shortcode_attributes['option_all_value'] ) ) {
247
  $option_all = array_search( '0', $terms );
68
  * opened on 3/28/2019 by "fabrizioarnone".
69
  * https://wordpress.org/support/topic/search-solution/
70
  *
71
+ * Enhanced (bug fixes) for support topic "Drop down not sticking"
72
+ * opened on 12/10/2019 by "ageingdj".
73
+ * https://wordpress.org/support/topic/drop-down-not-sticking/
74
+ *
75
  * @package MLA UI Elements Example
76
+ * @version 1.12
77
  */
78
 
79
  /*
81
  Plugin URI: http://davidlingren.com/
82
  Description: Provides shortcodes to improve user experience for [mla_term_list], [mla_tag_cloud] and [mla_gallery] shortcodes
83
  Author: David Lingren
84
+ Version: 1.12
85
  Author URI: http://davidlingren.com/
86
 
87
  Copyright 2016-2019 David Lingren
187
  }
188
 
189
  // Pass "slug" overides to mla_gallery_attributes; using the slug is a common practice
190
+ if ( empty( $shortcode_attributes['mla_option_value'] ) ) {
191
+ $mla_option_value = 'term_id';
192
+ } else {
193
+ $mla_option_value = in_array( $shortcode_attributes['mla_option_value'], array( '{+slug+}', '[+slug+]' ) ) ? 'slug' : 'term_id';
194
+ }
195
+
196
  foreach( explode( ',', $shortcode_attributes['taxonomy'] ) as $taxonomy ) {
197
  self::$mla_option_values[ $taxonomy ] = $mla_option_value;
198
  }
250
  }
251
 
252
  $terms = $_REQUEST['tax_input'][ $taxonomy ];
253
+ if ( is_string( $terms ) ) {
254
+ $terms = (array) trim( stripslashes( $terms ), ' \'"' );
255
+ }
256
+
257
  // Check for a dropdown control with "All Terms" selected
258
  if ( empty( $shortcode_attributes['option_all_value'] ) ) {
259
  $option_all = array_search( '0', $terms );
examples/plugins/woofixit.php CHANGED
@@ -52,6 +52,9 @@
52
  * - Copy product_category and/or product_tag term assignments to Media Library items
53
  * for items used as Product Image or in the Product Gallery
54
  *
 
 
 
55
  * Created for support topic "Remove first image in all product galleries"
56
  * opened on 5/23/2014 by "Dana S".
57
  * https://wordpress.org/support/topic/remove-first-image-in-all-product-galleries/
@@ -80,8 +83,16 @@
80
  * opened on 9/18/2019 by "wimvl".
81
  * https://wordpress.org/support/topic/product-categories-thumbnails-2/
82
  *
 
 
 
 
 
 
 
 
83
  * @package WooCommerce Fixit
84
- * @version 2.05
85
  */
86
 
87
  /*
@@ -89,7 +100,7 @@ Plugin Name: WooCommerce Fixit
89
  Plugin URI: http://davidlingren.com/
90
  Description: Adds "product:" and "product_terms:" custom substitution prefixes and adds a Tools/Woo Fixit submenu with buttons to perform a variety of MLA/WooCommerce repair and enhancement operations.
91
  Author: David Lingren
92
- Version: 2.05
93
  Author URI: http://davidlingren.com/
94
 
95
  Copyright 2014-2019 David Lingren
@@ -122,7 +133,7 @@ class Woo_Fixit {
122
  *
123
  * @var string
124
  */
125
- const CURRENT_VERSION = '2.05';
126
 
127
  /**
128
  * Slug prefix for registering and enqueueing submenu pages, style sheets and scripts
@@ -163,6 +174,15 @@ class Woo_Fixit {
163
  private static $append_item_id = false;
164
  const APPEND_ITEM_ID = 'append-item-id';
165
 
 
 
 
 
 
 
 
 
 
166
  /**
167
  * Use WordPress unique slug function
168
  *
@@ -173,6 +193,15 @@ class Woo_Fixit {
173
  private static $check_unique_slug = false;
174
  const CHECK_UNIQUE_SLUG = 'check-unique-slug';
175
 
 
 
 
 
 
 
 
 
 
176
  /**
177
  * Content Template for Product Image/Product Gallery Images
178
  *
@@ -193,6 +222,15 @@ class Woo_Fixit {
193
  private static $process_category = false;
194
  const INPUT_PROCESS_CATEGORY = 'category';
195
 
 
 
 
 
 
 
 
 
 
196
  /**
197
  * Process term assignments for Product Tag
198
  *
@@ -203,6 +241,15 @@ class Woo_Fixit {
203
  private static $process_tag = false;
204
  const INPUT_PROCESS_TAG = 'tag';
205
 
 
 
 
 
 
 
 
 
 
206
  /**
207
  * Chunk (offset) to start term assignments at
208
  *
@@ -233,6 +280,212 @@ class Woo_Fixit {
233
  private static $chunk_size = 1000;
234
  const INPUT_CHUNK_SIZE = 'size';
235
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  /**
237
  * Initialization function, similar to __construct()
238
  *
@@ -248,7 +501,21 @@ class Woo_Fixit {
248
  if ( !is_admin() )
249
  return;
250
 
251
- //add_action( 'admin_init', 'Woo_Fixit::admin_init' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  add_action( 'admin_menu', 'Woo_Fixit::admin_menu' );
253
  }
254
 
@@ -330,7 +597,9 @@ class Woo_Fixit {
330
  } // _evaluate_terms
331
 
332
  /**
333
- * Add the "product:" and "product_terms:" custom substitution prefixes
 
 
334
  *
335
  * @since 2.00
336
  *
@@ -455,13 +724,55 @@ class Woo_Fixit {
455
  } // mla_expand_custom_prefix
456
 
457
  /**
458
- * Admin Init Action
459
  *
460
- * @since 1.00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  *
 
 
 
 
 
462
  * @return void
463
  */
464
- public static function admin_init() {
 
 
 
 
 
 
 
 
 
 
 
465
  }
466
 
467
  /**
@@ -496,42 +807,14 @@ class Woo_Fixit {
496
  }
497
 
498
  /**
499
- * Render (echo) the "WooCommerce Fixit" submenu in the Tools section
500
  *
501
- * @since 1.00
502
  *
503
- * @return void Echoes HTML markup for the submenu page
504
  */
505
- public static function render_tools_page() {
506
- //error_log( __LINE__ . ' Woo_Fixit::render_tools_page() $_REQUEST = ' . var_export( $_REQUEST, true ), 0 );
507
- if ( !current_user_can( 'manage_options' ) ) {
508
- echo "WooCommerce Fixit - Error</h2>\n";
509
- wp_die( 'You do not have permission to manage plugin settings.' );
510
- }
511
-
512
- /*
513
- * Extract relevant query arguments
514
- */
515
- self::$first_product = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_FIRST_PRODUCT ] ) ? $_REQUEST[ self::SLUG_PREFIX . self::INPUT_FIRST_PRODUCT ] : '';
516
- self::$last_product = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_LAST_PRODUCT ] ) ? $_REQUEST[ self::SLUG_PREFIX . self::INPUT_LAST_PRODUCT ] : '';
517
-
518
- self::$append_item_id = isset( $_REQUEST[ self::SLUG_PREFIX . self::APPEND_ITEM_ID ] ) ? true : false;
519
- $append_item_id_attr = self::$append_item_id ? ' checked="checked" ' : ' ';
520
- self::$check_unique_slug = isset( $_REQUEST[ self::SLUG_PREFIX . self::CHECK_UNIQUE_SLUG ] ) ? true : false;
521
- $check_unique_slug_attr = self::$check_unique_slug ? ' checked="checked" ' : ' ';
522
-
523
- self::$content_template = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_CONTENT_TEMPLATE ] ) ? trim( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_CONTENT_TEMPLATE ] ) : self::$content_template;
524
-
525
- self::$process_category = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_PROCESS_CATEGORY ] ) ? true : false;
526
- $category_attr = self::$process_category ? ' checked="checked" ' : ' ';
527
- self::$process_tag = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_PROCESS_TAG ] ) ? true : false;
528
- $tag_attr = self::$process_tag ? ' checked="checked" ' : ' ';
529
-
530
- self::$start_chunk = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_FIRST_CHUNK ] ) ? absint( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_FIRST_CHUNK ] ) : self::$start_chunk;
531
- self::$stop_chunk = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_LAST_CHUNK ] ) ? absint( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_LAST_CHUNK ] ) : self::$stop_chunk;
532
- self::$chunk_size = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_CHUNK_SIZE ] ) ? absint( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_CHUNK_SIZE ] ) : self::$chunk_size;
533
-
534
- $setting_actions = array(
535
  'help' => array( 'handler' => '', 'comment' => 'Enter first/last Product ID values above to restrict tool application range. You can find ID values by hovering over the "Name" column in the WooCommerce/Products submenu table.' ),
536
  'warning' => array( 'handler' => '', 'comment' => '<strong>These tools make permanent updates to your database.</strong> Make a backup before you use the tools so you can restore your old values if you don&rsquo;t like the results.' ),
537
 
@@ -546,9 +829,9 @@ class Woo_Fixit {
546
  'comment' => '<strong>Replace ALL</strong> item Title fields with re-formatted file name.' ),
547
  'c1a' => array( 'handler' => '', 'comment' => '<hr>' ),
548
  't0301' => array( 'open' => '<table><tr>' ),
549
- 't0302' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle"><input name="' . self::SLUG_PREFIX . self::APPEND_ITEM_ID . '" type="checkbox"' . $append_item_id_attr . 'value="' . self::APPEND_ITEM_ID . '"></td>' ),
550
  't0303' => array( 'continue' => ' <td style="text-align: left; padding-right: 5px" valign="middle">Append Item ID</td>' ),
551
- 't0304' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle"><input name="' . self::SLUG_PREFIX . self::CHECK_UNIQUE_SLUG . '" type="checkbox"' . $check_unique_slug_attr . 'value="' . self::CHECK_UNIQUE_SLUG . '"></td>' ),
552
  't0305' => array( 'continue' => ' <td style="text-align: left; padding-right: 5px" valign="middle">Ensure Unique Slug</td>' ),
553
  't0306' => array( 'continue' => ' <td colspan=2 style="text-align: right; padding-right: 5px" valign="middle">&nbsp;</td>' ),
554
  't0307' => array( 'continue' => '</tr><tr>' ),
@@ -633,9 +916,9 @@ class Woo_Fixit {
633
  'comment' => '<strong>Replace ALL</strong> Att. Categories assignments from Att. Tags, where the Att. Tag matches an existing Att. Category.' ),
634
  'c9' => array( 'handler' => '', 'comment' => '<h3>Term Assignments for Media Library Items</h3>' ),
635
  't0201' => array( 'open' => '<table><tr>' ),
636
- 't0202' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle"><input name="' . self::SLUG_PREFIX . self::INPUT_PROCESS_CATEGORY . '" type="checkbox"' . $category_attr . 'value="' . self::INPUT_PROCESS_CATEGORY . '"></td>' ),
637
  't0203' => array( 'continue' => ' <td style="text-align: left; padding-right: 5px" valign="middle">product_category</td>' ),
638
- 't0204' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle"><input name="' . self::SLUG_PREFIX . self::INPUT_PROCESS_TAG . '" type="checkbox"' . $tag_attr . 'value="' . self::INPUT_PROCESS_TAG . '"></td>' ),
639
  't0205' => array( 'continue' => ' <td style="text-align: left; padding-right: 5px" valign="middle">product_tag</td>' ),
640
  't0206' => array( 'continue' => ' <td colspan=2 style="text-align: right; padding-right: 5px" valign="middle">&nbsp;</td>' ),
641
  't0207' => array( 'continue' => '</tr><tr>' ),
@@ -660,13 +943,123 @@ class Woo_Fixit {
660
  'comment' => '<strong>Delete ALL</strong> product_category and/or product_tag term assignments to Media Library items.' ),
661
  'Assign Terms' => array( 'handler' => '_copy_term_assignments',
662
  'comment' => 'Copy product_category and/or product_tag term assignments to Media Library items for items used as Product Image or in the Product Gallery.' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
663
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
664
 
665
  echo '<div class="wrap">' . "\n";
666
  echo "\t\t" . '<div id="icon-tools" class="icon32"><br/></div>' . "\n";
667
  echo "\t\t" . '<h2>WooCommerce Fixit Tools v' . self::CURRENT_VERSION . '</h2>' . "\n";
668
 
669
  if ( isset( $_REQUEST[ self::SLUG_PREFIX . 'action' ] ) ) {
 
670
  $label = $_REQUEST[ self::SLUG_PREFIX . 'action' ];
671
  if( isset( $setting_actions[ $label ] ) ) {
672
  $action = $setting_actions[ $label ]['handler'];
@@ -703,6 +1096,10 @@ class Woo_Fixit {
703
  }
704
  }
705
 
 
 
 
 
706
  echo "\t\t" . '<div style="width:700px">' . "\n";
707
  echo "\t\t" . '<form action="' . admin_url( 'tools.php?page=' . self::SLUG_PREFIX . 'tools' ) . '" method="post" class="' . self::SLUG_PREFIX . 'tools-form-class" id="' . self::SLUG_PREFIX . 'tools-form-id">' . "\n";
708
  echo "\t\t" . ' <p class="submit" style="padding-bottom: 0;">' . "\n";
@@ -716,6 +1113,8 @@ class Woo_Fixit {
716
  echo "\t\t" . ' <input name="' . self::SLUG_PREFIX . self::INPUT_LAST_PRODUCT . '" type="text" size="5" value="' . self::$last_product . '">' . "\n";
717
  echo "\t\t" . ' </td></tr>' . "\n";
718
 
 
 
719
  foreach ( $setting_actions as $label => $action ) {
720
  if ( isset( $action['open'] ) ) {
721
  echo "\t\t" . ' <tr><td colspan=2 style="padding: 2px 0px;">' . "\n";
@@ -2483,6 +2882,304 @@ VALUES ( {$attachment},'_wp_attachment_image_alt','{$text}' )";
2483
  $tag_text = ( 1 == $tag_added ) ? 'tag' : 'tags';
2484
  return "_copy_term_assignments() processed {$item_count} item(s), added {$cat_added} {$cat_text} to {$cat_count} item(s), and added {$tag_added} {$tag_text} to {$tag_count} item(s).\n";
2485
  } // _copy_term_assignments
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2486
  } //Woo_Fixit
2487
 
2488
  // Install the submenu at an early opportunity
52
  * - Copy product_category and/or product_tag term assignments to Media Library items
53
  * for items used as Product Image or in the Product Gallery
54
  *
55
+ * - Populate Product values from Content Template(s) using Product Image data sources
56
+ * Name, Description, Short Description, Categories, SKU
57
+ *
58
  * Created for support topic "Remove first image in all product galleries"
59
  * opened on 5/23/2014 by "Dana S".
60
  * https://wordpress.org/support/topic/remove-first-image-in-all-product-galleries/
83
  * opened on 9/18/2019 by "wimvl".
84
  * https://wordpress.org/support/topic/product-categories-thumbnails-2/
85
  *
86
+ * Enhanced for support topic "Populating WooCommerce Fields when Uploading Media"
87
+ * opened on 11/26/2019 by "mrphil".
88
+ * https://wordpress.org/support/topic/populating-woocommerce-fields-when-uploading-media/
89
+ *
90
+ * Enhanced for support topic "Image keywords (tags) into a product tags"
91
+ * opened on 1/19/2020 by "kuassar".
92
+ * https://wordpress.org/support/topic/image-keywords-tags-into-a-product-tags/
93
+ *
94
  * @package WooCommerce Fixit
95
+ * @version 2.09
96
  */
97
 
98
  /*
100
  Plugin URI: http://davidlingren.com/
101
  Description: Adds "product:" and "product_terms:" custom substitution prefixes and adds a Tools/Woo Fixit submenu with buttons to perform a variety of MLA/WooCommerce repair and enhancement operations.
102
  Author: David Lingren
103
+ Version: 2.09
104
  Author URI: http://davidlingren.com/
105
 
106
  Copyright 2014-2019 David Lingren
133
  *
134
  * @var string
135
  */
136
+ const CURRENT_VERSION = '2.09';
137
 
138
  /**
139
  * Slug prefix for registering and enqueueing submenu pages, style sheets and scripts
174
  private static $append_item_id = false;
175
  const APPEND_ITEM_ID = 'append-item-id';
176
 
177
+ /**
178
+ * Append Item ID checkbox attribute
179
+ *
180
+ * @since 2.06
181
+ *
182
+ * @var string
183
+ */
184
+ private static $append_item_id_attr = ' ';
185
+
186
  /**
187
  * Use WordPress unique slug function
188
  *
193
  private static $check_unique_slug = false;
194
  const CHECK_UNIQUE_SLUG = 'check-unique-slug';
195
 
196
+ /**
197
+ * Use WordPress unique slug checkbox attribute
198
+ *
199
+ * @since 2.06
200
+ *
201
+ * @var string
202
+ */
203
+ private static $check_unique_slug_attr = ' ';
204
+
205
  /**
206
  * Content Template for Product Image/Product Gallery Images
207
  *
222
  private static $process_category = false;
223
  const INPUT_PROCESS_CATEGORY = 'category';
224
 
225
+ /**
226
+ * Process term assignments for Product Category checkbox attribute
227
+ *
228
+ * @since 2.06
229
+ *
230
+ * @var string
231
+ */
232
+ private static $category_attr = ' ';
233
+
234
  /**
235
  * Process term assignments for Product Tag
236
  *
241
  private static $process_tag = false;
242
  const INPUT_PROCESS_TAG = 'tag';
243
 
244
+ /**
245
+ * Process term assignments for Product Tag checkbox attribute
246
+ *
247
+ * @since 2.06
248
+ *
249
+ * @var string
250
+ */
251
+ private static $tag_attr = ' ';
252
+
253
  /**
254
  * Chunk (offset) to start term assignments at
255
  *
280
  private static $chunk_size = 1000;
281
  const INPUT_CHUNK_SIZE = 'size';
282
 
283
+ /**
284
+ * Product Name (post_title) Template for Populate Product from Product Image
285
+ *
286
+ * @since 2.06
287
+ *
288
+ * @var string
289
+ */
290
+ const NAME_TEMPLATE = 'name-template';
291
+ const DEFAULT_NAME_TEMPLATE = '[+alt_text+]';
292
+
293
+ /**
294
+ * Product Description (post_content) Template for Populate Product from Product Image
295
+ *
296
+ * @since 2.06
297
+ *
298
+ * @var string
299
+ */
300
+ const DESCRIPTION_TEMPLATE = 'description-template';
301
+ const DEFAULT_DESCRIPTION_TEMPLATE = '[+post_content+]';
302
+
303
+ /**
304
+ * Product Short Description (post_excerpt) Template for Populate Product from Product Image
305
+ *
306
+ * @since 2.06
307
+ *
308
+ * @var string
309
+ */
310
+ const SHORT_DESCRIPTION_TEMPLATE = 'short-description-template';
311
+ const DEFAULT_SHORT_DESCRIPTION_TEMPLATE = '[+post_content+]';
312
+
313
+ /**
314
+ * Product Categories ( taxonomy product_cat ) Template for Populate Product from Product Image
315
+ *
316
+ * @since 2.06
317
+ *
318
+ * @var string
319
+ */
320
+ const CATEGORIES_TEMPLATE = 'categories-template';
321
+ const DEFAULT_CATEGORIES_TEMPLATE = '[+terms:attachment_category+]';
322
+
323
+ /**
324
+ * Product Tags ( taxonomy product_tag ) Template for Populate Product from Product Image
325
+ *
326
+ * @since 2.09
327
+ *
328
+ * @var string
329
+ */
330
+ const TAGS_TEMPLATE = 'tags-template';
331
+ const DEFAULT_TAGS_TEMPLATE = '';
332
+
333
+ /**
334
+ * Product SKU ( postmeta _sku ) Template for Populate Product from Product Image
335
+ *
336
+ * @since 2.06
337
+ *
338
+ * @var string
339
+ */
340
+ const SKU_TEMPLATE = 'sku-template';
341
+ const DEFAULT_SKU_TEMPLATE = '[+name_only+]';
342
+
343
+ /**
344
+ * Populate when Product Image is set
345
+ *
346
+ * @since 2.06
347
+ *
348
+ * @var boolean
349
+ */
350
+ const POPULATE_ON_ADD = 'populate-on-add';
351
+ const DEFAULT_POPULATE_ON_ADD = false;
352
+
353
+ /**
354
+ * Append Item ID checkbox attribute
355
+ *
356
+ * @since 2.06
357
+ *
358
+ * @var string
359
+ */
360
+ private static $populate_on_add_attr = ' ';
361
+
362
+ /**
363
+ * Populate when Product Image is changed
364
+ *
365
+ * @since 2.06
366
+ *
367
+ * @var boolean
368
+ */
369
+ const POPULATE_ON_UPDATE = 'populate-on-update';
370
+ const DEFAULT_POPULATE_ON_UPDATE = false;
371
+
372
+ /**
373
+ * Append Item ID checkbox attribute
374
+ *
375
+ * @since 2.06
376
+ *
377
+ * @var string
378
+ */
379
+ private static $populate_on_update_attr = ' ';
380
+
381
+ /**
382
+ * Processing options
383
+ *
384
+ * This array specifies the components used in the pretty links and whether
385
+ * the mla_debug=log argument is appended to the links
386
+ *
387
+ * @since 2.06
388
+ *
389
+ * @var array
390
+ */
391
+ private static $settings = array ();
392
+
393
+ /**
394
+ * Default processing options
395
+ *
396
+ * @since 2.06
397
+ *
398
+ * @var array
399
+ */
400
+ private static $default_settings = array (
401
+ self::NAME_TEMPLATE => self::DEFAULT_NAME_TEMPLATE,
402
+ self::DESCRIPTION_TEMPLATE => self::DEFAULT_DESCRIPTION_TEMPLATE,
403
+ self::SHORT_DESCRIPTION_TEMPLATE => self::DEFAULT_SHORT_DESCRIPTION_TEMPLATE,
404
+ self::CATEGORIES_TEMPLATE => self::DEFAULT_CATEGORIES_TEMPLATE,
405
+ self::TAGS_TEMPLATE => self::DEFAULT_TAGS_TEMPLATE,
406
+ self::SKU_TEMPLATE => self::DEFAULT_SKU_TEMPLATE,
407
+ self::POPULATE_ON_ADD => self::DEFAULT_POPULATE_ON_ADD,
408
+ self::POPULATE_ON_UPDATE => self::DEFAULT_POPULATE_ON_UPDATE,
409
+ );
410
+
411
+ /**
412
+ * Update the plugin options from the wp_options table or set defaults
413
+ *
414
+ * @since 2.06
415
+ */
416
+ private static function _load_settings() {
417
+ $settings = get_option( self::SLUG_PREFIX . 'settings' );
418
+ if ( is_array( $settings ) ) {
419
+ self::$settings = $settings;
420
+ // Adapt old settings from version 2.08
421
+ if ( !isset( self::$settings[self::TAGS_TEMPLATE] ) ) {
422
+ self::$settings[self::TAGS_TEMPLATE] = self::$default_settings[self::TAGS_TEMPLATE];
423
+ }
424
+
425
+ self::$populate_on_add_attr = self::$settings[self::POPULATE_ON_ADD] ? ' checked="checked" ' : ' ';
426
+ self::$populate_on_update_attr = self::$settings[self::POPULATE_ON_UPDATE] ? ' checked="checked" ' : ' ';
427
+
428
+ return 'Settings loaded from database.';
429
+ } else {
430
+ self::$settings = self::$default_settings;
431
+ self::$populate_on_add_attr = self::$settings[self::POPULATE_ON_ADD] ? ' checked="checked" ' : ' ';
432
+ self::$populate_on_update_attr = self::$settings[self::POPULATE_ON_UPDATE] ? ' checked="checked" ' : ' ';
433
+
434
+ return 'No settings in database; defaults loaded.';
435
+ }
436
+ }
437
+
438
+ /**
439
+ * Save settings as a WordPress wp_options entry
440
+ *
441
+ * @since 2.06
442
+ *
443
+ * @return string HTML markup for results/messages
444
+ */
445
+ private static function _save_setting_changes() {
446
+ $new_settings = self::$settings;
447
+
448
+ // Load old settings from the database or defaults
449
+ self::_load_product_templates();
450
+
451
+ $new_settings[self::NAME_TEMPLATE] = trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::NAME_TEMPLATE ] ) );
452
+ $new_settings[self::DESCRIPTION_TEMPLATE] = trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::DESCRIPTION_TEMPLATE ] ) );
453
+ $new_settings[self::SHORT_DESCRIPTION_TEMPLATE] = trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::SHORT_DESCRIPTION_TEMPLATE ] ) );
454
+ $new_settings[self::CATEGORIES_TEMPLATE] = trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::CATEGORIES_TEMPLATE ] ) );
455
+ $new_settings[self::TAGS_TEMPLATE] = trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::TAGS_TEMPLATE ] ) );
456
+ $new_settings[self::SKU_TEMPLATE] = trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::SKU_TEMPLATE ] ) );
457
+ $new_settings[self::POPULATE_ON_ADD] = isset( $_REQUEST[ self::SLUG_PREFIX . self::POPULATE_ON_ADD ] ) ? true : false;
458
+ $new_settings[self::POPULATE_ON_UPDATE] = isset( $_REQUEST[ self::SLUG_PREFIX . self::POPULATE_ON_UPDATE ] ) ? true : false;
459
+
460
+ if ( $new_settings === self::$settings ) {
461
+ return "Settings unchanged.\n";
462
+ }
463
+
464
+ $success = update_option( self::SLUG_PREFIX . 'settings', $new_settings, false );
465
+ if ( $success ) {
466
+ self::$settings = $new_settings;
467
+ self::$populate_on_add_attr = self::$settings[self::POPULATE_ON_ADD] ? ' checked="checked" ' : ' ';
468
+ self::$populate_on_update_attr = self::$settings[self::POPULATE_ON_UPDATE] ? ' checked="checked" ' : ' ';
469
+ return "Settings have been updated.\n";
470
+ }
471
+
472
+ return "Settings update failed.\n";
473
+ } // _save_setting_changes
474
+
475
+ /**
476
+ * Delete WordPress wp_options entry
477
+ *
478
+ * @since 1.00
479
+ *
480
+ * @return string HTML markup for results/messages
481
+ */
482
+ private static function _delete_settings() {
483
+ delete_option( self::SLUG_PREFIX . 'settings' );
484
+ self::$settings = self::$default_settings;
485
+
486
+ return "Settings removed from database and reset to default values.\n";
487
+ } // _delete_settings
488
+
489
  /**
490
  * Initialization function, similar to __construct()
491
  *
501
  if ( !is_admin() )
502
  return;
503
 
504
+ self::_load_product_templates();
505
+ //error_log( __LINE__ . " Woo_Fixit::initialize settings = " . var_export( self::$settings, true ), 0 );
506
+ //error_log( __LINE__ . " Woo_Fixit::initialize populate_on_add_attr = " . var_export( self::$populate_on_add_attr, true ), 0 );
507
+ //error_log( __LINE__ . " Woo_Fixit::initialize populate_on_update_attr = " . var_export( self::$populate_on_update_attr, true ), 0 );
508
+
509
+ if ( self::$settings[self::POPULATE_ON_ADD] ) {
510
+ // Defined in /wp-includes/meta.php
511
+ add_action( 'added_post_meta', 'Woo_Fixit::added_post_meta', 10, 4 );
512
+ }
513
+
514
+ if ( self::$settings[self::POPULATE_ON_UPDATE] ) {
515
+ // Defined in /wp-includes/meta.php
516
+ add_action( 'updated_postmeta', 'Woo_Fixit::updated_postmeta', 10, 4 );
517
+ }
518
+
519
  add_action( 'admin_menu', 'Woo_Fixit::admin_menu' );
520
  }
521
 
597
  } // _evaluate_terms
598
 
599
  /**
600
+ * Add the "product:" and "product_terms:" custom substitution prefixes.
601
+ * For any Media Library item that is used as a Product Image or Product Gallery item,
602
+ * these will return values from the associated Product.
603
  *
604
  * @since 2.00
605
  *
724
  } // mla_expand_custom_prefix
725
 
726
  /**
727
+ * After adding a post's metadata, check for Product Image add.
728
  *
729
+ * @since 2.06
730
+ *
731
+ * @param int $meta_id ID of updated metadata entry.
732
+ * @param int $object_id Post ID.
733
+ * @param string $meta_key Meta key.
734
+ * @param mixed $meta_value Meta value. This will be a PHP-serialized string representation of the value if
735
+ * the value is an array, an object, or itself a PHP-serialized string.
736
+ * @return void
737
+ */
738
+ public static function added_post_meta( $meta_id, $object_id, $meta_key, $meta_value ) {
739
+ global $post;
740
+
741
+ //error_log( __LINE__ . " Woo_Fixit::added_post_meta( $meta_id, $object_id, $meta_key ) meta_value = " . var_export( $meta_value, true ), 0 );
742
+ if ( '_thumbnail_id' === $meta_key ) {
743
+ //error_log( __LINE__ . " Woo_Fixit::added_post_meta( $meta_id, $object_id, $meta_key ) post = " . var_export( $post, true ), 0 );
744
+ if ( !empty( $post->post_type ) && ( 'product' === $post->post_type ) ) {
745
+ self::$first_product = self::$last_product = $object_id;
746
+ $result = self::_populate_product_from_product_image();
747
+ //error_log( __LINE__ . " Woo_Fixit::added_post_meta( $meta_id, $object_id, $meta_key ) result = " . var_export( $result, true ), 0 );
748
+ }
749
+ }
750
+ }
751
+
752
+ /**
753
+ * After updating a post's metadata, check for Product Image add/update.
754
+ *
755
+ * @since 2.06
756
  *
757
+ * @param int $meta_id ID of updated metadata entry.
758
+ * @param int $object_id Post ID.
759
+ * @param string $meta_key Meta key.
760
+ * @param mixed $meta_value Meta value. This will be a PHP-serialized string representation of the value if
761
+ * the value is an array, an object, or itself a PHP-serialized string.
762
  * @return void
763
  */
764
+ public static function updated_postmeta( $meta_id, $object_id, $meta_key, $meta_value ) {
765
+ global $post;
766
+
767
+ //error_log( __LINE__ . " Woo_Fixit::updated_postmeta( $meta_id, $object_id, $meta_key ) meta_value = " . var_export( $meta_value, true ), 0 );
768
+ if ( '_thumbnail_id' === $meta_key ) {
769
+ //error_log( __LINE__ . " Woo_Fixit::updated_postmeta( $meta_id, $object_id, $meta_key ) post = " . var_export( $post, true ), 0 );
770
+ if ( !empty( $post->post_type ) && ( 'product' === $post->post_type ) ) {
771
+ self::$first_product = self::$last_product = $object_id;
772
+ $result = self::_populate_product_from_product_image();
773
+ //error_log( __LINE__ . " Woo_Fixit::updated_postmeta( $meta_id, $object_id, $meta_key ) result = " . var_export( $result, true ), 0 );
774
+ }
775
+ }
776
  }
777
 
778
  /**
807
  }
808
 
809
  /**
810
+ * Compose the Settings Actions table, with the woofixit-acton handlers
811
  *
812
+ * @since 2.06
813
  *
814
+ * @return array Actions, handlers, comments, input tables, etc.
815
  */
816
+ private static function _compose_settings_actions() {
817
+ return array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
818
  'help' => array( 'handler' => '', 'comment' => 'Enter first/last Product ID values above to restrict tool application range. You can find ID values by hovering over the "Name" column in the WooCommerce/Products submenu table.' ),
819
  'warning' => array( 'handler' => '', 'comment' => '<strong>These tools make permanent updates to your database.</strong> Make a backup before you use the tools so you can restore your old values if you don&rsquo;t like the results.' ),
820
 
829
  'comment' => '<strong>Replace ALL</strong> item Title fields with re-formatted file name.' ),
830
  'c1a' => array( 'handler' => '', 'comment' => '<hr>' ),
831
  't0301' => array( 'open' => '<table><tr>' ),
832
+ 't0302' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle"><input name="' . self::SLUG_PREFIX . self::APPEND_ITEM_ID . '" type="checkbox"' . self::$append_item_id_attr . 'value="' . self::APPEND_ITEM_ID . '"></td>' ),
833
  't0303' => array( 'continue' => ' <td style="text-align: left; padding-right: 5px" valign="middle">Append Item ID</td>' ),
834
+ 't0304' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle"><input name="' . self::SLUG_PREFIX . self::CHECK_UNIQUE_SLUG . '" type="checkbox"' . self::$check_unique_slug_attr . 'value="' . self::CHECK_UNIQUE_SLUG . '"></td>' ),
835
  't0305' => array( 'continue' => ' <td style="text-align: left; padding-right: 5px" valign="middle">Ensure Unique Slug</td>' ),
836
  't0306' => array( 'continue' => ' <td colspan=2 style="text-align: right; padding-right: 5px" valign="middle">&nbsp;</td>' ),
837
  't0307' => array( 'continue' => '</tr><tr>' ),
916
  'comment' => '<strong>Replace ALL</strong> Att. Categories assignments from Att. Tags, where the Att. Tag matches an existing Att. Category.' ),
917
  'c9' => array( 'handler' => '', 'comment' => '<h3>Term Assignments for Media Library Items</h3>' ),
918
  't0201' => array( 'open' => '<table><tr>' ),
919
+ 't0202' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle"><input name="' . self::SLUG_PREFIX . self::INPUT_PROCESS_CATEGORY . '" type="checkbox"' . self::$category_attr . 'value="' . self::INPUT_PROCESS_CATEGORY . '"></td>' ),
920
  't0203' => array( 'continue' => ' <td style="text-align: left; padding-right: 5px" valign="middle">product_category</td>' ),
921
+ 't0204' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle"><input name="' . self::SLUG_PREFIX . self::INPUT_PROCESS_TAG . '" type="checkbox"' . self::$tag_attr . 'value="' . self::INPUT_PROCESS_TAG . '"></td>' ),
922
  't0205' => array( 'continue' => ' <td style="text-align: left; padding-right: 5px" valign="middle">product_tag</td>' ),
923
  't0206' => array( 'continue' => ' <td colspan=2 style="text-align: right; padding-right: 5px" valign="middle">&nbsp;</td>' ),
924
  't0207' => array( 'continue' => '</tr><tr>' ),
943
  'comment' => '<strong>Delete ALL</strong> product_category and/or product_tag term assignments to Media Library items.' ),
944
  'Assign Terms' => array( 'handler' => '_copy_term_assignments',
945
  'comment' => 'Copy product_category and/or product_tag term assignments to Media Library items for items used as Product Image or in the Product Gallery.' ),
946
+
947
+ 'c10' => array( 'handler' => '', 'comment' => '<h3>Populate Product from Product Image</h3>' ),
948
+ 't1001' => array( 'open' => '<table><tr>' ),
949
+ 't1002' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">Name</td>' ),
950
+ 't1003' => array( 'continue' => ' <td colspan="4" style="text-align: left; padding-right: 20px">' ),
951
+ 't1004' => array( 'continue' => ' <input name="' . self::SLUG_PREFIX . self::NAME_TEMPLATE . '" type="text" size="60" value="' . self::$settings[self::NAME_TEMPLATE] . '">' ),
952
+ 't1005' => array( 'continue' => ' </td>' ),
953
+ 't1006' => array( 'continue' => '</tr><tr>' ),
954
+ 't1007' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">Description</td>' ),
955
+ 't1008' => array( 'continue' => ' <td colspan="4" style="text-align: left; padding-right: 20px">' ),
956
+ 't1009' => array( 'continue' => ' <input name="' . self::SLUG_PREFIX . self::DESCRIPTION_TEMPLATE . '" type="text" size="60" value="' . self::$settings[self::DESCRIPTION_TEMPLATE] . '">' ),
957
+ 't1010' => array( 'continue' => ' </td>' ),
958
+ 't1011' => array( 'continue' => '</tr><tr>' ),
959
+ 't1012' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">Short Description</td>' ),
960
+ 't1013' => array( 'continue' => ' <td colspan="4" style="text-align: left; padding-right: 20px">' ),
961
+ 't1014' => array( 'continue' => ' <input name="' . self::SLUG_PREFIX . self::SHORT_DESCRIPTION_TEMPLATE . '" type="text" size="60" value="' . self::$settings[self::SHORT_DESCRIPTION_TEMPLATE] . '">' ),
962
+ 't1015' => array( 'continue' => ' </td>' ),
963
+ 't1016' => array( 'continue' => '</tr><tr>' ),
964
+ 't1017' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">Categories</td>' ),
965
+ 't1018' => array( 'continue' => ' <td colspan="4" style="text-align: left; padding-right: 20px">' ),
966
+ 't1019' => array( 'continue' => ' <input name="' . self::SLUG_PREFIX . self::CATEGORIES_TEMPLATE . '" type="text" size="60" value="' . self::$settings[self::CATEGORIES_TEMPLATE] . '">' ),
967
+ 't1020' => array( 'continue' => ' </td>' ),
968
+ 't1021' => array( 'continue' => '</tr><tr>' ),
969
+ 't1022' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">Tags</td>' ),
970
+ 't1023' => array( 'continue' => ' <td colspan="4" style="text-align: left; padding-right: 20px">' ),
971
+ 't1024' => array( 'continue' => ' <input name="' . self::SLUG_PREFIX . self::TAGS_TEMPLATE . '" type="text" size="60" value="' . self::$settings[self::TAGS_TEMPLATE] . '">' ),
972
+ 't1025' => array( 'continue' => ' </td>' ),
973
+ 't1026' => array( 'continue' => '</tr><tr>' ),
974
+ 't1027' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">SKU</td>' ),
975
+ 't1028' => array( 'continue' => ' <td colspan="4" style="text-align: left; padding-right: 20px">' ),
976
+ 't1029' => array( 'continue' => ' <input name="' . self::SLUG_PREFIX . self::SKU_TEMPLATE . '" type="text" size="60" value="' . self::$settings[self::SKU_TEMPLATE] . '">' ),
977
+ 't1030' => array( 'continue' => ' </td>' ),
978
+ 't1031' => array( 'continue' => '</tr><tr>' ),
979
+ 't1032' => array( 'continue' => '<td>&nbsp;</td><td colspan="4" >Enter Content Template(s) (without the "template:" prefix). To leave a field unchanged, delete the template from the corresponding text box.<br>&nbsp;</td>' ),
980
+ 't1033' => array( 'continue' => '</tr><tr>' ),
981
+ 't1034' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle"><input name="' . self::SLUG_PREFIX . self::POPULATE_ON_ADD . '" type="checkbox"' . self::$populate_on_add_attr . 'value="' . self::POPULATE_ON_ADD . '"></td>' ),
982
+ 't1035' => array( 'continue' => ' <td style="text-align: left; padding-right: 5px" valign="middle">Active for adding Product Image</td>' ),
983
+ 't1036' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle"><input name="' . self::SLUG_PREFIX . self::POPULATE_ON_UPDATE . '" type="checkbox"' . self::$populate_on_update_attr . 'value="' . self::POPULATE_ON_UPDATE . '"></td>' ),
984
+ 't1037' => array( 'continue' => ' <td style="text-align: left; padding-right: 5px" valign="middle">Active for updating Product Image</td>' ),
985
+ 't1038' => array( 'continue' => ' <td colspan=2 style="text-align: right; padding-right: 5px" valign="middle">&nbsp;</td>' ),
986
+ 't1039' => array( 'continue' => '</tr><tr>' ),
987
+ 't1040' => array( 'continue' => '<td>&nbsp;</td><td colspan="5">Check Active for adding... to populate when Product Image is set.<br>Check Active for updating... to populate when Product Image is changed.</td>' ),
988
+ 't1041' => array( 'close' => '</tr></table>&nbsp;<br>' ),
989
+ 'Populate Products' => array( 'handler' => '_populate_product_from_product_image',
990
+ 'comment' => 'Populate Product values from the attached Product Image item.' ),
991
+ 'Save Templates' => array( 'handler' => '_save_product_templates',
992
+ 'comment' => 'Save current template values to the database.' ),
993
+ 'Load Templates' => array( 'handler' => '_load_product_templates',
994
+ 'comment' => 'Load template values from the database.' ),
995
+ 'Restore Defaults' => array( 'handler' => '_restore_product_template_defaults',
996
+ 'comment' => 'Erase stored values from the database and set the default template values.' ),
997
  );
998
+ }
999
+
1000
+ /**
1001
+ * Render (echo) the "WooCommerce Fixit" submenu in the Tools section
1002
+ *
1003
+ * @since 1.00
1004
+ *
1005
+ * @return void Echoes HTML markup for the submenu page
1006
+ */
1007
+ public static function render_tools_page() {
1008
+ //error_log( __LINE__ . ' Woo_Fixit::render_tools_page() $_REQUEST = ' . var_export( $_REQUEST, true ), 0 );
1009
+ if ( !current_user_can( 'manage_options' ) ) {
1010
+ echo "WooCommerce Fixit - Error</h2>\n";
1011
+ wp_die( 'You do not have permission to manage plugin settings.' );
1012
+ }
1013
+
1014
+ // Load the Product from Product Image templates from the database or set defaults
1015
+ //self::_load_settings();
1016
+
1017
+ // Extract relevant query arguments
1018
+ self::$first_product = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_FIRST_PRODUCT ] ) ? $_REQUEST[ self::SLUG_PREFIX . self::INPUT_FIRST_PRODUCT ] : '';
1019
+ self::$last_product = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_LAST_PRODUCT ] ) ? $_REQUEST[ self::SLUG_PREFIX . self::INPUT_LAST_PRODUCT ] : '';
1020
+
1021
+ // Operations on ALL Media Library Images
1022
+ self::$append_item_id = isset( $_REQUEST[ self::SLUG_PREFIX . self::APPEND_ITEM_ID ] ) ? true : false;
1023
+ self::$append_item_id_attr = self::$append_item_id ? ' checked="checked" ' : ' ';
1024
+ self::$check_unique_slug = isset( $_REQUEST[ self::SLUG_PREFIX . self::CHECK_UNIQUE_SLUG ] ) ? true : false;
1025
+ self::$check_unique_slug_attr = self::$check_unique_slug ? ' checked="checked" ' : ' ';
1026
+
1027
+ // Apply Template to Product Image/Product Gallery Images
1028
+ self::$content_template = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_CONTENT_TEMPLATE ] ) ? trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_CONTENT_TEMPLATE ] ) ) : self::$content_template;
1029
+
1030
+ // Term Assignments for Media Library Items
1031
+ self::$process_category = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_PROCESS_CATEGORY ] ) ? true : false;
1032
+ self::$category_attr = self::$process_category ? ' checked="checked" ' : ' ';
1033
+ self::$process_tag = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_PROCESS_TAG ] ) ? true : false;
1034
+ self::$tag_attr = self::$process_tag ? ' checked="checked" ' : ' ';
1035
+
1036
+ self::$start_chunk = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_FIRST_CHUNK ] ) ? absint( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_FIRST_CHUNK ] ) : self::$start_chunk;
1037
+ self::$stop_chunk = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_LAST_CHUNK ] ) ? absint( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_LAST_CHUNK ] ) : self::$stop_chunk;
1038
+ self::$chunk_size = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_CHUNK_SIZE ] ) ? absint( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_CHUNK_SIZE ] ) : self::$chunk_size;
1039
+
1040
+ // Populate Product from Product Imag
1041
+ self::$settings[self::NAME_TEMPLATE] = isset( $_REQUEST[ self::SLUG_PREFIX . self::NAME_TEMPLATE ] ) ? trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::NAME_TEMPLATE ] ) ) : self::$settings[self::NAME_TEMPLATE];
1042
+ self::$settings[self::DESCRIPTION_TEMPLATE] = isset( $_REQUEST[ self::SLUG_PREFIX . self::DESCRIPTION_TEMPLATE ] ) ? trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::DESCRIPTION_TEMPLATE ] ) ) : self::$settings[self::DESCRIPTION_TEMPLATE];
1043
+ self::$settings[self::SHORT_DESCRIPTION_TEMPLATE] = isset( $_REQUEST[ self::SLUG_PREFIX . self::SHORT_DESCRIPTION_TEMPLATE ] ) ? trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::SHORT_DESCRIPTION_TEMPLATE ] ) ) : self::$settings[self::SHORT_DESCRIPTION_TEMPLATE];
1044
+ self::$settings[self::CATEGORIES_TEMPLATE] = isset( $_REQUEST[ self::SLUG_PREFIX . self::CATEGORIES_TEMPLATE ] ) ? trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::CATEGORIES_TEMPLATE ] ) ) : self::$settings[self::CATEGORIES_TEMPLATE];
1045
+ self::$settings[self::TAGS_TEMPLATE] = isset( $_REQUEST[ self::SLUG_PREFIX . self::TAGS_TEMPLATE ] ) ? trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::TAGS_TEMPLATE ] ) ) : self::$settings[self::TAGS_TEMPLATE];
1046
+ self::$settings[self::SKU_TEMPLATE] = isset( $_REQUEST[ self::SLUG_PREFIX . self::SKU_TEMPLATE ] ) ? trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::SKU_TEMPLATE ] ) ) : self::$settings[self::SKU_TEMPLATE];
1047
+
1048
+ // No checkbox settings on initial page load
1049
+ if ( isset( $_REQUEST[ self::SLUG_PREFIX . 'action' ] ) ) {
1050
+ self::$settings[self::POPULATE_ON_ADD] = isset( $_REQUEST[ self::SLUG_PREFIX . self::POPULATE_ON_ADD ] );
1051
+ self::$settings[self::POPULATE_ON_UPDATE] = isset( $_REQUEST[ self::SLUG_PREFIX . self::POPULATE_ON_UPDATE ] );
1052
+ }
1053
+
1054
+ self::$populate_on_add_attr = self::$settings[self::POPULATE_ON_ADD] ? ' checked="checked" ' : ' ';
1055
+ self::$populate_on_update_attr = self::$settings[self::POPULATE_ON_UPDATE] ? ' checked="checked" ' : ' ';
1056
 
1057
  echo '<div class="wrap">' . "\n";
1058
  echo "\t\t" . '<div id="icon-tools" class="icon32"><br/></div>' . "\n";
1059
  echo "\t\t" . '<h2>WooCommerce Fixit Tools v' . self::CURRENT_VERSION . '</h2>' . "\n";
1060
 
1061
  if ( isset( $_REQUEST[ self::SLUG_PREFIX . 'action' ] ) ) {
1062
+ $setting_actions = self::_compose_settings_actions();
1063
  $label = $_REQUEST[ self::SLUG_PREFIX . 'action' ];
1064
  if( isset( $setting_actions[ $label ] ) ) {
1065
  $action = $setting_actions[ $label ]['handler'];
1096
  }
1097
  }
1098
 
1099
+ echo "\t\t" . '<p><strong>NOTE:</strong> This plugin adds "product:" and "product_terms:" custom substitution prefixes.<br />' . "\n";
1100
+ echo "\t\t" . 'For any Media Library item that is used as a Product Image or Product Gallery item,<br />' . "\n";
1101
+ echo "\t\t" . 'these will return values from the associated Product.</p>' . "\n";
1102
+
1103
  echo "\t\t" . '<div style="width:700px">' . "\n";
1104
  echo "\t\t" . '<form action="' . admin_url( 'tools.php?page=' . self::SLUG_PREFIX . 'tools' ) . '" method="post" class="' . self::SLUG_PREFIX . 'tools-form-class" id="' . self::SLUG_PREFIX . 'tools-form-id">' . "\n";
1105
  echo "\t\t" . ' <p class="submit" style="padding-bottom: 0;">' . "\n";
1113
  echo "\t\t" . ' <input name="' . self::SLUG_PREFIX . self::INPUT_LAST_PRODUCT . '" type="text" size="5" value="' . self::$last_product . '">' . "\n";
1114
  echo "\t\t" . ' </td></tr>' . "\n";
1115
 
1116
+ // Refresh the settings actions, which may be modified by the just-executed action.
1117
+ $setting_actions = self::_compose_settings_actions();
1118
  foreach ( $setting_actions as $label => $action ) {
1119
  if ( isset( $action['open'] ) ) {
1120
  echo "\t\t" . ' <tr><td colspan=2 style="padding: 2px 0px;">' . "\n";
2882
  $tag_text = ( 1 == $tag_added ) ? 'tag' : 'tags';
2883
  return "_copy_term_assignments() processed {$item_count} item(s), added {$cat_added} {$cat_text} to {$cat_count} item(s), and added {$tag_added} {$tag_text} to {$tag_count} item(s).\n";
2884
  } // _copy_term_assignments
2885
+
2886
+ /**
2887
+ * Restore default values for the Populate Product from Product Image templates
2888
+ *
2889
+ * @since 2.06
2890
+ *
2891
+ * @return string HTML markup for results/messages
2892
+ */
2893
+ private static function _populate_product_from_product_image() {
2894
+ global $wpdb;
2895
+
2896
+ if ( ! empty( self::$first_product ) ) {
2897
+ $lower_bound = (integer) self::$first_product;
2898
+ } else {
2899
+ $lower_bound = 0;
2900
+ }
2901
+
2902
+ if ( ! empty( self::$last_product ) ) {
2903
+ $upper_bound = (integer) self::$last_product;
2904
+ } elseif ( $lower_bound ) {
2905
+ $upper_bound = $lower_bound;
2906
+ } else {
2907
+ $upper_bound = 0x7FFFFFFF;
2908
+ }
2909
+
2910
+ $query = sprintf( 'SELECT m.post_id, m.meta_key, m.meta_value, p.post_title, p.post_content, p.post_excerpt FROM %1$s as m INNER JOIN %2$s as p ON m.post_id = p.ID WHERE ( p.post_type = \'product\' ) AND ( p.ID >= %3$d ) AND ( p.ID <= %4$d) AND ( m.meta_key IN ( \'_thumbnail_id\', \'_sku\' ) ) GROUP BY m.post_id, m.meta_id ORDER BY m.post_id', $wpdb->postmeta, $wpdb->posts, $lower_bound, $upper_bound );
2911
+ $results = $wpdb->get_results( $query );
2912
+ //error_log( __LINE__ . ' Woo_Fixit::_populate_product_from_product_image() $results = ' . var_export( $results, true ), 0 );
2913
+
2914
+ $old_values = array();
2915
+ foreach ( $results as $result ) {
2916
+ $value = isset( $old_values[ $result->post_id ] ) ? $old_values[ $result->post_id ] : array();
2917
+ $value['post_title'] = $result->post_title;
2918
+ $value['post_content'] = $result->post_content;
2919
+ $value['post_excerpt'] = $result->post_excerpt;
2920
+ $value[$result->meta_key] = $result->meta_value;
2921
+ $old_values[ $result->post_id ] = $value;
2922
+ }
2923
+
2924
+ unset( $reaults, $result );
2925
+
2926
+ foreach( $old_values as $product_id => $value ) {
2927
+ // Find existing product_cat terms
2928
+ $terms = get_object_term_cache( $product_id, 'product_cat' );
2929
+ if ( false === $terms ) {
2930
+ $terms = wp_get_object_terms( $product_id, 'product_cat' );
2931
+ if ( is_wp_error( $terms ) ) {
2932
+ //error_log( __LINE__ . " Woo_Fixit::_populate_product_from_product_image( $product_id, 'product_cat' ) terms error = " . var_export( $terms->get_error_messages(), true ), 0 );
2933
+ continue;
2934
+ }
2935
+ //error_log( __LINE__ . " Woo_Fixit::_populate_product_from_product_image( $product_id, 'product_cat' ) terms = " . var_export( $terms, true ), 0 );
2936
+
2937
+ wp_cache_add( $product_id, $terms, 'product_cat' . '_relationships' );
2938
+ }
2939
+
2940
+ foreach ( $terms as $term ) {
2941
+ $old_values[ $product_id ]['product_cat_terms'][] = $term->term_id;
2942
+ }
2943
+ sort( $old_values[ $product_id ]['product_cat_terms'] );
2944
+
2945
+ // Find existing product_tag terms
2946
+ $terms = get_object_term_cache( $product_id, 'product_tag' );
2947
+ if ( false === $terms ) {
2948
+ $terms = wp_get_object_terms( $product_id, 'product_tag' );
2949
+ if ( is_wp_error( $terms ) ) {
2950
+ //error_log( __LINE__ . " Woo_Fixit::_populate_product_from_product_image( $product_id, 'product_cat' ) terms error = " . var_export( $terms->get_error_messages(), true ), 0 );
2951
+ continue;
2952
+ }
2953
+ //error_log( __LINE__ . " Woo_Fixit::_populate_product_from_product_image( $product_id, 'product_cat' ) terms = " . var_export( $terms, true ), 0 );
2954
+
2955
+ wp_cache_add( $product_id, $terms, 'product_tag' . '_relationships' );
2956
+ }
2957
+
2958
+ foreach ( $terms as $term ) {
2959
+ $old_values[ $product_id ]['product_tag_terms'][] = $term->term_id;
2960
+ }
2961
+ sort( $old_values[ $product_id ]['product_tag_terms'] );
2962
+ } // foreach old_values ID
2963
+ //error_log( __LINE__ . ' Woo_Fixit::_populate_product_from_product_image() $old_values = ' . var_export( $old_values, true ), 0 );
2964
+
2965
+ $product_count = 0;
2966
+ $updated_count= 0;
2967
+
2968
+ // Define the template
2969
+ $my_setting = array(
2970
+ 'data_source' => 'template',
2971
+ 'meta_name' => '',
2972
+ 'option' => 'raw'
2973
+ );
2974
+
2975
+ foreach ( $old_values as $product_id => $value ) {
2976
+ $product_count++;
2977
+ $update_count = 0;
2978
+ $attachment_id = $value['_thumbnail_id'];
2979
+ $replace_values = array();
2980
+
2981
+ // Evaluate the template for the Product Name (post_title)
2982
+ if ( !empty( self::$settings[self::NAME_TEMPLATE] ) ) {
2983
+ $my_setting['meta_name'] = '(' . self::$settings[self::NAME_TEMPLATE] . ')';
2984
+
2985
+ $template_value = trim( MLAOptions::mla_get_data_source( $attachment_id, 'single_attachment_mapping', $my_setting, NULL ) );
2986
+ if ( !empty( $template_value ) && ( $template_value !== $value['post_title'] ) ) {
2987
+ $replace_values[ 'post_title' ] = $template_value;
2988
+ }
2989
+ }
2990
+
2991
+ // Evaluate the template for the Product Description (post_content)
2992
+ if ( !empty( self::$settings[self::DESCRIPTION_TEMPLATE] ) ) {
2993
+ $my_setting['meta_name'] = '(' . self::$settings[self::DESCRIPTION_TEMPLATE] . ')';
2994
+
2995
+ $template_value = trim( MLAOptions::mla_get_data_source( $attachment_id, 'single_attachment_mapping', $my_setting, NULL ) );
2996
+ if ( !empty( $template_value ) && ( $template_value !== $value['post_content'] ) ) {
2997
+ $replace_values[ 'post_content' ] = $template_value;
2998
+ }
2999
+ }
3000
+
3001
+ // Evaluate the template for the Product Short Description (post_excerpt)
3002
+ if ( !empty( self::$settings[self::SHORT_DESCRIPTION_TEMPLATE] ) ) {
3003
+ $my_setting['meta_name'] = '(' . self::$settings[self::SHORT_DESCRIPTION_TEMPLATE] . ')';
3004
+
3005
+ $template_value = trim( MLAOptions::mla_get_data_source( $attachment_id, 'single_attachment_mapping', $my_setting, NULL ) );
3006
+ if ( !empty( $template_value ) && ( $template_value !== $value['post_excerpt'] ) ) {
3007
+ $replace_values[ 'post_excerpt' ] = $template_value;
3008
+ }
3009
+ }
3010
+
3011
+ //error_log( __LINE__ . ' Woo_Fixit::_populate_product_from_product_image() $replace_values = ' . var_export( $replace_values, true ), 0 );
3012
+ $update_count = count( $replace_values );
3013
+ if ( $update_count ) {
3014
+ $replace_values['ID'] = $product_id;
3015
+ $result = wp_update_post( $replace_values );
3016
+ } else {
3017
+ $result = NULL;
3018
+ }
3019
+ //error_log( __LINE__ . " Woo_Fixit::_populate_product_from_product_image( $update_count ) result = " . var_export( $result, true ), 0 );
3020
+
3021
+ // Evaluate the template for the Product Categories ( taxonomy product_cat )
3022
+ if ( !empty( self::$settings[self::CATEGORIES_TEMPLATE] ) ) {
3023
+ $my_setting['meta_name'] = '(' . self::$settings[self::CATEGORIES_TEMPLATE] . ')';
3024
+
3025
+ $template_value = trim( MLAOptions::mla_get_data_source( $attachment_id, 'single_attachment_mapping', $my_setting, NULL ) );
3026
+ //error_log( __LINE__ . " Woo_Fixit::_populate_product_from_product_image( $update_count ) template_value = " . var_export( $template_value, true ), 0 );
3027
+ if ( !empty( $template_value ) ) {
3028
+ /*
3029
+ * Convert term names to term IDs, to avoid ambiguity.
3030
+ * Adapted from edit_post() in /wp-admin/includes/post.php
3031
+ */
3032
+ $comma = _x( ',', 'tag delimiter' );
3033
+ if ( ',' !== $comma ) {
3034
+ $template_value = str_replace( $comma, ',', $template_value );
3035
+ }
3036
+ $tags = explode( ',', trim( $template_value, " \n\t\r\0\x0B," ) );
3037
+
3038
+ $clean_terms = array();
3039
+ foreach ( $tags as $tag ) {
3040
+ // Empty terms are invalid input.
3041
+ if ( empty( $tag ) ) {
3042
+ continue;
3043
+ }
3044
+
3045
+ $tag = trim( $tag );
3046
+ $_term = MLAQuery::mla_wp_get_terms( 'product_cat', array(
3047
+ 'name' => $tag,
3048
+ 'fields' => 'ids',
3049
+ 'hide_empty' => false,
3050
+ ) );
3051
+
3052
+ if ( ! empty( $_term ) ) {
3053
+ $clean_terms[] = intval( $_term[0] );
3054
+ } else {
3055
+ // No existing term was found, so pass the string. A new term will be created.
3056
+ $clean_terms[] = $tag;
3057
+ }
3058
+ }
3059
+
3060
+ sort( $clean_terms );
3061
+ //error_log( __LINE__ . " Woo_Fixit::_populate_product_from_product_image( $update_count ) clean_terms = " . var_export( $clean_terms, true ), 0 );
3062
+ if ( $clean_terms !== $value['product_cat_terms'] ) {
3063
+ $result = wp_set_object_terms( $product_id, $clean_terms, 'product_cat' );
3064
+ if ( is_wp_error( $result ) ) {
3065
+ //error_log( __LINE__ . " Woo_Fixit::_populate_product_from_product_image( $product_id, 'product_cat' ) wp_get_object_terms error = " . var_export( $result->get_error_messages(), true ), 0 );
3066
+ } else {
3067
+ $update_count++;
3068
+ }
3069
+ } // terms unequal
3070
+ } // $template_value
3071
+ } // CATEGORIES_TEMPLATE
3072
+
3073
+ // Evaluate the template for the Product Tags ( taxonomy product_tag )
3074
+ if ( !empty( self::$settings[self::TAGS_TEMPLATE] ) ) {
3075
+ $my_setting['meta_name'] = '(' . self::$settings[self::TAGS_TEMPLATE] . ')';
3076
+
3077
+ $template_value = trim( MLAOptions::mla_get_data_source( $attachment_id, 'single_attachment_mapping', $my_setting, NULL ) );
3078
+ //error_log( __LINE__ . " Woo_Fixit::_populate_product_from_product_image( $update_count ) template_value = " . var_export( $template_value, true ), 0 );
3079
+ if ( !empty( $template_value ) ) {
3080
+ /*
3081
+ * Convert term names to term IDs, to avoid ambiguity.
3082
+ * Adapted from edit_post() in /wp-admin/includes/post.php
3083
+ */
3084
+ $comma = _x( ',', 'tag delimiter' );
3085
+ if ( ',' !== $comma ) {
3086
+ $template_value = str_replace( $comma, ',', $template_value );
3087
+ }
3088
+ $tags = explode( ',', trim( $template_value, " \n\t\r\0\x0B," ) );
3089
+
3090
+ $clean_terms = array();
3091
+ foreach ( $tags as $tag ) {
3092
+ // Empty terms are invalid input.
3093
+ if ( empty( $tag ) ) {
3094
+ continue;
3095
+ }
3096
+
3097
+ $tag = trim( $tag );
3098
+ $_term = MLAQuery::mla_wp_get_terms( 'product_tag', array(
3099
+ 'name' => $tag,
3100
+ 'fields' => 'ids',
3101
+ 'hide_empty' => false,
3102
+ ) );
3103
+
3104
+ if ( ! empty( $_term ) ) {
3105
+ $clean_terms[] = intval( $_term[0] );
3106
+ } else {
3107
+ // No existing term was found, so pass the string. A new term will be created.
3108
+ $clean_terms[] = $tag;
3109
+ }
3110
+ }
3111
+
3112
+ sort( $clean_terms );
3113
+ //error_log( __LINE__ . " Woo_Fixit::_populate_product_from_product_image( $update_count ) clean_terms = " . var_export( $clean_terms, true ), 0 );
3114
+ if ( $clean_terms !== $value['product_tag_terms'] ) {
3115
+ $result = wp_set_object_terms( $product_id, $clean_terms, 'product_tag' );
3116
+ if ( is_wp_error( $result ) ) {
3117
+ //error_log( __LINE__ . " Woo_Fixit::_populate_product_from_product_image( $product_id, 'product_tag' ) wp_get_object_terms error = " . var_export( $result->get_error_messages(), true ), 0 );
3118
+ } else {
3119
+ $update_count++;
3120
+ }
3121
+ } // terms unequal
3122
+ } // $template_value
3123
+ } // TAGS_TEMPLATE
3124
+
3125
+ // Evaluate the template for the Product SKU ( postmeta _sku )
3126
+ if ( !empty( self::$settings[self::SKU_TEMPLATE] ) ) {
3127
+ $my_setting['meta_name'] = '(' . self::$settings[self::SKU_TEMPLATE] . ')';
3128
+
3129
+ $template_value = trim( MLAOptions::mla_get_data_source( $attachment_id, 'single_attachment_mapping', $my_setting, NULL ) );
3130
+ //error_log( __LINE__ . " Woo_Fixit::_populate_product_from_product_image( $update_count ) template_value = " . var_export( $template_value, true ), 0 );
3131
+ if ( !empty( $template_value ) && ( $template_value !== $value['_sku'] ) ) {
3132
+ $result = update_post_meta( $product_id, '_sku', $template_value );
3133
+ $update_count++;
3134
+ }
3135
+ //error_log( __LINE__ . " Woo_Fixit::_populate_product_from_product_image( $update_count ) SKU result = " . var_export( $result, true ), 0 );
3136
+ } // SKU_TEMPLATE
3137
+
3138
+ if ( $update_count ) {
3139
+ $updated_count++;
3140
+ }
3141
+ } // foreach product
3142
+
3143
+ return "Populate Product examined {$product_count} Product(s) and updated {$updated_count} Product(s).";
3144
+ } // _populate_product_from_product_image
3145
+
3146
+ /**
3147
+ * Save the Populate Product from Product Image templates to the database
3148
+ *
3149
+ * @since 2.06
3150
+ *
3151
+ * @return string HTML markup for results/messages
3152
+ */
3153
+ private static function _save_product_templates() {
3154
+ return self::_save_setting_changes();
3155
+ } // _save_product_templates
3156
+
3157
+ /**
3158
+ * Load the Populate Product from Product Image templates from the database
3159
+ *
3160
+ * @since 2.06
3161
+ *
3162
+ * @return string HTML markup for results/messages
3163
+ */
3164
+ private static function _load_product_templates() {
3165
+ $result = self::_load_settings();
3166
+
3167
+ return $result;
3168
+ } // _load_product_templates
3169
+
3170
+ /**
3171
+ * Restore default values for the Populate Product from Product Image templates
3172
+ *
3173
+ * @since 2.06
3174
+ *
3175
+ * @return string HTML markup for results/messages
3176
+ */
3177
+ private static function _restore_product_template_defaults() {
3178
+ self::$populate_on_add_attr = self::DEFAULT_POPULATE_ON_ADD;
3179
+ self::$populate_on_update_attr = self::DEFAULT_POPULATE_ON_UPDATE;
3180
+
3181
+ return self::_delete_settings();
3182
+ } // _restore_product_template_defaults
3183
  } //Woo_Fixit
3184
 
3185
  // Install the submenu at an early opportunity
includes/class-mla-core.php CHANGED
@@ -21,7 +21,7 @@ class MLACore {
21
  *
22
  * @var string
23
  */
24
- const CURRENT_MLA_VERSION = '2.81';
25
 
26
  /**
27
  * Slug for registering and enqueueing plugin style sheets (moved from class-mla-main.php)
21
  *
22
  * @var string
23
  */
24
+ const CURRENT_MLA_VERSION = '2.82';
25
 
26
  /**
27
  * Slug for registering and enqueueing plugin style sheets (moved from class-mla-main.php)
includes/class-mla-data-query.php CHANGED
@@ -552,7 +552,7 @@ class MLAQuery {
552
  continue;
553
  }
554
 
555
- if ( '_' == $post_meta_key{0} ) {
556
  if ( stripos( $post_meta_key, '_wp_attached_file' ) === 0 ) {
557
  $key = 'mla_wp_attached_file';
558
  $attached_file = $post_meta_value[0];
@@ -639,6 +639,7 @@ class MLAQuery {
639
  * ['mla_search_fields'] => 'title', 'name', 'alt-text', 'excerpt', 'content', 'file' ,'terms'
640
  * Note: 'alt-text' and 'file' are not supported in [mla_gallery]
641
  * ['mla_search_connector'] => AND/OR
 
642
  * ['sentence'] => entire string must match as one "keyword"
643
  * ['exact'] => entire string must match entire field value
644
  * ['debug'] => internal element, console/log/shortcode/none
@@ -832,6 +833,7 @@ class MLAQuery {
832
  * @return array revised arguments suitable for WP_Query
833
  */
834
  private static function _prepare_list_table_query( $raw_request, $offset = 0, $count = 0 ) {
 
835
  /*
836
  * Go through the $raw_request, take only the arguments that are used in the query and
837
  * sanitize or validate them.
@@ -883,9 +885,10 @@ class MLAQuery {
883
  foreach ( $raw_request as $key => $value ) {
884
  switch ( $key ) {
885
  /*
886
- * 'sentence' and 'exact' modify the keyword search ('s')
887
  * Their value is not important, only their presence.
888
  */
 
889
  case 'sentence':
890
  case 'exact':
891
  case 'mla-tax':
@@ -1102,6 +1105,7 @@ class MLAQuery {
1102
  self::$search_parameters['s'] = $clean_request['s'];
1103
  self::$search_parameters['mla_search_fields'] = apply_filters( 'mla_list_table_search_filter_fields', $clean_request['mla_search_fields'], array( 'title', 'name', 'alt-text', 'excerpt', 'content', 'file' ,'terms' ) );
1104
  self::$search_parameters['mla_search_connector'] = $clean_request['mla_search_connector'];
 
1105
  self::$search_parameters['sentence'] = isset( $clean_request['sentence'] );
1106
  self::$search_parameters['exact'] = isset( $clean_request['exact'] );
1107
 
@@ -1120,6 +1124,7 @@ class MLAQuery {
1120
  unset( $clean_request['s'] );
1121
  unset( $clean_request['mla_search_connector'] );
1122
  unset( $clean_request['mla_search_fields'] );
 
1123
  unset( $clean_request['sentence'] );
1124
  unset( $clean_request['exact'] );
1125
  }
@@ -1259,6 +1264,8 @@ class MLAQuery {
1259
  if ( !empty( self::$search_parameters['mla_terms_search'] ) ) {
1260
  $search_phrases = self::mla_divide_search_string( self::$search_parameters['mla_terms_search']['phrases'] );
1261
  //error_log( __LINE__ . " MLAQuery::_prepare_list_table_query mla_terms_search search_phrases = " . var_export( $search_phrases, true ), 0 );
 
 
1262
 
1263
  if ( !empty( $search_phrases['negative'] ) ) {
1264
  self::$search_parameters['mla_terms_search']['phrases'] = $search_phrases['negative'];
@@ -1534,6 +1541,7 @@ class MLAQuery {
1534
  * @return integer Taxonomy JOIN clauses required. Updates $tax_clause as well
1535
  */
1536
  private static function _generate_tax_clause( $terms_search_parameters, &$tax_clause ) {
 
1537
  //error_log( __LINE__ . ' MLAQuery::_generate_tax_clause terms_search_parameters = ' . var_export( $terms_search_parameters, true ), 0 );
1538
  $term_delimiter = isset( $terms_search_parameters['term_delimiter'] ) ? $terms_search_parameters['term_delimiter'] : ',';
1539
  $phrase_delimiter = isset( $terms_search_parameters['phrase_delimiter'] ) ? $terms_search_parameters['phrase_delimiter'] : ' ';
@@ -1551,13 +1559,23 @@ class MLAQuery {
1551
  $matched_terms = 0;
1552
  foreach ( $terms as $term ) {
1553
 
 
 
 
 
 
 
1554
  // Find the quoted phrases for a word-boundary check
1555
  $phrases = self::_parse_terms_search( $term, $phrase_delimiter, false );
1556
  //error_log( __LINE__ . " MLAQuery::_generate_tax_clause terms_search_parameters( {$term} ) phrases = " . var_export( $phrases, true ), 0 );
1557
  $quoted = array();
1558
  foreach ( $phrases as $index => $phrase ) {
1559
- $delimiter = substr( $phrase, 0, 1 );
1560
- $quoted[ $index ] = ( '"' == $delimiter ) || ( "'" == $delimiter );
 
 
 
 
1561
  }
1562
  //error_log( __LINE__ . " MLAQuery::_generate_tax_clause terms_search_parameters( {$term} ) quoted = " . var_export( $quoted, true ), 0 );
1563
 
@@ -1568,7 +1586,7 @@ class MLAQuery {
1568
  $tax_terms = array();
1569
  $tax_counts = array();
1570
  foreach ( $phrases as $index => $phrase ) {
1571
- if ( isset( $terms_search_parameters['exact'] ) ) {
1572
  $the_terms = array();
1573
  foreach( $terms_search_parameters['taxonomies'] as $taxonomy ) {
1574
  // WordPress encodes special characters, e.g., "&" as HTML entities in term names
@@ -1699,6 +1717,8 @@ class MLAQuery {
1699
  //error_log( __LINE__ . " MLAQuery::mla_query_posts_search_filter search_parameters = " . var_export( self::$search_parameters, true ), 0 );
1700
  // Process the Terms Search arguments, if present.
1701
  if ( isset( self::$search_parameters['mla_terms_search']['phrases'] ) ) {
 
 
1702
  self::$search_parameters['tax_terms_count'] = self::_generate_tax_clause( self::$search_parameters['mla_terms_search'], $tax_clause );
1703
  //error_log( __LINE__ . " MLAQuery::mla_query_posts_search_filter tax_clause = " . var_export( $tax_clause, true ), 0 );
1704
 
@@ -1805,7 +1825,7 @@ class MLAQuery {
1805
  } // foreach phrase
1806
 
1807
  if ( $allow_terms_search ) {
1808
- self::$search_parameters['tax_terms_count'] = self::_generate_tax_clause( array( 'phrases' => $keyword_string, 'radio_phrases' => self::$search_parameters['mla_search_connector'], 'radio_terms' => self::$search_parameters['mla_search_connector'], 'taxonomies' => self::$search_parameters['mla_search_taxonomies'] ), $tax_clause );
1809
  //error_log( __LINE__ . " MLAQuery::mla_query_posts_search_filter tax_clause = " . var_export( $tax_clause, true ), 0 );
1810
 
1811
  if ( '1=0' === $tax_clause ) {
552
  continue;
553
  }
554
 
555
+ if ( '_' == $post_meta_key[0] ) {
556
  if ( stripos( $post_meta_key, '_wp_attached_file' ) === 0 ) {
557
  $key = 'mla_wp_attached_file';
558
  $attached_file = $post_meta_value[0];
639
  * ['mla_search_fields'] => 'title', 'name', 'alt-text', 'excerpt', 'content', 'file' ,'terms'
640
  * Note: 'alt-text' and 'file' are not supported in [mla_gallery]
641
  * ['mla_search_connector'] => AND/OR
642
+ * ['whole_word'] => each word must match as one "keyword", e.g. "man" won't match "woman"
643
  * ['sentence'] => entire string must match as one "keyword"
644
  * ['exact'] => entire string must match entire field value
645
  * ['debug'] => internal element, console/log/shortcode/none
833
  * @return array revised arguments suitable for WP_Query
834
  */
835
  private static function _prepare_list_table_query( $raw_request, $offset = 0, $count = 0 ) {
836
+ //error_log( __LINE__ . " _prepare_list_table_query( $offset, $count ) raw_request = " . var_export( $raw_request, true ), 0 );
837
  /*
838
  * Go through the $raw_request, take only the arguments that are used in the query and
839
  * sanitize or validate them.
885
  foreach ( $raw_request as $key => $value ) {
886
  switch ( $key ) {
887
  /*
888
+ * 'whole_word', 'sentence' and 'exact' modify the keyword search ('s')
889
  * Their value is not important, only their presence.
890
  */
891
+ case 'whole_word':
892
  case 'sentence':
893
  case 'exact':
894
  case 'mla-tax':
1105
  self::$search_parameters['s'] = $clean_request['s'];
1106
  self::$search_parameters['mla_search_fields'] = apply_filters( 'mla_list_table_search_filter_fields', $clean_request['mla_search_fields'], array( 'title', 'name', 'alt-text', 'excerpt', 'content', 'file' ,'terms' ) );
1107
  self::$search_parameters['mla_search_connector'] = $clean_request['mla_search_connector'];
1108
+ self::$search_parameters['whole_word'] = isset( $clean_request['whole_word'] );
1109
  self::$search_parameters['sentence'] = isset( $clean_request['sentence'] );
1110
  self::$search_parameters['exact'] = isset( $clean_request['exact'] );
1111
 
1124
  unset( $clean_request['s'] );
1125
  unset( $clean_request['mla_search_connector'] );
1126
  unset( $clean_request['mla_search_fields'] );
1127
+ unset( $clean_request['whole_word'] );
1128
  unset( $clean_request['sentence'] );
1129
  unset( $clean_request['exact'] );
1130
  }
1264
  if ( !empty( self::$search_parameters['mla_terms_search'] ) ) {
1265
  $search_phrases = self::mla_divide_search_string( self::$search_parameters['mla_terms_search']['phrases'] );
1266
  //error_log( __LINE__ . " MLAQuery::_prepare_list_table_query mla_terms_search search_phrases = " . var_export( $search_phrases, true ), 0 );
1267
+ //error_log( __LINE__ . " MLAQuery::_prepare_list_table_query clean_request = " . var_export( $clean_request, true ), 0 );
1268
+ //error_log( __LINE__ . " MLAQuery::_prepare_list_table_query search_parameters = " . var_export( self::$search_parameters, true ), 0 );
1269
 
1270
  if ( !empty( $search_phrases['negative'] ) ) {
1271
  self::$search_parameters['mla_terms_search']['phrases'] = $search_phrases['negative'];
1541
  * @return integer Taxonomy JOIN clauses required. Updates $tax_clause as well
1542
  */
1543
  private static function _generate_tax_clause( $terms_search_parameters, &$tax_clause ) {
1544
+ //error_log( __LINE__ . ' MLAQuery::_generate_tax_clause self::search_parameters = ' . var_export( self::$search_parameters, true ), 0 );
1545
  //error_log( __LINE__ . ' MLAQuery::_generate_tax_clause terms_search_parameters = ' . var_export( $terms_search_parameters, true ), 0 );
1546
  $term_delimiter = isset( $terms_search_parameters['term_delimiter'] ) ? $terms_search_parameters['term_delimiter'] : ',';
1547
  $phrase_delimiter = isset( $terms_search_parameters['phrase_delimiter'] ) ? $terms_search_parameters['phrase_delimiter'] : ' ';
1559
  $matched_terms = 0;
1560
  foreach ( $terms as $term ) {
1561
 
1562
+ // Sentence puts quotes around the entire term
1563
+ if ( !empty( $terms_search_parameters['sentence'] ) ) {
1564
+ $term = '"' . str_replace( array( '"', "'" ), '', $term ) . '"';
1565
+ }
1566
+ //error_log( __LINE__ . " MLAQuery::_generate_tax_clause terms_search_parameters term = " . var_export( $term, true ), 0 );
1567
+
1568
  // Find the quoted phrases for a word-boundary check
1569
  $phrases = self::_parse_terms_search( $term, $phrase_delimiter, false );
1570
  //error_log( __LINE__ . " MLAQuery::_generate_tax_clause terms_search_parameters( {$term} ) phrases = " . var_export( $phrases, true ), 0 );
1571
  $quoted = array();
1572
  foreach ( $phrases as $index => $phrase ) {
1573
+ if ( empty( $terms_search_parameters['whole_word'] ) ) {
1574
+ $delimiter = substr( $phrase, 0, 1 );
1575
+ $quoted[ $index ] = ( '"' == $delimiter ) || ( "'" == $delimiter );
1576
+ } else {
1577
+ $quoted[ $index ] = true;
1578
+ }
1579
  }
1580
  //error_log( __LINE__ . " MLAQuery::_generate_tax_clause terms_search_parameters( {$term} ) quoted = " . var_export( $quoted, true ), 0 );
1581
 
1586
  $tax_terms = array();
1587
  $tax_counts = array();
1588
  foreach ( $phrases as $index => $phrase ) {
1589
+ if ( !empty( $terms_search_parameters['exact'] ) ) {
1590
  $the_terms = array();
1591
  foreach( $terms_search_parameters['taxonomies'] as $taxonomy ) {
1592
  // WordPress encodes special characters, e.g., "&" as HTML entities in term names
1717
  //error_log( __LINE__ . " MLAQuery::mla_query_posts_search_filter search_parameters = " . var_export( self::$search_parameters, true ), 0 );
1718
  // Process the Terms Search arguments, if present.
1719
  if ( isset( self::$search_parameters['mla_terms_search']['phrases'] ) ) {
1720
+ //error_log( __LINE__ . " MLAQuery::mla_query_posts_search_filter search_string = " . var_export( $search_string, true ), 0 );
1721
+ //error_log( __LINE__ . " MLAQuery::mla_query_posts_search_filter search_parameters = " . var_export( self::$search_parameters, true ), 0 );
1722
  self::$search_parameters['tax_terms_count'] = self::_generate_tax_clause( self::$search_parameters['mla_terms_search'], $tax_clause );
1723
  //error_log( __LINE__ . " MLAQuery::mla_query_posts_search_filter tax_clause = " . var_export( $tax_clause, true ), 0 );
1724
 
1825
  } // foreach phrase
1826
 
1827
  if ( $allow_terms_search ) {
1828
+ self::$search_parameters['tax_terms_count'] = self::_generate_tax_clause( array( 'phrases' => $keyword_string, 'taxonomies' => self::$search_parameters['mla_search_taxonomies'], 'radio_phrases' => self::$search_parameters['mla_search_connector'], 'radio_terms' => self::$search_parameters['mla_search_connector'], 'whole_word' => self::$search_parameters['whole_word'], 'exact' => self::$search_parameters['exact'], 'sentence' => self::$search_parameters['sentence'] ), $tax_clause );
1829
  //error_log( __LINE__ . " MLAQuery::mla_query_posts_search_filter tax_clause = " . var_export( $tax_clause, true ), 0 );
1830
 
1831
  if ( '1=0' === $tax_clause ) {
includes/class-mla-data-references.php CHANGED
@@ -352,9 +352,7 @@ class MLAReferences {
352
  public static function mla_attachment_array_fetch_references_handler( &$attachments ) {
353
  global $wpdb;
354
 
355
- /*
356
- * See element definitions above
357
- */
358
  $initial_references = array(
359
  'inserted_option' => '',
360
  'tested_reference' => false,
@@ -378,9 +376,7 @@ class MLAReferences {
378
  $inserted_in_option = MLACore::mla_get_option( MLACoreOptions::MLA_INSERTED_IN_TUNING );
379
  $initial_references['inserted_option'] = $inserted_in_option;
380
 
381
- /*
382
- * Make sure there's work to do; otherwise initialize the attachment data and return
383
- */
384
  if ( false == ( MLACore::$process_featured_in || MLACore::$process_inserted_in || MLACore::$process_gallery_in || MLACore::$process_mla_gallery_in ) ) {
385
  foreach ( $attachments as $attachment_index => $attachment ) {
386
  $attachments[ $attachment_index ]->mla_references = $initial_references;
@@ -389,9 +385,7 @@ class MLAReferences {
389
  return;
390
  }
391
 
392
- /*
393
- * Collect the raw data for where-used analysis
394
- */
395
  $attachment_ids = array();
396
  $files = array();
397
  foreach ( $attachments as $index => $attachment ) {
@@ -497,9 +491,7 @@ class MLAReferences {
497
  $wpdb->prepare( $query, $query_parameters )
498
  );
499
 
500
- /*
501
- * Match each post with inserts back to the attachments
502
- */
503
  $inserts = array();
504
  if ( ! empty( $results ) ) {
505
  foreach ( $files as $index => $file ) {
@@ -532,9 +524,7 @@ class MLAReferences {
532
  foreach ( $attachments as $attachment_index => $attachment ) {
533
  $references = array_merge( $initial_references, $files[ $attachment_index ] );
534
 
535
- /*
536
- * Fill in Parent data
537
- */
538
  if ( ( (int) $attachment->post_parent ) === 0 ) {
539
  $references['is_unattached'] = true;
540
  } else {
@@ -553,14 +543,10 @@ class MLAReferences {
553
  }
554
  }
555
 
556
- /*
557
- * Accumulate reference test types, e.g., 0 = no tests, 4 = all tests
558
- */
559
  $reference_tests = 0;
560
 
561
- /*
562
- * Look for the "Featured Image(s)", if enabled
563
- */
564
  if ( MLACore::$process_featured_in ) {
565
  $reference_tests++;
566
  if ( isset( $features[ $attachment->ID ] ) ) {
@@ -575,9 +561,7 @@ class MLAReferences {
575
  }
576
  } // $process_featured_in
577
 
578
- /*
579
- * Look for item(s) inserted in post_content
580
- */
581
  if ( MLACore::$process_inserted_in ) {
582
  $reference_tests++;
583
 
@@ -603,9 +587,7 @@ class MLAReferences {
603
  }
604
  } // $process_inserted_in
605
 
606
- /*
607
- * Look for [mla_gallery] references
608
- */
609
  if ( MLACore::$process_mla_gallery_in ) {
610
  $reference_tests++;
611
  if ( self::_build_mla_galleries( MLACoreOptions::MLA_MLA_GALLERY_IN_TUNING, self::$mla_galleries, '[mla_gallery', $exclude_revisions ) ) {
@@ -625,9 +607,7 @@ class MLAReferences {
625
  }
626
  } // $process_mla_gallery_in
627
 
628
- /*
629
- * Look for [gallery] references
630
- */
631
  if ( MLACore::$process_gallery_in ) {
632
  $reference_tests++;
633
  if ( self::_build_mla_galleries( MLACoreOptions::MLA_GALLERY_IN_TUNING, self::$galleries, '[gallery', $exclude_revisions ) ) {
@@ -647,9 +627,7 @@ class MLAReferences {
647
  }
648
  } // $process_gallery_in
649
 
650
- /*
651
- * Evaluate and summarize reference tests
652
- */
653
  $errors = '';
654
  if ( 0 == $reference_tests ) {
655
  $references['tested_reference'] = false;
@@ -752,6 +730,7 @@ class MLAReferences {
752
  */
753
  private static function _build_mla_galleries( $option_name, &$galleries_array, $shortcode, $exclude_revisions ) {
754
  global $wpdb, $post;
 
755
 
756
  if ( is_array( $galleries_array ) ) {
757
  if ( ! empty( $galleries_array ) ) {
@@ -784,9 +763,7 @@ class MLAReferences {
784
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-shortcodes.php' );
785
  }
786
 
787
- /*
788
- * $galleries_array is null, so build the array
789
- */
790
  $galleries_array = array();
791
 
792
  if ( $exclude_revisions ) {
@@ -818,31 +795,69 @@ class MLAReferences {
818
  }
819
 
820
  foreach ( $results as $result ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
821
  $count = preg_match_all( "/\\{$shortcode}([^\\]]*)\\]/", $result->post_content, $matches, PREG_PATTERN_ORDER );
822
  if ( $count ) {
823
- $result_id = $result->ID;
824
- $galleries_array[ $result_id ]['parent_title'] = $result->post_title;
825
- $galleries_array[ $result_id ]['parent_type'] = $result->post_type;
826
- $galleries_array[ $result_id ]['parent_status'] = $result->post_status;
827
- $galleries_array[ $result_id ]['results'] = array();
828
- $galleries_array[ $result_id ]['galleries'] = array();
829
- $instance = 0;
830
-
831
  foreach ( $matches[1] as $index => $match ) {
832
- /*
833
- * Filter out shortcodes that are not an exact match
834
- */
835
  if ( empty( $match ) || ( ' ' == substr( $match, 0, 1 ) ) ) {
836
  $instance++;
837
- /*
838
- * Remove trailing "/" from XHTML-style self-closing shortcodes
839
- */
840
  $galleries_array[ $result_id ]['galleries'][ $instance ]['query'] = trim( rtrim( $matches[1][$index], '/' ) );
841
  $galleries_array[ $result_id ]['galleries'][ $instance ]['results'] = array();
842
  $post = $result; // set global variable for mla_gallery_shortcode
843
  $attachments = MLAShortcodes::mla_get_shortcode_attachments( $result_id, $galleries_array[ $result_id ]['galleries'][ $instance ]['query'] . ' cache_results=false update_post_meta_cache=false update_post_term_cache=false where_used_query=this-is-a-where-used-query' );
844
 
845
  if ( is_string( $attachments ) ) {
 
846
  /* translators: 1: post_type, 2: post_title, 3: post ID, 4: query string, 5: error message */
847
  trigger_error( htmlentities( sprintf( __( '(%1$s) %2$s (ID %3$d) query "%4$s" failed, returning "%5$s"', 'media-library-assistant' ), $result->post_type, $result->post_title, $result->ID, $galleries_array[ $result_id ]['galleries'][ $instance ]['query'], $attachments) ), E_USER_WARNING );
848
  } elseif ( ! empty( $attachments ) ) {
@@ -854,15 +869,19 @@ class MLAReferences {
854
  } // exact match
855
  } // foreach $match
856
  } // if $count
 
 
 
 
 
857
  } // foreach $result
858
 
859
- /*
860
- * Maybe cache the results
861
- */
862
  if ( 'cached' == $option_value ) {
863
  set_transient( MLA_OPTION_PREFIX . 't_' . $option_name, $galleries_array, 900 ); // fifteen minutes
864
  }
865
 
 
866
  return true;
867
  }
868
 
352
  public static function mla_attachment_array_fetch_references_handler( &$attachments ) {
353
  global $wpdb;
354
 
355
+ // See element definitions above
 
 
356
  $initial_references = array(
357
  'inserted_option' => '',
358
  'tested_reference' => false,
376
  $inserted_in_option = MLACore::mla_get_option( MLACoreOptions::MLA_INSERTED_IN_TUNING );
377
  $initial_references['inserted_option'] = $inserted_in_option;
378
 
379
+ // Make sure there's work to do; otherwise initialize the attachment data and return
 
 
380
  if ( false == ( MLACore::$process_featured_in || MLACore::$process_inserted_in || MLACore::$process_gallery_in || MLACore::$process_mla_gallery_in ) ) {
381
  foreach ( $attachments as $attachment_index => $attachment ) {
382
  $attachments[ $attachment_index ]->mla_references = $initial_references;
385
  return;
386
  }
387
 
388
+ // Collect the raw data for where-used analysis
 
 
389
  $attachment_ids = array();
390
  $files = array();
391
  foreach ( $attachments as $index => $attachment ) {
491
  $wpdb->prepare( $query, $query_parameters )
492
  );
493
 
494
+ // Match each post with inserts back to the attachments
 
 
495
  $inserts = array();
496
  if ( ! empty( $results ) ) {
497
  foreach ( $files as $index => $file ) {
524
  foreach ( $attachments as $attachment_index => $attachment ) {
525
  $references = array_merge( $initial_references, $files[ $attachment_index ] );
526
 
527
+ // Fill in Parent data
 
 
528
  if ( ( (int) $attachment->post_parent ) === 0 ) {
529
  $references['is_unattached'] = true;
530
  } else {
543
  }
544
  }
545
 
546
+ // Accumulate reference test types, e.g., 0 = no tests, 4 = all tests
 
 
547
  $reference_tests = 0;
548
 
549
+ // Look for the "Featured Image(s)", if enabled
 
 
550
  if ( MLACore::$process_featured_in ) {
551
  $reference_tests++;
552
  if ( isset( $features[ $attachment->ID ] ) ) {
561
  }
562
  } // $process_featured_in
563
 
564
+ // Look for item(s) inserted in post_content
 
 
565
  if ( MLACore::$process_inserted_in ) {
566
  $reference_tests++;
567
 
587
  }
588
  } // $process_inserted_in
589
 
590
+ // Look for [mla_gallery] references
 
 
591
  if ( MLACore::$process_mla_gallery_in ) {
592
  $reference_tests++;
593
  if ( self::_build_mla_galleries( MLACoreOptions::MLA_MLA_GALLERY_IN_TUNING, self::$mla_galleries, '[mla_gallery', $exclude_revisions ) ) {
607
  }
608
  } // $process_mla_gallery_in
609
 
610
+ // Look for [gallery] references
 
 
611
  if ( MLACore::$process_gallery_in ) {
612
  $reference_tests++;
613
  if ( self::_build_mla_galleries( MLACoreOptions::MLA_GALLERY_IN_TUNING, self::$galleries, '[gallery', $exclude_revisions ) ) {
627
  }
628
  } // $process_gallery_in
629
 
630
+ // Evaluate and summarize reference tests
 
 
631
  $errors = '';
632
  if ( 0 == $reference_tests ) {
633
  $references['tested_reference'] = false;
730
  */
731
  private static function _build_mla_galleries( $option_name, &$galleries_array, $shortcode, $exclude_revisions ) {
732
  global $wpdb, $post;
733
+ //error_log( __LINE__ . " MLAReferences::_build_mla_galleries( $option_name, $shortcode, $exclude_revisions )", 0 );
734
 
735
  if ( is_array( $galleries_array ) ) {
736
  if ( ! empty( $galleries_array ) ) {
763
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-shortcodes.php' );
764
  }
765
 
766
+ // $galleries_array is null, so build the array
 
 
767
  $galleries_array = array();
768
 
769
  if ( $exclude_revisions ) {
795
  }
796
 
797
  foreach ( $results as $result ) {
798
+ $result_id = $result->ID;
799
+ $galleries_array[ $result_id ]['parent_title'] = $result->post_title;
800
+ $galleries_array[ $result_id ]['parent_type'] = $result->post_type;
801
+ $galleries_array[ $result_id ]['parent_status'] = $result->post_status;
802
+ $galleries_array[ $result_id ]['results'] = array();
803
+ $galleries_array[ $result_id ]['galleries'] = array();
804
+ $instance = 0;
805
+
806
+ // Look for and process enclosing shortcode ayntax first
807
+ if ( strpos( $result->post_content, '[/mla_gallery]' ) ) {
808
+ //error_log( __LINE__ . " MLAReferences::_build_mla_galleries( $option_name, $shortcode, $exclude_revisions ) result = " . var_export( $result, true ), 0 );
809
+ $count = preg_match_all( "/\\[mla_gallery([^\\]]*)\\](.*?)(\\[\\/mla_gallery\\])/s", $result->post_content, $matches, PREG_PATTERN_ORDER + PREG_OFFSET_CAPTURE );
810
+ if ( $count ) {
811
+ $cleanup = array();
812
+ //error_log( __LINE__ . " MLAReferences::_build_mla_galleries( $result_id, $count ) matches = " . var_export( $matches, true ), 0 );
813
+ foreach ( $matches[0] as $index => $match ) {
814
+ $instance++;
815
+ $cleanup[ $match[1] ] = $match[0];
816
+ $galleries_array[ $result_id ]['galleries'][ $instance ]['query'] = MLAShortcode_Support::mla_validate_attributes( $matches[1][$index][0], $matches[2][$index][0] );
817
+ $galleries_array[ $result_id ]['galleries'][ $instance ]['results'] = array();
818
+ $post = $result; // set global variable for mla_gallery_shortcode
819
+ $attr = array_merge( $galleries_array[ $result_id ]['galleries'][ $instance ]['query'],
820
+ array( 'cache_results' => 'false', 'update_post_meta_cache' => 'false', 'update_post_term_cache' => 'false', 'where_used_query' => 'this-is-a-where-used-query' ) );
821
+ //error_log( __LINE__ . " MLAReferences::_build_mla_galleries( $result_id, $count ) attr = " . var_export( $attr, true ), 0 );
822
+ $attachments = MLAShortcodes::mla_get_shortcode_attachments( $result_id, $attr );
823
+ //error_log( __LINE__ . " MLAReferences::_build_mla_galleries( $result_id, $count ) attachments = " . var_export( $attachments, true ), 0 );
824
+
825
+ if ( is_string( $attachments ) ) {
826
+ //error_log( __LINE__ . " MLAReferences::_build_mla_galleries( $result_id, $index ) query = " . var_export( $galleries_array[ $result_id ]['galleries'][ $instance ]['query'] . ' cache_results=false update_post_meta_cache=false update_post_term_cache=false where_used_query=this-is-a-where-used-query', true ), 0 );
827
+ /* translators: 1: post_type, 2: post_title, 3: post ID, 4: query string, 5: error message */
828
+ trigger_error( htmlentities( sprintf( __( '(%1$s) %2$s (ID %3$d) query "%4$s" failed, returning "%5$s"', 'media-library-assistant' ), $result->post_type, $result->post_title, $result->ID, $galleries_array[ $result_id ]['galleries'][ $instance ]['query'], $attachments) ), E_USER_WARNING );
829
+ } elseif ( ! empty( $attachments ) ) {
830
+ foreach ( $attachments as $attachment ) {
831
+ $galleries_array[ $result_id ]['results'][ $attachment->ID ] = $attachment->ID;
832
+ $galleries_array[ $result_id ]['galleries'][ $instance ]['results'][] = $attachment->ID;
833
+ }
834
+ } // ! empty( $attachments )
835
+ } // foreach $match
836
+ krsort( $cleanup );
837
+ //error_log( __LINE__ . " MLAReferences::_build_mla_galleries( $result_id, $count ) cleanup = " . var_export( $cleanup, true ), 0 );
838
+ foreach ( $cleanup as $offset => $content ) {
839
+ $result->post_content = substr_replace( $result->post_content, '', $offset, strlen( $content ) );
840
+ }
841
+ //error_log( __LINE__ . " MLAReferences::_build_mla_galleries( $result_id, $count ) post_content = " . var_export( $result->post_content, true ), 0 );
842
+ } // $count
843
+ } // enclosing shortcode(s)
844
+
845
  $count = preg_match_all( "/\\{$shortcode}([^\\]]*)\\]/", $result->post_content, $matches, PREG_PATTERN_ORDER );
846
  if ( $count ) {
847
+ //error_log( __LINE__ . " MLAReferences::_build_mla_galleries( $result_id ) matches = " . var_export( $matches, true ), 0 );
 
 
 
 
 
 
 
848
  foreach ( $matches[1] as $index => $match ) {
849
+ //error_log( __LINE__ . " MLAReferences::_build_mla_galleries( $result_id, $index ) match = " . var_export( $match, true ), 0 );
850
+ // Filter out shortcodes that are not an exact match
 
851
  if ( empty( $match ) || ( ' ' == substr( $match, 0, 1 ) ) ) {
852
  $instance++;
853
+ // Remove trailing "/" from XHTML-style self-closing shortcodes
 
 
854
  $galleries_array[ $result_id ]['galleries'][ $instance ]['query'] = trim( rtrim( $matches[1][$index], '/' ) );
855
  $galleries_array[ $result_id ]['galleries'][ $instance ]['results'] = array();
856
  $post = $result; // set global variable for mla_gallery_shortcode
857
  $attachments = MLAShortcodes::mla_get_shortcode_attachments( $result_id, $galleries_array[ $result_id ]['galleries'][ $instance ]['query'] . ' cache_results=false update_post_meta_cache=false update_post_term_cache=false where_used_query=this-is-a-where-used-query' );
858
 
859
  if ( is_string( $attachments ) ) {
860
+ //error_log( __LINE__ . " MLAReferences::_build_mla_galleries( $result_id, $index ) query = " . var_export( $galleries_array[ $result_id ]['galleries'][ $instance ]['query'] . ' cache_results=false update_post_meta_cache=false update_post_term_cache=false where_used_query=this-is-a-where-used-query', true ), 0 );
861
  /* translators: 1: post_type, 2: post_title, 3: post ID, 4: query string, 5: error message */
862
  trigger_error( htmlentities( sprintf( __( '(%1$s) %2$s (ID %3$d) query "%4$s" failed, returning "%5$s"', 'media-library-assistant' ), $result->post_type, $result->post_title, $result->ID, $galleries_array[ $result_id ]['galleries'][ $instance ]['query'], $attachments) ), E_USER_WARNING );
863
  } elseif ( ! empty( $attachments ) ) {
869
  } // exact match
870
  } // foreach $match
871
  } // if $count
872
+
873
+ // Back out results with no galleries found
874
+ if ( 0 === $instance ) {
875
+ unset( $galleries_array[ $result_id ] );
876
+ }
877
  } // foreach $result
878
 
879
+ // Maybe cache the results
 
 
880
  if ( 'cached' == $option_value ) {
881
  set_transient( MLA_OPTION_PREFIX . 't_' . $option_name, $galleries_array, 900 ); // fifteen minutes
882
  }
883
 
884
+ //error_log( __LINE__ . " MLAReferences::_build_mla_galleries( ) galleries_array = " . var_export( $galleries_array, true ), 0 );
885
  return true;
886
  }
887
 
includes/class-mla-data.php CHANGED
@@ -430,7 +430,7 @@ class MLAData {
430
  */
431
  private static function _evaluate_template_array_node( $node, $markup_values = array() ) {
432
  $result = array();
433
-
434
  // Check for an array of sub-nodes
435
  if ( ! isset( $node['type'] ) ) {
436
  foreach ( $node as $value ) {
@@ -1633,6 +1633,7 @@ class MLAData {
1633
  * ['mla_search_fields'] => 'title', 'name', 'alt-text', 'excerpt', 'content', 'file' ,'terms'
1634
  * Note: 'alt-text' and 'file' are not supported in [mla_gallery]
1635
  * ['mla_search_connector'] => AND/OR
 
1636
  * ['sentence'] => entire string must match as one "keyword"
1637
  * ['exact'] => entire string must match entire field value
1638
  * ['debug'] => internal element, console/log/shortcode/none
@@ -2203,12 +2204,12 @@ class MLAData {
2203
  } elseif ( is_array( $value ) ) {
2204
  $value = self::_parse_xmp_array( $value );
2205
  }
2206
-
2207
  if ( false !== ($colon = strpos( $key, ':' ) ) ) {
2208
  $array_name = substr( $key, 0, $colon );
2209
  $array_index = substr( $key, $colon + 1 );
2210
  $namespace_arrays[ $array_name ][ $array_index ] = $value;
2211
-
2212
  if ( ! isset( $results[ $array_index ] ) && in_array( $array_name, array( 'xmp', 'xmpMM', 'xmpRights', 'xap', 'xapMM', 'dc', 'pdf', 'pdfx', 'mwg-rs' ) ) ) {
2213
  if ( is_array( $value ) && 1 == count( $value ) && isset( $value[0] ) ) {
2214
  $results[ $array_index ] = $value[0];
@@ -2232,12 +2233,12 @@ class MLAData {
2232
  } elseif ( is_array( $value ) ) {
2233
  $value = self::_parse_xmp_array( $value );
2234
  }
2235
-
2236
  if ( false !== ($colon = strpos( $key, ':' ) ) ) {
2237
  $array_name = substr( $key, 0, $colon );
2238
  $array_index = substr( $key, $colon + 1 );
2239
  $namespace_arrays[ $array_name ][ $array_index ] = $value;
2240
-
2241
  if ( ! isset( $results[ $array_index ] ) && in_array( $array_name, array( 'cp', 'dc', 'dcterms' ) ) ) {
2242
  if ( is_array( $value ) && 1 == count( $value ) && isset( $value[0] ) ) {
2243
  $results[ $array_index ] = $value[0];
@@ -2248,7 +2249,7 @@ class MLAData {
2248
  // found namespace
2249
  } elseif ( $is_app_xml ) {
2250
  $namespace_arrays[ 'app' ][ $key ] = $value;
2251
-
2252
  if ( ! isset( $results[ $key ] ) ) {
2253
  if ( is_array( $value ) && 1 == count( $value ) && isset( $value[0] ) ) {
2254
  $results[ $key ] = $value[0];
@@ -2293,7 +2294,7 @@ class MLAData {
2293
  } else {
2294
  $replacement = self::_nonempty_value( $namespace_arrays, 'dc', 'subject' );
2295
  }
2296
-
2297
  if ( ! empty( $replacement ) ) {
2298
  $results['Subject'] = $replacement;
2299
  }
@@ -3417,7 +3418,16 @@ class MLAData {
3417
  );
3418
 
3419
  if ( 0 != $post_id ) {
3420
- $path = get_attached_file($post_id);
 
 
 
 
 
 
 
 
 
3421
  }
3422
 
3423
  if ( ! empty( $path ) ) {
@@ -3982,7 +3992,7 @@ class MLAData {
3982
  }
3983
 
3984
  // mla_fetch_attachment_metadata doesn't return "hidden" fields
3985
- if ( '_' === $meta_key{0} ) {
3986
  $old_meta_value = get_post_meta( $post_id, $meta_key );
3987
 
3988
  if ( !empty( $old_meta_value ) ) {
430
  */
431
  private static function _evaluate_template_array_node( $node, $markup_values = array() ) {
432
  $result = array();
433
+
434
  // Check for an array of sub-nodes
435
  if ( ! isset( $node['type'] ) ) {
436
  foreach ( $node as $value ) {
1633
  * ['mla_search_fields'] => 'title', 'name', 'alt-text', 'excerpt', 'content', 'file' ,'terms'
1634
  * Note: 'alt-text' and 'file' are not supported in [mla_gallery]
1635
  * ['mla_search_connector'] => AND/OR
1636
+ * ['whole_word'] => each word must match as one "keyword", e.g. "man" won't match "woman"
1637
  * ['sentence'] => entire string must match as one "keyword"
1638
  * ['exact'] => entire string must match entire field value
1639
  * ['debug'] => internal element, console/log/shortcode/none
2204
  } elseif ( is_array( $value ) ) {
2205
  $value = self::_parse_xmp_array( $value );
2206
  }
2207
+
2208
  if ( false !== ($colon = strpos( $key, ':' ) ) ) {
2209
  $array_name = substr( $key, 0, $colon );
2210
  $array_index = substr( $key, $colon + 1 );
2211
  $namespace_arrays[ $array_name ][ $array_index ] = $value;
2212
+
2213
  if ( ! isset( $results[ $array_index ] ) && in_array( $array_name, array( 'xmp', 'xmpMM', 'xmpRights', 'xap', 'xapMM', 'dc', 'pdf', 'pdfx', 'mwg-rs' ) ) ) {
2214
  if ( is_array( $value ) && 1 == count( $value ) && isset( $value[0] ) ) {
2215
  $results[ $array_index ] = $value[0];
2233
  } elseif ( is_array( $value ) ) {
2234
  $value = self::_parse_xmp_array( $value );
2235
  }
2236
+
2237
  if ( false !== ($colon = strpos( $key, ':' ) ) ) {
2238
  $array_name = substr( $key, 0, $colon );
2239
  $array_index = substr( $key, $colon + 1 );
2240
  $namespace_arrays[ $array_name ][ $array_index ] = $value;
2241
+
2242
  if ( ! isset( $results[ $array_index ] ) && in_array( $array_name, array( 'cp', 'dc', 'dcterms' ) ) ) {
2243
  if ( is_array( $value ) && 1 == count( $value ) && isset( $value[0] ) ) {
2244
  $results[ $array_index ] = $value[0];
2249
  // found namespace
2250
  } elseif ( $is_app_xml ) {
2251
  $namespace_arrays[ 'app' ][ $key ] = $value;
2252
+
2253
  if ( ! isset( $results[ $key ] ) ) {
2254
  if ( is_array( $value ) && 1 == count( $value ) && isset( $value[0] ) ) {
2255
  $results[ $key ] = $value[0];
2294
  } else {
2295
  $replacement = self::_nonempty_value( $namespace_arrays, 'dc', 'subject' );
2296
  }
2297
+
2298
  if ( ! empty( $replacement ) ) {
2299
  $results['Subject'] = $replacement;
2300
  }
3418
  );
3419
 
3420
  if ( 0 != $post_id ) {
3421
+ $path = false;
3422
+
3423
+ // WP 5.3+ produces "scaled" images without metadata; we need the original.
3424
+ if ( function_exists( 'wp_get_original_image_path' ) ) {
3425
+ $path = wp_get_original_image_path( $post_id );
3426
+ }
3427
+
3428
+ if ( false === $path ) {
3429
+ $path = get_attached_file($post_id);
3430
+ }
3431
  }
3432
 
3433
  if ( ! empty( $path ) ) {
3992
  }
3993
 
3994
  // mla_fetch_attachment_metadata doesn't return "hidden" fields
3995
+ if ( '_' === $meta_key[0] ) {
3996
  $old_meta_value = get_post_meta( $post_id, $meta_key );
3997
 
3998
  if ( !empty( $old_meta_value ) ) {
includes/class-mla-file-downloader.php CHANGED
@@ -67,12 +67,15 @@ class MLAFileDownloader {
67
  }
68
  }
69
 
 
70
  $file_name = $args['mla_download_file'];
71
  $match_name = str_replace( '\\', '/', $file_name );
72
- $base_dir = pathinfo( __FILE__, PATHINFO_DIRNAME );
73
- $match_dir = str_replace( '\\', '/', $base_dir );
74
- $allowed_path = substr( $match_dir, 0, strpos( $match_dir, 'plugins' ) );
75
 
 
 
 
 
 
76
  if ( 0 !== strpos( $match_name, $allowed_path ) ) {
77
  $message = 'ERROR: download path out of bounds.';
78
  } elseif ( false !== strpos( $match_name, '..' ) ) {
67
  }
68
  }
69
 
70
+
71
  $file_name = $args['mla_download_file'];
72
  $match_name = str_replace( '\\', '/', $file_name );
 
 
 
73
 
74
+
75
+ $upload_dir = wp_upload_dir();
76
+ $allowed_path = str_replace( '\\', '/', $upload_dir['basedir'] );
77
+
78
+ // Restrict downloads to the WordPress Uploads directory tree
79
  if ( 0 !== strpos( $match_name, $allowed_path ) ) {
80
  $message = 'ERROR: download path out of bounds.';
81
  } elseif ( false !== strpos( $match_name, '..' ) ) {
includes/class-mla-media-modal.php CHANGED
@@ -655,6 +655,8 @@ class MLAModal {
655
  'Any term' => __( 'Any term', 'media-library-assistant' ),
656
  'exact_checked' => '',
657
  'Exact' => __( 'Exact', 'media-library-assistant' ),
 
 
658
  'mla_terms_search_taxonomies' => $taxonomy_list,
659
  );
660
  $terms_search_tpl = MLAData::mla_parse_template( $page_template_array['mla-terms-search-div'], $page_values );
655
  'Any term' => __( 'Any term', 'media-library-assistant' ),
656
  'exact_checked' => '',
657
  'Exact' => __( 'Exact', 'media-library-assistant' ),
658
+ 'whole_word_checked' => '',
659
+ 'Whole Word' => __( 'Whole Word', 'media-library-assistant' ),
660
  'mla_terms_search_taxonomies' => $taxonomy_list,
661
  );
662
  $terms_search_tpl = MLAData::mla_parse_template( $page_template_array['mla-terms-search-div'], $page_values );
includes/class-mla-settings-custom-fields-tab.php CHANGED
@@ -750,7 +750,7 @@ class MLASettings_CustomFields {
750
  'results' => ! empty( $_REQUEST['s'] ) ? '<span class="alignright" style="margin-top: .5em; font-weight: bold">' . __( 'Search results for', 'media-library-assistant' ) . ':&nbsp;</span>' : '',
751
  // '_wp_http_referer' => wp_referer_field( false ),
752
  'Search Rules Text' => __( 'Search Rules Text', 'media-library-assistant' ),
753
- 's' => isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '',
754
  'Search Rules' => __( 'Search Rules', 'media-library-assistant' ),
755
  'options_list' => $options_list,
756
  'Save Changes' => __( 'Save Changes', 'media-library-assistant' ),
750
  'results' => ! empty( $_REQUEST['s'] ) ? '<span class="alignright" style="margin-top: .5em; font-weight: bold">' . __( 'Search results for', 'media-library-assistant' ) . ':&nbsp;</span>' : '',
751
  // '_wp_http_referer' => wp_referer_field( false ),
752
  'Search Rules Text' => __( 'Search Rules Text', 'media-library-assistant' ),
753
+ 's' => isset( $_REQUEST['s'] ) ? esc_attr( stripslashes( trim( $_REQUEST['s'] ) ) ) : '',
754
  'Search Rules' => __( 'Search Rules', 'media-library-assistant' ),
755
  'options_list' => $options_list,
756
  'Save Changes' => __( 'Save Changes', 'media-library-assistant' ),
includes/class-mla-settings-documentation-tab.php CHANGED
@@ -183,7 +183,7 @@ class MLASettings_Documentation {
183
  );
184
 
185
  $page_values = array(
186
- 'results' => ! empty( $_REQUEST['s'] ) ? ' - ' . __( 'Displaying search results for', 'media-library-assistant' ) . ': "' . $_REQUEST['s'] . '"' : '',
187
  'In this tab' => __( 'In this tab you can browse the list of MLA example plugins, install or update them in the Plugins/Installed Plugins area and see which examples you have already installed. <strong>To activate, deactivate or delete</strong> the plugins you must go to the Plugins/Installed Plugins admin submenu.' ),
188
  /* translators: 1: Documentation hyperlink */
189
  'You can find' => sprintf( __( 'You can find more information about using the example plugins in the %1$s section of the Documentation or by clicking the <strong>"Help"</strong> tab in the upper-right corner of this screen.', 'media-library-assistant' ), '<a href="[+settingsURL+]?page=mla-settings-menu-documentation&amp;mla_tab=documentation#mla_example_plugins" title="' . __( 'Example plugin documentation', 'media-library-assistant' ) . '">' . __( 'The Example Plugins', 'media-library-assistant' ) . '</a>' ),
@@ -193,7 +193,7 @@ class MLASettings_Documentation {
193
  '_wpnonce' => wp_nonce_field( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME, true, false ),
194
  'Example Plugins' => __( 'Example Plugins', 'media-library-assistant' ),
195
  'Search Example Plugins' => __( 'Search Example Plugins', 'media-library-assistant' ),
196
- 's' => isset( $_REQUEST['s'] ) ? esc_attr( stripslashes( $_REQUEST['s'] ) ) : '',
197
  'Search Plugins' => __( 'Search Plugins', 'media-library-assistant' ),
198
  'Search help' => __( 'Searches Name, Description, File Name and Tags', 'media-library-assistant' ),
199
  'Cancel' => __( 'Cancel', 'media-library-assistant' ),
183
  );
184
 
185
  $page_values = array(
186
+ 'results' => ! empty( $_REQUEST['s'] ) ? ' - ' . __( 'Displaying search results for', 'media-library-assistant' ) . ': "' . esc_html( stripslashes( trim( $_REQUEST['s'] ) ) ) . '"' : '',
187
  'In this tab' => __( 'In this tab you can browse the list of MLA example plugins, install or update them in the Plugins/Installed Plugins area and see which examples you have already installed. <strong>To activate, deactivate or delete</strong> the plugins you must go to the Plugins/Installed Plugins admin submenu.' ),
188
  /* translators: 1: Documentation hyperlink */
189
  'You can find' => sprintf( __( 'You can find more information about using the example plugins in the %1$s section of the Documentation or by clicking the <strong>"Help"</strong> tab in the upper-right corner of this screen.', 'media-library-assistant' ), '<a href="[+settingsURL+]?page=mla-settings-menu-documentation&amp;mla_tab=documentation#mla_example_plugins" title="' . __( 'Example plugin documentation', 'media-library-assistant' ) . '">' . __( 'The Example Plugins', 'media-library-assistant' ) . '</a>' ),
193
  '_wpnonce' => wp_nonce_field( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME, true, false ),
194
  'Example Plugins' => __( 'Example Plugins', 'media-library-assistant' ),
195
  'Search Example Plugins' => __( 'Search Example Plugins', 'media-library-assistant' ),
196
+ 's' => isset( $_REQUEST['s'] ) ? esc_attr( stripslashes( trim( $_REQUEST['s'] ) ) ) : '',
197
  'Search Plugins' => __( 'Search Plugins', 'media-library-assistant' ),
198
  'Search help' => __( 'Searches Name, Description, File Name and Tags', 'media-library-assistant' ),
199
  'Cancel' => __( 'Cancel', 'media-library-assistant' ),
includes/class-mla-settings-iptc-exif-tab.php CHANGED
@@ -830,7 +830,7 @@ class MLASettings_IPTCEXIF {
830
  '_wpnonce' => wp_nonce_field( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME, true, false ),
831
  'results' => ! empty( $_REQUEST['s'] ) ? '<span class="alignright" style="margin-top: .5em; font-weight: bold">' . __( 'Search results for', 'media-library-assistant' ) . ':&nbsp;</span>' : '',
832
  'Search Rules Text' => __( 'Search Rules Text', 'media-library-assistant' ),
833
- 's' => isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '',
834
  'Search Rules' => __( 'Search Rules', 'media-library-assistant' ),
835
  'options_list' => $options_list,
836
  'Save Changes' => __( 'Save Changes', 'media-library-assistant' ),
830
  '_wpnonce' => wp_nonce_field( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME, true, false ),
831
  'results' => ! empty( $_REQUEST['s'] ) ? '<span class="alignright" style="margin-top: .5em; font-weight: bold">' . __( 'Search results for', 'media-library-assistant' ) . ':&nbsp;</span>' : '',
832
  'Search Rules Text' => __( 'Search Rules Text', 'media-library-assistant' ),
833
+ 's' => isset( $_REQUEST['s'] ) ? esc_attr( stripslashes( trim( $_REQUEST['s'] ) ) ) : '',
834
  'Search Rules' => __( 'Search Rules', 'media-library-assistant' ),
835
  'options_list' => $options_list,
836
  'Save Changes' => __( 'Save Changes', 'media-library-assistant' ),
includes/class-mla-settings-shortcodes-tab.php CHANGED
@@ -707,7 +707,7 @@ class MLASettings_Shortcodes {
707
  '_wp_http_referer' => wp_referer_field( false ),
708
  'Add New Template' => __( 'Add New Template', 'media-library-assistant' ),
709
  'Search Templates' => __( 'Search Templates', 'media-library-assistant' ),
710
- 's' => isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '',
711
  'results' => ! empty( $_REQUEST['s'] ) ? '<span class="alignright" style="margin-top: .5em; font-weight: bold">' . __( 'Search results for', 'media-library-assistant' ) . ':&nbsp;</span>' : '',
712
  'options_list' => $options_list,
713
  'Save Changes' => __( 'Save Changes', 'media-library-assistant' ),
707
  '_wp_http_referer' => wp_referer_field( false ),
708
  'Add New Template' => __( 'Add New Template', 'media-library-assistant' ),
709
  'Search Templates' => __( 'Search Templates', 'media-library-assistant' ),
710
+ 's' => isset( $_REQUEST['s'] ) ? esc_attr( stripslashes( trim( $_REQUEST['s'] ) ) ) : '',
711
  'results' => ! empty( $_REQUEST['s'] ) ? '<span class="alignright" style="margin-top: .5em; font-weight: bold">' . __( 'Search results for', 'media-library-assistant' ) . ':&nbsp;</span>' : '',
712
  'options_list' => $options_list,
713
  'Save Changes' => __( 'Save Changes', 'media-library-assistant' ),
includes/class-mla-settings-upload-tab.php CHANGED
@@ -243,9 +243,9 @@ class MLASettings_Upload {
243
  'form_url' => admin_url( 'options-general.php' ) . '?page=mla-settings-menu-upload&mla_tab=upload',
244
  '_wpnonce' => wp_nonce_field( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME, true, false ),
245
  'Known File Extension' => __( 'Known File Extension/MIME Type Associations', 'media-library-assistant' ),
246
- 'results' => ! empty( $_REQUEST['s'] ) ? '<h2 class="alignleft">' . __( 'Displaying search results for', 'media-library-assistant' ) . ': "' . $_REQUEST['s'] . '"</h2>' : '',
247
  'Search Known MIME' => __( 'Search Known MIME Types', 'media-library-assistant' ),
248
- 's' => isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '',
249
  'Search Types' => __( 'Search Types', 'media-library-assistant' ),
250
  'To search by' => __( 'To search by extension, use ".", e.g., ".doc"', 'media-library-assistant' ),
251
  'Cancel' => __( 'Cancel', 'media-library-assistant' ),
@@ -548,8 +548,8 @@ class MLASettings_Upload {
548
  'Status' => __( 'Status', 'media-library-assistant' ),
549
  'No Change' => __( 'No Change', 'media-library-assistant' ),
550
  'Active' => __( 'Active', 'media-library-assistant' ),
551
- 'results' => ! empty( $_REQUEST['s'] ) ? '<h2 class="alignleft">' . __( 'Displaying search results for', 'media-library-assistant' ) . ': "' . $_REQUEST['s'] . '"</h2>' : '',
552
- 's' => isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '',
553
  'icon_types' => self::_get_icon_type_dropdown( $page_template_array, 'mla_upload_item[icon_type]' ),
554
  'inline_icon_types' => self::_get_icon_type_dropdown( $page_template_array, 'icon_type' ),
555
  'bulk_icon_types' => self::_get_icon_type_dropdown( $page_template_array, 'icon_type', '.nochange.' ),
243
  'form_url' => admin_url( 'options-general.php' ) . '?page=mla-settings-menu-upload&mla_tab=upload',
244
  '_wpnonce' => wp_nonce_field( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME, true, false ),
245
  'Known File Extension' => __( 'Known File Extension/MIME Type Associations', 'media-library-assistant' ),
246
+ 'results' => ! empty( $_REQUEST['s'] ) ? '<h2 class="alignleft">' . __( 'Displaying search results for', 'media-library-assistant' ) . ': "' . esc_html( stripslashes( trim( $_REQUEST['s'] ) ) ) . '"</h2>' : '',
247
  'Search Known MIME' => __( 'Search Known MIME Types', 'media-library-assistant' ),
248
+ 's' => isset( $_REQUEST['s'] ) ? esc_attr( stripslashes( trim( $_REQUEST['s'] ) ) ) : '',
249
  'Search Types' => __( 'Search Types', 'media-library-assistant' ),
250
  'To search by' => __( 'To search by extension, use ".", e.g., ".doc"', 'media-library-assistant' ),
251
  'Cancel' => __( 'Cancel', 'media-library-assistant' ),
548
  'Status' => __( 'Status', 'media-library-assistant' ),
549
  'No Change' => __( 'No Change', 'media-library-assistant' ),
550
  'Active' => __( 'Active', 'media-library-assistant' ),
551
+ 'results' => ! empty( $_REQUEST['s'] ) ? '<h2 class="alignleft">' . __( 'Displaying search results for', 'media-library-assistant' ) . ': "' . esc_html( stripslashes( trim( $_REQUEST['s'] ) ) ) . '"</h2>' : '',
552
+ 's' => isset( $_REQUEST['s'] ) ? esc_attr( stripslashes( trim( $_REQUEST['s'] ) ) ) : '',
553
  'icon_types' => self::_get_icon_type_dropdown( $page_template_array, 'mla_upload_item[icon_type]' ),
554
  'inline_icon_types' => self::_get_icon_type_dropdown( $page_template_array, 'icon_type' ),
555
  'bulk_icon_types' => self::_get_icon_type_dropdown( $page_template_array, 'icon_type', '.nochange.' ),
includes/class-mla-settings-view-tab.php CHANGED
@@ -365,9 +365,9 @@ class MLASettings_View {
365
  'settingsURL' => admin_url('options-general.php'),
366
  'form_url' => admin_url( 'options-general.php' ) . '?page=mla-settings-menu-view&mla_tab=view',
367
  '_wpnonce' => wp_nonce_field( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME, true, false ),
368
- 'results' => ! empty( $_REQUEST['s'] ) ? '<h2 class="alignleft">' . __( 'Displaying search results for', 'media-library-assistant' ) . ': "' . $_REQUEST['s'] . '"</h2>' : '',
369
  'Search Views' => __( 'Search Views', 'media-library-assistant' ),
370
- 's' => isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '',
371
  'options_list' => $options_list,
372
  'Save Changes' => __( 'Save Changes', 'media-library-assistant' ),
373
  /* translators: %s: add new View */
365
  'settingsURL' => admin_url('options-general.php'),
366
  'form_url' => admin_url( 'options-general.php' ) . '?page=mla-settings-menu-view&mla_tab=view',
367
  '_wpnonce' => wp_nonce_field( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME, true, false ),
368
+ 'results' => ! empty( $_REQUEST['s'] ) ? '<h2 class="alignleft">' . __( 'Displaying search results for', 'media-library-assistant' ) . ': "' . esc_html( stripslashes( trim( $_REQUEST['s'] ) ) ) . '"</h2>' : '',
369
  'Search Views' => __( 'Search Views', 'media-library-assistant' ),
370
+ 's' => isset( $_REQUEST['s'] ) ? esc_attr( stripslashes( trim( $_REQUEST['s'] ) ) ) : '',
371
  'options_list' => $options_list,
372
  'Save Changes' => __( 'Save Changes', 'media-library-assistant' ),
373
  /* translators: %s: add new View */
includes/class-mla-shortcode-support.php CHANGED
@@ -223,7 +223,7 @@ class MLAShortcode_Support {
223
  }
224
 
225
  /**
226
- * Errors found in function _validate_attributes()
227
  *
228
  * @since 2.80
229
  *
@@ -241,12 +241,15 @@ class MLAShortcode_Support {
241
  *
242
  * @return array clean attributes array
243
  */
244
- private static function _validate_attributes( $attr, $content = NULL ) {
 
 
245
  if ( empty( $attr ) ) {
246
  $attr = array();
247
  } elseif ( is_string( $attr ) ) {
248
  $attr = shortcode_parse_atts( $attr );
249
  }
 
250
 
251
  // Numeric keys indicate parse errors
252
  $not_valid = false;
@@ -264,6 +267,9 @@ class MLAShortcode_Support {
264
  */
265
  $new_attr = '';
266
  foreach ( $attr as $key => $value ) {
 
 
 
267
  $break_tag = strpos( $value, '<br' );
268
  if ( ( false !== $break_tag ) && ( ($break_tag + 3) == strlen( $value ) ) ) {
269
  $value = substr( $value, 0, ( strlen( $value ) - 3) );
@@ -278,8 +284,10 @@ class MLAShortcode_Support {
278
  $new_attr .= $key . '=' . $delimiter . $value . $delimiter . ' ';
279
  }
280
  }
 
281
 
282
  $attr = shortcode_parse_atts( $new_attr );
 
283
 
284
  // Remove empty values and still-invalid parameters
285
  $new_attr = array();
@@ -295,11 +303,12 @@ class MLAShortcode_Support {
295
 
296
  $attr = $new_attr;
297
  } // not_valid
 
298
 
299
  // Look for parameters in an enclosing shortcode
300
  if ( ! ( empty( $content ) || isset( $attr['mla_alt_shortcode'] ) ) ) {
301
- $content = str_replace( array( '&#038;', '&#8216;', '&#8217;', '&#8221;', '&#8243;', '&amp;', '<br />', '<br>', '<p>', '</p>', "\r", "\n" ),
302
- array( '&', '\'', '\'', '"', '"', '&', ' ', ' ', ' ', ' ', ' ', ' ' ), $content );
303
  $content_attr = shortcode_parse_atts( $content );
304
  if ( is_array( $content_attr ) ) {
305
  // Remove empty values and still-invalid parameters
@@ -377,6 +386,8 @@ class MLAShortcode_Support {
377
  * @return string HTML content to display gallery.
378
  */
379
  public static function mla_gallery_shortcode( $attr, $content = NULL ) {
 
 
380
  global $post;
381
 
382
  // Some do_shortcode callers may not have a specific post in mind
@@ -417,7 +428,7 @@ class MLAShortcode_Support {
417
  * Make sure $attr is an array, even if it's empty,
418
  * and repair damage caused by link-breaks in the source text
419
  */
420
- $attr = self::_validate_attributes( $attr, $content );
421
 
422
  // Filter the attributes before $mla_page_parameter and "request:" prefix processing.
423
  $attr = apply_filters( 'mla_gallery_raw_attributes', $attr );
@@ -456,7 +467,8 @@ class MLAShortcode_Support {
456
  'mla_image_class' => '',
457
  'mla_image_alt' => '',
458
  'mla_image_attributes' => '',
459
- 'mla_caption' => ''
 
460
  );
461
 
462
  // These arguments must not be passed on to alternate gallery shortcodes
@@ -485,7 +497,6 @@ class MLAShortcode_Support {
485
 
486
  'mla_alt_shortcode' => NULL,
487
  'mla_alt_ids_name' => 'ids',
488
- 'mla_alt_ids_value' => NULL,
489
  'mla_alt_ids_template' => NULL,
490
 
491
  // paginatation arguments defined in $mla_get_shortcode_attachments_parameters
@@ -538,7 +549,7 @@ class MLAShortcode_Support {
538
 
539
  $arguments = MLATemplate_Support::mla_fetch_custom_template( $template, 'gallery', 'markup', 'arguments' );
540
  if ( !empty( $arguments ) ) {
541
- $attr = wp_parse_args( $attr, self::_validate_attributes( array(), $arguments ) );
542
  }
543
 
544
  /*
@@ -736,6 +747,7 @@ class MLAShortcode_Support {
736
  }
737
 
738
  // Look for user-specified alternate gallery shortcode
 
739
  if ( is_string( $arguments['mla_alt_shortcode'] ) ) {
740
  // Replace data-selection parameters with the "ids" list
741
  $blacklist = array_merge( self::$mla_get_shortcode_attachments_parameters, self::$mla_get_shortcode_dynamic_attachments_parameters );
@@ -774,7 +786,6 @@ class MLAShortcode_Support {
774
  $mla_alt_ids_template = is_null( $arguments['mla_alt_ids_template'] ) ? NULL : str_replace( '{+', '[+', str_replace( '+}', '+]', $arguments['mla_alt_ids_template'] ) );
775
 
776
  if ( is_null( $mla_alt_ids_value ) ) {
777
-
778
  $mla_alt_shortcode_ids = apply_filters_ref_array( 'mla_gallery_alt_shortcode_ids', array( $mla_alt_shortcode_ids, $arguments['mla_alt_ids_name'], &$attachments ) );
779
  if ( is_array( $mla_alt_shortcode_ids ) ) {
780
  if ( 0 == count( $mla_alt_shortcode_ids ) ) {
@@ -821,7 +832,13 @@ class MLAShortcode_Support {
821
 
822
  do_action( 'mla_gallery_end_alt_shortcode' );
823
  return $output;
824
- } // is_null( $mla_alt_ids_value )
 
 
 
 
 
 
825
  } // mla_alt_shortcode
826
 
827
  $size_class = $arguments['size'];
@@ -848,7 +865,7 @@ class MLAShortcode_Support {
848
  if ( is_feed() ) {
849
  $output = "\n";
850
  foreach ( $attachments as $att_id => $attachment )
851
- $output .= wp_get_attachment_link($att_id, $size, true) . "\n";
852
  return $output;
853
  }
854
 
@@ -1056,9 +1073,9 @@ class MLAShortcode_Support {
1056
  $markup_values = MLAData::mla_expand_field_level_parameters( $new_text, $attr, $markup_values );
1057
 
1058
  if ( self::$mla_debug ) {
1059
- $mla_alt_ids_output = $output = MLACore::mla_debug_flush();
1060
  } else {
1061
- $mla_alt_ids_output = $output = '';
1062
  }
1063
 
1064
  // These $markup_values are used for both pagination and gallery output
@@ -1073,7 +1090,9 @@ class MLAShortcode_Support {
1073
  }
1074
 
1075
  $gallery_open = apply_filters( 'mla_gallery_open_parse', $gallery_open, $open_template, $markup_values );
1076
- $output .= apply_filters( 'mla_gallery_style', $gallery_style . $gallery_open, $style_values, $markup_values, $style_template, $open_template );
 
 
1077
  } else {
1078
  // Handle 'previous_page', 'next_page', and 'paginate_links'
1079
  $pagination_result = self::_process_pagination_output_types( $output_parameters, $markup_values, $arguments, $attr, $found_rows, $output );
@@ -1456,7 +1475,7 @@ class MLAShortcode_Support {
1456
  // Create download and named transfer links with all Content Parameters
1457
  $match_count = preg_match( '#href=\'([^\']+)\'#', $item_values['filelink'], $matches, PREG_OFFSET_CAPTURE );
1458
  if ( ! ( ( $match_count == false ) || ( $match_count == 0 ) ) ) {
1459
- // Forced download link
1460
  $args = array(
1461
  'mla_download_file' => urlencode( $item_values['base_dir'] . '/' . $item_values['base_file'] ),
1462
  'mla_download_type' => $item_values['mime_type']
@@ -1467,7 +1486,7 @@ class MLAShortcode_Support {
1467
  }
1468
 
1469
  $item_values['downloadlink_url'] = add_query_arg( $args, MLA_PLUGIN_URL . 'includes/mla-file-downloader.php' );
1470
- $item_values['downloadlink'] = preg_replace( '"' . $matches[0][0] . '"', sprintf( 'href=\'%1$s\'', $item_values['downloadlink_url'] ), $item_values['filelink'] );
1471
 
1472
  // AJAX-based Named Transfer link
1473
  $args = array(
@@ -1482,6 +1501,20 @@ class MLAShortcode_Support {
1482
 
1483
  $item_values['transferlink_url'] = add_query_arg( $args, admin_url( 'admin-ajax.php' ) );
1484
  $item_values['transferlink'] = preg_replace( '"' . $matches[0][0] . '"', sprintf( 'href=\'%1$s\'', $item_values['transferlink_url'] ), $item_values['filelink'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1485
  } else {
1486
  $item_values['downloadlink_url'] = $item_values['filelink_url'];
1487
  $item_values['downloadlink'] = $item_values['filelink'];
@@ -1730,7 +1763,9 @@ class MLAShortcode_Support {
1730
  $markup_values = apply_filters( 'mla_gallery_row_open_values', $markup_values );
1731
  $row_open_template = apply_filters( 'mla_gallery_row_open_template', $row_open_template );
1732
  $parse_value = MLAData::mla_parse_template( $row_open_template, $markup_values );
1733
- $output .= apply_filters( 'mla_gallery_row_open_parse', $parse_value, $row_open_template, $markup_values );
 
 
1734
  }
1735
 
1736
  // item markup
@@ -1751,7 +1786,7 @@ class MLAShortcode_Support {
1751
  $item_values = apply_filters( 'mla_gallery_item_values', $item_values );
1752
 
1753
  // Accumulate mla_alt_shortcode_ids when mla_alt_ids_value present
1754
- if ( is_string( $arguments['mla_alt_shortcode'] ) && is_string( $mla_alt_ids_value ) ) {
1755
  $item_values = MLAData::mla_expand_field_level_parameters( $mla_alt_ids_value, $attr, $item_values );
1756
  $mla_alt_shortcode_ids[] = MLAData::mla_parse_template( $mla_alt_ids_value, $item_values );
1757
  continue;
@@ -1775,7 +1810,7 @@ class MLAShortcode_Support {
1775
  } // foreach attachment
1776
 
1777
  // Execute the alternate gallery shortcode with the new parameters
1778
- if ( is_string( $arguments['mla_alt_shortcode'] ) && is_string( $mla_alt_ids_value ) ) {
1779
  // Apply the template when mla_alt_ids_template present
1780
  if ( is_string( $mla_alt_ids_template ) ) {
1781
  $markup_values['alt_ids'] = implode( ',', $mla_alt_shortcode_ids );
@@ -1973,7 +2008,7 @@ class MLAShortcode_Support {
1973
  if ( !empty( $template ) ) {
1974
  $arguments = MLATemplate_Support::mla_fetch_custom_template( $template, 'tag-cloud', 'markup', 'arguments' );
1975
  if ( !empty( $arguments ) ) {
1976
- $attr = wp_parse_args( $attr, self::_validate_attributes( array(), $arguments ) );
1977
  }
1978
  }
1979
 
@@ -2718,7 +2753,7 @@ class MLAShortcode_Support {
2718
  * Make sure $attr is an array, even if it's empty,
2719
  * and repair damage caused by link-breaks in the source text
2720
  */
2721
- $attr = self::_validate_attributes( $attr, $content );
2722
 
2723
  // The 'array' format makes no sense in a shortcode
2724
  if ( isset( $attr['mla_output'] ) && 'array' == $attr['mla_output'] ) {
@@ -3281,7 +3316,7 @@ class MLAShortcode_Support {
3281
  // Apply default arguments set in the markup template
3282
  $arguments = MLATemplate_Support::mla_fetch_custom_template( $template, 'term-list', 'markup', 'arguments' );
3283
  if ( !empty( $arguments ) ) {
3284
- $attr = wp_parse_args( $attr, self::_validate_attributes( array(), $arguments ) );
3285
  }
3286
 
3287
  // Adjust data selection arguments; remove pagination-specific arguments
@@ -3808,7 +3843,7 @@ class MLAShortcode_Support {
3808
  * Make sure $attr is an array, even if it's empty,
3809
  * and repair damage caused by link-breaks in the source text
3810
  */
3811
- $attr = self::_validate_attributes( $attr, $content );
3812
 
3813
  // The 'array' format makes no sense in a shortcode
3814
  if ( isset( $attr['mla_output'] ) && 'array' == $attr['mla_output'] ) {
@@ -4251,7 +4286,93 @@ class MLAShortcode_Support {
4251
  private static $query_parameters = array();
4252
 
4253
  /**
4254
- * Cleans up damage caused by the Visual Editor to the tax_query and meta_query specifications
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4255
  *
4256
  * @since 2.20
4257
  *
@@ -4260,9 +4381,23 @@ class MLAShortcode_Support {
4260
  * @return string query specification with HTML escape sequences and line breaks removed
4261
  */
4262
  private static function _sanitize_query_specification( $specification ) {
4263
- $specification = wp_specialchars_decode( $specification );
4264
- $specification = str_replace( array( '<br>', '<br />', '<p>', '</p>', "\r", "\n" ), ' ', $specification );
4265
- return $specification;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4266
  }
4267
 
4268
  /**
@@ -4462,6 +4597,7 @@ class MLAShortcode_Support {
4462
  's' => '',
4463
  'mla_search_fields' => '',
4464
  'mla_search_connector' => '',
 
4465
  'sentence' => '',
4466
  'exact' => '',
4467
  // Returned fields, for support topic "Adding 'fields' to function mla_get_shortcode_attachments" by leoloso
@@ -4595,13 +4731,23 @@ class MLAShortcode_Support {
4595
  self::$mla_get_shortcode_dynamic_attachments_parameters[ $key ] = $value;
4596
  } else {
4597
  $value = self::_sanitize_query_specification( $value );
 
4598
 
4599
  // Replace invalid queries from "where-used" callers with a harmless equivalent
4600
- if ( $where_used_query && ( false !== strpos( $value, '{+' ) ) ) {
4601
  $value = "array( array( 'taxonomy' => 'none', 'field' => 'slug', 'terms' => 'none' ) )";
 
4602
  }
4603
 
4604
  try {
 
 
 
 
 
 
 
 
4605
  $function = @create_function('', 'return ' . $value . ';' );
4606
  } catch ( Throwable $e ) { // PHP 7
4607
  $function = NULL;
@@ -4614,7 +4760,7 @@ class MLAShortcode_Support {
4614
  } else {
4615
  $tax_query = NULL;
4616
 
4617
- }
4618
 
4619
  if ( is_array( $tax_query ) ) {
4620
  // Check for no.terms.assigned
@@ -4642,9 +4788,9 @@ class MLAShortcode_Support {
4642
  break; // Done - the tax_query overrides all other taxonomy parameters
4643
  } else {
4644
  return '<p>' . __( 'ERROR', 'media-library-assistant' ) . ': ' . __( 'Invalid mla_gallery', 'media-library-assistant' ) . ' tax_query = ' . var_export( $value, true ) . '</p>';
4645
- }
4646
- } // not array
4647
- } // tax_query
4648
  elseif ( 'tax_input' == $key ) {
4649
  $tax_queries = array();
4650
  $compound_values = array_filter( array_map( 'trim', explode( ',', $value ) ) );
@@ -4943,8 +5089,10 @@ class MLAShortcode_Support {
4943
 
4944
  unset( $arguments[ $key ] );
4945
  break;
 
4946
  case 'sentence':
4947
  case 'exact':
 
4948
  if ( ! empty( $value ) && ( 'true' == strtolower( $value ) ) ) {
4949
  MLAQuery::$search_parameters[ $key ] = true;
4950
  } else {
@@ -5031,11 +5179,19 @@ class MLAShortcode_Support {
5031
  $value = self::_sanitize_query_specification( $value );
5032
 
5033
  // Replace invalid queries from "where-used" callers with a harmless equivalent
5034
- if ( $where_used_query && ( false !== strpos( $value, '{+' ) ) ) {
5035
  $value = "array( array( 'key' => 'unlikely', 'value' => 'none or otherwise unlikely' ) )";
5036
  }
5037
 
5038
  try {
 
 
 
 
 
 
 
 
5039
  $function = @create_function('', 'return ' . $value . ';' );
5040
  } catch ( Throwable $e ) { // PHP 7
5041
  $function = NULL;
@@ -5047,7 +5203,7 @@ class MLAShortcode_Support {
5047
  $date_query = $function();
5048
  } else {
5049
  $date_query = NULL;
5050
- }
5051
 
5052
  if ( is_array( $date_query ) ) {
5053
  $query_arguments[ $key ] = $date_query;
@@ -5068,11 +5224,19 @@ class MLAShortcode_Support {
5068
  $value = self::_sanitize_query_specification( $value );
5069
 
5070
  // Replace invalid queries from "where-used" callers with a harmless equivalent
5071
- if ( $where_used_query && ( false !== strpos( $value, '{+' ) ) ) {
5072
  $value = "array( array( 'key' => 'unlikely', 'value' => 'none or otherwise unlikely' ) )";
5073
  }
5074
 
5075
  try {
 
 
 
 
 
 
 
 
5076
  $function = @create_function('', 'return ' . $value . ';' );
5077
  } catch ( Throwable $e ) { // PHP 7
5078
  $function = NULL;
@@ -5084,7 +5248,7 @@ class MLAShortcode_Support {
5084
  $meta_query = $function();
5085
  } else {
5086
  $meta_query = NULL;
5087
- }
5088
 
5089
  if ( is_array( $meta_query ) ) {
5090
  $query_arguments[ $key ] = $meta_query;
@@ -5246,12 +5410,18 @@ class MLAShortcode_Support {
5246
  } else {
5247
  MLAQuery::$search_parameters['mla_terms_search']['radio_terms'] = MLAQuery::$search_parameters['mla_term_connector'];
5248
  }
 
 
 
 
5249
  }
5250
 
 
5251
  unset( MLAQuery::$search_parameters['mla_terms_phrases'] );
5252
  unset( MLAQuery::$search_parameters['mla_terms_taxonomies'] );
5253
  unset( MLAQuery::$search_parameters['mla_phrase_connector'] );
5254
  unset( MLAQuery::$search_parameters['mla_term_connector'] );
 
5255
 
5256
  if ( empty( MLAQuery::$search_parameters['mla_search_fields'] ) ) {
5257
  MLAQuery::$search_parameters['mla_search_fields'] = array( 'title', 'content' );
@@ -5285,6 +5455,10 @@ class MLAShortcode_Support {
5285
  MLAQuery::$search_parameters['mla_search_connector'] = 'AND';
5286
  }
5287
 
 
 
 
 
5288
  if ( empty( MLAQuery::$search_parameters['sentence'] ) ) {
5289
  MLAQuery::$search_parameters['sentence'] = false;
5290
  }
223
  }
224
 
225
  /**
226
+ * Errors found in function mla_validate_attributes()
227
  *
228
  * @since 2.80
229
  *
241
  *
242
  * @return array clean attributes array
243
  */
244
+ public static function mla_validate_attributes( $attr, $content = NULL ) {
245
+ //error_log( __LINE__ . " mla_validate_attributes() attr = " . var_export( $attr, true ), 0 );
246
+ //error_log( __LINE__ . " mla_validate_attributes() content = " . var_export( $content, true ), 0 );
247
  if ( empty( $attr ) ) {
248
  $attr = array();
249
  } elseif ( is_string( $attr ) ) {
250
  $attr = shortcode_parse_atts( $attr );
251
  }
252
+ //error_log( __LINE__ . " mla_validate_attributes() attr = " . var_export( $attr, true ), 0 );
253
 
254
  // Numeric keys indicate parse errors
255
  $not_valid = false;
267
  */
268
  $new_attr = '';
269
  foreach ( $attr as $key => $value ) {
270
+ $value = str_replace( array( '&#038;', '&#8216;', '&#8217;', '&#8220;', '&#8221;', '&#8242;', '&#8243;', '&amp;', '<br />', '<br>', '<p>', '</p>', "\r", "\n", "\t" ),
271
+ array( '&', '\'', '\'', '"', '"', '\'', '"', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ), $value );
272
+ //error_log( __LINE__ . " mla_validate_attributes() value = " . var_export( $value, true ), 0 );
273
  $break_tag = strpos( $value, '<br' );
274
  if ( ( false !== $break_tag ) && ( ($break_tag + 3) == strlen( $value ) ) ) {
275
  $value = substr( $value, 0, ( strlen( $value ) - 3) );
284
  $new_attr .= $key . '=' . $delimiter . $value . $delimiter . ' ';
285
  }
286
  }
287
+ //error_log( __LINE__ . " mla_validate_attributes() new_attr = " . var_export( $new_attr, true ), 0 );
288
 
289
  $attr = shortcode_parse_atts( $new_attr );
290
+ //error_log( __LINE__ . " mla_validate_attributes() attr = " . var_export( $attr, true ), 0 );
291
 
292
  // Remove empty values and still-invalid parameters
293
  $new_attr = array();
303
 
304
  $attr = $new_attr;
305
  } // not_valid
306
+ //error_log( __LINE__ . " mla_validate_attributes() attr = " . var_export( $attr, true ), 0 );
307
 
308
  // Look for parameters in an enclosing shortcode
309
  if ( ! ( empty( $content ) || isset( $attr['mla_alt_shortcode'] ) ) ) {
310
+ $content = str_replace( array( '&#038;', '&#8216;', '&#8217;', '&#8220;', '&#8221;', '&#8242;', '&#8243;', '&amp;', '<br />', '<br>', '<p>', '</p>', "\r", "\n", "\t" ),
311
+ array( '&', '\'', '\'', '"', '"', '\'', '"', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ), $content );
312
  $content_attr = shortcode_parse_atts( $content );
313
  if ( is_array( $content_attr ) ) {
314
  // Remove empty values and still-invalid parameters
386
  * @return string HTML content to display gallery.
387
  */
388
  public static function mla_gallery_shortcode( $attr, $content = NULL ) {
389
+ //error_log( __LINE__ . " mla_gallery_shortcode() _REQUEST = " . var_export( $_REQUEST, true ), 0 );
390
+ //error_log( __LINE__ . " mla_gallery_shortcode() attr = " . var_export( $attr, true ), 0 );
391
  global $post;
392
 
393
  // Some do_shortcode callers may not have a specific post in mind
428
  * Make sure $attr is an array, even if it's empty,
429
  * and repair damage caused by link-breaks in the source text
430
  */
431
+ $attr = self::mla_validate_attributes( $attr, $content );
432
 
433
  // Filter the attributes before $mla_page_parameter and "request:" prefix processing.
434
  $attr = apply_filters( 'mla_gallery_raw_attributes', $attr );
467
  'mla_image_class' => '',
468
  'mla_image_alt' => '',
469
  'mla_image_attributes' => '',
470
+ 'mla_caption' => '',
471
+ 'mla_alt_ids_value' => NULL,
472
  );
473
 
474
  // These arguments must not be passed on to alternate gallery shortcodes
497
 
498
  'mla_alt_shortcode' => NULL,
499
  'mla_alt_ids_name' => 'ids',
 
500
  'mla_alt_ids_template' => NULL,
501
 
502
  // paginatation arguments defined in $mla_get_shortcode_attachments_parameters
549
 
550
  $arguments = MLATemplate_Support::mla_fetch_custom_template( $template, 'gallery', 'markup', 'arguments' );
551
  if ( !empty( $arguments ) ) {
552
+ $attr = wp_parse_args( $attr, self::mla_validate_attributes( array(), $arguments ) );
553
  }
554
 
555
  /*
747
  }
748
 
749
  // Look for user-specified alternate gallery shortcode
750
+ $processing_alt_ids_value = false;
751
  if ( is_string( $arguments['mla_alt_shortcode'] ) ) {
752
  // Replace data-selection parameters with the "ids" list
753
  $blacklist = array_merge( self::$mla_get_shortcode_attachments_parameters, self::$mla_get_shortcode_dynamic_attachments_parameters );
786
  $mla_alt_ids_template = is_null( $arguments['mla_alt_ids_template'] ) ? NULL : str_replace( '{+', '[+', str_replace( '+}', '+]', $arguments['mla_alt_ids_template'] ) );
787
 
788
  if ( is_null( $mla_alt_ids_value ) ) {
 
789
  $mla_alt_shortcode_ids = apply_filters_ref_array( 'mla_gallery_alt_shortcode_ids', array( $mla_alt_shortcode_ids, $arguments['mla_alt_ids_name'], &$attachments ) );
790
  if ( is_array( $mla_alt_shortcode_ids ) ) {
791
  if ( 0 == count( $mla_alt_shortcode_ids ) ) {
832
 
833
  do_action( 'mla_gallery_end_alt_shortcode' );
834
  return $output;
835
+ } /* is_null( $mla_alt_ids_value ) */ else {
836
+ /*
837
+ * If an alternate value has been specified we must delay alt shortcode execution
838
+ * and accumulate $mla_alt_shortcode_ids in the template Item section.
839
+ */
840
+ $processing_alt_ids_value = true;
841
+ }
842
  } // mla_alt_shortcode
843
 
844
  $size_class = $arguments['size'];
865
  if ( is_feed() ) {
866
  $output = "\n";
867
  foreach ( $attachments as $att_id => $attachment )
868
+ $output .= wp_get_attachment_link( $att_id, $size, true ) . "\n";
869
  return $output;
870
  }
871
 
1073
  $markup_values = MLAData::mla_expand_field_level_parameters( $new_text, $attr, $markup_values );
1074
 
1075
  if ( self::$mla_debug ) {
1076
+ $output = MLACore::mla_debug_flush();
1077
  } else {
1078
+ $output = '';
1079
  }
1080
 
1081
  // These $markup_values are used for both pagination and gallery output
1090
  }
1091
 
1092
  $gallery_open = apply_filters( 'mla_gallery_open_parse', $gallery_open, $open_template, $markup_values );
1093
+ if ( ! $processing_alt_ids_value ) {
1094
+ $output .= apply_filters( 'mla_gallery_style', $gallery_style . $gallery_open, $style_values, $markup_values, $style_template, $open_template );
1095
+ }
1096
  } else {
1097
  // Handle 'previous_page', 'next_page', and 'paginate_links'
1098
  $pagination_result = self::_process_pagination_output_types( $output_parameters, $markup_values, $arguments, $attr, $found_rows, $output );
1475
  // Create download and named transfer links with all Content Parameters
1476
  $match_count = preg_match( '#href=\'([^\']+)\'#', $item_values['filelink'], $matches, PREG_OFFSET_CAPTURE );
1477
  if ( ! ( ( $match_count == false ) || ( $match_count == 0 ) ) ) {
1478
+ /*/ Forced download link - NO LONGER ALLOWED, SEE BELOW
1479
  $args = array(
1480
  'mla_download_file' => urlencode( $item_values['base_dir'] . '/' . $item_values['base_file'] ),
1481
  'mla_download_type' => $item_values['mime_type']
1486
  }
1487
 
1488
  $item_values['downloadlink_url'] = add_query_arg( $args, MLA_PLUGIN_URL . 'includes/mla-file-downloader.php' );
1489
+ $item_values['downloadlink'] = preg_replace( '"' . $matches[0][0] . '"', sprintf( 'href=\'%1$s\'', $item_values['downloadlink_url'] ), $item_values['filelink'] ); // */
1490
 
1491
  // AJAX-based Named Transfer link
1492
  $args = array(
1501
 
1502
  $item_values['transferlink_url'] = add_query_arg( $args, admin_url( 'admin-ajax.php' ) );
1503
  $item_values['transferlink'] = preg_replace( '"' . $matches[0][0] . '"', sprintf( 'href=\'%1$s\'', $item_values['transferlink_url'] ), $item_values['filelink'] );
1504
+
1505
+ // AJAX-based Named Transfer link for forced downloads
1506
+ $args = array(
1507
+ 'action' => 'mla_named_transfer',
1508
+ 'mla_item' => $attachment->post_name,
1509
+ 'mla_disposition' => 'attachment',
1510
+ );
1511
+
1512
+ if ( 'log' == $arguments['mla_debug'] ) {
1513
+ $args['mla_debug'] = 'log';
1514
+ }
1515
+
1516
+ $item_values['downloadlink_url'] = add_query_arg( $args, admin_url( 'admin-ajax.php' ) );
1517
+ $item_values['downloadlink'] = preg_replace( '"' . $matches[0][0] . '"', sprintf( 'href=\'%1$s\'', $item_values['transferlink_url'] ), $item_values['filelink'] );
1518
  } else {
1519
  $item_values['downloadlink_url'] = $item_values['filelink_url'];
1520
  $item_values['downloadlink'] = $item_values['filelink'];
1763
  $markup_values = apply_filters( 'mla_gallery_row_open_values', $markup_values );
1764
  $row_open_template = apply_filters( 'mla_gallery_row_open_template', $row_open_template );
1765
  $parse_value = MLAData::mla_parse_template( $row_open_template, $markup_values );
1766
+ if ( ! $processing_alt_ids_value ) {
1767
+ $output .= apply_filters( 'mla_gallery_row_open_parse', $parse_value, $row_open_template, $markup_values );
1768
+ }
1769
  }
1770
 
1771
  // item markup
1786
  $item_values = apply_filters( 'mla_gallery_item_values', $item_values );
1787
 
1788
  // Accumulate mla_alt_shortcode_ids when mla_alt_ids_value present
1789
+ if ( $processing_alt_ids_value ) {
1790
  $item_values = MLAData::mla_expand_field_level_parameters( $mla_alt_ids_value, $attr, $item_values );
1791
  $mla_alt_shortcode_ids[] = MLAData::mla_parse_template( $mla_alt_ids_value, $item_values );
1792
  continue;
1810
  } // foreach attachment
1811
 
1812
  // Execute the alternate gallery shortcode with the new parameters
1813
+ if ( $processing_alt_ids_value ) {
1814
  // Apply the template when mla_alt_ids_template present
1815
  if ( is_string( $mla_alt_ids_template ) ) {
1816
  $markup_values['alt_ids'] = implode( ',', $mla_alt_shortcode_ids );
2008
  if ( !empty( $template ) ) {
2009
  $arguments = MLATemplate_Support::mla_fetch_custom_template( $template, 'tag-cloud', 'markup', 'arguments' );
2010
  if ( !empty( $arguments ) ) {
2011
+ $attr = wp_parse_args( $attr, self::mla_validate_attributes( array(), $arguments ) );
2012
  }
2013
  }
2014
 
2753
  * Make sure $attr is an array, even if it's empty,
2754
  * and repair damage caused by link-breaks in the source text
2755
  */
2756
+ $attr = self::mla_validate_attributes( $attr, $content );
2757
 
2758
  // The 'array' format makes no sense in a shortcode
2759
  if ( isset( $attr['mla_output'] ) && 'array' == $attr['mla_output'] ) {
3316
  // Apply default arguments set in the markup template
3317
  $arguments = MLATemplate_Support::mla_fetch_custom_template( $template, 'term-list', 'markup', 'arguments' );
3318
  if ( !empty( $arguments ) ) {
3319
+ $attr = wp_parse_args( $attr, self::mla_validate_attributes( array(), $arguments ) );
3320
  }
3321
 
3322
  // Adjust data selection arguments; remove pagination-specific arguments
3843
  * Make sure $attr is an array, even if it's empty,
3844
  * and repair damage caused by link-breaks in the source text
3845
  */
3846
+ $attr = self::mla_validate_attributes( $attr, $content );
3847
 
3848
  // The 'array' format makes no sense in a shortcode
3849
  if ( isset( $attr['mla_output'] ) && 'array' == $attr['mla_output'] ) {
4286
  private static $query_parameters = array();
4287
 
4288
  /**
4289
+ * Checks for valid, perhaps nested PHP array specification
4290
+ *
4291
+ * @since 2.82
4292
+ *
4293
+ * @param string query specification; PHP nested arrays
4294
+ *
4295
+ * @return boolean true if specification is a valid PHP array else false
4296
+ */
4297
+ private static function _validate_array_specification( $specification ) {
4298
+ //error_log( __LINE__ . " _validate_array_specification() specification = " . var_export( $specification, true ), 0 );
4299
+ // Check for outer array specification(s) and reject anything else.
4300
+ if ( 1 !== preg_match( '/^array\s*\((.*)\)[\s\,]*$/', $specification, $matches ) ) {
4301
+ return false;
4302
+ }
4303
+
4304
+ $interior = trim( $matches[1], ', ' );
4305
+ while ( strlen( $interior ) ) {
4306
+ //error_log( __LINE__ . " _validate_array_specification() interior = " . var_export( $interior, true ), 0 );
4307
+ // Recursive matching required for nested and multiple arrays
4308
+ while ( preg_match_all( '/(?x)array\s*\( ( (?>[^()]+) | (?R) )* \)/', $interior, $matches ) ) {
4309
+ //error_log( __LINE__ . " _validate_array_specification() recursion matches = " . var_export( $matches, true ), 0 );
4310
+ foreach ( $matches[0] as $search ) {
4311
+ // Replace valid arrays with a harmless literal value
4312
+ if ( false === self::_validate_array_specification( $search ) ) {
4313
+ return false;
4314
+ }
4315
+
4316
+ $interior = str_replace( $search, 'ARRAY', $interior );
4317
+ }
4318
+ //error_log( __LINE__ . " _validate_array_specification() recursion interior = " . var_export( $interior, true ), 0 );
4319
+ }
4320
+
4321
+ // Look for an already-validated array match
4322
+ if ( 0 === strpos( $interior, 'ARRAY' ) ) {
4323
+ $interior = trim( substr( $interior, 5 ), ' ,' );
4324
+ continue;
4325
+ }
4326
+
4327
+ // Look for a nested array
4328
+ if ( 1 === preg_match( '/^(array\s*\(.*\))(.*)$/', $interior, $matches ) ) {
4329
+ //error_log( __LINE__ . " _validate_array_specification() matches = " . var_export( $matches, true ), 0 );
4330
+ if ( false === self::_validate_array_specification( $matches[1] ) ) {
4331
+ return false;
4332
+ }
4333
+
4334
+ $interior = trim( $matches[2], ' ,' );
4335
+ continue;
4336
+ }
4337
+
4338
+ // PHP "undefined constant" pattern: [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*
4339
+
4340
+ // Look for 'key' => value
4341
+ if ( 1 === preg_match( '/^((([\'\"](.+?)[\'\"])|(\d+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*))\s*\=\>\s*)(([\'\"](.*?)[\'\"])|(\d+)|(\w{4,5}))(.*)$/', $interior, $matches /*, PREG_OFFSET_CAPTURE */ ) ) {
4342
+ //error_log( __LINE__ . " _validate_array_specification() key => value matches = " . var_export( $matches, true ), 0 );
4343
+
4344
+ // Validate boolean and array() values
4345
+ if ( !empty( $matches[11] ) ) {
4346
+ //error_log( __LINE__ . " _validate_array_specification() boolean and array() matches = " . var_export( $matches[10], true ), 0 );
4347
+ if ( false === in_array( strtolower( $matches[11] ), array( 'false', 'true', 'array' ) ) ) {
4348
+ //error_log( __LINE__ . " _validate_array_specification() FAILED boolean matches = " . var_export( $matches[7], true ), 0 );
4349
+ return false;
4350
+ }
4351
+ }
4352
+
4353
+ $interior = trim( $matches[12], ' ,' );
4354
+ continue;
4355
+ }
4356
+
4357
+ // Look for simple quoted string, integer value or "undefined constant", e.g., in 'terms' =>
4358
+ if ( 1 === preg_match( '/^(([\'\"](.+?)[\'\"])|(\d+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*))(.*)$/', $interior, $matches ) ) {
4359
+ //error_log( __LINE__ . " _validate_array_specification() simple matches = " . var_export( $matches, true ), 0 );
4360
+
4361
+ $interior = trim( $matches[5], ' ,' );
4362
+ continue;
4363
+ }
4364
+
4365
+ //error_log( __LINE__ . " _validate_array_specification() FAILED interior = " . var_export( $interior, true ), 0 );
4366
+ return false;
4367
+ }
4368
+
4369
+ //error_log( __LINE__ . " _validate_array_specification() GOOD interior = " . var_export( $interior, true ), 0 );
4370
+ return true;
4371
+ }
4372
+
4373
+ /**
4374
+ * Cleans up damage caused by the Visual Editor to the tax_query and meta_query specifications,
4375
+ * then checks for valid PHP array specification to avoid remote code execution attacks.
4376
  *
4377
  * @since 2.20
4378
  *
4381
  * @return string query specification with HTML escape sequences and line breaks removed
4382
  */
4383
  private static function _sanitize_query_specification( $specification ) {
4384
+ //error_log( __LINE__ . " _sanitize_query_specification() specification = " . var_export( $specification, true ), 0 );
4385
+ // Clean up the text
4386
+ $candidate = wp_specialchars_decode( $specification );
4387
+
4388
+ $candidate = str_replace( array( '&#038;', '&#8216;', '&#8217;', '&#8220;', '&#8221;', '&#8242;', '&#8243;', '&amp;', '<br />', '<br>', '<p>', '</p>', "\r", "\n", "\t" ),
4389
+ array( '&', '\'', '\'', '"', '"', '\'', '"', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ), $candidate );
4390
+
4391
+ $candidate = trim( $candidate, ' ,"\`' );
4392
+ //error_log( __LINE__ . " _sanitize_query_specification() candidate = " . var_export( $candidate, true ), 0 );
4393
+
4394
+ // Check for nested array specification(s) and reject anything else.
4395
+ if ( self::_validate_array_specification( $candidate ) ) {
4396
+ return $candidate;
4397
+ }
4398
+
4399
+ //error_log( __LINE__ . " _sanitize_query_specification() FAILED", 0 );
4400
+ return 'false';
4401
  }
4402
 
4403
  /**
4597
  's' => '',
4598
  'mla_search_fields' => '',
4599
  'mla_search_connector' => '',
4600
+ 'whole_word' => '',
4601
  'sentence' => '',
4602
  'exact' => '',
4603
  // Returned fields, for support topic "Adding 'fields' to function mla_get_shortcode_attachments" by leoloso
4731
  self::$mla_get_shortcode_dynamic_attachments_parameters[ $key ] = $value;
4732
  } else {
4733
  $value = self::_sanitize_query_specification( $value );
4734
+ //error_log( __LINE__ . " mla_get_shortcode_attachments() value = " . var_export( $value, true ), 0 );
4735
 
4736
  // Replace invalid queries from "where-used" callers with a harmless equivalent
4737
+ if ( $where_used_query && ( ( 'false' === $value ) || ( false !== strpos( $value, '{+' ) ) ) ) {
4738
  $value = "array( array( 'taxonomy' => 'none', 'field' => 'slug', 'terms' => 'none' ) )";
4739
+ //error_log( __LINE__ . " mla_get_shortcode_attachments() value = " . var_export( $value, true ), 0 );
4740
  }
4741
 
4742
  try {
4743
+ $tax_query = @eval( 'return ' . $value . ';' );
4744
+ } catch ( Throwable $e ) { // PHP 7+
4745
+ $tax_query = NULL;
4746
+ } catch ( Exception $e ) { // PHP 5
4747
+ $tax_query = NULL;
4748
+ }
4749
+
4750
+ /* try {
4751
  $function = @create_function('', 'return ' . $value . ';' );
4752
  } catch ( Throwable $e ) { // PHP 7
4753
  $function = NULL;
4760
  } else {
4761
  $tax_query = NULL;
4762
 
4763
+ } // */
4764
 
4765
  if ( is_array( $tax_query ) ) {
4766
  // Check for no.terms.assigned
4788
  break; // Done - the tax_query overrides all other taxonomy parameters
4789
  } else {
4790
  return '<p>' . __( 'ERROR', 'media-library-assistant' ) . ': ' . __( 'Invalid mla_gallery', 'media-library-assistant' ) . ' tax_query = ' . var_export( $value, true ) . '</p>';
4791
+ } // generated value is not an array
4792
+ } // $tax_query is a string, not array
4793
+ } // attr is 'tax_query'
4794
  elseif ( 'tax_input' == $key ) {
4795
  $tax_queries = array();
4796
  $compound_values = array_filter( array_map( 'trim', explode( ',', $value ) ) );
5089
 
5090
  unset( $arguments[ $key ] );
5091
  break;
5092
+ case 'whole_word':
5093
  case 'sentence':
5094
  case 'exact':
5095
+ //error_log( __LINE__ . " mla_gallery_shortcode( $key) value = " . var_export( $value, true ), 0 );
5096
  if ( ! empty( $value ) && ( 'true' == strtolower( $value ) ) ) {
5097
  MLAQuery::$search_parameters[ $key ] = true;
5098
  } else {
5179
  $value = self::_sanitize_query_specification( $value );
5180
 
5181
  // Replace invalid queries from "where-used" callers with a harmless equivalent
5182
+ if ( $where_used_query && ( ( 'false' === $value ) || ( false !== strpos( $value, '{+' ) ) ) ) {
5183
  $value = "array( array( 'key' => 'unlikely', 'value' => 'none or otherwise unlikely' ) )";
5184
  }
5185
 
5186
  try {
5187
+ $date_query = @eval( 'return ' . $value . ';' );
5188
+ } catch ( Throwable $e ) { // PHP 7+
5189
+ $date_query = NULL;
5190
+ } catch ( Exception $e ) { // PHP 5
5191
+ $date_query = NULL;
5192
+ }
5193
+
5194
+ /* try {
5195
  $function = @create_function('', 'return ' . $value . ';' );
5196
  } catch ( Throwable $e ) { // PHP 7
5197
  $function = NULL;
5203
  $date_query = $function();
5204
  } else {
5205
  $date_query = NULL;
5206
+ } // */
5207
 
5208
  if ( is_array( $date_query ) ) {
5209
  $query_arguments[ $key ] = $date_query;
5224
  $value = self::_sanitize_query_specification( $value );
5225
 
5226
  // Replace invalid queries from "where-used" callers with a harmless equivalent
5227
+ if ( $where_used_query && ( ( 'false' === $value ) || ( false !== strpos( $value, '{+' ) ) ) ) {
5228
  $value = "array( array( 'key' => 'unlikely', 'value' => 'none or otherwise unlikely' ) )";
5229
  }
5230
 
5231
  try {
5232
+ $meta_query = @eval( 'return ' . $value . ';' );
5233
+ } catch ( Throwable $e ) { // PHP 7+
5234
+ $meta_query = NULL;
5235
+ } catch ( Exception $e ) { // PHP 5
5236
+ $meta_query = NULL;
5237
+ }
5238
+
5239
+ /* try {
5240
  $function = @create_function('', 'return ' . $value . ';' );
5241
  } catch ( Throwable $e ) { // PHP 7
5242
  $function = NULL;
5248
  $meta_query = $function();
5249
  } else {
5250
  $meta_query = NULL;
5251
+ } // */
5252
 
5253
  if ( is_array( $meta_query ) ) {
5254
  $query_arguments[ $key ] = $meta_query;
5410
  } else {
5411
  MLAQuery::$search_parameters['mla_terms_search']['radio_terms'] = MLAQuery::$search_parameters['mla_term_connector'];
5412
  }
5413
+
5414
+ MLAQuery::$search_parameters['mla_terms_search']['whole_word'] = !empty( MLAQuery::$search_parameters['whole_word'] );
5415
+ MLAQuery::$search_parameters['mla_terms_search']['exact'] = !empty( MLAQuery::$search_parameters['exact'] );
5416
+ MLAQuery::$search_parameters['mla_terms_search']['sentence'] = !empty( MLAQuery::$search_parameters['sentence'] );
5417
  }
5418
 
5419
+ // Remove terms-search-specific parameters
5420
  unset( MLAQuery::$search_parameters['mla_terms_phrases'] );
5421
  unset( MLAQuery::$search_parameters['mla_terms_taxonomies'] );
5422
  unset( MLAQuery::$search_parameters['mla_phrase_connector'] );
5423
  unset( MLAQuery::$search_parameters['mla_term_connector'] );
5424
+ unset( MLAQuery::$search_parameters['whole_word'] );
5425
 
5426
  if ( empty( MLAQuery::$search_parameters['mla_search_fields'] ) ) {
5427
  MLAQuery::$search_parameters['mla_search_fields'] = array( 'title', 'content' );
5455
  MLAQuery::$search_parameters['mla_search_connector'] = 'AND';
5456
  }
5457
 
5458
+ if ( empty( MLAQuery::$search_parameters['whole_word'] ) ) {
5459
+ MLAQuery::$search_parameters['whole_word'] = false;
5460
+ }
5461
+
5462
  if ( empty( MLAQuery::$search_parameters['sentence'] ) ) {
5463
  MLAQuery::$search_parameters['sentence'] = false;
5464
  }
includes/mla-file-downloader.php CHANGED
@@ -13,6 +13,9 @@
13
 
14
  require_once( pathinfo( __FILE__, PATHINFO_DIRNAME ) . '/class-mla-file-downloader.php' );
15
 
 
 
 
16
  if ( isset( $_REQUEST['mla_download_file'] ) && isset( $_REQUEST['mla_download_type'] ) ) {
17
  MLAFileDownloader::$mla_debug = isset( $_REQUEST['mla_debug'] ) && 'log' == $_REQUEST['mla_debug'];
18
  MLAFileDownloader::mla_process_download_file();
13
 
14
  require_once( pathinfo( __FILE__, PATHINFO_DIRNAME ) . '/class-mla-file-downloader.php' );
15
 
16
+ MLAFileDownloader::mla_process_download_file( array( 'error' => 'MLA File Downloader no longer supported because it allowed Local File Disclosure attacks.' ) );
17
+
18
+ // NO LONGER ALLOWED AS OF v2.82
19
  if ( isset( $_REQUEST['mla_download_file'] ) && isset( $_REQUEST['mla_download_type'] ) ) {
20
  MLAFileDownloader::$mla_debug = isset( $_REQUEST['mla_debug'] ) && 'log' == $_REQUEST['mla_debug'];
21
  MLAFileDownloader::mla_process_download_file();
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.80
10
  */
11
 
12
  /*
@@ -16,10 +16,10 @@ Description: Enhances the Media Library; powerful [mla_gallery] [mla_tag_cloud]
16
  Author: David Lingren
17
  Text Domain: media-library-assistant
18
  Domain Path: /languages
19
- Version: 2.81
20
  Author URI: http://davidlingren.com/
21
 
22
- Copyright 2011-2019 David Lingren
23
 
24
  This program is free software; you can redistribute it and/or modify
25
  it under the terms of the GNU General Public License as published by
6
  * will the rest of the plugin be loaded and run.
7
  *
8
  * @package Media Library Assistant
9
+ * @version 2.82
10
  */
11
 
12
  /*
16
  Author: David Lingren
17
  Text Domain: media-library-assistant
18
  Domain Path: /languages
19
+ Version: 2.82
20
  Author URI: http://davidlingren.com/
21
 
22
+ Copyright 2011-2020 David Lingren
23
 
24
  This program is free software; you can redistribute it and/or modify
25
  it under the terms of the GNU General Public License as published by
js/mla-media-modal-scripts.js CHANGED
@@ -605,11 +605,6 @@ var wp, wpAjax, ajaxurl, jQuery, _,
605
  }); // wp.media.view.MlaTermsSearch
606
  } // mlaModal.settings.enableTermsSearch
607
 
608
- /* for debug : trace every event triggered in the wp.media.view.MlaSearch * /
609
- function MlaSearchOn( eventName ) {
610
- console.log('wp.media.view.MlaSearch Event: ', eventName);
611
- } // */
612
-
613
  /**
614
  * Extended wp.media.view.Search
615
  */
@@ -633,11 +628,6 @@ function MlaSearchOn( eventName ) {
633
 
634
  initialize: function() {
635
  var state = this.controller._state;
636
- /* for debug : trace every event triggered in the wp.media.view.MlaSearch * /
637
- wp.media.view.MlaSearch.off( 'all', MlaSearchOn );
638
- wp.media.view.MlaSearch.on( 'all', MlaSearchOn );
639
- // */
640
-
641
  if ( 'undefined' === typeof mlaModal.settings.query[ state ] ) {
642
  mlaModal.settings.query[ state ] = _.clone( mlaModal.settings.query.initial );
643
  mlaModal.settings.query[ state ].searchFields = _.clone( mlaModal.settings.query.initial.searchFields );
@@ -647,12 +637,23 @@ wp.media.view.MlaSearch.on( 'all', MlaSearchOn );
647
  render: function() {
648
  var state = this.controller._state,
649
  data = _.extend( mlaModal.strings, mlaModal.settings.query[ state ] );
 
 
 
 
 
 
 
 
 
 
 
650
  this.$el.html( this.template( data ) );
651
  return this;
652
  },
653
 
654
  search: function( event ) {
655
- var state = this.controller._state, searchValues, searchFields, index;
656
 
657
  if ( ( 'input' == event.type ) && ( 's[mla_search_value]' == event.target.name ) ) {
658
  mlaModal.settings.query[ state ].searchValue = event.target.value;
@@ -682,16 +683,19 @@ wp.media.view.MlaSearch.on( 'all', MlaSearchOn );
682
  mlaModal.settings.query[ state ].searchConnector = event.target.value;
683
  break;
684
  case 's[mla_search_title]':
685
- searchFields = mlaModal.settings.query[ state ].searchFields;
686
- index = searchFields.indexOf( 'title' );
 
 
687
  if ( -1 == index )
688
- searchFields.push( 'title' );
689
  else
690
- searchFields.splice( index, 1 );
691
-
692
- mlaModal.settings.query[ state ].searchFields = searchFields;
693
  break;
694
  case 's[mla_search_name]':
 
 
 
695
  index = mlaModal.settings.query[ state ].searchFields.indexOf( 'name' );
696
  if ( -1 == index )
697
  mlaModal.settings.query[ state ].searchFields.push( 'name' );
@@ -699,6 +703,9 @@ wp.media.view.MlaSearch.on( 'all', MlaSearchOn );
699
  mlaModal.settings.query[ state ].searchFields.splice( index, 1 );
700
  break;
701
  case 's[mla_search_alt_text]':
 
 
 
702
  index = mlaModal.settings.query[ state ].searchFields.indexOf( 'alt-text' );
703
  if ( -1 == index )
704
  mlaModal.settings.query[ state ].searchFields.push( 'alt-text' );
@@ -706,6 +713,9 @@ wp.media.view.MlaSearch.on( 'all', MlaSearchOn );
706
  mlaModal.settings.query[ state ].searchFields.splice( index, 1 );
707
  break;
708
  case 's[mla_search_excerpt]':
 
 
 
709
  index = mlaModal.settings.query[ state ].searchFields.indexOf( 'excerpt' );
710
  if ( -1 == index )
711
  mlaModal.settings.query[ state ].searchFields.push( 'excerpt' );
@@ -713,6 +723,9 @@ wp.media.view.MlaSearch.on( 'all', MlaSearchOn );
713
  mlaModal.settings.query[ state ].searchFields.splice( index, 1 );
714
  break;
715
  case 's[mla_search_content]':
 
 
 
716
  index = mlaModal.settings.query[ state ].searchFields.indexOf( 'content' );
717
  if ( -1 == index )
718
  mlaModal.settings.query[ state ].searchFields.push( 'content' );
@@ -720,6 +733,9 @@ wp.media.view.MlaSearch.on( 'all', MlaSearchOn );
720
  mlaModal.settings.query[ state ].searchFields.splice( index, 1 );
721
  break;
722
  case 's[mla_search_file]':
 
 
 
723
  index = mlaModal.settings.query[ state ].searchFields.indexOf( 'file' );
724
  if ( -1 == index )
725
  mlaModal.settings.query[ state ].searchFields.push( 'file' );
@@ -727,6 +743,9 @@ wp.media.view.MlaSearch.on( 'all', MlaSearchOn );
727
  mlaModal.settings.query[ state ].searchFields.splice( index, 1 );
728
  break;
729
  case 's[mla_search_terms]':
 
 
 
730
  index = mlaModal.settings.query[ state ].searchFields.indexOf( 'terms' );
731
  if ( -1 == index )
732
  mlaModal.settings.query[ state ].searchFields.push( 'terms' );
@@ -773,6 +792,7 @@ wp.media.view.MlaSearch.on( 'all', MlaSearchOn );
773
  * Add/replace media-toolbar controls with our own
774
  */
775
  if ( mlaModal.settings.enableMimeTypes || mlaModal.settings.enableMonthsDropdown || mlaModal.settings.enableTermsDropdown || mlaModal.settings.enableTermsSearch || mlaModal.settings.enableSearchBox ) {
 
776
  wp.media.view.AttachmentsBrowser = wp.media.view.AttachmentsBrowser.extend({
777
  /* for debug : trace every event triggered in this.controller * /
778
  toolbarEvent: function( eventName ) {
@@ -782,6 +802,31 @@ wp.media.view.MlaSearch.on( 'all', MlaSearchOn );
782
  console.log('toolbarEvent( ) Event: ', eventName);
783
  }, // */
784
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
785
  createToolbar: function() {
786
  var filters, state = this.controller._state;
787
 
@@ -804,6 +849,9 @@ this.controller.on( 'all', this.toolbarEvent );
804
  console.log( 'listening to controller events' );
805
  // */
806
 
 
 
 
807
  // Enhanced Media Library (eml) plugin has CSS styles that require this patch
808
  if ( typeof window.eml !== "undefined" ) {
809
  $( '.media-toolbar', this.$el ).css( 'overflow', 'hidden' );
605
  }); // wp.media.view.MlaTermsSearch
606
  } // mlaModal.settings.enableTermsSearch
607
 
 
 
 
 
 
608
  /**
609
  * Extended wp.media.view.Search
610
  */
628
 
629
  initialize: function() {
630
  var state = this.controller._state;
 
 
 
 
 
631
  if ( 'undefined' === typeof mlaModal.settings.query[ state ] ) {
632
  mlaModal.settings.query[ state ] = _.clone( mlaModal.settings.query.initial );
633
  mlaModal.settings.query[ state ].searchFields = _.clone( mlaModal.settings.query.initial.searchFields );
637
  render: function() {
638
  var state = this.controller._state,
639
  data = _.extend( mlaModal.strings, mlaModal.settings.query[ state ] );
640
+
641
+ searchValues = {
642
+ 'mla_filter_month': mlaModal.settings.query[ state ].filterMonth,
643
+ 'mla_filter_term': mlaModal.settings.query[ state ].filterTerm,
644
+ 'mla_terms_search': mlaModal.settings.query[ state ].termsSearch,
645
+ 'mla_search_clicks': mlaModal.settings.query[ state ].searchClicks++,
646
+ 'mla_search_value': mlaModal.settings.query[ state ].searchValue,
647
+ 'mla_search_fields': mlaModal.settings.query[ state ].searchFields,
648
+ 'mla_search_connector': mlaModal.settings.query[ state ].searchConnector };
649
+ this.model.set({ 's': searchValues });
650
+
651
  this.$el.html( this.template( data ) );
652
  return this;
653
  },
654
 
655
  search: function( event ) {
656
+ var state = this.controller._state, searchValues, index;
657
 
658
  if ( ( 'input' == event.type ) && ( 's[mla_search_value]' == event.target.name ) ) {
659
  mlaModal.settings.query[ state ].searchValue = event.target.value;
683
  mlaModal.settings.query[ state ].searchConnector = event.target.value;
684
  break;
685
  case 's[mla_search_title]':
686
+ if ( 'change' != event.type )
687
+ break;
688
+
689
+ index = mlaModal.settings.query[ state ].searchFields.indexOf( 'title' );
690
  if ( -1 == index )
691
+ mlaModal.settings.query[ state ].searchFields.push( 'title' );
692
  else
693
+ mlaModal.settings.query[ state ].searchFields.splice( index, 1 );
 
 
694
  break;
695
  case 's[mla_search_name]':
696
+ if ( 'change' != event.type )
697
+ break;
698
+
699
  index = mlaModal.settings.query[ state ].searchFields.indexOf( 'name' );
700
  if ( -1 == index )
701
  mlaModal.settings.query[ state ].searchFields.push( 'name' );
703
  mlaModal.settings.query[ state ].searchFields.splice( index, 1 );
704
  break;
705
  case 's[mla_search_alt_text]':
706
+ if ( 'change' != event.type )
707
+ break;
708
+
709
  index = mlaModal.settings.query[ state ].searchFields.indexOf( 'alt-text' );
710
  if ( -1 == index )
711
  mlaModal.settings.query[ state ].searchFields.push( 'alt-text' );
713
  mlaModal.settings.query[ state ].searchFields.splice( index, 1 );
714
  break;
715
  case 's[mla_search_excerpt]':
716
+ if ( 'change' != event.type )
717
+ break;
718
+
719
  index = mlaModal.settings.query[ state ].searchFields.indexOf( 'excerpt' );
720
  if ( -1 == index )
721
  mlaModal.settings.query[ state ].searchFields.push( 'excerpt' );
723
  mlaModal.settings.query[ state ].searchFields.splice( index, 1 );
724
  break;
725
  case 's[mla_search_content]':
726
+ if ( 'change' != event.type )
727
+ break;
728
+
729
  index = mlaModal.settings.query[ state ].searchFields.indexOf( 'content' );
730
  if ( -1 == index )
731
  mlaModal.settings.query[ state ].searchFields.push( 'content' );
733
  mlaModal.settings.query[ state ].searchFields.splice( index, 1 );
734
  break;
735
  case 's[mla_search_file]':
736
+ if ( 'change' != event.type )
737
+ break;
738
+
739
  index = mlaModal.settings.query[ state ].searchFields.indexOf( 'file' );
740
  if ( -1 == index )
741
  mlaModal.settings.query[ state ].searchFields.push( 'file' );
743
  mlaModal.settings.query[ state ].searchFields.splice( index, 1 );
744
  break;
745
  case 's[mla_search_terms]':
746
+ if ( 'change' != event.type )
747
+ break;
748
+
749
  index = mlaModal.settings.query[ state ].searchFields.indexOf( 'terms' );
750
  if ( -1 == index )
751
  mlaModal.settings.query[ state ].searchFields.push( 'terms' );
792
  * Add/replace media-toolbar controls with our own
793
  */
794
  if ( mlaModal.settings.enableMimeTypes || mlaModal.settings.enableMonthsDropdown || mlaModal.settings.enableTermsDropdown || mlaModal.settings.enableTermsSearch || mlaModal.settings.enableSearchBox ) {
795
+
796
  wp.media.view.AttachmentsBrowser = wp.media.view.AttachmentsBrowser.extend({
797
  /* for debug : trace every event triggered in this.controller * /
798
  toolbarEvent: function( eventName ) {
802
  console.log('toolbarEvent( ) Event: ', eventName);
803
  }, // */
804
 
805
+ toolbarOpen: function() {
806
+ var toolbarOffset, toolbarHeight, attachmentsOffset;
807
+
808
+ toolbarOffset = $( '.attachments-browser .media-toolbar' ).offset();
809
+ toolbarHeight = $( '.attachments-browser .media-toolbar' ).height();
810
+ attachmentsOffset = $( '.attachments-browser .attachments' ).offset();
811
+ attachmentsOffset.top = toolbarHeight + toolbarOffset.top;
812
+ $( '.attachments-browser .attachments' ).offset( attachmentsOffset );
813
+
814
+ $( window ).resize( function() {
815
+ var newHeight, toolbarOffset, attachmentsOffset;
816
+
817
+ newHeight = $( '.media-toolbar', this.$el ).height();
818
+ if ( newHeight !== mlaModal.settings.oldHeight ) {
819
+
820
+ toolbarOffset = $( '.attachments-browser .media-toolbar' ).offset();
821
+ attachmentsOffset = $( '.attachments-browser .attachments' ).offset();
822
+ attachmentsOffset.top = newHeight + toolbarOffset.top;
823
+ $( '.attachments-browser .attachments' ).offset( attachmentsOffset );
824
+
825
+ mlaModal.settings.oldHeight = newHeight;
826
+ }
827
+ } )
828
+ },
829
+
830
  createToolbar: function() {
831
  var filters, state = this.controller._state;
832
 
849
  console.log( 'listening to controller events' );
850
  // */
851
 
852
+ mlaModal.settings.oldHeight = 0;
853
+ this.controller.on( 'open', this.toolbarOpen );
854
+
855
  // Enhanced Media Library (eml) plugin has CSS styles that require this patch
856
  if ( typeof window.eml !== "undefined" ) {
857
  $( '.media-toolbar', this.$el ).css( 'overflow', 'hidden' );
js/mla-media-modal-scripts.min.js CHANGED
@@ -1 +1 @@
1
- var wp,wpAjax,ajaxurl,jQuery,_,getUserSetting,setUserSetting,deleteUserSetting,mlaTaxonomy,mlaModal={strings:{},settings:{},initialHTML:{},uploading:false,cid:null,utility:{originalMediaAjax:null,mlaAttachmentsBrowser:null,parseTermsOptions:null,arrayCleanup:null,parseTaxonomyId:null,hookCompatTaxonomies:null,fillCompatTaxonomies:null,supportCompatTaxonomies:null},tagBox:null};(function(d){var c=wp.media.view.AttachmentsBrowser,b=wp.media.view.AttachmentCompat,a=wp.media.model.Selection;mlaModal.strings=typeof wp.media.view.l10n.mla_strings==="undefined"?{}:wp.media.view.l10n.mla_strings;delete wp.media.view.l10n.mla_strings;mlaModal.settings=typeof wp.media.view.settings.mla_settings==="undefined"?{screen:"unknown",enableMediaGrid:false,enableMediaModal:false}:wp.media.view.settings.mla_settings;delete wp.media.view.settings.mla_settings;if(!(mlaModal.settings.enableMediaGrid||mlaModal.settings.enableMediaModal)){return}if(("grid"===mlaModal.settings.screen)&&false===mlaModal.settings.enableMediaGrid){return}if(("modal"===mlaModal.settings.screen)&&false===mlaModal.settings.enableMediaModal){return}mlaModal.settings.pagenow=typeof pagenow==="undefined"?"unknown":pagenow;if(mlaModal.settings.pagenow==="toolset_page_views-editor"){return}mlaModal.utility.originalMediaAjax=wp.media.ajax;wp.media.ajax=function(k,g){var j=mlaModal.settings.state,i,f,h,e;if(_.isObject(k)){g=k}else{g=g||{};g.data=_.extend(g.data||{},{action:k})}if("query-attachments"==g.data.action){i=g.data.query;f=typeof i.s;if("object"==f){h=i.s}else{if("string"==f){h={mla_search_value:i.s}}else{h={mla_search_value:""}}}if("undefined"!=typeof i.post_mime_type){mlaModal.settings.query[j].filterMime=i.post_mime_type}else{mlaModal.settings.query[j].filterMime="all"}if("undefined"!=typeof h.mla_filter_month){mlaModal.settings.query[j].filterMonth=h.mla_filter_month}else{if("undefined"!=typeof i.year){mlaModal.settings.query[j].filterMonth=(100*i.year)+(1*i.monthnum)}else{}}if("undefined"!=typeof h.mla_filter_term){mlaModal.settings.query[j].filterTerm=h.mla_filter_term}if("undefined"!=typeof h.mla_search_value){mlaModal.settings.query[j].searchValue=h.mla_search_value}e={mla_filter_month:mlaModal.settings.query[j].filterMonth,mla_filter_term:mlaModal.settings.query[j].filterTerm,mla_terms_search:mlaModal.settings.query[j].termsSearch,mla_search_clicks:mlaModal.settings.query[j].searchClicks,mla_search_value:mlaModal.settings.query[j].searchValue,mla_search_fields:mlaModal.settings.query[j].searchFields,mla_search_connector:mlaModal.settings.query[j].searchConnector};mlaModal.settings.query[j].termsSearch="";d("#mla-terms-search-input").html("").val("");g.data.query.s=e}return mlaModal.utility.originalMediaAjax.call(this,g)};if(mlaModal.settings.enableMimeTypes){wp.media.view.AttachmentFilters.Mla=wp.media.view.AttachmentFilters.extend({createFilters:function(){var f=this.controller._state,e={};_.each(mlaModal.settings.allMimeTypes||{},function(h,g){if(("grid"===mlaModal.settings.screen)||("trash"!==g)){e[g]={text:h,props:{type:g,uploadedTo:null,orderby:"date",order:"DESC"}}}});e.all={text:wp.media.view.l10n.allMediaItems,props:{type:null,uploadedTo:null,orderby:"date",order:"DESC"},priority:10};if(wp.media.view.settings.post.id){e.uploaded={text:wp.media.view.l10n.uploadedToThisPost,props:{type:null,uploadedTo:wp.media.view.settings.post.id,orderby:"menuOrder",order:"ASC"},priority:20}}this.filters=e;if("undefined"===typeof e[mlaModal.settings.query[f].filterMime]){mlaModal.settings.query[f].filterMime="all"}if(mlaModal.settings.query[f].filterMime!="all"){this.model.set(e[mlaModal.settings.query[f].filterMime].props,{silent:false})}},select:function(){var h=this.controller._state,e=this.model,g=mlaModal.settings.query[h].filterMime,f=e.toJSON();if(false===mlaModal.settings.enableSearchBox){if("string"==typeof f.search){mlaModal.settings.query[h].searchValue=f.search}else{mlaModal.settings.query[h].searchValue=""}}_.find(this.filters,function(j,k){var i=_.all(j.props,function(m,l){return m===(_.isUndefined(f[l])?null:f[l])});if(i){return g=k}});this.$el.val(g)},change:function(){var f=d(this.el).closest("div.media-toolbar"),e=this.filters[this.el.value];if(e){this.model.set(e.props,{silent:true});d("#mla-search-submit",f).click()}}});wp.media.view.AttachmentFilters.MlaUploaded=wp.media.view.AttachmentFilters.extend({createFilters:function(){var f=this.model.get("type"),e=wp.media.view.settings.mimeTypes,i,h=this.controller._state,g={};if(e&&f){i=e[f]}_.each(mlaModal.settings.uploadMimeTypes||{},function(k,j){if(("grid"===mlaModal.settings.screen)||("trash"!==j)){g[j]={text:k,props:{type:j,uploadedTo:null,orderby:"date",order:"DESC"}}}});g.all={text:i||wp.media.view.l10n.allMediaItems,props:{uploadedTo:null,orderby:"date",order:"DESC"},priority:10};g.uploaded={text:wp.media.view.l10n.uploadedToThisPost,props:{type:null,uploadedTo:wp.media.view.settings.post.id,orderby:"menuOrder",order:"ASC"},priority:20};g.unattached={text:wp.media.view.l10n.unattached,props:{uploadedTo:0,orderby:"menuOrder",order:"ASC"},priority:50};this.filters=g;if("undefined"===typeof g[mlaModal.settings.query[h].filterUploaded]){mlaModal.settings.query[h].filterUploaded="all"}if(mlaModal.settings.query[h].filterUploaded!="all"){this.model.set(g[mlaModal.settings.query[h].filterUploaded].props,{silent:false})}},select:function(){var h=this.controller._state,e=this.model,g=mlaModal.settings.query[h].filterMime,f=e.toJSON();if(false===mlaModal.settings.enableSearchBox){if("string"==typeof f.search){mlaModal.settings.query[h].searchValue=f.search}else{mlaModal.settings.query[h].searchValue=""}}_.find(this.filters,function(j,k){var i=_.all(j.props,function(m,l){return m===(_.isUndefined(f[l])?null:f[l])});if(i){return g=k}});this.$el.val(g)},change:function(){var f=d(this.el).closest("div.media-toolbar"),e=this.filters[this.el.value];if(e){this.model.set(e.props,{silent:true});d("#mla-search-submit",f).click()}}})}if(mlaModal.settings.enableMonthsDropdown){wp.media.view.AttachmentFilters.MlaMonths=wp.media.view.AttachmentFilters.extend({className:"attachment-filters",id:"media-attachment-date-filters",createFilters:function(){var f=this.controller._state,e={};_.each(mlaModal.settings.months||{},function(h,g){e[g]={text:h,props:{s:{mla_filter_month:g}}}});this.filters=e;if("undefined"===typeof e[mlaModal.settings.query[f].filterMonth]){mlaModal.settings.query[f].filterMonth=0}if(mlaModal.settings.query[f].filterMonth>0){this.model.set(e[mlaModal.settings.query[f].filterMonth].props,{silent:false})}},select:function(){var h=this.controller._state,e=this.model,g=mlaModal.settings.query[h].filterMonth,f=e.toJSON();if(_.isUndefined(f.s)){f.s={}}if(false===mlaModal.settings.enableSearchBox){if("string"==typeof f.search){mlaModal.settings.query[h].searchValue=f.search}else{mlaModal.settings.query[h].searchValue=""}}if(_.isUndefined(f.s.mla_filter_month)){f.s.mla_filter_month=mlaModal.settings.query[h].filterMonth}else{mlaModal.settings.query[h].filterMonth=f.s.mla_filter_month}_.find(this.filters,function(j,k){var i=_.all(j.props,function(l){return l.mla_filter_month==mlaModal.settings.query[h].filterMonth});if(i){return g=k}});this.$el.val(g)},change:function(){var e=this.filters[this.el.value],f;if(e){f={s:{mla_filter_month:e.props.s.mla_filter_month}};this.model.set(f)}}})}if(mlaModal.settings.enableTermsDropdown){wp.media.view.AttachmentFilters.MlaTerms=wp.media.view.AttachmentFilters.extend({className:"attachment-filters",id:"media-attachment-term-filters",createFilters:function(){var h=this.controller._state,e,f,g={};_.each(mlaModal.settings.termsText||{},function(j,i){if(mlaModal.settings.termsCustom){f=mlaModal.settings.termsValue[i]}else{f=parseInt(mlaModal.settings.termsValue[i])}g[i]={text:j,props:{s:{mla_filter_term:f}}}});this.filters=g;e=_.indexOf(mlaModal.settings.termsValue,mlaModal.settings.query[h].filterTerm);if(e>0){this.model.set(g[e].props,{silent:false})}},select:function(){var h=this.controller._state,e=this.model,g=mlaModal.settings.query[h].filterTerm,f=e.toJSON();if(_.isUndefined(f.s)){f.s={}}if(false===mlaModal.settings.enableSearchBox){if("string"==typeof f.search){mlaModal.settings.query[h].searchValue=f.search}else{mlaModal.settings.query[h].searchValue=""}}if(_.isUndefined(f.s.mla_filter_term)){f.s.mla_filter_term=mlaModal.settings.query[h].filterTerm}else{mlaModal.settings.query[h].filterTerm=f.s.mla_filter_term}_.find(this.filters,function(j,k){var i=_.all(j.props,function(l){return l.mla_filter_term==mlaModal.settings.query[h].filterTerm});if(i){return g=k}});this.$el.val(g)},change:function(){var e=this.filters[this.el.value],f;if(e){f={s:{mla_filter_term:e.props.s.mla_filter_term}};this.model.set(f)}}})}if(mlaModal.settings.enableTermsSearch){wp.media.view.MlaTermsSearch=wp.media.View.extend({tagName:"span",className:"mla-terms-search",template:wp.media.template("mla-terms-search-button"),attributes:{type:"mla-terms-search-button"},events:{change:"termsSearchOpen",click:"termsSearchOpen"},render:function(){this.$el.html(this.template(mlaModal.strings));return this},termsSearchOpen:function(f){var e=d(this.el).closest("div.media-toolbar");if(("click"==f.type)&&("mla_terms_search"===f.target.name)){mlaTaxonomy.termsSearch.open();d("#mla-terms-search-form").off("submit");d("#mla-terms-search-form").submit(function(j){var g,i,h={phrases:"",taxonomies:[]};j.preventDefault();g=d("#mla-terms-search-form").serializeArray();for(i=0;i<g.length;i++){switch(g[i].name){case"mla_terms_search[phrases]":h.phrases=g[i].value;break;case"mla_terms_search[radio_phrases]":h.radio_phrases=g[i].value;break;case"mla_terms_search[radio_terms]":h.radio_terms=g[i].value;break;case"mla_terms_search[taxonomies][]":h.taxonomies[h.taxonomies.length]=g[i].value;break}}mlaModal.settings.query[mlaModal.settings.state].termsSearch=h;d("#mla-search-submit",e).click();return false});d("#mla-terms-search-input").keypress(function(g){if(13==g.which){g.preventDefault();d("#mla-terms-search-submit").click()}})}}})}if(mlaModal.settings.enableSearchBox){wp.media.view.MlaSearch=wp.media.View.extend({tagName:"div",className:"mla-search-box",template:wp.media.template("mla-search-box"),attributes:{type:"mla-search-box"},events:{input:"search",change:"search",click:"search",search:"search",MlaSearch:"search"},initialize:function(){var e=this.controller._state;if("undefined"===typeof mlaModal.settings.query[e]){mlaModal.settings.query[e]=_.clone(mlaModal.settings.query.initial);mlaModal.settings.query[e].searchFields=_.clone(mlaModal.settings.query.initial.searchFields)}},render:function(){var f=this.controller._state,e=_.extend(mlaModal.strings,mlaModal.settings.query[f]);this.$el.html(this.template(e));return this},search:function(g){var h=this.controller._state,e,i,f;if(("input"==g.type)&&("s[mla_search_value]"==g.target.name)){mlaModal.settings.query[h].searchValue=g.target.value;return}if(("click"==g.type)&&("mla_search_submit"!=g.target.name)){return}switch(g.target.name){case"s[mla_search_value]":mlaModal.settings.query[h].searchValue=g.target.value;break;case"mla_search_submit":e={mla_filter_month:mlaModal.settings.query[h].filterMonth,mla_filter_term:mlaModal.settings.query[h].filterTerm,mla_terms_search:mlaModal.settings.query[h].termsSearch,mla_search_clicks:mlaModal.settings.query[h].searchClicks++,mla_search_value:mlaModal.settings.query[h].searchValue,mla_search_fields:mlaModal.settings.query[h].searchFields,mla_search_connector:mlaModal.settings.query[h].searchConnector};this.model.set({s:e});break;case"s[mla_search_connector]":mlaModal.settings.query[h].searchConnector=g.target.value;break;case"s[mla_search_title]":i=mlaModal.settings.query[h].searchFields;f=i.indexOf("title");if(-1==f){i.push("title")}else{i.splice(f,1)}mlaModal.settings.query[h].searchFields=i;break;case"s[mla_search_name]":f=mlaModal.settings.query[h].searchFields.indexOf("name");if(-1==f){mlaModal.settings.query[h].searchFields.push("name")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_alt_text]":f=mlaModal.settings.query[h].searchFields.indexOf("alt-text");if(-1==f){mlaModal.settings.query[h].searchFields.push("alt-text")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_excerpt]":f=mlaModal.settings.query[h].searchFields.indexOf("excerpt");if(-1==f){mlaModal.settings.query[h].searchFields.push("excerpt")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_content]":f=mlaModal.settings.query[h].searchFields.indexOf("content");if(-1==f){mlaModal.settings.query[h].searchFields.push("content")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_file]":f=mlaModal.settings.query[h].searchFields.indexOf("file");if(-1==f){mlaModal.settings.query[h].searchFields.push("file")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_terms]":f=mlaModal.settings.query[h].searchFields.indexOf("terms");if(-1==f){mlaModal.settings.query[h].searchFields.push("terms")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break}}})}else{wp.media.view.MlaSearch=wp.media.View.extend({tagName:"span",className:"mla-simulate-search-button",template:wp.media.template("mla-simulate-search-button"),attributes:{type:"mla-simulate-search-button"},events:{click:"simulateSearch"},render:function(){this.$el.html(this.template(mlaModal.strings));return this},simulateSearch:function(){var f=this.controller._state,e={mla_filter_month:mlaModal.settings.query[f].filterMonth,mla_filter_term:mlaModal.settings.query[f].filterTerm,mla_terms_search:mlaModal.settings.query[f].termsSearch,mla_search_clicks:mlaModal.settings.query[f].searchClicks++,mla_search_value:mlaModal.settings.query[f].searchValue,mla_search_fields:mlaModal.settings.query[f].searchFields,mla_search_connector:mlaModal.settings.query[f].searchConnector};this.model.set({s:e})}})}if(mlaModal.settings.enableMimeTypes||mlaModal.settings.enableMonthsDropdown||mlaModal.settings.enableTermsDropdown||mlaModal.settings.enableTermsSearch||mlaModal.settings.enableSearchBox){wp.media.view.AttachmentsBrowser=wp.media.view.AttachmentsBrowser.extend({createToolbar:function(){var e,f=this.controller._state;mlaModal.settings.state=f;mlaModal.settings.$el=this.controller.$el;if("undefined"===typeof mlaModal.settings.query[f]){mlaModal.settings.query[f]=_.clone(mlaModal.settings.query.initial);mlaModal.settings.query[f].searchFields=_.clone(mlaModal.settings.query.initial.searchFields)}c.prototype.createToolbar.apply(this,arguments);mlaModal.utility.mlaAttachmentsBrowser=this;e=this.options.filters;if(typeof window.eml!=="undefined"){d(".media-toolbar",this.$el).css("overflow","hidden")}if(("all"===e)&&mlaModal.settings.enableMimeTypes){this.toolbar.unset("filters",{silent:true});this.toolbar.set("filters",new wp.media.view.AttachmentFilters.Mla({controller:this.controller,model:this.collection.props,priority:-80}).render())}if(("uploaded"===e)&&mlaModal.settings.enableMimeTypes){this.toolbar.unset("filters",{silent:true});this.toolbar.set("filters",new wp.media.view.AttachmentFilters.MlaUploaded({controller:this.controller,model:this.collection.props,priority:-80}).render())}if(this.options.search&&mlaModal.settings.enableMonthsDropdown){this.toolbar.unset("dateFilter",{silent:true});this.toolbar.set("dateFilter",new wp.media.view.AttachmentFilters.MlaMonths({controller:this.controller,model:this.collection.props,priority:-75}).render())}if(this.options.search&&mlaModal.settings.enableTermsDropdown){this.toolbar.set("terms",new wp.media.view.AttachmentFilters.MlaTerms({controller:this.controller,model:this.collection.props,priority:-50}).render())}if(this.options.search&&mlaModal.settings.enableTermsSearch){this.toolbar.set("termsSearch",new wp.media.view.MlaTermsSearch({controller:this.controller,model:this.collection.props,priority:-50}).render())}if(this.options.search){if(mlaModal.settings.enableSearchBox){this.controller.on("content:activate",this.hideDefaultSearch);this.controller.on("edit:activate",this.hideDefaultSearch);this.controller.on("router:render",this.hideDefaultSearch);this.controller.on("uploader:ready",this.hideDefaultSearch);this.toolbar.set("MlaSearch",new wp.media.view.MlaSearch({controller:this.controller,model:this.collection.props,priority:60}).render())}else{this.toolbar.set("MlaSearch",new wp.media.view.MlaSearch({controller:this.controller,model:this.collection.props,priority:70}).render())}}},hideDefaultSearch:function(){var e=d("#media-search-input",mlaModal.settings.$el),f=d(".media-search-input-label",mlaModal.settings.$el);if(0===e.length){e=d("div.media-toolbar-primary > input.search",mlaModal.settings.$el)}e.hide();f.hide()},updateFilters:function(e,f){var g={};if(this.options.search&&mlaModal.settings.enableTermsDropdown&&mlaModal.settings.termsTaxonomy==e){g=mlaModal.utility.parseTermsOptions(f);mlaModal.settings.termsClass=g.termsClass;mlaModal.settings.termsText=g.termsText;mlaModal.settings.termsValue=g.termsValue;this.toolbar.unset("terms",{silent:true});this.toolbar.set("terms",new wp.media.view.AttachmentFilters.MlaTerms({controller:this.controller,model:this.collection.props,priority:-80}).render())}}})}mlaModal.utility.parseTermsOptions=function(k){var j={termsClass:[mlaModal.settings.termsClass[0],mlaModal.settings.termsClass[1]],termsText:[mlaModal.settings.termsText[0],mlaModal.settings.termsText[1]],termsValue:[mlaModal.settings.termsValue[0],mlaModal.settings.termsValue[1]]},g=2,e,f,i=/\<option(( class=\"([^\"]+)\" )|( ))value=((\'([^\']+)\')|(\"([^\"]+)\"))([^\>]*)\>([^\<]*)\<.*/g,h=[];if("object"===typeof k){g=mlaModal.settings.termsValue.length;for(e=2;e<g;e++){h[e]={termsClass:mlaModal.settings.termsClass[e],termsText:mlaModal.settings.termsText[e],termsValue:mlaModal.settings.termsValue[e]};if("undefined"!==typeof k[mlaModal.settings.termsValue[e]]){delete k[mlaModal.settings.termsValue[e]]}}for(f in k){h[e++]={termsClass:"level-0",termsText:k[f],termsValue:f.toString()}}if(g===e){return{termsClass:mlaModal.settings.termsClass,termsText:mlaModal.settings.termsText,termsValue:mlaModal.settings.termsValue}}h.sort(function(m,l){if(m.termsText>l.termsText){return 1}else{if(m.termsText<l.termsText){return -1}else{return 0}}});e=2;for(f in h){j.termsClass[e]=h[f].termsClass;j.termsText[e]=h[f].termsText;j.termsValue[e++]=h[f].termsValue}return j}h=i.exec(k);while(null!==(h=i.exec(k))){j.termsClass[g]=h[3];j.termsValue[g]=("undefined"===typeof h[6])?h[9]:h[7];j.termsText[g++]=h[11].replace("&nbsp;",mlaModal.settings.termsIndent)}return j};mlaModal.utility.arrayCleanup=function(g){var f=[],e=("string"===typeof g);if(e){g=g.split(mlaModal.settings.comma)}jQuery.each(g,function(h,i){i=jQuery.trim(i);if(i&&jQuery.inArray(i,f)==-1){f.push(i)}});f.sort();if(e){f=f.join(mlaModal.settings.comma)}return f};mlaModal.utility.parseTaxonomyId=function(f){var e=f.split("-");e.shift();e.shift();return e.join("-")};mlaModal.tagBox={cleanTags:function(f){var e=mlaModal.settings.comma;if(","!==e){f=f.replace(new RegExp(e,"g"),",")}f=f.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"");if(","!==e){f=f.replace(/,/g,e)}return f},parseTags:function(h){var l=h.id,f=l.split("-check-num-")[1],i=d(h).closest(".tagsdiv"),k=i.find(".the-tags"),e=mlaModal.settings.comma,g=k.val().split(e),j=[];delete g[f];d.each(g,function(m,n){n=d.trim(n);if(n){j.push(n)}});k.val(this.cleanTags(j.join(e)));this.quickClicks(i);return false},quickClicks:function(g){var j=d(".the-tags",g),h=d(".tagchecklist",g),i=d(g).attr("id"),e,f;if(!j.length){return}f=j.prop("disabled");e=j.val().split(mlaModal.settings.comma);h.empty();d.each(e,function(m,n){var l,k;n=d.trim(n);if(!n){return}if(mlaModal.settings.generateTagUl){l=d("<li />").text(n)}else{l=d("<span />").text(n)}if(!f){if(mlaModal.settings.generateTagButtons){k=d('<button class="ntdelbutton" id="'+i+"-check-num-"+m+'" type="button"><span class="remove-tag-icon" aria-hidden="true"></span><span class="screen-reader-text">'+mlaModal.settings.removeTerm+": "+n+"</span></button>")}else{k=d('<a id="'+i+"-check-num-"+m+'" class="ntdelbutton">X</a>')}k.click(function(){mlaModal.tagBox.parseTags(this)});l.prepend("&nbsp;").prepend(k)}h.append(l)})},flushTags:function(k,h,g){var m,e,i,n=d(".the-tags",k),j=d("input.newtag",k),l=mlaModal.settings.comma;h=h||false;i=h?d(h).text():j.val();m=n.val();e=m?m+l+i:i;e=mlaModal.utility.arrayCleanup(this.cleanTags(e));n.val(e);this.quickClicks(k);if(!h){j.val("")}if("undefined"==typeof(g)){j.focus()}return false},getCloud:function(f,e){d.post(ajaxurl,{action:"get-tagcloud",tax:e},function(h,g){if(0===h||"success"!=g){h=wpAjax.broken}h=d('<p id="tagcloud-'+e+'" class="the-tagcloud">'+h+"</p>");d("a",h).click(function(){mlaModal.tagBox.flushTags(d(this).closest(".mla-taxonomy-field").children(".tagsdiv"),this);return false});d("#"+f).after(h)})},init:function(i,e,g){var h,f;h=d("#mla-taxonomy-"+e,g);f=d("div.ajaxtag",h);mlaModal.tagBox.quickClicks(h);d("input.tagadd",f).click(function(){mlaModal.tagBox.flushTags(d(this).closest(".tagsdiv"))});d("input.newtag",f).keyup(function(j){if(13==j.which){mlaModal.tagBox.flushTags(h);return false}}).keypress(function(j){if(13==j.which){j.preventDefault();return false}}).each(function(){d(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+e,{delay:500,resultsClass:"mla_ac_results",selectClass:"mla_ac_over",matchClass:"mla_ac_match",minchars:2,multiple:true,multipleSep:mlaModal.settings.comma+" "})});h.siblings(":first").click(function(){mlaModal.tagBox.getCloud(d("a",this).attr("id"),e);d("a",this).unbind().click(function(){d(this).siblings(".the-tagcloud").toggle();return false});return false});d(".compat-field-"+e+" td",g).on("mouseleave",function(){var m,k=this,j=mlaModal.utility.arrayCleanup(d(".server-tags",k).val()),l=mlaModal.utility.arrayCleanup(d(".the-tags",k).val());if(j===l){return}d(k).css("opacity","0.5");m={id:i};m[e]=l;wp.media.post(mlaModal.settings.ajaxUpdateCompatAction,m).done(function(o){var p,n,q;for(n in o){if("object"===typeof(o[n]["object-terms"])){if(null!==mlaModal.utility.mlaAttachmentsBrowser){mlaModal.utility.mlaAttachmentsBrowser.updateFilters(n,o[n]["object-terms"])}delete o[n]["object-terms"]}for(q in o[n]){d("#"+q,k).replaceWith(o[n][q])}p=d("#mla-taxonomy-"+n,k);mlaModal.tagBox.quickClicks(p)}d(k).css("opacity","1.0")})});h.on("change",function(j){j.stopPropagation();return false});d(".the-tags, .server-tags .newtag",h).on("change",function(j){j.stopPropagation();return false})}};if(mlaModal.settings.enableDetailsCategory||mlaModal.settings.enableDetailsTag){wp.media.view.AttachmentCompat=wp.media.view.AttachmentCompat.extend({initialize:function(){b.prototype.initialize.apply(this,arguments);this.on("ready",function(){mlaModal.utility.hookCompatTaxonomies(this.model.get("id"),this.el)})}})}if(mlaModal.settings.enableDetailsCategory||mlaModal.settings.enableDetailsTag){wp.media.model.Selection=wp.media.model.Selection.extend({initialize:function(){a.prototype.initialize.apply(this,arguments);this.on("selection:reset",function(){mlaModal.cid=null});this.on("selection:unsingle",function(){mlaModal.cid=null});this.on("selection:single",function(e){mlaModal.cid=e.cid});this.on("change:uploading",function(){mlaModal.uploading=true});this.on("change",function(e){var f=false,g;if(mlaModal.uploading&&mlaModal.cid===e.cid){mlaModal.uploading=false;f=true}else{if(false===e.attributes.uploading){g=_.clone(e.changed);delete g.title;delete g.caption;delete g.alt;delete g.description;if(!_.isEmpty(g)){f=true}}}if(true===f){mlaModal.utility.hookCompatTaxonomies(e.get("id"),mlaModal.settings.$el)}})}})}mlaModal.utility.hookCompatTaxonomies=function(h,f){var e,g=null;d(".mla-taxonomy-field .categorydiv",f).each(function(){e=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));if(-1!=mlaModal.settings.enhancedTaxonomies.indexOf(e)){d(".compat-field-"+e+" th",f).click({id:h,currentTaxonomy:e,el:f},function(i){mlaModal.utility.fillCompatTaxonomies(i.data)});d("tr.compat-field-"+e,f).each(function(){if(d(this).hasClass("mla-taxonomy-row")){d(this).show()}else{d(this).remove()}});if(null===g){g=e}}else{d("tr.compat-field-"+e,f).each(function(){if(d(this).hasClass("mla-taxonomy-row")){d(this).remove()}})}});d(".mla-taxonomy-field .tagsdiv",f).each(function(){e=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));if(-1!=mlaModal.settings.enhancedTaxonomies.indexOf(e)){d(".compat-field-"+e+" th",f).click({id:h,currentTaxonomy:e,el:f},function(i){mlaModal.utility.fillCompatTaxonomies(i.data)});d("tr.compat-field-"+e,f).each(function(){if(d(this).hasClass("mla-taxonomy-row")){d(this).show()}else{d(this).remove()}});if(null===g){g=e}}else{d("tr.compat-field-"+e,f).each(function(){if(d(this).hasClass("mla-taxonomy-row")){d(this).remove()}})}});if(mlaModal.settings.enableTermsAutofill&&null!==g){d(".compat-field-"+g+" th",f).click()}};mlaModal.utility.fillCompatTaxonomies=function(i){var f=i.el,h=[],e,g;d(".mla-taxonomy-field .categorydiv",f).each(function(){e=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));h[h.length]=e;g=".compat-field-"+e;if("undefined"===typeof(mlaModal.initialHTML[e])){mlaModal.initialHTML[e]=d(g,f).html()}else{d(g,f).html(mlaModal.initialHTML[e])}d(g+" .categorydiv",f).html(mlaModal.strings.loadingText)});d(".mla-taxonomy-field .tagsdiv",f).each(function(){e=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));h[h.length]=e;g=".compat-field-"+e;if("undefined"===typeof(mlaModal.initialHTML[e])){mlaModal.initialHTML[e]=d(g,f).html()}else{d(g,f).html(mlaModal.initialHTML[e])}d(g+" .tagsdiv",f).html(mlaModal.strings.loadingText)});if(h.length){wp.media.post(mlaModal.settings.ajaxFillCompatAction,{id:i.id,query:h}).done(function(k){var j,l;for(j in k){l=".compat-field-"+j;d(l,f).html(k[j])}mlaModal.utility.supportCompatTaxonomies(i);d(".compat-field-"+i.currentTaxonomy+" td",f).show()})}};mlaModal.utility.supportCompatTaxonomies=function(g){var f=g.id,e=g.el;if(mlaModal.settings.enableDetailsCategory){d(".mla-taxonomy-field .categorydiv",e).each(function(){var j=d(this),h,k,i,n,l,p,o,m;i=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));n=i+"_tab";l="#mla-"+i;p="#mla-new-"+i;o="#mla-search-"+i;m="#mla-attachments-"+f+"-"+i;if(i=="category"){n="cats"}j.find(".category-tabs").show();d(".compat-field-"+i+" th",e).click(function(){d(this).siblings("td").slideToggle()});j.on("mouseleave",function(){var t,q,s=[],r=j.find(l+"-checklist input:checked");r.each(function(){s[s.length]=d(this).val()});s.sort(function(v,u){return v-u});s=s.join(",");q=j.siblings(m).val();if(q===s){return}j.siblings(m).val(s);j.prop("disabled",true);t={id:f};t[i]=s;wp.media.post(mlaModal.settings.ajaxUpdateCompatAction,t).done(function(v){var u,w;for(u in v){for(w in v[u]){j.find("#"+w).html(v[u][w])}}j.find(o).val("");j.find(l+"-searcher").addClass("mla-hidden-children");j.prop("disabled",false)})});j.on('change input[type="checkbox"]',function(q){q.stopPropagation();return false});j.find(l+"-tabs a").click(function(){var q=d(this).attr("href");d(this).parent().addClass("tabs").siblings("li").removeClass("tabs");j.find(l+"-tabs").siblings(".tabs-panel").hide();j.find(q).show();d(this).focus();if("#mla-"+i+"-all"==q){deleteUserSetting(n)}else{setUserSetting(n,"pop")}return false});if(getUserSetting(n)){j.find(l+'-tabs a[href="#mla-'+i+'-pop"]').click()}j.find(l+"-add-toggle").click(function(){j.find(l+"-searcher").addClass("mla-hidden-children");j.find(l+"-adder").toggleClass("mla-hidden-children");j.find(l+'-tabs a[href="#mla-'+i+'-all"]').click();j.find(l+"-checklist li").show();j.find(l+"-checklist-pop li").show();if(false===j.find(l+"-adder").hasClass("mla-hidden-children")){j.find(p).val("").removeClass("form-input-tip");j.find(p).focus()}return false});j.find(p).keypress(function(q){if(13===q.keyCode){q.preventDefault();j.find(l+"-add-submit").click()}});j.find(l+"-add-submit").click(function(){j.find(p).focus()});h=function(q){if(!j.find(p).val()){return false}q.data+="&"+j.find(l+"-checklist :checked").serialize();j.prop("disabled",true);return q};k=function(v,u){var t,q=j.find("#new"+i+"_parent");j.prop("disabled",false);if("undefined"!=u.parsed.responses[0]&&(t=u.parsed.responses[0].supplemental.newcat_parent)){q.before(t);q.remove();if(null!==mlaModal.utility.mlaAttachmentsBrowser){mlaModal.utility.mlaAttachmentsBrowser.updateFilters(i,t)}}};j.find(l+"-checklist").wpList({alt:"",response:"mla-"+i+"-ajax-response",addBefore:h,addAfter:k});j.find(l+"-checklist, "+l+"-checklist-pop").on("click",'li.popular-category > label input[type="checkbox"]',function(){var q=d(this),s=q.is(":checked"),r=q.val();if(r&&q.parents("#mla-taxonomy-"+i).length){d("#in-"+i+"-"+r+", #in-popular-"+i+"-"+r).prop("checked",s)}});d.extend(d.expr[":"],{matchTerms:function(s,r,q,t){return(s.textContent||s.innerText||"").toLowerCase().indexOf((q[3]||"").toLowerCase())>=0}});j.find(o).keypress(function(q){if(13===q.keyCode){q.preventDefault();j.find(o).val("");j.find(l+"-searcher").addClass("mla-hidden-children");j.find(l+"-checklist li").show();j.find(l+"-checklist-pop li").show();return}});j.find(o).keyup(function(s){var u,t,v,r,q;if(13===s.keyCode){s.preventDefault();j.find(l+"-search-toggle").focus();return}u=j.find(o).val();t=j.find(l+"-checklist li");v=j.find(l+"-checklist-pop li");if(0<u.length){t.hide();v.hide()}else{t.show();v.show()}r=j.find(l+"-checklist label:matchTerms('"+u+"')");r.closest("li").find("li").andSelf().show();r.parents(l+"-checklist li").show();q=j.find(l+"-checklist-pop label:matchTerms('"+u+"')");q.closest("li").find("li").andSelf().show();q.parents(l+"-checklist li").show()});j.find(l+"-search-toggle").click(function(){j.find(l+"-adder ").addClass("mla-hidden-children");j.find(l+"-searcher").toggleClass("mla-hidden-children");j.find(l+'-tabs a[href="#mla-'+i+'-all"]').click();j.find(l+"-checklist li").show();j.find(l+"-checklist-pop li").show();if(false===j.find(l+"-searcher").hasClass("mla-hidden-children")){j.find(o).val("").removeClass("form-input-tip");j.find(o).focus()}return false})})}if(mlaModal.settings.enableDetailsTag){d(".mla-taxonomy-field .tagsdiv",e).each(function(){var h=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));d(".compat-field-"+h+" th",e).click(function(){d(this).siblings("td").slideToggle()});mlaModal.tagBox.init(f,h,e)})}}}(jQuery));
1
+ var wp,wpAjax,ajaxurl,jQuery,_,getUserSetting,setUserSetting,deleteUserSetting,mlaTaxonomy,mlaModal={strings:{},settings:{},initialHTML:{},uploading:false,cid:null,utility:{originalMediaAjax:null,mlaAttachmentsBrowser:null,parseTermsOptions:null,arrayCleanup:null,parseTaxonomyId:null,hookCompatTaxonomies:null,fillCompatTaxonomies:null,supportCompatTaxonomies:null},tagBox:null};(function(d){var c=wp.media.view.AttachmentsBrowser,b=wp.media.view.AttachmentCompat,a=wp.media.model.Selection;mlaModal.strings=typeof wp.media.view.l10n.mla_strings==="undefined"?{}:wp.media.view.l10n.mla_strings;delete wp.media.view.l10n.mla_strings;mlaModal.settings=typeof wp.media.view.settings.mla_settings==="undefined"?{screen:"unknown",enableMediaGrid:false,enableMediaModal:false}:wp.media.view.settings.mla_settings;delete wp.media.view.settings.mla_settings;if(!(mlaModal.settings.enableMediaGrid||mlaModal.settings.enableMediaModal)){return}if(("grid"===mlaModal.settings.screen)&&false===mlaModal.settings.enableMediaGrid){return}if(("modal"===mlaModal.settings.screen)&&false===mlaModal.settings.enableMediaModal){return}mlaModal.settings.pagenow=typeof pagenow==="undefined"?"unknown":pagenow;if(mlaModal.settings.pagenow==="toolset_page_views-editor"){return}mlaModal.utility.originalMediaAjax=wp.media.ajax;wp.media.ajax=function(k,g){var j=mlaModal.settings.state,i,f,h,e;if(_.isObject(k)){g=k}else{g=g||{};g.data=_.extend(g.data||{},{action:k})}if("query-attachments"==g.data.action){i=g.data.query;f=typeof i.s;if("object"==f){h=i.s}else{if("string"==f){h={mla_search_value:i.s}}else{h={mla_search_value:""}}}if("undefined"!=typeof i.post_mime_type){mlaModal.settings.query[j].filterMime=i.post_mime_type}else{mlaModal.settings.query[j].filterMime="all"}if("undefined"!=typeof h.mla_filter_month){mlaModal.settings.query[j].filterMonth=h.mla_filter_month}else{if("undefined"!=typeof i.year){mlaModal.settings.query[j].filterMonth=(100*i.year)+(1*i.monthnum)}else{}}if("undefined"!=typeof h.mla_filter_term){mlaModal.settings.query[j].filterTerm=h.mla_filter_term}if("undefined"!=typeof h.mla_search_value){mlaModal.settings.query[j].searchValue=h.mla_search_value}e={mla_filter_month:mlaModal.settings.query[j].filterMonth,mla_filter_term:mlaModal.settings.query[j].filterTerm,mla_terms_search:mlaModal.settings.query[j].termsSearch,mla_search_clicks:mlaModal.settings.query[j].searchClicks,mla_search_value:mlaModal.settings.query[j].searchValue,mla_search_fields:mlaModal.settings.query[j].searchFields,mla_search_connector:mlaModal.settings.query[j].searchConnector};mlaModal.settings.query[j].termsSearch="";d("#mla-terms-search-input").html("").val("");g.data.query.s=e}return mlaModal.utility.originalMediaAjax.call(this,g)};if(mlaModal.settings.enableMimeTypes){wp.media.view.AttachmentFilters.Mla=wp.media.view.AttachmentFilters.extend({createFilters:function(){var f=this.controller._state,e={};_.each(mlaModal.settings.allMimeTypes||{},function(h,g){if(("grid"===mlaModal.settings.screen)||("trash"!==g)){e[g]={text:h,props:{type:g,uploadedTo:null,orderby:"date",order:"DESC"}}}});e.all={text:wp.media.view.l10n.allMediaItems,props:{type:null,uploadedTo:null,orderby:"date",order:"DESC"},priority:10};if(wp.media.view.settings.post.id){e.uploaded={text:wp.media.view.l10n.uploadedToThisPost,props:{type:null,uploadedTo:wp.media.view.settings.post.id,orderby:"menuOrder",order:"ASC"},priority:20}}this.filters=e;if("undefined"===typeof e[mlaModal.settings.query[f].filterMime]){mlaModal.settings.query[f].filterMime="all"}if(mlaModal.settings.query[f].filterMime!="all"){this.model.set(e[mlaModal.settings.query[f].filterMime].props,{silent:false})}},select:function(){var h=this.controller._state,e=this.model,g=mlaModal.settings.query[h].filterMime,f=e.toJSON();if(false===mlaModal.settings.enableSearchBox){if("string"==typeof f.search){mlaModal.settings.query[h].searchValue=f.search}else{mlaModal.settings.query[h].searchValue=""}}_.find(this.filters,function(j,k){var i=_.all(j.props,function(m,l){return m===(_.isUndefined(f[l])?null:f[l])});if(i){return g=k}});this.$el.val(g)},change:function(){var f=d(this.el).closest("div.media-toolbar"),e=this.filters[this.el.value];if(e){this.model.set(e.props,{silent:true});d("#mla-search-submit",f).click()}}});wp.media.view.AttachmentFilters.MlaUploaded=wp.media.view.AttachmentFilters.extend({createFilters:function(){var f=this.model.get("type"),e=wp.media.view.settings.mimeTypes,i,h=this.controller._state,g={};if(e&&f){i=e[f]}_.each(mlaModal.settings.uploadMimeTypes||{},function(k,j){if(("grid"===mlaModal.settings.screen)||("trash"!==j)){g[j]={text:k,props:{type:j,uploadedTo:null,orderby:"date",order:"DESC"}}}});g.all={text:i||wp.media.view.l10n.allMediaItems,props:{uploadedTo:null,orderby:"date",order:"DESC"},priority:10};g.uploaded={text:wp.media.view.l10n.uploadedToThisPost,props:{type:null,uploadedTo:wp.media.view.settings.post.id,orderby:"menuOrder",order:"ASC"},priority:20};g.unattached={text:wp.media.view.l10n.unattached,props:{uploadedTo:0,orderby:"menuOrder",order:"ASC"},priority:50};this.filters=g;if("undefined"===typeof g[mlaModal.settings.query[h].filterUploaded]){mlaModal.settings.query[h].filterUploaded="all"}if(mlaModal.settings.query[h].filterUploaded!="all"){this.model.set(g[mlaModal.settings.query[h].filterUploaded].props,{silent:false})}},select:function(){var h=this.controller._state,e=this.model,g=mlaModal.settings.query[h].filterMime,f=e.toJSON();if(false===mlaModal.settings.enableSearchBox){if("string"==typeof f.search){mlaModal.settings.query[h].searchValue=f.search}else{mlaModal.settings.query[h].searchValue=""}}_.find(this.filters,function(j,k){var i=_.all(j.props,function(m,l){return m===(_.isUndefined(f[l])?null:f[l])});if(i){return g=k}});this.$el.val(g)},change:function(){var f=d(this.el).closest("div.media-toolbar"),e=this.filters[this.el.value];if(e){this.model.set(e.props,{silent:true});d("#mla-search-submit",f).click()}}})}if(mlaModal.settings.enableMonthsDropdown){wp.media.view.AttachmentFilters.MlaMonths=wp.media.view.AttachmentFilters.extend({className:"attachment-filters",id:"media-attachment-date-filters",createFilters:function(){var f=this.controller._state,e={};_.each(mlaModal.settings.months||{},function(h,g){e[g]={text:h,props:{s:{mla_filter_month:g}}}});this.filters=e;if("undefined"===typeof e[mlaModal.settings.query[f].filterMonth]){mlaModal.settings.query[f].filterMonth=0}if(mlaModal.settings.query[f].filterMonth>0){this.model.set(e[mlaModal.settings.query[f].filterMonth].props,{silent:false})}},select:function(){var h=this.controller._state,e=this.model,g=mlaModal.settings.query[h].filterMonth,f=e.toJSON();if(_.isUndefined(f.s)){f.s={}}if(false===mlaModal.settings.enableSearchBox){if("string"==typeof f.search){mlaModal.settings.query[h].searchValue=f.search}else{mlaModal.settings.query[h].searchValue=""}}if(_.isUndefined(f.s.mla_filter_month)){f.s.mla_filter_month=mlaModal.settings.query[h].filterMonth}else{mlaModal.settings.query[h].filterMonth=f.s.mla_filter_month}_.find(this.filters,function(j,k){var i=_.all(j.props,function(l){return l.mla_filter_month==mlaModal.settings.query[h].filterMonth});if(i){return g=k}});this.$el.val(g)},change:function(){var e=this.filters[this.el.value],f;if(e){f={s:{mla_filter_month:e.props.s.mla_filter_month}};this.model.set(f)}}})}if(mlaModal.settings.enableTermsDropdown){wp.media.view.AttachmentFilters.MlaTerms=wp.media.view.AttachmentFilters.extend({className:"attachment-filters",id:"media-attachment-term-filters",createFilters:function(){var h=this.controller._state,e,f,g={};_.each(mlaModal.settings.termsText||{},function(j,i){if(mlaModal.settings.termsCustom){f=mlaModal.settings.termsValue[i]}else{f=parseInt(mlaModal.settings.termsValue[i])}g[i]={text:j,props:{s:{mla_filter_term:f}}}});this.filters=g;e=_.indexOf(mlaModal.settings.termsValue,mlaModal.settings.query[h].filterTerm);if(e>0){this.model.set(g[e].props,{silent:false})}},select:function(){var h=this.controller._state,e=this.model,g=mlaModal.settings.query[h].filterTerm,f=e.toJSON();if(_.isUndefined(f.s)){f.s={}}if(false===mlaModal.settings.enableSearchBox){if("string"==typeof f.search){mlaModal.settings.query[h].searchValue=f.search}else{mlaModal.settings.query[h].searchValue=""}}if(_.isUndefined(f.s.mla_filter_term)){f.s.mla_filter_term=mlaModal.settings.query[h].filterTerm}else{mlaModal.settings.query[h].filterTerm=f.s.mla_filter_term}_.find(this.filters,function(j,k){var i=_.all(j.props,function(l){return l.mla_filter_term==mlaModal.settings.query[h].filterTerm});if(i){return g=k}});this.$el.val(g)},change:function(){var e=this.filters[this.el.value],f;if(e){f={s:{mla_filter_term:e.props.s.mla_filter_term}};this.model.set(f)}}})}if(mlaModal.settings.enableTermsSearch){wp.media.view.MlaTermsSearch=wp.media.View.extend({tagName:"span",className:"mla-terms-search",template:wp.media.template("mla-terms-search-button"),attributes:{type:"mla-terms-search-button"},events:{change:"termsSearchOpen",click:"termsSearchOpen"},render:function(){this.$el.html(this.template(mlaModal.strings));return this},termsSearchOpen:function(f){var e=d(this.el).closest("div.media-toolbar");if(("click"==f.type)&&("mla_terms_search"===f.target.name)){mlaTaxonomy.termsSearch.open();d("#mla-terms-search-form").off("submit");d("#mla-terms-search-form").submit(function(j){var g,i,h={phrases:"",taxonomies:[]};j.preventDefault();g=d("#mla-terms-search-form").serializeArray();for(i=0;i<g.length;i++){switch(g[i].name){case"mla_terms_search[phrases]":h.phrases=g[i].value;break;case"mla_terms_search[radio_phrases]":h.radio_phrases=g[i].value;break;case"mla_terms_search[radio_terms]":h.radio_terms=g[i].value;break;case"mla_terms_search[taxonomies][]":h.taxonomies[h.taxonomies.length]=g[i].value;break}}mlaModal.settings.query[mlaModal.settings.state].termsSearch=h;d("#mla-search-submit",e).click();return false});d("#mla-terms-search-input").keypress(function(g){if(13==g.which){g.preventDefault();d("#mla-terms-search-submit").click()}})}}})}if(mlaModal.settings.enableSearchBox){wp.media.view.MlaSearch=wp.media.View.extend({tagName:"div",className:"mla-search-box",template:wp.media.template("mla-search-box"),attributes:{type:"mla-search-box"},events:{input:"search",change:"search",click:"search",search:"search",MlaSearch:"search"},initialize:function(){var e=this.controller._state;if("undefined"===typeof mlaModal.settings.query[e]){mlaModal.settings.query[e]=_.clone(mlaModal.settings.query.initial);mlaModal.settings.query[e].searchFields=_.clone(mlaModal.settings.query.initial.searchFields)}},render:function(){var f=this.controller._state,e=_.extend(mlaModal.strings,mlaModal.settings.query[f]);searchValues={mla_filter_month:mlaModal.settings.query[f].filterMonth,mla_filter_term:mlaModal.settings.query[f].filterTerm,mla_terms_search:mlaModal.settings.query[f].termsSearch,mla_search_clicks:mlaModal.settings.query[f].searchClicks++,mla_search_value:mlaModal.settings.query[f].searchValue,mla_search_fields:mlaModal.settings.query[f].searchFields,mla_search_connector:mlaModal.settings.query[f].searchConnector};this.model.set({s:searchValues});this.$el.html(this.template(e));return this},search:function(g){var h=this.controller._state,e,f;if(("input"==g.type)&&("s[mla_search_value]"==g.target.name)){mlaModal.settings.query[h].searchValue=g.target.value;return}if(("click"==g.type)&&("mla_search_submit"!=g.target.name)){return}switch(g.target.name){case"s[mla_search_value]":mlaModal.settings.query[h].searchValue=g.target.value;break;case"mla_search_submit":e={mla_filter_month:mlaModal.settings.query[h].filterMonth,mla_filter_term:mlaModal.settings.query[h].filterTerm,mla_terms_search:mlaModal.settings.query[h].termsSearch,mla_search_clicks:mlaModal.settings.query[h].searchClicks++,mla_search_value:mlaModal.settings.query[h].searchValue,mla_search_fields:mlaModal.settings.query[h].searchFields,mla_search_connector:mlaModal.settings.query[h].searchConnector};this.model.set({s:e});break;case"s[mla_search_connector]":mlaModal.settings.query[h].searchConnector=g.target.value;break;case"s[mla_search_title]":if("change"!=g.type){break}f=mlaModal.settings.query[h].searchFields.indexOf("title");if(-1==f){mlaModal.settings.query[h].searchFields.push("title")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_name]":if("change"!=g.type){break}f=mlaModal.settings.query[h].searchFields.indexOf("name");if(-1==f){mlaModal.settings.query[h].searchFields.push("name")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_alt_text]":if("change"!=g.type){break}f=mlaModal.settings.query[h].searchFields.indexOf("alt-text");if(-1==f){mlaModal.settings.query[h].searchFields.push("alt-text")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_excerpt]":if("change"!=g.type){break}f=mlaModal.settings.query[h].searchFields.indexOf("excerpt");if(-1==f){mlaModal.settings.query[h].searchFields.push("excerpt")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_content]":if("change"!=g.type){break}f=mlaModal.settings.query[h].searchFields.indexOf("content");if(-1==f){mlaModal.settings.query[h].searchFields.push("content")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_file]":if("change"!=g.type){break}f=mlaModal.settings.query[h].searchFields.indexOf("file");if(-1==f){mlaModal.settings.query[h].searchFields.push("file")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_terms]":if("change"!=g.type){break}f=mlaModal.settings.query[h].searchFields.indexOf("terms");if(-1==f){mlaModal.settings.query[h].searchFields.push("terms")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break}}})}else{wp.media.view.MlaSearch=wp.media.View.extend({tagName:"span",className:"mla-simulate-search-button",template:wp.media.template("mla-simulate-search-button"),attributes:{type:"mla-simulate-search-button"},events:{click:"simulateSearch"},render:function(){this.$el.html(this.template(mlaModal.strings));return this},simulateSearch:function(){var f=this.controller._state,e={mla_filter_month:mlaModal.settings.query[f].filterMonth,mla_filter_term:mlaModal.settings.query[f].filterTerm,mla_terms_search:mlaModal.settings.query[f].termsSearch,mla_search_clicks:mlaModal.settings.query[f].searchClicks++,mla_search_value:mlaModal.settings.query[f].searchValue,mla_search_fields:mlaModal.settings.query[f].searchFields,mla_search_connector:mlaModal.settings.query[f].searchConnector};this.model.set({s:e})}})}if(mlaModal.settings.enableMimeTypes||mlaModal.settings.enableMonthsDropdown||mlaModal.settings.enableTermsDropdown||mlaModal.settings.enableTermsSearch||mlaModal.settings.enableSearchBox){wp.media.view.AttachmentsBrowser=wp.media.view.AttachmentsBrowser.extend({toolbarOpen:function(){var f,g,e;f=d(".attachments-browser .media-toolbar").offset();g=d(".attachments-browser .media-toolbar").height();e=d(".attachments-browser .attachments").offset();e.top=g+f.top;d(".attachments-browser .attachments").offset(e);d(window).resize(function(){var h,j,i;h=d(".media-toolbar",this.$el).height();if(h!==mlaModal.settings.oldHeight){j=d(".attachments-browser .media-toolbar").offset();i=d(".attachments-browser .attachments").offset();i.top=h+j.top;d(".attachments-browser .attachments").offset(i);mlaModal.settings.oldHeight=h}})},createToolbar:function(){var e,f=this.controller._state;mlaModal.settings.state=f;mlaModal.settings.$el=this.controller.$el;if("undefined"===typeof mlaModal.settings.query[f]){mlaModal.settings.query[f]=_.clone(mlaModal.settings.query.initial);mlaModal.settings.query[f].searchFields=_.clone(mlaModal.settings.query.initial.searchFields)}c.prototype.createToolbar.apply(this,arguments);mlaModal.utility.mlaAttachmentsBrowser=this;e=this.options.filters;mlaModal.settings.oldHeight=0;this.controller.on("open",this.toolbarOpen);if(typeof window.eml!=="undefined"){d(".media-toolbar",this.$el).css("overflow","hidden")}if(("all"===e)&&mlaModal.settings.enableMimeTypes){this.toolbar.unset("filters",{silent:true});this.toolbar.set("filters",new wp.media.view.AttachmentFilters.Mla({controller:this.controller,model:this.collection.props,priority:-80}).render())}if(("uploaded"===e)&&mlaModal.settings.enableMimeTypes){this.toolbar.unset("filters",{silent:true});this.toolbar.set("filters",new wp.media.view.AttachmentFilters.MlaUploaded({controller:this.controller,model:this.collection.props,priority:-80}).render())}if(this.options.search&&mlaModal.settings.enableMonthsDropdown){this.toolbar.unset("dateFilter",{silent:true});this.toolbar.set("dateFilter",new wp.media.view.AttachmentFilters.MlaMonths({controller:this.controller,model:this.collection.props,priority:-75}).render())}if(this.options.search&&mlaModal.settings.enableTermsDropdown){this.toolbar.set("terms",new wp.media.view.AttachmentFilters.MlaTerms({controller:this.controller,model:this.collection.props,priority:-50}).render())}if(this.options.search&&mlaModal.settings.enableTermsSearch){this.toolbar.set("termsSearch",new wp.media.view.MlaTermsSearch({controller:this.controller,model:this.collection.props,priority:-50}).render())}if(this.options.search){if(mlaModal.settings.enableSearchBox){this.controller.on("content:activate",this.hideDefaultSearch);this.controller.on("edit:activate",this.hideDefaultSearch);this.controller.on("router:render",this.hideDefaultSearch);this.controller.on("uploader:ready",this.hideDefaultSearch);this.toolbar.set("MlaSearch",new wp.media.view.MlaSearch({controller:this.controller,model:this.collection.props,priority:60}).render())}else{this.toolbar.set("MlaSearch",new wp.media.view.MlaSearch({controller:this.controller,model:this.collection.props,priority:70}).render())}}},hideDefaultSearch:function(){var e=d("#media-search-input",mlaModal.settings.$el),f=d(".media-search-input-label",mlaModal.settings.$el);if(0===e.length){e=d("div.media-toolbar-primary > input.search",mlaModal.settings.$el)}e.hide();f.hide()},updateFilters:function(e,f){var g={};if(this.options.search&&mlaModal.settings.enableTermsDropdown&&mlaModal.settings.termsTaxonomy==e){g=mlaModal.utility.parseTermsOptions(f);mlaModal.settings.termsClass=g.termsClass;mlaModal.settings.termsText=g.termsText;mlaModal.settings.termsValue=g.termsValue;this.toolbar.unset("terms",{silent:true});this.toolbar.set("terms",new wp.media.view.AttachmentFilters.MlaTerms({controller:this.controller,model:this.collection.props,priority:-80}).render())}}})}mlaModal.utility.parseTermsOptions=function(k){var j={termsClass:[mlaModal.settings.termsClass[0],mlaModal.settings.termsClass[1]],termsText:[mlaModal.settings.termsText[0],mlaModal.settings.termsText[1]],termsValue:[mlaModal.settings.termsValue[0],mlaModal.settings.termsValue[1]]},g=2,e,f,i=/\<option(( class=\"([^\"]+)\" )|( ))value=((\'([^\']+)\')|(\"([^\"]+)\"))([^\>]*)\>([^\<]*)\<.*/g,h=[];if("object"===typeof k){g=mlaModal.settings.termsValue.length;for(e=2;e<g;e++){h[e]={termsClass:mlaModal.settings.termsClass[e],termsText:mlaModal.settings.termsText[e],termsValue:mlaModal.settings.termsValue[e]};if("undefined"!==typeof k[mlaModal.settings.termsValue[e]]){delete k[mlaModal.settings.termsValue[e]]}}for(f in k){h[e++]={termsClass:"level-0",termsText:k[f],termsValue:f.toString()}}if(g===e){return{termsClass:mlaModal.settings.termsClass,termsText:mlaModal.settings.termsText,termsValue:mlaModal.settings.termsValue}}h.sort(function(m,l){if(m.termsText>l.termsText){return 1}else{if(m.termsText<l.termsText){return -1}else{return 0}}});e=2;for(f in h){j.termsClass[e]=h[f].termsClass;j.termsText[e]=h[f].termsText;j.termsValue[e++]=h[f].termsValue}return j}h=i.exec(k);while(null!==(h=i.exec(k))){j.termsClass[g]=h[3];j.termsValue[g]=("undefined"===typeof h[6])?h[9]:h[7];j.termsText[g++]=h[11].replace("&nbsp;",mlaModal.settings.termsIndent)}return j};mlaModal.utility.arrayCleanup=function(g){var f=[],e=("string"===typeof g);if(e){g=g.split(mlaModal.settings.comma)}jQuery.each(g,function(h,i){i=jQuery.trim(i);if(i&&jQuery.inArray(i,f)==-1){f.push(i)}});f.sort();if(e){f=f.join(mlaModal.settings.comma)}return f};mlaModal.utility.parseTaxonomyId=function(f){var e=f.split("-");e.shift();e.shift();return e.join("-")};mlaModal.tagBox={cleanTags:function(f){var e=mlaModal.settings.comma;if(","!==e){f=f.replace(new RegExp(e,"g"),",")}f=f.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"");if(","!==e){f=f.replace(/,/g,e)}return f},parseTags:function(h){var l=h.id,f=l.split("-check-num-")[1],i=d(h).closest(".tagsdiv"),k=i.find(".the-tags"),e=mlaModal.settings.comma,g=k.val().split(e),j=[];delete g[f];d.each(g,function(m,n){n=d.trim(n);if(n){j.push(n)}});k.val(this.cleanTags(j.join(e)));this.quickClicks(i);return false},quickClicks:function(g){var j=d(".the-tags",g),h=d(".tagchecklist",g),i=d(g).attr("id"),e,f;if(!j.length){return}f=j.prop("disabled");e=j.val().split(mlaModal.settings.comma);h.empty();d.each(e,function(m,n){var l,k;n=d.trim(n);if(!n){return}if(mlaModal.settings.generateTagUl){l=d("<li />").text(n)}else{l=d("<span />").text(n)}if(!f){if(mlaModal.settings.generateTagButtons){k=d('<button class="ntdelbutton" id="'+i+"-check-num-"+m+'" type="button"><span class="remove-tag-icon" aria-hidden="true"></span><span class="screen-reader-text">'+mlaModal.settings.removeTerm+": "+n+"</span></button>")}else{k=d('<a id="'+i+"-check-num-"+m+'" class="ntdelbutton">X</a>')}k.click(function(){mlaModal.tagBox.parseTags(this)});l.prepend("&nbsp;").prepend(k)}h.append(l)})},flushTags:function(k,h,g){var m,e,i,n=d(".the-tags",k),j=d("input.newtag",k),l=mlaModal.settings.comma;h=h||false;i=h?d(h).text():j.val();m=n.val();e=m?m+l+i:i;e=mlaModal.utility.arrayCleanup(this.cleanTags(e));n.val(e);this.quickClicks(k);if(!h){j.val("")}if("undefined"==typeof(g)){j.focus()}return false},getCloud:function(f,e){d.post(ajaxurl,{action:"get-tagcloud",tax:e},function(h,g){if(0===h||"success"!=g){h=wpAjax.broken}h=d('<p id="tagcloud-'+e+'" class="the-tagcloud">'+h+"</p>");d("a",h).click(function(){mlaModal.tagBox.flushTags(d(this).closest(".mla-taxonomy-field").children(".tagsdiv"),this);return false});d("#"+f).after(h)})},init:function(i,e,g){var h,f;h=d("#mla-taxonomy-"+e,g);f=d("div.ajaxtag",h);mlaModal.tagBox.quickClicks(h);d("input.tagadd",f).click(function(){mlaModal.tagBox.flushTags(d(this).closest(".tagsdiv"))});d("input.newtag",f).keyup(function(j){if(13==j.which){mlaModal.tagBox.flushTags(h);return false}}).keypress(function(j){if(13==j.which){j.preventDefault();return false}}).each(function(){d(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+e,{delay:500,resultsClass:"mla_ac_results",selectClass:"mla_ac_over",matchClass:"mla_ac_match",minchars:2,multiple:true,multipleSep:mlaModal.settings.comma+" "})});h.siblings(":first").click(function(){mlaModal.tagBox.getCloud(d("a",this).attr("id"),e);d("a",this).unbind().click(function(){d(this).siblings(".the-tagcloud").toggle();return false});return false});d(".compat-field-"+e+" td",g).on("mouseleave",function(){var m,k=this,j=mlaModal.utility.arrayCleanup(d(".server-tags",k).val()),l=mlaModal.utility.arrayCleanup(d(".the-tags",k).val());if(j===l){return}d(k).css("opacity","0.5");m={id:i};m[e]=l;wp.media.post(mlaModal.settings.ajaxUpdateCompatAction,m).done(function(o){var p,n,q;for(n in o){if("object"===typeof(o[n]["object-terms"])){if(null!==mlaModal.utility.mlaAttachmentsBrowser){mlaModal.utility.mlaAttachmentsBrowser.updateFilters(n,o[n]["object-terms"])}delete o[n]["object-terms"]}for(q in o[n]){d("#"+q,k).replaceWith(o[n][q])}p=d("#mla-taxonomy-"+n,k);mlaModal.tagBox.quickClicks(p)}d(k).css("opacity","1.0")})});h.on("change",function(j){j.stopPropagation();return false});d(".the-tags, .server-tags .newtag",h).on("change",function(j){j.stopPropagation();return false})}};if(mlaModal.settings.enableDetailsCategory||mlaModal.settings.enableDetailsTag){wp.media.view.AttachmentCompat=wp.media.view.AttachmentCompat.extend({initialize:function(){b.prototype.initialize.apply(this,arguments);this.on("ready",function(){mlaModal.utility.hookCompatTaxonomies(this.model.get("id"),this.el)})}})}if(mlaModal.settings.enableDetailsCategory||mlaModal.settings.enableDetailsTag){wp.media.model.Selection=wp.media.model.Selection.extend({initialize:function(){a.prototype.initialize.apply(this,arguments);this.on("selection:reset",function(){mlaModal.cid=null});this.on("selection:unsingle",function(){mlaModal.cid=null});this.on("selection:single",function(e){mlaModal.cid=e.cid});this.on("change:uploading",function(){mlaModal.uploading=true});this.on("change",function(e){var f=false,g;if(mlaModal.uploading&&mlaModal.cid===e.cid){mlaModal.uploading=false;f=true}else{if(false===e.attributes.uploading){g=_.clone(e.changed);delete g.title;delete g.caption;delete g.alt;delete g.description;if(!_.isEmpty(g)){f=true}}}if(true===f){mlaModal.utility.hookCompatTaxonomies(e.get("id"),mlaModal.settings.$el)}})}})}mlaModal.utility.hookCompatTaxonomies=function(h,f){var e,g=null;d(".mla-taxonomy-field .categorydiv",f).each(function(){e=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));if(-1!=mlaModal.settings.enhancedTaxonomies.indexOf(e)){d(".compat-field-"+e+" th",f).click({id:h,currentTaxonomy:e,el:f},function(i){mlaModal.utility.fillCompatTaxonomies(i.data)});d("tr.compat-field-"+e,f).each(function(){if(d(this).hasClass("mla-taxonomy-row")){d(this).show()}else{d(this).remove()}});if(null===g){g=e}}else{d("tr.compat-field-"+e,f).each(function(){if(d(this).hasClass("mla-taxonomy-row")){d(this).remove()}})}});d(".mla-taxonomy-field .tagsdiv",f).each(function(){e=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));if(-1!=mlaModal.settings.enhancedTaxonomies.indexOf(e)){d(".compat-field-"+e+" th",f).click({id:h,currentTaxonomy:e,el:f},function(i){mlaModal.utility.fillCompatTaxonomies(i.data)});d("tr.compat-field-"+e,f).each(function(){if(d(this).hasClass("mla-taxonomy-row")){d(this).show()}else{d(this).remove()}});if(null===g){g=e}}else{d("tr.compat-field-"+e,f).each(function(){if(d(this).hasClass("mla-taxonomy-row")){d(this).remove()}})}});if(mlaModal.settings.enableTermsAutofill&&null!==g){d(".compat-field-"+g+" th",f).click()}};mlaModal.utility.fillCompatTaxonomies=function(i){var f=i.el,h=[],e,g;d(".mla-taxonomy-field .categorydiv",f).each(function(){e=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));h[h.length]=e;g=".compat-field-"+e;if("undefined"===typeof(mlaModal.initialHTML[e])){mlaModal.initialHTML[e]=d(g,f).html()}else{d(g,f).html(mlaModal.initialHTML[e])}d(g+" .categorydiv",f).html(mlaModal.strings.loadingText)});d(".mla-taxonomy-field .tagsdiv",f).each(function(){e=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));h[h.length]=e;g=".compat-field-"+e;if("undefined"===typeof(mlaModal.initialHTML[e])){mlaModal.initialHTML[e]=d(g,f).html()}else{d(g,f).html(mlaModal.initialHTML[e])}d(g+" .tagsdiv",f).html(mlaModal.strings.loadingText)});if(h.length){wp.media.post(mlaModal.settings.ajaxFillCompatAction,{id:i.id,query:h}).done(function(k){var j,l;for(j in k){l=".compat-field-"+j;d(l,f).html(k[j])}mlaModal.utility.supportCompatTaxonomies(i);d(".compat-field-"+i.currentTaxonomy+" td",f).show()})}};mlaModal.utility.supportCompatTaxonomies=function(g){var f=g.id,e=g.el;if(mlaModal.settings.enableDetailsCategory){d(".mla-taxonomy-field .categorydiv",e).each(function(){var j=d(this),h,k,i,n,l,p,o,m;i=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));n=i+"_tab";l="#mla-"+i;p="#mla-new-"+i;o="#mla-search-"+i;m="#mla-attachments-"+f+"-"+i;if(i=="category"){n="cats"}j.find(".category-tabs").show();d(".compat-field-"+i+" th",e).click(function(){d(this).siblings("td").slideToggle()});j.on("mouseleave",function(){var t,q,s=[],r=j.find(l+"-checklist input:checked");r.each(function(){s[s.length]=d(this).val()});s.sort(function(v,u){return v-u});s=s.join(",");q=j.siblings(m).val();if(q===s){return}j.siblings(m).val(s);j.prop("disabled",true);t={id:f};t[i]=s;wp.media.post(mlaModal.settings.ajaxUpdateCompatAction,t).done(function(v){var u,w;for(u in v){for(w in v[u]){j.find("#"+w).html(v[u][w])}}j.find(o).val("");j.find(l+"-searcher").addClass("mla-hidden-children");j.prop("disabled",false)})});j.on('change input[type="checkbox"]',function(q){q.stopPropagation();return false});j.find(l+"-tabs a").click(function(){var q=d(this).attr("href");d(this).parent().addClass("tabs").siblings("li").removeClass("tabs");j.find(l+"-tabs").siblings(".tabs-panel").hide();j.find(q).show();d(this).focus();if("#mla-"+i+"-all"==q){deleteUserSetting(n)}else{setUserSetting(n,"pop")}return false});if(getUserSetting(n)){j.find(l+'-tabs a[href="#mla-'+i+'-pop"]').click()}j.find(l+"-add-toggle").click(function(){j.find(l+"-searcher").addClass("mla-hidden-children");j.find(l+"-adder").toggleClass("mla-hidden-children");j.find(l+'-tabs a[href="#mla-'+i+'-all"]').click();j.find(l+"-checklist li").show();j.find(l+"-checklist-pop li").show();if(false===j.find(l+"-adder").hasClass("mla-hidden-children")){j.find(p).val("").removeClass("form-input-tip");j.find(p).focus()}return false});j.find(p).keypress(function(q){if(13===q.keyCode){q.preventDefault();j.find(l+"-add-submit").click()}});j.find(l+"-add-submit").click(function(){j.find(p).focus()});h=function(q){if(!j.find(p).val()){return false}q.data+="&"+j.find(l+"-checklist :checked").serialize();j.prop("disabled",true);return q};k=function(v,u){var t,q=j.find("#new"+i+"_parent");j.prop("disabled",false);if("undefined"!=u.parsed.responses[0]&&(t=u.parsed.responses[0].supplemental.newcat_parent)){q.before(t);q.remove();if(null!==mlaModal.utility.mlaAttachmentsBrowser){mlaModal.utility.mlaAttachmentsBrowser.updateFilters(i,t)}}};j.find(l+"-checklist").wpList({alt:"",response:"mla-"+i+"-ajax-response",addBefore:h,addAfter:k});j.find(l+"-checklist, "+l+"-checklist-pop").on("click",'li.popular-category > label input[type="checkbox"]',function(){var q=d(this),s=q.is(":checked"),r=q.val();if(r&&q.parents("#mla-taxonomy-"+i).length){d("#in-"+i+"-"+r+", #in-popular-"+i+"-"+r).prop("checked",s)}});d.extend(d.expr[":"],{matchTerms:function(s,r,q,t){return(s.textContent||s.innerText||"").toLowerCase().indexOf((q[3]||"").toLowerCase())>=0}});j.find(o).keypress(function(q){if(13===q.keyCode){q.preventDefault();j.find(o).val("");j.find(l+"-searcher").addClass("mla-hidden-children");j.find(l+"-checklist li").show();j.find(l+"-checklist-pop li").show();return}});j.find(o).keyup(function(s){var u,t,v,r,q;if(13===s.keyCode){s.preventDefault();j.find(l+"-search-toggle").focus();return}u=j.find(o).val();t=j.find(l+"-checklist li");v=j.find(l+"-checklist-pop li");if(0<u.length){t.hide();v.hide()}else{t.show();v.show()}r=j.find(l+"-checklist label:matchTerms('"+u+"')");r.closest("li").find("li").andSelf().show();r.parents(l+"-checklist li").show();q=j.find(l+"-checklist-pop label:matchTerms('"+u+"')");q.closest("li").find("li").andSelf().show();q.parents(l+"-checklist li").show()});j.find(l+"-search-toggle").click(function(){j.find(l+"-adder ").addClass("mla-hidden-children");j.find(l+"-searcher").toggleClass("mla-hidden-children");j.find(l+'-tabs a[href="#mla-'+i+'-all"]').click();j.find(l+"-checklist li").show();j.find(l+"-checklist-pop li").show();if(false===j.find(l+"-searcher").hasClass("mla-hidden-children")){j.find(o).val("").removeClass("form-input-tip");j.find(o).focus()}return false})})}if(mlaModal.settings.enableDetailsTag){d(".mla-taxonomy-field .tagsdiv",e).each(function(){var h=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));d(".compat-field-"+h+" th",e).click(function(){d(this).siblings("td").slideToggle()});mlaModal.tagBox.init(f,h,e)})}}}(jQuery));
languages/media-library-assistant-en_US - References.pot CHANGED
@@ -2,7 +2,7 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Media Library Assistant\n"
5
- "POT-Creation-Date: 2019-08-18 19:15-0700\n"
6
  "PO-Revision-Date: 2015-08-21 21:38-0800\n"
7
  "Last-Translator: David Lingren <david@fairtradejudaica.org>\n"
8
  "Language-Team: David Lingren <david@fairtradejudaica.org>\n"
@@ -48,7 +48,7 @@ msgstr ""
48
  #: includes/class-mla-admin-columns-pro-support-44.php:184
49
  #: includes/class-mla-admin-columns-pro-support.php:202
50
  #: includes/class-mla-list-table.php:644
51
- #: includes/class-mla-thumbnail-generation.php:645
52
  msgid "Trash"
53
  msgstr ""
54
 
@@ -56,7 +56,7 @@ msgstr ""
56
  #: includes/class-mla-admin-columns-pro-support-44.php:392
57
  #: includes/class-mla-admin-columns-pro-support.php:410
58
  #: includes/class-mla-data-references.php:310
59
- #: includes/class-mla-data-references.php:656
60
  #: includes/class-mla-list-table.php:1070
61
  msgid "NO REFERENCE TESTS"
62
  msgstr ""
@@ -159,16 +159,16 @@ msgid "Assistant"
159
  msgstr ""
160
 
161
  #: includes/class-mla-ajax.php:233 includes/class-mla-core-options.php:1186
162
- #: includes/class-mla-data.php:3992 includes/class-mla-edit-media.php:478
163
  #: includes/class-mla-main.php:2038 includes/class-mla-main.php:2343
164
- #: includes/class-mla-objects.php:348 includes/class-mla-options.php:465
165
  #: includes/mla-main-search-box-template.php:47
166
- #: includes/mla-media-modal-js-template.php:40
167
  msgid "Title"
168
  msgstr ""
169
 
170
  #: includes/class-mla-ajax.php:233 includes/class-mla-main.php:2039
171
- #: includes/class-mla-thumbnail-generation.php:637
172
  msgid "Type"
173
  msgstr ""
174
 
@@ -204,36 +204,39 @@ msgstr ""
204
  #: includes/class-mla-ajax.php:307 includes/class-mla-core.php:846
205
  #: includes/class-mla-core.php:864 includes/class-mla-core.php:1289
206
  #: includes/class-mla-core.php:1295 includes/class-mla-core.php:1299
207
- #: includes/class-mla-data-pdf.php:216 includes/class-mla-data-pdf.php:517
208
- #: includes/class-mla-data-pdf.php:519 includes/class-mla-data-pdf.php:565
209
- #: includes/class-mla-data-pdf.php:749 includes/class-mla-data-query.php:841
210
- #: includes/class-mla-data.php:50 includes/class-mla-data.php:108
211
- #: includes/class-mla-data.php:194 includes/class-mla-data.php:238
212
- #: includes/class-mla-data.php:341 includes/class-mla-data.php:497
213
- #: includes/class-mla-data.php:560 includes/class-mla-data.php:1504
214
- #: includes/class-mla-data.php:1702 includes/class-mla-data.php:1708
215
- #: includes/class-mla-data.php:2105 includes/class-mla-data.php:2109
216
- #: includes/class-mla-data.php:3252 includes/class-mla-data.php:3296
217
- #: includes/class-mla-data.php:3340 includes/class-mla-data.php:3720
218
- #: includes/class-mla-data.php:3733 includes/class-mla-data.php:3755
219
- #: includes/class-mla-data.php:3969 includes/class-mla-data.php:4015
220
- #: includes/class-mla-data.php:4048 includes/class-mla-data.php:4064
221
- #: includes/class-mla-data.php:4317 includes/class-mla-edit-media.php:319
222
- #: includes/class-mla-edit-media.php:892 includes/class-mla-edit-media.php:934
223
- #: includes/class-mla-main.php:707 includes/class-mla-main.php:830
224
- #: includes/class-mla-main.php:832 includes/class-mla-main.php:835
225
- #: includes/class-mla-main.php:884 includes/class-mla-main.php:918
226
- #: includes/class-mla-main.php:927 includes/class-mla-main.php:934
227
- #: includes/class-mla-main.php:1318 includes/class-mla-main.php:1374
228
- #: includes/class-mla-main.php:1399 includes/class-mla-main.php:1536
229
- #: includes/class-mla-main.php:1586 includes/class-mla-main.php:1689
230
- #: includes/class-mla-main.php:1718 includes/class-mla-main.php:1854
231
- #: includes/class-mla-main.php:1861 includes/class-mla-main.php:2024
232
- #: includes/class-mla-main.php:2150 includes/class-mla-main.php:2475
233
- #: includes/class-mla-main.php:2483 includes/class-mla-main.php:2507
234
- #: includes/class-mla-main.php:2515 includes/class-mla-main.php:2547
235
- #: includes/class-mla-main.php:2555 includes/class-mla-media-modal.php:617
236
- #: includes/class-mla-mime-types.php:801 includes/class-mla-mime-types.php:1193
 
 
 
237
  #: includes/class-mla-mime-types.php:1281
238
  #: includes/class-mla-mime-types.php:1427
239
  #: includes/class-mla-mime-types.php:1450
@@ -250,10 +253,10 @@ msgstr ""
250
  #: includes/class-mla-mime-types.php:2599
251
  #: includes/class-mla-mime-types.php:2608
252
  #: includes/class-mla-mime-types.php:2640 includes/class-mla-objects.php:245
253
- #: includes/class-mla-options.php:217 includes/class-mla-options.php:433
254
- #: includes/class-mla-options.php:514 includes/class-mla-options.php:569
255
- #: includes/class-mla-options.php:1088 includes/class-mla-options.php:1933
256
- #: includes/class-mla-options.php:2159
257
  #: includes/class-mla-settings-custom-fields-tab.php:173
258
  #: includes/class-mla-settings-custom-fields-tab.php:238
259
  #: includes/class-mla-settings-custom-fields-tab.php:242
@@ -270,7 +273,7 @@ msgstr ""
270
  #: includes/class-mla-settings-custom-fields-tab.php:2034
271
  #: includes/class-mla-settings-documentation-tab.php:131
272
  #: includes/class-mla-settings-documentation-tab.php:323
273
- #: includes/class-mla-settings-documentation-tab.php:1296
274
  #: includes/class-mla-settings-iptc-exif-tab.php:175
275
  #: includes/class-mla-settings-iptc-exif-tab.php:241
276
  #: includes/class-mla-settings-iptc-exif-tab.php:245
@@ -284,7 +287,7 @@ msgstr ""
284
  #: includes/class-mla-settings-iptc-exif-tab.php:1000
285
  #: includes/class-mla-settings-iptc-exif-tab.php:1004
286
  #: includes/class-mla-settings-iptc-exif-tab.php:1028
287
- #: includes/class-mla-settings-iptc-exif-tab.php:2264
288
  #: includes/class-mla-settings-shortcodes-tab.php:79
289
  #: includes/class-mla-settings-shortcodes-tab.php:90
290
  #: includes/class-mla-settings-shortcodes-tab.php:94
@@ -314,18 +317,18 @@ msgstr ""
314
  #: includes/class-mla-settings.php:1794 includes/class-mla-settings.php:1801
315
  #: includes/class-mla-settings.php:1810 includes/class-mla-settings.php:1847
316
  #: includes/class-mla-settings.php:1855 includes/class-mla-settings.php:1864
317
- #: includes/class-mla-shortcode-support.php:2147
318
- #: includes/class-mla-shortcode-support.php:2236
319
- #: includes/class-mla-shortcode-support.php:3469
320
- #: includes/class-mla-shortcode-support.php:3596
321
- #: includes/class-mla-shortcode-support.php:3628
322
- #: includes/class-mla-shortcode-support.php:4644
323
- #: includes/class-mla-shortcode-support.php:5055
324
- #: includes/class-mla-shortcode-support.php:5092
325
- #: includes/class-mla-thumbnail-generation.php:430
326
- #: includes/class-mla-thumbnail-generation.php:442
327
- #: includes/class-mla-thumbnail-generation.php:454
328
- #: includes/class-mla-thumbnail-generation.php:498
329
  msgid "ERROR"
330
  msgstr ""
331
 
@@ -338,7 +341,7 @@ msgstr ""
338
  msgid "You are not allowed to edit this Attachment."
339
  msgstr ""
340
 
341
- #: includes/class-mla-core-options.php:408 includes/class-mla-options.php:256
342
  msgid "Attachment Categories"
343
  msgstr ""
344
 
@@ -346,7 +349,7 @@ msgstr ""
346
  msgid "Check this option to add support for Attachment Categories."
347
  msgstr ""
348
 
349
- #: includes/class-mla-core-options.php:416 includes/class-mla-options.php:271
350
  msgid "Attachment Tags"
351
  msgstr ""
352
 
@@ -972,8 +975,8 @@ msgid "Size"
972
  msgstr ""
973
 
974
  #: includes/class-mla-core-options.php:922
975
- #: includes/class-mla-thumbnail-generation.php:584
976
- #: includes/class-mla-thumbnail-generation.php:648
977
  msgid "Thumbnail"
978
  msgstr ""
979
 
@@ -1236,30 +1239,30 @@ msgstr ""
1236
  msgid "IPTC/EXIF Mapping help"
1237
  msgstr ""
1238
 
1239
- #: includes/class-mla-core-options.php:1193 includes/class-mla-data.php:4018
1240
  #: includes/class-mla-edit-media.php:479 includes/class-mla-main.php:2344
1241
  msgid "Name/Slug"
1242
  msgstr ""
1243
 
1244
- #: includes/class-mla-core-options.php:1200 includes/class-mla-data.php:4061
1245
  #: includes/class-mla-edit-media.php:482 includes/class-mla-list-table.php:1345
1246
- #: includes/class-mla-main.php:2348 includes/class-mla-options.php:471
1247
  #: includes/mla-main-search-box-template.php:51
1248
- #: includes/mla-media-modal-js-template.php:48
1249
  msgid "ALT Text"
1250
  msgstr ""
1251
 
1252
- #: includes/class-mla-core-options.php:1207 includes/class-mla-data.php:4074
1253
  #: includes/class-mla-edit-media.php:480 includes/class-mla-main.php:2345
1254
- #: includes/class-mla-options.php:474
1255
  #: includes/mla-main-search-box-template.php:53
1256
- #: includes/mla-media-modal-js-template.php:53
1257
  msgid "Caption"
1258
  msgstr ""
1259
 
1260
- #: includes/class-mla-core-options.php:1214 includes/class-mla-data.php:4083
1261
  #: includes/class-mla-edit-media.php:481 includes/class-mla-main.php:2346
1262
- #: includes/class-mla-options.php:477
1263
  #: includes/class-mla-settings-upload-tab.php:174
1264
  #: includes/class-mla-settings-upload-tab.php:538
1265
  #: includes/class-mla-settings-view-tab.php:132
@@ -1271,12 +1274,12 @@ msgstr ""
1271
  #: includes/class-mla-template-support.php:178
1272
  #: includes/class-mla-template-support.php:226
1273
  #: includes/mla-main-search-box-template.php:55
1274
- #: includes/mla-media-modal-js-template.php:57
1275
  msgid "Description"
1276
  msgstr ""
1277
 
1278
- #: includes/class-mla-core-options.php:1221 includes/class-mla-data.php:4145
1279
- #: includes/class-mla-data.php:4154 includes/class-mla-edit-media.php:483
1280
  #: includes/class-mla-edit-media.php:677 includes/class-mla-main.php:2350
1281
  msgid "Uploaded on"
1282
  msgstr ""
@@ -1298,8 +1301,8 @@ msgstr ""
1298
  #: includes/class-mla-core-options.php:1256
1299
  #: includes/class-mla-mime-types.php:1682
1300
  #: includes/class-mla-settings-custom-fields-tab.php:2460
1301
- #: includes/class-mla-settings-documentation-tab.php:1566
1302
- #: includes/class-mla-settings-iptc-exif-tab.php:2727
1303
  #: includes/class-mla-settings-shortcodes-tab.php:1973
1304
  msgctxt "table_view_singular"
1305
  msgid "All"
@@ -1308,8 +1311,8 @@ msgstr ""
1308
  #: includes/class-mla-core-options.php:1257
1309
  #: includes/class-mla-mime-types.php:1683
1310
  #: includes/class-mla-settings-custom-fields-tab.php:2461
1311
- #: includes/class-mla-settings-documentation-tab.php:1567
1312
- #: includes/class-mla-settings-iptc-exif-tab.php:2728
1313
  #: includes/class-mla-settings-shortcodes-tab.php:1974
1314
  msgctxt "table_view_plural"
1315
  msgid "All"
@@ -1539,11 +1542,38 @@ msgstr ""
1539
  #: includes/class-mla-edit-media.php:416 includes/class-mla-main.php:2030
1540
  #: includes/class-mla-main.php:2211 includes/class-mla-main.php:2275
1541
  #: includes/class-mla-media-modal.php:647
1542
- #: includes/mla-media-modal-js-template.php:28
1543
- #: includes/mla-media-modal-js-template.php:75
1544
  msgid "Search"
1545
  msgstr ""
1546
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1547
  #: includes/class-mla-data-pdf.php:216
1548
  #, php-format
1549
  msgctxt "error_log"
@@ -1682,7 +1712,7 @@ msgctxt "list_table_column"
1682
  msgid "Attached to"
1683
  msgstr ""
1684
 
1685
- #: includes/class-mla-data-query.php:841 includes/class-mla-edit-media.php:319
1686
  #: includes/class-mla-main.php:2024 includes/class-mla-main.php:2150
1687
  #: includes/class-mla-media-modal.php:617 includes/class-mla-mime-types.php:801
1688
  #: includes/class-mla-mime-types.php:1450
@@ -1691,10 +1721,10 @@ msgstr ""
1691
  #: includes/class-mla-settings-custom-fields-tab.php:718
1692
  #: includes/class-mla-settings-custom-fields-tab.php:2034
1693
  #: includes/class-mla-settings-documentation-tab.php:323
1694
- #: includes/class-mla-settings-documentation-tab.php:1296
1695
  #: includes/class-mla-settings-iptc-exif-tab.php:631
1696
  #: includes/class-mla-settings-iptc-exif-tab.php:799
1697
- #: includes/class-mla-settings-iptc-exif-tab.php:2264
1698
  #: includes/class-mla-settings-shortcodes-tab.php:503
1699
  #: includes/class-mla-settings-shortcodes-tab.php:1630
1700
  #: includes/class-mla-settings-upload-tab.php:301
@@ -1704,95 +1734,96 @@ msgctxt "error_log"
1704
  msgid "%1$s: %2$s non-array \"%3$s\""
1705
  msgstr ""
1706
 
1707
- #: includes/class-mla-data-query.php:1326
1708
  #, php-format
1709
  msgctxt "error_log"
1710
  msgid "%1$s: _execute_list_table_query $wp_filter = \"%2$s\"."
1711
  msgstr ""
1712
 
1713
- #: includes/class-mla-data-query.php:1326
1714
- #: includes/class-mla-data-query.php:1341
1715
- #: includes/class-mla-data-query.php:1343
1716
- #: includes/class-mla-data-query.php:1844
1717
- #: includes/class-mla-data-query.php:1923
1718
- #: includes/class-mla-data-query.php:1995
1719
- #: includes/class-mla-data-query.php:2092
1720
- #: includes/class-mla-data-query.php:2184
1721
- #: includes/class-mla-data-query.php:2203
1722
  msgid "DEBUG"
1723
  msgstr ""
1724
 
1725
- #: includes/class-mla-data-query.php:1341
1726
  #, php-format
1727
  msgctxt "error_log"
1728
  msgid "%1$s: _execute_list_table_query WP_Query = \"%2$s\"."
1729
  msgstr ""
1730
 
1731
- #: includes/class-mla-data-query.php:1343
1732
  #, php-format
1733
  msgctxt "error_log"
1734
  msgid "%1$s: _execute_list_table_query SQL_request = \"%2$s\"."
1735
  msgstr ""
1736
 
1737
- #: includes/class-mla-data-query.php:1844
1738
  #, php-format
1739
  msgctxt "error_log"
1740
  msgid "%1$s: mla_query_posts_search_filter = \"%2$s\"."
1741
  msgstr ""
1742
 
1743
- #: includes/class-mla-data-query.php:1923
1744
  #, php-format
1745
  msgctxt "error_log"
1746
  msgid "%1$s: mla_query_posts_where_filter = \"%2$s\"."
1747
  msgstr ""
1748
 
1749
- #: includes/class-mla-data-query.php:1995
1750
  #, php-format
1751
  msgctxt "error_log"
1752
  msgid "%1$s: mla_query_posts_join_filter = \"%2$s\"."
1753
  msgstr ""
1754
 
1755
- #: includes/class-mla-data-query.php:2092
1756
  #, php-format
1757
  msgctxt "error_log"
1758
  msgid "%1$s: mla_query_posts_orderby_filter = \"%2$s\"."
1759
  msgstr ""
1760
 
1761
- #: includes/class-mla-data-query.php:2184
1762
  #, php-format
1763
  msgctxt "error_log"
1764
  msgid "%1$s: mla_query_posts_clauses_filter = \"%2$s\"."
1765
  msgstr ""
1766
 
1767
- #: includes/class-mla-data-query.php:2203
1768
  #, php-format
1769
  msgctxt "error_log"
1770
  msgid "%1$s: mla_query_posts_clauses_request_filter = \"%2$s\"."
1771
  msgstr ""
1772
 
1773
  #: includes/class-mla-data-references.php:316
1774
- #: includes/class-mla-data-references.php:662
1775
  #: includes/class-mla-data-source.php:688
1776
  #: includes/class-mla-data-source.php:689
1777
  msgid "ORPHAN"
1778
  msgstr ""
1779
 
1780
  #: includes/class-mla-data-references.php:320
1781
- #: includes/class-mla-data-references.php:666
1782
  msgid "UNUSED"
1783
  msgstr ""
1784
 
1785
  #: includes/class-mla-data-references.php:325
1786
- #: includes/class-mla-data-references.php:671
1787
  msgid "UNATTACHED"
1788
  msgstr ""
1789
 
1790
  #: includes/class-mla-data-references.php:327
1791
- #: includes/class-mla-data-references.php:673
1792
  msgid "INVALID PARENT"
1793
  msgstr ""
1794
 
1795
- #: includes/class-mla-data-references.php:847
 
1796
  #, php-format
1797
  msgid "(%1$s) %2$s (ID %3$d) query \"%4$s\" failed, returning \"%5$s\""
1798
  msgstr ""
@@ -1804,42 +1835,42 @@ msgid ""
1804
  "%1$s: _find_template_substring no template end delimiter, tail = \"%2$s\"."
1805
  msgstr ""
1806
 
1807
- #: includes/class-mla-data.php:108
1808
  #, php-format
1809
  msgctxt "error_log"
1810
  msgid ""
1811
  "%1$s: mla_parse_array_template no template end delimiter, tail = \"%2$s\"."
1812
  msgstr ""
1813
 
1814
- #: includes/class-mla-data.php:194
1815
  #, php-format
1816
  msgctxt "error_log"
1817
  msgid "%1$s: mla_parse_template no end delimiter, tail = \"%2$s\"."
1818
  msgstr ""
1819
 
1820
- #: includes/class-mla-data.php:238
1821
  #, php-format
1822
  msgctxt "error_log"
1823
  msgid "%1$s: _find_delimited_substring no end delimiter, tail = \"%2$s\"."
1824
  msgstr ""
1825
 
1826
- #: includes/class-mla-data.php:341
1827
  msgid "Test; no closing parenthesis "
1828
  msgstr ""
1829
 
1830
- #: includes/class-mla-data.php:497
1831
  #, php-format
1832
  msgctxt "error_log"
1833
  msgid "%1$s: _evaluate_template_array_node unknown type \"%2$s\"."
1834
  msgstr ""
1835
 
1836
- #: includes/class-mla-data.php:560
1837
  #, php-format
1838
  msgctxt "error_log"
1839
  msgid "%1$s: _evaluate_template_node unknown type \"%2$s\"."
1840
  msgstr ""
1841
 
1842
- #: includes/class-mla-data.php:1504
1843
  #, php-format
1844
  msgctxt "error_log"
1845
  msgid ""
@@ -1847,34 +1878,34 @@ msgid ""
1847
  "\"."
1848
  msgstr ""
1849
 
1850
- #: includes/class-mla-data.php:1702
1851
  #, php-format
1852
  msgctxt "error_log"
1853
  msgid "%1$s: mla_get_attachment_by_id(%2$d) not found."
1854
  msgstr ""
1855
 
1856
- #: includes/class-mla-data.php:1708
1857
  #, php-format
1858
  msgctxt "error_log"
1859
  msgid "%1$s: mla_get_attachment_by_id(%2$d) wrong post_type \"%3$s\"."
1860
  msgstr ""
1861
 
1862
- #: includes/class-mla-data.php:2105
1863
  msgctxt "error_log"
1864
- msgid "mla_parse_xmp_metadata xml_parse_into_struct failed."
1865
  msgstr ""
1866
 
1867
- #: includes/class-mla-data.php:2109
1868
  msgctxt "error_log"
1869
- msgid "mla_parse_xmp_metadata set option failed."
1870
  msgstr ""
1871
 
1872
- #: includes/class-mla-data.php:3467
1873
  #: includes/class-mla-settings-custom-fields-tab.php:810
1874
  #: includes/class-mla-settings-custom-fields-tab.php:1520
1875
  #: includes/class-mla-settings-iptc-exif-tab.php:893
1876
  #: includes/class-mla-settings-iptc-exif-tab.php:1626
1877
- #: includes/class-mla-settings-iptc-exif-tab.php:2438
1878
  #: includes/class-mla-settings-view-tab.php:398
1879
  #: includes/class-mla-settings-view-tab.php:796
1880
  #: includes/class-mla-settings-view-tab.php:812
@@ -1882,12 +1913,12 @@ msgstr ""
1882
  msgid "Yes"
1883
  msgstr ""
1884
 
1885
- #: includes/class-mla-data.php:3469
1886
  #: includes/class-mla-settings-custom-fields-tab.php:811
1887
  #: includes/class-mla-settings-custom-fields-tab.php:1522
1888
  #: includes/class-mla-settings-iptc-exif-tab.php:894
1889
  #: includes/class-mla-settings-iptc-exif-tab.php:1628
1890
- #: includes/class-mla-settings-iptc-exif-tab.php:2438
1891
  #: includes/class-mla-settings-view-tab.php:397
1892
  #: includes/class-mla-settings-view-tab.php:798
1893
  #: includes/class-mla-settings-view-tab.php:814
@@ -1895,159 +1926,159 @@ msgstr ""
1895
  msgid "No"
1896
  msgstr ""
1897
 
1898
- #: includes/class-mla-data.php:3717 includes/class-mla-data.php:3834
1899
  #, php-format
1900
  msgid "Deleting %1$s"
1901
  msgstr ""
1902
 
1903
- #: includes/class-mla-data.php:3720
1904
  #, php-format
1905
  msgid "%1$s: meta:%2$s not found"
1906
  msgstr ""
1907
 
1908
- #: includes/class-mla-data.php:3729 includes/class-mla-data.php:3845
1909
- #: includes/class-mla-data.php:3857
1910
  #, php-format
1911
  msgid "Adding %1$s = %2$s"
1912
  msgstr ""
1913
 
1914
- #: includes/class-mla-data.php:3733
1915
  #, php-format
1916
  msgid "%1$s: Adding meta:%2$s; not found"
1917
  msgstr ""
1918
 
1919
- #: includes/class-mla-data.php:3740
1920
  #, php-format
1921
  msgid "Deleting Null meta:%1$s"
1922
  msgstr ""
1923
 
1924
- #: includes/class-mla-data.php:3750 includes/class-mla-data.php:3926
1925
- #: includes/class-mla-data.php:3992 includes/class-mla-data.php:4018
1926
- #: includes/class-mla-data.php:4061 includes/class-mla-data.php:4074
1927
- #: includes/class-mla-data.php:4083 includes/class-mla-data.php:4094
1928
- #: includes/class-mla-data.php:4105 includes/class-mla-data.php:4118
1929
- #: includes/class-mla-data.php:4127 includes/class-mla-data.php:4136
1930
- #: includes/class-mla-data.php:4145 includes/class-mla-data.php:4154
1931
  #: includes/class-mla-mime-types.php:1284
1932
  #: includes/class-mla-mime-types.php:2404
1933
  #, php-format
1934
  msgid "Changing %1$s from \"%2$s\" to \"%3$s\""
1935
  msgstr ""
1936
 
1937
- #: includes/class-mla-data.php:3755
1938
  #, php-format
1939
  msgid "%1$s: Changing meta:%2$s; not found"
1940
  msgstr ""
1941
 
1942
- #: includes/class-mla-data.php:3881
1943
  #, php-format
1944
  msgid "Deleting old %1$s values"
1945
  msgstr ""
1946
 
1947
- #: includes/class-mla-data.php:3911
1948
  #, php-format
1949
  msgid "Changing %1$s from \"%2$s\" to \"%3$s\"; %4$d updates"
1950
  msgstr ""
1951
 
1952
- #: includes/class-mla-data.php:3969
1953
  msgid "Could not retrieve Attachment."
1954
  msgstr ""
1955
 
1956
- #: includes/class-mla-data.php:4015
1957
  #, php-format
1958
  msgid "%1$s: Could not change Name/Slug \"%2$s\"; name already exists"
1959
  msgstr ""
1960
 
1961
- #: includes/class-mla-data.php:4045
1962
  #, php-format
1963
  msgid "Deleting ALT Text, was \"%1$s\""
1964
  msgstr ""
1965
 
1966
- #: includes/class-mla-data.php:4048
1967
  #, php-format
1968
  msgid "%1$s: Could not delete ALT Text, remains \"%2$s\""
1969
  msgstr ""
1970
 
1971
- #: includes/class-mla-data.php:4064
1972
  #, php-format
1973
  msgid "%1$s: Could not change ALT Text from \"%2$s\" to \"%3$s\""
1974
  msgstr ""
1975
 
1976
- #: includes/class-mla-data.php:4094 includes/class-mla-list-table.php:1047
1977
  #: includes/class-mla-list-table.php:1050
1978
  #: includes/class-mla-list-table.php:1053
1979
- #: includes/class-mla-list-table.php:1121 includes/class-mla-options.php:2103
1980
  #: includes/class-mla-settings-iptc-exif-tab.php:484
1981
  #: includes/class-mla-settings-iptc-exif-tab.php:863
1982
  msgid "Parent"
1983
  msgstr ""
1984
 
1985
- #: includes/class-mla-data.php:4105 includes/class-mla-edit-media.php:816
1986
  #: includes/class-mla-edit-media.php:1021 includes/class-mla-main.php:2353
1987
  #: includes/class-mla-settings-view-tab.php:130
1988
  #: includes/class-mla-settings-view-tab.php:386
1989
  msgid "Menu Order"
1990
  msgstr ""
1991
 
1992
- #: includes/class-mla-data.php:4118 includes/class-mla-edit-media.php:447
1993
  #: includes/class-mla-list-table.php:1501
1994
  #: includes/class-mla-list-table.php:1504 includes/class-mla-main.php:2156
1995
  #: includes/class-mla-main.php:2312
1996
  msgid "Author"
1997
  msgstr ""
1998
 
1999
- #: includes/class-mla-data.php:4127 includes/class-mla-edit-media.php:472
2000
  #: includes/class-mla-main.php:2365
2001
  msgid "Comments"
2002
  msgstr ""
2003
 
2004
- #: includes/class-mla-data.php:4136 includes/class-mla-edit-media.php:473
2005
  #: includes/class-mla-main.php:2366
2006
  msgid "Pings"
2007
  msgstr ""
2008
 
2009
- #: includes/class-mla-data.php:4181
2010
  #, php-format
2011
  msgid "You cannot assign \"%1$s\" terms"
2012
  msgstr ""
2013
 
2014
- #: includes/class-mla-data.php:4193
2015
  msgctxt "tag delimiter"
2016
  msgid ","
2017
  msgstr ""
2018
 
2019
- #: includes/class-mla-data.php:4226
2020
  msgid "Adding"
2021
  msgstr ""
2022
 
2023
- #: includes/class-mla-data.php:4231
2024
  msgid "Removing"
2025
  msgstr ""
2026
 
2027
- #: includes/class-mla-data.php:4240
2028
  msgid "Replacing"
2029
  msgstr ""
2030
 
2031
- #: includes/class-mla-data.php:4248
2032
  msgid "Ignoring"
2033
  msgstr ""
2034
 
2035
- #: includes/class-mla-data.php:4261
2036
  #, php-format
2037
  msgid "%1$s \"%2$s\" terms"
2038
  msgstr ""
2039
 
2040
- #: includes/class-mla-data.php:4273 includes/class-mla-main.php:1384
2041
  #, php-format
2042
  msgid "Item %1$d, no changes detected."
2043
  msgstr ""
2044
 
2045
- #: includes/class-mla-data.php:4303
2046
  #, php-format
2047
  msgid "Item %1$d updated."
2048
  msgstr ""
2049
 
2050
- #: includes/class-mla-data.php:4317
2051
  #, php-format
2052
  msgid "%1$s: Item %2$d update failed."
2053
  msgstr ""
@@ -2055,7 +2086,7 @@ msgstr ""
2055
  #: includes/class-mla-edit-media.php:129 includes/class-mla-edit-media.php:183
2056
  #: includes/class-mla-edit-media.php:236 includes/class-mla-main.php:468
2057
  #: includes/class-mla-main.php:1139 includes/class-mla-main.php:1908
2058
- #: includes/class-mla-media-modal.php:268 includes/class-mla-options.php:1606
2059
  #: includes/class-mla-polylang-support.php:378
2060
  #: includes/class-mla-settings-custom-fields-tab.php:59
2061
  #: includes/class-mla-settings-custom-fields-tab.php:94
@@ -2135,7 +2166,7 @@ msgstr ""
2135
  #: includes/class-mla-settings-iptc-exif-tab.php:478
2136
  #: includes/class-mla-settings-iptc-exif-tab.php:860
2137
  #: includes/class-mla-settings-iptc-exif-tab.php:1567
2138
- #: includes/class-mla-settings-iptc-exif-tab.php:2419
2139
  msgid "Replace"
2140
  msgstr ""
2141
 
@@ -2246,7 +2277,7 @@ msgstr ""
2246
  #: includes/class-mla-settings-upload-tab.php:545
2247
  #: includes/class-mla-settings-view-tab.php:135
2248
  #: includes/class-mla-settings-view-tab.php:393
2249
- #: includes/class-mla-thumbnail-generation.php:651
2250
  msgid "Cancel"
2251
  msgstr ""
2252
 
@@ -2394,7 +2425,7 @@ msgid "Edit this item inline"
2394
  msgstr ""
2395
 
2396
  #: includes/class-mla-list-table.php:748 includes/class-mla-main.php:2342
2397
- #: includes/class-mla-options.php:1199
2398
  #: includes/class-mla-settings-custom-fields-tab.php:472
2399
  #: includes/class-mla-settings-custom-fields-tab.php:772
2400
  #: includes/class-mla-settings-custom-fields-tab.php:1352
@@ -2503,13 +2534,13 @@ msgid "Filter"
2503
  msgstr ""
2504
 
2505
  #: includes/class-mla-list-table.php:1965
2506
- #: includes/mla-media-modal-js-template.php:72
2507
  msgid "Terms Search"
2508
  msgstr ""
2509
 
2510
  #: includes/class-mla-list-table.php:1970
2511
  #: includes/class-mla-polylang-support.php:2072
2512
- #: includes/class-mla-thumbnail-generation.php:650
2513
  msgid "Clear Filter-by"
2514
  msgstr ""
2515
 
@@ -2704,11 +2735,11 @@ msgid "For"
2704
  msgstr ""
2705
 
2706
  #: includes/class-mla-main.php:2042
2707
- #: includes/class-mla-shortcode-support.php:1163
2708
  msgid "Unattached"
2709
  msgstr ""
2710
 
2711
- #: includes/class-mla-main.php:2361 includes/class-mla-options.php:1213
2712
  #: includes/class-mla-settings-custom-fields-tab.php:475
2713
  #: includes/class-mla-settings-custom-fields-tab.php:775
2714
  #: includes/class-mla-settings-custom-fields-tab.php:1466
@@ -2834,6 +2865,10 @@ msgstr ""
2834
  msgid "Exact"
2835
  msgstr ""
2836
 
 
 
 
 
2837
  #: includes/class-mla-mime-types.php:445
2838
  msgctxt "post_mime_types"
2839
  msgid "Manage"
@@ -2984,25 +3019,25 @@ msgid "%1$s: Did not find view \"%2$s\""
2984
  msgstr ""
2985
 
2986
  #: includes/class-mla-mime-types.php:1686
2987
- #: includes/class-mla-settings-documentation-tab.php:1574
2988
  msgctxt "table_view_singular"
2989
  msgid "Active"
2990
  msgstr ""
2991
 
2992
  #: includes/class-mla-mime-types.php:1687
2993
- #: includes/class-mla-settings-documentation-tab.php:1575
2994
  msgctxt "table_view_plural"
2995
  msgid "Active"
2996
  msgstr ""
2997
 
2998
  #: includes/class-mla-mime-types.php:1690
2999
- #: includes/class-mla-settings-documentation-tab.php:1578
3000
  msgctxt "table_view_singular"
3001
  msgid "Inactive"
3002
  msgstr ""
3003
 
3004
  #: includes/class-mla-mime-types.php:1691
3005
- #: includes/class-mla-settings-documentation-tab.php:1579
3006
  msgctxt "table_view_plural"
3007
  msgid "Inactive"
3008
  msgstr ""
@@ -3028,13 +3063,13 @@ msgid "MLA"
3028
  msgstr ""
3029
 
3030
  #: includes/class-mla-mime-types.php:1702
3031
- #: includes/class-mla-settings-iptc-exif-tab.php:2739
3032
  msgctxt "table_view_singular"
3033
  msgid "Custom"
3034
  msgstr ""
3035
 
3036
  #: includes/class-mla-mime-types.php:1703
3037
- #: includes/class-mla-settings-iptc-exif-tab.php:2740
3038
  msgctxt "table_view_plural"
3039
  msgid "Custom"
3040
  msgstr ""
@@ -3223,111 +3258,111 @@ msgstr ""
3223
  msgid "Add .textwidget div tags"
3224
  msgstr ""
3225
 
3226
- #: includes/class-mla-options.php:62
3227
  msgid "error loading tpls/mla-option-templates.tpl"
3228
  msgstr ""
3229
 
3230
- #: includes/class-mla-options.php:65
3231
  msgid "tpls/mla-option-templates.tpl not found"
3232
  msgstr ""
3233
 
3234
- #: includes/class-mla-options.php:217 includes/class-mla-options.php:433
3235
- #: includes/class-mla-options.php:514 includes/class-mla-options.php:569
3236
  #, php-format
3237
  msgid "%1$s: Custom %2$s unknown action \"%3$s\""
3238
  msgstr ""
3239
 
3240
- #: includes/class-mla-options.php:319
3241
  msgid "Custom Field"
3242
  msgstr ""
3243
 
3244
- #: includes/class-mla-options.php:331
3245
  msgid "Support"
3246
  msgstr ""
3247
 
3248
- #: includes/class-mla-options.php:332
3249
  msgid "Inline Edit"
3250
  msgstr ""
3251
 
3252
- #: includes/class-mla-options.php:333
3253
  msgid "Term Search"
3254
  msgstr ""
3255
 
3256
- #: includes/class-mla-options.php:334
3257
  msgid "Checklist"
3258
  msgstr ""
3259
 
3260
- #: includes/class-mla-options.php:335
3261
  msgid "Checked On Top"
3262
  msgstr ""
3263
 
3264
- #: includes/class-mla-options.php:336
3265
  msgid "Inline Add Term"
3266
  msgstr ""
3267
 
3268
- #: includes/class-mla-options.php:337
3269
  msgid "List Filter"
3270
  msgstr ""
3271
 
3272
- #: includes/class-mla-options.php:338
3273
  msgid "Taxonomy"
3274
  msgstr ""
3275
 
3276
- #: includes/class-mla-options.php:360
3277
  #, php-format
3278
  msgid "List Filter ignored; %1$s not supported."
3279
  msgstr ""
3280
 
3281
- #: includes/class-mla-options.php:367
3282
  #, php-format
3283
  msgid "Inline Edit ignored; %1$s not supported."
3284
  msgstr ""
3285
 
3286
- #: includes/class-mla-options.php:375
3287
  #, php-format
3288
  msgid "Term Search ignored; %1$s not supported."
3289
  msgstr ""
3290
 
3291
- #: includes/class-mla-options.php:385
3292
  #, php-format
3293
  msgid "Checklist ignored; %1$s not supported."
3294
  msgstr ""
3295
 
3296
- #: includes/class-mla-options.php:393
3297
  #, php-format
3298
  msgid "Checked On Top ignored; %1$s not supported."
3299
  msgstr ""
3300
 
3301
- #: includes/class-mla-options.php:402
3302
  #, php-format
3303
  msgid "Inline Add Term ignored; %1$s not supported."
3304
  msgstr ""
3305
 
3306
- #: includes/class-mla-options.php:423 includes/class-mla-options.php:504
3307
- #: includes/class-mla-options.php:559
3308
  #, php-format
3309
  msgid "Update custom %1$s"
3310
  msgstr ""
3311
 
3312
- #: includes/class-mla-options.php:430 includes/class-mla-options.php:511
3313
- #: includes/class-mla-options.php:566
3314
  #, php-format
3315
  msgid "Reset custom %1$s"
3316
  msgstr ""
3317
 
3318
- #: includes/class-mla-options.php:461
3319
  #: includes/mla-main-search-box-template.php:60
3320
- #: includes/mla-media-modal-js-template.php:32
3321
  msgid "and"
3322
  msgstr ""
3323
 
3324
- #: includes/class-mla-options.php:463
3325
  #: includes/mla-main-search-box-template.php:61
3326
- #: includes/mla-media-modal-js-template.php:36
3327
  msgid "or"
3328
  msgstr ""
3329
 
3330
- #: includes/class-mla-options.php:468
3331
  #: includes/class-mla-settings-custom-fields-tab.php:455
3332
  #: includes/class-mla-settings-custom-fields-tab.php:759
3333
  #: includes/class-mla-settings-iptc-exif-tab.php:455
@@ -3335,97 +3370,98 @@ msgstr ""
3335
  #: includes/class-mla-settings-shortcodes-tab.php:401
3336
  #: includes/class-mla-settings-shortcodes-tab.php:472
3337
  #: includes/mla-main-search-box-template.php:49
3338
- #: includes/mla-media-modal-js-template.php:44
3339
  msgid "Name"
3340
  msgstr ""
3341
 
3342
- #: includes/class-mla-options.php:480
3343
  #: includes/mla-main-search-box-template.php:57
3344
- #: includes/mla-media-modal-js-template.php:61
3345
  msgid "File"
3346
  msgstr ""
3347
 
3348
- #: includes/class-mla-options.php:483
3349
  #: includes/mla-main-search-box-template.php:58
3350
- #: includes/mla-media-modal-js-template.php:66
3351
  msgid "Terms"
3352
  msgstr ""
3353
 
3354
- #: includes/class-mla-options.php:956 includes/class-mla-options.php:1002
3355
- #: includes/class-mla-options.php:1846 includes/class-mla-options.php:1877
 
3356
  #: includes/class-mla-settings-upload-tab.php:128
3357
  msgid "None (select a value)"
3358
  msgstr ""
3359
 
3360
- #: includes/class-mla-options.php:1009
3361
  msgid "Metadata (see below)"
3362
  msgstr ""
3363
 
3364
- #: includes/class-mla-options.php:1016
3365
  msgid "Template (see below)"
3366
  msgstr ""
3367
 
3368
- #: includes/class-mla-options.php:1088 includes/class-mla-options.php:2159
3369
  #, php-format
3370
  msgid "%1$s: New field %2$s already exists."
3371
  msgstr ""
3372
 
3373
- #: includes/class-mla-options.php:1093 includes/class-mla-options.php:2164
3374
  #, php-format
3375
  msgid "Adding new field %1$s."
3376
  msgstr ""
3377
 
3378
- #: includes/class-mla-options.php:1101 includes/class-mla-options.php:2172
3379
  #, php-format
3380
  msgid "Adding new rule for %1$s."
3381
  msgstr ""
3382
 
3383
- #: includes/class-mla-options.php:1127 includes/class-mla-options.php:2029
3384
- #: includes/class-mla-options.php:2198
3385
  #, php-format
3386
  msgid "Deleting rule for %1$s."
3387
  msgstr ""
3388
 
3389
- #: includes/class-mla-options.php:1150 includes/class-mla-options.php:1171
3390
- #: includes/class-mla-options.php:1221 includes/class-mla-options.php:1228
3391
- #: includes/class-mla-options.php:1945 includes/class-mla-options.php:1952
3392
- #: includes/class-mla-options.php:1959 includes/class-mla-options.php:2054
3393
- #: includes/class-mla-options.php:2061 includes/class-mla-options.php:2096
3394
- #: includes/class-mla-options.php:2103 includes/class-mla-options.php:2208
3395
- #: includes/class-mla-options.php:2215 includes/class-mla-options.php:2250
3396
- #: includes/class-mla-options.php:2257
3397
  #, php-format
3398
  msgid "%1$s changing %2$s from %3$s to %4$s."
3399
  msgstr ""
3400
 
3401
- #: includes/class-mla-options.php:1150
3402
  #: includes/class-mla-settings-custom-fields-tab.php:463
3403
  #: includes/class-mla-settings-custom-fields-tab.php:763
3404
  msgid "Data Source"
3405
  msgstr ""
3406
 
3407
- #: includes/class-mla-options.php:1156 includes/class-mla-options.php:1979
3408
- #: includes/class-mla-options.php:2081 includes/class-mla-options.php:2235
3409
  msgid "Replace to Keep"
3410
  msgstr ""
3411
 
3412
- #: includes/class-mla-options.php:1159 includes/class-mla-options.php:1982
3413
- #: includes/class-mla-options.php:2084 includes/class-mla-options.php:2238
3414
  msgid "Keep to Replace"
3415
  msgstr ""
3416
 
3417
- #: includes/class-mla-options.php:1164 includes/class-mla-options.php:1185
3418
- #: includes/class-mla-options.php:1199 includes/class-mla-options.php:1213
3419
- #: includes/class-mla-options.php:1242 includes/class-mla-options.php:1973
3420
- #: includes/class-mla-options.php:1987 includes/class-mla-options.php:2075
3421
- #: includes/class-mla-options.php:2089 includes/class-mla-options.php:2229
3422
- #: includes/class-mla-options.php:2243 includes/class-mla-options.php:2271
3423
  #, php-format
3424
  msgid "%1$s changing %2$s value from %3$s."
3425
  msgstr ""
3426
 
3427
- #: includes/class-mla-options.php:1164 includes/class-mla-options.php:1987
3428
- #: includes/class-mla-options.php:2089 includes/class-mla-options.php:2243
3429
  #: includes/class-mla-settings-custom-fields-tab.php:477
3430
  #: includes/class-mla-settings-custom-fields-tab.php:777
3431
  #: includes/class-mla-settings-iptc-exif-tab.php:474
@@ -3433,7 +3469,7 @@ msgstr ""
3433
  msgid "Existing Text"
3434
  msgstr ""
3435
 
3436
- #: includes/class-mla-options.php:1171 includes/class-mla-options.php:2250
3437
  #: includes/class-mla-settings-custom-fields-tab.php:482
3438
  #: includes/class-mla-settings-custom-fields-tab.php:782
3439
  #: includes/class-mla-settings-iptc-exif-tab.php:489
@@ -3441,30 +3477,30 @@ msgstr ""
3441
  msgid "Format"
3442
  msgstr ""
3443
 
3444
- #: includes/class-mla-options.php:1177 includes/class-mla-options.php:1191
3445
- #: includes/class-mla-options.php:1205 includes/class-mla-options.php:1234
3446
- #: includes/class-mla-options.php:2263
3447
  msgid "unchecked to checked"
3448
  msgstr ""
3449
 
3450
- #: includes/class-mla-options.php:1180 includes/class-mla-options.php:1194
3451
- #: includes/class-mla-options.php:1208 includes/class-mla-options.php:1237
3452
- #: includes/class-mla-options.php:2266
3453
  msgid "checked to unchecked"
3454
  msgstr ""
3455
 
3456
- #: includes/class-mla-options.php:1185
3457
  #: includes/class-mla-settings-custom-fields-tab.php:469
3458
  #: includes/class-mla-settings-custom-fields-tab.php:769
3459
  #: includes/class-mla-settings-custom-fields-tab.php:1458
3460
  msgid "MLA Column"
3461
  msgstr ""
3462
 
3463
- #: includes/class-mla-options.php:1221
3464
  msgid "Metavalue name"
3465
  msgstr ""
3466
 
3467
- #: includes/class-mla-options.php:1228 includes/class-mla-options.php:2257
3468
  #: includes/class-mla-settings-custom-fields-tab.php:489
3469
  #: includes/class-mla-settings-custom-fields-tab.php:789
3470
  #: includes/class-mla-settings-iptc-exif-tab.php:496
@@ -3472,50 +3508,50 @@ msgstr ""
3472
  msgid "Option"
3473
  msgstr ""
3474
 
3475
- #: includes/class-mla-options.php:1242 includes/class-mla-options.php:2271
3476
  #: includes/class-mla-settings-iptc-exif-tab.php:508
3477
  msgid "Delete NULL values"
3478
  msgstr ""
3479
 
3480
- #: includes/class-mla-options.php:1933
3481
  #, php-format
3482
  msgid "%1$s: No old values for %2$s."
3483
  msgstr ""
3484
 
3485
- #: includes/class-mla-options.php:1945
3486
  msgid "Field Title"
3487
  msgstr ""
3488
 
3489
- #: includes/class-mla-options.php:1952 includes/class-mla-options.php:2054
3490
- #: includes/class-mla-options.php:2208
3491
  #: includes/class-mla-settings-iptc-exif-tab.php:463
3492
  #: includes/class-mla-settings-iptc-exif-tab.php:845
3493
  msgid "IPTC Value"
3494
  msgstr ""
3495
 
3496
- #: includes/class-mla-options.php:1959 includes/class-mla-options.php:2061
3497
- #: includes/class-mla-options.php:2215
3498
  msgid "EXIF Value"
3499
  msgstr ""
3500
 
3501
- #: includes/class-mla-options.php:1965 includes/class-mla-options.php:2067
3502
- #: includes/class-mla-options.php:2221
3503
  msgid "EXIF to IPTC"
3504
  msgstr ""
3505
 
3506
- #: includes/class-mla-options.php:1968 includes/class-mla-options.php:2070
3507
- #: includes/class-mla-options.php:2224
3508
  msgid "IPTC to EXIF"
3509
  msgstr ""
3510
 
3511
- #: includes/class-mla-options.php:1973 includes/class-mla-options.php:2075
3512
- #: includes/class-mla-options.php:2229
3513
  #: includes/class-mla-settings-iptc-exif-tab.php:469
3514
  #: includes/class-mla-settings-iptc-exif-tab.php:851
3515
  msgid "Priority"
3516
  msgstr ""
3517
 
3518
- #: includes/class-mla-options.php:2096
3519
  msgid "Delimiter(s)"
3520
  msgstr ""
3521
 
@@ -3582,7 +3618,7 @@ msgid "Language"
3582
  msgstr ""
3583
 
3584
  #: includes/class-mla-polylang-support.php:2071
3585
- #: includes/class-mla-thumbnail-generation.php:649
3586
  msgid "Options"
3587
  msgstr ""
3588
 
@@ -3938,8 +3974,8 @@ msgstr ""
3938
  #: includes/class-mla-settings-iptc-exif-tab.php:476
3939
  #: includes/class-mla-settings-iptc-exif-tab.php:858
3940
  #: includes/class-mla-settings-iptc-exif-tab.php:1565
3941
- #: includes/class-mla-settings-iptc-exif-tab.php:2419
3942
- #: includes/class-mla-thumbnail-generation.php:643
3943
  msgid "Keep"
3944
  msgstr ""
3945
 
@@ -4016,12 +4052,12 @@ msgstr ""
4016
  #: includes/class-mla-settings-custom-fields-tab.php:805
4017
  #: includes/class-mla-settings-custom-fields-tab.php:1488
4018
  #: includes/class-mla-settings-custom-fields-tab.php:1711
4019
- #: includes/class-mla-settings-documentation-tab.php:1244
4020
  #: includes/class-mla-settings-iptc-exif-tab.php:513
4021
  #: includes/class-mla-settings-iptc-exif-tab.php:887
4022
  #: includes/class-mla-settings-iptc-exif-tab.php:1581
4023
  #: includes/class-mla-settings-iptc-exif-tab.php:1817
4024
- #: includes/class-mla-settings-iptc-exif-tab.php:2422
4025
  #: includes/class-mla-settings-upload-tab.php:550
4026
  #: includes/class-mla-settings-upload-tab.php:1031
4027
  msgid "Active"
@@ -4031,12 +4067,12 @@ msgstr ""
4031
  #: includes/class-mla-settings-custom-fields-tab.php:807
4032
  #: includes/class-mla-settings-custom-fields-tab.php:1490
4033
  #: includes/class-mla-settings-custom-fields-tab.php:1714
4034
- #: includes/class-mla-settings-documentation-tab.php:1246
4035
  #: includes/class-mla-settings-iptc-exif-tab.php:515
4036
  #: includes/class-mla-settings-iptc-exif-tab.php:889
4037
  #: includes/class-mla-settings-iptc-exif-tab.php:1583
4038
  #: includes/class-mla-settings-iptc-exif-tab.php:1820
4039
- #: includes/class-mla-settings-iptc-exif-tab.php:2422
4040
  #: includes/class-mla-settings-upload-tab.php:172
4041
  #: includes/class-mla-settings-upload-tab.php:536
4042
  #: includes/class-mla-settings-upload-tab.php:1029
@@ -4289,21 +4325,21 @@ msgid "Bulk Edit"
4289
  msgstr ""
4290
 
4291
  #: includes/class-mla-settings-custom-fields-tab.php:2476
4292
- #: includes/class-mla-settings-iptc-exif-tab.php:2743
4293
  msgctxt "table_view_singular"
4294
  msgid "Read Only"
4295
  msgstr ""
4296
 
4297
  #: includes/class-mla-settings-custom-fields-tab.php:2477
4298
- #: includes/class-mla-settings-iptc-exif-tab.php:2744
4299
  msgctxt "table_view_plural"
4300
  msgid "Read Only"
4301
  msgstr ""
4302
 
4303
  #: includes/class-mla-settings-documentation-tab.php:82
4304
  #: includes/class-mla-settings-documentation-tab.php:974
4305
- #: includes/class-mla-settings-documentation-tab.php:1056
4306
- #: includes/class-mla-settings-documentation-tab.php:1086
4307
  #, php-format
4308
  msgid "Example plugin \"%1$s\" not found"
4309
  msgstr ""
@@ -4412,77 +4448,77 @@ msgstr ""
4412
  msgid "View this item"
4413
  msgstr ""
4414
 
4415
- #: includes/class-mla-settings-documentation-tab.php:997
4416
  #, php-format
4417
  msgid "Example plugin \"%1$s\" fs_connect failed; no action taken. Error: %2$s"
4418
  msgstr ""
4419
 
4420
- #: includes/class-mla-settings-documentation-tab.php:1002
4421
  #, php-format
4422
  msgid "Example plugin \"%1$s\" fs_connect failed; no action taken"
4423
  msgstr ""
4424
 
4425
- #: includes/class-mla-settings-documentation-tab.php:1025
4426
  #, php-format
4427
  msgid ""
4428
  "Example plugin \"%1$s\" install_package failed; no action taken. Error: %2$s"
4429
  msgstr ""
4430
 
4431
- #: includes/class-mla-settings-documentation-tab.php:1036
4432
  #, php-format
4433
  msgid "Example plugin \"%1$s\" remove old single file failed."
4434
  msgstr ""
4435
 
4436
- #: includes/class-mla-settings-documentation-tab.php:1061
4437
  #, php-format
4438
  msgid "Example plugin \"%1$s\" already installed; no action taken"
4439
  msgstr ""
4440
 
4441
- #: includes/class-mla-settings-documentation-tab.php:1067
4442
  #, php-format
4443
  msgid "Example plugin \"%1$s\" installed"
4444
  msgstr ""
4445
 
4446
- #: includes/class-mla-settings-documentation-tab.php:1091
4447
  #, php-format
4448
  msgid "Example plugin \"%1$s\" not installed; no action taken"
4449
  msgstr ""
4450
 
4451
- #: includes/class-mla-settings-documentation-tab.php:1097
4452
  #, php-format
4453
  msgid "Example plugin \"%1$s\" updated"
4454
  msgstr ""
4455
 
4456
- #: includes/class-mla-settings-documentation-tab.php:1242
4457
  msgid "Network"
4458
  msgstr ""
4459
 
4460
- #: includes/class-mla-settings-documentation-tab.php:1570
4461
  msgctxt "table_view_singular"
4462
  msgid "Installed"
4463
  msgstr ""
4464
 
4465
- #: includes/class-mla-settings-documentation-tab.php:1571
4466
  msgctxt "table_view_plural"
4467
  msgid "Installed"
4468
  msgstr ""
4469
 
4470
- #: includes/class-mla-settings-documentation-tab.php:1582
4471
  msgctxt "table_view_singular"
4472
  msgid "Network"
4473
  msgstr ""
4474
 
4475
- #: includes/class-mla-settings-documentation-tab.php:1583
4476
  msgctxt "table_view_plural"
4477
  msgid "Network"
4478
  msgstr ""
4479
 
4480
- #: includes/class-mla-settings-documentation-tab.php:1586
4481
  msgctxt "table_view_singular"
4482
  msgid "Uninstalled"
4483
  msgstr ""
4484
 
4485
- #: includes/class-mla-settings-documentation-tab.php:1587
4486
  msgctxt "table_view_plural"
4487
  msgid "Uninstalled"
4488
  msgstr ""
@@ -4594,22 +4630,22 @@ msgstr ""
4594
  msgid "Purge IPTC EXIF values"
4595
  msgstr ""
4596
 
4597
- #: includes/class-mla-settings-iptc-exif-tab.php:2731
4598
  msgctxt "table_view_singular"
4599
  msgid "Standard"
4600
  msgstr ""
4601
 
4602
- #: includes/class-mla-settings-iptc-exif-tab.php:2732
4603
  msgctxt "table_view_plural"
4604
  msgid "Standard"
4605
  msgstr ""
4606
 
4607
- #: includes/class-mla-settings-iptc-exif-tab.php:2735
4608
  msgctxt "table_view_singular"
4609
  msgid "Taxonomy"
4610
  msgstr ""
4611
 
4612
- #: includes/class-mla-settings-iptc-exif-tab.php:2736
4613
  msgctxt "table_view_plural"
4614
  msgid "Taxonomy"
4615
  msgstr ""
@@ -4859,7 +4895,7 @@ msgid "Markup"
4859
  msgstr ""
4860
 
4861
  #: includes/class-mla-settings-shortcodes-tab.php:1285
4862
- #: includes/class-mla-thumbnail-generation.php:646
4863
  msgid "Delete"
4864
  msgstr ""
4865
 
@@ -5506,154 +5542,154 @@ msgstr ""
5506
  msgid "Settings imported; %1$s updated, %2$s unchanged."
5507
  msgstr ""
5508
 
5509
- #: includes/class-mla-shortcode-support.php:499
5510
- #: includes/class-mla-shortcode-support.php:1907
5511
- #: includes/class-mla-shortcode-support.php:3940
5512
- #: includes/class-mla-shortcode-support.php:4222
5513
  msgid "Previous"
5514
  msgstr ""
5515
 
5516
- #: includes/class-mla-shortcode-support.php:500
5517
- #: includes/class-mla-shortcode-support.php:1908
5518
- #: includes/class-mla-shortcode-support.php:3989
5519
- #: includes/class-mla-shortcode-support.php:4228
5520
  msgid "Next"
5521
  msgstr ""
5522
 
5523
- #: includes/class-mla-shortcode-support.php:571
5524
- #: includes/class-mla-shortcode-support.php:577
5525
- #: includes/class-mla-shortcode-support.php:2046
5526
- #: includes/class-mla-shortcode-support.php:2053
5527
- #: includes/class-mla-shortcode-support.php:3366
5528
- #: includes/class-mla-shortcode-support.php:3373
5529
  #: includes/class-mla-template-support.php:598
5530
  msgid "not found"
5531
  msgstr ""
5532
 
5533
- #: includes/class-mla-shortcode-support.php:601
5534
- #: includes/class-mla-shortcode-support.php:2038
5535
- #: includes/class-mla-shortcode-support.php:3358
5536
  msgid "mla_debug REQUEST"
5537
  msgstr ""
5538
 
5539
- #: includes/class-mla-shortcode-support.php:605
5540
- #: includes/class-mla-shortcode-support.php:607
5541
  msgid "mla_debug attributes_errors"
5542
  msgstr ""
5543
 
5544
- #: includes/class-mla-shortcode-support.php:613
5545
- #: includes/class-mla-shortcode-support.php:2039
5546
- #: includes/class-mla-shortcode-support.php:3359
5547
  msgid "mla_debug attributes"
5548
  msgstr ""
5549
 
5550
- #: includes/class-mla-shortcode-support.php:614
5551
- #: includes/class-mla-shortcode-support.php:2040
5552
- #: includes/class-mla-shortcode-support.php:3360
5553
  msgid "mla_debug arguments"
5554
  msgstr ""
5555
 
5556
- #: includes/class-mla-shortcode-support.php:706
5557
  msgid "mla_debug empty gallery"
5558
  msgstr ""
5559
 
5560
- #: includes/class-mla-shortcode-support.php:727
5561
  msgid ""
5562
  "<strong>Photonic-enhanced [mla_gallery]</strong> type must be "
5563
  "<strong>default</strong>, query = "
5564
  msgstr ""
5565
 
5566
- #: includes/class-mla-shortcode-support.php:1187
5567
  msgid "unknown"
5568
  msgstr ""
5569
 
5570
- #: includes/class-mla-shortcode-support.php:2171
5571
  msgid "mla_debug empty cloud"
5572
  msgstr ""
5573
 
5574
- #: includes/class-mla-shortcode-support.php:3494
5575
  msgid "mla_debug empty list"
5576
  msgstr ""
5577
 
5578
- #: includes/class-mla-shortcode-support.php:3517
5579
  msgid "no-terms"
5580
  msgstr ""
5581
 
5582
- #: includes/class-mla-shortcode-support.php:4644
5583
- #: includes/class-mla-shortcode-support.php:5055
5584
- #: includes/class-mla-shortcode-support.php:5092
5585
  msgid "Invalid mla_gallery"
5586
  msgstr ""
5587
 
5588
- #: includes/class-mla-shortcode-support.php:5363
5589
  msgid "mla_debug query"
5590
  msgstr ""
5591
 
5592
- #: includes/class-mla-shortcode-support.php:5364
5593
  msgid "mla_debug request"
5594
  msgstr ""
5595
 
5596
- #: includes/class-mla-shortcode-support.php:5365
5597
  msgid "mla_debug query_vars"
5598
  msgstr ""
5599
 
5600
- #: includes/class-mla-shortcode-support.php:5366
5601
  msgid "mla_debug post_count"
5602
  msgstr ""
5603
 
5604
- #: includes/class-mla-shortcode-support.php:5390
5605
  msgid "mla_debug JOIN filter"
5606
  msgstr ""
5607
 
5608
- #: includes/class-mla-shortcode-support.php:5430
5609
  msgid "mla_debug modified JOIN filter"
5610
  msgstr ""
5611
 
5612
- #: includes/class-mla-shortcode-support.php:5455
5613
  msgid "mla_debug WHERE filter"
5614
  msgstr ""
5615
 
5616
- #: includes/class-mla-shortcode-support.php:5479
5617
  msgid "mla_debug modified WHERE filter"
5618
  msgstr ""
5619
 
5620
- #: includes/class-mla-shortcode-support.php:5502
5621
  msgid "mla_debug ORDER BY filter, incoming"
5622
  msgstr ""
5623
 
5624
- #: includes/class-mla-shortcode-support.php:5502
5625
  msgid "Replacement ORDER BY clause"
5626
  msgstr ""
5627
 
5628
- #: includes/class-mla-shortcode-support.php:5525
5629
  msgid "mla_debug posts_clauses filter"
5630
  msgstr ""
5631
 
5632
- #: includes/class-mla-shortcode-support.php:5543
5633
  msgid "mla_debug posts_clauses_request filter"
5634
  msgstr ""
5635
 
5636
- #: includes/class-mla-shortcode-support.php:5757
5637
  msgid "Invalid taxonomy"
5638
  msgstr ""
5639
 
5640
- #: includes/class-mla-shortcode-support.php:5937
5641
  msgid "mla_debug query arguments"
5642
  msgstr ""
5643
 
5644
- #: includes/class-mla-shortcode-support.php:5938
5645
  msgid "mla_debug last_query"
5646
  msgstr ""
5647
 
5648
- #: includes/class-mla-shortcode-support.php:5939
5649
  msgid "mla_debug last_error"
5650
  msgstr ""
5651
 
5652
- #: includes/class-mla-shortcode-support.php:5940
5653
  msgid "mla_debug num_rows"
5654
  msgstr ""
5655
 
5656
- #: includes/class-mla-shortcode-support.php:5941
5657
  msgid "mla_debug found_rows"
5658
  msgstr ""
5659
 
@@ -5815,102 +5851,102 @@ msgstr ""
5815
 
5816
  #: includes/class-mla-thumbnail-generation.php:96
5817
  #: includes/class-mla-thumbnail-generation.php:98
5818
- #: includes/class-mla-thumbnail-generation.php:629
5819
  msgid "Generate Thumbnails"
5820
  msgstr ""
5821
 
5822
- #: includes/class-mla-thumbnail-generation.php:383
5823
  #, php-format
5824
  msgid "Item %1$d"
5825
  msgstr ""
5826
 
5827
- #: includes/class-mla-thumbnail-generation.php:401
5828
  msgid "has native thumbnail."
5829
  msgstr ""
5830
 
5831
- #: includes/class-mla-thumbnail-generation.php:422
5832
  msgid "Featured Image retained."
5833
  msgstr ""
5834
 
5835
- #: includes/class-mla-thumbnail-generation.php:430
5836
  #, php-format
5837
  msgid "%1$s: %2$sno attached file."
5838
  msgstr ""
5839
 
5840
- #: includes/class-mla-thumbnail-generation.php:434
5841
  msgid "unsupported file type."
5842
  msgstr ""
5843
 
5844
- #: includes/class-mla-thumbnail-generation.php:442
5845
- #: includes/class-mla-thumbnail-generation.php:454
5846
  #, php-format
5847
  msgid "%1$s: %2$sthumbnail generation failed"
5848
  msgstr ""
5849
 
5850
- #: includes/class-mla-thumbnail-generation.php:450
5851
  #, php-format
5852
  msgid "%1$sWordPress-style thumbnail generated."
5853
  msgstr ""
5854
 
5855
- #: includes/class-mla-thumbnail-generation.php:498
5856
  #, php-format
5857
  msgid "%1$s: %2$swp_insert_attachment failed."
5858
  msgstr ""
5859
 
5860
- #: includes/class-mla-thumbnail-generation.php:515
5861
  #, php-format
5862
  msgid "%1$sthumbnail generated as new item %2$s."
5863
  msgstr ""
5864
 
5865
- #: includes/class-mla-thumbnail-generation.php:564
5866
- #: includes/class-mla-thumbnail-generation.php:673
5867
  msgid "Generated Thumbnails"
5868
  msgstr ""
5869
 
5870
- #: includes/class-mla-thumbnail-generation.php:619
5871
  msgid ""
5872
  "Type &ldquo;WP&rdquo; generates native WordPress thumbnails without creating "
5873
  "a separate image item."
5874
  msgstr ""
5875
 
5876
- #: includes/class-mla-thumbnail-generation.php:630
5877
  msgid ""
5878
  "Pull down the Help menu and select Thumbnail Generation for setting details"
5879
  msgstr ""
5880
 
5881
- #: includes/class-mla-thumbnail-generation.php:631
5882
  msgid "Width"
5883
  msgstr ""
5884
 
5885
- #: includes/class-mla-thumbnail-generation.php:632
5886
  msgid "Height"
5887
  msgstr ""
5888
 
5889
- #: includes/class-mla-thumbnail-generation.php:633
5890
  msgid "Best Fit"
5891
  msgstr ""
5892
 
5893
- #: includes/class-mla-thumbnail-generation.php:634
5894
  msgid "Page"
5895
  msgstr ""
5896
 
5897
- #: includes/class-mla-thumbnail-generation.php:635
5898
  msgid "Resolution"
5899
  msgstr ""
5900
 
5901
- #: includes/class-mla-thumbnail-generation.php:636
5902
  msgid "Quality"
5903
  msgstr ""
5904
 
5905
- #: includes/class-mla-thumbnail-generation.php:642
5906
  msgid "Existing Items"
5907
  msgstr ""
5908
 
5909
- #: includes/class-mla-thumbnail-generation.php:644
5910
  msgid "Ignore"
5911
  msgstr ""
5912
 
5913
- #: includes/class-mla-thumbnail-generation.php:647
5914
  msgid "Suffix"
5915
  msgstr ""
5916
 
@@ -5951,7 +5987,7 @@ msgstr ""
5951
 
5952
  #: includes/mla-main-search-box-template.php:42
5953
  #: includes/mla-main-search-box-template.php:44
5954
- #: includes/mla-media-modal-js-template.php:25
5955
  msgid "Search Media"
5956
  msgstr ""
5957
 
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Media Library Assistant\n"
5
+ "POT-Creation-Date: 2020-03-31 20:09-0700\n"
6
  "PO-Revision-Date: 2015-08-21 21:38-0800\n"
7
  "Last-Translator: David Lingren <david@fairtradejudaica.org>\n"
8
  "Language-Team: David Lingren <david@fairtradejudaica.org>\n"
48
  #: includes/class-mla-admin-columns-pro-support-44.php:184
49
  #: includes/class-mla-admin-columns-pro-support.php:202
50
  #: includes/class-mla-list-table.php:644
51
+ #: includes/class-mla-thumbnail-generation.php:649
52
  msgid "Trash"
53
  msgstr ""
54
 
56
  #: includes/class-mla-admin-columns-pro-support-44.php:392
57
  #: includes/class-mla-admin-columns-pro-support.php:410
58
  #: includes/class-mla-data-references.php:310
59
+ #: includes/class-mla-data-references.php:634
60
  #: includes/class-mla-list-table.php:1070
61
  msgid "NO REFERENCE TESTS"
62
  msgstr ""
159
  msgstr ""
160
 
161
  #: includes/class-mla-ajax.php:233 includes/class-mla-core-options.php:1186
162
+ #: includes/class-mla-data.php:4187 includes/class-mla-edit-media.php:478
163
  #: includes/class-mla-main.php:2038 includes/class-mla-main.php:2343
164
+ #: includes/class-mla-objects.php:348 includes/class-mla-options.php:466
165
  #: includes/mla-main-search-box-template.php:47
166
+ #: includes/mla-media-modal-js-template.php:57
167
  msgid "Title"
168
  msgstr ""
169
 
170
  #: includes/class-mla-ajax.php:233 includes/class-mla-main.php:2039
171
+ #: includes/class-mla-thumbnail-generation.php:641
172
  msgid "Type"
173
  msgstr ""
174
 
204
  #: includes/class-mla-ajax.php:307 includes/class-mla-core.php:846
205
  #: includes/class-mla-core.php:864 includes/class-mla-core.php:1289
206
  #: includes/class-mla-core.php:1295 includes/class-mla-core.php:1299
207
+ #: includes/class-mla-data-office.php:54 includes/class-mla-data-office.php:64
208
+ #: includes/class-mla-data-office.php:68 includes/class-mla-data-office.php:83
209
+ #: includes/class-mla-data-office.php:88 includes/class-mla-data-pdf.php:216
210
+ #: includes/class-mla-data-pdf.php:517 includes/class-mla-data-pdf.php:519
211
+ #: includes/class-mla-data-pdf.php:565 includes/class-mla-data-pdf.php:749
212
+ #: includes/class-mla-data-query.php:843 includes/class-mla-data.php:50
213
+ #: includes/class-mla-data.php:109 includes/class-mla-data.php:193
214
+ #: includes/class-mla-data.php:237 includes/class-mla-data.php:340
215
+ #: includes/class-mla-data.php:495 includes/class-mla-data.php:558
216
+ #: includes/class-mla-data.php:1511 includes/class-mla-data.php:1710
217
+ #: includes/class-mla-data.php:1716 includes/class-mla-data.php:2066
218
+ #: includes/class-mla-data.php:2070 includes/class-mla-data.php:3435
219
+ #: includes/class-mla-data.php:3491 includes/class-mla-data.php:3535
220
+ #: includes/class-mla-data.php:3915 includes/class-mla-data.php:3928
221
+ #: includes/class-mla-data.php:3950 includes/class-mla-data.php:4164
222
+ #: includes/class-mla-data.php:4210 includes/class-mla-data.php:4243
223
+ #: includes/class-mla-data.php:4259 includes/class-mla-data.php:4512
224
+ #: includes/class-mla-edit-media.php:319 includes/class-mla-edit-media.php:892
225
+ #: includes/class-mla-edit-media.php:934 includes/class-mla-main.php:707
226
+ #: includes/class-mla-main.php:830 includes/class-mla-main.php:832
227
+ #: includes/class-mla-main.php:835 includes/class-mla-main.php:884
228
+ #: includes/class-mla-main.php:918 includes/class-mla-main.php:927
229
+ #: includes/class-mla-main.php:934 includes/class-mla-main.php:1318
230
+ #: includes/class-mla-main.php:1374 includes/class-mla-main.php:1399
231
+ #: includes/class-mla-main.php:1536 includes/class-mla-main.php:1586
232
+ #: includes/class-mla-main.php:1689 includes/class-mla-main.php:1718
233
+ #: includes/class-mla-main.php:1854 includes/class-mla-main.php:1861
234
+ #: includes/class-mla-main.php:2024 includes/class-mla-main.php:2150
235
+ #: includes/class-mla-main.php:2475 includes/class-mla-main.php:2483
236
+ #: includes/class-mla-main.php:2507 includes/class-mla-main.php:2515
237
+ #: includes/class-mla-main.php:2547 includes/class-mla-main.php:2555
238
+ #: includes/class-mla-media-modal.php:617 includes/class-mla-mime-types.php:801
239
+ #: includes/class-mla-mime-types.php:1193
240
  #: includes/class-mla-mime-types.php:1281
241
  #: includes/class-mla-mime-types.php:1427
242
  #: includes/class-mla-mime-types.php:1450
253
  #: includes/class-mla-mime-types.php:2599
254
  #: includes/class-mla-mime-types.php:2608
255
  #: includes/class-mla-mime-types.php:2640 includes/class-mla-objects.php:245
256
+ #: includes/class-mla-options.php:218 includes/class-mla-options.php:434
257
+ #: includes/class-mla-options.php:515 includes/class-mla-options.php:570
258
+ #: includes/class-mla-options.php:1131 includes/class-mla-options.php:1981
259
+ #: includes/class-mla-options.php:2207
260
  #: includes/class-mla-settings-custom-fields-tab.php:173
261
  #: includes/class-mla-settings-custom-fields-tab.php:238
262
  #: includes/class-mla-settings-custom-fields-tab.php:242
273
  #: includes/class-mla-settings-custom-fields-tab.php:2034
274
  #: includes/class-mla-settings-documentation-tab.php:131
275
  #: includes/class-mla-settings-documentation-tab.php:323
276
+ #: includes/class-mla-settings-documentation-tab.php:1301
277
  #: includes/class-mla-settings-iptc-exif-tab.php:175
278
  #: includes/class-mla-settings-iptc-exif-tab.php:241
279
  #: includes/class-mla-settings-iptc-exif-tab.php:245
287
  #: includes/class-mla-settings-iptc-exif-tab.php:1000
288
  #: includes/class-mla-settings-iptc-exif-tab.php:1004
289
  #: includes/class-mla-settings-iptc-exif-tab.php:1028
290
+ #: includes/class-mla-settings-iptc-exif-tab.php:2265
291
  #: includes/class-mla-settings-shortcodes-tab.php:79
292
  #: includes/class-mla-settings-shortcodes-tab.php:90
293
  #: includes/class-mla-settings-shortcodes-tab.php:94
317
  #: includes/class-mla-settings.php:1794 includes/class-mla-settings.php:1801
318
  #: includes/class-mla-settings.php:1810 includes/class-mla-settings.php:1847
319
  #: includes/class-mla-settings.php:1855 includes/class-mla-settings.php:1864
320
+ #: includes/class-mla-shortcode-support.php:2182
321
+ #: includes/class-mla-shortcode-support.php:2271
322
+ #: includes/class-mla-shortcode-support.php:3504
323
+ #: includes/class-mla-shortcode-support.php:3631
324
+ #: includes/class-mla-shortcode-support.php:3663
325
+ #: includes/class-mla-shortcode-support.php:4790
326
+ #: includes/class-mla-shortcode-support.php:5211
327
+ #: includes/class-mla-shortcode-support.php:5256
328
+ #: includes/class-mla-thumbnail-generation.php:434
329
+ #: includes/class-mla-thumbnail-generation.php:446
330
+ #: includes/class-mla-thumbnail-generation.php:458
331
+ #: includes/class-mla-thumbnail-generation.php:502
332
  msgid "ERROR"
333
  msgstr ""
334
 
341
  msgid "You are not allowed to edit this Attachment."
342
  msgstr ""
343
 
344
+ #: includes/class-mla-core-options.php:408 includes/class-mla-options.php:257
345
  msgid "Attachment Categories"
346
  msgstr ""
347
 
349
  msgid "Check this option to add support for Attachment Categories."
350
  msgstr ""
351
 
352
+ #: includes/class-mla-core-options.php:416 includes/class-mla-options.php:272
353
  msgid "Attachment Tags"
354
  msgstr ""
355
 
975
  msgstr ""
976
 
977
  #: includes/class-mla-core-options.php:922
978
+ #: includes/class-mla-thumbnail-generation.php:588
979
+ #: includes/class-mla-thumbnail-generation.php:652
980
  msgid "Thumbnail"
981
  msgstr ""
982
 
1239
  msgid "IPTC/EXIF Mapping help"
1240
  msgstr ""
1241
 
1242
+ #: includes/class-mla-core-options.php:1193 includes/class-mla-data.php:4213
1243
  #: includes/class-mla-edit-media.php:479 includes/class-mla-main.php:2344
1244
  msgid "Name/Slug"
1245
  msgstr ""
1246
 
1247
+ #: includes/class-mla-core-options.php:1200 includes/class-mla-data.php:4256
1248
  #: includes/class-mla-edit-media.php:482 includes/class-mla-list-table.php:1345
1249
+ #: includes/class-mla-main.php:2348 includes/class-mla-options.php:472
1250
  #: includes/mla-main-search-box-template.php:51
1251
+ #: includes/mla-media-modal-js-template.php:65
1252
  msgid "ALT Text"
1253
  msgstr ""
1254
 
1255
+ #: includes/class-mla-core-options.php:1207 includes/class-mla-data.php:4269
1256
  #: includes/class-mla-edit-media.php:480 includes/class-mla-main.php:2345
1257
+ #: includes/class-mla-options.php:475
1258
  #: includes/mla-main-search-box-template.php:53
1259
+ #: includes/mla-media-modal-js-template.php:70
1260
  msgid "Caption"
1261
  msgstr ""
1262
 
1263
+ #: includes/class-mla-core-options.php:1214 includes/class-mla-data.php:4278
1264
  #: includes/class-mla-edit-media.php:481 includes/class-mla-main.php:2346
1265
+ #: includes/class-mla-options.php:478
1266
  #: includes/class-mla-settings-upload-tab.php:174
1267
  #: includes/class-mla-settings-upload-tab.php:538
1268
  #: includes/class-mla-settings-view-tab.php:132
1274
  #: includes/class-mla-template-support.php:178
1275
  #: includes/class-mla-template-support.php:226
1276
  #: includes/mla-main-search-box-template.php:55
1277
+ #: includes/mla-media-modal-js-template.php:74
1278
  msgid "Description"
1279
  msgstr ""
1280
 
1281
+ #: includes/class-mla-core-options.php:1221 includes/class-mla-data.php:4340
1282
+ #: includes/class-mla-data.php:4349 includes/class-mla-edit-media.php:483
1283
  #: includes/class-mla-edit-media.php:677 includes/class-mla-main.php:2350
1284
  msgid "Uploaded on"
1285
  msgstr ""
1301
  #: includes/class-mla-core-options.php:1256
1302
  #: includes/class-mla-mime-types.php:1682
1303
  #: includes/class-mla-settings-custom-fields-tab.php:2460
1304
+ #: includes/class-mla-settings-documentation-tab.php:1571
1305
+ #: includes/class-mla-settings-iptc-exif-tab.php:2728
1306
  #: includes/class-mla-settings-shortcodes-tab.php:1973
1307
  msgctxt "table_view_singular"
1308
  msgid "All"
1311
  #: includes/class-mla-core-options.php:1257
1312
  #: includes/class-mla-mime-types.php:1683
1313
  #: includes/class-mla-settings-custom-fields-tab.php:2461
1314
+ #: includes/class-mla-settings-documentation-tab.php:1572
1315
+ #: includes/class-mla-settings-iptc-exif-tab.php:2729
1316
  #: includes/class-mla-settings-shortcodes-tab.php:1974
1317
  msgctxt "table_view_plural"
1318
  msgid "All"
1542
  #: includes/class-mla-edit-media.php:416 includes/class-mla-main.php:2030
1543
  #: includes/class-mla-main.php:2211 includes/class-mla-main.php:2275
1544
  #: includes/class-mla-media-modal.php:647
1545
+ #: includes/mla-media-modal-js-template.php:45
1546
+ #: includes/mla-media-modal-js-template.php:92
1547
  msgid "Search"
1548
  msgstr ""
1549
 
1550
+ #: includes/class-mla-data-office.php:54
1551
+ msgctxt "error_log"
1552
+ msgid "mla_extract_office_metadata zip open failed."
1553
+ msgstr ""
1554
+
1555
+ #: includes/class-mla-data-office.php:64
1556
+ msgctxt "error_log"
1557
+ msgid ""
1558
+ "mla_extract_office_metadata mla_parse_xml_string( docProps/app.xml ) failed."
1559
+ msgstr ""
1560
+
1561
+ #: includes/class-mla-data-office.php:68
1562
+ msgctxt "error_log"
1563
+ msgid "mla_extract_office_metadata locateName( docProps/app.xml ) failed."
1564
+ msgstr ""
1565
+
1566
+ #: includes/class-mla-data-office.php:83
1567
+ msgctxt "error_log"
1568
+ msgid ""
1569
+ "mla_extract_office_metadata mla_parse_xml_string( docProps/core.xml ) failed."
1570
+ msgstr ""
1571
+
1572
+ #: includes/class-mla-data-office.php:88
1573
+ msgctxt "error_log"
1574
+ msgid "mla_extract_office_metadata locateName( docProps/core.xml ) failed."
1575
+ msgstr ""
1576
+
1577
  #: includes/class-mla-data-pdf.php:216
1578
  #, php-format
1579
  msgctxt "error_log"
1712
  msgid "Attached to"
1713
  msgstr ""
1714
 
1715
+ #: includes/class-mla-data-query.php:843 includes/class-mla-edit-media.php:319
1716
  #: includes/class-mla-main.php:2024 includes/class-mla-main.php:2150
1717
  #: includes/class-mla-media-modal.php:617 includes/class-mla-mime-types.php:801
1718
  #: includes/class-mla-mime-types.php:1450
1721
  #: includes/class-mla-settings-custom-fields-tab.php:718
1722
  #: includes/class-mla-settings-custom-fields-tab.php:2034
1723
  #: includes/class-mla-settings-documentation-tab.php:323
1724
+ #: includes/class-mla-settings-documentation-tab.php:1301
1725
  #: includes/class-mla-settings-iptc-exif-tab.php:631
1726
  #: includes/class-mla-settings-iptc-exif-tab.php:799
1727
+ #: includes/class-mla-settings-iptc-exif-tab.php:2265
1728
  #: includes/class-mla-settings-shortcodes-tab.php:503
1729
  #: includes/class-mla-settings-shortcodes-tab.php:1630
1730
  #: includes/class-mla-settings-upload-tab.php:301
1734
  msgid "%1$s: %2$s non-array \"%3$s\""
1735
  msgstr ""
1736
 
1737
+ #: includes/class-mla-data-query.php:1333
1738
  #, php-format
1739
  msgctxt "error_log"
1740
  msgid "%1$s: _execute_list_table_query $wp_filter = \"%2$s\"."
1741
  msgstr ""
1742
 
1743
+ #: includes/class-mla-data-query.php:1333
1744
+ #: includes/class-mla-data-query.php:1348
1745
+ #: includes/class-mla-data-query.php:1350
1746
+ #: includes/class-mla-data-query.php:1864
1747
+ #: includes/class-mla-data-query.php:1943
1748
+ #: includes/class-mla-data-query.php:2015
1749
+ #: includes/class-mla-data-query.php:2112
1750
+ #: includes/class-mla-data-query.php:2204
1751
+ #: includes/class-mla-data-query.php:2223
1752
  msgid "DEBUG"
1753
  msgstr ""
1754
 
1755
+ #: includes/class-mla-data-query.php:1348
1756
  #, php-format
1757
  msgctxt "error_log"
1758
  msgid "%1$s: _execute_list_table_query WP_Query = \"%2$s\"."
1759
  msgstr ""
1760
 
1761
+ #: includes/class-mla-data-query.php:1350
1762
  #, php-format
1763
  msgctxt "error_log"
1764
  msgid "%1$s: _execute_list_table_query SQL_request = \"%2$s\"."
1765
  msgstr ""
1766
 
1767
+ #: includes/class-mla-data-query.php:1864
1768
  #, php-format
1769
  msgctxt "error_log"
1770
  msgid "%1$s: mla_query_posts_search_filter = \"%2$s\"."
1771
  msgstr ""
1772
 
1773
+ #: includes/class-mla-data-query.php:1943
1774
  #, php-format
1775
  msgctxt "error_log"
1776
  msgid "%1$s: mla_query_posts_where_filter = \"%2$s\"."
1777
  msgstr ""
1778
 
1779
+ #: includes/class-mla-data-query.php:2015
1780
  #, php-format
1781
  msgctxt "error_log"
1782
  msgid "%1$s: mla_query_posts_join_filter = \"%2$s\"."
1783
  msgstr ""
1784
 
1785
+ #: includes/class-mla-data-query.php:2112
1786
  #, php-format
1787
  msgctxt "error_log"
1788
  msgid "%1$s: mla_query_posts_orderby_filter = \"%2$s\"."
1789
  msgstr ""
1790
 
1791
+ #: includes/class-mla-data-query.php:2204
1792
  #, php-format
1793
  msgctxt "error_log"
1794
  msgid "%1$s: mla_query_posts_clauses_filter = \"%2$s\"."
1795
  msgstr ""
1796
 
1797
+ #: includes/class-mla-data-query.php:2223
1798
  #, php-format
1799
  msgctxt "error_log"
1800
  msgid "%1$s: mla_query_posts_clauses_request_filter = \"%2$s\"."
1801
  msgstr ""
1802
 
1803
  #: includes/class-mla-data-references.php:316
1804
+ #: includes/class-mla-data-references.php:640
1805
  #: includes/class-mla-data-source.php:688
1806
  #: includes/class-mla-data-source.php:689
1807
  msgid "ORPHAN"
1808
  msgstr ""
1809
 
1810
  #: includes/class-mla-data-references.php:320
1811
+ #: includes/class-mla-data-references.php:644
1812
  msgid "UNUSED"
1813
  msgstr ""
1814
 
1815
  #: includes/class-mla-data-references.php:325
1816
+ #: includes/class-mla-data-references.php:649
1817
  msgid "UNATTACHED"
1818
  msgstr ""
1819
 
1820
  #: includes/class-mla-data-references.php:327
1821
+ #: includes/class-mla-data-references.php:651
1822
  msgid "INVALID PARENT"
1823
  msgstr ""
1824
 
1825
+ #: includes/class-mla-data-references.php:828
1826
+ #: includes/class-mla-data-references.php:862
1827
  #, php-format
1828
  msgid "(%1$s) %2$s (ID %3$d) query \"%4$s\" failed, returning \"%5$s\""
1829
  msgstr ""
1835
  "%1$s: _find_template_substring no template end delimiter, tail = \"%2$s\"."
1836
  msgstr ""
1837
 
1838
+ #: includes/class-mla-data.php:109
1839
  #, php-format
1840
  msgctxt "error_log"
1841
  msgid ""
1842
  "%1$s: mla_parse_array_template no template end delimiter, tail = \"%2$s\"."
1843
  msgstr ""
1844
 
1845
+ #: includes/class-mla-data.php:193
1846
  #, php-format
1847
  msgctxt "error_log"
1848
  msgid "%1$s: mla_parse_template no end delimiter, tail = \"%2$s\"."
1849
  msgstr ""
1850
 
1851
+ #: includes/class-mla-data.php:237
1852
  #, php-format
1853
  msgctxt "error_log"
1854
  msgid "%1$s: _find_delimited_substring no end delimiter, tail = \"%2$s\"."
1855
  msgstr ""
1856
 
1857
+ #: includes/class-mla-data.php:340
1858
  msgid "Test; no closing parenthesis "
1859
  msgstr ""
1860
 
1861
+ #: includes/class-mla-data.php:495
1862
  #, php-format
1863
  msgctxt "error_log"
1864
  msgid "%1$s: _evaluate_template_array_node unknown type \"%2$s\"."
1865
  msgstr ""
1866
 
1867
+ #: includes/class-mla-data.php:558
1868
  #, php-format
1869
  msgctxt "error_log"
1870
  msgid "%1$s: _evaluate_template_node unknown type \"%2$s\"."
1871
  msgstr ""
1872
 
1873
+ #: includes/class-mla-data.php:1511
1874
  #, php-format
1875
  msgctxt "error_log"
1876
  msgid ""
1878
  "\"."
1879
  msgstr ""
1880
 
1881
+ #: includes/class-mla-data.php:1710
1882
  #, php-format
1883
  msgctxt "error_log"
1884
  msgid "%1$s: mla_get_attachment_by_id(%2$d) not found."
1885
  msgstr ""
1886
 
1887
+ #: includes/class-mla-data.php:1716
1888
  #, php-format
1889
  msgctxt "error_log"
1890
  msgid "%1$s: mla_get_attachment_by_id(%2$d) wrong post_type \"%3$s\"."
1891
  msgstr ""
1892
 
1893
+ #: includes/class-mla-data.php:2066
1894
  msgctxt "error_log"
1895
+ msgid "mla_parse_xml_string xml_parse_into_struct failed."
1896
  msgstr ""
1897
 
1898
+ #: includes/class-mla-data.php:2070
1899
  msgctxt "error_log"
1900
+ msgid "mla_parse_xml_string set option failed."
1901
  msgstr ""
1902
 
1903
+ #: includes/class-mla-data.php:3662
1904
  #: includes/class-mla-settings-custom-fields-tab.php:810
1905
  #: includes/class-mla-settings-custom-fields-tab.php:1520
1906
  #: includes/class-mla-settings-iptc-exif-tab.php:893
1907
  #: includes/class-mla-settings-iptc-exif-tab.php:1626
1908
+ #: includes/class-mla-settings-iptc-exif-tab.php:2439
1909
  #: includes/class-mla-settings-view-tab.php:398
1910
  #: includes/class-mla-settings-view-tab.php:796
1911
  #: includes/class-mla-settings-view-tab.php:812
1913
  msgid "Yes"
1914
  msgstr ""
1915
 
1916
+ #: includes/class-mla-data.php:3664
1917
  #: includes/class-mla-settings-custom-fields-tab.php:811
1918
  #: includes/class-mla-settings-custom-fields-tab.php:1522
1919
  #: includes/class-mla-settings-iptc-exif-tab.php:894
1920
  #: includes/class-mla-settings-iptc-exif-tab.php:1628
1921
+ #: includes/class-mla-settings-iptc-exif-tab.php:2439
1922
  #: includes/class-mla-settings-view-tab.php:397
1923
  #: includes/class-mla-settings-view-tab.php:798
1924
  #: includes/class-mla-settings-view-tab.php:814
1926
  msgid "No"
1927
  msgstr ""
1928
 
1929
+ #: includes/class-mla-data.php:3912 includes/class-mla-data.php:4029
1930
  #, php-format
1931
  msgid "Deleting %1$s"
1932
  msgstr ""
1933
 
1934
+ #: includes/class-mla-data.php:3915
1935
  #, php-format
1936
  msgid "%1$s: meta:%2$s not found"
1937
  msgstr ""
1938
 
1939
+ #: includes/class-mla-data.php:3924 includes/class-mla-data.php:4040
1940
+ #: includes/class-mla-data.php:4052
1941
  #, php-format
1942
  msgid "Adding %1$s = %2$s"
1943
  msgstr ""
1944
 
1945
+ #: includes/class-mla-data.php:3928
1946
  #, php-format
1947
  msgid "%1$s: Adding meta:%2$s; not found"
1948
  msgstr ""
1949
 
1950
+ #: includes/class-mla-data.php:3935
1951
  #, php-format
1952
  msgid "Deleting Null meta:%1$s"
1953
  msgstr ""
1954
 
1955
+ #: includes/class-mla-data.php:3945 includes/class-mla-data.php:4121
1956
+ #: includes/class-mla-data.php:4187 includes/class-mla-data.php:4213
1957
+ #: includes/class-mla-data.php:4256 includes/class-mla-data.php:4269
1958
+ #: includes/class-mla-data.php:4278 includes/class-mla-data.php:4289
1959
+ #: includes/class-mla-data.php:4300 includes/class-mla-data.php:4313
1960
+ #: includes/class-mla-data.php:4322 includes/class-mla-data.php:4331
1961
+ #: includes/class-mla-data.php:4340 includes/class-mla-data.php:4349
1962
  #: includes/class-mla-mime-types.php:1284
1963
  #: includes/class-mla-mime-types.php:2404
1964
  #, php-format
1965
  msgid "Changing %1$s from \"%2$s\" to \"%3$s\""
1966
  msgstr ""
1967
 
1968
+ #: includes/class-mla-data.php:3950
1969
  #, php-format
1970
  msgid "%1$s: Changing meta:%2$s; not found"
1971
  msgstr ""
1972
 
1973
+ #: includes/class-mla-data.php:4076
1974
  #, php-format
1975
  msgid "Deleting old %1$s values"
1976
  msgstr ""
1977
 
1978
+ #: includes/class-mla-data.php:4106
1979
  #, php-format
1980
  msgid "Changing %1$s from \"%2$s\" to \"%3$s\"; %4$d updates"
1981
  msgstr ""
1982
 
1983
+ #: includes/class-mla-data.php:4164
1984
  msgid "Could not retrieve Attachment."
1985
  msgstr ""
1986
 
1987
+ #: includes/class-mla-data.php:4210
1988
  #, php-format
1989
  msgid "%1$s: Could not change Name/Slug \"%2$s\"; name already exists"
1990
  msgstr ""
1991
 
1992
+ #: includes/class-mla-data.php:4240
1993
  #, php-format
1994
  msgid "Deleting ALT Text, was \"%1$s\""
1995
  msgstr ""
1996
 
1997
+ #: includes/class-mla-data.php:4243
1998
  #, php-format
1999
  msgid "%1$s: Could not delete ALT Text, remains \"%2$s\""
2000
  msgstr ""
2001
 
2002
+ #: includes/class-mla-data.php:4259
2003
  #, php-format
2004
  msgid "%1$s: Could not change ALT Text from \"%2$s\" to \"%3$s\""
2005
  msgstr ""
2006
 
2007
+ #: includes/class-mla-data.php:4289 includes/class-mla-list-table.php:1047
2008
  #: includes/class-mla-list-table.php:1050
2009
  #: includes/class-mla-list-table.php:1053
2010
+ #: includes/class-mla-list-table.php:1121 includes/class-mla-options.php:2151
2011
  #: includes/class-mla-settings-iptc-exif-tab.php:484
2012
  #: includes/class-mla-settings-iptc-exif-tab.php:863
2013
  msgid "Parent"
2014
  msgstr ""
2015
 
2016
+ #: includes/class-mla-data.php:4300 includes/class-mla-edit-media.php:816
2017
  #: includes/class-mla-edit-media.php:1021 includes/class-mla-main.php:2353
2018
  #: includes/class-mla-settings-view-tab.php:130
2019
  #: includes/class-mla-settings-view-tab.php:386
2020
  msgid "Menu Order"
2021
  msgstr ""
2022
 
2023
+ #: includes/class-mla-data.php:4313 includes/class-mla-edit-media.php:447
2024
  #: includes/class-mla-list-table.php:1501
2025
  #: includes/class-mla-list-table.php:1504 includes/class-mla-main.php:2156
2026
  #: includes/class-mla-main.php:2312
2027
  msgid "Author"
2028
  msgstr ""
2029
 
2030
+ #: includes/class-mla-data.php:4322 includes/class-mla-edit-media.php:472
2031
  #: includes/class-mla-main.php:2365
2032
  msgid "Comments"
2033
  msgstr ""
2034
 
2035
+ #: includes/class-mla-data.php:4331 includes/class-mla-edit-media.php:473
2036
  #: includes/class-mla-main.php:2366
2037
  msgid "Pings"
2038
  msgstr ""
2039
 
2040
+ #: includes/class-mla-data.php:4376
2041
  #, php-format
2042
  msgid "You cannot assign \"%1$s\" terms"
2043
  msgstr ""
2044
 
2045
+ #: includes/class-mla-data.php:4388
2046
  msgctxt "tag delimiter"
2047
  msgid ","
2048
  msgstr ""
2049
 
2050
+ #: includes/class-mla-data.php:4421
2051
  msgid "Adding"
2052
  msgstr ""
2053
 
2054
+ #: includes/class-mla-data.php:4426
2055
  msgid "Removing"
2056
  msgstr ""
2057
 
2058
+ #: includes/class-mla-data.php:4435
2059
  msgid "Replacing"
2060
  msgstr ""
2061
 
2062
+ #: includes/class-mla-data.php:4443
2063
  msgid "Ignoring"
2064
  msgstr ""
2065
 
2066
+ #: includes/class-mla-data.php:4456
2067
  #, php-format
2068
  msgid "%1$s \"%2$s\" terms"
2069
  msgstr ""
2070
 
2071
+ #: includes/class-mla-data.php:4468 includes/class-mla-main.php:1384
2072
  #, php-format
2073
  msgid "Item %1$d, no changes detected."
2074
  msgstr ""
2075
 
2076
+ #: includes/class-mla-data.php:4498
2077
  #, php-format
2078
  msgid "Item %1$d updated."
2079
  msgstr ""
2080
 
2081
+ #: includes/class-mla-data.php:4512
2082
  #, php-format
2083
  msgid "%1$s: Item %2$d update failed."
2084
  msgstr ""
2086
  #: includes/class-mla-edit-media.php:129 includes/class-mla-edit-media.php:183
2087
  #: includes/class-mla-edit-media.php:236 includes/class-mla-main.php:468
2088
  #: includes/class-mla-main.php:1139 includes/class-mla-main.php:1908
2089
+ #: includes/class-mla-media-modal.php:268 includes/class-mla-options.php:1649
2090
  #: includes/class-mla-polylang-support.php:378
2091
  #: includes/class-mla-settings-custom-fields-tab.php:59
2092
  #: includes/class-mla-settings-custom-fields-tab.php:94
2166
  #: includes/class-mla-settings-iptc-exif-tab.php:478
2167
  #: includes/class-mla-settings-iptc-exif-tab.php:860
2168
  #: includes/class-mla-settings-iptc-exif-tab.php:1567
2169
+ #: includes/class-mla-settings-iptc-exif-tab.php:2420
2170
  msgid "Replace"
2171
  msgstr ""
2172
 
2277
  #: includes/class-mla-settings-upload-tab.php:545
2278
  #: includes/class-mla-settings-view-tab.php:135
2279
  #: includes/class-mla-settings-view-tab.php:393
2280
+ #: includes/class-mla-thumbnail-generation.php:655
2281
  msgid "Cancel"
2282
  msgstr ""
2283
 
2425
  msgstr ""
2426
 
2427
  #: includes/class-mla-list-table.php:748 includes/class-mla-main.php:2342
2428
+ #: includes/class-mla-options.php:1242
2429
  #: includes/class-mla-settings-custom-fields-tab.php:472
2430
  #: includes/class-mla-settings-custom-fields-tab.php:772
2431
  #: includes/class-mla-settings-custom-fields-tab.php:1352
2534
  msgstr ""
2535
 
2536
  #: includes/class-mla-list-table.php:1965
2537
+ #: includes/mla-media-modal-js-template.php:89
2538
  msgid "Terms Search"
2539
  msgstr ""
2540
 
2541
  #: includes/class-mla-list-table.php:1970
2542
  #: includes/class-mla-polylang-support.php:2072
2543
+ #: includes/class-mla-thumbnail-generation.php:654
2544
  msgid "Clear Filter-by"
2545
  msgstr ""
2546
 
2735
  msgstr ""
2736
 
2737
  #: includes/class-mla-main.php:2042
2738
+ #: includes/class-mla-shortcode-support.php:1182
2739
  msgid "Unattached"
2740
  msgstr ""
2741
 
2742
+ #: includes/class-mla-main.php:2361 includes/class-mla-options.php:1256
2743
  #: includes/class-mla-settings-custom-fields-tab.php:475
2744
  #: includes/class-mla-settings-custom-fields-tab.php:775
2745
  #: includes/class-mla-settings-custom-fields-tab.php:1466
2865
  msgid "Exact"
2866
  msgstr ""
2867
 
2868
+ #: includes/class-mla-media-modal.php:659
2869
+ msgid "Whole Word"
2870
+ msgstr ""
2871
+
2872
  #: includes/class-mla-mime-types.php:445
2873
  msgctxt "post_mime_types"
2874
  msgid "Manage"
3019
  msgstr ""
3020
 
3021
  #: includes/class-mla-mime-types.php:1686
3022
+ #: includes/class-mla-settings-documentation-tab.php:1579
3023
  msgctxt "table_view_singular"
3024
  msgid "Active"
3025
  msgstr ""
3026
 
3027
  #: includes/class-mla-mime-types.php:1687
3028
+ #: includes/class-mla-settings-documentation-tab.php:1580
3029
  msgctxt "table_view_plural"
3030
  msgid "Active"
3031
  msgstr ""
3032
 
3033
  #: includes/class-mla-mime-types.php:1690
3034
+ #: includes/class-mla-settings-documentation-tab.php:1583
3035
  msgctxt "table_view_singular"
3036
  msgid "Inactive"
3037
  msgstr ""
3038
 
3039
  #: includes/class-mla-mime-types.php:1691
3040
+ #: includes/class-mla-settings-documentation-tab.php:1584
3041
  msgctxt "table_view_plural"
3042
  msgid "Inactive"
3043
  msgstr ""
3063
  msgstr ""
3064
 
3065
  #: includes/class-mla-mime-types.php:1702
3066
+ #: includes/class-mla-settings-iptc-exif-tab.php:2740
3067
  msgctxt "table_view_singular"
3068
  msgid "Custom"
3069
  msgstr ""
3070
 
3071
  #: includes/class-mla-mime-types.php:1703
3072
+ #: includes/class-mla-settings-iptc-exif-tab.php:2741
3073
  msgctxt "table_view_plural"
3074
  msgid "Custom"
3075
  msgstr ""
3258
  msgid "Add .textwidget div tags"
3259
  msgstr ""
3260
 
3261
+ #: includes/class-mla-options.php:63
3262
  msgid "error loading tpls/mla-option-templates.tpl"
3263
  msgstr ""
3264
 
3265
+ #: includes/class-mla-options.php:66
3266
  msgid "tpls/mla-option-templates.tpl not found"
3267
  msgstr ""
3268
 
3269
+ #: includes/class-mla-options.php:218 includes/class-mla-options.php:434
3270
+ #: includes/class-mla-options.php:515 includes/class-mla-options.php:570
3271
  #, php-format
3272
  msgid "%1$s: Custom %2$s unknown action \"%3$s\""
3273
  msgstr ""
3274
 
3275
+ #: includes/class-mla-options.php:320
3276
  msgid "Custom Field"
3277
  msgstr ""
3278
 
3279
+ #: includes/class-mla-options.php:332
3280
  msgid "Support"
3281
  msgstr ""
3282
 
3283
+ #: includes/class-mla-options.php:333
3284
  msgid "Inline Edit"
3285
  msgstr ""
3286
 
3287
+ #: includes/class-mla-options.php:334
3288
  msgid "Term Search"
3289
  msgstr ""
3290
 
3291
+ #: includes/class-mla-options.php:335
3292
  msgid "Checklist"
3293
  msgstr ""
3294
 
3295
+ #: includes/class-mla-options.php:336
3296
  msgid "Checked On Top"
3297
  msgstr ""
3298
 
3299
+ #: includes/class-mla-options.php:337
3300
  msgid "Inline Add Term"
3301
  msgstr ""
3302
 
3303
+ #: includes/class-mla-options.php:338
3304
  msgid "List Filter"
3305
  msgstr ""
3306
 
3307
+ #: includes/class-mla-options.php:339
3308
  msgid "Taxonomy"
3309
  msgstr ""
3310
 
3311
+ #: includes/class-mla-options.php:361
3312
  #, php-format
3313
  msgid "List Filter ignored; %1$s not supported."
3314
  msgstr ""
3315
 
3316
+ #: includes/class-mla-options.php:368
3317
  #, php-format
3318
  msgid "Inline Edit ignored; %1$s not supported."
3319
  msgstr ""
3320
 
3321
+ #: includes/class-mla-options.php:376
3322
  #, php-format
3323
  msgid "Term Search ignored; %1$s not supported."
3324
  msgstr ""
3325
 
3326
+ #: includes/class-mla-options.php:386
3327
  #, php-format
3328
  msgid "Checklist ignored; %1$s not supported."
3329
  msgstr ""
3330
 
3331
+ #: includes/class-mla-options.php:394
3332
  #, php-format
3333
  msgid "Checked On Top ignored; %1$s not supported."
3334
  msgstr ""
3335
 
3336
+ #: includes/class-mla-options.php:403
3337
  #, php-format
3338
  msgid "Inline Add Term ignored; %1$s not supported."
3339
  msgstr ""
3340
 
3341
+ #: includes/class-mla-options.php:424 includes/class-mla-options.php:505
3342
+ #: includes/class-mla-options.php:560
3343
  #, php-format
3344
  msgid "Update custom %1$s"
3345
  msgstr ""
3346
 
3347
+ #: includes/class-mla-options.php:431 includes/class-mla-options.php:512
3348
+ #: includes/class-mla-options.php:567
3349
  #, php-format
3350
  msgid "Reset custom %1$s"
3351
  msgstr ""
3352
 
3353
+ #: includes/class-mla-options.php:462
3354
  #: includes/mla-main-search-box-template.php:60
3355
+ #: includes/mla-media-modal-js-template.php:49
3356
  msgid "and"
3357
  msgstr ""
3358
 
3359
+ #: includes/class-mla-options.php:464
3360
  #: includes/mla-main-search-box-template.php:61
3361
+ #: includes/mla-media-modal-js-template.php:53
3362
  msgid "or"
3363
  msgstr ""
3364
 
3365
+ #: includes/class-mla-options.php:469
3366
  #: includes/class-mla-settings-custom-fields-tab.php:455
3367
  #: includes/class-mla-settings-custom-fields-tab.php:759
3368
  #: includes/class-mla-settings-iptc-exif-tab.php:455
3370
  #: includes/class-mla-settings-shortcodes-tab.php:401
3371
  #: includes/class-mla-settings-shortcodes-tab.php:472
3372
  #: includes/mla-main-search-box-template.php:49
3373
+ #: includes/mla-media-modal-js-template.php:61
3374
  msgid "Name"
3375
  msgstr ""
3376
 
3377
+ #: includes/class-mla-options.php:481
3378
  #: includes/mla-main-search-box-template.php:57
3379
+ #: includes/mla-media-modal-js-template.php:78
3380
  msgid "File"
3381
  msgstr ""
3382
 
3383
+ #: includes/class-mla-options.php:484
3384
  #: includes/mla-main-search-box-template.php:58
3385
+ #: includes/mla-media-modal-js-template.php:83
3386
  msgid "Terms"
3387
  msgstr ""
3388
 
3389
+ #: includes/class-mla-options.php:999 includes/class-mla-options.php:1045
3390
+ #: includes/class-mla-options.php:1889 includes/class-mla-options.php:1920
3391
+ #: includes/class-mla-options.php:1925
3392
  #: includes/class-mla-settings-upload-tab.php:128
3393
  msgid "None (select a value)"
3394
  msgstr ""
3395
 
3396
+ #: includes/class-mla-options.php:1052
3397
  msgid "Metadata (see below)"
3398
  msgstr ""
3399
 
3400
+ #: includes/class-mla-options.php:1059
3401
  msgid "Template (see below)"
3402
  msgstr ""
3403
 
3404
+ #: includes/class-mla-options.php:1131 includes/class-mla-options.php:2207
3405
  #, php-format
3406
  msgid "%1$s: New field %2$s already exists."
3407
  msgstr ""
3408
 
3409
+ #: includes/class-mla-options.php:1136 includes/class-mla-options.php:2212
3410
  #, php-format
3411
  msgid "Adding new field %1$s."
3412
  msgstr ""
3413
 
3414
+ #: includes/class-mla-options.php:1144 includes/class-mla-options.php:2220
3415
  #, php-format
3416
  msgid "Adding new rule for %1$s."
3417
  msgstr ""
3418
 
3419
+ #: includes/class-mla-options.php:1170 includes/class-mla-options.php:2077
3420
+ #: includes/class-mla-options.php:2246
3421
  #, php-format
3422
  msgid "Deleting rule for %1$s."
3423
  msgstr ""
3424
 
3425
+ #: includes/class-mla-options.php:1193 includes/class-mla-options.php:1214
3426
+ #: includes/class-mla-options.php:1264 includes/class-mla-options.php:1271
3427
+ #: includes/class-mla-options.php:1993 includes/class-mla-options.php:2000
3428
+ #: includes/class-mla-options.php:2007 includes/class-mla-options.php:2102
3429
+ #: includes/class-mla-options.php:2109 includes/class-mla-options.php:2144
3430
+ #: includes/class-mla-options.php:2151 includes/class-mla-options.php:2256
3431
+ #: includes/class-mla-options.php:2263 includes/class-mla-options.php:2298
3432
+ #: includes/class-mla-options.php:2305
3433
  #, php-format
3434
  msgid "%1$s changing %2$s from %3$s to %4$s."
3435
  msgstr ""
3436
 
3437
+ #: includes/class-mla-options.php:1193
3438
  #: includes/class-mla-settings-custom-fields-tab.php:463
3439
  #: includes/class-mla-settings-custom-fields-tab.php:763
3440
  msgid "Data Source"
3441
  msgstr ""
3442
 
3443
+ #: includes/class-mla-options.php:1199 includes/class-mla-options.php:2027
3444
+ #: includes/class-mla-options.php:2129 includes/class-mla-options.php:2283
3445
  msgid "Replace to Keep"
3446
  msgstr ""
3447
 
3448
+ #: includes/class-mla-options.php:1202 includes/class-mla-options.php:2030
3449
+ #: includes/class-mla-options.php:2132 includes/class-mla-options.php:2286
3450
  msgid "Keep to Replace"
3451
  msgstr ""
3452
 
3453
+ #: includes/class-mla-options.php:1207 includes/class-mla-options.php:1228
3454
+ #: includes/class-mla-options.php:1242 includes/class-mla-options.php:1256
3455
+ #: includes/class-mla-options.php:1285 includes/class-mla-options.php:2021
3456
+ #: includes/class-mla-options.php:2035 includes/class-mla-options.php:2123
3457
+ #: includes/class-mla-options.php:2137 includes/class-mla-options.php:2277
3458
+ #: includes/class-mla-options.php:2291 includes/class-mla-options.php:2319
3459
  #, php-format
3460
  msgid "%1$s changing %2$s value from %3$s."
3461
  msgstr ""
3462
 
3463
+ #: includes/class-mla-options.php:1207 includes/class-mla-options.php:2035
3464
+ #: includes/class-mla-options.php:2137 includes/class-mla-options.php:2291
3465
  #: includes/class-mla-settings-custom-fields-tab.php:477
3466
  #: includes/class-mla-settings-custom-fields-tab.php:777
3467
  #: includes/class-mla-settings-iptc-exif-tab.php:474
3469
  msgid "Existing Text"
3470
  msgstr ""
3471
 
3472
+ #: includes/class-mla-options.php:1214 includes/class-mla-options.php:2298
3473
  #: includes/class-mla-settings-custom-fields-tab.php:482
3474
  #: includes/class-mla-settings-custom-fields-tab.php:782
3475
  #: includes/class-mla-settings-iptc-exif-tab.php:489
3477
  msgid "Format"
3478
  msgstr ""
3479
 
3480
+ #: includes/class-mla-options.php:1220 includes/class-mla-options.php:1234
3481
+ #: includes/class-mla-options.php:1248 includes/class-mla-options.php:1277
3482
+ #: includes/class-mla-options.php:2311
3483
  msgid "unchecked to checked"
3484
  msgstr ""
3485
 
3486
+ #: includes/class-mla-options.php:1223 includes/class-mla-options.php:1237
3487
+ #: includes/class-mla-options.php:1251 includes/class-mla-options.php:1280
3488
+ #: includes/class-mla-options.php:2314
3489
  msgid "checked to unchecked"
3490
  msgstr ""
3491
 
3492
+ #: includes/class-mla-options.php:1228
3493
  #: includes/class-mla-settings-custom-fields-tab.php:469
3494
  #: includes/class-mla-settings-custom-fields-tab.php:769
3495
  #: includes/class-mla-settings-custom-fields-tab.php:1458
3496
  msgid "MLA Column"
3497
  msgstr ""
3498
 
3499
+ #: includes/class-mla-options.php:1264
3500
  msgid "Metavalue name"
3501
  msgstr ""
3502
 
3503
+ #: includes/class-mla-options.php:1271 includes/class-mla-options.php:2305
3504
  #: includes/class-mla-settings-custom-fields-tab.php:489
3505
  #: includes/class-mla-settings-custom-fields-tab.php:789
3506
  #: includes/class-mla-settings-iptc-exif-tab.php:496
3508
  msgid "Option"
3509
  msgstr ""
3510
 
3511
+ #: includes/class-mla-options.php:1285 includes/class-mla-options.php:2319
3512
  #: includes/class-mla-settings-iptc-exif-tab.php:508
3513
  msgid "Delete NULL values"
3514
  msgstr ""
3515
 
3516
+ #: includes/class-mla-options.php:1981
3517
  #, php-format
3518
  msgid "%1$s: No old values for %2$s."
3519
  msgstr ""
3520
 
3521
+ #: includes/class-mla-options.php:1993
3522
  msgid "Field Title"
3523
  msgstr ""
3524
 
3525
+ #: includes/class-mla-options.php:2000 includes/class-mla-options.php:2102
3526
+ #: includes/class-mla-options.php:2256
3527
  #: includes/class-mla-settings-iptc-exif-tab.php:463
3528
  #: includes/class-mla-settings-iptc-exif-tab.php:845
3529
  msgid "IPTC Value"
3530
  msgstr ""
3531
 
3532
+ #: includes/class-mla-options.php:2007 includes/class-mla-options.php:2109
3533
+ #: includes/class-mla-options.php:2263
3534
  msgid "EXIF Value"
3535
  msgstr ""
3536
 
3537
+ #: includes/class-mla-options.php:2013 includes/class-mla-options.php:2115
3538
+ #: includes/class-mla-options.php:2269
3539
  msgid "EXIF to IPTC"
3540
  msgstr ""
3541
 
3542
+ #: includes/class-mla-options.php:2016 includes/class-mla-options.php:2118
3543
+ #: includes/class-mla-options.php:2272
3544
  msgid "IPTC to EXIF"
3545
  msgstr ""
3546
 
3547
+ #: includes/class-mla-options.php:2021 includes/class-mla-options.php:2123
3548
+ #: includes/class-mla-options.php:2277
3549
  #: includes/class-mla-settings-iptc-exif-tab.php:469
3550
  #: includes/class-mla-settings-iptc-exif-tab.php:851
3551
  msgid "Priority"
3552
  msgstr ""
3553
 
3554
+ #: includes/class-mla-options.php:2144
3555
  msgid "Delimiter(s)"
3556
  msgstr ""
3557
 
3618
  msgstr ""
3619
 
3620
  #: includes/class-mla-polylang-support.php:2071
3621
+ #: includes/class-mla-thumbnail-generation.php:653
3622
  msgid "Options"
3623
  msgstr ""
3624
 
3974
  #: includes/class-mla-settings-iptc-exif-tab.php:476
3975
  #: includes/class-mla-settings-iptc-exif-tab.php:858
3976
  #: includes/class-mla-settings-iptc-exif-tab.php:1565
3977
+ #: includes/class-mla-settings-iptc-exif-tab.php:2420
3978
+ #: includes/class-mla-thumbnail-generation.php:647
3979
  msgid "Keep"
3980
  msgstr ""
3981
 
4052
  #: includes/class-mla-settings-custom-fields-tab.php:805
4053
  #: includes/class-mla-settings-custom-fields-tab.php:1488
4054
  #: includes/class-mla-settings-custom-fields-tab.php:1711
4055
+ #: includes/class-mla-settings-documentation-tab.php:1249
4056
  #: includes/class-mla-settings-iptc-exif-tab.php:513
4057
  #: includes/class-mla-settings-iptc-exif-tab.php:887
4058
  #: includes/class-mla-settings-iptc-exif-tab.php:1581
4059
  #: includes/class-mla-settings-iptc-exif-tab.php:1817
4060
+ #: includes/class-mla-settings-iptc-exif-tab.php:2423
4061
  #: includes/class-mla-settings-upload-tab.php:550
4062
  #: includes/class-mla-settings-upload-tab.php:1031
4063
  msgid "Active"
4067
  #: includes/class-mla-settings-custom-fields-tab.php:807
4068
  #: includes/class-mla-settings-custom-fields-tab.php:1490
4069
  #: includes/class-mla-settings-custom-fields-tab.php:1714
4070
+ #: includes/class-mla-settings-documentation-tab.php:1251
4071
  #: includes/class-mla-settings-iptc-exif-tab.php:515
4072
  #: includes/class-mla-settings-iptc-exif-tab.php:889
4073
  #: includes/class-mla-settings-iptc-exif-tab.php:1583
4074
  #: includes/class-mla-settings-iptc-exif-tab.php:1820
4075
+ #: includes/class-mla-settings-iptc-exif-tab.php:2423
4076
  #: includes/class-mla-settings-upload-tab.php:172
4077
  #: includes/class-mla-settings-upload-tab.php:536
4078
  #: includes/class-mla-settings-upload-tab.php:1029
4325
  msgstr ""
4326
 
4327
  #: includes/class-mla-settings-custom-fields-tab.php:2476
4328
+ #: includes/class-mla-settings-iptc-exif-tab.php:2744
4329
  msgctxt "table_view_singular"
4330
  msgid "Read Only"
4331
  msgstr ""
4332
 
4333
  #: includes/class-mla-settings-custom-fields-tab.php:2477
4334
+ #: includes/class-mla-settings-iptc-exif-tab.php:2745
4335
  msgctxt "table_view_plural"
4336
  msgid "Read Only"
4337
  msgstr ""
4338
 
4339
  #: includes/class-mla-settings-documentation-tab.php:82
4340
  #: includes/class-mla-settings-documentation-tab.php:974
4341
+ #: includes/class-mla-settings-documentation-tab.php:1061
4342
+ #: includes/class-mla-settings-documentation-tab.php:1091
4343
  #, php-format
4344
  msgid "Example plugin \"%1$s\" not found"
4345
  msgstr ""
4448
  msgid "View this item"
4449
  msgstr ""
4450
 
4451
+ #: includes/class-mla-settings-documentation-tab.php:1002
4452
  #, php-format
4453
  msgid "Example plugin \"%1$s\" fs_connect failed; no action taken. Error: %2$s"
4454
  msgstr ""
4455
 
4456
+ #: includes/class-mla-settings-documentation-tab.php:1007
4457
  #, php-format
4458
  msgid "Example plugin \"%1$s\" fs_connect failed; no action taken"
4459
  msgstr ""
4460
 
4461
+ #: includes/class-mla-settings-documentation-tab.php:1030
4462
  #, php-format
4463
  msgid ""
4464
  "Example plugin \"%1$s\" install_package failed; no action taken. Error: %2$s"
4465
  msgstr ""
4466
 
4467
+ #: includes/class-mla-settings-documentation-tab.php:1041
4468
  #, php-format
4469
  msgid "Example plugin \"%1$s\" remove old single file failed."
4470
  msgstr ""
4471
 
4472
+ #: includes/class-mla-settings-documentation-tab.php:1066
4473
  #, php-format
4474
  msgid "Example plugin \"%1$s\" already installed; no action taken"
4475
  msgstr ""
4476
 
4477
+ #: includes/class-mla-settings-documentation-tab.php:1072
4478
  #, php-format
4479
  msgid "Example plugin \"%1$s\" installed"
4480
  msgstr ""
4481
 
4482
+ #: includes/class-mla-settings-documentation-tab.php:1096
4483
  #, php-format
4484
  msgid "Example plugin \"%1$s\" not installed; no action taken"
4485
  msgstr ""
4486
 
4487
+ #: includes/class-mla-settings-documentation-tab.php:1102
4488
  #, php-format
4489
  msgid "Example plugin \"%1$s\" updated"
4490
  msgstr ""
4491
 
4492
+ #: includes/class-mla-settings-documentation-tab.php:1247
4493
  msgid "Network"
4494
  msgstr ""
4495
 
4496
+ #: includes/class-mla-settings-documentation-tab.php:1575
4497
  msgctxt "table_view_singular"
4498
  msgid "Installed"
4499
  msgstr ""
4500
 
4501
+ #: includes/class-mla-settings-documentation-tab.php:1576
4502
  msgctxt "table_view_plural"
4503
  msgid "Installed"
4504
  msgstr ""
4505
 
4506
+ #: includes/class-mla-settings-documentation-tab.php:1587
4507
  msgctxt "table_view_singular"
4508
  msgid "Network"
4509
  msgstr ""
4510
 
4511
+ #: includes/class-mla-settings-documentation-tab.php:1588
4512
  msgctxt "table_view_plural"
4513
  msgid "Network"
4514
  msgstr ""
4515
 
4516
+ #: includes/class-mla-settings-documentation-tab.php:1591
4517
  msgctxt "table_view_singular"
4518
  msgid "Uninstalled"
4519
  msgstr ""
4520
 
4521
+ #: includes/class-mla-settings-documentation-tab.php:1592
4522
  msgctxt "table_view_plural"
4523
  msgid "Uninstalled"
4524
  msgstr ""
4630
  msgid "Purge IPTC EXIF values"
4631
  msgstr ""
4632
 
4633
+ #: includes/class-mla-settings-iptc-exif-tab.php:2732
4634
  msgctxt "table_view_singular"
4635
  msgid "Standard"
4636
  msgstr ""
4637
 
4638
+ #: includes/class-mla-settings-iptc-exif-tab.php:2733
4639
  msgctxt "table_view_plural"
4640
  msgid "Standard"
4641
  msgstr ""
4642
 
4643
+ #: includes/class-mla-settings-iptc-exif-tab.php:2736
4644
  msgctxt "table_view_singular"
4645
  msgid "Taxonomy"
4646
  msgstr ""
4647
 
4648
+ #: includes/class-mla-settings-iptc-exif-tab.php:2737
4649
  msgctxt "table_view_plural"
4650
  msgid "Taxonomy"
4651
  msgstr ""
4895
  msgstr ""
4896
 
4897
  #: includes/class-mla-settings-shortcodes-tab.php:1285
4898
+ #: includes/class-mla-thumbnail-generation.php:650
4899
  msgid "Delete"
4900
  msgstr ""
4901
 
5542
  msgid "Settings imported; %1$s updated, %2$s unchanged."
5543
  msgstr ""
5544
 
5545
+ #: includes/class-mla-shortcode-support.php:510
5546
+ #: includes/class-mla-shortcode-support.php:1942
5547
+ #: includes/class-mla-shortcode-support.php:3975
5548
+ #: includes/class-mla-shortcode-support.php:4257
5549
  msgid "Previous"
5550
  msgstr ""
5551
 
5552
+ #: includes/class-mla-shortcode-support.php:511
5553
+ #: includes/class-mla-shortcode-support.php:1943
5554
+ #: includes/class-mla-shortcode-support.php:4024
5555
+ #: includes/class-mla-shortcode-support.php:4263
5556
  msgid "Next"
5557
  msgstr ""
5558
 
5559
+ #: includes/class-mla-shortcode-support.php:582
5560
+ #: includes/class-mla-shortcode-support.php:588
5561
+ #: includes/class-mla-shortcode-support.php:2081
5562
+ #: includes/class-mla-shortcode-support.php:2088
5563
+ #: includes/class-mla-shortcode-support.php:3401
5564
+ #: includes/class-mla-shortcode-support.php:3408
5565
  #: includes/class-mla-template-support.php:598
5566
  msgid "not found"
5567
  msgstr ""
5568
 
5569
+ #: includes/class-mla-shortcode-support.php:612
5570
+ #: includes/class-mla-shortcode-support.php:2073
5571
+ #: includes/class-mla-shortcode-support.php:3393
5572
  msgid "mla_debug REQUEST"
5573
  msgstr ""
5574
 
5575
+ #: includes/class-mla-shortcode-support.php:616
5576
+ #: includes/class-mla-shortcode-support.php:618
5577
  msgid "mla_debug attributes_errors"
5578
  msgstr ""
5579
 
5580
+ #: includes/class-mla-shortcode-support.php:624
5581
+ #: includes/class-mla-shortcode-support.php:2074
5582
+ #: includes/class-mla-shortcode-support.php:3394
5583
  msgid "mla_debug attributes"
5584
  msgstr ""
5585
 
5586
+ #: includes/class-mla-shortcode-support.php:625
5587
+ #: includes/class-mla-shortcode-support.php:2075
5588
+ #: includes/class-mla-shortcode-support.php:3395
5589
  msgid "mla_debug arguments"
5590
  msgstr ""
5591
 
5592
+ #: includes/class-mla-shortcode-support.php:717
5593
  msgid "mla_debug empty gallery"
5594
  msgstr ""
5595
 
5596
+ #: includes/class-mla-shortcode-support.php:738
5597
  msgid ""
5598
  "<strong>Photonic-enhanced [mla_gallery]</strong> type must be "
5599
  "<strong>default</strong>, query = "
5600
  msgstr ""
5601
 
5602
+ #: includes/class-mla-shortcode-support.php:1206
5603
  msgid "unknown"
5604
  msgstr ""
5605
 
5606
+ #: includes/class-mla-shortcode-support.php:2206
5607
  msgid "mla_debug empty cloud"
5608
  msgstr ""
5609
 
5610
+ #: includes/class-mla-shortcode-support.php:3529
5611
  msgid "mla_debug empty list"
5612
  msgstr ""
5613
 
5614
+ #: includes/class-mla-shortcode-support.php:3552
5615
  msgid "no-terms"
5616
  msgstr ""
5617
 
5618
+ #: includes/class-mla-shortcode-support.php:4790
5619
+ #: includes/class-mla-shortcode-support.php:5211
5620
+ #: includes/class-mla-shortcode-support.php:5256
5621
  msgid "Invalid mla_gallery"
5622
  msgstr ""
5623
 
5624
+ #: includes/class-mla-shortcode-support.php:5537
5625
  msgid "mla_debug query"
5626
  msgstr ""
5627
 
5628
+ #: includes/class-mla-shortcode-support.php:5538
5629
  msgid "mla_debug request"
5630
  msgstr ""
5631
 
5632
+ #: includes/class-mla-shortcode-support.php:5539
5633
  msgid "mla_debug query_vars"
5634
  msgstr ""
5635
 
5636
+ #: includes/class-mla-shortcode-support.php:5540
5637
  msgid "mla_debug post_count"
5638
  msgstr ""
5639
 
5640
+ #: includes/class-mla-shortcode-support.php:5564
5641
  msgid "mla_debug JOIN filter"
5642
  msgstr ""
5643
 
5644
+ #: includes/class-mla-shortcode-support.php:5604
5645
  msgid "mla_debug modified JOIN filter"
5646
  msgstr ""
5647
 
5648
+ #: includes/class-mla-shortcode-support.php:5629
5649
  msgid "mla_debug WHERE filter"
5650
  msgstr ""
5651
 
5652
+ #: includes/class-mla-shortcode-support.php:5653
5653
  msgid "mla_debug modified WHERE filter"
5654
  msgstr ""
5655
 
5656
+ #: includes/class-mla-shortcode-support.php:5676
5657
  msgid "mla_debug ORDER BY filter, incoming"
5658
  msgstr ""
5659
 
5660
+ #: includes/class-mla-shortcode-support.php:5676
5661
  msgid "Replacement ORDER BY clause"
5662
  msgstr ""
5663
 
5664
+ #: includes/class-mla-shortcode-support.php:5699
5665
  msgid "mla_debug posts_clauses filter"
5666
  msgstr ""
5667
 
5668
+ #: includes/class-mla-shortcode-support.php:5717
5669
  msgid "mla_debug posts_clauses_request filter"
5670
  msgstr ""
5671
 
5672
+ #: includes/class-mla-shortcode-support.php:5931
5673
  msgid "Invalid taxonomy"
5674
  msgstr ""
5675
 
5676
+ #: includes/class-mla-shortcode-support.php:6111
5677
  msgid "mla_debug query arguments"
5678
  msgstr ""
5679
 
5680
+ #: includes/class-mla-shortcode-support.php:6112
5681
  msgid "mla_debug last_query"
5682
  msgstr ""
5683
 
5684
+ #: includes/class-mla-shortcode-support.php:6113
5685
  msgid "mla_debug last_error"
5686
  msgstr ""
5687
 
5688
+ #: includes/class-mla-shortcode-support.php:6114
5689
  msgid "mla_debug num_rows"
5690
  msgstr ""
5691
 
5692
+ #: includes/class-mla-shortcode-support.php:6115
5693
  msgid "mla_debug found_rows"
5694
  msgstr ""
5695
 
5851
 
5852
  #: includes/class-mla-thumbnail-generation.php:96
5853
  #: includes/class-mla-thumbnail-generation.php:98
5854
+ #: includes/class-mla-thumbnail-generation.php:633
5855
  msgid "Generate Thumbnails"
5856
  msgstr ""
5857
 
5858
+ #: includes/class-mla-thumbnail-generation.php:387
5859
  #, php-format
5860
  msgid "Item %1$d"
5861
  msgstr ""
5862
 
5863
+ #: includes/class-mla-thumbnail-generation.php:405
5864
  msgid "has native thumbnail."
5865
  msgstr ""
5866
 
5867
+ #: includes/class-mla-thumbnail-generation.php:426
5868
  msgid "Featured Image retained."
5869
  msgstr ""
5870
 
5871
+ #: includes/class-mla-thumbnail-generation.php:434
5872
  #, php-format
5873
  msgid "%1$s: %2$sno attached file."
5874
  msgstr ""
5875
 
5876
+ #: includes/class-mla-thumbnail-generation.php:438
5877
  msgid "unsupported file type."
5878
  msgstr ""
5879
 
5880
+ #: includes/class-mla-thumbnail-generation.php:446
5881
+ #: includes/class-mla-thumbnail-generation.php:458
5882
  #, php-format
5883
  msgid "%1$s: %2$sthumbnail generation failed"
5884
  msgstr ""
5885
 
5886
+ #: includes/class-mla-thumbnail-generation.php:454
5887
  #, php-format
5888
  msgid "%1$sWordPress-style thumbnail generated."
5889
  msgstr ""
5890
 
5891
+ #: includes/class-mla-thumbnail-generation.php:502
5892
  #, php-format
5893
  msgid "%1$s: %2$swp_insert_attachment failed."
5894
  msgstr ""
5895
 
5896
+ #: includes/class-mla-thumbnail-generation.php:519
5897
  #, php-format
5898
  msgid "%1$sthumbnail generated as new item %2$s."
5899
  msgstr ""
5900
 
5901
+ #: includes/class-mla-thumbnail-generation.php:568
5902
+ #: includes/class-mla-thumbnail-generation.php:677
5903
  msgid "Generated Thumbnails"
5904
  msgstr ""
5905
 
5906
+ #: includes/class-mla-thumbnail-generation.php:623
5907
  msgid ""
5908
  "Type &ldquo;WP&rdquo; generates native WordPress thumbnails without creating "
5909
  "a separate image item."
5910
  msgstr ""
5911
 
5912
+ #: includes/class-mla-thumbnail-generation.php:634
5913
  msgid ""
5914
  "Pull down the Help menu and select Thumbnail Generation for setting details"
5915
  msgstr ""
5916
 
5917
+ #: includes/class-mla-thumbnail-generation.php:635
5918
  msgid "Width"
5919
  msgstr ""
5920
 
5921
+ #: includes/class-mla-thumbnail-generation.php:636
5922
  msgid "Height"
5923
  msgstr ""
5924
 
5925
+ #: includes/class-mla-thumbnail-generation.php:637
5926
  msgid "Best Fit"
5927
  msgstr ""
5928
 
5929
+ #: includes/class-mla-thumbnail-generation.php:638
5930
  msgid "Page"
5931
  msgstr ""
5932
 
5933
+ #: includes/class-mla-thumbnail-generation.php:639
5934
  msgid "Resolution"
5935
  msgstr ""
5936
 
5937
+ #: includes/class-mla-thumbnail-generation.php:640
5938
  msgid "Quality"
5939
  msgstr ""
5940
 
5941
+ #: includes/class-mla-thumbnail-generation.php:646
5942
  msgid "Existing Items"
5943
  msgstr ""
5944
 
5945
+ #: includes/class-mla-thumbnail-generation.php:648
5946
  msgid "Ignore"
5947
  msgstr ""
5948
 
5949
+ #: includes/class-mla-thumbnail-generation.php:651
5950
  msgid "Suffix"
5951
  msgstr ""
5952
 
5987
 
5988
  #: includes/mla-main-search-box-template.php:42
5989
  #: includes/mla-main-search-box-template.php:44
5990
+ #: includes/mla-media-modal-js-template.php:42
5991
  msgid "Search Media"
5992
  msgstr ""
5993
 
languages/media-library-assistant-en_US.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Media Library Assistant\n"
4
- "POT-Creation-Date: 2019-08-18 19:16-0700\n"
5
- "PO-Revision-Date: 2019-08-18 19:19-0700\n"
6
  "Language-Team: David Lingren <david@fairtradejudaica.org>\n"
7
  "MIME-Version: 1.0\n"
8
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -975,6 +975,28 @@ msgstr ""
975
  msgid "Search"
976
  msgstr ""
977
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
978
  #, php-format
979
  msgctxt "error_log"
980
  msgid "%1$s: _build_pdf_indirect_objects bad value at $index = \"%2$d\"."
@@ -1202,11 +1224,11 @@ msgid "%1$s: mla_get_attachment_by_id(%2$d) wrong post_type \"%3$s\"."
1202
  msgstr ""
1203
 
1204
  msgctxt "error_log"
1205
- msgid "mla_parse_xmp_metadata xml_parse_into_struct failed."
1206
  msgstr ""
1207
 
1208
  msgctxt "error_log"
1209
- msgid "mla_parse_xmp_metadata set option failed."
1210
  msgstr ""
1211
 
1212
  msgid "Yes"
@@ -1768,6 +1790,9 @@ msgstr ""
1768
  msgid "Exact"
1769
  msgstr ""
1770
 
 
 
 
1771
  msgctxt "post_mime_types"
1772
  msgid "Manage"
1773
  msgstr ""
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Media Library Assistant\n"
4
+ "POT-Creation-Date: 2020-03-31 20:12-0700\n"
5
+ "PO-Revision-Date: 2020-03-31 20:12-0700\n"
6
  "Language-Team: David Lingren <david@fairtradejudaica.org>\n"
7
  "MIME-Version: 1.0\n"
8
  "Content-Type: text/plain; charset=UTF-8\n"
975
  msgid "Search"
976
  msgstr ""
977
 
978
+ msgctxt "error_log"
979
+ msgid "mla_extract_office_metadata zip open failed."
980
+ msgstr ""
981
+
982
+ msgctxt "error_log"
983
+ msgid ""
984
+ "mla_extract_office_metadata mla_parse_xml_string( docProps/app.xml ) failed."
985
+ msgstr ""
986
+
987
+ msgctxt "error_log"
988
+ msgid "mla_extract_office_metadata locateName( docProps/app.xml ) failed."
989
+ msgstr ""
990
+
991
+ msgctxt "error_log"
992
+ msgid ""
993
+ "mla_extract_office_metadata mla_parse_xml_string( docProps/core.xml ) failed."
994
+ msgstr ""
995
+
996
+ msgctxt "error_log"
997
+ msgid "mla_extract_office_metadata locateName( docProps/core.xml ) failed."
998
+ msgstr ""
999
+
1000
  #, php-format
1001
  msgctxt "error_log"
1002
  msgid "%1$s: _build_pdf_indirect_objects bad value at $index = \"%2$d\"."
1224
  msgstr ""
1225
 
1226
  msgctxt "error_log"
1227
+ msgid "mla_parse_xml_string xml_parse_into_struct failed."
1228
  msgstr ""
1229
 
1230
  msgctxt "error_log"
1231
+ msgid "mla_parse_xml_string set option failed."
1232
  msgstr ""
1233
 
1234
  msgid "Yes"
1790
  msgid "Exact"
1791
  msgstr ""
1792
 
1793
+ msgid "Whole Word"
1794
+ msgstr ""
1795
+
1796
  msgctxt "post_mime_types"
1797
  msgid "Manage"
1798
  msgstr ""
languages/media-library-assistant-en_US.pot CHANGED
@@ -2,7 +2,7 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Media Library Assistant\n"
5
- "POT-Creation-Date: 2019-08-18 19:15-0700\n"
6
  "PO-Revision-Date: 2015-08-21 21:38-0800\n"
7
  "Last-Translator: David Lingren <david@fairtradejudaica.org>\n"
8
  "Language-Team: David Lingren <david@fairtradejudaica.org>\n"
@@ -976,6 +976,28 @@ msgstr ""
976
  msgid "Search"
977
  msgstr ""
978
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
979
  #, php-format
980
  msgctxt "error_log"
981
  msgid "%1$s: _build_pdf_indirect_objects bad value at $index = \"%2$d\"."
@@ -1203,11 +1225,11 @@ msgid "%1$s: mla_get_attachment_by_id(%2$d) wrong post_type \"%3$s\"."
1203
  msgstr ""
1204
 
1205
  msgctxt "error_log"
1206
- msgid "mla_parse_xmp_metadata xml_parse_into_struct failed."
1207
  msgstr ""
1208
 
1209
  msgctxt "error_log"
1210
- msgid "mla_parse_xmp_metadata set option failed."
1211
  msgstr ""
1212
 
1213
  msgid "Yes"
@@ -1769,6 +1791,9 @@ msgstr ""
1769
  msgid "Exact"
1770
  msgstr ""
1771
 
 
 
 
1772
  msgctxt "post_mime_types"
1773
  msgid "Manage"
1774
  msgstr ""
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Media Library Assistant\n"
5
+ "POT-Creation-Date: 2020-03-31 20:11-0700\n"
6
  "PO-Revision-Date: 2015-08-21 21:38-0800\n"
7
  "Last-Translator: David Lingren <david@fairtradejudaica.org>\n"
8
  "Language-Team: David Lingren <david@fairtradejudaica.org>\n"
976
  msgid "Search"
977
  msgstr ""
978
 
979
+ msgctxt "error_log"
980
+ msgid "mla_extract_office_metadata zip open failed."
981
+ msgstr ""
982
+
983
+ msgctxt "error_log"
984
+ msgid ""
985
+ "mla_extract_office_metadata mla_parse_xml_string( docProps/app.xml ) failed."
986
+ msgstr ""
987
+
988
+ msgctxt "error_log"
989
+ msgid "mla_extract_office_metadata locateName( docProps/app.xml ) failed."
990
+ msgstr ""
991
+
992
+ msgctxt "error_log"
993
+ msgid ""
994
+ "mla_extract_office_metadata mla_parse_xml_string( docProps/core.xml ) failed."
995
+ msgstr ""
996
+
997
+ msgctxt "error_log"
998
+ msgid "mla_extract_office_metadata locateName( docProps/core.xml ) failed."
999
+ msgstr ""
1000
+
1001
  #, php-format
1002
  msgctxt "error_log"
1003
  msgid "%1$s: _build_pdf_indirect_objects bad value at $index = \"%2$d\"."
1225
  msgstr ""
1226
 
1227
  msgctxt "error_log"
1228
+ msgid "mla_parse_xml_string xml_parse_into_struct failed."
1229
  msgstr ""
1230
 
1231
  msgctxt "error_log"
1232
+ msgid "mla_parse_xml_string set option failed."
1233
  msgstr ""
1234
 
1235
  msgid "Yes"
1791
  msgid "Exact"
1792
  msgstr ""
1793
 
1794
+ msgid "Whole Word"
1795
+ msgstr ""
1796
+
1797
  msgctxt "post_mime_types"
1798
  msgid "Manage"
1799
  msgstr ""
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: dglingren
3
  Donate link: http://davidlingren.com/#two
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: 5.3
7
  Requires PHP: 5.3
8
- Stable tag: 2.81
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -181,6 +181,26 @@ All of the MLA source code has been annotated with "DocBlocks", a special type o
181
 
182
  == Changelog ==
183
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  = 2.81 =
185
  * New: For the "Field-level Substitution Parameters", a new "mso:" prefix gives access to the Document Properties embedded in Office Open XML file formats (e.g., docx, xlsx, pptx). More information is given in the "Prefix values" section of the Settings/Media Library Assistant Documentation tab.
186
  * New: For the Bulk Edit, a new `[+reverse_index+]` substitution parameter counts down from the number of selected items to one. More informatin is in the Help menu for the Media/Assistant admin screen.
@@ -209,24 +229,8 @@ All of the MLA source code has been annotated with "DocBlocks", a special type o
209
  * Fix: When decoding the `wp_filter` list for debug logging, unknown reference types no longer cause PHP errors.
210
  * Fix: Handles new synchronization protocol for WP/LR Sync version 5.0+
211
 
212
- = 2.79 =
213
- * New: For the `[mla_tag_cloud]` shortcode, a new `no_count=internal` parameter setting substitutes the WordPress-maintained "count" value for the explicitly-computed "attachments per term" value. This can significantly improve shortcode performance.
214
- * New: For the `[mla_gallery]` "date" and "timestamp" option/format codes, a second argument containing "i18n" will localize the returned value based on the site locale. A second argument containing "age" will return the difference between the source value and the current date/time. See the Documentation tab.
215
- * New: For all of the keyword search functions, You can also exclude items/terms by prepending a word or quoted phrase with a hyphen, e.g., "pillow -sofa" will select items/terms containing "pillow" but not "sofa".
216
- * New: For the `[mla_gallery]` "Keyword(s) Search" and "Taxonomy term keyword(s) search" functions, keywords and terms can be excluded from the results by enclosing them in "/" delimiters, e.g., "/not/ happy" will return items containing "happy" after excluding items containing "not".
217
- * New: For `[mla_gallery]`, when `mla_alt_shortcode=mla_term_list`, parameters such as `mla_link_href` are passed through to be used by `[mla_term_list]`.
218
- * New: For the `[mla_gallery]` "Support for Other Gallery-generating Shortcodes", a new <code>mla_alt_ids_template</code> parameter lets you specify a Content Template for the entire parameter value passed to the alternate shortcode.
219
- * New: For the Media/Assistant admin submenu, a new "Download" Bulk Action has been added. You can select one or more items and use the new action to download a ZIP archive containing the items through your browser. This new feature replaces the "MLA Download ZIP Example" plugin, which is disabled if present.
220
- * New: The Settings/Media Library Assistant General tab "Show Count Column" option now applies to all taxonomy edit screens, not just Categories and Tags.
221
- * New: For the "MLA UI Elements Example" plugin, simple taxonomy queries can now be combined with the `add_filters_to` queries.
222
- * Fix: For the "Media/Edit Media" screen, IPTC/EXIF metadata mapping now works when the "Enable custom field mapping" option is disabled.
223
- * Fix: For the Media Manager Modal (Popup) Window, formatting and handling of the "Remove term" elements for flat taxonomies has been corrected.
224
- * Fix: For `[mla_gallery]`, the `link_url` item-level substitution parameter now reflects the `mla_link_href` parameter value.
225
- * Fix: For the new Gutenberg/Block Editor, load Media Modal scripts in footer section to avoid wp-lists.js conflicts such as failure to update custom fields in Posts/Edit Post and Page/Edit Page.
226
- * Fix: For the Media/Assistant admin submenu, suppresses the Admin Columns Pro version 4.5.x Bulk Edit feature.
227
- * Fix: Eliminate "Uncaught ReferenceError: ajaxurl is not defined" error for page builders such as Elementor.
228
-
229
- = 2.70 - 2.78 =
230
  * 2.78 - Support Admin Columns Pro v4.5.x, add "Search Media" and "Terms Search" exclude logic, Eliminate PHP messages for Polylang and some AJAX actions. One enhancement, five fixes.
231
  * 2.77 - Preserve current term assignments for checklist-style taxonomies when opening the Media/Assistant Quick Edit area. This defect was introduced in v2.76.
232
  * 2.76 - "Checklist-style" term search and additions in the Bulk and Quick Edit areas. New and improved example plugins. Seven enhancements, four fixes.
@@ -328,8 +332,8 @@ All of the MLA source code has been annotated with "DocBlocks", a special type o
328
 
329
  == Upgrade Notice ==
330
 
331
- = 2.81 =
332
- Compatibility updates for WordPress 5.3. New "mso:" prefix gives access to the Document Properties embedded in Office Open XML file formats (e.g., docx, xlsx, pptx). Three enhancements, eight fixes.
333
 
334
  == Other Notes ==
335
 
@@ -488,68 +492,3 @@ When terms change in any of the above ways there are two tasks that require rule
488
 
489
  1. How should language-specific terms be assigned to items selected? This is "Term Assignment".
490
  1. How should terms assigned to one translation of an item be used to update other translations of the same item? This is "Term Synchronization".
491
-
492
- When new terms are added during IPTC/EXIF taxonomy term mapping a third task is required; should new terms be added only to the current language or should they be made available in all languages? This is "Term Mapping Replication".
493
-
494
- <strong>Term Assignment</strong>
495
-
496
- When a specific language is selected only the item translations for that language are shown, and only the terms for that language are displayed (except for a Polylang bug that shows all languages in the "auto-complete" list for flat taxonomies). When "All Languages"/"Show all languages" is selected the terms for all languages are displayed even if they cannot be assigned to an item. For example, a Spanish term may appear in the list be cannot be assigned to an English item translations.
497
-
498
- For individual edit and quick edit updates the rule is simple:
499
-
500
- 1. For all terms selected/entered, find the equivalent term in the language of the item translation. Assign the equivalent (language-specific) term if one exists. If no equivalent term exists, ignore the selected/entered term. Assign all equivalent terms to the item translation, replacing any previous terms.
501
-
502
- For bulk edit updates the rule depends on which action (add, remove, replace) has been selected. Each of the item translations in the bulk edit list is updated by these rules:
503
-
504
- 1. <strong>Add</strong>: For all terms selected/entered, find the equivalent term in the language of the item translation. Assign the equivalent (language-specific) term if one exists. If the equivalent term exists, add it to the item translation.
505
- 1. <strong>Remove</strong>: For all terms selected/entered, find the equivalent term in the language of the item translation. Assign the equivalent (language-specific) term if one exists. If the equivalent term exists, remove it from the item translation.
506
- 1. <strong>Replace</strong>: This is the tricky case. What should happen to terms already assigned to an item translation that have not been selected/entered for the update? In particular, what about terms that do not have translations to all languages? Should a "French-only" term be preserved?
507
-
508
- The "<strong>Replace</strong>" answer is the same as the individual/quick edit answer. If the term is not selected/entered for the update it is discarded along with the other old assignments. After all, in "All Languages"/"Show all languages" mode the "French-only" term would have been in the list and could be selected if desired.
509
-
510
- <strong>Term Synchronization</strong>
511
-
512
- If you edit an item translation, for example to add or remove a term assignment, what should happen to the other translations of the same item? Term synchroniztion will add or remove the equivalent term in the other item translations if the equivalent term exists.
513
-
514
- What about "untranslated" terms that do not have translations to all languages? Should an existing "French-only" (untranslated) term be preserved? It is, since there is no way to indicate that it should be removed.
515
-
516
- Individual and quick edits are "replace" updates, and "replace" is an option for bulk edits as well. For term synchronization to preserve untranslated terms "replace" updates must be converted to separate "add" and "remove" updates that include only the changes made to the original item translation. For example, if these terms are defined:
517
-
518
- English
519
-
520
- - Common-term-1-eng
521
- - Common-term-2-eng
522
- - English-only-term
523
-
524
- Spanish
525
-
526
- - Common-term-1-esp
527
- - Common-term-2-esp
528
- - Spanish-only-term
529
-
530
- And these term assignments exist:
531
-
532
- English Translation
533
-
534
- - Common-term-1-eng
535
- - English-only-term
536
-
537
- Spanish Translation
538
-
539
- - Common-term-1-esp
540
- - Spanish-only-term
541
-
542
- Then synchronization handles common editing actions as follows:
543
-
544
- 1. If you edit the English Translation and add "Common-term-2-eng", synchronization will add "Common-term-2-esp" to the Spanish Translation.
545
- 1. If you edit the English Translation and remove "Common-term-1-eng", synchronization will remove "Common-term-1-esp" from the Spanish Translation.
546
- 1. If you edit the English Translation and remove "English-only-term", nothing will happen to the Spanish Translation.
547
-
548
- <strong>Term Mapping Replication</strong>
549
-
550
- When rules are defined in the IPTC/EXIF "Taxonomy term mapping section" they extract values (e.g., "IPTC 2#025 Keywords") from image metadata and use them to assign terms to the Media Library item(s). If the metadata value matches an existing term in the item's language it is assigned to the item. If the term already exists for any other active language it is not assigned to the item. If the term does not exist in any of the active languages, i.e., it is an entirely new term, a decision is required. The "Term Mapping Replication" option controls the decision:
551
-
552
- * When Replication <strong>is active</strong>, the term is created in the current language and then copied to every other active language as a translation of the term in the current language.
553
- * When Replication <strong>is not active</strong>, the term is created in the current language only. It is not copied to any other active language and will not be assigned to items in any language other than the current language.
554
-
555
- If you use Replication to automatically create terms in non-current languages they will be created with the same text value as the source term in the current language. You can always go to the taxonomy edit page and change the source text to an appropriate value for the other language(s). If you do not use Replication you can always go to the taxonomy edit page and add translations with an appropriate value for the other language(s).
3
  Donate link: http://davidlingren.com/#two
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: 5.4
7
  Requires PHP: 5.3
8
+ Stable tag: 2.82
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
181
 
182
  == Changelog ==
183
 
184
+ = 2.82 =
185
+ * New: For the "MLA Insert Fixit" example plugin, new "Figure Caption" tools let you add or replace `<figcaption>` values for items and galleries in the body of a post/page.
186
+ * New: For the "MLA Insert Fixit" example plugin, a new "Item fields to parent" tool lets you copy custom field values from attached items to their parent post/page.
187
+ * New: For the "MLA Insert Fixit" example plugin, allow multiple taxonomy pairs for the "Item terms to parent" and "Parent terms to item" tools.
188
+ * New: For the `[mla_gallery]` shortcode Taxonomy term keyword(s) search, a new `whole_word=true` parameter requires each entered word to match an entire word in the term name, e.g., entering "man" (without the quotes) will not match a portion of "woman" in the term name.
189
+ * New: For the "MLA tax query Example" plugin, multiple taxonomies are allowed in `my_custom_sql` and a new `tax_operator` parameter within `my_custom_sql` supports "AND" to require a match on all of the terms in the taxonomy parameters..
190
+ * New: For the "WooCommerce Fixit Tools" example plugin, new "Populate Product from Product Image" tool updates Product values from the Product Image.
191
+ * New: For the "MLA Insert Fixit" example plugin, allow custom post types for the "Copy ALT Text between Media Library items and Post/Page inserts" tools.
192
+ * Fix: For `[mla_gallery]`, when `mla_alt_ids_value` is used the style template, gallery open and row open HTML markup is no longer generated. Only the output of the alternate shortcode is echoed to the browser.
193
+ * Fix: For the Media Manager Modal (popup) Window, toolbar controls no longer overflow into the Attachmenta area..
194
+ * Fix: For the Media Manager Modal (popup) Window, "Filter media" selections, e.g., search box contents, persist for two or more "Media Library" invocations on a post/page.
195
+ * Fix: Corrected Chrome & Firefox issue with "Search Box" checkbox control changes not being recorded.
196
+ * Fix: Corrected PHP 7.4 issue with deprecated curly braces in `class-mla-data.php` and `class-mla-data-query.php`.
197
+ * Fix: For "MLA Gallery in" (where-used) reporting, shortcodes using the enclosing shortcode syntax are now included in the results.
198
+ * Fix: For "search" text boxes in all Settings/Media Library Assistant tabs, properly escape values to prevent Reflected Cross Site Scripting attacks.
199
+ * Fix: For `[mla_gallery]` `link=download`, restrict downloads to the WordPress Uploads directory subtree to prevent Local File Disclosure attacks. The old file downloader has been replaced by an AJAX-based WordPress request.
200
+ * Fix: For `[mla_gallery]`, validate content of `tax_query`, `meta_query` and `date_query` parameters to prevent Remote Code Execution attacks.
201
+ * Fix: For the "MLA UI Elements Example" plugin, correct parameter handling defects in `[mla_term_list]` handler.
202
+ * Fix: For WordPress 5.3+ "big image" handling, use the "original image" for sourcing IPTC/EXIF/XMP metadata, not the "scaled" image.
203
+
204
  = 2.81 =
205
  * New: For the "Field-level Substitution Parameters", a new "mso:" prefix gives access to the Document Properties embedded in Office Open XML file formats (e.g., docx, xlsx, pptx). More information is given in the "Prefix values" section of the Settings/Media Library Assistant Documentation tab.
206
  * New: For the Bulk Edit, a new `[+reverse_index+]` substitution parameter counts down from the number of selected items to one. More informatin is in the Help menu for the Media/Assistant admin screen.
229
  * Fix: When decoding the `wp_filter` list for debug logging, unknown reference types no longer cause PHP errors.
230
  * Fix: Handles new synchronization protocol for WP/LR Sync version 5.0+
231
 
232
+ = 2.70 - 2.79 =
233
+ * 2.79 - [mla_gallery] keyword/term search "exclude" logic, [mla_tag_cloud] performance improvements, Media/Assistant Download bulk action. Nine enhancements in all, six fixes.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  * 2.78 - Support Admin Columns Pro v4.5.x, add "Search Media" and "Terms Search" exclude logic, Eliminate PHP messages for Polylang and some AJAX actions. One enhancement, five fixes.
235
  * 2.77 - Preserve current term assignments for checklist-style taxonomies when opening the Media/Assistant Quick Edit area. This defect was introduced in v2.76.
236
  * 2.76 - "Checklist-style" term search and additions in the Bulk and Quick Edit areas. New and improved example plugins. Seven enhancements, four fixes.
332
 
333
  == Upgrade Notice ==
334
 
335
+ = 2.82 =
336
+ Compatibility updates for WordPress 5.4. Security fixes to prevent three categories of attacks. New tools for "MLA Insert Fixit" and “WooCommerce Fixit Tools" example plugins. Fixes for `[mla_gallery]` and Media Manager Modal Window. Seven enhancements in all, eleven fixes.
337
 
338
  == Other Notes ==
339
 
492
 
493
  1. How should language-specific terms be assigned to items selected? This is "Term Assignment".
494
  1. How should terms assigned to one translation of an item be used to update other translations of the same item? This is "Term Synchronization".
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tpls/admin-terms-search-form.tpl CHANGED
@@ -56,6 +56,10 @@
56
  <input name="mla_terms_search[exact]" id="mla-terms-search-exact" type="checkbox" value="exact" [+exact_checked+] />
57
  [+Exact+]
58
  </li>
 
 
 
 
59
  </ul>
60
  </div>
61
  </div>
56
  <input name="mla_terms_search[exact]" id="mla-terms-search-exact" type="checkbox" value="exact" [+exact_checked+] />
57
  [+Exact+]
58
  </li>
59
+ <li>
60
+ <input name="mla_terms_search[whole_word]" id="mla-terms-search-whole-word" type="checkbox" value="whole_word" [+whole_word_checked+] />
61
+ [+Whole Word+]
62
+ </li>
63
  </ul>
64
  </div>
65
  </div>
tpls/documentation-settings-tab.tpl CHANGED
@@ -649,7 +649,7 @@ The Link parameter specifies the target and type of link from the gallery item t
649
  </tr>
650
  <tr>
651
  <td class="mla-doc-table-label">download</td>
652
- <td>Link to the MLA file downloader for this attachment. Forces a file download instead of opening the file in the browser. See also the "Transfer by Item Name" section just below.</td>
653
  </tr>
654
  <tr>
655
  <td class="mla-doc-table-label">thumbnail,&nbsp;medium,<br />large</td>
@@ -965,6 +965,18 @@ Searching for keywords within the names of taxonomy terms is a completely differ
965
  <td class="mla-doc-table-label">mla_term_connector</td>
966
  <td>If you enter multiple terms (separated by the <code>mla_term_delimiter</code>) in the <code>mla_terms_phrases</code> parameter, this parameter controls how they are connected. Choose from <strong>OR (the default)</strong> to require that any one of the terms must match for the search to succeed, or AND to require that all of the terms must match.</td>
967
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
968
  </table>
969
  <p>
970
  <a name="post_mime_type_parameter"></a>
@@ -1124,7 +1136,7 @@ Remember to use <code>post_parent=current</code> if you want to restrict your qu
1124
  The search parameter ("s=keyword") will perform a keyword search. By default, the search includes the "post_title" and "post_content" (Description) fields but not the "post_excerpt" (Caption) field. All of the words you enter in the parameter must match for the search to succeed. An SQL "LIKE" clause for each word is composed and added to the search criteria.
1125
  </p>
1126
  <p>
1127
- You can match on multi-word phrases in a variety of ways. These are described in detail, with examples, in the "Entering Words and Phrases" portion of the "<a href="#terms_search">Terms Search - filtering on taxonomy term names</a>" Documentation section. You can also use the <code>sentence=true</code> and <code>exact=true</code> parameters to change the matching logic used in the <code>[mla_gallery]</code> shortcode.
1128
  </p>
1129
  <p>
1130
  You can search for Media Library items and parent posts/pages by their ID value(s). If <strong>all of the values</strong> in the search field are numeric (and unquoted) they will be interpreted as ID values. To search for items attached to one or more parent posts/pages, enter the ID of the parent(s). If you want to search for a numeric value in the text fields, surround it with quotes.
@@ -1154,6 +1166,10 @@ You can use the <code>mla_search_connector</code> and <code>mla_search_fields</c
1154
  <td>Choose from OR to require that any one of the phrases must match for the search to succeed, or AND (the default) to require that all of the phrases must match.</td>
1155
  </tr>
1156
  <tr>
 
 
 
 
1157
  <td class="mla-doc-table-label">sentence</td>
1158
  <td>Add <code>sentence=true</code> to require that all of the words entered must match in sequence. This is equivalent to putting quotes around all of the words in your search.</td>
1159
  </tr>
@@ -5505,6 +5521,10 @@ If you choose the 'or'/'Any phrase' connector and enter 'man "bites dog"' in the
5505
  <p>
5506
  The Search Terms popup window has an additional capability, "Exact match" and a checkbox to activate it. When you check the "Exact" box, each phrase must match the entire text of a term name. For example, if you check "Exact", the phrase "man" will match a term of the same name but not a term named "big man". If you check "Exact" and enter "big man" you will match terms named "big" or "man" <strong>but not</strong> "big man". If you want an exact match on a multi-word term such as "big man", put quotes around the name, i.e., ' "big man" '.
5507
  </p>
 
 
 
 
5508
  <h4>Excluding phrases</h4>
5509
  <p>
5510
  If you want to exclude terms that match a phrase, enclose the phrase in slash ("/") delimiters. For example, enter "/dog/" to exclude terms containing the word dog. To exclude a multi word phrase, enter something like "/bites dog/" to exclude both words or ' /"bites dog"/ ' to exclude the exact phrase. You can combine include and exclude phrases, e.g., something like "man /that/ dog" to select terms containing "man" and "dog" but not containing "that".
649
  </tr>
650
  <tr>
651
  <td class="mla-doc-table-label">download</td>
652
+ <td>Link to the MLA "Transfer by Item Name" feature for this attachment with <code>mla_disposition=attachment</code>. Forces a file download instead of opening the file in the browser. See the "Transfer by Item Name" section just below.</td>
653
  </tr>
654
  <tr>
655
  <td class="mla-doc-table-label">thumbnail,&nbsp;medium,<br />large</td>
965
  <td class="mla-doc-table-label">mla_term_connector</td>
966
  <td>If you enter multiple terms (separated by the <code>mla_term_delimiter</code>) in the <code>mla_terms_phrases</code> parameter, this parameter controls how they are connected. Choose from <strong>OR (the default)</strong> to require that any one of the terms must match for the search to succeed, or AND to require that all of the terms must match.</td>
967
  </tr>
968
+ <tr>
969
+ <td class="mla-doc-table-label">whole_word</td>
970
+ <td>Add <code>whole_word=true</code> to require that each of the words entered must match a whole word in taxonomy terms. This is equivalent to putting quotes around each of the words in your search.</td>
971
+ </tr>
972
+ <tr>
973
+ <td class="mla-doc-table-label">sentence</td>
974
+ <td>Add <code>sentence=true</code> to require that all of the words entered must match in sequence. This is equivalent to putting quotes around all of the words in your search.</td>
975
+ </tr>
976
+ <tr>
977
+ <td class="mla-doc-table-label">exact</td>
978
+ <td>Add <code>exact=true</code> to require that each phrase must match the entire text of a term name.</td>
979
+ </tr>
980
  </table>
981
  <p>
982
  <a name="post_mime_type_parameter"></a>
1136
  The search parameter ("s=keyword") will perform a keyword search. By default, the search includes the "post_title" and "post_content" (Description) fields but not the "post_excerpt" (Caption) field. All of the words you enter in the parameter must match for the search to succeed. An SQL "LIKE" clause for each word is composed and added to the search criteria.
1137
  </p>
1138
  <p>
1139
+ You can match on multi-word phrases in a variety of ways. These are described in detail, with examples, in the "Entering Words and Phrases" portion of the "<a href="#terms_search">Terms Search - filtering on taxonomy term names</a>" Documentation section. You can also use the <code>whole_word=true</code>, <code>sentence=true</code> and <code>exact=true</code> parameters to change the matching logic used in the <code>[mla_gallery]</code> shortcode.
1140
  </p>
1141
  <p>
1142
  You can search for Media Library items and parent posts/pages by their ID value(s). If <strong>all of the values</strong> in the search field are numeric (and unquoted) they will be interpreted as ID values. To search for items attached to one or more parent posts/pages, enter the ID of the parent(s). If you want to search for a numeric value in the text fields, surround it with quotes.
1166
  <td>Choose from OR to require that any one of the phrases must match for the search to succeed, or AND (the default) to require that all of the phrases must match.</td>
1167
  </tr>
1168
  <tr>
1169
+ <td class="mla-doc-table-label">whole_word</td>
1170
+ <td>Add <code>whole_word=true</code> to require that each of the words entered must match a whole word in taxonomy terms. This is equivalent to putting quotes around each of the words in your search. <strong>Note that this option only affects the "terms" portion of the search.</strong> WordPress does not support a whole word search in any of the other search fields.</td>
1171
+ </tr>
1172
+ <tr>
1173
  <td class="mla-doc-table-label">sentence</td>
1174
  <td>Add <code>sentence=true</code> to require that all of the words entered must match in sequence. This is equivalent to putting quotes around all of the words in your search.</td>
1175
  </tr>
5521
  <p>
5522
  The Search Terms popup window has an additional capability, "Exact match" and a checkbox to activate it. When you check the "Exact" box, each phrase must match the entire text of a term name. For example, if you check "Exact", the phrase "man" will match a term of the same name but not a term named "big man". If you check "Exact" and enter "big man" you will match terms named "big" or "man" <strong>but not</strong> "big man". If you want an exact match on a multi-word term such as "big man", put quotes around the name, i.e., ' "big man" '.
5523
  </p>
5524
+ <h4>Whole word matching</h4>
5525
+ <p>
5526
+ The Search Terms popup window has an additional capability, "Whole word match" and a checkbox to activate it. When you check the "Whole Word" box, each word in the phrase must match a whole word of a term name. For example, if you check "Whole Word", the phrase "man" will match a term that contains "man" but not the word "woman". If you check "Whole Word" and enter "big man" it is as if you put quotes around each of the words, i.e., ` "big" "man" `. If you want an exact match on a multi-word term such as "big man", put quotes around the name, i.e., ' "big man" '.
5527
+ </p>
5528
  <h4>Excluding phrases</h4>
5529
  <p>
5530
  If you want to exclude terms that match a phrase, enclose the phrase in slash ("/") delimiters. For example, enter "/dog/" to exclude terms containing the word dog. To exclude a multi word phrase, enter something like "/bites dog/" to exclude both words or ' /"bites dog"/ ' to exclude the exact phrase. You can combine include and exclude phrases, e.g., something like "man /that/ dog" to select terms containing "man" and "dog" but not containing "that".