Media Library Assistant - Version 2.96

Version Description

  • New: For the "MLA CSV Data Source Example" plugin, the new "Export Item Values" tool lets you export anything you need from Media Library items, e.g., standard values, taxonomy terms, custom fields and embedded image IPTC/EXIF/XMP metadata.
  • New: For the "MLA UI Elements Example" plugin, the `[muie_archive_list]' shortcode adds date-based archive controls and lists.
  • New: For the "MLA UI Elements Example" plugin, the `[muie_text_box]' shortcode adds a "sticky" text box that survives page refresh and pagination.
  • New: An "ExposureMode" data source has been added to the "Field-level enhanced EXIF CAMERA values".
  • New: A new debugging tool adds Term ID and Term-taxonomy ID columns to the Media/taxonomy edit screens, controlled by a checkbox on the Settings/Media Library Assistant Debug tab.
  • New: Enhanced support for the Enhanced Media Library plugin, including filter support in the Media Manager Modal (popup) Window and Media/Assistant Grid mode.
  • New: For [mla_tag_cloud] and [mla_term_list], special "ignore.terms.assigned", "no.terms.assigned", and "any.terms.assigned" values let you add links/controls to the cloud or term list to select all items, items with no term assignments and items with one ore more term assginments.
  • New: For [mla_gallery], a special "any.terms.assigned" value lets you use a simple taxonomy query or a tax_query to find items that have one or more term assignments in a given taxonomy.
  • New: For the ",kbmb" Field-level option/format value, if the kilobyte suffix option is empty and the megabyte suffix is present all values above the threshold will be displayed in megabytes.
  • New: For the "MLA Insert Fixit" example plugin, the "Attach Referenced in" tool "ids=" analysis can be applied to any shortcode.
  • New: For the "WooCommerce Fixit Tools" example plugin, new tools to populate the Product Image and Product Gallery from items attached to the Product(s) have been added.
  • New: The full path and file name has been added to the "Settings updated" message for the "Export ALL Settings" function of the Settings/Media Library Assistant General tab.
  • New: Donation links and information have been restored, going to our Chateau Seaview Fund at the Golden West Chapter of the ALS Association.
  • Fix: Handle new "Load More" functions in WP 5.8 Media Manager Modal Window.
  • Fix: Correct handling of spaces in substitution parameter format values, e.g., ,str_replace(s,r) and ,replace(p,r,v).
  • Fix: jQuery migrate "deprecated" notices for JS event shorthand instances have been resolved.
  • Fix: For the Media/Assistant admin submenu, the "Attached" view item count has been corrected.
  • Fix: Handling of array variables in the request: prefix has been restored.
  • Fix: For [mla_gallery], displaying the Featured Image for a non-image post type, e.g., post or page, has been restored.
  • Fix: For WPML term processing in "All Languages" mode, the Quick Edit action will update assigned terms in the proper language regardless of the language of selected terms.
  • Fix: For the Media/Assistant admin submenu displayed to members of the "Author" role, Bulk Actions such as "Edit" do not allow the user to select items belionging to other users.
  • Fix: For the "MLA Custom Feed" example plugin, code has been added to ensure that all active feeds are reflected in the WordPress URL rewrite rules and flushed (only) when missing feeds are detected.
  • Fix: For [mla_tag_cloud] and [mla_term_list], "pad_counts" values now reflect filtering with the post_mime_type data selection parameter..
  • Fix: For [mla_term_list], PHP error messages when using a custom markup template with an empty Open section have been resolved.
  • Fix: Improved toolbar layout and styling for the Media Manager Modal (popup) Window and Media/Assistant Grid mode.
  • Fix: Support for the ajax_query_attachments_args filter to support plugins such as Enhanced Media Library and ACF:Image Aspect Ratio Crop Field.
  • Fix: For the Bulk Edit on Upload feature, only one call to the edit processing function is made when all four "Enable ... mapping..." options are disabled.
Download this release

Release Info

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

Code changes from version 2.95 to 2.96

Files changed (64) hide show
  1. css/mla-media-modal-style-rtl.css +85 -29
  2. css/mla-media-modal-style.css +83 -29
  3. css/mla-style-rtl.css +4 -0
  4. css/mla-style.css +4 -0
  5. examples/plugins/mla-csv-data-source-example/admin-settings-page.tpl +47 -11
  6. examples/plugins/mla-csv-data-source-example/class-mla-example-plugin-settings-101.php +559 -0
  7. examples/plugins/mla-csv-data-source-example/mla-csv-data-source-example.php +185 -417
  8. examples/plugins/mla-custom-feed-example/mla-custom-feed-example.php +42 -13
  9. examples/plugins/mla-custom-field-search-example/admin-settings-page.tpl +1 -1
  10. examples/plugins/mla-insert-fixit.php +116 -69
  11. examples/plugins/mla-tax-query-example.php +16 -5
  12. examples/plugins/mla-ui-elements-example.php +0 -1125
  13. examples/plugins/mla-ui-elements-example/admin-settings-page.tpl +1263 -0
  14. examples/plugins/mla-ui-elements-example/class-mla-example-plugin-settings-101.php +559 -0
  15. examples/plugins/mla-ui-elements-example/mla-ui-custom-templates.tpl +39 -0
  16. examples/plugins/mla-ui-elements-example/mla-ui-elements-example.php +2956 -0
  17. examples/plugins/woofixit.php +605 -27
  18. includes/class-mla-core-options.php +12 -0
  19. includes/class-mla-core.php +1 -1
  20. includes/class-mla-data-query.php +33 -7
  21. includes/class-mla-data.php +41 -6
  22. includes/class-mla-edit-media.php +69 -3
  23. includes/class-mla-list-table.php +9 -12
  24. includes/class-mla-main.php +2 -1
  25. includes/class-mla-media-modal-ajax.php +33 -7
  26. includes/class-mla-objects.php +22 -0
  27. includes/class-mla-settings.php +17 -19
  28. includes/class-mla-shortcode-support.php +624 -106
  29. includes/class-mla-shortcodes.php +4 -3
  30. includes/class-mla-wpml-support.php +66 -76
  31. includes/mla-media-modal-js-template.php +4 -23
  32. index.php +3 -3
  33. js/mla-add-new-bulk-edit-scripts.js +5 -5
  34. js/mla-add-new-bulk-edit-scripts.min.js +1 -1
  35. js/mla-add-term-scripts.js +11 -9
  36. js/mla-add-term-scripts.min.js +1 -1
  37. js/mla-define-ajaxurl-scripts.js +1 -1
  38. js/mla-define-ajaxurl-scripts.min.js +1 -1
  39. js/mla-edit-media-scripts.js +9 -9
  40. js/mla-edit-media-scripts.min.js +1 -1
  41. js/mla-inline-edit-scripts.js +20 -20
  42. js/mla-inline-edit-scripts.min.js +1 -1
  43. js/mla-inline-edit-settings-scripts.js +9 -9
  44. js/mla-inline-edit-settings-scripts.min.js +1 -1
  45. js/mla-inline-mapping-scripts.js +9 -9
  46. js/mla-inline-mapping-scripts.min.js +1 -1
  47. js/mla-media-modal-scripts.js +44 -105
  48. js/mla-media-modal-scripts.min.js +1 -1
  49. js/mla-polylang-support-scripts.js +14 -14
  50. js/mla-polylang-support-scripts.min.js +1 -1
  51. js/mla-set-parent-scripts.js +9 -9
  52. js/mla-set-parent-scripts.min.js +1 -1
  53. js/mla-settings-shortcodes-tab-scripts.js +1 -1
  54. js/mla-settings-shortcodes-tab-scripts.min.js +1 -1
  55. js/mla-terms-search-scripts.js +4 -7
  56. js/mla-terms-search-scripts.min.js +1 -1
  57. js/mla-thumbnail-generation-scripts.js +5 -5
  58. js/mla-thumbnail-generation-scripts.min.js +1 -1
  59. languages/media-library-assistant-en_US - References.pot +800 -712
  60. languages/media-library-assistant-en_US.po +69 -3
  61. languages/media-library-assistant-en_US.pot +68 -2
  62. readme.txt +46 -67
  63. tpls/admin-display-settings-page.tpl +12 -1
  64. tpls/documentation-settings-tab.tpl +138 -28
css/mla-media-modal-style-rtl.css CHANGED
@@ -7,21 +7,12 @@
7
  * Adapted from /wp-admin/css/edit.css and given unique names to avoid conflicts.
8
  */
9
 
10
- .attachments-browser .media-toolbar {
11
- overflow: visible;
12
- }
13
-
14
- .attachments-browser .media-toolbar .media-toolbar-secondary {
15
- width: 50%;
16
- max-width: 50%;
17
- }
18
-
19
- .attachments-browser .media-toolbar .media-toolbar-primary {
20
- width: 50%;
21
- max-width: 50%;
22
  }
23
 
24
- /** === Search Options */
25
  .mla-search-options {
26
  list-style: none;
27
  padding: 0;
@@ -29,36 +20,101 @@
29
 
30
  .mla-search-options > li {
31
  float: right;
32
- margin-right: 5px;
33
  margin-bottom: 0;
34
  }
35
 
36
- .mla-search-options > li:last-child { margin-right: 0; }
37
 
38
  /**
39
- * Media Toolbar Controls
40
- */
41
- .media-modal-content #mla-terms-search,
42
- .media-modal-content #mla-search-submit {
43
- height: 26px;
44
- line-height:normal;
45
- margin-top: 11px;
46
- position: static;
47
- width:auto
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
 
50
- .mode-grid.media-frame .media-toolbar .select-mode-toggle-button,
51
- .mode-grid.media-frame .media-toolbar input#mla-terms-search {
 
 
 
 
 
 
 
 
 
 
52
  vertical-align:middle;
53
  }
54
 
55
- .mode-grid.media-frame .media-toolbar input#mla-media-search-input,
56
- .mode-grid.media-frame .media-toolbar input#mla-search-submit {
57
- /* margin-top: 11px; */
58
  position: static;
59
  width:auto
60
  }
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  /**
63
  * Hide "Media Categories" meta box
64
  */
7
  * Adapted from /wp-admin/css/edit.css and given unique names to avoid conflicts.
8
  */
9
 
10
+ /** === Search Options */
11
+ .mla-search-box {
12
+ display: inline-block;
13
+ float: left;
 
 
 
 
 
 
 
 
14
  }
15
 
 
16
  .mla-search-options {
17
  list-style: none;
18
  padding: 0;
20
 
21
  .mla-search-options > li {
22
  float: right;
23
+ margin-left: 5px;
24
  margin-bottom: 0;
25
  }
26
 
27
+ .mla-search-options > li:last-child { margin-left: 0; }
28
 
29
  /**
30
+ * MMMW Popup adapted from EML Media Toolbar Controls
31
+ */
32
+ body.mla-media-modal .attachments-browser .media-toolbar {
33
+ height: auto;
34
+ }
35
+
36
+ body.mla-media-modal .attachments-browser .media-toolbar-secondary {
37
+ max-width: none;
38
+ width: 100%; /*auto; */
39
+ }
40
+
41
+ body.mla-media-modal .media-modal-content .media-frame select.attachment-filters {
42
+ width: auto;
43
+ max-width: calc(48% - 12px);
44
+ margin-left: 10px;
45
+ margin-top: 10px;
46
+ vertical-align: middle;
47
+ line-height: 28px;
48
+ height: 28px;
49
+ }
50
+
51
+ body.mla-media-modal .attachments-browser .media-toolbar-secondary .media-button {
52
+ margin: 10px 0 0 10px;
53
+ vertical-align: middle;
54
+ }
55
+
56
+ body.mla-media-modal .media-modal-content .attachments-browser .search {
57
+ margin: 10px 0 0 10px;
58
+ vertical-align: middle;
59
+ width: auto;
60
+ padding: 0px 8px;
61
  }
62
 
63
+ @media only screen and (max-width: 900px) {
64
+
65
+ body.mla-media-modal .media-modal-content .attachments-browser .search {
66
+ float: none;
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Media/Library Grid Mode Media Toolbar Controls
72
+ */
73
+ body.mla-media-grid .mode-grid.media-frame .media-toolbar .select-mode-toggle-button,
74
+ body.mla-media-grid .mode-grid.media-frame .media-toolbar input#mla-terms-search {
75
  vertical-align:middle;
76
  }
77
 
78
+ body.mla-media-grid .mode-grid.media-frame .media-toolbar input#mla-media-search-input,
79
+ body.mla-media-grid .mode-grid.media-frame .media-toolbar input#mla-search-submit {
 
80
  position: static;
81
  width:auto
82
  }
83
 
84
+ /*
85
+ * Media/Library Grid Mode adapted from EML
86
+ */
87
+
88
+ body.mla-media-grid .mode-grid.media-frame .attachments-browser .media-toolbar-secondary {
89
+ max-width: none;
90
+ width: 100%;
91
+ }
92
+
93
+ body.mla-media-grid .mode-grid.media-frame .media-toolbar select {
94
+ margin: 8px 0 8px 10px;
95
+ }
96
+
97
+ body.mla-media-grid .mode-grid.media-frame.mode-edit .media-toolbar-secondary .media-button {
98
+ margin: 8px 0 8px 10px;
99
+ vertical-align: middle;
100
+
101
+ opacity: 1;
102
+ visibility: visible;
103
+ -webkit-transition: visibility 0.2s linear, opacity 0.2s linear;
104
+ -moz-transition: visibility 0.2s linear, opacity 0.2s linear;
105
+ -o-transition: visibility 0.2s linear, opacity 0.2s linear;
106
+ }
107
+
108
+ body.mla-media-grid .mode-grid.media-frame.mode-edit .media-toolbar-secondary .search {
109
+ margin: 8px 0 8px 0;
110
+ padding: 3px 5px;
111
+ max-width: 100%;
112
+ font-size: 16px;
113
+ font-weight: 300;
114
+ line-height: 1.5;
115
+ vertical-align: middle;
116
+ }
117
+
118
  /**
119
  * Hide "Media Categories" meta box
120
  */
css/mla-media-modal-style.css CHANGED
@@ -1,5 +1,4 @@
1
  @charset "utf-8";
2
-
3
  /**
4
  * CSS Document
5
  *
@@ -8,22 +7,12 @@
8
  * Adapted from /wp-admin/css/edit.css and given unique names to avoid conflicts.
9
  */
10
 
11
- .attachments-browser .media-toolbar {
12
- overflow: visible;
13
- height: auto;
14
- }
15
-
16
- .attachments-browser .media-toolbar .media-toolbar-secondary {
17
- width: 50%;
18
- max-width: 50%;
19
- }
20
-
21
- .attachments-browser .media-toolbar .media-toolbar-primary {
22
- width: 50%;
23
- max-width: 50%;
24
  }
25
 
26
- /** === Search Options */
27
  .mla-search-options {
28
  list-style: none;
29
  padding: 0;
@@ -38,29 +27,94 @@
38
  .mla-search-options > li:last-child { margin-right: 0; }
39
 
40
  /**
41
- * Media Toolbar Controls
42
- */
43
- .media-modal-content #mla-terms-search,
44
- .media-modal-content #mla-search-submit {
45
- height: 26px;
46
- line-height:normal;
47
- margin-top: 11px;
48
- position: static;
49
- width:auto
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  }
51
 
52
- .mode-grid.media-frame .media-toolbar .select-mode-toggle-button,
53
- .mode-grid.media-frame .media-toolbar input#mla-terms-search {
 
 
 
 
 
 
 
 
 
 
54
  vertical-align:middle;
55
  }
56
 
57
- .mode-grid.media-frame .media-toolbar input#mla-media-search-input,
58
- .mode-grid.media-frame .media-toolbar input#mla-search-submit {
59
- /* margin-top: 11px; */
60
  position: static;
61
  width:auto
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  /**
65
  * Hide "Media Categories" meta box
66
  */
1
  @charset "utf-8";
 
2
  /**
3
  * CSS Document
4
  *
7
  * Adapted from /wp-admin/css/edit.css and given unique names to avoid conflicts.
8
  */
9
 
10
+ /** === Search Options */
11
+ .mla-search-box {
12
+ display: inline-block;
13
+ float: right;
 
 
 
 
 
 
 
 
 
14
  }
15
 
 
16
  .mla-search-options {
17
  list-style: none;
18
  padding: 0;
27
  .mla-search-options > li:last-child { margin-right: 0; }
28
 
29
  /**
30
+ * MMMW Popup adapted from EML Media Toolbar Controls
31
+ */
32
+ body.mla-media-modal .attachments-browser .media-toolbar {
33
+ height: auto;
34
+ }
35
+
36
+ body.mla-media-modal .attachments-browser .media-toolbar-secondary {
37
+ max-width: none;
38
+ width: 100%; /*auto; */
39
+ }
40
+
41
+ body.mla-media-modal .media-modal-content .media-frame select.attachment-filters {
42
+ width: auto;
43
+ max-width: calc(48% - 12px);
44
+ margin-right: 10px;
45
+ margin-top: 10px;
46
+ vertical-align: middle;
47
+ line-height: 28px;
48
+ height: 28px;
49
+ }
50
+
51
+ body.mla-media-modal .attachments-browser .media-toolbar-secondary .media-button {
52
+ margin: 10px 10px 0 0;
53
+ vertical-align: middle;
54
+ }
55
+
56
+ body.mla-media-modal .media-modal-content .attachments-browser .search {
57
+ margin: 10px 10px 0 0;
58
+ vertical-align: middle;
59
+ width: auto;
60
+ padding: 0px 8px;
61
  }
62
 
63
+ @media only screen and (max-width: 900px) {
64
+
65
+ body.mla-media-modal .media-modal-content .attachments-browser .search {
66
+ float: none;
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Media/Library Grid Mode Media Toolbar Controls
72
+ */
73
+ body.mla-media-grid .mode-grid.media-frame .media-toolbar .select-mode-toggle-button,
74
+ body.mla-media-grid .mode-grid.media-frame .media-toolbar input#mla-terms-search {
75
  vertical-align:middle;
76
  }
77
 
78
+ body.mla-media-grid .mode-grid.media-frame .media-toolbar input#mla-media-search-input,
79
+ body.mla-media-grid .mode-grid.media-frame .media-toolbar input#mla-search-submit {
 
80
  position: static;
81
  width:auto
82
  }
83
 
84
+ /*
85
+ * Media/Library Grid Mode adapted from EML
86
+ */
87
+
88
+ body.mla-media-grid .mode-grid.media-frame .attachments-browser .media-toolbar-secondary {
89
+ max-width: none;
90
+ width: 100%;
91
+ }
92
+
93
+ body.mla-media-grid .mode-grid.media-frame .media-toolbar select {
94
+ margin: 8px 10px 8px 0;
95
+ }
96
+
97
+ body.mla-media-grid .mode-grid.media-frame.mode-edit .media-toolbar-secondary .media-button {
98
+ margin: 8px 10px 8px 0;
99
+ vertical-align: middle;
100
+
101
+ opacity: 1;
102
+ visibility: visible;
103
+ -webkit-transition: visibility 0.2s linear, opacity 0.2s linear;
104
+ -moz-transition: visibility 0.2s linear, opacity 0.2s linear;
105
+ -o-transition: visibility 0.2s linear, opacity 0.2s linear;
106
+ }
107
+
108
+ body.mla-media-grid .mode-grid.media-frame.mode-edit .media-toolbar-secondary .search {
109
+ margin: 8px 0 8px 0;
110
+ padding: 3px 5px;
111
+ max-width: 100%;
112
+ font-size: 16px;
113
+ font-weight: 300;
114
+ line-height: 1.5;
115
+ vertical-align: middle;
116
+ }
117
+
118
  /**
119
  * Hide "Media Categories" meta box
120
  */
css/mla-style-rtl.css CHANGED
@@ -364,6 +364,10 @@ div.mla_errors {
364
  * MLA Settings page
365
  */
366
 
 
 
 
 
367
  #wpbody-content .optiontable th {
368
  padding-left: 10px;
369
  }
364
  * MLA Settings page
365
  */
366
 
367
+ #donate-button-div {
368
+ margin-top: 5px;
369
+ }
370
+
371
  #wpbody-content .optiontable th {
372
  padding-left: 10px;
373
  }
css/mla-style.css CHANGED
@@ -364,6 +364,10 @@ div.mla_errors {
364
  * MLA Settings page
365
  */
366
 
 
 
 
 
367
  #wpbody-content .optiontable th {
368
  padding-right: 10px;
369
  }
364
  * MLA Settings page
365
  */
366
 
367
+ #donate-button-div {
368
+ margin-top: 5px;
369
+ }
370
+
371
  #wpbody-content .optiontable th {
372
  padding-right: 10px;
373
  }
examples/plugins/mla-csv-data-source-example/admin-settings-page.tpl CHANGED
@@ -2,7 +2,7 @@
2
  <a name="backtotop"></a>
3
  &nbsp;
4
  <div class="wrap">
5
- <h1 class="wp-heading-inline">MLA CSV Data Source Example [+version+] Settings</h1>
6
  [+messages+]
7
  [+tablist+]
8
  [+tab_content+]
@@ -20,7 +20,6 @@
20
  <p>
21
  [+messages+]
22
  </p>
23
- [+dismiss_button+]
24
  </div>
25
 
26
  <!-- template="select-option" -->
@@ -32,7 +31,7 @@
32
  <strong>Source file</strong>
33
  </td>
34
  <td>
35
- <select name="mla_csv_data_source_options[source]" id="mla-csv-data-source-source">
36
  [+source_options+]
37
  </select>
38
  <div class="mla-settings-help">&nbsp;&nbsp;Select the CSV file to use for the data sources.</div>
@@ -43,7 +42,7 @@
43
  <strong>Match on</strong>
44
  </td>
45
  <td>
46
- <select name="mla_csv_data_source_options[match]" id="mla-csv-data-source-match">
47
  <option [+id_selected+] value="id">ID (or .ID)</option>
48
  <option [+base_file_selected+] value="base_file">Base File</option>
49
  <option [+file_name_selected+] value="file_name">File Name (only)</option>
@@ -56,7 +55,7 @@
56
  <strong>Delimiter</strong>
57
  </td>
58
  <td>
59
- <input name="mla_csv_data_source_options[delimiter]" id="mla-csv-data-source-delimiter" type="text" size="1" maxlength="1"value="[+delimiter+]" />
60
  <div class="mla-settings-help">&nbsp;&nbsp;Enter the (one character) delimiter that separates variables.</div>
61
  </td>
62
  </tr>
@@ -65,7 +64,7 @@
65
  <strong>Enclosure</strong>
66
  </td>
67
  <td>
68
- <input name="mla_csv_data_source_options[enclosure]" id="mla-csv-data-source-enclosure" type="text" size="1" maxlength="1"value="[+enclosure+]" />
69
  <div class="mla-settings-help">&nbsp;&nbsp;Enter the (one) character that encloses a variable.</div>
70
  </td>
71
  </tr>
@@ -74,10 +73,19 @@
74
  <strong>Escape</strong>
75
  </td>
76
  <td>
77
- <input name="mla_csv_data_source_options[escape]" id="mla-csv-data-source-escape" type="text" size="1" maxlength="1"value="[+escape+]" />
78
  <div class="mla-settings-help">&nbsp;&nbsp;Enter the (one) character that escapes special characters within a variable.</div>
79
  </td>
80
  </tr>
 
 
 
 
 
 
 
 
 
81
 
82
  <!-- template="general-tab" -->
83
  <style type='text/css'>
@@ -118,12 +126,13 @@ ul.mla_settings li {
118
  </tbody>
119
  </table>
120
  <span class="submit mla-settings-submit">
121
- <input name="mla_csv_data_source_options_save" class="button-primary" id="mla-csv-data-source-save" type="submit" value="Save Changes" />
 
122
  </span>
123
- <h3>Export Match Keys</h3>
124
  <p>Click the button below to download a CSV file containing the ID, Base File and File Name values for all the items currently in your Media Library.</p>
125
  <span class="submit mla-settings-submit">
126
- <input name="mla_csv_data_source_options_export" class="button-primary" id="mla-csv-data-source-export" type="submit" value="Export Match Keys" />
127
  </span>
128
  [+_wpnonce+]
129
  </form>
@@ -195,6 +204,7 @@ ul.mla_settings li {
195
  <li><a href="#delimiter-enclosure-escape"><strong>Delimiter, Enclosure and Escape</strong></a></li>
196
  <li><a href="#accessing-csv-values"><strong>Accessing CSV Values</strong></a></li>
197
  <li><a href="#assigning-hierarchical-terms"><strong>Assigning Hierarchical Terms</strong></a></li>
 
198
  </ul>
199
  <p>
200
  &nbsp;
@@ -255,7 +265,7 @@ To match a record containing CSV variables to the correct Media Library item the
255
  If you select a file that does not contain the match variable you select on the General tab you will see a warning message at the top of the screen. None of the variables in the file will be accessible until you select a match variable that the file contains.
256
  </p>
257
  <p>
258
- You can use the "Export Match Keys" button at the bottom of the General tag to create and download a CSV file containing all three match key values of the items in the destination site. You can use this file to match the File Name or the Base Name to the correct destination site ID values and update your source file with the correct ID values.
259
  <a name="delimiter-enclosure-escape"></a>
260
  </p>
261
  <p>
@@ -301,5 +311,31 @@ The <a title="Find the Path Mapping Example" href="[+example_url+]&amp;mla-examp
301
  </p>
302
  <p>
303
  The MLA Path Mapping Example plugin includes a Settings/MLA Path Mapping Documentation tab with a detailed discussion of hierarchical term implementation and how to code term path names in your CSV file.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  </p>
305
  </div>
2
  <a name="backtotop"></a>
3
  &nbsp;
4
  <div class="wrap">
5
+ <h1 class="wp-heading-inline">[+plugin_title+] [+version+] Settings</h1>
6
  [+messages+]
7
  [+tablist+]
8
  [+tab_content+]
20
  <p>
21
  [+messages+]
22
  </p>
 
23
  </div>
24
 
25
  <!-- template="select-option" -->
31
  <strong>Source file</strong>
32
  </td>
33
  <td>
34
+ <select name="[+slug_prefix+]_options[source]" id="mla-csv-data-source-source">
35
  [+source_options+]
36
  </select>
37
  <div class="mla-settings-help">&nbsp;&nbsp;Select the CSV file to use for the data sources.</div>
42
  <strong>Match on</strong>
43
  </td>
44
  <td>
45
+ <select name="[+slug_prefix+]_options[match]" id="mla-csv-data-source-match">
46
  <option [+id_selected+] value="id">ID (or .ID)</option>
47
  <option [+base_file_selected+] value="base_file">Base File</option>
48
  <option [+file_name_selected+] value="file_name">File Name (only)</option>
55
  <strong>Delimiter</strong>
56
  </td>
57
  <td>
58
+ <input name="[+slug_prefix+]_options[delimiter]" id="mla-csv-data-source-delimiter" type="text" size="1" maxlength="1" value="[+delimiter+]" />
59
  <div class="mla-settings-help">&nbsp;&nbsp;Enter the (one character) delimiter that separates variables.</div>
60
  </td>
61
  </tr>
64
  <strong>Enclosure</strong>
65
  </td>
66
  <td>
67
+ <input name="[+slug_prefix+]_options[enclosure]" id="mla-csv-data-source-enclosure" type="text" size="1" maxlength="1" value="[+enclosure+]" />
68
  <div class="mla-settings-help">&nbsp;&nbsp;Enter the (one) character that encloses a variable.</div>
69
  </td>
70
  </tr>
73
  <strong>Escape</strong>
74
  </td>
75
  <td>
76
+ <input name="[+slug_prefix+]_options[escape]" id="mla-csv-data-source-escape" type="text" size="1" maxlength="1" value="[+escape+]" />
77
  <div class="mla-settings-help">&nbsp;&nbsp;Enter the (one) character that escapes special characters within a variable.</div>
78
  </td>
79
  </tr>
80
+ <tr valign="top">
81
+ <td class="textright">
82
+ <strong>Exports</strong>
83
+ </td>
84
+ <td>
85
+ <textarea name="[+slug_prefix+]_options[exports]" id="mla-csv-data-source-exports" rows="4" cols="80" >[+exports+]</textarea>
86
+ <div class="mla-settings-help">&nbsp;&nbsp;Enter data sources, substitution parameters or content templates; one entry per line.<br />&nbsp;&nbsp;See Documentation tab for details.</div>
87
+ </td>
88
+ </tr>
89
 
90
  <!-- template="general-tab" -->
91
  <style type='text/css'>
126
  </tbody>
127
  </table>
128
  <span class="submit mla-settings-submit">
129
+ <input name="[+slug_prefix+]_options_save" class="button-primary" id="[+slug_prefix+]_options_save" type="submit" value="Save Changes" />
130
+ <input name="[+slug_prefix+]_options_reset" class="button-primary alignright" id="[+slug_prefix+]_options_reset" type="submit" value="Delete Settings, Restore Defaults" />
131
  </span>
132
+ <h3>Export Item Values</h3>
133
  <p>Click the button below to download a CSV file containing the ID, Base File and File Name values for all the items currently in your Media Library.</p>
134
  <span class="submit mla-settings-submit">
135
+ <input name="[+slug_prefix+]_options_export" class="button-primary" id="mla-csv-data-source-export" type="submit" value="Export Item Values" />
136
  </span>
137
  [+_wpnonce+]
138
  </form>
204
  <li><a href="#delimiter-enclosure-escape"><strong>Delimiter, Enclosure and Escape</strong></a></li>
205
  <li><a href="#accessing-csv-values"><strong>Accessing CSV Values</strong></a></li>
206
  <li><a href="#assigning-hierarchical-terms"><strong>Assigning Hierarchical Terms</strong></a></li>
207
+ <li><a href="#exporting-item-values"><strong>Exporting Item Values</strong></a></li>
208
  </ul>
209
  <p>
210
  &nbsp;
265
  If you select a file that does not contain the match variable you select on the General tab you will see a warning message at the top of the screen. None of the variables in the file will be accessible until you select a match variable that the file contains.
266
  </p>
267
  <p>
268
+ You can use the "Export Item Values" button at the bottom of the General tag to create and download a CSV file containing all three match key values of the items in the destination site. Study the "<a href="#exporting-item-values">Exporting Item Values</a>" section below for more information.
269
  <a name="delimiter-enclosure-escape"></a>
270
  </p>
271
  <p>
311
  </p>
312
  <p>
313
  The MLA Path Mapping Example plugin includes a Settings/MLA Path Mapping Documentation tab with a detailed discussion of hierarchical term implementation and how to code term path names in your CSV file.
314
+ <a name="exporting-item-values"></a>
315
+ </p>
316
+ <p>
317
+ <a href="#backtotop">Go to Top</a>
318
+ </p>
319
+ <h3>Exporting Item Values</h3>
320
+ <p>
321
+ You can use the "Export Item Values" button at the bottom of the General tag to create and download a CSV file containing all three match key values of all Media Library items in the destination site. You can use this file to match the File Name or the Base Name to the correct destination site ID values and update your source file with the correct ID values.
322
+ </p>
323
+ <p>
324
+ At a minimum the file will contain three columns - Base Name, File Name and ID. You can add additional columns to the file by defining them in the "Exports" text area on the General tab. In the text area you can define multiple columns, entering <strong>one definition per line</strong>. Each definition contains an optional column name and a Field-level Substitution Parameter specifying the column content.
325
+ </p>
326
+ <p>
327
+ If you do not add a column name to your definition the column content specification will be used as a default name. For simple specifications this is often a good choice. If your specification is long or complex you will want to give the column a more practical name. To add a name, start the specification with a double-quote ('<strong>"</strong>'), enter the name and end the name with a double-quote followed by a comma. For example, <code>"Title",post_title</code> or <code>"Date Taken",[+exif:DateTimeOriginal+]</code>.
328
+ </p>
329
+ <p>
330
+ The column content specification can use almost all of the features described in the "Field-level Substitution Parameters" section of MLA's Settings/Media Library Assistant Documentation tab. The <code>query:</code> prefix is not available because it only applies to the <code>[mla_gallery]</code> shortcode. For the same reason the substitution parameters described in the "Style and Markup Templates" section are not available. In particular, the "Attachment-specific substitution parameters for the markup template Item part" are not available; use the equivalent "Field-level data sources" instead.
331
+ </p>
332
+ <p>
333
+ For convenience you can omit the enclosing "[+" and "+]" delimiters from the specification. The plugin will use the specification as the default column name and add enclosing delimiters, e.g., <code>post_title</code> becomes <code>"post_title",[+post_title+]</code>. You can add one of the "Field-level option/format values" or use a prefix as well, e.g., <code>exif:DateTimeOriginal,date('j F, Y')</code> becomes <code>"exif:DateTimeOriginal,date('j F, Y')",[+exif:DateTimeOriginal,date('j F, Y')+]</code>. Of course, you can add your own column name if desired.
334
+ </p>
335
+ <p>
336
+ You can use a Content Template for more complex requirements. The conditional and choice elements are the key to templates' power, particularly with custom fields and metadata such as IPTC and EXIF. With the conditional element you can combine literal text with a substitution value and eliminate the text if the value is missing. With the choice element you can specify multiple sources for a value and decide the order in which they are tested. For example:<br />&nbsp;<br />
337
+ <code>"Date Taken",template:([+exif:DateTimeOriginal,date('j F, Y')+])|([+iptc:DateCreated,date('j F, Y')+])|([+xmp:CreateDate,date('j F, Y')+])</code>
338
+ <br />&nbsp;<br />
339
+ The above example uses the value from any of three sources and translates the result into a common format.
340
  </p>
341
  </div>
examples/plugins/mla-csv-data-source-example/class-mla-example-plugin-settings-101.php ADDED
@@ -0,0 +1,559 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Provides option management and Settings/ General and Documentation submenu pages
4
+ *
5
+ * This file might be shared among multiple example plugins, so load it with:
6
+ *
7
+ * if ( ! class_exists( 'MLAExamplePluginSettings101' ) ) {
8
+ * require_once( pathinfo( __FILE__, PATHINFO_DIRNAME ) . '/class-mla-example-plugin-settings-101.php' );
9
+ * }
10
+ *
11
+ * @package Media Library Assistant
12
+ * @version 1.01
13
+ */
14
+
15
+ /**
16
+ * Class MLA Example Settings Menu adds Settings/ General and Documentation submenu pages to an example plugin
17
+ *
18
+ * @package MLA Example Settings Menu
19
+ * @since 1.00
20
+ */
21
+ class MLAExamplePluginSettings101 {
22
+ /**
23
+ * Default values for the __construct function
24
+ *
25
+ * @since 1.00
26
+ *
27
+ * @var array
28
+ */
29
+ private static $default_arguments = array(
30
+ 'slug_prefix' => 'example-plugin',
31
+ 'plugin_title' => 'The Example Plugin',
32
+ 'menu_title' => 'Example Plugin',
33
+ 'plugin_file_name_only' => 'the-example-plugin',
34
+ 'plugin_version' => '1.00',
35
+ 'template_file' => 'absolute path to the template file', // e.g., dirname( __FILE__ ) . '/admin-settings-page.tpl'
36
+ 'options' => array( 'slug' => array( 'type' => 'text|checkbox', 'default' => 'text|boolean' ) ),
37
+ 'general_tab_values' => array(), // additional page_values for 'page-level-options' template
38
+ 'documentation_tab_values' => array(), // page_values for 'documentation-tab' template
39
+ );
40
+
41
+ /**
42
+ * Current values for this object instance
43
+ *
44
+ * @since 1.00
45
+ *
46
+ * @var array
47
+ */
48
+ private $current_arguments = array();
49
+
50
+ /**
51
+ * This function sets option definitions and installs filters.
52
+ *
53
+ * @since 1.00
54
+ *
55
+ * @param array $attr Option definitions and settings
56
+ */
57
+ public function __construct( $attr ) {
58
+ //error_log( __LINE__ . " MLAExamplePluginSettings101::__construct() _REQUEST = " . var_export( $_REQUEST, true ), 0 );
59
+ // Make sure $attr is an array, even if it's empty
60
+ if ( empty( $attr ) ) {
61
+ $attr = array();
62
+ } elseif ( is_string( $attr ) ) {
63
+ $attr = shortcode_parse_atts( $attr );
64
+ }
65
+
66
+ // Accept only the attributes we need and supply defaults
67
+ $this->current_arguments = shortcode_atts( self::$default_arguments, $attr );
68
+
69
+ // Compile the default settings
70
+ foreach ( $this->current_arguments['options'] as $slug => $option ) {
71
+ $this->default_settings[ $slug ] = $option['default'];
72
+ }
73
+
74
+ if ( is_admin() ) {
75
+ // Record new settings if they're being updated
76
+ $this->request_settings = array();
77
+ if ( !empty( $_REQUEST[ $this->current_arguments['slug_prefix'] . '_options_save'] ) ) {
78
+ if ( isset( $_REQUEST[ $this->current_arguments['slug_prefix'] . '_options' ] ) ) {
79
+ $this->request_settings = wp_unslash( $_REQUEST[ $this->current_arguments['slug_prefix'] . '_options' ] );
80
+ }
81
+ } elseif ( !empty( $_REQUEST[ $this->current_arguments['slug_prefix'] . '_options_reset'] ) ) {
82
+ $this->request_settings = $this->default_settings;
83
+ }
84
+ //error_log( __LINE__ . ' MLAExamplePluginSettings101::__construct request_settings = ' . var_export( $this->request_settings, true ), 0 );
85
+ //error_log( __LINE__ . ' MLAExamplePluginSettings101::__construct mla_hex_dump( exports ) = ' . var_export( MLAData::mla_hex_dump( $this->request_settings['exports'] ), true ), 0 );
86
+ // Add submenu page in the "Settings" section
87
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Add submenu page in the "Settings" section
93
+ *
94
+ * @since 1.00
95
+ */
96
+ public function admin_menu() {
97
+ /*
98
+ * We need a tab-specific page ID to manage the screen options on the General tab.
99
+ * Use the URL suffix, if present. If the URL doesn't have a tab suffix, use '-general'.
100
+ * This hack is required to pass the WordPress "referer" validation.
101
+ */
102
+ if ( isset( $_REQUEST['page'] ) && is_string( $_REQUEST['page'] ) && ( $this->current_arguments['slug_prefix'] . '-settings-' == substr( $_REQUEST['page'], 0, strlen( $this->current_arguments['slug_prefix'] . '-settings-' ) ) ) ) {
103
+ $tab = substr( $_REQUEST['page'], strlen( $this->current_arguments['slug_prefix'] . '-settings-' ) );
104
+ } else {
105
+ $tab = 'general';
106
+ }
107
+
108
+ $tab = $this->_get_options_tablist( $tab ) ? '-' . $tab : '-general';
109
+ add_submenu_page( 'options-general.php', $this->current_arguments['plugin_title'], $this->current_arguments['menu_title'], 'manage_options', $this->current_arguments['slug_prefix'] . '-settings' . $tab, array( $this, 'add_submenu_page' ) );
110
+ add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2 );
111
+ }
112
+
113
+ /**
114
+ * Add the "Settings" and "Guide" links to the Plugins section entry
115
+ *
116
+ * @since 1.00
117
+ *
118
+ * @param array array of links for the Plugin, e.g., "Activate"
119
+ * @param string Directory and name of the plugin Index file
120
+ *
121
+ * @return array Updated array of links for the Plugin
122
+ */
123
+ public function plugin_action_links( $links, $file ) {
124
+ if ( $file == $this->current_arguments['plugin_file_name_only'] . '/' . $this->current_arguments['plugin_file_name_only'] . '.php' ) {
125
+ $settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'options-general.php?page=' . $this->current_arguments['slug_prefix'] . '-settings-documentation&mla_tab=documentation' ), 'Guide' );
126
+ array_unshift( $links, $settings_link );
127
+ $settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'options-general.php?page=' . $this->current_arguments['slug_prefix'] . '-settings-general' ), 'Settings' );
128
+ array_unshift( $links, $settings_link );
129
+ }
130
+
131
+ return $links;
132
+ }
133
+
134
+ /**
135
+ * Render (echo) the example plugin's submenu in the Settings section
136
+ *
137
+ * @since 1.00
138
+ *
139
+ * @return void Echoes HTML markup for the submenu page
140
+ */
141
+ public function add_submenu_page() {
142
+ if ( !current_user_can( 'manage_options' ) ) {
143
+ echo '<h2>' . $this->current_arguments['plugin_title'] . " - Error</h2>\n";
144
+ wp_die( 'You do not have permission to manage plugin settings.' );
145
+ }
146
+
147
+ // Load template array and initialize page-level values.
148
+ $this->page_template_array = MLACore::mla_load_template( $this->current_arguments['template_file'], 'path' );
149
+ $current_tab_slug = isset( $_REQUEST['mla_tab'] ) ? $_REQUEST['mla_tab']: 'general';
150
+ $current_tab = $this->_get_options_tablist( $current_tab_slug );
151
+ $page_values = array(
152
+ 'plugin_title' => $this->current_arguments['plugin_title'],
153
+ 'version' => 'v' . $this->current_arguments['plugin_version'],
154
+ 'messages' => '',
155
+ 'tablist' => $this->_compose_settings_tabs( $current_tab_slug ),
156
+ 'tab_content' => '',
157
+ );
158
+
159
+ // Compose tab content
160
+ if ( $current_tab ) {
161
+ if ( isset( $current_tab['render'] ) ) {
162
+ $handler = $current_tab['render'];
163
+ $page_content = call_user_func( array( $this, $handler ) );
164
+ } else {
165
+ $page_content = array( 'message' => "ERROR: Cannot render content tab {$current_tab_slug}", 'body' => '' );
166
+ }
167
+ } else {
168
+ $page_content = array( 'message' => "ERROR: Unknown content tab {$current_tab_slug}", 'body' => '' );
169
+ }
170
+
171
+ if ( ! empty( $page_content['message'] ) ) {
172
+ if ( false !== strpos( $page_content['message'], 'ERROR' ) ) {
173
+ $messages_class = 'updated error';
174
+ } else {
175
+ $messages_class = 'updated notice is-dismissible';
176
+ }
177
+
178
+ $page_values['messages'] = MLAData::mla_parse_template( $this->page_template_array['messages'], array(
179
+ 'mla_messages_class' => $messages_class ,
180
+ 'messages' => $page_content['message'],
181
+ ) );
182
+ }
183
+
184
+ $page_values['tab_content'] = $page_content['body'];
185
+
186
+ echo MLAData::mla_parse_template( $this->page_template_array['page'], $page_values );
187
+ }
188
+
189
+ /**
190
+ * Template file for the Settings page(s) and parts
191
+ *
192
+ * This array contains all of the template parts for the Settings page(s). The array is built once
193
+ * each page load and cached for subsequent use.
194
+ *
195
+ * @since 1.00
196
+ *
197
+ * @var array
198
+ */
199
+ private $page_template_array = NULL;
200
+
201
+ /**
202
+ * Definitions for Settings page tab ids, titles and handlers
203
+ * Each tab is defined by an array with the following elements:
204
+ *
205
+ * array key => HTML id/name attribute and option database key (OMIT MLA_OPTION_PREFIX)
206
+ *
207
+ * title => tab label / heading text
208
+ * render => rendering function for tab messages and content. Usage:
209
+ * $tab_content = ['render']();
210
+ *
211
+ * @since 1.00
212
+ *
213
+ * @var array
214
+ */
215
+ private $mla_tablist = array(
216
+ 'general' => array( 'title' => 'General', 'render' => '_compose_general_tab' ),
217
+ 'documentation' => array( 'title' => 'Documentation', 'render' => '_compose_documentation_tab' ),
218
+ );
219
+
220
+ /**
221
+ * Retrieve the list of options tabs or a specific tab value
222
+ *
223
+ * @since 1.00
224
+ *
225
+ * @param string Tab slug, to retrieve a single entry
226
+ *
227
+ * @return array|false The entire tablist ( $tab = NULL ), a single tab entry or false if not found/not allowed
228
+ */
229
+ private function _get_options_tablist( $tab = NULL ) {
230
+ if ( is_string( $tab ) ) {
231
+ if ( isset( $this->mla_tablist[ $tab ] ) ) {
232
+ $results = $this->mla_tablist[ $tab ];
233
+ } else {
234
+ $results = false;
235
+ }
236
+ } else {
237
+ $results = $this->mla_tablist;
238
+ }
239
+
240
+ return $results;
241
+ }
242
+
243
+ /**
244
+ * Compose the navigation tabs for the Settings subpage
245
+ *
246
+ * @since 1.00
247
+ * @uses $page_template_array contains tablist and tablist-item templates
248
+ *
249
+ * @param string Optional data-tab-id value for the active tab, default 'general'
250
+ *
251
+ * @return string HTML markup for the Settings subpage navigation tabs
252
+ */
253
+ private function _compose_settings_tabs( $active_tab = 'general' ) {
254
+ $tablist_item = $this->page_template_array['tablist-item'];
255
+ $tabs = '';
256
+ foreach ( $this->_get_options_tablist() as $key => $item ) {
257
+ $item_values = array(
258
+ 'data-tab-id' => $key,
259
+ 'nav-tab-active' => ( $active_tab == $key ) ? 'nav-tab-active' : '',
260
+ 'settings-page' => $this->current_arguments['slug_prefix'] . '-settings-' . $key,
261
+ 'title' => $item['title']
262
+ );
263
+
264
+ $tabs .= MLAData::mla_parse_template( $tablist_item, $item_values );
265
+ } // foreach $item
266
+
267
+ $tablist_values = array( 'tablist' => $tabs );
268
+ return MLAData::mla_parse_template( $this->page_template_array['tablist'], $tablist_values );
269
+ }
270
+
271
+ /**
272
+ * Compose the General tab content for the Settings subpage
273
+ *
274
+ * @since 1.00
275
+ * @uses $page_template_array contains tab content template(s)
276
+ *
277
+ * @return array 'message' => status/error messages, 'body' => tab content
278
+ */
279
+ private function _compose_general_tab() {
280
+ $page_content = array( 'message' => '', 'body' => '' );
281
+
282
+ // Check for page-level Save Changes, Restore Defaults
283
+ if ( !empty( $_REQUEST[ $this->current_arguments['slug_prefix'] . '_options_save'] ) ) {
284
+ check_admin_referer( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME );
285
+ $page_content = $this->_save_setting_changes();
286
+ } elseif ( !empty( $_REQUEST[ $this->current_arguments['slug_prefix'] . '_options_reset'] ) ) {
287
+ check_admin_referer( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME );
288
+ $page_content = $this->_restore_setting_defaults();
289
+ }
290
+
291
+ if ( !empty( $page_content['body'] ) ) {
292
+ return $page_content;
293
+ }
294
+
295
+ // Display the General tab
296
+ $_SERVER['REQUEST_URI'] = remove_query_arg( array(
297
+ $this->current_arguments['slug_prefix'] . '_options',
298
+ '_wpnonce',
299
+ '_wp_http_referer',
300
+ $this->current_arguments['slug_prefix'] . '_options_save',
301
+ $this->current_arguments['slug_prefix'] . '_options_reset',
302
+ ), $_SERVER['REQUEST_URI'] );
303
+
304
+ // Compose page-level options
305
+ $page_values = $this->current_arguments['general_tab_values'];
306
+
307
+ foreach ( $this->current_arguments['options'] as $slug => $option ) {
308
+ if ( 'checkbox' === $option['type'] ) {
309
+ $page_values[ $slug . '_checked' ] = $this->get_plugin_option( $slug ) ? 'checked="checked" ' : '';
310
+ } else {
311
+ $page_values[ $slug ] = esc_attr( $this->get_plugin_option( $slug ) );
312
+ }
313
+ }
314
+ //error_log( __LINE__ . ' MLAExamplePluginSettings101::_compose_general_tab page_values = ' . var_export( $page_values, true ), 0 );
315
+
316
+ $options_list = MLAData::mla_parse_template( $this->page_template_array['page-level-options'], $page_values );
317
+
318
+ $form_arguments = '?page=' . $this->current_arguments['slug_prefix'] . '-settings-general&mla_tab=general';
319
+
320
+ $page_values = array(
321
+ 'form_url' => admin_url( 'options-general.php' ) . $form_arguments,
322
+ '_wpnonce' => wp_nonce_field( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME, true, false ),
323
+ 'options_list' => $options_list,
324
+ 'slug_prefix' => $this->current_arguments['slug_prefix'],
325
+ );
326
+
327
+ $page_content['body'] .= MLAData::mla_parse_template( $this->page_template_array['general-tab'], $page_values );
328
+
329
+ return $page_content;
330
+ }
331
+
332
+ /**
333
+ * Compose the Documentation tab content for the Settings subpage
334
+ *
335
+ * @since 1.00
336
+ * @uses $page_template_array contains tab content template(s)
337
+ *
338
+ * @return array 'message' => status/error messages, 'body' => tab content
339
+ */
340
+ private function _compose_documentation_tab() {
341
+ $page_content = array( 'message' => '', 'body' => '' );
342
+ $page_values = array(
343
+ );
344
+
345
+ $page_content['body'] = MLAData::mla_parse_template( $this->page_template_array['documentation-tab'], $this->current_arguments['documentation_tab_values'] );
346
+ return $page_content;
347
+ }
348
+
349
+ /**
350
+ * Save settings as a WordPress wp_options entry
351
+ *
352
+ * @since 1.00
353
+ *
354
+ * @return array 'message' => status/error messages, 'body' => tab content
355
+ */
356
+ private function _save_setting_changes() {
357
+ $page_content = array( 'message' => 'Settings unchanged.', 'body' => '' );
358
+
359
+ $changed = false;
360
+ //error_log( __LINE__ . ' MLAExamplePluginSettings101::_save_setting_changes current_arguments[options] = ' . var_export( $this->current_arguments['options'], true ), 0 );
361
+ foreach ( $this->current_arguments['options'] as $slug => $option ) {
362
+ if ( 'checkbox' === $option['type'] ) {
363
+ $changed |= $this->_update_plugin_option( $slug, isset( $this->request_settings[ $slug ] ) );
364
+ } else {
365
+ if ( isset( $this->request_settings[ $slug ] ) ) {
366
+ $changed |= $this->_update_plugin_option( $slug, $this->request_settings[ $slug ] );
367
+ } else {
368
+ $changed |= $this->_update_plugin_option( $slug, $option['default'] );
369
+ }
370
+ }
371
+ } // foreach option
372
+ $this->request_settings = array();
373
+ //error_log( __LINE__ . " MLAExamplePluginSettings101::_save_setting_changes( {$changed} ) final current_settings = " . var_export( $this->current_settings, true ), 0 );
374
+
375
+ if ( $changed ) {
376
+ // No reason to save defaults in the database
377
+ if ( $this->current_settings === $this->default_settings ) {
378
+ delete_option( $this->current_arguments['slug_prefix'] . '-settings' );
379
+ } else {
380
+ $changed = update_option( $this->current_arguments['slug_prefix'] . '-settings', $this->current_settings, false );
381
+ }
382
+
383
+ if ( $changed ) {
384
+ $page_content['message'] = "Settings have been updated.";
385
+ } else {
386
+ $page_content['message'] = "Settings updated failed.";
387
+ }
388
+ }
389
+
390
+ return $page_content;
391
+ } // _save_setting_changes
392
+
393
+ /**
394
+ * Delete the plugin's WordPress wp_options entry, restoring the default settings
395
+ *
396
+ * @since 1.00
397
+ *
398
+ * @return array 'message' => status/error messages, 'body' => tab content
399
+ */
400
+ private function _restore_setting_defaults() {
401
+ $page_content = array( 'message' => 'Settings unchanged.', 'body' => '' );
402
+ $this->current_settings = $this->default_settings;
403
+ $changed = delete_option( $this->current_arguments['slug_prefix'] . '-settings' );
404
+
405
+ if ( $changed ) {
406
+ $page_content['message'] = "Settings have been updated.";
407
+ }
408
+
409
+ return $page_content;
410
+ } // _restore_setting_defaults
411
+
412
+ /**
413
+ * Assemble the in-memory representation of the plugin settings
414
+ *
415
+ * @since 1.00
416
+ *
417
+ * @param boolean $force_refresh Optional. Force a reload of rules. Default false.
418
+ *
419
+ * @return boolean Success (true) or failure (false) of the operation
420
+ */
421
+ private function _get_plugin_settings( $force_refresh = false ) {
422
+ if ( false == $force_refresh && NULL != $this->current_settings ) {
423
+ return true;
424
+ }
425
+
426
+ // Update the plugin options from the wp_options table or set defaults
427
+ $this->current_settings = get_option( $this->current_arguments['slug_prefix'] . '-settings' );
428
+ //error_log( __LINE__ . ' MLAExamplePluginSettings101::_get_plugin_settings stored current_settings = ' . var_export( $this->current_settings, true ), 0 );
429
+ if ( !is_array( $this->current_settings ) ) {
430
+ $this->current_settings = $this->default_settings;
431
+ }
432
+
433
+ // Initialize any new setting(s) from the default settings
434
+ foreach ( $this->current_arguments['options'] as $slug => $option ) {
435
+ if ( !isset( $this->current_settings[ $slug ] ) ) {
436
+ $this->current_settings[ $slug ] = $option['default'];
437
+ }
438
+ }
439
+
440
+ //error_log( __LINE__ . ' MLAExamplePluginSettings101::_get_plugin_settings final current_settings = ' . var_export( $this->current_settings, true ), 0 );
441
+ return true;
442
+ }
443
+
444
+ /**
445
+ * Updated option settings from the $_REQUEST array
446
+ *
447
+ * @since 1.01
448
+ *
449
+ * @var array
450
+ */
451
+ private $request_settings = array();
452
+
453
+ /**
454
+ * In-memory representation of the option settings
455
+ *
456
+ * @since 1.00
457
+ *
458
+ * @var array
459
+ */
460
+ private $current_settings = NULL;
461
+
462
+ /**
463
+ * Default processing options
464
+ *
465
+ * @since 1.00
466
+ *
467
+ * @var array
468
+ */
469
+ private $default_settings = array();
470
+
471
+ /**
472
+ * Update a plugin option setting
473
+ *
474
+ * @since 1.00
475
+ *
476
+ * @param string $name Option name
477
+ * @param mixed $new_value Option value
478
+ *
479
+ * @return mixed True if option value changed, false if value unchanged, NULL if failure
480
+ */
481
+ private function _update_plugin_option( $name, $new_value ) {
482
+ if ( !$this->_get_plugin_settings() ) {
483
+ return NULL;
484
+ }
485
+
486
+ $old_value = isset( $this->current_settings[ $name ] ) ? $this->current_settings[ $name ] : NULL;
487
+
488
+ if ( $new_value === $old_value ) {
489
+ return false;
490
+ }
491
+
492
+ $this->current_settings[ $name ] = $new_value;
493
+ return true;
494
+ }
495
+
496
+ /**
497
+ * Get a plugin option setting
498
+ *
499
+ * @since 1.00
500
+ *
501
+ * @param string $name Option name
502
+ *
503
+ * @return mixed Option value, if it exists else NULL
504
+ */
505
+ public function get_plugin_option( $name ) {
506
+ if ( !$this->_get_plugin_settings() ) {
507
+ return NULL;
508
+ }
509
+
510
+ // See if the setting is being updated
511
+ if ( isset( $this->request_settings[ $name ] ) ) {
512
+ return $this->request_settings[ $name ];
513
+ }
514
+
515
+ if ( isset( $this->current_settings[ $name ] ) ) {
516
+ return $this->current_settings[ $name ];
517
+ }
518
+
519
+ return NULL;
520
+ }
521
+
522
+ /**
523
+ * Get a plugin argument setting
524
+ *
525
+ * @since 1.01
526
+ *
527
+ * @param string $name Argument name
528
+ *
529
+ * @return mixed Argument value, if it exists else NULL
530
+ */
531
+ public function get_plugin_argument( $name ) {
532
+ if ( !isset( $this->current_arguments[ $name ] ) ) {
533
+ return NULL;
534
+ }
535
+
536
+ return $this->current_arguments[ $name ];
537
+ }
538
+
539
+ /**
540
+ * Update a plugin argument setting
541
+ *
542
+ * @since 1.01
543
+ *
544
+ * @param string $name Argument name
545
+ *
546
+ * @return boolean True if argument value changed, false if value unchanged
547
+ */
548
+ public function update_plugin_argument( $name, $new_value ) {
549
+ $old_value = isset( $this->current_arguments[ $name ] ) ? $this->current_arguments[ $name ] : NULL;
550
+
551
+ if ( $new_value === $old_value ) {
552
+ return false;
553
+ }
554
+
555
+ $this->current_arguments[ $name ] = $new_value;
556
+ return true;
557
+ }
558
+ } // Class MLAExamplePluginSettings101
559
+ ?>
examples/plugins/mla-csv-data-source-example/mla-csv-data-source-example.php CHANGED
@@ -50,8 +50,16 @@
50
  * opened on 9/25/2012 by "brentwz".
51
  * https://wordpress.org/support/topic/plugin-media-library-assistant-what-about-a-media-library-exportimport-function/
52
  *
 
 
 
 
 
 
 
 
53
  * @package MLA CSV Data Source Example
54
- * @version 1.01
55
  */
56
 
57
  /*
@@ -59,7 +67,7 @@ Plugin Name: MLA CSV Data Source Example
59
  Plugin URI: http://davidlingren.com/
60
  Description: Populates one or more data sources from a CSV file
61
  Author: David Lingren
62
- Version: 1.01
63
  Author URI: http://davidlingren.com/
64
 
65
  Copyright 2020 David Lingren
@@ -95,7 +103,7 @@ class MLACSVDataSourceExample {
95
  *
96
  * @var string
97
  */
98
- const CURRENT_VERSION = '1.01';
99
 
100
  /**
101
  * Slug prefix for registering and enqueueing submenu pages, style sheets, scripts and settings
@@ -107,134 +115,94 @@ class MLACSVDataSourceExample {
107
  const SLUG_PREFIX = 'mlacsvdatasource';
108
 
109
  /**
110
- * Initialization function, similar to __construct()
111
  *
112
- * Installs filters and actions that handle the MLA hooks for uploading and mapping.
113
  *
114
- * @since 1.00
115
- *
116
- * @return void
117
- */
118
- public static function initialize() {
119
- if ( !empty( $_REQUEST['mla_csv_data_source_options_export'] ) ) {
120
- // Match Keys download will be handled in the admin_init filter
121
- check_admin_referer( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME );
122
- self::export_match_keys_action( );
123
- return;
124
- }
125
-
126
- // Defined in /media-library-assistant/includes/class-mla-data.php
127
- add_filter( 'mla_expand_custom_prefix', 'MLACSVDataSourceExample::mla_expand_custom_prefix', 10, 8 );
128
-
129
- // The remaining filters are only useful in the admin section; exit if in the "front-end" posts/pages.
130
- if ( ! is_admin() )
131
- return;
132
-
133
- // Add submenu page in the "Settings" section
134
- add_action( 'admin_menu', 'MLACSVDataSourceExample::admin_menu' );
135
- } // initialize
136
-
137
- /**
138
- * Add submenu page in the "Settings" section
139
- *
140
- * @since 1.00
141
  */
142
- public static function admin_menu( ) {
143
- /*
144
- * We need a tab-specific page ID to manage the screen options on the General tab.
145
- * Use the URL suffix, if present. If the URL doesn't have a tab suffix, use '-general'.
146
- * This hack is required to pass the WordPress "referer" validation.
147
- */
148
- if ( isset( $_REQUEST['page'] ) && is_string( $_REQUEST['page'] ) && ( self::SLUG_PREFIX . '-settings-' == substr( $_REQUEST['page'], 0, strlen( self::SLUG_PREFIX . '-settings-' ) ) ) ) {
149
- $tab = substr( $_REQUEST['page'], strlen( self::SLUG_PREFIX . '-settings-' ) );
150
- } else {
151
- $tab = 'general';
152
- }
153
-
154
- $tab = self::_get_options_tablist( $tab ) ? '-' . $tab : '-general';
155
- add_submenu_page( 'options-general.php', 'MLA CSV Data Source Example', 'MLA CSV Data', 'manage_options', self::SLUG_PREFIX . '-settings' . $tab, 'MLACSVDataSourceExample::add_submenu_page' );
156
- add_filter( 'plugin_action_links', 'MLACSVDataSourceExample::plugin_action_links', 10, 2 );
157
- } // admin_menu
 
 
 
 
158
 
159
  /**
160
- * Add the "Settings" and "Guide" links to the Plugins section entry
161
  *
162
- * @since 1.00
163
- *
164
- * @param array array of links for the Plugin, e.g., "Activate"
165
- * @param string Directory and name of the plugin Index file
166
  *
167
- * @return array Updated array of links for the Plugin
168
  */
169
- public static function plugin_action_links( $links, $file ) {
170
- if ( $file == 'mla-csv-data-source-example/mla-csv-data-source-example.php' ) {
171
- $settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'options-general.php?page=' . self::SLUG_PREFIX . '-settings-documentation&mla_tab=documentation' ), 'Guide' );
172
- array_unshift( $links, $settings_link );
173
- $settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'options-general.php?page=' . self::SLUG_PREFIX . '-settings-general' ), 'Settings' );
174
- array_unshift( $links, $settings_link );
175
- }
176
-
177
- return $links;
178
- } // plugin_action_links
179
 
180
  /**
181
- * Render (echo) the "MLA CSV Data" submenu in the Settings section
 
 
182
  *
183
  * @since 1.00
184
  *
185
- * @return void Echoes HTML markup for the submenu page
186
  */
187
- public static function add_submenu_page() {
188
- //error_log( __LINE__ . " MLACSVDataSourceExample:add_submenu_page _REQUEST = " . var_export( $_REQUEST, true ), 0 );
 
 
 
189
 
190
- if ( !current_user_can( 'manage_options' ) ) {
191
- echo "<h2>MLA CSV Data Source Example - Error</h2>\n";
192
- wp_die( 'You do not have permission to manage plugin settings.' );
193
  }
194
 
195
- // Load template array and initialize page-level values.
196
- self::$page_template_array = MLACore::mla_load_template( dirname( __FILE__ ) . '/admin-settings-page.tpl', 'path' );
197
- $current_tab_slug = isset( $_REQUEST['mla_tab'] ) ? $_REQUEST['mla_tab']: 'general';
198
- $current_tab = self::_get_options_tablist( $current_tab_slug );
199
- $page_values = array(
200
- 'version' => 'v' . self::CURRENT_VERSION,
201
- 'messages' => '',
202
- 'tablist' => self::_compose_settings_tabs( $current_tab_slug ),
203
- 'tab_content' => '',
204
- );
205
 
206
- // Compose tab content
207
- if ( $current_tab ) {
208
- if ( isset( $current_tab['render'] ) ) {
209
- $handler = $current_tab['render'];
210
- $page_content = call_user_func( $handler );
211
- } else {
212
- $page_content = array( 'message' => 'ERROR: Cannot render content tab', 'body' => '' );
213
- }
214
- } else {
215
- $page_content = array( 'message' => 'ERROR: Unknown content tab', 'body' => '' );
216
  }
 
 
 
217
 
218
- if ( ! empty( $page_content['message'] ) ) {
219
- if ( false !== strpos( $page_content['message'], 'ERROR' ) ) {
220
- $messages_class = 'updated error';
221
- $dismiss_button = '';
222
- } else {
223
- $messages_class = 'updated notice is-dismissible';
224
- $dismiss_button = " <button class=\"notice-dismiss\" type=\"button\"><span class=\"screen-reader-text\">[+dismiss_text+].</span></button>\n";
225
- }
226
-
227
- $page_values['messages'] = MLAData::mla_parse_template( self::$page_template_array['messages'], array(
228
- 'mla_messages_class' => $messages_class ,
229
- 'messages' => $page_content['message'],
230
- 'dismiss_button' => $dismiss_button,
231
- 'dismiss_text' => 'Dismiss this notice',
232
- ) );
233
  }
234
 
235
- $page_values['tab_content'] = $page_content['body'];
236
- echo MLAData::mla_parse_template( self::$page_template_array['page'], $page_values );
237
- } // add_submenu_page
 
 
 
 
 
 
 
 
238
 
239
  /**
240
  * Template file for the Settings page(s) and parts
@@ -268,182 +236,42 @@ class MLACSVDataSourceExample {
268
  );
269
 
270
  /**
271
- * Retrieve the list of options tabs or a specific tab value
272
  *
273
  * @since 1.00
274
  *
275
- * @param string Tab slug, to retrieve a single entry
276
- *
277
- * @return array|false The entire tablist ( $tab = NULL ), a single tab entry or false if not found/not allowed
 
 
278
  */
279
- private static function _get_options_tablist( $tab = NULL ) {
280
- if ( is_string( $tab ) ) {
281
- if ( isset( self::$mla_tablist[ $tab ] ) ) {
282
- $results = self::$mla_tablist[ $tab ];
283
- } else {
284
- $results = false;
285
- }
286
- } else {
287
- $results = self::$mla_tablist;
288
- }
289
-
290
- return $results;
291
- } // _get_options_tablist
292
 
293
  /**
294
- * Compose the navigation tabs for the Settings subpage
295
  *
296
  * @since 1.00
297
- * @uses $page_template_array contains tablist and tablist-item templates
298
- *
299
- * @param string Optional data-tab-id value for the active tab, default 'general'
300
- *
301
- * @return string HTML markup for the Settings subpage navigation tabs
302
- */
303
- private static function _compose_settings_tabs( $active_tab = 'general' ) {
304
- $tablist_item = self::$page_template_array['tablist-item'];
305
- $tabs = '';
306
- foreach ( self::_get_options_tablist() as $key => $item ) {
307
- $item_values = array(
308
- 'data-tab-id' => $key,
309
- 'nav-tab-active' => ( $active_tab == $key ) ? 'nav-tab-active' : '',
310
- 'settings-page' => self::SLUG_PREFIX . '-settings-' . $key,
311
- 'title' => $item['title']
312
- );
313
-
314
- $tabs .= MLAData::mla_parse_template( $tablist_item, $item_values );
315
- } // foreach $item
316
-
317
- $tablist_values = array( 'tablist' => $tabs );
318
- return MLAData::mla_parse_template( self::$page_template_array['tablist'], $tablist_values );
319
- } // _compose_settings_tabs
320
-
321
- /**
322
- * Compose HTML markup for the source file options if any text/csv files exist
323
- *
324
- * @since 1.00
325
- *
326
- * @param integer Optional item ID value for the current source file, default 0
327
- *
328
- * @return string HTML markup for the Source file <select> list, if any
329
- */
330
- private static function _compose_source_file_options( $current_id = 0 ) {
331
- // Default option if no files exist or there is no current selection
332
- $option_values = array(
333
- 'value' => '0',
334
- 'text' => '&mdash; select a source (CSV) file &mdash;',
335
- 'selected' => ''
336
- );
337
- $select_options = MLAData::mla_parse_template( self::$page_template_array['select-option'], $option_values );
338
-
339
- // Find all CSV files in the Media Library
340
- $args = array(
341
- 'post_type' => 'attachment',
342
- 'post_status' => 'inherit',
343
- 'post_mime_type' => 'text/csv',
344
- 'nopaging' => true,
345
- );
346
- $query = new WP_Query( $args );
347
-
348
- foreach ( $query->posts as $post ) {
349
- $option_values = array(
350
- 'value' => $post->ID,
351
- 'text' => esc_attr( $post->post_title ),
352
- 'selected' => $current_id === $post->ID ? 'selected=selected' : '',
353
- );
354
-
355
- $select_options .= MLAData::mla_parse_template( self::$page_template_array['select-option'], $option_values );
356
- }
357
-
358
- $option_values = array(
359
- 'key' => 'mla-import-settings-file',
360
- 'options' => $select_options
361
- );
362
-
363
- return $select_options;
364
- } // _compose_source_file_options
365
-
366
- /**
367
- * Compose the General tab content for the Settings subpage
368
  *
369
- * @since 1.00
370
- * @uses $page_template_array contains tab content template(s)
371
- *
372
- * @return array 'message' => status/error messages, 'body' => tab content
373
- */
374
- private static function _compose_general_tab( ) {
375
- $page_content = array( 'message' => '', 'body' => '' );
376
-
377
- // Initialize page messages and content, check for page-level Save Changes and Export Match Keys
378
- if ( !empty( $_REQUEST['mla_csv_data_source_options_save'] ) ) {
379
- check_admin_referer( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME );
380
- $page_content = self::_save_setting_changes( );
381
- }
382
-
383
- if ( !empty( $page_content['body'] ) ) {
384
- return $page_content;
385
- }
386
-
387
- // Display the General tab
388
- $_SERVER['REQUEST_URI'] = remove_query_arg( array(
389
- 'mla_csv_data_source_options',
390
- '_wpnonce',
391
- '_wp_http_referer',
392
- 'mla_csv_data_source_options_save',
393
- ), $_SERVER['REQUEST_URI'] );
394
-
395
- // Compose page-level options
396
- $page_values = array(
397
- 'source_options' => self::_compose_source_file_options( self::_get_plugin_option('source') ),
398
- 'id_selected' => 'id' === self::_get_plugin_option('match') ? 'selected=selected' : '',
399
- 'base_file_selected' => 'base_file' === self::_get_plugin_option('match') ? 'selected=selected' : '',
400
- 'file_name_selected' => 'file_name' === self::_get_plugin_option('match') ? 'selected=selected' : '',
401
- 'delimiter' => esc_attr( self::_get_plugin_option('delimiter') ),
402
- 'enclosure' => esc_attr( self::_get_plugin_option('enclosure') ),
403
- 'escape' => esc_attr( self::_get_plugin_option('escape') ),
404
- );
405
- $options_list = MLAData::mla_parse_template( self::$page_template_array['page-level-options'], $page_values );
406
-
407
- $form_arguments = '?page=' . self::SLUG_PREFIX . '-settings-general&mla_tab=general';
408
-
409
- $page_values = array(
410
- 'form_url' => admin_url( 'options-general.php' ) . $form_arguments,
411
- '_wpnonce' => wp_nonce_field( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME, true, false ),
412
- 'options_list' => $options_list,
413
- );
414
-
415
- $page_content['body'] .= MLAData::mla_parse_template( self::$page_template_array['general-tab'], $page_values );
416
-
417
- return $page_content;
418
- } // _compose_general_tab
419
-
420
- /**
421
- * Compose the General tab content for the Settings subpage
422
- *
423
- * @since 1.00
424
- * @uses $page_template_array contains tab content template(s)
425
- *
426
- * @return array 'message' => status/error messages, 'body' => tab content
427
  */
428
- private static function _compose_documentation_tab( ) {
429
- $page_content = array( 'message' => '', 'body' => '' );
430
- $page_values = array(
431
- 'example_url' => MLACore::mla_nonce_url( '?page=mla-settings-menu-documentation&mla_tab=documentation&mla-example-search=Search', MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME ),
432
- 'settingsURL' => admin_url('options-general.php'),
433
- );
434
-
435
- $page_content['body'] = MLAData::mla_parse_template( self::$page_template_array['documentation-tab'], $page_values );
436
- return $page_content;
437
- } // _compose_documentation_tab
438
 
439
  /**
440
- * Export Base Name, File Name and ID to a CSV file
441
  *
442
  * @since 1.01
443
  *
444
  * @return none terminates execution with exit();
445
  */
446
- public static function export_match_keys_action() {//
447
  global $wpdb;
448
 
449
  check_admin_referer( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME );
@@ -457,12 +285,49 @@ class MLACSVDataSourceExample {
457
  $upload_dir = $upload_dir['basedir'];
458
  $date = date("Ymd_B");
459
  $filename = "{$upload_dir}/match_keys_{$date}.csv";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
460
 
461
  $file_handle = @fopen( $filename, 'w' );
462
  if ( ! $file_handle ) {
463
  $message = sprintf( 'ERROR: The export file ( %1$s ) could not be opened.', $filename );
464
  } else {
465
- if (false === @fwrite( $file_handle, "Base Name,File Name,ID\r\n")) {
 
466
  $error_info = error_get_last();
467
 
468
  if ( false !== ( $tail = strpos( $error_info['message'], '</a>]: ' ) ) ) {
@@ -484,6 +349,12 @@ class MLACSVDataSourceExample {
484
  $pathinfo = pathinfo( $item->meta_value );
485
  $file_name = $pathinfo['basename'];
486
  $fields = array( $item->meta_value, $file_name, $item->post_id );
 
 
 
 
 
 
487
  @fputcsv( $file_handle, $fields );
488
  }
489
  }
@@ -519,161 +390,58 @@ class MLACSVDataSourceExample {
519
 
520
  @unlink( $filename );
521
  exit();
522
- } // export_match_keys_action
523
-
524
- /**
525
- * Save settings as a WordPress wp_options entry
526
- *
527
- * @since 1.00
528
- *
529
- * @return array 'message' => status/error messages, 'body' => tab content
530
- */
531
- private static function _save_setting_changes() {
532
- $page_content = array( 'message' => 'Settings unchanged.', 'body' => '' );
533
-
534
- $changed = self::_update_plugin_option( 'source', absint( $_REQUEST[ 'mla_csv_data_source_options' ]['source'] ) );
535
- $changed |= self::_update_plugin_option( 'match', stripslashes( $_REQUEST[ 'mla_csv_data_source_options' ]['match'] ) );
536
-
537
- if ( empty( $_REQUEST[ 'mla_csv_data_source_options' ]['delimiter'] ) ) {
538
- $changed |= self::_update_plugin_option( 'delimiter', self::$_default_settings['delimiter'] );
539
- } else {
540
- $changed |= self::_update_plugin_option( 'delimiter', stripslashes( $_REQUEST[ 'mla_csv_data_source_options' ]['delimiter'] ) );
541
- }
542
-
543
- if ( empty( $_REQUEST[ 'mla_csv_data_source_options' ]['enclosure'] ) ) {
544
- $changed |= self::_update_plugin_option( 'enclosure', self::$_default_settings['enclosure'] );
545
- } else {
546
- $changed |= self::_update_plugin_option( 'enclosure', stripslashes( $_REQUEST[ 'mla_csv_data_source_options' ]['enclosure'] ) );
547
- }
548
-
549
- if ( empty( $_REQUEST[ 'mla_csv_data_source_options' ]['escape'] ) ) {
550
- // An empty escape character is allowed as of PHP 7.4; is disables the escape mechanism.
551
- if ( version_compare( phpversion(), '7.4.0', '>=' ) ) {
552
- $changed |= self::_update_plugin_option( 'escape', '' );
553
- } else {
554
- $changed |= self::_update_plugin_option( 'escape', self::$_default_settings['escape'] );
555
- }
556
- } else {
557
- $changed |= self::_update_plugin_option( 'escape', stripslashes( $_REQUEST[ 'mla_csv_data_source_options' ]['escape'] ) );
558
- }
559
-
560
- if ( $changed ) {
561
- // No reason to save defaults in the database
562
- if ( self::$_settings === self::$_default_settings ) {
563
- delete_option( self::SLUG_PREFIX . '-settings' );
564
- } else {
565
- $changed = update_option( self::SLUG_PREFIX . '-settings', self::$_settings, false );
566
- }
567
-
568
- if ( $changed ) {
569
- $page_content['message'] = "Settings have been updated.";
570
- } else {
571
- $page_content['message'] = "Settings update failed.";
572
- }
573
- }
574
-
575
- if ( false === self::_validate_match_selection( false ) ) {
576
- $page_content['message'] .= "<br />WARNING: Match variable not found in source file.";
577
- }
578
-
579
- return $page_content;
580
- } // _save_setting_changes
581
-
582
- /**
583
- * Assemble the in-memory representation of the custom feed settings
584
- *
585
- * @since 1.00
586
- *
587
- * @param boolean $force_refresh Optional. Force a reload of rules. Default false.
588
- * @return boolean Success (true) or failure (false) of the operation
589
- */
590
- private static function _get_plugin_option_settings( $force_refresh = false ) {
591
- if ( false == $force_refresh && NULL != self::$_settings ) {
592
- return true;
593
- }
594
-
595
- // Update the plugin options from the wp_options table or set defaults
596
- self::$_settings = get_option( self::SLUG_PREFIX . '-settings' );
597
- if ( !is_array( self::$_settings ) ) {
598
- self::$_settings = self::$_default_settings;
599
- }
600
-
601
- return true;
602
- } // _get_plugin_option_settings
603
-
604
- /**
605
- * In-memory representation of the option settings
606
- *
607
- * @since 1.00
608
- *
609
- * @var array $_settings {
610
- * @type boolean $assign_parents Assign all terms in path, not just the last (leaf) term
611
- * @type boolean $assign_rule_parent Assign the Rule Parent (if any) in addition to terms in path
612
- * @type string $path_delimiter The delimiter that separates path components
613
- * }
614
- */
615
- private static $_settings = NULL;
616
-
617
- /**
618
- * Default processing options
619
- *
620
- * @since 1.00
621
- *
622
- * @var array
623
- */
624
- private static $_default_settings = array (
625
- 'source' => 0,
626
- 'match' => 'id',
627
- 'delimiter' => ',',
628
- 'enclosure' => '"',
629
- 'escape' => '\\',
630
- );
631
 
632
  /**
633
- * Get a custom feed option setting
634
- *
635
  * @since 1.00
636
  *
637
- * @param string $name Option name
638
  *
639
- * @return mixed Option value, if it exists else NULL
640
  */
641
- private static function _get_plugin_option( $name ) {
642
- if ( !self::_get_plugin_option_settings() ) {
643
- return NULL;
 
644
  }
 
 
 
 
 
 
 
 
645
 
646
- if ( !isset( self::$_settings[ $name ] ) ) {
647
- return NULL;
648
- }
 
 
 
 
 
649
 
650
- return self::$_settings[ $name ];
651
- } // _get_plugin_option
 
 
 
 
 
652
 
653
- /**
654
- * Update a custom feed option setting
655
- *
656
- * @since 1.00
657
- *
658
- * @param string $name Option name
659
- * @param mixed $new_value Option value
660
- *
661
- * @return mixed True if option value changed, false if value unchanged, NULL if failure
662
- */
663
- private static function _update_plugin_option( $name, $new_value ) {
664
- if ( !self::_get_plugin_option_settings() ) {
665
- return NULL;
666
  }
667
 
668
- $old_value = isset( self::$_settings[ $name ] ) ? self::$_settings[ $name ] : NULL;
669
-
670
- if ( $new_value === $old_value ) {
671
- return false;
672
- }
673
 
674
- self::$_settings[ $name ] = $new_value;
675
- return true;
676
- } // _update_plugin_option
677
 
678
  /**
679
  * In-memory representation of the CSV variables,
@@ -730,7 +498,7 @@ class MLACSVDataSourceExample {
730
  self::_load_csv_file( $use_existing, true );
731
 
732
  if ( !empty( self::$_csv_variable_names ) ) {
733
- $match = self::_get_plugin_option('match');
734
 
735
  switch ( $match ) {
736
  case 'id':
@@ -776,11 +544,11 @@ class MLACSVDataSourceExample {
776
  self::$_csv_match_variable = '';
777
  self::$_csv_match_index = false;
778
 
779
- $ID = self::_get_plugin_option('source');
780
- $match = self::_get_plugin_option('match');
781
- $delimiter = self::_get_plugin_option('delimiter');
782
- $enclosure = self::_get_plugin_option('enclosure');
783
- $escape = self::_get_plugin_option('escape');
784
 
785
  // Find the file attached to the selected item
786
  $path = get_attached_file( $ID );
50
  * opened on 9/25/2012 by "brentwz".
51
  * https://wordpress.org/support/topic/plugin-media-library-assistant-what-about-a-media-library-exportimport-function/
52
  *
53
+ * Enhanced (Export Item Values) for support topic "download url"
54
+ * opened on 5/18/2021 by "blogdropper".
55
+ * https://wordpress.org/support/topic/download-url-2/
56
+ *
57
+ * Enhanced (Export Item Values) for support topic "Import / Export to CSV for bulk edit"
58
+ * opened on 5/21/2021 by "cuppacoffee".
59
+ * https://wordpress.org/support/topic/import-export-to-csv-for-bulk-edit/
60
+ *
61
  * @package MLA CSV Data Source Example
62
+ * @version 1.02
63
  */
64
 
65
  /*
67
  Plugin URI: http://davidlingren.com/
68
  Description: Populates one or more data sources from a CSV file
69
  Author: David Lingren
70
+ Version: 1.02
71
  Author URI: http://davidlingren.com/
72
 
73
  Copyright 2020 David Lingren
103
  *
104
  * @var string
105
  */
106
+ const PLUGIN_VERSION = '1.02';
107
 
108
  /**
109
  * Slug prefix for registering and enqueueing submenu pages, style sheets, scripts and settings
115
  const SLUG_PREFIX = 'mlacsvdatasource';
116
 
117
  /**
118
+ * Configuration values for the Settings Management object
119
  *
120
+ * @since 1.02
121
  *
122
+ * @var array
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  */
124
+ private static $settings_arguments = array(
125
+ 'slug_prefix' => self::SLUG_PREFIX,
126
+ 'plugin_title' => 'MLA CSV Data Source Example',
127
+ 'menu_title' => 'MLA CSV Data',
128
+ 'plugin_file_name_only' => 'mla-csv-data-source-example',
129
+ 'plugin_version' => self::PLUGIN_VERSION,
130
+ 'template_file' => '/admin-settings-page.tpl', // Add the path at runtime, in initialize()
131
+ 'options' => array( // 'slug' => array( 'type' => 'text|checkbox', 'default' => 'text|boolean' )
132
+ 'source' => array( 'type' => 'select', 'default' => 0 ),
133
+ 'match' => array( 'type' => 'select', 'default' => 'id' ),
134
+ 'delimiter' => array( 'type' => 'text', 'default' => ',' ),
135
+ 'enclosure' => array( 'type' => 'text', 'default' => '"' ),
136
+ 'escape' => array( 'type' => 'text', 'default' => '\\' ),
137
+ 'exports' => array( 'type' => 'textarea', 'default' => '' ),
138
+ ),
139
+ 'general_tab_values' => array(), // additional page_values for 'page-level-options' template
140
+ 'documentation_tab_values' => array(
141
+ 'plugin_title' => 'MLA CSV Data Source Example',
142
+ ), // page_values for 'documentation-tab' template
143
+ );
144
 
145
  /**
146
+ * Settings Management object
147
  *
148
+ * @since 1.02
 
 
 
149
  *
150
+ * @var array
151
  */
152
+ private static $plugin_settings = NULL;
 
 
 
 
 
 
 
 
 
153
 
154
  /**
155
+ * Initialization function, similar to __construct()
156
+ *
157
+ * Installs filters and actions that handle the MLA hooks for uploading and mapping.
158
  *
159
  * @since 1.00
160
  *
161
+ * @return void
162
  */
163
+ public static function initialize() {
164
+ // This plugin requires MLA
165
+ if ( ! class_exists( 'MLACore', false ) ) {
166
+ return;
167
+ }
168
 
169
+ // The plugin settings class is shared with other MLA example plugins
170
+ if ( ! class_exists( 'MLAExamplePluginSettings101' ) ) {
171
+ require_once( pathinfo( __FILE__, PATHINFO_DIRNAME ) . '/class-mla-example-plugin-settings-101.php' );
172
  }
173
 
174
+ // Add the run-time values to the arguments
175
+ self::$settings_arguments['template_file'] = dirname( __FILE__ ) . self::$settings_arguments['template_file'];
 
 
 
 
 
 
 
 
176
 
177
+ // Create our own settings object
178
+ self::$plugin_settings = new MLAExamplePluginSettings101( self::$settings_arguments );
179
+
180
+ if ( !empty( $_REQUEST[ self::SLUG_PREFIX . '_options_export'] ) ) {
181
+ // Match Keys download will be handled in the admin_init filter
182
+ check_admin_referer( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME );
183
+ self::export_item_values_action( ); // Does not return; calls exit()
184
+ return;
 
 
185
  }
186
+
187
+ // Defined in /media-library-assistant/includes/class-mla-data.php
188
+ add_filter( 'mla_expand_custom_prefix', 'MLACSVDataSourceExample::mla_expand_custom_prefix', 10, 8 );
189
 
190
+ // The remaining filters are only useful in the admin section; exit if in the "front-end" posts/pages.
191
+ if ( ! is_admin() ) {
192
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
193
  }
194
 
195
+ // Add the run-time values to the settings
196
+ // Load template array and initialize page-level values.
197
+ self::$page_template_array = MLACore::mla_load_template( self::$settings_arguments['template_file'], 'path' );
198
+
199
+ $general_tab_values = self::$plugin_settings->get_plugin_argument('general_tab_values');
200
+ $general_tab_values['source_options'] = self::_compose_source_file_options( self::$plugin_settings->get_plugin_option('source') );
201
+ $general_tab_values['id_selected'] = 'id' === self::$plugin_settings->get_plugin_option('match') ? 'selected=selected' : '';
202
+ $general_tab_values['base_file_selected'] = 'base_file' === self::$plugin_settings->get_plugin_option('match') ? 'selected=selected' : '';
203
+ $general_tab_values['file_name_selected'] = 'file_name' === self::$plugin_settings->get_plugin_option('match') ? 'selected=selected' : '';
204
+ self::$plugin_settings->update_plugin_argument('general_tab_values', $general_tab_values );
205
+ } // initialize
206
 
207
  /**
208
  * Template file for the Settings page(s) and parts
236
  );
237
 
238
  /**
239
+ * In-memory representation of the option settings
240
  *
241
  * @since 1.00
242
  *
243
+ * @var array $_settings {
244
+ * @type boolean $assign_parents Assign all terms in path, not just the last (leaf) term
245
+ * @type boolean $assign_rule_parent Assign the Rule Parent (if any) in addition to terms in path
246
+ * @type string $path_delimiter The delimiter that separates path components
247
+ * }
248
  */
249
+ private static $_settings = NULL;
 
 
 
 
 
 
 
 
 
 
 
 
250
 
251
  /**
252
+ * Default processing options
253
  *
254
  * @since 1.00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  *
256
+ * @var array
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  */
258
+ private static $_default_settings = array (
259
+ 'source' => 0,
260
+ 'match' => 'id',
261
+ 'delimiter' => ',',
262
+ 'enclosure' => '"',
263
+ 'escape' => '\\',
264
+ 'exports' => '',
265
+ );
 
 
266
 
267
  /**
268
+ * Export Base Name, File Name, ID and optional columns to a CSV file
269
  *
270
  * @since 1.01
271
  *
272
  * @return none terminates execution with exit();
273
  */
274
+ public static function export_item_values_action() {
275
  global $wpdb;
276
 
277
  check_admin_referer( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME );
285
  $upload_dir = $upload_dir['basedir'];
286
  $date = date("Ymd_B");
287
  $filename = "{$upload_dir}/match_keys_{$date}.csv";
288
+ $column_names = array( 'Base Name', 'File Name', 'ID' );
289
+ $export_specifications = array();
290
+
291
+ // Prepare optional columns
292
+ $exports = self::$plugin_settings->get_plugin_option('exports');
293
+ //error_log( __LINE__ . ' export_item_values_action mla_hex_dump( exports ) = ' . var_export( MLAData::mla_hex_dump( $exports ), true ), 0);
294
+ $exports = explode( "\n", str_replace( "\r", "\n", str_replace( "\r\n", "\n", $exports ) ) );
295
+ //error_log( __LINE__ . ' export_item_values_action exports = ' . var_export( $exports, true ), 0);
296
+ foreach ( $exports as $export ) {
297
+ $column_name = $export; // Default value
298
+ // Look for optional column name
299
+ if ( 0 === strpos( $export, '"' ) ) {
300
+ $title_length = strpos( $export, '",' ) + 2;
301
+ // Filter out invalid or empty titles
302
+ if ( 3 < $title_length ) {
303
+ $column_name = substr( $export, 1, $title_length - 3 );
304
+ }
305
+
306
+ // Separate the specification from the title
307
+ $export = substr( $export, $title_length );
308
+ } // found a name
309
+
310
+ if ( 0 !== strpos( $export, '[+' ) ) {
311
+ $export = '[+' . $export . '+]';
312
+ }
313
+
314
+ $column_names[] = $column_name;
315
+ $export_specifications[] = array(
316
+ 'data_source' => 'template',
317
+ 'meta_name' => str_replace( '{+', '[+', str_replace( '+}', '+]', $export ) ),
318
+ 'option' => 'text',
319
+ 'format' => 'raw',
320
+ );
321
+ }
322
+ //error_log( __LINE__ . ' export_item_values_action column_names = ' . var_export( $column_names, true ), 0);
323
+ //error_log( __LINE__ . ' export_item_values_action export_specifications = ' . var_export( $export_specifications, true ), 0);
324
 
325
  $file_handle = @fopen( $filename, 'w' );
326
  if ( ! $file_handle ) {
327
  $message = sprintf( 'ERROR: The export file ( %1$s ) could not be opened.', $filename );
328
  } else {
329
+ $column_names = implode( ',', $column_names );
330
+ if ( false === @fwrite( $file_handle, $column_names . "\r\n" ) ) {
331
  $error_info = error_get_last();
332
 
333
  if ( false !== ( $tail = strpos( $error_info['message'], '</a>]: ' ) ) ) {
349
  $pathinfo = pathinfo( $item->meta_value );
350
  $file_name = $pathinfo['basename'];
351
  $fields = array( $item->meta_value, $file_name, $item->post_id );
352
+
353
+ // Add optional columns
354
+ foreach ( $export_specifications as $specification ) {
355
+ $fields[] = MLAShortcodes::mla_get_data_source( $item->post_id, 'single_attachment_mapping', $specification, NULL );
356
+ }
357
+
358
  @fputcsv( $file_handle, $fields );
359
  }
360
  }
390
 
391
  @unlink( $filename );
392
  exit();
393
+ } // export_item_values_action
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
 
395
  /**
396
+ * Compose HTML markup for the source file options if any text/csv files exist
397
+ *
398
  * @since 1.00
399
  *
400
+ * @param integer Optional item ID value for the current source file, default 0
401
  *
402
+ * @return string HTML markup for the Source file <select> list, if any
403
  */
404
+ private static function _compose_source_file_options( $current_id = 0 ) {
405
+ // Avoid fatal errors, e.g., for some AJAX calls such as "heartbeat"
406
+ if ( ! class_exists( 'MLAData' ) ) {
407
+ return '';
408
  }
409
+
410
+ // Default option if no files exist or there is no current selection
411
+ $option_values = array(
412
+ 'value' => '0',
413
+ 'text' => '&mdash; select a source (CSV) file &mdash;',
414
+ 'selected' => ''
415
+ );
416
+ $select_options = MLAData::mla_parse_template( self::$page_template_array['select-option'], $option_values );
417
 
418
+ // Find all CSV files in the Media Library
419
+ $args = array(
420
+ 'post_type' => 'attachment',
421
+ 'post_status' => 'inherit',
422
+ 'post_mime_type' => 'text/csv',
423
+ 'nopaging' => true,
424
+ );
425
+ $query = new WP_Query( $args );
426
 
427
+ $current_id = absint( $current_id );
428
+ foreach ( $query->posts as $post ) {
429
+ $option_values = array(
430
+ 'value' => $post->ID,
431
+ 'text' => esc_attr( $post->post_title ),
432
+ 'selected' => $current_id === $post->ID ? 'selected=selected' : '',
433
+ );
434
 
435
+ $select_options .= MLAData::mla_parse_template( self::$page_template_array['select-option'], $option_values );
 
 
 
 
 
 
 
 
 
 
 
 
436
  }
437
 
438
+ $option_values = array(
439
+ 'key' => 'mla-import-settings-file',
440
+ 'options' => $select_options
441
+ );
 
442
 
443
+ return $select_options;
444
+ } // _compose_source_file_options
 
445
 
446
  /**
447
  * In-memory representation of the CSV variables,
498
  self::_load_csv_file( $use_existing, true );
499
 
500
  if ( !empty( self::$_csv_variable_names ) ) {
501
+ $match = self::$plugin_settings->get_plugin_option('match');
502
 
503
  switch ( $match ) {
504
  case 'id':
544
  self::$_csv_match_variable = '';
545
  self::$_csv_match_index = false;
546
 
547
+ $ID = self::$plugin_settings->get_plugin_option('source');
548
+ $match = self::$plugin_settings->get_plugin_option('match');
549
+ $delimiter = self::$plugin_settings->get_plugin_option('delimiter');
550
+ $enclosure = self::$plugin_settings->get_plugin_option('enclosure');
551
+ $escape = self::$plugin_settings->get_plugin_option('escape');
552
 
553
  // Find the file attached to the selected item
554
  $path = get_attached_file( $ID );
examples/plugins/mla-custom-feed-example/mla-custom-feed-example.php CHANGED
@@ -17,8 +17,12 @@
17
  * opened on 8/21/2017 by "lwcorp".
18
  * https://wordpress.org/support/topic/create-a-feed-out-of-the-media-library/
19
  *
 
 
 
 
20
  * @package MLA Custom Feed Example
21
- * @version 1.12
22
  */
23
 
24
  /*
@@ -26,10 +30,10 @@ Plugin Name: MLA Custom Feed Example
26
  Plugin URI: http://davidlingren.com/
27
  Description: Configures and processes custom RSS2 feeds for Media Library items
28
  Author: David Lingren
29
- Version: 1.12
30
  Author URI: http://davidlingren.com/
31
 
32
- Copyright 2017-2020 David Lingren
33
 
34
  This program is free software; you can redistribute it and/or modify
35
  it under the terms of the GNU General Public License as published by
@@ -60,7 +64,7 @@ class MLACustomFeedExample {
60
  *
61
  * @var string
62
  */
63
- const CURRENT_VERSION = '1.12';
64
 
65
  /**
66
  * Slug prefix for registering and enqueueing submenu pages, style sheets, scripts and settings
@@ -79,22 +83,45 @@ class MLACustomFeedExample {
79
  * @return void
80
  */
81
  public static function initialize() {
 
82
  //error_log( __LINE__ . ' MLACustomFeedExample::initialize $_REQUEST = ' . var_export( $_REQUEST, true ), 0 );
83
 
84
- // Set the appropriate hooks depending on admin or front-end mode
85
  if ( is_admin() ) {
86
  add_action( 'admin_menu', 'MLACustomFeedExample::admin_menu' );
87
  add_filter( 'set-screen-option', 'MLACustomFeedExample::mla_set_screen_option', 10, 3 );
88
  add_filter( 'screen_options_show_screen', 'MLACustomFeedExample::mla_screen_options_show_screen', 10, 2 );
89
- } else {
90
- if ( MLA_Custom_Feed_Query::get_option('add_mlafeeds') ) {
91
- $slugs = MLA_Custom_Feed_Query::mla_custom_feed_slugs('active');
92
- foreach ( $slugs as $ID => $slug ) {
 
93
  //error_log( __LINE__ . ' MLACustomFeedExample::initialize adding feed ' . $slug, 0 );
94
- add_feed( $slug, 'MLACustomFeedExample::mla_custom_feed' );
95
- }
96
  }
97
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  }
99
 
100
  /**
@@ -238,7 +265,9 @@ class MLACustomFeedExample {
238
  $dismiss_button = '';
239
  } else {
240
  $messages_class = 'updated notice is-dismissible';
241
- $dismiss_button = " <button class=\"notice-dismiss\" type=\"button\"><span class=\"screen-reader-text\">[+dismiss_text+].</span></button>\n";
 
 
242
  }
243
 
244
  $page_values['messages'] = MLAData::mla_parse_template( self::$page_template_array['messages'], array(
17
  * opened on 8/21/2017 by "lwcorp".
18
  * https://wordpress.org/support/topic/create-a-feed-out-of-the-media-library/
19
  *
20
+ * Enhanced for support topic "MLA custom feed stops working every now and then"
21
+ * opened on 4/17/2021 by "wijnveen".
22
+ * https://wordpress.org/support/topic/mla-custom-feed-stops-working-every-now-and-then/
23
+ *
24
  * @package MLA Custom Feed Example
25
+ * @version 1.13
26
  */
27
 
28
  /*
30
  Plugin URI: http://davidlingren.com/
31
  Description: Configures and processes custom RSS2 feeds for Media Library items
32
  Author: David Lingren
33
+ Version: 1.13
34
  Author URI: http://davidlingren.com/
35
 
36
+ Copyright 2017-2021 David Lingren
37
 
38
  This program is free software; you can redistribute it and/or modify
39
  it under the terms of the GNU General Public License as published by
64
  *
65
  * @var string
66
  */
67
+ const CURRENT_VERSION = '1.13';
68
 
69
  /**
70
  * Slug prefix for registering and enqueueing submenu pages, style sheets, scripts and settings
83
  * @return void
84
  */
85
  public static function initialize() {
86
+ global $wp_rewrite;
87
  //error_log( __LINE__ . ' MLACustomFeedExample::initialize $_REQUEST = ' . var_export( $_REQUEST, true ), 0 );
88
 
 
89
  if ( is_admin() ) {
90
  add_action( 'admin_menu', 'MLACustomFeedExample::admin_menu' );
91
  add_filter( 'set-screen-option', 'MLACustomFeedExample::mla_set_screen_option', 10, 3 );
92
  add_filter( 'screen_options_show_screen', 'MLACustomFeedExample::mla_screen_options_show_screen', 10, 2 );
93
+ }
94
+
95
+ if ( MLA_Custom_Feed_Query::get_option('add_mlafeeds') ) {
96
+ $slugs = MLA_Custom_Feed_Query::mla_custom_feed_slugs('active');
97
+ foreach ( $slugs as $ID => $slug ) {
98
  //error_log( __LINE__ . ' MLACustomFeedExample::initialize adding feed ' . $slug, 0 );
99
+ add_feed( $slug, 'MLACustomFeedExample::mla_custom_feed' );
 
100
  }
101
+
102
+ // Make sure our feeds are reflected in the WordPress URL rewrite rules
103
+ if ( is_callable( array( $wp_rewrite, 'wp_rewrite_rules' ) ) ) {
104
+ foreach ( $wp_rewrite->wp_rewrite_rules() as $rule => $url ) {
105
+ // Looking for 'feed/(feed|rdf|rss|rss2|atom|mlafeed|mlafeed-2|mlacat|aaa)/?$' => 'index.php?&feed=$matches[1]',
106
+ if ( 0 === strpos( $rule, 'feed/(feed' ) ) {
107
+ $feeds = explode( '|', substr( $rule, 6, ( strlen( $rule ) - ( 6 + 4 ) ) ) );
108
+ //error_log( __LINE__ . ' DEBUG: MLACore::initialize feeds = ' . var_export( $feeds, true ), 0 );
109
+ foreach ( $slugs as $index => $slug ) {
110
+ if ( in_array( $slug, $feeds ) ) {
111
+ unset( $slugs[ $index ] );
112
+ }
113
+ }
114
+ //error_log( __LINE__ . ' DEBUG: MLACore::initialize residual slugs = ' . var_export( $slugs, true ), 0 );
115
+
116
+ // Any missing feeds? (Deleted feeds still present are harmless)
117
+ if ( !empty( $slugs ) ) {
118
+ $wp_rewrite->flush_rules( false );
119
+ //error_log( __LINE__ . ' DEBUG: MLACore::initialize flush_rules complete', 0 );
120
+ }
121
+ } // found feed rule
122
+ } // foreach rule
123
+ }
124
+ } // add_mlafeeds
125
  }
126
 
127
  /**
265
  $dismiss_button = '';
266
  } else {
267
  $messages_class = 'updated notice is-dismissible';
268
+ //$dismiss_button = " <button class=\"notice-dismiss\" type=\"button\"><span class=\"screen-reader-text\">[+dismiss_text+].</span></button>\n";
269
+ $dismiss_button = ''; // /wp-admin/js/common.js function makeNoticesDismissible() since WP 4.4.0
270
+
271
  }
272
 
273
  $page_values['messages'] = MLAData::mla_parse_template( self::$page_template_array['messages'], array(
examples/plugins/mla-custom-field-search-example/admin-settings-page.tpl CHANGED
@@ -338,7 +338,7 @@ For a quick look at the plugin's operation on a given search you can add a debug
338
  </p>
339
  <ul class="mla-doc-toc-list">
340
  <li><strong><code>'}|{'</code></strong> - Write debug information to the console, e.g., <code>}|{custom:Kingdom=*</code>. This option writes log entries as PHP Warnings, which might be displayed in the browser window or written to the error log depending on how your site is configured. It's quick and easy but the results are ugly. Also, it will not work for the Media/Library Grid view or the MMMW; information will go to the log for these cases.</li>
341
- <li><strong><code>'}|{'</code></strong> - Write debug information to the error log, e.g., <code>}|{custom:Artist,Patron</code>. This option avoids cluttering the display with ugly messages but requires you to find a view the error log file to see the results. The MLA Debug tab may be an easy way to find and view the log.</li>
342
  </ul>
343
  <p>
344
  </p>
338
  </p>
339
  <ul class="mla-doc-toc-list">
340
  <li><strong><code>'}|{'</code></strong> - Write debug information to the console, e.g., <code>}|{custom:Kingdom=*</code>. This option writes log entries as PHP Warnings, which might be displayed in the browser window or written to the error log depending on how your site is configured. It's quick and easy but the results are ugly. Also, it will not work for the Media/Library Grid view or the MMMW; information will go to the log for these cases.</li>
341
+ <li><strong><code>'{|}'</code></strong> - Write debug information to the error log, e.g., <code>{|}custom:Artist,Patron</code>. This option avoids cluttering the display with ugly messages but requires you to find a view the error log file to see the results. The MLA Debug tab may be an easy way to find and view the log.</li>
342
  </ul>
343
  <p>
344
  </p>
examples/plugins/mla-insert-fixit.php CHANGED
@@ -48,8 +48,12 @@
48
  * opened on 2/20/2021 by "jamiedelaney"
49
  * https://wordpress.org/support/topic/updating-alt-text-for-images-already-in-post-insert-fixit-tools/
50
  *
 
 
 
 
51
  * @package Insert Fixit
52
- * @version 1.18
53
  */
54
 
55
  /*
@@ -57,7 +61,7 @@ Plugin Name: MLA Insert Fixit
57
  Plugin URI: http://davidlingren.com/
58
  Description: Synchronizes Media Library values to and from post/page inserted/featured/attached images
59
  Author: David Lingren
60
- Version: 1.18
61
  Author URI: http://davidlingren.com/
62
 
63
  Copyright 2015-2020 David Lingren
@@ -90,7 +94,16 @@ class Insert_Fixit {
90
  *
91
  * @var string
92
  */
93
- const CURRENT_VERSION = '1.18';
 
 
 
 
 
 
 
 
 
94
 
95
  /**
96
  * Slug prefix for registering and enqueueing submenu pages, style sheets and scripts
@@ -183,7 +196,7 @@ class Insert_Fixit {
183
  * @return void Echoes HTML markup for the submenu page
184
  */
185
  public static function render_tools_page() {
186
- MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::render_tools_page() $_REQUEST = ' . var_export( $_REQUEST, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
187
  if ( !current_user_can( 'manage_options' ) ) {
188
  echo "Insert Fixit - Error</h2>\n";
189
  wp_die( 'You do not have permission to manage plugin settings.' );
@@ -218,6 +231,12 @@ class Insert_Fixit {
218
  $lowest_attr = self::$reverse_sort ? ' ' : ' selected="selected" ';
219
  $highest_attr = self::$reverse_sort ? ' selected="selected" ' : ' ';
220
 
 
 
 
 
 
 
221
  // Copy Post/Page values to inserted Media Library items
222
  $page_library_template = isset( $_REQUEST[ self::SLUG_PREFIX . 'page_library_template' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'page_library_template' ] : '([+page_terms:category,single+]: )([+page_title+] )[+index+]';
223
 
@@ -306,8 +325,24 @@ class Insert_Fixit {
306
  't1212' => array( 'continue' => ' </select>' ),
307
  't1213' => array( 'continue' => ' </td>' ),
308
  't1214' => array( 'continue' => '</tr><tr>' ),
309
- 't1215' => array( 'continue' => ' <td>&nbsp;</td><td >Select the definition of "first" item from the dropdown above.</td>' ),
310
- 't1216' => array( 'close' => '</tr></table>&nbsp;<br>' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  'Attach Inserted In' => array( 'handler' => '_attach_inserted_in',
312
  'comment' => 'Attach items to the first Post/Page they are inserted in' ),
313
  'Attach Featured In' => array( 'handler' => '_attach_featured_in',
@@ -432,6 +467,10 @@ class Insert_Fixit {
432
  delete_transient( self::SLUG_PREFIX . 'image_objects' );
433
  }
434
 
 
 
 
 
435
  echo "\t\t" . '<div style="width:700px">' . "\n";
436
  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";
437
  echo "\t\t" . ' <table>' . "\n";
@@ -600,13 +639,12 @@ class Insert_Fixit {
600
  if ( $use_cache ) {
601
  self::$image_inserts = get_transient( self::SLUG_PREFIX . 'image_inserts' );
602
  if ( is_array( self::$image_inserts ) ) {
603
- 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 );
604
  return 'Using cached image inserts with ' . count( self::$image_inserts ) . ' post/page elements.';
605
  }
606
  }
607
 
608
  $return = delete_transient( self::SLUG_PREFIX . 'image_inserts' );
609
- //error_log( __LINE__ . " Insert_Fixit::_build_image_inserts_cache delete_transient return = " . var_export( $return, true ), 0 );
610
 
611
  if ( ! empty( $_REQUEST[ self::SLUG_PREFIX . 'post_lower' ] ) ) {
612
  $lower_bound = (integer) $_REQUEST[ self::SLUG_PREFIX . 'post_lower' ];
@@ -627,22 +665,21 @@ class Insert_Fixit {
627
  } else {
628
  $post_types = "'post', 'page'";
629
  }
630
- //error_log( __LINE__ . " Insert_Fixit::_build_image_inserts_cache post_types = " . var_export( $post_types, true ), 0 );
631
 
632
  $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%' );
633
- MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $query = ' . var_export( $query, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
634
  $results = $wpdb->get_results( $query );
635
- MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $results = ' . var_export( $results, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
636
 
637
  $upload_dir = wp_upload_dir();
638
- MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $upload_dir = ' . var_export( $upload_dir, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
639
  $upload_dir = $upload_dir['baseurl'] . '/';
640
  $site_url = get_site_url();
641
- MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $site_url = ' . var_export( $site_url, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
642
  $upload_subdir = str_replace( $site_url, '', $upload_dir );
643
- MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $upload_subdir = ' . var_export( $upload_subdir, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
644
 
645
- // Use two uoload directory URLs to handle HTTP/HTTPS mismatches
646
  $root_dir = str_replace( 'http', '', str_replace( 'https', '', $upload_dir ) );
647
  $http_dir = 'http' . $root_dir;
648
  $https_dir = 'https' . $root_dir;
@@ -650,8 +687,8 @@ class Insert_Fixit {
650
  $image_inserts = array();
651
  foreach ( $results as $result ) {
652
  $match_count = preg_match_all( '/\<img .*?(src="([^"]*?)")[^\>]*?\>/', $result->post_content, $matches, PREG_OFFSET_CAPTURE );
653
- 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 );
654
- //error_log( __LINE__ . " Insert_Fixit::_build_image_inserts_cache( {$result->ID} ) count = {$match_count}, src \$matches = " . var_export( $matches, true ), 0 );
655
  if ( $match_count ) {
656
  $image_inserts[ $result->ID ]['content'] = $result->post_content;
657
 
@@ -678,7 +715,7 @@ class Insert_Fixit {
678
  // alt= value if present
679
  foreach ( $image_inserts[ $result->ID ]['inserts'] as $index => $insert ) {
680
  $match_count = preg_match( '/alt="([^"]*)"/', $insert['img'], $matches, PREG_OFFSET_CAPTURE );
681
- 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 );
682
  if ( $match_count ) {
683
  $image_inserts[ $result->ID ]['inserts'][ $index ]['alt'] = $matches[1][0];
684
  $image_inserts[ $result->ID ]['inserts'][ $index ]['alt_offset'] = $insert['img_offset'] + $matches[1][1];
@@ -690,11 +727,9 @@ class Insert_Fixit {
690
  }
691
 
692
  $return = set_transient( self::SLUG_PREFIX . 'image_inserts', $image_inserts, 900 ); // fifteen minutes
693
- //error_log( __LINE__ . " Insert_Fixit::_build_image_inserts_cache set_transient return = " . var_export( $return, true ), 0 );
694
- 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 );
695
  self::$image_inserts = $image_inserts;
696
 
697
- //error_log( __LINE__ . " Insert_Fixit::_build_image_inserts_cache image_inserts = " . var_export( $image_inserts, true ), 0 );
698
  return 'Image inserts cache refreshed with ' . count( self::$image_inserts ) . ' post/page elements.';
699
  } // _build_image_inserts_cache
700
 
@@ -739,7 +774,7 @@ class Insert_Fixit {
739
  if ( $use_cache ) {
740
  self::$figcaption_inserts = get_transient( self::SLUG_PREFIX . 'figcaption_inserts' );
741
  if ( is_array( self::$figcaption_inserts ) ) {
742
- 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 );
743
  return 'Using cached figcaption inserts with ' . count( self::$figcaption_inserts ) . ' post/page elements.';
744
  }
745
  }
@@ -769,9 +804,9 @@ class Insert_Fixit {
769
  //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache post_types = " . var_export( $post_types, true ), 0 );
770
 
771
  $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%' );
772
- MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_figcaption_inserts_cache() $query = ' . var_export( $query, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
773
  $results = $wpdb->get_results( $query );
774
- MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_figcaption_inserts_cache() $results = ' . var_export( $results, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
775
 
776
  $gallery_items = array();
777
  $figcaption_inserts = array();
@@ -779,7 +814,7 @@ class Insert_Fixit {
779
 
780
  // Items within a gallery require a different <figcaption> tag
781
  $match_count = preg_match_all( '/\<\!-- wp:gallery \{"ids":\[([^\]]*?)\]/', $result->post_content, $matches );
782
- 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 );
783
  //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache( {$result->ID} ) count = {$match_count}, src \$matches = " . var_export( $matches, true ), 0 );
784
  if ( $match_count ) {
785
  foreach( $matches[1] as $match ) {
@@ -792,7 +827,7 @@ class Insert_Fixit {
792
  //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache( {$result->ID} ) count = {$match_count}, src \$gallery_items = " . var_export( $gallery_items, true ), 0 );
793
 
794
  $match_count = preg_match_all( '/\<figure[^\>]*?\>\<img.*?(wp-image-([0-9]*)).*?(\<figcaption.*?\>(.*?)\<\/figcaption\>|)\<\/figure\>/', $result->post_content, $matches, PREG_OFFSET_CAPTURE );
795
- 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 );
796
  //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache( {$result->ID} ) count = {$match_count}, src \$matches = " . var_export( $matches, true ), 0 );
797
 
798
  if ( $match_count ) {
@@ -824,7 +859,7 @@ class Insert_Fixit {
824
 
825
  $return = set_transient( self::SLUG_PREFIX . 'figcaption_inserts', $figcaption_inserts, 900 ); // fifteen minutes
826
  //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache set_transient return = " . var_export( $return, true ), 0 );
827
- 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 );
828
  self::$figcaption_inserts = $figcaption_inserts;
829
 
830
  //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache figcaption_inserts = " . var_export( $figcaption_inserts, true ), 0 );
@@ -858,7 +893,7 @@ class Insert_Fixit {
858
  if ( $use_cache ) {
859
  self::$featured_objects = get_transient( self::SLUG_PREFIX . 'featured_objects' );
860
  if ( is_array( self::$featured_objects ) ) {
861
- 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 );
862
  return 'Using cached featured objects with ' . count( self::$featured_objects ) . ' attachment elements.';
863
  }
864
  }
@@ -893,9 +928,9 @@ class Insert_Fixit {
893
  $query[] = "AND ( ID >= {$lower_bound} ) AND ( ID <= {$upper_bound} ) ) ORDER BY ID ) AS p ON m.meta_value = p.ID";
894
  $query[] = "WHERE m.meta_key = '_thumbnail_id'";
895
  $query = implode( ' ', $query );
896
- MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_featured_objects_cache() $query = ' . var_export( $query, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
897
  $results = $wpdb->get_results( $query );
898
- MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_featured_objects_cache() $results = ' . var_export( $results, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
899
 
900
  $references = array();
901
  if ( is_array( $results ) ) {
@@ -906,7 +941,7 @@ class Insert_Fixit {
906
  }
907
 
908
  foreach( $references as $id => $result ) {
909
- if ( $reverse_sort ) {
910
  krsort( $references[ $id ] );
911
  } else {
912
  ksort( $references[ $id ] );
@@ -916,7 +951,7 @@ class Insert_Fixit {
916
 
917
  $return = set_transient( self::SLUG_PREFIX . 'featured_objects', $references, 900 ); // fifteen minutes
918
  //error_log( __LINE__ . " Insert_Fixit::_build_featured_objects_cache set_transient return = " . var_export( $return, true ), 0 );
919
- MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_featured_objects_cache return = {$return}, references = " . var_export( $references, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
920
  self::$featured_objects = $references;
921
 
922
  return 'Featured objects cache refreshed with ' . count( self::$featured_objects ) . ' attachment elements.';
@@ -949,7 +984,7 @@ class Insert_Fixit {
949
  if ( $use_cache ) {
950
  self::$item_references = get_transient( self::SLUG_PREFIX . 'item_references' );
951
  if ( is_array( self::$item_references ) ) {
952
- 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 );
953
  return 'Using cached item references with ' . count( self::$item_references ) . ' attachment elements.';
954
  }
955
  }
@@ -979,36 +1014,52 @@ class Insert_Fixit {
979
  //error_log( __LINE__ . " Insert_Fixit::_build_item_references_cache post_types = " . var_export( $post_types, true ), 0 );
980
 
981
  $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=%' );
982
- MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_item_references_cache() $query = ' . var_export( $query, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
983
  $results = $wpdb->get_results( $query );
984
- MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_item_references_cache() $results = ' . var_export( $results, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
 
 
 
985
 
986
  self::$item_references = array();
987
  foreach ( $results as $result ) {
988
  // Find the class="wp-image-" references
989
  $match_count = preg_match_all( '/wp-image-([0-9]{1,6})/', $result->post_content, $matches );
990
- MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_item_references_cache( {$result->ID} ) class \$matches = " . var_export( $matches, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
991
  if ( $match_count ) {
992
  foreach ( $matches[1] as $match ) {
993
  self::$item_references[ absint( $match ) ][ absint( $result->ID ) ] = absint( $result->ID );
994
  }
995
  }
996
 
997
- // Find the ids= references
998
- $match_count = preg_match_all( '/(\[gallery|\[mla_gallery)[^\]]*ids=([0-9,\\\'\"]*)/', $result->post_content, $matches );
999
- MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_item_references_cache( {$result->ID} ) ids \$matches = " . var_export( $matches, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1000
- if ( $match_count ) {
1001
- foreach ( $matches[2] as $match ) {
1002
- $items = explode( ',', trim( $match, '\'"' ) );
1003
- foreach ( $items as $item ) {
1004
- self::$item_references[ absint( $item ) ][ absint( $result->ID ) ] = absint( $result->ID );
 
 
 
 
 
 
 
 
 
 
 
 
 
1005
  }
1006
  }
1007
  }
1008
- }
1009
 
1010
  $return = set_transient( self::SLUG_PREFIX . 'item_references', self::$item_references, 900 ); // fifteen minutes
1011
- 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 );
1012
 
1013
  //error_log( __LINE__ . " Insert_Fixit::_build_item_references_cache item_references = " . var_export( self::$item_references, true ), 0 );
1014
  return 'Item references cache refreshed with ' . count( self::$item_references ) . ' items referenced in ' . count( $results ) . ' post/page elements.';
@@ -1047,7 +1098,7 @@ class Insert_Fixit {
1047
  if ( $use_cache ) {
1048
  self::$image_objects = get_transient( self::SLUG_PREFIX . 'image_objects' );
1049
  if ( is_array( self::$image_objects ) ) {
1050
- 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 );
1051
  return 'Using cached image objects with ' . count( self::$image_objects ) . ' attachment elements.';
1052
  }
1053
  }
@@ -1076,9 +1127,9 @@ class Insert_Fixit {
1076
  }
1077
 
1078
  $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 );
1079
- MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_objects_cache() $query = ' . var_export( $query, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1080
  $results = $wpdb->get_results( $query );
1081
- MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_objects_cache() $results = ' . var_export( $results, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1082
 
1083
  // Load the image_inserts array
1084
  self::_build_image_inserts_cache( true );
@@ -1117,7 +1168,7 @@ class Insert_Fixit {
1117
  } else {
1118
  $original_file = false;
1119
  }
1120
- MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_objects_cache() $original_file = ' . var_export( $original_file, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1121
 
1122
  $attachment_metadata = get_metadata( 'post', $result->ID, '_wp_attachment_metadata', true );
1123
  if ( empty( $attachment_metadata ) ) {
@@ -1125,7 +1176,7 @@ class Insert_Fixit {
1125
  }
1126
 
1127
  $sizes = isset( $attachment_metadata['sizes'] ) ? $attachment_metadata['sizes'] : NULL;
1128
- MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_array_image_inserts_references( {$result->ID} ) sizes = " . var_export( $sizes, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1129
  if ( ! empty( $sizes ) && is_array( $sizes ) ) {
1130
  // Using the path and name as the array key ensures each name is added only once
1131
  foreach ( $sizes as $size => $size_info ) {
@@ -1137,7 +1188,7 @@ class Insert_Fixit {
1137
  //$files[ $path . $base_file ] = $path . $base_file;
1138
  $files[ $base_file ] = $base_file;
1139
  }
1140
- MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_array_image_inserts_references( {$result->ID} ) files = " . var_export( $files, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1141
 
1142
  /*
1143
  * inserts Array of specific files (i.e., sizes) found in one or more posts/pages
@@ -1147,9 +1198,9 @@ class Insert_Fixit {
1147
  $inserts = array();
1148
 
1149
  foreach( $files as $file ) {
1150
- MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_array_image_inserts_references( {$result->ID} ) file = " . var_export( $file, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1151
  foreach ( self::$image_inserts as $insert_id => $value ) {
1152
- MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_array_image_inserts_references( {$insert_id} ) value = " . var_export( $value, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1153
  if ( in_array( $file, $value['files'] ) ) {
1154
  $inserts[ $insert_id ][] = $file;
1155
  }
@@ -1157,7 +1208,7 @@ class Insert_Fixit {
1157
  } // foreach file
1158
 
1159
  if ( ! empty( $inserts ) ) {
1160
- if ( $reverse_sort ) {
1161
  krsort( $inserts );
1162
  } else {
1163
  ksort( $inserts );
@@ -1172,7 +1223,7 @@ class Insert_Fixit {
1172
  } // each result
1173
 
1174
  $return = set_transient( self::SLUG_PREFIX . 'image_objects', $references, 900 ); // fifteen minutes
1175
- 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 );
1176
  self::$image_objects = $references;
1177
 
1178
  //error_log( __LINE__ . " Insert_Fixit::_build_image_objects_cache image_objects = " . var_export( $references, true ), 0 );
@@ -1377,14 +1428,10 @@ class Insert_Fixit {
1377
  * @return string HTML markup for results/messages
1378
  */
1379
  private static function _copy_alt_from_media_library() {
1380
- /*
1381
- * Load the image_inserts array
1382
- */
1383
  self::_build_image_inserts_cache( true );
1384
 
1385
- /*
1386
- * Load the image_objects array
1387
- */
1388
  self::_build_image_objects_cache( true );
1389
 
1390
  // Initialize statistics
@@ -1405,12 +1452,12 @@ class Insert_Fixit {
1405
  $inserts = self::$image_inserts[ $post_id ];
1406
  foreach ( $files as $file ) {
1407
  foreach ( $inserts['inserts'] as $insert ) {
1408
- 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 );
1409
  if ( $file != $insert['src'] || ! isset( $insert['alt'] ) ) {
1410
  continue;
1411
  }
1412
 
1413
- 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 );
1414
  if ( $alt_text == $insert['alt'] ) {
1415
  continue;
1416
  }
@@ -1427,22 +1474,22 @@ class Insert_Fixit {
1427
  $replacements = $inserts['replacements'];
1428
  if ( ! empty( $replacements ) ) {
1429
  krsort( $replacements );
1430
- MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library( {$post_id} ) replacements = " . var_export( $replacements, true ), MLACore::MLA_DEBUG_CATEGORY_ANY );
1431
  $post_content = $inserts['content'];
1432
  foreach ( $replacements as $offset => $replacement ) {
1433
  $post_content = substr_replace( $post_content, $replacement['text'], $offset, $replacement['length'] );
1434
  $updates++;
1435
  } // foreach replacement
1436
  $new_content = array( 'ID' => $post_id, 'post_content' => $post_content );
1437
- 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 );
1438
  $result = wp_update_post( $new_content, true );
1439
- 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 );
1440
  if ( is_wp_error( $result ) ) {
1441
  $errors++;
1442
  }
1443
  $updated_posts++;
1444
  } else { // has replacements
1445
- 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 );
1446
  } // no replacements
1447
  } // foreach post/page
1448
 
@@ -1799,7 +1846,7 @@ class Insert_Fixit {
1799
  $referenced_items++;
1800
 
1801
  // Define "first"; oldest = ksort, newest = krsort
1802
- if ( $reverse_sort ) {
1803
  krsort( $references, SORT_NUMERIC );
1804
  } else {
1805
  ksort( $references, SORT_NUMERIC );
48
  * opened on 2/20/2021 by "jamiedelaney"
49
  * https://wordpress.org/support/topic/updating-alt-text-for-images-already-in-post-insert-fixit-tools/
50
  *
51
+ * Enhanced for support topic "post parent, link images"
52
+ * opened on 5/20/2021 by "ellabtz"
53
+ * https://wordpress.org/support/topic/post-parent-link-images/
54
+ *
55
  * @package Insert Fixit
56
+ * @version 1.20
57
  */
58
 
59
  /*
61
  Plugin URI: http://davidlingren.com/
62
  Description: Synchronizes Media Library values to and from post/page inserted/featured/attached images
63
  Author: David Lingren
64
+ Version: 1.20
65
  Author URI: http://davidlingren.com/
66
 
67
  Copyright 2015-2020 David Lingren
94
  *
95
  * @var string
96
  */
97
+ const CURRENT_VERSION = '1.20';
98
+
99
+ /**
100
+ * Constant to log this plugin's debug activity
101
+ *
102
+ * @since 1.19
103
+ *
104
+ * @var integer
105
+ */
106
+ const MLA_DEBUG_CATEGORY = 0x00008000;
107
 
108
  /**
109
  * Slug prefix for registering and enqueueing submenu pages, style sheets and scripts
196
  * @return void Echoes HTML markup for the submenu page
197
  */
198
  public static function render_tools_page() {
199
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::render_tools_page() $_REQUEST = ' . var_export( $_REQUEST, true ), self::MLA_DEBUG_CATEGORY );
200
  if ( !current_user_can( 'manage_options' ) ) {
201
  echo "Insert Fixit - Error</h2>\n";
202
  wp_die( 'You do not have permission to manage plugin settings.' );
231
  $lowest_attr = self::$reverse_sort ? ' ' : ' selected="selected" ';
232
  $highest_attr = self::$reverse_sort ? ' selected="selected" ' : ' ';
233
 
234
+ $old_reference_shortcodes = isset( $_REQUEST[ self::SLUG_PREFIX . 'old_reference_shortcodes' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'old_reference_shortcodes' ] : '';
235
+ $reference_shortcodes = isset( $_REQUEST[ self::SLUG_PREFIX . 'reference_shortcodes' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'reference_shortcodes' ] : 'gallery,mla_gallery';
236
+
237
+ $old_reference_parameter = isset( $_REQUEST[ self::SLUG_PREFIX . 'old_reference_parameter' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'old_reference_parameter' ] : '';
238
+ $reference_parameter = isset( $_REQUEST[ self::SLUG_PREFIX . 'reference_parameter' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'reference_parameter' ] : 'ids';
239
+
240
  // Copy Post/Page values to inserted Media Library items
241
  $page_library_template = isset( $_REQUEST[ self::SLUG_PREFIX . 'page_library_template' ] ) ? $_REQUEST[ self::SLUG_PREFIX . 'page_library_template' ] : '([+page_terms:category,single+]: )([+page_title+] )[+index+]';
242
 
325
  't1212' => array( 'continue' => ' </select>' ),
326
  't1213' => array( 'continue' => ' </td>' ),
327
  't1214' => array( 'continue' => '</tr><tr>' ),
328
+ 't1215' => array( 'continue' => ' <td>&nbsp;</td><td >Select the definition of "first" item from the dropdown above.<br />&nbsp;</td>' ),
329
+ 't1216' => array( 'continue' => '</tr><tr>' ),
330
+ 't1617' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">Shortcode(s)</td>' ),
331
+ 't1618' => array( 'continue' => ' <td style="text-align: left">' ),
332
+ 't1619' => array( 'continue' => ' <input name="' . self::SLUG_PREFIX . 'old_reference_shortcodes" type="hidden" value="' . $reference_shortcodes . '">' ),
333
+ 't1620' => array( 'continue' => ' <input name="' . self::SLUG_PREFIX . 'reference_shortcodes" type="text" size="60" value="' . $reference_shortcodes . '">' ),
334
+ 't1621' => array( 'continue' => ' </td>' ),
335
+ 't1222' => array( 'continue' => '</tr><tr>' ),
336
+ 't1223' => array( 'continue' => ' <td>&nbsp;</td><td >Enter a comma-separated list of shortcode names for the "Attach Referenced in" tool.</td>' ),
337
+ 't1224' => array( 'continue' => '</tr><tr>' ),
338
+ 't1625' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle">Parameter</td>' ),
339
+ 't1626' => array( 'continue' => ' <td style="text-align: left">' ),
340
+ 't1627' => array( 'continue' => ' <input name="' . self::SLUG_PREFIX . 'old_reference_parameter" type="hidden" value="' . $reference_parameter . '">' ),
341
+ 't1628' => array( 'continue' => ' <input name="' . self::SLUG_PREFIX . 'reference_parameter" type="text" size="60" value="' . $reference_parameter . '">' ),
342
+ 't1629' => array( 'continue' => ' </td>' ),
343
+ 't1230' => array( 'continue' => '</tr><tr>' ),
344
+ 't1231' => array( 'continue' => ' <td>&nbsp;</td><td >Enter the desired parameter name (e.g. "ids" without quotes) for the "Attach Referenced in" tool.</td>' ),
345
+ 't1232' => array( 'close' => '</tr></table>&nbsp;<br>' ),
346
  'Attach Inserted In' => array( 'handler' => '_attach_inserted_in',
347
  'comment' => 'Attach items to the first Post/Page they are inserted in' ),
348
  'Attach Featured In' => array( 'handler' => '_attach_featured_in',
467
  delete_transient( self::SLUG_PREFIX . 'image_objects' );
468
  }
469
 
470
+ if ( $old_reference_shortcodes !== $reference_shortcodes || $old_reference_parameter !== $reference_parameter ) {
471
+ delete_transient( self::SLUG_PREFIX . 'item_references' );
472
+ }
473
+
474
  echo "\t\t" . '<div style="width:700px">' . "\n";
475
  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";
476
  echo "\t\t" . ' <table>' . "\n";
639
  if ( $use_cache ) {
640
  self::$image_inserts = get_transient( self::SLUG_PREFIX . 'image_inserts' );
641
  if ( is_array( self::$image_inserts ) ) {
642
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_image_inserts_cache using cached self::\$image_inserts " . var_export( self::$image_inserts, true ), self::MLA_DEBUG_CATEGORY );
643
  return 'Using cached image inserts with ' . count( self::$image_inserts ) . ' post/page elements.';
644
  }
645
  }
646
 
647
  $return = delete_transient( self::SLUG_PREFIX . 'image_inserts' );
 
648
 
649
  if ( ! empty( $_REQUEST[ self::SLUG_PREFIX . 'post_lower' ] ) ) {
650
  $lower_bound = (integer) $_REQUEST[ self::SLUG_PREFIX . 'post_lower' ];
665
  } else {
666
  $post_types = "'post', 'page'";
667
  }
 
668
 
669
  $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%' );
670
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $query = ' . var_export( $query, true ), self::MLA_DEBUG_CATEGORY );
671
  $results = $wpdb->get_results( $query );
672
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $results = ' . var_export( $results, true ), self::MLA_DEBUG_CATEGORY );
673
 
674
  $upload_dir = wp_upload_dir();
675
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $upload_dir = ' . var_export( $upload_dir, true ), self::MLA_DEBUG_CATEGORY );
676
  $upload_dir = $upload_dir['baseurl'] . '/';
677
  $site_url = get_site_url();
678
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $site_url = ' . var_export( $site_url, true ), self::MLA_DEBUG_CATEGORY );
679
  $upload_subdir = str_replace( $site_url, '', $upload_dir );
680
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_inserts_cache() $upload_subdir = ' . var_export( $upload_subdir, true ), self::MLA_DEBUG_CATEGORY );
681
 
682
+ // Use two upload directory URLs to handle HTTP/HTTPS mismatches
683
  $root_dir = str_replace( 'http', '', str_replace( 'https', '', $upload_dir ) );
684
  $http_dir = 'http' . $root_dir;
685
  $https_dir = 'https' . $root_dir;
687
  $image_inserts = array();
688
  foreach ( $results as $result ) {
689
  $match_count = preg_match_all( '/\<img .*?(src="([^"]*?)")[^\>]*?\>/', $result->post_content, $matches, PREG_OFFSET_CAPTURE );
690
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_image_inserts_cache( {$result->ID} ) count = {$match_count}, src \$matches = " . var_export( $matches, true ), self::MLA_DEBUG_CATEGORY );
691
+
692
  if ( $match_count ) {
693
  $image_inserts[ $result->ID ]['content'] = $result->post_content;
694
 
715
  // alt= value if present
716
  foreach ( $image_inserts[ $result->ID ]['inserts'] as $index => $insert ) {
717
  $match_count = preg_match( '/alt="([^"]*)"/', $insert['img'], $matches, PREG_OFFSET_CAPTURE );
718
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_image_inserts_cache( {$result->ID}, {$index} ) count = {$match_count}, alt \$matches = " . var_export( $matches, true ), self::MLA_DEBUG_CATEGORY );
719
  if ( $match_count ) {
720
  $image_inserts[ $result->ID ]['inserts'][ $index ]['alt'] = $matches[1][0];
721
  $image_inserts[ $result->ID ]['inserts'][ $index ]['alt_offset'] = $insert['img_offset'] + $matches[1][1];
727
  }
728
 
729
  $return = set_transient( self::SLUG_PREFIX . 'image_inserts', $image_inserts, 900 ); // fifteen minutes
730
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_image_inserts_cache() return = {$return}, \$image_inserts = " . var_export( $image_inserts, true ), self::MLA_DEBUG_CATEGORY );
 
731
  self::$image_inserts = $image_inserts;
732
 
 
733
  return 'Image inserts cache refreshed with ' . count( self::$image_inserts ) . ' post/page elements.';
734
  } // _build_image_inserts_cache
735
 
774
  if ( $use_cache ) {
775
  self::$figcaption_inserts = get_transient( self::SLUG_PREFIX . 'figcaption_inserts' );
776
  if ( is_array( self::$figcaption_inserts ) ) {
777
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache using cached self::\$figcaption_inserts " . var_export( self::$figcaption_inserts, true ), self::MLA_DEBUG_CATEGORY );
778
  return 'Using cached figcaption inserts with ' . count( self::$figcaption_inserts ) . ' post/page elements.';
779
  }
780
  }
804
  //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache post_types = " . var_export( $post_types, true ), 0 );
805
 
806
  $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%' );
807
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_figcaption_inserts_cache() $query = ' . var_export( $query, true ), self::MLA_DEBUG_CATEGORY );
808
  $results = $wpdb->get_results( $query );
809
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_figcaption_inserts_cache() $results = ' . var_export( $results, true ), self::MLA_DEBUG_CATEGORY );
810
 
811
  $gallery_items = array();
812
  $figcaption_inserts = array();
814
 
815
  // Items within a gallery require a different <figcaption> tag
816
  $match_count = preg_match_all( '/\<\!-- wp:gallery \{"ids":\[([^\]]*?)\]/', $result->post_content, $matches );
817
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache( {$result->ID} ) count = {$match_count}, src \$matches = " . var_export( $matches, true ), self::MLA_DEBUG_CATEGORY );
818
  //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache( {$result->ID} ) count = {$match_count}, src \$matches = " . var_export( $matches, true ), 0 );
819
  if ( $match_count ) {
820
  foreach( $matches[1] as $match ) {
827
  //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache( {$result->ID} ) count = {$match_count}, src \$gallery_items = " . var_export( $gallery_items, true ), 0 );
828
 
829
  $match_count = preg_match_all( '/\<figure[^\>]*?\>\<img.*?(wp-image-([0-9]*)).*?(\<figcaption.*?\>(.*?)\<\/figcaption\>|)\<\/figure\>/', $result->post_content, $matches, PREG_OFFSET_CAPTURE );
830
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache( {$result->ID} ) count = {$match_count}, src \$matches = " . var_export( $matches, true ), self::MLA_DEBUG_CATEGORY );
831
  //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache( {$result->ID} ) count = {$match_count}, src \$matches = " . var_export( $matches, true ), 0 );
832
 
833
  if ( $match_count ) {
859
 
860
  $return = set_transient( self::SLUG_PREFIX . 'figcaption_inserts', $figcaption_inserts, 900 ); // fifteen minutes
861
  //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache set_transient return = " . var_export( $return, true ), 0 );
862
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache() return = {$return}, \$figcaption_inserts = " . var_export( $figcaption_inserts, true ), self::MLA_DEBUG_CATEGORY );
863
  self::$figcaption_inserts = $figcaption_inserts;
864
 
865
  //error_log( __LINE__ . " Insert_Fixit::_build_figcaption_inserts_cache figcaption_inserts = " . var_export( $figcaption_inserts, true ), 0 );
893
  if ( $use_cache ) {
894
  self::$featured_objects = get_transient( self::SLUG_PREFIX . 'featured_objects' );
895
  if ( is_array( self::$featured_objects ) ) {
896
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_featured_objects_cache using cached self::\$featured_objects " . var_export( self::$featured_objects, true ), self::MLA_DEBUG_CATEGORY );
897
  return 'Using cached featured objects with ' . count( self::$featured_objects ) . ' attachment elements.';
898
  }
899
  }
928
  $query[] = "AND ( ID >= {$lower_bound} ) AND ( ID <= {$upper_bound} ) ) ORDER BY ID ) AS p ON m.meta_value = p.ID";
929
  $query[] = "WHERE m.meta_key = '_thumbnail_id'";
930
  $query = implode( ' ', $query );
931
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_featured_objects_cache() $query = ' . var_export( $query, true ), self::MLA_DEBUG_CATEGORY );
932
  $results = $wpdb->get_results( $query );
933
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_featured_objects_cache() $results = ' . var_export( $results, true ), self::MLA_DEBUG_CATEGORY );
934
 
935
  $references = array();
936
  if ( is_array( $results ) ) {
941
  }
942
 
943
  foreach( $references as $id => $result ) {
944
+ if ( self::$reverse_sort ) {
945
  krsort( $references[ $id ] );
946
  } else {
947
  ksort( $references[ $id ] );
951
 
952
  $return = set_transient( self::SLUG_PREFIX . 'featured_objects', $references, 900 ); // fifteen minutes
953
  //error_log( __LINE__ . " Insert_Fixit::_build_featured_objects_cache set_transient return = " . var_export( $return, true ), 0 );
954
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_featured_objects_cache return = {$return}, references = " . var_export( $references, true ), self::MLA_DEBUG_CATEGORY );
955
  self::$featured_objects = $references;
956
 
957
  return 'Featured objects cache refreshed with ' . count( self::$featured_objects ) . ' attachment elements.';
984
  if ( $use_cache ) {
985
  self::$item_references = get_transient( self::SLUG_PREFIX . 'item_references' );
986
  if ( is_array( self::$item_references ) ) {
987
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_item_references_cache using cached self::\$item_references " . var_export( self::$item_references, true ), self::MLA_DEBUG_CATEGORY );
988
  return 'Using cached item references with ' . count( self::$item_references ) . ' attachment elements.';
989
  }
990
  }
1014
  //error_log( __LINE__ . " Insert_Fixit::_build_item_references_cache post_types = " . var_export( $post_types, true ), 0 );
1015
 
1016
  $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=%' );
1017
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_item_references_cache() $query = ' . var_export( $query, true ), self::MLA_DEBUG_CATEGORY );
1018
  $results = $wpdb->get_results( $query );
1019
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_item_references_cache() $results = ' . var_export( $results, true ), self::MLA_DEBUG_CATEGORY );
1020
+
1021
+ $reference_shortcodes = isset( $_REQUEST[ self::SLUG_PREFIX . 'reference_shortcodes' ] ) ? trim( $_REQUEST[ self::SLUG_PREFIX . 'reference_shortcodes' ] ) : 'gallery,mla_gallery';
1022
+ $reference_parameter = isset( $_REQUEST[ self::SLUG_PREFIX . 'reference_parameter' ] ) ? trim( $_REQUEST[ self::SLUG_PREFIX . 'reference_parameter' ] ) : 'ids';
1023
 
1024
  self::$item_references = array();
1025
  foreach ( $results as $result ) {
1026
  // Find the class="wp-image-" references
1027
  $match_count = preg_match_all( '/wp-image-([0-9]{1,6})/', $result->post_content, $matches );
1028
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_item_references_cache( {$result->ID} ) class \$matches = " . var_export( $matches, true ), self::MLA_DEBUG_CATEGORY );
1029
  if ( $match_count ) {
1030
  foreach ( $matches[1] as $match ) {
1031
  self::$item_references[ absint( $match ) ][ absint( $result->ID ) ] = absint( $result->ID );
1032
  }
1033
  }
1034
 
1035
+ // Find the reference_parameter values
1036
+ if ( !empty( $reference_shortcodes ) ) {
1037
+ $match_shortcodes = array();
1038
+ $shortcodes = explode( ',', $reference_shortcodes );
1039
+
1040
+ foreach ( $shortcodes as $shortcode ) {
1041
+ $match_shortcodes[] = '\\[' . $shortcode;
1042
+ }
1043
+
1044
+ $match_shortcodes = implode( '|', $match_shortcodes );
1045
+ $match_shortcodes = '/(' . $match_shortcodes . ')[^\]]*' . $reference_parameter . '=([0-9,\\\'\"]*)/';
1046
+
1047
+ // $match_count = preg_match_all( '/(\[gallery|\[mla_gallery)[^\]]*ids=([0-9,\\\'\"]*)/', $result->post_content, $matches );
1048
+ $match_count = preg_match_all( $match_shortcodes, $result->post_content, $matches );
1049
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_item_references_cache( {$result->ID} ) ids \$matches = " . var_export( $matches, true ), self::MLA_DEBUG_CATEGORY );
1050
+ if ( $match_count ) {
1051
+ foreach ( $matches[2] as $match ) {
1052
+ $items = explode( ',', trim( $match, '\'"' ) );
1053
+ foreach ( $items as $item ) {
1054
+ self::$item_references[ absint( $item ) ][ absint( $result->ID ) ] = absint( $result->ID );
1055
+ }
1056
  }
1057
  }
1058
  }
1059
+ } // !empty( $reference_shortcodes )
1060
 
1061
  $return = set_transient( self::SLUG_PREFIX . 'item_references', self::$item_references, 900 ); // fifteen minutes
1062
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_item_references_cache return = {$return}, self::\$item_references " . var_export( self::$item_references, true ), self::MLA_DEBUG_CATEGORY );
1063
 
1064
  //error_log( __LINE__ . " Insert_Fixit::_build_item_references_cache item_references = " . var_export( self::$item_references, true ), 0 );
1065
  return 'Item references cache refreshed with ' . count( self::$item_references ) . ' items referenced in ' . count( $results ) . ' post/page elements.';
1098
  if ( $use_cache ) {
1099
  self::$image_objects = get_transient( self::SLUG_PREFIX . 'image_objects' );
1100
  if ( is_array( self::$image_objects ) ) {
1101
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_image_objects_cache using cached self::\$image_objects " . var_export( self::$image_objects, true ), self::MLA_DEBUG_CATEGORY );
1102
  return 'Using cached image objects with ' . count( self::$image_objects ) . ' attachment elements.';
1103
  }
1104
  }
1127
  }
1128
 
1129
  $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 );
1130
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_objects_cache() $query = ' . var_export( $query, true ), self::MLA_DEBUG_CATEGORY );
1131
  $results = $wpdb->get_results( $query );
1132
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_objects_cache() $results = ' . var_export( $results, true ), self::MLA_DEBUG_CATEGORY );
1133
 
1134
  // Load the image_inserts array
1135
  self::_build_image_inserts_cache( true );
1168
  } else {
1169
  $original_file = false;
1170
  }
1171
+ MLACore::mla_debug_add( __LINE__ . ' Insert_Fixit::_build_image_objects_cache() $original_file = ' . var_export( $original_file, true ), self::MLA_DEBUG_CATEGORY );
1172
 
1173
  $attachment_metadata = get_metadata( 'post', $result->ID, '_wp_attachment_metadata', true );
1174
  if ( empty( $attachment_metadata ) ) {
1176
  }
1177
 
1178
  $sizes = isset( $attachment_metadata['sizes'] ) ? $attachment_metadata['sizes'] : NULL;
1179
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_array_image_inserts_references( {$result->ID} ) sizes = " . var_export( $sizes, true ), self::MLA_DEBUG_CATEGORY );
1180
  if ( ! empty( $sizes ) && is_array( $sizes ) ) {
1181
  // Using the path and name as the array key ensures each name is added only once
1182
  foreach ( $sizes as $size => $size_info ) {
1188
  //$files[ $path . $base_file ] = $path . $base_file;
1189
  $files[ $base_file ] = $base_file;
1190
  }
1191
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_array_image_inserts_references( {$result->ID} ) files = " . var_export( $files, true ), self::MLA_DEBUG_CATEGORY );
1192
 
1193
  /*
1194
  * inserts Array of specific files (i.e., sizes) found in one or more posts/pages
1198
  $inserts = array();
1199
 
1200
  foreach( $files as $file ) {
1201
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_array_image_inserts_references( {$result->ID} ) file = " . var_export( $file, true ), self::MLA_DEBUG_CATEGORY );
1202
  foreach ( self::$image_inserts as $insert_id => $value ) {
1203
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_array_image_inserts_references( {$insert_id} ) value = " . var_export( $value, true ), self::MLA_DEBUG_CATEGORY );
1204
  if ( in_array( $file, $value['files'] ) ) {
1205
  $inserts[ $insert_id ][] = $file;
1206
  }
1208
  } // foreach file
1209
 
1210
  if ( ! empty( $inserts ) ) {
1211
+ if ( self::$reverse_sort ) {
1212
  krsort( $inserts );
1213
  } else {
1214
  ksort( $inserts );
1223
  } // each result
1224
 
1225
  $return = set_transient( self::SLUG_PREFIX . 'image_objects', $references, 900 ); // fifteen minutes
1226
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_build_image_objects_cache return = {$return}, self::\$image_objects = " . var_export( $references, true ), self::MLA_DEBUG_CATEGORY );
1227
  self::$image_objects = $references;
1228
 
1229
  //error_log( __LINE__ . " Insert_Fixit::_build_image_objects_cache image_objects = " . var_export( $references, true ), 0 );
1428
  * @return string HTML markup for results/messages
1429
  */
1430
  private static function _copy_alt_from_media_library() {
1431
+ // Load the image_inserts array
 
 
1432
  self::_build_image_inserts_cache( true );
1433
 
1434
+ // Load the image_objects array
 
 
1435
  self::_build_image_objects_cache( true );
1436
 
1437
  // Initialize statistics
1452
  $inserts = self::$image_inserts[ $post_id ];
1453
  foreach ( $files as $file ) {
1454
  foreach ( $inserts['inserts'] as $insert ) {
1455
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library file test '{$file}' == " . var_export( $insert['src'], true ), self::MLA_DEBUG_CATEGORY );
1456
  if ( $file != $insert['src'] || ! isset( $insert['alt'] ) ) {
1457
  continue;
1458
  }
1459
 
1460
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library ALT text test '{$alt_text}' == " . var_export( $insert['alt'], true ), self::MLA_DEBUG_CATEGORY );
1461
  if ( $alt_text == $insert['alt'] ) {
1462
  continue;
1463
  }
1474
  $replacements = $inserts['replacements'];
1475
  if ( ! empty( $replacements ) ) {
1476
  krsort( $replacements );
1477
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library( {$post_id} ) replacements = " . var_export( $replacements, true ), self::MLA_DEBUG_CATEGORY );
1478
  $post_content = $inserts['content'];
1479
  foreach ( $replacements as $offset => $replacement ) {
1480
  $post_content = substr_replace( $post_content, $replacement['text'], $offset, $replacement['length'] );
1481
  $updates++;
1482
  } // foreach replacement
1483
  $new_content = array( 'ID' => $post_id, 'post_content' => $post_content );
1484
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library( {$post_id} ) new post_content = " . var_export( $post_content, true ), self::MLA_DEBUG_CATEGORY );
1485
  $result = wp_update_post( $new_content, true );
1486
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library( {$post_id} ) update result = " . var_export( $result, true ), self::MLA_DEBUG_CATEGORY );
1487
  if ( is_wp_error( $result ) ) {
1488
  $errors++;
1489
  }
1490
  $updated_posts++;
1491
  } else { // has replacements
1492
+ MLACore::mla_debug_add( __LINE__ . " Insert_Fixit::_copy_alt_from_media_library( {$post_id} ) no replacements = " . var_export( $replacements, true ), self::MLA_DEBUG_CATEGORY );
1493
  } // no replacements
1494
  } // foreach post/page
1495
 
1846
  $referenced_items++;
1847
 
1848
  // Define "first"; oldest = ksort, newest = krsort
1849
+ if ( self::$reverse_sort ) {
1850
  krsort( $references, SORT_NUMERIC );
1851
  } else {
1852
  ksort( $references, SORT_NUMERIC );
examples/plugins/mla-tax-query-example.php CHANGED
@@ -61,8 +61,12 @@
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,10 +74,10 @@ Plugin Name: MLA tax query Example
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
@@ -152,6 +156,7 @@ class MLATaxQueryExample {
152
  public static function mla_gallery_attributes( $shortcode_attributes ) {
153
  // Save the attributes for use in the later filters
154
  self::$shortcode_attributes = $shortcode_attributes;
 
155
 
156
  // See if we are involved in processing this shortcode
157
  if ( isset( self::$shortcode_attributes['my_custom_sql'] ) ) {
@@ -356,6 +361,10 @@ class MLATaxQueryExample {
356
  $args = array( 'slug' => substr( $slug, 1 ), 'hide_empty' => false );
357
  $excludes = array_merge( $excludes, MLAQuery::mla_wp_get_terms( $taxonomy, $args ) );
358
  } else {
 
 
 
 
359
  $args = array( 'slug' => $slug, 'hide_empty' => false );
360
  $terms = array_merge( $terms, MLAQuery::mla_wp_get_terms( $taxonomy, $args ) );
361
  }
@@ -816,7 +825,6 @@ class MLATaxQueryExample {
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'] ) ) {
@@ -852,6 +860,7 @@ class MLATaxQueryExample {
852
  if ( ! empty( $orderby ) ) {
853
  $query[] = $orderby;
854
  }
 
855
 
856
  // Tell the final query to respect our orderby
857
  $all_query_parameters['orderby'] = 'post__in';
@@ -892,6 +901,7 @@ class MLATaxQueryExample {
892
  $paged = 1;
893
  }
894
 
 
895
  $limit = absint( ! empty( $all_query_parameters['posts_per_page'] ) ? $all_query_parameters['posts_per_page'] : $all_query_parameters['numberposts'] );
896
  $offset = $limit * ( $paged - 1);
897
  if ( 0 < $offset && 0 < $limit ) {
@@ -928,7 +938,7 @@ class MLATaxQueryExample {
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 ) {
934
  $includes[] = $id->ID;
@@ -938,6 +948,7 @@ class MLATaxQueryExample {
938
  $all_query_parameters['include'] = '1'; // return no items
939
  }
940
 
 
941
  return $all_query_parameters;
942
  } // double_query
943
  } // Class MLATaxQueryExample
61
  * opened on 12/15/2019 by "feelee".
62
  * https://wordpress.org/support/topic/mla-tax-query-example-plugin-syntax/
63
  *
64
+ * Enhanced (bug fixes) for support topic "Checklist behaviour, my_custom_sql, muie_terms_search"
65
+ * opened on 5/18/2021 by "heb51".
66
+ * https://wordpress.org/support/topic/checklist-behaviour-my_custom_sql-muie_terms_search/
67
+ *
68
  * @package MLA tax query Example
69
+ * @version 1.11
70
  */
71
 
72
  /*
74
  Plugin URI: http://davidlingren.com/
75
  Description: Replaces the WP_Query tax_query with a more efficient, direct SQL query
76
  Author: David Lingren
77
+ Version: 1.11
78
  Author URI: http://davidlingren.com/
79
 
80
+ Copyright 2013 - 2021 David Lingren
81
 
82
  This program is free software; you can redistribute it and/or modify
83
  it under the terms of the GNU General Public License as published by
156
  public static function mla_gallery_attributes( $shortcode_attributes ) {
157
  // Save the attributes for use in the later filters
158
  self::$shortcode_attributes = $shortcode_attributes;
159
+ //error_log( __LINE__ . ' MLATaxQueryExample::mla_gallery_attributes shortcode_attributes = ' . var_export( $shortcode_attributes, true ), 0 );
160
 
161
  // See if we are involved in processing this shortcode
162
  if ( isset( self::$shortcode_attributes['my_custom_sql'] ) ) {
361
  $args = array( 'slug' => substr( $slug, 1 ), 'hide_empty' => false );
362
  $excludes = array_merge( $excludes, MLAQuery::mla_wp_get_terms( $taxonomy, $args ) );
363
  } else {
364
+ if ( empty( $slug ) ) {
365
+ continue;
366
+ }
367
+
368
  $args = array( 'slug' => $slug, 'hide_empty' => false );
369
  $terms = array_merge( $terms, MLAQuery::mla_wp_get_terms( $taxonomy, $args ) );
370
  }
825
  //error_log( __LINE__ . " double_query( $tax_operator ) subquery = " . var_export( $subquery, true ), 0 );
826
  //error_log( __LINE__ . " double_query( $tax_operator ) subquery_parameters = " . var_export( $subquery_parameters, true ), 0 );
827
  $query[] = 'WHERE ( ( p.ID IN ( ' . $wpdb->prepare( $subquery, $subquery_parameters ) . ' ) )';
 
828
 
829
  if ( ! empty( self::$shortcode_attributes['post_mime_type'] ) ) {
830
  if ( 'all' != strtolower( self::$shortcode_attributes['post_mime_type'] ) ) {
860
  if ( ! empty( $orderby ) ) {
861
  $query[] = $orderby;
862
  }
863
+ //error_log( __LINE__ . " double_query query = " . var_export( $query, true ), 0 );
864
 
865
  // Tell the final query to respect our orderby
866
  $all_query_parameters['orderby'] = 'post__in';
901
  $paged = 1;
902
  }
903
 
904
+ //error_log( __LINE__ . " double_query all_query_parameters = " . var_export( $all_query_parameters, true ), 0 );
905
  $limit = absint( ! empty( $all_query_parameters['posts_per_page'] ) ? $all_query_parameters['posts_per_page'] : $all_query_parameters['numberposts'] );
906
  $offset = $limit * ( $paged - 1);
907
  if ( 0 < $offset && 0 < $limit ) {
938
 
939
  $ids = $wpdb->get_results( $query );
940
  //error_log( __LINE__ . ' double_query ids = ' . var_export( $ids, true ), 0 );
941
+ if ( is_array( $ids ) && count( $ids ) ) {
942
  $includes = array();
943
  foreach ( $ids as $id ) {
944
  $includes[] = $id->ID;
948
  $all_query_parameters['include'] = '1'; // return no items
949
  }
950
 
951
+ //error_log( __LINE__ . " double_query all_query_parameters = " . var_export( $all_query_parameters, true ), 0 );
952
  return $all_query_parameters;
953
  } // double_query
954
  } // Class MLATaxQueryExample
examples/plugins/mla-ui-elements-example.php DELETED
@@ -1,1125 +0,0 @@
1
- <?php
2
- /**
3
- * Provides shortcodes to improve user experience for [mla_term_list],
4
- * [mla_tag_cloud] and [mla_gallery] shortcodes
5
- *
6
- * In this example:
7
- *
8
- * 1. If you add "use_filters=true" to an [mla_term_list] shortcode this plugin will retain the
9
- * selected terms when the page is refreshed and pass them back into the shortcode.
10
- *
11
- * 2. If you add "add_filters_to=any" to an [mla_gallery] shortcode this plugin will retain
12
- * settings for terms search, keyword search, taxonomy queries and posts_per_page when the
13
- * page is refreshed or pagination moves to a new page.
14
- *
15
- * 3. If you add "add_filters_to=<taxonomy_slug>" to an [mla_gallery] shortcode this plugin will
16
- * do the actions in 2. and will also match the taxonomy_slug to a simple taxonomy query (if
17
- * present) and add that query to the taxonomy queries. If the simple query is 'muie-no-terms',
18
- * it will be ignored.
19
- *
20
- * 4. If you add "default_empty_gallery=true" an [mla_gallery] shortcode the initial gallery display
21
- * will show no items, until a selection is made from the other controls.
22
- *
23
- * 5. Shortcodes are provided to generate text box controls and retain their settings when the
24
- * page is refreshed or pagination moves to a new page:
25
- *
26
- * [muie_terms_search] generates a terms search text box
27
- * [muie_keyword_search] generates a keyword search text box
28
- * [muie_orderby] generates an order by dropdown control
29
- * [muie_order] generates ascending/descending radio buttons
30
- * [muie_per_page] generates an items per page text box
31
- * [muie_assigned_items_count] returns the number of items assigned to any term(s) in the
32
- * selected taxonomy
33
- *
34
- * 6. With a bit of work you can add a tag cloud that works with these filters. Here's an example
35
- * you can adapt for your application:
36
- *
37
- * <style type='text/css'>
38
- * #mla-tag-cloud .mla_current_item {
39
- * color:#FF0000;
40
- * font-weight:bold}
41
- * </style>
42
- * <span id=mla-tag-cloud>
43
- * <strong>Tag Cloud</strong>
44
- * [mla_tag_cloud taxonomy=attachment_tag number=20 current_item="{+request:current_item+}" mla_link_href="{+currentlink_url+}&tax_input{{+query:taxonomy+}}{}={+slug+}&muie_per_page={+template:({+request:muie_per_page+}|5)+}" mla_link_class="{+current_item_class+}"]
45
- * </span>
46
- *
47
- * This example plugin uses two of the many filters available in the [mla_gallery] and [mla_term_list] shortcodes
48
- * and illustrates some of the techniques you can use to customize the gallery display and term list controls.
49
- *
50
- * Created for support topic "How do I provide a front-end search of my media items using Custom Fields?"
51
- * opened on 4/15/2016 by "direys".
52
- * https://wordpress.org/support/topic/how-do-i-provide-a-front-end-search-of-my-media-items-using-custom-fields
53
- *
54
- * Enhanced for support topic "Dynamic search and filters"
55
- * opened on 5/28/2016 by "ghislainsc".
56
- * https://wordpress.org/support/topic/dynamic-search-and-filters
57
- *
58
- * Enhanced for support topic "Very new to this, need help"
59
- * opened on 6/15/2016 by "abronk".
60
- * https://wordpress.org/support/topic/very-new-to-this-need-help/
61
- *
62
- * Enhanced for support topic "Limiting search results to attachment tags/'Justifying' gallery grids"
63
- * opened on 7/2/2016 by "ceophoetography".
64
- * https://wordpress.org/support/topic/limiting-search-results-to-attachment-tagsjustifying-gallery-grids
65
- *
66
- * Enhanced for support topic "Shortcode"
67
- * opened on 10/18/2016 by "trinitaa".
68
- * https://wordpress.org/support/topic/shortcode-456/
69
- *
70
- * Enhanced for support topic "Search solution"
71
- * opened on 3/28/2019 by "fabrizioarnone".
72
- * https://wordpress.org/support/topic/search-solution/
73
- *
74
- * Enhanced (bug fixes) for support topic "Drop down not sticking"
75
- * opened on 12/10/2019 by "ageingdj".
76
- * https://wordpress.org/support/topic/drop-down-not-sticking/
77
- *
78
- * Enhanced (default_empty_gallery) for support topic "Search fields and presentation of results"
79
- * opened on 6/2/2020 by "ernstwg".
80
- * https://wordpress.org/support/topic/search-fields-and-presentation-of-results/
81
- *
82
- * @package MLA UI Elements Example
83
- * @version 1.13
84
- */
85
-
86
- /*
87
- Plugin Name: MLA UI Elements Example
88
- Plugin URI: http://davidlingren.com/
89
- Description: Provides shortcodes to improve user experience for [mla_term_list], [mla_tag_cloud] and [mla_gallery] shortcodes
90
- Author: David Lingren
91
- Version: 1.13
92
- Author URI: http://davidlingren.com/
93
-
94
- Copyright 2016-2019 David Lingren
95
-
96
- This program is free software; you can redistribute it and/or modify
97
- it under the terms of the GNU General Public License as published by
98
- the Free Software Foundation; either version 2 of the License, or
99
- (at your option) any later version.
100
-
101
- This program is distributed in the hope that it will be useful,
102
- but WITHOUT ANY WARRANTY; without even the implied warranty of
103
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
104
- GNU General Public License for more details.
105
-
106
- You can get a copy of the GNU General Public License by writing to the
107
- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
108
- */
109
-
110
- /**
111
- * Class MLA UI Elements Example provides shortcodes to improve user experience for
112
- * [mla_term_list], [mla_tag_cloud] and [mla_gallery] shortcodes
113
- *
114
- * @package MLA UI Elements Example
115
- * @since 1.00
116
- */
117
- class MLAUIElementsExample {
118
- /**
119
- * Initialization function, similar to __construct()
120
- *
121
- * @since 1.00
122
- */
123
- public static function initialize() {
124
- // The filters are only useful for front-end posts/pages; exit if in the admin section
125
- if ( is_admin() )
126
- return;
127
-
128
- add_filter( 'mla_term_list_attributes', 'MLAUIElementsExample::mla_term_list_attributes', 10, 1 );
129
- add_filter( 'mla_gallery_attributes', 'MLAUIElementsExample::mla_gallery_attributes', 10, 1 );
130
-
131
- // Add the custom shortcode for generating "sticky" term search text box
132
- add_shortcode( 'muie_terms_search', 'MLAUIElementsExample::muie_terms_search' );
133
-
134
- // Add the custom shortcode for generating "sticky" keyword search text box
135
- add_shortcode( 'muie_keyword_search', 'MLAUIElementsExample::muie_keyword_search' );
136
-
137
- // Add the custom shortcode for generating the items per page text box
138
- add_shortcode( 'muie_per_page', 'MLAUIElementsExample::muie_per_page' );
139
-
140
- // Add the custom shortcode for generating the order by dropdown control
141
- add_shortcode( 'muie_orderby', 'MLAUIElementsExample::muie_orderby' );
142
-
143
- // Add the custom shortcode for generating the order radio buttons
144
- add_shortcode( 'muie_order', 'MLAUIElementsExample::muie_order' );
145
-
146
- // Add the custom shortcode for generating assigned terms counts
147
- add_shortcode( 'muie_assigned_items_count', 'MLAUIElementsExample::muie_assigned_items_count' );
148
- }
149
-
150
- /**
151
- * Pass mla_control_name parameters from [mla_term_list] to [mla_gallery] for muie_filters
152
- *
153
- * @since 1.05
154
- *
155
- * @var array [ $mla_control_name ] = $_REQUEST[ $mla_control_name ]
156
- */
157
- private static $mla_control_names = array();
158
-
159
- /**
160
- * Pass term_id/slug choices from [mla_term_list] to [mla_gallery] for muie_filters
161
- *
162
- * @since 1.07
163
- *
164
- * @var array [ taxonomy ] = 'term_id' or 'slug'
165
- */
166
- private static $mla_option_values = array();
167
-
168
- /**
169
- * Look for 'muie_filters' that pass the selected parameters from page to page of a paginated gallery
170
- *
171
- * @since 1.00
172
- *
173
- * @param array the shortcode parameters passed in to the shortcode
174
- */
175
- public static function mla_term_list_attributes( $shortcode_attributes ) {
176
- // Exit if this is not a "filtered" term list
177
- if ( empty( $shortcode_attributes['use_filters'] ) || ( 'true' !== trim ( strtolower( $shortcode_attributes['use_filters'] ) ) ) ) {
178
- return $shortcode_attributes;
179
- }
180
-
181
- $mla_debug = ( ! empty( $shortcode_attributes['mla_debug'] ) ) ? trim( strtolower( $shortcode_attributes['mla_debug'] ) ) : false;
182
- if ( $mla_debug ) {
183
- if ( 'true' == $mla_debug ) {
184
- MLACore::mla_debug_mode( 'buffer' );
185
- } elseif ( 'log' == $mla_debug ) {
186
- MLACore::mla_debug_mode( 'log' );
187
- } else {
188
- $mla_debug = false;
189
- }
190
- }
191
-
192
- if ( $mla_debug ) {
193
- MLACore::mla_debug_add( __LINE__ . ' MLAUIElementsExample::mla_term_list_attributes input = ' . var_export( $shortcode_attributes, true ) );
194
- }
195
-
196
- // Pass "slug" overides to mla_gallery_attributes; using the slug is a common practice
197
- if ( empty( $shortcode_attributes['mla_option_value'] ) ) {
198
- $mla_option_value = 'term_id';
199
- } else {
200
- $mla_option_value = in_array( $shortcode_attributes['mla_option_value'], array( '{+slug+}', '[+slug+]' ) ) ? 'slug' : 'term_id';
201
- }
202
-
203
- foreach( explode( ',', $shortcode_attributes['taxonomy'] ) as $taxonomy ) {
204
- self::$mla_option_values[ $taxonomy ] = $mla_option_value;
205
- }
206
-
207
- // Allow for multiple taxonomies and named controls
208
- $taxonomy = implode( '-', explode( ',', $shortcode_attributes['taxonomy'] ) );
209
- $mla_control_name = !empty( $shortcode_attributes['mla_control_name'] ) ? $shortcode_attributes['mla_control_name'] : false;
210
- if ( $mla_control_name ) {
211
- if ( $index = strpos( $mla_control_name, '[]' ) ) {
212
- $mla_control_name = substr( $mla_control_name, 0, $index );
213
- }
214
- }
215
-
216
- // Pagination links, e.g. Previous or Next, have muie_filters that encode the form parameters
217
- if ( !empty( $_REQUEST['muie_filters'] ) ) {
218
- $filters = json_decode( trim( stripslashes( $_REQUEST['muie_filters'] ), '"' ), true );
219
-
220
- if ( !empty( $filters['tax_input'] ) ) {
221
- $_REQUEST['tax_input'] = $filters['tax_input'];
222
- }
223
-
224
- if ( $mla_control_name && !empty( $filters[ $mla_control_name ] ) ) {
225
- $_REQUEST[ $mla_control_name ] = $filters[ $mla_control_name ];
226
- }
227
- }
228
-
229
- // Check for a named control with possible taxonomy.term values from "combined" taxonomies
230
- if ( $mla_control_name && !empty( $_REQUEST[ $mla_control_name ] ) ) {
231
- self::$mla_control_names[ $mla_control_name ] = $_REQUEST[ $mla_control_name ];
232
- if ( is_scalar( $_REQUEST[ $mla_control_name ] ) ) {
233
- $input = array( $_REQUEST[ $mla_control_name ] );
234
- } else {
235
- $input = $_REQUEST[ $mla_control_name ];
236
- }
237
-
238
- foreach( $input as $input_element ) {
239
- $value = explode( '.', $input_element );
240
-
241
- if ( 2 === count( $value ) ) {
242
- $taxonomy = $value[0];
243
- $_REQUEST['tax_input'][ $taxonomy ][] = $value[1];
244
- } else {
245
- $_REQUEST['tax_input'][ $taxonomy ][] = $input_element;
246
- }
247
- }
248
- }
249
-
250
- // If nothing is set for this taxonomy we're done
251
- if ( empty( $_REQUEST['tax_input'] ) || !array_key_exists( $taxonomy, $_REQUEST['tax_input'] ) ) {
252
- if ( $mla_debug ) {
253
- MLACore::mla_debug_add( __LINE__ . ' MLAUIElementsExample::mla_term_list_attributes no changes' );
254
- }
255
-
256
- return $shortcode_attributes;
257
- }
258
-
259
- $terms = $_REQUEST['tax_input'][ $taxonomy ];
260
- if ( is_string( $terms ) ) {
261
- $terms = (array) trim( stripslashes( $terms ), ' \'"' );
262
- }
263
-
264
- // Check for a dropdown control with "All Terms" selected
265
- if ( empty( $shortcode_attributes['option_all_value'] ) ) {
266
- $option_all = array_search( '0', $terms );
267
- } else {
268
- $option_all = array_search( $shortcode_attributes['option_all_value'], $terms );
269
- }
270
-
271
- if ( false !== $option_all ) {
272
- unset( $terms[ $option_all ] );
273
- }
274
-
275
- if ( empty( $shortcode_attributes['option_all_text'] ) ) {
276
- $option_all = array_search( '', $terms );
277
- } else {
278
- $option_all = array_search( sanitize_title( $shortcode_attributes['option_all_text'] ), $terms );
279
- }
280
-
281
- if ( false !== $option_all ) {
282
- unset( $terms[ $option_all ] );
283
- }
284
-
285
- // Reflect option_all changes in the query arguments
286
- $_REQUEST['tax_input'][ $taxonomy ] = $terms;
287
- if ( $mla_debug ) {
288
- MLACore::mla_debug_add( __LINE__ . ' MLAUIElementsExample::mla_term_list_attributes tax_input = ' . var_export( $_REQUEST['tax_input'], true ) );
289
- }
290
-
291
- // Pass selected terms to the shortcode
292
- if ( !empty( $terms ) ) {
293
- if ( $mla_control_name && !empty( $_REQUEST[ $mla_control_name ] ) ) {
294
- $shortcode_attributes[ $shortcode_attributes['mla_item_parameter'] ] = $_REQUEST[ $mla_control_name ];
295
- } else {
296
- $shortcode_attributes[ $shortcode_attributes['mla_item_parameter'] ] = implode( ',', $_REQUEST['tax_input'][ $taxonomy ] );
297
- }
298
- }
299
-
300
- unset( $shortcode_attributes['use_filters'] );
301
-
302
- if ( $mla_debug ) {
303
- MLACore::mla_debug_add( __LINE__ . ' MLAUIElementsExample::mla_term_list_attributes returns = ' . var_export( $shortcode_attributes, true ) );
304
- }
305
-
306
- return $shortcode_attributes;
307
- } // mla_term_list_attributes
308
-
309
- /**
310
- * Add the taxonomy, terms, keyword queries and sort parameters to the shortcode,
311
- * limit posts_per_page and encode filters for pagination links
312
- *
313
- * @since 1.00
314
- *
315
- * @param array the shortcode parameters passed in to the shortcode
316
- */
317
- public static function mla_gallery_attributes( $shortcode_attributes ) {
318
- // Only process shortcodes that allow filters
319
- if ( empty( $shortcode_attributes['add_filters_to'] ) ) {
320
- return $shortcode_attributes;
321
- }
322
-
323
- $mla_debug = ( ! empty( $shortcode_attributes['mla_debug'] ) ) ? trim( strtolower( $shortcode_attributes['mla_debug'] ) ) : false;
324
- if ( $mla_debug ) {
325
- if ( 'true' == $mla_debug ) {
326
- MLACore::mla_debug_mode( 'buffer' );
327
- } elseif ( 'log' == $mla_debug ) {
328
- MLACore::mla_debug_mode( 'log' );
329
- } else {
330
- $mla_debug = false;
331
- }
332
- }
333
-
334
- if ( $mla_debug ) {
335
- MLACore::mla_debug_add( __LINE__ . ' MLAUIElementsExample::mla_gallery_attributes input = ' . var_export( $shortcode_attributes, true ) );
336
- }
337
-
338
- // Unpack filter values encoded for pagination links
339
- if ( !empty( $_REQUEST['muie_filters'] ) ) {
340
- $filters = json_decode( trim( stripslashes( $_REQUEST['muie_filters'] ), '"' ), true );
341
-
342
- foreach( $filters as $filter_key => $filter_value ) {
343
- $_REQUEST[ $filter_key ] = $filter_value;
344
- }
345
- }
346
-
347
- // Adjust posts_per_page/numberposts
348
- if ( !empty( $_REQUEST['muie_per_page'] ) ) {
349
- if ( isset( $shortcode_attributes['numberposts'] ) && ! isset( $shortcode_attributes['posts_per_page'] )) {
350
- $shortcode_attributes['posts_per_page'] = $shortcode_attributes['numberposts'];
351
- unset( $shortcode_attributes['numberposts'] );
352
- }
353
-
354
- $shortcode_attributes['posts_per_page'] = $_REQUEST['muie_per_page'];
355
- }
356
-
357
- // Fill these in from $_REQUEST parameters
358
- $muie_filters = array();
359
-
360
- $mla_control_name = !empty( $shortcode_attributes['mla_control_name'] ) ? $shortcode_attributes['mla_control_name'] : '';
361
- if ( !empty( $_REQUEST[ $mla_control_name ] ) ) {
362
- $muie_filters[ $mla_control_name ] = $_REQUEST[ $mla_control_name ];
363
- }
364
-
365
- // Add the orderby & order parameters
366
- if ( !empty( $_REQUEST['muie_orderby'] ) ) {
367
- $muie_filters['muie_orderby'] = $shortcode_attributes['orderby'] = $_REQUEST['muie_orderby'];
368
- }
369
-
370
- if ( !empty( $_REQUEST['muie_meta_key'] ) ) {
371
- $muie_filters['muie_meta_key'] = $shortcode_attributes['meta_key'] = $_REQUEST['muie_meta_key'];
372
- }
373
-
374
- if ( !empty( $_REQUEST['muie_order'] ) ) {
375
- $muie_filters['muie_order'] = $shortcode_attributes['order'] = $_REQUEST['muie_order'];
376
- }
377
-
378
- // Flag for the "empty_default_gallery" parameter
379
- $default_gallery = true;
380
-
381
- // Add the terms search parameters, if present
382
- if ( !empty( $_REQUEST['muie_terms_search'] ) && is_array( $_REQUEST['muie_terms_search'] ) && !empty( $_REQUEST['muie_terms_search']['mla_terms_phrases'] ) ) {
383
- $default_gallery = false;
384
- $muie_filters['muie_terms_search'] = $_REQUEST['muie_terms_search'];
385
- foreach( $muie_filters['muie_terms_search'] as $key => $value ) {
386
- if ( !empty( $value ) ) {
387
- $shortcode_attributes[ $key ] = $value;
388
- }
389
- }
390
- }
391
-
392
- // Add the keyword search parameters, if present
393
- if ( !empty( $_REQUEST['muie_keyword_search'] ) && is_array( $_REQUEST['muie_keyword_search'] ) && !empty( $_REQUEST['muie_keyword_search']['s'] ) ) {
394
- $default_gallery = false;
395
- $muie_filters['muie_keyword_search'] = $_REQUEST['muie_keyword_search'];
396
- foreach( $muie_filters['muie_keyword_search'] as $key => $value ) {
397
- if ( !empty( $value ) ) {
398
- $shortcode_attributes[ $key ] = $value;
399
- }
400
- }
401
- }
402
-
403
- // Add the taxonomy filter(s), if present
404
- $filter_taxonomy = $shortcode_attributes['add_filters_to'];
405
- if ( !empty( $_REQUEST['tax_input'] ) ) {
406
- $muie_filters['tax_input'] = $tax_input = $_REQUEST['tax_input'];
407
- } else {
408
- $tax_input = array();
409
- }
410
-
411
- // Add in any simple taxonomy query shortcode parameters
412
- if ( ! empty( $shortcode_attributes ) ) {
413
- $all_taxonomies = get_taxonomies( array ( 'show_ui' => true ), 'names' );
414
- $simple_tax_queries = array();
415
- foreach ( $shortcode_attributes as $key => $value ) {
416
- if ( 'tax_input' == $key ) {
417
- $tax_queries = array();
418
- $compound_values = array_filter( array_map( 'trim', explode( ',', $value ) ) );
419
- foreach ( $compound_values as $compound_value ) {
420
- $value = explode( '.', $compound_value );
421
- if ( 2 === count( $value ) ) {
422
- if ( array_key_exists( $value[0], $all_taxonomies ) ) {
423
- $tax_queries[ $value[0] ][] = $value[1];
424
- } // valid taxonomy
425
- } // valid coumpound value
426
- } // foreach compound_value
427
-
428
- foreach( $tax_queries as $key => $value ) {
429
- $simple_tax_queries[ $key ] = implode(',', $value );
430
- }
431
- } // tax_input
432
- elseif ( array_key_exists( $key, $all_taxonomies ) ) {
433
- $simple_tax_queries[ $key ] = implode(',', array_filter( array_map( 'trim', explode( ',', $value ) ) ) );
434
- if ( 'no.terms.assigned' === $simple_tax_queries[ $key ] ) {
435
- $no_terms_assigned_query = true;
436
- }
437
- } // array_key_exists
438
- } //foreach $shortcode_attributes
439
-
440
- if ( !empty( $simple_tax_queries ) ) {
441
- foreach ( $simple_tax_queries as $key => $value ) {
442
- $tax_input[ $key ] = explode( ',', $value );
443
- }
444
- }
445
- }
446
-
447
- // Add the [mla_term_list mla_control_name=] parameter(s)
448
- if ( !empty( self::$mla_control_names ) ) {
449
- $muie_filters = array_merge( $muie_filters, self::$mla_control_names );
450
- }
451
-
452
- if ( ! ( empty( $shortcode_attributes[ $filter_taxonomy ] ) && empty( $tax_input ) ) ) {
453
- $tax_query = '';
454
-
455
- // Validate other tax_query parameters or set defaults
456
- $tax_relation = 'AND';
457
- if ( isset( $shortcode_attributes['tax_relation'] ) ) {
458
- $attr_value = strtoupper( $shortcode_attributes['tax_relation'] );
459
- if ( in_array( $attr_value, array( 'AND', 'OR' ) ) ) {
460
- $tax_relation = $attr_value;
461
- }
462
- }
463
-
464
- $default_operator = 'IN';
465
- if ( isset( $shortcode_attributes['tax_operator'] ) ) {
466
- $attr_value = strtoupper( $shortcode_attributes['tax_operator'] );
467
- if ( in_array( $attr_value, array( 'IN', 'NOT IN', 'AND' ) ) ) {
468
- $default_operator = $attr_value;
469
- }
470
- }
471
-
472
- $default_children = 'true';
473
- if ( isset( $shortcode_attributes[ 'tax_include_children' ] ) ) {
474
- $attr_value = strtolower( $shortcode_attributes[ 'tax_include_children' ] );
475
- if ( in_array( $attr_value, array( 'false', 'true' ) ) ) {
476
- $default_children = $attr_value;
477
- }
478
- }
479
-
480
- // Look for the optional "simple taxonomy query" as an initial filter
481
- if ( !empty( $shortcode_attributes[ $filter_taxonomy ] ) ) {
482
- if ( 'muie-no-terms' !== $shortcode_attributes[ $filter_taxonomy ] ) {
483
- // Check for a dropdown control with "All Terms" selected
484
- $terms = explode( ',', $shortcode_attributes[ $filter_taxonomy ] );
485
- if ( empty( $shortcode_attributes['option_all_value'] ) ) {
486
- $option_all = array_search( '0', $terms );
487
- } else {
488
- $option_all = array_search( $shortcode_attributes['option_all_value'], $terms );
489
- }
490
-
491
- if ( false !== $option_all ) {
492
- unset( $terms[ $option_all ] );
493
- }
494
-
495
- if ( !empty( $terms ) ) {
496
- $values = "array( '" . implode( "', '", $terms ) . "' )";
497
- $tax_query .= "array('taxonomy' => '{$filter_taxonomy}' ,'field' => 'slug','terms' => {$values}, 'operator' => '{$default_operator}', 'include_children' => {$default_children} ), ";
498
- }
499
- }
500
-
501
- unset( $shortcode_attributes[ $filter_taxonomy ] );
502
- }
503
-
504
- foreach ( $tax_input as $taxonomy => $terms ) {
505
- // simple taxonomy query overrides tax_input
506
- if ( $taxonomy == $filter_taxonomy ) {
507
- continue;
508
- }
509
-
510
- // Check for a dropdown control with "All Terms" selected
511
- if ( empty( $shortcode_attributes['option_all_value'] ) ) {
512
- $option_all = array_search( '0', $terms );
513
- } else {
514
- $option_all = array_search( $shortcode_attributes['option_all_value'], $terms );
515
- }
516
-
517
- if ( false !== $option_all ) {
518
- unset( $terms[ $option_all ] );
519
- }
520
-
521
- if ( !empty( $terms ) ) {
522
- // Numeric values could still be a slug
523
- $field = ( !empty( self::$mla_option_values[ $taxonomy ] ) ) ? self::$mla_option_values[ $taxonomy ] : 'term_id';
524
- foreach ( $terms as $term ) {
525
- if ( ! ctype_digit( $term ) ) {
526
- $field = 'slug';
527
- break;
528
- }
529
- }
530
-
531
- if ( 'term_id' == $field ) {
532
- $values = 'array( ' . implode( ',', $terms ) . ' )';
533
- } else {
534
- $values = "array( '" . implode( "','", $terms ) . "' )";
535
- }
536
-
537
- // Taxonomy-specific "operator"
538
- $tax_operator = $default_operator;
539
- if ( isset( $shortcode_attributes[ $taxonomy . '_operator' ] ) ) {
540
- $attr_value = strtoupper( $shortcode_attributes[ $taxonomy . '_operator' ] );
541
- if ( in_array( $attr_value, array( 'IN', 'NOT IN', 'AND' ) ) ) {
542
- $tax_operator = $attr_value;
543
- }
544
- }
545
-
546
- // Taxonomy-specific "include_children"
547
- $tax_children = $default_children;
548
- if ( isset( $shortcode_attributes[ $taxonomy . '_children' ] ) ) {
549
- $attr_value = strtolower( $shortcode_attributes[ $taxonomy . '_children' ] );
550
- if ( in_array( $attr_value, array( 'false', 'true' ) ) ) {
551
- $tax_children = $attr_value;
552
- }
553
- }
554
-
555
- $tax_query .= "array('taxonomy' => '{$taxonomy}' ,'field' => '{$field}','terms' => {$values}, 'operator' => '{$tax_operator}', 'include_children' => {$tax_children} ), ";
556
- }
557
- }
558
-
559
- if ( ! empty( $tax_query ) ) {
560
- $default_gallery = false;
561
- $shortcode_attributes['tax_query'] = "array( 'relation' => '" . $tax_relation . "', " . $tax_query . ')';
562
- }
563
- }
564
-
565
- // Check for an initial display of an empty gallery instead of all images.
566
- if ( $default_gallery && !empty( $shortcode_attributes['default_empty_gallery'] ) ) {
567
- if ( 'true' === trim( strtolower( $shortcode_attributes['default_empty_gallery'] ) ) ) {
568
- $shortcode_attributes['s'] = 'mla-default-empty-gallery-keyword-search-string';
569
- $shortcode_attributes['mla_search_fields'] = 'title';
570
- }
571
- }
572
-
573
- // Add the filter settings to pagination URLs
574
- if ( !empty( $shortcode_attributes['mla_output'] ) ) {
575
-
576
- $filters = urlencode( json_encode( $muie_filters ) );
577
- $shortcode_attributes['mla_link_href'] = '[+new_url+]?[+new_page_text+]&muie_filters=' . $filters;
578
-
579
- if ( !empty( $shortcode_attributes['posts_per_page'] ) ) {
580
- $shortcode_attributes['mla_link_href'] .= '&muie_per_page=' . $shortcode_attributes['posts_per_page'];
581
- }
582
- }
583
-
584
- unset( $shortcode_attributes['add_filters_to'] );
585
-
586
- if ( $mla_debug ) {
587
- MLACore::mla_debug_add( __LINE__ . ' MLAUIElementsExample::mla_gallery_attributes returns = ' . var_export( $shortcode_attributes, true ) );
588
- }
589
-
590
- return $shortcode_attributes;
591
- } // mla_gallery_attributes
592
-
593
- /**
594
- * Terms search generator shortcode
595
- *
596
- * This shortcode generates an HTML text box with a default mla_terms_phrases value,
597
- * and adds hidden parameters for the other Terms Search parameters
598
- *
599
- * @since 1.00
600
- *
601
- * @param array the shortcode parameters
602
- *
603
- * @return string HTML markup for the generated form
604
- */
605
- public static function muie_terms_search( $attr ) {
606
- $default_arguments = array(
607
- 'mla_terms_phrases' => '',
608
- 'mla_terms_taxonomies' => '',
609
- 'mla_phrase_delimiter' => '',
610
- 'mla_term_delimiter' => '',
611
- 'mla_phrase_connector' => '',
612
- 'mla_term_delimiter' => '',
613
- 'mla_term_connector' => '',
614
- );
615
-
616
- // Make sure $attr is an array, even if it's empty
617
- if ( empty( $attr ) ) {
618
- $attr = array();
619
- } elseif ( is_string( $attr ) ) {
620
- $attr = shortcode_parse_atts( $attr );
621
- }
622
-
623
- // Accept only the attributes we need and supply defaults
624
- $arguments = shortcode_atts( $default_arguments, $attr );
625
-
626
- // Pagination links, e.g. Previous or Next, have muie_filters that encode the form parameters
627
- if ( !empty( $_REQUEST['muie_filters'] ) ) {
628
- $filters = json_decode( trim( stripslashes( $_REQUEST['muie_filters'] ), '"' ), true );
629
-
630
- if ( !empty( $filters['muie_terms_search'] ) ) {
631
- $_REQUEST['muie_terms_search'] = $filters['muie_terms_search'];
632
- }
633
- }
634
-
635
- // muie_terms_search has settings from the form or pagination link
636
- if ( !empty( $_REQUEST['muie_terms_search'] ) && is_array( $_REQUEST['muie_terms_search'] ) ) {
637
- foreach ( $arguments as $key => $value ) {
638
- if ( !empty( $_REQUEST['muie_terms_search'][ $key ] ) ) {
639
- $arguments[ $key ] = stripslashes( $_REQUEST['muie_terms_search'][ $key ] );
640
- }
641
- }
642
- }
643
-
644
- // Always supply the terms phrases text box, with the appropriate quoting
645
- if ( false !== strpos( $arguments['mla_terms_phrases'], '"' ) ) {
646
- $delimiter = '\'';
647
- } else {
648
- $delimiter = '"';
649
- }
650
-
651
- $return_value = '<input name="muie_terms_search[mla_terms_phrases]" id="muie-terms-phrases" type="text" size="20" value=' . $delimiter . $arguments['mla_terms_phrases'] . $delimiter . " />\n";
652
- unset( $arguments['mla_terms_phrases'] );
653
-
654
- // Add optional parameters
655
- foreach( $arguments as $key => $value ) {
656
- if ( !empty( $value ) ) {
657
- $id_value = str_replace( '_', '-', substr( $key, 4 ) );
658
- $return_value .= sprintf( '<input name="muie_terms_search[%1$s]" id="muie-%2$s" type="hidden" value="%3$s" />%4$s', $key, $id_value, $value, "\n" );
659
- }
660
- }
661
-
662
- return $return_value;
663
- } // muie_terms_search
664
-
665
- /**
666
- * Keyword search generator shortcode
667
- *
668
- * This shortcode generates an HTML text box with a default "s" (search string) value,
669
- * and adds hidden parameters for the other Keyword Search parameters
670
- *
671
- * @since 1.00
672
- *
673
- * @param array the shortcode parameters
674
- *
675
- * @return string HTML markup for the generated form
676
- */
677
- public static function muie_keyword_search( $attr ) {
678
- $default_arguments = array(
679
- 's' => '',
680
- 'mla_search_fields' => '',
681
- 'mla_search_connector' => '',
682
- 'sentence' => '',
683
- 'exact' => '',
684
- );
685
-
686
- // Make sure $attr is an array, even if it's empty
687
- if ( empty( $attr ) ) {
688
- $attr = array();
689
- } elseif ( is_string( $attr ) ) {
690
- $attr = shortcode_parse_atts( $attr );
691
- }
692
-
693
- // Accept only the attributes we need and supply defaults
694
- $arguments = shortcode_atts( $default_arguments, $attr );
695
-
696
- // Pagination links, e.g. Previous or Next, have muie_filters that encode the form parameters
697
- if ( !empty( $_REQUEST['muie_filters'] ) ) {
698
- $filters = json_decode( trim( stripslashes( $_REQUEST['muie_filters'] ), '"' ), true );
699
-
700
- if ( !empty( $filters['muie_keyword_search'] ) ) {
701
- $_REQUEST['muie_keyword_search'] = $filters['muie_keyword_search'];
702
- }
703
- }
704
-
705
- // muie_keyword_search has settings from the form or pagination link
706
- if ( !empty( $_REQUEST['muie_keyword_search'] ) && is_array( $_REQUEST['muie_keyword_search'] ) ) {
707
- foreach ( $arguments as $key => $value ) {
708
- if ( !empty( $_REQUEST['muie_keyword_search'][ $key ] ) ) {
709
- $arguments[ $key ] = stripslashes( $_REQUEST['muie_keyword_search'][ $key ] );
710
- }
711
- }
712
- }
713
-
714
- // Always supply the search text box, with the appropriate quoting
715
- if ( false !== strpos( $arguments['s'], '"' ) ) {
716
- $delimiter = '\'';
717
- } else {
718
- $delimiter = '"';
719
- }
720
-
721
- $return_value = '<input name="muie_keyword_search[s]" id="muie-s" type="text" size="20" value=' . $delimiter . $arguments['s'] . $delimiter . " />\n";
722
- unset( $arguments['s'] );
723
-
724
- // Add optional parameters
725
- foreach( $arguments as $key => $value ) {
726
- if ( !empty( $value ) ) {
727
- $id_value = str_replace( '_', '-', substr( $key, 4 ) );
728
- $return_value .= sprintf( '<input name="muie_keyword_search[%1$s]" id="muie-%2$s" type="hidden" value="%3$s" />%4$s', $key, $id_value, $value, "\n" );
729
- }
730
- }
731
-
732
- return $return_value;
733
- } // muie_keyword_search
734
-
735
- /**
736
- * Items per page shortcode
737
- *
738
- * This shortcode generates an HTML text box with a default muie_per_page value.
739
- *
740
- * @since 1.00
741
- *
742
- * @param array the shortcode parameters
743
- *
744
- * @return string HTML markup for the generated form
745
- */
746
- public static function muie_per_page( $attr ) {
747
- if ( isset( $attr['numberposts'] ) && ! isset( $attr['posts_per_page'] )) {
748
- $attr['posts_per_page'] = $attr['numberposts'];
749
- unset( $attr['numberposts'] );
750
- }
751
-
752
- if ( !empty( $_REQUEST['muie_per_page'] ) ) {
753
- $posts_per_page = $_REQUEST['muie_per_page'];
754
- } else {
755
- $posts_per_page = isset( $attr['posts_per_page'] ) ? $attr['posts_per_page'] : 6;
756
- }
757
-
758
- return '<input name="muie_per_page" id="muie-per-page" type="text" size="2" value="' . $posts_per_page . '" />';
759
- } // muie_per_page
760
-
761
- /**
762
- * Order by shortcode
763
- *
764
- * This shortcode generates a dropdown control with sort order values.
765
- *
766
- * @since 1.03
767
- *
768
- * @param array $attr the shortcode parameters
769
- * @param string $content Optional content for enclosing shortcodes
770
- *
771
- * @return string HTML markup for the generated control(s)
772
- */
773
- public static function muie_orderby( $attr, $content = NULL ) {
774
- $default_arguments = array(
775
- 'shortcode' => 'mla_gallery',
776
- 'sort_fields' => '',
777
- 'meta_value_num' => '',
778
- 'meta_value' => '',
779
- );
780
-
781
- // Make sure $attr is an array, even if it's empty
782
- if ( empty( $attr ) ) {
783
- $attr = array();
784
- } elseif ( is_string( $attr ) ) {
785
- $attr = shortcode_parse_atts( $attr );
786
- }
787
-
788
- /*
789
- * Look for parameters in an enclosing shortcode
790
- */
791
- if ( !empty( $content ) ) {
792
- $content = str_replace( array( '&#8216;', '&#8217;', '&#8221;', '&#8243;', '<br />', '<p>', '</p>', "\r", "\n" ), array( '\'', '\'', '"', '"', ' ', ' ', ' ', ' ', ' ' ), $content );
793
- $new_attr = shortcode_parse_atts( $content );
794
- $attr = array_merge( $attr, $new_attr );
795
- }
796
-
797
- // Accept only the attributes we need and supply defaults
798
- $arguments = shortcode_atts( $default_arguments, $attr );
799
-
800
- switch ( $arguments['shortcode'] ) {
801
- case 'mla_gallery':
802
- $allowed_fields = array(
803
- 'empty' => '- select -',
804
- 'ID' => 'item ID',
805
- 'author' => 'Author',
806
- 'date' => 'Date uploaded',
807
- 'description' => 'Description',
808
- 'title' => 'Title',
809
- 'caption' => 'Caption',
810
- 'slug' => 'name/slug',
811
- 'parent' => 'Parent ID',
812
- 'menu_order' => 'Menu order',
813
- 'mime_type' => 'MIME type',
814
- 'none' => 'No order',
815
- 'rand' => 'Random',
816
- );
817
- break;
818
- case 'mla_tag_cloud':
819
- case 'mla_term_list':
820
- $allowed_fields = array(
821
- 'empty' => '- select -',
822
- 'count' => 'Assigned items',
823
- 'id' => 'Term ID',
824
- 'name' => 'Term name',
825
- 'slug' => 'Term slug',
826
- 'none' => 'No order',
827
- 'random' => 'Random',
828
- );
829
- break;
830
- default:
831
- $allowed_fields = array();
832
- }
833
-
834
- if ( empty( $arguments['sort_fields'] ) ) {
835
- $sort_fields = $allowed_fields;
836
- } else {
837
- $sort_fields = array();
838
-
839
- if ( 0 === strpos( $arguments['sort_fields'], 'array' ) ) {
840
- $function = @create_function('', 'return ' . $arguments['sort_fields'] . ';' );
841
- if ( is_callable( $function ) ) {
842
- $field_array = $function();
843
- }
844
-
845
- if ( is_array( $field_array ) ) {
846
- $sort_fields = $field_array;
847
- }
848
- } else {
849
- foreach( explode( ',', $arguments['sort_fields'] ) as $field ) {
850
- if ( array_key_exists( $field, $allowed_fields ) ) {
851
- $sort_fields[ $field ] = $allowed_fields[ $field ];
852
- }
853
- }
854
- }
855
- }
856
-
857
- // Check for custom field sorting
858
- if ( !empty( $arguments['meta_value_num'] ) ) {
859
- $custom_key = 'meta_value_num';
860
- $custom_spec = $arguments['meta_value_num'];
861
- } elseif ( !empty( $arguments['meta_value'] ) ) {
862
- $custom_key = 'meta_value';
863
- $custom_spec = $arguments['meta_value'];
864
- } else {
865
- $custom_key = '';
866
- $custom_spec = '';
867
- }
868
-
869
- if ( !empty( $custom_spec ) ) {
870
- $spec_parts = explode( '=>', $custom_spec );
871
- $spec_key = trim( $spec_parts[0], ' \'"' );
872
- $spec_suffix = '';
873
-
874
- $tail = strrpos( $spec_key, ' DESC' );
875
- if ( ! ( false === $tail ) ) {
876
- $spec_key = substr( $spec_key, 0, $tail );
877
- $spec_suffix = ' DESC';
878
- } else {
879
- $tail = strrpos( $spec_key, ' ASC' );
880
- if ( ! ( false === $tail ) ) {
881
- $spec_key = substr( $spec_key, 0, $tail );
882
- $spec_suffix = ' ASC';
883
- }
884
- }
885
-
886
- $spec_label = !empty( $spec_parts[1] ) ? trim( $spec_parts[1], ' \'"' ) : $spec_key;
887
- $sort_fields[ $custom_key . $spec_suffix ] = $spec_label;
888
- }
889
-
890
- if ( empty( $sort_fields ) ) {
891
- return '';
892
- }
893
-
894
- // Unpack filter values encoded for pagination links
895
- if ( !empty( $_REQUEST['muie_filters'] ) ) {
896
- $filters = json_decode( trim( stripslashes( $_REQUEST['muie_filters'] ), '"' ), true );
897
-
898
- if ( isset( $filters['muie_orderby'] ) ) {
899
- $_REQUEST['muie_orderby'] = $filters['muie_orderby'];
900
- }
901
- }
902
-
903
- if ( !empty( $_REQUEST['muie_orderby'] ) ) {
904
- $current_value = $_REQUEST['muie_orderby'];
905
- } else {
906
- $current_value = '';
907
- }
908
-
909
- if ( !empty( $spec_key ) ) {
910
- $output = '<input name="muie_meta_key" id="muie-meta-key" type="hidden" value="' . $spec_key . '">' . "\n";
911
- } else {
912
- $output = '';
913
- }
914
-
915
- $output .= '<select name="muie_orderby" id="muie-orderby">' . "\n";
916
-
917
- foreach ( $sort_fields as $value => $label ) {
918
- $value = 'empty' === $value ? '' : $value;
919
-
920
- $selected = ( $current_value === $value ) ? ' selected=selected ' : ' ';
921
-
922
- $output .= ' <option' . $selected . 'value="' . $value . '">' . $label . "</option>\n";
923
- }
924
-
925
- $output .= "</select>\n";
926
-
927
- return $output;
928
- } // muie_orderby
929
-
930
- /**
931
- * Order (ASC/DESC) shortcode
932
- *
933
- * This shortcode generates ascending/descending radio buttons.
934
- *
935
- * @since 1.03
936
- *
937
- * @param array $attr the shortcode parameters
938
- * @param string $content Optional content for enclosing shortcodes
939
- *
940
- * @return string HTML markup for the generated control(s)
941
- */
942
- public static function muie_order( $attr, $content = NULL ) {
943
- $default_arguments = array(
944
- 'default_order' => 'ASC',
945
- 'asc_label' => 'Ascending',
946
- 'desc_label' => 'Descending',
947
- );
948
-
949
- // Make sure $attr is an array, even if it's empty
950
- if ( empty( $attr ) ) {
951
- $attr = array();
952
- } elseif ( is_string( $attr ) ) {
953
- $attr = shortcode_parse_atts( $attr );
954
- }
955
-
956
- /*
957
- * Look for parameters in an enclosing shortcode
958
- */
959
- if ( !empty( $content ) ) {
960
- $content = str_replace( array( '&#8216;', '&#8217;', '&#8221;', '&#8243;', '<br />', '<p>', '</p>', "\r", "\n" ), array( '\'', '\'', '"', '"', ' ', ' ', ' ', ' ', ' ' ), $content );
961
- $new_attr = shortcode_parse_atts( $content );
962
- $attr = array_merge( $attr, $new_attr );
963
- }
964
-
965
- // Accept only the attributes we need and supply defaults
966
- $arguments = shortcode_atts( $default_arguments, $attr );
967
-
968
- // Unpack filter values encoded for pagination links
969
- if ( !empty( $_REQUEST['muie_filters'] ) ) {
970
- $filters = json_decode( trim( stripslashes( $_REQUEST['muie_filters'] ), '"' ), true );
971
-
972
- if ( isset( $filters['muie_order'] ) ) {
973
- $_REQUEST['muie_order'] = $filters['muie_order'];
974
- }
975
- }
976
-
977
- if ( !empty( $_REQUEST['muie_order'] ) ) {
978
- $current_value = $_REQUEST['muie_order'];
979
- } else {
980
- $current_value = $arguments['default_order'];
981
- }
982
-
983
- if ( 'DESC' === $current_value ) {
984
- $asc_selected = '';
985
- $desc_selected = ' checked="checked"';
986
- } else {
987
- $asc_selected = ' checked="checked"';
988
- $desc_selected = '';
989
- }
990
-
991
- $output = '<input name="muie_order" id="muie-order-asc" type="radio"' . $asc_selected . ' value="ASC"> ' . $arguments['asc_label'] . '&nbsp;&nbsp;';
992
- $output .= '<input name="muie_order" id="muie-order-desc" type="radio"' . $desc_selected . ' value="DESC">' . $arguments['desc_label'] . "&nbsp;&nbsp\n";
993
-
994
- return $output;
995
- } // muie_order
996
-
997
- /**
998
- * Assigned items count shortcode
999
- *
1000
- * This shortcode returns the number of items assigned to any term(s) in the selected taxonomy
1001
- *
1002
- * @since 1.01
1003
- *
1004
- * @param array the shortcode parameters
1005
- *
1006
- * @return string HTML markup for the generated form
1007
- */
1008
- public static function muie_assigned_items_count( $attr ) {
1009
- global $wpdb;
1010
-
1011
- $default_arguments = array(
1012
- 'taxonomy' => '',
1013
- 'post_type' => 'attachment',
1014
- 'post_status' => 'inherit',
1015
- 'post_mime_type' => 'image',
1016
- );
1017
-
1018
- // Make sure $attr is an array, even if it's empty
1019
- if ( empty( $attr ) ) {
1020
- $attr = array();
1021
- } elseif ( is_string( $attr ) ) {
1022
- $attr = shortcode_parse_atts( $attr );
1023
- }
1024
-
1025
- // Accept only the attributes we need and supply defaults
1026
- $arguments = shortcode_atts( $default_arguments, $attr );
1027
-
1028
- /*
1029
- * Build an array of individual clauses that can be filtered
1030
- */
1031
- $clauses = array( 'fields' => '', 'join' => '', 'where' => '', 'order' => '', 'orderby' => '', 'limits' => '', );
1032
-
1033
- $clause_parameters = array();
1034
-
1035
- $clause[] = 'LEFT JOIN `' . $wpdb->term_relationships . '` AS tr ON tt.term_taxonomy_id = tr.term_taxonomy_id';
1036
- $clause[] = 'LEFT JOIN `' . $wpdb->posts . '` AS p ON tr.object_id = p.ID';
1037
-
1038
- /*
1039
- * Add type and status constraints
1040
- */
1041
- if ( is_array( $arguments['post_type'] ) ) {
1042
- $post_types = $arguments['post_type'];
1043
- } else {
1044
- $post_types = array( $arguments['post_type'] );
1045
- }
1046
-
1047
- $placeholders = array();
1048
- foreach ( $post_types as $post_type ) {
1049
- $placeholders[] = '%s';
1050
- $clause_parameters[] = $post_type;
1051
- }
1052
-
1053
- $clause[] = 'AND p.post_type IN (' . join( ',', $placeholders ) . ')';
1054
-
1055
- if ( is_array( $arguments['post_status'] ) ) {
1056
- $post_stati = $arguments['post_status'];
1057
- } else {
1058
- $post_stati = array( $arguments['post_status'] );
1059
- }
1060
-
1061
- $placeholders = array();
1062
- foreach ( $post_stati as $post_status ) {
1063
- if ( ( 'private' != $post_status ) || is_user_logged_in() ) {
1064
- $placeholders[] = '%s';
1065
- $clause_parameters[] = $post_status;
1066
- }
1067
- }
1068
- $clause[] = 'AND p.post_status IN (' . join( ',', $placeholders ) . ')';
1069
-
1070
- $clause = join(' ', $clause);
1071
- $clauses['join'] = $wpdb->prepare( $clause, $clause_parameters );
1072
-
1073
- /*
1074
- * Start WHERE clause with a taxonomy constraint
1075
- */
1076
- if ( is_array( $arguments['taxonomy'] ) ) {
1077
- $taxonomies = $arguments['taxonomy'];
1078
- } else {
1079
- $taxonomies = array( $arguments['taxonomy'] );
1080
- }
1081
-
1082
- foreach ( $taxonomies as $taxonomy ) {
1083
- if ( ! taxonomy_exists( $taxonomy ) ) {
1084
- $error = new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy', 'media-library-assistant' ), $taxonomy );
1085
- return $error;
1086
- }
1087
- }
1088
-
1089
- $clause_parameters = array();
1090
- $placeholders = array();
1091
- foreach ($taxonomies as $taxonomy) {
1092
- $placeholders[] = '%s';
1093
- $clause_parameters[] = $taxonomy;
1094
- }
1095
-
1096
- $clause = array( 'tt.taxonomy IN (' . join( ',', $placeholders ) . ')' );
1097
- if ( 'all' !== strtolower( $arguments['post_mime_type'] ) ) {
1098
- $clause[] = str_replace( '%', '%%', wp_post_mime_type_where( $arguments['post_mime_type'], 'p' ) );
1099
- }
1100
-
1101
- $clause = join(' ', $clause);
1102
- $clauses['where'] = $wpdb->prepare( $clause, $clause_parameters );
1103
-
1104
- /*
1105
- * Build the final query
1106
- */
1107
- $query = array( 'SELECT' );
1108
- $query[] = 'COUNT(*)'; // 'p.ID'; // $clauses['fields'];
1109
- $query[] = 'FROM ( SELECT DISTINCT p.ID FROM `' . $wpdb->term_taxonomy . '` AS tt';
1110
- $query[] = $clauses['join'];
1111
- $query[] = 'WHERE (';
1112
- $query[] = $clauses['where'];
1113
- $query[] = ') ) as subquery';
1114
-
1115
- $query = join(' ', $query);
1116
- $count = $wpdb->get_var( $query );
1117
- return number_format( (float) $count );
1118
- } // muie_assigned_items_count
1119
- } // Class MLAUIElementsExample
1120
-
1121
- /*
1122
- * Install the filters at an early opportunity
1123
- */
1124
- add_action('init', 'MLAUIElementsExample::initialize');
1125
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
examples/plugins/mla-ui-elements-example/admin-settings-page.tpl ADDED
@@ -0,0 +1,1263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- template="page" -->
2
+ <a name="backtotop"></a>
3
+ &nbsp;
4
+ <div class="wrap">
5
+ <h1 class="wp-heading-inline">[+plugin_title+] [+version+] Settings</h1>
6
+ [+messages+]
7
+ [+tablist+]
8
+ [+tab_content+]
9
+ </div><!-- wrap -->
10
+
11
+ <!-- template="tablist" -->
12
+ <h2 class="nav-tab-wrapper">
13
+ [+tablist+]
14
+ </h2>
15
+ <!-- template="tablist-item" -->
16
+ <a data-tab-id="[+data-tab-id+]" class="nav-tab [+nav-tab-active+]" href="?page=[+settings-page+]&amp;mla_tab=[+data-tab-id+]">[+title+]</a>
17
+
18
+ <!-- template="messages" -->
19
+ <div class="[+mla_messages_class+]">
20
+ <p>
21
+ [+messages+]
22
+ </p>
23
+ </div>
24
+
25
+ <!-- template="page-level-options" -->
26
+ <tr valign="top">
27
+ <td class="textright">
28
+ <input name="[+slug_prefix+]_options[media_assistant_support]" id="[+slug_prefix+]_options_media_assistant_support" type="checkbox" [+media_assistant_support_checked+] value="1" />
29
+ </td>
30
+ <td>
31
+ &nbsp;<strong>Enable Media/Assistant searches</strong>
32
+ <div class="mla-settings-help">&nbsp;&nbsp;Check this option to activate support for the Search Media box on the Media/Assistant admin submenu.</div>
33
+ </td>
34
+ </tr>
35
+ <tr valign="top">
36
+ <td class="textright">
37
+ <input name="[+slug_prefix+]_options[mmmw_support]" id="[+slug_prefix+]_options_mmmw_support" type="checkbox" [+mmmw_support_checked+] value="1" />
38
+ </td>
39
+ <td>
40
+ &nbsp;<strong>Enable Media Manager searches</strong>
41
+ <div class="mla-settings-help">&nbsp;&nbsp;Check this option to activate support for the Media Manager Modal (popup) Window.</div>
42
+ </td>
43
+ </tr>
44
+ <tr valign="top">
45
+ <td class="textright">
46
+ <strong>Prefix</strong>
47
+ </td>
48
+ <td>
49
+ <input name="[+slug_prefix+]_options[prefix]" id="[+slug_prefix+]_options_prefix" type="text" size="20" maxlength="20"value="[+prefix+]" />
50
+ <div class="mla-settings-help">&nbsp;&nbsp;Enter the prefix value that signifies a custom field search. Be sure to include something like a colon at the end.</div>
51
+ </td>
52
+ </tr>
53
+ <tr valign="top">
54
+ <td class="textright">
55
+ <strong>Default Field(s)</strong>
56
+ </td>
57
+ <td>
58
+ <input name="[+slug_prefix+]_options[default_fields]" id="[+slug_prefix+]_options_default_fields" type="text" size="40" maxlength="40"value="[+default_fields+]" />
59
+ <div class="mla-settings-help">&nbsp;&nbsp;Enter the (comma-separated) custom field name(s) to be searched by default.</div>
60
+ </td>
61
+ </tr>
62
+ <tr valign="top">
63
+ <td class="textright">
64
+ <strong>All Fields Name</strong>
65
+ </td>
66
+ <td>
67
+ <input name="[+slug_prefix+]_options[all_fields]" id="[+slug_prefix+]_options_all_fields" type="text" size="20" maxlength="20"value="[+all_fields+]" />
68
+ <div class="mla-settings-help">&nbsp;&nbsp;Enter the name that signifies a search of all custom fields.</div>
69
+ </td>
70
+ </tr>
71
+ <tr valign="top">
72
+ <td class="textright">
73
+ <input name="[+slug_prefix+]_options[all_fields_support]" id="[+slug_prefix+]_options_all_fields_support" type="checkbox" [+all_fields_support_checked+] value="1" />
74
+ </td>
75
+ <td>
76
+ &nbsp;<strong>Enable All Fields name substitution</strong>
77
+ <div class="mla-settings-help">&nbsp;&nbsp;Check this option to use the above name for an "All Fields" search.</div>
78
+ </td>
79
+ </tr>
80
+
81
+
82
+ <!-- template="general-tab" -->
83
+ <style type='text/css'>
84
+ .mla-settings-help {
85
+ font-size: 8pt;
86
+ padding-bottom: 5px
87
+ }
88
+
89
+ .mla-page-level-options-form {
90
+ margin-left: 0px;
91
+ margin-top: 10px;
92
+ padding-bottom: 10px;
93
+ border-bottom:thin solid #888888;
94
+ }
95
+
96
+ span.submit.mla-settings-submit,
97
+ p.submit.mla-settings-submit {
98
+ padding-bottom: 0px
99
+ }
100
+ </style>
101
+ <h2>Plugin Options</h2>
102
+ <p>There are no General option settings in this version of the plugin.</p>
103
+ <p>You can find more information about using all of the features of this plugin in the Documentation tab on this page.</p>
104
+ <div class="mla-page-level-options-form" style="display:none">
105
+ <form action="[+form_url+]" method="post" class="mla-display-settings-page" id="[+slug_prefix+]_options_general_tab">
106
+ <table class="optiontable">
107
+ <tbody>
108
+ [+options_list+]
109
+ </tbody>
110
+ </table>
111
+ <span class="submit mla-settings-submit">
112
+ <input name="[+slug_prefix+]_options_save" class="button-primary" id="[+slug_prefix+]_options_save" type="submit" value="Save Changes" />
113
+ <input name="[+slug_prefix+]_options_reset" class="button-primary alignright" id="[+slug_prefix+]_options_reset" type="submit" value="Delete Settings, Restore Defaults" />
114
+ </span>
115
+ [+_wpnonce+]
116
+ </form>
117
+ </div>
118
+
119
+ <!-- template="documentation-tab" -->
120
+ <style type='text/css'>
121
+ .mla-doc-toc-list {
122
+ list-style-position:inside;
123
+ list-style:disc;
124
+ line-height: 15px;
125
+ padding-left: 20px
126
+ }
127
+
128
+ .mla-doc-hook-label {
129
+ text-align: right;
130
+ padding: 0 1em 2em 0;
131
+ vertical-align: top;
132
+ font-weight:bold
133
+ }
134
+
135
+ .mla-doc-hook-definition {
136
+ vertical-align: top;
137
+ }
138
+
139
+ .mla-doc-table-label {
140
+ text-align: right;
141
+ padding-right: 10px;
142
+ vertical-align: top;
143
+ font-weight:bold
144
+ }
145
+
146
+ .mla-doc-table-sublabel {
147
+ padding-right: 10px;
148
+ vertical-align: top
149
+ }
150
+
151
+ .mla-doc-table-reverse {
152
+ text-align: right;
153
+ padding-right: 10px;
154
+ vertical-align:top
155
+ }
156
+
157
+ .mla-doc-table-definition {
158
+ vertical-align: top;
159
+ }
160
+
161
+ .mla-doc-bold-link {
162
+ font-size:14px;
163
+ font-weight:bold
164
+ }
165
+ </style>
166
+ <h2>Plugin Documentation</h2>
167
+ <p>In this tab, jump to:</p>
168
+ <div class="mla-display-settings-page" id="[+slug_prefix+]_options_documentation_tab" style="width:700px">
169
+ <ul class="mla-doc-toc-list">
170
+ <li><a href="#introduction"><strong>Introduction</strong></a></li>
171
+ <li><a href="#processing"><strong>How the Plugin Works</strong></a></li>
172
+ <li><a href="#use_filters"><strong>use_filters, for [mla_term_list]</strong></a></li>
173
+ <li><a href="#add_filters_to"><strong>add_filters_to, for [mla_gallery]</strong></a></li>
174
+ <li><a href="#default_empty_gallery"><strong>default_empty_gallery, for [mla_gallery]</strong></a></li>
175
+ <li><a href="#muie_terms_search"><strong>The [muie_terms_search] shortcode</strong></a></li>
176
+ <li><a href="#muie_keyword_search"><strong>The [muie_keyword_search] shortcode</strong></a></li>
177
+ <li><a href="#muie_orderby"><strong>The [muie_orderby] and [muie_order] shortcodes</strong></a></li>
178
+ <li><a href="#muie_per_page"><strong>The [muie_per_page] shortcode</strong></a></li>
179
+ <li><a href="#muie_assigned_items_count"><strong>The [muie_assigned_items_count] shortcode</strong></a></li>
180
+ <li><a href="#muie_text_box"><strong>The [muie_text_box] shortcode</strong></a></li>
181
+ <li><a href="#muie_archive_list"><strong>The [muie_archive_list] shortcode</strong></a></li>
182
+ <li style="list-style-type:none"><ul class="mla-doc-toc-list">
183
+ <li><a href="#archive_type">Archive Type</a></li>
184
+ <li><a href="#archive_source">Archive Source</a></li>
185
+ <li><a href="#archive_list_output_formats">Archive List Output Formats</a></li>
186
+ <li><a href="#archive_list_display_content">Archive List Display Content</a></li>
187
+ <li><a href="#archive_list_link">Archive List Item Link Values (Array, Flat and List)</a></li>
188
+ <li><a href="#archive_list_other">Archive List Other Parameters</a></li>
189
+ <li><a href="#archive_list_data_selection">Archive List Data Selection Parameters</a></li>
190
+ <li><a href="#archive_list_substitution">Archive List Substitution Parameters</a></li>
191
+ </ul></li>
192
+ <li><a href="#filters_examples"><strong>use_filters/add_filters_to Examples</strong></a></li>
193
+ <li><a href="#sticky_examples"><strong>Sticky shortcodes Examples</strong></a></li>
194
+ <li><a href="#muie_archive_list_examples"><strong>Archive List shortcode Examples</strong></a></li>
195
+ <li><a href="#debugging"><strong>Debugging and Troubleshooting</strong></a></li>
196
+ </ul>
197
+ <p>
198
+ &nbsp;
199
+ <a name="introduction"></a>
200
+ </p>
201
+ <p>
202
+ <a href="#backtotop">Go to Top</a>
203
+ </p>
204
+ <h3>Introduction</h3>
205
+ <p>
206
+ This example plugin provides shortcodes to improve user experience for [mla_term_list], [mla_tag_cloud] and [mla_gallery] shortcodes. It also provides a number of additional shortcodes to implement "sticky" versions of search, sort and per-page controls for filtering an [mla_gallery] display as well as the [muie_archive_list] shortcode for date-based filtering.
207
+ </p>
208
+ <p>
209
+ You can find detailed information and examples of these features in the sections below. Briefly:
210
+ </p>
211
+ <ul class="mla-doc-toc-list">
212
+ <li>If you add "use_filters=true" to an [mla_term_list] shortcode this plugin will retain the selected terms when the page is refreshed and pass them back into the shortcode.</li>
213
+ <li>If you add "add_filters_to=any" to an [mla_gallery] shortcode this plugin will retain settings for terms search, keyword search, taxonomy queries and posts_per_page when the page is refreshed or pagination moves to a new page.</li>
214
+ <li>If you add "add_filters_to=<taxonomy_slug>" to an [mla_gallery] shortcode this plugin will do the actions in 2. and will also match the taxonomy_slug to a simple taxonomy query (if present) and add that query to the taxonomy queries. If the simple query is "muie-no-terms", it will be ignored.</li>
215
+ <li>If you add "default_empty_gallery=true" an [mla_gallery] shortcode the initial gallery display will show no items, until a selection is made from the other controls.</li>
216
+ <li>Shortcodes are provided to generate text box controls and retain their settings when the page is refreshed or pagination moves to a new page:</li>
217
+ <li style="list-style-type:none"><ul class="mla-doc-toc-list">
218
+ <li>[muie_terms_search] generates a terms search text box</li>
219
+ <li>[muie_keyword_search] generates a keyword search text box</li>
220
+ <li>[muie_orderby] generates an order by dropdown control</li>
221
+ <li>[muie_order] generates ascending/descending radio buttons</li>
222
+ <li>[muie_per_page] generates an items per page text box</li>
223
+ <li>[muie_assigned_items_count] returns the number of items assigned to any term(s) in the selected taxonomy</li>
224
+ <li>[muie_text_box] generates a text box with a "sticky" value that survives page refresh and pagination</li>
225
+ </ul></li>
226
+ <li>The [muie_archive_list] shortcode lets you construct lists and controls for filtering a gallery on the values of date variables in the items' post row or a custom field.</li>
227
+ </ul>
228
+ <p>
229
+ With a bit of work you can add a tag cloud that works with these filters. Here's an example you can adapt for your application:
230
+ </p>
231
+ <code>
232
+ &nbsp;&nbsp;&nbsp;&nbsp;&lt;style type='text/css'>
233
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;#mla-tag-cloud .mla_current_item {
234
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;color:#FF0000;
235
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font-weight:bold}
236
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/style>
237
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;span id=mla-tag-cloud>
238
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;strong>Tag Cloud&lt;/strong>
239
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;[mla_tag_cloud]
240
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;taxonomy=attachment_tag
241
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;current_item="{+request:current_item+}"
242
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;mla_link_href="{+currentlink_url+}&tax_input{{+query:taxonomy+}}{}={+slug+}&muie_per_page={+template:({+request:muie_per_page+}|5)+}" link_class="{+current_item_class+}"
243
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;[/mla_tag_cloud]
244
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span>
245
+ </code>
246
+ <p>
247
+ This example plugin uses three of the many filters available in the [mla_gallery] and [muie_archive_list] shortcodes and illustrates some of the techniques you can use to customize the gallery display and archive list controls.
248
+ <a name="processing"></a>
249
+ </p>
250
+ <p>
251
+ <a href="#backtotop">Go to Top</a>
252
+ </p>
253
+ <h3>How the Plugin Works</h3>
254
+ <p>
255
+ The example plugin makes no changes or additions to the MLA core code; it hooks some of the actions and filters MLA provides. The plugin works by detecting the presence of its parameters (use_filters, add_filters_to, archive_parameter_name) in the [mla_term_list] or [mla_gallery] parameter list. The added shortcodes this plugin provides use the standard WordPress <code>add_shortcode()</code> function. They add controls to the post/page, typically in an HTML form, that supply parameters to [mla_gallery].
256
+ </p>
257
+ <p>
258
+ The "sticky" shortcodes work in two ways. First, when the page is refreshed they look for a query argument or form data value corredponding to their name and if they find it they use the incoming value to initialize their new value. Second, they participate in the generation of <code>[mla_gallery]</code> pagination links, adding their current values to a <code>muie_filters</code> array, JSON encoding the array and adding it as a query argument to each pagination URL. When a pagination URL is returned from the browser the <code>muie_filters</code> array is decoded and its elements added to the <code>$_REQUEST</code> array.
259
+ <a name="use_filters"></a>
260
+ </p>
261
+ <p>
262
+ <a href="#backtotop">Go to Top</a>
263
+ </p>
264
+ <h3>use_filters, for [mla_term_list]</h3>
265
+ <p>
266
+ If you add "use_filters=true" to an <code>[mla_term_list]</code> shortcode this plugin will retain the selected terms when the page is refreshed and pass them back into the shortcode.
267
+ </p>
268
+ <p>
269
+ For gallery pagination links, the term list parameters (e.g., "tax_input") are recovered from the "muie_filters" query attribute and restored to the <code>$_REQUEST</code> array so the <code>[mla_gallery]</code> shortcodes can access them.
270
+ </p>
271
+ <p>
272
+ If the <code>$_REQUEST['tax_input']</code> element is present the selected terms are added to the <code>[mla_term_list]</code> shortcode parameters so the list output reflects them. They can also be accessed in an <code>[mla_gallery]</code> shortcode with the `request:` substitution parameter prefix.
273
+ </p>
274
+ <p>
275
+ If you are not getting the results you expect carefully inspecting the results of parsing the specification and generating the query can be a valuable exercise. You can add the <code>muie_debug=true</code> or <code>muie_debug=log</code> parameters to the <code>[mla_gallery]</code> shortcode, run a test and inspect the log file or the screen messages for more information about what's going on.
276
+ <a name="add_filters_to"></a>
277
+ </p>
278
+ <p>
279
+ <a href="#backtotop">Go to Top</a>
280
+ </p>
281
+ <h3>add_filters_to, for [mla_gallery]</h3>
282
+ <p>
283
+ If you add "add_filters_to=any" to an [mla_gallery] shortcode this plugin will retain settings for terms search, keyword search, taxonomy queries and posts_per_page when the page is refreshed or pagination moves to a new page.
284
+ </p>
285
+ <p>
286
+ If you add "add_filters_to=<taxonomy_slug>" to an [mla_gallery] shortcode this plugin will do the actions in 2. and will also match the taxonomy_slug to a simple taxonomy query (if present) and add that query to the taxonomy queries. If the simple query is "muie-no-terms", it will be ignored.
287
+ </p>
288
+ <p>
289
+ &nbsp;
290
+ <a name="default_empty_gallery"></a>
291
+ </p>
292
+ <p>
293
+ <a href="#backtotop">Go to Top</a>
294
+ </p>
295
+ <h3>default_empty_gallery, for [mla_gallery]</h3>
296
+ <p>
297
+ If you add "default_empty_gallery=true" an [mla_gallery] shortcode the initial gallery display will show no items, until a selection is made from the other controls.
298
+ <a name="muie_terms_search"></a>
299
+ </p>
300
+ <p>
301
+ <a href="#backtotop">Go to Top</a>
302
+ </p>
303
+ <h3>The [muie_terms_search] shortcode</h3>
304
+ <p>
305
+ The <code>[muie_terms_search]</code> shortcode generates a text box for passing the "mla_terms_phrases" parameter to an <code>[mla_gallery]</code> shortcode. You can add parameters to this shortcode to pass the other terms search parameters as well:
306
+ </p>
307
+ <ul class="mla-doc-toc-list">
308
+ <li>mla_terms_taxonomies</li>
309
+ <li>mla_phrase_delimiter</li>
310
+ <li>mla_term_delimiter</li>
311
+ <li>mla_phrase_connector</li>
312
+ <li>mla_term_delimiter</li>
313
+ <li>mla_term_connector</li>
314
+ </ul>
315
+ <p>
316
+ The shortcode is meant to be placed in an HTML form that lets the user enter criteria to filter a gallery display.
317
+ <a name="muie_keyword_search"></a>
318
+ </p>
319
+ <p>
320
+ <a href="#backtotop">Go to Top</a>
321
+ </p>
322
+ <h3>The [muie_keyword_search] shortcode</h3>
323
+ <p>
324
+ The <code>[muie_terms_search]</code> shortcode generates a text box for passing the "s" parameter to an <code>[mla_gallery]</code> shortcode. You can add parameters to this shortcode to pass the other keyword search parameters as well:
325
+ </p>
326
+ <ul class="mla-doc-toc-list">
327
+ <li>mla_search_fields</li>
328
+ <li>mla_search_connector</li>
329
+ <li>mla_term_delimiter</li>
330
+ <li>sentence</li>
331
+ <li>exact</li>
332
+ </ul>
333
+ <p>
334
+ The shortcode is meant to be placed in an HTML form that lets the user enter criteria to filter a gallery display.
335
+ <a name="muie_orderby"></a>
336
+ </p>
337
+ <p>
338
+ <a href="#backtotop">Go to Top</a>
339
+ </p>
340
+ <h3>The [muie_orderby] and [muie_order] shortcodes</h3>
341
+ <p>
342
+ The <code>[muie_orderby]</code> shortcode generates a dropdown control for passing the "orderby" parameter to an <code>[mla_gallery]</code>, <code>[mla_tag_cloud]</code>, or <code>[mla_term_list]</code> shortcode. You can add parameters to this shortcode to change the default value:
343
+ </p>
344
+ <ul class="mla-doc-toc-list">
345
+ <li>shortcode - mla_gallery, mla_tag_cloud, or mla_term_list</li>
346
+ <li>sort_fields</li>
347
+ <li>meta_value_num</li>
348
+ <li>meta_value</li>
349
+ </ul>
350
+ <p>
351
+ The <code>[muie_order]</code> shortcode generates a radio button control for passing the "order" parameter to an <code>[mla_gallery]</code>, <code>[mla_tag_cloud]</code>, or <code>[mla_term_list]</code> shortcode. You can add parameters to this shortcode to change the default value:
352
+ </p>
353
+ <ul class="mla-doc-toc-list">
354
+ <li>default_order - ASC or DESC</li>
355
+ <li>asc_label</li>
356
+ <li>desc_label</li>
357
+ </ul>
358
+ <p>
359
+ The shortcodes are meant to be placed in an HTML form that lets the user enter criteria to filter a gallery display.
360
+ <a name="muie_per_page"></a>
361
+ </p>
362
+ <p>
363
+ <a href="#backtotop">Go to Top</a>
364
+ </p>
365
+ <h3>The [muie_per_page] shortcode</h3>
366
+ <p>
367
+ The <code>[muie_per_page]</code> shortcode generates a text box for passing the "posts_per_page" parameter to an <code>[mla_gallery]</code> shortcode. You can add parameters to this shortcode to change the default value:
368
+ </p>
369
+ <ul class="mla-doc-toc-list">
370
+ <li>posts_per_page</li>
371
+ <li>numberposts</li>
372
+ </ul>
373
+ <p>
374
+ The shortcode is meant to be placed in an HTML form that lets the user enter criteria to filter a gallery display.
375
+ <a name="muie_assigned_items_count"></a>
376
+ </p>
377
+ <p>
378
+ <a href="#backtotop">Go to Top</a>
379
+ </p>
380
+ <h3>The [muie_assigned_items_count] shortcode</h3>
381
+ <p>
382
+ The <code>[muie_assigned_items_count]</code> shortcode returns the number of items assigned to any term(s) in the selected taxonomy. You can add parameters to this shortcode to change the default value:
383
+ </p>
384
+ <ul class="mla-doc-toc-list">
385
+ <li>taxonomy - required; taxonomy slug.</li>
386
+ <li>post_type</li>
387
+ <li>post_status</li>
388
+ <li>post_mime_type</li>
389
+ </ul>
390
+ <p>
391
+ &nbsp;
392
+ <a name="muie_text_box"></a>
393
+ </p>
394
+ <p>
395
+ <a href="#backtotop">Go to Top</a>
396
+ </p>
397
+ <h3>The [muie_text_box] shortcode</h3>
398
+ <p>
399
+ The <code>[muie_text_box]</code> shortcode generates a general purpose text box for passing a value to an <code>[mla_gallery]</code> shortcode. The value is "sticky"; it will survive page refreshes and pagination. You can add parameters to this shortcode to change the default values:
400
+ </p>
401
+ <ul class="mla-doc-toc-list">
402
+ <li>name</li>
403
+ <li>id</li>
404
+ <li>type</li>
405
+ <li>value</li>
406
+ </ul>
407
+ <p>
408
+ The shortcode is meant to be placed in an HTML form that lets the user enter criteria to filter a gallery display.
409
+ <a name="muie_archive_list"></a>
410
+ </p>
411
+ <p>
412
+ <a href="#backtotop">Go to Top</a>
413
+ </p>
414
+ <h3>The [muie_archive_list] shortcode</h3>
415
+ <p>
416
+ The [muie_archive_list] shortcode function displays date-oriented values in a variety of formats; flat text, link lists, dropdown controls and "pagination"-like links. The archive list works with year, month, week and day values. MLA Archive List enhancements for lists and controls include:
417
+ </p>
418
+ <ul class="mla-doc-toc-list">
419
+ <li>Several display formats, including "flat", "list" and "dropdown".</li>
420
+ <li>Access to a wide range of content using the term-specific and Field-level Substitution parameters. A powerful Content Template facility lets you assemble content from multiple sources and vary the results depending on which data elements contain non-empty values for a given value.</li>
421
+ <li>Display Style and Display Content parameters for easy customization of the list display and the destination/value behind each value.
422
+ </li>
423
+ </ul>
424
+ <p>
425
+ The <code>[muie_archive_list]</code> shortcode has many parameters and some of them have a complex syntax; it can be a challenge to build a correct shortcode. The WordPress Shortcode API has a number of limitations that make techniques such as entering HTML or splitting shortcode parameters across multiple lines difficult. Read and follow the rules and guidelines in the MLA "Entering Long/Complex Shortcodes" Documentation section to get the results you want.
426
+ </p>
427
+ <p>
428
+ The next Documentation sections are a complete reference for the shortcode. Don't be put off by the volume of material; you won't need most of the parameters for typical applications. You may want to start by reviewing the <a href="#muie_archive_list_examples">Archive List shortcode Examples</a> to see how easy using the shortcode can be.
429
+ </p>
430
+ <p>
431
+ Many of the <code>[muie_archive_list]</code> concepts and shortcode parameters are modeled after the <code>[mla_gallery]</code> and <code>[mla_tag_cloud]</code> shortcodes, so the learning curve is shorter. Differences and parameters unique to the shortcode are given in the sections below.
432
+ </p>
433
+ <a name="archive_type"></a>
434
+ </p>
435
+ <h4>Archive Type</h4>
436
+ <p>
437
+ List values have a prefix denoting the level of detail they contain followed by a numeric value. The <strong>"archive_type"</strong> parameter determines the level of detail for the list values:
438
+ </p>
439
+ <table>
440
+ <tr>
441
+ <td class="mla-doc-table-label">daily</td>
442
+ <td>four-digit year, two-digit month and two-digit day, e.g. <strong>"D20210615"</strong>.</td>
443
+ </tr>
444
+ <tr>
445
+ <td class="mla-doc-table-label">weekly</td>
446
+ <td>four-digit year and two-digit week, e.g. <strong>"W202123"</strong>.</td>
447
+ </tr>
448
+ <tr>
449
+ <td class="mla-doc-table-label">monthly</td>
450
+ <td>four-digit year and two-digit month, e.g. <strong>"M202106"</strong>.</td>
451
+ </tr>
452
+ <tr>
453
+ <td class="mla-doc-table-label">yearly</td>
454
+ <td>four-digit year, e.g. <strong>"Y2021"</strong>. <strong>"yearly" is the default archive type value.</strong></td>
455
+ </tr>
456
+ </table>
457
+ <p>
458
+ These values will automatically be translated to the appropriate parameter values for the `[mla_gallery]` shortcode.
459
+ <a name="archive_source"></a>
460
+ </p>
461
+ <h4>Archive Source</h4>
462
+ <p>
463
+ The data source for an archive must be a text database field that contains a valid date format. The <strong>"archive_source"</strong> parameter determines the source for the list values:
464
+ </p>
465
+ <table>
466
+ <tr>
467
+ <td class="mla-doc-table-label">post_date</td>
468
+ <td>the post_date value in the wp_posts table. <strong>"post_date" is the default archive source value.</strong></td>
469
+ </tr>
470
+ <tr>
471
+ <td class="mla-doc-table-label">post_date_gmt</td>
472
+ <td>the post_date_gmt value in the wp_posts table.</td>
473
+ </tr>
474
+ <tr>
475
+ <td class="mla-doc-table-label">post_modified</td>
476
+ <td>the post_modified value in the wp_posts table.</td>
477
+ </tr>
478
+ <tr>
479
+ <td class="mla-doc-table-label">post_modified_gmt</td>
480
+ <td>the post_modified_gmt value in the wp_posts table.</td>
481
+ </tr>
482
+ <tr>
483
+ <td class="mla-doc-table-label">custom</td>
484
+ <td>a custom field value. The custom field must contain a text value with a date format recognized by the database SQL date query functions.</td>
485
+ </tr>
486
+ <tr>
487
+ <td class="mla-doc-table-label">archive_key</td>
488
+ <td>for the "custom" archive source, the name of the custom field to be used for the query.</td>
489
+ </tr>
490
+ </table>
491
+ <p>
492
+ The four values from the wp_posts table are in a valid date format. For custom fields, a vairety of common formats are acceptable. For example, you can use a mapping rule to source the custom field from:
493
+ </p>
494
+ <table>
495
+ <tr>
496
+ <td class="mla-doc-table-label">exif:DateTimeOriginal</td>
497
+ <td>YYYY:MM:DD HH:MM:SS</td>
498
+ </tr>
499
+ <tr>
500
+ <td class="mla-doc-table-label">iptc:DateCreated</td>
501
+ <td>YYYYMMDD</td>
502
+ </tr>
503
+ <tr>
504
+ <td class="mla-doc-table-label">xmp:CreateDate</td>
505
+ <td>YYYY-MM-DD HH:MM:SS two digit month and day, 24-hour clock</td>
506
+ </tr>
507
+ </table>
508
+ <p>
509
+ You can use the timestamp and date field-level option/format values to convert many other formats to one of the valid formats illustrated above.
510
+ <a name="archive_list_output_formats"></a>
511
+ </p>
512
+ <h4>Archive List Output Formats</h4>
513
+ <p>
514
+ The default archive list output is a dropdown control with options for each archive value. The output markup and display format are determined by the <strong>"archive_output"</strong> parameter:
515
+ </p>
516
+ <table>
517
+ <tr>
518
+ <td class="mla-doc-table-label">dropdown</td>
519
+ <td>Returns an HTML "select" control with a sequence of HTML "option" tags. <strong>"dropdown" is the default output format value.</strong></td>
520
+ </tr>
521
+ <tr>
522
+ <td class="mla-doc-table-label">list</td>
523
+ <td>Returns hyperlinks enclosed by one of the HTML list tags; unordered (<strong>&lt;ul&gt;&lt;/ul&gt;, the default tag value</strong>) or ordered (&lt;ol&gt;&lt;/ol&gt;).</td>
524
+ </tr>
525
+ <tr>
526
+ <td class="mla-doc-table-label">flat</td>
527
+ <td>Returns a sequence of hyperlink tags without further HTML markup. The "separator" parameter content (default, one newline character) is inserted between each hyperlink.</td>
528
+ </tr>
529
+ <tr>
530
+ <td class="mla-doc-table-label">array</td>
531
+ <td>Returns a PHP array of list hyperlinks. This output format is not available through the shortcode; it is allowed when the <code>MLAShortcodes::muie_archive_list()</code> function is called directly from your theme or plugin PHP code.</td>
532
+ </tr>
533
+ <tr>
534
+ <tr>
535
+ <td class="mla-doc-table-label">next_archive</td>
536
+ <td>returns a link to the next archive value. The optional ",wrap" or ",always_wrap" qualifier determines what happens at the last value. If you omit the qualifier, an empty string is returned for the "next_archive" from the last value. If you code the ",wrap" or ",always_wrap" qualifier, the "next_archive" from the last value will be to the first value.</td>
537
+ </tr>
538
+ <tr>
539
+ <td class="mla-doc-table-label">current_archive</td>
540
+ <td>returns a link to the current archive value. This gives you an easy way to provide a visual indication of where you are within the list. The "span" and "none" link formats are often used with this archive_output type.</td>
541
+ </tr>
542
+ <tr>
543
+ <td class="mla-doc-table-label">previous_archive</td>
544
+ <td>returns a link to the previous archive value. The optional ",wrap" or ",always_wrap" qualifier determines what happens at the first value. If you omit the qualifier, an empty string is returned for the "previous_archive" from the first value. If you code the ",wrap" or ",always_wrap" qualifier, "previous_archive" from the first value will be to the last value.</td>
545
+ </tr>
546
+ <td class="mla-doc-table-label">paginate_archive</td>
547
+ <td>returns a link to values at the start and end of the list and to pages around the current value ( e.g.: « Previous 1995 ... 2000 2001 2002 2003 2004 ... 2021 Next » ). The optional ",show_all" qualifier will show all of the values instead of a short list around the current value. The optional ",prev_next" qualifier will include the "« Previous" and "Next »" portions of the link list.</td>
548
+ </tr>
549
+ </table>
550
+ <p>
551
+ The "next_archive", "current_archive" and "previous_archive" return an empty string if there is no current value, i.e., if no <code>muie_current_archive</code> value is set in the shortcode parameters or in the URL query attributes. If you code the "option_none_label" parameter its value will be displayed when there is no current value. If you add the ",always_wrap" qualifier the "next_archive" and "previous_archive" will <strong>always</strong> return the last/first value in the archive list if there is one.
552
+ <h4>Specific parameters for the <code>paginate_archive</code> output type</h4>
553
+ <table>
554
+ <tr>
555
+ <td class="mla-doc-table-label">end_size</td>
556
+ <td>How many numbers (default 1) appear on either the start and the end list edges</td>
557
+ </tr>
558
+ <tr>
559
+ <td class="mla-doc-table-label">mid_size</td>
560
+ <td>How many numbers (default 1) appear to either side of current item, but not including current item</td>
561
+ </tr>
562
+ <tr>
563
+ <td class="mla-doc-table-label">prev_text</td>
564
+ <td>the "previous page" text (default "&laquo; Previous") , which appears when the ",prev_next" qualifier is added to the output_type</td>
565
+ </tr>
566
+ <tr>
567
+ <td class="mla-doc-table-label">next_text</td>
568
+ <td>the "next page" text (default "Next &raquo;") , which appears when the ",prev_next" qualifier is added to the output_type</td>
569
+ </tr>
570
+ </table>
571
+ <p>If you code the "<strong>,show_all</strong>" qualifier, the above parameters have no effect. The "<strong>,show_all</strong>" qualifer is basically the same as "flat" output with short labels.
572
+ <a name="archive_list_display_content"></a>
573
+ </p>
574
+ <h4>Archive List Display Content</h4>
575
+ <p>
576
+ For the "dropdown" archive_output type, the list comprises a select tag (&lt;select&gt;&lt;/select&gt;) enclosing a list of option (&lt;option&gt;&lt;/option&gt;) tags. For the "list" archive_output type, the list comprises an unordered list tag (&lt;ul&gt;&lt;/ul&gt;) enclosing a list of item (&lt;li&gt;&lt;/li&gt;) tags. The following parameters customize the overall type and content of the control/list:
577
+ </p>
578
+ <table>
579
+ <tr>
580
+ <td class="mla-doc-table-label">muie_current_archive</td>
581
+ <td>Identifies the current/selected value in the list. It will be ignored if it does not match an item in the list.</td>
582
+ </tr>
583
+ <tr>
584
+ <td class="mla-doc-table-label">archive_parameter_name</td>
585
+ <td>The name of the parameter containing the current item value; <strong>default "muie_current_archive"</strong>. You can change the name if you need multiple controls/lists on one post/page.</td>
586
+ </tr>
587
+ <tr>
588
+ <td class="mla-doc-table-label">archive_order</td>
589
+ <td>Selects the order in which values are displayed. Use <strong>"DESC" (the default value)</strong> to display the newest value first, or "ASC" to display the oldest value first.</td>
590
+ </tr>
591
+ <tr>
592
+ <td class="mla-doc-table-label">archive_limit</td>
593
+ <td>Sets the maximum number of values to be displayed. Use <strong>"0" (zero, the default value)</strong> to display all of the values. Use a positive number to limit the values.</td>
594
+ </tr>
595
+ <tr>
596
+ <td class="mla-doc-table-label">archive_label</td>
597
+ <td>Selects the length of the text displayed for each value. Use "short" for short labels, e.g., "Sep 2021". Use "long" for more complete labels, e.g., "September 2021". <strong>The default value for the "paginate_archive" archive_output is "short". All other output types default to "long".</strong> </td>
598
+ </tr>
599
+ <tr>
600
+ <td class="mla-doc-table-label">show_count</td>
601
+ <td>Selects the option to display the number of items assigned to each archive value.Use <strong>"true" (the default value)</strong> to display the count. Use "false" to omit the count.</td>
602
+ </tr>
603
+ <tr>
604
+ <td class="mla-doc-table-label">hide_if_empty</td>
605
+ <td>If <strong>false (default)</strong>, display a control with "option_none_label" text &amp; "option_none_value" value. If true, display "option_none_label" as plain text or nothing.</td>
606
+ </tr>
607
+ </table>
608
+ <p>
609
+ The following parameters customize overall control/list content and markup for the "dropdown" and "list" archive_output types:
610
+ </p>
611
+ <table>
612
+ <tr>
613
+ <td class="mla-doc-table-label">listtag</td>
614
+ <td>The HTML tag that encloses the list of archive values. For the <strong>"dropdown" archive_output type, the default is "select"</strong>. For the <strong>"list" archive_output type, the default is "ul"</strong>.</td>
615
+ </tr>
616
+ <tr>
617
+ <td class="mla-doc-table-label">listtag_name</td>
618
+ <td>For the "dropdown" archive_output type, the "name" attribute of HTML tag that begins the list of archive values. <strong>The default is "muie_current_archive"</strong>.</td>
619
+ </tr>
620
+ <tr>
621
+ <td class="mla-doc-table-label">listtag_id</td>
622
+ <td>The "id" attribute of the HTML tag that begins the list of archive values; <strong>default "muie_archive_list-{$instance}"</strong>, where "{$instance}" is a number starting at "1" making the value unique.</td>
623
+ </tr>
624
+ <tr>
625
+ <td class="mla-doc-table-label">listtag_class</td>
626
+ <td>The "class" attribute of the HTML tag that begins the list of archive values; <strong>default "muie-archive-list"</strong>.</td>
627
+ </tr>
628
+ <tr>
629
+ <td class="mla-doc-table-label">listtag_attributes</td>
630
+ <td>Additional attribute(s) the HTML tag that begins the list of archive values; <strong>default empty, no value</strong>.</td>
631
+ </tr>
632
+ <tr>
633
+ <td class="mla-doc-table-label">itemtag</td>
634
+ <td>The HTML tag that encloses each value in the archive list. For the <strong>"dropdown" archive_output type, the default is "option"</strong>. For the <strong>"list" archive_output type, the default is "li"</strong>.</td>
635
+ </tr>
636
+ <tr>
637
+ <td class="mla-doc-table-label">current_archive_class</td>
638
+ <td>The class attribute for the current item in the archive list as determined by the "muie_current_archive" parameter (if specified); <strong>default "muie-current-archive"</strong>.</td>
639
+ </tr>
640
+ </table>
641
+ <p>
642
+ The following parameters customize the content of two special control/list item values:
643
+ </p>
644
+ <table>
645
+ <tr>
646
+ <td class="mla-doc-table-label">option_none_label</td>
647
+ <td>Text to display when there are no archive values in the list. If the "hide_if_empty=true" parameter is present this is displayed as plain text; <strong>default is empty, no value</strong>. If not, the option_none_label and option_none_value are used to generate an "empty" control or list; <strong>default "No archives"</strong>.</td>
648
+ </tr>
649
+ <tr>
650
+ <td class="mla-doc-table-label">option_none_value</td>
651
+ <td>Control value to use when there are no archive values in the list; <strong>default "no-archives"</strong>.</td>
652
+ </tr>
653
+ <tr>
654
+ <td class="mla-doc-table-label">option_all_label</td>
655
+ <td>Text to display for showing an "all values" option. Default will not show an option to select "all values". When this option is selected all items, regardless of their archive value, are included in the `[mla_gallery]` results.</td>
656
+ </tr>
657
+ <tr>
658
+ <td class="mla-doc-table-label">option_all_value</td>
659
+ <td>Control value for "all values" option. <strong>Default empty, no value</strong>. When this option is selected all items, regardless of their archive value, are included in the `[mla_gallery]` results. To display an empty gallery enter an invalid date value in the appropriate format.</td>
660
+ </tr>
661
+ </table>
662
+ <p>
663
+ The following parameters customize content and markup for each control/list item:
664
+ </p>
665
+ <table>
666
+ <tr>
667
+ <td class="mla-doc-table-label">itemtag_id</td>
668
+ <td>The id attribute for each item in the list; <strong>default empty, no value</strong>.</td>
669
+ </tr>
670
+ <tr>
671
+ <td class="mla-doc-table-label">itemtag_class</td>
672
+ <td>The class attribute(s) for each item in the list; <strong>default "muie-archive-list-item"</strong>.</td>
673
+ </tr>
674
+ <tr>
675
+ <td class="mla-doc-table-label">itemtag_attributes</td>
676
+ <td>Additional attribute for each item in the list; <strong>default empty, no value</strong>.</td>
677
+ </tr>
678
+ <tr>
679
+ <td class="mla-doc-table-label">itemtag_value</td>
680
+ <td>A custom format or content template for the item value; <strong>default determined by "archive_type"</strong>.</td>
681
+ </tr>
682
+ <tr>
683
+ <td class="mla-doc-table-label">itemtag_label</td>
684
+ <td>A custom format or content template for the item name/label; <strong>default determined by "archive_type"</strong>.</td>
685
+ </tr>
686
+ </table>
687
+ <p>
688
+ For the "list", "flat" and "array" archive_output types, each item in the list comprises an archive value and a hyperlink surrounding the value. The following parameters customize link content and markup:
689
+ </p>
690
+ <table>
691
+ <tr>
692
+ <td class="mla-doc-table-label">separator</td>
693
+ <td>The text/space between items. <strong>Default "\n"</strong> (newline whitespace)</td>
694
+ </tr>
695
+ <tr>
696
+ <td class="mla-doc-table-label">link</td>
697
+ <td>Chooses the destination of the item hyperlink; details in the next section below.</td>
698
+ </tr>
699
+ <tr>
700
+ <td class="mla-doc-table-label">link_id</td>
701
+ <td>The id attribute for each link in the list; <strong>default empty, no value</strong>.</td>
702
+ </tr>
703
+ <tr>
704
+ <td class="mla-doc-table-label">link_class</td>
705
+ <td>The class attribute for each link in the list; <strong>default empty, no value</strong>.</td>
706
+ </tr>
707
+ <tr>
708
+ <td class="mla-doc-table-label">rollover_text</td>
709
+ <td>The text for the "title" attribute (Rollover Text); <strong>default empty, no value</strong>.</td>
710
+ </tr>
711
+ <tr>
712
+ <td class="mla-doc-table-label">link_attributes</td>
713
+ <td>Additional attribute(s) for each link in the list; <strong>default empty, no value</strong>.</td>
714
+ </tr>
715
+ <tr>
716
+ <td class="mla-doc-table-label">link_text</td>
717
+ <td>The text surrounded by the hyperlink tags (&lt;a ... &gt;&lt;/a&gt;). The default text is an appropriate display format for each value.</td>
718
+ </tr>
719
+ <tr>
720
+ <td class="mla-doc-table-label">link_href</td>
721
+ <td>The href attribute of the hyperlink tags; <strong>default empty, no value</strong>. When present, this value replaces the <code>link=</code> values (current, view, span or none)</td>
722
+ </tr>
723
+ </table>
724
+ <p>
725
+ The item and link parameters are an easy way to customize the content and markup for each control/list item. They support the Archive List Substitution Parameters and Content Template substitution parameters. For example, if you code "<code>rollover_text='{+current_label+} ({+items+})'</code>, the rollover text will contain the item value's label followed by the number of items having that value in parentheses. Simply add "{+" before the substitution parameter name and add "+}" after the name. Note that the enclosing delimiters are different than those used in the templates, since the WordPress shortcode parser reserves square brackets ("[" and "]") for its own use.
726
+ </p>
727
+ <p>
728
+ The "link_href" parameter is a great way to change the destination your list item links to and/or add arguments to the link for later processing. For example, to make a gallery item link back to the current page/post you can code: <code>link_href='{+page_url+}'</code>. You can also add arguments to the link, e.g., <code>mla_link_href='{+page_url+}?firstarg=value1&amp;amp;myarg=myvalue'</code>. Note the use of the HTML entity name "&amp;amp;" to put an ampersand in the value; the WordPress "visual" post editor will replace "&amp;", "&lt;" and ">" with "&amp;amp;", "&amp;lt;" and "&amp;gt;" whether you like it not. The <strong>only</strong> markup parameters modified by this parameter are "link_url" and "thelink". The markup parameters "currentlink" and "viewlink" are not modified.
729
+ </p>
730
+ <p>
731
+ The "link_attributes" parameter accepts any value and adds it to the "&lt;a&gt;" or "&lt;span&gt;" tags for the item. For example, you can add an HTML "target" attribute to the hyperlink. If you code <code>link_attributes='target="_blank"'</code> the item will open in a new window or tab. You can also use "_self", "_parent", "_top" or the "<em>framename</em>" of a named frame. Note the use of single quotes around the parameter value and the double quotes within the parameter. <strong>IMPORTANT:</strong> since the shortcode parser reserves square brackets ("[" and "]") for its own use, <strong>you must substitute curly braces for square brackets</strong> if your attributes require brackets. If you must code a curly brace in your attribute value, preface it with <strong>two backslash characters</strong>, e.g., "\\{" or "\\}". If you code an attribute already present in the tag, your value will override the existing value.
732
+ <a name="archive_list_link"></a>
733
+ </p>
734
+ <h4>Archive List Item Link Values (Array, Flat and List)</h4>
735
+ <p>
736
+ The Link parameter specifies the target and type of link from the list item back to the current post/page, the item's archive page, edit page or other destination. You can also specify a non-hyperlink treatment for each item. These values only apply to the hyperlinks generated for the "array", "flat" and "list" output formats.
737
+ </p>
738
+ <table>
739
+ <tr>
740
+ <td class="mla-doc-table-label">current</td>
741
+ <td>Link back to the current post/page with a query argument, <code>muie_current_archive</code>, set to the archive_type value of the selected item. <strong>"current" is the default item link value.</strong></td>
742
+ </tr>
743
+ <tr>
744
+ <td class="mla-doc-table-label">view</td>
745
+ <td>Link to the term's "archive page". Support for archive pages, or "date archives", is theme-dependent. There is an introduction to tag archives in the WordPress Codex at the bottom of the <a href="http://codex.wordpress.org/Function_Reference/wp_tag_cloud#Creating_a_Tag_Archive" title="Codex Tag Archive Discussion" target="_blank"><code>wp_tag_cloud</code> Function Reference</a>.</td>
746
+ </tr>
747
+ <tr>
748
+ <td class="mla-doc-table-label" style="font-style:italic">(link_href)</td>
749
+ <td>Link to a custom destination, typically another post/page. If the "link_href" parameter is present the value of the "link" parameter is ignored. See the example later in this section for more details.</td>
750
+ </tr>
751
+ <tr>
752
+ <td class="mla-doc-table-label">span</td>
753
+ <td>Substitutes a <code>&lt;span&gt;&lt;/span&gt;</code> tag for the hyperlink tag. You can use the "link_id", "link_class" and "link_attributes" parameters to add attributes to the <code>&lt;span&gt;</code> tag. You can use the "link_text" parameter to customize the text within the span.</td>
754
+ </tr>
755
+ <tr>
756
+ <td class="mla-doc-table-label">none</td>
757
+ <td>Eliminates the hyperlink tag surrounding the item text. You can use the "mla_link_text" parameter to customize the contents.</td>
758
+ </tr>
759
+ </table>
760
+ <p>
761
+ Using the "link_href" parameter to completely replace the link destination URL is a common and useful choice. With this parameter you can use the archive list to select a value and then go to another post/page that uses that selection as part of an <code>[mla_gallery]</code> shortcode. The examples section illustrates this technique.
762
+ <a name="archive_list_other"></a>
763
+ </p>
764
+ <h4>Archive List Other Parameters</h4>
765
+ <table>
766
+ <tr>
767
+ <td class="mla-doc-table-label">muie_debug</td>
768
+ <td>controls debug log output; <strong>default empty; no value</strong>, "false", "log" or "true". See below for details.</td>
769
+ </tr>
770
+ <tr>
771
+ <td class="mla-doc-table-label">mla_debug</td>
772
+ <td>adds debug log output for "get attachments" database query; <strong>default "false"</strong> or "true". See below for details.</td>
773
+ </tr>
774
+ <tr>
775
+ <td class="mla-doc-table-label">echo</td>
776
+ <td>This does not apply to the shortcode; it is allowed when the <code>MLAShortcodes::muie_archive_list()</code> function is called directly from your theme or plugin PHP code. If <code>echo=false</code> content generated by the function is returned to the caller; <strong>false is the default value</strong>. If <code>echo=true</code> content is echoed to the browser and nothing is returned.</td>
777
+ </tr>
778
+ </table>
779
+ <p>
780
+ The "muie_debug" parameter controls the display of information about parameter processing and control/list output generation. If you leave this parameter out you can use the "MLA Reporting" value in the Settings/Media Library Assistant Debug Tab to activate logging by adding "0x8000" to the value, e.g., enter "0x8001" to log this category only.
781
+ </p>
782
+ <p>If you code <code>muie_debug=true</code> you will see a lot of information added to the post or page containing the list. Of course, this parameter should <strong><em>ONLY</em></strong> be used in a development/debugging environment; it's quite ugly.
783
+ </p>
784
+ <p>
785
+ If you code <code>muie_debug=log</code> all of the information will be written to the error log. You can use the MLA Debug Tab to view and download the information in the error log.
786
+ </p>
787
+ <p>
788
+ When <code>muie_debug=log</code> or <code>muie_debug=true</code> you can activate some database logging by adding the <code>mla_debug=true</code> paremeter. In this shortcode, <code>mla_debug</code> only accepts "true" or "false" and it goes to the destination set by the <code>muie_debug</code> parameter.
789
+ <a name="archive_list_data_selection"></a>
790
+ </p>
791
+ <h4>Archive List Data Selection Parameters</h4>
792
+ <p>
793
+ The Archive List shortcode displays only those date values to which one or more Media Library items are assigned. The Data Selection parameters provide a way to filter the list, e.g., specifying a taxonomy term or a particular MIME type.
794
+ </p>
795
+ <p>
796
+ The Archive List shortcode uses the same database query functions employed by the <code>[mla_gallery]</code> shortcode. All of the <code>[mla_gallery]</code> data selection parameters are available, including:
797
+ </p>
798
+ <ul class="mla-doc-toc-list">
799
+ <li>Include, Exclude</li>
800
+ <li>Post ID, "ids", Post Parent</li>
801
+ <li>Author, Author Name</li>
802
+ <li>Category Parameters</li>
803
+ <li>Tag Parameters</li>
804
+ <li>Simple Taxonomy Parameters</li>
805
+ <li>Compound Taxonomy Parameters, "tax_input"</li>
806
+ <li>Taxonomy Queries, the "tax_query"</li>
807
+ <li>Taxonomy term keyword(s) search</li>
808
+ <li>Post MIME Type</li>
809
+ <li>Post Type, Post Status</li>
810
+ <li>Simple Date Parameters</li>
811
+ <li>Date and Time Queries, the "date query"</li>
812
+ <li>Simple Custom Field Parameters</li>
813
+ <li>Custom Field Queries, the "meta_query"</li>
814
+ <li>Keyword(s) Search</li>
815
+ </ul>
816
+ <p>
817
+ If you do not code any data selection parameters, <code>post_parent=all</code> will be added so the default data selection parameters are:
818
+ </p>
819
+ <ul class="mla-doc-toc-list">
820
+ <li><code>post_parent=all</code></li>
821
+ <li><code>post_type=attachment</code></li>
822
+ <li><code>post_status=inherit</code></li>
823
+ <li><code>post_mime_type=image</code></li>
824
+ </ul>
825
+ <p>
826
+ The default parameters will select all of the image items in your Media Library, extract the date value you have chosen from each item and use the values to build the archive list. For example, if you simply code <code>[muie_archive_list]</code> with no parameters you will get a dropdown control with one option for each year in which one or more items was added to the Media Library.
827
+ <a name="archive_list_substitution"></a>
828
+ </p>
829
+ <h4>Archive List Substitution Parameters</h4>
830
+ <p>
831
+ Substitution parameters are a powerful way to add general and attachment-specific values to the list display. For example, if you code "<code>mla_link_href="{+page_url+}?muie_current_archive={+current_value+}&amp;current_name={+current_label,url+}"</code>, the hyperlinks behind each list term will contain the page URL, the current archive value and the value's label encoded in url format. There are many parameter names like `page_url` and `current_label` divided in several categories:
832
+ </p>
833
+ <table>
834
+ <tr>
835
+ <td class="mla-doc-table-label">Shortcode-specific</td>
836
+ <td>All of the shortcode arguments defined above are available as substitution parameters, as well as additional values from sources like query arguments and shortcode parameters. The "request:" and "query:" prefixes can be used in the list. A Content Template lets you compose a value from multiple substitution parameters and test for empty values, choose among two or more alternatives or suppress output entirely.</td>
837
+ </tr>
838
+ <tr>
839
+ <td class="mla-doc-table-label">List-specific</td>
840
+ <td>values that are known at the beginning of shortcode processing and remain the same for the entire shortcode, such as the ID and URL of the post/page in which the shortcode appears</td>
841
+ </tr>
842
+ <tr>
843
+ <td class="mla-doc-table-label">Item-specific</td>
844
+ <td style="vertical-align: top">values that change for each term/item in the list, such as Name and Description</td>
845
+ </tr>
846
+ </table>
847
+ <p>
848
+ The following paragraphs go into more detail about each category and the parameter names within them.
849
+ </p>
850
+ <p>
851
+ To use a substitution parameter in your shortcode, simply add "{+" before the substitution parameter name and add "+}" after the name. Note that the enclosing delimiters are different than those used in Style and Markup templates, since the WordPress shortcode parser reserves square brackets ("[" and "]") for its own use. Also, because square brackets are reserved, <strong>you must substitute curly braces for square brackets</strong> if your parameter values require them. For example, if your shortcode parameter is <code>mla_link_attributes='rel="shadowbox{sbalbum-{+instance+}};player=img"'</code>, the actual attribute added to the link will be <code>rel="shadowbox[sbalbum-1];player=img"</code>. If you must code a curly brace in a parameter value, preface it with <strong>two backslash characters</strong>, e.g., "\\{" or "\\}".
852
+ </p>
853
+ <p>
854
+ <strong>Shortcode-level substitution parameters</strong> are available throughout the gneration of the control/list:</p>
855
+ <table>
856
+ <tr>
857
+ <td class="mla-doc-table-label">shortcode arguments</td>
858
+ <td>All of the shortcode arguments defined above are available. If an argument has been set by a shortcode parameter its value will reflect that. If the shortcode parameter contains substitution parameters or a content template the argument will reflect the results of processing those elements. All arguments that do not appear as shortcode parameters will be set to their default values.</td>
859
+ </tr>
860
+ <tr>
861
+ <td class="mla-doc-table-label">request: prefix</td>
862
+ <td>The parameters defined in the <code>$_REQUEST</code> array; the "query strings" sent from the browser. The PHP $_REQUEST variable is a superglobal Array that contains the contents of both $_GET, $_POST and $_COOKIE arrays.</td>
863
+ </tr>
864
+ <tr>
865
+ <td class="mla-doc-table-label">query: prefix</td>
866
+ <td>The parameters defined in the <code>[muie_archive_list]</code> shortcode. For example, if your shortcode is <code>[muie_archive_list taxonomy=attachment_tag div-class=some_class]</code> you can access the parameters as <code>[+query:taxonomy+]</code> and <code>[+query:div-class+]</code> respectively. If the shortcode parameter contains substitution parameters or a content template the query: value will NOT reflect the results of processing those elements. You can define your own parameters, e.g., "div-class"; they will be accessible as shortcode-level data but will otherwise be ignored.</td>
867
+ </tr>
868
+ <tr>
869
+ <td class="mla-doc-table-label">template: prefix</td>
870
+ <td>A Content Template, which lets you compose a value from multiple substitution parameters and test for empty values, choosing among two or more alternatives or suppressing output entirely. See the "Content Templates" section of the Settings/Media Library Assistant Documentation tab for details. Note that the formatting option is not supported for content templates.</td>
871
+ </tr>
872
+ </table>
873
+ <p>
874
+ <strong>List-specific substitution parameters</strong> are known at the beginning of shortcode processing and they do not change during processing. They can be used, for example, in any of the data selection parameters to change the items selected for the list based on information about the post/page on which the list appears. The list-specific substitution parameters are:
875
+ </p>
876
+ <table>
877
+ <tr>
878
+ <td class="mla-doc-table-label">instance</td>
879
+ <td>starts at "1"', incremented for each additional shortcode in the post/page</td>
880
+ </tr>
881
+ <tr>
882
+ <td class="mla-doc-table-label">selector</td>
883
+ <td>"muie_archive_list-{$instance}", e.g., muie_archive_list-1</td>
884
+ </tr>
885
+ <tr>
886
+ <td class="mla-doc-table-label">site_url</td>
887
+ <td>absolute URL to the site directory, without trailing slash</td>
888
+ </tr>
889
+ <tr>
890
+ <td class="mla-doc-table-label">base_url</td>
891
+ <td>absolute URL to the upload directory, without trailing slash</td>
892
+ </tr>
893
+ <tr>
894
+ <td class="mla-doc-table-label">base_dir</td>
895
+ <td>absolute (full) path to the upload directory, without trailing slash</td>
896
+ </tr>
897
+ <tr>
898
+ <td class="mla-doc-table-label">page_ID,<br />id</td>
899
+ <td style="vertical-align: top">the <code>ID</code> value of the post/page in which the list appears</td>
900
+ </tr>
901
+ <tr>
902
+ <td class="mla-doc-table-label">page_author</td>
903
+ <td>the <code>post_author</code> value of the post/page in which the list appears</td>
904
+ </tr>
905
+ <tr>
906
+ <td class="mla-doc-table-label">page_date</td>
907
+ <td>the <code>post_date</code> value of the post/page in which the list appears</td>
908
+ </tr>
909
+ <tr>
910
+ <td class="mla-doc-table-label">page_content</td>
911
+ <td>the <code>post_content</code> value of the post/page in which the list appears</td>
912
+ </tr>
913
+ <tr>
914
+ <td class="mla-doc-table-label">page_title</td>
915
+ <td>the <code>post_title</code> value of the post/page in which the list appears</td>
916
+ </tr>
917
+ <tr>
918
+ <td class="mla-doc-table-label">page_excerpt</td>
919
+ <td>the <code>post_excerpt</code> value of the post/page in which the list appears</td>
920
+ </tr>
921
+ <tr>
922
+ <td class="mla-doc-table-label">page_status</td>
923
+ <td>the <code>post_status</code> value of the post/page in which the list appears</td>
924
+ </tr>
925
+ <tr>
926
+ <td class="mla-doc-table-label">page_name</td>
927
+ <td>the <code>post_name</code> value of the post/page in which the list appears</td>
928
+ </tr>
929
+ <tr>
930
+ <td class="mla-doc-table-label">page_modified</td>
931
+ <td>the <code>post_modified</code> value of the post/page in which the list appears</td>
932
+ </tr>
933
+ <tr>
934
+ <td class="mla-doc-table-label">page_guid</td>
935
+ <td>the <code>post_guid</code> value of the post/page in which the list appears</td>
936
+ </tr>
937
+ <tr>
938
+ <td class="mla-doc-table-label">page_type</td>
939
+ <td>the <code>post_type</code> value of the post/page in which the list appears</td>
940
+ </tr>
941
+ <tr>
942
+ <td class="mla-doc-table-label">page_url</td>
943
+ <td>absolute URL to the page or post on which the list appears, if any, with trailing slash</td>
944
+ </tr>
945
+ </table>
946
+ <p>
947
+ <strong>Item-specific substitution parameters</strong> are, well, specific to each item in the archive list. The list-specific substitution parameters are:
948
+ </p>
949
+ <table>
950
+ <tr>
951
+ <td class="mla-doc-table-label">current_value</td>
952
+ <td>the value of the item, e.g., "post_date,M(202011)" or "custom:CreateDate,M(202011)". When passed to <code>[mla_gallery[</code> this will be translated to the appropriate date query parameter(s).</td>
953
+ </tr>
954
+ <tr>
955
+ <td class="mla-doc-table-label">current_label_short</td>
956
+ <td>the short version of the item's label, e.g., "Nov 2020".</td>
957
+ </tr>
958
+ <tr>
959
+ <td class="mla-doc-table-label">current_label_long</td>
960
+ <td>the long version of the item's label, e.g., "November 2020".</td>
961
+ </tr>
962
+ <tr>
963
+ <td class="mla-doc-table-label">current_label</td>
964
+ <td>the selected version of the item's label, based on the archive_label parameter.</td>
965
+ </tr>
966
+ <tr>
967
+ <td class="mla-doc-table-label">items</td>
968
+ <td>the number of items that will be selected by this value.</td>
969
+ </tr>
970
+ <tr>
971
+ <td class="mla-doc-table-label">year</td>
972
+ <td>the four-digit year portion of the value, if present, else empty.</td>
973
+ </tr>
974
+ <tr>
975
+ <td class="mla-doc-table-label">month</td>
976
+ <td>the two-digit month portion of the value, if present, else empty.</td>
977
+ </tr>
978
+ <tr>
979
+ <td class="mla-doc-table-label">week</td>
980
+ <td>the two-digit week portion of the value, if present, else empty.</td>
981
+ </tr>
982
+ <tr>
983
+ <td class="mla-doc-table-label">day</td>
984
+ <td>the two-digit day portion of the value, if present, else empty.</td>
985
+ </tr>
986
+ <tr>
987
+ <td class="mla-doc-table-label">m</td>
988
+ <td>the six-digit year and month portion of the value, if present, else empty.</td>
989
+ </tr>
990
+ <tr>
991
+ <td class="mla-doc-table-label">yyyymmdd</td>
992
+ <td>for weekly archives, a random date within the week, formatted as "yyyy-mm-dd". Used to determine the start and end dates of the week.</td>
993
+ </tr>
994
+ <tr>
995
+ <td class="mla-doc-table-label">month_long</td>
996
+ <td>the long version of the value's month, e.g., "November".</td>
997
+ </tr>
998
+ <tr>
999
+ <td class="mla-doc-table-label">month_short</td>
1000
+ <td>the short version of the value's month, e.g., "Nov".</td>
1001
+ </tr>
1002
+ <tr>
1003
+ <td class="mla-doc-table-label">week_start_raw</td>
1004
+ <td>the timestamp version of the week's first day, e.g., "1605484800".</td>
1005
+ </tr>
1006
+ <tr>
1007
+ <td class="mla-doc-table-label">week_start_short</td>
1008
+ <td>the short version of the week's first day, e.g., "2020-11-16".</td>
1009
+ </tr>
1010
+ <tr>
1011
+ <td class="mla-doc-table-label">week_start</td>
1012
+ <td>the long version of the week's first day, e.g., "November 16, 2020".</td>
1013
+ </tr>
1014
+ <tr>
1015
+ <td class="mla-doc-table-label">week_end_raw</td>
1016
+ <td>the timestamp version of the week's last day, e.g., "1606089599"</td>
1017
+ </tr>
1018
+ <tr>
1019
+ <td class="mla-doc-table-label">week_end_short</td>
1020
+ <td>the short version of the week's last day, e.g., "2020-11-22".</td>
1021
+ </tr>
1022
+ <tr>
1023
+ <td class="mla-doc-table-label">week_end</td>
1024
+ <td>the long version of the week's last day, e.g., "November 22, 2020".</td>
1025
+ </tr>
1026
+ <tr>
1027
+ <td class="mla-doc-table-label">item_id</td>
1028
+ <td>the id attribute of the item, taken from the itemtag_id, if present, or defaulted to the listtag_id, a dash, then the current_value.</td>
1029
+ </tr>
1030
+ <tr>
1031
+ <td class="mla-doc-table-label">item_class</td>
1032
+ <td>the class attribute of the item, taken from the itemtag_class, if present, or defaulted to "muie-archive-list-item". If this is the current archive item, the "current_archive_class" value is added.</td>
1033
+ </tr>
1034
+ <tr>
1035
+ <td class="mla-doc-table-label">item_attributes</td>
1036
+ <td>all of the item's attributes; the "item_id", "item_class" and any additional attributes from the "itemtag_attributes" parameter.</td>
1037
+ </tr>
1038
+ <tr>
1039
+ <td class="mla-doc-table-label">item_selected</td>
1040
+ <td>set to "selected=selected" for the current item, else empty.</td>
1041
+ </tr>
1042
+ <tr>
1043
+ <td class="mla-doc-table-label">item_label</td>
1044
+ <td>the text label of the item, taken from the itemtag_label, if present, or defaulted to the current_label.</td>
1045
+ </tr>
1046
+ <tr>
1047
+ <td class="mla-doc-table-label">item_link_id</td>
1048
+ <td>the id attribute of the item's link, taken from the link_id, if present, or defaulted to empty.</td>
1049
+ </tr>
1050
+ <tr>
1051
+ <td class="mla-doc-table-label">item_link_class</td>
1052
+ <td>the class attribute of the item's link, taken from the link_class, if present, or defaulted to empty.</td>
1053
+ </tr>
1054
+ <tr>
1055
+ <td class="mla-doc-table-label">item_link_rollover</td>
1056
+ <td>the title attribute of the item's link, taken from the rollover_text, if present, or defaulted to empty.</td>
1057
+ </tr>
1058
+ <tr>
1059
+ <td class="mla-doc-table-label">item_link_attributes</td>
1060
+ <td>all of the link's attributes; the "item_link_id", "item_link_class" and any additional attributes from the "link_attributes" parameter.</td>
1061
+ </tr>
1062
+ <tr>
1063
+ <td class="mla-doc-table-label">item_link_text</td>
1064
+ <td>the text value of the link, taken from the link_text, if present, or defaulted to the current_label.</td>
1065
+ </tr>
1066
+ <tr>
1067
+ <td class="mla-doc-table-label">thelink</td>
1068
+ <td>the item's full link value, selected by the link parameter (current, view, span, none).</td>
1069
+ </tr>
1070
+ <tr>
1071
+ <td class="mla-doc-table-label">currentlink</td>
1072
+ <td>the link back to the current page with the value of the current item.</td>
1073
+ </tr>
1074
+ <tr>
1075
+ <td class="mla-doc-table-label">viewlink</td>
1076
+ <td>the link to the item's archive page.</td>
1077
+ </tr>
1078
+ <tr>
1079
+ <td class="mla-doc-table-label">link_url</td>
1080
+ <td>the URL portion of thelink, if any. Empty for the span and none settings.</td>
1081
+ </tr>
1082
+ <tr>
1083
+ <td class="mla-doc-table-label">currentlink_url</td>
1084
+ <td>the URL portion of currentlink.</td>
1085
+ </tr>
1086
+ <tr>
1087
+ <td class="mla-doc-table-label">viewlink_url</td>
1088
+ <td>the URL portion of viewlink.</td>
1089
+ </tr>
1090
+ </table>
1091
+ <p>
1092
+ &nbsp;
1093
+ <a name="filters_examples"></a>
1094
+ </p>
1095
+ <p>
1096
+ <a href="#backtotop">Go to Top</a>
1097
+ </p>
1098
+ <h3>use_filters/add_filters_to Examples</h3>
1099
+ <p>
1100
+ &nbsp;
1101
+ <a name="sticky_examples"></a>
1102
+ </p>
1103
+ <p>
1104
+ <a href="#backtotop">Go to Top</a>
1105
+ </p>
1106
+ <h3>Sticky shortcodes Examples</h3>
1107
+ <p>
1108
+ &nbsp;
1109
+ <a name="muie_archive_list_examples"></a>
1110
+ </p>
1111
+ <p>
1112
+ <a href="#backtotop">Go to Top</a>
1113
+ </p>
1114
+ <h3>Archive List shortcode Examples</h3>
1115
+ <p>
1116
+ The MUIE Archive List shortcode is very flexible and has many parameters and features. However, you can accomplish many application goals with simple shortcodes and just a few parameters. For example, here is a shortcode that will generate a dropdown control with an option to select Media Library items uploaded in a given year:
1117
+ <br />&nbsp;<br />
1118
+ <code>[muie_archive_list]</code>
1119
+ <br />&nbsp;<br />
1120
+ Pretty simple. Adding a couple of parameters gives you an archive with year and month values and a default option for the initial display:
1121
+ <br />&nbsp;<br />
1122
+ <code>[muie_archive_list archive_type=monthly option_all_label="Select a Year and Month"]</code>
1123
+ <br />&nbsp;<br />
1124
+ The default source date for archive values is the "Uploaded on" date (post_date); you can easily change this to a custom field. For example, if you have created a "CreateDate" custom field by mapping the <code>exif:DateTimeOriginal</code>, <code>iptc:DateCreated</code> and/or <code>xmp:CreateDate</code> values you can build the archive from it:
1125
+ <br />&nbsp;<br />
1126
+ <code>[muie_archive_list archive_type=monthly archive_source=custom archive_key=CreateDate option_all_label="Select a Year and Month"]</code>
1127
+ <br />&nbsp;<br />
1128
+ The default output is a dropdown control you can add to an HTML "search form". You can change this to an unordered list where each list item is a hyperlink to the corresponding value:
1129
+ <br />&nbsp;<br />
1130
+ <code>[muie_archive_list archive_type=monthly archive_output=list archive_limit=10 show_count=true]</code>
1131
+ <br />&nbsp;<br />
1132
+ The above example also limits the display to the ten most recent values and adds a count of the number of items selected by each value to the display.
1133
+ </p>
1134
+ <p>
1135
+ The MUIE Archive List shortcode is designed to work with the <code>[mla_gallery]</code> shortcode to display galleries filtered by a date value. To link the archive list to the gallery simply add <code>archive_parameter_name=muie_current_archive</code> to your <code>[mla_gallery]</code> shortcode. Here is a simple example combining an archive search form with a gallery display:
1136
+ <br />&nbsp;<br />
1137
+ <code>
1138
+ &lt;h3&gt;Archive Search Form&lt;/h3&gt;<br />
1139
+ &lt;form id="archive-search-form" action="." method="post"&gt;<br />
1140
+ [muie_archive_list archive_type=monthly option_all_label="Select Uploaded on date"]<br />
1141
+ &lt;input id="search-form-submit" name="search_form_submit" type="submit" value="Filter"&gt;<br />
1142
+ &lt;/form&gt;<br />
1143
+ &lt;h3&gt;Gallery&lt;/h3&gt;<br />
1144
+ [mla_gallery post_parent=all <strong>archive_parameter_name=muie_current_archive</strong> ]
1145
+ </code>
1146
+ <br />&nbsp;<br />
1147
+ The above example displays all of the image items in the Media Library when the page is first loaded or when the "Select Uploaded on date" option is selected. If you want to start with an empty gallery, use a date that doesn't match any of your items, e.g., add these parameters to the shortcodes:
1148
+ <br />&nbsp;<br />
1149
+ <code>
1150
+ &lt;h3&gt;Archive Search Form&lt;/h3&gt;<br />
1151
+ &lt;form id="archive-search-form" action="." method="post"&gt;<br />
1152
+ [muie_archive_list archive_type=monthly option_all_label="Select Uploaded on date" <strong>option_all_value=post_date,M(190001)</strong>]<br />
1153
+ &lt;input id="search-form-submit" name="search_form_submit" type="submit" value="Filter"&gt;<br />
1154
+ &lt;/form&gt;<br />
1155
+ &lt;h3&gt;Gallery&lt;/h3&gt;<br />
1156
+ [mla_gallery post_parent=all archive_parameter_name=muie_current_archive <strong>muie_current_archive="{+template:{+request:muie_current_archive+}|post_date,M\\(190001\\)+}"</strong> ]
1157
+ </code>
1158
+ <br />&nbsp;<br />
1159
+ Note the double backslash characters in the template; they prevent the template processor from interpreting the parentheses as a "Conditional" element. Two are required because of the way WordPress processes shortcode parameters.
1160
+ </p>
1161
+ <p>
1162
+ As described in the "Archive List Data Selection Parameters" section above you can filter the archive list to show the dates present in a subset of your Media Library items. For example, here is a taxonomy term-specific variation on the archive search form:
1163
+ <br />&nbsp;<br />
1164
+ <code>
1165
+ &lt;h3&gt;Archive Search Form for Att. Category ABC&lt;/h3&gt;<br />
1166
+ &lt;form id="archive-search-form" action="." method="post"&gt;<br />
1167
+ [muie_archive_list <strong>attachment_category=abc</strong> archive_type=monthly option_all_label="Select Uploaded on date"]<br />
1168
+ &lt;input id="search-form-submit" name="search_form_submit" type="submit" value="Filter"&gt;<br />
1169
+ &lt;/form&gt;<br />
1170
+ &lt;h3&gt;Gallery for Att. Category ABC&lt;/h3&gt;<br />
1171
+ [mla_gallery <strong>attachment_category=abc</strong> archive_parameter_name=muie_current_archive]
1172
+ </code>
1173
+ <br />&nbsp;<br />
1174
+ This example will initially show all items assigned to <code>attachment_category=abc</code> and the dropdown control will show only those dates that have one or more items assigned to the term. Selecting an archive value will combine the term filter and the date filter for the gallery display.
1175
+ </p>
1176
+ <p>
1177
+ </p>
1178
+ Finally, here is an example that shows how you can combine <code>[muie_archive_list]</code> with the other MUIE elements to create a powerful multi-criteria search application. In this example the <code>tax_input={+template:({+request:tax_input,array+})+}</code> parameter added to the <code>[muie_archive_list]</code> shortcode links the archive list to whatever taxonomy term is selected in the <code>[mla_term_list]</code> shortcode:
1179
+ <br />&nbsp;<br />
1180
+ <code>
1181
+ &lt;form id="mla-text-form" action="." method="post" class="row"&gt;<br />
1182
+ &lt;strong&gt;Att. Categories&lt;/strong&gt;<br />
1183
+ [mla_term_list taxonomy=attachment_category post_mime_type=image number=15 mla_output=dropdown mla_option_value="{+slug+}" use_filters=true show_count=true pad_counts=false option_all_text="Select Att. Category"]<br />
1184
+ <br />
1185
+ &lt;strong&gt;Archive Search&lt;/strong&gt;<br />
1186
+ [muie_archive_list tax_input={+template:({+request:tax_input,array+})+} archive_type=weekly archive_source=custom archive_key=CreateDate xarchive_output=list xlink=span option_all_label="Select Archive" archive_limit=10 muie_debug=log mla_debug=true]<br />
1187
+ <br />
1188
+ &lt;strong&gt;Keyword Search&lt;/strong&gt;<br />
1189
+ [muie_keyword_search mla_search_connector='OR']<br />
1190
+ <br />
1191
+ Items per page: [muie_per_page numberposts=3]<br />
1192
+ <br />
1193
+ &lt;input id="text-form-submit" name="text_form_submit" type="submit" value="Filter"&gt;<br />
1194
+ &lt;/form&gt;<br />
1195
+ <br />
1196
+ &lt;h3&gt;Gallery&lt;/h3&gt;<br />
1197
+ [mla_gallery post_parent=all order<br />by=date posts_per_page=20 add_filters_to=any archive_parameter_name=muie_current_archive mla_output="paginate_links,prev_next"]<br />
1198
+ <br />
1199
+ [mla_gallery post_parent=all orderby=date posts_per_page=20 add_filters_to=any archive_parameter_name=muie_current_archive mla_nolink_text="Enter a term above to see a gallery of items that match."]
1200
+ </code>
1201
+ <br />&nbsp;<br />
1202
+ The above example can be adapted to a variety of application scenarios.
1203
+ <a name="debugging"></a>
1204
+ </p>
1205
+ <p>
1206
+ <a href="#backtotop">Go to Top</a>
1207
+ </p>
1208
+ <h3>Debugging and Troubleshooting</h3>
1209
+ <p>
1210
+ If you are not getting the results you expect from "use_filters" and "add_filters_to" carefully inspecting the results of parsing the specification and generating the query can be a valuable exercise. You can add the <code>muie_debug=true</code> or <code>muie_debug=log</code> parameters to the <code>[mla_gallery]</code> or <code>[mla_term_list]</code> shortcode, run a test and inspect the log file or the screen messages for more information about what's going on.
1211
+ </p>
1212
+ <p>
1213
+ You can also add the <code>mla_debug=true</code> or <code>mla_debug=log</code> parameters to the <code>[mla_gallery]</code> shortcode for even more debug information. If you do this, make sure that both <code>muie_debug</code> and <code>mla_debug</code> are set to the same value, i.e., both "true" or both "log".
1214
+ </p>
1215
+ <p>
1216
+ Most of the shortcodes added by this example plugin are very straightforward and they do not generate debug log entries. The <code>[muie_archive_list]</code> shortcode can be much more complex. For this shortcode adding &ldquo;0x8000&rdquo; to the MLA Reporting value will generate useful information.
1217
+ </p>
1218
+ <p>
1219
+ To activate MLA&rsquo;s debug logging:
1220
+ </p>
1221
+ <ol>
1222
+ <li>Navigate to the Settings/Media Library Assistant Debug tab.</li>
1223
+ <li>Scroll down to the &ldquo;MLA Reporting&rdquo; text box and enter &ldquo;0x8001&rdquo;. This will turn on MLA debug logging for messages specific to this example plugin.</li>
1224
+ <li>Click the Save Changes button to record your new setting.</li>
1225
+ <li>Optionally, scroll to the bottom of the screen and click &ldquo;Reset&rdquo; to clear the error log. You may not want to do this depending on how you manage your error log.</li>
1226
+ </ol>
1227
+ <p>
1228
+ Once that&rsquo;s done you can run a test. The debug log can be very detailed, so restricting the test as best you can will be very helpful. When you&rsquo;ve finished testing, go back to the Debug screen and:
1229
+ </p>
1230
+ <ol>
1231
+ <li>Enter &ldquo;0&rdquo; in the MLA Reporting text box to turn debug logging off.</li>
1232
+ <li>Click the Save Changes button to record your new setting.</li>
1233
+ <li>Scroll to the bottom and click &ldquo;Download&rdquo; to get the log content in a text file.</li>
1234
+ <li>Optionally, scroll to the bottom of the screen and click &ldquo;Reset&rdquo; to clear the error log.</li>
1235
+ </ol>
1236
+ <p>
1237
+ There may be a lot of messages written to the log, so limit the amount of activity during the logging period. You should see messages in the log like these:
1238
+ </p>
1239
+ <blockquote>
1240
+ [28-Dec-2020 05:38:55 UTC] 610 MLACore::mla_plugins_loaded_action() MLA 2.96 mla_debug_level 0x8001<br />
1241
+ [28-Dec-2020 05:38:55 UTC] 623 <strong>mla_debug REQUEST</strong> = array (
1242
+ 'tax_input' =>
1243
+ array (
1244
+ 'attachment_category' =>
1245
+ array (
1246
+ 0 => 'def',
1247
+ ),
1248
+ ),
1249
+ )
1250
+ [28-Dec-2020 05:38:55 UTC] 635 <strong>mla_debug attributes</strong> = array (
1251
+ 'post_mime_type' => 'image/j*',
1252
+ 'numberposts' => '3',
1253
+ 'columns' => '2',
1254
+ 'size' => 'large',
1255
+ 'mla_debug' => 'log',
1256
+ 'mla_page_parameter' => 'mla_paginate_current',
1257
+ )
1258
+
1259
+ </blockquote>
1260
+ <p>
1261
+ Of course, the details will be different. If you discover a defect in the plugin (or in MLA) you can <a href="http://wordpress.org/support/plugin/media-library-assistant" target="_blank">open a support topic</a> or <a href="http://davidlingren.com/#two" target="_blank">contact me at my web site</a> so it can be investigated further. I may ask for a copy of the log file from your tests.
1262
+ </p>
1263
+ </div>
examples/plugins/mla-ui-elements-example/class-mla-example-plugin-settings-101.php ADDED
@@ -0,0 +1,559 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Provides option management and Settings/ General and Documentation submenu pages
4
+ *
5
+ * This file might be shared among multiple example plugins, so load it with:
6
+ *
7
+ * if ( ! class_exists( 'MLAExamplePluginSettings101' ) ) {
8
+ * require_once( pathinfo( __FILE__, PATHINFO_DIRNAME ) . '/class-mla-example-plugin-settings-101.php' );
9
+ * }
10
+ *
11
+ * @package Media Library Assistant
12
+ * @version 1.01
13
+ */
14
+
15
+ /**
16
+ * Class MLA Example Settings Menu adds Settings/ General and Documentation submenu pages to an example plugin
17
+ *
18
+ * @package MLA Example Settings Menu
19
+ * @since 1.00
20
+ */
21
+ class MLAExamplePluginSettings101 {
22
+ /**
23
+ * Default values for the __construct function
24
+ *
25
+ * @since 1.00
26
+ *
27
+ * @var array
28
+ */
29
+ private static $default_arguments = array(
30
+ 'slug_prefix' => 'example-plugin',
31
+ 'plugin_title' => 'The Example Plugin',
32
+ 'menu_title' => 'Example Plugin',
33
+ 'plugin_file_name_only' => 'the-example-plugin',
34
+ 'plugin_version' => '1.00',
35
+ 'template_file' => 'absolute path to the template file', // e.g., dirname( __FILE__ ) . '/admin-settings-page.tpl'
36
+ 'options' => array( 'slug' => array( 'type' => 'text|checkbox', 'default' => 'text|boolean' ) ),
37
+ 'general_tab_values' => array(), // additional page_values for 'page-level-options' template
38
+ 'documentation_tab_values' => array(), // page_values for 'documentation-tab' template
39
+ );
40
+
41
+ /**
42
+ * Current values for this object instance
43
+ *
44
+ * @since 1.00
45
+ *
46
+ * @var array
47
+ */
48
+ private $current_arguments = array();
49
+
50
+ /**
51
+ * This function sets option definitions and installs filters.
52
+ *
53
+ * @since 1.00
54
+ *
55
+ * @param array $attr Option definitions and settings
56
+ */
57
+ public function __construct( $attr ) {
58
+ //error_log( __LINE__ . " MLAExamplePluginSettings101::__construct() _REQUEST = " . var_export( $_REQUEST, true ), 0 );
59
+ // Make sure $attr is an array, even if it's empty
60
+ if ( empty( $attr ) ) {
61
+ $attr = array();
62
+ } elseif ( is_string( $attr ) ) {
63
+ $attr = shortcode_parse_atts( $attr );
64
+ }
65
+
66
+ // Accept only the attributes we need and supply defaults
67
+ $this->current_arguments = shortcode_atts( self::$default_arguments, $attr );
68
+
69
+ // Compile the default settings
70
+ foreach ( $this->current_arguments['options'] as $slug => $option ) {
71
+ $this->default_settings[ $slug ] = $option['default'];
72
+ }
73
+
74
+ if ( is_admin() ) {
75
+ // Record new settings if they're being updated
76
+ $this->request_settings = array();
77
+ if ( !empty( $_REQUEST[ $this->current_arguments['slug_prefix'] . '_options_save'] ) ) {
78
+ if ( isset( $_REQUEST[ $this->current_arguments['slug_prefix'] . '_options' ] ) ) {
79
+ $this->request_settings = wp_unslash( $_REQUEST[ $this->current_arguments['slug_prefix'] . '_options' ] );
80
+ }
81
+ } elseif ( !empty( $_REQUEST[ $this->current_arguments['slug_prefix'] . '_options_reset'] ) ) {
82
+ $this->request_settings = $this->default_settings;
83
+ }
84
+ //error_log( __LINE__ . ' MLAExamplePluginSettings101::__construct request_settings = ' . var_export( $this->request_settings, true ), 0 );
85
+ //error_log( __LINE__ . ' MLAExamplePluginSettings101::__construct mla_hex_dump( exports ) = ' . var_export( MLAData::mla_hex_dump( $this->request_settings['exports'] ), true ), 0 );
86
+ // Add submenu page in the "Settings" section
87
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Add submenu page in the "Settings" section
93
+ *
94
+ * @since 1.00
95
+ */
96
+ public function admin_menu() {
97
+ /*
98
+ * We need a tab-specific page ID to manage the screen options on the General tab.
99
+ * Use the URL suffix, if present. If the URL doesn't have a tab suffix, use '-general'.
100
+ * This hack is required to pass the WordPress "referer" validation.
101
+ */
102
+ if ( isset( $_REQUEST['page'] ) && is_string( $_REQUEST['page'] ) && ( $this->current_arguments['slug_prefix'] . '-settings-' == substr( $_REQUEST['page'], 0, strlen( $this->current_arguments['slug_prefix'] . '-settings-' ) ) ) ) {
103
+ $tab = substr( $_REQUEST['page'], strlen( $this->current_arguments['slug_prefix'] . '-settings-' ) );
104
+ } else {
105
+ $tab = 'general';
106
+ }
107
+
108
+ $tab = $this->_get_options_tablist( $tab ) ? '-' . $tab : '-general';
109
+ add_submenu_page( 'options-general.php', $this->current_arguments['plugin_title'], $this->current_arguments['menu_title'], 'manage_options', $this->current_arguments['slug_prefix'] . '-settings' . $tab, array( $this, 'add_submenu_page' ) );
110
+ add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2 );
111
+ }
112
+
113
+ /**
114
+ * Add the "Settings" and "Guide" links to the Plugins section entry
115
+ *
116
+ * @since 1.00
117
+ *
118
+ * @param array array of links for the Plugin, e.g., "Activate"
119
+ * @param string Directory and name of the plugin Index file
120
+ *
121
+ * @return array Updated array of links for the Plugin
122
+ */
123
+ public function plugin_action_links( $links, $file ) {
124
+ if ( $file == $this->current_arguments['plugin_file_name_only'] . '/' . $this->current_arguments['plugin_file_name_only'] . '.php' ) {
125
+ $settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'options-general.php?page=' . $this->current_arguments['slug_prefix'] . '-settings-documentation&mla_tab=documentation' ), 'Guide' );
126
+ array_unshift( $links, $settings_link );
127
+ $settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'options-general.php?page=' . $this->current_arguments['slug_prefix'] . '-settings-general' ), 'Settings' );
128
+ array_unshift( $links, $settings_link );
129
+ }
130
+
131
+ return $links;
132
+ }
133
+
134
+ /**
135
+ * Render (echo) the example plugin's submenu in the Settings section
136
+ *
137
+ * @since 1.00
138
+ *
139
+ * @return void Echoes HTML markup for the submenu page
140
+ */
141
+ public function add_submenu_page() {
142
+ if ( !current_user_can( 'manage_options' ) ) {
143
+ echo '<h2>' . $this->current_arguments['plugin_title'] . " - Error</h2>\n";
144
+ wp_die( 'You do not have permission to manage plugin settings.' );
145
+ }
146
+
147
+ // Load template array and initialize page-level values.
148
+ $this->page_template_array = MLACore::mla_load_template( $this->current_arguments['template_file'], 'path' );
149
+ $current_tab_slug = isset( $_REQUEST['mla_tab'] ) ? $_REQUEST['mla_tab']: 'general';
150
+ $current_tab = $this->_get_options_tablist( $current_tab_slug );
151
+ $page_values = array(
152
+ 'plugin_title' => $this->current_arguments['plugin_title'],
153
+ 'version' => 'v' . $this->current_arguments['plugin_version'],
154
+ 'messages' => '',
155
+ 'tablist' => $this->_compose_settings_tabs( $current_tab_slug ),
156
+ 'tab_content' => '',
157
+ );
158
+
159
+ // Compose tab content
160
+ if ( $current_tab ) {
161
+ if ( isset( $current_tab['render'] ) ) {
162
+ $handler = $current_tab['render'];
163
+ $page_content = call_user_func( array( $this, $handler ) );
164
+ } else {
165
+ $page_content = array( 'message' => "ERROR: Cannot render content tab {$current_tab_slug}", 'body' => '' );
166
+ }
167
+ } else {
168
+ $page_content = array( 'message' => "ERROR: Unknown content tab {$current_tab_slug}", 'body' => '' );
169
+ }
170
+
171
+ if ( ! empty( $page_content['message'] ) ) {
172
+ if ( false !== strpos( $page_content['message'], 'ERROR' ) ) {
173
+ $messages_class = 'updated error';
174
+ } else {
175
+ $messages_class = 'updated notice is-dismissible';
176
+ }
177
+
178
+ $page_values['messages'] = MLAData::mla_parse_template( $this->page_template_array['messages'], array(
179
+ 'mla_messages_class' => $messages_class ,
180
+ 'messages' => $page_content['message'],
181
+ ) );
182
+ }
183
+
184
+ $page_values['tab_content'] = $page_content['body'];
185
+
186
+ echo MLAData::mla_parse_template( $this->page_template_array['page'], $page_values );
187
+ }
188
+
189
+ /**
190
+ * Template file for the Settings page(s) and parts
191
+ *
192
+ * This array contains all of the template parts for the Settings page(s). The array is built once
193
+ * each page load and cached for subsequent use.
194
+ *
195
+ * @since 1.00
196
+ *
197
+ * @var array
198
+ */
199
+ private $page_template_array = NULL;
200
+
201
+ /**
202
+ * Definitions for Settings page tab ids, titles and handlers
203
+ * Each tab is defined by an array with the following elements:
204
+ *
205
+ * array key => HTML id/name attribute and option database key (OMIT MLA_OPTION_PREFIX)
206
+ *
207
+ * title => tab label / heading text
208
+ * render => rendering function for tab messages and content. Usage:
209
+ * $tab_content = ['render']();
210
+ *
211
+ * @since 1.00
212
+ *
213
+ * @var array
214
+ */
215
+ private $mla_tablist = array(
216
+ 'general' => array( 'title' => 'General', 'render' => '_compose_general_tab' ),
217
+ 'documentation' => array( 'title' => 'Documentation', 'render' => '_compose_documentation_tab' ),
218
+ );
219
+
220
+ /**
221
+ * Retrieve the list of options tabs or a specific tab value
222
+ *
223
+ * @since 1.00
224
+ *
225
+ * @param string Tab slug, to retrieve a single entry
226
+ *
227
+ * @return array|false The entire tablist ( $tab = NULL ), a single tab entry or false if not found/not allowed
228
+ */
229
+ private function _get_options_tablist( $tab = NULL ) {
230
+ if ( is_string( $tab ) ) {
231
+ if ( isset( $this->mla_tablist[ $tab ] ) ) {
232
+ $results = $this->mla_tablist[ $tab ];
233
+ } else {
234
+ $results = false;
235
+ }
236
+ } else {
237
+ $results = $this->mla_tablist;
238
+ }
239
+
240
+ return $results;
241
+ }
242
+
243
+ /**
244
+ * Compose the navigation tabs for the Settings subpage
245
+ *
246
+ * @since 1.00
247
+ * @uses $page_template_array contains tablist and tablist-item templates
248
+ *
249
+ * @param string Optional data-tab-id value for the active tab, default 'general'
250
+ *
251
+ * @return string HTML markup for the Settings subpage navigation tabs
252
+ */
253
+ private function _compose_settings_tabs( $active_tab = 'general' ) {
254
+ $tablist_item = $this->page_template_array['tablist-item'];
255
+ $tabs = '';
256
+ foreach ( $this->_get_options_tablist() as $key => $item ) {
257
+ $item_values = array(
258
+ 'data-tab-id' => $key,
259
+ 'nav-tab-active' => ( $active_tab == $key ) ? 'nav-tab-active' : '',
260
+ 'settings-page' => $this->current_arguments['slug_prefix'] . '-settings-' . $key,
261
+ 'title' => $item['title']
262
+ );
263
+
264
+ $tabs .= MLAData::mla_parse_template( $tablist_item, $item_values );
265
+ } // foreach $item
266
+
267
+ $tablist_values = array( 'tablist' => $tabs );
268
+ return MLAData::mla_parse_template( $this->page_template_array['tablist'], $tablist_values );
269
+ }
270
+
271
+ /**
272
+ * Compose the General tab content for the Settings subpage
273
+ *
274
+ * @since 1.00
275
+ * @uses $page_template_array contains tab content template(s)
276
+ *
277
+ * @return array 'message' => status/error messages, 'body' => tab content
278
+ */
279
+ private function _compose_general_tab() {
280
+ $page_content = array( 'message' => '', 'body' => '' );
281
+
282
+ // Check for page-level Save Changes, Restore Defaults
283
+ if ( !empty( $_REQUEST[ $this->current_arguments['slug_prefix'] . '_options_save'] ) ) {
284
+ check_admin_referer( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME );
285
+ $page_content = $this->_save_setting_changes();
286
+ } elseif ( !empty( $_REQUEST[ $this->current_arguments['slug_prefix'] . '_options_reset'] ) ) {
287
+ check_admin_referer( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME );
288
+ $page_content = $this->_restore_setting_defaults();
289
+ }
290
+
291
+ if ( !empty( $page_content['body'] ) ) {
292
+ return $page_content;
293
+ }
294
+
295
+ // Display the General tab
296
+ $_SERVER['REQUEST_URI'] = remove_query_arg( array(
297
+ $this->current_arguments['slug_prefix'] . '_options',
298
+ '_wpnonce',
299
+ '_wp_http_referer',
300
+ $this->current_arguments['slug_prefix'] . '_options_save',
301
+ $this->current_arguments['slug_prefix'] . '_options_reset',
302
+ ), $_SERVER['REQUEST_URI'] );
303
+
304
+ // Compose page-level options
305
+ $page_values = $this->current_arguments['general_tab_values'];
306
+
307
+ foreach ( $this->current_arguments['options'] as $slug => $option ) {
308
+ if ( 'checkbox' === $option['type'] ) {
309
+ $page_values[ $slug . '_checked' ] = $this->get_plugin_option( $slug ) ? 'checked="checked" ' : '';
310
+ } else {
311
+ $page_values[ $slug ] = esc_attr( $this->get_plugin_option( $slug ) );
312
+ }
313
+ }
314
+ //error_log( __LINE__ . ' MLAExamplePluginSettings101::_compose_general_tab page_values = ' . var_export( $page_values, true ), 0 );
315
+
316
+ $options_list = MLAData::mla_parse_template( $this->page_template_array['page-level-options'], $page_values );
317
+
318
+ $form_arguments = '?page=' . $this->current_arguments['slug_prefix'] . '-settings-general&mla_tab=general';
319
+
320
+ $page_values = array(
321
+ 'form_url' => admin_url( 'options-general.php' ) . $form_arguments,
322
+ '_wpnonce' => wp_nonce_field( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME, true, false ),
323
+ 'options_list' => $options_list,
324
+ 'slug_prefix' => $this->current_arguments['slug_prefix'],
325
+ );
326
+
327
+ $page_content['body'] .= MLAData::mla_parse_template( $this->page_template_array['general-tab'], $page_values );
328
+
329
+ return $page_content;
330
+ }
331
+
332
+ /**
333
+ * Compose the Documentation tab content for the Settings subpage
334
+ *
335
+ * @since 1.00
336
+ * @uses $page_template_array contains tab content template(s)
337
+ *
338
+ * @return array 'message' => status/error messages, 'body' => tab content
339
+ */
340
+ private function _compose_documentation_tab() {
341
+ $page_content = array( 'message' => '', 'body' => '' );
342
+ $page_values = array(
343
+ );
344
+
345
+ $page_content['body'] = MLAData::mla_parse_template( $this->page_template_array['documentation-tab'], $this->current_arguments['documentation_tab_values'] );
346
+ return $page_content;
347
+ }
348
+
349
+ /**
350
+ * Save settings as a WordPress wp_options entry
351
+ *
352
+ * @since 1.00
353
+ *
354
+ * @return array 'message' => status/error messages, 'body' => tab content
355
+ */
356
+ private function _save_setting_changes() {
357
+ $page_content = array( 'message' => 'Settings unchanged.', 'body' => '' );
358
+
359
+ $changed = false;
360
+ //error_log( __LINE__ . ' MLAExamplePluginSettings101::_save_setting_changes current_arguments[options] = ' . var_export( $this->current_arguments['options'], true ), 0 );
361
+ foreach ( $this->current_arguments['options'] as $slug => $option ) {
362
+ if ( 'checkbox' === $option['type'] ) {
363
+ $changed |= $this->_update_plugin_option( $slug, isset( $this->request_settings[ $slug ] ) );
364
+ } else {
365
+ if ( isset( $this->request_settings[ $slug ] ) ) {
366
+ $changed |= $this->_update_plugin_option( $slug, $this->request_settings[ $slug ] );
367
+ } else {
368
+ $changed |= $this->_update_plugin_option( $slug, $option['default'] );
369
+ }
370
+ }
371
+ } // foreach option
372
+ $this->request_settings = array();
373
+ //error_log( __LINE__ . " MLAExamplePluginSettings101::_save_setting_changes( {$changed} ) final current_settings = " . var_export( $this->current_settings, true ), 0 );
374
+
375
+ if ( $changed ) {
376
+ // No reason to save defaults in the database
377
+ if ( $this->current_settings === $this->default_settings ) {
378
+ delete_option( $this->current_arguments['slug_prefix'] . '-settings' );
379
+ } else {
380
+ $changed = update_option( $this->current_arguments['slug_prefix'] . '-settings', $this->current_settings, false );
381
+ }
382
+
383
+ if ( $changed ) {
384
+ $page_content['message'] = "Settings have been updated.";
385
+ } else {
386
+ $page_content['message'] = "Settings updated failed.";
387
+ }
388
+ }
389
+
390
+ return $page_content;
391
+ } // _save_setting_changes
392
+
393
+ /**
394
+ * Delete the plugin's WordPress wp_options entry, restoring the default settings
395
+ *
396
+ * @since 1.00
397
+ *
398
+ * @return array 'message' => status/error messages, 'body' => tab content
399
+ */
400
+ private function _restore_setting_defaults() {
401
+ $page_content = array( 'message' => 'Settings unchanged.', 'body' => '' );
402
+ $this->current_settings = $this->default_settings;
403
+ $changed = delete_option( $this->current_arguments['slug_prefix'] . '-settings' );
404
+
405
+ if ( $changed ) {
406
+ $page_content['message'] = "Settings have been updated.";
407
+ }
408
+
409
+ return $page_content;
410
+ } // _restore_setting_defaults
411
+
412
+ /**
413
+ * Assemble the in-memory representation of the plugin settings
414
+ *
415
+ * @since 1.00
416
+ *
417
+ * @param boolean $force_refresh Optional. Force a reload of rules. Default false.
418
+ *
419
+ * @return boolean Success (true) or failure (false) of the operation
420
+ */
421
+ private function _get_plugin_settings( $force_refresh = false ) {
422
+ if ( false == $force_refresh && NULL != $this->current_settings ) {
423
+ return true;
424
+ }
425
+
426
+ // Update the plugin options from the wp_options table or set defaults
427
+ $this->current_settings = get_option( $this->current_arguments['slug_prefix'] . '-settings' );
428
+ //error_log( __LINE__ . ' MLAExamplePluginSettings101::_get_plugin_settings stored current_settings = ' . var_export( $this->current_settings, true ), 0 );
429
+ if ( !is_array( $this->current_settings ) ) {
430
+ $this->current_settings = $this->default_settings;
431
+ }
432
+
433
+ // Initialize any new setting(s) from the default settings
434
+ foreach ( $this->current_arguments['options'] as $slug => $option ) {
435
+ if ( !isset( $this->current_settings[ $slug ] ) ) {
436
+ $this->current_settings[ $slug ] = $option['default'];
437
+ }
438
+ }
439
+
440
+ //error_log( __LINE__ . ' MLAExamplePluginSettings101::_get_plugin_settings final current_settings = ' . var_export( $this->current_settings, true ), 0 );
441
+ return true;
442
+ }
443
+
444
+ /**
445
+ * Updated option settings from the $_REQUEST array
446
+ *
447
+ * @since 1.01
448
+ *
449
+ * @var array
450
+ */
451
+ private $request_settings = array();
452
+
453
+ /**
454
+ * In-memory representation of the option settings
455
+ *
456
+ * @since 1.00
457
+ *
458
+ * @var array
459
+ */
460
+ private $current_settings = NULL;
461
+
462
+ /**
463
+ * Default processing options
464
+ *
465
+ * @since 1.00
466
+ *
467
+ * @var array
468
+ */
469
+ private $default_settings = array();
470
+
471
+ /**
472
+ * Update a plugin option setting
473
+ *
474
+ * @since 1.00
475
+ *
476
+ * @param string $name Option name
477
+ * @param mixed $new_value Option value
478
+ *
479
+ * @return mixed True if option value changed, false if value unchanged, NULL if failure
480
+ */
481
+ private function _update_plugin_option( $name, $new_value ) {
482
+ if ( !$this->_get_plugin_settings() ) {
483
+ return NULL;
484
+ }
485
+
486
+ $old_value = isset( $this->current_settings[ $name ] ) ? $this->current_settings[ $name ] : NULL;
487
+
488
+ if ( $new_value === $old_value ) {
489
+ return false;
490
+ }
491
+
492
+ $this->current_settings[ $name ] = $new_value;
493
+ return true;
494
+ }
495
+
496
+ /**
497
+ * Get a plugin option setting
498
+ *
499
+ * @since 1.00
500
+ *
501
+ * @param string $name Option name
502
+ *
503
+ * @return mixed Option value, if it exists else NULL
504
+ */
505
+ public function get_plugin_option( $name ) {
506
+ if ( !$this->_get_plugin_settings() ) {
507
+ return NULL;
508
+ }
509
+
510
+ // See if the setting is being updated
511
+ if ( isset( $this->request_settings[ $name ] ) ) {
512
+ return $this->request_settings[ $name ];
513
+ }
514
+
515
+ if ( isset( $this->current_settings[ $name ] ) ) {
516
+ return $this->current_settings[ $name ];
517
+ }
518
+
519
+ return NULL;
520
+ }
521
+
522
+ /**
523
+ * Get a plugin argument setting
524
+ *
525
+ * @since 1.01
526
+ *
527
+ * @param string $name Argument name
528
+ *
529
+ * @return mixed Argument value, if it exists else NULL
530
+ */
531
+ public function get_plugin_argument( $name ) {
532
+ if ( !isset( $this->current_arguments[ $name ] ) ) {
533
+ return NULL;
534
+ }
535
+
536
+ return $this->current_arguments[ $name ];
537
+ }
538
+
539
+ /**
540
+ * Update a plugin argument setting
541
+ *
542
+ * @since 1.01
543
+ *
544
+ * @param string $name Argument name
545
+ *
546
+ * @return boolean True if argument value changed, false if value unchanged
547
+ */
548
+ public function update_plugin_argument( $name, $new_value ) {
549
+ $old_value = isset( $this->current_arguments[ $name ] ) ? $this->current_arguments[ $name ] : NULL;
550
+
551
+ if ( $new_value === $old_value ) {
552
+ return false;
553
+ }
554
+
555
+ $this->current_arguments[ $name ] = $new_value;
556
+ return true;
557
+ }
558
+ } // Class MLAExamplePluginSettings101
559
+ ?>
examples/plugins/mla-ui-elements-example/mla-ui-custom-templates.tpl ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- template="muie-archive-list-style" -->
2
+ <!-- mla_shortcode_slug="muie-archive-list" -->
3
+ <style type='text/css'>
4
+ #[+selector+] {
5
+ margin: auto;
6
+ width: 100%;
7
+ }
8
+ #[+selector+] .muie-archive-list-item {
9
+ text-align: left;
10
+ }
11
+ #[+selector+] li.[+current_archive_class+] a {
12
+ font-weight: bold;
13
+ font-size:larger;
14
+ }
15
+ </style>
16
+
17
+ <!-- template="muie-archive-dropdown-arguments-markup" -->
18
+ mla_shortcode_slug="muie-archive-list"
19
+
20
+ <!-- template="muie-archive-dropdown-open-markup" -->
21
+ <[+listtag+] name="[+listtag_name+]" id="[+listtag_id+]" class="[+listtag_class+]" [+listtag_attributes+]>
22
+
23
+ <!-- template="muie-archive-dropdown-item-markup" -->
24
+ <[+itemtag+] id="[+item_id+]" class="[+item_class+]" [+item_attributes+] [+item_selected+] value="[+item_value+]">[+item_label+]</[+itemtag+]>
25
+
26
+ <!-- template="muie-archive-dropdown-close-markup" -->
27
+ </[+listtag+]>
28
+
29
+ <!-- template="muie-archive-list-arguments-markup" -->
30
+ mla_shortcode_slug="muie-archive-list"
31
+
32
+ <!-- template="muie-archive-list-open-markup" -->
33
+ <[+listtag+] id="[+listtag_id+]" class="[+listtag_class+]" [+listtag_attributes+]>
34
+
35
+ <!-- template="muie-archive-list-item-markup" -->
36
+ <[+itemtag+] id="[+item_id+]" class="[+item_class+]" [+item_attributes+]>[+thelink+]</[+itemtag+]>
37
+
38
+ <!-- template="muie-archive-list-close-markup" -->
39
+ </[+listtag+]>
examples/plugins/mla-ui-elements-example/mla-ui-elements-example.php ADDED
@@ -0,0 +1,2956 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Provides shortcodes to improve user experience for [mla_term_list],
4
+ * [mla_tag_cloud] and [mla_gallery] shortcodes
5
+ *
6
+ * Detailed information is in the Settings/MLA UI Elements Documentation tab.
7
+ *
8
+ * In this example:
9
+ *
10
+ * 1. If you add "use_filters=true" to an [mla_term_list] shortcode this plugin will retain the
11
+ * selected terms when the page is refreshed and pass them back into the shortcode.
12
+ *
13
+ * 2. If you add "add_filters_to=any" to an [mla_gallery] shortcode this plugin will retain
14
+ * settings for terms search, keyword search, taxonomy queries and posts_per_page when the
15
+ * page is refreshed or pagination moves to a new page.
16
+ *
17
+ * 3. If you add "add_filters_to=<taxonomy_slug>" to an [mla_gallery] shortcode this plugin will
18
+ * do the actions in 2. and will also match the taxonomy_slug to a simple taxonomy query (if
19
+ * present) and add that query to the taxonomy queries. If the simple query is 'muie-no-terms',
20
+ * it will be ignored.
21
+ *
22
+ * 4. If you add "default_empty_gallery=true" an [mla_gallery] shortcode the initial gallery display
23
+ * will show no items, until a selection is made from the other controls.
24
+ *
25
+ * 5. The [muie_archive_list] lets you construct lists and controls for filtering a gallery on the
26
+ * values of date variables in the items' post row or a custom field.
27
+ *
28
+ * 6. Shortcodes are provided to generate text box controls and retain their settings when the
29
+ * page is refreshed or pagination moves to a new page:
30
+ *
31
+ * [muie_terms_search] generates a terms search text box
32
+ * [muie_keyword_search] generates a keyword search text box
33
+ * [muie_orderby] generates an order by dropdown control
34
+ * [muie_order] generates ascending/descending radio buttons
35
+ * [muie_per_page] generates an items per page text box
36
+ * [muie_assigned_items_count] returns the number of items assigned to any term(s) in the
37
+ * selected taxonomy
38
+ *
39
+ * 7. With a bit of work you can add a tag cloud that works with these filters. Here's an example
40
+ * you can adapt for your application:
41
+ *
42
+ * <style type='text/css'>
43
+ * #mla-tag-cloud .mla_current_item {
44
+ * color:#FF0000;
45
+ * font-weight:bold}
46
+ * </style>
47
+ * <span id=mla-tag-cloud>
48
+ * <strong>Tag Cloud</strong>
49
+ * [mla_tag_cloud taxonomy=attachment_tag number=20 current_item="{+request:current_item+}" mla_link_href="{+currentlink_url+}&tax_input{{+query:taxonomy+}}{}={+slug+}&muie_per_page={+template:({+request:muie_per_page+}|5)+}" link_class="{+current_item_class+}"]
50
+ * </span>
51
+ *
52
+ * This example plugin uses three of the many filters available in the [mla_gallery] and [mla_term_list] shortcodes
53
+ * and illustrates some of the techniques you can use to customize the gallery display and term list controls.
54
+ *
55
+ * Created for support topic "How do I provide a front-end search of my media items using Custom Fields?"
56
+ * opened on 4/15/2016 by "direys".
57
+ * https://wordpress.org/support/topic/how-do-i-provide-a-front-end-search-of-my-media-items-using-custom-fields
58
+ *
59
+ * Enhanced for support topic "Dynamic search and filters"
60
+ * opened on 5/28/2016 by "ghislainsc".
61
+ * https://wordpress.org/support/topic/dynamic-search-and-filters
62
+ *
63
+ * Enhanced for support topic "Very new to this, need help"
64
+ * opened on 6/15/2016 by "abronk".
65
+ * https://wordpress.org/support/topic/very-new-to-this-need-help/
66
+ *
67
+ * Enhanced for support topic "Limiting search results to attachment tags/'Justifying' gallery grids"
68
+ * opened on 7/2/2016 by "ceophoetography".
69
+ * https://wordpress.org/support/topic/limiting-search-results-to-attachment-tagsjustifying-gallery-grids
70
+ *
71
+ * Enhanced for support topic "Shortcode"
72
+ * opened on 10/18/2016 by "trinitaa".
73
+ * https://wordpress.org/support/topic/shortcode-456/
74
+ *
75
+ * Enhanced for support topic "Search solution"
76
+ * opened on 3/28/2019 by "fabrizioarnone".
77
+ * https://wordpress.org/support/topic/search-solution/
78
+ *
79
+ * Enhanced (bug fixes) for support topic "Drop down not sticking"
80
+ * opened on 12/10/2019 by "ageingdj".
81
+ * https://wordpress.org/support/topic/drop-down-not-sticking/
82
+ *
83
+ * Enhanced (default_empty_gallery) for support topic "Search fields and presentation of results"
84
+ * opened on 6/2/2020 by "ernstwg".
85
+ * https://wordpress.org/support/topic/search-fields-and-presentation-of-results/
86
+ *
87
+ * Enhanced ([mla_archive_list] shortcode) for support topic "Pages by date"
88
+ * opened on 1/18/2021 by "cirks".
89
+ * https://wordpress.org/support/topic/pages-by-date/
90
+ *
91
+ * Enhanced ([mla_text_box] shortcode) for support topic "Checklist behaviour, my_custom_sql, muie_terms_search"
92
+ * opened on 5/18/2021 by "heb51".
93
+ * https://wordpress.org/support/topic/checklist-behaviour-my_custom_sql-muie_terms_search/
94
+ *
95
+ * @package MLA UI Elements Example
96
+ * @version 1.16
97
+ */
98
+
99
+ /*
100
+ Plugin Name: MLA UI Elements Example
101
+ Plugin URI: http://davidlingren.com/
102
+ Description: Provides shortcodes to improve user experience for [mla_term_list], [mla_tag_cloud] and [mla_gallery] shortcodes
103
+ Author: David Lingren
104
+ Version: 1.16
105
+ Author URI: http://davidlingren.com/
106
+
107
+ Copyright 2016-2021 David Lingren
108
+
109
+ This program is free software; you can redistribute it and/or modify
110
+ it under the terms of the GNU General Public License as published by
111
+ the Free Software Foundation; either version 2 of the License, or
112
+ (at your option) any later version.
113
+
114
+ This program is distributed in the hope that it will be useful,
115
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
116
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
117
+ GNU General Public License for more details.
118
+
119
+ You can get a copy of the GNU General Public License by writing to the
120
+ Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
121
+ */
122
+
123
+ /**
124
+ * Class MLA UI Elements Example provides shortcodes to improve user experience for
125
+ * [mla_term_list], [mla_tag_cloud] and [mla_gallery] shortcodes
126
+ *
127
+ * @package MLA UI Elements Example
128
+ * @since 1.00
129
+ */
130
+ class MLAUIElementsExample {
131
+ /**
132
+ * Plugin version number for debug logging
133
+ *
134
+ * @since 1.14
135
+ *
136
+ * @var integer
137
+ */
138
+ const PLUGIN_VERSION = '1.16';
139
+
140
+ /**
141
+ * Constant to log this plugin's debug activity
142
+ *
143
+ * @since 1.14
144
+ *
145
+ * @var integer
146
+ */
147
+ const MLA_DEBUG_CATEGORY = 0x00008000;
148
+
149
+ /**
150
+ * Slug prefix for registering and enqueueing submenu pages, style sheets, scripts and settings
151
+ *
152
+ * @since 1.14
153
+ *
154
+ * @var string
155
+ */
156
+ const SLUG_PREFIX = 'mlauielementsexample';
157
+
158
+ /**
159
+ * Configuration values for the Settings Management object
160
+ *
161
+ * @since 1.14
162
+ *
163
+ * @var array
164
+ */
165
+ private static $settings_arguments = array(
166
+ 'slug_prefix' => self::SLUG_PREFIX,
167
+ 'plugin_title' => 'MLA UI Elements Example',
168
+ 'menu_title' => 'MLA UI Elements',
169
+ 'plugin_file_name_only' => 'mla-ui-elements-example',
170
+ 'plugin_version' => self::PLUGIN_VERSION,
171
+ 'template_file' => '/admin-settings-page.tpl', // Add the path at runtime, in initialize()
172
+ 'options' => array( // 'slug' => array( 'type' => 'text|checkbox', 'default' => 'text|boolean' )
173
+ 'checkbox' =>array( 'type' => 'checkbox', 'default' => true ),
174
+ 'text' =>array( 'type' => 'text', 'default' => 'custom:' ),
175
+ ),
176
+ 'general_tab_values' => array(), // additional page_values for 'page-level-options' template
177
+ 'documentation_tab_values' => array(
178
+ 'plugin_title' => 'MLA UI Elements Example',
179
+ ), // page_values for 'documentation-tab' template
180
+ );
181
+
182
+ /**
183
+ * Settings Management object
184
+ *
185
+ * @since 1.14
186
+ *
187
+ * @var array
188
+ */
189
+ private static $plugin_settings = NULL;
190
+
191
+ /**
192
+ * Initialization function, similar to __construct()
193
+ *
194
+ * @since 1.00
195
+ */
196
+ public static function initialize() {
197
+ // This plugin requires MLA
198
+ if ( ! class_exists( 'MLACore', false ) ) {
199
+ return;
200
+ }
201
+
202
+ // The plugin settings class is shared with other MLA example plugins
203
+ if ( ! class_exists( 'MLAExamplePluginSettings101' ) ) {
204
+ require_once( pathinfo( __FILE__, PATHINFO_DIRNAME ) . '/class-mla-example-plugin-settings-101.php' );
205
+ }
206
+
207
+ // Add the run-time values to the arguments
208
+ self::$settings_arguments['template_file'] = dirname( __FILE__ ) . self::$settings_arguments['template_file'];
209
+
210
+ // Create our own settings object
211
+ self::$plugin_settings = new MLAExamplePluginSettings101( self::$settings_arguments );
212
+
213
+ // The remaining filters are only useful for front-end posts/pages; exit if in the admin section
214
+ if ( is_admin() )
215
+ return;
216
+
217
+ add_filter( 'mla_term_list_attributes', 'MLAUIElementsExample::mla_term_list_attributes', 10, 1 );
218
+ add_filter( 'mla_gallery_attributes', 'MLAUIElementsExample::mla_gallery_attributes', 10, 1 );
219
+
220
+ // Add the custom shortcode for generating "sticky" term search text box
221
+ add_shortcode( 'muie_terms_search', 'MLAUIElementsExample::muie_terms_search' );
222
+
223
+ // Add the custom shortcode for generating "sticky" keyword search text box
224
+ add_shortcode( 'muie_keyword_search', 'MLAUIElementsExample::muie_keyword_search' );
225
+
226
+ // Add the custom shortcode for generating the items per page text box
227
+ add_shortcode( 'muie_per_page', 'MLAUIElementsExample::muie_per_page' );
228
+
229
+ // Add the custom shortcode for generating the order by dropdown control
230
+ add_shortcode( 'muie_orderby', 'MLAUIElementsExample::muie_orderby' );
231
+
232
+ // Add the custom shortcode for generating the order radio buttons
233
+ add_shortcode( 'muie_order', 'MLAUIElementsExample::muie_order' );
234
+
235
+ // Add the custom shortcode for generating assigned terms counts
236
+ add_shortcode( 'muie_assigned_items_count', 'MLAUIElementsExample::muie_assigned_items_count' );
237
+
238
+ // Add the custom shortcode for generic text boxes
239
+ add_shortcode( 'muie_text_box', 'MLAUIElementsExample::muie_text_box' );
240
+
241
+ // Add the custom shortcode for generating archive lists
242
+ add_shortcode( 'muie_archive_list', 'MLAUIElementsExample::muie_archive_list_shortcode' );
243
+ }
244
+
245
+ /**
246
+ * Pass mla_control_name parameters from [mla_term_list] to [mla_gallery] for muie_filters
247
+ *
248
+ * @since 1.05
249
+ *
250
+ * @var array [ $mla_control_name ] = $_REQUEST[ $mla_control_name ]
251
+ */
252
+ private static $mla_control_names = array();
253
+
254
+ /**
255
+ * Pass term_id/slug choices from [mla_term_list] to [mla_gallery] for muie_filters
256
+ *
257
+ * @since 1.07
258
+ *
259
+ * @var array [ taxonomy ] = 'term_id' or 'slug'
260
+ */
261
+ private static $mla_option_values = array();
262
+
263
+ /**
264
+ * Look for 'muie_filters' that pass the selected parameters from page to page of a paginated gallery
265
+ *
266
+ * @since 1.00
267
+ *
268
+ * @param array the shortcode parameters passed in to the shortcode
269
+ */
270
+ public static function mla_term_list_attributes( $shortcode_attributes ) {
271
+ // Exit if this is not a "filtered" term list
272
+ $use_filters = !empty( $shortcode_attributes['use_filters'] ) && ( 'true' === trim ( strtolower( $shortcode_attributes['use_filters'] ) ) );
273
+ unset( $shortcode_attributes['use_filters'] );
274
+ if ( !$use_filters ) {
275
+ return $shortcode_attributes;
276
+ }
277
+
278
+ $muie_debug = ( !empty( $shortcode_attributes['muie_debug'] ) ) ? trim( strtolower( $shortcode_attributes['muie_debug'] ) ) : false;
279
+ unset( $shortcode_attributes['muie_debug'] );
280
+ if ( $muie_debug ) {
281
+ if ( 'true' === $muie_debug ) {
282
+ MLACore::mla_debug_mode( 'buffer' );
283
+ } elseif ( 'log' === $muie_debug ) {
284
+ MLACore::mla_debug_mode( 'log' );
285
+ } else {
286
+ $muie_debug = false;
287
+ }
288
+ }
289
+
290
+ if ( $muie_debug ) {
291
+ MLACore::mla_debug_add( __LINE__ . ' MLAUIElementsExample::mla_term_list_attributes input = ' . var_export( $shortcode_attributes, true ) );
292
+ }
293
+
294
+ // Pass "slug" overides to mla_gallery_attributes; using the slug is a common practice
295
+ if ( empty( $shortcode_attributes['mla_option_value'] ) ) {
296
+ $mla_option_value = 'term_id';
297
+ } else {
298
+ $mla_option_value = in_array( $shortcode_attributes['mla_option_value'], array( '{+slug+}', '[+slug+]' ) ) ? 'slug' : 'term_id';
299
+ }
300
+
301
+ foreach( explode( ',', $shortcode_attributes['taxonomy'] ) as $taxonomy ) {
302
+ self::$mla_option_values[ $taxonomy ] = $mla_option_value;
303
+ }
304
+
305
+ // Allow for multiple taxonomies and named controls
306
+ $taxonomy = implode( '-', explode( ',', $shortcode_attributes['taxonomy'] ) );
307
+ $mla_control_name = !empty( $shortcode_attributes['mla_control_name'] ) ? $shortcode_attributes['mla_control_name'] : false;
308
+ if ( $mla_control_name ) {
309
+ // Handle default 'tax_input[[+taxonomy+]][]' values
310
+ if ( $index = strpos( $mla_control_name, '[]' ) ) {
311
+ $mla_control_name = substr( $mla_control_name, 0, $index );
312
+ }
313
+ }
314
+
315
+ // Pagination links, e.g. Previous or Next, have muie_filters that encode the form parameters
316
+ if ( !empty( $_REQUEST['muie_filters'] ) ) {
317
+ $filters = json_decode( trim( stripslashes( $_REQUEST['muie_filters'] ), '"' ), true );
318
+
319
+ if ( !empty( $filters['tax_input'] ) ) {
320
+ $_REQUEST['tax_input'] = $filters['tax_input'];
321
+ }
322
+
323
+ if ( $mla_control_name && !empty( $filters[ $mla_control_name ] ) ) {
324
+ $_REQUEST[ $mla_control_name ] = $filters[ $mla_control_name ];
325
+ }
326
+ }
327
+
328
+ // Check for a named control with possible taxonomy.term values from "combined" taxonomies
329
+ if ( $mla_control_name && !empty( $_REQUEST[ $mla_control_name ] ) ) {
330
+ self::$mla_control_names[ $mla_control_name ] = $_REQUEST[ $mla_control_name ];
331
+ if ( is_scalar( $_REQUEST[ $mla_control_name ] ) ) {
332
+ $input = array( $_REQUEST[ $mla_control_name ] );
333
+ } else {
334
+ $input = $_REQUEST[ $mla_control_name ];
335
+ }
336
+
337
+ foreach( $input as $input_element ) {
338
+ $value = explode( '.', $input_element );
339
+
340
+ if ( 2 === count( $value ) ) {
341
+ $taxonomy = $value[0];
342
+ $_REQUEST['tax_input'][ $taxonomy ][] = $value[1];
343
+ } else {
344
+ $_REQUEST['tax_input'][ $taxonomy ][] = $input_element;
345
+ }
346
+ }
347
+ }
348
+
349
+ // If nothing is set for this taxonomy we're done
350
+ if ( empty( $_REQUEST['tax_input'] ) || !array_key_exists( $taxonomy, $_REQUEST['tax_input'] ) ) {
351
+ if ( $muie_debug ) {
352
+ MLACore::mla_debug_add( __LINE__ . ' MLAUIElementsExample::mla_term_list_attributes no changes' );
353
+ }
354
+
355
+ return $shortcode_attributes;
356
+ }
357
+
358
+ $terms = $_REQUEST['tax_input'][ $taxonomy ];
359
+ if ( is_string( $terms ) ) {
360
+ $terms = (array) trim( stripslashes( $terms ), ' \'"' );
361
+ }
362
+
363
+ // Check for a dropdown control with "All Terms" selected
364
+ if ( empty( $shortcode_attributes['option_all_value'] ) ) {
365
+ $option_all = array_search( '0', $terms );
366
+ } else {
367
+ $option_all = array_search( $shortcode_attributes['option_all_value'], $terms );
368
+ }
369
+
370
+ if ( false !== $option_all ) {
371
+ unset( $terms[ $option_all ] );
372
+ }
373
+
374
+ if ( empty( $shortcode_attributes['option_all_text'] ) ) {
375
+ $option_all = array_search( '', $terms );
376
+ } else {
377
+ $option_all = array_search( sanitize_title( $shortcode_attributes['option_all_text'] ), $terms );
378
+ }
379
+
380
+ if ( false !== $option_all ) {
381
+ unset( $terms[ $option_all ] );
382
+ }
383
+
384
+ // Reflect option_all changes in the query arguments
385
+ $_REQUEST['tax_input'][ $taxonomy ] = $terms;
386
+ if ( $muie_debug ) {
387
+ MLACore::mla_debug_add( __LINE__ . ' MLAUIElementsExample::mla_term_list_attributes tax_input = ' . var_export( $_REQUEST['tax_input'], true ) );
388
+ }
389
+
390
+ // Pass selected terms to the shortcode
391
+ if ( !empty( $terms ) ) {
392
+ if ( $mla_control_name && !empty( $_REQUEST[ $mla_control_name ] ) ) {
393
+ $shortcode_attributes[ $shortcode_attributes['mla_item_parameter'] ] = $_REQUEST[ $mla_control_name ];
394
+ } else {
395
+ $shortcode_attributes[ $shortcode_attributes['mla_item_parameter'] ] = implode( ',', $_REQUEST['tax_input'][ $taxonomy ] );
396
+ }
397
+ }
398
+
399
+ if ( $muie_debug ) {
400
+ MLACore::mla_debug_add( __LINE__ . ' MLAUIElementsExample::mla_term_list_attributes returns = ' . var_export( $shortcode_attributes, true ) );
401
+ }
402
+
403
+ return $shortcode_attributes;
404
+ } // mla_term_list_attributes
405
+
406
+ /**
407
+ * Add the taxonomy, terms, keyword queries and sort parameters to the shortcode,
408
+ * limit posts_per_page and encode filters for pagination links
409
+ *
410
+ * @since 1.00
411
+ *
412
+ * @param array the shortcode parameters passed in to the shortcode
413
+ */
414
+ public static function mla_gallery_attributes( $shortcode_attributes ) {
415
+ // Look for date archive option
416
+ $archive_parameter_name = !empty( $shortcode_attributes['archive_parameter_name'] ) ? $shortcode_attributes['archive_parameter_name'] : false;
417
+ if ( $archive_parameter_name ) {
418
+ if ( empty( $shortcode_attributes['add_filters_to'] ) ) {
419
+ $shortcode_attributes['add_filters_to'] = 'any';
420
+ }
421
+
422
+ unset( $shortcode_attributes['archive_parameter_name'] );
423
+ }
424
+
425
+ // Only process shortcodes that allow filters
426
+ if ( empty( $shortcode_attributes['add_filters_to'] ) ) {
427
+ return $shortcode_attributes;
428
+ }
429
+
430
+ $muie_debug = ( !empty( $shortcode_attributes['muie_debug'] ) ) ? trim( strtolower( $shortcode_attributes['muie_debug'] ) ) : false;
431
+ unset( $shortcode_attributes['muie_debug'] );
432
+ if ( $muie_debug ) {
433
+ if ( 'true' === $muie_debug ) {
434
+ MLACore::mla_debug_mode( 'buffer' );
435
+ } elseif ( 'log' === $muie_debug ) {
436
+ MLACore::mla_debug_mode( 'log' );
437
+ } else {
438
+ $muie_debug = false;
439
+ }
440
+ }
441
+
442
+ if ( $muie_debug ) {
443
+ MLACore::mla_debug_add( __LINE__ . ' MLAUIElementsExample::mla_gallery_attributes raw input = ' . var_export( $shortcode_attributes, true ) );
444
+ }
445
+
446
+ // Unpack filter values encoded for pagination links
447
+ if ( !empty( $_REQUEST['muie_filters'] ) ) {
448
+ $filters = json_decode( trim( stripslashes( $_REQUEST['muie_filters'] ), '"' ), true );
449
+
450
+ foreach( $filters as $filter_key => $filter_value ) {
451
+ $_REQUEST[ $filter_key ] = $filter_value;
452
+ }
453
+ }
454
+
455
+ // Adjust posts_per_page/numberposts
456
+ if ( !empty( $_REQUEST['muie_per_page'] ) ) {
457
+ unset( $shortcode_attributes['numberposts'] );
458
+ $shortcode_attributes['posts_per_page'] = $_REQUEST['muie_per_page'];
459
+ }
460
+
461
+ if ( $muie_debug ) {
462
+ MLACore::mla_debug_add( __LINE__ . ' MLAUIElementsExample::mla_gallery_attributes filtered input = ' . var_export( $shortcode_attributes, true ) );
463
+ }
464
+
465
+ // Fill these in from $_REQUEST parameters
466
+ $muie_filters = array();
467
+
468
+ /*
469
+ * Special handling of the current archive parameter to make archive processing easier.
470
+ * Look for this parameter in $_REQUEST if it's not present in the shortcode itself.
471
+ */
472
+ if ( empty( $shortcode_attributes[ $archive_parameter_name ] ) && !empty( $_REQUEST[ $archive_parameter_name ] ) ) {
473
+ $shortcode_attributes[ $archive_parameter_name ] = $_REQUEST[ $archive_parameter_name ];
474
+ }
475
+
476
+ if ( !empty( $shortcode_attributes[ $archive_parameter_name ] ) ) {
477
+ $muie_filters[ $archive_parameter_name ] = $shortcode_attributes[ $archive_parameter_name ];
478
+ $shortcode_attributes = self::_translate_current_archive( $shortcode_attributes, $archive_parameter_name );
479
+ unset( $shortcode_attributes[ $archive_parameter_name ] );
480
+ }
481
+
482
+ $mla_control_name = !empty( $shortcode_attributes['mla_control_name'] ) ? $shortcode_attributes['mla_control_name'] : '';
483
+ if ( !empty( $_REQUEST[ $mla_control_name ] ) ) {
484
+ $muie_filters[ $mla_control_name ] = $_REQUEST[ $mla_control_name ];
485
+ }
486
+
487
+ // Add the orderby & order parameters
488
+ if ( !empty( $_REQUEST['muie_orderby'] ) ) {
489
+ $muie_filters['muie_orderby'] = $shortcode_attributes['orderby'] = $_REQUEST['muie_orderby'];
490
+ }
491
+
492
+ if ( !empty( $_REQUEST['muie_meta_key'] ) ) {
493
+ $muie_filters['muie_meta_key'] = $shortcode_attributes['meta_key'] = $_REQUEST['muie_meta_key'];
494
+ }
495
+
496
+ if ( !empty( $_REQUEST['muie_order'] ) ) {
497
+ $muie_filters['muie_order'] = $shortcode_attributes['order'] = $_REQUEST['muie_order'];
498
+ }
499
+
500
+ // Flag for the "empty_default_gallery" parameter
501
+ $default_gallery = true;
502
+
503
+ // Add the terms search parameters, if present
504
+ if ( !empty( $_REQUEST['muie_terms_search'] ) && is_array( $_REQUEST['muie_terms_search'] ) && !empty( $_REQUEST['muie_terms_search']['mla_terms_phrases'] ) ) {
505
+ $default_gallery = false;
506
+ $muie_filters['muie_terms_search'] = $_REQUEST['muie_terms_search'];
507
+ foreach( $muie_filters['muie_terms_search'] as $key => $value ) {
508
+ if ( !empty( $value ) ) {
509
+ $shortcode_attributes[ $key ] = $value;
510
+ }
511
+ }
512
+ }
513
+
514
+ // Add the keyword search parameters, if present
515
+ if ( !empty( $_REQUEST['muie_keyword_search'] ) && is_array( $_REQUEST['muie_keyword_search'] ) && !empty( $_REQUEST['muie_keyword_search']['s'] ) ) {
516
+ $default_gallery = false;
517
+ $muie_filters['muie_keyword_search'] = $_REQUEST['muie_keyword_search'];
518
+ foreach( $muie_filters['muie_keyword_search'] as $key => $value ) {
519
+ if ( !empty( $value ) ) {
520
+ $shortcode_attributes[ $key ] = $value;
521
+ }
522
+ }
523
+ }
524
+
525
+ // Add the taxonomy filter(s), if present
526
+ $filter_taxonomy = $shortcode_attributes['add_filters_to'];
527
+ if ( !empty( $_REQUEST['tax_input'] ) ) {
528
+ $muie_filters['tax_input'] = $tax_input = $_REQUEST['tax_input'];
529
+ } else {
530
+ $tax_input = array();
531
+ }
532
+
533
+ // Add in any simple taxonomy query shortcode parameters
534
+ if ( !empty( $shortcode_attributes ) ) {
535
+ $all_taxonomies = get_taxonomies( array ( 'show_ui' => true ), 'names' );
536
+ $simple_tax_queries = array();
537
+ foreach ( $shortcode_attributes as $key => $value ) {
538
+ if ( 'tax_input' === $key ) {
539
+ $tax_queries = array();
540
+ $compound_values = array_filter( array_map( 'trim', explode( ',', $value ) ) );
541
+ foreach ( $compound_values as $compound_value ) {
542
+ $value = explode( '.', $compound_value );
543
+ if ( 2 === count( $value ) ) {
544
+ if ( array_key_exists( $value[0], $all_taxonomies ) ) {
545
+ $tax_queries[ $value[0] ][] = $value[1];
546
+ } // valid taxonomy
547
+ } // valid coumpound value
548
+ } // foreach compound_value
549
+
550
+ foreach( $tax_queries as $key => $value ) {
551
+ $simple_tax_queries[ $key ] = implode(',', $value );
552
+ }
553
+ } // tax_input
554
+ elseif ( array_key_exists( $key, $all_taxonomies ) ) {
555
+ $simple_tax_queries[ $key ] = implode(',', array_filter( array_map( 'trim', explode( ',', $value ) ) ) );
556
+ if ( 'no.terms.assigned' === $simple_tax_queries[ $key ] ) {
557
+ $no_terms_assigned_query = true;
558
+ }
559
+ } // array_key_exists
560
+ } //foreach $shortcode_attributes
561
+
562
+ if ( !empty( $simple_tax_queries ) ) {
563
+ foreach ( $simple_tax_queries as $key => $value ) {
564
+ $tax_input[ $key ] = explode( ',', $value );
565
+ }
566
+ }
567
+ }
568
+
569
+ // Add the [mla_term_list mla_control_name=] parameter(s)
570
+ if ( !empty( self::$mla_control_names ) ) {
571
+ $muie_filters = array_merge( $muie_filters, self::$mla_control_names );
572
+ }
573
+
574
+ if ( ! ( empty( $shortcode_attributes[ $filter_taxonomy ] ) && empty( $tax_input ) ) ) {
575
+ $tax_query = '';
576
+
577
+ // Validate other tax_query parameters or set defaults
578
+ $tax_relation = 'AND';
579
+ if ( isset( $shortcode_attributes['tax_relation'] ) ) {
580
+ $attr_value = strtoupper( $shortcode_attributes['tax_relation'] );
581
+ if ( in_array( $attr_value, array( 'AND', 'OR' ) ) ) {
582
+ $tax_relation = $attr_value;
583
+ }
584
+ }
585
+
586
+ $default_operator = 'IN';
587
+ if ( isset( $shortcode_attributes['tax_operator'] ) ) {
588
+ $attr_value = strtoupper( $shortcode_attributes['tax_operator'] );
589
+ if ( in_array( $attr_value, array( 'IN', 'NOT IN', 'AND' ) ) ) {
590
+ $default_operator = $attr_value;
591
+ }
592
+ }
593
+
594
+ $default_children = 'true';
595
+ if ( isset( $shortcode_attributes[ 'tax_include_children' ] ) ) {
596
+ $attr_value = strtolower( $shortcode_attributes[ 'tax_include_children' ] );
597
+ if ( in_array( $attr_value, array( 'false', 'true' ) ) ) {
598
+ $default_children = $attr_value;
599
+ }
600
+ }
601
+
602
+ // Look for the optional "simple taxonomy query" as an initial filter
603
+ if ( !empty( $shortcode_attributes[ $filter_taxonomy ] ) ) {
604
+ if ( 'muie-no-terms' !== $shortcode_attributes[ $filter_taxonomy ] ) {
605
+ // Check for a dropdown control with "All Terms" selected
606
+ $terms = explode( ',', $shortcode_attributes[ $filter_taxonomy ] );
607
+ if ( empty( $shortcode_attributes['option_all_value'] ) ) {
608
+ $option_all = array_search( '0', $terms );
609
+ } else {
610
+ $option_all = array_search( $shortcode_attributes['option_all_value'], $terms );
611
+ }
612
+
613
+ if ( false !== $option_all ) {
614
+ unset( $terms[ $option_all ] );
615
+ }
616
+
617
+ if ( !empty( $terms ) ) {
618
+ $values = "array( '" . implode( "', '", $terms ) . "' )";
619
+ $tax_query .= "array('taxonomy' => '{$filter_taxonomy}' ,'field' => 'slug','terms' => {$values}, 'operator' => '{$default_operator}', 'include_children' => {$default_children} ), ";
620
+ }
621
+ }
622
+
623
+ unset( $shortcode_attributes[ $filter_taxonomy ] );
624
+ }
625
+
626
+ foreach ( $tax_input as $taxonomy => $terms ) {
627
+ // simple taxonomy query overrides tax_input
628
+ if ( $taxonomy === $filter_taxonomy ) {
629
+ continue;
630
+ }
631
+
632
+ // Check for a dropdown control with "All Terms" selected
633
+ if ( empty( $shortcode_attributes['option_all_value'] ) ) {
634
+ $option_all = array_search( '0', $terms );
635
+ } else {
636
+ $option_all = array_search( $shortcode_attributes['option_all_value'], $terms );
637
+ }
638
+
639
+ if ( false !== $option_all ) {
640
+ unset( $terms[ $option_all ] );
641
+ }
642
+
643
+ if ( !empty( $terms ) ) {
644
+ // Numeric values could still be a slug
645
+ $field = ( !empty( self::$mla_option_values[ $taxonomy ] ) ) ? self::$mla_option_values[ $taxonomy ] : 'term_id';
646
+ foreach ( $terms as $term ) {
647
+ if ( ! ctype_digit( $term ) ) {
648
+ $field = 'slug';
649
+ break;
650
+ }
651
+ }
652
+
653
+ if ( 'term_id' === $field ) {
654
+ $values = 'array( ' . implode( ',', $terms ) . ' )';
655
+ } else {
656
+ $values = "array( '" . implode( "','", $terms ) . "' )";
657
+ }
658
+
659
+ // Taxonomy-specific "operator"
660
+ $tax_operator = $default_operator;
661
+ if ( isset( $shortcode_attributes[ $taxonomy . '_operator' ] ) ) {
662
+ $attr_value = strtoupper( $shortcode_attributes[ $taxonomy . '_operator' ] );
663
+ if ( in_array( $attr_value, array( 'IN', 'NOT IN', 'AND' ) ) ) {
664
+ $tax_operator = $attr_value;
665
+ }
666
+ }
667
+
668
+ // Taxonomy-specific "include_children"
669
+ $tax_children = $default_children;
670
+ if ( isset( $shortcode_attributes[ $taxonomy . '_children' ] ) ) {
671
+ $attr_value = strtolower( $shortcode_attributes[ $taxonomy . '_children' ] );
672
+ if ( in_array( $attr_value, array( 'false', 'true' ) ) ) {
673
+ $tax_children = $attr_value;
674
+ }
675
+ }
676
+
677
+ $tax_query .= "array('taxonomy' => '{$taxonomy}' ,'field' => '{$field}','terms' => {$values}, 'operator' => '{$tax_operator}', 'include_children' => {$tax_children} ), ";
678
+ }
679
+ }
680
+
681
+ if ( !empty( $tax_query ) ) {
682
+ $default_gallery = false;
683
+ $shortcode_attributes['tax_query'] = "array( 'relation' => '" . $tax_relation . "', " . $tax_query . ')';
684
+ }
685
+ }
686
+
687
+ // Check for an initial display of an empty gallery instead of all images.
688
+ if ( $default_gallery && !empty( $shortcode_attributes['default_empty_gallery'] ) ) {
689
+ if ( 'true' === trim( strtolower( $shortcode_attributes['default_empty_gallery'] ) ) ) {
690
+ $shortcode_attributes['s'] = 'mla-default-empty-gallery-keyword-search-string';
691
+ $shortcode_attributes['mla_search_fields'] = 'title';
692
+ }
693
+ }
694
+
695
+ // Add the filter settings to pagination URLs
696
+ if ( !empty( $shortcode_attributes['mla_output'] ) ) {
697
+
698
+ $filters = urlencode( json_encode( $muie_filters ) );
699
+ $shortcode_attributes['mla_link_href'] = '[+new_url+]?[+new_page_text+]&muie_filters=' . $filters;
700
+
701
+ if ( !empty( $shortcode_attributes['posts_per_page'] ) ) {
702
+ $shortcode_attributes['mla_link_href'] .= '&muie_per_page=' . $shortcode_attributes['posts_per_page'];
703
+ }
704
+ }
705
+
706
+ unset( $shortcode_attributes['add_filters_to'] );
707
+
708
+ if ( $muie_debug ) {
709
+ MLACore::mla_debug_add( __LINE__ . ' MLAUIElementsExample::mla_gallery_attributes returns = ' . var_export( $shortcode_attributes, true ) );
710
+ }
711
+
712
+ return $shortcode_attributes;
713
+ } // mla_gallery_attributes
714
+
715
+ /**
716
+ * Terms search generator shortcode
717
+ *
718
+ * This shortcode generates an HTML text box with a default mla_terms_phrases value,
719
+ * and adds hidden parameters for the other Terms Search parameters
720
+ *
721
+ * @since 1.00
722
+ *
723
+ * @param array the shortcode parameters
724
+ *
725
+ * @return string HTML markup for the generated form
726
+ */
727
+ public static function muie_terms_search( $attr ) {
728
+ $default_arguments = array(
729
+ 'mla_terms_phrases' => '',
730
+ 'mla_terms_taxonomies' => '',
731
+ 'mla_phrase_delimiter' => '',
732
+ 'mla_term_delimiter' => '',
733
+ 'mla_phrase_connector' => '',
734
+ 'mla_term_delimiter' => '',
735
+ 'mla_term_connector' => '',
736
+ );
737
+
738
+ // Make sure $attr is an array, even if it's empty
739
+ if ( is_string( $attr ) ) {
740
+ $attr = shortcode_parse_atts( $attr );
741
+ }
742
+
743
+ if ( empty( $attr ) ) {
744
+ $attr = array();
745
+ }
746
+
747
+ // Accept only the attributes we need and supply defaults
748
+ $arguments = shortcode_atts( $default_arguments, $attr );
749
+
750
+ // Pagination links, e.g. Previous or Next, have muie_filters that encode the form parameters
751
+ if ( !empty( $_REQUEST['muie_filters'] ) ) {
752
+ $filters = json_decode( trim( stripslashes( $_REQUEST['muie_filters'] ), '"' ), true );
753
+
754
+ if ( !empty( $filters['muie_terms_search'] ) ) {
755
+ $_REQUEST['muie_terms_search'] = $filters['muie_terms_search'];
756
+ }
757
+ }
758
+
759
+ // muie_terms_search has settings from the form or pagination link
760
+ if ( !empty( $_REQUEST['muie_terms_search'] ) && is_array( $_REQUEST['muie_terms_search'] ) ) {
761
+ foreach ( $arguments as $key => $value ) {
762
+ if ( !empty( $_REQUEST['muie_terms_search'][ $key ] ) ) {
763
+ $arguments[ $key ] = stripslashes( $_REQUEST['muie_terms_search'][ $key ] );
764
+ }
765
+ }
766
+ }
767
+
768
+ // Always supply the terms phrases text box, with the appropriate quoting
769
+ if ( false !== strpos( $arguments['mla_terms_phrases'], '"' ) ) {
770
+ $delimiter = '\'';
771
+ } else {
772
+ $delimiter = '"';
773
+ }
774
+
775
+ $return_value = '<input name="muie_terms_search[mla_terms_phrases]" id="muie-terms-phrases" type="text" size="20" value=' . $delimiter . $arguments['mla_terms_phrases'] . $delimiter . " />\n";
776
+ unset( $arguments['mla_terms_phrases'] );
777
+
778
+ // Add optional parameters
779
+ foreach( $arguments as $key => $value ) {
780
+ if ( !empty( $value ) ) {
781
+ $id_value = str_replace( '_', '-', substr( $key, 4 ) );
782
+ $return_value .= sprintf( '<input name="muie_terms_search[%1$s]" id="muie-%2$s" type="hidden" value="%3$s" />%4$s', $key, $id_value, $value, "\n" );
783
+ }
784
+ }
785
+
786
+ return $return_value;
787
+ } // muie_terms_search
788
+
789
+ /**
790
+ * Keyword search generator shortcode
791
+ *
792
+ * This shortcode generates an HTML text box with a default "s" (search string) value,
793
+ * and adds hidden parameters for the other Keyword Search parameters
794
+ *
795
+ * @since 1.00
796
+ *
797
+ * @param array the shortcode parameters
798
+ *
799
+ * @return string HTML markup for the generated form
800
+ */
801
+ public static function muie_keyword_search( $attr ) {
802
+ $default_arguments = array(
803
+ 's' => '',
804
+ 'mla_search_fields' => '',
805
+ 'mla_search_connector' => '',
806
+ 'sentence' => '',
807
+ 'exact' => '',
808
+ );
809
+
810
+ // Make sure $attr is an array, even if it's empty
811
+ if ( is_string( $attr ) ) {
812
+ $attr = shortcode_parse_atts( $attr );
813
+ }
814
+
815
+ if ( empty( $attr ) ) {
816
+ $attr = array();
817
+ }
818
+
819
+ // Accept only the attributes we need and supply defaults
820
+ $arguments = shortcode_atts( $default_arguments, $attr );
821
+
822
+ // Pagination links, e.g. Previous or Next, have muie_filters that encode the form parameters
823
+ if ( !empty( $_REQUEST['muie_filters'] ) ) {
824
+ $filters = json_decode( trim( stripslashes( $_REQUEST['muie_filters'] ), '"' ), true );
825
+
826
+ if ( !empty( $filters['muie_keyword_search'] ) ) {
827
+ $_REQUEST['muie_keyword_search'] = $filters['muie_keyword_search'];
828
+ }
829
+ }
830
+
831
+ // muie_keyword_search has settings from the form or pagination link
832
+ if ( !empty( $_REQUEST['muie_keyword_search'] ) && is_array( $_REQUEST['muie_keyword_search'] ) ) {
833
+ foreach ( $arguments as $key => $value ) {
834
+ if ( !empty( $_REQUEST['muie_keyword_search'][ $key ] ) ) {
835
+ $arguments[ $key ] = stripslashes( $_REQUEST['muie_keyword_search'][ $key ] );
836
+ }
837
+ }
838
+ }
839
+
840
+ // Always supply the search text box, with the appropriate quoting
841
+ if ( false !== strpos( $arguments['s'], '"' ) ) {
842
+ $delimiter = '\'';
843
+ } else {
844
+ $delimiter = '"';
845
+ }
846
+
847
+ $return_value = '<input name="muie_keyword_search[s]" id="muie-s" type="text" size="20" value=' . $delimiter . $arguments['s'] . $delimiter . " />\n";
848
+ unset( $arguments['s'] );
849
+
850
+ // Add optional parameters
851
+ foreach( $arguments as $key => $value ) {
852
+ if ( !empty( $value ) ) {
853
+ $id_value = str_replace( '_', '-', substr( $key, 4 ) );
854
+ $return_value .= sprintf( '<input name="muie_keyword_search[%1$s]" id="muie-%2$s" type="hidden" value="%3$s" />%4$s', $key, $id_value, $value, "\n" );
855
+ }
856
+ }
857
+
858
+ return $return_value;
859
+ } // muie_keyword_search
860
+
861
+ /**
862
+ * Items per page shortcode
863
+ *
864
+ * This shortcode generates an HTML text box with a default muie_per_page value.
865
+ *
866
+ * @since 1.00
867
+ *
868
+ * @param array the shortcode parameters
869
+ *
870
+ * @return string HTML markup for the generated form
871
+ */
872
+ public static function muie_per_page( $attr ) {
873
+ if ( isset( $attr['numberposts'] ) && ! isset( $attr['posts_per_page'] )) {
874
+ $attr['posts_per_page'] = $attr['numberposts'];
875
+ unset( $attr['numberposts'] );
876
+ }
877
+
878
+ if ( !empty( $_REQUEST['muie_per_page'] ) ) {
879
+ $posts_per_page = $_REQUEST['muie_per_page'];
880
+ } else {
881
+ $posts_per_page = isset( $attr['posts_per_page'] ) ? $attr['posts_per_page'] : 6;
882
+ }
883
+
884
+ return '<input name="muie_per_page" id="muie-per-page" type="text" size="2" value="' . $posts_per_page . '" />';
885
+ } // muie_per_page
886
+
887
+ /**
888
+ * Order by shortcode
889
+ *
890
+ * This shortcode generates a dropdown control with sort order values.
891
+ *
892
+ * @since 1.03
893
+ *
894
+ * @param array $attr the shortcode parameters
895
+ * @param string $content Optional content for enclosing shortcodes
896
+ *
897
+ * @return string HTML markup for the generated control(s)
898
+ */
899
+ public static function muie_orderby( $attr, $content = NULL ) {
900
+ $default_arguments = array(
901
+ 'shortcode' => 'mla_gallery',
902
+ 'sort_fields' => '',
903
+ 'meta_value_num' => '',
904
+ 'meta_value' => '',
905
+ );
906
+
907
+ // Make sure $attr is an array, even if it's empty
908
+ if ( is_string( $attr ) ) {
909
+ $attr = shortcode_parse_atts( $attr );
910
+ }
911
+
912
+ if ( empty( $attr ) ) {
913
+ $attr = array();
914
+ }
915
+
916
+ // Look for parameters in an enclosing shortcode
917
+ if ( !empty( $content ) ) {
918
+ $content = str_replace( array( '&#8216;', '&#8217;', '&#8221;', '&#8243;', '<br />', '<p>', '</p>', "\r", "\n" ), array( '\'', '\'', '"', '"', ' ', ' ', ' ', ' ', ' ' ), $content );
919
+ $new_attr = shortcode_parse_atts( $content );
920
+ $attr = array_merge( $attr, $new_attr );
921
+ }
922
+
923
+ // Accept only the attributes we need and supply defaults
924
+ $arguments = shortcode_atts( $default_arguments, $attr );
925
+
926
+ switch ( $arguments['shortcode'] ) {
927
+ case 'mla_gallery':
928
+ $allowed_fields = array(
929
+ 'empty' => '- select -',
930
+ 'ID' => 'item ID',
931
+ 'author' => 'Author',
932
+ 'date' => 'Date uploaded',
933
+ 'description' => 'Description',
934
+ 'title' => 'Title',
935
+ 'caption' => 'Caption',
936
+ 'slug' => 'name/slug',
937
+ 'parent' => 'Parent ID',
938
+ 'menu_order' => 'Menu order',
939
+ 'mime_type' => 'MIME type',
940
+ 'none' => 'No order',
941
+ 'rand' => 'Random',
942
+ );
943
+ break;
944
+ case 'mla_tag_cloud':
945
+ case 'mla_term_list':
946
+ $allowed_fields = array(
947
+ 'empty' => '- select -',
948
+ 'count' => 'Assigned items',
949
+ 'id' => 'Term ID',
950
+ 'name' => 'Term name',
951
+ 'slug' => 'Term slug',
952
+ 'none' => 'No order',
953
+ 'random' => 'Random',
954
+ );
955
+ break;
956
+ default:
957
+ $allowed_fields = array();
958
+ }
959
+
960
+ if ( empty( $arguments['sort_fields'] ) ) {
961
+ $sort_fields = $allowed_fields;
962
+ } else {
963
+ $sort_fields = array();
964
+
965
+ if ( 0 === strpos( $arguments['sort_fields'], 'array' ) ) {
966
+ $function = @create_function('', 'return ' . $arguments['sort_fields'] . ';' );
967
+ if ( is_callable( $function ) ) {
968
+ $field_array = $function();
969
+ }
970
+
971
+ if ( is_array( $field_array ) ) {
972
+ $sort_fields = $field_array;
973
+ }
974
+ } else {
975
+ foreach( explode( ',', $arguments['sort_fields'] ) as $field ) {
976
+ if ( array_key_exists( $field, $allowed_fields ) ) {
977
+ $sort_fields[ $field ] = $allowed_fields[ $field ];
978
+ }
979
+ }
980
+ }
981
+ }
982
+
983
+ // Check for custom field sorting
984
+ if ( !empty( $arguments['meta_value_num'] ) ) {
985
+ $custom_key = 'meta_value_num';
986
+ $custom_spec = $arguments['meta_value_num'];
987
+ } elseif ( !empty( $arguments['meta_value'] ) ) {
988
+ $custom_key = 'meta_value';
989
+ $custom_spec = $arguments['meta_value'];
990
+ } else {
991
+ $custom_key = '';
992
+ $custom_spec = '';
993
+ }
994
+
995
+ if ( !empty( $custom_spec ) ) {
996
+ $spec_parts = explode( '=>', $custom_spec );
997
+ $spec_key = trim( $spec_parts[0], ' \'"' );
998
+ $spec_suffix = '';
999
+
1000
+ $tail = strrpos( $spec_key, ' DESC' );
1001
+ if ( ! ( false === $tail ) ) {
1002
+ $spec_key = substr( $spec_key, 0, $tail );
1003
+ $spec_suffix = ' DESC';
1004
+ } else {
1005
+ $tail = strrpos( $spec_key, ' ASC' );
1006
+ if ( ! ( false === $tail ) ) {
1007
+ $spec_key = substr( $spec_key, 0, $tail );
1008
+ $spec_suffix = ' ASC';
1009
+ }
1010
+ }
1011
+
1012
+ $spec_label = !empty( $spec_parts[1] ) ? trim( $spec_parts[1], ' \'"' ) : $spec_key;
1013
+ $sort_fields[ $custom_key . $spec_suffix ] = $spec_label;
1014
+ }
1015
+
1016
+ if ( empty( $sort_fields ) ) {
1017
+ return '';
1018
+ }
1019
+
1020
+ // Unpack filter values encoded for pagination links
1021
+ if ( !empty( $_REQUEST['muie_filters'] ) ) {
1022
+ $filters = json_decode( trim( stripslashes( $_REQUEST['muie_filters'] ), '"' ), true );
1023
+
1024
+ if ( isset( $filters['muie_orderby'] ) ) {
1025
+ $_REQUEST['muie_orderby'] = $filters['muie_orderby'];
1026
+ }
1027
+ }
1028
+
1029
+ if ( !empty( $_REQUEST['muie_orderby'] ) ) {
1030
+ $current_value = $_REQUEST['muie_orderby'];
1031
+ } else {
1032
+ $current_value = '';
1033
+ }
1034
+
1035
+ if ( !empty( $spec_key ) ) {
1036
+ $output = '<input name="muie_meta_key" id="muie-meta-key" type="hidden" value="' . $spec_key . '">' . "\n";
1037
+ } else {
1038
+ $output = '';
1039
+ }
1040
+
1041
+ $output .= '<select name="muie_orderby" id="muie-orderby">' . "\n";
1042
+
1043
+ foreach ( $sort_fields as $value => $label ) {
1044
+ $value = 'empty' === $value ? '' : $value;
1045
+
1046
+ $selected = ( $current_value === $value ) ? ' selected=selected ' : ' ';
1047
+
1048
+ $output .= ' <option' . $selected . 'value="' . $value . '">' . $label . "</option>\n";
1049
+ }
1050
+
1051
+ $output .= "</select>\n";
1052
+
1053
+ return $output;
1054
+ } // muie_orderby
1055
+
1056
+ /**
1057
+ * Order (ASC/DESC) shortcode
1058
+ *
1059
+ * This shortcode generates ascending/descending radio buttons.
1060
+ *
1061
+ * @since 1.03
1062
+ *
1063
+ * @param array $attr the shortcode parameters
1064
+ * @param string $content Optional content for enclosing shortcodes
1065
+ *
1066
+ * @return string HTML markup for the generated control(s)
1067
+ */
1068
+ public static function muie_order( $attr, $content = NULL ) {
1069
+ $default_arguments = array(
1070
+ 'default_order' => 'ASC',
1071
+ 'asc_label' => 'Ascending',
1072
+ 'desc_label' => 'Descending',
1073
+ );
1074
+
1075
+ // Make sure $attr is an array, even if it's empty
1076
+ if ( is_string( $attr ) ) {
1077
+ $attr = shortcode_parse_atts( $attr );
1078
+ }
1079
+
1080
+ if ( empty( $attr ) ) {
1081
+ $attr = array();
1082
+ }
1083
+
1084
+ // Look for parameters in an enclosing shortcode
1085
+ if ( !empty( $content ) ) {
1086
+ $content = str_replace( array( '&#8216;', '&#8217;', '&#8221;', '&#8243;', '<br />', '<p>', '</p>', "\r", "\n" ), array( '\'', '\'', '"', '"', ' ', ' ', ' ', ' ', ' ' ), $content );
1087
+ $new_attr = shortcode_parse_atts( $content );
1088
+ $attr = array_merge( $attr, $new_attr );
1089
+ }
1090
+
1091
+ // Accept only the attributes we need and supply defaults
1092
+ $arguments = shortcode_atts( $default_arguments, $attr );
1093
+
1094
+ // Unpack filter values encoded for pagination links
1095
+ if ( !empty( $_REQUEST['muie_filters'] ) ) {
1096
+ $filters = json_decode( trim( stripslashes( $_REQUEST['muie_filters'] ), '"' ), true );
1097
+
1098
+ if ( isset( $filters['muie_order'] ) ) {
1099
+ $_REQUEST['muie_order'] = $filters['muie_order'];
1100
+ }
1101
+ }
1102
+
1103
+ if ( !empty( $_REQUEST['muie_order'] ) ) {
1104
+ $current_value = $_REQUEST['muie_order'];
1105
+ } else {
1106
+ $current_value = $arguments['default_order'];
1107
+ }
1108
+
1109
+ if ( 'DESC' === $current_value ) {
1110
+ $asc_selected = '';
1111
+ $desc_selected = ' checked="checked"';
1112
+ } else {
1113
+ $asc_selected = ' checked="checked"';
1114
+ $desc_selected = '';
1115
+ }
1116
+
1117
+ $output = '<input name="muie_order" id="muie-order-asc" type="radio"' . $asc_selected . ' value="ASC"> ' . $arguments['asc_label'] . '&nbsp;&nbsp;';
1118
+ $output .= '<input name="muie_order" id="muie-order-desc" type="radio"' . $desc_selected . ' value="DESC">' . $arguments['desc_label'] . "&nbsp;&nbsp\n";
1119
+
1120
+ return $output;
1121
+ } // muie_order
1122
+
1123
+ /**
1124
+ * Assigned items count shortcode
1125
+ *
1126
+ * This shortcode returns the number of items assigned to any term(s) in the selected taxonomy
1127
+ *
1128
+ * @since 1.01
1129
+ *
1130
+ * @param array the shortcode parameters
1131
+ *
1132
+ * @return string HTML markup for the generated form
1133
+ */
1134
+ public static function muie_assigned_items_count( $attr ) {
1135
+ global $wpdb;
1136
+
1137
+ $default_arguments = array(
1138
+ 'taxonomy' => '',
1139
+ 'post_type' => 'attachment',
1140
+ 'post_status' => 'inherit',
1141
+ 'post_mime_type' => 'image',
1142
+ );
1143
+
1144
+ // Make sure $attr is an array, even if it's empty
1145
+ if ( is_string( $attr ) ) {
1146
+ $attr = shortcode_parse_atts( $attr );
1147
+ }
1148
+
1149
+ if ( empty( $attr ) ) {
1150
+ $attr = array();
1151
+ }
1152
+
1153
+ // Accept only the attributes we need and supply defaults
1154
+ $arguments = shortcode_atts( $default_arguments, $attr );
1155
+
1156
+ // Build an array of individual clauses that can be filtered
1157
+ $clauses = array( 'fields' => '', 'join' => '', 'where' => '', 'order' => '', 'orderby' => '', 'limits' => '', );
1158
+
1159
+ $clause_parameters = array();
1160
+
1161
+ $clause[] = 'LEFT JOIN `' . $wpdb->term_relationships . '` AS tr ON tt.term_taxonomy_id = tr.term_taxonomy_id';
1162
+ $clause[] = 'LEFT JOIN `' . $wpdb->posts . '` AS p ON tr.object_id = p.ID';
1163
+
1164
+ // Add type and status constraints
1165
+ if ( is_array( $arguments['post_type'] ) ) {
1166
+ $post_types = $arguments['post_type'];
1167
+ } else {
1168
+ $post_types = array( $arguments['post_type'] );
1169
+ }
1170
+
1171
+ $placeholders = array();
1172
+ foreach ( $post_types as $post_type ) {
1173
+ $placeholders[] = '%s';
1174
+ $clause_parameters[] = $post_type;
1175
+ }
1176
+
1177
+ $clause[] = 'AND p.post_type IN (' . join( ',', $placeholders ) . ')';
1178
+
1179
+ if ( is_array( $arguments['post_status'] ) ) {
1180
+ $post_stati = $arguments['post_status'];
1181
+ } else {
1182
+ $post_stati = array( $arguments['post_status'] );
1183
+ }
1184
+
1185
+ $placeholders = array();
1186
+ foreach ( $post_stati as $post_status ) {
1187
+ if ( ( 'private' != $post_status ) || is_user_logged_in() ) {
1188
+ $placeholders[] = '%s';
1189
+ $clause_parameters[] = $post_status;
1190
+ }
1191
+ }
1192
+ $clause[] = 'AND p.post_status IN (' . join( ',', $placeholders ) . ')';
1193
+
1194
+ $clause = join(' ', $clause);
1195
+ $clauses['join'] = $wpdb->prepare( $clause, $clause_parameters );
1196
+
1197
+ // Start WHERE clause with a taxonomy constraint
1198
+ if ( is_array( $arguments['taxonomy'] ) ) {
1199
+ $taxonomies = $arguments['taxonomy'];
1200
+ } else {
1201
+ $taxonomies = array( $arguments['taxonomy'] );
1202
+ }
1203
+
1204
+ foreach ( $taxonomies as $taxonomy ) {
1205
+ if ( ! taxonomy_exists( $taxonomy ) ) {
1206
+ $error = new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy', 'media-library-assistant' ), $taxonomy );
1207
+ return $error;
1208
+ }
1209
+ }
1210
+
1211
+ $clause_parameters = array();
1212
+ $placeholders = array();
1213
+ foreach ($taxonomies as $taxonomy) {
1214
+ $placeholders[] = '%s';
1215
+ $clause_parameters[] = $taxonomy;
1216
+ }
1217
+
1218
+ $clause = array( 'tt.taxonomy IN (' . join( ',', $placeholders ) . ')' );
1219
+ if ( 'all' !== strtolower( $arguments['post_mime_type'] ) ) {
1220
+ $clause[] = str_replace( '%', '%%', wp_post_mime_type_where( $arguments['post_mime_type'], 'p' ) );
1221
+ }
1222
+
1223
+ $clause = join(' ', $clause);
1224
+ $clauses['where'] = $wpdb->prepare( $clause, $clause_parameters );
1225
+
1226
+ // Build the final query
1227
+ $query = array( 'SELECT' );
1228
+ $query[] = 'COUNT(*)'; // 'p.ID'; // $clauses['fields'];
1229
+ $query[] = 'FROM ( SELECT DISTINCT p.ID FROM `' . $wpdb->term_taxonomy . '` AS tt';
1230
+ $query[] = $clauses['join'];
1231
+ $query[] = 'WHERE (';
1232
+ $query[] = $clauses['where'];
1233
+ $query[] = ') ) as subquery';
1234
+
1235
+ $query = join(' ', $query);
1236
+ $count = $wpdb->get_var( $query );
1237
+ return number_format( (float) $count );
1238
+ } // muie_assigned_items_count
1239
+
1240
+ /**
1241
+ * Sticky text box shortcode
1242
+ *
1243
+ * This shortcode generates an HTML text box with a sticky value that survives pagination.
1244
+ *
1245
+ * @since 1.14
1246
+ *
1247
+ * @param array the shortcode parameters
1248
+ *
1249
+ * @return string HTML markup for the generated input control
1250
+ */
1251
+ public static function muie_text_box( $attr ) {
1252
+ $default_arguments = array(
1253
+ 'name' => 'muie_text_box',
1254
+ 'id' => '',
1255
+ 'type' => 'text',
1256
+ 'value' => '',
1257
+ );
1258
+
1259
+ // Make sure $attr is an array, even if it's empty
1260
+ if ( is_string( $attr ) ) {
1261
+ $attr = shortcode_parse_atts( $attr );
1262
+ }
1263
+
1264
+ if ( empty( $attr ) ) {
1265
+ $attr = array();
1266
+ }
1267
+
1268
+ // Accept only the attributes we need and supply defaults
1269
+ $arguments = shortcode_atts( $default_arguments, $attr );
1270
+
1271
+ // Pagination links, e.g. Previous or Next, have muie_filters that encode the form parameters
1272
+ if ( !empty( $_REQUEST['muie_filters'] ) ) {
1273
+ $filters = json_decode( trim( stripslashes( $_REQUEST['muie_filters'] ), '"' ), true );
1274
+
1275
+ if ( !empty( $filters[ $arguments['name'] ] ) ) {
1276
+ $_REQUEST[ $arguments['name'] ] = $filters[ $arguments['name'] ];
1277
+ }
1278
+ }
1279
+
1280
+ // Find the id value
1281
+ if ( empty( $arguments['id'] ) ) {
1282
+ $arguments['id'] = str_replace( '_', '-', $arguments['name'] );
1283
+ }
1284
+
1285
+ // Find the "sticky" value, save for pagination
1286
+ if ( !empty( $_REQUEST[ $arguments['name'] ] ) ) {
1287
+ $arguments['value'] = $_REQUEST[ $arguments['name'] ];
1288
+ self::$mla_control_names[ $arguments['name'] ] = $arguments['value'];
1289
+ }
1290
+
1291
+ // Assemble the standard control attributes
1292
+ $attributes = array();
1293
+ foreach ( $arguments as $key => $value ) {
1294
+ $attributes[] = $key . '="' . $value . '"';
1295
+ unset( $attr[ $key ] );
1296
+ }
1297
+
1298
+ // Add the optional control attributes
1299
+ foreach ( $attr as $key => $value ) {
1300
+ $attributes[] = $key . '="' . $value . '"';
1301
+ }
1302
+
1303
+ // Convert the attributes to a string string
1304
+ $attributes = implode( ' ', $attributes );
1305
+
1306
+ return '<input ' . $attributes . ' />';
1307
+ } // muie_text_box
1308
+
1309
+ /**
1310
+ * Translates muie_current_archive value to [mla_gallery] query arguments
1311
+ *
1312
+ * @since 1.14
1313
+ *
1314
+ * @param array raw shortcode attributes
1315
+ * @param string current parameter name, e.g., muie_current_archive
1316
+ *
1317
+ * @return array updated shortcode attributes
1318
+ */
1319
+ private static function _translate_current_archive( $shortcode_attributes, $archive_parameter_name ) {
1320
+ $current_value = MLAData::mla_get_template_placeholders( '[+' . $shortcode_attributes[ $archive_parameter_name ] . '+]' );
1321
+ $current_value = $current_value[ $shortcode_attributes[ $archive_parameter_name ] ];
1322
+ MLACore::mla_debug_add( __LINE__ . " _translate_current_archive() current_value = " . var_export( $current_value, true ), self::$muie_debug_category );
1323
+
1324
+ $date_query = array( 'column' => $current_value['value'], 'compare' => '=' );
1325
+ switch ( $current_value['format'] ) {
1326
+ case 'D':
1327
+ $date_query['year'] = substr( $current_value['args'], 0, 4 );
1328
+ $date_query['month'] = substr( $current_value['args'], 4, 2 );
1329
+ $date_query['day'] = substr( $current_value['args'], 6, 2 );
1330
+ break;
1331
+ case 'W':
1332
+ $date_query['year'] = substr( $current_value['args'], 0, 4 );
1333
+ $date_query['week'] = substr( $current_value['args'], 4, 2 );
1334
+ break;
1335
+ case 'M':
1336
+ $date_query['year'] = substr( $current_value['args'], 0, 4 );
1337
+ $date_query['month'] = substr( $current_value['args'], 4, 2 );
1338
+ break;
1339
+ case 'Y':
1340
+ $date_query['year'] = substr( $current_value['args'], 0, 4 );
1341
+ }
1342
+
1343
+ // Wrap our query in an outer array to allow for others
1344
+ $date_query = array( $date_query );
1345
+
1346
+ /*/ Add existing queries to our date_query TODO
1347
+ if ( !empty( $shortcode_attributes['date_query'] ) ) {
1348
+ foreach( $clean_request['tax_query'] as $key => $value ) {
1349
+ if ( is_integer( $key ) ) {
1350
+ $mla_tax_query[] = $value;
1351
+ } else {
1352
+ $mla_tax_query[ $key ] = $value;
1353
+ }
1354
+ }
1355
+
1356
+ if ( empty( $mla_tax_query['relation'] ) ) {
1357
+ $mla_tax_query['relation'] = 'AND';
1358
+ }
1359
+ } // existing query */
1360
+
1361
+ if ( 'custom' === $current_value['prefix'] ) {
1362
+ $shortcode_attributes['muie_custom_date_query'] = $date_query;
1363
+ add_filter( 'mla_gallery_query_attributes', 'MLAUIElementsExample::mla_gallery_query_attributes', 10, 1 );
1364
+ } else {
1365
+ $shortcode_attributes['date_query'] = $date_query;
1366
+ }
1367
+
1368
+ MLACore::mla_debug_add( __LINE__ . " _translate_current_archive( $archive_parameter_name ) shortcode_attributes = " . var_export( $shortcode_attributes, true ), self::$muie_debug_category );
1369
+ return $shortcode_attributes;
1370
+ }
1371
+
1372
+ /**
1373
+ * MLA Gallery Query Attributes
1374
+ *
1375
+ * This filter gives you an opportunity to record or modify the arguments passed in to the shortcode
1376
+ * before they are merged with the default arguments used to select the attachments for the gallery.
1377
+ *
1378
+ * The query attributes passed in to this filter are the same as those passed through the
1379
+ * "MLA Gallery (Display) Attributes" filter above. This filter is provided so you can modify
1380
+ * the data selection attributes without disturbing the attributes used for gallery display.
1381
+ *
1382
+ * @since 1.00
1383
+ *
1384
+ * @param array the shortcode parameters passed in to the shortcode
1385
+ *
1386
+ * @return array updated shortcode attributes
1387
+ */
1388
+ public static function mla_gallery_query_attributes( $query_attributes ) {
1389
+ remove_filter( 'mla_gallery_query_attributes', 'MLAUIElementsExample::mla_gallery_query_attributes', 10 );
1390
+
1391
+ if ( !empty( $query_attributes['muie_custom_date_query'] ) ) {
1392
+ self::$custom_date_query = $query_attributes['muie_custom_date_query'];
1393
+ unset( $query_attributes['muie_custom_date_query'] );
1394
+ add_filter( 'posts_clauses_request', 'MLAUIElementsExample::mla_gallery_posts_clauses_request', 10, 2 );
1395
+ }
1396
+
1397
+ return $query_attributes;
1398
+ } // mla_gallery_query_attributes
1399
+
1400
+ /**
1401
+ * Explicit Shortcode Attributes for muie_archive_list
1402
+ *
1403
+ * @since 1.14
1404
+ *
1405
+ * @var array
1406
+ */
1407
+ private static $custom_date_query = NULL;
1408
+
1409
+ /**
1410
+ * Filters all query clauses at once, for convenience.
1411
+ *
1412
+ * For use by caching plugins.
1413
+ *
1414
+ * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT,
1415
+ * fields (SELECT), and LIMITS clauses.
1416
+ *
1417
+ * @since 1.14
1418
+ *
1419
+ * @param string[] $pieces Associative array of the pieces of the query.
1420
+ * @param WP_Query $wp_query The WP_Query instance (passed by reference).
1421
+ */
1422
+ public static function mla_gallery_posts_clauses_request( $pieces, $wp_query ) {
1423
+ global $wpdb;
1424
+
1425
+ remove_filter( 'posts_clauses_request', 'MLAUIElementsExample::mla_gallery_posts_clauses_request', 10 );
1426
+
1427
+ MLACore::mla_debug_add( __LINE__ . " mla_gallery_posts_clauses_request() original pieces = " . var_export( $pieces, true ), self::$muie_debug_category );
1428
+ MLACore::mla_debug_add( __LINE__ . " custom_date_query = " . var_export( self::$custom_date_query, true ), self::$muie_debug_category );
1429
+
1430
+ if ( empty( self::$custom_date_query ) ) {
1431
+ return $pieces;
1432
+ }
1433
+
1434
+ $where = isset( $pieces['where'] ) ? $pieces['where'] : '';
1435
+ $join = isset( $pieces['join'] ) ? $pieces['join'] : '';
1436
+ $query = self::$custom_date_query[0];
1437
+
1438
+ $key = $query['column'];
1439
+
1440
+ $field = $wpdb->postmeta . '.meta_value';
1441
+ $join .= " INNER JOIN {$wpdb->postmeta} ON ( $wpdb->posts.ID = {$wpdb->postmeta}.post_id )";
1442
+ $where .= " AND ( {$wpdb->postmeta}.meta_key = '{$key}' )";
1443
+
1444
+ $compare = $query['compare'];
1445
+ $date_where = '';
1446
+ $prefix = ' AND ( ( ';
1447
+
1448
+ if ( !empty( $query['year'] ) ) {
1449
+ $date_where .= $prefix . " YEAR( {$field} ) {$compare} " . absint( $query['year'] ) . ' )';
1450
+ $prefix = ' AND ( ';
1451
+ }
1452
+
1453
+ if ( !empty( $query['month'] ) ) {
1454
+ $date_where .= $prefix . " MONTH( {$field} ) {$compare} " . absint( $query['month'] ) . ' )';
1455
+ $prefix = ' AND ( ';
1456
+ }
1457
+
1458
+ if ( !empty( $query['week'] ) ) {
1459
+ $date_where .= $prefix . " WEEK( {$field}, 1 ) {$compare} " . absint( $query['week'] ) . ' )';
1460
+ $prefix = ' AND ( ';
1461
+ }
1462
+
1463
+ if ( !empty( $query['day'] ) ) {
1464
+ $date_where .= $prefix . " DAYOFMONTH( {$field} ) {$compare} " . absint( $query['day'] ) . ' )';
1465
+ $prefix = ' AND ( ';
1466
+ }
1467
+
1468
+ if ( !empty( $date_where ) ) {
1469
+ $where = $date_where . ' )' . $where;
1470
+ }
1471
+
1472
+ $pieces['where'] = $where;
1473
+ $pieces['join'] = $join;
1474
+
1475
+ self::$custom_date_query = NULL;
1476
+ MLACore::mla_debug_add( __LINE__ . " mla_gallery_posts_clauses_request() final pieces = " . var_export( $pieces, true ), self::$muie_debug_category );
1477
+ return $pieces;
1478
+ } // mla_gallery_posts_clauses_request
1479
+
1480
+ /**
1481
+ * Replaces or removes a query argument, preserving url encoding
1482
+ *
1483
+ * @since 1.15
1484
+ *
1485
+ * @param string argument name
1486
+ * @param mixed argument value (string) or false to remove argument
1487
+ * @param string url
1488
+ *
1489
+ * @return string url with argument replaced
1490
+ */
1491
+ private static function _replace_query_parameter( $key, $value, $url ) {
1492
+ $parts = wp_parse_url( $url );
1493
+ if ( empty( $parts['path'] ) ) {
1494
+ $parts['path'] = '';
1495
+ }
1496
+
1497
+ // Fragments must come at the end of the URL and be preceded by a #
1498
+ if ( !empty( $parts['fragment'] ) ) {
1499
+ $parts['fragment'] = '#' . $parts['fragment'];
1500
+ } else {
1501
+ $parts['fragment'] = '';
1502
+ }
1503
+
1504
+ $clean_query = array();
1505
+ if ( empty( $parts['query'] ) ) {
1506
+ // No existing query arguments; create query if requested
1507
+ if ( false !== $value ) {
1508
+ $clean_query[ $key ] = $value;
1509
+ }
1510
+ } else {
1511
+ parse_str( $parts['query'], $query );
1512
+
1513
+ $add_it = true;
1514
+ foreach ( $query as $query_key => $query_value ) {
1515
+ // Query argument names cannot have URL special characters
1516
+ if ( $query_key === urldecode( $query_key ) ) {
1517
+ if ( $key === $query_key ) {
1518
+ $add_it = false;
1519
+ // Deleting argument?
1520
+ if ( false === $value ) {
1521
+ continue;
1522
+ }
1523
+
1524
+ $query_value = $value;
1525
+ }
1526
+
1527
+ $clean_query[ $query_key ] = $query_value;
1528
+ }
1529
+ }
1530
+
1531
+ if ( $add_it && ( false !== $value ) ) {
1532
+ $clean_query[ $key ] = $value;
1533
+ }
1534
+ }
1535
+
1536
+ $clean_query = urlencode_deep( $clean_query );
1537
+ $clean_query = build_query( $clean_query );
1538
+
1539
+ // Query arguments must come before the fragment, if any
1540
+ if ( !empty( $clean_query ) ) {
1541
+ return $parts['scheme'] . '://' . $parts['host'] . $parts['path'] . '?' . $clean_query . $parts['fragment'];
1542
+ } else {
1543
+ return $parts['scheme'] . '://' . $parts['host'] . $parts['path'] . $parts['fragment'];
1544
+ }
1545
+ }
1546
+
1547
+ /**
1548
+ * Handles 'paginate_archive' output type
1549
+ *
1550
+ * @since 1.15
1551
+ *
1552
+ * @uses array self::$archive_list_atttr Shortcode parameters, explicit, used by reference
1553
+ * @uses array self::$archive_list_items List item objects, used by reference
1554
+ *
1555
+ * @param array $markup_values Style and list-level substitution parameters, by reference
1556
+ * @param integer $target_key Index in self::$archive_list_items of the current archive item
1557
+ * @param string $list Shortcode output text, by reference
1558
+ *
1559
+ * @return boolean false; appends to &$list
1560
+ */
1561
+ private static function _paginate_links( $markup_values, $target_key, &$list ) {
1562
+ //error_log( __LINE__ . " _paginate_links( {$target_key} ) markup_values = " . var_export( $markup_values, true ), 0 );
1563
+
1564
+ $items = &self::$archive_list_items;
1565
+ //error_log( __LINE__ . " _paginate_links( {$target_key} ) items = " . var_export( $items, true ), 0 );
1566
+ $attr = &self::$archive_list_attr;
1567
+ //error_log( __LINE__ . " _paginate_links( {$target_key} ) attr = " . var_export( $attr, true ), 0 );
1568
+
1569
+ if ( ( 0 > $target_key ) || ( 2 > count( $items ) ) ) {
1570
+ if ( ! empty( $markup_values['option_none_label'] ) ) {
1571
+ $list = self::_process_shortcode_parameter( $markup_values['option_none_label'], $markup_values );
1572
+ }
1573
+
1574
+ return false;
1575
+ }
1576
+
1577
+ $show_all = $prev_next = false;
1578
+ if ( ! empty( $markup_values['archive_qualifier'] ) ) {
1579
+ switch ( $markup_values['archive_qualifier'] ) {
1580
+ case 'show_all':
1581
+ $show_all = true;
1582
+ break;
1583
+ case 'prev_next':
1584
+ $prev_next = true;
1585
+ }
1586
+ }
1587
+
1588
+ $last_key = count( $items ) - 1;
1589
+ $end_size = absint( $markup_values['end_size'] );
1590
+ $mid_size = absint( $markup_values['mid_size'] );
1591
+ $archive_parameter_name = $markup_values['archive_parameter_name'];
1592
+
1593
+ // $mla_page_parameter = $arguments['mla_page_parameter'];
1594
+ // $current_page = $markup_values['current_page'];
1595
+ // $last_page = $markup_values['last_page'];
1596
+ // $posts_per_page = $markup_values['posts_per_page'];
1597
+
1598
+ // $new_target = ( ! empty( $arguments['mla_target'] ) ) ? 'target="' . $arguments['mla_target'] . '" ' : '';
1599
+
1600
+ // these will add to the default classes
1601
+ $new_class = ( ! empty( $arguments['link_class'] ) ) ? ' ' . esc_attr( self::_process_shortcode_parameter( $arguments['link_class'], $markup_values ) ) : '';
1602
+
1603
+ $new_attributes = ( ! empty( $arguments['link_attributes'] ) ) ? esc_attr( self::_process_shortcode_parameter( $arguments['link_attributes'], $markup_values ) ) . ' ' : '';
1604
+
1605
+ $new_base = ( ! empty( $arguments['link_href'] ) ) ? self::_process_shortcode_parameter( $arguments['link_href'], $markup_values ) : $markup_values['page_url'];
1606
+
1607
+ // Build the array of page links
1608
+ $page_links = array();
1609
+ $dots = false;
1610
+
1611
+ if ( $prev_next && $target_key ) {
1612
+ $item_values = array_merge( $markup_values, (array) $items[ $target_key - 1 ] );
1613
+ $new_title = ( ! empty( $item_values['rollover_text'] ) ) ? 'title="' . esc_attr( self::_process_shortcode_parameter( $item_values['rollover_text'], $item_values ) ) . '" ' : '';
1614
+ $new_url = self::_replace_query_parameter( $archive_parameter_name, $item_values['current_value'], $new_base );
1615
+ $prev_text = ( ! empty( $item_values['prev_text'] ) ) ? esc_attr( self::_process_shortcode_parameter( $item_values['prev_text'], $item_values ) ) : '&laquo; ' . __( 'Previous', 'media-library-assistant' );
1616
+ $page_links[] = sprintf( '<a class="prev paginate-archive%1$s" %2$s%3$shref="%4$s">%5$s</a>',
1617
+ /* %1$s */ $new_class,
1618
+ /* %2$s */ $new_attributes,
1619
+ /* %3$s */ $new_title,
1620
+ /* %4$s */ $new_url,
1621
+ /* %5$s */ $prev_text );
1622
+ }
1623
+
1624
+ // for ( $new_page = 1; $new_page <= $last_page; $new_page++ ) {
1625
+ foreach ( $items as $key => $item ) {
1626
+ $item_values = array_merge( $markup_values, (array) $item );
1627
+ $new_title = ( ! empty( $item_values['rollover_text'] ) ) ? 'title="' . esc_attr( self::_process_shortcode_parameter( $item_values['rollover_text'], $item_values ) ) . '" ' : '';
1628
+
1629
+ if ( $key === $target_key ) {
1630
+ // build current item span
1631
+ $page_links[] = sprintf( '<span class="paginate-archive current%1$s">%2$s</span>',
1632
+ /* %1$s */ $new_class,
1633
+ /* %2$s */ $item_values['current_label'] );
1634
+ $dots = true;
1635
+ } else {
1636
+ if ( $show_all || ( $key < $end_size || ( $key >= $target_key - $mid_size && $key <= $target_key + $mid_size ) || $key > $last_key - $end_size ) ) {
1637
+ // build link
1638
+ $new_url = self::_replace_query_parameter( $archive_parameter_name, $item_values['current_value'], $new_base );
1639
+ $page_links[] = sprintf( '<a class="paginate-archive%1$s" %2$s%3$shref="%4$s">%5$s</a>',
1640
+ /* %1$s */ $new_class,
1641
+ /* %2$s */ $new_attributes,
1642
+ /* %3$s */ $new_title,
1643
+ /* %4$s */ $new_url,
1644
+ /* %5$s */ $item_values['current_label'] );
1645
+ $dots = true;
1646
+ } elseif ( $dots && ! $show_all ) {
1647
+ // build link
1648
+ $page_links[] = sprintf( '<span class="paginate-archive dots%1$s">&hellip;</span>',
1649
+ /* %1$s */ $new_class );
1650
+ $dots = false;
1651
+ }
1652
+ } // ! current
1653
+ } // foreach $item
1654
+
1655
+ if ( $prev_next && ( 0 <= $target_key ) && ( $target_key < $last_key ) ) {
1656
+ // build next link
1657
+ $item_values = array_merge( $markup_values, (array) $items[ $target_key + 1 ] );
1658
+ $new_title = ( ! empty( $item_values['rollover_text'] ) ) ? 'title="' . esc_attr( self::_process_shortcode_parameter( $item_values['rollover_text'], $item_values ) ) . '" ' : '';
1659
+ $new_url = self::_replace_query_parameter( $archive_parameter_name, $item_values['current_value'], $new_base );
1660
+ $next_text = ( ! empty( $item_values['next_text'] ) ) ? esc_attr( self::_process_shortcode_parameter( $item_values['next_text'], $item_values ) ) : __( 'Next', 'media-library-assistant' ) . ' &raquo;';
1661
+ $page_links[] = sprintf( '<a class="next paginate-archive%1$s" %2$s%3$shref="%4$s">%5$s</a>',
1662
+ /* %1$s */ $new_class,
1663
+ /* %2$s */ $new_attributes,
1664
+ /* %3$s */ $new_title,
1665
+ /* %4$s */ $new_url,
1666
+ /* %5$s */ $next_text );
1667
+ }
1668
+
1669
+ $list .= join("\n", $page_links);
1670
+ return false;
1671
+ }
1672
+
1673
+ /**
1674
+ * Handles brace/bracket escaping and parses template for a shortcode parameter
1675
+ *
1676
+ * @since 1.14
1677
+ *
1678
+ * @param string raw shortcode parameter, e.g., "text {+field+} {brackets} \\{braces\\}"
1679
+ * @param array template substitution values, e.g., ('instance' => '1', ... )
1680
+ *
1681
+ * @return string parameter with brackets, braces, substitution parameters and templates processed
1682
+ */
1683
+ private static function _process_shortcode_parameter( $text, $markup_values ) {
1684
+ $new_text = str_replace( '{\+', '\[\+', str_replace( '+\}', '+\\\\]', $text ) );
1685
+ $new_text = str_replace( '{', '[', str_replace( '}', ']', $new_text ) );
1686
+ $new_text = str_replace( '\[', '{', str_replace( '\]', '}', $new_text ) );
1687
+ return MLAData::mla_parse_template( $new_text, $markup_values );
1688
+ }
1689
+
1690
+ /**
1691
+ * Compose an mla_archive_list
1692
+ *
1693
+ * Adds shortcode output text and item-specific links to arrays passed by reference.
1694
+ *
1695
+ * @since 1.14
1696
+ *
1697
+ * @uses array self::$archive_list_atttr Shortcode parameters, explicit, used by reference
1698
+ * @uses array self::$archive_list_items List item objects, used by reference
1699
+ *
1700
+ * @param string $list Shortcode output text, by reference
1701
+ * @param array $links Term-specific links for flat/array output, by reference
1702
+ * @param array $markup_values Style and list-level substitution parameters, by reference
1703
+ *
1704
+ * @return boolean True if the list contains the "current_item"; appends to &$list, &$links
1705
+ */
1706
+ public static function compose_archive_list( &$list, &$links, &$markup_values ) {
1707
+ static $page_content = NULL; // for mla_debug_add
1708
+
1709
+ $items = &self::$archive_list_items;
1710
+ $attr = &self::$archive_list_attr;
1711
+
1712
+ $archive_parameter_name = $markup_values['archive_parameter_name'];
1713
+ $is_dropdown = 'dropdown' === $markup_values['archive_output'];
1714
+ $is_list = 'list' === $markup_values['archive_output'];
1715
+ $is_link = in_array( $markup_values['archive_output'], array( 'paginate_archive', 'next_archive', 'current_archive', 'previous_archive' ) );
1716
+
1717
+ // Handle an empty, hidden archive
1718
+ if ( ( 0 === count( $items ) ) && $markup_values['hide_if_empty'] ) {
1719
+ $option_none_label = self::_process_shortcode_parameter( $markup_values['option_none_label'], $markup_values );
1720
+
1721
+ if ( $is_list || $is_dropdown ) {
1722
+ $list .= $option_none_label;
1723
+ } else {
1724
+ if ( !empty( $option_none_label ) ) {
1725
+ $links[] = $option_none_label;
1726
+ }
1727
+ }
1728
+
1729
+ return false;
1730
+ } // empty archive
1731
+
1732
+ // Load the appropriate templates
1733
+ $open_template = '';
1734
+ $item_template = '';
1735
+ $close_template = '';
1736
+ if ( $is_list || $is_dropdown ) {
1737
+ if ( $is_list ) {
1738
+ if ( isset( self::$muie_archive_templates['muie-archive-list-open-markup'] ) ) {
1739
+ $open_template = self::$muie_archive_templates['muie-archive-list-open-markup'];
1740
+ }
1741
+ if ( isset( self::$muie_archive_templates['muie-archive-list-item-markup'] ) ) {
1742
+ $item_template = self::$muie_archive_templates['muie-archive-list-item-markup'];
1743
+ }
1744
+ if ( isset( self::$muie_archive_templates['muie-archive-list-close-markup'] ) ) {
1745
+ $close_template = self::$muie_archive_templates['muie-archive-list-close-markup'];
1746
+ }
1747
+ } elseif ( $is_dropdown ) {
1748
+ if ( isset( self::$muie_archive_templates['muie-archive-dropdown-open-markup'] ) ) {
1749
+ $open_template = self::$muie_archive_templates['muie-archive-dropdown-open-markup'];
1750
+ }
1751
+ if ( isset( self::$muie_archive_templates['muie-archive-dropdown-item-markup'] ) ) {
1752
+ $item_template = self::$muie_archive_templates['muie-archive-dropdown-item-markup'];
1753
+ }
1754
+ if ( isset( self::$muie_archive_templates['muie-archive-dropdown-close-markup'] ) ) {
1755
+ $close_template = self::$muie_archive_templates['muie-archive-dropdown-close-markup'];
1756
+ }
1757
+ }
1758
+
1759
+ // Look for gallery-level markup substitution parameters
1760
+ $new_text = $open_template . $close_template;
1761
+ $markup_values = MLAData::mla_expand_field_level_parameters( $new_text, $attr, $markup_values );
1762
+
1763
+ if ( !empty( $open_template ) ) {
1764
+ $list .= MLAData::mla_parse_template( $open_template, $markup_values );
1765
+ }
1766
+ } // is_list || is_dropdown
1767
+ //error_log( __LINE__ . " compose_archive_list() list = " . var_export( $list, true ), 0 );
1768
+
1769
+ // Find delimiter for currentlink, currentlink_url
1770
+ if ( strpos( $markup_values['page_url'], '?' ) ) {
1771
+ $current_item_delimiter = '&';
1772
+ } else {
1773
+ $current_item_delimiter = '?';
1774
+ }
1775
+
1776
+ // Item values vary by archive type; make sure all elements are defined
1777
+ $item_default_values = array_merge( $markup_values, array(
1778
+ 'current_value' => '',
1779
+ 'current_label_short' => '',
1780
+ 'current_label_long' => '',
1781
+ 'current_label' => '',
1782
+ 'items' => 0,
1783
+ 'year' => '',
1784
+ 'month' => '',
1785
+ 'week' => '',
1786
+ 'day' => '',
1787
+ 'm' => '',
1788
+ 'yyyymmdd' => '',
1789
+ 'month_long' => '',
1790
+ 'month_short' => '',
1791
+ 'week_start_raw' => 0,
1792
+ 'week_start_short' => '',
1793
+ 'week_start' => '',
1794
+ 'week_end_raw' => 0,
1795
+ 'week_end_short' => '',
1796
+ 'week_end' => '',
1797
+
1798
+ 'item_id' => '',
1799
+ 'item_class' => '',
1800
+ 'item_attributes' => '',
1801
+ 'item_selected' => '',
1802
+ 'item_value' => '',
1803
+ 'item_label' => '',
1804
+
1805
+ 'item_link_id' => '',
1806
+ 'item_link_class' => '',
1807
+ 'item_link_rollover' => '',
1808
+ 'item_link_attributes' => '',
1809
+ 'item_link_text' => '',
1810
+
1811
+ 'thelink' => '',
1812
+ 'currentlink' => '',
1813
+ 'viewlink' => '',
1814
+ 'link_url' => '',
1815
+ 'currentlink_url' => '',
1816
+ 'viewlink_url' => '',
1817
+ ) );
1818
+
1819
+ $has_active = false;
1820
+
1821
+ // Handle an empty, visible archive
1822
+ if ( 0 === count( $items ) ) {
1823
+ // Apply the Display Content parameters
1824
+ $attributes = array();
1825
+
1826
+ if ( !empty( $item_default_values['itemtag_id'] ) ) {
1827
+ $item_default_values['item_id'] = self::_process_shortcode_parameter( $item_default_values['itemtag_id'], $item_default_values );
1828
+ $attributes[] = 'id="' . $item_default_values['item_id'] . '"';
1829
+ }
1830
+
1831
+ if ( !empty( $item_default_values['itemtag_class'] ) ) {
1832
+ $item_default_values['item_class'] = self::_process_shortcode_parameter( $item_default_values['itemtag_class'], $item_default_values );
1833
+ if ( !empty( $item_default_values['item_selected'] ) ) {
1834
+ $item_default_values['item_class'] .= ' ' . $item_default_values['current_archive_class'];
1835
+ }
1836
+
1837
+ $attributes[] = 'class="' . $item_default_values['item_class'] . '"';
1838
+ }
1839
+
1840
+ if ( !empty( $item_default_values['itemtag_attributes'] ) ) {
1841
+ $attributes[] = self::_process_shortcode_parameter( $item_default_values['itemtag_attributes'], $item_default_values );
1842
+ }
1843
+
1844
+ if ( !empty( $attributes ) ) {
1845
+ $item_default_values['item_attributes'] = implode( ' ', $attributes ) . ' ';
1846
+ }
1847
+
1848
+ if ( !empty( $item_default_values['option_none_value'] ) ) {
1849
+ $item_default_values['item_value'] = self::_process_shortcode_parameter( $item_default_values['option_none_value'], $item_default_values );
1850
+ } else {
1851
+ $item_default_values['item_value'] = 'no-archives';
1852
+ }
1853
+
1854
+ if ( !empty( $item_default_values['option_none_label'] ) ) {
1855
+ $item_default_values['item_label'] = self::_process_shortcode_parameter( $item_default_values['option_none_label'], $item_default_values );
1856
+ } else {
1857
+ $item_default_values['item_label'] = 'No archives';
1858
+ }
1859
+
1860
+ $item_default_values['thelink'] = $item_default_values['item_label'];
1861
+
1862
+ if ( $is_list || $is_dropdown ) {
1863
+ $list .= MLAData::mla_parse_template( $item_template, $item_default_values );
1864
+ } else {
1865
+ $links[] = $item_default_values['item_label'];
1866
+ }
1867
+
1868
+ MLACore::mla_debug_add( __LINE__ . " compose_archive_list() empty archive, item_default_values = " . var_export( $item_default_values, true ), self::$muie_debug_category );
1869
+ return false;
1870
+ } else { // Empty, visible archive
1871
+
1872
+ // Add the "option all" element, if specified
1873
+ if ( !empty( $item_default_values['option_all_label'] ) ) {
1874
+ // Apply the Display Content parameters
1875
+ $attributes = array();
1876
+
1877
+ if ( !empty( $item_default_values['itemtag_id'] ) ) {
1878
+ $item_default_values['item_id'] = self::_process_shortcode_parameter( $item_default_values['itemtag_id'], $item_default_values );
1879
+ $attributes[] = 'id="' . $item_default_values['item_id'] . '"';
1880
+ }
1881
+
1882
+ if ( !empty( $item_default_values['itemtag_class'] ) ) {
1883
+ $item_default_values['item_class'] = self::_process_shortcode_parameter( $item_default_values['itemtag_class'], $item_default_values );
1884
+ if ( !empty( $item_default_values['item_selected'] ) ) {
1885
+ $item_default_values['item_class'] .= ' ' . $item_default_values['current_archive_class'];
1886
+ }
1887
+
1888
+ $attributes[] = 'class="' . $item_default_values['item_class'] . '"';
1889
+ }
1890
+
1891
+ if ( !empty( $item_default_values['itemtag_attributes'] ) ) {
1892
+ $attributes[] = self::_process_shortcode_parameter( $item_default_values['itemtag_attributes'], $item_default_values );
1893
+ }
1894
+
1895
+ if ( !empty( $attributes ) ) {
1896
+ $item_default_values['item_attributes'] = implode( ' ', $attributes ) . ' ';
1897
+ }
1898
+
1899
+ if ( !empty( $item_default_values['option_all_value'] ) ) {
1900
+ $item_default_values['item_value'] = self::_process_shortcode_parameter( $item_default_values['option_all_value'], $item_default_values );
1901
+ } else {
1902
+ $item_default_values['item_value'] = '';
1903
+ }
1904
+
1905
+ if ( !empty( $item_default_values['option_all_label'] ) ) {
1906
+ $item_default_values['item_label'] = self::_process_shortcode_parameter( $item_default_values['option_all_label'], $item_default_values );
1907
+ } else {
1908
+ $item_default_values['item_label'] = 'Select archive';
1909
+ }
1910
+
1911
+ $item_default_values['thelink'] = $item_default_values['item_label'];
1912
+
1913
+ if ( $is_list || $is_dropdown ) {
1914
+ $list .= MLAData::mla_parse_template( $item_template, $item_default_values );
1915
+ } else {
1916
+ $links[] = $item_default_values['item_label'];
1917
+ }
1918
+ } // Option all value
1919
+ } // non-empty, visible archive
1920
+
1921
+ MLACore::mla_debug_add( __LINE__ . " compose_archive_list() markup_values[ $archive_parameter_name ] = " . var_export( $markup_values[ $archive_parameter_name ], true ), self::$muie_debug_category );
1922
+
1923
+ // Do this once per page load only through MLA Reporting
1924
+ if ( NULL === $page_content ) {
1925
+ $page_content = $item_default_values['page_content'];
1926
+ MLACore::mla_debug_add( __LINE__ . " compose_archive_list() page content = " . var_export( $page_content, true ), self::MLA_DEBUG_CATEGORY );
1927
+ }
1928
+
1929
+ // Expand the items with values needed for all output types including $is_link types
1930
+ foreach ( $items as $key => $item ) {
1931
+ $month_stamp = 0;
1932
+ if ( !empty( $item->month ) ) {
1933
+ $item->m = sprintf( '%1$04d%2$02d', (integer) $item->year, (integer) $item->month );
1934
+
1935
+ if ( !empty( $item->day ) ) {
1936
+ $item->yyyymmdd = sprintf( '%1$04d-%2$02d-%3$02d', (integer) $item->year, (integer) $item->month, (integer) $item->day );
1937
+ $month_stamp = strtotime( $item->yyyymmdd );
1938
+ } else {
1939
+ $month_stamp = strtotime( $item->m . '01' );
1940
+ }
1941
+ } elseif ( !empty( $item->week_start_short ) ) {
1942
+ $month_stamp = strtotime( $item->week_start_short );
1943
+ }
1944
+
1945
+ if ( $month_stamp ) {
1946
+ $item->month_long = date( 'F', $month_stamp );
1947
+ $item->month_short = date( 'M', $month_stamp );
1948
+ }
1949
+
1950
+ // Compute the current_value and current_labels based on the archive type
1951
+ switch ( $markup_values['archive_type'] ) {
1952
+ case 'daily':
1953
+ $item->current_value = sprintf( 'D(%1$04d%2$02d%3$02d)', (integer) $item->year, (integer) $item->month, (integer) $item->day );
1954
+ $item->current_label_short = sprintf( '%1$04d/%2$02d/%3$02d', (integer) $item->year, (integer) $item->month, (integer) $item->day );
1955
+ $item->current_label_long = sprintf( '%1$s %2$02d, %3$04d', $item->month_long, (integer) $item->day, (integer) $item->year );
1956
+ $item->viewlink_url = get_day_link( (integer) $item->year, (integer) $item->month, (integer) $item->day );
1957
+ break;
1958
+ case 'weekly':
1959
+ $item->current_value = sprintf( 'W(%1$04d%2$02d)', (integer) $item->year, (integer) $item->week );
1960
+ $item->current_label_short = $item->week_start_short;
1961
+ $item->current_label_long = $item->week_start;
1962
+ $item->viewlink_url = add_query_arg(
1963
+ array(
1964
+ 'm' => $item->year,
1965
+ 'w' => $item->week,
1966
+ ),
1967
+ home_url( '/' )
1968
+ );
1969
+ break;
1970
+ case 'monthly':
1971
+ $item->current_value = sprintf( 'M(%1$04d%2$02d)', (integer) $item->year, (integer) $item->month );
1972
+ $item->current_label_short = sprintf( '%1$s %2$s', $item->month_short, $item->year );
1973
+ $item->current_label_long = sprintf( '%1$s %2$s', $item->month_long, $item->year );
1974
+ $item->viewlink_url = get_month_link( (integer) $item->year, (integer) $item->month );
1975
+ break;
1976
+ case 'yearly':
1977
+ default:
1978
+ $item->current_value = sprintf( 'Y(%1$04d)', (integer) $item->year );
1979
+ $item->current_label_short = sprintf( '%1$04d', (integer) $item->year );
1980
+ $item->current_label_long = sprintf( '%1$04d', (integer) $item->year );
1981
+ $item->viewlink_url = get_year_link( (integer) $item->year );
1982
+ }
1983
+
1984
+ // Add the archive source to the current value
1985
+ $current_args = ',' . $item->current_value;
1986
+ if ( 'custom' === $markup_values['archive_source'] ) {
1987
+ $item->current_value = 'custom:' . $markup_values['archive_key'] . $current_args;
1988
+ } else {
1989
+ $item->current_value = $markup_values['archive_source'] . $current_args;
1990
+ }
1991
+
1992
+ $item->current_label = ( 'short' === $markup_values['archive_label'] ) ? $item->current_label_short : $item->current_label_long;
1993
+ $item->currentlink_url = sprintf( '%1$s%2$s%3$s=%4$s', $markup_values['page_url'], $current_item_delimiter, $archive_parameter_name, urlencode( $item->current_value ) );
1994
+ $items[ $key ] = $item;
1995
+ }
1996
+ //error_log( __LINE__ . " compose_archive_list() items = " . var_export( $items, true ), 0 );
1997
+
1998
+ // For link outputs, discard all of the items except the appropriate choice
1999
+ if ( $is_link ) {
2000
+ // Remove the style template from the $list
2001
+ $list = '';
2002
+ $link_type = $item_default_values['archive_output'];
2003
+ $is_wrap = in_array( $item_default_values['archive_qualifier'], array( 'wrap', 'always_wrap' ) );
2004
+
2005
+ $target_value = $item_default_values[ $archive_parameter_name ];
2006
+ $target_key = NULL;
2007
+ if ( !empty( $target_value ) ) {
2008
+ foreach ( $items as $key => $item ) {
2009
+ //error_log( __LINE__ . " compose_archive_list( {$key} ) item = " . var_export( $item, true ), 0 );
2010
+ if ( $item->current_value === $target_value ) {
2011
+ $target_key = $key;
2012
+ break;
2013
+ }
2014
+ } // foreach $item
2015
+ }
2016
+
2017
+ // Default to empty/option_none_label
2018
+ if ( NULL === $target_key ) {
2019
+ $target_key = -2;
2020
+ }
2021
+
2022
+ switch ( $link_type ) {
2023
+ case 'paginate_archive':
2024
+ return self::_paginate_links( $item_default_values, $target_key, $list );
2025
+ case 'previous_archive':
2026
+ $target_key = $target_key - 1;
2027
+ break;
2028
+ case 'next_archive':
2029
+ $target_key = $target_key + 1;
2030
+ break;
2031
+ case 'current_archive':
2032
+ default:
2033
+ // no change
2034
+ } // link_type
2035
+
2036
+ $item = NULL;
2037
+ if ( isset( $items[ $target_key ] ) ) {
2038
+ $item = $items[ $target_key ];
2039
+ } elseif ( $is_wrap && ( !empty( $target_value ) || ( 'always_wrap' === $item_default_values['archive_qualifier'] ) ) ) {
2040
+ switch ( $link_type ) {
2041
+ case 'previous_archive':
2042
+ $item = array_pop( $items );
2043
+ break;
2044
+ case 'next_archive':
2045
+ $item = array_shift( $items );
2046
+ } // link_type
2047
+ } // is_wrap
2048
+
2049
+ if ( !empty( $item ) ) {
2050
+ $items = array( $item );
2051
+ } elseif ( ! empty( $item_default_values['option_none_label'] ) ) {
2052
+ $list = self::_process_shortcode_parameter( $item_default_values['option_none_label'], $item_default_values );
2053
+ return false;
2054
+ } else {
2055
+ return false;
2056
+ }
2057
+ }// $is_link
2058
+
2059
+ foreach ( $items as $key => $item ) {
2060
+ //error_log( __LINE__ . " compose_archive_list( {$key} ) item = " . var_export( $item, true ), 0 );
2061
+ // fill in item-specific elements
2062
+ $item_values = array_merge( $item_default_values, (array) $item );
2063
+ //error_log( __LINE__ . " compose_archive_list( {$key} ) item_values = " . var_export( $item_values, true ), 0 );
2064
+
2065
+ /* $month_stamp = 0;
2066
+ if ( !empty( $item_values['month'] ) ) {
2067
+ $item_values['m'] = sprintf( '%1$04d%2$02d', (integer) $item_values['year'], (integer) $item_values['month'] );
2068
+
2069
+ if ( !empty( $item_values['day'] ) ) {
2070
+ $item_values['yyyymmdd'] = sprintf( '%1$04d-%2$02d-%3$02d', (integer) $item_values['year'], (integer) $item_values['month'], (integer) $item_values['day'] );
2071
+ $month_stamp = strtotime( $item_values['yyyymmdd'] );
2072
+ } else {
2073
+ $month_stamp = strtotime( $item_values['m'] . '01' );
2074
+ }
2075
+ } elseif ( !empty( $item_values['week_start_short'] ) ) {
2076
+ $month_stamp = strtotime( $item_values['week_start_short'] );
2077
+ }
2078
+
2079
+ if ( $month_stamp ) {
2080
+ $item_values['month_long'] = date( 'F', $month_stamp );
2081
+ $item_values['month_short'] = date( 'M', $month_stamp );
2082
+ }
2083
+
2084
+ // Compute the current_value and current_labels based on the archive type
2085
+ switch ( $item_values['archive_type'] ) {
2086
+ case 'daily':
2087
+ $item_values['current_value'] = sprintf( 'D(%1$04d%2$02d%3$02d)', (integer) $item_values['year'], (integer) $item_values['month'], (integer) $item_values['day'] );
2088
+ $item_values['current_label_short'] = sprintf( '%1$04d/%2$02d/%3$02d', (integer) $item_values['year'], (integer) $item_values['month'], (integer) $item_values['day'] );
2089
+ $item_values['current_label_long'] = sprintf( '%1$s %2$02d, %3$04d', $item_values['month_long'], (integer) $item_values['day'], (integer) $item_values['year'] );
2090
+ $item_values['viewlink_url'] = get_day_link( (integer) $item_values['year'], (integer) $item_values['month'], (integer) $item_values['day'] );
2091
+ break;
2092
+ case 'weekly':
2093
+ $item_values['current_value'] = sprintf( 'W(%1$04d%2$02d)', (integer) $item_values['year'], (integer) $item_values['week'] );
2094
+ $item_values['current_label_short'] = $item_values['week_start_short'];
2095
+ $item_values['current_label_long'] = $item_values['week_start'];
2096
+ $item_values['viewlink_url'] = add_query_arg(
2097
+ array(
2098
+ 'm' => $item_values['year'],
2099
+ 'w' => $item_values['week'],
2100
+ ),
2101
+ home_url( '/' )
2102
+ );
2103
+ break;
2104
+ case 'monthly':
2105
+ $item_values['current_value'] = sprintf( 'M(%1$04d%2$02d)', (integer) $item_values['year'], (integer) $item_values['month'] );
2106
+ $item_values['current_label_short'] = sprintf( '%1$s %2$s', $item_values['month_short'], $item_values['year'] );
2107
+ $item_values['current_label_long'] = sprintf( '%1$s %2$s', $item_values['month_long'], $item_values['year'] );
2108
+ $item_values['viewlink_url'] = get_month_link( (integer) $item_values['year'], (integer) $item_values['month'] );
2109
+ break;
2110
+ case 'yearly':
2111
+ default:
2112
+ $item_values['current_value'] = sprintf( 'Y(%1$04d)', (integer) $item_values['year'] );
2113
+ $item_values['current_label_short'] = sprintf( '%1$04d', (integer) $item_values['year'] );
2114
+ $item_values['current_label_long'] = sprintf( '%1$04d', (integer) $item_values['year'] );
2115
+ $item_values['viewlink_url'] = get_year_link( (integer) $item_values['year'] );
2116
+ }
2117
+
2118
+ // Add the archive source to the current value
2119
+ $current_args = ',' . $item_values['current_value'];
2120
+ if ( 'custom' === $item_values['archive_source'] ) {
2121
+ $item_values['current_value'] = 'custom:' . $item_values['archive_key'] . $current_args;
2122
+ } else {
2123
+ $item_values['current_value'] = $item_values['archive_source'] . $current_args;
2124
+ }
2125
+
2126
+ $item_values['current_label'] = ( 'short' === $item_values['archive_label'] ) ? $item_values['current_label_short'] : $item_values['current_label_long'];
2127
+ $item_values['currentlink_url'] = sprintf( '%1$s%2$s%3$s=%4$s', $item_values['page_url'], $current_item_delimiter, $archive_parameter_name, urlencode( $item_values['current_value'] ) ); // */
2128
+
2129
+ if ( !empty( $item_default_values['itemtag_id'] ) ) {
2130
+ $item_values['itemtag_id'] = esc_attr( $item_default_values['itemtag_id'] );
2131
+ } else {
2132
+ $item_values['itemtag_id'] = esc_attr( $item_values['listtag_id'] . '-' . $item_values['current_value'] );
2133
+ }
2134
+
2135
+ //error_log( __LINE__ . " compose_archive_list() item_values['current_value'] = " . var_export( $item_values['current_value'], true ), 0 );
2136
+ if ( !empty( $item_values[ $archive_parameter_name ] ) ) {
2137
+ if ( $item_values['current_value'] === $item_values[ $archive_parameter_name ] ) {
2138
+ $has_active = true;
2139
+ $item_values['item_selected'] = 'selected=selected';
2140
+ }
2141
+ }
2142
+
2143
+ // Add item_specific field-level substitution parameters
2144
+ $new_text = isset( $item_template ) ? $item_template : '';
2145
+ foreach( self::$archive_list_item_specific_defaults as $index => $value ) {
2146
+ $new_text .= str_replace( '{+', '[+', str_replace( '+}', '+]', $item_values[ $index ] ) );
2147
+ }
2148
+ //error_log( __LINE__ . " compose_archive_list() new_text = " . var_export( $new_text, true ), 0 );
2149
+
2150
+ $item_values = MLAData::mla_expand_field_level_parameters( $new_text, $attr, $item_values );
2151
+
2152
+ // Apply the Display Content parameters
2153
+ $attributes = array();
2154
+
2155
+ if ( !empty( $item_values['itemtag_id'] ) ) {
2156
+ $item_values['item_id'] = self::_process_shortcode_parameter( $item_values['itemtag_id'], $item_values );
2157
+ $attributes[] = 'id="' . $item_values['item_id'] . '"';
2158
+ }
2159
+
2160
+ if ( !empty( $item_values['itemtag_class'] ) ) {
2161
+ $item_values['item_class'] = self::_process_shortcode_parameter( $item_values['itemtag_class'], $item_values );
2162
+ if ( !empty( $item_values['item_selected'] ) ) {
2163
+ $item_values['item_class'] .= ' ' . $item_values['current_archive_class'];
2164
+ }
2165
+
2166
+ $attributes[] = 'class="' . $item_values['item_class'] . '"';
2167
+ }
2168
+
2169
+ if ( !empty( $item_values['itemtag_attributes'] ) ) {
2170
+ $attributes[] = self::_process_shortcode_parameter( $item_values['itemtag_attributes'], $item_values );
2171
+ }
2172
+
2173
+ if ( !empty( $attributes ) ) {
2174
+ $item_values['item_attributes'] = implode( ' ', $attributes ) . ' ';
2175
+ }
2176
+
2177
+ if ( !empty( $item_values['itemtag_value'] ) ) {
2178
+ $item_values['item_value'] = self::_process_shortcode_parameter( $item_values['itemtag_value'], $item_values );
2179
+ } else {
2180
+ $item_values['item_value'] = $item_values['current_value'];
2181
+ }
2182
+
2183
+ if ( !empty( $item_values['itemtag_label'] ) ) {
2184
+ $item_values['item_label'] = self::_process_shortcode_parameter( $item_values['itemtag_label'], $item_values );
2185
+ } else {
2186
+ $item_values['item_label'] = $item_values['current_label'];
2187
+ }
2188
+
2189
+ // Build the link components
2190
+ $attributes = array();
2191
+
2192
+ if ( !empty( $item_values['link_id'] ) ) {
2193
+ $item_values['item_link_id'] = self::_process_shortcode_parameter( $item_values['link_id'], $item_values );
2194
+ $attributes[] = 'id="' . $item_values['item_link_id'] . '"';
2195
+ }
2196
+
2197
+ if ( !empty( $item_values['link_class'] ) ) {
2198
+ $item_values['item_link_class'] = self::_process_shortcode_parameter( $item_values['link_class'], $item_values );
2199
+ $attributes[] = 'class="' . $item_values['item_link_class'] . '"';
2200
+ }
2201
+
2202
+ if ( !empty( $item_values['rollover_text'] ) ) {
2203
+ $item_values['item_link_rollover'] = self::_process_shortcode_parameter( $item_values['rollover_text'], $item_values );
2204
+ $attributes[] = 'title="' . $item_values['item_link_rollover'] . '"';
2205
+ }
2206
+
2207
+ if ( !empty( $item_values['link_attributes'] ) ) {
2208
+ $attributes[] = self::_process_shortcode_parameter( $item_values['link_attributes'], $item_values );
2209
+ }
2210
+
2211
+ if ( !empty( $attributes ) ) {
2212
+ $item_values['item_link_attributes'] = implode( ' ', $attributes ) . ' ';
2213
+ }
2214
+
2215
+ if ( !empty( $item_values['link_text'] ) ) {
2216
+ $item_values['item_link_text'] = esc_attr( self::_process_shortcode_parameter( $item_values['link_text'], $item_values ) );
2217
+ } else {
2218
+ $item_values['item_link_text'] = $item_values['current_label'];
2219
+ }
2220
+
2221
+ if ( !empty( $item_values['show_count'] ) && ( 'true' === strtolower( $item_values['show_count'] ) ) ) {
2222
+ // Ignore option-all
2223
+ if ( -1 !== $item_values['items'] ) {
2224
+ $item_values['item_label'] .= ' (' . $item_values['items'] . ')';
2225
+ $item_values['item_link_text'] .= ' (' . $item_values['items'] . ')';
2226
+ }
2227
+ }
2228
+
2229
+ if ( !empty( $item_values['link_href'] ) ) {
2230
+ $link_href = self::_process_shortcode_parameter( $item_values['link_href'], $item_values );
2231
+ $item_values['link_url'] = $link_href;
2232
+ } else {
2233
+ $link_href = '';
2234
+ }
2235
+
2236
+ // currentlink, viewlink and thelink
2237
+ $item_values['currentlink'] = sprintf( '<a %1$shref="%2$s">%3$s</a>', $item_values['item_link_attributes'], $item_values['currentlink_url'], $item_values['item_link_text'] );
2238
+ $item_values['viewlink'] = sprintf( '<a %1$shref="%2$s">%3$s</a>', $item_values['item_link_attributes'], $item_values['viewlink_url'], $item_values['item_link_text'] );
2239
+
2240
+ if ( !empty( $item_values['link_url'] ) ) {
2241
+ $item_values['thelink'] = sprintf( '<a %1$shref="%2$s">%3$s</a>', $item_values['item_link_attributes'], $item_values['link_url'], $item_values['item_link_text'] );
2242
+ } elseif ( 'current' === $item_values['link'] ) {
2243
+ $item_values['link_url'] = $item_values['currentlink_url'];
2244
+ $item_values['thelink'] = $item_values['currentlink'];
2245
+ } elseif ( 'view' === $item_values['link'] ) {
2246
+ $item_values['thelink'] = $item_values['viewlink'];
2247
+ } elseif ( 'span' === $item_values['link'] ) {
2248
+ $item_values['thelink'] = sprintf( '<span %1$s>%2$s</span>', $item_values['item_link_attributes'], $item_values['item_link_text'] );
2249
+ } else {
2250
+ $item_values['thelink'] = $item_values['link_text'];
2251
+ }
2252
+
2253
+ // Page content has already been logged and cached
2254
+ $item_values['page_content'] = '';
2255
+ //MLACore::mla_debug_add( __LINE__ . " compose_archive_list() item_values = " . var_export( $item_values, true ), self::$muie_debug_category );
2256
+ $item_values['page_content'] = $page_content;
2257
+
2258
+ if ( $is_list || $is_dropdown ) {
2259
+ $list .= MLAData::mla_parse_template( $item_template, $item_values );
2260
+ } else {
2261
+ $links[] = $item_values['thelink'];
2262
+ }
2263
+ } // foreach item
2264
+
2265
+ if ( $is_list || $is_dropdown ) {
2266
+ $list .= MLAData::mla_parse_template( $close_template, $markup_values );
2267
+ } else {
2268
+ switch ( $markup_values['archive_output'] ) {
2269
+ case 'array' :
2270
+ $list =& $links;
2271
+ break;
2272
+ case 'flat' :
2273
+ default :
2274
+ $list .= join( $markup_values['separator'], $links );
2275
+ break;
2276
+ } // switch format
2277
+ }
2278
+
2279
+ //error_log( __LINE__ . " compose_archive_list() links = " . var_export( $links, true ), 0 );
2280
+ if ( 'true' === $markup_values['muie_debug'] ) {
2281
+ MLACore::mla_debug_add( __LINE__ . " compose_archive_list() list = " . var_export( esc_html( $list ), true ), self::$muie_debug_category );
2282
+ } else {
2283
+ MLACore::mla_debug_add( __LINE__ . " compose_archive_list() list = " . var_export( $list, true ), self::$muie_debug_category );
2284
+ }
2285
+
2286
+ return $has_active;
2287
+ } // compose_archive_list
2288
+
2289
+ /**
2290
+ * Explicit Shortcode Attributes for muie_archive_list
2291
+ *
2292
+ * @since 1.14
2293
+ *
2294
+ * @var array
2295
+ */
2296
+ private static $archive_list_attr = NULL;
2297
+
2298
+ /**
2299
+ * Shortcode Arguments for muie_archive_list
2300
+ *
2301
+ * @since 1.14
2302
+ *
2303
+ * @var array
2304
+ */
2305
+ private static $archive_list_arguments = NULL;
2306
+
2307
+ /**
2308
+ * Query results for muie_archive_list
2309
+ *
2310
+ * @since 1.14
2311
+ *
2312
+ * @var array
2313
+
2314
+ yearly =>
2315
+ (object) array(
2316
+ 'year' => '2019',
2317
+ 'items' => '2',
2318
+ ),
2319
+
2320
+ monthly =>
2321
+ (object) array(
2322
+ 'year' => '2019',
2323
+ 'month' => '9',
2324
+ 'items' => '2',
2325
+ ),
2326
+
2327
+ weekly =>
2328
+ (object) array(
2329
+ 'year' => '2019',
2330
+ 'week' => '38',
2331
+ 'yyyymmdd' => '2019-09-21',
2332
+ 'items' => '2',
2333
+ 'week_start_raw' => 1568592000,
2334
+ 'week_start_short' => '2019-09-16',
2335
+ 'week_start' => 'September 16, 2019',
2336
+ 'week_end_raw' => 1569196799,
2337
+ 'week_end_short' => '2019-09-22',
2338
+ 'week_end' => 'September 22, 2019',
2339
+ ),
2340
+
2341
+ daily =>
2342
+ (object) array(
2343
+ 'year' => '2019',
2344
+ 'month' => '9',
2345
+ 'day' => '21',
2346
+ 'items' => '2',
2347
+ ),
2348
+
2349
+ */
2350
+ private static $archive_list_items = NULL;
2351
+
2352
+ /**
2353
+ * Filters all query clauses at once, for convenience.
2354
+ *
2355
+ * For use by caching plugins.
2356
+ *
2357
+ * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT,
2358
+ * fields (SELECT), and LIMITS clauses.
2359
+ *
2360
+ * @since 1.14
2361
+ *
2362
+ * @param string[] $pieces Associative array of the pieces of the query.
2363
+ * @param WP_Query $wp_query The WP_Query instance (passed by reference).
2364
+ */
2365
+ public static function muie_archive_posts_clauses_request( $pieces, $wp_query ) {
2366
+ global $wpdb;
2367
+ //error_log( __LINE__ . " muie_archive_posts_clauses_request() pieces = " . var_export( $pieces, true ), 0 );
2368
+
2369
+ $where = isset( $pieces['where'] ) ? $pieces['where'] : '';
2370
+ $join = isset( $pieces['join'] ) ? $pieces['join'] : '';
2371
+
2372
+ // exif:DateTimeOriginal YYYY:MM:DD HH:MM:SS
2373
+ // iptc:DateCreated YYYYMMDD
2374
+ // xmp:CreateDate YYYY-MM-DD HH:MM:SS two digit month and day, 24-hour clock
2375
+
2376
+ // These will come from shortcode attributes
2377
+ if ( 'custom' === self::$archive_list_arguments['archive_source'] ) {
2378
+ $key = self::$archive_list_arguments['archive_key'];
2379
+ $field = $wpdb->postmeta . '.meta_value';
2380
+ $join .= " INNER JOIN {$wpdb->postmeta} ON ( $wpdb->posts.ID = {$wpdb->postmeta}.post_id )";
2381
+ $where .= " AND ( {$wpdb->postmeta}.meta_key = '{$key}' )";
2382
+ } else {
2383
+ $field = self::$archive_list_arguments['archive_source'];
2384
+ }
2385
+
2386
+ $order = self::$archive_list_arguments['archive_order'];
2387
+
2388
+ if ( self::$archive_list_arguments['archive_limit'] ) {
2389
+ $limit = 'LIMIT ' . (string) self::$archive_list_arguments['archive_limit'];
2390
+ } else {
2391
+ $limit = '';
2392
+ }
2393
+
2394
+ // Initialize clauses that vary by archive type
2395
+ switch ( self::$archive_list_arguments['archive_type'] ) {
2396
+ case 'daily':
2397
+ $main_select = "sq.year AS `year`, sq.month AS `month`, sq.day AS `day`";
2398
+ $main_group_by = "sq.year, sq.month, sq.day";
2399
+ $main_order_by = "sq.year {$order}, sq.month {$order}, sq.day {$order}";
2400
+ $sq_select = "YEAR({$field}) AS `year`, MONTH({$field}) AS `month`, DAYOFMONTH({$field}) AS `day`";
2401
+ $sq_group_by = "YEAR({$field}), MONTH({$field}), DAYOFMONTH({$field})";
2402
+ $sq_order_by = "{$field} {$order}";
2403
+ break;
2404
+ case 'weekly':
2405
+ $week = _wp_mysql_week( "{$field}" );
2406
+ $main_select = "DISTINCT sq.year AS `year`, sq.week as `week`, sq.yyyymmdd AS `yyyymmdd`";
2407
+ $main_group_by = "sq.year, sq.week";
2408
+ $main_order_by = "sq.year {$order}, sq.week {$order}";
2409
+ $sq_select = "DISTINCT YEAR({$field}) AS `year`, {$week} as `week`, DATE_FORMAT( {$field}, '%Y-%m-%d' ) AS `yyyymmdd`";
2410
+ $sq_group_by = "YEAR({$field}), {$week}";
2411
+ $sq_order_by = "{$field} {$order}";
2412
+ break;
2413
+ case 'monthly':
2414
+ $main_select = "sq.year AS `year`, sq.month AS `month`";
2415
+ $main_group_by = "sq.year, sq.month";
2416
+ $main_order_by = "sq.year {$order}, sq.month {$order}";
2417
+ $sq_select = "YEAR({$field}) AS `year`, MONTH({$field}) AS `month`";
2418
+ $sq_group_by = "YEAR({$field}), MONTH({$field})";
2419
+ $sq_order_by = "{$field} {$order}";
2420
+ break;
2421
+ case 'yearly':
2422
+ default:
2423
+ $main_select = "sq.year AS `year`";
2424
+ $main_group_by = "sq.year";
2425
+ $main_order_by = "sq.year {$order}";
2426
+ $sq_select = "YEAR({$field}) AS `year`";
2427
+ $sq_group_by = "YEAR({$field})";
2428
+ $sq_order_by = "{$field} {$order}";
2429
+ }
2430
+
2431
+ // $query = "SELECT {$sq_select}, ID FROM $wpdb->posts {$join} WHERE 1=1 {$where} GROUP BY {$sq_group_by}, ID ORDER BY {$sq_order_by}, ID {$order}";
2432
+ //error_log( __LINE__ . " muie_archive_posts_clauses_request() query = " . var_export( $query, true ), 0 );
2433
+ // self::$archive_list_items = $wpdb->get_results( $query );
2434
+ //error_log( __LINE__ . " muie_archive_posts_clauses_request() archive_list_items = " . var_export( self::$archive_list_items, true ), 0 );
2435
+
2436
+ $query = "SELECT {$main_select}, count(sq.ID) as items FROM ( SELECT {$sq_select}, ID FROM $wpdb->posts {$join} WHERE 1=1 {$where} GROUP BY {$sq_group_by}, ID ORDER BY {$sq_order_by}) as sq GROUP BY {$main_group_by} ORDER BY {$main_order_by} {$limit}";
2437
+ //error_log( __LINE__ . " muie_archive_posts_clauses_request() query = " . var_export( $query, true ), 0 );
2438
+
2439
+ // $key = md5( $query );
2440
+ // $key = "wp_get_archives:$key:$last_changed";
2441
+ // $results = wp_cache_get( $key, 'posts' );
2442
+ // if ( ! $results ) {
2443
+ self::$archive_list_items = $wpdb->get_results( $query );
2444
+
2445
+ if ( 'weekly' === self::$archive_list_arguments['archive_type'] ) {
2446
+ foreach( self::$archive_list_items as $index => $item ) {
2447
+ $arc_week = get_weekstartend( $item->yyyymmdd, get_option( 'start_of_week' ) );
2448
+ self::$archive_list_items[ $index ]->week_start_raw = $arc_week['start'];
2449
+ self::$archive_list_items[ $index ]->week_start_short = date_i18n( 'Y-m-d', $arc_week['start'] );
2450
+ self::$archive_list_items[ $index ]->week_start = date_i18n( get_option( 'date_format' ), $arc_week['start'] );
2451
+ self::$archive_list_items[ $index ]->week_end_raw = $arc_week['end'];
2452
+ self::$archive_list_items[ $index ]->week_end_short = date_i18n( 'Y-m-d', $arc_week['end'] );
2453
+ self::$archive_list_items[ $index ]->week_end = date_i18n( get_option( 'date_format' ), $arc_week['end'] );
2454
+ }
2455
+ }
2456
+ //error_log( __LINE__ . " muie_archive_posts_clauses_request() archive_list_items = " . var_export( self::$archive_list_items, true ), 0 );
2457
+ // }
2458
+
2459
+ return $pieces;
2460
+ }
2461
+
2462
+ /**
2463
+ * Filters the posts array before the query takes place.
2464
+ *
2465
+ * Return a non-null value to bypass WordPress' default post queries.
2466
+ *
2467
+ * Filtering functions that require pagination information are encouraged to set
2468
+ * the `found_posts` and `max_num_pages` properties of the WP_Query object,
2469
+ * passed to the filter by reference. If WP_Query does not perform a database
2470
+ * query, it will not have enough information to generate these values itself.
2471
+ *
2472
+ * @since 4.6.0
2473
+ *
2474
+ * @param array|null $posts Return an array of post data to short-circuit WP's query,
2475
+ * or null to allow WP to run its normal queries.
2476
+ * @param WP_Query $wp_query The WP_Query instance (passed by reference).
2477
+ */
2478
+ public static function muie_archive_posts_pre_query( $posts, $wp_query ) {
2479
+ return array( 0 );
2480
+ }
2481
+
2482
+ /**
2483
+ * The MLA Term List shortcode.
2484
+ *
2485
+ * This is an interface to the muie_archive_list function.
2486
+ *
2487
+ * @since 1.14
2488
+ *
2489
+ * @param array $attr Attributes of the shortcode.
2490
+ * @param string $content Optional content for enclosing shortcodes
2491
+ *
2492
+ * @return string HTML content to display the archive list.
2493
+ */
2494
+ public static function muie_archive_list_shortcode( $attr, $content = NULL ) {
2495
+ MLACore::mla_debug_add( __LINE__ . " muie_archive_list_shortcode() _REQUEST = " . var_export( $_REQUEST, true ), self::$muie_debug_category );
2496
+ MLACore::mla_debug_add( __LINE__ . " muie_archive_list_shortcode() raw attr = " . var_export( $attr, true ), self::$muie_debug_category );
2497
+ MLACore::mla_debug_add( __LINE__ . " muie_archive_list_shortcode() content = " . var_export( $content, true ), self::$muie_debug_category );
2498
+
2499
+ /*
2500
+ * Make sure $attr is an array, even if it's empty,
2501
+ * and repair damage caused by link-breaks in the source text
2502
+ */
2503
+ $attr = MLAShortcodes::mla_validate_attributes( $attr, $content );
2504
+
2505
+ // The 'array' format makes no sense in a shortcode
2506
+ if ( isset( $attr['archive_output'] ) && 'array' === $attr['archive_output'] ) {
2507
+ $attr['archive_output'] = 'dropdown';
2508
+ }
2509
+
2510
+ // The current_archive parameter can be changed to support multiple lists per page
2511
+ if ( isset( $attr['archive_parameter_name'] ) ) {
2512
+ $archive_parameter_name = $attr['archive_parameter_name'];
2513
+ } else {
2514
+ $archive_parameter_name = 'muie_current_archive';
2515
+ }
2516
+
2517
+ // Pagination links, e.g. Previous or Next, have muie_filters that encode the form parameters
2518
+ if ( !empty( $_REQUEST['muie_filters'] ) ) {
2519
+ $filters = json_decode( trim( stripslashes( $_REQUEST['muie_filters'] ), '"' ), true );
2520
+
2521
+ if ( !empty( $filters[ $archive_parameter_name ] ) ) {
2522
+ $attr[ $archive_parameter_name ] = $filters[ $archive_parameter_name ];
2523
+ }
2524
+ }
2525
+
2526
+ if ( empty( $attr[ $archive_parameter_name ] ) && !empty( $_REQUEST[ $archive_parameter_name ] ) ) {
2527
+ $attr[ $archive_parameter_name ] = $_REQUEST[ $archive_parameter_name ];
2528
+ }
2529
+
2530
+ // A shortcode must return its content to the caller, so "echo" makes no sense
2531
+ $attr['echo'] = false;
2532
+
2533
+ MLACore::mla_debug_add( __LINE__ . " muie_archive_list_shortcode() validated attr = " . var_export( $attr, true ), self::$muie_debug_category );
2534
+ return self::muie_archive_list( $attr );
2535
+ }
2536
+
2537
+ /**
2538
+ * Turn [muie_archive_list] debug collection and display on or off
2539
+ *
2540
+ * @since 1.14
2541
+ *
2542
+ * @var mixed MLA_DEBUG_CATEGORY for normal operation, NULL for unconditional logging, false to suppress logging
2543
+ */
2544
+ private static $muie_debug_category = self::MLA_DEBUG_CATEGORY;
2545
+
2546
+ /**
2547
+ * Default values when global $post is not set
2548
+ *
2549
+ * @since 1.14
2550
+ *
2551
+ * @var array
2552
+ */
2553
+ private static $empty_post = array(
2554
+ 'ID' => 0,
2555
+ 'post_author' => 0,
2556
+ 'post_date' => '0000-00-00 00:00:00',
2557
+ 'post_date_gmt' => '0000-00-00 00:00:00',
2558
+ 'post_content' => '',
2559
+ 'post_title' => '',
2560
+ 'post_excerpt' => '',
2561
+ 'post_status' => 'publish',
2562
+ 'comment_status' => 'open',
2563
+ 'ping_status' => 'open',
2564
+ 'post_name' => '',
2565
+ 'to_ping' => 'None',
2566
+ 'pinged' => 'None',
2567
+ 'post_modified' => '0000-00-00 00:00:00',
2568
+ 'post_modified_gmt' => '0000-00-00 00:00:00',
2569
+ 'post_content_filtered' => 'None',
2570
+ 'post_parent' => 0,
2571
+ 'guid' => '',
2572
+ 'menu_order' => 0,
2573
+ 'post_type' => 'post',
2574
+ 'post_mime_type' => '',
2575
+ 'comment_count' => 0,
2576
+ );
2577
+
2578
+ /**
2579
+ * Style and Markup templates
2580
+ *
2581
+ * @since 1.14
2582
+ *
2583
+ * @var array
2584
+ */
2585
+ private static $muie_archive_templates = NULL;
2586
+
2587
+ /**
2588
+ * These are the default parameters for srchive list display
2589
+ *
2590
+ * @since 1.14
2591
+ *
2592
+ * @var array
2593
+ */
2594
+ private static $archive_list_item_specific_defaults = array(
2595
+ 'itemtag_id' => '',
2596
+ 'itemtag_class' => 'muie-archive-list-item',
2597
+ 'itemtag_attributes' => '',
2598
+ 'itemtag_value' => '',
2599
+ 'itemtag_label' => '',
2600
+ // 'itemtag_default_value' => '',
2601
+ // 'itemtag_default_label' => '',
2602
+
2603
+ 'separator' => "\n",
2604
+ 'link' => 'current',
2605
+ 'link_id' => '',
2606
+ 'link_class' => '',
2607
+ 'rollover_text' => '',
2608
+ 'link_attributes' => '',
2609
+ 'link_href' => '',
2610
+ 'link_text' => '',
2611
+ );
2612
+
2613
+ /**
2614
+ * Archive list support function
2615
+ *
2616
+ * This function generates a 'daily', 'weekly', 'monthly', or 'yearly' dropdown control, list or array
2617
+ *
2618
+ * @since 1.14
2619
+ *
2620
+ * @param array $attr the shortcode parameters
2621
+ *
2622
+ * @return mixed HTML markup (or array) for the generated control/list
2623
+ */
2624
+ public static function muie_archive_list( $attr ) {
2625
+ global $wpdb, $post;
2626
+ //error_log( __LINE__ . " muie_archive_list() attr = " . var_export( $attr, true ), 0 );
2627
+
2628
+ // Make sure $attr is an array, even if it's empty
2629
+ if ( is_string( $attr ) ) {
2630
+ $attr = shortcode_parse_atts( $attr );
2631
+ }
2632
+
2633
+ if ( empty( $attr ) ) {
2634
+ $attr = array();
2635
+ }
2636
+
2637
+ // Save the validated arguments for processing in posts_clauses_request, compose_archive_list
2638
+ self::$archive_list_attr = $attr;
2639
+
2640
+ // Some do_shortcode callers may not have a specific post in mind
2641
+ if ( ! is_object( $post ) ) {
2642
+ $post = (object) self::$empty_post;
2643
+ }
2644
+
2645
+ // $instance supports multiple lists in one page/post
2646
+ static $instance = 0;
2647
+ $instance++;
2648
+
2649
+ // Some values are already known, and can be used in data selection parameters
2650
+ $upload_dir = wp_upload_dir();
2651
+ $page_values = array(
2652
+ 'instance' => $instance,
2653
+ 'selector' => "muie_archive_list-{$instance}",
2654
+ 'site_url' => site_url(),
2655
+ 'base_url' => $upload_dir['baseurl'],
2656
+ 'base_dir' => $upload_dir['basedir'],
2657
+ 'id' => $post->ID,
2658
+ 'page_ID' => $post->ID,
2659
+ 'page_author' => $post->post_author,
2660
+ 'page_date' => $post->post_date,
2661
+ 'page_content' => $post->post_content,
2662
+ 'page_title' => $post->post_title,
2663
+ 'page_excerpt' => $post->post_excerpt,
2664
+ 'page_status' => $post->post_status,
2665
+ 'page_name' => $post->post_name,
2666
+ 'page_modified' => $post->post_modified,
2667
+ 'page_guid' => $post->guid,
2668
+ 'page_type' => $post->post_type,
2669
+ 'page_url' => get_page_link(),
2670
+ );
2671
+
2672
+ $default_arguments = array_merge(
2673
+ array(
2674
+ 'archive_type' => 'yearly',
2675
+ 'archive_source' => 'post_date',
2676
+ 'archive_key' => '', // for source = custom
2677
+ 'archive_output' => 'dropdown',
2678
+ 'archive_qualifier' => '',
2679
+
2680
+ 'archive_parameter_name' => 'muie_current_archive',
2681
+ 'archive_order' => 'DESC',
2682
+ 'archive_limit' => '0',
2683
+ 'archive_label' => '', // 'short', 'long'
2684
+ 'show_count' => 'true',
2685
+ 'hide_if_empty' => 'false',
2686
+
2687
+ 'listtag' => '',
2688
+ 'listtag_name' => 'muie_current_archive',
2689
+ 'listtag_id' => $page_values['selector'],
2690
+ 'listtag_class' => 'muie-archive-list',
2691
+ 'listtag_attributes' => '',
2692
+ 'itemtag' => '',
2693
+ 'current_archive_class' => 'muie-current-archive',
2694
+
2695
+ 'option_all_value' => '',
2696
+ 'option_all_label' => '',
2697
+ 'option_none_value' => '',
2698
+ 'option_none_label' => '',
2699
+
2700
+ 'end_size'=> 1,
2701
+ 'mid_size' => 1,
2702
+ 'prev_text' => '&laquo; ' . __( 'Previous', 'media-library-assistant' ),
2703
+ 'next_text' => __( 'Next', 'media-library-assistant' ) . ' &raquo;',
2704
+
2705
+ 'muie_debug' => '',
2706
+ 'echo' => 'false',
2707
+ ),
2708
+ self::$archive_list_item_specific_defaults
2709
+ );
2710
+
2711
+ // Accept only the attributes we need, supply defaults and validate
2712
+ $arguments = shortcode_atts( $default_arguments, $attr );
2713
+
2714
+ // Separate output type from qualifier
2715
+ $value = array_map( 'strtolower', array_map( 'trim', explode( ',', $arguments['archive_output'] ) ) );
2716
+ $qualifier = isset( $value[1] ) ? $value[1] : '';
2717
+ if ( in_array( $qualifier, array( 'wrap', 'always_wrap', 'show_all', 'prev_next' ) ) ) {
2718
+ $arguments['archive_qualifier'] = $qualifier;
2719
+ } else {
2720
+ $arguments['archive_qualifier'] = '';
2721
+ }
2722
+
2723
+ $value = $value[0];
2724
+ if ( in_array( $value, array( 'dropdown', 'list', 'flat', 'array', 'next_archive', 'current_archive', 'previous_archive', 'paginate_archive', ) ) ) {
2725
+ $arguments['archive_output'] = $value;
2726
+ $attr['archive_output'] = $value; // Fix for array_diff_assoc() below
2727
+ } else {
2728
+ $arguments['archive_output'] = 'dropdown';
2729
+ $arguments['archive_qualifier'] = '';
2730
+ }
2731
+
2732
+ if ( empty( $arguments['archive_label'] ) ) {
2733
+ if ( 'paginate_archive' === $arguments['archive_output'] ) {
2734
+ $arguments['archive_label'] = 'short';
2735
+ } else {
2736
+ $arguments['archive_label'] = 'long';
2737
+ }
2738
+ } else {
2739
+ $value = trim( strtolower( $arguments['archive_label'] ) );
2740
+ if ( 'short' === $value ) {
2741
+ $arguments['archive_label'] = $value;
2742
+ } else {
2743
+ $arguments['archive_label'] = 'long';
2744
+ }
2745
+ }
2746
+
2747
+ if ( empty( $arguments['listtag'] ) ) {
2748
+ if ( 'list' === $value ) {
2749
+ $arguments['listtag'] = 'ul';
2750
+ } else {
2751
+ $arguments['listtag'] = 'select';
2752
+ }
2753
+ }
2754
+
2755
+ if ( empty( $arguments['itemtag'] ) ) {
2756
+ if ( 'list' === $value ) {
2757
+ $arguments['itemtag'] = 'li';
2758
+ } else {
2759
+ $arguments['itemtag'] = 'option';
2760
+ }
2761
+ }
2762
+
2763
+ $value = trim( strtolower( $arguments['hide_if_empty'] ) );
2764
+ $arguments['hide_if_empty'] = 'true' === $value;
2765
+
2766
+ $value = trim( strtolower( $arguments['link'] ) );
2767
+ if ( in_array( $value, array( 'current', 'view', 'span', 'none', ) ) ) {
2768
+ $arguments['link'] = $value;
2769
+ } else {
2770
+ $arguments['link'] = 'current';
2771
+ }
2772
+
2773
+ // muie_debug controls output from this shortcode
2774
+ $old_debug_category = self::$muie_debug_category;
2775
+ $old_debug_mode = MLACore::mla_debug_mode();
2776
+
2777
+ $value = trim( strtolower( $arguments['muie_debug'] ) );
2778
+ if ( in_array( $value, array( 'false', 'log', 'true', ) ) ) {
2779
+ self::$muie_debug_category = NULL; // Unconditional logging
2780
+
2781
+ if ( 'true' === $value ) {
2782
+ MLACore::mla_debug_mode( 'buffer' );
2783
+ } elseif ( 'log' === $value ) {
2784
+ MLACore::mla_debug_mode( 'log' );
2785
+ } else {
2786
+ self::$muie_debug_category = $old_debug_category;
2787
+ }
2788
+
2789
+ $arguments['muie_debug'] = $value;
2790
+ } else {
2791
+ $arguments['muie_debug'] = '';
2792
+ }
2793
+
2794
+ $value = trim( strtolower( $arguments['echo'] ) );
2795
+ $arguments['echo'] = 'true' === $value;
2796
+
2797
+ $value = trim( strtolower( $arguments['archive_type'] ) );
2798
+ if ( in_array( $value, array( 'daily', 'weekly', 'monthly', 'yearly', ) ) ) {
2799
+ $arguments['archive_type'] = $value;
2800
+ } else {
2801
+ $arguments['archive_type'] = 'yearly';
2802
+ }
2803
+
2804
+ $value = trim( strtolower( $arguments['archive_source'] ) );
2805
+ if ( in_array( $value, array( 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt', 'custom', ) ) ) {
2806
+ $arguments['archive_source'] = $value;
2807
+ } else {
2808
+ $arguments['archive_source'] = 'post_date';
2809
+ }
2810
+
2811
+ if ( 'custom' === $value ) {
2812
+ $value = trim( $arguments['archive_key'] );
2813
+ if ( !empty( $value ) ) {
2814
+ $arguments['archive_key'] = $value;
2815
+ } else {
2816
+ $arguments['archive_key'] = '';
2817
+ $arguments['archive_source'] = 'post_date';
2818
+ }
2819
+ } else {
2820
+ $arguments['archive_key'] = '';
2821
+ }
2822
+
2823
+ $value = trim( strtoupper( $arguments['archive_order'] ) );
2824
+ if ( in_array( $value, array( 'ASC', 'DESC', ) ) ) {
2825
+ $arguments['archive_order'] = $value;
2826
+ } else {
2827
+ $arguments['archive_order'] = 'DESC';
2828
+ }
2829
+
2830
+ $arguments['archive_limit'] = absint( $arguments['archive_limit'] );
2831
+
2832
+ // The current_archive parameter can be changed to support multiple lists per page
2833
+ if ( ! isset( $attr['archive_parameter_name'] ) ) {
2834
+ $attr['archive_parameter_name'] = $default_arguments['archive_parameter_name'];
2835
+ }
2836
+
2837
+ // The archive_parameter_name can contain page_level parameters like {+page_ID+}
2838
+ $attr_value = str_replace( '{+', '[+', str_replace( '+}', '+]', $attr['archive_parameter_name'] ) );
2839
+ $archive_parameter_name = MLAData::mla_parse_template( $attr_value, $page_values );
2840
+
2841
+ /*
2842
+ * Special handling of archive_parameter_name to make multiple lists per page easier.
2843
+ * Look for this parameter in $_REQUEST if it's not present in the shortcode itself.
2844
+ */
2845
+ if ( ! isset( $attr[ $archive_parameter_name ] ) ) {
2846
+ if ( isset( $_REQUEST[ $archive_parameter_name ] ) ) {
2847
+ $attr[ $archive_parameter_name ] = sanitize_text_field( wp_unslash( $_REQUEST[ $archive_parameter_name ] ) );
2848
+ }
2849
+ }
2850
+
2851
+ /*
2852
+ * $archive_parameter_name, if non-default, doesn't make it through the shortcode_atts
2853
+ * filter, so we handle it separately
2854
+ */
2855
+ if ( isset( $attr[ $archive_parameter_name ] ) ) {
2856
+ $arguments[ $archive_parameter_name ] = $attr[ $archive_parameter_name ];
2857
+ } else {
2858
+ $arguments[ $archive_parameter_name ] = '';
2859
+ }
2860
+
2861
+ $arguments['archive_parameter_name'] = $archive_parameter_name;
2862
+
2863
+ // Save the validated arguments for processing in posts_clauses_request, compose_archive_list
2864
+ self::$archive_list_arguments = $arguments;
2865
+ MLACore::mla_debug_add( __LINE__ . " muie_archive_list() _REQUEST = " . var_export( $_REQUEST, true ), self::$muie_debug_category );
2866
+ MLACore::mla_debug_add( __LINE__ . " muie_archive_list() self::\$archive_list_attr = " . var_export( self::$archive_list_attr, true ), self::$muie_debug_category );
2867
+ MLACore::mla_debug_add( __LINE__ . " muie_archive_list() self::\$archive_list_arguments = " . var_export( self::$archive_list_arguments, true ), self::$muie_debug_category );
2868
+
2869
+ $other_arguments = array_diff_assoc( $attr, self::$archive_list_arguments );
2870
+ MLACore::mla_debug_add( __LINE__ . " muie_archive_list() other_arguments = " . var_export( $other_arguments, true ), self::$muie_debug_category );
2871
+
2872
+ // The other arguments can contain page_level parameters like {+page_ID+}, request: or query: parameters
2873
+ $markup_values = $page_values;
2874
+ foreach ( $other_arguments as $key => $value ) {
2875
+ $attr_value = str_replace( '{+', '[+', str_replace( '+}', '+]', $value ) );
2876
+ $markup_values = MLAData::mla_expand_field_level_parameters( $attr_value, $other_arguments, $markup_values );
2877
+ $value = MLAData::mla_parse_array_template( $attr_value, $markup_values, 'array' );
2878
+ if ( empty( $value ) ) {
2879
+ unset( $other_arguments[ $key ] );
2880
+ } else {
2881
+ $other_arguments[ $key ] = $value;
2882
+ }
2883
+ }
2884
+
2885
+ if ( empty( $other_arguments['post_parent'] ) ) {
2886
+ $other_arguments['post_parent'] = 'all';
2887
+ }
2888
+
2889
+ $shortcode_arguments = array_merge( $other_arguments, array(
2890
+ 'no_found_rows' => true,
2891
+ 'fields' => 'ids',
2892
+ 'cache_results' => false,
2893
+ 'update_post_term_cache' => false,
2894
+ 'update_post_meta_cache' => false,
2895
+ ) );
2896
+ MLACore::mla_debug_add( __LINE__ . " muie_archive_list() shortcode_arguments = " . var_export( $shortcode_arguments, true ), self::$muie_debug_category );
2897
+
2898
+ // posts_clauses_request will perform the actual query, and posts_pre_query will short-circuit WP_Query
2899
+ add_filter( 'posts_clauses_request', 'MLAUIElementsExample::muie_archive_posts_clauses_request', 10, 2 );
2900
+ add_filter( 'posts_pre_query', 'MLAUIElementsExample::muie_archive_posts_pre_query', 10, 2 );
2901
+
2902
+
2903
+ // Some do_shortcode callers may not have a specific post in mind
2904
+ $ID = is_object( $post ) ? $post->ID : 0;
2905
+
2906
+ if ( NULL === self::$muie_debug_category ) {
2907
+ $mla_debug = ( ! empty( $attr['mla_debug'] ) ) ? ( 'true' === trim( strtolower( $attr['mla_debug'] ) ) ) : false;
2908
+ } else {
2909
+ $mla_debug = false;
2910
+ }
2911
+
2912
+ $attachments = MLAShortcodes::mla_get_shortcode_attachments( $ID, $shortcode_arguments, false, $mla_debug );
2913
+ //error_log( __LINE__ . " muie_archive_list() attachments = " . var_export( $attachments, true ), 0 );
2914
+
2915
+ remove_filter( 'posts_clauses_request', 'MLAUIElementsExample::muie_archive_posts_clauses_request', 10 );
2916
+ remove_filter( 'posts_pre_query', 'MLAUIElementsExample::muie_archive_posts_pre_query', 10 );
2917
+
2918
+ $list_values = array_merge( $page_values, $arguments );
2919
+ //error_log( __LINE__ . " muie_archive_list() list_values = " . var_export( $list_values, true ), 0 );
2920
+
2921
+ // Expand list-level parameters
2922
+ $list_values['listtag_name'] = self::_process_shortcode_parameter( $list_values['listtag_name'], $list_values );
2923
+ $list_values['listtag_id'] = self::_process_shortcode_parameter( $list_values['listtag_id'], $list_values );
2924
+ $list_values['listtag_class'] = self::_process_shortcode_parameter( $list_values['listtag_class'], $list_values );
2925
+ $list_values['listtag_attributes'] = self::_process_shortcode_parameter( $list_values['listtag_attributes'], $list_values );
2926
+
2927
+ // Load template array and initialize page-level values.
2928
+ if ( empty( self::$muie_archive_templates ) ) {
2929
+ self::$muie_archive_templates = MLACore::mla_load_template( dirname( __FILE__ ) . '/mla-ui-custom-templates.tpl' , 'path' );
2930
+ //error_log( __LINE__ . " muie_archive_list() muie_archive_templates = " . var_export( self::$muie_archive_templates, true ), 0 );
2931
+ }
2932
+
2933
+ $list_values = MLAData::mla_expand_field_level_parameters( self::$muie_archive_templates['muie-archive-list-style'], $attr, $list_values );
2934
+ //error_log( __LINE__ . " muie_archive_list() list_values = " . var_export( $list_values, true ), 0 );
2935
+ $list = MLAData::mla_parse_template( self::$muie_archive_templates['muie-archive-list-style'], $list_values );
2936
+ //error_log( __LINE__ . " muie_archive_list() list = " . var_export( $list, true ), 0 );
2937
+ $links = array();
2938
+ self::compose_archive_list( $list, $links, $list_values );
2939
+ //error_log( __LINE__ . " muie_archive_list() list = " . var_export( $list, true ), 0 );
2940
+
2941
+ if ( 'true' === $arguments['muie_debug'] ) {
2942
+ $output = MLACore::mla_debug_flush();
2943
+ } else {
2944
+ $output = '';
2945
+ }
2946
+
2947
+ // restore debug settings
2948
+ self::$muie_debug_category = $old_debug_category;
2949
+ MLACore::mla_debug_mode( $old_debug_mode );
2950
+ return $output . $list;
2951
+ } // muie_archive_list
2952
+ } // Class MLAUIElementsExample
2953
+
2954
+ // Install the filters at an early opportunity
2955
+ add_action('init', 'MLAUIElementsExample::initialize');
2956
+ ?>
examples/plugins/woofixit.php CHANGED
@@ -91,8 +91,12 @@
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,10 +104,10 @@ Plugin Name: WooCommerce Fixit
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
107
 
108
  This program is free software; you can redistribute it and/or modify
109
  it under the terms of the GNU General Public License as published by
@@ -133,7 +137,7 @@ class Woo_Fixit {
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
@@ -202,6 +206,82 @@ class Woo_Fixit {
202
  */
203
  private static $check_unique_slug_attr = ' ';
204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  /**
206
  * Content Template for Product Image/Product Gallery Images
207
  *
@@ -398,6 +478,8 @@ class Woo_Fixit {
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,
@@ -417,17 +499,30 @@ class Woo_Fixit {
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
 
@@ -448,6 +543,9 @@ class Woo_Fixit {
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 ] ) );
@@ -456,7 +554,7 @@ class Woo_Fixit {
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
  }
@@ -464,6 +562,8 @@ class Woo_Fixit {
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";
@@ -485,7 +585,7 @@ class Woo_Fixit {
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
  *
@@ -503,9 +603,16 @@ class Woo_Fixit {
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 );
@@ -723,6 +830,143 @@ class Woo_Fixit {
723
  return $custom_value;
724
  } // mla_expand_custom_prefix
725
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
726
  /**
727
  * After adding a post's metadata, check for Product Image add.
728
  *
@@ -737,7 +981,7 @@ class Woo_Fixit {
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 );
@@ -763,7 +1007,7 @@ class Woo_Fixit {
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 );
@@ -882,9 +1126,35 @@ class Woo_Fixit {
882
  'comment' => 'Restore Product/Featured Image to the Product Gallery.' ),
883
  'Reverse Gallery' => array( 'handler' => '_reverse_gallery',
884
  'comment' => 'Reverse the image order in the Product Gallery.' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
885
  'Where-used' => array( 'handler' => '_where_used',
886
  'comment' => 'Replace &quot;where_used&quot; information in custom field &quot;Woo Used In&quot;.' ),
887
-
888
  'c6' => array( 'handler' => '', 'comment' => '<h3>Operations on Products, using the Product Image, Product Tags and Att. Tags</h3>' ),
889
  'Clear Product Tags' => array( 'handler' => '_clear_product_tags',
890
  'comment' => '<strong>Delete ALL</strong> Product Tags assignments where a Product Image exists.' ),
@@ -1013,7 +1283,7 @@ class Woo_Fixit {
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 ] : '';
@@ -1024,6 +1294,23 @@ class Woo_Fixit {
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
 
@@ -1037,14 +1324,14 @@ class Woo_Fixit {
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 ] );
@@ -1080,7 +1367,8 @@ class Woo_Fixit {
1080
  echo " </p>\n";
1081
 
1082
  if ( !$is_error ) {
1083
- echo " <button class=\"notice-dismiss\" type=\"button\"><span class=\"screen-reader-text\">Dismiss this notice.</span></button>\n";
 
1084
  }
1085
 
1086
  echo " </div>\n";
@@ -1146,7 +1434,7 @@ class Woo_Fixit {
1146
 
1147
  /**
1148
  * Array of Products giving Product Image and Product Gallery attachments:
1149
- * product_id => array( 'post_title' => product Title, '_thumbnail_id' => image_id, '_product_image_gallery' => gallery_ids (comma-delimited string)
1150
  *
1151
  * @since 1.00
1152
  *
@@ -1170,8 +1458,9 @@ class Woo_Fixit {
1170
  * @since 1.00
1171
  *
1172
  * @param boolean $build_pa Optional. Build the product_attachments array. Default: true.
 
1173
  */
1174
- private static function _build_product_attachments( $build_pa = true ) {
1175
  global $wpdb;
1176
 
1177
  if ( ! empty( self::$first_product ) ) {
@@ -1203,9 +1492,9 @@ class Woo_Fixit {
1203
  }
1204
  }
1205
  //error_log( __LINE__ . ' Woo_Fixit::_build_product_attachments() self::$attachment_products = ' . var_export( self::$attachment_products, true ), 0 );
1206
-
1207
  unset( $results );
1208
-
1209
  $query = sprintf( 'SELECT m.*, p.post_title 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 ( \'_product_image_gallery\', \'_thumbnail_id\' ) ) GROUP BY m.post_id, m.meta_id ORDER BY m.post_id', $wpdb->postmeta, $wpdb->posts, $lower_bound, $upper_bound );
1210
  $results = $wpdb->get_results( $query );
1211
  //error_log( __LINE__ . ' Woo_Fixit::_build_product_attachments() $results = ' . var_export( $results, true ), 0 );
@@ -1218,6 +1507,7 @@ class Woo_Fixit {
1218
 
1219
  if ( '_thumbnail_id' == $result->meta_key ) {
1220
  $key = (integer) $result->meta_value;
 
1221
  if ( isset( self::$attachment_products[ $key ] ) ) {
1222
  self::$attachment_products[ $key ]['_thumbnail_id'][] = (integer) $result->post_id;
1223
  } else {
@@ -1225,7 +1515,7 @@ class Woo_Fixit {
1225
  }
1226
  } else {
1227
  foreach( explode( ',', $result->meta_value ) as $key ) {
1228
- $key = (integer) trim( $key);
1229
  if ( isset( self::$attachment_products[ $key ] ) ) {
1230
  self::$attachment_products[ $key ]['_product_image_gallery'][] = (integer) $result->post_id;
1231
  } else {
@@ -1233,7 +1523,31 @@ class Woo_Fixit {
1233
  }
1234
  }
1235
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1236
  }
 
1237
  //error_log( __LINE__ . ' Woo_Fixit::_build_product_attachments() self::$product_attachments = ' . var_export( self::$product_attachments, true ), 0 );
1238
  //error_log( __LINE__ . ' Woo_Fixit::_build_product_attachments() self::$attachment_products = ' . var_export( self::$attachment_products, true ), 0 );
1239
  } // _build_product_attachments
@@ -2126,6 +2440,267 @@ VALUES ( {$attachment},'_wp_attachment_image_alt','{$text}' )";
2126
  return "_reverse_gallery() performed {$update_count} update(s).\n";
2127
  } // _reverse_gallery
2128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2129
  /**
2130
  * Replace "where_used" information in custom field "Woo Used In".
2131
  *
@@ -2150,7 +2725,7 @@ VALUES ( {$attachment},'_wp_attachment_image_alt','{$text}' )";
2150
  $thumbnail_count = 0;
2151
  $gallery_count = 0;
2152
  $category_count = 0;
2153
-
2154
  foreach( self::$attachment_products as $post_id => $result ) {
2155
  if ( empty( $result['_thumbnail_id'] ) ) {
2156
  $thumbnails = array();
@@ -2920,9 +3495,9 @@ VALUES ( {$attachment},'_wp_attachment_image_alt','{$text}' )";
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' );
@@ -3134,7 +3709,7 @@ VALUES ( {$attachment},'_wp_attachment_image_alt','{$text}' )";
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
  }
@@ -3163,7 +3738,7 @@ VALUES ( {$attachment},'_wp_attachment_image_alt','{$text}' )";
3163
  */
3164
  private static function _load_product_templates() {
3165
  $result = self::_load_settings();
3166
-
3167
  return $result;
3168
  } // _load_product_templates
3169
 
@@ -3175,8 +3750,11 @@ VALUES ( {$attachment},'_wp_attachment_image_alt','{$text}' )";
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
91
  * opened on 1/19/2020 by "kuassar".
92
  * https://wordpress.org/support/topic/image-keywords-tags-into-a-product-tags/
93
  *
94
+ * Enhanced for support topic "Adding images to product"
95
+ * opened on 2/25/2021 by "fireskyresale".
96
+ * https://wordpress.org/support/topic/adding-images-to-product/
97
+ *
98
  * @package WooCommerce Fixit
99
+ * @version 2.10
100
  */
101
 
102
  /*
104
  Plugin URI: http://davidlingren.com/
105
  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.
106
  Author: David Lingren
107
+ Version: 2.10
108
  Author URI: http://davidlingren.com/
109
 
110
+ Copyright 2014-2021 David Lingren
111
 
112
  This program is free software; you can redistribute it and/or modify
113
  it under the terms of the GNU General Public License as published by
137
  *
138
  * @var string
139
  */
140
+ const CURRENT_VERSION = '2.10';
141
 
142
  /**
143
  * Slug prefix for registering and enqueueing submenu pages, style sheets and scripts
206
  */
207
  private static $check_unique_slug_attr = ' ';
208
 
209
+ /**
210
+ * Add Product Image to Product Gallery
211
+ *
212
+ * @since 2.10
213
+ *
214
+ * @var boolean
215
+ */
216
+ private static $add_image_to_gallery = false;
217
+ const ADD_IMAGE_TO_GALLERY = 'add-image-to-gallery';
218
+
219
+ /**
220
+ * Append Item ID checkbox attribute
221
+ *
222
+ * @since 2.10
223
+ *
224
+ * @var string
225
+ */
226
+ private static $add_image_to_gallery_attr = ' ';
227
+
228
+ /**
229
+ * Use WordPress unique slug function
230
+ *
231
+ * @since 2.10
232
+ *
233
+ * @var boolean
234
+ */
235
+ private static $delete_no_children = false;
236
+ const DELETE_NO_CHILDREN = 'delete-no-children';
237
+
238
+ /**
239
+ * Use WordPress unique slug checkbox attribute
240
+ *
241
+ * @since 2.10
242
+ *
243
+ * @var string
244
+ */
245
+ private static $delete_no_children_attr = ' ';
246
+
247
+ /**
248
+ * Populate Product Image and Gallery with children from MLA Bulk Edit on Upload
249
+ *
250
+ * @since 2.10
251
+ *
252
+ * @var boolean
253
+ */
254
+ const POPULATE_PI_PG_ON_UPLOAD = 'populate-pi-pg-on-upload';
255
+ const DEFAULT_POPULATE_PI_PG_ON_UPLOAD = false;
256
+
257
+ /**
258
+ * Append Item ID checkbox attribute
259
+ *
260
+ * @since 2.10
261
+ *
262
+ * @var string
263
+ */
264
+ private static $populate_pi_pg_on_upload_attr = ' ';
265
+
266
+ /**
267
+ * Populate Product Image and Gallery with children from WP MMMW
268
+ *
269
+ * @since 2.10
270
+ *
271
+ * @var boolean
272
+ */
273
+ const POPULATE_PI_PG_ON_MMMW = 'populate-pi-pg-on-mmmw';
274
+ const DEFAULT_POPULATE_PI_PG_ON_MMMW = false;
275
+
276
+ /**
277
+ * Append Item ID checkbox attribute
278
+ *
279
+ * @since 2.10
280
+ *
281
+ * @var string
282
+ */
283
+ private static $populate_pi_pg_on_mmmw_attr = ' ';
284
+
285
  /**
286
  * Content Template for Product Image/Product Gallery Images
287
  *
478
  * @var array
479
  */
480
  private static $default_settings = array (
481
+ self::POPULATE_PI_PG_ON_UPLOAD => self::DEFAULT_POPULATE_PI_PG_ON_UPLOAD,
482
+ self::POPULATE_PI_PG_ON_MMMW => self::DEFAULT_POPULATE_PI_PG_ON_MMMW,
483
  self::NAME_TEMPLATE => self::DEFAULT_NAME_TEMPLATE,
484
  self::DESCRIPTION_TEMPLATE => self::DEFAULT_DESCRIPTION_TEMPLATE,
485
  self::SHORT_DESCRIPTION_TEMPLATE => self::DEFAULT_SHORT_DESCRIPTION_TEMPLATE,
499
  $settings = get_option( self::SLUG_PREFIX . 'settings' );
500
  if ( is_array( $settings ) ) {
501
  self::$settings = $settings;
502
+ // Adapt settings added in version 2.09
503
  if ( !isset( self::$settings[self::TAGS_TEMPLATE] ) ) {
504
  self::$settings[self::TAGS_TEMPLATE] = self::$default_settings[self::TAGS_TEMPLATE];
505
  }
506
+
507
+ // Adapt settings added in version 2.10
508
+ if ( !isset( self::$settings[self::POPULATE_PI_PG_ON_UPLOAD] ) ) {
509
+ self::$settings[self::POPULATE_PI_PG_ON_UPLOAD] = self::$default_settings[self::POPULATE_PI_PG_ON_UPLOAD];
510
+ }
511
+
512
+ if ( !isset( self::$settings[self::POPULATE_PI_PG_ON_MMMW] ) ) {
513
+ self::$settings[self::POPULATE_PI_PG_ON_MMMW] = self::$default_settings[self::POPULATE_PI_PG_ON_MMMW];
514
+ }
515
+
516
+ self::$populate_pi_pg_on_upload_attr = self::$settings[self::POPULATE_PI_PG_ON_UPLOAD] ? ' checked="checked" ' : ' ';
517
+ self::$populate_pi_pg_on_mmmw_attr = self::$settings[self::POPULATE_PI_PG_ON_MMMW] ? ' checked="checked" ' : ' ';
518
  self::$populate_on_add_attr = self::$settings[self::POPULATE_ON_ADD] ? ' checked="checked" ' : ' ';
519
  self::$populate_on_update_attr = self::$settings[self::POPULATE_ON_UPDATE] ? ' checked="checked" ' : ' ';
520
 
521
  return 'Settings loaded from database.';
522
  } else {
523
  self::$settings = self::$default_settings;
524
+ self::$populate_pi_pg_on_upload_attr = self::$settings[self::POPULATE_PI_PG_ON_UPLOAD] ? ' checked="checked" ' : ' ';
525
+ self::$populate_pi_pg_on_mmmw_attr = self::$settings[self::POPULATE_PI_PG_ON_MMMW] ? ' checked="checked" ' : ' ';
526
  self::$populate_on_add_attr = self::$settings[self::POPULATE_ON_ADD] ? ' checked="checked" ' : ' ';
527
  self::$populate_on_update_attr = self::$settings[self::POPULATE_ON_UPDATE] ? ' checked="checked" ' : ' ';
528
 
543
  // Load old settings from the database or defaults
544
  self::_load_product_templates();
545
 
546
+ $new_settings[self::POPULATE_PI_PG_ON_UPLOAD] = isset( $_REQUEST[ self::SLUG_PREFIX . self::POPULATE_PI_PG_ON_UPLOAD ] ) ? true : false;
547
+ $new_settings[self::POPULATE_PI_PG_ON_MMMW] = isset( $_REQUEST[ self::SLUG_PREFIX . self::POPULATE_PI_PG_ON_MMMW ] ) ? true : false;
548
+
549
  $new_settings[self::NAME_TEMPLATE] = trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::NAME_TEMPLATE ] ) );
550
  $new_settings[self::DESCRIPTION_TEMPLATE] = trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::DESCRIPTION_TEMPLATE ] ) );
551
  $new_settings[self::SHORT_DESCRIPTION_TEMPLATE] = trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::SHORT_DESCRIPTION_TEMPLATE ] ) );
554
  $new_settings[self::SKU_TEMPLATE] = trim( stripslashes( $_REQUEST[ self::SLUG_PREFIX . self::SKU_TEMPLATE ] ) );
555
  $new_settings[self::POPULATE_ON_ADD] = isset( $_REQUEST[ self::SLUG_PREFIX . self::POPULATE_ON_ADD ] ) ? true : false;
556
  $new_settings[self::POPULATE_ON_UPDATE] = isset( $_REQUEST[ self::SLUG_PREFIX . self::POPULATE_ON_UPDATE ] ) ? true : false;
557
+
558
  if ( $new_settings === self::$settings ) {
559
  return "Settings unchanged.\n";
560
  }
562
  $success = update_option( self::SLUG_PREFIX . 'settings', $new_settings, false );
563
  if ( $success ) {
564
  self::$settings = $new_settings;
565
+ self::$populate_pi_pg_on_upload_attr = self::$settings[self::POPULATE_PI_PG_ON_UPLOAD] ? ' checked="checked" ' : ' ';
566
+ self::$populate_pi_pg_on_mmmw_attr = self::$settings[self::POPULATE_PI_PG_ON_MMMW] ? ' checked="checked" ' : ' ';
567
  self::$populate_on_add_attr = self::$settings[self::POPULATE_ON_ADD] ? ' checked="checked" ' : ' ';
568
  self::$populate_on_update_attr = self::$settings[self::POPULATE_ON_UPDATE] ? ' checked="checked" ' : ' ';
569
  return "Settings have been updated.\n";
585
 
586
  return "Settings removed from database and reset to default values.\n";
587
  } // _delete_settings
588
+
589
  /**
590
  * Initialization function, similar to __construct()
591
  *
603
 
604
  self::_load_product_templates();
605
  //error_log( __LINE__ . " Woo_Fixit::initialize settings = " . var_export( self::$settings, true ), 0 );
606
+ //error_log( __LINE__ . " Woo_Fixit::initialize populate_pi_pg_on_upload_attr = " . var_export( self::$populate_pi_pg_on_upload_attr, true ), 0 );
607
+ //error_log( __LINE__ . " Woo_Fixit::initialize populate_pi_pg_on_mmmw_attr = " . var_export( self::$populate_pi_pg_on_mmmw_attr, true ), 0 );
608
  //error_log( __LINE__ . " Woo_Fixit::initialize populate_on_add_attr = " . var_export( self::$populate_on_add_attr, true ), 0 );
609
  //error_log( __LINE__ . " Woo_Fixit::initialize populate_on_update_attr = " . var_export( self::$populate_on_update_attr, true ), 0 );
610
 
611
+ if ( self::$settings[self::POPULATE_PI_PG_ON_UPLOAD] || self::$settings[self::POPULATE_PI_PG_ON_MMMW] ) {
612
+ // Defined in class-mla-options.php
613
+ add_action( 'add_attachment', 'Woo_Fixit::add_attachment', 10, 1 );
614
+ }
615
+
616
  if ( self::$settings[self::POPULATE_ON_ADD] ) {
617
  // Defined in /wp-includes/meta.php
618
  add_action( 'added_post_meta', 'Woo_Fixit::added_post_meta', 10, 4 );
830
  return $custom_value;
831
  } // mla_expand_custom_prefix
832
 
833
+ /**
834
+ * Attachment ID passed from add_attachment_action to mla_list_table_end_bulk_action
835
+ *
836
+ * Ensures that product population is only performed when the attachment is first
837
+ * added to the Media Library.
838
+ *
839
+ * @since 2.10
840
+ *
841
+ * @var integer
842
+ */
843
+ private static $add_attachment_id = 0;
844
+
845
+ /**
846
+ * After a new attachment is added, arm the filters to populate Priduct Image and Gallery.
847
+ *
848
+ * @since 2.10
849
+ *
850
+ * @param int $object_id Post ID.
851
+ */
852
+ public static function add_attachment( $object_id ) {
853
+ //error_log( __LINE__ . " Woo_Fixit::add_attachment( $object_id )", 0 );
854
+ self::$add_attachment_id = $object_id;
855
+
856
+ // If MLA's Bulk Edit on Upload isn't present, use the WP filters instead
857
+ if ( empty( $_REQUEST['mlaAddNewBulkEditFormString'] ) ) {
858
+ if ( self::$settings[self::POPULATE_PI_PG_ON_MMMW] ) {
859
+ add_filter( 'wp_generate_attachment_metadata', 'Woo_Fixit::generate_attachment_metadata', 0x7FFFFFFF, 2 );
860
+ }
861
+ } else {
862
+ if ( self::$settings[self::POPULATE_PI_PG_ON_UPLOAD] ) {
863
+ add_filter( 'mla_list_table_end_bulk_action', 'Woo_Fixit::mla_list_table_end_bulk_action', 10, 2 );
864
+ }
865
+ }
866
+ }
867
+
868
+ /**
869
+ * This filter tests the $add_attachment_id variable set by the add_attachment_action
870
+ * to ensure that population is only performed once, after the generation of all intermediate sizes is complete.
871
+ *
872
+ * The filter is applied by function wp_generate_attachment_metadata() in /wp-includes/image.php
873
+ * This function is called only Bulk Edit on Upload is not in process.
874
+ *
875
+ * @since 2.96
876
+ *
877
+ * @param array Attachment metadata for just-inserted attachment
878
+ * @param integer ID of just-inserted attachment
879
+ *
880
+ * @return array Updated attachment metadata
881
+ */
882
+ public static function generate_attachment_metadata( $data, $post_id ) {
883
+ $add_attachment_id = self::$add_attachment_id;
884
+ //error_log( __LINE__ . " Woo_Fixit::generate_attachment_metadata( {$post_id}, {$add_attachment_id} ) \$data = " . var_export( $data, true ), 0 );
885
+ if ( $add_attachment_id === $post_id ) {
886
+ add_filter( 'wp_update_attachment_metadata', 'Woo_Fixit::update_attachment_metadata', 0x7FFFFFFF, 2 );
887
+ remove_filter( 'wp_generate_attachment_metadata', 'Woo_Fixit::generate_attachment_metadata', 0x7FFFFFFF );
888
+ }
889
+
890
+ //error_log( __LINE__ . " Woo_Fixit::generate_attachment_metadata( {$post_id}, {$add_attachment_id} )", 0 );
891
+ return $data;
892
+ } // generate_attachment_metadata
893
+
894
+ /**
895
+ * This filter tests the MLAEdit::$add_attachment_id variable set by the mla_add_attachment_action
896
+ * to ensure that mapping is only performed after the generation of all intermediate sizes is complete.
897
+ *
898
+ * The filter is applied by function wp_generate_attachment_metadata() in /wp-includes/image.php
899
+ * This function is called only if Custom Field AND IPTC/EXIF mapping on new attachments are disabled
900
+ *
901
+ * @since 2.96
902
+ *
903
+ * @param array Attachment metadata for just-inserted attachment
904
+ * @param integer ID of just-inserted attachment
905
+ *
906
+ * @return array Updated attachment metadata
907
+ */
908
+ public static function update_attachment_metadata( $data, $post_id ) {
909
+ $add_attachment_id = self::$add_attachment_id;
910
+ //error_log( __LINE__ . " Woo_Fixit::update_attachment_metadata( {$post_id}, {$add_attachment_id} ) \$data = " . var_export( $data, true ), 0 );
911
+ if ( $add_attachment_id === $post_id ) {
912
+ // Only do this once per attachment
913
+ self::mla_list_table_end_bulk_action( NULL, 'edit' );
914
+
915
+ self::$add_attachment_id = 0;
916
+ remove_filter( 'wp_update_attachment_metadata', 'Woo_Fixit::update_attachment_metadata', 0x7FFFFFFF );
917
+ }
918
+
919
+ //error_log( __LINE__ . " Woo_Fixit::update_attachment_metadata( {$post_id}, {$add_attachment_id} )", 0 );
920
+ return $data;
921
+ } // mla_generate_attachment_metadata_filter
922
+
923
+ /**
924
+ * After a new attachment is added, populate the Product Image and Product Gallery.
925
+ *
926
+ * @since 2.10
927
+ *
928
+ * @param string $content Default message and page content.
929
+ * @param string $bulk_action Should be "edit".
930
+ */
931
+ public static function mla_list_table_end_bulk_action( $content, $bulk_action ) {
932
+ //error_log( __LINE__ . " Woo_Fixit::mla_list_table_end_bulk_action( $bulk_action )", 0 );
933
+
934
+ if ( 0 < self::$add_attachment_id ) {
935
+ $attachment = get_post( self::$add_attachment_id );
936
+ //error_log( __LINE__ . " Woo_Fixit::mla_list_table_end_bulk_action( $bulk_action ) attachment = " . var_export( $attachment, true ), 0 );
937
+ if ( isset( $attachment->post_parent ) && ( 0 < $attachment->post_parent ) ) {
938
+ if ( 0 === strpos( $attachment->post_mime_type, 'image' ) ) {
939
+ $parent = get_post( $attachment->post_parent ); }
940
+ //error_log( __LINE__ . " Woo_Fixit::mla_list_table_end_bulk_action( $bulk_action ) parent = " . var_export( $parent, true ), 0 );
941
+ if ( isset( $parent->post_type ) && ( 'product' === $parent->post_type ) ) {
942
+ $product_id = $parent->ID;
943
+ $thumbnail = get_post_meta( $product_id, '_thumbnail_id', true );
944
+ $gallery = get_post_meta( $product_id, '_product_image_gallery', true );
945
+ //error_log( __LINE__ . " Woo_Fixit::mla_list_table_end_bulk_action( $bulk_action ) thumbnail = " . var_export( $thumbnail, true ), 0 );
946
+ //error_log( __LINE__ . " Woo_Fixit::mla_list_table_end_bulk_action( $bulk_action ) gallery = " . var_export( $gallery, true ), 0 );
947
+
948
+ // First new item becomes the thumbnail, if needed
949
+ if ( empty( $thumbnail ) ) {
950
+ $result = update_post_meta( $product_id, '_thumbnail_id', self::$add_attachment_id );
951
+ //error_log( __LINE__ . " Woo_Fixit::mla_list_table_end_bulk_action( $bulk_action ) _thumbnail_id result = " . var_export( $result, true ), 0 );
952
+ $thumbnail = self::$add_attachment_id;
953
+ }
954
+
955
+ // Add the new item at the end of the gallery
956
+ if ( ( self::$add_attachment_id !== $thumbnail ) || self::$add_image_to_gallery ) {
957
+ $gallery .= empty( $gallery ) ? self::$add_attachment_id : ',' . self::$add_attachment_id;
958
+ $result = update_post_meta( $product_id, '_product_image_gallery', $gallery );
959
+ //error_log( __LINE__ . " Woo_Fixit::mla_list_table_end_bulk_action( $bulk_action ) _product_image_gallery result = " . var_export( $result, true ), 0 );
960
+ }
961
+
962
+ } // parent is product
963
+ } // attachment is image
964
+ } // adding an attachment
965
+
966
+ remove_filter( 'mla_list_table_end_bulk_action', 'Woo_Fixit::mla_list_table_end_bulk_action', 10 );
967
+ return $content;
968
+ }
969
+
970
  /**
971
  * After adding a post's metadata, check for Product Image add.
972
  *
981
  */
982
  public static function added_post_meta( $meta_id, $object_id, $meta_key, $meta_value ) {
983
  global $post;
984
+
985
  //error_log( __LINE__ . " Woo_Fixit::added_post_meta( $meta_id, $object_id, $meta_key ) meta_value = " . var_export( $meta_value, true ), 0 );
986
  if ( '_thumbnail_id' === $meta_key ) {
987
  //error_log( __LINE__ . " Woo_Fixit::added_post_meta( $meta_id, $object_id, $meta_key ) post = " . var_export( $post, true ), 0 );
1007
  */
1008
  public static function updated_postmeta( $meta_id, $object_id, $meta_key, $meta_value ) {
1009
  global $post;
1010
+
1011
  //error_log( __LINE__ . " Woo_Fixit::updated_postmeta( $meta_id, $object_id, $meta_key ) meta_value = " . var_export( $meta_value, true ), 0 );
1012
  if ( '_thumbnail_id' === $meta_key ) {
1013
  //error_log( __LINE__ . " Woo_Fixit::updated_postmeta( $meta_id, $object_id, $meta_key ) post = " . var_export( $post, true ), 0 );
1126
  'comment' => 'Restore Product/Featured Image to the Product Gallery.' ),
1127
  'Reverse Gallery' => array( 'handler' => '_reverse_gallery',
1128
  'comment' => 'Reverse the image order in the Product Gallery.' ),
1129
+ 'c5a' => array( 'handler' => '', 'comment' => '<hr>' ),
1130
+ 'c5b' => array( 'handler' => '', 'comment' => 'Options for the &ldquo;... from Children&rdquo; tools:' ),
1131
+ 't0401' => array( 'open' => '<table><tr>' ),
1132
+ 't0402' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle"><input name="' . self::SLUG_PREFIX . self::ADD_IMAGE_TO_GALLERY . '" type="checkbox"' . self::$add_image_to_gallery_attr . 'value="' . self::ADD_IMAGE_TO_GALLERY . '"></td>' ),
1133
+ 't0403' => array( 'continue' => ' <td style="text-align: left; padding-right: 5px" valign="middle">Add Product Image to Gallery</td>' ),
1134
+ 't0404' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle"><input name="' . self::SLUG_PREFIX . self::DELETE_NO_CHILDREN . '" type="checkbox"' . self::$delete_no_children_attr . 'value="' . self::DELETE_NO_CHILDREN . '"></td>' ),
1135
+ 't0405' => array( 'continue' => ' <td style="text-align: left; padding-right: 5px" valign="middle">Delete P.I. and P.G. if no children</td>' ),
1136
+ 't0406' => array( 'continue' => ' <td colspan=2 style="text-align: right; padding-right: 5px" valign="middle">&nbsp;</td>' ),
1137
+ 't0407' => array( 'continue' => '</tr><tr>' ),
1138
+ 't0408' => array( 'continue' => '<td>&nbsp;</td><td colspan="5">Check Add Product Image to Gallery to add the Product Image to the Product Gallery.<br>For the Replace tool, check Delete P.I. and P.G. ... to delete the Product Image and Product Gallery<br>if there are no attached children.</td>' ),
1139
+ 't0409' => array( 'close' => '</tr></table>&nbsp;<br>' ),
1140
+ 'Fill from Children' => array( 'handler' => '_fill_from_children',
1141
+ 'comment' => 'Add product\'s children to the Product/Featured Image and Product Gallery.' ),
1142
+ 'Replace from Children' => array( 'handler' => '_replace_from_children',
1143
+ 'comment' => 'Replace Product/Featured Image and Product Gallery from product\'s children.' ),
1144
+ 'c5c' => array( 'handler' => '', 'comment' => '<hr>' ),
1145
+ 't0501' => array( 'open' => '<table><tr>' ),
1146
+ 't0502' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle"><input name="' . self::SLUG_PREFIX . self::POPULATE_PI_PG_ON_UPLOAD . '" type="checkbox"' . self::$populate_pi_pg_on_upload_attr . 'value="' . self::POPULATE_PI_PG_ON_UPLOAD . '"></td>' ),
1147
+ 't0503' => array( 'continue' => ' <td style="text-align: left; padding-right: 5px" valign="middle">Populate P.I. and P.G. with children<br>from MLA&rsquo;s Bulk Edit on Upload</td>' ),
1148
+ 't0504' => array( 'continue' => ' <td style="text-align: right; padding-right: 5px" valign="middle"><input name="' . self::SLUG_PREFIX . self::POPULATE_PI_PG_ON_MMMW . '" type="checkbox"' . self::$populate_pi_pg_on_mmmw_attr . 'value="' . self::POPULATE_PI_PG_ON_MMMW . '"></td>' ),
1149
+ 't0505' => array( 'continue' => ' <td style="text-align: left; padding-right: 5px" valign="middle">Populate P.I. and P.G. with children<br>from WordPress MMMW Add Files</td>' ),
1150
+ 't0506' => array( 'continue' => ' <td colspan=2 style="text-align: right; padding-right: 5px" valign="middle">&nbsp;</td>' ),
1151
+ 't0507' => array( 'continue' => '</tr><tr>' ),
1152
+ 't0508' => array( 'continue' => '<td colspan="5">Check this options to populate the Product Image and Product Gallery when images are attached to a Product during the Media/Add New Bulk Edit on Upload processing and/or the WordPress "Add Files" popup window tab.</td>' ),
1153
+ 't0509' => array( 'close' => '</tr></table>&nbsp;<br>' ),
1154
+ 'Save Changes' => array( 'handler' => '_save_upload_children_option', 'comment' => 'Click here to record the new Populate P.I. and P.G. with children option settings.' ),
1155
+ 'c5d' => array( 'handler' => '', 'comment' => '<hr>' ),
1156
  'Where-used' => array( 'handler' => '_where_used',
1157
  'comment' => 'Replace &quot;where_used&quot; information in custom field &quot;Woo Used In&quot;.' ),
 
1158
  'c6' => array( 'handler' => '', 'comment' => '<h3>Operations on Products, using the Product Image, Product Tags and Att. Tags</h3>' ),
1159
  'Clear Product Tags' => array( 'handler' => '_clear_product_tags',
1160
  'comment' => '<strong>Delete ALL</strong> Product Tags assignments where a Product Image exists.' ),
1283
 
1284
  // Load the Product from Product Image templates from the database or set defaults
1285
  //self::_load_settings();
1286
+
1287
  // Extract relevant query arguments
1288
  self::$first_product = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_FIRST_PRODUCT ] ) ? $_REQUEST[ self::SLUG_PREFIX . self::INPUT_FIRST_PRODUCT ] : '';
1289
  self::$last_product = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_LAST_PRODUCT ] ) ? $_REQUEST[ self::SLUG_PREFIX . self::INPUT_LAST_PRODUCT ] : '';
1294
  self::$check_unique_slug = isset( $_REQUEST[ self::SLUG_PREFIX . self::CHECK_UNIQUE_SLUG ] ) ? true : false;
1295
  self::$check_unique_slug_attr = self::$check_unique_slug ? ' checked="checked" ' : ' ';
1296
 
1297
+ // Operations on the Product Image and Product Gallery
1298
+ self::$add_image_to_gallery = isset( $_REQUEST[ self::SLUG_PREFIX . self::ADD_IMAGE_TO_GALLERY ] ) ? true : false;
1299
+ self::$add_image_to_gallery_attr = self::$add_image_to_gallery ? ' checked="checked" ' : ' ';
1300
+ self::$delete_no_children = isset( $_REQUEST[ self::SLUG_PREFIX . self::DELETE_NO_CHILDREN ] ) ? true : false;
1301
+ self::$delete_no_children_attr = self::$delete_no_children ? ' checked="checked" ' : ' ';
1302
+ self::$delete_no_children = isset( $_REQUEST[ self::SLUG_PREFIX . self::DELETE_NO_CHILDREN ] ) ? true : false;
1303
+ self::$delete_no_children_attr = self::$delete_no_children ? ' checked="checked" ' : ' ';
1304
+
1305
+ // No checkbox settings on initial page load
1306
+ if ( isset( $_REQUEST[ self::SLUG_PREFIX . 'action' ] ) ) {
1307
+ self::$settings[self::POPULATE_PI_PG_ON_UPLOAD] = isset( $_REQUEST[ self::SLUG_PREFIX . self::POPULATE_PI_PG_ON_UPLOAD ] );
1308
+ self::$settings[self::POPULATE_PI_PG_ON_MMMW] = isset( $_REQUEST[ self::SLUG_PREFIX . self::POPULATE_PI_PG_ON_MMMW ] );
1309
+ }
1310
+
1311
+ self::$populate_pi_pg_on_upload_attr = self::$settings[self::POPULATE_PI_PG_ON_UPLOAD] ? ' checked="checked" ' : ' ';
1312
+ self::$populate_pi_pg_on_mmmw_attr = self::$settings[self::POPULATE_PI_PG_ON_MMMW] ? ' checked="checked" ' : ' ';
1313
+
1314
  // Apply Template to Product Image/Product Gallery Images
1315
  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;
1316
 
1324
  self::$stop_chunk = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_LAST_CHUNK ] ) ? absint( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_LAST_CHUNK ] ) : self::$stop_chunk;
1325
  self::$chunk_size = isset( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_CHUNK_SIZE ] ) ? absint( $_REQUEST[ self::SLUG_PREFIX . self::INPUT_CHUNK_SIZE ] ) : self::$chunk_size;
1326
 
1327
+ // Populate Product from Product Image
1328
  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];
1329
  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];
1330
  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];
1331
  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];
1332
  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];
1333
  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];
1334
+
1335
  // No checkbox settings on initial page load
1336
  if ( isset( $_REQUEST[ self::SLUG_PREFIX . 'action' ] ) ) {
1337
  self::$settings[self::POPULATE_ON_ADD] = isset( $_REQUEST[ self::SLUG_PREFIX . self::POPULATE_ON_ADD ] );
1367
  echo " </p>\n";
1368
 
1369
  if ( !$is_error ) {
1370
+ // Obsolete as of WP 4.4.0
1371
+ // echo " <button class=\"notice-dismiss\" type=\"button\"><span class=\"screen-reader-text\">Dismiss this notice.</span></button>\n";
1372
  }
1373
 
1374
  echo " </div>\n";
1434
 
1435
  /**
1436
  * Array of Products giving Product Image and Product Gallery attachments:
1437
+ * product_id => array( 'post_title' => product Title, '_thumbnail_id' => image_id, '_product_image_gallery' => gallery_ids (comma-delimited string), 'children' => array( child IDs ) )
1438
  *
1439
  * @since 1.00
1440
  *
1458
  * @since 1.00
1459
  *
1460
  * @param boolean $build_pa Optional. Build the product_attachments array. Default: true.
1461
+ * @param boolean $add_children Optional. Add product children to the product_attachments array. Default: false.
1462
  */
1463
+ private static function _build_product_attachments( $build_pa = true, $add_children = false ) {
1464
  global $wpdb;
1465
 
1466
  if ( ! empty( self::$first_product ) ) {
1492
  }
1493
  }
1494
  //error_log( __LINE__ . ' Woo_Fixit::_build_product_attachments() self::$attachment_products = ' . var_export( self::$attachment_products, true ), 0 );
1495
+
1496
  unset( $results );
1497
+
1498
  $query = sprintf( 'SELECT m.*, p.post_title 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 ( \'_product_image_gallery\', \'_thumbnail_id\' ) ) GROUP BY m.post_id, m.meta_id ORDER BY m.post_id', $wpdb->postmeta, $wpdb->posts, $lower_bound, $upper_bound );
1499
  $results = $wpdb->get_results( $query );
1500
  //error_log( __LINE__ . ' Woo_Fixit::_build_product_attachments() $results = ' . var_export( $results, true ), 0 );
1507
 
1508
  if ( '_thumbnail_id' == $result->meta_key ) {
1509
  $key = (integer) $result->meta_value;
1510
+
1511
  if ( isset( self::$attachment_products[ $key ] ) ) {
1512
  self::$attachment_products[ $key ]['_thumbnail_id'][] = (integer) $result->post_id;
1513
  } else {
1515
  }
1516
  } else {
1517
  foreach( explode( ',', $result->meta_value ) as $key ) {
1518
+ $key = (integer) trim( $key );
1519
  if ( isset( self::$attachment_products[ $key ] ) ) {
1520
  self::$attachment_products[ $key ]['_product_image_gallery'][] = (integer) $result->post_id;
1521
  } else {
1523
  }
1524
  }
1525
  }
1526
+ } // foreach attachment_products thumbnail/gallery
1527
+
1528
+ if ( $build_pa && $add_children ) {
1529
+ // Exclude unattached items
1530
+ if ( 0 === $lower_bound ) {
1531
+ $lower_bound = 1;
1532
+ }
1533
+
1534
+ $query = sprintf( 'SELECT p.ID, p.post_mime_type, p.post_parent FROM %1$s as p INNER JOIN %1$s as parent ON parent.ID = p.post_parent WHERE ( parent.post_type = \'product\' ) AND ( p.post_type = \'attachment\' ) AND ( p.post_status = \'inherit\' ) AND ( p.post_parent >= %2$d ) AND ( p.post_parent <= %3$d ) ORDER BY p.ID', $wpdb->posts, $lower_bound, $upper_bound );
1535
+ $results = $wpdb->get_results( $query );
1536
+ //error_log( __LINE__ . ' Woo_Fixit::_build_product_attachments() add_children $results = ' . var_export( $results, true ), 0 );
1537
+
1538
+ foreach ( $results as $result ) {
1539
+ if ( 0 === strpos( $result->post_mime_type, 'image' ) ) {
1540
+ $key = (integer) trim( $result->post_parent );
1541
+ $ID = (integer) $result->ID;
1542
+ if ( isset( self::$product_attachments[ $key ] ) ) {
1543
+ self::$product_attachments[ $key ]['children'][ $ID ] = $ID;
1544
+ } else {
1545
+ self::$product_attachments[ $key ]['children'] = array( $ID => $ID );
1546
+ }
1547
+ } // image child
1548
+ } // foreach product child
1549
  }
1550
+
1551
  //error_log( __LINE__ . ' Woo_Fixit::_build_product_attachments() self::$product_attachments = ' . var_export( self::$product_attachments, true ), 0 );
1552
  //error_log( __LINE__ . ' Woo_Fixit::_build_product_attachments() self::$attachment_products = ' . var_export( self::$attachment_products, true ), 0 );
1553
  } // _build_product_attachments
2440
  return "_reverse_gallery() performed {$update_count} update(s).\n";
2441
  } // _reverse_gallery
2442
 
2443
+ /**
2444
+ * Updates the postmeta table one chunk at a time.
2445
+ *
2446
+ * @since 2.10
2447
+ *
2448
+ * @param string $meta_key Meta value name
2449
+ * @param array $updates ( $post_id => $meta_value )
2450
+ * @param array $inserts optional. ( $post_id => $meta_value )
2451
+ *
2452
+ * @return integer number of rows updated
2453
+ */
2454
+ private static function _update_postmeta( $meta_key, $updates, $inserts = array() ) {
2455
+ global $wpdb;
2456
+ //error_log( __LINE__ . " _update_postmeta( $meta_key ) updates = " . var_export( $updates, true ), 0 );
2457
+ //error_log( __LINE__ . " _update_postmeta( $meta_key ) inserts = " . var_export( $inserts, true ), 0 );
2458
+
2459
+ $update_count = 0;
2460
+ $select_bits = '';
2461
+ $where_bits = array();
2462
+ $chunk_count = 0;
2463
+ foreach( $updates as $post_id => $meta_value ) {
2464
+ $select_bits .= " WHEN post_id = {$post_id} THEN '{$meta_value}'";
2465
+ $where_bits[] = $post_id;
2466
+
2467
+ // Run an update when the chunk is full
2468
+ if ( 25 <= ++$chunk_count ) {
2469
+ $where_bits = implode( ',', $where_bits );
2470
+ $query = "UPDATE {$wpdb->postmeta} SET meta_value = CASE{$select_bits} ELSE meta_value END WHERE post_id IN ( {$where_bits} ) AND meta_key = '{$meta_key}'";
2471
+ $query_result = $wpdb->query( $query );
2472
+ $update_count += $chunk_count;
2473
+ $select_bits = '';
2474
+ $where_bits = array();
2475
+ $chunk_count = 0;
2476
+ }
2477
+ } // foreach product
2478
+
2479
+ // Run a final update if the chunk is partially filled
2480
+ if ( $chunk_count ) {
2481
+ $where_bits = implode( ',', $where_bits );
2482
+ $query = "UPDATE {$wpdb->postmeta} SET meta_value = CASE{$select_bits} ELSE meta_value END WHERE post_id IN ( {$where_bits} ) AND meta_key = '{$meta_key}'";
2483
+ $query_result = $wpdb->query( $query );
2484
+ $update_count += $chunk_count;
2485
+ }
2486
+
2487
+ // Insertsd are done one row at a time
2488
+ foreach( $inserts as $post_id => $meta_value ) {
2489
+ $query = "INSERT INTO {$wpdb->postmeta} ( `post_id`,`meta_key`,`meta_value` )
2490
+ VALUES ( {$post_id},'{$meta_key}','{$meta_value}' )";
2491
+ $query_result = $wpdb->query( $query );
2492
+ $update_count++;
2493
+ } // foreach product
2494
+
2495
+ return $update_count;
2496
+ } // _update_postmeta
2497
+
2498
+ /**
2499
+ * Add product's children to Product Image and Product Gallery.
2500
+ *
2501
+ * @since 2.10
2502
+ *
2503
+ * @return string HTML markup for results/messages
2504
+ */
2505
+ private static function _fill_from_children() {
2506
+ self::_build_product_attachments( true, true );
2507
+
2508
+ $product_count = count( self::$product_attachments );
2509
+ $update_count = 0;
2510
+ $thumbnail_count = 0;
2511
+ $gallery_count = 0;
2512
+
2513
+ $thumbnail_updates = array();
2514
+ $thumbnail_inserts = array();
2515
+ $gallery_updates = array();
2516
+ $gallery_inserts = array();
2517
+
2518
+ foreach ( self::$product_attachments as $ID => $images ) {
2519
+ $thumbnail = isset( $images['_thumbnail_id'] ) ? (integer) $images['_thumbnail_id'] : 0;
2520
+ $gallery = isset( $images['_product_image_gallery'] ) ? array_map( 'absint', explode( ',', $images['_product_image_gallery'] ) ) : array();
2521
+ $children = isset( $images['children'] ) ? $images['children'] : array();
2522
+ $updated = false;
2523
+
2524
+ if ( empty( $children ) ) {
2525
+ continue;
2526
+ }
2527
+
2528
+ // Use the earliest child for a missing product image
2529
+ if ( 0 === $thumbnail ) {
2530
+ $thumbnail = reset( $children );
2531
+
2532
+ if ( !empty( $images['_thumbnail_id'] ) ) {
2533
+ $thumbnail_updates[ $ID ] = $thumbnail;
2534
+ } else {
2535
+ $thumbnail_inserts[ $ID ] = $thumbnail;
2536
+ }
2537
+
2538
+ $updated = true;
2539
+ }
2540
+
2541
+ // Make sure all children are in the gallery
2542
+ $gallery_additions = array();
2543
+ $child_thumbnail_in_gallery = false;
2544
+ foreach ( $children as $child ) {
2545
+ if ( in_array( $child, $gallery ) ) {
2546
+ if ( $child === $thumbnail ) {
2547
+ $child_thumbnail_in_gallery = true;
2548
+ }
2549
+
2550
+ continue;
2551
+ }
2552
+
2553
+ if ( ( $child !== $thumbnail ) || self::$add_image_to_gallery ) {
2554
+ $gallery_additions[] = $child;
2555
+ }
2556
+ } // foreach child
2557
+
2558
+ // See if we must remove the "thumbnail child" from the gallery
2559
+ if ( $child_thumbnail_in_gallery && !self::$add_image_to_gallery ) {
2560
+ unset( $gallery[ array_search( $thumbnail, $gallery ) ] );
2561
+ $gallery_additions = array_merge( $gallery, $gallery_additions );
2562
+ $gallery = array();
2563
+ }
2564
+
2565
+ if ( !empty( $gallery_additions ) ) {
2566
+ if ( !empty( $images['_product_image_gallery'] ) ) {
2567
+ $gallery_updates[ $ID ] = implode( ',', array_merge( $gallery, $gallery_additions ) );
2568
+ } else {
2569
+ $gallery_inserts[ $ID ] = implode( ',', $gallery_additions );
2570
+ }
2571
+
2572
+ $updated = true;
2573
+ }
2574
+
2575
+ if ( $updated ) {
2576
+ $update_count++;
2577
+ }
2578
+ } // foreach product
2579
+
2580
+ // Apply the updates, if any
2581
+ if ( !empty( $thumbnail_updates ) || !empty( $thumbnail_inserts ) ) {
2582
+ $thumbnail_count = self::_update_postmeta( '_thumbnail_id', $thumbnail_updates, $thumbnail_inserts );
2583
+ }
2584
+
2585
+ if ( !empty( $gallery_updates ) || !empty( $gallery_inserts ) ) {
2586
+ $gallery_count = self::_update_postmeta( '_product_image_gallery', $gallery_updates, $gallery_inserts );
2587
+ }
2588
+
2589
+ return "_fill_from_children examined {$product_count} products, updated {$update_count}, filling {$thumbnail_count} product images and {$gallery_count} galleries";
2590
+ } // _fill_from_children
2591
+
2592
+ /**
2593
+ * Use product's children to replace Product Image and Product Gallery.
2594
+ *
2595
+ * @since 2.10
2596
+ *
2597
+ * @return string HTML markup for results/messages
2598
+ */
2599
+ private static function _replace_from_children() {
2600
+ self::_build_product_attachments( true, true );
2601
+
2602
+ $product_count = count( self::$product_attachments );
2603
+ $update_count = 0;
2604
+ $thumbnail_count = 0;
2605
+ $gallery_count = 0;
2606
+
2607
+ $thumbnail_updates = array();
2608
+ $thumbnail_inserts = array();
2609
+ $gallery_updates = array();
2610
+ $gallery_inserts = array();
2611
+
2612
+ foreach ( self::$product_attachments as $ID => $images ) {
2613
+ $thumbnail = isset( $images['_thumbnail_id'] ) ? (integer) $images['_thumbnail_id'] : 0;
2614
+ $gallery = isset( $images['_product_image_gallery'] ) ? array_map( 'absint', explode( ',', $images['_product_image_gallery'] ) ) : array();
2615
+ $children = isset( $images['children'] ) ? $images['children'] : array();
2616
+ $updated = false;
2617
+
2618
+ if ( empty( $children ) ) {
2619
+ if ( self::$delete_no_children ) {
2620
+ if ( delete_post_meta( $ID, '_thumbnail_id' ) ) {
2621
+ $updated = true;
2622
+ $thumbnail_count++;
2623
+ }
2624
+
2625
+ if ( delete_post_meta( $ID, '_product_image_gallery' ) ) {
2626
+ $updated = true;
2627
+ $gallery_count++;
2628
+ }
2629
+
2630
+ if ( $updated ) {
2631
+ $update_count++;
2632
+ }
2633
+ }
2634
+
2635
+ continue;
2636
+ }
2637
+
2638
+ // Use the earliest child for the product image
2639
+ $first_child = reset( $children );
2640
+ if ( $first_child !== $thumbnail ) {
2641
+ if ( !empty( $images['_thumbnail_id'] ) ) {
2642
+ $thumbnail_updates[ $ID ] = $first_child;
2643
+ } else {
2644
+ $thumbnail_inserts[ $ID ] = $first_child;
2645
+ }
2646
+
2647
+ $updated = true;
2648
+ }
2649
+
2650
+ if ( !self::$add_image_to_gallery ) {
2651
+ unset( $children[ $first_child ] );
2652
+ }
2653
+
2654
+ // See if the galleries match, ignoring the order of the current gallery.
2655
+ $current_gallery = $gallery;
2656
+ $gallery_additions = $children;
2657
+
2658
+ foreach ( $current_gallery as $index => $image ) {
2659
+ if ( in_array( $image, $gallery_additions ) ) {
2660
+ unset( $current_gallery[ $index ] );
2661
+ unset( $gallery_additions[ $image ] );
2662
+ }
2663
+ } // foreach current gallery image
2664
+
2665
+ // If they match, both arrays will be empty
2666
+ if ( !empty( $current_gallery ) || !empty( $gallery_additions ) ) {
2667
+ if ( !empty( $images['_product_image_gallery'] ) ) {
2668
+ $gallery_updates[ $ID ] = implode( ',', $children );
2669
+ } else {
2670
+ $gallery_inserts[ $ID ] = implode( ',', $children );
2671
+ }
2672
+
2673
+ $updated = true;
2674
+ }
2675
+
2676
+ if ( $updated ) {
2677
+ $update_count++;
2678
+ }
2679
+ } // foreach product
2680
+
2681
+ // Apply the updates, if any
2682
+ if ( !empty( $thumbnail_updates ) || !empty( $thumbnail_inserts ) ) {
2683
+ $thumbnail_count = self::_update_postmeta( '_thumbnail_id', $thumbnail_updates, $thumbnail_inserts );
2684
+ }
2685
+
2686
+ if ( !empty( $gallery_updates ) || !empty( $gallery_inserts ) ) {
2687
+ $gallery_count = self::_update_postmeta( '_product_image_gallery', $gallery_updates, $gallery_inserts );
2688
+ }
2689
+
2690
+ return "_replace_from_children examined {$product_count} products, updated {$update_count}, replacing {$thumbnail_count} product images and {$gallery_count} galleries";
2691
+ } // _replace_from_children
2692
+
2693
+ /**
2694
+ * Save the Populate Product from Product Image templates to the database
2695
+ *
2696
+ * @since 2.06
2697
+ *
2698
+ * @return string HTML markup for results/messages
2699
+ */
2700
+ private static function _save_upload_children_option() {
2701
+ return self::_save_setting_changes();
2702
+ } // _save_upload_children_option
2703
+
2704
  /**
2705
  * Replace "where_used" information in custom field "Woo Used In".
2706
  *
2725
  $thumbnail_count = 0;
2726
  $gallery_count = 0;
2727
  $category_count = 0;
2728
+
2729
  foreach( self::$attachment_products as $post_id => $result ) {
2730
  if ( empty( $result['_thumbnail_id'] ) ) {
2731
  $thumbnails = array();
3495
  $value[$result->meta_key] = $result->meta_value;
3496
  $old_values[ $result->post_id ] = $value;
3497
  }
3498
+
3499
  unset( $reaults, $result );
3500
+
3501
  foreach( $old_values as $product_id => $value ) {
3502
  // Find existing product_cat terms
3503
  $terms = get_object_term_cache( $product_id, 'product_cat' );
3709
  }
3710
  //error_log( __LINE__ . " Woo_Fixit::_populate_product_from_product_image( $update_count ) SKU result = " . var_export( $result, true ), 0 );
3711
  } // SKU_TEMPLATE
3712
+
3713
  if ( $update_count ) {
3714
  $updated_count++;
3715
  }
3738
  */
3739
  private static function _load_product_templates() {
3740
  $result = self::_load_settings();
3741
+
3742
  return $result;
3743
  } // _load_product_templates
3744
 
3750
  * @return string HTML markup for results/messages
3751
  */
3752
  private static function _restore_product_template_defaults() {
3753
+ self::$populate_pi_pg_on_upload_attr = self::DEFAULT_POPULATE_PI_PG_ON_UPLOAD ? ' checked="checked" ' : ' ';
3754
+ self::$populate_pi_pg_on_mmmw_attr = self::DEFAULT_POPULATE_PI_PG_ON_MMMW ? ' checked="checked" ' : ' ';
3755
+
3756
+ self::$populate_on_add_attr = self::DEFAULT_POPULATE_ON_ADD ? ' checked="checked" ' : ' ';
3757
+ self::$populate_on_update_attr = self::DEFAULT_POPULATE_ON_UPDATE ? ' checked="checked" ' : ' ';
3758
 
3759
  return self::_delete_settings();
3760
  } // _restore_product_template_defaults
includes/class-mla-core-options.php CHANGED
@@ -342,6 +342,11 @@ class MLACoreOptions {
342
  */
343
  const MLA_DEBUG_REPLACE_PHP_LOG = 'debug_replace_php_log';
344
 
 
 
 
 
 
345
  /**
346
  * Provides a unique name for the Debug replace PHP error_reporting option
347
  */
@@ -1419,6 +1424,13 @@ class MLACoreOptions {
1419
  'size' => 10,
1420
  'help' => __( 'Enter a numeric MLA_DEBUG_LEVEL value, e.g., 0x0003 or 3; leave blank to use the existing MLA_DEBUG_LEVEL value.', 'media-library-assistant' )),
1421
 
 
 
 
 
 
 
 
1422
  /* Here are examples of the other option types
1423
  'textarea' =>
1424
  array('tab' => '',
342
  */
343
  const MLA_DEBUG_REPLACE_PHP_LOG = 'debug_replace_php_log';
344
 
345
+ /**
346
+ * Provides a unique name for the Debug taconomy columns option
347
+ */
348
+ const MLA_DEBUG_ADD_TAXONOMY_COLUMNS = 'debug_add_taxonomy_columns';
349
+
350
  /**
351
  * Provides a unique name for the Debug replace PHP error_reporting option
352
  */
1424
  'size' => 10,
1425
  'help' => __( 'Enter a numeric MLA_DEBUG_LEVEL value, e.g., 0x0003 or 3; leave blank to use the existing MLA_DEBUG_LEVEL value.', 'media-library-assistant' )),
1426
 
1427
+ self::MLA_DEBUG_ADD_TAXONOMY_COLUMNS =>
1428
+ array('tab' => 'debug',
1429
+ 'name' => __( 'Add Tax. Columns', 'media-library-assistant' ),
1430
+ 'type' => 'checkbox',
1431
+ 'std' => '',
1432
+ 'help' => __( 'Check this option to add Term ID and Term-Taxonomy ID columns to the taxonomy edit admin submenu tables.', 'media-library-assistant' )),
1433
+
1434
  /* Here are examples of the other option types
1435
  'textarea' =>
1436
  array('tab' => '',
includes/class-mla-core.php CHANGED
@@ -21,7 +21,7 @@ class MLACore {
21
  *
22
  * @var string
23
  */
24
- const CURRENT_MLA_VERSION = '2.95';
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.96';
25
 
26
  /**
27
  * Slug for registering and enqueueing plugin style sheets (moved from class-mla-main.php)
includes/class-mla-data-query.php CHANGED
@@ -833,7 +833,7 @@ class MLAQuery {
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.
@@ -950,9 +950,10 @@ class MLAQuery {
950
  case 'post_parent':
951
  $clean_request[ 'post_parent' ] = absint( $value );
952
  break;
953
- // ['m'] - filter by year and month of post, e.g., 201204
954
- case 'author':
955
- case 'm':
 
956
  $clean_request[ $key ] = absint( $value );
957
  break;
958
  // ['mla_filter_term'] - filter by taxonomy term ID (-1 allowed), or by custom field
@@ -1052,6 +1053,7 @@ class MLAQuery {
1052
  case 'mla-metavalue':
1053
  $clean_request[ $key ] = stripslashes( html_entity_decode( $value ) );
1054
  break;
 
1055
  case 'meta_query':
1056
  if ( ! empty( $value ) ) {
1057
  if ( is_array( $value ) ) {
@@ -1204,6 +1206,9 @@ class MLAQuery {
1204
  $clean_request['posts_per_page'] = $count;
1205
  }
1206
 
 
 
 
1207
  /*
1208
  * ['mla_filter_term'] - filter by taxonomy
1209
  *
@@ -1218,7 +1223,7 @@ class MLAQuery {
1218
  'fields' => 'ids',
1219
  'hide_empty' => false
1220
  ) );
1221
- $clean_request['tax_query'] = array(
1222
  array(
1223
  'taxonomy' => $tax_filter,
1224
  'field' => 'id',
@@ -1227,7 +1232,7 @@ class MLAQuery {
1227
  )
1228
  );
1229
  } else { // mla_filter_term == -1
1230
- $clean_request['tax_query'] = array(
1231
  array(
1232
  'taxonomy' => $tax_filter,
1233
  'field' => 'id',
@@ -1243,8 +1248,9 @@ class MLAQuery {
1243
  unset( $clean_request['mla_filter_term'] );
1244
  } // isset mla_filter_term
1245
 
 
1246
  if ( isset( $clean_request['mla-tax'] ) && isset( $clean_request['mla-term'] )) {
1247
- $clean_request['tax_query'] = array(
1248
  array(
1249
  'taxonomy' => $clean_request['mla-tax'],
1250
  'field' => 'slug',
@@ -1257,6 +1263,25 @@ class MLAQuery {
1257
  unset( $clean_request['mla-term'] );
1258
  } // isset mla_tax
1259
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1260
  if ( isset( $clean_request['mla-metakey'] ) && isset( $clean_request['mla-metavalue'] ) ) {
1261
  $clean_request['meta_key'] = $clean_request['mla-metakey'];
1262
  $clean_request['meta_value'] = $clean_request['mla-metavalue'];
@@ -1366,6 +1391,7 @@ class MLAQuery {
1366
  add_filter( 'posts_clauses_request', 'MLAQuery::mla_query_posts_clauses_request_filter', 0x7FFFFFFF, 1 );
1367
  } // debug
1368
 
 
1369
  $results = new WP_Query( $request );
1370
 
1371
  if ( isset( self::$query_parameters['debug'] ) ) {
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__ . " MLAQuery::_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.
950
  case 'post_parent':
951
  $clean_request[ 'post_parent' ] = absint( $value );
952
  break;
953
+ case 'author': // userid of item owner
954
+ case 'm': // year and month of post, e.g., 201204
955
+ case 'year': // 4 digit year, e.g., 2021
956
+ case 'monthnum': // Month number (from 1 to 12)
957
  $clean_request[ $key ] = absint( $value );
958
  break;
959
  // ['mla_filter_term'] - filter by taxonomy term ID (-1 allowed), or by custom field
1053
  case 'mla-metavalue':
1054
  $clean_request[ $key ] = stripslashes( html_entity_decode( $value ) );
1055
  break;
1056
+ case 'tax_query':
1057
  case 'meta_query':
1058
  if ( ! empty( $value ) ) {
1059
  if ( is_array( $value ) ) {
1206
  $clean_request['posts_per_page'] = $count;
1207
  }
1208
 
1209
+ // Prepare to combine MLA's tax_query with any existing query
1210
+ $mla_tax_query = NULL;
1211
+
1212
  /*
1213
  * ['mla_filter_term'] - filter by taxonomy
1214
  *
1223
  'fields' => 'ids',
1224
  'hide_empty' => false
1225
  ) );
1226
+ $mla_tax_query = array(
1227
  array(
1228
  'taxonomy' => $tax_filter,
1229
  'field' => 'id',
1232
  )
1233
  );
1234
  } else { // mla_filter_term == -1
1235
+ $mla_tax_query = array(
1236
  array(
1237
  'taxonomy' => $tax_filter,
1238
  'field' => 'id',
1248
  unset( $clean_request['mla_filter_term'] );
1249
  } // isset mla_filter_term
1250
 
1251
+ // Filter by a term clicked in a submenu table taxonomy column
1252
  if ( isset( $clean_request['mla-tax'] ) && isset( $clean_request['mla-term'] )) {
1253
+ $mla_tax_query = array(
1254
  array(
1255
  'taxonomy' => $clean_request['mla-tax'],
1256
  'field' => 'slug',
1263
  unset( $clean_request['mla-term'] );
1264
  } // isset mla_tax
1265
 
1266
+ // Add our tax_query to the clean request
1267
+ if ( !empty( $mla_tax_query ) ) {
1268
+ if ( !empty( $clean_request['tax_query'] ) ) {
1269
+ foreach( $clean_request['tax_query'] as $key => $value ) {
1270
+ if ( is_integer( $key ) ) {
1271
+ $mla_tax_query[] = $value;
1272
+ } else {
1273
+ $mla_tax_query[ $key ] = $value;
1274
+ }
1275
+ }
1276
+
1277
+ if ( empty( $mla_tax_query['relation'] ) ) {
1278
+ $mla_tax_query['relation'] = 'AND';
1279
+ }
1280
+ } // existing query
1281
+
1282
+ $clean_request['tax_query'] = $mla_tax_query;
1283
+ } // mla_tax_query
1284
+
1285
  if ( isset( $clean_request['mla-metakey'] ) && isset( $clean_request['mla-metavalue'] ) ) {
1286
  $clean_request['meta_key'] = $clean_request['mla-metakey'];
1287
  $clean_request['meta_value'] = $clean_request['mla-metavalue'];
1391
  add_filter( 'posts_clauses_request', 'MLAQuery::mla_query_posts_clauses_request_filter', 0x7FFFFFFF, 1 );
1392
  } // debug
1393
 
1394
+ //error_log( __LINE__ . ' MLAQuery::_execute_list_table_query() request = ' . var_export( $request, true ), 0 );
1395
  $results = new WP_Query( $request );
1396
 
1397
  if ( isset( self::$query_parameters['debug'] ) ) {
includes/class-mla-data.php CHANGED
@@ -158,7 +158,10 @@ class MLAData {
158
  }
159
 
160
  if ( 1 == count( $final ) ) {
161
- $final = $final[0];
 
 
 
162
  }
163
 
164
  return $final;
@@ -737,6 +740,7 @@ class MLAData {
737
  * @return array individual arguments, e.g. array( 0 => 'd/m/Y H:i:s', 1 => 'arg, " two' )
738
  */
739
  private static function _parse_arguments( $argument_string ) {
 
740
  $argument_string = trim( $argument_string, " \n\t\r\0\x0B," );
741
  $arguments = array();
742
 
@@ -807,7 +811,7 @@ class MLAData {
807
 
808
  $index++;
809
  } else { // backslash
810
- if ( $delimiter == $byte || ( empty( $delimiter ) && ',' == $byte ) ) {
811
  break;
812
  }
813
 
@@ -816,10 +820,14 @@ class MLAData {
816
  } // index < strlen
817
  } // non-array
818
 
 
819
  $arguments[] = $argument;
 
 
820
  $argument_string = trim( substr( $argument_string, $index ), " \n\t\r\0\x0B," );
821
  } // strlen( $argument_string )
822
 
 
823
  return $arguments;
824
  }
825
 
@@ -934,7 +942,11 @@ class MLAData {
934
  if ( 1048576 < $number ) {
935
  $value = number_format( ( $number/1048576 ), $precision ) . $mb_suffix;
936
  } elseif ( $threshold < $number ) {
937
- $value = number_format( ( $number/1024 ), $precision ) . $kb_suffix;
 
 
 
 
938
  } else {
939
  $value = number_format( $number );
940
  }
@@ -1159,7 +1171,8 @@ class MLAData {
1159
  $pattern = trim( $args['args'][0] );
1160
 
1161
  if ( 1 < count( $args['args'] ) ) {
1162
- $replacement = trim( $args['args'][1] );
 
1163
  }
1164
 
1165
  if ( 2 < count( $args['args'] ) ) {
@@ -1285,7 +1298,11 @@ class MLAData {
1285
  break;
1286
  case 'request':
1287
  if ( isset( $_REQUEST[ $value['value'] ] ) ) {
1288
- $record = wp_kses( wp_unslash( $_REQUEST[ $value['value'] ] ), 'post' );
 
 
 
 
1289
  } else {
1290
  // Look for compound names, e.g., tax_input.attachment_category
1291
  $key_array = explode( '.', $value['value'] );
@@ -1302,7 +1319,9 @@ class MLAData {
1302
  } elseif ( is_scalar( $record ) ) {
1303
  $text = sanitize_text_field( (string) $record );
1304
  } elseif ( is_array( $record ) ) {
1305
- if ( 'export' == $value['option'] ) {
 
 
1306
  $text = sanitize_text_field( var_export( $record, true ) );
1307
  } else {
1308
  $text = '';
@@ -3729,6 +3748,22 @@ class MLAData {
3729
  }
3730
  } // ExposureBiasValue
3731
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3732
  if ( isset( $exif_data['Flash'] ) ) {
3733
  $value = ( absint( $exif_data['Flash'] ) );
3734
  if ( $value & 0x1 ) {
158
  }
159
 
160
  if ( 1 == count( $final ) ) {
161
+ // Don't flatten a string value key
162
+ if ( isset( $final[0] ) ) {
163
+ $final = $final[0];
164
+ }
165
  }
166
 
167
  return $final;
740
  * @return array individual arguments, e.g. array( 0 => 'd/m/Y H:i:s', 1 => 'arg, " two' )
741
  */
742
  private static function _parse_arguments( $argument_string ) {
743
+ //error_log( __LINE__ . ' _parse_arguments argument_string = ' . var_export( $argument_string, true ), 0 );
744
  $argument_string = trim( $argument_string, " \n\t\r\0\x0B," );
745
  $arguments = array();
746
 
811
 
812
  $index++;
813
  } else { // backslash
814
+ if ( $delimiter === $byte || ( empty( $delimiter ) && ',' === $byte ) ) {
815
  break;
816
  }
817
 
820
  } // index < strlen
821
  } // non-array
822
 
823
+ //error_log( __LINE__ . ' _parse_arguments argument = ' . var_export( $argument, true ), 0 );
824
  $arguments[] = $argument;
825
+ //error_log( __LINE__ . " _parse_arguments( {$index} ) argument_string = " . var_export( $argument_string, true ), 0 );
826
+ // $argument_string = trim( substr( $argument_string, $index ), " \n\t\r\0\x0B" ); 20210717
827
  $argument_string = trim( substr( $argument_string, $index ), " \n\t\r\0\x0B," );
828
  } // strlen( $argument_string )
829
 
830
+ //error_log( __LINE__ . ' _parse_arguments arguments = ' . var_export( $arguments, true ), 0 );
831
  return $arguments;
832
  }
833
 
942
  if ( 1048576 < $number ) {
943
  $value = number_format( ( $number/1048576 ), $precision ) . $mb_suffix;
944
  } elseif ( $threshold < $number ) {
945
+ if ( empty( $kb_suffix ) ) {
946
+ $value = number_format( ( $number/1048576 ), $precision ) . $mb_suffix;
947
+ } else {
948
+ $value = number_format( ( $number/1024 ), $precision ) . $kb_suffix;
949
+ }
950
  } else {
951
  $value = number_format( $number );
952
  }
1171
  $pattern = trim( $args['args'][0] );
1172
 
1173
  if ( 1 < count( $args['args'] ) ) {
1174
+ // $replacement = trim( $args['args'][1] ); 20210717
1175
+ $replacement = $args['args'][1];
1176
  }
1177
 
1178
  if ( 2 < count( $args['args'] ) ) {
1298
  break;
1299
  case 'request':
1300
  if ( isset( $_REQUEST[ $value['value'] ] ) ) {
1301
+ if ( is_array( $_REQUEST[ $value['value'] ] ) ) {
1302
+ $record = wp_unslash( $_REQUEST[ $value['value'] ] ); // phpcs:ignore
1303
+ } else {
1304
+ $record = wp_kses( wp_unslash( $_REQUEST[ $value['value'] ] ), 'post' );
1305
+ }
1306
  } else {
1307
  // Look for compound names, e.g., tax_input.attachment_category
1308
  $key_array = explode( '.', $value['value'] );
1319
  } elseif ( is_scalar( $record ) ) {
1320
  $text = sanitize_text_field( (string) $record );
1321
  } elseif ( is_array( $record ) ) {
1322
+ if ( 'array' == $value['option'] ) {
1323
+ $text = $record;
1324
+ } elseif ( 'export' == $value['option'] ) {
1325
  $text = sanitize_text_field( var_export( $record, true ) );
1326
  } else {
1327
  $text = '';
3748
  }
3749
  } // ExposureBiasValue
3750
 
3751
+ if ( isset( $exif_data['ExposureMode'] ) ) {
3752
+ switch ( absint( $exif_data['ExposureMode'] ) ) {
3753
+ case 0:
3754
+ $new_data['ExposureMode'] = __( 'Auto', 'media-library-assistant' );
3755
+ break;
3756
+ case 1:
3757
+ $new_data['ExposureMode'] = __( 'Manual', 'media-library-assistant' );
3758
+ break;
3759
+ case 2:
3760
+ $new_data['ExposureMode'] = __( 'Bracket', 'media-library-assistant' );
3761
+ break;
3762
+ default:
3763
+ $new_data['ExposureMode'] = __( 'Other', 'media-library-assistant' ) . ': ' . $exif_data['ExposureMode'];
3764
+ }
3765
+ } // ExposureMode
3766
+
3767
  if ( isset( $exif_data['Flash'] ) ) {
3768
  $value = ( absint( $exif_data['Flash'] ) );
3769
  if ( $value & 0x1 ) {
includes/class-mla-edit-media.php CHANGED
@@ -91,7 +91,7 @@ class MLAEdit {
91
  /*
92
  * If any of the mapping rule options is enabled, use the MLA filter so this
93
  * filter is called after mapping rules have run. If none are enabled,
94
- * use the WordPress filter directly.
95
  */
96
  if ( ( 'checked' == MLACore::mla_get_option( 'enable_iptc_exif_mapping' ) ) ||
97
  ( 'checked' == MLACore::mla_get_option( 'enable_custom_field_mapping' ) ) ||
@@ -100,7 +100,7 @@ class MLAEdit {
100
  // Fires after MLA mapping in wp_update_attachment_metadata() processing.
101
  add_filter( 'mla_update_attachment_metadata_postfilter', 'MLAEdit::mla_update_attachment_metadata_postfilter', 10, 3 );
102
  } else {
103
- add_filter( 'wp_update_attachment_metadata', 'MLAEdit::mla_update_attachment_metadata_postfilter', 0x7FFFFFFF, 2 );
104
  }
105
  }
106
 
@@ -491,10 +491,69 @@ class MLAEdit {
491
  $page_values = apply_filters( 'mla_upload_bulk_edit_form_values', $page_values );
492
  $page_template = apply_filters( 'mla_upload_bulk_edit_form_template', $page_template_array['page'] );
493
  $parse_value = MLAData::mla_parse_template( $page_template, $page_values );
494
- // echo wp_kses( apply_filters( 'mla_upload_bulk_edit_form_parse', $parse_value, $page_template, $page_values ), 'post' );
495
  echo apply_filters( 'mla_upload_bulk_edit_form_parse', $parse_value, $page_template, $page_values ); // phpcs:ignore
496
  }
497
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
498
  /**
499
  * Apply Media/Add New bulk edit area updates, if any
500
  *
@@ -512,6 +571,13 @@ class MLAEdit {
512
  * @return array updated attachment metadata
513
  */
514
  public static function mla_update_attachment_metadata_postfilter( $data, $post_id, $options = array( 'is_upload' => true ) ) {
 
 
 
 
 
 
 
515
  // Check for active debug setting
516
  if ( ( MLACore::$mla_debug_level & 1 ) && ( MLACore::$mla_debug_level & MLACore::MLA_DEBUG_CATEGORY_THUMBNAIL ) ) {
517
  $post = get_post( $post_id );
91
  /*
92
  * If any of the mapping rule options is enabled, use the MLA filter so this
93
  * filter is called after mapping rules have run. If none are enabled,
94
+ * use the WordPress filters directly.
95
  */
96
  if ( ( 'checked' == MLACore::mla_get_option( 'enable_iptc_exif_mapping' ) ) ||
97
  ( 'checked' == MLACore::mla_get_option( 'enable_custom_field_mapping' ) ) ||
100
  // Fires after MLA mapping in wp_update_attachment_metadata() processing.
101
  add_filter( 'mla_update_attachment_metadata_postfilter', 'MLAEdit::mla_update_attachment_metadata_postfilter', 10, 3 );
102
  } else {
103
+ add_action( 'add_attachment', 'MLAEdit::mla_add_attachment_action', 0x7FFFFFFF, 1 );
104
  }
105
  }
106
 
491
  $page_values = apply_filters( 'mla_upload_bulk_edit_form_values', $page_values );
492
  $page_template = apply_filters( 'mla_upload_bulk_edit_form_template', $page_template_array['page'] );
493
  $parse_value = MLAData::mla_parse_template( $page_template, $page_values );
 
494
  echo apply_filters( 'mla_upload_bulk_edit_form_parse', $parse_value, $page_template, $page_values ); // phpcs:ignore
495
  }
496
 
497
+ /**
498
+ * Attachment ID passed from mla_add_attachment_action to mla_update_attachment_metadata_filter
499
+ *
500
+ * Ensures that IPTC/EXIF and Custom Field mapping is only performed when the attachment is first
501
+ * added to the Media Library.
502
+ *
503
+ * @since 2.96
504
+ *
505
+ * @var integer
506
+ */
507
+ private static $add_attachment_id = 0;
508
+
509
+ /**
510
+ * Set $add_attachment_id to just-inserted attachment
511
+ *
512
+ * All of the actual processing is done later, in mla_update_attachment_metadata_filter.
513
+ * This function is called only if Custom FIeld AND IPTC/EXIF mapping on new attachments are disabled
514
+ *
515
+ * The filter is applied by function wp_insert_post() in /wp-includes/post.php
516
+ *
517
+ * @since 2.96
518
+ *
519
+ * @param integer ID of just-inserted attachment
520
+ *
521
+ * @return void
522
+ */
523
+ public static function mla_add_attachment_action( $post_ID ) {
524
+ MLACore::mla_debug_add( __LINE__ . " MLAEdit::mla_add_attachment_action( $post_ID )", MLACore::MLA_DEBUG_CATEGORY_METADATA );
525
+ MLAEdit::$add_attachment_id = $post_ID;
526
+
527
+ add_filter( 'wp_generate_attachment_metadata', 'MLAEdit::mla_generate_attachment_metadata_filter', 0x7FFFFFFF, 2 );
528
+
529
+ do_action( 'mla_add_attachment', $post_ID );
530
+ } // mla_add_attachment_action
531
+
532
+ /**
533
+ * This filter tests the MLAEdit::$add_attachment_id variable set by the mla_add_attachment_action
534
+ * to ensure that mapping is only performed after the generation of all intermediate sizes is complete.
535
+ *
536
+ * The filter is applied by function wp_generate_attachment_metadata() in /wp-includes/image.php
537
+ * This function is called only if Custom Field AND IPTC/EXIF mapping on new attachments are disabled
538
+ *
539
+ * @since 2.96
540
+ *
541
+ * @param array Attachment metadata for just-inserted attachment
542
+ * @param integer ID of just-inserted attachment
543
+ *
544
+ * @return array Updated attachment metadata
545
+ */
546
+ public static function mla_generate_attachment_metadata_filter( $data, $post_id ) {
547
+ $add_attachment_id = MLAEdit::$add_attachment_id;
548
+ if ( $add_attachment_id === $post_id ) {
549
+ add_filter( 'wp_update_attachment_metadata', 'MLAEdit::mla_update_attachment_metadata_postfilter', 0x7FFFFFFF, 2 );
550
+ remove_filter( 'mla_generate_attachment_metadata_filter', 'MLAEdit::mla_generate_attachment_metadata_filter', 0x7FFFFFFF );
551
+ }
552
+
553
+ MLACore::mla_debug_add( __LINE__ . " MLAEdit::mla_generate_attachment_metadata_filter( {$post_id}, {$add_attachment_id} ) \$data = " . var_export( $data, true ), MLACore::MLA_DEBUG_CATEGORY_METADATA );
554
+ return $data;
555
+ } // mla_generate_attachment_metadata_filter
556
+
557
  /**
558
  * Apply Media/Add New bulk edit area updates, if any
559
  *
571
  * @return array updated attachment metadata
572
  */
573
  public static function mla_update_attachment_metadata_postfilter( $data, $post_id, $options = array( 'is_upload' => true ) ) {
574
+ // If mapping on upload is disabled, reset the alternative trigger
575
+ if ( MLAEdit::$add_attachment_id === $post_id ) {
576
+ // Only do this once per attachment
577
+ MLAEdit::$add_attachment_id = 0;
578
+ remove_filter( 'mla_update_attachment_metadata_filter', 'MLAEdit::mla_update_attachment_metadata_filter', 0x7FFFFFFF );
579
+ }
580
+
581
  // Check for active debug setting
582
  if ( ( MLACore::$mla_debug_level & 1 ) && ( MLACore::$mla_debug_level & MLACore::MLA_DEBUG_CATEGORY_THUMBNAIL ) ) {
583
  $post = get_post( $post_id );
includes/class-mla-list-table.php CHANGED
@@ -662,10 +662,12 @@ class MLA_List_Table extends WP_List_Table {
662
  * @return string HTML markup to be placed inside the column
663
  */
664
  function column_cb( $item ) {
665
- return sprintf( '<input type="checkbox" id="cb-select-%2$s" name="cb_%1$s[]" value="%2$s" />',
666
- /*%1$s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("attachment")
667
- /*%2$s*/ $item->ID //The value of the checkbox should be the object's id
668
- );
 
 
669
  }
670
 
671
  /**
@@ -683,9 +685,7 @@ class MLA_List_Table extends WP_List_Table {
683
  return $thumb;
684
  }
685
 
686
- /*
687
- * Use the WordPress Edit Media screen
688
- */
689
  $view_args = self::mla_submenu_arguments();
690
  if ( isset( $view_args['lang'] ) ) {
691
  $edit_url = 'post.php?post=' . $item->ID . '&action=edit&mla_source=edit&lang=' . $view_args['lang'];
@@ -810,9 +810,7 @@ class MLA_List_Table extends WP_List_Table {
810
  }
811
  } else {
812
  if ( current_user_can( 'edit_post', $item->ID ) ) {
813
- /*
814
- * Use the WordPress Edit Media screen
815
- */
816
  if ( isset( $view_args['lang'] ) ) {
817
  $edit_url = 'post.php?post=' . $item->ID . '&action=edit&mla_source=edit&lang=' . $view_args['lang'];
818
  } else {
@@ -933,7 +931,6 @@ class MLA_List_Table extends WP_List_Table {
933
  $inline_data .= ' <div class="post_excerpt">' . esc_attr( $item->post_excerpt ) . "</div>\r\n";
934
  $inline_data .= ' <div class="post_content">' . esc_attr( $item->post_content ) . "</div>\r\n";
935
 
936
- // if ( !empty( $item->mla_wp_attachment_metadata ) ) {
937
  if ( ( 'image/' === substr( $item->post_mime_type, 0, 6 ) )
938
  || ( 'application/' === substr( $item->post_mime_type, 0, 12 ) ) ) {
939
  $inline_data .= ' <div class="image_alt">';
@@ -1833,7 +1830,7 @@ class MLA_List_Table extends WP_List_Table {
1833
 
1834
  return false;
1835
  case 'attached':
1836
- if ( $attached_items = ( array_sum( $posts_per_type ) - $posts_per_type['trash'] ) - $detached_items ) {
1837
  $value = $default_types['attached'];
1838
  $singular = sprintf('%s <span class="count">(%%s)</span>', $value['singular'] );
1839
  $plural = sprintf('%s <span class="count">(%%s)</span>', $value['plural'] );
662
  * @return string HTML markup to be placed inside the column
663
  */
664
  function column_cb( $item ) {
665
+ if ( current_user_can( 'edit_post', $item->ID ) ) {
666
+ return sprintf( '<input type="checkbox" id="cb-select-%2$s" name="cb_%1$s[]" value="%2$s" />',
667
+ /*%1$s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("attachment")
668
+ /*%2$s*/ $item->ID //The value of the checkbox should be the object's id
669
+ );
670
+ }
671
  }
672
 
673
  /**
685
  return $thumb;
686
  }
687
 
688
+ // Use the WordPress Edit Media screen
 
 
689
  $view_args = self::mla_submenu_arguments();
690
  if ( isset( $view_args['lang'] ) ) {
691
  $edit_url = 'post.php?post=' . $item->ID . '&action=edit&mla_source=edit&lang=' . $view_args['lang'];
810
  }
811
  } else {
812
  if ( current_user_can( 'edit_post', $item->ID ) ) {
813
+ // Use the WordPress Edit Media screen
 
 
814
  if ( isset( $view_args['lang'] ) ) {
815
  $edit_url = 'post.php?post=' . $item->ID . '&action=edit&mla_source=edit&lang=' . $view_args['lang'];
816
  } else {
931
  $inline_data .= ' <div class="post_excerpt">' . esc_attr( $item->post_excerpt ) . "</div>\r\n";
932
  $inline_data .= ' <div class="post_content">' . esc_attr( $item->post_content ) . "</div>\r\n";
933
 
 
934
  if ( ( 'image/' === substr( $item->post_mime_type, 0, 6 ) )
935
  || ( 'application/' === substr( $item->post_mime_type, 0, 12 ) ) ) {
936
  $inline_data .= ' <div class="image_alt">';
1830
 
1831
  return false;
1832
  case 'attached':
1833
+ if ( $attached_items = ( array_sum( $posts_per_type ) - ( $posts_per_type['trash'] + $posts_per_type['mine'] ) ) - $detached_items ) {
1834
  $value = $default_types['attached'];
1835
  $singular = sprintf('%s <span class="count">(%%s)</span>', $value['singular'] );
1836
  $plural = sprintf('%s <span class="count">(%%s)</span>', $value['plural'] );
includes/class-mla-main.php CHANGED
@@ -1993,7 +1993,8 @@ class MLA {
1993
  $_REQUEST['post_date_gmt'] = get_gmt_from_date( $new_date );
1994
  }
1995
 
1996
- $results = MLAData::mla_update_single_item( $post_id, $_REQUEST, $tax_output );
 
1997
  MLACore::mla_debug_add( __LINE__ . " MLA::mla_inline_edit_ajax_action( {$post_id} ) results = " . var_export( $results, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
1998
  }
1999
 
1993
  $_REQUEST['post_date_gmt'] = get_gmt_from_date( $new_date );
1994
  }
1995
 
1996
+ // $results = MLAData::mla_update_single_item( $post_id, $_REQUEST, $tax_output );
1997
+ $results = MLAData::mla_update_single_item( $post_id, $_REQUEST, $_REQUEST['tax_input'] );
1998
  MLACore::mla_debug_add( __LINE__ . " MLA::mla_inline_edit_ajax_action( {$post_id} ) results = " . var_export( $results, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
1999
  }
2000
 
includes/class-mla-media-modal-ajax.php CHANGED
@@ -646,20 +646,26 @@ class MLAModal_Ajax {
646
  * @return void passes array of post arrays to wp_send_json_success() for JSON encoding and transmission
647
  */
648
  public static function mla_query_attachments_action() {
 
649
  if ( ! current_user_can( 'upload_files' ) ) {
650
  wp_send_json_error();
651
  }
652
 
653
- // Pick out and clean up the query terms we can process
654
- $raw_query = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array(); // phpcs:ignore
655
- $query = array_intersect_key( $raw_query, array_flip( array(
656
  'order', 'orderby', 'posts_per_page', 'paged', 'post_mime_type',
657
- 'post_parent', 'post__in', 'post__not_in',
658
  'mla_filter_month', 'mla_filter_term', 'mla_terms_search',
659
  'mla_search_value', 's', 'mla_search_fields', 'mla_search_connector'
660
- ) ) );
 
 
 
 
 
 
661
 
662
  $query = apply_filters( 'mla_media_modal_query_initial_terms', $query, $raw_query );
 
663
 
664
  if ( isset( $query['post_mime_type'] ) ) {
665
  if ( 'detached' == $query['post_mime_type'] ) {
@@ -755,9 +761,29 @@ class MLAModal_Ajax {
755
  }
756
  }
757
 
758
- $query = MLAQuery::mla_query_media_modal_items( $query, $offset, $count );
759
- $posts = array_map( 'wp_prepare_attachment_for_js', $query->posts );
 
 
 
 
760
  $posts = array_filter( $posts );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
761
 
762
  wp_send_json_success( $posts );
763
  }
646
  * @return void passes array of post arrays to wp_send_json_success() for JSON encoding and transmission
647
  */
648
  public static function mla_query_attachments_action() {
649
+ //error_log( __LINE__ . ' MLAModal_Ajax::mla_query_attachments_action() _REQUEST = ' . var_export( $_REQUEST, true ), 0 );
650
  if ( ! current_user_can( 'upload_files' ) ) {
651
  wp_send_json_error();
652
  }
653
 
654
+ $keys = array(
 
 
655
  'order', 'orderby', 'posts_per_page', 'paged', 'post_mime_type',
656
+ 'post_parent', 'author', 'post__in', 'post__not_in', 'year', 'monthnum',
657
  'mla_filter_month', 'mla_filter_term', 'mla_terms_search',
658
  'mla_search_value', 's', 'mla_search_fields', 'mla_search_connector'
659
+ );
660
+
661
+ // Pick out and clean up the query terms we can process
662
+ $raw_query = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array(); // phpcs:ignore
663
+ //error_log( __LINE__ . ' MLAModal_Ajax::mla_query_attachments_action() raw_query = ' . var_export( $raw_query, true ), 0 );
664
+
665
+ $query = array_intersect_key( $raw_query, array_flip( $keys ) );
666
 
667
  $query = apply_filters( 'mla_media_modal_query_initial_terms', $query, $raw_query );
668
+ //error_log( __LINE__ . ' MLAModal_Ajax::mla_query_attachments_action() query = ' . var_export( $query, true ), 0 );
669
 
670
  if ( isset( $query['post_mime_type'] ) ) {
671
  if ( 'detached' == $query['post_mime_type'] ) {
761
  }
762
  }
763
 
764
+ // Defined in wp-admin/includes/ajax-actions.php function wp_ajax_query_attachments()
765
+ $query = apply_filters( 'ajax_query_attachments_args', $query );
766
+ //error_log( __LINE__ . ' MLAModal_Ajax::mla_query_attachments_action() query = ' . var_export( $query, true ), 0 );
767
+
768
+ $attachments_query = MLAQuery::mla_query_media_modal_items( $query, $offset, $count );
769
+ $posts = array_map( 'wp_prepare_attachment_for_js', $attachments_query->posts );
770
  $posts = array_filter( $posts );
771
+ $total_posts = $attachments_query->found_posts;
772
+
773
+ if ( $total_posts < 1 ) {
774
+ // Out-of-bounds, run the query again without LIMIT for total count.
775
+ unset( $query['paged'] );
776
+
777
+ $count_query = new WP_Query();
778
+ $count_query->query( $query );
779
+ $total_posts = $count_query->found_posts;
780
+ }
781
+
782
+ $max_pages = ceil( $total_posts / (int) $attachments_query->query['posts_per_page'] );
783
+ //error_log( __LINE__ . " MLAModal_Ajax::mla_query_attachments_action( {$total_posts}, {$max_pages} )", 0 );
784
+
785
+ header( 'X-WP-Total: ' . (int) $total_posts );
786
+ header( 'X-WP-TotalPages: ' . (int) $max_pages );
787
 
788
  wp_send_json_success( $posts );
789
  }
includes/class-mla-objects.php CHANGED
@@ -153,6 +153,11 @@ class MLAObjects {
153
  }
154
 
155
  $columns[ 'attachments' ] = __( 'Attachments', 'media-library-assistant' );
 
 
 
 
 
156
  }
157
 
158
  return $columns;
@@ -190,6 +195,23 @@ class MLAObjects {
190
  return $filter_content;
191
  }
192
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  if ( 'attachments' !== $column_name ) {
194
  return $current_value;
195
  }
153
  }
154
 
155
  $columns[ 'attachments' ] = __( 'Attachments', 'media-library-assistant' );
156
+
157
+ if ( 'checked' === MLACore::mla_get_option( MLACoreOptions::MLA_DEBUG_ADD_TAXONOMY_COLUMNS ) ) {
158
+ $columns[ 'termid' ] = __( 'Term ID', 'media-library-assistant' );
159
+ $columns[ 'ttid' ] = __( 'Term-Tax ID', 'media-library-assistant' );
160
+ }
161
  }
162
 
163
  return $columns;
195
  return $filter_content;
196
  }
197
 
198
+ $term = get_term( $term_id, $taxonomy );
199
+
200
+ if ( 'termid' === $column_name ) {
201
+ return (string) $term_id;
202
+ }
203
+
204
+ if ( 'ttid' === $column_name ) {
205
+ if ( isset( $terms[ $term_id ] ) ) {
206
+ $term = $terms[ $term_id ];
207
+ } else {
208
+ $term = get_term( $term_id, $taxonomy );
209
+ }
210
+
211
+ return (string) $term->term_taxonomy_id;
212
+ }
213
+
214
+
215
  if ( 'attachments' !== $column_name ) {
216
  return $current_value;
217
  }
includes/class-mla-settings.php CHANGED
@@ -1065,6 +1065,13 @@ class MLASettings {
1065
  '_wp_http_referer' => wp_referer_field( false ),
1066
  'Go to Top' => __( 'Go to Top', 'media-library-assistant' ),
1067
  'Go to Bottom' => __( 'Go to Bottom', 'media-library-assistant' ),
 
 
 
 
 
 
 
1068
  'shortcode_list' => '',
1069
  'form_url' => admin_url( 'options-general.php' ) . '?page=mla-settings-menu-general&mla_tab=general',
1070
  'options_list' => '',
@@ -1260,17 +1267,13 @@ class MLASettings {
1260
 
1261
  $page_values = array();
1262
 
1263
- /*
1264
- * Saving the options can change the log file name, so do it first
1265
- */
1266
  if ( !empty( $_REQUEST['mla-debug-options-save'] ) ) {
1267
  check_admin_referer( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME );
1268
  $page_content = self::_save_debug_settings();
1269
  }
1270
 
1271
- /*
1272
- * Find the appropriate error log file
1273
- */
1274
  $error_log_name = MLACore::mla_get_option( MLACoreOptions::MLA_DEBUG_FILE );
1275
  if ( empty( $error_log_name ) ) {
1276
  $error_log_name = ini_get( 'error_log' );
@@ -1285,9 +1288,7 @@ class MLASettings {
1285
 
1286
  $error_log_exists = file_exists ( $error_log_name );
1287
 
1288
- /*
1289
- * Check for other page-level actions
1290
- */
1291
  if ( isset( $_REQUEST['mla_reset_log'] ) && 'true' == $_REQUEST['mla_reset_log'] ) {
1292
  $file_error = false;
1293
  $file_handle = @fopen( $error_log_name, 'w' );
@@ -1314,9 +1315,7 @@ class MLASettings {
1314
  }
1315
  }
1316
 
1317
- /*
1318
- * Start with any page-level options
1319
- */
1320
  $options_list = '';
1321
  foreach ( MLACoreOptions::$mla_option_definitions as $key => $value ) {
1322
  if ( 'debug' == $value['tab'] ) {
@@ -1324,19 +1323,16 @@ class MLASettings {
1324
  }
1325
  }
1326
 
1327
- /*
1328
- * Gather Debug Settings
1329
- */
1330
  $display_limit = MLACore::mla_get_option( MLACoreOptions::MLA_DEBUG_DISPLAY_LIMIT );
1331
  $debug_file = MLACore::mla_get_option( MLACoreOptions::MLA_DEBUG_FILE );
1332
  $replace_php = MLACore::mla_get_option( MLACoreOptions::MLA_DEBUG_REPLACE_PHP_LOG );
1333
  $php_reporting = MLACore::mla_get_option( MLACoreOptions::MLA_DEBUG_REPLACE_PHP_REPORTING );
1334
  $mla_reporting = MLACore::mla_get_option( MLACoreOptions::MLA_DEBUG_REPLACE_LEVEL );
 
1335
 
1336
  if ( $error_log_exists ) {
1337
- /*
1338
- * Add debug content
1339
- */
1340
  $display_limit = absint( MLACore::mla_get_option( MLACoreOptions::MLA_DEBUG_DISPLAY_LIMIT ) );
1341
  $error_log_size = filesize( $error_log_name );
1342
 
@@ -1458,6 +1454,8 @@ class MLASettings {
1458
  $current_tab_slug = isset( $_REQUEST['mla_tab'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['mla_tab'] ) ): 'general';
1459
  $current_tab = self::_get_options_tablist( $current_tab_slug );
1460
  $page_values = array(
 
 
1461
  'version' => 'v' . MLACore::CURRENT_MLA_VERSION,
1462
  'development' => $development_version,
1463
  'messages' => '',
@@ -1813,7 +1811,7 @@ class MLASettings {
1813
  fclose($file_handle);
1814
 
1815
  /* translators: 1: number of option settings */
1816
- $page_content['message'] = sprintf( __( 'Settings exported; %1$s settings recorded.', 'media-library-assistant' ), $stored_count );
1817
 
1818
  /*
1819
  * Uncomment this for debugging.
1065
  '_wp_http_referer' => wp_referer_field( false ),
1066
  'Go to Top' => __( 'Go to Top', 'media-library-assistant' ),
1067
  'Go to Bottom' => __( 'Go to Bottom', 'media-library-assistant' ),
1068
+ 'Donations to Support MLA' => __( 'Donations to Support MLA', 'media-library-assistant' ),
1069
+ 'Donate to our fund' => __( 'Donate to our fund', 'media-library-assistant' ),
1070
+ 'Donate' => __( 'Donate', 'media-library-assistant' ),
1071
+ /* translators: 1: donation hyperlink */
1072
+ 'Donate Text' => sprintf( __( '<strong>I do not solicit nor accept personal donations in support of the plugin.</strong> WordPress and its global community means a lot to me and I am happy to give something back.
1073
+ <br />&nbsp;<br />
1074
+ If you find the Media Library Assistant plugin useful and would like to support a great cause, consider a %1$s to our Chateau Seaview Fund at the Golden West Chapter of the ALS Association. Every dollar of the fund goes to make the lives of people with ALS, their families and caregivers easier. Thank you!', 'media-library-assistant' ), '<a href="http://webgw.alsa.org/goto/ChateauSeaviewFund" title="' . __( 'Donate to our fund', 'media-library-assistant' ) . '" target="_blank" style="font-weight:bold">' . __( 'tax-deductible donation', 'media-library-assistant' ) . '</a>' ),
1075
  'shortcode_list' => '',
1076
  'form_url' => admin_url( 'options-general.php' ) . '?page=mla-settings-menu-general&mla_tab=general',
1077
  'options_list' => '',
1267
 
1268
  $page_values = array();
1269
 
1270
+ // Saving the options can change the log file name, so do it first
 
 
1271
  if ( !empty( $_REQUEST['mla-debug-options-save'] ) ) {
1272
  check_admin_referer( MLACore::MLA_ADMIN_NONCE_ACTION, MLACore::MLA_ADMIN_NONCE_NAME );
1273
  $page_content = self::_save_debug_settings();
1274
  }
1275
 
1276
+ // Find the appropriate error log file
 
 
1277
  $error_log_name = MLACore::mla_get_option( MLACoreOptions::MLA_DEBUG_FILE );
1278
  if ( empty( $error_log_name ) ) {
1279
  $error_log_name = ini_get( 'error_log' );
1288
 
1289
  $error_log_exists = file_exists ( $error_log_name );
1290
 
1291
+ // Check for other page-level actions
 
 
1292
  if ( isset( $_REQUEST['mla_reset_log'] ) && 'true' == $_REQUEST['mla_reset_log'] ) {
1293
  $file_error = false;
1294
  $file_handle = @fopen( $error_log_name, 'w' );
1315
  }
1316
  }
1317
 
1318
+ // Start with any page-level options
 
 
1319
  $options_list = '';
1320
  foreach ( MLACoreOptions::$mla_option_definitions as $key => $value ) {
1321
  if ( 'debug' == $value['tab'] ) {
1323
  }
1324
  }
1325
 
1326
+ // Gather Debug Settings
 
 
1327
  $display_limit = MLACore::mla_get_option( MLACoreOptions::MLA_DEBUG_DISPLAY_LIMIT );
1328
  $debug_file = MLACore::mla_get_option( MLACoreOptions::MLA_DEBUG_FILE );
1329
  $replace_php = MLACore::mla_get_option( MLACoreOptions::MLA_DEBUG_REPLACE_PHP_LOG );
1330
  $php_reporting = MLACore::mla_get_option( MLACoreOptions::MLA_DEBUG_REPLACE_PHP_REPORTING );
1331
  $mla_reporting = MLACore::mla_get_option( MLACoreOptions::MLA_DEBUG_REPLACE_LEVEL );
1332
+ $taxonomy_columns = MLACore::mla_get_option( MLACoreOptions::MLA_DEBUG_ADD_TAXONOMY_COLUMNS );
1333
 
1334
  if ( $error_log_exists ) {
1335
+ // Add debug content
 
 
1336
  $display_limit = absint( MLACore::mla_get_option( MLACoreOptions::MLA_DEBUG_DISPLAY_LIMIT ) );
1337
  $error_log_size = filesize( $error_log_name );
1338
 
1454
  $current_tab_slug = isset( $_REQUEST['mla_tab'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['mla_tab'] ) ): 'general';
1455
  $current_tab = self::_get_options_tablist( $current_tab_slug );
1456
  $page_values = array(
1457
+ 'Donate to our fund' => __( 'Donate to our fund', 'media-library-assistant' ),
1458
+ 'Donate' => __( 'Donate', 'media-library-assistant' ),
1459
  'version' => 'v' . MLACore::CURRENT_MLA_VERSION,
1460
  'development' => $development_version,
1461
  'messages' => '',
1811
  fclose($file_handle);
1812
 
1813
  /* translators: 1: number of option settings */
1814
+ $page_content['message'] = sprintf( __( 'Settings exported; %1$s settings recorded in %2$s.', 'media-library-assistant' ), $stored_count, $filename );
1815
 
1816
  /*
1817
  * Uncomment this for debugging.
includes/class-mla-shortcode-support.php CHANGED
@@ -247,11 +247,7 @@ class MLAShortcode_Support {
247
  public static function mla_validate_attributes( $attr, $content = NULL ) {
248
  //error_log( __LINE__ . " mla_validate_attributes() attr = " . var_export( $attr, true ), 0 );
249
  //error_log( __LINE__ . " mla_validate_attributes() content = " . var_export( $content, true ), 0 );
250
- /* if ( empty( $attr ) ) {
251
- $attr = array();
252
- } elseif ( is_string( $attr ) ) {
253
- $attr = shortcode_parse_atts( $attr );
254
- } // */
255
  if ( is_string( $attr ) ) {
256
  $attr = shortcode_parse_atts( $attr );
257
  }
@@ -279,7 +275,7 @@ class MLAShortcode_Support {
279
  foreach ( $attr as $key => $value ) {
280
  $value = str_replace( array( '&#038;', '&#8216;', '&#8217;', '&#8220;', '&#8221;', '&#8242;', '&#8243;', '&amp;', '<br />', '<br>', '<p>', '</p>', "\r", "\n", "\t" ),
281
  array( '&', '\'', '\'', '"', '"', '\'', '"', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ), $value );
282
- //error_log( __LINE__ . " mla_validate_attributes() value = " . var_export( $value, true ), 0 );
283
  $break_tag = strpos( $value, '<br' );
284
  if ( ( false !== $break_tag ) && ( ($break_tag + 3) == strlen( $value ) ) ) {
285
  $value = substr( $value, 0, ( strlen( $value ) - 3) );
@@ -320,11 +316,12 @@ class MLAShortcode_Support {
320
  $content = str_replace( array( '&#038;', '&#8216;', '&#8217;', '&#8220;', '&#8221;', '&#8242;', '&#8243;', '&amp;', '<br />', '<br>', '<p>', '</p>', "\r", "\n", "\t" ),
321
  array( '&', '\'', '\'', '"', '"', '\'', '"', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ), $content );
322
  $content_attr = shortcode_parse_atts( $content );
 
323
  if ( is_array( $content_attr ) ) {
324
  // Remove empty values and still-invalid parameters
325
  $new_attr = array();
326
  foreach ( $content_attr as $key => $value ) {
327
- if ( is_numeric( $key ) || empty( $value ) ) {
328
  self::$attributes_errors['raw'][] = 'content [' . $key . '] => ' . $value;
329
  self::$attributes_errors['escaped'][] = 'content [' . $key . '] => ' . esc_html( $value );
330
  continue;
@@ -512,6 +509,7 @@ class MLAShortcode_Support {
512
  'mla_alt_shortcode' => NULL,
513
  'mla_alt_ids_name' => 'ids',
514
  'mla_alt_ids_template' => NULL,
 
515
 
516
  // paginatation arguments defined in $mla_get_shortcode_attachments_parameters
517
  // 'mla_page_parameter' => 'mla_paginate_current', handled in code with $mla_page_parameter
@@ -609,6 +607,7 @@ class MLAShortcode_Support {
609
  $arguments['mla_alt_ids_name'] = 'ids';
610
  $arguments['mla_alt_ids_value'] = NULL;
611
  $arguments['mla_alt_ids_template'] = NULL;
 
612
  }
613
 
614
  self::$mla_debug = ( ! empty( $arguments['mla_debug'] ) ) ? trim( strtolower( $arguments['mla_debug'] ) ) : false;
@@ -783,10 +782,20 @@ class MLAShortcode_Support {
783
 
784
  $blacklist = apply_filters( 'mla_gallery_alt_shortcode_blacklist', $blacklist );
785
  $alt_attr = apply_filters( 'mla_gallery_alt_shortcode_attributes', $attr );
 
786
 
787
- $mla_alt_shortcode_args = '';
 
 
 
 
 
 
 
 
 
788
  foreach ( $alt_attr as $key => $value ) {
789
- if ( array_key_exists( $key, $blacklist ) ) {
790
  continue;
791
  }
792
 
@@ -795,11 +804,16 @@ class MLAShortcode_Support {
795
  $value = '"' . $slashed . '"';
796
  }
797
 
798
- $mla_alt_shortcode_args .= empty( $mla_alt_shortcode_args ) ? $key . '=' . $value : ' ' . $key . '=' . $value;
799
  } // foreach $attr
 
 
 
 
800
 
801
  // Restore original delimiters
802
  $mla_alt_shortcode_args = str_replace( '[+', '{+', str_replace( '+]', '+}', $mla_alt_shortcode_args ) );
 
803
 
804
  /*
805
  * If an alternate value has been specified we must delay alt shortcode execution
@@ -1339,8 +1353,20 @@ class MLAShortcode_Support {
1339
  remove_filter( 'wp_get_attachment_image_src', 'MLAShortcode_Support::_get_attachment_image_src' );
1340
  }
1341
  } else {
1342
- $item_values['pagelink'] = sprintf( '<a href=\'%1$s\'>%2$s</a>', $attachment->guid, $attachment->post_title );
1343
- $item_values['filelink'] = sprintf( '<a href=\'%1$s\'>%2$s</a>', get_permalink( $attachment->ID ), $attachment->post_title );
 
 
 
 
 
 
 
 
 
 
 
 
1344
  }
1345
 
1346
  if ( in_array( $attachment->post_mime_type, array( 'image/svg+xml' ) ) ) {
@@ -1914,7 +1940,8 @@ class MLAShortcode_Support {
1914
  'mla_link_text' => '',
1915
  'mla_nolink_text' => '',
1916
  'mla_rollover_text' => '',
1917
- 'mla_caption' => ''
 
1918
  );
1919
 
1920
  $defaults = array_merge(
@@ -1922,6 +1949,7 @@ class MLAShortcode_Support {
1922
  array(
1923
  'smallest' => 8,
1924
  'largest' => 22,
 
1925
  'unit' => 'pt',
1926
  'separator' => "\n",
1927
  'single_text' => '%d item',
@@ -1946,6 +1974,13 @@ class MLAShortcode_Support {
1946
  'mla_target' => '',
1947
  'mla_debug' => false,
1948
 
 
 
 
 
 
 
 
1949
  // Pagination parameters
1950
  'term_id' => NULL,
1951
  'mla_end_size'=> 1,
@@ -1953,9 +1988,10 @@ class MLAShortcode_Support {
1953
  'mla_prev_text' => '&laquo; ' . __( 'Previous', 'media-library-assistant' ),
1954
  'mla_next_text' => __( 'Next', 'media-library-assistant' ) . ' &raquo;',
1955
  'mla_page_parameter' => 'mla_cloud_current',
1956
- 'mla_cloud_current' => NULL,
1957
  'mla_paginate_total' => NULL,
1958
  'mla_paginate_type' => 'plain'),
 
1959
  $mla_item_specific_arguments
1960
  );
1961
 
@@ -2048,8 +2084,8 @@ class MLAShortcode_Support {
2048
  * $mla_page_parameter, if non-default, doesn't make it through the shortcode_atts
2049
  * filter, so we handle it separately
2050
  */
2051
- if ( ! isset( $arguments[ $mla_page_parameter ] ) ) {
2052
- if ( isset( $attr[ $mla_page_parameter ] ) ) {
2053
  $arguments[ $mla_page_parameter ] = $attr[ $mla_page_parameter ];
2054
  } else {
2055
  $arguments[ $mla_page_parameter ] = $defaults['mla_cloud_current'];
@@ -2059,7 +2095,7 @@ class MLAShortcode_Support {
2059
 
2060
  // Process the pagination parameter, if present
2061
  if ( isset( $arguments[ $mla_page_parameter ] ) ) {
2062
- $arguments['offset'] = $arguments['limit'] * ( $arguments[ $mla_page_parameter ] - 1);
2063
  }
2064
 
2065
  // Clean up the current_item to separate term_id from slug
@@ -2204,6 +2240,12 @@ class MLAShortcode_Support {
2204
  return;
2205
  }
2206
 
 
 
 
 
 
 
2207
  // Fill in the item_specific link properties, calculate cloud parameters
2208
  if ( isset( $tags['found_rows'] ) ) {
2209
  $found_rows = $tags['found_rows'];
@@ -2212,7 +2254,7 @@ class MLAShortcode_Support {
2212
  $found_rows = count( $tags );
2213
  }
2214
 
2215
- if ( 0 == $found_rows ) {
2216
  if ( self::$mla_debug ) {
2217
  MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug empty cloud', 'media-library-assistant' ) . '</strong>, query = ' . var_export( $arguments, true ) );
2218
  $cloud = MLACore::mla_debug_flush();
@@ -2239,7 +2281,7 @@ class MLAShortcode_Support {
2239
 
2240
  echo $cloud; // phpcs:ignore
2241
  return;
2242
- }
2243
 
2244
  if ( self::$mla_debug ) {
2245
  $cloud = MLACore::mla_debug_flush();
@@ -2300,6 +2342,121 @@ class MLAShortcode_Support {
2300
  }
2301
  } // foreach tag
2302
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2303
  /*
2304
  * The default MLA style template includes "margin: 1.5%" to put a bit of
2305
  * minimum space between the columns. "mla_margin" can be used to change
@@ -2570,7 +2727,13 @@ class MLAShortcode_Support {
2570
  $item_values['parent'] = $tag->parent;
2571
  $item_values['count'] = isset ( $tag->count ) ? $tag->count : 0;
2572
  $item_values['scaled_count'] = $tag->scaled_count;
2573
- $item_values['font_size'] = str_replace( ',', '.', ( $item_values['smallest'] + ( ( $item_values['scaled_count'] - $item_values['min_scaled_count'] ) * $item_values['font_step'] ) ) );
 
 
 
 
 
 
2574
  $item_values['link_url'] = $tag->link;
2575
  $item_values['currentlink_url'] = sprintf( '%1$s%2$scurrent_item=%3$d', $item_values['page_url'], $current_item_delimiter, $item_values['term_id'] );
2576
  $item_values['editlink_url'] = $tag->edit_link;
@@ -2593,7 +2756,6 @@ class MLAShortcode_Support {
2593
  $item_values['current_item_class'] = $arguments['current_item_class'];
2594
  }
2595
  } else {
2596
- // if ( $arguments['current_item'] == $tag->slug ) {
2597
  if ( $tag->slug == sanitize_title_for_query( $arguments['current_item'] ) ) {
2598
  $item_values['current_item_class'] = $arguments['current_item_class'];
2599
  }
@@ -2637,7 +2799,11 @@ class MLAShortcode_Support {
2637
 
2638
  $item_values['link_attributes'] = $link_attributes;
2639
 
2640
- $item_values['rollover_text'] = sprintf( _n( $item_values['single_text'], $item_values['multiple_text'], $item_values['count'], 'media-library-assistant' ), number_format_i18n( $item_values['count'] ) );
 
 
 
 
2641
  if ( ! empty( $arguments['mla_rollover_text'] ) ) {
2642
  $item_values['rollover_text'] = esc_attr( self::_process_shortcode_parameter( $arguments['mla_rollover_text'], $item_values ) );
2643
  }
@@ -2661,8 +2827,14 @@ class MLAShortcode_Support {
2661
  $item_values['link_text'] = $item_values['name'];
2662
  }
2663
 
 
 
 
 
 
 
2664
  // Currentlink, editlink, termlink and thelink
2665
- $item_values['currentlink'] = sprintf( '<a %1$shref="%2$s%3$scurrent_item=%4$d" title="%5$s" style="%6$s">%7$s</a>', $link_attributes, $item_values['page_url'], $current_item_delimiter, $item_values['term_id'], $item_values['rollover_text'], $item_values['link_style'], $item_values['link_text'] );
2666
  $item_values['editlink'] = sprintf( '<a %1$shref="%2$s" title="%3$s" style="%4$s">%5$s</a>', $link_attributes, $item_values['editlink_url'], $item_values['rollover_text'], $item_values['link_style'], $item_values['link_text'] );
2667
  $item_values['termlink'] = sprintf( '<a %1$shref="%2$s" title="%3$s" style="%4$s">%5$s</a>', $link_attributes, $item_values['termlink_url'], $item_values['rollover_text'], $item_values['link_style'], $item_values['link_text'] );
2668
 
@@ -2820,7 +2992,11 @@ class MLAShortcode_Support {
2820
  $combine_hierarchical = 'combine' === $arguments['hierarchical'];
2821
 
2822
  // Using the slug is a common practice and affects current_item
2823
- $current_is_slug = in_array( $arguments['mla_option_value'], array( '{+slug+}', '[+slug+]' ) );
 
 
 
 
2824
 
2825
  if ( $is_list || $is_dropdown || $is_checklist ) {
2826
  if ( $term->parent ) {
@@ -2835,16 +3011,16 @@ class MLAShortcode_Support {
2835
 
2836
  // Fall back to default template if no Open section
2837
  if ( false === $open_template ) {
2838
- $markup_values['mla_markup'] = $default_markup;
2839
 
2840
  if ( $term->parent ) {
2841
- $open_template = MLATemplate_support::mla_fetch_custom_template( $default_markup, 'term-list', 'markup', 'child-open' );
2842
  } else {
2843
  $open_template = false;
2844
  }
2845
 
2846
  if ( false === $open_template ) {
2847
- $open_template = MLATemplate_support::mla_fetch_custom_template( $default_markup, 'term-list', 'markup', 'open' );
2848
  }
2849
  }
2850
 
@@ -2895,7 +3071,7 @@ class MLAShortcode_Support {
2895
 
2896
  $list .= apply_filters( 'mla_term_list_open_parse', $gallery_open, $open_template, $markup_values );
2897
  }
2898
- } // is_list
2899
 
2900
  // Find delimiter for currentlink, currentlink_url
2901
  if ( strpos( $markup_values['page_url'], '?' ) ) {
@@ -2954,14 +3130,13 @@ class MLAShortcode_Support {
2954
  }
2955
 
2956
  if ( $current_is_slug || !( ctype_digit( $current_item ) || is_int( $current_item ) ) ) {
2957
- // if ( $current_item == $term->slug ) {
2958
- if ( $term->slug == sanitize_title_for_query( $current_item ) ) {
2959
  $is_active = true;
2960
  $item_values['current_item_class'] = $arguments['current_item_class'];
2961
  break;
2962
  }
2963
  } else {
2964
- if ( $current_item == $term->term_id ) {
2965
  $is_active = true;
2966
  $item_values['current_item_class'] = $arguments['current_item_class'];
2967
  break;
@@ -3004,9 +3179,12 @@ class MLAShortcode_Support {
3004
 
3005
  $item_values['link_attributes'] = $link_attributes;
3006
 
3007
- $item_values['rollover_text'] = sprintf( _n( $item_values['single_text'], $item_values['multiple_text'], $item_values['count'], 'media-library-assistant' ), number_format_i18n( $item_values['count'] ) );
3008
- if ( ! empty( $arguments['mla_rollover_text'] ) ) {
3009
- $item_values['rollover_text'] = esc_attr( self::_process_shortcode_parameter( $arguments['mla_rollover_text'], $item_values ) );
 
 
 
3010
  }
3011
 
3012
  if ( ! empty( $arguments['mla_link_href'] ) ) {
@@ -3023,7 +3201,7 @@ class MLAShortcode_Support {
3023
  }
3024
 
3025
  if ( ! empty( $arguments['show_count'] ) && ( 'true' == strtolower( $arguments['show_count'] ) ) ) {
3026
- // Ignore option-all
3027
  if ( -1 !== $item_values['count'] ) {
3028
  $item_values['link_text'] .= ' (' . $item_values['count'] . ')';
3029
  }
@@ -3242,8 +3420,14 @@ class MLAShortcode_Support {
3242
  'mla_nolink_text' => '',
3243
  'mla_target' => '',
3244
  'hide_if_empty' => false,
 
3245
  'option_all_text' => '',
3246
  'option_all_value' => NULL,
 
 
 
 
 
3247
  'option_none_text' => '',
3248
  'option_none_value' => NULL,
3249
 
@@ -3471,10 +3655,12 @@ class MLAShortcode_Support {
3471
  $arguments['termtag'] = 'li';
3472
  }
3473
 
 
3474
  if ( NULL == $arguments['mla_style'] ) {
3475
  $arguments['mla_style'] = $default_style;
3476
  }
3477
 
 
3478
  if ( NULL == $arguments['mla_markup'] ) {
3479
  $arguments['mla_markup'] = $default_markup;
3480
  }
@@ -3613,26 +3799,63 @@ class MLAShortcode_Support {
3613
  $list = '';
3614
  }
3615
 
3616
- $add_all_option = ( $is_checklist || $is_dropdown ) && ! empty( $arguments['option_all_text'] ) && !$show_empty;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3617
 
3618
- // Using the slug is a common practice and affects option_all_value
 
 
3619
  if ( $add_all_option ) {
3620
  if ( ! empty( $arguments['option_all_value'] ) ) {
3621
  $option_all_value = self::_process_shortcode_parameter( $arguments['option_all_value'], $page_values );
3622
  if ( is_numeric( $option_all_value ) ) {
3623
- $option_all_id = (int) $option_all_value;
3624
  $option_all_slug = sanitize_title( $arguments['option_all_text'] );
3625
  } else {
3626
- $option_all_id = 0;
3627
  $option_all_slug = sanitize_title( $option_all_value );
3628
  }
3629
- } else {
3630
- $option_all_id = 0;
3631
- $option_all_slug = sanitize_title( $arguments['option_all_text'] );
3632
  }
3633
- } else {
3634
- $option_all_id = 0;
3635
- $option_all_slug = 'all';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3636
  }
3637
 
3638
  if ( $is_hierarchical ) {
@@ -3691,12 +3914,18 @@ class MLAShortcode_Support {
3691
  $tags[ $key ]->link = $tags[ $key ]->term_link;
3692
  }
3693
  } // foreach tag
3694
- }
3695
- }
3696
 
3697
  if ( $add_all_option ) {
3698
  $found_rows += 1;
3699
  }
 
 
 
 
 
 
3700
 
3701
  $style_values = array_merge( $page_values, array(
3702
  'mla_output' => $arguments['mla_output'],
@@ -3753,7 +3982,6 @@ class MLAShortcode_Support {
3753
  $tag_links = array();
3754
 
3755
  if ( $is_hierarchical ) {
3756
-
3757
  if ( $combine_hierarchical ) {
3758
  $combined_tags = array();
3759
  foreach( $tags as $taxonomy => $root_terms ) {
@@ -3766,9 +3994,53 @@ class MLAShortcode_Support {
3766
  $markup_values['taxonomy'] = $taxonomy;
3767
  $markup_values['thename'] = self::_process_shortcode_parameter( $mla_control_name, $markup_values );
3768
 
3769
- // Add the optional 'all-terms' option, if requested
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3770
  if ( $add_all_option ) {
3771
- $option_all = ( object ) array(
3772
  'term_id' => $option_all_id,
3773
  'name' => $arguments['option_all_text'],
3774
  'slug' => $option_all_slug,
@@ -3777,17 +4049,15 @@ class MLAShortcode_Support {
3777
  'taxonomy' => $taxonomy,
3778
  'description' => '',
3779
  'parent' => '0',
3780
- 'count' => -1,
3781
  'level' => 0,
3782
  'edit_link' => '',
3783
  'term_link' => '',
3784
  'link' => '',
3785
  );
3786
 
3787
- array_unshift( $root_terms, $option_all );
3788
- $add_to_found_rows = 1;
3789
- } else {
3790
- $add_to_found_rows = 0;
3791
  }
3792
 
3793
  if ( isset( $root_terms['found_rows'] ) ) {
@@ -3804,15 +4074,55 @@ class MLAShortcode_Support {
3804
  } else {
3805
  $markup_values['thename'] = self::_process_shortcode_parameter( $mla_control_name, $markup_values );
3806
 
3807
- // Add the optional 'all-terms' option, if requested
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3808
  if ( $add_all_option ) {
3809
- $option_all = ( object ) array(
3810
  'term_id' => $option_all_id,
3811
  'name' => $arguments['option_all_text'],
3812
  'slug' => $option_all_slug,
3813
  'term_group' => '0',
3814
  'term_taxonomy_id' => $option_all_id,
3815
- 'taxonomy' => $markup_values['taxonomy'],
3816
  'description' => '',
3817
  'parent' => '0',
3818
  'count' => -1,
@@ -3822,7 +4132,7 @@ class MLAShortcode_Support {
3822
  'link' => '',
3823
  );
3824
 
3825
- array_unshift( $tags, $option_all );
3826
  }
3827
 
3828
  if ( count( $tags ) ) {
@@ -3830,7 +4140,7 @@ class MLAShortcode_Support {
3830
  }
3831
  }
3832
 
3833
- if ( 'array' == $arguments['mla_output'] || empty($arguments['echo']) ) {
3834
  return $list;
3835
  }
3836
 
@@ -4472,7 +4782,7 @@ class MLAShortcode_Support {
4472
  }
4473
 
4474
  // Look for simple quoted string, integer value or "undefined constant", e.g., in 'terms' =>
4475
- if ( 1 === preg_match( '/^(([\'\"](.+?)[\'\"])|(\d+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*))(.*)$/', $interior, $matches ) ) {
4476
  //error_log( __LINE__ . " _validate_array_specification() simple matches = " . var_export( $matches, true ), 0 );
4477
 
4478
  $interior = trim( $matches[6], ' ,' );
@@ -4730,6 +5040,7 @@ class MLAShortcode_Support {
4730
  'cache_results' => NULL,
4731
  'update_post_meta_cache' => NULL,
4732
  'update_post_term_cache' => NULL,
 
4733
  'mla_allow_rml' => false,
4734
  'mla_rml_folder' => NULL,
4735
  'mla_rml_include_children' => false,
@@ -4773,13 +5084,20 @@ class MLAShortcode_Support {
4773
  *
4774
  * @param int Post ID of the parent
4775
  * @param array Attributes of the shortcode
4776
- * @param boolean true to calculate and return ['found_rows', 'max_num_pages'] as array elements
 
4777
  *
4778
  * @return array List of attachments returned from WP_Query
4779
  */
4780
- public static function mla_get_shortcode_attachments( $post_parent, $attr, $return_found_rows = NULL ) {
4781
  global $wp_query;
4782
 
 
 
 
 
 
 
4783
  // Parameters passed to the join, where and orderby filter functions
4784
  self::$query_parameters = array( MLAQuery::MLA_ALT_TEXT_SUBQUERY => false, MLAQuery::MLA_FILE_SUBQUERY => false, );
4785
 
@@ -4870,7 +5188,7 @@ class MLAShortcode_Support {
4870
  // Extract taxonomy arguments
4871
  self::$mla_get_shortcode_dynamic_attachments_parameters = array();
4872
  $query_arguments = array();
4873
- $no_terms_assigned_query = false;
4874
  if ( ! empty( $attr ) ) {
4875
  $all_taxonomies = get_taxonomies( array ( 'show_ui' => true ), 'names' );
4876
  $simple_tax_queries = array();
@@ -4893,6 +5211,7 @@ class MLAShortcode_Support {
4893
  } else {
4894
  // If sanitization fails, return an error message
4895
  if ( 'false' === $value ) {
 
4896
  return '<p>' . __( 'ERROR', 'media-library-assistant' ) . ': ' . __( 'Invalid mla_gallery', 'media-library-assistant' ) . ' tax_query = ' . self::$array_specification_error . '</p>';
4897
  }
4898
  }
@@ -4906,7 +5225,7 @@ class MLAShortcode_Support {
4906
  }
4907
 
4908
  if ( is_array( $tax_query ) ) {
4909
- // Check for no.terms.assigned
4910
  foreach ( $tax_query as $tax_query_key => $tax_query_element ) {
4911
  if ( !is_array( $tax_query_element ) ) {
4912
  continue;
@@ -4918,42 +5237,90 @@ class MLAShortcode_Support {
4918
  continue;
4919
  }
4920
 
4921
- if ( isset( $tax_query_element['terms'] ) && is_array( $tax_query_element['terms'] ) && in_array( 'no.terms.assigned', $tax_query_element['terms'] ) ) {
4922
- $tax_query[ $tax_query_key ]['terms'] = MLAQuery::mla_wp_get_terms( $tax_query_taxonomy, array(
4923
- 'fields' => 'ids',
4924
- 'hide_empty' => false
4925
- ) );
4926
- }
4927
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4928
 
4929
  $query_arguments[ $key ] = $tax_query;
4930
  self::$mla_get_shortcode_dynamic_attachments_parameters[ $key ] = $value;
4931
  break; // Done - the tax_query overrides all other taxonomy parameters
4932
  } else {
 
4933
  return '<p>' . __( 'ERROR', 'media-library-assistant' ) . ': ' . __( 'Invalid mla_gallery', 'media-library-assistant' ) . ' tax_query = ' . var_export( $value, true ) . '</p>';
4934
  } // generated value is not an array
4935
  } // $tax_query is a string, not array
4936
  } // attr is 'tax_query'
4937
  elseif ( 'tax_input' == $key ) {
4938
- $tax_queries = array();
4939
- $compound_values = array_filter( array_map( 'trim', explode( ',', $value ) ) );
4940
- foreach ( $compound_values as $compound_value ) {
4941
- $value = explode( '.', $compound_value );
4942
- if ( 2 === count( $value ) ) {
4943
- if ( array_key_exists( $value[0], $all_taxonomies ) ) {
4944
- $tax_queries[ $value[0] ][] = $value[1];
4945
- } // valid taxonomy
4946
- } // valid coumpound value
4947
- } // foreach compound_value
 
 
 
 
4948
 
4949
  foreach( $tax_queries as $key => $value ) {
4950
- $simple_tax_queries[ $key ] = implode(',', $value );
 
 
 
 
 
 
 
4951
  }
4952
  } // tax_input
4953
  elseif ( array_key_exists( $key, $all_taxonomies ) ) {
4954
- $simple_tax_queries[ $key ] = implode(',', array_filter( array_map( 'trim', explode( ',', $value ) ) ) );
4955
- if ( 'no.terms.assigned' === $simple_tax_queries[ $key ] ) {
4956
- $no_terms_assigned_query = true;
 
 
 
 
4957
  }
4958
  } // array_key_exists
4959
  } //foreach $attr
@@ -4968,7 +5335,7 @@ class MLAShortcode_Support {
4968
  */
4969
  if ( isset( $query_arguments['tax_query'] ) || empty( $simple_tax_queries ) ) {
4970
  // No further action required
4971
- } elseif ( ( 1 < count( $simple_tax_queries ) ) || isset( $attr['tax_operator'] ) || isset( $attr['tax_include_children'] ) || $no_terms_assigned_query ) {
4972
  // Build a tax_query
4973
  if ( 1 < count( $simple_tax_queries ) ) {
4974
  $tax_relation = 'AND';
@@ -4999,28 +5366,31 @@ class MLAShortcode_Support {
4999
  }
5000
 
5001
  foreach( $simple_tax_queries as $key => $value ) {
5002
- if ( empty( $value ) ) {
 
5003
  continue;
5004
  }
5005
 
5006
- if ( 'no.terms.assigned' === $value ) {
5007
- $term_list = MLAQuery::mla_wp_get_terms( $key, array(
5008
- 'fields' => 'ids',
5009
- 'hide_empty' => false
5010
- ) );
 
 
 
5011
 
 
5012
  $tax_query[] = array(
5013
  'taxonomy' => $key,
5014
- 'field' => 'id',
5015
- 'terms' => $term_list,
5016
- 'operator' => 'NOT IN'
5017
  );
5018
 
5019
  continue;
5020
  }
5021
 
5022
  $tax_query[] = array( 'taxonomy' => $key, 'field' => 'slug', 'terms' => explode( ',', $value ), 'operator' => $tax_operator, 'include_children' => $tax_include_children );
5023
- }
5024
 
5025
  $query_arguments['tax_query'] = $tax_query;
5026
  self::$mla_get_shortcode_dynamic_attachments_parameters['tax_query'] = $tax_query;
@@ -5375,6 +5745,7 @@ class MLAShortcode_Support {
5375
  } else {
5376
  // If sanitization fails, return an error message
5377
  if ( 'false' === $value ) {
 
5378
  return '<p>' . __( 'ERROR', 'media-library-assistant' ) . ': ' . __( 'Invalid mla_gallery', 'media-library-assistant' ) . ' date_query = ' . self::$array_specification_error . '</p>';
5379
  }
5380
  }
@@ -5390,6 +5761,7 @@ class MLAShortcode_Support {
5390
  if ( is_array( $date_query ) ) {
5391
  $query_arguments[ $key ] = $date_query;
5392
  } else {
 
5393
  return '<p>' . __( 'ERROR', 'media-library-assistant' ) . ': ' . __( 'Invalid mla_gallery', 'media-library-assistant' ) . ' date_query = ' . var_export( $value, true ) . '</p>';
5394
  }
5395
  } // not array
@@ -5412,6 +5784,7 @@ class MLAShortcode_Support {
5412
  } else {
5413
  // If sanitization fails, return an error message
5414
  if ( 'false' === $value ) {
 
5415
  return '<p>' . __( 'ERROR', 'media-library-assistant' ) . ': ' . __( 'Invalid mla_gallery', 'media-library-assistant' ) . ' meta_query = ' . self::$array_specification_error . '</p>';
5416
  }
5417
  }
@@ -5427,6 +5800,7 @@ class MLAShortcode_Support {
5427
  if ( is_array( $meta_query ) ) {
5428
  $query_arguments[ $key ] = $meta_query;
5429
  } else {
 
5430
  return '<p>' . __( 'ERROR', 'media-library-assistant' ) . ': ' . __( 'Invalid mla_gallery', 'media-library-assistant' ) . ' meta_query = ' . var_export( $value, true ) . '</p>';
5431
  }
5432
  } // not array
@@ -5748,10 +6122,13 @@ class MLAShortcode_Support {
5748
  MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug request', 'media-library-assistant' ) . '</strong> = ' . var_export( MLAShortcodes::$mla_gallery_wp_query_object->request, true ) );
5749
  MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug query_vars', 'media-library-assistant' ) . '</strong> = ' . var_export( MLAShortcodes::$mla_gallery_wp_query_object->query_vars, true ) );
5750
  MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug post_count', 'media-library-assistant' ) . '</strong> = ' . var_export( MLAShortcodes::$mla_gallery_wp_query_object->post_count, true ) );
 
5751
  }
5752
 
5753
  MLAQuery::$search_parameters = array( 'debug' => 'none' );
5754
  MLAShortcodes::$mla_gallery_wp_query_object = NULL;
 
 
5755
  return $attachments;
5756
  }
5757
 
@@ -5961,6 +6338,146 @@ class MLAShortcode_Support {
5961
  return $pieces;
5962
  }
5963
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5964
  /**
5965
  * Data selection parameters for [mla_tag_cloud], [mla_term_list]
5966
  *
@@ -5990,7 +6507,6 @@ class MLAShortcode_Support {
5990
  'offset' => 0
5991
  );
5992
 
5993
-
5994
  /**
5995
  * Retrieve the terms in one or more taxonomies.
5996
  *
@@ -6247,7 +6763,8 @@ class MLAShortcode_Support {
6247
  }
6248
 
6249
  if ( 'all' !== strtolower( $arguments['post_mime_type'] ) ) {
6250
- $where = str_replace( '%', '%%', wp_post_mime_type_where( $arguments['post_mime_type'], 'p' ) );
 
6251
 
6252
  if ( 0 == absint( $arguments['minimum'] ) ) {
6253
  $clause[] = ' AND ( p.post_mime_type IS NULL OR ' . substr( $where, 6 );
@@ -6387,12 +6904,11 @@ class MLAShortcode_Support {
6387
  }
6388
 
6389
  if ( 'true' == strtolower( trim( $arguments['pad_counts'] ) ) ) {
6390
- self::_pad_term_counts( $tags, reset( $taxonomies ), $post_types, $post_stati );
6391
  }
6392
 
6393
  $tags['found_rows'] = $found_rows;
6394
  $tags = apply_filters( 'mla_get_terms_query_results', $tags );
6395
-
6396
  return $tags;
6397
  } // mla_get_terms
6398
 
@@ -6709,9 +7225,10 @@ class MLAShortcode_Support {
6709
  * @param string Term Context
6710
  * @param array Qualifying post type value(s)
6711
  * @param array Qualifying post status value(s)
 
6712
  * @return null Will break from function if conditions are not met.
6713
  */
6714
- private static function _pad_term_counts( &$terms, $taxonomy, $post_types = NULL, $post_stati = NULL ) {
6715
  global $wpdb;
6716
 
6717
  // This function only works for hierarchical taxonomies like post categories.
@@ -6719,18 +7236,19 @@ class MLAShortcode_Support {
6719
  return;
6720
  }
6721
 
6722
- // WordPress "private" function, in /wp-includes/taxonomy.php
6723
  $term_hier = _get_term_hierarchy( $taxonomy );
6724
 
6725
  if ( empty( $term_hier ) ) {
6726
  return;
6727
- }
6728
 
6729
  $terms_by_id = array(); // key term_id, value = reference to term object
6730
  $term_ids = array(); // key term_taxonomy_id, value = term_id
6731
  $term_items = array(); // key term_id
6732
 
6733
- foreach ( (array) $terms as $key => $term ) {
 
6734
  if ( is_integer( $key ) ) {
6735
  $terms_by_id[$term->term_id] = & $terms[$key];
6736
  $term_ids[$term->term_taxonomy_id] = $term->term_id;
@@ -6751,7 +7269,7 @@ class MLAShortcode_Support {
6751
  }
6752
 
6753
  // Get the object and term ids and stick them in a lookup table
6754
- $results = $wpdb->get_results( "SELECT object_id, term_taxonomy_id FROM $wpdb->term_relationships INNER JOIN $wpdb->posts ON object_id = ID WHERE term_taxonomy_id IN (" . implode( ',', array_keys($term_ids) ) . ") AND post_type IN ('" . implode( "', '", $post_types ) . "') AND post_status in ( '" . implode( "', '", $post_stati ) . "' )" );
6755
  foreach ( $results as $row ) {
6756
  $id = $term_ids[ $row->term_taxonomy_id ];
6757
  $term_items[ $id ][ $row->object_id ] = isset( $term_items[ $id ][ $row->object_id ] ) ? ++$term_items[ $id ][ $row->object_id ] : 1;
247
  public static function mla_validate_attributes( $attr, $content = NULL ) {
248
  //error_log( __LINE__ . " mla_validate_attributes() attr = " . var_export( $attr, true ), 0 );
249
  //error_log( __LINE__ . " mla_validate_attributes() content = " . var_export( $content, true ), 0 );
250
+
 
 
 
 
251
  if ( is_string( $attr ) ) {
252
  $attr = shortcode_parse_atts( $attr );
253
  }
275
  foreach ( $attr as $key => $value ) {
276
  $value = str_replace( array( '&#038;', '&#8216;', '&#8217;', '&#8220;', '&#8221;', '&#8242;', '&#8243;', '&amp;', '<br />', '<br>', '<p>', '</p>', "\r", "\n", "\t" ),
277
  array( '&', '\'', '\'', '"', '"', '\'', '"', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ), $value );
278
+ //error_log( __LINE__ . " mla_validate_attributes() [{$key}] value = " . var_export( $value, true ), 0 );
279
  $break_tag = strpos( $value, '<br' );
280
  if ( ( false !== $break_tag ) && ( ($break_tag + 3) == strlen( $value ) ) ) {
281
  $value = substr( $value, 0, ( strlen( $value ) - 3) );
316
  $content = str_replace( array( '&#038;', '&#8216;', '&#8217;', '&#8220;', '&#8221;', '&#8242;', '&#8243;', '&amp;', '<br />', '<br>', '<p>', '</p>', "\r", "\n", "\t" ),
317
  array( '&', '\'', '\'', '"', '"', '\'', '"', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ), $content );
318
  $content_attr = shortcode_parse_atts( $content );
319
+ //error_log( __LINE__ . " mla_validate_attributes() content_attr = " . var_export( $content_attr, true ), 0 );
320
  if ( is_array( $content_attr ) ) {
321
  // Remove empty values and still-invalid parameters
322
  $new_attr = array();
323
  foreach ( $content_attr as $key => $value ) {
324
+ if ( is_numeric( $key ) || ( 0 === strlen( $value ) ) ) { // empty( $value ) ) {
325
  self::$attributes_errors['raw'][] = 'content [' . $key . '] => ' . $value;
326
  self::$attributes_errors['escaped'][] = 'content [' . $key . '] => ' . esc_html( $value );
327
  continue;
509
  'mla_alt_shortcode' => NULL,
510
  'mla_alt_ids_name' => 'ids',
511
  'mla_alt_ids_template' => NULL,
512
+ 'mla_alt_parameters' => NULL,
513
 
514
  // paginatation arguments defined in $mla_get_shortcode_attachments_parameters
515
  // 'mla_page_parameter' => 'mla_paginate_current', handled in code with $mla_page_parameter
607
  $arguments['mla_alt_ids_name'] = 'ids';
608
  $arguments['mla_alt_ids_value'] = NULL;
609
  $arguments['mla_alt_ids_template'] = NULL;
610
+ $arguments['mla_alt_parameters'] = NULL;
611
  }
612
 
613
  self::$mla_debug = ( ! empty( $arguments['mla_debug'] ) ) ? trim( strtolower( $arguments['mla_debug'] ) ) : false;
782
 
783
  $blacklist = apply_filters( 'mla_gallery_alt_shortcode_blacklist', $blacklist );
784
  $alt_attr = apply_filters( 'mla_gallery_alt_shortcode_attributes', $attr );
785
+ //error_log( __LINE__ . " alt_attr = " . var_export( $alt_attr, true ), 0 );
786
 
787
+ // Allow for overide of blacklist values, e.g., post_mime_type
788
+ if ( !empty( $alt_attr['mla_alt_parameters'] ) ) {
789
+ $alt_parameters = self::mla_validate_attributes( $alt_attr['mla_alt_parameters'] );
790
+ //error_log( __LINE__ . " alt_parameters = " . var_export( $alt_parameters, true ), 0 );
791
+ unset( $alt_attr['mla_alt_parameters'] );
792
+ $alt_attr = array_merge( $alt_attr, $alt_parameters );
793
+ }
794
+ //error_log( __LINE__ . " alt_attr = " . var_export( $alt_attr, true ), 0 );
795
+
796
+ $mla_alt_shortcode_args = array();
797
  foreach ( $alt_attr as $key => $value ) {
798
+ if ( array_key_exists( $key, $blacklist ) && ( !array_key_exists( $key, $alt_parameters ) ) ) {
799
  continue;
800
  }
801
 
804
  $value = '"' . $slashed . '"';
805
  }
806
 
807
+ $mla_alt_shortcode_args[] = $key . '=' . $value;
808
  } // foreach $attr
809
+ //error_log( __LINE__ . " mla_alt_shortcode_args = " . var_export( $mla_alt_shortcode_args, true ), 0 );
810
+
811
+
812
+ $mla_alt_shortcode_args = implode( ' ', $mla_alt_shortcode_args );
813
 
814
  // Restore original delimiters
815
  $mla_alt_shortcode_args = str_replace( '[+', '{+', str_replace( '+]', '+}', $mla_alt_shortcode_args ) );
816
+ //error_log( __LINE__ . " mla_alt_shortcode_args = " . var_export( $mla_alt_shortcode_args, true ), 0 );
817
 
818
  /*
819
  * If an alternate value has been specified we must delay alt shortcode execution
1353
  remove_filter( 'wp_get_attachment_image_src', 'MLAShortcode_Support::_get_attachment_image_src' );
1354
  }
1355
  } else {
1356
+ $thumbnail_content = $attachment->post_title;
1357
+
1358
+ if ( ( 'none' !== $arguments['size'] ) && ( 'checked' == MLACore::mla_get_option( 'enable_featured_image' ) ) ) {
1359
+ // Look for the "Featured Image" as an alternate thumbnail for PDFs, etc.
1360
+ $thumb = get_the_post_thumbnail( $attachment->ID, $size, array( 'class' => 'attachment-thumbnail' ) );
1361
+ $thumb = apply_filters( 'mla_gallery_featured_image', $thumb, $attachment, $size, $item_values );
1362
+
1363
+ if ( ! empty( $thumb ) ) {
1364
+ $thumbnail_content = $thumb;
1365
+ }
1366
+ }
1367
+
1368
+ $item_values['pagelink'] = sprintf( '<a href=\'%1$s\'>%2$s</a>', $attachment->guid, $thumbnail_content );
1369
+ $item_values['filelink'] = sprintf( '<a href=\'%1$s\'>%2$s</a>', get_permalink( $attachment->ID ), $thumbnail_content );
1370
  }
1371
 
1372
  if ( in_array( $attachment->post_mime_type, array( 'image/svg+xml' ) ) ) {
1940
  'mla_link_text' => '',
1941
  'mla_nolink_text' => '',
1942
  'mla_rollover_text' => '',
1943
+ 'mla_caption' => '',
1944
+ 'mla_item_value' => '',
1945
  );
1946
 
1947
  $defaults = array_merge(
1949
  array(
1950
  'smallest' => 8,
1951
  'largest' => 22,
1952
+ 'default_size' => 12,
1953
  'unit' => 'pt',
1954
  'separator' => "\n",
1955
  'single_text' => '%d item',
1974
  'mla_target' => '',
1975
  'mla_debug' => false,
1976
 
1977
+ 'option_all_text' => '',
1978
+ 'option_all_value' => NULL,
1979
+ 'option_no_terms_text' => '',
1980
+ 'option_no_terms_value' => NULL,
1981
+ 'option_any_terms_text' => '',
1982
+ 'option_any_terms_value' => NULL,
1983
+
1984
  // Pagination parameters
1985
  'term_id' => NULL,
1986
  'mla_end_size'=> 1,
1988
  'mla_prev_text' => '&laquo; ' . __( 'Previous', 'media-library-assistant' ),
1989
  'mla_next_text' => __( 'Next', 'media-library-assistant' ) . ' &raquo;',
1990
  'mla_page_parameter' => 'mla_cloud_current',
1991
+ 'mla_cloud_current' => 1,
1992
  'mla_paginate_total' => NULL,
1993
  'mla_paginate_type' => 'plain'),
1994
+
1995
  $mla_item_specific_arguments
1996
  );
1997
 
2084
  * $mla_page_parameter, if non-default, doesn't make it through the shortcode_atts
2085
  * filter, so we handle it separately
2086
  */
2087
+ if ( empty( $arguments[ $mla_page_parameter ] ) ) {
2088
+ if ( !empty( $attr[ $mla_page_parameter ] ) ) {
2089
  $arguments[ $mla_page_parameter ] = $attr[ $mla_page_parameter ];
2090
  } else {
2091
  $arguments[ $mla_page_parameter ] = $defaults['mla_cloud_current'];
2095
 
2096
  // Process the pagination parameter, if present
2097
  if ( isset( $arguments[ $mla_page_parameter ] ) ) {
2098
+ $arguments['offset'] = absint( $arguments['limit'] ) * ( absint( $arguments[ $mla_page_parameter ] ) - 1);
2099
  }
2100
 
2101
  // Clean up the current_item to separate term_id from slug
2240
  return;
2241
  }
2242
 
2243
+ if ( ! ( empty( $arguments['option_any_terms_text'] ) && empty( $arguments['option_no_terms_text'] ) && empty( $arguments['option_all_text'] ) ) ) {
2244
+ $terms_assigned_counts = self::mla_get_all_none_term_counts( $arguments );
2245
+ } else {
2246
+ $terms_assigned_counts = array( 'ignore.terms.assigned' => 0, 'no.terms.assigned' => 0, 'any.terms.assigned' => 0 );
2247
+ }
2248
+
2249
  // Fill in the item_specific link properties, calculate cloud parameters
2250
  if ( isset( $tags['found_rows'] ) ) {
2251
  $found_rows = $tags['found_rows'];
2254
  $found_rows = count( $tags );
2255
  }
2256
 
2257
+ if ( 0 === $found_rows ) {
2258
  if ( self::$mla_debug ) {
2259
  MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug empty cloud', 'media-library-assistant' ) . '</strong>, query = ' . var_export( $arguments, true ) );
2260
  $cloud = MLACore::mla_debug_flush();
2281
 
2282
  echo $cloud; // phpcs:ignore
2283
  return;
2284
+ } // Empty cloud
2285
 
2286
  if ( self::$mla_debug ) {
2287
  $cloud = MLACore::mla_debug_flush();
2342
  }
2343
  } // foreach tag
2344
 
2345
+ // Add the optional 'all-terms', 'any-terms' and/or 'no-terms' option(s), if requested
2346
+ if ( ! empty( $arguments['option_any_terms_text'] ) ) {
2347
+ $new_term_id = -2;
2348
+ $new_term_slug = 'any.terms.assigned';
2349
+
2350
+ if ( ! empty( $arguments['option_any_terms_value'] ) ) {
2351
+ $new_term_value = self::_process_shortcode_parameter( $arguments['option_any_terms_value'], $page_values );
2352
+ if ( is_numeric( $new_term_value ) ) {
2353
+ $new_term_id = (integer) $new_term_value;
2354
+ $new_term_slug = sanitize_title( $arguments['option_any_terms_text'] );
2355
+ } else {
2356
+ $new_term_slug = sanitize_title( $new_term_value );
2357
+ }
2358
+ }
2359
+
2360
+ $new_term = ( object ) array(
2361
+ 'term_id' => $new_term_id,
2362
+ 'name' => $arguments['option_any_terms_text'],
2363
+ 'slug' => $new_term_slug,
2364
+ 'term_group' => '0',
2365
+ 'term_taxonomy_id' => $new_term_id,
2366
+ 'taxonomy' => $arguments['taxonomy'][0],
2367
+ 'description' => '',
2368
+ 'parent' => '0',
2369
+ 'count' => $terms_assigned_counts['any.terms.assigned'],
2370
+ 'level' => 0,
2371
+ 'edit_link' => '',
2372
+ 'term_link' => '',
2373
+ 'link' => '',
2374
+ );
2375
+ $new_term->scaled_count = apply_filters( 'mla_tag_cloud_scale', round( log10( 1 ) * 100 ), $attr, $arguments, $new_term );
2376
+
2377
+ if ( self::$mla_debug ) {
2378
+ MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug adding ANY terms', 'media-library-assistant' ) . '</strong> = ' . var_export( $new_term, true ) );
2379
+ }
2380
+ array_unshift( $tags, $new_term );
2381
+ $found_rows += 1;
2382
+ }
2383
+
2384
+ if ( ! empty( $arguments['option_no_terms_text'] ) ) {
2385
+ $new_term_id = -1;
2386
+ $new_term_slug = 'no.terms.assigned';
2387
+
2388
+ if ( ! empty( $arguments['option_no_terms_value'] ) ) {
2389
+ $new_term_value = self::_process_shortcode_parameter( $arguments['option_no_terms_value'], $page_values );
2390
+ if ( is_numeric( $new_term_value ) ) {
2391
+ $new_term_id = (integer) $new_term_value;
2392
+ $new_term_slug = sanitize_title( $arguments['option_no_terms_text'] );
2393
+ } else {
2394
+ $new_term_slug = sanitize_title( $new_term_value );
2395
+ }
2396
+ }
2397
+
2398
+ $new_term = ( object ) array(
2399
+ 'term_id' => $new_term_id,
2400
+ 'name' => $arguments['option_no_terms_text'],
2401
+ 'slug' => $new_term_slug,
2402
+ 'term_group' => '0',
2403
+ 'term_taxonomy_id' => $new_term_id,
2404
+ 'taxonomy' => $arguments['taxonomy'][0],
2405
+ 'description' => '',
2406
+ 'parent' => '0',
2407
+ 'count' => $terms_assigned_counts['no.terms.assigned'],
2408
+ 'level' => 0,
2409
+ 'edit_link' => '',
2410
+ 'term_link' => '',
2411
+ 'link' => '',
2412
+ );
2413
+ $new_term->scaled_count = apply_filters( 'mla_tag_cloud_scale', round( log10( 1 ) * 100 ), $attr, $arguments, $new_term );
2414
+
2415
+ if ( self::$mla_debug ) {
2416
+ MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug adding NO terms', 'media-library-assistant' ) . '</strong> = ' . var_export( $new_term, true ) );
2417
+ }
2418
+ array_unshift( $tags, $new_term );
2419
+ $found_rows += 1;
2420
+ }
2421
+
2422
+ if ( ! empty( $arguments['option_all_text'] ) ) {
2423
+ $new_term_id = -3;
2424
+ $new_term_slug = 'ignore.terms.assigned';
2425
+
2426
+ if ( ! empty( $arguments['option_all_value'] ) ) {
2427
+ $new_term_value = self::_process_shortcode_parameter( $arguments['option_all_value'], $page_values );
2428
+ if ( is_numeric( $new_term_value ) ) {
2429
+ $new_term_id = (integer) $new_term_value;
2430
+ $new_term_slug = sanitize_title( $arguments['option_all_text'] );
2431
+ } else {
2432
+ $new_term_slug = sanitize_title( $new_term_value );
2433
+ }
2434
+ }
2435
+
2436
+ $new_term = ( object ) array(
2437
+ 'term_id' => $new_term_id,
2438
+ 'name' => $arguments['option_all_text'],
2439
+ 'slug' => $new_term_slug,
2440
+ 'term_group' => '0',
2441
+ 'term_taxonomy_id' => $new_term_id,
2442
+ 'taxonomy' => $arguments['taxonomy'][0],
2443
+ 'description' => '',
2444
+ 'parent' => '0',
2445
+ 'count' => $terms_assigned_counts['ignore.terms.assigned'],
2446
+ 'level' => 0,
2447
+ 'edit_link' => '',
2448
+ 'term_link' => '',
2449
+ 'link' => '',
2450
+ );
2451
+ $new_term->scaled_count = apply_filters( 'mla_tag_cloud_scale', round( log10( 1 ) * 100 ), $attr, $arguments, $new_term );
2452
+
2453
+ if ( self::$mla_debug ) {
2454
+ MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug adding IGNORE terms', 'media-library-assistant' ) . '</strong> = ' . var_export( $new_term, true ) );
2455
+ }
2456
+ array_unshift( $tags, $new_term );
2457
+ $found_rows += 1;
2458
+ }
2459
+
2460
  /*
2461
  * The default MLA style template includes "margin: 1.5%" to put a bit of
2462
  * minimum space between the columns. "mla_margin" can be used to change
2727
  $item_values['parent'] = $tag->parent;
2728
  $item_values['count'] = isset ( $tag->count ) ? $tag->count : 0;
2729
  $item_values['scaled_count'] = $tag->scaled_count;
2730
+
2731
+ if ( in_array( $tag->slug, array( 'ignore.terms.assigned', 'no.terms.assigned', 'any.terms.assigned' ) ) ) {
2732
+ $item_values['font_size'] = absint( $arguments['default_size'] );
2733
+ } else {
2734
+ $item_values['font_size'] = str_replace( ',', '.', ( $item_values['smallest'] + ( ( $item_values['scaled_count'] - $item_values['min_scaled_count'] ) * $item_values['font_step'] ) ) );
2735
+ }
2736
+
2737
  $item_values['link_url'] = $tag->link;
2738
  $item_values['currentlink_url'] = sprintf( '%1$s%2$scurrent_item=%3$d', $item_values['page_url'], $current_item_delimiter, $item_values['term_id'] );
2739
  $item_values['editlink_url'] = $tag->edit_link;
2756
  $item_values['current_item_class'] = $arguments['current_item_class'];
2757
  }
2758
  } else {
 
2759
  if ( $tag->slug == sanitize_title_for_query( $arguments['current_item'] ) ) {
2760
  $item_values['current_item_class'] = $arguments['current_item_class'];
2761
  }
2799
 
2800
  $item_values['link_attributes'] = $link_attributes;
2801
 
2802
+ // Ignore option- all,any_terms,no_terms
2803
+ if ( -1 !== $item_values['count'] ) {
2804
+ $item_values['rollover_text'] = sprintf( _n( $item_values['single_text'], $item_values['multiple_text'], $item_values['count'], 'media-library-assistant' ), number_format_i18n( $item_values['count'] ) );
2805
+ }
2806
+
2807
  if ( ! empty( $arguments['mla_rollover_text'] ) ) {
2808
  $item_values['rollover_text'] = esc_attr( self::_process_shortcode_parameter( $arguments['mla_rollover_text'], $item_values ) );
2809
  }
2827
  $item_values['link_text'] = $item_values['name'];
2828
  }
2829
 
2830
+ if ( empty( $arguments['mla_item_value'] ) ) {
2831
+ $item_values['thevalue'] = $item_values['term_id'];
2832
+ } else {
2833
+ $item_values['thevalue'] = self::_process_shortcode_parameter( $arguments['mla_item_value'], $item_values );
2834
+ }
2835
+
2836
  // Currentlink, editlink, termlink and thelink
2837
+ $item_values['currentlink'] = sprintf( '<a %1$shref="%2$s%3$scurrent_item=%4$d" title="%5$s" style="%6$s">%7$s</a>', $link_attributes, $item_values['page_url'], $current_item_delimiter, $item_values['thevalue'], $item_values['rollover_text'], $item_values['link_style'], $item_values['link_text'] );
2838
  $item_values['editlink'] = sprintf( '<a %1$shref="%2$s" title="%3$s" style="%4$s">%5$s</a>', $link_attributes, $item_values['editlink_url'], $item_values['rollover_text'], $item_values['link_style'], $item_values['link_text'] );
2839
  $item_values['termlink'] = sprintf( '<a %1$shref="%2$s" title="%3$s" style="%4$s">%5$s</a>', $link_attributes, $item_values['termlink_url'], $item_values['rollover_text'], $item_values['link_style'], $item_values['link_text'] );
2840
 
2992
  $combine_hierarchical = 'combine' === $arguments['hierarchical'];
2993
 
2994
  // Using the slug is a common practice and affects current_item
2995
+ if ( $is_dropdown || $is_checklist ) {
2996
+ $current_is_slug = in_array( $arguments['mla_option_value'], array( '{+slug+}', '[+slug+]' ) );
2997
+ } else {
2998
+ $current_is_slug = in_array( $arguments['mla_item_value'], array( '{+slug+}', '[+slug+]' ) );
2999
+ }
3000
 
3001
  if ( $is_list || $is_dropdown || $is_checklist ) {
3002
  if ( $term->parent ) {
3011
 
3012
  // Fall back to default template if no Open section
3013
  if ( false === $open_template ) {
3014
+ $markup_values['mla_markup'] = $arguments['default_mla_markup'];
3015
 
3016
  if ( $term->parent ) {
3017
+ $open_template = MLATemplate_support::mla_fetch_custom_template( $arguments['mla_markup'], 'term-list', 'markup', 'child-open' );
3018
  } else {
3019
  $open_template = false;
3020
  }
3021
 
3022
  if ( false === $open_template ) {
3023
+ $open_template = MLATemplate_support::mla_fetch_custom_template( $arguments['mla_markup'], 'term-list', 'markup', 'open' );
3024
  }
3025
  }
3026
 
3071
 
3072
  $list .= apply_filters( 'mla_term_list_open_parse', $gallery_open, $open_template, $markup_values );
3073
  }
3074
+ } // $is_list || $is_dropdown || $is_checklist
3075
 
3076
  // Find delimiter for currentlink, currentlink_url
3077
  if ( strpos( $markup_values['page_url'], '?' ) ) {
3130
  }
3131
 
3132
  if ( $current_is_slug || !( ctype_digit( $current_item ) || is_int( $current_item ) ) ) {
3133
+ if ( $term->slug === sanitize_title_for_query( $current_item ) ) {
 
3134
  $is_active = true;
3135
  $item_values['current_item_class'] = $arguments['current_item_class'];
3136
  break;
3137
  }
3138
  } else {
3139
+ if ( $current_item === $term->term_id ) {
3140
  $is_active = true;
3141
  $item_values['current_item_class'] = $arguments['current_item_class'];
3142
  break;
3179
 
3180
  $item_values['link_attributes'] = $link_attributes;
3181
 
3182
+ // Ignore option- all,any_terms,no_terms
3183
+ if ( -1 !== $item_values['count'] ) {
3184
+ $item_values['rollover_text'] = sprintf( _n( $item_values['single_text'], $item_values['multiple_text'], $item_values['count'], 'media-library-assistant' ), number_format_i18n( $item_values['count'] ) );
3185
+ if ( ! empty( $arguments['mla_rollover_text'] ) ) {
3186
+ $item_values['rollover_text'] = esc_attr( self::_process_shortcode_parameter( $arguments['mla_rollover_text'], $item_values ) );
3187
+ }
3188
  }
3189
 
3190
  if ( ! empty( $arguments['mla_link_href'] ) ) {
3201
  }
3202
 
3203
  if ( ! empty( $arguments['show_count'] ) && ( 'true' == strtolower( $arguments['show_count'] ) ) ) {
3204
+ // Ignore option- all,any_terms,no_terms
3205
  if ( -1 !== $item_values['count'] ) {
3206
  $item_values['link_text'] .= ' (' . $item_values['count'] . ')';
3207
  }
3420
  'mla_nolink_text' => '',
3421
  'mla_target' => '',
3422
  'hide_if_empty' => false,
3423
+
3424
  'option_all_text' => '',
3425
  'option_all_value' => NULL,
3426
+ 'option_no_terms_text' => '',
3427
+ 'option_no_terms_value' => NULL,
3428
+ 'option_any_terms_text' => '',
3429
+ 'option_any_terms_value' => NULL,
3430
+
3431
  'option_none_text' => '',
3432
  'option_none_value' => NULL,
3433
 
3655
  $arguments['termtag'] = 'li';
3656
  }
3657
 
3658
+ $arguments['default_mla_style'] = $default_style;
3659
  if ( NULL == $arguments['mla_style'] ) {
3660
  $arguments['mla_style'] = $default_style;
3661
  }
3662
 
3663
+ $arguments['default_mla_markup'] = $default_markup;
3664
  if ( NULL == $arguments['mla_markup'] ) {
3665
  $arguments['mla_markup'] = $default_markup;
3666
  }
3799
  $list = '';
3800
  }
3801
 
3802
+ if ( !$show_empty ) {
3803
+ $add_all_option = ! empty( $arguments['option_all_text'] );
3804
+ $add_any_terms_option = ! empty( $arguments['option_any_terms_text'] );
3805
+ $add_no_terms_option = ! empty( $arguments['option_no_terms_text'] );
3806
+ } else {
3807
+ $add_all_option = false;
3808
+ $add_any_terms_option = false;
3809
+ $add_no_terms_option = false;
3810
+ }
3811
+
3812
+ if ( $add_all_option || $add_any_terms_option || $add_no_terms_option ) {
3813
+ $terms_assigned_counts = self::mla_get_all_none_term_counts( $arguments );
3814
+ } else {
3815
+ $terms_assigned_counts = array( 'ignore.terms.assigned' => 0, 'no.terms.assigned' => 0, 'any.terms.assigned' => 0 );
3816
+ }
3817
 
3818
+ // Using the slug is a common practice and affects option_ all/any_terms/no_terms _value(s)
3819
+ $option_all_id = -3;
3820
+ $option_all_slug = 'ignore.terms.assigned';
3821
  if ( $add_all_option ) {
3822
  if ( ! empty( $arguments['option_all_value'] ) ) {
3823
  $option_all_value = self::_process_shortcode_parameter( $arguments['option_all_value'], $page_values );
3824
  if ( is_numeric( $option_all_value ) ) {
3825
+ $option_all_id = (integer) $option_all_value;
3826
  $option_all_slug = sanitize_title( $arguments['option_all_text'] );
3827
  } else {
 
3828
  $option_all_slug = sanitize_title( $option_all_value );
3829
  }
 
 
 
3830
  }
3831
+ }
3832
+
3833
+ $option_any_terms_id = -2;
3834
+ $option_any_terms_slug = 'any.terms.assigned';
3835
+ if ( $add_any_terms_option ) {
3836
+ if ( ! empty( $arguments['option_any_terms_value'] ) ) {
3837
+ $option_any_terms_value = self::_process_shortcode_parameter( $arguments['option_any_terms_value'], $page_values );
3838
+ if ( is_numeric( $option_any_terms_value ) ) {
3839
+ $option_any_terms_id = (integer) $option_any_terms_value;
3840
+ $option_any_terms_slug = sanitize_title( $arguments['option_any_terms_text'] );
3841
+ } else {
3842
+ $option_any_terms_slug = sanitize_title( $option_any_terms_value );
3843
+ }
3844
+ }
3845
+ }
3846
+
3847
+ $option_no_terms_id = -1;
3848
+ $option_no_terms_slug = 'no.terms.assigned';
3849
+ if ( $add_no_terms_option ) {
3850
+ if ( ! empty( $arguments['option_no_terms_value'] ) ) {
3851
+ $option_no_terms_value = self::_process_shortcode_parameter( $arguments['option_no_terms_value'], $page_values );
3852
+ if ( is_numeric( $option_no_terms_value ) ) {
3853
+ $option_no_terms_id = (integer) $option_no_terms_value;
3854
+ $option_no_terms_slug = sanitize_title( $arguments['option_no_terms_text'] );
3855
+ } else {
3856
+ $option_no_terms_slug = sanitize_title( $option_no_terms_value );
3857
+ }
3858
+ }
3859
  }
3860
 
3861
  if ( $is_hierarchical ) {
3914
  $tags[ $key ]->link = $tags[ $key ]->term_link;
3915
  }
3916
  } // foreach tag
3917
+ } // !show_empty
3918
+ }// !is_hierarchical
3919
 
3920
  if ( $add_all_option ) {
3921
  $found_rows += 1;
3922
  }
3923
+ if ( $add_any_terms_option ) {
3924
+ $found_rows += 1;
3925
+ }
3926
+ if ( $add_no_terms_option ) {
3927
+ $found_rows += 1;
3928
+ }
3929
 
3930
  $style_values = array_merge( $page_values, array(
3931
  'mla_output' => $arguments['mla_output'],
3982
  $tag_links = array();
3983
 
3984
  if ( $is_hierarchical ) {
 
3985
  if ( $combine_hierarchical ) {
3986
  $combined_tags = array();
3987
  foreach( $tags as $taxonomy => $root_terms ) {
3994
  $markup_values['taxonomy'] = $taxonomy;
3995
  $markup_values['thename'] = self::_process_shortcode_parameter( $mla_control_name, $markup_values );
3996
 
3997
+
3998
+ // Add the optional 'all-terms', 'any-terms' and/or 'no-terms' option(s), if requested
3999
+ $add_to_found_rows = 0;
4000
+ if ( $add_any_terms_option ) {
4001
+ $new_term = ( object ) array(
4002
+ 'term_id' => $option_any_terms_id,
4003
+ 'name' => $arguments['option_any_terms_text'],
4004
+ 'slug' => $option_any_terms_slug,
4005
+ 'term_group' => '0',
4006
+ 'term_taxonomy_id' => $option_any_terms_id,
4007
+ 'taxonomy' => $taxonomy,
4008
+ 'description' => '',
4009
+ 'parent' => '0',
4010
+ 'count' => $terms_assigned_counts['any.terms.assigned'],
4011
+ 'level' => 0,
4012
+ 'edit_link' => '',
4013
+ 'term_link' => '',
4014
+ 'link' => '',
4015
+ );
4016
+
4017
+ array_unshift( $root_terms, $new_term );
4018
+ $add_to_found_rows += 1;
4019
+ }
4020
+
4021
+ if ( $add_no_terms_option ) {
4022
+ $new_term = ( object ) array(
4023
+ 'term_id' => $option_no_terms_id,
4024
+ 'name' => $arguments['option_no_terms_text'],
4025
+ 'slug' => $option_no_terms_slug,
4026
+ 'term_group' => '0',
4027
+ 'term_taxonomy_id' => $option_no_terms_id,
4028
+ 'taxonomy' => $taxonomy,
4029
+ 'description' => '',
4030
+ 'parent' => '0',
4031
+ 'count' => $terms_assigned_counts['no.terms.assigned'],
4032
+ 'level' => 0,
4033
+ 'edit_link' => '',
4034
+ 'term_link' => '',
4035
+ 'link' => '',
4036
+ );
4037
+
4038
+ array_unshift( $root_terms, $new_term );
4039
+ $add_to_found_rows += 1;
4040
+ }
4041
+
4042
  if ( $add_all_option ) {
4043
+ $new_term = ( object ) array(
4044
  'term_id' => $option_all_id,
4045
  'name' => $arguments['option_all_text'],
4046
  'slug' => $option_all_slug,
4049
  'taxonomy' => $taxonomy,
4050
  'description' => '',
4051
  'parent' => '0',
4052
+ 'count' => $terms_assigned_counts['ignore.terms.assigned'],
4053
  'level' => 0,
4054
  'edit_link' => '',
4055
  'term_link' => '',
4056
  'link' => '',
4057
  );
4058
 
4059
+ array_unshift( $root_terms, $new_term );
4060
+ $add_to_found_rows += 1;
 
 
4061
  }
4062
 
4063
  if ( isset( $root_terms['found_rows'] ) ) {
4074
  } else {
4075
  $markup_values['thename'] = self::_process_shortcode_parameter( $mla_control_name, $markup_values );
4076
 
4077
+ // Add the optional 'all-terms', 'any-terms' and/or 'no-terms' option(s), if requested
4078
+ if ( $add_any_terms_option ) {
4079
+ $new_term = ( object ) array(
4080
+ 'term_id' => $option_any_terms_id,
4081
+ 'name' => $arguments['option_any_terms_text'],
4082
+ 'slug' => $option_any_terms_slug,
4083
+ 'term_group' => '0',
4084
+ 'term_taxonomy_id' => $option_any_terms_id,
4085
+ 'taxonomy' => $taxonomy,
4086
+ 'description' => '',
4087
+ 'parent' => '0',
4088
+ 'count' => -1,
4089
+ 'level' => 0,
4090
+ 'edit_link' => '',
4091
+ 'term_link' => '',
4092
+ 'link' => '',
4093
+ );
4094
+
4095
+ array_unshift( $tags, $new_term );
4096
+ }
4097
+
4098
+ if ( $add_no_terms_option ) {
4099
+ $new_term = ( object ) array(
4100
+ 'term_id' => $option_no_terms_id,
4101
+ 'name' => $arguments['option_no_terms_text'],
4102
+ 'slug' => $option_no_terms_slug,
4103
+ 'term_group' => '0',
4104
+ 'term_taxonomy_id' => $option_no_terms_id,
4105
+ 'taxonomy' => $taxonomy,
4106
+ 'description' => '',
4107
+ 'parent' => '0',
4108
+ 'count' => -1,
4109
+ 'level' => 0,
4110
+ 'edit_link' => '',
4111
+ 'term_link' => '',
4112
+ 'link' => '',
4113
+ );
4114
+
4115
+ array_unshift( $tags, $new_term );
4116
+ }
4117
+
4118
  if ( $add_all_option ) {
4119
+ $new_term = ( object ) array(
4120
  'term_id' => $option_all_id,
4121
  'name' => $arguments['option_all_text'],
4122
  'slug' => $option_all_slug,
4123
  'term_group' => '0',
4124
  'term_taxonomy_id' => $option_all_id,
4125
+ 'taxonomy' => $taxonomy,
4126
  'description' => '',
4127
  'parent' => '0',
4128
  'count' => -1,
4132
  'link' => '',
4133
  );
4134
 
4135
+ array_unshift( $tags, $new_term );
4136
  }
4137
 
4138
  if ( count( $tags ) ) {
4140
  }
4141
  }
4142
 
4143
+ if ( 'array' === $arguments['mla_output'] || empty($arguments['echo']) ) {
4144
  return $list;
4145
  }
4146
 
4782
  }
4783
 
4784
  // Look for simple quoted string, integer value or "undefined constant", e.g., in 'terms' =>
4785
+ if ( 1 === preg_match( '/^(([\'\"](.+?)[\'\"])|(-{0,1}\d+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*))(.*)$/', $interior, $matches ) ) {
4786
  //error_log( __LINE__ . " _validate_array_specification() simple matches = " . var_export( $matches, true ), 0 );
4787
 
4788
  $interior = trim( $matches[6], ' ,' );
5040
  'cache_results' => NULL,
5041
  'update_post_meta_cache' => NULL,
5042
  'update_post_term_cache' => NULL,
5043
+ // WordPress Real Media Library plugin support
5044
  'mla_allow_rml' => false,
5045
  'mla_rml_folder' => NULL,
5046
  'mla_rml_include_children' => false,
5084
  *
5085
  * @param int Post ID of the parent
5086
  * @param array Attributes of the shortcode
5087
+ * @param boolean Optional; true to calculate and return ['found_rows', 'max_num_pages'] as array elements
5088
+ * @param boolean Optional; true activate debug logging, false to suppress it.
5089
  *
5090
  * @return array List of attachments returned from WP_Query
5091
  */
5092
+ public static function mla_get_shortcode_attachments( $post_parent, $attr, $return_found_rows = NULL, $overide_debug = NULL ) {
5093
  global $wp_query;
5094
 
5095
+ // Set the local debug mode
5096
+ $old_debug_mode = self::$mla_debug;
5097
+ if ( NULL !== $overide_debug ) {
5098
+ self::$mla_debug = ( true === $overide_debug );
5099
+ }
5100
+
5101
  // Parameters passed to the join, where and orderby filter functions
5102
  self::$query_parameters = array( MLAQuery::MLA_ALT_TEXT_SUBQUERY => false, MLAQuery::MLA_FILE_SUBQUERY => false, );
5103
 
5188
  // Extract taxonomy arguments
5189
  self::$mla_get_shortcode_dynamic_attachments_parameters = array();
5190
  $query_arguments = array();
5191
+ $terms_assigned_query = false;
5192
  if ( ! empty( $attr ) ) {
5193
  $all_taxonomies = get_taxonomies( array ( 'show_ui' => true ), 'names' );
5194
  $simple_tax_queries = array();
5211
  } else {
5212
  // If sanitization fails, return an error message
5213
  if ( 'false' === $value ) {
5214
+ self::$mla_debug = $old_debug_mode;
5215
  return '<p>' . __( 'ERROR', 'media-library-assistant' ) . ': ' . __( 'Invalid mla_gallery', 'media-library-assistant' ) . ' tax_query = ' . self::$array_specification_error . '</p>';
5216
  }
5217
  }
5225
  }
5226
 
5227
  if ( is_array( $tax_query ) ) {
5228
+ // Check for ignore.terms.assigned/-3, no.terms.assigned/-1 or any.terms.assigned/-2
5229
  foreach ( $tax_query as $tax_query_key => $tax_query_element ) {
5230
  if ( !is_array( $tax_query_element ) ) {
5231
  continue;
5237
  continue;
5238
  }
5239
 
5240
+ if ( isset( $tax_query_element['terms'] ) ) {
5241
+ $terms = $tax_query_element['terms'];
5242
+
5243
+ if ( empty( $terms ) || ( $terms === '-3' ) || ( is_array( $terms ) && in_array( '-3', $terms ) ) ) {
5244
+ $terms = 'ignore.terms.assigned';
5245
+ }
5246
+
5247
+ if ( ( $terms === 'ignore.terms.assigned' ) || ( is_array( $terms ) && in_array( 'ignore.terms.assigned', $terms ) ) ) {
5248
+ unset( $tax_query[ $tax_query_key ] );
5249
+ continue;
5250
+ }
5251
+
5252
+ if ( ( $terms === '-1' ) || ( is_array( $terms ) && in_array( '-1', $terms ) ) ) {
5253
+ $terms = 'no.terms.assigned';
5254
+ }
5255
+
5256
+ if ( ( $terms === 'no.terms.assigned' ) || ( is_array( $terms ) && in_array( 'no.terms.assigned', $terms ) ) ) {
5257
+ $tax_query[ $tax_query_key ] = array(
5258
+ 'taxonomy' => $tax_query_taxonomy,
5259
+ 'operator' => 'NOT EXISTS',
5260
+ );
5261
+
5262
+ continue;
5263
+ }
5264
+
5265
+ if ( ( $terms === '-2' ) || ( is_array( $terms ) && in_array( '-2', $terms ) ) ) {
5266
+ $terms = 'any.terms.assigned';
5267
+ }
5268
+
5269
+ if ( ( $terms === 'any.terms.assigned' ) || ( is_array( $terms ) && in_array( 'any.terms.assigned', $terms ) ) ) {
5270
+ $tax_query[ $tax_query_key ] = array(
5271
+ 'taxonomy' => $tax_query_taxonomy,
5272
+ 'operator' => 'EXISTS',
5273
+ );
5274
+
5275
+ continue;
5276
+ }
5277
+ } // isset( terms )
5278
+ } // is_array( $tax_query )
5279
 
5280
  $query_arguments[ $key ] = $tax_query;
5281
  self::$mla_get_shortcode_dynamic_attachments_parameters[ $key ] = $value;
5282
  break; // Done - the tax_query overrides all other taxonomy parameters
5283
  } else {
5284
+ self::$mla_debug = $old_debug_mode;
5285
  return '<p>' . __( 'ERROR', 'media-library-assistant' ) . ': ' . __( 'Invalid mla_gallery', 'media-library-assistant' ) . ' tax_query = ' . var_export( $value, true ) . '</p>';
5286
  } // generated value is not an array
5287
  } // $tax_query is a string, not array
5288
  } // attr is 'tax_query'
5289
  elseif ( 'tax_input' == $key ) {
5290
+ if ( is_array( $value ) ) {
5291
+ $tax_queries = $value;
5292
+ } else {
5293
+ $tax_queries = array();
5294
+ $compound_values = array_filter( array_map( 'trim', explode( ',', $value ) ) );
5295
+ foreach ( $compound_values as $compound_value ) {
5296
+ $value = explode( '.', $compound_value );
5297
+ if ( 2 === count( $value ) ) {
5298
+ if ( array_key_exists( $value[0], $all_taxonomies ) ) {
5299
+ $tax_queries[ $value[0] ][] = $value[1];
5300
+ } // valid taxonomy
5301
+ } // valid coumpound value
5302
+ } // foreach compound_value
5303
+ } // string value
5304
 
5305
  foreach( $tax_queries as $key => $value ) {
5306
+ if ( is_string( $value ) ) {
5307
+ $value = explode( ',', $value );
5308
+ }
5309
+
5310
+ $simple_tax_queries[ $key ] = implode(',', array_filter( array_map( 'trim', $value ) ) );
5311
+ if ( in_array( $simple_tax_queries[ $key ], array( 'ignore.terms.assigned', '-3', 'no.terms.assigned', '-1', 'any.terms.assigned', '-2' ) ) ) {
5312
+ $terms_assigned_query = true;
5313
+ }
5314
  }
5315
  } // tax_input
5316
  elseif ( array_key_exists( $key, $all_taxonomies ) ) {
5317
+ if ( is_string( $value ) ) {
5318
+ $value = explode( ',', $value );
5319
+ }
5320
+
5321
+ $simple_tax_queries[ $key ] = implode(',', array_filter( array_map( 'trim', $value ) ) );
5322
+ if ( in_array( $simple_tax_queries[ $key ], array( 'ignore.terms.assigned', '-3', 'no.terms.assigned', '-1', 'any.terms.assigned', '-2' ) ) ) {
5323
+ $terms_assigned_query = true;
5324
  }
5325
  } // array_key_exists
5326
  } //foreach $attr
5335
  */
5336
  if ( isset( $query_arguments['tax_query'] ) || empty( $simple_tax_queries ) ) {
5337
  // No further action required
5338
+ } elseif ( ( 1 < count( $simple_tax_queries ) ) || isset( $attr['tax_operator'] ) || isset( $attr['tax_include_children'] ) || $terms_assigned_query ) {
5339
  // Build a tax_query
5340
  if ( 1 < count( $simple_tax_queries ) ) {
5341
  $tax_relation = 'AND';
5366
  }
5367
 
5368
  foreach( $simple_tax_queries as $key => $value ) {
5369
+ // simple queries with these values are ignored
5370
+ if ( empty( $value ) || ( 'ignore.terms.assigned' === $value ) || ( '-3' === $value ) ) {
5371
  continue;
5372
  }
5373
 
5374
+ if ( ( 'no.terms.assigned' === $value ) || ( '-1' === $value ) ) {
5375
+ $tax_query[] = array(
5376
+ 'taxonomy' => $key,
5377
+ 'operator' => 'NOT EXISTS'
5378
+ );
5379
+
5380
+ continue;
5381
+ }
5382
 
5383
+ if ( ( 'any.terms.assigned' === $value ) || ( '-2' === $value ) ) {
5384
  $tax_query[] = array(
5385
  'taxonomy' => $key,
5386
+ 'operator' => 'EXISTS'
 
 
5387
  );
5388
 
5389
  continue;
5390
  }
5391
 
5392
  $tax_query[] = array( 'taxonomy' => $key, 'field' => 'slug', 'terms' => explode( ',', $value ), 'operator' => $tax_operator, 'include_children' => $tax_include_children );
5393
+ } // foreach simple_tax_queries
5394
 
5395
  $query_arguments['tax_query'] = $tax_query;
5396
  self::$mla_get_shortcode_dynamic_attachments_parameters['tax_query'] = $tax_query;
5745
  } else {
5746
  // If sanitization fails, return an error message
5747
  if ( 'false' === $value ) {
5748
+ self::$mla_debug = $old_debug_mode;
5749
  return '<p>' . __( 'ERROR', 'media-library-assistant' ) . ': ' . __( 'Invalid mla_gallery', 'media-library-assistant' ) . ' date_query = ' . self::$array_specification_error . '</p>';
5750
  }
5751
  }
5761
  if ( is_array( $date_query ) ) {
5762
  $query_arguments[ $key ] = $date_query;
5763
  } else {
5764
+ self::$mla_debug = $old_debug_mode;
5765
  return '<p>' . __( 'ERROR', 'media-library-assistant' ) . ': ' . __( 'Invalid mla_gallery', 'media-library-assistant' ) . ' date_query = ' . var_export( $value, true ) . '</p>';
5766
  }
5767
  } // not array
5784
  } else {
5785
  // If sanitization fails, return an error message
5786
  if ( 'false' === $value ) {
5787
+ self::$mla_debug = $old_debug_mode;
5788
  return '<p>' . __( 'ERROR', 'media-library-assistant' ) . ': ' . __( 'Invalid mla_gallery', 'media-library-assistant' ) . ' meta_query = ' . self::$array_specification_error . '</p>';
5789
  }
5790
  }
5800
  if ( is_array( $meta_query ) ) {
5801
  $query_arguments[ $key ] = $meta_query;
5802
  } else {
5803
+ self::$mla_debug = $old_debug_mode;
5804
  return '<p>' . __( 'ERROR', 'media-library-assistant' ) . ': ' . __( 'Invalid mla_gallery', 'media-library-assistant' ) . ' meta_query = ' . var_export( $value, true ) . '</p>';
5805
  }
5806
  } // not array
6122
  MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug request', 'media-library-assistant' ) . '</strong> = ' . var_export( MLAShortcodes::$mla_gallery_wp_query_object->request, true ) );
6123
  MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug query_vars', 'media-library-assistant' ) . '</strong> = ' . var_export( MLAShortcodes::$mla_gallery_wp_query_object->query_vars, true ) );
6124
  MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug post_count', 'media-library-assistant' ) . '</strong> = ' . var_export( MLAShortcodes::$mla_gallery_wp_query_object->post_count, true ) );
6125
+ MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug found_posts', 'media-library-assistant' ) . '</strong> = ' . var_export( MLAShortcodes::$mla_gallery_wp_query_object->found_posts, true ) );
6126
  }
6127
 
6128
  MLAQuery::$search_parameters = array( 'debug' => 'none' );
6129
  MLAShortcodes::$mla_gallery_wp_query_object = NULL;
6130
+
6131
+ self::$mla_debug = $old_debug_mode;
6132
  return $attachments;
6133
  }
6134
 
6338
  return $pieces;
6339
  }
6340
 
6341
+ /**
6342
+ * Data selection parameters for mla_get_all_none_term_counts()
6343
+ *
6344
+ * @since 2.96
6345
+ *
6346
+ * @var array
6347
+ */
6348
+ private static $mla_get_all_none_term_counts = array(
6349
+ 'taxonomy' => 'post_tag',
6350
+ 'post_mime_type' => 'all',
6351
+ 'post_type' => 'attachment',
6352
+ 'post_status' => 'inherit',
6353
+ );
6354
+
6355
+ /**
6356
+ * Retrieve the "ignore.", "no.", and "any." "terms.assigned" counts in one taxonomy
6357
+ *
6358
+ * taxonomy - string containing one or more (comma-delimited) taxonomy names
6359
+ * or an array of taxonomy names. Default 'post_tag'. Only the first value is used.
6360
+ *
6361
+ * post_mime_type - MIME type(s) of the items to include in the term-specific counts. Default 'all'.
6362
+ *
6363
+ * post_type - The post type(s) of the items to include in the term-specific counts.
6364
+ * The default is "attachment".
6365
+ *
6366
+ * post_status - The post status value(s) of the items to include in the term-specific counts.
6367
+ * The default is "inherit".
6368
+ *
6369
+ * @since 2.96
6370
+ *
6371
+ * @param array taxonomy to search and query parameters
6372
+ *
6373
+ * @return array ( 'ignore.terms.assigned' => count, 'no.terms.assigned' => count, 'any.terms.assigned' => count )
6374
+ */
6375
+ public static function mla_get_all_none_term_counts( $attr ) {
6376
+ global $wpdb;
6377
+
6378
+ // Make sure $attr is an array, even if it's empty
6379
+ if ( empty( $attr ) ) {
6380
+ $attr = array();
6381
+ } elseif ( is_string( $attr ) ) {
6382
+ $attr = shortcode_parse_atts( $attr );
6383
+ }
6384
+
6385
+ // Merge input arguments with defaults
6386
+ $attr = apply_filters( 'mla_get_terms_query_attributes', $attr );
6387
+ $arguments = shortcode_atts( self::$mla_get_all_none_term_counts, $attr );
6388
+ $arguments = apply_filters( 'mla_get_terms_query_arguments', $arguments );
6389
+
6390
+ if ( self::$mla_debug ) {
6391
+ MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug attributes', 'media-library-assistant' ) . '</strong> = ' . var_export( $attr, true ) );
6392
+ MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug arguments', 'media-library-assistant' ) . '</strong> = ' . var_export( $arguments, true ) );
6393
+ }
6394
+
6395
+ // Isolate the first taxonomy value
6396
+ if ( is_array( $arguments['taxonomy'] ) ) {
6397
+ $taxonomy = reset( $arguments['taxonomy'] );
6398
+ } else {
6399
+ $taxonomy = reset( explode( ',', $arguments['taxonomy'] ) );
6400
+ }
6401
+
6402
+ $clause = array( 'SELECT' );
6403
+ $clause[] = 'COUNT( p.ID) as `ignore.terms.assigned`, COUNT( sq.object_id ) as `any.terms.assigned`';
6404
+ $clause[] = 'FROM mladev_posts AS p';
6405
+ $clause[] = 'LEFT JOIN ( ';
6406
+ $clause[] = 'SELECT DISTINCT tr.object_id FROM mladev_term_relationships as tr';
6407
+ $clause[] = 'INNER JOIN mladev_term_taxonomy as tt';
6408
+ $clause[] = 'ON tt.term_taxonomy_id = tr.term_taxonomy_id';
6409
+ $clause[] = 'AND tt.taxonomy = \'' . $taxonomy . '\'';
6410
+ $clause[] = ') AS sq';
6411
+ $clause[] = 'ON p.ID = sq.object_id';
6412
+ $clause[] = 'WHERE 1=1';
6413
+
6414
+ // Add type and status constraints
6415
+ if ( is_array( $arguments['post_type'] ) ) {
6416
+ $post_types = $arguments['post_type'];
6417
+ } else {
6418
+ $post_types = array( $arguments['post_type'] );
6419
+ }
6420
+
6421
+ $placeholders = array();
6422
+ $clause_parameters = array();
6423
+ foreach ( $post_types as $post_type ) {
6424
+ $placeholders[] = '%s';
6425
+ $clause_parameters[] = $post_type;
6426
+ }
6427
+
6428
+ $clause[] = $wpdb->prepare( 'AND p.post_type IN ( ' . join( ',', $placeholders ) . ' )', $clause_parameters );
6429
+
6430
+ if ( is_array( $arguments['post_status'] ) ) {
6431
+ $post_stati = $arguments['post_status'];
6432
+ } else {
6433
+ $post_stati = array( $arguments['post_status'] );
6434
+ }
6435
+
6436
+ $placeholders = array();
6437
+ $clause_parameters = array();
6438
+ foreach ( $post_stati as $post_status ) {
6439
+ if ( ( 'private' != $post_status ) || is_user_logged_in() ) {
6440
+ $placeholders[] = '%s';
6441
+ $clause_parameters[] = $post_status;
6442
+ }
6443
+ }
6444
+
6445
+ $clause[] = $wpdb->prepare( 'AND p.post_status IN ( ' . join( ',', $placeholders ) . ' )', $clause_parameters );
6446
+
6447
+ // Add optional post_mime_type constraint
6448
+ if ( 'all' !== strtolower( $arguments['post_mime_type'] ) ) {
6449
+ $post_mimes = wp_post_mime_type_where( $arguments['post_mime_type'], 'p' );
6450
+ $clause[] = str_replace( '%', '%%', $post_mimes );
6451
+ }
6452
+
6453
+ $query = join(' ', $clause);
6454
+ $results = $wpdb->get_results( $query );
6455
+
6456
+ if ( is_wp_error( $results ) ) {
6457
+ $results = array(
6458
+ 'ignore.terms.assigned' => 0,
6459
+ 'no.terms.assigned' => 0,
6460
+ 'any.terms.assigned' => 0,
6461
+ 'wp_error_code' => $results->get_error_code(),
6462
+ 'wp_error_message' => $results->get_error_message(),
6463
+ 'wp_error_data' => $results->get_error_data( $results->get_error_code() ),
6464
+ );
6465
+ } elseif ( isset( $results[0] ) ) {
6466
+ $results = array_map( 'absint', (array) $results[0] );
6467
+ $results['no.terms.assigned'] = $results['ignore.terms.assigned'] - $results['any.terms.assigned'];
6468
+ } else {
6469
+ $results = array( 'ignore.terms.assigned' => 0, 'no.terms.assigned' => 0, 'any.terms.assigned' => 0 );
6470
+ $results['wpdb_last_error'] = $wpdb->last_error;
6471
+ }
6472
+
6473
+ if ( self::$mla_debug ) {
6474
+ MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug query', 'media-library-assistant' ) . '</strong> = ' . var_export( $query, true ) );
6475
+ MLACore::mla_debug_add( __LINE__ . ' <strong>' . __( 'mla_debug results', 'media-library-assistant' ) . '</strong> = ' . var_export( $results, true ) );
6476
+ }
6477
+
6478
+ return $results;
6479
+ } // mla_get_all_none_term_counts
6480
+
6481
  /**
6482
  * Data selection parameters for [mla_tag_cloud], [mla_term_list]
6483
  *
6507
  'offset' => 0
6508
  );
6509
 
 
6510
  /**
6511
  * Retrieve the terms in one or more taxonomies.
6512
  *
6763
  }
6764
 
6765
  if ( 'all' !== strtolower( $arguments['post_mime_type'] ) ) {
6766
+ $post_mimes = wp_post_mime_type_where( $arguments['post_mime_type'], 'p' );
6767
+ $where = str_replace( '%', '%%', $post_mimes );
6768
 
6769
  if ( 0 == absint( $arguments['minimum'] ) ) {
6770
  $clause[] = ' AND ( p.post_mime_type IS NULL OR ' . substr( $where, 6 );
6904
  }
6905
 
6906
  if ( 'true' == strtolower( trim( $arguments['pad_counts'] ) ) ) {
6907
+ self::_pad_term_counts( $tags, reset( $taxonomies ), $post_types, $post_stati, $post_mimes );
6908
  }
6909
 
6910
  $tags['found_rows'] = $found_rows;
6911
  $tags = apply_filters( 'mla_get_terms_query_results', $tags );
 
6912
  return $tags;
6913
  } // mla_get_terms
6914
 
7225
  * @param string Term Context
7226
  * @param array Qualifying post type value(s)
7227
  * @param array Qualifying post status value(s)
7228
+ * @param string Qualifying post MIME type clause
7229
  * @return null Will break from function if conditions are not met.
7230
  */
7231
+ private static function _pad_term_counts( &$terms, $taxonomy, $post_types = NULL, $post_stati = NULL, $post_mimes = '' ) {
7232
  global $wpdb;
7233
 
7234
  // This function only works for hierarchical taxonomies like post categories.
7236
  return;
7237
  }
7238
 
7239
+ /*/ WordPress "private" function, in /wp-includes/taxonomy.php array( term_id => array( child_ids ) )
7240
  $term_hier = _get_term_hierarchy( $taxonomy );
7241
 
7242
  if ( empty( $term_hier ) ) {
7243
  return;
7244
+ } // */
7245
 
7246
  $terms_by_id = array(); // key term_id, value = reference to term object
7247
  $term_ids = array(); // key term_taxonomy_id, value = term_id
7248
  $term_items = array(); // key term_id
7249
 
7250
+ // foreach ( (array) $terms as $key => $term ) {
7251
+ foreach ( $terms as $key => $term ) {
7252
  if ( is_integer( $key ) ) {
7253
  $terms_by_id[$term->term_id] = & $terms[$key];
7254
  $term_ids[$term->term_taxonomy_id] = $term->term_id;
7269
  }
7270
 
7271
  // Get the object and term ids and stick them in a lookup table
7272
+ $results = $wpdb->get_results( "SELECT object_id, term_taxonomy_id FROM $wpdb->term_relationships INNER JOIN $wpdb->posts AS p ON object_id = ID WHERE term_taxonomy_id IN (" . implode( ',', array_keys($term_ids) ) . ") AND p.post_type IN ('" . implode( "', '", $post_types ) . "') AND p.post_status in ( '" . implode( "', '", $post_stati ) . "' )" . $post_mimes );
7273
  foreach ( $results as $row ) {
7274
  $id = $term_ids[ $row->term_taxonomy_id ];
7275
  $term_items[ $id ][ $row->object_id ] = isset( $term_items[ $id ][ $row->object_id ] ) ? ++$term_items[ $id ][ $row->object_id ] : 1;
includes/class-mla-shortcodes.php CHANGED
@@ -169,16 +169,17 @@ class MLAShortcodes {
169
  *
170
  * @param int Post ID of the parent
171
  * @param array Attributes of the shortcode
172
- * @param boolean true to calculate and return ['found_posts'] as an array element
 
173
  *
174
  * @return array List of attachments returned from WP_Query
175
  */
176
- public static function mla_get_shortcode_attachments( $post_parent, $attr, $return_found_rows = NULL ) {
177
  if ( !class_exists( 'MLAShortcode_Support' ) ) {
178
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-shortcode-support.php' );
179
  }
180
 
181
- return MLAShortcode_Support::mla_get_shortcode_attachments( $post_parent, $attr, $return_found_rows );
182
  }
183
 
184
  /**
169
  *
170
  * @param int Post ID of the parent
171
  * @param array Attributes of the shortcode
172
+ * @param boolean Optional; true to calculate and return ['found_posts'] as an array element
173
+ * @param boolean Optional; true activate debug logging, false to suppress it.
174
  *
175
  * @return array List of attachments returned from WP_Query
176
  */
177
+ public static function mla_get_shortcode_attachments( $post_parent, $attr, $return_found_rows = NULL, $overide_debug = NULL ) {
178
  if ( !class_exists( 'MLAShortcode_Support' ) ) {
179
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-shortcode-support.php' );
180
  }
181
 
182
+ return MLAShortcode_Support::mla_get_shortcode_attachments( $post_parent, $attr, $return_found_rows, $overide_debug );
183
  }
184
 
185
  /**
includes/class-mla-wpml-support.php CHANGED
@@ -74,7 +74,7 @@ class MLA_WPML {
74
  // Defined in /wpml-media/inc/wpml-media-class.php
75
  add_action( 'wpml_media_create_duplicate_attachment', 'MLA_WPML::wpml_media_create_duplicate_attachment', 10, 2 );
76
  }
77
-
78
  /**
79
  * Add the plugin's admin-mode filter/action handlers
80
  *
@@ -121,7 +121,7 @@ class MLA_WPML {
121
 
122
  // Localize $mla_language_option_definitions array
123
  self::mla_localize_language_option_definitions();
124
-
125
  // Apply the "Always Translate Media" override
126
  if ( ! empty( $_REQUEST['mlaAddNewBulkEditFormString'] ) && class_exists( 'WPML_Media' ) && ( 'checked' == MLACore::mla_get_option( MLACoreOptions::MLA_ADD_NEW_BULK_EDIT ) ) ) {
127
  $content_defaults = WPML_Media::get_setting( 'new_content_settings' );
@@ -160,7 +160,7 @@ class MLA_WPML {
160
  */
161
  public static function mla_taxonomy_column_final( $filter_content, $tax_object, $term, $column_text, $count_terms ) {
162
  global $sitepress;
163
-
164
  $details = $sitepress->get_element_language_details( $term->term_taxonomy_id, 'tax_' . $tax_object->name );
165
  if ( !empty( $details ) ) {
166
  $language_code = $details->language_code;
@@ -267,7 +267,7 @@ class MLA_WPML {
267
 
268
  self::_build_existing_terms( $post_id );
269
  if ( isset( $_REQUEST['action'] ) && 'mla-inline-edit-scripts' === $_REQUEST['action'] && isset( $_REQUEST['tax_input'] ) ) {
270
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::mla_list_table_inline_action( {$post_id} ) Quick Edit initial \$_REQUEST['tax_input'] = " . var_export( $_REQUEST['tax_input'], true ), MLACore::MLA_DEBUG_CATEGORY_AJAX ); // phpcs:ignore
271
 
272
  if ( 'checked' == MLACore::mla_get_option( 'term_assignment', false, false, MLA_WPML::$mla_language_option_definitions ) ) {
273
  // Quick Edit calls update_single_item right after this filter
@@ -289,7 +289,7 @@ class MLA_WPML {
289
  $_REQUEST['tax_input'] = self::_apply_tax_input( $post_id );
290
  }
291
 
292
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::mla_list_table_inline_action( {$post_id} ) Quick Edit final \$_REQUEST['tax_input'] = " . var_export( $_REQUEST['tax_input'], true ), MLACore::MLA_DEBUG_CATEGORY_AJAX ); // phpcs:ignore
293
  }
294
 
295
  return $item_content;
@@ -320,7 +320,7 @@ class MLA_WPML {
320
  if ( ! empty( self::$wpml_content_defaults ) ) {
321
  WPML_Media::update_setting( 'new_content_settings', self::$wpml_content_defaults );
322
  }
323
-
324
  /*
325
  * Suppress WPML processing in wpml-media.class.php function save_attachment_actions,
326
  * which wipes out attachment meta data.
@@ -384,15 +384,15 @@ class MLA_WPML {
384
  }
385
 
386
  if ( isset( $request['tax_input'] ) ) {
387
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::bulk_action_item_request( {$bulk_action}, {$post_id} ) \$request['tax_input'] = " . var_export( $request['tax_input'], true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
388
  } else {
389
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::bulk_action_item_request( {$bulk_action}, {$post_id} ) \$request['tax_input'] NOT SET", MLACore::MLA_DEBUG_CATEGORY_AJAX );
390
  }
391
 
392
  if ( isset( $request['tax_action'] ) ) {
393
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::bulk_action_item_request( {$bulk_action}, {$post_id} ) \$request['tax_action'] = " . var_export( $request['tax_action'], true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
394
  } else {
395
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::bulk_action_item_request( {$bulk_action}, {$post_id} ) \$request['tax_action'] NOT SET", MLACore::MLA_DEBUG_CATEGORY_AJAX );
396
  }
397
 
398
  return $request;
@@ -421,10 +421,10 @@ class MLA_WPML {
421
  $wpdb,
422
  $wpml_language_resolution
423
  );
424
-
425
  $new_item = $media_attachment_duplication->create_duplicate_attachment( $mla_item_ID, $mla_parent_ID, $lang );
426
  }
427
-
428
  $view_args = isset( $_REQUEST['mla_source'] ) ? array( 'mla_source' => sanitize_text_field( wp_unslash( $_REQUEST['mla_source'] ) ) ) : array();
429
  wp_redirect( add_query_arg( $view_args, admin_url( 'post.php' ) . '?action=edit&post=' . $new_item . '&message=201' ), 302 );
430
  exit;
@@ -533,7 +533,7 @@ class MLA_WPML {
533
  $other_languages = $sitepress->get_active_languages();
534
  unset( $other_languages[ $current_language ] );
535
  }
536
-
537
  if ( ( ! empty( $new_text ) ) && in_array( $setting_key, $taxonomies ) ) {
538
  $language_details = $sitepress->get_element_language_details( $post_id, 'post_attachment' );
539
  $item_language = $language_details->language_code;
@@ -546,7 +546,7 @@ class MLA_WPML {
546
  } else {
547
  $parent_term = 0;
548
  }
549
-
550
  $new_terms = array();
551
  foreach( $new_text as $new_name ) {
552
  $relevant_term = self::_get_relevant_term( 'name', $new_name, $setting_key );
@@ -611,7 +611,7 @@ class MLA_WPML {
611
  } // new term
612
  } // foreach new_name
613
 
614
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::mla_mapping_new_text( {$setting_key}, {$post_id} ) \$new_terms = " . var_export( $new_terms, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
615
  return $new_terms;
616
  } // translated taxonomy
617
 
@@ -673,7 +673,7 @@ class MLA_WPML {
673
  */
674
  private static function _create_relevant_translation( $relevant_term, $language ) {
675
  global $sitepress;
676
-
677
  $details = $sitepress->get_element_language_details( $relevant_term['term']->term_taxonomy_id, 'tax_' . $relevant_term['term']->taxonomy );
678
  $args = array(
679
  'trid' => $details->trid,
@@ -838,7 +838,7 @@ class MLA_WPML {
838
  }
839
 
840
  $language_details = (array) $sitepress->get_element_language_details( $post_id, 'post_attachment' );
841
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_build_existing_terms( {$post_id} ) \$sitepress->get_element_language_details = " . var_export( $language_details, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
842
 
843
  // WPML doesn't fill in $language_details if WPML Media is not installed
844
  if ( ( ! is_array( $language_details ) ) || empty( $language_details ) ) {
@@ -846,22 +846,22 @@ class MLA_WPML {
846
  }
847
 
848
  $element_translations = $sitepress->get_element_translations( $language_details['trid'], 'post_attachment' );
849
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_build_existing_terms( {$post_id} ) \$sitepress->get_element_translations() = " . var_export( $element_translations, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
850
-
851
  $translations = array();
852
  if ( $language_details['trid'] ) {
853
  foreach ( $element_translations as $language_code => $translation ) {
854
  $translations[ $language_code ] = (array) $translation;
855
  }
856
  }
857
-
858
  if ( empty( $translations ) ) {
859
  $translations[ $language_details['language_code'] ] = array( 'element_id' => $post_id );
860
  }
861
 
862
  self::$existing_terms = array_merge( array( 'element_id' => $post_id ), $language_details, $translations );
863
  $taxonomies = $sitepress->get_translatable_taxonomies( true, 'attachment' );
864
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_build_existing_terms( {$post_id} ) \$sitepress->get_translatable_taxonomies() = " . var_export( $taxonomies, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
865
 
866
  /*
867
  * Find all assigned terms and build term_master array
@@ -897,8 +897,8 @@ class MLA_WPML {
897
  } // term
898
  $sitepress->switch_lang( $current_language, true );
899
 
900
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_build_existing_terms( {$post_id} ) self::\$existing_terms = " . var_export( self::$existing_terms, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
901
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_build_existing_terms( {$post_id} ) self::\$relevant_terms = " . var_export( self::$relevant_terms, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
902
  return;
903
  }
904
 
@@ -919,26 +919,27 @@ class MLA_WPML {
919
  */
920
  private static function _update_existing_terms( $post_id ) {
921
  global $sitepress;
922
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_update_existing_terms( {$post_id} ) initial self::\$existing_terms = " . var_export( self::$existing_terms, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
923
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_update_existing_terms( {$post_id} ) initial self::\$relevant_terms = " . var_export( self::$relevant_terms, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
924
 
925
  if ( $post_id != self::$existing_terms['element_id'] ) {
926
  return false;
927
  }
928
 
 
929
  $language_code = self::$existing_terms['language_code'];
 
930
 
931
  if ( isset( self::$existing_terms[ $language_code ] ) ) {
932
  $translation = self::$existing_terms[ $language_code ];
933
  } else {
934
  $translation = array();
935
  }
 
936
 
937
  $terms_before = array();
938
 
939
- /*
940
- * Find all assigned terms and update the array
941
- */
942
  $taxonomies = $sitepress->get_translatable_taxonomies( true, 'attachment' );
943
  foreach ( $taxonomies as $taxonomy_name ) {
944
  $terms_before[ $taxonomy_name ] = isset( $translation[ $taxonomy_name ] ) ? $translation[ $taxonomy_name ] : array();
@@ -950,12 +951,12 @@ class MLA_WPML {
950
  } // term
951
  }
952
  } // taxonomy
 
 
953
 
954
  self::$existing_terms[ $language_code ] = $translation;
955
 
956
- /*
957
- * Add missing translated terms to the term_master array
958
- */
959
  foreach ( self::$relevant_terms as $term ) {
960
  foreach ( $term['translations'] as $translation ) {
961
  if ( array_key_exists( $translation->element_id, self::$relevant_terms ) ) {
@@ -967,8 +968,10 @@ class MLA_WPML {
967
  } // translation
968
  } // term
969
 
970
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_update_existing_terms( {$post_id} ) final self::\$existing_terms = " . var_export( self::$existing_terms, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
971
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_update_existing_terms( {$post_id} ) final self::\$relevant_terms = " . var_export( self::$relevant_terms, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
 
 
972
  return $terms_before;
973
  }
974
 
@@ -1122,8 +1125,8 @@ class MLA_WPML {
1122
  } // language
1123
  } // foreach taxonomy
1124
 
1125
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_build_tax_input( {$post_id} ) self::\$tax_input = " . var_export( self::$tax_input, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
1126
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_build_tax_input( {$post_id} ) self::\$relevant_terms = " . var_export( self::$relevant_terms, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
1127
  } // _build_tax_input
1128
 
1129
  /**
@@ -1150,8 +1153,8 @@ class MLA_WPML {
1150
  }
1151
  }
1152
 
1153
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_apply_tax_input( {$post_id} ) \$post_language = " . var_export( $post_language, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
1154
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_apply_tax_input( {$post_id} ) self::\$tax_input[ \$post_language ] = " . var_export( self::$tax_input[ $post_language ], true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
1155
  return self::$tax_input[ $post_language ];
1156
  } // _apply_tax_input
1157
 
@@ -1179,9 +1182,7 @@ class MLA_WPML {
1179
  $source_language = self::$existing_terms['language_code'];
1180
  $taxonomies = $sitepress->get_translatable_taxonomies( true, 'attachment' );
1181
 
1182
- /*
1183
- * Find all source terms with a destination equivalent, record destination equivalent
1184
- */
1185
  $new_terms = array();
1186
  foreach ( $taxonomies as $taxonomy ) {
1187
  $new_terms[ $taxonomy ] = array();
@@ -1194,9 +1195,7 @@ class MLA_WPML {
1194
  }
1195
  }
1196
 
1197
- /*
1198
- * Find all destination terms with a source equivalent, record destination equivalent
1199
- */
1200
  $old_terms = array();
1201
  foreach ( $taxonomies as $taxonomy ) {
1202
  $old_terms[ $taxonomy ] = array();
@@ -1209,9 +1208,10 @@ class MLA_WPML {
1209
  }
1210
  }
1211
 
1212
- /*
1213
- * Remove terms in common, leaving new_terms => add, old_terms => remove
1214
- */
 
1215
  foreach ( $old_terms as $taxonomy => $terms ) {
1216
  foreach ( $terms as $ttid => $term ) {
1217
  if ( isset( $new_terms[ $taxonomy ][ $ttid ] ) ) {
@@ -1221,9 +1221,7 @@ class MLA_WPML {
1221
  } // terms
1222
  } // taxonomies
1223
 
1224
- /*
1225
- * Compute "replace" tax_inputs for the target translation
1226
- */
1227
  $translation = self::$existing_terms[ $language ];
1228
  $synch_inputs = array();
1229
 
@@ -1259,12 +1257,9 @@ class MLA_WPML {
1259
  }
1260
  } // taxonomies
1261
 
1262
- /*
1263
- * Convert synch terms to $tax_inputs format
1264
- */
1265
  $tax_inputs = array();
1266
  foreach ( $synch_inputs as $taxonomy_name => $terms ) {
1267
- $taxonomy = get_taxonomy( $taxonomy_name );
1268
  $input_terms = array();
1269
  foreach ( $terms as $term ) {
1270
  $input_terms[] = $term->term_id;
@@ -1274,8 +1269,7 @@ class MLA_WPML {
1274
  } // synch_inputs
1275
 
1276
  $post_id = self::$existing_terms[ $language ]['element_id'];
1277
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_apply_synch_input( {$post_id} ) \$language = " . var_export( $language, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
1278
- MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_apply_synch_input( {$post_id} ) \$tax_inputs = " . var_export( $tax_inputs, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
1279
  return $tax_inputs;
1280
  } // _apply_synch_input
1281
 
@@ -1286,25 +1280,21 @@ class MLA_WPML {
1286
  * @uses MLA_WPML::$existing_terms
1287
  *
1288
  * @param integer $post_id the item we're synchronizing to
1289
- *
1290
- * @return array $tax_inputs for Term Synchronization
1291
  */
1292
  private static function _apply_term_synchronization( $post_id ) {
1293
  global $sitepress;
1294
 
1295
  if ( 'checked' == MLACore::mla_get_option( 'term_synchronization', false, false, MLA_WPML::$mla_language_option_definitions ) ) {
1296
 
1297
- /*
1298
- * Update terms because they have changed
1299
- */
1300
  $terms_before = self::_update_existing_terms( $post_id );
 
1301
 
1302
  // $tax_input is a convenient source of language codes; ignore $tax_inputs
1303
  $current_language = $sitepress->get_current_language();
1304
  foreach( self::$tax_input as $language => $tax_inputs ) {
1305
- /*
1306
- * Skip the language we've already updated
1307
- */
1308
  if ( ( ! isset( self::$existing_terms[ $language ] ) ) || ( self::$existing_terms[ 'language_code' ] == $language ) ) {
1309
  continue;
1310
  }
@@ -1313,9 +1303,11 @@ class MLA_WPML {
1313
  $tax_inputs = self::_apply_synch_input( $language );
1314
  if ( ! empty( $tax_inputs ) ) {
1315
  $translation = self::$existing_terms[ $language ]['element_id'];
 
1316
  MLAData::mla_update_single_item( $translation, array(), $tax_inputs );
1317
  }
1318
  } // translation
 
1319
  $sitepress->switch_lang( $current_language, true );
1320
  } // do synchronization
1321
  }
@@ -1332,9 +1324,7 @@ class MLA_WPML {
1332
  MLACore::mla_debug_add( __LINE__ . " MLA_WPML::mla_updated_single_item( {$post_id}, {$result} )", MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
1333
 
1334
  if ( self::$existing_terms['element_id'] == $post_id ) {
1335
- /*
1336
- * Synchronize the changes to all other translations
1337
- */
1338
  self::_apply_term_synchronization( $post_id );
1339
  }
1340
  }
@@ -1453,14 +1443,14 @@ class MLA_WPML {
1453
  */
1454
  if ( ! empty( self::$duplicate_attachments ) ) {
1455
  self::$updating_duplicates = true;
1456
-
1457
  foreach( self::$duplicate_attachments as $id => $language ) {
1458
  $meta = get_post_meta( $id, '_wp_attachment_metadata', true );
1459
  MLACore::mla_debug_add( __LINE__ . " MLA_WPML::mla_update_attachment_metadata_postfilter( {$id}, {$language} ) attachment_metadata = " . var_export( $meta, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
1460
  if ( is_array( $meta ) ) {
1461
  continue;
1462
  }
1463
-
1464
  /*
1465
  * update_post_meta is required twice; first to set it for mapping rules,
1466
  * second to repair the damage done by WPML synchronize_attachment_metadata
@@ -1477,7 +1467,7 @@ class MLA_WPML {
1477
  self::$updating_duplicates = false;
1478
  }
1479
  }
1480
-
1481
  return $data;
1482
  }
1483
 
@@ -1589,7 +1579,7 @@ class MLA_WPML {
1589
  $true_selected = '';
1590
  $false_selected = 'selected="selected"';
1591
  }
1592
-
1593
  $page_values['custom_fields'] .= ' <label class="inline-edit-c_0 clear"><span class="title">WPML</span><span class="input-text-wrap">' . "\n";
1594
  $page_values['custom_fields'] .= ' <select name="mla_always_translate_media">' . "\n";
1595
  $page_values['custom_fields'] .= ' <option ' . $true_selected . ' value="true">' . __( 'Yes', 'media-library-assistant' ) . '&nbsp;</option>' . "\n";
@@ -1597,7 +1587,7 @@ class MLA_WPML {
1597
  $page_values['custom_fields'] .= ' </select><span>&nbsp;' . __( 'Make media available in all languages', 'media-library-assistant' ) . '</span>' . "\n";
1598
  $page_values['custom_fields'] .= ' </span></label>' . "\n";
1599
  }
1600
-
1601
  return $page_values;
1602
  } // mla_upload_bulk_edit_form_values
1603
 
@@ -1741,14 +1731,14 @@ class MLA_WPML {
1741
  $active = isset( $wpml_media['file'] ) && is_plugin_active( $wpml_media['file'] );
1742
  }
1743
  }
1744
-
1745
  $wpml_media = '';
1746
  if ( ! $installed ) {
1747
  $wpml_media = '<p><strong>' . __( 'WARNING:', 'media-library-assistant' ) . __( ' WPML Media is not installed.', 'media-library-assistant' ) . '</strong></p>';
1748
  } elseif ( ! $active ) {
1749
  $wpml_media = '<p><strong>' . __( 'WARNING:', 'media-library-assistant' ) . __( ' WPML Media is not active.', 'media-library-assistant' ) . '</strong></p>';
1750
  }
1751
-
1752
  $page_values = array(
1753
  'Language Options' => __( 'Language Options', 'media-library-assistant' ),
1754
  /* translators: 1: - 4: page subheader values */
@@ -1946,7 +1936,7 @@ class MLA_WPML_Table {
1946
  if ( false === strpos( $views['all'], 'page=mla-menu' ) ) {
1947
  $views['all'] = str_replace( 'upload.php?', 'upload.php?page=mla-menu&', $views['all'] );
1948
  }
1949
-
1950
  return $views;
1951
  }
1952
 
@@ -2144,7 +2134,7 @@ class MLA_WPML_Table {
2144
  $table_language = $query['lang'];
2145
  }
2146
  }
2147
-
2148
  if ( empty( $table_language ) && method_exists( $sitepress, 'get_admin_language_cookie' ) ) {
2149
  $table_language = $sitepress->get_admin_language_cookie();
2150
  }
@@ -2153,7 +2143,7 @@ class MLA_WPML_Table {
2153
  $table_language = $sitepress->get_default_language();
2154
  }
2155
  }
2156
-
2157
  return $table_language;
2158
  }
2159
 
74
  // Defined in /wpml-media/inc/wpml-media-class.php
75
  add_action( 'wpml_media_create_duplicate_attachment', 'MLA_WPML::wpml_media_create_duplicate_attachment', 10, 2 );
76
  }
77
+
78
  /**
79
  * Add the plugin's admin-mode filter/action handlers
80
  *
121
 
122
  // Localize $mla_language_option_definitions array
123
  self::mla_localize_language_option_definitions();
124
+
125
  // Apply the "Always Translate Media" override
126
  if ( ! empty( $_REQUEST['mlaAddNewBulkEditFormString'] ) && class_exists( 'WPML_Media' ) && ( 'checked' == MLACore::mla_get_option( MLACoreOptions::MLA_ADD_NEW_BULK_EDIT ) ) ) {
127
  $content_defaults = WPML_Media::get_setting( 'new_content_settings' );
160
  */
161
  public static function mla_taxonomy_column_final( $filter_content, $tax_object, $term, $column_text, $count_terms ) {
162
  global $sitepress;
163
+
164
  $details = $sitepress->get_element_language_details( $term->term_taxonomy_id, 'tax_' . $tax_object->name );
165
  if ( !empty( $details ) ) {
166
  $language_code = $details->language_code;
267
 
268
  self::_build_existing_terms( $post_id );
269
  if ( isset( $_REQUEST['action'] ) && 'mla-inline-edit-scripts' === $_REQUEST['action'] && isset( $_REQUEST['tax_input'] ) ) {
270
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::mla_list_table_inline_action( {$post_id} ) Quick Edit initial \$_REQUEST['tax_input'] = " . var_export( $_REQUEST['tax_input'], true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE ); // phpcs:ignore
271
 
272
  if ( 'checked' == MLACore::mla_get_option( 'term_assignment', false, false, MLA_WPML::$mla_language_option_definitions ) ) {
273
  // Quick Edit calls update_single_item right after this filter
289
  $_REQUEST['tax_input'] = self::_apply_tax_input( $post_id );
290
  }
291
 
292
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::mla_list_table_inline_action( {$post_id} ) Quick Edit final \$_REQUEST['tax_input'] = " . var_export( $_REQUEST['tax_input'], true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE ); // phpcs:ignore
293
  }
294
 
295
  return $item_content;
320
  if ( ! empty( self::$wpml_content_defaults ) ) {
321
  WPML_Media::update_setting( 'new_content_settings', self::$wpml_content_defaults );
322
  }
323
+
324
  /*
325
  * Suppress WPML processing in wpml-media.class.php function save_attachment_actions,
326
  * which wipes out attachment meta data.
384
  }
385
 
386
  if ( isset( $request['tax_input'] ) ) {
387
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::bulk_action_item_request( {$bulk_action}, {$post_id} ) \$request['tax_input'] = " . var_export( $request['tax_input'], true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
388
  } else {
389
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::bulk_action_item_request( {$bulk_action}, {$post_id} ) \$request['tax_input'] NOT SET", MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
390
  }
391
 
392
  if ( isset( $request['tax_action'] ) ) {
393
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::bulk_action_item_request( {$bulk_action}, {$post_id} ) \$request['tax_action'] = " . var_export( $request['tax_action'], true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
394
  } else {
395
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::bulk_action_item_request( {$bulk_action}, {$post_id} ) \$request['tax_action'] NOT SET", MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
396
  }
397
 
398
  return $request;
421
  $wpdb,
422
  $wpml_language_resolution
423
  );
424
+
425
  $new_item = $media_attachment_duplication->create_duplicate_attachment( $mla_item_ID, $mla_parent_ID, $lang );
426
  }
427
+
428
  $view_args = isset( $_REQUEST['mla_source'] ) ? array( 'mla_source' => sanitize_text_field( wp_unslash( $_REQUEST['mla_source'] ) ) ) : array();
429
  wp_redirect( add_query_arg( $view_args, admin_url( 'post.php' ) . '?action=edit&post=' . $new_item . '&message=201' ), 302 );
430
  exit;
533
  $other_languages = $sitepress->get_active_languages();
534
  unset( $other_languages[ $current_language ] );
535
  }
536
+
537
  if ( ( ! empty( $new_text ) ) && in_array( $setting_key, $taxonomies ) ) {
538
  $language_details = $sitepress->get_element_language_details( $post_id, 'post_attachment' );
539
  $item_language = $language_details->language_code;
546
  } else {
547
  $parent_term = 0;
548
  }
549
+
550
  $new_terms = array();
551
  foreach( $new_text as $new_name ) {
552
  $relevant_term = self::_get_relevant_term( 'name', $new_name, $setting_key );
611
  } // new term
612
  } // foreach new_name
613
 
614
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::mla_mapping_new_text( {$setting_key}, {$post_id} ) \$new_terms = " . var_export( $new_terms, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
615
  return $new_terms;
616
  } // translated taxonomy
617
 
673
  */
674
  private static function _create_relevant_translation( $relevant_term, $language ) {
675
  global $sitepress;
676
+
677
  $details = $sitepress->get_element_language_details( $relevant_term['term']->term_taxonomy_id, 'tax_' . $relevant_term['term']->taxonomy );
678
  $args = array(
679
  'trid' => $details->trid,
838
  }
839
 
840
  $language_details = (array) $sitepress->get_element_language_details( $post_id, 'post_attachment' );
841
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_build_existing_terms( {$post_id} ) \$sitepress->get_element_language_details = " . var_export( $language_details, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
842
 
843
  // WPML doesn't fill in $language_details if WPML Media is not installed
844
  if ( ( ! is_array( $language_details ) ) || empty( $language_details ) ) {
846
  }
847
 
848
  $element_translations = $sitepress->get_element_translations( $language_details['trid'], 'post_attachment' );
849
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_build_existing_terms( {$post_id} ) \$sitepress->get_element_translations() = " . var_export( $element_translations, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
850
+
851
  $translations = array();
852
  if ( $language_details['trid'] ) {
853
  foreach ( $element_translations as $language_code => $translation ) {
854
  $translations[ $language_code ] = (array) $translation;
855
  }
856
  }
857
+
858
  if ( empty( $translations ) ) {
859
  $translations[ $language_details['language_code'] ] = array( 'element_id' => $post_id );
860
  }
861
 
862
  self::$existing_terms = array_merge( array( 'element_id' => $post_id ), $language_details, $translations );
863
  $taxonomies = $sitepress->get_translatable_taxonomies( true, 'attachment' );
864
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_build_existing_terms( {$post_id} ) \$sitepress->get_translatable_taxonomies() = " . var_export( $taxonomies, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
865
 
866
  /*
867
  * Find all assigned terms and build term_master array
897
  } // term
898
  $sitepress->switch_lang( $current_language, true );
899
 
900
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_build_existing_terms( {$post_id} ) self::\$existing_terms = " . var_export( self::$existing_terms, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
901
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_build_existing_terms( {$post_id} ) self::\$relevant_terms = " . var_export( self::$relevant_terms, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
902
  return;
903
  }
904
 
919
  */
920
  private static function _update_existing_terms( $post_id ) {
921
  global $sitepress;
922
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_update_existing_terms( {$post_id} ) initial self::\$existing_terms = " . var_export( self::$existing_terms, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
923
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_update_existing_terms( {$post_id} ) initial self::\$relevant_terms = " . var_export( self::$relevant_terms, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
924
 
925
  if ( $post_id != self::$existing_terms['element_id'] ) {
926
  return false;
927
  }
928
 
929
+ //$current_language = $sitepress->get_current_language();
930
  $language_code = self::$existing_terms['language_code'];
931
+ //$sitepress->switch_lang( $language_code, true );
932
 
933
  if ( isset( self::$existing_terms[ $language_code ] ) ) {
934
  $translation = self::$existing_terms[ $language_code ];
935
  } else {
936
  $translation = array();
937
  }
938
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_update_existing_terms( {$post_id}, {$language_code} ) \$translation = " . var_export( $translation, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
939
 
940
  $terms_before = array();
941
 
942
+ // Find all assigned terms and update the array
 
 
943
  $taxonomies = $sitepress->get_translatable_taxonomies( true, 'attachment' );
944
  foreach ( $taxonomies as $taxonomy_name ) {
945
  $terms_before[ $taxonomy_name ] = isset( $translation[ $taxonomy_name ] ) ? $translation[ $taxonomy_name ] : array();
951
  } // term
952
  }
953
  } // taxonomy
954
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_update_existing_terms( {$post_id} ) \$terms_before = " . var_export( $terms_before, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
955
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_update_existing_terms( {$post_id} ) {$language_code} \$translation = " . var_export( $translation, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
956
 
957
  self::$existing_terms[ $language_code ] = $translation;
958
 
959
+ // Add missing translated terms to the term_master array
 
 
960
  foreach ( self::$relevant_terms as $term ) {
961
  foreach ( $term['translations'] as $translation ) {
962
  if ( array_key_exists( $translation->element_id, self::$relevant_terms ) ) {
968
  } // translation
969
  } // term
970
 
971
+ //$sitepress->switch_lang( $current_language, true );
972
+
973
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_update_existing_terms( {$post_id} ) final self::\$existing_terms = " . var_export( self::$existing_terms, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
974
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_update_existing_terms( {$post_id} ) final self::\$relevant_terms = " . var_export( self::$relevant_terms, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
975
  return $terms_before;
976
  }
977
 
1125
  } // language
1126
  } // foreach taxonomy
1127
 
1128
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_build_tax_input( {$post_id} ) self::\$tax_input = " . var_export( self::$tax_input, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
1129
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_build_tax_input( {$post_id} ) self::\$relevant_terms = " . var_export( self::$relevant_terms, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
1130
  } // _build_tax_input
1131
 
1132
  /**
1153
  }
1154
  }
1155
 
1156
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_apply_tax_input( {$post_id} ) \$post_language = " . var_export( $post_language, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
1157
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_apply_tax_input( {$post_id} ) self::\$tax_input[ \$post_language ] = " . var_export( self::$tax_input[ $post_language ], true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
1158
  return self::$tax_input[ $post_language ];
1159
  } // _apply_tax_input
1160
 
1182
  $source_language = self::$existing_terms['language_code'];
1183
  $taxonomies = $sitepress->get_translatable_taxonomies( true, 'attachment' );
1184
 
1185
+ // Find all source terms with a destination equivalent, record destination equivalent
 
 
1186
  $new_terms = array();
1187
  foreach ( $taxonomies as $taxonomy ) {
1188
  $new_terms[ $taxonomy ] = array();
1195
  }
1196
  }
1197
 
1198
+ // Find all destination terms with a source equivalent, record destination equivalent
 
 
1199
  $old_terms = array();
1200
  foreach ( $taxonomies as $taxonomy ) {
1201
  $old_terms[ $taxonomy ] = array();
1208
  }
1209
  }
1210
 
1211
+ //MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_apply_synch_input( {$language} ) \$new_terms = " . var_export( $new_terms, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
1212
+ //MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_apply_synch_input( {$language} ) \$old_terms = " . var_export( $old_terms, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
1213
+
1214
+ // Remove terms in common, leaving new_terms => add, old_terms => remove
1215
  foreach ( $old_terms as $taxonomy => $terms ) {
1216
  foreach ( $terms as $ttid => $term ) {
1217
  if ( isset( $new_terms[ $taxonomy ][ $ttid ] ) ) {
1221
  } // terms
1222
  } // taxonomies
1223
 
1224
+ // Compute "replace" tax_inputs for the target translation
 
 
1225
  $translation = self::$existing_terms[ $language ];
1226
  $synch_inputs = array();
1227
 
1257
  }
1258
  } // taxonomies
1259
 
1260
+ // Convert synch terms to $tax_inputs format
 
 
1261
  $tax_inputs = array();
1262
  foreach ( $synch_inputs as $taxonomy_name => $terms ) {
 
1263
  $input_terms = array();
1264
  foreach ( $terms as $term ) {
1265
  $input_terms[] = $term->term_id;
1269
  } // synch_inputs
1270
 
1271
  $post_id = self::$existing_terms[ $language ]['element_id'];
1272
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_apply_synch_input( {$post_id}, {$language} ) \$tax_inputs = " . var_export( $tax_inputs, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
 
1273
  return $tax_inputs;
1274
  } // _apply_synch_input
1275
 
1280
  * @uses MLA_WPML::$existing_terms
1281
  *
1282
  * @param integer $post_id the item we're synchronizing to
 
 
1283
  */
1284
  private static function _apply_term_synchronization( $post_id ) {
1285
  global $sitepress;
1286
 
1287
  if ( 'checked' == MLACore::mla_get_option( 'term_synchronization', false, false, MLA_WPML::$mla_language_option_definitions ) ) {
1288
 
1289
+ // Update terms because they have changed
 
 
1290
  $terms_before = self::_update_existing_terms( $post_id );
1291
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_apply_term_synchronization( {$post_id} ) terms_before = " . var_export( $terms_before, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
1292
 
1293
  // $tax_input is a convenient source of language codes; ignore $tax_inputs
1294
  $current_language = $sitepress->get_current_language();
1295
  foreach( self::$tax_input as $language => $tax_inputs ) {
1296
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_apply_term_synchronization( {$post_id}, {$language} ) tax_inputs = " . var_export( $tax_inputs, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
1297
+ // Skip the language we've already updated
 
1298
  if ( ( ! isset( self::$existing_terms[ $language ] ) ) || ( self::$existing_terms[ 'language_code' ] == $language ) ) {
1299
  continue;
1300
  }
1303
  $tax_inputs = self::_apply_synch_input( $language );
1304
  if ( ! empty( $tax_inputs ) ) {
1305
  $translation = self::$existing_terms[ $language ]['element_id'];
1306
+ MLACore::mla_debug_add( __LINE__ . " MLA_WPML::_apply_term_synchronization( {$post_id}, {$language}, {$translation} ) tax_inputs = " . var_export( $tax_inputs, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
1307
  MLAData::mla_update_single_item( $translation, array(), $tax_inputs );
1308
  }
1309
  } // translation
1310
+
1311
  $sitepress->switch_lang( $current_language, true );
1312
  } // do synchronization
1313
  }
1324
  MLACore::mla_debug_add( __LINE__ . " MLA_WPML::mla_updated_single_item( {$post_id}, {$result} )", MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
1325
 
1326
  if ( self::$existing_terms['element_id'] == $post_id ) {
1327
+ // Synchronize the changes to all other translations
 
 
1328
  self::_apply_term_synchronization( $post_id );
1329
  }
1330
  }
1443
  */
1444
  if ( ! empty( self::$duplicate_attachments ) ) {
1445
  self::$updating_duplicates = true;
1446
+
1447
  foreach( self::$duplicate_attachments as $id => $language ) {
1448
  $meta = get_post_meta( $id, '_wp_attachment_metadata', true );
1449
  MLACore::mla_debug_add( __LINE__ . " MLA_WPML::mla_update_attachment_metadata_postfilter( {$id}, {$language} ) attachment_metadata = " . var_export( $meta, true ), MLACore::MLA_DEBUG_CATEGORY_LANGUAGE );
1450
  if ( is_array( $meta ) ) {
1451
  continue;
1452
  }
1453
+
1454
  /*
1455
  * update_post_meta is required twice; first to set it for mapping rules,
1456
  * second to repair the damage done by WPML synchronize_attachment_metadata
1467
  self::$updating_duplicates = false;
1468
  }
1469
  }
1470
+
1471
  return $data;
1472
  }
1473
 
1579
  $true_selected = '';
1580
  $false_selected = 'selected="selected"';
1581
  }
1582
+
1583
  $page_values['custom_fields'] .= ' <label class="inline-edit-c_0 clear"><span class="title">WPML</span><span class="input-text-wrap">' . "\n";
1584
  $page_values['custom_fields'] .= ' <select name="mla_always_translate_media">' . "\n";
1585
  $page_values['custom_fields'] .= ' <option ' . $true_selected . ' value="true">' . __( 'Yes', 'media-library-assistant' ) . '&nbsp;</option>' . "\n";
1587
  $page_values['custom_fields'] .= ' </select><span>&nbsp;' . __( 'Make media available in all languages', 'media-library-assistant' ) . '</span>' . "\n";
1588
  $page_values['custom_fields'] .= ' </span></label>' . "\n";
1589
  }
1590
+
1591
  return $page_values;
1592
  } // mla_upload_bulk_edit_form_values
1593
 
1731
  $active = isset( $wpml_media['file'] ) && is_plugin_active( $wpml_media['file'] );
1732
  }
1733
  }
1734
+
1735
  $wpml_media = '';
1736
  if ( ! $installed ) {
1737
  $wpml_media = '<p><strong>' . __( 'WARNING:', 'media-library-assistant' ) . __( ' WPML Media is not installed.', 'media-library-assistant' ) . '</strong></p>';
1738
  } elseif ( ! $active ) {
1739
  $wpml_media = '<p><strong>' . __( 'WARNING:', 'media-library-assistant' ) . __( ' WPML Media is not active.', 'media-library-assistant' ) . '</strong></p>';
1740
  }
1741
+
1742
  $page_values = array(
1743
  'Language Options' => __( 'Language Options', 'media-library-assistant' ),
1744
  /* translators: 1: - 4: page subheader values */
1936
  if ( false === strpos( $views['all'], 'page=mla-menu' ) ) {
1937
  $views['all'] = str_replace( 'upload.php?', 'upload.php?page=mla-menu&', $views['all'] );
1938
  }
1939
+
1940
  return $views;
1941
  }
1942
 
2134
  $table_language = $query['lang'];
2135
  }
2136
  }
2137
+
2138
  if ( empty( $table_language ) && method_exists( $sitepress, 'get_admin_language_cookie' ) ) {
2139
  $table_language = $sitepress->get_admin_language_cookie();
2140
  }
2143
  $table_language = $sitepress->get_default_language();
2144
  }
2145
  }
2146
+
2147
  return $table_language;
2148
  }
2149
 
includes/mla-media-modal-js-template.php CHANGED
@@ -13,23 +13,6 @@
13
  */
14
  global $post;
15
 
16
- if ( version_compare( get_bloginfo('version'), '5.2.9', '>' ) ) {
17
- $margin = 'margin-top: 32px; ';
18
-
19
- // Do not adjust margin-top for Media/Library Grid mode
20
- if ( function_exists( 'get_current_screen' ) ) {
21
- $screen = get_current_screen();
22
-
23
- if ( is_object( $screen ) ) {
24
- if ( 'upload' == $screen->base ) {
25
- $margin = '';
26
- }
27
- }
28
- }
29
- } else {
30
- $margin = '';
31
- }
32
-
33
  $supported_taxonomies = MLACore::mla_supported_taxonomies('support');
34
  if ( empty( $supported_taxonomies ) ) {
35
  $terms_style = 'style="display: none;"';
@@ -38,11 +21,9 @@ if ( empty( $supported_taxonomies ) ) {
38
  }
39
  ?>
40
  <script type="text/html" id="tmpl-mla-search-box">
41
- <div style="display: inline-block">
42
  <label class="screen-reader-text" for="mla-media-search-input"><?php esc_html_e( 'Search Media', 'media-library-assistant' ); ?>:</label>
43
- <input name="s[mla_search_value]" class="search" id="mla-media-search-input" style="width: 100%; max-width: 100%" type="search" value="{{ data.searchValue }}" placeholder="{{ data.searchBoxPlaceholder }}" />
44
- </div>
45
- <input name="mla_search_submit" class="button media-button mla-search-submit-button" id="mla-search-submit" type="submit" style="<?php echo esc_attr( $margin ) ?>float: none" value="<?php esc_attr_e( 'Search', 'media-library-assistant' ); ?>" /><br>
46
  <ul class="mla-search-options" style="{{ data.searchBoxControlsStyle }}">
47
  <li>
48
  <input type="radio" name="s[mla_search_connector]" value="AND" <# if ( 'OR' !== data.searchConnector ) { #>checked="checked"<# } #> />
@@ -77,7 +58,7 @@ if ( empty( $supported_taxonomies ) ) {
77
  <input type="checkbox" name="s[mla_search_file]" id="search-file" value="file" <# if ( -1 != data.searchFields.indexOf( 'file' ) ) { #>checked<# } #> />
78
  <?php esc_html_e( 'File', 'media-library-assistant' ); ?>
79
  </li>
80
- <span <?php echo esc_attr( $terms_style ) ?>>
81
  <li>
82
  <input type="checkbox" name="s[mla_search_terms]" id="search-terms" value="terms" <# if ( -1 != data.searchFields.indexOf( 'terms' ) ) { #>checked<# } #> />
83
  <?php esc_html_e( 'Terms', 'media-library-assistant' ); ?>
@@ -86,7 +67,7 @@ if ( empty( $supported_taxonomies ) ) {
86
  </ul>
87
  </script>
88
  <script type="text/html" id="tmpl-mla-terms-search-button">
89
- <input name="mla_terms_search" id="mla-terms-search" class="button media-button button-large mla-terms-search-button" style="<?php echo esc_attr( $margin ) ?>" type="button" value="<?php esc_attr_e( 'Terms Search', 'media-library-assistant' ); ?>" />
90
  </script>
91
  <script type="text/html" id="tmpl-mla-simulate-search-button">
92
  <input style="display:none" type="button" name="mla_search_submit" id="mla-search-submit" class="button" value="<?php esc_attr_e( 'Search', 'media-library-assistant' ); ?>" />
13
  */
14
  global $post;
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  $supported_taxonomies = MLACore::mla_supported_taxonomies('support');
17
  if ( empty( $supported_taxonomies ) ) {
18
  $terms_style = 'style="display: none;"';
21
  }
22
  ?>
23
  <script type="text/html" id="tmpl-mla-search-box">
 
24
  <label class="screen-reader-text" for="mla-media-search-input"><?php esc_html_e( 'Search Media', 'media-library-assistant' ); ?>:</label>
25
+ <input name="s[mla_search_value]" class="search mla-media-search-input" id="mla-media-search-input" type="search" value="{{ data.searchValue }}" placeholder="{{ data.searchBoxPlaceholder }}" />
26
+ <input name="mla_search_submit" class="button media-button button-large mla-search-submit-button" id="mla-search-submit" type="submit" value="<?php esc_attr_e( 'Search', 'media-library-assistant' ); ?>" /><br>
 
27
  <ul class="mla-search-options" style="{{ data.searchBoxControlsStyle }}">
28
  <li>
29
  <input type="radio" name="s[mla_search_connector]" value="AND" <# if ( 'OR' !== data.searchConnector ) { #>checked="checked"<# } #> />
58
  <input type="checkbox" name="s[mla_search_file]" id="search-file" value="file" <# if ( -1 != data.searchFields.indexOf( 'file' ) ) { #>checked<# } #> />
59
  <?php esc_html_e( 'File', 'media-library-assistant' ); ?>
60
  </li>
61
+ <span <?php echo $terms_style; // phpcs:ignore ?>>
62
  <li>
63
  <input type="checkbox" name="s[mla_search_terms]" id="search-terms" value="terms" <# if ( -1 != data.searchFields.indexOf( 'terms' ) ) { #>checked<# } #> />
64
  <?php esc_html_e( 'Terms', 'media-library-assistant' ); ?>
67
  </ul>
68
  </script>
69
  <script type="text/html" id="tmpl-mla-terms-search-button">
70
+ <input name="mla_terms_search" id="mla-terms-search" class="button media-button button-large mla-terms-search-button" type="button" value="<?php esc_attr_e( 'Terms Search', 'media-library-assistant' ); ?>" />
71
  </script>
72
  <script type="text/html" id="tmpl-mla-simulate-search-button">
73
  <input style="display:none" type="button" name="mla_search_submit" id="mla-search-submit" class="button" value="<?php esc_attr_e( 'Search', 'media-library-assistant' ); ?>" />
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.94
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.95
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
6
  * will the rest of the plugin be loaded and run.
7
  *
8
  * @package Media Library Assistant
9
+ * @version 2.96
10
  */
11
 
12
  /*
16
  Author: David Lingren
17
  Text Domain: media-library-assistant
18
  Domain Path: /languages
19
+ Version: 2.96
20
  Author URI: http://davidlingren.com/
21
 
22
+ Copyright 2011-2021 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-add-new-bulk-edit-scripts.js CHANGED
@@ -31,7 +31,7 @@ var jQuery,
31
  taxonomyParts.shift(); // taxonomy-
32
  taxonomy = taxonomyParts.join('-');
33
 
34
- jQuery.extend( jQuery.expr[":"], {
35
  "matchTerms": function( elem, i, match, array ) {
36
  return ( elem.textContent || elem.innerText || "" ).toLowerCase().indexOf( ( match[3] || "" ).toLowerCase() ) >= 0;
37
  }
@@ -42,7 +42,7 @@ var jQuery,
42
 
43
  jQuery( rowId + ' #search-' + taxonomy ).off();
44
 
45
- jQuery( rowId + ' #search-' + taxonomy ).keydown( function( event ){
46
 
47
  if( 13 === event.keyCode ) {
48
  event.preventDefault();
@@ -55,7 +55,7 @@ var jQuery,
55
 
56
  } );
57
 
58
- jQuery( rowId + ' #search-' + taxonomy ).keypress( function( event ){
59
 
60
  if( 13 === event.keyCode ) {
61
  event.preventDefault();
@@ -68,7 +68,7 @@ var jQuery,
68
 
69
  } );
70
 
71
- jQuery( rowId + ' #search-' + taxonomy ).keyup( function( event ){
72
  var searchValue, termList, matchingTerms;
73
 
74
  if( 13 === event.keyCode ) {
@@ -93,7 +93,7 @@ var jQuery,
93
 
94
  jQuery( rowId + ' #' + taxonomy + '-search-toggle' ).off();
95
 
96
- jQuery( rowId + ' #' + taxonomy + '-search-toggle' ).click( function() {
97
  jQuery( rowId + ' #' + taxonomy + '-adder ').addClass( 'wp-hidden-children' );
98
  jQuery( rowId + ' #' + taxonomy + '-searcher' ).toggleClass( 'wp-hidden-children' );
99
  jQuery( rowId + ' #' + taxonomy + 'checklist li' ).show();
31
  taxonomyParts.shift(); // taxonomy-
32
  taxonomy = taxonomyParts.join('-');
33
 
34
+ jQuery.extend( jQuery.expr.pseudos || jQuery.expr[":"], {
35
  "matchTerms": function( elem, i, match, array ) {
36
  return ( elem.textContent || elem.innerText || "" ).toLowerCase().indexOf( ( match[3] || "" ).toLowerCase() ) >= 0;
37
  }
42
 
43
  jQuery( rowId + ' #search-' + taxonomy ).off();
44
 
45
+ jQuery( rowId + ' #search-' + taxonomy ).on( 'keydown', function( event ){
46
 
47
  if( 13 === event.keyCode ) {
48
  event.preventDefault();
55
 
56
  } );
57
 
58
+ jQuery( rowId + ' #search-' + taxonomy ).on( 'keypress', function( event ){
59
 
60
  if( 13 === event.keyCode ) {
61
  event.preventDefault();
68
 
69
  } );
70
 
71
+ jQuery( rowId + ' #search-' + taxonomy ).on( 'keyup', function( event ){
72
  var searchValue, termList, matchingTerms;
73
 
74
  if( 13 === event.keyCode ) {
93
 
94
  jQuery( rowId + ' #' + taxonomy + '-search-toggle' ).off();
95
 
96
+ jQuery( rowId + ' #' + taxonomy + '-search-toggle' ).on( 'click', function() {
97
  jQuery( rowId + ' #' + taxonomy + '-adder ').addClass( 'wp-hidden-children' );
98
  jQuery( rowId + ' #' + taxonomy + '-searcher' ).toggleClass( 'wp-hidden-children' );
99
  jQuery( rowId + ' #' + taxonomy + 'checklist li' ).show();
js/mla-add-new-bulk-edit-scripts.min.js CHANGED
@@ -1 +1 @@
1
- var jQuery,mla_add_new_bulk_edit_vars,mla={settings:{},utility:{getId:function(b){var c=jQuery(b).closest("tr").attr("id"),a=c.split("-");return a[a.length-1]},attachSearch:function(a){jQuery(a+" .categorydiv").each(function(){var d=jQuery(this).attr("id"),c,b;c=d.split("-");c.shift();b=c.join("-");jQuery.extend(jQuery.expr[":"],{matchTerms:function(g,f,e,h){return(g.textContent||g.innerText||"").toLowerCase().indexOf((e[3]||"").toLowerCase())>=0}});jQuery(a+" #"+b+"-searcher").addClass("wp-hidden-children");jQuery(a+" #"+b+"checklist li").show();jQuery(a+" #search-"+b).off();jQuery(a+" #search-"+b).keydown(function(e){if(13===e.keyCode){e.preventDefault();jQuery(a+" #search-"+b).val("");jQuery(a+" #"+b+"-searcher").addClass("wp-hidden-children");jQuery(a+" #"+b+"checklist li").show();return false}});jQuery(a+" #search-"+b).keypress(function(e){if(13===e.keyCode){e.preventDefault();jQuery(a+" #search-"+b).val("");jQuery(a+" #"+b+"-searcher").addClass("wp-hidden-children");jQuery(a+" #"+b+"checklist li").show();return}});jQuery(a+" #search-"+b).keyup(function(f){var h,g,e;if(13===f.keyCode){f.preventDefault();jQuery(a+" #"+b+"-search-toggle").focus();return}h=jQuery(a+" #search-"+b).val();g=jQuery(a+" #"+b+"checklist li");if(0<h.length){g.hide()}else{g.show()}e=jQuery(a+" #"+b+"checklist label:matchTerms('"+h+"')");e.closest("li").find("li").andSelf().show();e.parents(a+" #"+b+"checklist li").show()});jQuery(a+" #"+b+"-search-toggle").off();jQuery(a+" #"+b+"-search-toggle").click(function(){jQuery(a+" #"+b+"-adder ").addClass("wp-hidden-children");jQuery(a+" #"+b+"-searcher").toggleClass("wp-hidden-children");jQuery(a+" #"+b+"checklist li").show();if(false===jQuery(a+" #"+b+"-searcher").hasClass("wp-hidden-children")){jQuery(a+" #search-"+b).val("").removeClass("form-input-tip");jQuery(a+" #search-"+b).focus()}return false})})}},addNewBulkEdit:null,setParent:null};(function(a){mla.settings=typeof mla_add_new_bulk_edit_vars==="undefined"?{}:mla_add_new_bulk_edit_vars;mla_add_new_bulk_edit_vars=void 0;if(typeof mla.settings.areaOnTop==="undefined"){mla.settings.areaOnTop=false}mla.addNewBulkEdit={init:function(){var d,e,c,g=a(".upload-flash-bypass"),f=a("#wpbody .wrap").children("h1, h2"),b,h=a("#mla-add-new-bulk-edit-div").hide();if(typeof mla.addTerm!=="undefined"){mla.addTerm.init("#mla-add-new-bulk-edit-div")}mla.utility.attachSearch("#mla-add-new-bulk-edit-div");a("#bulk-edit-set-parent",h).on("click",function(){return mla.addNewBulkEdit.parentOpen()});d=a("#mla-blank-add-new-bulk-edit-div").detach();a("#file-form").after(d);e=a("#bulk-edit-toggle",h).detach();c=a("#bulk-edit-reset",h).detach();if(mla.settings.areaOnTop){e.appendTo(f);c.appendTo(f);b=h.detach();a("#media-upload-notice").before(b)}else{e.appendTo(g);c.appendTo(g)}e.siblings("a").on("click",function(){e.attr("title",mla.settings.toggleOpen);e.attr("value",mla.settings.toggleOpen);c.hide();h.hide()});e.on("click",function(){return mla.addNewBulkEdit.formToggle()});c.on("click",function(){return mla.addNewBulkEdit.doReset()});if(mla.settings.areaOpen){mla.addNewBulkEdit.formToggle()}a("textarea.mla_tags",h).each(function(){var i=a(this).attr("name").replace("]","").replace("tax_input[","");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+i,{delay:500,minchars:2,multiple:true,multipleSep:mla.settings.comma+" "})});uploader.bind("BeforeUpload",function(i,j){var k=a("#file-form").serialize();i.settings.multipart_params.mlaAddNewBulkEditFormString=k})},doReset:function(){var e=a("#mla-add-new-bulk-edit-div"),d=a("#mla-blank-add-new-bulk-edit-div"),b=a(".inline-edit-categories",d).html(),f=a(".inline-edit-tags",d).html(),c=a(".inline-edit-fields",d).html();a(".inline-edit-categories",e).html(b),a(".inline-edit-tags",e).html(f),a(".inline-edit-fields",e).html(c);if(typeof mla.addTerm!=="undefined"){mla.addTerm.init("#mla-add-new-bulk-edit-div")}mla.utility.attachSearch("#mla-add-new-bulk-edit-div");a("#bulk-edit-set-parent",e).on("click",function(){return mla.addNewBulkEdit.parentOpen()});return false},formToggle:function(){var d=a("#bulk-edit-toggle"),b=a("#bulk-edit-reset"),c=a("#mla-add-new-bulk-edit-div");if("none"===c.css("display")){d.attr("title",mla.settings.toggleClose);d.attr("value",mla.settings.toggleClose);b.show()}else{d.attr("title",mla.settings.toggleOpen);d.attr("value",mla.settings.toggleOpen);b.hide()}c.slideToggle("slow")},parentOpen:function(){var d,b,c;b=-1;c=mla.settings.uploadTitle;d=a('#mla-add-new-bulk-edit-div :input[name="post_parent"]').val()||-1;mla.setParent.open(d,b,c);a("#mla-set-parent-submit").on("click",function(e){e.preventDefault();mla.addNewBulkEdit.parentSave();return false})},parentSave:function(){var c=a("#mla-set-parent-response-div input:checked").closest("tr"),d,b;if(c.length){d=a(":radio",c).val()||"";b=a('#mla-add-new-bulk-edit-div :input[name="post_parent"]').clone(true).val(d);a('#mla-add-new-bulk-edit-div :input[name="post_parent"]').replaceWith(b)}mla.setParent.close();a("#mla-set-parent-submit").off("click")}};a(document).ready(function(){mla.addNewBulkEdit.init()})})(jQuery);
1
+ var jQuery,mla_add_new_bulk_edit_vars,mla={settings:{},utility:{getId:function(b){var c=jQuery(b).closest("tr").attr("id"),a=c.split("-");return a[a.length-1]},attachSearch:function(a){jQuery(a+" .categorydiv").each(function(){var d=jQuery(this).attr("id"),c,b;c=d.split("-");c.shift();b=c.join("-");jQuery.extend(jQuery.expr.pseudos||jQuery.expr[":"],{matchTerms:function(g,f,e,h){return(g.textContent||g.innerText||"").toLowerCase().indexOf((e[3]||"").toLowerCase())>=0}});jQuery(a+" #"+b+"-searcher").addClass("wp-hidden-children");jQuery(a+" #"+b+"checklist li").show();jQuery(a+" #search-"+b).off();jQuery(a+" #search-"+b).on("keydown",function(e){if(13===e.keyCode){e.preventDefault();jQuery(a+" #search-"+b).val("");jQuery(a+" #"+b+"-searcher").addClass("wp-hidden-children");jQuery(a+" #"+b+"checklist li").show();return false}});jQuery(a+" #search-"+b).on("keypress",function(e){if(13===e.keyCode){e.preventDefault();jQuery(a+" #search-"+b).val("");jQuery(a+" #"+b+"-searcher").addClass("wp-hidden-children");jQuery(a+" #"+b+"checklist li").show();return}});jQuery(a+" #search-"+b).on("keyup",function(f){var h,g,e;if(13===f.keyCode){f.preventDefault();jQuery(a+" #"+b+"-search-toggle").focus();return}h=jQuery(a+" #search-"+b).val();g=jQuery(a+" #"+b+"checklist li");if(0<h.length){g.hide()}else{g.show()}e=jQuery(a+" #"+b+"checklist label:matchTerms('"+h+"')");e.closest("li").find("li").andSelf().show();e.parents(a+" #"+b+"checklist li").show()});jQuery(a+" #"+b+"-search-toggle").off();jQuery(a+" #"+b+"-search-toggle").on("click",function(){jQuery(a+" #"+b+"-adder ").addClass("wp-hidden-children");jQuery(a+" #"+b+"-searcher").toggleClass("wp-hidden-children");jQuery(a+" #"+b+"checklist li").show();if(false===jQuery(a+" #"+b+"-searcher").hasClass("wp-hidden-children")){jQuery(a+" #search-"+b).val("").removeClass("form-input-tip");jQuery(a+" #search-"+b).focus()}return false})})}},addNewBulkEdit:null,setParent:null};(function(a){mla.settings=typeof mla_add_new_bulk_edit_vars==="undefined"?{}:mla_add_new_bulk_edit_vars;mla_add_new_bulk_edit_vars=void 0;if(typeof mla.settings.areaOnTop==="undefined"){mla.settings.areaOnTop=false}mla.addNewBulkEdit={init:function(){var d,e,c,g=a(".upload-flash-bypass"),f=a("#wpbody .wrap").children("h1, h2"),b,h=a("#mla-add-new-bulk-edit-div").hide();if(typeof mla.addTerm!=="undefined"){mla.addTerm.init("#mla-add-new-bulk-edit-div")}mla.utility.attachSearch("#mla-add-new-bulk-edit-div");a("#bulk-edit-set-parent",h).on("click",function(){return mla.addNewBulkEdit.parentOpen()});d=a("#mla-blank-add-new-bulk-edit-div").detach();a("#file-form").after(d);e=a("#bulk-edit-toggle",h).detach();c=a("#bulk-edit-reset",h).detach();if(mla.settings.areaOnTop){e.appendTo(f);c.appendTo(f);b=h.detach();a("#media-upload-notice").before(b)}else{e.appendTo(g);c.appendTo(g)}e.siblings("a").on("click",function(){e.attr("title",mla.settings.toggleOpen);e.attr("value",mla.settings.toggleOpen);c.hide();h.hide()});e.on("click",function(){return mla.addNewBulkEdit.formToggle()});c.on("click",function(){return mla.addNewBulkEdit.doReset()});if(mla.settings.areaOpen){mla.addNewBulkEdit.formToggle()}a("textarea.mla_tags",h).each(function(){var i=a(this).attr("name").replace("]","").replace("tax_input[","");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+i,{delay:500,minchars:2,multiple:true,multipleSep:mla.settings.comma+" "})});uploader.bind("BeforeUpload",function(i,j){var k=a("#file-form").serialize();i.settings.multipart_params.mlaAddNewBulkEditFormString=k})},doReset:function(){var e=a("#mla-add-new-bulk-edit-div"),d=a("#mla-blank-add-new-bulk-edit-div"),b=a(".inline-edit-categories",d).html(),f=a(".inline-edit-tags",d).html(),c=a(".inline-edit-fields",d).html();a(".inline-edit-categories",e).html(b),a(".inline-edit-tags",e).html(f),a(".inline-edit-fields",e).html(c);if(typeof mla.addTerm!=="undefined"){mla.addTerm.init("#mla-add-new-bulk-edit-div")}mla.utility.attachSearch("#mla-add-new-bulk-edit-div");a("#bulk-edit-set-parent",e).on("click",function(){return mla.addNewBulkEdit.parentOpen()});return false},formToggle:function(){var d=a("#bulk-edit-toggle"),b=a("#bulk-edit-reset"),c=a("#mla-add-new-bulk-edit-div");if("none"===c.css("display")){d.attr("title",mla.settings.toggleClose);d.attr("value",mla.settings.toggleClose);b.show()}else{d.attr("title",mla.settings.toggleOpen);d.attr("value",mla.settings.toggleOpen);b.hide()}c.slideToggle("slow")},parentOpen:function(){var d,b,c;b=-1;c=mla.settings.uploadTitle;d=a('#mla-add-new-bulk-edit-div :input[name="post_parent"]').val()||-1;mla.setParent.open(d,b,c);a("#mla-set-parent-submit").on("click",function(e){e.preventDefault();mla.addNewBulkEdit.parentSave();return false})},parentSave:function(){var c=a("#mla-set-parent-response-div input:checked").closest("tr"),d,b;if(c.length){d=a(":radio",c).val()||"";b=a('#mla-add-new-bulk-edit-div :input[name="post_parent"]').clone(true).val(d);a('#mla-add-new-bulk-edit-div :input[name="post_parent"]').replaceWith(b)}mla.setParent.close();a("#mla-set-parent-submit").off("click")}};a(document).ready(function(){mla.addNewBulkEdit.init()})})(jQuery);
js/mla-add-term-scripts.js CHANGED
@@ -45,15 +45,14 @@ var jQuery;
45
  });
46
 
47
  // On [enter] submit the taxonomy.
48
- $( '#new' + taxonomy, context ).keypress( function(event){
49
  if( 13 === event.keyCode ) {
50
  event.preventDefault();
51
- $( '#' + taxonomy + '-add-submit', context ).click();
52
- }
53
  });
54
 
55
  // After submitting a new taxonomy, re-focus the input field.
56
- $( '#' + taxonomy + '-add-submit', context ).click( function() {
57
  $( '#new' + taxonomy, context ).focus();
58
  });
59
 
@@ -114,7 +113,7 @@ var jQuery;
114
  $( '#' + taxonomy + '-add-toggle', context ).off();
115
 
116
  // Add new taxonomy button toggles input form visibility.
117
- $( '#' + taxonomy + '-add-toggle', context ).click( function( e ) {
118
  e.preventDefault();
119
  $( '#' + taxonomy + '-adder', context ).toggleClass( 'wp-hidden-children' );
120
  $( '#new' + taxonomy, context ).focus();
@@ -314,7 +313,8 @@ var jQuery;
314
  target: list.get( 0 )
315
  }, settings || {} );
316
 
317
- if ( $.isFunction( settings.confirm ) ) {
 
318
  $element = $( '#' + settings.element, mla.mlaList.settings.context );
319
 
320
  if ( 'add' !== action ) {
@@ -380,13 +380,14 @@ var jQuery;
380
  }, wpAjax.unserialize( data[4] || '' ) ) );
381
 
382
  formValues = $( '#' + settings.element + ' :input', mla.mlaList.settings.context ).not( '[name="_ajax_nonce"], [name="_wpnonce"], [name="action"]' );
383
- formData = $.isFunction( formValues.fieldSerialize ) ? formValues.fieldSerialize() : formValues.serialize();
384
 
385
  if ( formData ) {
386
  settings.data += '&' + formData;
387
  }
388
 
389
- if ( $.isFunction( settings.addBefore ) ) {
 
390
  settings = settings.addBefore( settings );
391
 
392
  if ( ! settings ) {
@@ -428,7 +429,8 @@ var jQuery;
428
 
429
  // The addAfter function uses the supplemental data to update the "Parent Term" dropdown ontrol
430
  settings.complete = function( jqXHR, status ) {
431
- if ( $.isFunction( settings.addAfter ) ) {
 
432
  settings.addAfter( returnedResponse, $.extend( {
433
  xml: jqXHR,
434
  status: status,
45
  });
46
 
47
  // On [enter] submit the taxonomy.
48
+ $( '#new' + taxonomy, context ).on( 'keypress', function(event){
49
  if( 13 === event.keyCode ) {
50
  event.preventDefault();
51
+ $( '#' + taxonomy + '-add-submit', context ).trigger('click'); }
 
52
  });
53
 
54
  // After submitting a new taxonomy, re-focus the input field.
55
+ $( '#' + taxonomy + '-add-submit', context ).on( 'click', function() {
56
  $( '#new' + taxonomy, context ).focus();
57
  });
58
 
113
  $( '#' + taxonomy + '-add-toggle', context ).off();
114
 
115
  // Add new taxonomy button toggles input form visibility.
116
+ $( '#' + taxonomy + '-add-toggle', context ).on( 'click', function( e ) {
117
  e.preventDefault();
118
  $( '#' + taxonomy + '-adder', context ).toggleClass( 'wp-hidden-children' );
119
  $( '#new' + taxonomy, context ).focus();
313
  target: list.get( 0 )
314
  }, settings || {} );
315
 
316
+ // if ( $.isFunction( settings.confirm ) ) {
317
+ if ( typeof settings.confirm === 'function' ) {
318
  $element = $( '#' + settings.element, mla.mlaList.settings.context );
319
 
320
  if ( 'add' !== action ) {
380
  }, wpAjax.unserialize( data[4] || '' ) ) );
381
 
382
  formValues = $( '#' + settings.element + ' :input', mla.mlaList.settings.context ).not( '[name="_ajax_nonce"], [name="_wpnonce"], [name="action"]' );
383
+ formData = typeof formValues.fieldSerialize === 'function' ? formValues.fieldSerialize() : formValues.serialize();
384
 
385
  if ( formData ) {
386
  settings.data += '&' + formData;
387
  }
388
 
389
+ // if ( $.isFunction( settings.addBefore ) ) {
390
+ if ( typeof settings.addBefore === 'function' ) {
391
  settings = settings.addBefore( settings );
392
 
393
  if ( ! settings ) {
429
 
430
  // The addAfter function uses the supplemental data to update the "Parent Term" dropdown ontrol
431
  settings.complete = function( jqXHR, status ) {
432
+ // if ( $.isFunction( settings.addAfter ) ) {
433
+ if ( typeof settings.addAfter === 'function' ) {
434
  settings.addAfter( returnedResponse, $.extend( {
435
  xml: jqXHR,
436
  status: status,
js/mla-add-term-scripts.min.js CHANGED
@@ -1 +1 @@
1
- var jQuery;(function(a){mla.addTerm={init:function(c){var d=a(c);a(".categorydiv",d).each(function(){var h=a(this).attr("id"),g,i,f,e;f=h.split("-");f.shift();e=f.join("-");a("#new"+e,d).one("focus",function(){a(this).val("").removeClass("form-input-tip")});a("#new"+e,d).keypress(function(j){if(13===j.keyCode){j.preventDefault();a("#"+e+"-add-submit",d).click()}});a("#"+e+"-add-submit",d).click(function(){a("#new"+e,d).focus()});g=function(j){if(!a("#new"+e,d).val()){return false}j.data+="&"+a(":checked","#"+e+"-checklist",d).serialize();a("#"+e+"-add-submit",d).prop("disabled",true);return j};i=function(l,k){var j;a("#"+e+"-add-submit",d).prop("disabled",false);if("undefined"!=k.parsed.responses[0]&&(j=k.parsed.responses[0].supplemental.newcat_parent)){a(".edit-fields-div").each(function(){var m=a("#new"+e+"_parent",a(this));m.before(j);m.remove()})}};mla.mlaList.settings.context=d;a("#"+e+"checklist",d).mlaList({alt:"",context:d,response:"add-term-ajax-response",addBefore:g,addAfter:i});a("#"+e+"-add-toggle",d).off();a("#"+e+"-add-toggle",d).click(function(j){j.preventDefault();a("#"+e+"-adder",d).toggleClass("wp-hidden-children");a("#new"+e,d).focus();a("#"+e+"-searcher",d).addClass("wp-hidden-children");return false})})}};mla.mlaList={settings:{url:ajaxurl,type:"POST",context:null,response:"ajax-response",what:"",alt:"alternate",altOffset:0,addColor:"#ffff33",confirm:null,addBefore:null,addAfter:null},nonce:function(e,f){var d=wpAjax.unserialize(e.attr("href")),c=a("#"+f.element,mla.mlaList.settings.context);return f.nonce||d._ajax_nonce||c.find('input[name="_ajax_nonce"]').val()||d._wpnonce||c.find('input[name="_wpnonce"]').val()||0},parseData:function(d,e){var g=[],f;try{f=a(d).data("wp-lists")||"";f=f.match(new RegExp(e+":[\\S]+"));if(f){g=f[0].split(":")}}catch(c){}return g},pre:function(g,e,f){var c,d,h;e=a.extend({},this.mlaList.settings,{element:null,nonce:0,target:g.get(0)},e||{});if(a.isFunction(e.confirm)){c=a("#"+e.element,mla.mlaList.settings.context);if("add"!==f){d=c.css("backgroundColor");c.css("backgroundColor","#ff9966")}h=e.confirm.call(this,g,e,f,d);if("add"!==f){c.css("backgroundColor",d)}if(!h){return false}}return e},ajaxAdd:function(g,e){var j=this,k=a(g,mla.mlaList.settings.context),f=mla.mlaList.parseData(k,"add"),i,c,h,d;e=e||{};e=mla.mlaList.pre.call(j,k,e,"add");e.element=f[2]||k.prop("id")||e.element||null;e.addColor=f[3]?"#"+f[3]:e.addColor;if(!e){return false}if(!k.is('[id="'+e.element+'-submit"]',mla.mlaList.settings.context)){return !mla.mlaList.add.call(j,k,e)}if(!e.element){return true}e.action="add-"+e.what;e.nonce=mla.mlaList.nonce(k,e);if(!wpAjax.validateForm(mla.mlaList.settings.context.selector+" #"+e.element)){return false}e.data=a.param(a.extend({_ajax_nonce:e.nonce,action:e.action},wpAjax.unserialize(f[4]||"")));i=a("#"+e.element+" :input",mla.mlaList.settings.context).not('[name="_ajax_nonce"], [name="_wpnonce"], [name="action"]');c=a.isFunction(i.fieldSerialize)?i.fieldSerialize():i.serialize();if(c){e.data+="&"+c}if(a.isFunction(e.addBefore)){e=e.addBefore(e);if(!e){return true}}if(!e.data.match(/_ajax_nonce=[a-f0-9]+/)){return true}e.success=function(m){var l=mla.mlaList.settings.context.selector.substring(1);h=wpAjax.parseAjaxResponse(m,l+" #"+e.response,e.element);d=m;if(!h||h.errors){return false}if(true===h){return true}a.each(h.responses,function(){mla.mlaList.add.call(j,this.data,a.extend({},e,{position:this.position||0,id:this.id||0,oldId:this.oldId||null}))});j.mlaList.recolor();a(j).trigger("mlaListAddEnd",[e,j.mlaList]);mla.mlaList.clear.call(j,"#"+e.element)};e.complete=function(m,l){if(a.isFunction(e.addAfter)){e.addAfter(d,a.extend({xml:m,status:l,parsed:h},e))}};a.ajax(e);return false},getColor:function(c){return a(c).css("backgroundColor")||"#ffffff"},addToOtherLists:function(d,c,e){a(".edit-fields-div").each(function(){var m=a(this),i=m.attr("id"),l=e.context.selector.substring(1),h,k,j,g,f;if(l!==i){h=a("."+c.attr("id"),m);k=a(d);j=false;a("input",k).removeAttr("checked");if(e.oldId){j=a("#"+e.what+"-"+e.oldId,h)}if(e.id&&(e.id!==e.oldId||!j||!j.length)){a("#"+e.what+"-"+e.id,h).remove()}if(j&&j.length){j.before(k);j.remove()}else{if(isNaN(e.position)){g="after";if("-"===e.position.substr(0,1)){e.position=e.position.substr(1);g="before"}f=h.find("#"+e.position);if(1===f.length){f[g](k)}else{h.append(k)}}else{if("comment"!==e.what||0===a("#"+e.element,h).length){if(e.position<0){h.prepend(k)}else{h.append(k)}}}}}})},add:function(h,i){var g=a(this),f=a(h),e=false,d,c;if("string"===typeof i){i={what:i}}i=a.extend({position:0,id:0,oldId:null},this.mlaList.settings,i);if(!f.length||!i.what){return false}mla.mlaList.addToOtherLists(h,g,i);if(i.oldId){e=a("#"+i.what+"-"+i.oldId,i.context)}if(i.id&&(i.id!==i.oldId||!e||!e.length)){a("#"+i.what+"-"+i.id,i.context).remove()}if(e&&e.length){e.before(f);e.remove()}else{if(isNaN(i.position)){d="after";if("-"===i.position.substr(0,1)){i.position=i.position.substr(1);d="before"}c=g.find("#"+i.position);if(1===c.length){c[d](f)}else{g.append(f)}}else{if("comment"!==i.what||0===a("#"+i.element,mla.mlaList.settings.context).length){if(i.position<0){g.prepend(f)}else{g.append(f)}}}}if(i.alt){f.toggleClass(i.alt,(g.children(":visible").index(f[0])+i.altOffset)%2)}if("none"!==i.addColor){f.css("backgroundColor",i.addColor).animate({backgroundColor:mla.mlaList.getColor(f)},{complete:function(){a(this).css("backgroundColor","")}})}g.each(function(j,k){k.mlaList.process(f)});return f},clear:function(d){var g=this,c=a(d),f,e;if(g.mlaList&&c.parents("#"+g.id).length){return}c.find(":input").each(function(i,h){if(a(h).parents(".form-no-clear").length){return}f=h.type.toLowerCase();e=h.tagName.toLowerCase();if("text"===f||"password"===f||"textarea"===e){h.value=""}else{if("checkbox"===f||"radio"===f){h.checked=false}else{if("select"===e){h.selectedIndex=null}}}})},process:function(d){var e=this,c=a(d||document);c.on("submit",'form[data-wp-lists^="add:'+e.id+':"]',function(){return e.mlaList.add(this)});c.on("click",'a[data-wp-lists^="add:'+e.id+':"], input[data-wp-lists^="add:'+e.id+':"]',function(){return e.mlaList.add(this)})},recolor:function(){var d=this,e=[":even",":odd"],c;if(!d.mlaList.settings.alt){return}c=a(".list-item:visible",d);if(!c.length){c=a(d).children(":visible")}if(d.mlaList.settings.altOffset%2){e.reverse()}c.filter(e[0]).addClass(d.mlaList.settings.alt).end();c.filter(e[1]).removeClass(d.mlaList.settings.alt)},init:function(){var c=this;c.mlaList.process=function(d){c.each(function(){this.mlaList.process(d)})};c.mlaList.recolor=function(){c.each(function(){this.mlaList.recolor()})}}};var b={add:"ajaxAdd",process:"process",recolor:"recolor"};a.fn.mlaList=function(c){this.each(function(d,e){e.mlaList={settings:a.extend({},mla.mlaList.settings,{what:mla.mlaList.parseData(e,"list")[1]||""},c)};a.each(b,function(f,g){e.mlaList[f]=function(h,i){return mla.mlaList[g].call(e,h,i)}})});mla.mlaList.init.call(this);this.mlaList.process(c.context);return this}})(jQuery);
1
+ var jQuery;(function(a){mla.addTerm={init:function(c){var d=a(c);a(".categorydiv",d).each(function(){var h=a(this).attr("id"),g,i,f,e;f=h.split("-");f.shift();e=f.join("-");a("#new"+e,d).one("focus",function(){a(this).val("").removeClass("form-input-tip")});a("#new"+e,d).on("keypress",function(j){if(13===j.keyCode){j.preventDefault();a("#"+e+"-add-submit",d).trigger("click")}});a("#"+e+"-add-submit",d).on("click",function(){a("#new"+e,d).focus()});g=function(j){if(!a("#new"+e,d).val()){return false}j.data+="&"+a(":checked","#"+e+"-checklist",d).serialize();a("#"+e+"-add-submit",d).prop("disabled",true);return j};i=function(l,k){var j;a("#"+e+"-add-submit",d).prop("disabled",false);if("undefined"!=k.parsed.responses[0]&&(j=k.parsed.responses[0].supplemental.newcat_parent)){a(".edit-fields-div").each(function(){var m=a("#new"+e+"_parent",a(this));m.before(j);m.remove()})}};mla.mlaList.settings.context=d;a("#"+e+"checklist",d).mlaList({alt:"",context:d,response:"add-term-ajax-response",addBefore:g,addAfter:i});a("#"+e+"-add-toggle",d).off();a("#"+e+"-add-toggle",d).on("click",function(j){j.preventDefault();a("#"+e+"-adder",d).toggleClass("wp-hidden-children");a("#new"+e,d).focus();a("#"+e+"-searcher",d).addClass("wp-hidden-children");return false})})}};mla.mlaList={settings:{url:ajaxurl,type:"POST",context:null,response:"ajax-response",what:"",alt:"alternate",altOffset:0,addColor:"#ffff33",confirm:null,addBefore:null,addAfter:null},nonce:function(e,f){var d=wpAjax.unserialize(e.attr("href")),c=a("#"+f.element,mla.mlaList.settings.context);return f.nonce||d._ajax_nonce||c.find('input[name="_ajax_nonce"]').val()||d._wpnonce||c.find('input[name="_wpnonce"]').val()||0},parseData:function(d,e){var g=[],f;try{f=a(d).data("wp-lists")||"";f=f.match(new RegExp(e+":[\\S]+"));if(f){g=f[0].split(":")}}catch(c){}return g},pre:function(g,e,f){var c,d,h;e=a.extend({},this.mlaList.settings,{element:null,nonce:0,target:g.get(0)},e||{});if(typeof e.confirm==="function"){c=a("#"+e.element,mla.mlaList.settings.context);if("add"!==f){d=c.css("backgroundColor");c.css("backgroundColor","#ff9966")}h=e.confirm.call(this,g,e,f,d);if("add"!==f){c.css("backgroundColor",d)}if(!h){return false}}return e},ajaxAdd:function(g,e){var j=this,k=a(g,mla.mlaList.settings.context),f=mla.mlaList.parseData(k,"add"),i,c,h,d;e=e||{};e=mla.mlaList.pre.call(j,k,e,"add");e.element=f[2]||k.prop("id")||e.element||null;e.addColor=f[3]?"#"+f[3]:e.addColor;if(!e){return false}if(!k.is('[id="'+e.element+'-submit"]',mla.mlaList.settings.context)){return !mla.mlaList.add.call(j,k,e)}if(!e.element){return true}e.action="add-"+e.what;e.nonce=mla.mlaList.nonce(k,e);if(!wpAjax.validateForm(mla.mlaList.settings.context.selector+" #"+e.element)){return false}e.data=a.param(a.extend({_ajax_nonce:e.nonce,action:e.action},wpAjax.unserialize(f[4]||"")));i=a("#"+e.element+" :input",mla.mlaList.settings.context).not('[name="_ajax_nonce"], [name="_wpnonce"], [name="action"]');c=typeof i.fieldSerialize==="function"?i.fieldSerialize():i.serialize();if(c){e.data+="&"+c}if(typeof e.addBefore==="function"){e=e.addBefore(e);if(!e){return true}}if(!e.data.match(/_ajax_nonce=[a-f0-9]+/)){return true}e.success=function(m){var l=mla.mlaList.settings.context.selector.substring(1);h=wpAjax.parseAjaxResponse(m,l+" #"+e.response,e.element);d=m;if(!h||h.errors){return false}if(true===h){return true}a.each(h.responses,function(){mla.mlaList.add.call(j,this.data,a.extend({},e,{position:this.position||0,id:this.id||0,oldId:this.oldId||null}))});j.mlaList.recolor();a(j).trigger("mlaListAddEnd",[e,j.mlaList]);mla.mlaList.clear.call(j,"#"+e.element)};e.complete=function(m,l){if(typeof e.addAfter==="function"){e.addAfter(d,a.extend({xml:m,status:l,parsed:h},e))}};a.ajax(e);return false},getColor:function(c){return a(c).css("backgroundColor")||"#ffffff"},addToOtherLists:function(d,c,e){a(".edit-fields-div").each(function(){var m=a(this),i=m.attr("id"),l=e.context.selector.substring(1),h,k,j,g,f;if(l!==i){h=a("."+c.attr("id"),m);k=a(d);j=false;a("input",k).removeAttr("checked");if(e.oldId){j=a("#"+e.what+"-"+e.oldId,h)}if(e.id&&(e.id!==e.oldId||!j||!j.length)){a("#"+e.what+"-"+e.id,h).remove()}if(j&&j.length){j.before(k);j.remove()}else{if(isNaN(e.position)){g="after";if("-"===e.position.substr(0,1)){e.position=e.position.substr(1);g="before"}f=h.find("#"+e.position);if(1===f.length){f[g](k)}else{h.append(k)}}else{if("comment"!==e.what||0===a("#"+e.element,h).length){if(e.position<0){h.prepend(k)}else{h.append(k)}}}}}})},add:function(h,i){var g=a(this),f=a(h),e=false,d,c;if("string"===typeof i){i={what:i}}i=a.extend({position:0,id:0,oldId:null},this.mlaList.settings,i);if(!f.length||!i.what){return false}mla.mlaList.addToOtherLists(h,g,i);if(i.oldId){e=a("#"+i.what+"-"+i.oldId,i.context)}if(i.id&&(i.id!==i.oldId||!e||!e.length)){a("#"+i.what+"-"+i.id,i.context).remove()}if(e&&e.length){e.before(f);e.remove()}else{if(isNaN(i.position)){d="after";if("-"===i.position.substr(0,1)){i.position=i.position.substr(1);d="before"}c=g.find("#"+i.position);if(1===c.length){c[d](f)}else{g.append(f)}}else{if("comment"!==i.what||0===a("#"+i.element,mla.mlaList.settings.context).length){if(i.position<0){g.prepend(f)}else{g.append(f)}}}}if(i.alt){f.toggleClass(i.alt,(g.children(":visible").index(f[0])+i.altOffset)%2)}if("none"!==i.addColor){f.css("backgroundColor",i.addColor).animate({backgroundColor:mla.mlaList.getColor(f)},{complete:function(){a(this).css("backgroundColor","")}})}g.each(function(j,k){k.mlaList.process(f)});return f},clear:function(d){var g=this,c=a(d),f,e;if(g.mlaList&&c.parents("#"+g.id).length){return}c.find(":input").each(function(i,h){if(a(h).parents(".form-no-clear").length){return}f=h.type.toLowerCase();e=h.tagName.toLowerCase();if("text"===f||"password"===f||"textarea"===e){h.value=""}else{if("checkbox"===f||"radio"===f){h.checked=false}else{if("select"===e){h.selectedIndex=null}}}})},process:function(d){var e=this,c=a(d||document);c.on("submit",'form[data-wp-lists^="add:'+e.id+':"]',function(){return e.mlaList.add(this)});c.on("click",'a[data-wp-lists^="add:'+e.id+':"], input[data-wp-lists^="add:'+e.id+':"]',function(){return e.mlaList.add(this)})},recolor:function(){var d=this,e=[":even",":odd"],c;if(!d.mlaList.settings.alt){return}c=a(".list-item:visible",d);if(!c.length){c=a(d).children(":visible")}if(d.mlaList.settings.altOffset%2){e.reverse()}c.filter(e[0]).addClass(d.mlaList.settings.alt).end();c.filter(e[1]).removeClass(d.mlaList.settings.alt)},init:function(){var c=this;c.mlaList.process=function(d){c.each(function(){this.mlaList.process(d)})};c.mlaList.recolor=function(){c.each(function(){this.mlaList.recolor()})}}};var b={add:"ajaxAdd",process:"process",recolor:"recolor"};a.fn.mlaList=function(c){this.each(function(d,e){e.mlaList={settings:a.extend({},mla.mlaList.settings,{what:mla.mlaList.parseData(e,"list")[1]||""},c)};a.each(b,function(f,g){e.mlaList[f]=function(h,i){return mla.mlaList[g].call(e,h,i)}})});mla.mlaList.init.call(this);this.mlaList.process(c.context);return this}})(jQuery);
js/mla-define-ajaxurl-scripts.js CHANGED
@@ -13,7 +13,7 @@ if ( typeof ajaxurl === 'undefined' ) {
13
  if ( typeof window._wpMediaViewsL10n === 'object' ) {
14
  if ( typeof window._wpMediaViewsL10n.mla_strings === 'object' ) {
15
  if ( typeof window._wpMediaViewsL10n.mla_strings.ajaxurl === 'string' ) {
16
- var ajaxurl = window._wpMediaViewsL10n.mla_strings.ajaxurl;
17
  } else {
18
  console.log( 'mla-define-ajaxurl-scripts.js window._wpMediaViewsL10n.mla_strings.ajaxurl failed' );
19
  }
13
  if ( typeof window._wpMediaViewsL10n === 'object' ) {
14
  if ( typeof window._wpMediaViewsL10n.mla_strings === 'object' ) {
15
  if ( typeof window._wpMediaViewsL10n.mla_strings.ajaxurl === 'string' ) {
16
+ ajaxurl = window._wpMediaViewsL10n.mla_strings.ajaxurl;
17
  } else {
18
  console.log( 'mla-define-ajaxurl-scripts.js window._wpMediaViewsL10n.mla_strings.ajaxurl failed' );
19
  }
js/mla-define-ajaxurl-scripts.min.js CHANGED
@@ -1 +1 @@
1
- if(typeof ajaxurl==="undefined"){var ajaxurl="/wp-admin/admin-ajax.php";try{if(typeof window._wpMediaViewsL10n==="object"){if(typeof window._wpMediaViewsL10n.mla_strings==="object"){if(typeof window._wpMediaViewsL10n.mla_strings.ajaxurl==="string"){var ajaxurl=window._wpMediaViewsL10n.mla_strings.ajaxurl}else{console.log("mla-define-ajaxurl-scripts.js window._wpMediaViewsL10n.mla_strings.ajaxurl failed")}}else{console.log("mla-define-ajaxurl-scripts.js window._wpMediaViewsL10n.mla_strings failed")}}else{console.log("mla-define-ajaxurl-scripts.js window._wpMediaViewsL10n failed")}}catch(error){console.log("mla-define-ajaxurl-scripts.js error thrown")}};
1
+ if(typeof ajaxurl==="undefined"){var ajaxurl="/wp-admin/admin-ajax.php";try{if(typeof window._wpMediaViewsL10n==="object"){if(typeof window._wpMediaViewsL10n.mla_strings==="object"){if(typeof window._wpMediaViewsL10n.mla_strings.ajaxurl==="string"){ajaxurl=window._wpMediaViewsL10n.mla_strings.ajaxurl}else{console.log("mla-define-ajaxurl-scripts.js window._wpMediaViewsL10n.mla_strings.ajaxurl failed")}}else{console.log("mla-define-ajaxurl-scripts.js window._wpMediaViewsL10n.mla_strings failed")}}else{console.log("mla-define-ajaxurl-scripts.js window._wpMediaViewsL10n failed")}}catch(error){console.log("mla-define-ajaxurl-scripts.js error thrown")}};
js/mla-edit-media-scripts.js CHANGED
@@ -39,13 +39,13 @@ var jQuery,
39
  taxonomyParts.shift(); // taxonomy-
40
  taxonomy = taxonomyParts.join('-');
41
 
42
- $.extend( $.expr[":"], {
43
  "matchTerms": function( elem, i, match, array ) {
44
  return ( elem.textContent || elem.innerText || "" ).toLowerCase().indexOf( ( match[3] || "" ).toLowerCase() ) >= 0;
45
  }
46
  });
47
 
48
- $( '#search-' + taxonomy ).keypress( function( event ){
49
 
50
  if( 13 === event.keyCode ) {
51
  event.preventDefault();
@@ -59,7 +59,7 @@ var jQuery,
59
 
60
  } );
61
 
62
- $( '#search-' + taxonomy ).keyup( function( event ){
63
  var searchValue, termList, termListPopular, matchingTerms, matchingTermsPopular;
64
 
65
  if( 13 === event.keyCode ) {
@@ -89,10 +89,10 @@ var jQuery,
89
  matchingTermsPopular.parents( '#' + taxonomy + 'checklist li' ).show();
90
  } );
91
 
92
- $( '#' + taxonomy + '-search-toggle' ).click( function() {
93
  $( '#' + taxonomy + '-adder ').addClass( 'wp-hidden-children' );
94
  $( '#' + taxonomy + '-searcher' ).toggleClass( 'wp-hidden-children' );
95
- $( 'a[href="#' + taxonomy + '-all"]', '#' + taxonomy + '-tabs' ).click();
96
  $( '#' + taxonomy + 'checklist li' ).show();
97
  $( '#' + taxonomy + 'checklist-pop li' ).show();
98
 
@@ -105,7 +105,7 @@ var jQuery,
105
  });
106
 
107
  // Supplement the click logic in wp-admin/js/post.js
108
- $( '#' + taxonomy + '-add-toggle' ).click( function() {
109
  $( '#' + taxonomy + '-searcher' ).addClass( 'wp-hidden-children' );
110
  return false;
111
  });
@@ -119,7 +119,7 @@ var jQuery,
119
  //mla.mlaEditAttachment.$modifydiv = $('#modifytimestampdiv');
120
 
121
  // Edit Uploaded on click.
122
- mla.mlaEditAttachment.$uploaddiv.siblings('a.edit-timestamp').click( function( event ) {
123
  if ( mla.mlaEditAttachment.$uploaddiv.is( ':hidden' ) ) {
124
  mla.mlaEditAttachment.$uploaddiv.slideDown( 'fast', function() {
125
  $( 'input, select', mla.mlaEditAttachment.$uploaddiv.find( '.timestamp-wrap' ) ).first().focus();
@@ -130,7 +130,7 @@ var jQuery,
130
  });
131
 
132
  // Cancel editing the Uploaded on time and hide the settings.
133
- mla.mlaEditAttachment.$uploaddiv.find('.cancel-timestamp').click( function( event ) {
134
  mla.mlaEditAttachment.$uploaddiv.slideUp('fast').siblings('a.edit-timestamp').show().focus();
135
  $( '#mm', mla.mlaEditAttachment.$uploaddiv ).val($( '#hidden_mm', mla.mlaEditAttachment.$uploaddiv ).val());
136
  $( '#jj', mla.mlaEditAttachment.$uploaddiv ).val($( '#hidden_jj', mla.mlaEditAttachment.$uploaddiv ).val());
@@ -142,7 +142,7 @@ var jQuery,
142
  });
143
 
144
  // Save the changed Uploaded on timestamp.
145
- mla.mlaEditAttachment.$uploaddiv.find('.save-timestamp').click( function( event ) { // crazyhorse - multiple ok cancels
146
  if ( mla.mlaEditAttachment.updateText( mla.mlaEditAttachment.$uploaddiv, mla.mlaEditAttachment.uploadtimestamp, '#upload-timestamp' ) ) {
147
  mla.mlaEditAttachment.$uploaddiv.slideUp('fast');
148
  mla.mlaEditAttachment.$uploaddiv.siblings('a.edit-timestamp').show().focus();
39
  taxonomyParts.shift(); // taxonomy-
40
  taxonomy = taxonomyParts.join('-');
41
 
42
+ $.extend( $.expr.pseudos || $.expr[":"], {
43
  "matchTerms": function( elem, i, match, array ) {
44
  return ( elem.textContent || elem.innerText || "" ).toLowerCase().indexOf( ( match[3] || "" ).toLowerCase() ) >= 0;
45
  }
46
  });
47
 
48
+ $( '#search-' + taxonomy ).on( 'keypress', function( event ){
49
 
50
  if( 13 === event.keyCode ) {
51
  event.preventDefault();
59
 
60
  } );
61
 
62
+ $( '#search-' + taxonomy ).on( 'keyup', function( event ){
63
  var searchValue, termList, termListPopular, matchingTerms, matchingTermsPopular;
64
 
65
  if( 13 === event.keyCode ) {
89
  matchingTermsPopular.parents( '#' + taxonomy + 'checklist li' ).show();
90
  } );
91
 
92
+ $( '#' + taxonomy + '-search-toggle' ).on( 'click', function() {
93
  $( '#' + taxonomy + '-adder ').addClass( 'wp-hidden-children' );
94
  $( '#' + taxonomy + '-searcher' ).toggleClass( 'wp-hidden-children' );
95
+ $( 'a[href="#' + taxonomy + '-all"]', '#' + taxonomy + '-tabs' ).trigger('click');
96
  $( '#' + taxonomy + 'checklist li' ).show();
97
  $( '#' + taxonomy + 'checklist-pop li' ).show();
98
 
105
  });
106
 
107
  // Supplement the click logic in wp-admin/js/post.js
108
+ $( '#' + taxonomy + '-add-toggle' ).on( 'click', function() {
109
  $( '#' + taxonomy + '-searcher' ).addClass( 'wp-hidden-children' );
110
  return false;
111
  });
119
  //mla.mlaEditAttachment.$modifydiv = $('#modifytimestampdiv');
120
 
121
  // Edit Uploaded on click.
122
+ mla.mlaEditAttachment.$uploaddiv.siblings('a.edit-timestamp').on( 'click', function( event ) {
123
  if ( mla.mlaEditAttachment.$uploaddiv.is( ':hidden' ) ) {
124
  mla.mlaEditAttachment.$uploaddiv.slideDown( 'fast', function() {
125
  $( 'input, select', mla.mlaEditAttachment.$uploaddiv.find( '.timestamp-wrap' ) ).first().focus();
130
  });
131
 
132
  // Cancel editing the Uploaded on time and hide the settings.
133
+ mla.mlaEditAttachment.$uploaddiv.find('.cancel-timestamp').on( 'click', function( event ) {
134
  mla.mlaEditAttachment.$uploaddiv.slideUp('fast').siblings('a.edit-timestamp').show().focus();
135
  $( '#mm', mla.mlaEditAttachment.$uploaddiv ).val($( '#hidden_mm', mla.mlaEditAttachment.$uploaddiv ).val());
136
  $( '#jj', mla.mlaEditAttachment.$uploaddiv ).val($( '#hidden_jj', mla.mlaEditAttachment.$uploaddiv ).val());
142
  });
143
 
144
  // Save the changed Uploaded on timestamp.
145
+ mla.mlaEditAttachment.$uploaddiv.find('.save-timestamp').on( 'click', function( event ) { // crazyhorse - multiple ok cancels
146
  if ( mla.mlaEditAttachment.updateText( mla.mlaEditAttachment.$uploaddiv, mla.mlaEditAttachment.uploadtimestamp, '#upload-timestamp' ) ) {
147
  mla.mlaEditAttachment.$uploaddiv.slideUp('fast');
148
  mla.mlaEditAttachment.$uploaddiv.siblings('a.edit-timestamp').show().focus();
js/mla-edit-media-scripts.min.js CHANGED
@@ -1 +1 @@
1
- var jQuery,mla_edit_media_vars,mla={settings:{},utility:{},setParent:null,mlaEditAttachment:null};(function(a){mla.settings=typeof mla_edit_media_vars==="undefined"?{}:mla_edit_media_vars;mla_edit_media_vars=void 0;mla.mlaEditAttachment={$uploaddiv:null,uploadtimestamp:"",$modifydiv:null,modifytimestamp:"",init:function(){a("#mla_set_parent").on("click",function(){return mla.mlaEditAttachment.setParentOpen()});a(".categorydiv").each(function(){var d=a(this).attr("id"),c,b;c=d.split("-");c.shift();b=c.join("-");a.extend(a.expr[":"],{matchTerms:function(g,f,e,h){return(g.textContent||g.innerText||"").toLowerCase().indexOf((e[3]||"").toLowerCase())>=0}});a("#search-"+b).keypress(function(e){if(13===e.keyCode){e.preventDefault();a("#search-"+b).val("");a("#"+b+"-searcher").addClass("wp-hidden-children");a("#"+b+"checklist li").show();a("#"+b+"checklist-pop li").show();return}});a("#search-"+b).keyup(function(g){var i,h,j,f,e;if(13===g.keyCode){g.preventDefault();a("#"+b+"-search-toggle").focus();return}i=a("#search-"+b).val();h=a("#"+b+"checklist li");j=a("#"+b+"checklist-pop li");if(0<i.length){h.hide();j.hide()}else{h.show();j.show()}f=a("#"+b+"checklist label:matchTerms('"+i+"')");f.closest("li").find("li").andSelf().show();f.parents("#"+b+"checklist li").show();e=a("#"+b+"checklist-pop label:matchTerms('"+i+"')");e.closest("li").find("li").andSelf().show();e.parents("#"+b+"checklist li").show()});a("#"+b+"-search-toggle").click(function(){a("#"+b+"-adder ").addClass("wp-hidden-children");a("#"+b+"-searcher").toggleClass("wp-hidden-children");a('a[href="#'+b+'-all"]',"#"+b+"-tabs").click();a("#"+b+"checklist li").show();a("#"+b+"checklist-pop li").show();if(false===a("#"+b+"-searcher").hasClass("wp-hidden-children")){a("#search-"+b).val("").removeClass("form-input-tip");a("#search-"+b).focus()}return false});a("#"+b+"-add-toggle").click(function(){a("#"+b+"-searcher").addClass("wp-hidden-children");return false})});if(a("#submitdiv").length){mla.mlaEditAttachment.uploadtimestamp=a("#upload-timestamp").html();mla.mlaEditAttachment.$uploaddiv=a("#timestampdiv");mla.mlaEditAttachment.$uploaddiv.siblings("a.edit-timestamp").click(function(b){if(mla.mlaEditAttachment.$uploaddiv.is(":hidden")){mla.mlaEditAttachment.$uploaddiv.slideDown("fast",function(){a("input, select",mla.mlaEditAttachment.$uploaddiv.find(".timestamp-wrap")).first().focus()});a(this).hide()}b.preventDefault()});mla.mlaEditAttachment.$uploaddiv.find(".cancel-timestamp").click(function(b){mla.mlaEditAttachment.$uploaddiv.slideUp("fast").siblings("a.edit-timestamp").show().focus();a("#mm",mla.mlaEditAttachment.$uploaddiv).val(a("#hidden_mm",mla.mlaEditAttachment.$uploaddiv).val());a("#jj",mla.mlaEditAttachment.$uploaddiv).val(a("#hidden_jj",mla.mlaEditAttachment.$uploaddiv).val());a("#aa",mla.mlaEditAttachment.$uploaddiv).val(a("#hidden_aa",mla.mlaEditAttachment.$uploaddiv).val());a("#hh",mla.mlaEditAttachment.$uploaddiv).val(a("#hidden_hh",mla.mlaEditAttachment.$uploaddiv).val());a("#mn",mla.mlaEditAttachment.$uploaddiv).val(a("#hidden_mn",mla.mlaEditAttachment.$uploaddiv).val());mla.mlaEditAttachment.updateText(mla.mlaEditAttachment.$uploaddiv,mla.mlaEditAttachment.uploadtimestamp,"#upload-timestamp");b.preventDefault()});mla.mlaEditAttachment.$uploaddiv.find(".save-timestamp").click(function(b){if(mla.mlaEditAttachment.updateText(mla.mlaEditAttachment.$uploaddiv,mla.mlaEditAttachment.uploadtimestamp,"#upload-timestamp")){mla.mlaEditAttachment.$uploaddiv.slideUp("fast");mla.mlaEditAttachment.$uploaddiv.siblings("a.edit-timestamp").show().focus()}b.preventDefault()});a("#post").on("submit",function(b){if(!mla.mlaEditAttachment.updateText(mla.mlaEditAttachment.$uploaddiv,mla.mlaEditAttachment.uploadtimestamp,"#upload-timestamp")){b.preventDefault();mla.mlaEditAttachment.$uploaddiv.show();if(wp.autosave){wp.autosave.enableButtons()}a("#publishing-action .spinner").removeClass("is-active")}})}},setParentOpen:function(){var d,b,c;d=a("#mla_post_parent").val()||"";b=a("#post_ID").val()||"";c=a("#title").val()||"";mla.setParent.open(d,b,c);a("#mla-set-parent-submit").on("click",function(e){e.preventDefault();mla.mlaEditAttachment.setParentSave();return false})},setParentSave:function(){var d=a("#mla-set-parent-response-div input:checked").closest("tr"),f,c,b,e;if(d.length){f=a(":radio",d).val()||"";c=a("label",d).html()||"";b=a("#mla_post_parent").clone(true).val(f);e=a("#mla_parent_info").clone(true).val(c);a("#mla_post_parent").replaceWith(b);a("#mla_parent_info").replaceWith(e);mla.setParent.close()}a("#mla-set-parent-submit").off("click")},updateText:function(k,c,h){if(!k.length){return true}var j,l,d,m,n,b=a("#aa",k).val(),g=a("#mm",k).val(),i=a("#jj",k).val(),f=a("#hh",k).val(),e=a("#mn",k).val();j=new Date(b,g-1,i,f,e);l=new Date(a("#hidden_aa",k).val(),a("#hidden_mm",k).val()-1,a("#hidden_jj",k).val(),a("#hidden_hh",k).val(),a("#hidden_mn",k).val());d=new Date(a("#cur_aa",k).val(),a("#cur_mm",k).val()-1,a("#cur_jj",k).val(),a("#cur_hh",k).val(),a("#cur_mn",k).val());if(j.getFullYear()!=b||(1+j.getMonth())!=g||j.getDate()!=i||j.getMinutes()!=e){k.find(".timestamp-wrap").addClass("form-invalid");return false}else{k.find(".timestamp-wrap").removeClass("form-invalid")}if(l.toUTCString()==j.toUTCString()){a(h).html(c)}else{m="#upload-timestamp"==h?mla.settings.uploadLabel:mla.settings.modifyLabel;if("object"===typeof wp.i18n){n=wp.i18n.__("%1$s %2$s, %3$s at %4$s:%5$s").replace("%1$s",a('option[value="'+g+'"]',"#mm").attr("data-text")).replace("%2$s",parseInt(i,10)).replace("%3$s",b).replace("%4$s",("00"+f).slice(-2)).replace("%5$s",("00"+e).slice(-2))}else{n=postL10n.dateFormat.replace("%1$s",a('option[value="'+g+'"]',"#mm").attr("data-text")).replace("%2$s",parseInt(i,10)).replace("%3$s",b).replace("%4$s",("00"+f).slice(-2)).replace("%5$s",("00"+e).slice(-2))}a(h).html(m+"<b>"+n+"</b> ")}return true}};a(document).ready(function(){mla.mlaEditAttachment.init()})})(jQuery);
1
+ var jQuery,mla_edit_media_vars,mla={settings:{},utility:{},setParent:null,mlaEditAttachment:null};(function(a){mla.settings=typeof mla_edit_media_vars==="undefined"?{}:mla_edit_media_vars;mla_edit_media_vars=void 0;mla.mlaEditAttachment={$uploaddiv:null,uploadtimestamp:"",$modifydiv:null,modifytimestamp:"",init:function(){a("#mla_set_parent").on("click",function(){return mla.mlaEditAttachment.setParentOpen()});a(".categorydiv").each(function(){var d=a(this).attr("id"),c,b;c=d.split("-");c.shift();b=c.join("-");a.extend(a.expr.pseudos||a.expr[":"],{matchTerms:function(g,f,e,h){return(g.textContent||g.innerText||"").toLowerCase().indexOf((e[3]||"").toLowerCase())>=0}});a("#search-"+b).on("keypress",function(e){if(13===e.keyCode){e.preventDefault();a("#search-"+b).val("");a("#"+b+"-searcher").addClass("wp-hidden-children");a("#"+b+"checklist li").show();a("#"+b+"checklist-pop li").show();return}});a("#search-"+b).on("keyup",function(g){var i,h,j,f,e;if(13===g.keyCode){g.preventDefault();a("#"+b+"-search-toggle").focus();return}i=a("#search-"+b).val();h=a("#"+b+"checklist li");j=a("#"+b+"checklist-pop li");if(0<i.length){h.hide();j.hide()}else{h.show();j.show()}f=a("#"+b+"checklist label:matchTerms('"+i+"')");f.closest("li").find("li").andSelf().show();f.parents("#"+b+"checklist li").show();e=a("#"+b+"checklist-pop label:matchTerms('"+i+"')");e.closest("li").find("li").andSelf().show();e.parents("#"+b+"checklist li").show()});a("#"+b+"-search-toggle").on("click",function(){a("#"+b+"-adder ").addClass("wp-hidden-children");a("#"+b+"-searcher").toggleClass("wp-hidden-children");a('a[href="#'+b+'-all"]',"#"+b+"-tabs").trigger("click");a("#"+b+"checklist li").show();a("#"+b+"checklist-pop li").show();if(false===a("#"+b+"-searcher").hasClass("wp-hidden-children")){a("#search-"+b).val("").removeClass("form-input-tip");a("#search-"+b).focus()}return false});a("#"+b+"-add-toggle").on("click",function(){a("#"+b+"-searcher").addClass("wp-hidden-children");return false})});if(a("#submitdiv").length){mla.mlaEditAttachment.uploadtimestamp=a("#upload-timestamp").html();mla.mlaEditAttachment.$uploaddiv=a("#timestampdiv");mla.mlaEditAttachment.$uploaddiv.siblings("a.edit-timestamp").on("click",function(b){if(mla.mlaEditAttachment.$uploaddiv.is(":hidden")){mla.mlaEditAttachment.$uploaddiv.slideDown("fast",function(){a("input, select",mla.mlaEditAttachment.$uploaddiv.find(".timestamp-wrap")).first().focus()});a(this).hide()}b.preventDefault()});mla.mlaEditAttachment.$uploaddiv.find(".cancel-timestamp").on("click",function(b){mla.mlaEditAttachment.$uploaddiv.slideUp("fast").siblings("a.edit-timestamp").show().focus();a("#mm",mla.mlaEditAttachment.$uploaddiv).val(a("#hidden_mm",mla.mlaEditAttachment.$uploaddiv).val());a("#jj",mla.mlaEditAttachment.$uploaddiv).val(a("#hidden_jj",mla.mlaEditAttachment.$uploaddiv).val());a("#aa",mla.mlaEditAttachment.$uploaddiv).val(a("#hidden_aa",mla.mlaEditAttachment.$uploaddiv).val());a("#hh",mla.mlaEditAttachment.$uploaddiv).val(a("#hidden_hh",mla.mlaEditAttachment.$uploaddiv).val());a("#mn",mla.mlaEditAttachment.$uploaddiv).val(a("#hidden_mn",mla.mlaEditAttachment.$uploaddiv).val());mla.mlaEditAttachment.updateText(mla.mlaEditAttachment.$uploaddiv,mla.mlaEditAttachment.uploadtimestamp,"#upload-timestamp");b.preventDefault()});mla.mlaEditAttachment.$uploaddiv.find(".save-timestamp").on("click",function(b){if(mla.mlaEditAttachment.updateText(mla.mlaEditAttachment.$uploaddiv,mla.mlaEditAttachment.uploadtimestamp,"#upload-timestamp")){mla.mlaEditAttachment.$uploaddiv.slideUp("fast");mla.mlaEditAttachment.$uploaddiv.siblings("a.edit-timestamp").show().focus()}b.preventDefault()});a("#post").on("submit",function(b){if(!mla.mlaEditAttachment.updateText(mla.mlaEditAttachment.$uploaddiv,mla.mlaEditAttachment.uploadtimestamp,"#upload-timestamp")){b.preventDefault();mla.mlaEditAttachment.$uploaddiv.show();if(wp.autosave){wp.autosave.enableButtons()}a("#publishing-action .spinner").removeClass("is-active")}})}},setParentOpen:function(){var d,b,c;d=a("#mla_post_parent").val()||"";b=a("#post_ID").val()||"";c=a("#title").val()||"";mla.setParent.open(d,b,c);a("#mla-set-parent-submit").on("click",function(e){e.preventDefault();mla.mlaEditAttachment.setParentSave();return false})},setParentSave:function(){var d=a("#mla-set-parent-response-div input:checked").closest("tr"),f,c,b,e;if(d.length){f=a(":radio",d).val()||"";c=a("label",d).html()||"";b=a("#mla_post_parent").clone(true).val(f);e=a("#mla_parent_info").clone(true).val(c);a("#mla_post_parent").replaceWith(b);a("#mla_parent_info").replaceWith(e);mla.setParent.close()}a("#mla-set-parent-submit").off("click")},updateText:function(k,c,h){if(!k.length){return true}var j,l,d,m,n,b=a("#aa",k).val(),g=a("#mm",k).val(),i=a("#jj",k).val(),f=a("#hh",k).val(),e=a("#mn",k).val();j=new Date(b,g-1,i,f,e);l=new Date(a("#hidden_aa",k).val(),a("#hidden_mm",k).val()-1,a("#hidden_jj",k).val(),a("#hidden_hh",k).val(),a("#hidden_mn",k).val());d=new Date(a("#cur_aa",k).val(),a("#cur_mm",k).val()-1,a("#cur_jj",k).val(),a("#cur_hh",k).val(),a("#cur_mn",k).val());if(j.getFullYear()!=b||(1+j.getMonth())!=g||j.getDate()!=i||j.getMinutes()!=e){k.find(".timestamp-wrap").addClass("form-invalid");return false}else{k.find(".timestamp-wrap").removeClass("form-invalid")}if(l.toUTCString()==j.toUTCString()){a(h).html(c)}else{m="#upload-timestamp"==h?mla.settings.uploadLabel:mla.settings.modifyLabel;if("object"===typeof wp.i18n){n=wp.i18n.__("%1$s %2$s, %3$s at %4$s:%5$s").replace("%1$s",a('option[value="'+g+'"]',"#mm").attr("data-text")).replace("%2$s",parseInt(i,10)).replace("%3$s",b).replace("%4$s",("00"+f).slice(-2)).replace("%5$s",("00"+e).slice(-2))}else{n=postL10n.dateFormat.replace("%1$s",a('option[value="'+g+'"]',"#mm").attr("data-text")).replace("%2$s",parseInt(i,10)).replace("%3$s",b).replace("%4$s",("00"+f).slice(-2)).replace("%5$s",("00"+e).slice(-2))}a(h).html(m+"<b>"+n+"</b> ")}return true}};a(document).ready(function(){mla.mlaEditAttachment.init()})})(jQuery);
js/mla-inline-edit-scripts.js CHANGED
@@ -45,7 +45,7 @@ var jQuery,
45
  taxonomyParts.shift(); // taxonomy-
46
  taxonomy = taxonomyParts.join('-');
47
 
48
- jQuery.extend( jQuery.expr[":"], {
49
  "matchTerms": function( elem, i, match, array ) {
50
  return ( elem.textContent || elem.innerText || "" ).toLowerCase().indexOf( ( match[3] || "" ).toLowerCase() ) >= 0;
51
  }
@@ -56,7 +56,7 @@ var jQuery,
56
 
57
  jQuery( rowId + ' #search-' + taxonomy ).off();
58
 
59
- jQuery( rowId + ' #search-' + taxonomy ).keydown( function( event ){
60
 
61
  if( 13 === event.keyCode ) {
62
  event.preventDefault();
@@ -69,7 +69,7 @@ var jQuery,
69
 
70
  } );
71
 
72
- jQuery( rowId + ' #search-' + taxonomy ).keypress( function( event ){
73
 
74
  if( 13 === event.keyCode ) {
75
  event.preventDefault();
@@ -82,7 +82,7 @@ var jQuery,
82
 
83
  } );
84
 
85
- jQuery( rowId + ' #search-' + taxonomy ).keyup( function( event ){
86
  var searchValue, termList, matchingTerms;
87
 
88
  if( 13 === event.keyCode ) {
@@ -107,7 +107,7 @@ var jQuery,
107
 
108
  jQuery( rowId + ' #' + taxonomy + '-search-toggle' ).off();
109
 
110
- jQuery( rowId + ' #' + taxonomy + '-search-toggle' ).click( function() {
111
  jQuery( rowId + ' #' + taxonomy + '-adder ').addClass( 'wp-hidden-children' );
112
  jQuery( rowId + ' #' + taxonomy + '-searcher' ).toggleClass( 'wp-hidden-children' );
113
  jQuery( rowId + ' #' + taxonomy + 'checklist li' ).show();
@@ -152,15 +152,15 @@ var jQuery,
152
  t.what = '#attachment-';
153
 
154
  // prepare the edit rows
155
- qeRow.keyup(function(e){
156
  if (e.which == 27)
157
  return mla.inlineEditAttachment.revert();
158
  });
159
- bulkRow.keyup(function(e){
160
  if (e.which == 27)
161
  return mla.inlineEditAttachment.revert();
162
  });
163
- progressRow.keyup(function(e){
164
  if (e.which == 27)
165
  return mla.inlineEditAttachment.revert();
166
  });
@@ -168,13 +168,13 @@ var jQuery,
168
  $('#inline-edit-post-set-parent', qeRow).on( 'click', function(){
169
  return mla.inlineEditAttachment.inlineParentOpen(this);
170
  });
171
- $('a.cancel', qeRow).click(function(){
172
  return mla.inlineEditAttachment.revert();
173
  });
174
- $('a.save', qeRow).click(function(){
175
  return mla.inlineEditAttachment.quickSave(this);
176
  });
177
- $('td', qeRow).keydown(function(e){
178
  if ( e.which == 13 )
179
  return mla.inlineEditAttachment.quickSave(this);
180
  });
@@ -187,18 +187,18 @@ var jQuery,
187
  $('#bulk-edit-set-parent', bulkRow).on( 'click', function(){
188
  return mla.inlineEditAttachment.bulkParentOpen();
189
  });
190
- $('a.cancel', bulkRow).click(function(){
191
  return mla.inlineEditAttachment.revert();
192
  });
193
- $('a.reset', bulkRow).click(function(){
194
  return mla.inlineEditAttachment.doReset();
195
  });
196
- $('input[type="submit"]', bulkRow).click(function(e){
197
  e.preventDefault();
198
  return mla.inlineEditAttachment.bulkSave(e);
199
  });
200
 
201
- $('a.cancel', progressRow).click(function(){
202
  if ( mla.bulkEdit.inProcess ) {
203
  mla.bulkEdit.doCancel = true;
204
  return false;
@@ -208,7 +208,7 @@ var jQuery,
208
  });
209
 
210
  // Clicking "Refresh" submits the form, refreshing the page
211
- $('#bulk_refresh', progressRow).click(function(){
212
  $( '#bulk-progress a' ).prop( 'disabled', true );
213
  $( '#bulk-progress' ).css( 'opacity', '0.5' );
214
  });
@@ -221,7 +221,7 @@ var jQuery,
221
 
222
  $('select[name="_status"] option[value="future"]', bulkRow).remove();
223
 
224
- $('#doaction, #doaction2').click(function(e){
225
  var n = $(this).attr('id').substr(2);
226
 
227
  if ( $('select[name="'+n+'"]').val() == 'edit' ) {
@@ -233,7 +233,7 @@ var jQuery,
233
  });
234
 
235
  // Filter button (dates, categories) in top nav bar
236
- $('#post-query-submit').mousedown(function(){
237
  t.revert();
238
  $('select[name^="action"]').val('-1');
239
  });
@@ -269,7 +269,7 @@ var jQuery,
269
  return this.revert();
270
 
271
  $('#bulk-titles').html(te);
272
- $('#bulk-titles a').click(function(){
273
  var id = $(this).attr('id').substr(1);
274
 
275
  $('table.wp-list-table input[value="' + id + '"]').prop('checked', false);
@@ -357,7 +357,7 @@ var jQuery,
357
  $('#bulk-progress-running').html('');
358
  $('#bulk-progress-complete').html('');
359
  $('#bulk-progress-waiting').html(te);
360
- $('#bulk-progress-waiting a').click(function(){
361
  var id = $(this).attr('id').substr(1);
362
 
363
  $('table.wp-list-table input[value="' + id + '"]').prop('checked', false);
45
  taxonomyParts.shift(); // taxonomy-
46
  taxonomy = taxonomyParts.join('-');
47
 
48
+ jQuery.extend( jQuery.expr.pseudos || jQuery.expr[":"], {
49
  "matchTerms": function( elem, i, match, array ) {
50
  return ( elem.textContent || elem.innerText || "" ).toLowerCase().indexOf( ( match[3] || "" ).toLowerCase() ) >= 0;
51
  }
56
 
57
  jQuery( rowId + ' #search-' + taxonomy ).off();
58
 
59
+ jQuery( rowId + ' #search-' + taxonomy ).on( 'keydown', function( event ){
60
 
61
  if( 13 === event.keyCode ) {
62
  event.preventDefault();
69
 
70
  } );
71
 
72
+ jQuery( rowId + ' #search-' + taxonomy ).on( 'keypress', function( event ){
73
 
74
  if( 13 === event.keyCode ) {
75
  event.preventDefault();
82
 
83
  } );
84
 
85
+ jQuery( rowId + ' #search-' + taxonomy ).on( 'keyup', function( event ){
86
  var searchValue, termList, matchingTerms;
87
 
88
  if( 13 === event.keyCode ) {
107
 
108
  jQuery( rowId + ' #' + taxonomy + '-search-toggle' ).off();
109
 
110
+ jQuery( rowId + ' #' + taxonomy + '-search-toggle' ).on( 'click', function() {
111
  jQuery( rowId + ' #' + taxonomy + '-adder ').addClass( 'wp-hidden-children' );
112
  jQuery( rowId + ' #' + taxonomy + '-searcher' ).toggleClass( 'wp-hidden-children' );
113
  jQuery( rowId + ' #' + taxonomy + 'checklist li' ).show();
152
  t.what = '#attachment-';
153
 
154
  // prepare the edit rows
155
+ qeRow.on( 'keyup', function(e){
156
  if (e.which == 27)
157
  return mla.inlineEditAttachment.revert();
158
  });
159
+ bulkRow.on( 'keyup', function(e){
160
  if (e.which == 27)
161
  return mla.inlineEditAttachment.revert();
162
  });
163
+ progressRow.on( 'keyup', function(e){
164
  if (e.which == 27)
165
  return mla.inlineEditAttachment.revert();
166
  });
168
  $('#inline-edit-post-set-parent', qeRow).on( 'click', function(){
169
  return mla.inlineEditAttachment.inlineParentOpen(this);
170
  });
171
+ $('a.cancel', qeRow).on( 'click', function(){
172
  return mla.inlineEditAttachment.revert();
173
  });
174
+ $('a.save', qeRow).on( 'click', function(){
175
  return mla.inlineEditAttachment.quickSave(this);
176
  });
177
+ $('td', qeRow).on( 'keydown', function(e){
178
  if ( e.which == 13 )
179
  return mla.inlineEditAttachment.quickSave(this);
180
  });
187
  $('#bulk-edit-set-parent', bulkRow).on( 'click', function(){
188
  return mla.inlineEditAttachment.bulkParentOpen();
189
  });
190
+ $('a.cancel', bulkRow).on( 'click', function(){
191
  return mla.inlineEditAttachment.revert();
192
  });
193
+ $('a.reset', bulkRow).on( 'click', function(){
194
  return mla.inlineEditAttachment.doReset();
195
  });
196
+ $('input[type="submit"]', bulkRow).on( 'click', function(e){
197
  e.preventDefault();
198
  return mla.inlineEditAttachment.bulkSave(e);
199
  });
200
 
201
+ $('a.cancel', progressRow).on( 'click', function(){
202
  if ( mla.bulkEdit.inProcess ) {
203
  mla.bulkEdit.doCancel = true;
204
  return false;
208
  });
209
 
210
  // Clicking "Refresh" submits the form, refreshing the page
211
+ $('#bulk_refresh', progressRow).on( 'click', function(){
212
  $( '#bulk-progress a' ).prop( 'disabled', true );
213
  $( '#bulk-progress' ).css( 'opacity', '0.5' );
214
  });
221
 
222
  $('select[name="_status"] option[value="future"]', bulkRow).remove();
223
 
224
+ $('#doaction, #doaction2').on( 'click', function(e){
225
  var n = $(this).attr('id').substr(2);
226
 
227
  if ( $('select[name="'+n+'"]').val() == 'edit' ) {
233
  });
234
 
235
  // Filter button (dates, categories) in top nav bar
236
+ $('#post-query-submit').on( 'mousedown', function(){
237
  t.revert();
238
  $('select[name^="action"]').val('-1');
239
  });
269
  return this.revert();
270
 
271
  $('#bulk-titles').html(te);
272
+ $('#bulk-titles a').on( 'click', function(){
273
  var id = $(this).attr('id').substr(1);
274
 
275
  $('table.wp-list-table input[value="' + id + '"]').prop('checked', false);
357
  $('#bulk-progress-running').html('');
358
  $('#bulk-progress-complete').html('');
359
  $('#bulk-progress-waiting').html(te);
360
+ $('#bulk-progress-waiting a').on( 'click', function(){
361
  var id = $(this).attr('id').substr(1);
362
 
363
  $('table.wp-list-table input[value="' + id + '"]').prop('checked', false);
js/mla-inline-edit-scripts.min.js CHANGED
@@ -1 +1 @@
1
- var jQuery,mla_inline_edit_vars,mla={settings:{},bulkEdit:{inProcess:false,doCancel:false},utility:{getId:function(b){var c=jQuery(b).closest("tr").attr("id"),a=c.split("-");return a[a.length-1]},attachSearch:function(a){jQuery(a+" .categorydiv").each(function(){var d=jQuery(this).attr("id"),c,b;c=d.split("-");c.shift();b=c.join("-");jQuery.extend(jQuery.expr[":"],{matchTerms:function(g,f,e,h){return(g.textContent||g.innerText||"").toLowerCase().indexOf((e[3]||"").toLowerCase())>=0}});jQuery(a+" #"+b+"-searcher").addClass("wp-hidden-children");jQuery(a+" #"+b+"checklist li").show();jQuery(a+" #search-"+b).off();jQuery(a+" #search-"+b).keydown(function(e){if(13===e.keyCode){e.preventDefault();jQuery(a+" #search-"+b).val("");jQuery(a+" #"+b+"-searcher").addClass("wp-hidden-children");jQuery(a+" #"+b+"checklist li").show();return false}});jQuery(a+" #search-"+b).keypress(function(e){if(13===e.keyCode){e.preventDefault();jQuery(a+" #search-"+b).val("");jQuery(a+" #"+b+"-searcher").addClass("wp-hidden-children");jQuery(a+" #"+b+"checklist li").show();return}});jQuery(a+" #search-"+b).keyup(function(f){var h,g,e;if(13===f.keyCode){f.preventDefault();jQuery(a+" #"+b+"-search-toggle").focus();return}h=jQuery(a+" #search-"+b).val();g=jQuery(a+" #"+b+"checklist li");if(0<h.length){g.hide()}else{g.show()}e=jQuery(a+" #"+b+"checklist label:matchTerms('"+h+"')");e.closest("li").find("li").andSelf().show();e.parents(a+" #"+b+"checklist li").show()});jQuery(a+" #"+b+"-search-toggle").off();jQuery(a+" #"+b+"-search-toggle").click(function(){jQuery(a+" #"+b+"-adder ").addClass("wp-hidden-children");jQuery(a+" #"+b+"-searcher").toggleClass("wp-hidden-children");jQuery(a+" #"+b+"checklist li").show();if(false===jQuery(a+" #"+b+"-searcher").hasClass("wp-hidden-children")){jQuery(a+" #search-"+b).val("").removeClass("form-input-tip");jQuery(a+" #search-"+b).focus()}return false})})}},setParent:null,inlineEditAttachment:null};(function(a){mla.settings=typeof mla_inline_edit_vars==="undefined"?{}:mla_inline_edit_vars;mla_inline_edit_vars=void 0;mla.inlineEditAttachment={init:function(){var d=this,e=a("#inline-edit"),c=a("#bulk-edit"),b=a("#bulk-progress");if(mla.settings.deleteAcpBulkEdit){setTimeout(function(){var f=document.querySelectorAll("body.ac-mla-media-assistant .acp-be-editrow, body.ac-mla-media-assistant .acp-be-noticerow");for(i=0;i<f.length;++i){f[i].remove()}},1000)}d.type="attachment";d.what="#attachment-";e.keyup(function(f){if(f.which==27){return mla.inlineEditAttachment.revert()}});c.keyup(function(f){if(f.which==27){return mla.inlineEditAttachment.revert()}});b.keyup(function(f){if(f.which==27){return mla.inlineEditAttachment.revert()}});a("#inline-edit-post-set-parent",e).on("click",function(){return mla.inlineEditAttachment.inlineParentOpen(this)});a("a.cancel",e).click(function(){return mla.inlineEditAttachment.revert()});a("a.save",e).click(function(){return mla.inlineEditAttachment.quickSave(this)});a("td",e).keydown(function(f){if(f.which==13){return mla.inlineEditAttachment.quickSave(this)}});if(typeof mla.addTerm!=="undefined"){mla.addTerm.init("#bulk-edit-fields-div")}mla.utility.attachSearch("#bulk-edit-fields-div");a("#bulk-edit-set-parent",c).on("click",function(){return mla.inlineEditAttachment.bulkParentOpen()});a("a.cancel",c).click(function(){return mla.inlineEditAttachment.revert()});a("a.reset",c).click(function(){return mla.inlineEditAttachment.doReset()});a('input[type="submit"]',c).click(function(f){f.preventDefault();return mla.inlineEditAttachment.bulkSave(f)});a("a.cancel",b).click(function(){if(mla.bulkEdit.inProcess){mla.bulkEdit.doCancel=true;return false}else{return mla.inlineEditAttachment.revert()}});a("#bulk_refresh",b).click(function(){a("#bulk-progress a").prop("disabled",true);a("#bulk-progress").css("opacity","0.5")});a("#the-list").on("click","a.editinline",function(){mla.inlineEditAttachment.quickEdit(this);return false});a('select[name="_status"] option[value="future"]',c).remove();a("#doaction, #doaction2").click(function(f){var g=a(this).attr("id").substr(2);if(a('select[name="'+g+'"]').val()=="edit"){f.preventDefault();d.bulkEdit()}else{if(a("form#posts-filter tr.inline-editor").length>0){d.revert()}}});a("#post-query-submit").mousedown(function(){d.revert();a('select[name^="action"]').val("-1")})},bulkEdit:function(){var b="",d=true;this.revert();a("#bulk-edit td").attr("colspan",a("th:visible, td:visible",".widefat:first thead").length);if(mla.settings.useSpinnerClass){a("table.wp-list-table tbody").prepend(a("#bulk-edit")).prepend('<tr class="hidden"></tr>')}else{a("table.wp-list-table tbody").prepend(a("#bulk-edit"))}a("#bulk-edit").addClass("inline-editor").show();a('tbody th.check-column input[type="checkbox"]').each(function(){if(a(this).prop("checked")){d=false;var e=a(this).val(),c;c=a("#inline_"+e+" .post_title").text()||mla.settings.noTitle;b+='<div id="ttle'+e+'"><a id="_'+e+'" class="ntdelbutton" title="'+mla.settings.ntdelTitle+'">X</a>'+c+"</div>"}});if(d){return this.revert()}a("#bulk-titles").html(b);a("#bulk-titles a").click(function(){var c=a(this).attr("id").substr(1);a('table.wp-list-table input[value="'+c+'"]').prop("checked",false);a("#ttle"+c).remove()});a("textarea.mla_tags").each(function(){var c=a(this).attr("name").replace("]","").replace("tax_input[","");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+c,{delay:500,minchars:2,multiple:true,multipleSep:mla.settings.comma+" "})});a("html, body").animate({scrollTop:0},"fast");if((typeof quicktags!=="undefined")&&(typeof mla.settings.quickTagsInit!=="undefined")){for(id in mla.settings.quickTagsInit){quicktags(mla.settings.quickTagsInit[id]);if(mla.settings.quickTagsInit[id]["active"]){window.wpActiveEditor=id}}}},bulkSave:function(c){var b;mla.bulkEdit={inProcess:false,doCancel:false,chunkSize:0,targetName:"",fields:"",ids:[],idsCount:0,offset:0,waiting:0,running:0,complete:0,unchanged:0,success:0,failure:0};mla.bulkEdit.chunkSize=+mla.settings.bulkChunkSize;mla.bulkEdit.targetName=c.target.name;mla.bulkEdit.fields=a("#bulk-edit :input").serialize();b=a('tbody th.check-column input[type="checkbox"]').serializeArray();a.each(b,function(d,e){mla.bulkEdit.ids[d]=+e.value});mla.bulkEdit.idsCount=mla.bulkEdit.waiting=mla.bulkEdit.ids.length;mla.inlineEditAttachment.bulkProgressOpen();mla.inlineEditAttachment.bulkPost();return false},bulkProgressOpen:function(){var b="",d=true;this.revert();a("#bulk-progress td").attr("colspan",a("th:visible, td:visible",".widefat:first thead").length);a("table.wp-list-table tbody").prepend(a("#bulk-progress"));a("#bulk-progress").addClass("inline-editor").show();a("#cb-select-all-1").removeAttr("checked");a("#cb-select-all-2").removeAttr("checked");a('tbody th.check-column input[type="checkbox"]').each(function(){if(a(this).prop("checked")){d=false;var e=a(this).val(),c;c=a("#inline_"+e+" .post_title").text()||mla.settings.noTitle;b+='<div id="ttle'+e+'"><a id="_'+e+'" class="ntdelbutton" title="'+mla.settings.ntdelTitle+'">X</a>'+c+"</div>"}});if(d){return this.revert()}a("#bulk-progress-running").html("");a("#bulk-progress-complete").html("");a("#bulk-progress-waiting").html(b);a("#bulk-progress-waiting a").click(function(){var c=a(this).attr("id").substr(1);a('table.wp-list-table input[value="'+c+'"]').prop("checked",false);a("#ttle"+c).remove()});a("#bulk-progress .inline-edit-save .error").html("");a("#bulk_refresh").prop("disabled",true).css("opacity","0.5");a("html, body").animate({scrollTop:0},"fast")},bulkPost:function(){var b,g,f,j,c,h=a("table.wp-list-table .inline-edit-save .spinner"),d=a("#bulk-progress .inline-edit-save .error"),k=a("#bulk-progress-waiting"),e=a("#bulk-progress-running");g=mla.bulkEdit.ids.slice(mla.bulkEdit.offset,mla.bulkEdit.offset+mla.bulkEdit.chunkSize);for(f=0;f<g.length;f++){j=a("#ttle"+g[f],k).remove();a("a",j).hide();e.append(j)}mla.bulkEdit.waiting-=g.length;mla.bulkEdit.running=g.length;b={action:mla.settings.ajax_action,mla_admin_nonce:mla.settings.ajax_nonce,bulk_action:mla.bulkEdit.targetName,cb_offset:mla.bulkEdit.offset,cb_count:mla.bulkEdit.idsCount,cb_attachment:g};mla.bulkEdit.offset+=mla.bulkEdit.chunkSize;b=a.param(b)+"&"+mla.bulkEdit.fields;mla.bulkEdit.inProcess=true;if(mla.settings.useSpinnerClass){h.addClass("is-active")}else{h.show()}c=mla.settings.bulkWaiting+": "+mla.bulkEdit.waiting+", "+mla.settings.bulkComplete+": "+mla.bulkEdit.complete+", "+mla.settings.bulkUnchanged+": "+mla.bulkEdit.unchanged+", "+mla.settings.bulkSuccess+": "+mla.bulkEdit.success+", "+mla.settings.bulkFailure+": "+mla.bulkEdit.failure;d.html(c).show();a.ajax(ajaxurl,{type:"POST",data:b,dataType:"json"}).always(function(){if(mla.settings.useSpinnerClass){h.removeClass("is-active")}else{h.hide()}}).done(function(o,m){var p="no response.data",l,n;if(mla.settings.useSpinnerClass){h.removeClass("is-active")}else{h.hide()}if(o){if(!o.success){if(o.responseData){p=o.data}d.html(JSON.stringify(o)).show();mla.bulkEdit.offset=mla.bulkEdit.idsCount}else{n=a("#bulk-progress-running div").remove();a.each(n,function(){var q,r=a(this).html(),s=a(this).attr("id").substr(4);if("string"===typeof(o.data.item_results[s]["result"])){q=o.data.item_results[s]["result"];a(this).html(r+" ("+s+") - "+q)}a("#attachment-"+s).remove()});a("#bulk-progress-complete").append(n);mla.bulkEdit.complete+=mla.bulkEdit.running;mla.bulkEdit.running=0;mla.bulkEdit.unchanged+=o.data.unchanged;mla.bulkEdit.success+=o.data.success;mla.bulkEdit.failure+=o.data.failure;l=mla.settings.bulkWaiting+": "+mla.bulkEdit.waiting+", "+mla.settings.bulkComplete+": "+mla.bulkEdit.complete+", "+mla.settings.bulkUnchanged+": "+mla.bulkEdit.unchanged+", "+mla.settings.bulkSuccess+": "+mla.bulkEdit.success+", "+mla.settings.bulkFailure+": "+mla.bulkEdit.failure;d.html(l).show()}}else{d.html(mla.settings.error).show();mla.bulkEdit.offset=mla.bulkEdit.idsCount}if(mla.bulkEdit.doCancel){d.html(mla.settings.bulkCanceled+". "+l).show()}else{if(mla.bulkEdit.offset<mla.bulkEdit.idsCount){mla.inlineEditAttachment.bulkPost();return}}a("#bulk_refresh").prop("disabled",false).css("opacity","1.0");mla.bulkEdit.inProcess=false}).fail(function(m,l){if(200==m.status){d.text("("+l+") "+m.responseText)}else{d.text(mla.settings.ajaxFailError+" ("+l+"), jqXHR( "+m.status+", "+m.statusText+", "+m.responseText+")")}})},quickEdit:function(j){var d=this,b,c,f,h=[],e,g;d.revert();if(typeof(j)=="object"){j=mla.utility.getId(j)}b=mla.settings.fields;c=a("#inline-edit").clone(true);a("td",c).attr("colspan",a("th:visible, td:visible",".widefat:first thead").length);if(mla.settings.useSpinnerClass){a(d.what+j).hide().after(c).after('<tr class="hidden"></tr>')}else{if(a(d.what+j).hasClass("alternate")){a(c).addClass("alternate")}a(d.what+j).hide().after(c)}f=a("#inline_"+j);e=a(".item_thumbnail",f).html();if(e.length){a("#item_thumbnail",c).html(e)}if(!a(':input[name="post_author"] option[value="'+a(".post_author",f).text()+'"]',c).val()){a(':input[name="post_author"]',c).prepend('<option value="'+a(".post_author",f).text()+'">'+a("#"+d.type+"-"+j+" .author").text()+"</option>")}if(a(':input[name="post_author"] option',c).length==1){a("label.inline-edit-author",c).hide()}for(g=0;g<b.length;g++){a(':input[name="'+b[g]+'"]',c).val(a("."+b[g],f).text())}if(a(".image_alt",f).length===0){a("label.inline-edit-image-alt",c).hide()}a(".checked_on_top",f).each(function(){h[h.length]=a(this).attr("id").replace("_"+j,"")});a(".mla_category",f).each(function(){var m=a(this).text(),n=a(this).attr("id").replace("_"+j,""),l,k;if(m){a("ul."+n+"checklist :checkbox",c).val(m.split(","));if(-1!==h.indexOf(n)){l=a("ul."+n+"checklist li :checked",c).parents("label").remove().toArray().reverse();k=a("<li></li>").html(l);a("ul."+n+"checklist",c).prepend(k)}}});a(".mla_tags",f).each(function(){var n=a(this).text(),o=a(this).attr("id").replace("_"+j,""),m=a("textarea.tax_input_"+o,c),k=mla.settings.comma,l;if(n){if(","!==k){n=n.replace(/,/g,k)}m.val(n)}l=a(".lang",f).text();if(0<l.length){l="&lang="+l}else{l=""}m.suggest(ajaxurl+"?action=ajax-tag-search&tax="+o+"&preview_id="+j+l,{delay:500,minchars:2,multiple:true,multipleSep:mla.settings.comma+" "})});f=a(c).attr("id","edit-"+j).addClass("inline-editor").show().position().top;a(".ptitle",c).focus();a("html, body").animate({scrollTop:f},"fast");a("#inline-edit-fields-div",c).attr("id","inline-edit-fields-div-active");if(typeof mla.addTerm!=="undefined"){mla.addTerm.init("#inline-edit-fields-div-active")}mla.utility.attachSearch("#inline-edit-fields-div-active");return false},quickSave:function(e){var d,b,c=a(".post_status_page").val()||"";if(typeof(e)=="object"){e=mla.utility.getId(e)}if(mla.settings.useSpinnerClass){a("table.wp-list-table .inline-edit-save .spinner").addClass("is-active")}else{a("table.wp-list-table .inline-edit-save .spinner").show()}d={action:mla.settings.ajax_action,mla_admin_nonce:mla.settings.ajax_nonce,post_type:"attachment",post_ID:e,edit_date:"true",post_status:c};b=a("#edit-"+e+" :input").serialize();d=b+"&"+a.param(d);a.post(ajaxurl,d,function(f){if(mla.settings.useSpinnerClass){a("table.wp-list-table .inline-edit-save .spinner").removeClass("is-active")}else{a("table.wp-list-table .inline-edit-save .spinner").hide()}if(f){if(-1!=f.indexOf("<tr")){if(mla.settings.useSpinnerClass){a(mla.inlineEditAttachment.what+e).siblings("tr.hidden").addBack().remove()}else{a(mla.inlineEditAttachment.what+e).remove()}a("#edit-"+e).before(f).remove();a(mla.inlineEditAttachment.what+e).hide().fadeIn()}else{f=f.replace(/<.[^<>]*?>/g,"");a("#edit-"+e+" .inline-edit-save .error").html(f).show()}}else{a("#edit-"+e+" .inline-edit-save .error").html(mla.settings.error).show()}},"html");return false},inlineParentOpen:function(e){var d,b,c;if(typeof(e)=="object"){b=mla.utility.getId(e);d=a("#edit-"+b+' :input[name="post_parent"]').val()||"";c=a("#edit-"+b+' :input[name="post_title"]').val()||"";mla.setParent.open(d,b,c);a("#mla-set-parent-submit").on("click",function(f){f.preventDefault();mla.inlineEditAttachment.inlineParentSave(b);return false})}},inlineParentSave:function(b){var f=a("#mla-set-parent-response-div input:checked").closest("tr"),h,e,c=a("#edit-"+b),d,g;if(f.length){h=a(":radio",f).val()||"";e=a("label",f).html()||"";d=a(':input[name="post_parent"]',c).clone(true).val(h);g=a(':input[name="post_parent_title"]',c).clone(true).val(e);a(':input[name="post_parent"]',c).replaceWith(d);a(':input[name="post_parent_title"]',c).replaceWith(g)}mla.setParent.close();a("#mla-set-parent-submit").off("click")},bulkParentOpen:function(){var d,b,c;b=-1;c=mla.settings.bulkTitle;d=a('#bulk-edit :input[name="post_parent"]').val()||-1;mla.setParent.open(d,b,c);a("#mla-set-parent-submit").on("click",function(e){e.preventDefault();mla.inlineEditAttachment.bulkParentSave();return false})},bulkParentSave:function(){var c=a("#mla-set-parent-response-div input:checked").closest("tr"),d,b;if(c.length){d=a(":radio",c).val()||"";b=a('#bulk-edit :input[name="post_parent"]').clone(true).val(d);a('#bulk-edit :input[name="post_parent"]').replaceWith(b)}mla.setParent.close();a("#mla-set-parent-submit").off("click")},tableParentOpen:function(d,b,c){mla.setParent.open(d,b,c);a("#mla-set-parent-submit").on("click",function(e){e.preventDefault();mla.inlineEditAttachment.tableParentSave(b);return false})},tableParentSave:function(b){var d=a("#mla-set-parent-response-div input:checked").closest("tr"),f=a(":radio",d).val()||"-1",c,e=a("#attachment-"+b+" td.attached_to").clone(true);if(d.length&&(f>=0)){e=a("#attachment-"+b+" td.attached_to").clone(true);e.html('<span class="spinner"></span>');a("#attachment-"+b+" td.attached_to").replaceWith(e);if(mla.settings.useSpinnerClass){a("#attachment-"+b+" td.attached_to .spinner").addClass("is-active")}else{a("#attachment-"+b+" td.attached_to .spinner").show()}c=a.param({action:mla.settings.ajax_action+"-set-parent",mla_admin_nonce:mla.settings.ajax_nonce,post_ID:b,post_parent:f});a.post(ajaxurl,c,function(g){if(g){if(-1==g.indexOf("tableParentOpen(")){g=g.replace(/<.[^<>]*?>/g,"")}}else{g=mla.settings.ajaxFailError}a("#attachment-"+b).before(g).remove();a("#attachment-"+b).hide().fadeIn()},"html")}else{e.html(mla.settings.error);a("#attachment-"+b+" td.attached_to").replaceWith(e)}a("#mla-set-parent-submit").off("click");mla.setParent.close()},doReset:function(){var g=a("table.wp-list-table tr.inline-editor").attr("id"),d=a("table.wp-list-table #bulk-edit"),c=a("#inlineedit #blank-bulk-edit"),b=a(".inline-edit-categories",c).html(),f=a(".inline-edit-tags",c).html(),e=a(".inline-edit-fields",c).html();if(g){if(mla.settings.useSpinnerClass){a("table.wp-list-table .inline-edit-save .spinner").removeClass("is-active")}else{a("table.wp-list-table .inline-edit-save .spinner").hide()}if("bulk-edit"==g){a(".inline-edit-categories",d).html(b),a(".inline-edit-tags",d).html(f),a(".inline-edit-fields",d).html(e);if((typeof quicktags!=="undefined")&&(typeof mla.settings.quickTagsInit!=="undefined")){for(g in mla.settings.quickTagsInit){quicktags(mla.settings.quickTagsInit[g]);if(mla.settings.quickTagsInit[g]["active"]){window.wpActiveEditor=g}}}if(typeof mla.addTerm!=="undefined"){mla.addTerm.init("#bulk-edit-fields-div")}mla.utility.attachSearch("#bulk-edit-fields-div");a("#bulk-edit-set-parent",d).on("click",function(){return mla.inlineEditAttachment.bulkParentOpen()})}}return false},revert:function(){var b=a("table.wp-list-table tr.inline-editor").attr("id");if(b){if(mla.settings.useSpinnerClass){a("table.wp-list-table .inline-edit-save .spinner").removeClass("is-active")}else{a("table.wp-list-table .inline-edit-save .spinner").hide()}if("bulk-edit"==b){if(mla.settings.useSpinnerClass){a("table.wp-list-table #bulk-edit").removeClass("inline-editor").hide().siblings("tr.hidden").remove()}else{a("table.wp-list-table #bulk-edit").removeClass("inline-editor").hide()}a("#bulk-titles").html("");a("#inlineedit").append(a("#bulk-edit"))}else{if("bulk-progress"==b){a("table.wp-list-table #bulk-progress").removeClass("inline-editor").hide();a("#bulk-progress-waiting").html("");a("#inlineedit").append(a("#bulk-progress"))}else{if(mla.settings.useSpinnerClass){a("#"+b).siblings("tr.hidden").addBack().remove()}else{a("#"+b).remove()}b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}}}return false}};a(document).ready(function(){mla.inlineEditAttachment.init()})})(jQuery);
1
+ var jQuery,mla_inline_edit_vars,mla={settings:{},bulkEdit:{inProcess:false,doCancel:false},utility:{getId:function(b){var c=jQuery(b).closest("tr").attr("id"),a=c.split("-");return a[a.length-1]},attachSearch:function(a){jQuery(a+" .categorydiv").each(function(){var d=jQuery(this).attr("id"),c,b;c=d.split("-");c.shift();b=c.join("-");jQuery.extend(jQuery.expr.pseudos||jQuery.expr[":"],{matchTerms:function(g,f,e,h){return(g.textContent||g.innerText||"").toLowerCase().indexOf((e[3]||"").toLowerCase())>=0}});jQuery(a+" #"+b+"-searcher").addClass("wp-hidden-children");jQuery(a+" #"+b+"checklist li").show();jQuery(a+" #search-"+b).off();jQuery(a+" #search-"+b).on("keydown",function(e){if(13===e.keyCode){e.preventDefault();jQuery(a+" #search-"+b).val("");jQuery(a+" #"+b+"-searcher").addClass("wp-hidden-children");jQuery(a+" #"+b+"checklist li").show();return false}});jQuery(a+" #search-"+b).on("keypress",function(e){if(13===e.keyCode){e.preventDefault();jQuery(a+" #search-"+b).val("");jQuery(a+" #"+b+"-searcher").addClass("wp-hidden-children");jQuery(a+" #"+b+"checklist li").show();return}});jQuery(a+" #search-"+b).on("keyup",function(f){var h,g,e;if(13===f.keyCode){f.preventDefault();jQuery(a+" #"+b+"-search-toggle").focus();return}h=jQuery(a+" #search-"+b).val();g=jQuery(a+" #"+b+"checklist li");if(0<h.length){g.hide()}else{g.show()}e=jQuery(a+" #"+b+"checklist label:matchTerms('"+h+"')");e.closest("li").find("li").andSelf().show();e.parents(a+" #"+b+"checklist li").show()});jQuery(a+" #"+b+"-search-toggle").off();jQuery(a+" #"+b+"-search-toggle").on("click",function(){jQuery(a+" #"+b+"-adder ").addClass("wp-hidden-children");jQuery(a+" #"+b+"-searcher").toggleClass("wp-hidden-children");jQuery(a+" #"+b+"checklist li").show();if(false===jQuery(a+" #"+b+"-searcher").hasClass("wp-hidden-children")){jQuery(a+" #search-"+b).val("").removeClass("form-input-tip");jQuery(a+" #search-"+b).focus()}return false})})}},setParent:null,inlineEditAttachment:null};(function(a){mla.settings=typeof mla_inline_edit_vars==="undefined"?{}:mla_inline_edit_vars;mla_inline_edit_vars=void 0;mla.inlineEditAttachment={init:function(){var d=this,e=a("#inline-edit"),c=a("#bulk-edit"),b=a("#bulk-progress");if(mla.settings.deleteAcpBulkEdit){setTimeout(function(){var f=document.querySelectorAll("body.ac-mla-media-assistant .acp-be-editrow, body.ac-mla-media-assistant .acp-be-noticerow");for(i=0;i<f.length;++i){f[i].remove()}},1000)}d.type="attachment";d.what="#attachment-";e.on("keyup",function(f){if(f.which==27){return mla.inlineEditAttachment.revert()}});c.on("keyup",function(f){if(f.which==27){return mla.inlineEditAttachment.revert()}});b.on("keyup",function(f){if(f.which==27){return mla.inlineEditAttachment.revert()}});a("#inline-edit-post-set-parent",e).on("click",function(){return mla.inlineEditAttachment.inlineParentOpen(this)});a("a.cancel",e).on("click",function(){return mla.inlineEditAttachment.revert()});a("a.save",e).on("click",function(){return mla.inlineEditAttachment.quickSave(this)});a("td",e).on("keydown",function(f){if(f.which==13){return mla.inlineEditAttachment.quickSave(this)}});if(typeof mla.addTerm!=="undefined"){mla.addTerm.init("#bulk-edit-fields-div")}mla.utility.attachSearch("#bulk-edit-fields-div");a("#bulk-edit-set-parent",c).on("click",function(){return mla.inlineEditAttachment.bulkParentOpen()});a("a.cancel",c).on("click",function(){return mla.inlineEditAttachment.revert()});a("a.reset",c).on("click",function(){return mla.inlineEditAttachment.doReset()});a('input[type="submit"]',c).on("click",function(f){f.preventDefault();return mla.inlineEditAttachment.bulkSave(f)});a("a.cancel",b).on("click",function(){if(mla.bulkEdit.inProcess){mla.bulkEdit.doCancel=true;return false}else{return mla.inlineEditAttachment.revert()}});a("#bulk_refresh",b).on("click",function(){a("#bulk-progress a").prop("disabled",true);a("#bulk-progress").css("opacity","0.5")});a("#the-list").on("click","a.editinline",function(){mla.inlineEditAttachment.quickEdit(this);return false});a('select[name="_status"] option[value="future"]',c).remove();a("#doaction, #doaction2").on("click",function(f){var g=a(this).attr("id").substr(2);if(a('select[name="'+g+'"]').val()=="edit"){f.preventDefault();d.bulkEdit()}else{if(a("form#posts-filter tr.inline-editor").length>0){d.revert()}}});a("#post-query-submit").on("mousedown",function(){d.revert();a('select[name^="action"]').val("-1")})},bulkEdit:function(){var b="",d=true;this.revert();a("#bulk-edit td").attr("colspan",a("th:visible, td:visible",".widefat:first thead").length);if(mla.settings.useSpinnerClass){a("table.wp-list-table tbody").prepend(a("#bulk-edit")).prepend('<tr class="hidden"></tr>')}else{a("table.wp-list-table tbody").prepend(a("#bulk-edit"))}a("#bulk-edit").addClass("inline-editor").show();a('tbody th.check-column input[type="checkbox"]').each(function(){if(a(this).prop("checked")){d=false;var e=a(this).val(),c;c=a("#inline_"+e+" .post_title").text()||mla.settings.noTitle;b+='<div id="ttle'+e+'"><a id="_'+e+'" class="ntdelbutton" title="'+mla.settings.ntdelTitle+'">X</a>'+c+"</div>"}});if(d){return this.revert()}a("#bulk-titles").html(b);a("#bulk-titles a").on("click",function(){var c=a(this).attr("id").substr(1);a('table.wp-list-table input[value="'+c+'"]').prop("checked",false);a("#ttle"+c).remove()});a("textarea.mla_tags").each(function(){var c=a(this).attr("name").replace("]","").replace("tax_input[","");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+c,{delay:500,minchars:2,multiple:true,multipleSep:mla.settings.comma+" "})});a("html, body").animate({scrollTop:0},"fast");if((typeof quicktags!=="undefined")&&(typeof mla.settings.quickTagsInit!=="undefined")){for(id in mla.settings.quickTagsInit){quicktags(mla.settings.quickTagsInit[id]);if(mla.settings.quickTagsInit[id]["active"]){window.wpActiveEditor=id}}}},bulkSave:function(c){var b;mla.bulkEdit={inProcess:false,doCancel:false,chunkSize:0,targetName:"",fields:"",ids:[],idsCount:0,offset:0,waiting:0,running:0,complete:0,unchanged:0,success:0,failure:0};mla.bulkEdit.chunkSize=+mla.settings.bulkChunkSize;mla.bulkEdit.targetName=c.target.name;mla.bulkEdit.fields=a("#bulk-edit :input").serialize();b=a('tbody th.check-column input[type="checkbox"]').serializeArray();a.each(b,function(d,e){mla.bulkEdit.ids[d]=+e.value});mla.bulkEdit.idsCount=mla.bulkEdit.waiting=mla.bulkEdit.ids.length;mla.inlineEditAttachment.bulkProgressOpen();mla.inlineEditAttachment.bulkPost();return false},bulkProgressOpen:function(){var b="",d=true;this.revert();a("#bulk-progress td").attr("colspan",a("th:visible, td:visible",".widefat:first thead").length);a("table.wp-list-table tbody").prepend(a("#bulk-progress"));a("#bulk-progress").addClass("inline-editor").show();a("#cb-select-all-1").removeAttr("checked");a("#cb-select-all-2").removeAttr("checked");a('tbody th.check-column input[type="checkbox"]').each(function(){if(a(this).prop("checked")){d=false;var e=a(this).val(),c;c=a("#inline_"+e+" .post_title").text()||mla.settings.noTitle;b+='<div id="ttle'+e+'"><a id="_'+e+'" class="ntdelbutton" title="'+mla.settings.ntdelTitle+'">X</a>'+c+"</div>"}});if(d){return this.revert()}a("#bulk-progress-running").html("");a("#bulk-progress-complete").html("");a("#bulk-progress-waiting").html(b);a("#bulk-progress-waiting a").on("click",function(){var c=a(this).attr("id").substr(1);a('table.wp-list-table input[value="'+c+'"]').prop("checked",false);a("#ttle"+c).remove()});a("#bulk-progress .inline-edit-save .error").html("");a("#bulk_refresh").prop("disabled",true).css("opacity","0.5");a("html, body").animate({scrollTop:0},"fast")},bulkPost:function(){var b,g,f,j,c,h=a("table.wp-list-table .inline-edit-save .spinner"),d=a("#bulk-progress .inline-edit-save .error"),k=a("#bulk-progress-waiting"),e=a("#bulk-progress-running");g=mla.bulkEdit.ids.slice(mla.bulkEdit.offset,mla.bulkEdit.offset+mla.bulkEdit.chunkSize);for(f=0;f<g.length;f++){j=a("#ttle"+g[f],k).remove();a("a",j).hide();e.append(j)}mla.bulkEdit.waiting-=g.length;mla.bulkEdit.running=g.length;b={action:mla.settings.ajax_action,mla_admin_nonce:mla.settings.ajax_nonce,bulk_action:mla.bulkEdit.targetName,cb_offset:mla.bulkEdit.offset,cb_count:mla.bulkEdit.idsCount,cb_attachment:g};mla.bulkEdit.offset+=mla.bulkEdit.chunkSize;b=a.param(b)+"&"+mla.bulkEdit.fields;mla.bulkEdit.inProcess=true;if(mla.settings.useSpinnerClass){h.addClass("is-active")}else{h.show()}c=mla.settings.bulkWaiting+": "+mla.bulkEdit.waiting+", "+mla.settings.bulkComplete+": "+mla.bulkEdit.complete+", "+mla.settings.bulkUnchanged+": "+mla.bulkEdit.unchanged+", "+mla.settings.bulkSuccess+": "+mla.bulkEdit.success+", "+mla.settings.bulkFailure+": "+mla.bulkEdit.failure;d.html(c).show();a.ajax(ajaxurl,{type:"POST",data:b,dataType:"json"}).always(function(){if(mla.settings.useSpinnerClass){h.removeClass("is-active")}else{h.hide()}}).done(function(o,m){var p="no response.data",l,n;if(mla.settings.useSpinnerClass){h.removeClass("is-active")}else{h.hide()}if(o){if(!o.success){if(o.responseData){p=o.data}d.html(JSON.stringify(o)).show();mla.bulkEdit.offset=mla.bulkEdit.idsCount}else{n=a("#bulk-progress-running div").remove();a.each(n,function(){var q,r=a(this).html(),s=a(this).attr("id").substr(4);if("string"===typeof(o.data.item_results[s]["result"])){q=o.data.item_results[s]["result"];a(this).html(r+" ("+s+") - "+q)}a("#attachment-"+s).remove()});a("#bulk-progress-complete").append(n);mla.bulkEdit.complete+=mla.bulkEdit.running;mla.bulkEdit.running=0;mla.bulkEdit.unchanged+=o.data.unchanged;mla.bulkEdit.success+=o.data.success;mla.bulkEdit.failure+=o.data.failure;l=mla.settings.bulkWaiting+": "+mla.bulkEdit.waiting+", "+mla.settings.bulkComplete+": "+mla.bulkEdit.complete+", "+mla.settings.bulkUnchanged+": "+mla.bulkEdit.unchanged+", "+mla.settings.bulkSuccess+": "+mla.bulkEdit.success+", "+mla.settings.bulkFailure+": "+mla.bulkEdit.failure;d.html(l).show()}}else{d.html(mla.settings.error).show();mla.bulkEdit.offset=mla.bulkEdit.idsCount}if(mla.bulkEdit.doCancel){d.html(mla.settings.bulkCanceled+". "+l).show()}else{if(mla.bulkEdit.offset<mla.bulkEdit.idsCount){mla.inlineEditAttachment.bulkPost();return}}a("#bulk_refresh").prop("disabled",false).css("opacity","1.0");mla.bulkEdit.inProcess=false}).fail(function(m,l){if(200==m.status){d.text("("+l+") "+m.responseText)}else{d.text(mla.settings.ajaxFailError+" ("+l+"), jqXHR( "+m.status+", "+m.statusText+", "+m.responseText+")")}})},quickEdit:function(j){var d=this,b,c,f,h=[],e,g;d.revert();if(typeof(j)=="object"){j=mla.utility.getId(j)}b=mla.settings.fields;c=a("#inline-edit").clone(true);a("td",c).attr("colspan",a("th:visible, td:visible",".widefat:first thead").length);if(mla.settings.useSpinnerClass){a(d.what+j).hide().after(c).after('<tr class="hidden"></tr>')}else{if(a(d.what+j).hasClass("alternate")){a(c).addClass("alternate")}a(d.what+j).hide().after(c)}f=a("#inline_"+j);e=a(".item_thumbnail",f).html();if(e.length){a("#item_thumbnail",c).html(e)}if(!a(':input[name="post_author"] option[value="'+a(".post_author",f).text()+'"]',c).val()){a(':input[name="post_author"]',c).prepend('<option value="'+a(".post_author",f).text()+'">'+a("#"+d.type+"-"+j+" .author").text()+"</option>")}if(a(':input[name="post_author"] option',c).length==1){a("label.inline-edit-author",c).hide()}for(g=0;g<b.length;g++){a(':input[name="'+b[g]+'"]',c).val(a("."+b[g],f).text())}if(a(".image_alt",f).length===0){a("label.inline-edit-image-alt",c).hide()}a(".checked_on_top",f).each(function(){h[h.length]=a(this).attr("id").replace("_"+j,"")});a(".mla_category",f).each(function(){var m=a(this).text(),n=a(this).attr("id").replace("_"+j,""),l,k;if(m){a("ul."+n+"checklist :checkbox",c).val(m.split(","));if(-1!==h.indexOf(n)){l=a("ul."+n+"checklist li :checked",c).parents("label").remove().toArray().reverse();k=a("<li></li>").html(l);a("ul."+n+"checklist",c).prepend(k)}}});a(".mla_tags",f).each(function(){var n=a(this).text(),o=a(this).attr("id").replace("_"+j,""),m=a("textarea.tax_input_"+o,c),k=mla.settings.comma,l;if(n){if(","!==k){n=n.replace(/,/g,k)}m.val(n)}l=a(".lang",f).text();if(0<l.length){l="&lang="+l}else{l=""}m.suggest(ajaxurl+"?action=ajax-tag-search&tax="+o+"&preview_id="+j+l,{delay:500,minchars:2,multiple:true,multipleSep:mla.settings.comma+" "})});f=a(c).attr("id","edit-"+j).addClass("inline-editor").show().position().top;a(".ptitle",c).focus();a("html, body").animate({scrollTop:f},"fast");a("#inline-edit-fields-div",c).attr("id","inline-edit-fields-div-active");if(typeof mla.addTerm!=="undefined"){mla.addTerm.init("#inline-edit-fields-div-active")}mla.utility.attachSearch("#inline-edit-fields-div-active");return false},quickSave:function(e){var d,b,c=a(".post_status_page").val()||"";if(typeof(e)=="object"){e=mla.utility.getId(e)}if(mla.settings.useSpinnerClass){a("table.wp-list-table .inline-edit-save .spinner").addClass("is-active")}else{a("table.wp-list-table .inline-edit-save .spinner").show()}d={action:mla.settings.ajax_action,mla_admin_nonce:mla.settings.ajax_nonce,post_type:"attachment",post_ID:e,edit_date:"true",post_status:c};b=a("#edit-"+e+" :input").serialize();d=b+"&"+a.param(d);a.post(ajaxurl,d,function(f){if(mla.settings.useSpinnerClass){a("table.wp-list-table .inline-edit-save .spinner").removeClass("is-active")}else{a("table.wp-list-table .inline-edit-save .spinner").hide()}if(f){if(-1!=f.indexOf("<tr")){if(mla.settings.useSpinnerClass){a(mla.inlineEditAttachment.what+e).siblings("tr.hidden").addBack().remove()}else{a(mla.inlineEditAttachment.what+e).remove()}a("#edit-"+e).before(f).remove();a(mla.inlineEditAttachment.what+e).hide().fadeIn()}else{f=f.replace(/<.[^<>]*?>/g,"");a("#edit-"+e+" .inline-edit-save .error").html(f).show()}}else{a("#edit-"+e+" .inline-edit-save .error").html(mla.settings.error).show()}},"html");return false},inlineParentOpen:function(e){var d,b,c;if(typeof(e)=="object"){b=mla.utility.getId(e);d=a("#edit-"+b+' :input[name="post_parent"]').val()||"";c=a("#edit-"+b+' :input[name="post_title"]').val()||"";mla.setParent.open(d,b,c);a("#mla-set-parent-submit").on("click",function(f){f.preventDefault();mla.inlineEditAttachment.inlineParentSave(b);return false})}},inlineParentSave:function(b){var f=a("#mla-set-parent-response-div input:checked").closest("tr"),h,e,c=a("#edit-"+b),d,g;if(f.length){h=a(":radio",f).val()||"";e=a("label",f).html()||"";d=a(':input[name="post_parent"]',c).clone(true).val(h);g=a(':input[name="post_parent_title"]',c).clone(true).val(e);a(':input[name="post_parent"]',c).replaceWith(d);a(':input[name="post_parent_title"]',c).replaceWith(g)}mla.setParent.close();a("#mla-set-parent-submit").off("click")},bulkParentOpen:function(){var d,b,c;b=-1;c=mla.settings.bulkTitle;d=a('#bulk-edit :input[name="post_parent"]').val()||-1;mla.setParent.open(d,b,c);a("#mla-set-parent-submit").on("click",function(e){e.preventDefault();mla.inlineEditAttachment.bulkParentSave();return false})},bulkParentSave:function(){var c=a("#mla-set-parent-response-div input:checked").closest("tr"),d,b;if(c.length){d=a(":radio",c).val()||"";b=a('#bulk-edit :input[name="post_parent"]').clone(true).val(d);a('#bulk-edit :input[name="post_parent"]').replaceWith(b)}mla.setParent.close();a("#mla-set-parent-submit").off("click")},tableParentOpen:function(d,b,c){mla.setParent.open(d,b,c);a("#mla-set-parent-submit").on("click",function(e){e.preventDefault();mla.inlineEditAttachment.tableParentSave(b);return false})},tableParentSave:function(b){var d=a("#mla-set-parent-response-div input:checked").closest("tr"),f=a(":radio",d).val()||"-1",c,e=a("#attachment-"+b+" td.attached_to").clone(true);if(d.length&&(f>=0)){e=a("#attachment-"+b+" td.attached_to").clone(true);e.html('<span class="spinner"></span>');a("#attachment-"+b+" td.attached_to").replaceWith(e);if(mla.settings.useSpinnerClass){a("#attachment-"+b+" td.attached_to .spinner").addClass("is-active")}else{a("#attachment-"+b+" td.attached_to .spinner").show()}c=a.param({action:mla.settings.ajax_action+"-set-parent",mla_admin_nonce:mla.settings.ajax_nonce,post_ID:b,post_parent:f});a.post(ajaxurl,c,function(g){if(g){if(-1==g.indexOf("tableParentOpen(")){g=g.replace(/<.[^<>]*?>/g,"")}}else{g=mla.settings.ajaxFailError}a("#attachment-"+b).before(g).remove();a("#attachment-"+b).hide().fadeIn()},"html")}else{e.html(mla.settings.error);a("#attachment-"+b+" td.attached_to").replaceWith(e)}a("#mla-set-parent-submit").off("click");mla.setParent.close()},doReset:function(){var g=a("table.wp-list-table tr.inline-editor").attr("id"),d=a("table.wp-list-table #bulk-edit"),c=a("#inlineedit #blank-bulk-edit"),b=a(".inline-edit-categories",c).html(),f=a(".inline-edit-tags",c).html(),e=a(".inline-edit-fields",c).html();if(g){if(mla.settings.useSpinnerClass){a("table.wp-list-table .inline-edit-save .spinner").removeClass("is-active")}else{a("table.wp-list-table .inline-edit-save .spinner").hide()}if("bulk-edit"==g){a(".inline-edit-categories",d).html(b),a(".inline-edit-tags",d).html(f),a(".inline-edit-fields",d).html(e);if((typeof quicktags!=="undefined")&&(typeof mla.settings.quickTagsInit!=="undefined")){for(g in mla.settings.quickTagsInit){quicktags(mla.settings.quickTagsInit[g]);if(mla.settings.quickTagsInit[g]["active"]){window.wpActiveEditor=g}}}if(typeof mla.addTerm!=="undefined"){mla.addTerm.init("#bulk-edit-fields-div")}mla.utility.attachSearch("#bulk-edit-fields-div");a("#bulk-edit-set-parent",d).on("click",function(){return mla.inlineEditAttachment.bulkParentOpen()})}}return false},revert:function(){var b=a("table.wp-list-table tr.inline-editor").attr("id");if(b){if(mla.settings.useSpinnerClass){a("table.wp-list-table .inline-edit-save .spinner").removeClass("is-active")}else{a("table.wp-list-table .inline-edit-save .spinner").hide()}if("bulk-edit"==b){if(mla.settings.useSpinnerClass){a("table.wp-list-table #bulk-edit").removeClass("inline-editor").hide().siblings("tr.hidden").remove()}else{a("table.wp-list-table #bulk-edit").removeClass("inline-editor").hide()}a("#bulk-titles").html("");a("#inlineedit").append(a("#bulk-edit"))}else{if("bulk-progress"==b){a("table.wp-list-table #bulk-progress").removeClass("inline-editor").hide();a("#bulk-progress-waiting").html("");a("#inlineedit").append(a("#bulk-progress"))}else{if(mla.settings.useSpinnerClass){a("#"+b).siblings("tr.hidden").addBack().remove()}else{a("#"+b).remove()}b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}}}return false}};a(document).ready(function(){mla.inlineEditAttachment.init()})})(jQuery);
js/mla-inline-edit-settings-scripts.js CHANGED
@@ -12,27 +12,27 @@ mlaInlineEditSettings = {
12
  t.what = '#' + mla_inline_edit_settings_vars.tab + '-';
13
 
14
  // prepare the edit rows
15
- qeRow.keyup(function(e){
16
  if (e.which == 27)
17
  return mlaInlineEditSettings.revert();
18
  });
19
- bulkRow.keyup(function(e){
20
  if (e.which == 27)
21
  return mlaInlineEditSettings.revert();
22
  });
23
 
24
- $('a.cancel', qeRow).click(function(){
25
  return mlaInlineEditSettings.revert();
26
  });
27
- $('a.save', qeRow).click(function(){
28
  return mlaInlineEditSettings.save(this);
29
  });
30
- $('td', qeRow).keydown(function(e){
31
  if ( e.which == 13 )
32
  return mlaInlineEditSettings.save(this);
33
  });
34
 
35
- $('a.cancel', bulkRow).click(function(){
36
  return mlaInlineEditSettings.revert();
37
  });
38
 
@@ -42,7 +42,7 @@ mlaInlineEditSettings = {
42
  return false;
43
  });
44
 
45
- $('#doaction, #doaction2').click(function(e){
46
  var n = $(this).attr('id').substr(2);
47
 
48
  if ( $('select[name="'+n+'"]').val() == 'edit' ) {
@@ -85,7 +85,7 @@ mlaInlineEditSettings = {
85
  return this.revert();
86
 
87
  $('#bulk-titles').html(te);
88
- $('#bulk-titles a').click(function(){
89
  var id = $(this).attr('id').substr(1);
90
 
91
  $('table.widefat input[value="' + id + '"]').prop('checked', false);
@@ -196,7 +196,7 @@ mlaInlineEditSettings = {
196
  $(mlaInlineEditSettings.what+id).hide().fadeIn();
197
 
198
  // add event handler to the Execute rollover link
199
- $(mlaInlineEditSettings.what+id + ' a.execute' ).click(function( e ){
200
  e.preventDefault();
201
  return mla.inlineMapAttachment.bulkMap( e.target.id, 0 );
202
  });
12
  t.what = '#' + mla_inline_edit_settings_vars.tab + '-';
13
 
14
  // prepare the edit rows
15
+ qeRow.on( 'keyup', function(e){
16
  if (e.which == 27)
17
  return mlaInlineEditSettings.revert();
18
  });
19
+ bulkRow.on( 'keyup', function(e){
20
  if (e.which == 27)
21
  return mlaInlineEditSettings.revert();
22
  });
23
 
24
+ $('a.cancel', qeRow).on( 'click', function(){
25
  return mlaInlineEditSettings.revert();
26
  });
27
+ $('a.save', qeRow).on( 'click', function(){
28
  return mlaInlineEditSettings.save(this);
29
  });
30
+ $('td', qeRow).on( 'keydown', function(e){
31
  if ( e.which == 13 )
32
  return mlaInlineEditSettings.save(this);
33
  });
34
 
35
+ $('a.cancel', bulkRow).on( 'click', function(){
36
  return mlaInlineEditSettings.revert();
37
  });
38
 
42
  return false;
43
  });
44
 
45
+ $('#doaction, #doaction2').on( 'click', function(e){
46
  var n = $(this).attr('id').substr(2);
47
 
48
  if ( $('select[name="'+n+'"]').val() == 'edit' ) {
85
  return this.revert();
86
 
87
  $('#bulk-titles').html(te);
88
+ $('#bulk-titles a').on( 'click', function(){
89
  var id = $(this).attr('id').substr(1);
90
 
91
  $('table.widefat input[value="' + id + '"]').prop('checked', false);
196
  $(mlaInlineEditSettings.what+id).hide().fadeIn();
197
 
198
  // add event handler to the Execute rollover link
199
+ $(mlaInlineEditSettings.what+id + ' a.execute' ).on( 'click', function( e ){
200
  e.preventDefault();
201
  return mla.inlineMapAttachment.bulkMap( e.target.id, 0 );
202
  });
js/mla-inline-edit-settings-scripts.min.js CHANGED
@@ -1 +1 @@
1
- var ajaxurl,jQuery,mlaInlineEditSettings,mla,mla_inline_edit_settings_vars;(function(a){mlaInlineEditSettings={init:function(){var c=this,d=a("#inline-edit"),b=a("#bulk-edit");c.type=mla_inline_edit_settings_vars.tab;c.what="#"+mla_inline_edit_settings_vars.tab+"-";d.keyup(function(f){if(f.which==27){return mlaInlineEditSettings.revert()}});b.keyup(function(f){if(f.which==27){return mlaInlineEditSettings.revert()}});a("a.cancel",d).click(function(){return mlaInlineEditSettings.revert()});a("a.save",d).click(function(){return mlaInlineEditSettings.save(this)});a("td",d).keydown(function(f){if(f.which==13){return mlaInlineEditSettings.save(this)}});a("a.cancel",b).click(function(){return mlaInlineEditSettings.revert()});a(document).on("click","a.editinline",function(){mlaInlineEditSettings.edit(this);return false});a("#doaction, #doaction2").click(function(f){var g=a(this).attr("id").substr(2);if(a('select[name="'+g+'"]').val()=="edit"){f.preventDefault();c.setBulk()}else{if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}}})},toggle:function(c){var b=this;if("none"==a(b.what+b.getId(c)).css("display")){b.revert()}else{b.edit(c)}},setBulk:function(){var b="",d=true;this.revert();a("#bulk-edit td").attr("colspan",a("th:visible, td:visible",".widefat:first thead").length);a("table.widefat tbody").prepend(a("#bulk-edit"));a("#bulk-edit").addClass("inline-editor").show();a('tbody th.check-column input[type="checkbox"]').each(function(){if(a(this).prop("checked")){d=false;var e=a(this).val(),c;c=a("#inline_"+e+" .slug").text()||mla_inline_edit_settings_vars.notitle;b+='<div id="ttle'+e+'"><a id="_'+e+'" class="ntdelbutton" title="'+mla_inline_edit_settings_vars.ntdeltitle+'">X</a>'+c+"</div>"}});if(d){return this.revert()}a("#bulk-titles").html(b);a("#bulk-titles a").click(function(){var c=a(this).attr("id").substr(1);a('table.widefat input[value="'+c+'"]').prop("checked",false);a("#ttle"+c).remove()});a("html, body").animate({scrollTop:0},"fast")},edit:function(i){var e=this,b,g,d,f,h,c;e.revert();if(typeof(i)=="object"){i=e.getId(i)}b=mla_inline_edit_settings_vars.fields;g=mla_inline_edit_settings_vars.checkboxes;d=a("#inline-edit").clone(true);a("td",d).attr("colspan",a("th:visible, td:visible",".widefat:first thead").length);if(a(e.what+i).hasClass("alternate")){a(d).addClass("alternate")}a(e.what+i).hide().after(d);f=a("#inline_"+i);for(h=0;h<b.length;h++){c=a("."+b[h],f).text();switch(b[h]){case"type":if("taxonomy"==c){a(".inline-taxonomy-group",d).show()}else{a(".inline-taxonomy-group",d).hide()}if("custom"==c){a(".inline-custom-group",d).show()}else{a(".inline-custom-group",d).hide()}break;case"parent_options":c=a("."+b[h],f).html();a(':input[name="parent"]',d).html(c);break;default:a(':input[name="'+b[h]+'"]',d).val(c);break}}for(h=0;h<g.length;h++){if("1"==a("."+g[h],f).text()){a(':input[name="'+g[h]+'"]',d).attr("checked","checked")}else{a(':input[name="'+g[h]+'"]',d).removeAttr("checked")}}a(d).attr("id","edit-"+i).addClass("inline-editor").show();a(".ptitle",d).focus();return false},save:function(d){var c,b;if(typeof(d)=="object"){d=this.getId(d)}if(mla_inline_edit_settings_vars.useSpinnerClass){a("table.widefat .spinner").addClass("is-active")}else{a("table.widefat .spinner").show()}c={action:mla_inline_edit_settings_vars.ajax_action,mla_admin_nonce:mla_inline_edit_settings_vars.ajax_nonce,post_ID:d};b=a("#edit-"+d+" :input").serialize();c=b+"&"+a.param(c);a.post(ajaxurl,c,function(e){if(mla_inline_edit_settings_vars.useSpinnerClass){a("table.widefat .spinner").removeClass("is-active")}else{a("table.widefat .spinner").hide()}if(e){if(-1!=e.indexOf("<tr")){a(mlaInlineEditSettings.what+d).remove();a("#edit-"+d).before(e).remove();a(mlaInlineEditSettings.what+d).hide().fadeIn();a(mlaInlineEditSettings.what+d+" a.execute").click(function(f){f.preventDefault();return mla.inlineMapAttachment.bulkMap(f.target.id,0)})}else{e=e.replace(/<.[^<>]*?>/g,"");a("#edit-"+d+" .inline-edit-save .error").html(e).show()}}else{a("#edit-"+d+" .inline-edit-save .error").html(mla_inline_edit_settings_vars.error).show()}},"html");return false},revert:function(){var b=a("table.widefat tr.inline-editor").attr("id");if(b){a("table.widefat .inline-edit-save .waiting").hide();if("bulk-edit"==b){a("table.widefat #bulk-edit").removeClass("inline-editor").hide();a("#bulk-titles").html("");a("#inlineedit").append(a("#bulk-edit"))}else{if(mla_inline_edit_settings_vars.useSpinnerClass){a("table.widefat .spinner").removeClass("is-active")}else{a("table.widefat .spinner").hide()}a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}}return false},getId:function(c){var d=a(c).closest("tr").attr("id"),b=d.split("-");return b[b.length-1]}};a(document).ready(function(){mlaInlineEditSettings.init()})})(jQuery);
1
+ var ajaxurl,jQuery,mlaInlineEditSettings,mla,mla_inline_edit_settings_vars;(function(a){mlaInlineEditSettings={init:function(){var c=this,d=a("#inline-edit"),b=a("#bulk-edit");c.type=mla_inline_edit_settings_vars.tab;c.what="#"+mla_inline_edit_settings_vars.tab+"-";d.on("keyup",function(f){if(f.which==27){return mlaInlineEditSettings.revert()}});b.on("keyup",function(f){if(f.which==27){return mlaInlineEditSettings.revert()}});a("a.cancel",d).on("click",function(){return mlaInlineEditSettings.revert()});a("a.save",d).on("click",function(){return mlaInlineEditSettings.save(this)});a("td",d).on("keydown",function(f){if(f.which==13){return mlaInlineEditSettings.save(this)}});a("a.cancel",b).on("click",function(){return mlaInlineEditSettings.revert()});a(document).on("click","a.editinline",function(){mlaInlineEditSettings.edit(this);return false});a("#doaction, #doaction2").on("click",function(f){var g=a(this).attr("id").substr(2);if(a('select[name="'+g+'"]').val()=="edit"){f.preventDefault();c.setBulk()}else{if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}}})},toggle:function(c){var b=this;if("none"==a(b.what+b.getId(c)).css("display")){b.revert()}else{b.edit(c)}},setBulk:function(){var b="",d=true;this.revert();a("#bulk-edit td").attr("colspan",a("th:visible, td:visible",".widefat:first thead").length);a("table.widefat tbody").prepend(a("#bulk-edit"));a("#bulk-edit").addClass("inline-editor").show();a('tbody th.check-column input[type="checkbox"]').each(function(){if(a(this).prop("checked")){d=false;var e=a(this).val(),c;c=a("#inline_"+e+" .slug").text()||mla_inline_edit_settings_vars.notitle;b+='<div id="ttle'+e+'"><a id="_'+e+'" class="ntdelbutton" title="'+mla_inline_edit_settings_vars.ntdeltitle+'">X</a>'+c+"</div>"}});if(d){return this.revert()}a("#bulk-titles").html(b);a("#bulk-titles a").on("click",function(){var c=a(this).attr("id").substr(1);a('table.widefat input[value="'+c+'"]').prop("checked",false);a("#ttle"+c).remove()});a("html, body").animate({scrollTop:0},"fast")},edit:function(i){var e=this,b,g,d,f,h,c;e.revert();if(typeof(i)=="object"){i=e.getId(i)}b=mla_inline_edit_settings_vars.fields;g=mla_inline_edit_settings_vars.checkboxes;d=a("#inline-edit").clone(true);a("td",d).attr("colspan",a("th:visible, td:visible",".widefat:first thead").length);if(a(e.what+i).hasClass("alternate")){a(d).addClass("alternate")}a(e.what+i).hide().after(d);f=a("#inline_"+i);for(h=0;h<b.length;h++){c=a("."+b[h],f).text();switch(b[h]){case"type":if("taxonomy"==c){a(".inline-taxonomy-group",d).show()}else{a(".inline-taxonomy-group",d).hide()}if("custom"==c){a(".inline-custom-group",d).show()}else{a(".inline-custom-group",d).hide()}break;case"parent_options":c=a("."+b[h],f).html();a(':input[name="parent"]',d).html(c);break;default:a(':input[name="'+b[h]+'"]',d).val(c);break}}for(h=0;h<g.length;h++){if("1"==a("."+g[h],f).text()){a(':input[name="'+g[h]+'"]',d).attr("checked","checked")}else{a(':input[name="'+g[h]+'"]',d).removeAttr("checked")}}a(d).attr("id","edit-"+i).addClass("inline-editor").show();a(".ptitle",d).focus();return false},save:function(d){var c,b;if(typeof(d)=="object"){d=this.getId(d)}if(mla_inline_edit_settings_vars.useSpinnerClass){a("table.widefat .spinner").addClass("is-active")}else{a("table.widefat .spinner").show()}c={action:mla_inline_edit_settings_vars.ajax_action,mla_admin_nonce:mla_inline_edit_settings_vars.ajax_nonce,post_ID:d};b=a("#edit-"+d+" :input").serialize();c=b+"&"+a.param(c);a.post(ajaxurl,c,function(e){if(mla_inline_edit_settings_vars.useSpinnerClass){a("table.widefat .spinner").removeClass("is-active")}else{a("table.widefat .spinner").hide()}if(e){if(-1!=e.indexOf("<tr")){a(mlaInlineEditSettings.what+d).remove();a("#edit-"+d).before(e).remove();a(mlaInlineEditSettings.what+d).hide().fadeIn();a(mlaInlineEditSettings.what+d+" a.execute").on("click",function(f){f.preventDefault();return mla.inlineMapAttachment.bulkMap(f.target.id,0)})}else{e=e.replace(/<.[^<>]*?>/g,"");a("#edit-"+d+" .inline-edit-save .error").html(e).show()}}else{a("#edit-"+d+" .inline-edit-save .error").html(mla_inline_edit_settings_vars.error).show()}},"html");return false},revert:function(){var b=a("table.widefat tr.inline-editor").attr("id");if(b){a("table.widefat .inline-edit-save .waiting").hide();if("bulk-edit"==b){a("table.widefat #bulk-edit").removeClass("inline-editor").hide();a("#bulk-titles").html("");a("#inlineedit").append(a("#bulk-edit"))}else{if(mla_inline_edit_settings_vars.useSpinnerClass){a("table.widefat .spinner").removeClass("is-active")}else{a("table.widefat .spinner").hide()}a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}}return false},getId:function(c){var d=a(c).closest("tr").attr("id"),b=d.split("-");return b[b.length-1]}};a(document).ready(function(){mlaInlineEditSettings.init()})})(jQuery);
js/mla-inline-mapping-scripts.js CHANGED
@@ -31,7 +31,7 @@ var jQuery,
31
  var progressDiv = $( '#mla-progress-div' );
32
 
33
  $('#mla-progress-pause', progressDiv).off( 'click' );
34
- $('#mla-progress-pause', progressDiv).click( function(){
35
  if ( mla.bulkMap.inProcess ) {
36
  mla.bulkMap.doCancel = true;
37
  return false;
@@ -41,12 +41,12 @@ var jQuery,
41
  });
42
 
43
  $('#mla-progress-cancel', progressDiv).off( 'click' );
44
- $('#mla-progress-cancel', progressDiv).click( function(){
45
  return mla.inlineMapAttachment.revert();
46
  });
47
 
48
  $('#mla-progress-resume', progressDiv).off( 'click' );
49
- $('#mla-progress-resume', progressDiv).click( function(){
50
  var totalItems = +mla.settings.totalItems, newOffset = + $( '#mla-progress-offset' ).val();
51
 
52
  if ( totalItems < newOffset ) {
@@ -67,12 +67,12 @@ var jQuery,
67
 
68
  // Clicking "Refresh" submits the form, refreshing the page
69
  $( '#mla-progress-refresh', progressDiv ).off( 'click' );
70
- $( '#mla-progress-refresh', progressDiv ).click( function(){
71
  $( '#mla-progress-refresh' ).prop( 'disabled', true ).css( 'opacity', '0.5' );
72
  });
73
 
74
  $('#mla-progress-close', progressDiv).off( 'click' );
75
- $('#mla-progress-close', progressDiv).click( function( e ){
76
  if ( mla.bulkMap.inProcess ) {
77
  return false;
78
  }
@@ -81,13 +81,13 @@ var jQuery,
81
  });
82
 
83
  // add event handler to the Execute All Rules
84
- $( 'input[type="submit"].mla-mapping' ).click(function( e ){
85
  e.preventDefault();
86
  return mla.inlineMapAttachment.bulkMap( e.target.name, 0 );
87
  });
88
 
89
  // add event handler to the Bulk Actions Apply (top)
90
- $( 'input[type="submit"]#doaction' ).click(function( e ){
91
  var action = $( '#bulk-action-selector-top' ).val(), ids;
92
  //console.log( 'Bulk Actions Apply (top) ', e.target.id, ' ', action );
93
  if ( 'execute' !== action ) {
@@ -109,7 +109,7 @@ var jQuery,
109
  });
110
 
111
  // add event handler to the Bulk Actions Apply (bottom)
112
- $( 'input[type="submit"]#doaction2' ).click(function( e ){
113
  var action = $( '#bulk-action-selector-bottom' ).val(), ids;
114
  if ( 'execute' !== action ) {
115
  return true;
@@ -129,7 +129,7 @@ var jQuery,
129
  });
130
 
131
  // add event handler to the Execute rollover links
132
- $( 'a.execute' ).click(function( e ){
133
  e.preventDefault();
134
  return mla.inlineMapAttachment.bulkMap( e.target.id, 0 );
135
  });
31
  var progressDiv = $( '#mla-progress-div' );
32
 
33
  $('#mla-progress-pause', progressDiv).off( 'click' );
34
+ $('#mla-progress-pause', progressDiv).on( 'click', function(){
35
  if ( mla.bulkMap.inProcess ) {
36
  mla.bulkMap.doCancel = true;
37
  return false;
41
  });
42
 
43
  $('#mla-progress-cancel', progressDiv).off( 'click' );
44
+ $('#mla-progress-cancel', progressDiv).on( 'click', function(){
45
  return mla.inlineMapAttachment.revert();
46
  });
47
 
48
  $('#mla-progress-resume', progressDiv).off( 'click' );
49
+ $('#mla-progress-resume', progressDiv).on( 'click', function(){
50
  var totalItems = +mla.settings.totalItems, newOffset = + $( '#mla-progress-offset' ).val();
51
 
52
  if ( totalItems < newOffset ) {
67
 
68
  // Clicking "Refresh" submits the form, refreshing the page
69
  $( '#mla-progress-refresh', progressDiv ).off( 'click' );
70
+ $( '#mla-progress-refresh', progressDiv ).on( 'click', function(){
71
  $( '#mla-progress-refresh' ).prop( 'disabled', true ).css( 'opacity', '0.5' );
72
  });
73
 
74
  $('#mla-progress-close', progressDiv).off( 'click' );
75
+ $('#mla-progress-close', progressDiv).on( 'click', function( e ){
76
  if ( mla.bulkMap.inProcess ) {
77
  return false;
78
  }
81
  });
82
 
83
  // add event handler to the Execute All Rules
84
+ $( 'input[type="submit"].mla-mapping' ).on( 'click', function( e ){
85
  e.preventDefault();
86
  return mla.inlineMapAttachment.bulkMap( e.target.name, 0 );
87
  });
88
 
89
  // add event handler to the Bulk Actions Apply (top)
90
+ $( 'input[type="submit"]#doaction' ).on( 'click', function( e ){
91
  var action = $( '#bulk-action-selector-top' ).val(), ids;
92
  //console.log( 'Bulk Actions Apply (top) ', e.target.id, ' ', action );
93
  if ( 'execute' !== action ) {
109
  });
110
 
111
  // add event handler to the Bulk Actions Apply (bottom)
112
+ $( 'input[type="submit"]#doaction2' ).on( 'click', function( e ){
113
  var action = $( '#bulk-action-selector-bottom' ).val(), ids;
114
  if ( 'execute' !== action ) {
115
  return true;
129
  });
130
 
131
  // add event handler to the Execute rollover links
132
+ $( 'a.execute' ).on( 'click', function( e ){
133
  e.preventDefault();
134
  return mla.inlineMapAttachment.bulkMap( e.target.id, 0 );
135
  });
js/mla-inline-mapping-scripts.min.js CHANGED
@@ -1 +1 @@
1
- var jQuery,mla_inline_mapping_vars,mla={settings:{},bulkMap:{ids:[],inProcess:false,doCancel:false},utility:{},inlineMapAttachment:null};(function(a){mla.settings=typeof mla_inline_mapping_vars==="undefined"?{}:mla_inline_mapping_vars;mla_inline_mapping_vars=void 0;mla.inlineMapAttachment={init:function(){var b=a("#mla-progress-div");a("#mla-progress-pause",b).off("click");a("#mla-progress-pause",b).click(function(){if(mla.bulkMap.inProcess){mla.bulkMap.doCancel=true;return false}else{return mla.inlineMapAttachment.revert()}});a("#mla-progress-cancel",b).off("click");a("#mla-progress-cancel",b).click(function(){return mla.inlineMapAttachment.revert()});a("#mla-progress-resume",b).off("click");a("#mla-progress-resume",b).click(function(){var c=+mla.settings.totalItems,d=+a("#mla-progress-offset").val();if(c<d){d=c}else{if(0>d){d=0}}if(mla.bulkMap.inProcess){mla.bulkMap.doCancel=true;return false}else{return mla.inlineMapAttachment.bulkMap(mla.bulkMap.targetName,d)}});a("#mla-progress-refresh",b).off("click");a("#mla-progress-refresh",b).click(function(){a("#mla-progress-refresh").prop("disabled",true).css("opacity","0.5")});a("#mla-progress-close",b).off("click");a("#mla-progress-close",b).click(function(c){if(mla.bulkMap.inProcess){return false}return mla.inlineMapAttachment.revert()});a('input[type="submit"].mla-mapping').click(function(c){c.preventDefault();return mla.inlineMapAttachment.bulkMap(c.target.name,0)});a('input[type="submit"]#doaction').click(function(f){var d=a("#bulk-action-selector-top").val(),c;if("execute"!==d){return true}c=a('tbody th.check-column input[type="checkbox"]').serializeArray();if(0===c.length){return true}a.each(c,function(e,g){mla.bulkMap.ids[e]=+g.value});f.preventDefault();return mla.inlineMapAttachment.bulkMap("mapping-options-bulk-execute",0)});a('input[type="submit"]#doaction2').click(function(f){var d=a("#bulk-action-selector-bottom").val(),c;if("execute"!==d){return true}c=a('tbody th.check-column input[type="checkbox"]').serializeArray();if(0===c.length){return true}a.each(c,function(e,g){mla.bulkMap.ids[e]=+g.value});f.preventDefault();return mla.inlineMapAttachment.bulkMap("mapping-options-bulk-execute",0)});a("a.execute").click(function(c){c.preventDefault();return mla.inlineMapAttachment.bulkMap(c.target.id,0)})},bulkMap:function(f,c){var e=0,d=0,h=0,g=0,i=0,b=[];c=+c;if(0<c){e=typeof mla.bulkMap.complete==="undefined"?0:mla.bulkMap.complete;d=typeof mla.bulkMap.unchanged==="undefined"?0:mla.bulkMap.unchanged;h=typeof mla.bulkMap.success==="undefined"?0:mla.bulkMap.success;g=typeof mla.bulkMap.skip==="undefined"?0:mla.bulkMap.skip;i=typeof mla.bulkMap.redone==="undefined"?0:mla.bulkMap.redone}if(e<c){g+=c-e}else{if(e>c){i+=e-c}}b=typeof mla.bulkMap.ids==="undefined"?[]:mla.bulkMap.ids;mla.bulkMap={ids:b,inProcess:false,doCancel:false,chunkSize:+mla.settings.bulkChunkSize,targetName:f,fields:a(mla.settings.fieldsId+" :input").serialize(),offset:c,waiting:mla.settings.totalItems-c,running:0,complete:c,unchanged:d,success:h,skip:g,redone:i,refresh:false};mla.inlineMapAttachment.progressOpen();mla.inlineMapAttachment.bulkPost();return false},progressOpen:function(){this.revert();a("#mla-progress-meter").css("width","0%");a("#mla-progress-meter").html("0%");a("#mla-progress-message").html("");a("#mla-progress-error").html("");a("#mla-progress-div").show();a("#mla-progress-pause").prop("disabled",false).css("opacity","1.0").show();a("#mla-progress-cancel").hide();a("#mla-progress-resume").hide();a("#mla-progress-offset").hide();a("#mla-progress-refresh").hide();a("#mla-progress-close").prop("disabled",true).css("opacity","0.5").show();a("html, body").animate({scrollTop:0},"fast")},bulkPost:function(){var g,c,f="",e=a("#mla-progress-div p.inline-edit-save .spinner"),d=a("#mla-progress-message"),b=a("#mla-progress-error");if(mla.bulkMap.waiting<mla.bulkMap.chunkSize){c=mla.bulkMap.waiting}else{c=mla.bulkMap.chunkSize}mla.bulkMap.waiting-=c;mla.bulkMap.running=c;g={page:mla.settings.page,mla_tab:mla.settings.mla_tab,screen:mla.settings.screen,action:mla.settings.ajax_action,mla_admin_nonce:mla.settings.ajax_nonce,bulk_action:mla.bulkMap.targetName,ids:mla.bulkMap.ids,offset:mla.bulkMap.complete,length:c};g=a.param(g)+"&"+mla.bulkMap.fields;mla.bulkMap.inProcess=true;percentComplete=Math.floor((100*mla.bulkMap.complete)/mla.settings.totalItems)+"%";a("#mla-progress-meter").css("width",percentComplete);a("#mla-progress-meter").html(percentComplete);if(0<mla.bulkMap.skip){f+=", "+mla.settings.bulkSkip+": "+mla.bulkMap.skip}if(0<mla.bulkMap.redone){f+=", "+mla.settings.bulkRedone+": "+mla.bulkMap.redone}if(mla.settings.useSpinnerClass){e.addClass("is-active")}else{e.show()}f=mla.settings.bulkWaiting+": "+mla.bulkMap.waiting+", "+mla.settings.bulkRunning+": "+mla.bulkMap.running+", "+mla.settings.bulkComplete+": "+mla.bulkMap.complete+f+", "+mla.settings.bulkUnchanged+": "+mla.bulkMap.unchanged+", "+mla.settings.bulkSuccess+": "+mla.bulkMap.success;d.html(f).show();a.ajax(ajaxurl,{type:"POST",data:g,dataType:"json"}).always(function(){if(mla.settings.useSpinnerClass){e.removeClass("is-active")}else{e.hide()}}).done(function(j,i){var k="no response.data",h="";if(j){if(!j.success){if(j.responseData){k=j.data}b.html(JSON.stringify(j));mla.bulkMap.waiting=0}else{if(0==j.data.processed){h=j.data.message;mla.bulkMap.waiting=0}else{mla.bulkMap.complete+=j.data.processed;mla.bulkMap.running=0;mla.bulkMap.unchanged+=j.data.unchanged;mla.bulkMap.success+=j.data.success;if("undefined"!==typeof j.data.refresh){mla.bulkMap.refresh=j.data.refresh}percentComplete=Math.floor((100*mla.bulkMap.complete)/mla.settings.totalItems)+"%";a("#mla-progress-meter").css("width",percentComplete);a("#mla-progress-meter").html(percentComplete);if(0<mla.bulkMap.skip){h+=", "+mla.settings.bulkSkip+": "+mla.bulkMap.skip}if(0<mla.bulkMap.redone){h+=", "+mla.settings.bulkRedone+": "+mla.bulkMap.redone}h=mla.settings.bulkWaiting+": "+mla.bulkMap.waiting+", "+mla.settings.bulkComplete+": "+mla.bulkMap.complete+h+", "+mla.settings.bulkUnchanged+": "+mla.bulkMap.unchanged+", "+mla.settings.bulkSuccess+": "+mla.bulkMap.success}d.html(h).show()}}else{b.html(mla.settings.error);mla.bulkMap.waiting=0}if(mla.bulkMap.doCancel){d.html(mla.settings.bulkPaused+". "+h).show();a("#mla-progress-pause").hide();a("#mla-progress-cancel").show();a("#mla-progress-resume").show();a("#mla-progress-offset").val(mla.bulkMap.complete).show()}else{if(mla.bulkMap.waiting){mla.inlineMapAttachment.bulkPost();return}}if(mla.bulkMap.refresh){a("#mla-progress-close").hide();a("#mla-progress-refresh").prop("disabled",false).css("opacity","1.0").show()}else{a("#mla-progress-close").prop("disabled",false).css("opacity","1.0")}a("#mla-progress-pause").prop("disabled",true).css("opacity","0.5");mla.bulkMap.inProcess=false}).fail(function(i,h){if(200==i.status){b.html("("+h+") "+i.responseText)}else{b.html(mla.settings.ajaxFailError+" ("+h+"), jqXHR( "+i.status+", "+i.statusText+", "+i.responseText+")")}})},revert:function(){var b=a("#mla-progress-div");if(b){if(mla.settings.useSpinnerClass){a("p.inline-edit-save .spinner",b).removeClass("is-active")}else{a("p.inline-edit-save .spinner",b).hide()}a(b).hide()}return false}};a(document).ready(function(){mla.inlineMapAttachment.init()})})(jQuery);
1
+ var jQuery,mla_inline_mapping_vars,mla={settings:{},bulkMap:{ids:[],inProcess:false,doCancel:false},utility:{},inlineMapAttachment:null};(function(a){mla.settings=typeof mla_inline_mapping_vars==="undefined"?{}:mla_inline_mapping_vars;mla_inline_mapping_vars=void 0;mla.inlineMapAttachment={init:function(){var b=a("#mla-progress-div");a("#mla-progress-pause",b).off("click");a("#mla-progress-pause",b).on("click",function(){if(mla.bulkMap.inProcess){mla.bulkMap.doCancel=true;return false}else{return mla.inlineMapAttachment.revert()}});a("#mla-progress-cancel",b).off("click");a("#mla-progress-cancel",b).on("click",function(){return mla.inlineMapAttachment.revert()});a("#mla-progress-resume",b).off("click");a("#mla-progress-resume",b).on("click",function(){var c=+mla.settings.totalItems,d=+a("#mla-progress-offset").val();if(c<d){d=c}else{if(0>d){d=0}}if(mla.bulkMap.inProcess){mla.bulkMap.doCancel=true;return false}else{return mla.inlineMapAttachment.bulkMap(mla.bulkMap.targetName,d)}});a("#mla-progress-refresh",b).off("click");a("#mla-progress-refresh",b).on("click",function(){a("#mla-progress-refresh").prop("disabled",true).css("opacity","0.5")});a("#mla-progress-close",b).off("click");a("#mla-progress-close",b).on("click",function(c){if(mla.bulkMap.inProcess){return false}return mla.inlineMapAttachment.revert()});a('input[type="submit"].mla-mapping').on("click",function(c){c.preventDefault();return mla.inlineMapAttachment.bulkMap(c.target.name,0)});a('input[type="submit"]#doaction').on("click",function(f){var d=a("#bulk-action-selector-top").val(),c;if("execute"!==d){return true}c=a('tbody th.check-column input[type="checkbox"]').serializeArray();if(0===c.length){return true}a.each(c,function(e,g){mla.bulkMap.ids[e]=+g.value});f.preventDefault();return mla.inlineMapAttachment.bulkMap("mapping-options-bulk-execute",0)});a('input[type="submit"]#doaction2').on("click",function(f){var d=a("#bulk-action-selector-bottom").val(),c;if("execute"!==d){return true}c=a('tbody th.check-column input[type="checkbox"]').serializeArray();if(0===c.length){return true}a.each(c,function(e,g){mla.bulkMap.ids[e]=+g.value});f.preventDefault();return mla.inlineMapAttachment.bulkMap("mapping-options-bulk-execute",0)});a("a.execute").on("click",function(c){c.preventDefault();return mla.inlineMapAttachment.bulkMap(c.target.id,0)})},bulkMap:function(f,c){var e=0,d=0,h=0,g=0,i=0,b=[];c=+c;if(0<c){e=typeof mla.bulkMap.complete==="undefined"?0:mla.bulkMap.complete;d=typeof mla.bulkMap.unchanged==="undefined"?0:mla.bulkMap.unchanged;h=typeof mla.bulkMap.success==="undefined"?0:mla.bulkMap.success;g=typeof mla.bulkMap.skip==="undefined"?0:mla.bulkMap.skip;i=typeof mla.bulkMap.redone==="undefined"?0:mla.bulkMap.redone}if(e<c){g+=c-e}else{if(e>c){i+=e-c}}b=typeof mla.bulkMap.ids==="undefined"?[]:mla.bulkMap.ids;mla.bulkMap={ids:b,inProcess:false,doCancel:false,chunkSize:+mla.settings.bulkChunkSize,targetName:f,fields:a(mla.settings.fieldsId+" :input").serialize(),offset:c,waiting:mla.settings.totalItems-c,running:0,complete:c,unchanged:d,success:h,skip:g,redone:i,refresh:false};mla.inlineMapAttachment.progressOpen();mla.inlineMapAttachment.bulkPost();return false},progressOpen:function(){this.revert();a("#mla-progress-meter").css("width","0%");a("#mla-progress-meter").html("0%");a("#mla-progress-message").html("");a("#mla-progress-error").html("");a("#mla-progress-div").show();a("#mla-progress-pause").prop("disabled",false).css("opacity","1.0").show();a("#mla-progress-cancel").hide();a("#mla-progress-resume").hide();a("#mla-progress-offset").hide();a("#mla-progress-refresh").hide();a("#mla-progress-close").prop("disabled",true).css("opacity","0.5").show();a("html, body").animate({scrollTop:0},"fast")},bulkPost:function(){var g,c,f="",e=a("#mla-progress-div p.inline-edit-save .spinner"),d=a("#mla-progress-message"),b=a("#mla-progress-error");if(mla.bulkMap.waiting<mla.bulkMap.chunkSize){c=mla.bulkMap.waiting}else{c=mla.bulkMap.chunkSize}mla.bulkMap.waiting-=c;mla.bulkMap.running=c;g={page:mla.settings.page,mla_tab:mla.settings.mla_tab,screen:mla.settings.screen,action:mla.settings.ajax_action,mla_admin_nonce:mla.settings.ajax_nonce,bulk_action:mla.bulkMap.targetName,ids:mla.bulkMap.ids,offset:mla.bulkMap.complete,length:c};g=a.param(g)+"&"+mla.bulkMap.fields;mla.bulkMap.inProcess=true;percentComplete=Math.floor((100*mla.bulkMap.complete)/mla.settings.totalItems)+"%";a("#mla-progress-meter").css("width",percentComplete);a("#mla-progress-meter").html(percentComplete);if(0<mla.bulkMap.skip){f+=", "+mla.settings.bulkSkip+": "+mla.bulkMap.skip}if(0<mla.bulkMap.redone){f+=", "+mla.settings.bulkRedone+": "+mla.bulkMap.redone}if(mla.settings.useSpinnerClass){e.addClass("is-active")}else{e.show()}f=mla.settings.bulkWaiting+": "+mla.bulkMap.waiting+", "+mla.settings.bulkRunning+": "+mla.bulkMap.running+", "+mla.settings.bulkComplete+": "+mla.bulkMap.complete+f+", "+mla.settings.bulkUnchanged+": "+mla.bulkMap.unchanged+", "+mla.settings.bulkSuccess+": "+mla.bulkMap.success;d.html(f).show();a.ajax(ajaxurl,{type:"POST",data:g,dataType:"json"}).always(function(){if(mla.settings.useSpinnerClass){e.removeClass("is-active")}else{e.hide()}}).done(function(j,i){var k="no response.data",h="";if(j){if(!j.success){if(j.responseData){k=j.data}b.html(JSON.stringify(j));mla.bulkMap.waiting=0}else{if(0==j.data.processed){h=j.data.message;mla.bulkMap.waiting=0}else{mla.bulkMap.complete+=j.data.processed;mla.bulkMap.running=0;mla.bulkMap.unchanged+=j.data.unchanged;mla.bulkMap.success+=j.data.success;if("undefined"!==typeof j.data.refresh){mla.bulkMap.refresh=j.data.refresh}percentComplete=Math.floor((100*mla.bulkMap.complete)/mla.settings.totalItems)+"%";a("#mla-progress-meter").css("width",percentComplete);a("#mla-progress-meter").html(percentComplete);if(0<mla.bulkMap.skip){h+=", "+mla.settings.bulkSkip+": "+mla.bulkMap.skip}if(0<mla.bulkMap.redone){h+=", "+mla.settings.bulkRedone+": "+mla.bulkMap.redone}h=mla.settings.bulkWaiting+": "+mla.bulkMap.waiting+", "+mla.settings.bulkComplete+": "+mla.bulkMap.complete+h+", "+mla.settings.bulkUnchanged+": "+mla.bulkMap.unchanged+", "+mla.settings.bulkSuccess+": "+mla.bulkMap.success}d.html(h).show()}}else{b.html(mla.settings.error);mla.bulkMap.waiting=0}if(mla.bulkMap.doCancel){d.html(mla.settings.bulkPaused+". "+h).show();a("#mla-progress-pause").hide();a("#mla-progress-cancel").show();a("#mla-progress-resume").show();a("#mla-progress-offset").val(mla.bulkMap.complete).show()}else{if(mla.bulkMap.waiting){mla.inlineMapAttachment.bulkPost();return}}if(mla.bulkMap.refresh){a("#mla-progress-close").hide();a("#mla-progress-refresh").prop("disabled",false).css("opacity","1.0").show()}else{a("#mla-progress-close").prop("disabled",false).css("opacity","1.0")}a("#mla-progress-pause").prop("disabled",true).css("opacity","0.5");mla.bulkMap.inProcess=false}).fail(function(i,h){if(200==i.status){b.html("("+h+") "+i.responseText)}else{b.html(mla.settings.ajaxFailError+" ("+h+"), jqXHR( "+i.status+", "+i.statusText+", "+i.responseText+")")}})},revert:function(){var b=a("#mla-progress-div");if(b){if(mla.settings.useSpinnerClass){a("p.inline-edit-save .spinner",b).removeClass("is-active")}else{a("p.inline-edit-save .spinner",b).hide()}a(b).hide()}return false}};a(document).ready(function(){mla.inlineMapAttachment.init()})})(jQuery);
js/mla-media-modal-scripts.js CHANGED
@@ -104,12 +104,20 @@ var wp, wpAjax, ajaxurl, jQuery, _,
104
  return;
105
  }
106
 
107
- if ( ( 'grid' === mlaModal.settings.screen ) && false === mlaModal.settings.enableMediaGrid ) {
108
- return;
 
 
 
 
109
  }
110
 
111
- if ( ( 'modal' === mlaModal.settings.screen ) && false === mlaModal.settings.enableMediaModal ) {
112
- return;
 
 
 
 
113
  }
114
 
115
  // Toolset Views editor locks uploads to "Uploaded to this post"
@@ -284,7 +292,7 @@ var wp, wpAjax, ajaxurl, jQuery, _,
284
  if ( filter ) {
285
  // silent because we must change the "s" prop before triggering an update
286
  this.model.set( filter.props, { silent: true } );
287
- $( '#mla-search-submit', toolbar ).click();
288
  }
289
  }
290
  });
@@ -390,7 +398,7 @@ var wp, wpAjax, ajaxurl, jQuery, _,
390
  if ( filter ) {
391
  // silent because we must change the "s" prop before triggering an update
392
  this.model.set( filter.props, { silent: true } );
393
- $( '#mla-search-submit', toolbar ).click();
394
  }
395
  }
396
  });
@@ -599,14 +607,14 @@ var wp, wpAjax, ajaxurl, jQuery, _,
599
  }
600
 
601
  mlaModal.settings.query[mlaModal.settings.state].termsSearch = termsSearch;
602
- $( '#mla-search-submit', toolbar ).click();
603
  return false;
604
  });
605
 
606
- $( '#mla-terms-search-input' ).keypress( function( e ){
607
  if ( 13 == e.which ) {
608
  e.preventDefault();
609
- $( '#mla-terms-search-submit' ).click();
610
  }
611
  });
612
  }
@@ -811,69 +819,6 @@ var wp, wpAjax, ajaxurl, jQuery, _,
811
  console.log('toolbarEvent( ) Event: ', eventName);
812
  }, // */
813
 
814
- toolbarContentActivateBrowse: function() {
815
- var toolbarHeight, primaryHeight, secondaryHeight;
816
-
817
- if ( ( null !== this.models ) && this.models.length && ( null !== this.models[0].active ) ) {
818
- mlaModal.settings.$el = this.models[0].frame.$el;
819
-
820
- // Need to find elements with reliable height
821
- secondaryHeight = $( '.attachments-browser .media-toolbar-secondary', mlaModal.settings.$el ).height();
822
- primaryHeight = $( '.media-toolbar-primary .mla-search-box', mlaModal.settings.$el ).height();
823
-
824
- if ( primaryHeight > secondaryHeight ) {
825
- toolbarHeight = primaryHeight;
826
- } else {
827
- toolbarHeight = secondaryHeight;
828
- }
829
-
830
- if ( ( null !== toolbarHeight ) ) {
831
- $( '.attachments-browser .attachments', mlaModal.settings.$el ).css( 'top', toolbarHeight );
832
- mlaModal.settings.oldHeight = toolbarHeight;
833
- }
834
- }
835
- },
836
-
837
- toolbarOpen: function() {
838
- var toolbarHeight, primaryHeight, secondaryHeight;
839
-
840
- if ( ( null !== this.models ) && this.models.length && ( null !== this.models[0].active ) ) {
841
- mlaModal.settings.$el = this.models[0].frame.$el;
842
-
843
- secondaryHeight = $( '.attachments-browser .media-toolbar-secondary', mlaModal.settings.$el ).height();
844
- primaryHeight = $( '.media-toolbar-primary .mla-search-box', mlaModal.settings.$el ).height();
845
-
846
- if ( primaryHeight > secondaryHeight ) {
847
- toolbarHeight = primaryHeight;
848
- } else {
849
- toolbarHeight = secondaryHeight;
850
- }
851
-
852
- if ( ( null !== toolbarHeight ) ) {
853
- $( '.attachments-browser .attachments', mlaModal.settings.$el ).css( 'top', toolbarHeight );
854
- mlaModal.settings.oldHeight = toolbarHeight;
855
- }
856
-
857
- $( window ).resize( function() {
858
- var toolbarHeight, primaryHeight, secondaryHeight;
859
-
860
- secondaryHeight = $( '.attachments-browser .media-toolbar-secondary', mlaModal.settings.$el ).height();
861
- primaryHeight = $( '.media-toolbar-primary .mla-search-box', mlaModal.settings.$el ).height();
862
-
863
- if ( primaryHeight > secondaryHeight ) {
864
- toolbarHeight = primaryHeight;
865
- } else {
866
- toolbarHeight = secondaryHeight;
867
- }
868
-
869
- if ( ( null !== toolbarHeight ) && ( toolbarHeight !== mlaModal.settings.oldHeight ) ) {
870
- $( '.attachments-browser .attachments' ).css( 'top', toolbarHeight );
871
- mlaModal.settings.oldHeight = toolbarHeight;
872
- }
873
- } )
874
- }
875
- },
876
-
877
  createToolbar: function() {
878
  var filters, state = this.controller._state;
879
 
@@ -896,14 +841,8 @@ this.controller.on( 'all', this.toolbarEvent );
896
  console.log( 'listening to controller events' );
897
  // */
898
 
899
- mlaModal.settings.oldHeight = 0;
900
- this.controller.on( 'open', this.toolbarOpen );
901
- this.controller.on( 'content:activate:browse', this.toolbarContentActivateBrowse );
902
-
903
- // Enhanced Media Library (eml) plugin has CSS styles that require this patch
904
- if ( typeof window.eml !== "undefined" ) {
905
- $( '.media-toolbar', this.$el ).css( 'overflow', 'hidden' );
906
- }
907
 
908
  if ( ( 'all' === filters ) && mlaModal.settings.enableMimeTypes ) {
909
  this.toolbar.unset( 'filters', { silent: true } );
@@ -958,7 +897,7 @@ console.log( 'listening to controller events' );
958
  this.toolbar.set( 'MlaSearch', new wp.media.view.MlaSearch({
959
  controller: this.controller,
960
  model: this.collection.props,
961
- priority: 60
962
  }).render() );
963
  } else {
964
  this.toolbar.set( 'MlaSearch', new wp.media.view.MlaSearch({
@@ -1216,7 +1155,7 @@ console.log( 'listening to controller events' );
1216
  xbutton = $( '<a id="' + id + '-check-num-' + key + '" class="ntdelbutton">X</a>' );
1217
  }
1218
 
1219
- xbutton.click( function(){ mlaModal.tagBox.parseTags( this ); });
1220
  element.prepend( '&nbsp;' ).prepend( xbutton );
1221
  }
1222
 
@@ -1265,7 +1204,7 @@ console.log( 'listening to controller events' );
1265
  }
1266
 
1267
  r = $( '<p id="tagcloud-'+taxonomy+'" class="the-tagcloud">'+r+'</p>' );
1268
- $( 'a', r ).click( function(){
1269
  mlaModal.tagBox.flushTags( $( this ).closest( '.mla-taxonomy-field' ).children( '.tagsdiv' ), this );
1270
  return false;
1271
  });
@@ -1281,16 +1220,16 @@ console.log( 'listening to controller events' );
1281
 
1282
  mlaModal.tagBox.quickClicks( tagsDiv );
1283
 
1284
- $( 'input.tagadd', ajaxTag ).click(function(){
1285
  mlaModal.tagBox.flushTags( $(this).closest( '.tagsdiv' ) );
1286
  });
1287
 
1288
- $( 'input.newtag', ajaxTag ).keyup( function( e ){
1289
  if ( 13 == e.which ) {
1290
  mlaModal.tagBox.flushTags( tagsDiv );
1291
  return false;
1292
  }
1293
- }).keypress( function( e ){
1294
  if ( 13 == e.which ) {
1295
  e.preventDefault();
1296
  return false;
@@ -1300,9 +1239,9 @@ console.log( 'listening to controller events' );
1300
  });
1301
 
1302
  // get the tag cloud on first click, then toggle visibility
1303
- tagsDiv.siblings( ':first' ).click( function(){
1304
  mlaModal.tagBox.getCloud( $( 'a', this ).attr( 'id' ), taxonomy );
1305
- $( 'a', this ).unbind().click( function(){
1306
  $( this ).siblings( '.the-tagcloud' ).toggle();
1307
  return false;
1308
  });
@@ -1485,7 +1424,7 @@ this.listenTo( this, 'all', this.selectionEvent );
1485
 
1486
  if ( -1 != mlaModal.settings.enhancedTaxonomies.indexOf( taxonomy ) ) {
1487
  // Load the taxonomy checklists on first expansion
1488
- $( '.compat-field-' + taxonomy + ' th', context ).click( { id: attachmentId, currentTaxonomy: taxonomy, el: context }, function( event ) {
1489
  mlaModal.utility.fillCompatTaxonomies( event.data );
1490
  });
1491
 
@@ -1516,7 +1455,7 @@ this.listenTo( this, 'all', this.selectionEvent );
1516
 
1517
  if ( -1 != mlaModal.settings.enhancedTaxonomies.indexOf( taxonomy ) ) {
1518
  // Load the taxonomy checklists on first expansion
1519
- $( '.compat-field-' + taxonomy + ' th', context ).click( { id: attachmentId, currentTaxonomy: taxonomy, el: context }, function( event ) {
1520
  mlaModal.utility.fillCompatTaxonomies( event.data );
1521
  });
1522
 
@@ -1543,7 +1482,7 @@ this.listenTo( this, 'all', this.selectionEvent );
1543
  });
1544
 
1545
  if ( mlaModal.settings.enableTermsAutofill && null !== clickTaxonomy ) {
1546
- $( '.compat-field-' + clickTaxonomy + ' th', context ).click();
1547
  }
1548
  };
1549
 
@@ -1637,7 +1576,7 @@ this.listenTo( this, 'all', this.selectionEvent );
1637
  thisJQuery.find( '.category-tabs' ).show();
1638
 
1639
  // Expand/collapse the meta box contents
1640
- $( '.compat-field-' + taxonomy + ' th', context ).click( function() {
1641
  $(this).siblings( 'td' ).slideToggle();
1642
  });
1643
 
@@ -1695,7 +1634,7 @@ this.listenTo( this, 'all', this.selectionEvent );
1695
  */
1696
 
1697
  // Switch between "All ..." and "Most Used"
1698
- thisJQuery.find( taxonomyIdPrefix + '-tabs a' ).click( function(){
1699
  var t = $(this).attr('href');
1700
  $(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
1701
  thisJQuery.find( taxonomyIdPrefix + '-tabs' ).siblings('.tabs-panel').hide();
@@ -1714,14 +1653,14 @@ this.listenTo( this, 'all', this.selectionEvent );
1714
 
1715
  // Reflect tab selection remembered in cookie
1716
  if ( getUserSetting( settingName ) ) {
1717
- thisJQuery.find( taxonomyIdPrefix + '-tabs a[href="#mla-' + taxonomy + '-pop"]' ).click();
1718
  }
1719
 
1720
  // Toggle the "Add New ..." sub panel
1721
- thisJQuery.find( taxonomyIdPrefix + '-add-toggle' ).click( function() {
1722
  thisJQuery.find( taxonomyIdPrefix + '-searcher' ).addClass( 'mla-hidden-children' );
1723
  thisJQuery.find( taxonomyIdPrefix + '-adder' ).toggleClass( 'mla-hidden-children' );
1724
- thisJQuery.find( taxonomyIdPrefix + '-tabs a[href="#mla-' + taxonomy + '-all"]' ).click();
1725
 
1726
  thisJQuery.find( taxonomyIdPrefix + '-checklist li' ).show();
1727
  thisJQuery.find( taxonomyIdPrefix + '-checklist-pop li' ).show();
@@ -1734,14 +1673,14 @@ this.listenTo( this, 'all', this.selectionEvent );
1734
  });
1735
 
1736
  // Convert "Enter" key to a click
1737
- thisJQuery.find( taxonomyNewIdSelector ).keypress( function(event){
1738
  if( 13 === event.keyCode ) {
1739
  event.preventDefault();
1740
- thisJQuery.find( taxonomyIdPrefix + '-add-submit' ).click();
1741
  }
1742
  });
1743
 
1744
- thisJQuery.find( taxonomyIdPrefix + '-add-submit' ).click( function(){
1745
  thisJQuery.find( taxonomyNewIdSelector ).focus();
1746
  });
1747
 
@@ -1788,13 +1727,13 @@ this.listenTo( this, 'all', this.selectionEvent );
1788
  /*
1789
  * Searchable meta box code from mla-edit-media-scripts.js
1790
  */
1791
- $.extend( $.expr[":"], {
1792
  "matchTerms": function( elem, i, match, array ) {
1793
  return ( elem.textContent || elem.innerText || "" ).toLowerCase().indexOf( ( match[3] || "" ).toLowerCase() ) >= 0;
1794
  }
1795
  });
1796
 
1797
- thisJQuery.find( taxonomySearchIdSelector ).keypress( function( event ){
1798
  // Enter key cancels the filter and closes the search field
1799
  if( 13 === event.keyCode ) {
1800
  event.preventDefault();
@@ -1808,7 +1747,7 @@ this.listenTo( this, 'all', this.selectionEvent );
1808
 
1809
  } );
1810
 
1811
- thisJQuery.find( taxonomySearchIdSelector ).keyup( function( event ){
1812
  var searchValue, termList, termListPopular, matchingTerms, matchingTermsPopular;
1813
 
1814
  // keyup happens after keypress; change the focus if the text box has been closed
@@ -1840,10 +1779,10 @@ this.listenTo( this, 'all', this.selectionEvent );
1840
  } );
1841
 
1842
  // Toggle the "Search" sub panel
1843
- thisJQuery.find( taxonomyIdPrefix + '-search-toggle' ).click( function() {
1844
  thisJQuery.find( taxonomyIdPrefix + '-adder ').addClass( 'mla-hidden-children' );
1845
  thisJQuery.find( taxonomyIdPrefix + '-searcher' ).toggleClass( 'mla-hidden-children' );
1846
- thisJQuery.find( taxonomyIdPrefix + '-tabs a[href="#mla-' + taxonomy + '-all"]' ).click();
1847
 
1848
  thisJQuery.find( taxonomyIdPrefix + '-checklist li' ).show();
1849
  thisJQuery.find( taxonomyIdPrefix + '-checklist-pop li' ).show();
@@ -1863,7 +1802,7 @@ this.listenTo( this, 'all', this.selectionEvent );
1863
  var taxonomy = mlaModal.utility.parseTaxonomyId( $(this).attr('id') );
1864
 
1865
  // Expand/collapse the meta box contents
1866
- $( '.compat-field-' + taxonomy + ' th', context ).click( function() {
1867
  $(this).siblings( 'td' ).slideToggle();
1868
  });
1869
 
104
  return;
105
  }
106
 
107
+ if ( 'grid' === mlaModal.settings.screen ) {
108
+ if ( false === mlaModal.settings.enableMediaGrid ) {
109
+ return;
110
+ }
111
+
112
+ $('body').addClass('mla-media-grid');
113
  }
114
 
115
+ if ( 'modal' === mlaModal.settings.screen ) {
116
+ if ( false === mlaModal.settings.enableMediaModal ) {
117
+ return;
118
+ }
119
+
120
+ $('body').addClass('mla-media-modal');
121
  }
122
 
123
  // Toolset Views editor locks uploads to "Uploaded to this post"
292
  if ( filter ) {
293
  // silent because we must change the "s" prop before triggering an update
294
  this.model.set( filter.props, { silent: true } );
295
+ $( '#mla-search-submit', toolbar ).trigger('click');
296
  }
297
  }
298
  });
398
  if ( filter ) {
399
  // silent because we must change the "s" prop before triggering an update
400
  this.model.set( filter.props, { silent: true } );
401
+ $( '#mla-search-submit', toolbar ).trigger('click');
402
  }
403
  }
404
  });
607
  }
608
 
609
  mlaModal.settings.query[mlaModal.settings.state].termsSearch = termsSearch;
610
+ $( '#mla-search-submit', toolbar ).trigger('click');
611
  return false;
612
  });
613
 
614
+ $( '#mla-terms-search-input' ).on( 'keypress', function( e ){
615
  if ( 13 == e.which ) {
616
  e.preventDefault();
617
+ $( '#mla-terms-search-submit' ).trigger('click');
618
  }
619
  });
620
  }
819
  console.log('toolbarEvent( ) Event: ', eventName);
820
  }, // */
821
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
822
  createToolbar: function() {
823
  var filters, state = this.controller._state;
824
 
841
  console.log( 'listening to controller events' );
842
  // */
843
 
844
+ // Suppress the "Filter Media" heading
845
+ $( '.media-attachments-filter-heading', this.$el ).css( 'display', 'none' );
 
 
 
 
 
 
846
 
847
  if ( ( 'all' === filters ) && mlaModal.settings.enableMimeTypes ) {
848
  this.toolbar.unset( 'filters', { silent: true } );
897
  this.toolbar.set( 'MlaSearch', new wp.media.view.MlaSearch({
898
  controller: this.controller,
899
  model: this.collection.props,
900
+ priority: -40
901
  }).render() );
902
  } else {
903
  this.toolbar.set( 'MlaSearch', new wp.media.view.MlaSearch({
1155
  xbutton = $( '<a id="' + id + '-check-num-' + key + '" class="ntdelbutton">X</a>' );
1156
  }
1157
 
1158
+ xbutton.on( 'click', function(){ mlaModal.tagBox.parseTags( this ); });
1159
  element.prepend( '&nbsp;' ).prepend( xbutton );
1160
  }
1161
 
1204
  }
1205
 
1206
  r = $( '<p id="tagcloud-'+taxonomy+'" class="the-tagcloud">'+r+'</p>' );
1207
+ $( 'a', r ).on( 'click', function(){
1208
  mlaModal.tagBox.flushTags( $( this ).closest( '.mla-taxonomy-field' ).children( '.tagsdiv' ), this );
1209
  return false;
1210
  });
1220
 
1221
  mlaModal.tagBox.quickClicks( tagsDiv );
1222
 
1223
+ $( 'input.tagadd', ajaxTag ).on( 'click', function(){
1224
  mlaModal.tagBox.flushTags( $(this).closest( '.tagsdiv' ) );
1225
  });
1226
 
1227
+ $( 'input.newtag', ajaxTag ).on( 'keyup', function( e ){
1228
  if ( 13 == e.which ) {
1229
  mlaModal.tagBox.flushTags( tagsDiv );
1230
  return false;
1231
  }
1232
+ }).on( 'keypress', function( e ){
1233
  if ( 13 == e.which ) {
1234
  e.preventDefault();
1235
  return false;
1239
  });
1240
 
1241
  // get the tag cloud on first click, then toggle visibility
1242
+ tagsDiv.siblings( ':first' ).on( 'click', function(){
1243
  mlaModal.tagBox.getCloud( $( 'a', this ).attr( 'id' ), taxonomy );
1244
+ $( 'a', this ).unbind().on( 'click', function(){
1245
  $( this ).siblings( '.the-tagcloud' ).toggle();
1246
  return false;
1247
  });
1424
 
1425
  if ( -1 != mlaModal.settings.enhancedTaxonomies.indexOf( taxonomy ) ) {
1426
  // Load the taxonomy checklists on first expansion
1427
+ $( '.compat-field-' + taxonomy + ' th', context ).on( 'click', { id: attachmentId, currentTaxonomy: taxonomy, el: context }, function( event ) {
1428
  mlaModal.utility.fillCompatTaxonomies( event.data );
1429
  });
1430
 
1455
 
1456
  if ( -1 != mlaModal.settings.enhancedTaxonomies.indexOf( taxonomy ) ) {
1457
  // Load the taxonomy checklists on first expansion
1458
+ $( '.compat-field-' + taxonomy + ' th', context ).on( 'click', { id: attachmentId, currentTaxonomy: taxonomy, el: context }, function( event ) {
1459
  mlaModal.utility.fillCompatTaxonomies( event.data );
1460
  });
1461
 
1482
  });
1483
 
1484
  if ( mlaModal.settings.enableTermsAutofill && null !== clickTaxonomy ) {
1485
+ $( '.compat-field-' + clickTaxonomy + ' th', context ).trigger('click');
1486
  }
1487
  };
1488
 
1576
  thisJQuery.find( '.category-tabs' ).show();
1577
 
1578
  // Expand/collapse the meta box contents
1579
+ $( '.compat-field-' + taxonomy + ' th', context ).on( 'click', function() {
1580
  $(this).siblings( 'td' ).slideToggle();
1581
  });
1582
 
1634
  */
1635
 
1636
  // Switch between "All ..." and "Most Used"
1637
+ thisJQuery.find( taxonomyIdPrefix + '-tabs a' ).on( 'click', function(){
1638
  var t = $(this).attr('href');
1639
  $(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
1640
  thisJQuery.find( taxonomyIdPrefix + '-tabs' ).siblings('.tabs-panel').hide();
1653
 
1654
  // Reflect tab selection remembered in cookie
1655
  if ( getUserSetting( settingName ) ) {
1656
+ thisJQuery.find( taxonomyIdPrefix + '-tabs a[href="#mla-' + taxonomy + '-pop"]' ).trigger('click');
1657
  }
1658
 
1659
  // Toggle the "Add New ..." sub panel
1660
+ thisJQuery.find( taxonomyIdPrefix + '-add-toggle' ).on( 'click', function() {
1661
  thisJQuery.find( taxonomyIdPrefix + '-searcher' ).addClass( 'mla-hidden-children' );
1662
  thisJQuery.find( taxonomyIdPrefix + '-adder' ).toggleClass( 'mla-hidden-children' );
1663
+ thisJQuery.find( taxonomyIdPrefix + '-tabs a[href="#mla-' + taxonomy + '-all"]' ).trigger('click');
1664
 
1665
  thisJQuery.find( taxonomyIdPrefix + '-checklist li' ).show();
1666
  thisJQuery.find( taxonomyIdPrefix + '-checklist-pop li' ).show();
1673
  });
1674
 
1675
  // Convert "Enter" key to a click
1676
+ thisJQuery.find( taxonomyNewIdSelector ).on( 'keypress', function(event){
1677
  if( 13 === event.keyCode ) {
1678
  event.preventDefault();
1679
+ thisJQuery.find( taxonomyIdPrefix + '-add-submit' ).trigger('click');
1680
  }
1681
  });
1682
 
1683
+ thisJQuery.find( taxonomyIdPrefix + '-add-submit' ).on( 'click', function(){
1684
  thisJQuery.find( taxonomyNewIdSelector ).focus();
1685
  });
1686
 
1727
  /*
1728
  * Searchable meta box code from mla-edit-media-scripts.js
1729
  */
1730
+ $.extend( $.expr.pseudos || $.expr[":"], {
1731
  "matchTerms": function( elem, i, match, array ) {
1732
  return ( elem.textContent || elem.innerText || "" ).toLowerCase().indexOf( ( match[3] || "" ).toLowerCase() ) >= 0;
1733
  }
1734
  });
1735
 
1736
+ thisJQuery.find( taxonomySearchIdSelector ).on( 'keypress', function( event ){
1737
  // Enter key cancels the filter and closes the search field
1738
  if( 13 === event.keyCode ) {
1739
  event.preventDefault();
1747
 
1748
  } );
1749
 
1750
+ thisJQuery.find( taxonomySearchIdSelector ).on( 'keyup', function( event ){
1751
  var searchValue, termList, termListPopular, matchingTerms, matchingTermsPopular;
1752
 
1753
  // keyup happens after keypress; change the focus if the text box has been closed
1779
  } );
1780
 
1781
  // Toggle the "Search" sub panel
1782
+ thisJQuery.find( taxonomyIdPrefix + '-search-toggle' ).on( 'click', function() {
1783
  thisJQuery.find( taxonomyIdPrefix + '-adder ').addClass( 'mla-hidden-children' );
1784
  thisJQuery.find( taxonomyIdPrefix + '-searcher' ).toggleClass( 'mla-hidden-children' );
1785
+ thisJQuery.find( taxonomyIdPrefix + '-tabs a[href="#mla-' + taxonomy + '-all"]' ).trigger('click');
1786
 
1787
  thisJQuery.find( taxonomyIdPrefix + '-checklist li' ).show();
1788
  thisJQuery.find( taxonomyIdPrefix + '-checklist-pop li' ).show();
1802
  var taxonomy = mlaModal.utility.parseTaxonomyId( $(this).attr('id') );
1803
 
1804
  // Expand/collapse the meta box contents
1805
+ $( '.compat-field-' + taxonomy + ' th', context ).on( 'click', function() {
1806
  $(this).siblings( 'td' ).slideToggle();
1807
  });
1808
 
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,l;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;if(d(document.activeElement).hasClass("acf-button")){l=d(document.activeElement).parentsUntil("div.acf-fields");if(l.length){g.data.query._acfuploader=d(l[l.length-1]).attr("data-key")}}}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({toolbarContentActivateBrowse:function(){var g,e,f;if((null!==this.models)&&this.models.length&&(null!==this.models[0].active)){mlaModal.settings.$el=this.models[0].frame.$el;f=d(".attachments-browser .media-toolbar-secondary",mlaModal.settings.$el).height();e=d(".media-toolbar-primary .mla-search-box",mlaModal.settings.$el).height();if(e>f){g=e}else{g=f}if((null!==g)){d(".attachments-browser .attachments",mlaModal.settings.$el).css("top",g);mlaModal.settings.oldHeight=g}}},toolbarOpen:function(){var g,e,f;if((null!==this.models)&&this.models.length&&(null!==this.models[0].active)){mlaModal.settings.$el=this.models[0].frame.$el;f=d(".attachments-browser .media-toolbar-secondary",mlaModal.settings.$el).height();e=d(".media-toolbar-primary .mla-search-box",mlaModal.settings.$el).height();if(e>f){g=e}else{g=f}if((null!==g)){d(".attachments-browser .attachments",mlaModal.settings.$el).css("top",g);mlaModal.settings.oldHeight=g}d(window).resize(function(){var j,h,i;i=d(".attachments-browser .media-toolbar-secondary",mlaModal.settings.$el).height();h=d(".media-toolbar-primary .mla-search-box",mlaModal.settings.$el).height();if(h>i){j=h}else{j=i}if((null!==j)&&(j!==mlaModal.settings.oldHeight)){d(".attachments-browser .attachments").css("top",j);mlaModal.settings.oldHeight=j}})}},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);this.controller.on("content:activate:browse",this.toolbarContentActivateBrowse);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,"#mla-taxonomy-"+i).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){if(false===mlaModal.settings.enableMediaGrid){return}d("body").addClass("mla-media-grid")}if("modal"===mlaModal.settings.screen){if(false===mlaModal.settings.enableMediaModal){return}d("body").addClass("mla-media-modal")}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,l;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;if(d(document.activeElement).hasClass("acf-button")){l=d(document.activeElement).parentsUntil("div.acf-fields");if(l.length){g.data.query._acfuploader=d(l[l.length-1]).attr("data-key")}}}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).trigger("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).trigger("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).trigger("click");return false});d("#mla-terms-search-input").on("keypress",function(g){if(13==g.which){g.preventDefault();d("#mla-terms-search-submit").trigger("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({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;d(".media-attachments-filter-heading",this.$el).css("display","none");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:-40}).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.on("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).on("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).on("click",function(){mlaModal.tagBox.flushTags(d(this).closest(".tagsdiv"))});d("input.newtag",f).on("keyup",function(j){if(13==j.which){mlaModal.tagBox.flushTags(h);return false}}).on("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").on("click",function(){mlaModal.tagBox.getCloud(d("a",this).attr("id"),e);d("a",this).unbind().on("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).on("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).on("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).trigger("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).on("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").on("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"]').trigger("click")}j.find(l+"-add-toggle").on("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"]').trigger("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).on("keypress",function(q){if(13===q.keyCode){q.preventDefault();j.find(l+"-add-submit").trigger("click")}});j.find(l+"-add-submit").on("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,"#mla-taxonomy-"+i).prop("checked",s)}});d.extend(d.expr.pseudos||d.expr[":"],{matchTerms:function(s,r,q,t){return(s.textContent||s.innerText||"").toLowerCase().indexOf((q[3]||"").toLowerCase())>=0}});j.find(o).on("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).on("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").on("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"]').trigger("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).on("click",function(){d(this).siblings("td").slideToggle()});mlaModal.tagBox.init(f,h,e)})}}}(jQuery));
js/mla-polylang-support-scripts.js CHANGED
@@ -41,20 +41,20 @@ var jQuery,
41
  t.what = '#attachment-';
42
 
43
  // prepare the quick-translate row
44
- qtRow.keyup( function( e ){
45
  if ( e.which == 27 )
46
  return mlaPolylang.inlineTranslate.revert();
47
  });
48
 
49
- $( 'a.cancel', qtRow ).click( function(){
50
  return mlaPolylang.inlineTranslate.revert();
51
  });
52
 
53
- $( 'a.save', qtRow ).click( function(){
54
  return mlaPolylang.inlineTranslate.save( this );
55
  });
56
 
57
- $( 'td', qtRow ).keydown( function(e){
58
  if ( e.which == 13 )
59
  return mlaPolylang.inlineTranslate.save( this );
60
  });
@@ -80,16 +80,16 @@ var jQuery,
80
  });
81
 
82
  // prepare the bulk-translate row
83
- btRow.keyup( function( e ){
84
  if ( e.which == 27 )
85
  return mlaPolylang.inlineTranslate.revert();
86
  });
87
 
88
- $( 'a.cancel', btRow ).click( function(){
89
  return mlaPolylang.inlineTranslate.revert();
90
  });
91
 
92
- $( '#doaction, #doaction2' ).click( function( e ){
93
  var n = $( this ).attr( 'id' ).substr( 2 );
94
 
95
  if ( $( 'select[name="'+n+'"]' ).val() == 'pll-translate' ) {
@@ -101,7 +101,7 @@ var jQuery,
101
  });
102
 
103
  // Filter button (dates, categories) in top nav bar
104
- $( '#post-query-submit' ).mousedown( function(){
105
  t.revert();
106
  $( 'select[name^="action"]' ).val( '-1' );
107
  });
@@ -142,7 +142,7 @@ var jQuery,
142
 
143
  // Populate the list of selected items
144
  $( '#pll-bulk-titles' ).html( te );
145
- $( '#pll-bulk-titles a' ).click(function(){
146
  var id = $( this ).attr( 'id' ).substr( 1 );
147
 
148
  $( 'table.widefat input[value="' + id + '"]' ).prop( 'checked', false );
@@ -152,14 +152,14 @@ var jQuery,
152
  // Capture Language links
153
  $( '#pll-bulk-translate .pll-media-action-table tr' ).each( function ( idx ){
154
  //$( '.pll-media-action-column a', this ).off( 'click' );
155
- $( '.pll-media-action-column a', this ).click( function( e ){
156
  var bulkLanguage = $( this ).attr( 'pll_bulk_language' );
157
 
158
  $( ':input[name="pll_bulk_language"]', '#pll-bulk-translate' ).val( bulkLanguage );
159
  $( '#pll-bulk-translate .pll-media-action-table a' ).prop( 'disabled', true );
160
  $( '#pll-bulk-translate' ).css( 'opacity', '0.5' );
161
  $( this ).hide();
162
- return $( '#pll-bulk-translate-submit', '#pll-bulk-translate' ).click();
163
  });
164
  });
165
 
@@ -200,7 +200,7 @@ var jQuery,
200
  }
201
 
202
  $( '.pll-media-action-column a', this ).off( 'click' );
203
- $( '.pll-media-action-column a', this ).click( function( e ){
204
  var quickLanguage = $( this ).attr( 'pll_quick_language' ), quickId = $( this ).attr( 'pll_quick_id' );
205
 
206
  $( ':input[name="pll_quick_language"]', translateRow ).val( quickLanguage );
@@ -263,7 +263,7 @@ var jQuery,
263
  }
264
 
265
  $( '.pll-media-action-column a', this ).off( 'click' );
266
- $( '.pll-media-action-column a', this ).click( function( e ){
267
  var quickLanguage = $( this ).attr( 'pll_quick_language' ), quickId = $( this ).attr( 'pll_quick_id' );
268
 
269
  $( ':input[name="pll_quick_language"]', translateRow ).val( quickLanguage );
@@ -345,7 +345,7 @@ var jQuery,
345
 
346
  // Quick Edit a new selected item
347
  if ( newId != id ) {
348
- $( 'a.editinline', mlaPolylang.inlineTranslate.what + newId ).click();
349
  }
350
  } else {
351
  response = response.replace( /<.[^<>]*?>/g, '' );
41
  t.what = '#attachment-';
42
 
43
  // prepare the quick-translate row
44
+ qtRow.on( 'keyup', function( e ){
45
  if ( e.which == 27 )
46
  return mlaPolylang.inlineTranslate.revert();
47
  });
48
 
49
+ $( 'a.cancel', qtRow ).on( 'click', function(){
50
  return mlaPolylang.inlineTranslate.revert();
51
  });
52
 
53
+ $( 'a.save', qtRow ).on( 'click', function(){
54
  return mlaPolylang.inlineTranslate.save( this );
55
  });
56
 
57
+ $( 'td', qtRow ).on( 'keydown', function(e){
58
  if ( e.which == 13 )
59
  return mlaPolylang.inlineTranslate.save( this );
60
  });
80
  });
81
 
82
  // prepare the bulk-translate row
83
+ btRow.on( 'keyup', function( e ){
84
  if ( e.which == 27 )
85
  return mlaPolylang.inlineTranslate.revert();
86
  });
87
 
88
+ $( 'a.cancel', btRow ).on( 'click', function(){
89
  return mlaPolylang.inlineTranslate.revert();
90
  });
91
 
92
+ $( '#doaction, #doaction2' ).on( 'click', function( e ){
93
  var n = $( this ).attr( 'id' ).substr( 2 );
94
 
95
  if ( $( 'select[name="'+n+'"]' ).val() == 'pll-translate' ) {
101
  });
102
 
103
  // Filter button (dates, categories) in top nav bar
104
+ $( '#post-query-submit' ).on( 'mousedown', function(){
105
  t.revert();
106
  $( 'select[name^="action"]' ).val( '-1' );
107
  });
142
 
143
  // Populate the list of selected items
144
  $( '#pll-bulk-titles' ).html( te );
145
+ $( '#pll-bulk-titles a' ).on( 'click', function(){
146
  var id = $( this ).attr( 'id' ).substr( 1 );
147
 
148
  $( 'table.widefat input[value="' + id + '"]' ).prop( 'checked', false );
152
  // Capture Language links
153
  $( '#pll-bulk-translate .pll-media-action-table tr' ).each( function ( idx ){
154
  //$( '.pll-media-action-column a', this ).off( 'click' );
155
+ $( '.pll-media-action-column a', this ).on( 'click', function( e ){
156
  var bulkLanguage = $( this ).attr( 'pll_bulk_language' );
157
 
158
  $( ':input[name="pll_bulk_language"]', '#pll-bulk-translate' ).val( bulkLanguage );
159
  $( '#pll-bulk-translate .pll-media-action-table a' ).prop( 'disabled', true );
160
  $( '#pll-bulk-translate' ).css( 'opacity', '0.5' );
161
  $( this ).hide();
162
+ return $( '#pll-bulk-translate-submit', '#pll-bulk-translate' ).trigger('click');
163
  });
164
  });
165
 
200
  }
201
 
202
  $( '.pll-media-action-column a', this ).off( 'click' );
203
+ $( '.pll-media-action-column a', this ).on( 'click', function( e ){
204
  var quickLanguage = $( this ).attr( 'pll_quick_language' ), quickId = $( this ).attr( 'pll_quick_id' );
205
 
206
  $( ':input[name="pll_quick_language"]', translateRow ).val( quickLanguage );
263
  }
264
 
265
  $( '.pll-media-action-column a', this ).off( 'click' );
266
+ $( '.pll-media-action-column a', this ).on( 'click', function( e ){
267
  var quickLanguage = $( this ).attr( 'pll_quick_language' ), quickId = $( this ).attr( 'pll_quick_id' );
268
 
269
  $( ':input[name="pll_quick_language"]', translateRow ).val( quickLanguage );
345
 
346
  // Quick Edit a new selected item
347
  if ( newId != id ) {
348
+ $( 'a.editinline', mlaPolylang.inlineTranslate.what + newId ).trigger('click');
349
  }
350
  } else {
351
  response = response.replace( /<.[^<>]*?>/g, '' );
js/mla-polylang-support-scripts.min.js CHANGED
@@ -1 +1 @@
1
- var jQuery,mla_polylang_support_vars,mlaPolylang={settings:{},utility:{getId:function(b){var c=jQuery(b).closest("tr").attr("id"),a=c.split("-");return a[a.length-1]}},inlineTranslate:null};(function(a){mlaPolylang.settings=typeof mla_polylang_support_vars==="undefined"?{}:mla_polylang_support_vars;mla_polylang_support_vars=void 0;mlaPolylang.inlineTranslate={init:function(){var c=this,d=a("#pll-quick-translate"),b=a("#pll-bulk-translate");c.type="attachment";c.what="#attachment-";d.keyup(function(f){if(f.which==27){return mlaPolylang.inlineTranslate.revert()}});a("a.cancel",d).click(function(){return mlaPolylang.inlineTranslate.revert()});a("a.save",d).click(function(){return mlaPolylang.inlineTranslate.save(this)});a("td",d).keydown(function(f){if(f.which==13){return mlaPolylang.inlineTranslate.save(this)}});a("#the-list").on("click","a.inlineTranslate",function(){mlaPolylang.inlineTranslate.edit(this);return false});a("#the-list").on("click","a.editinline",function(){a(".quick-edit-row").one("focusin",function(){mlaPolylang.inlineTranslate.openQuickEdit(this);return false});return false});b.keyup(function(f){if(f.which==27){return mlaPolylang.inlineTranslate.revert()}});a("a.cancel",b).click(function(){return mlaPolylang.inlineTranslate.revert()});a("#doaction, #doaction2").click(function(f){var g=a(this).attr("id").substr(2);if(a('select[name="'+g+'"]').val()=="pll-translate"){f.preventDefault();c.openBulkTranslate()}else{if(a("form#posts-filter tr.inline-translator").length>0){c.revert()}}});a("#post-query-submit").mousedown(function(){c.revert();a('select[name^="action"]').val("-1")})},toggle:function(c){var b=this;if("none"==a(b.what+mlaPolylang.utility.getId(c)).css("display")){b.revert()}else{b.edit(c)}},openBulkTranslate:function(){var b="",d=true;this.revert();a("#pll-bulk-translate td").attr("colspan",a("th:visible, td:visible",".widefat:first thead").length);a("table.widefat tbody").prepend(a("#pll-bulk-translate"));a("#pll-bulk-translate").addClass("inline-translator").show();a('tbody th.check-column input[type="checkbox"]').each(function(){if(a(this).prop("checked")){d=false;var e=a(this).val(),c;c=a("#inline_"+e+" .post_title").text()||mlaPolylang.settings.noTitle;b+='<div id="ttle'+e+'"><a id="_'+e+'" class="ntdelbutton" title="'+mlaPolylang.settings.ntdelTitle+'">X</a>'+c+"</div>"}});if(d){return this.revert()}a("#pll-bulk-titles").html(b);a("#pll-bulk-titles a").click(function(){var c=a(this).attr("id").substr(1);a('table.widefat input[value="'+c+'"]').prop("checked",false);a("#ttle"+c).remove()});a("#pll-bulk-translate .pll-media-action-table tr").each(function(c){a(".pll-media-action-column a",this).click(function(g){var f=a(this).attr("pll_bulk_language");a(':input[name="pll_bulk_language"]',"#pll-bulk-translate").val(f);a("#pll-bulk-translate .pll-media-action-table a").prop("disabled",true);a("#pll-bulk-translate").css("opacity","0.5");a(this).hide();return a("#pll-bulk-translate-submit","#pll-bulk-translate").click()})});a("html, body").animate({scrollTop:0},"fast")},openQuickEdit:function(e){var d,b,c;if(typeof(e)=="object"){e=mlaPolylang.utility.getId(e)}d=a("#edit-"+e);c=a(':input[name="old_lang"]',d).val();b=JSON.parse(a(':input[name="inline_translations"]',d).val());a(".pll-media-action-table tr",d).each(function(f){var h=a(this).attr("class").split("-"),g=h[h.length-1];if(g===c){a(".pll-media-action-column input",this).val(b[g]);a(this).hide()}else{if("undefined"!=typeof b[g]){a(".pll-media-action-column input",this).val(b[g]);a(".pll-media-action-column a",this).addClass("pll_icon_edit");a(".pll-media-action-column a",this).attr("title",mlaPolylang.settings.edit);a(".pll-media-action-column a",this).attr("pll_quick_language",g);a(".pll-media-action-column a",this).attr("pll_quick_id",b[g])}else{a(".pll-media-action-column input",this).val(0);a(".pll-media-action-column a",this).addClass("pll_icon_add");a(".pll-media-action-column a",this).attr("title",mlaPolylang.settings.addNew);a(".pll-media-action-column a",this).attr("pll_quick_language",g);a(".pll-media-action-column a",this).attr("pll_quick_id",0)}}a(".pll-media-action-column a",this).off("click");a(".pll-media-action-column a",this).click(function(k){var j=a(this).attr("pll_quick_language"),i=a(this).attr("pll_quick_id");a(':input[name="pll_quick_language"]',d).val(j);a(':input[name="pll_quick_id"]',d).val(i);k.preventDefault();return mlaPolylang.inlineTranslate.save(d)})});return false},edit:function(i){var d=this,b,g,f,h,c,e;d.revert();if(typeof(i)=="object"){i=mlaPolylang.utility.getId(i)}b=mlaPolylang.settings.fields;g=a("#pll-quick-translate").clone(true);a("td",g).attr("colspan",a("th:visible, td:visible",".widefat:first thead").length);if(a(d.what+i).hasClass("alternate")){a(g).addClass("alternate")}a(d.what+i).before(g);f=a("#inline_"+i);for(h=0;h<b.length;h++){a(':input[name="'+b[h]+'"]',g).val(a("."+b[h],f).text())}e=a(':input[name="old_lang"]',g).val();c=JSON.parse(a(':input[name="inline_translations"]',g).val());a(".pll-media-action-table tr",g).each(function(j){var l=a(this).attr("class").split("-"),k=l[l.length-1];if(k===e){a(".pll-media-action-column input",this).val(c[k]);a(this).hide()}else{if("undefined"!=typeof c[k]){a(".pll-media-action-column input",this).val(c[k]);a(".pll-media-action-column a",this).addClass("pll_icon_edit");a(".pll-media-action-column a",this).attr("title",mlaPolylang.settings.edit);a(".pll-media-action-column a",this).attr("pll_quick_language",k);a(".pll-media-action-column a",this).attr("pll_quick_id",c[k])}else{a(".pll-media-action-column input",this).val(0);a(".pll-media-action-column a",this).addClass("pll_icon_add");a(".pll-media-action-column a",this).attr("title",mlaPolylang.settings.addNew);a(".pll-media-action-column a",this).attr("pll_quick_language",k);a(".pll-media-action-column a",this).attr("pll_quick_id",0)}}a(".pll-media-action-column a",this).off("click");a(".pll-media-action-column a",this).click(function(o){var n=a(this).attr("pll_quick_language"),m=a(this).attr("pll_quick_id");a(':input[name="pll_quick_language"]',g).val(n);a(':input[name="pll_quick_id"]',g).val(m);return mlaPolylang.inlineTranslate.save(g)})});f=a(g).attr("id","edit-"+i).addClass("inline-translator").show().position().top;a("html, body").animate({scrollTop:f},"fast");return false},save:function(e){var d,b,c=a(".post_status_page").val()||"";if(typeof(e)=="object"){e=mlaPolylang.utility.getId(e)}if(mla.settings.useSpinnerClass){a("table.widefat .pll-quick-translate-save .spinner").addClass("is-active")}else{a("table.widefat .pll-quick-translate-save .spinner").show()}d={action:mlaPolylang.settings.ajax_action,mla_admin_nonce:mlaPolylang.settings.ajax_nonce,post_type:"attachment",post_ID:e,edit_date:"true",post_status:c};b=a("#edit-"+e+" :input").serialize();d=b+"&"+a.param(d);a.post(ajaxurl,d,function(g){var h,f,k,j,i;if(mla.settings.useSpinnerClass){a("table.widefat .pll-quick-translate-save .spinner").removeClass("is-active")}else{a("table.widefat .pll-quick-translate-save .spinner").hide()}if(g){if(-1!=g.indexOf('<tr id="attachment')){j=a(g).closest("tr");h=mlaPolylang.utility.getId(j[0]);f=a(mlaPolylang.inlineTranslate.what+h);if("undefined"!=typeof f){f.remove()}a("#edit-"+e).before(j[0]).remove();a(mlaPolylang.inlineTranslate.what+h).hide().fadeIn();if(1<j.length){for(i=1;i<j.length;i++){k=mlaPolylang.utility.getId(j[i]);f=a(mlaPolylang.inlineTranslate.what+k);if("undefined"!=typeof f){f.before(j[i]).remove();f=a(mlaPolylang.inlineTranslate.what+k);f.hide().fadeIn()}}}if(h!=e){a("a.editinline",mlaPolylang.inlineTranslate.what+h).click()}}else{g=g.replace(/<.[^<>]*?>/g,"");a("#edit-"+e+" .pll-quick-translate-save .error").html(g).show()}}else{a("#edit-"+e+" .pll-quick-translate-save .error").html(mlaPolylang.settings.error).show()}},"html");return false},revert:function(){var b=a("table.widefat tr.inline-translator ").attr("id");if(b){if(mla.settings.useSpinnerClass){a("table.widefat .pll-quick-translate-save .spinner").removeClass("is-active")}else{a("table.widefat .pll-quick-translate-save .spinner").hide()}if("pll-bulk-translate"==b){a("table.widefat #pll-bulk-translate ").removeClass("inline-translator").hide();a("#pll-bulk-titles").html("");a("#pll-inline-translate").append(a("#pll-bulk-translate"))}else{a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}}return false}};a(document).ready(function(){mlaPolylang.inlineTranslate.init()})})(jQuery);
1
+ var jQuery,mla_polylang_support_vars,mlaPolylang={settings:{},utility:{getId:function(b){var c=jQuery(b).closest("tr").attr("id"),a=c.split("-");return a[a.length-1]}},inlineTranslate:null};(function(a){mlaPolylang.settings=typeof mla_polylang_support_vars==="undefined"?{}:mla_polylang_support_vars;mla_polylang_support_vars=void 0;mlaPolylang.inlineTranslate={init:function(){var c=this,d=a("#pll-quick-translate"),b=a("#pll-bulk-translate");c.type="attachment";c.what="#attachment-";d.on("keyup",function(f){if(f.which==27){return mlaPolylang.inlineTranslate.revert()}});a("a.cancel",d).on("click",function(){return mlaPolylang.inlineTranslate.revert()});a("a.save",d).on("click",function(){return mlaPolylang.inlineTranslate.save(this)});a("td",d).on("keydown",function(f){if(f.which==13){return mlaPolylang.inlineTranslate.save(this)}});a("#the-list").on("click","a.inlineTranslate",function(){mlaPolylang.inlineTranslate.edit(this);return false});a("#the-list").on("click","a.editinline",function(){a(".quick-edit-row").one("focusin",function(){mlaPolylang.inlineTranslate.openQuickEdit(this);return false});return false});b.on("keyup",function(f){if(f.which==27){return mlaPolylang.inlineTranslate.revert()}});a("a.cancel",b).on("click",function(){return mlaPolylang.inlineTranslate.revert()});a("#doaction, #doaction2").on("click",function(f){var g=a(this).attr("id").substr(2);if(a('select[name="'+g+'"]').val()=="pll-translate"){f.preventDefault();c.openBulkTranslate()}else{if(a("form#posts-filter tr.inline-translator").length>0){c.revert()}}});a("#post-query-submit").on("mousedown",function(){c.revert();a('select[name^="action"]').val("-1")})},toggle:function(c){var b=this;if("none"==a(b.what+mlaPolylang.utility.getId(c)).css("display")){b.revert()}else{b.edit(c)}},openBulkTranslate:function(){var b="",d=true;this.revert();a("#pll-bulk-translate td").attr("colspan",a("th:visible, td:visible",".widefat:first thead").length);a("table.widefat tbody").prepend(a("#pll-bulk-translate"));a("#pll-bulk-translate").addClass("inline-translator").show();a('tbody th.check-column input[type="checkbox"]').each(function(){if(a(this).prop("checked")){d=false;var e=a(this).val(),c;c=a("#inline_"+e+" .post_title").text()||mlaPolylang.settings.noTitle;b+='<div id="ttle'+e+'"><a id="_'+e+'" class="ntdelbutton" title="'+mlaPolylang.settings.ntdelTitle+'">X</a>'+c+"</div>"}});if(d){return this.revert()}a("#pll-bulk-titles").html(b);a("#pll-bulk-titles a").on("click",function(){var c=a(this).attr("id").substr(1);a('table.widefat input[value="'+c+'"]').prop("checked",false);a("#ttle"+c).remove()});a("#pll-bulk-translate .pll-media-action-table tr").each(function(c){a(".pll-media-action-column a",this).on("click",function(g){var f=a(this).attr("pll_bulk_language");a(':input[name="pll_bulk_language"]',"#pll-bulk-translate").val(f);a("#pll-bulk-translate .pll-media-action-table a").prop("disabled",true);a("#pll-bulk-translate").css("opacity","0.5");a(this).hide();return a("#pll-bulk-translate-submit","#pll-bulk-translate").trigger("click")})});a("html, body").animate({scrollTop:0},"fast")},openQuickEdit:function(e){var d,b,c;if(typeof(e)=="object"){e=mlaPolylang.utility.getId(e)}d=a("#edit-"+e);c=a(':input[name="old_lang"]',d).val();b=JSON.parse(a(':input[name="inline_translations"]',d).val());a(".pll-media-action-table tr",d).each(function(f){var h=a(this).attr("class").split("-"),g=h[h.length-1];if(g===c){a(".pll-media-action-column input",this).val(b[g]);a(this).hide()}else{if("undefined"!=typeof b[g]){a(".pll-media-action-column input",this).val(b[g]);a(".pll-media-action-column a",this).addClass("pll_icon_edit");a(".pll-media-action-column a",this).attr("title",mlaPolylang.settings.edit);a(".pll-media-action-column a",this).attr("pll_quick_language",g);a(".pll-media-action-column a",this).attr("pll_quick_id",b[g])}else{a(".pll-media-action-column input",this).val(0);a(".pll-media-action-column a",this).addClass("pll_icon_add");a(".pll-media-action-column a",this).attr("title",mlaPolylang.settings.addNew);a(".pll-media-action-column a",this).attr("pll_quick_language",g);a(".pll-media-action-column a",this).attr("pll_quick_id",0)}}a(".pll-media-action-column a",this).off("click");a(".pll-media-action-column a",this).on("click",function(k){var j=a(this).attr("pll_quick_language"),i=a(this).attr("pll_quick_id");a(':input[name="pll_quick_language"]',d).val(j);a(':input[name="pll_quick_id"]',d).val(i);k.preventDefault();return mlaPolylang.inlineTranslate.save(d)})});return false},edit:function(i){var d=this,b,g,f,h,c,e;d.revert();if(typeof(i)=="object"){i=mlaPolylang.utility.getId(i)}b=mlaPolylang.settings.fields;g=a("#pll-quick-translate").clone(true);a("td",g).attr("colspan",a("th:visible, td:visible",".widefat:first thead").length);if(a(d.what+i).hasClass("alternate")){a(g).addClass("alternate")}a(d.what+i).before(g);f=a("#inline_"+i);for(h=0;h<b.length;h++){a(':input[name="'+b[h]+'"]',g).val(a("."+b[h],f).text())}e=a(':input[name="old_lang"]',g).val();c=JSON.parse(a(':input[name="inline_translations"]',g).val());a(".pll-media-action-table tr",g).each(function(j){var l=a(this).attr("class").split("-"),k=l[l.length-1];if(k===e){a(".pll-media-action-column input",this).val(c[k]);a(this).hide()}else{if("undefined"!=typeof c[k]){a(".pll-media-action-column input",this).val(c[k]);a(".pll-media-action-column a",this).addClass("pll_icon_edit");a(".pll-media-action-column a",this).attr("title",mlaPolylang.settings.edit);a(".pll-media-action-column a",this).attr("pll_quick_language",k);a(".pll-media-action-column a",this).attr("pll_quick_id",c[k])}else{a(".pll-media-action-column input",this).val(0);a(".pll-media-action-column a",this).addClass("pll_icon_add");a(".pll-media-action-column a",this).attr("title",mlaPolylang.settings.addNew);a(".pll-media-action-column a",this).attr("pll_quick_language",k);a(".pll-media-action-column a",this).attr("pll_quick_id",0)}}a(".pll-media-action-column a",this).off("click");a(".pll-media-action-column a",this).on("click",function(o){var n=a(this).attr("pll_quick_language"),m=a(this).attr("pll_quick_id");a(':input[name="pll_quick_language"]',g).val(n);a(':input[name="pll_quick_id"]',g).val(m);return mlaPolylang.inlineTranslate.save(g)})});f=a(g).attr("id","edit-"+i).addClass("inline-translator").show().position().top;a("html, body").animate({scrollTop:f},"fast");return false},save:function(e){var d,b,c=a(".post_status_page").val()||"";if(typeof(e)=="object"){e=mlaPolylang.utility.getId(e)}if(mla.settings.useSpinnerClass){a("table.widefat .pll-quick-translate-save .spinner").addClass("is-active")}else{a("table.widefat .pll-quick-translate-save .spinner").show()}d={action:mlaPolylang.settings.ajax_action,mla_admin_nonce:mlaPolylang.settings.ajax_nonce,post_type:"attachment",post_ID:e,edit_date:"true",post_status:c};b=a("#edit-"+e+" :input").serialize();d=b+"&"+a.param(d);a.post(ajaxurl,d,function(g){var h,f,k,j,i;if(mla.settings.useSpinnerClass){a("table.widefat .pll-quick-translate-save .spinner").removeClass("is-active")}else{a("table.widefat .pll-quick-translate-save .spinner").hide()}if(g){if(-1!=g.indexOf('<tr id="attachment')){j=a(g).closest("tr");h=mlaPolylang.utility.getId(j[0]);f=a(mlaPolylang.inlineTranslate.what+h);if("undefined"!=typeof f){f.remove()}a("#edit-"+e).before(j[0]).remove();a(mlaPolylang.inlineTranslate.what+h).hide().fadeIn();if(1<j.length){for(i=1;i<j.length;i++){k=mlaPolylang.utility.getId(j[i]);f=a(mlaPolylang.inlineTranslate.what+k);if("undefined"!=typeof f){f.before(j[i]).remove();f=a(mlaPolylang.inlineTranslate.what+k);f.hide().fadeIn()}}}if(h!=e){a("a.editinline",mlaPolylang.inlineTranslate.what+h).trigger("click")}}else{g=g.replace(/<.[^<>]*?>/g,"");a("#edit-"+e+" .pll-quick-translate-save .error").html(g).show()}}else{a("#edit-"+e+" .pll-quick-translate-save .error").html(mlaPolylang.settings.error).show()}},"html");return false},revert:function(){var b=a("table.widefat tr.inline-translator ").attr("id");if(b){if(mla.settings.useSpinnerClass){a("table.widefat .pll-quick-translate-save .spinner").removeClass("is-active")}else{a("table.widefat .pll-quick-translate-save .spinner").hide()}if("pll-bulk-translate"==b){a("table.widefat #pll-bulk-translate ").removeClass("inline-translator").hide();a("#pll-bulk-titles").html("");a("#pll-inline-translate").append(a("#pll-bulk-translate"))}else{a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}}return false}};a(document).ready(function(){mlaPolylang.inlineTranslate.init()})})(jQuery);
js/mla-set-parent-scripts.js CHANGED
@@ -24,18 +24,18 @@ var jQuery;
24
  mla.setParent = {
25
  init: function() {
26
  // Send setParent selected parent
27
- $( '#mla-set-parent-submit' ).click( function( event ) {
28
  if ( ! $( '#mla-set-parent-response-div input[type="radio"]:checked' ).length )
29
  event.preventDefault();
30
  });
31
 
32
  // Send setParent parent keywords for filtering
33
- $( '#mla-set-parent-search' ).click( function () {
34
  $( '#mla-set-parent-paged' ).val( 1 );
35
  mla.setParent.send();
36
  });
37
 
38
- $( '#mla-set-parent-search-div :input' ).keypress( function() {
39
  if ( 13 == event.which ) {
40
  mla.setParent.send();
41
  return false;
@@ -43,13 +43,13 @@ var jQuery;
43
  });
44
 
45
  // Send post type(s) for filtering
46
- $( '#mla-set-parent-post-type' ).change( function () {
47
  $( '#mla-set-parent-paged' ).val( 1 );
48
  mla.setParent.send();
49
  });
50
 
51
  // Pagination controls
52
- $( '#mla-set-parent-previous' ).click( function () {
53
  var paged = + $( '#mla-set-parent-paged' ).val();
54
 
55
  if ( paged > 1 ) {
@@ -61,7 +61,7 @@ var jQuery;
61
  mla.setParent.send();
62
  });
63
 
64
- $( '#mla-set-parent-next' ).click( function () {
65
  var count = + $( '#mla-set-parent-count' ).val(),
66
  paged = + $( '#mla-set-parent-paged' ).val(),
67
  found = + $( '#mla-set-parent-found' ).val();
@@ -76,9 +76,9 @@ var jQuery;
76
  });
77
 
78
  // Close the setParent pop-up
79
- $( '#mla-set-parent-close-div' ).click( mla.setParent.close );
80
 
81
- $( '#mla-set-parent-cancel' ).click( function ( event ) {
82
  event.preventDefault();
83
  return mla.setParent.close();
84
  });
@@ -116,7 +116,7 @@ var jQuery;
116
 
117
  $( '#mla-set-parent-div' ).show();
118
 
119
- $( '#mla-set-parent-input ' ).focus().keyup( function( event ){
120
  if ( event.which == 27 ) {
121
  mla.setParent.close();
122
  } // close on Escape
24
  mla.setParent = {
25
  init: function() {
26
  // Send setParent selected parent
27
+ $( '#mla-set-parent-submit' ).on( 'click', function( event ) {
28
  if ( ! $( '#mla-set-parent-response-div input[type="radio"]:checked' ).length )
29
  event.preventDefault();
30
  });
31
 
32
  // Send setParent parent keywords for filtering
33
+ $( '#mla-set-parent-search' ).on( 'click', function () {
34
  $( '#mla-set-parent-paged' ).val( 1 );
35
  mla.setParent.send();
36
  });
37
 
38
+ $( '#mla-set-parent-search-div :input' ).on( 'keypress', function() {
39
  if ( 13 == event.which ) {
40
  mla.setParent.send();
41
  return false;
43
  });
44
 
45
  // Send post type(s) for filtering
46
+ $( '#mla-set-parent-post-type' ).on( 'change', function () {
47
  $( '#mla-set-parent-paged' ).val( 1 );
48
  mla.setParent.send();
49
  });
50
 
51
  // Pagination controls
52
+ $( '#mla-set-parent-previous' ).on( 'click', function () {
53
  var paged = + $( '#mla-set-parent-paged' ).val();
54
 
55
  if ( paged > 1 ) {
61
  mla.setParent.send();
62
  });
63
 
64
+ $( '#mla-set-parent-next' ).on( 'click', function () {
65
  var count = + $( '#mla-set-parent-count' ).val(),
66
  paged = + $( '#mla-set-parent-paged' ).val(),
67
  found = + $( '#mla-set-parent-found' ).val();
76
  });
77
 
78
  // Close the setParent pop-up
79
+ $( '#mla-set-parent-close-div' ).trigger( 'click', mla.setParent.close );
80
 
81
+ $( '#mla-set-parent-cancel' ).on( 'click', function ( event ) {
82
  event.preventDefault();
83
  return mla.setParent.close();
84
  });
116
 
117
  $( '#mla-set-parent-div' ).show();
118
 
119
+ $( '#mla-set-parent-input ' ).focus().on( 'keyup', function( event ){
120
  if ( event.which == 27 ) {
121
  mla.setParent.close();
122
  } // close on Escape
js/mla-set-parent-scripts.min.js CHANGED
@@ -1 +1 @@
1
- var jQuery;(function(a){mla.setParent={init:function(){a("#mla-set-parent-submit").click(function(b){if(!a('#mla-set-parent-response-div input[type="radio"]:checked').length){b.preventDefault()}});a("#mla-set-parent-search").click(function(){a("#mla-set-parent-paged").val(1);mla.setParent.send()});a("#mla-set-parent-search-div :input").keypress(function(){if(13==event.which){mla.setParent.send();return false}});a("#mla-set-parent-post-type").change(function(){a("#mla-set-parent-paged").val(1);mla.setParent.send()});a("#mla-set-parent-previous").click(function(){var b=+a("#mla-set-parent-paged").val();if(b>1){a("#mla-set-parent-paged").val(b-1)}else{a("#mla-set-parent-paged").val(1)}mla.setParent.send()});a("#mla-set-parent-next").click(function(){var c=+a("#mla-set-parent-count").val(),b=+a("#mla-set-parent-paged").val(),d=+a("#mla-set-parent-found").val();if(d<c){a("#mla-set-parent-paged").val(1)}else{a("#mla-set-parent-paged").val(b+1)}mla.setParent.send()});a("#mla-set-parent-close-div").click(mla.setParent.close);a("#mla-set-parent-cancel").click(function(b){b.preventDefault();return mla.setParent.close()});a("#mla-set-parent-inside-div").on("click","tr",function(){a(this).find(".found-radio input").prop("checked",true)})},open:function(e,d,b){var c=a("#mla-set-parent-overlay");if(c.length===0){a("body").append('<div id="mla-set-parent-overlay"></div>');mla.setParent.overlay()}c.show();if(e&&d){a("#mla-set-parent-parent").val(e);a("#mla-set-parent-children").val(d)}if(b){a("#mla-set-parent-titles").html(b)}if(mla.settings.useDashicons){a("#mla-set-parent-close-div").addClass("mla-set-parent-close-div-dashicons")}else{a("#mla-set-parent-close-div").html("x")}a("#mla-set-parent-div").show();a("#mla-set-parent-input ").focus().keyup(function(f){if(f.which==27){mla.setParent.close()}});mla.setParent.send();return false},close:function(){a("#mla-set-parent-input").val("");a("#mla-set-parent-post-type").val("all");a("#mla-set-parent-response-div").html("");a("#mla-set-parent-div").hide();a("#mla-set-parent-overlay").hide()},overlay:function(){a("#mla-set-parent-overlay").on("click",function(){mla.setParent.close()})},send:function(){var b={mla_set_parent_search_text:a("#mla-set-parent-input").val(),mla_set_parent_post_type:a("#mla-set-parent-post-type").val(),mla_set_parent_count:a("#mla-set-parent-count").val(),mla_set_parent_paged:a("#mla-set-parent-paged").val(),action:"mla_find_posts",mla_admin_nonce:a("#mla-set-parent-ajax-nonce").val()},c=a("#mla-set-parent-search-div .spinner");if(mla.settings.useSpinnerClass){c.addClass("is-active")}else{c.show()}a.ajax(ajaxurl,{type:"POST",data:b,dataType:"json"}).always(function(){if(mla.settings.useSpinnerClass){c.removeClass("is-active")}else{c.hide()}}).done(function(d){var e="no response.data",f=0;if(!d.success){if(d.responseData){e=d.data}a("#mla-set-parent-response-div").text(mla.settings.ajaxDoneError+" ("+e+")")}else{a("#mla-set-parent-response-div").html(d.data);a("#mla-set-parent-response-div table tbody tr:eq(0)").before(a("#found-0-row").clone());f=a("#mla-set-parent-parent").val();a("#mla-set-parent-response-div #found-"+f).each(function(){a(this).prop("checked",true)})}}).fail(function(e,d){if(200==e.status){a("#mla-set-parent-response-div").text("("+d+") "+e.responseText)}else{a("#mla-set-parent-response-div").text(mla.settings.ajaxFailError+" ("+d+"), jqXHR( "+e.status+", "+e.statusText+", "+e.responseText+")")}})}};a(document).ready(function(){mla.setParent.init()})})(jQuery);
1
+ var jQuery;(function(a){mla.setParent={init:function(){a("#mla-set-parent-submit").on("click",function(b){if(!a('#mla-set-parent-response-div input[type="radio"]:checked').length){b.preventDefault()}});a("#mla-set-parent-search").on("click",function(){a("#mla-set-parent-paged").val(1);mla.setParent.send()});a("#mla-set-parent-search-div :input").on("keypress",function(){if(13==event.which){mla.setParent.send();return false}});a("#mla-set-parent-post-type").on("change",function(){a("#mla-set-parent-paged").val(1);mla.setParent.send()});a("#mla-set-parent-previous").on("click",function(){var b=+a("#mla-set-parent-paged").val();if(b>1){a("#mla-set-parent-paged").val(b-1)}else{a("#mla-set-parent-paged").val(1)}mla.setParent.send()});a("#mla-set-parent-next").on("click",function(){var c=+a("#mla-set-parent-count").val(),b=+a("#mla-set-parent-paged").val(),d=+a("#mla-set-parent-found").val();if(d<c){a("#mla-set-parent-paged").val(1)}else{a("#mla-set-parent-paged").val(b+1)}mla.setParent.send()});a("#mla-set-parent-close-div").trigger("click",mla.setParent.close);a("#mla-set-parent-cancel").on("click",function(b){b.preventDefault();return mla.setParent.close()});a("#mla-set-parent-inside-div").on("click","tr",function(){a(this).find(".found-radio input").prop("checked",true)})},open:function(e,d,b){var c=a("#mla-set-parent-overlay");if(c.length===0){a("body").append('<div id="mla-set-parent-overlay"></div>');mla.setParent.overlay()}c.show();if(e&&d){a("#mla-set-parent-parent").val(e);a("#mla-set-parent-children").val(d)}if(b){a("#mla-set-parent-titles").html(b)}if(mla.settings.useDashicons){a("#mla-set-parent-close-div").addClass("mla-set-parent-close-div-dashicons")}else{a("#mla-set-parent-close-div").html("x")}a("#mla-set-parent-div").show();a("#mla-set-parent-input ").focus().on("keyup",function(f){if(f.which==27){mla.setParent.close()}});mla.setParent.send();return false},close:function(){a("#mla-set-parent-input").val("");a("#mla-set-parent-post-type").val("all");a("#mla-set-parent-response-div").html("");a("#mla-set-parent-div").hide();a("#mla-set-parent-overlay").hide()},overlay:function(){a("#mla-set-parent-overlay").on("click",function(){mla.setParent.close()})},send:function(){var b={mla_set_parent_search_text:a("#mla-set-parent-input").val(),mla_set_parent_post_type:a("#mla-set-parent-post-type").val(),mla_set_parent_count:a("#mla-set-parent-count").val(),mla_set_parent_paged:a("#mla-set-parent-paged").val(),action:"mla_find_posts",mla_admin_nonce:a("#mla-set-parent-ajax-nonce").val()},c=a("#mla-set-parent-search-div .spinner");if(mla.settings.useSpinnerClass){c.addClass("is-active")}else{c.show()}a.ajax(ajaxurl,{type:"POST",data:b,dataType:"json"}).always(function(){if(mla.settings.useSpinnerClass){c.removeClass("is-active")}else{c.hide()}}).done(function(d){var e="no response.data",f=0;if(!d.success){if(d.responseData){e=d.data}a("#mla-set-parent-response-div").text(mla.settings.ajaxDoneError+" ("+e+")")}else{a("#mla-set-parent-response-div").html(d.data);a("#mla-set-parent-response-div table tbody tr:eq(0)").before(a("#found-0-row").clone());f=a("#mla-set-parent-parent").val();a("#mla-set-parent-response-div #found-"+f).each(function(){a(this).prop("checked",true)})}}).fail(function(e,d){if(200==e.status){a("#mla-set-parent-response-div").text("("+d+") "+e.responseText)}else{a("#mla-set-parent-response-div").text(mla.settings.ajaxFailError+" ("+d+"), jqXHR( "+e.status+", "+e.statusText+", "+e.responseText+")")}})}};a(document).ready(function(){mla.setParent.init()})})(jQuery);
js/mla-settings-shortcodes-tab-scripts.js CHANGED
@@ -29,7 +29,7 @@ var jQuery,
29
  init : function(){
30
  var t = this, templateForm = $( '#mla-edit-template' );
31
 
32
- $( '#mla-template-type, #mla-template-shortcode', templateForm ).change( function( e ){
33
  var type = $( '#mla-template-type', templateForm ).val(),
34
  shortcode = $( '#mla-template-shortcode', templateForm ).val();
35
 
29
  init : function(){
30
  var t = this, templateForm = $( '#mla-edit-template' );
31
 
32
+ $( '#mla-template-type, #mla-template-shortcode', templateForm ).on( 'change', function( e ){
33
  var type = $( '#mla-template-type', templateForm ).val(),
34
  shortcode = $( '#mla-template-shortcode', templateForm ).val();
35
 
js/mla-settings-shortcodes-tab-scripts.min.js CHANGED
@@ -1 +1 @@
1
- var jQuery,mla_shortcodes_tab_vars,mlaShortcodes={settings:{},utility:{getId:function(b){var c=jQuery(b).closest("tr").attr("id"),a=c.split("-");return a[a.length-1]}},addTemplate:null};(function(a){mlaShortcodes.settings=typeof mla_shortcodes_tab_vars==="undefined"?{}:mla_shortcodes_tab_vars;mla_shortcodes_tab_vars=void 0;mlaShortcodes.settings.sectionText=[];mlaShortcodes.addTemplate={init:function(){var c=this,b=a("#mla-edit-template");a("#mla-template-type, #mla-template-shortcode",b).change(function(g){var d=a("#mla-template-type",b).val(),f=a("#mla-template-shortcode",b).val();g.preventDefault();c.fillSections(d,f,b)})},fillSections:function(e,f,d){var g=a("#mla-template-item-type",d).val(),b=a("#mla-template-item-shortcode",d).val(),c=".mla_section.mla_"+g+".mla_"+b;newClass=".mla_section.mla_"+e+".mla_"+f;a("#mla-template-item-type",d).val(e),a("#mla-template-item-shortcode",d).val(f),a(c,d).each(function(i){var l=a("textarea",this).attr("id"),k=a("textarea",this).val(),j="mla-template-"+g+"-"+b+"-",h=l.substring(j.length);mlaShortcodes.settings.sectionText[h]=k});a(".mla_section",d).hide();if(e=="any"||f=="any"){return}a(newClass,d).each(function(i){var k=a("textarea",this).attr("id"),j="mla-template-"+e+"-"+f+"-",h=k.substring(j.length);if(typeof mlaShortcodes.settings.sectionText[h]!=="undefined"){a("textarea",this).val(mlaShortcodes.settings.sectionText[h])}});a(newClass,d).show()}};a(document).ready(function(){mlaShortcodes.addTemplate.init()})})(jQuery);
1
+ var jQuery,mla_shortcodes_tab_vars,mlaShortcodes={settings:{},utility:{getId:function(b){var c=jQuery(b).closest("tr").attr("id"),a=c.split("-");return a[a.length-1]}},addTemplate:null};(function(a){mlaShortcodes.settings=typeof mla_shortcodes_tab_vars==="undefined"?{}:mla_shortcodes_tab_vars;mla_shortcodes_tab_vars=void 0;mlaShortcodes.settings.sectionText=[];mlaShortcodes.addTemplate={init:function(){var c=this,b=a("#mla-edit-template");a("#mla-template-type, #mla-template-shortcode",b).on("change",function(g){var d=a("#mla-template-type",b).val(),f=a("#mla-template-shortcode",b).val();g.preventDefault();c.fillSections(d,f,b)})},fillSections:function(e,f,d){var g=a("#mla-template-item-type",d).val(),b=a("#mla-template-item-shortcode",d).val(),c=".mla_section.mla_"+g+".mla_"+b;newClass=".mla_section.mla_"+e+".mla_"+f;a("#mla-template-item-type",d).val(e),a("#mla-template-item-shortcode",d).val(f),a(c,d).each(function(i){var l=a("textarea",this).attr("id"),k=a("textarea",this).val(),j="mla-template-"+g+"-"+b+"-",h=l.substring(j.length);mlaShortcodes.settings.sectionText[h]=k});a(".mla_section",d).hide();if(e=="any"||f=="any"){return}a(newClass,d).each(function(i){var k=a("textarea",this).attr("id"),j="mla-template-"+e+"-"+f+"-",h=k.substring(j.length);if(typeof mlaShortcodes.settings.sectionText[h]!=="undefined"){a("textarea",this).val(mlaShortcodes.settings.sectionText[h])}});a(newClass,d).show()}};a(document).ready(function(){mlaShortcodes.addTemplate.init()})})(jQuery);
js/mla-terms-search-scripts.js CHANGED
@@ -35,16 +35,16 @@ var jQuery, wpAjax, ajaxurl,
35
  mlaTaxonomy.termsSearch = {
36
  init: function() {
37
  // Suppress form "submit" action for the "Terms Search" button
38
- $( '#mla-terms-search-open' ).click( function( event ) {
39
  event.preventDefault();
40
  });
41
 
42
- $( '#mla-terms-search-submit' ).click( function() {
43
  mlaTaxonomy.termsSearch.close();
44
  });
45
 
46
  // Close the termsSearch pop-up
47
- $( '#mla-terms-search-close-div' ).click( mlaTaxonomy.termsSearch.close );
48
 
49
  },
50
 
@@ -63,13 +63,10 @@ var jQuery, wpAjax, ajaxurl,
63
  } else {
64
  $( '#mla-terms-search-close-div' ).html( 'x' );
65
  }
66
- /* if ( ! mlaTaxonomy.settings.useDashicons ) {
67
- $( '#mla-terms-search-close-div' ).html( 'x' );
68
- } */
69
 
70
  $( '#mla-terms-search-div' ).show();
71
 
72
- $( '#mla-terms-search-input ' ).focus().keyup( function( event ){
73
  if ( event.which == 27 ) {
74
  mlaTaxonomy.termsSearch.close();
75
  } // close on Escape
35
  mlaTaxonomy.termsSearch = {
36
  init: function() {
37
  // Suppress form "submit" action for the "Terms Search" button
38
+ $( '#mla-terms-search-open' ).on( 'click', function( event ) {
39
  event.preventDefault();
40
  });
41
 
42
+ $( '#mla-terms-search-submit' ).on( 'click', function() {
43
  mlaTaxonomy.termsSearch.close();
44
  });
45
 
46
  // Close the termsSearch pop-up
47
+ $( '#mla-terms-search-close-div' ).on( 'click', mlaTaxonomy.termsSearch.close );
48
 
49
  },
50
 
63
  } else {
64
  $( '#mla-terms-search-close-div' ).html( 'x' );
65
  }
 
 
 
66
 
67
  $( '#mla-terms-search-div' ).show();
68
 
69
+ $( '#mla-terms-search-input ' ).focus().on( 'keyup', function( event ){
70
  if ( event.which == 27 ) {
71
  mlaTaxonomy.termsSearch.close();
72
  } // close on Escape
js/mla-terms-search-scripts.min.js CHANGED
@@ -1 +1 @@
1
- var jQuery,wpAjax,ajaxurl,mla_terms_search_vars,mlaTaxonomy={settings:{},utility:{},termsSearch:null};(function(a){mlaTaxonomy.settings=typeof mla_terms_search_vars==="undefined"?{}:mla_terms_search_vars;mla_terms_search_vars=void 0;mlaTaxonomy.termsSearch={init:function(){a("#mla-terms-search-open").click(function(b){b.preventDefault()});a("#mla-terms-search-submit").click(function(){mlaTaxonomy.termsSearch.close()});a("#mla-terms-search-close-div").click(mlaTaxonomy.termsSearch.close)},open:function(){var b=a("#mla-terms-search-overlay");if(b.length===0){a("body").append('<div id="mla-terms-search-overlay"></div>');mlaTaxonomy.termsSearch.overlay()}b.show();if(mlaTaxonomy.settings.useDashicons){a("#mla-terms-search-close-div").addClass("mla-terms-search-close-div-dashicons")}else{a("#mla-terms-search-close-div").html("x")}a("#mla-terms-search-div").show();a("#mla-terms-search-input ").focus().keyup(function(c){if(c.which==27){mlaTaxonomy.termsSearch.close()}});return false},close:function(){a("#mla-terms-search-response-div").html("");a("#mla-terms-search-div").hide();a("#mla-terms-search-overlay").hide()},overlay:function(){a("#mla-terms-search-overlay").on("click",function(){mlaTaxonomy.termsSearch.close()})},send:function(){var b={ps:a("#mla-terms-search-input").val(),action:"find_posts",_ajax_nonce:a("#mla-terms-search-ajax-nonce").val()},d=a("#mla-terms-search-search-div .spinner"),c=null;if(mla.settings.useSpinnerClass){d.addClass("is-active")}else{d.show()}a.ajax(ajaxurl,{type:"POST",data:b,dataType:mlaTaxonomy.settings.termsSearchDataType}).always(function(){if(mla.settings.useSpinnerClass){d.removeClass("is-active")}else{d.hide()}}).done(function(e){var f="no response.data",g=0;if("xml"===mlaTaxonomy.settings.termsSearchDataType){if("string"===typeof(e)){e={success:false,data:e}}else{c=wpAjax.parseAjaxResponse(e);if(c.errors){e={success:false,data:wpAjax.broken}}else{e={success:true,data:c.responses[0].data}}}}if(!e.success){if(e.responseData){f=e.data}a("#mla-terms-search-response-div").text(mlaTaxonomy.settings.ajaxDoneError+" ("+f+")")}else{a("#mla-terms-search-response-div").html(e.data);a("#mla-terms-search-response-div table tbody tr:eq(0)").before(a("#found-0-row").clone());g=a("#mla-terms-search-parent").val();a("#mla-terms-search-response-div #found-"+g).each(function(){a(this).prop("checked",true)})}}).fail(function(f,e){if(200==f.status){a("#mla-terms-search-response-div").text("("+e+") "+f.responseText)}else{a("#mla-terms-search-response-div").text(mlaTaxonomy.settings.ajaxFailError+" ("+e+"), jqXHR( "+f.status+", "+f.statusText+", "+f.responseText+")")}})}};a(document).ready(function(){mlaTaxonomy.termsSearch.init()})})(jQuery);
1
+ var jQuery,wpAjax,ajaxurl,mla_terms_search_vars,mlaTaxonomy={settings:{},utility:{},termsSearch:null};(function(a){mlaTaxonomy.settings=typeof mla_terms_search_vars==="undefined"?{}:mla_terms_search_vars;mla_terms_search_vars=void 0;mlaTaxonomy.termsSearch={init:function(){a("#mla-terms-search-open").on("click",function(b){b.preventDefault()});a("#mla-terms-search-submit").on("click",function(){mlaTaxonomy.termsSearch.close()});a("#mla-terms-search-close-div").on("click",mlaTaxonomy.termsSearch.close)},open:function(){var b=a("#mla-terms-search-overlay");if(b.length===0){a("body").append('<div id="mla-terms-search-overlay"></div>');mlaTaxonomy.termsSearch.overlay()}b.show();if(mlaTaxonomy.settings.useDashicons){a("#mla-terms-search-close-div").addClass("mla-terms-search-close-div-dashicons")}else{a("#mla-terms-search-close-div").html("x")}a("#mla-terms-search-div").show();a("#mla-terms-search-input ").focus().on("keyup",function(c){if(c.which==27){mlaTaxonomy.termsSearch.close()}});return false},close:function(){a("#mla-terms-search-response-div").html("");a("#mla-terms-search-div").hide();a("#mla-terms-search-overlay").hide()},overlay:function(){a("#mla-terms-search-overlay").on("click",function(){mlaTaxonomy.termsSearch.close()})},send:function(){var b={ps:a("#mla-terms-search-input").val(),action:"find_posts",_ajax_nonce:a("#mla-terms-search-ajax-nonce").val()},d=a("#mla-terms-search-search-div .spinner"),c=null;if(mla.settings.useSpinnerClass){d.addClass("is-active")}else{d.show()}a.ajax(ajaxurl,{type:"POST",data:b,dataType:mlaTaxonomy.settings.termsSearchDataType}).always(function(){if(mla.settings.useSpinnerClass){d.removeClass("is-active")}else{d.hide()}}).done(function(e){var f="no response.data",g=0;if("xml"===mlaTaxonomy.settings.termsSearchDataType){if("string"===typeof(e)){e={success:false,data:e}}else{c=wpAjax.parseAjaxResponse(e);if(c.errors){e={success:false,data:wpAjax.broken}}else{e={success:true,data:c.responses[0].data}}}}if(!e.success){if(e.responseData){f=e.data}a("#mla-terms-search-response-div").text(mlaTaxonomy.settings.ajaxDoneError+" ("+f+")")}else{a("#mla-terms-search-response-div").html(e.data);a("#mla-terms-search-response-div table tbody tr:eq(0)").before(a("#found-0-row").clone());g=a("#mla-terms-search-parent").val();a("#mla-terms-search-response-div #found-"+g).each(function(){a(this).prop("checked",true)})}}).fail(function(f,e){if(200==f.status){a("#mla-terms-search-response-div").text("("+e+") "+f.responseText)}else{a("#mla-terms-search-response-div").text(mlaTaxonomy.settings.ajaxFailError+" ("+e+"), jqXHR( "+f.status+", "+f.statusText+", "+f.responseText+")")}})}};a(document).ready(function(){mlaTaxonomy.termsSearch.init()})})(jQuery);
js/mla-thumbnail-generation-scripts.js CHANGED
@@ -40,16 +40,16 @@ var jQuery,
40
  t.what = '#attachment-';
41
 
42
  // prepare the bulk-generate row
43
- bgRow.keyup( function( e ){
44
  if ( e.which == 27 )
45
  return mlaThumbnail.inlineThumbnail.revert();
46
  });
47
 
48
- $( 'a.cancel', bgRow ).click( function(){
49
  return mlaThumbnail.inlineThumbnail.revert();
50
  });
51
 
52
- $( '#doaction, #doaction2' ).click( function( e ){
53
  var n = $( this ).attr( 'id' ).substr( 2 );
54
 
55
  if ( $( 'select[name="'+n+'"]' ).val() == 'mla-generate-featured-image' ) {
@@ -59,7 +59,7 @@ var jQuery,
59
  });
60
 
61
  // Filter button (dates, categories) in top nav bar
62
- $( '#post-query-submit' ).mousedown( function(){
63
  t.revert();
64
  $( 'select[name^="action"]' ).val( '-1' );
65
  });
@@ -90,7 +90,7 @@ var jQuery,
90
 
91
  // Populate the list of selected items
92
  $( '#mla-thumbnail-titles' ).html( te );
93
- $( '#mla-thumbnail-titles a' ).click(function(){
94
  var id = $( this ).attr( 'id' ).substr( 1 );
95
 
96
  $( 'table.widefat input[value="' + id + '"]' ).prop( 'checked', false );
40
  t.what = '#attachment-';
41
 
42
  // prepare the bulk-generate row
43
+ bgRow.on( 'keyup', function( e ){
44
  if ( e.which == 27 )
45
  return mlaThumbnail.inlineThumbnail.revert();
46
  });
47
 
48
+ $( 'a.cancel', bgRow ).on( 'click', function(){
49
  return mlaThumbnail.inlineThumbnail.revert();
50
  });
51
 
52
+ $( '#doaction, #doaction2' ).on( 'click', function( e ){
53
  var n = $( this ).attr( 'id' ).substr( 2 );
54
 
55
  if ( $( 'select[name="'+n+'"]' ).val() == 'mla-generate-featured-image' ) {
59
  });
60
 
61
  // Filter button (dates, categories) in top nav bar
62
+ $( '#post-query-submit' ).on( 'mousedown', function(){
63
  t.revert();
64
  $( 'select[name^="action"]' ).val( '-1' );
65
  });
90
 
91
  // Populate the list of selected items
92
  $( '#mla-thumbnail-titles' ).html( te );
93
+ $( '#mla-thumbnail-titles a' ).on( 'click', function(){
94
  var id = $( this ).attr( 'id' ).substr( 1 );
95
 
96
  $( 'table.widefat input[value="' + id + '"]' ).prop( 'checked', false );
js/mla-thumbnail-generation-scripts.min.js CHANGED
@@ -1 +1 @@
1
- var jQuery,mla_thumbnail_support_vars,mlaThumbnail={settings:{},utility:{getId:function(b){var c=jQuery(b).closest("tr").attr("id"),a=c.split("-");return a[a.length-1]}},inlineThumbnail:null};(function(a){mlaThumbnail.settings=typeof mla_thumbnail_support_vars==="undefined"?{}:mla_thumbnail_support_vars;mla_thumbnail_support_vars=void 0;mlaThumbnail.inlineThumbnail={init:function(){var b=this,c=a("#mla-bulk-thumbnail");b.type="attachment";b.what="#attachment-";c.keyup(function(d){if(d.which==27){return mlaThumbnail.inlineThumbnail.revert()}});a("a.cancel",c).click(function(){return mlaThumbnail.inlineThumbnail.revert()});a("#doaction, #doaction2").click(function(d){var f=a(this).attr("id").substr(2);if(a('select[name="'+f+'"]').val()=="mla-generate-featured-image"){d.preventDefault();b.openBulkGenerate()}});a("#post-query-submit").mousedown(function(){b.revert();a('select[name^="action"]').val("-1")})},openBulkGenerate:function(){var b="",d=true;this.revert();a("#mla-bulk-thumbnail td").attr("colspan",a("th:visible, td:visible",".widefat:first thead").length);a("table.widefat tbody").prepend(a("#mla-bulk-thumbnail"));a("#mla-bulk-thumbnail").addClass("inline-translator").show();a('tbody th.check-column input[type="checkbox"]').each(function(){if(a(this).prop("checked")){d=false;var e=a(this).val(),c;c=a("#inline_"+e+" .post_title").text()||mlaThumbnail.settings.noTitle;b+='<div id="ttle'+e+'"><a id="_'+e+'" class="ntdelbutton" title="'+mlaThumbnail.settings.ntdelTitle+'">X</a>'+c+"</div>"}});if(d){return this.revert()}a("#mla-thumbnail-titles").html(b);a("#mla-thumbnail-titles a").click(function(){var c=a(this).attr("id").substr(1);a('table.widefat input[value="'+c+'"]').prop("checked",false);a("#ttle"+c).remove()});a("html, body").animate({scrollTop:0},"fast")},revert:function(){var b=a("table.widefat tr.inline-translator ").attr("id");if(b){if(mlaThumbnail.settings.useSpinnerClass){a("table.widefat .pll-quick-translate-save .spinner").removeClass("is-active")}else{a("table.widefat .pll-quick-translate-save .spinner").hide()}if("mla-bulk-thumbnail"==b){a("table.widefat #mla-bulk-thumbnail ").removeClass("inline-translator").hide();a("#mla-thumbnail-titles").html("");a("#pll-inline-translate").append(a("#mla-bulk-thumbnail"))}else{a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}}return false}};a(document).ready(function(){mlaThumbnail.inlineThumbnail.init()})})(jQuery);
1
+ var jQuery,mla_thumbnail_support_vars,mlaThumbnail={settings:{},utility:{getId:function(b){var c=jQuery(b).closest("tr").attr("id"),a=c.split("-");return a[a.length-1]}},inlineThumbnail:null};(function(a){mlaThumbnail.settings=typeof mla_thumbnail_support_vars==="undefined"?{}:mla_thumbnail_support_vars;mla_thumbnail_support_vars=void 0;mlaThumbnail.inlineThumbnail={init:function(){var b=this,c=a("#mla-bulk-thumbnail");b.type="attachment";b.what="#attachment-";c.on("keyup",function(d){if(d.which==27){return mlaThumbnail.inlineThumbnail.revert()}});a("a.cancel",c).on("click",function(){return mlaThumbnail.inlineThumbnail.revert()});a("#doaction, #doaction2").on("click",function(d){var f=a(this).attr("id").substr(2);if(a('select[name="'+f+'"]').val()=="mla-generate-featured-image"){d.preventDefault();b.openBulkGenerate()}});a("#post-query-submit").on("mousedown",function(){b.revert();a('select[name^="action"]').val("-1")})},openBulkGenerate:function(){var b="",d=true;this.revert();a("#mla-bulk-thumbnail td").attr("colspan",a("th:visible, td:visible",".widefat:first thead").length);a("table.widefat tbody").prepend(a("#mla-bulk-thumbnail"));a("#mla-bulk-thumbnail").addClass("inline-translator").show();a('tbody th.check-column input[type="checkbox"]').each(function(){if(a(this).prop("checked")){d=false;var e=a(this).val(),c;c=a("#inline_"+e+" .post_title").text()||mlaThumbnail.settings.noTitle;b+='<div id="ttle'+e+'"><a id="_'+e+'" class="ntdelbutton" title="'+mlaThumbnail.settings.ntdelTitle+'">X</a>'+c+"</div>"}});if(d){return this.revert()}a("#mla-thumbnail-titles").html(b);a("#mla-thumbnail-titles a").on("click",function(){var c=a(this).attr("id").substr(1);a('table.widefat input[value="'+c+'"]').prop("checked",false);a("#ttle"+c).remove()});a("html, body").animate({scrollTop:0},"fast")},revert:function(){var b=a("table.widefat tr.inline-translator ").attr("id");if(b){if(mlaThumbnail.settings.useSpinnerClass){a("table.widefat .pll-quick-translate-save .spinner").removeClass("is-active")}else{a("table.widefat .pll-quick-translate-save .spinner").hide()}if("mla-bulk-thumbnail"==b){a("table.widefat #mla-bulk-thumbnail ").removeClass("inline-translator").hide();a("#mla-thumbnail-titles").html("");a("#pll-inline-translate").append(a("#mla-bulk-thumbnail"))}else{a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}}return false}};a(document).ready(function(){mlaThumbnail.inlineThumbnail.init()})})(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: 2021-03-14 20:56-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@davidlingren.com>\n"
@@ -24,7 +24,7 @@ msgstr ""
24
  #: includes/class-mla-admin-columns-pro-support-423.php:178
25
  #: includes/class-mla-admin-columns-pro-support-44.php:175
26
  #: includes/class-mla-admin-columns-pro-support.php:193
27
- #: includes/class-mla-ajax.php:356 includes/class-mla-edit-media.php:993
28
  #: includes/class-mla-list-table.php:712
29
  msgid "Draft"
30
  msgstr ""
@@ -32,7 +32,7 @@ msgstr ""
32
  #: includes/class-mla-admin-columns-pro-support-423.php:181
33
  #: includes/class-mla-admin-columns-pro-support-44.php:178
34
  #: includes/class-mla-admin-columns-pro-support.php:196
35
- #: includes/class-mla-ajax.php:350 includes/class-mla-edit-media.php:987
36
  #: includes/class-mla-list-table.php:715
37
  msgid "Scheduled"
38
  msgstr ""
@@ -40,7 +40,7 @@ msgstr ""
40
  #: includes/class-mla-admin-columns-pro-support-423.php:184
41
  #: includes/class-mla-admin-columns-pro-support-44.php:181
42
  #: includes/class-mla-admin-columns-pro-support.php:199
43
- #: includes/class-mla-edit-media.php:990 includes/class-mla-list-table.php:718
44
  msgctxt "post state"
45
  msgid "Pending"
46
  msgstr ""
@@ -58,7 +58,7 @@ msgstr ""
58
  #: includes/class-mla-admin-columns-pro-support.php:433
59
  #: includes/class-mla-data-references.php:310
60
  #: includes/class-mla-data-references.php:634
61
- #: includes/class-mla-list-table.php:1157
62
  msgid "NO REFERENCE TESTS"
63
  msgstr ""
64
 
@@ -74,14 +74,14 @@ msgstr ""
74
  #: includes/class-mla-admin-columns-pro-support.php:692
75
  #: includes/class-mla-admin-columns-pro-support.php:759
76
  #: includes/class-mla-admin-columns-pro-support.php:821
77
- #: includes/class-mla-core-options.php:452
78
- #: includes/class-mla-core-options.php:462
79
- #: includes/class-mla-core-options.php:472
80
- #: includes/class-mla-core-options.php:482
81
- #: includes/class-mla-list-table.php:1237
82
- #: includes/class-mla-list-table.php:1282
83
- #: includes/class-mla-list-table.php:1332
84
- #: includes/class-mla-list-table.php:1377
85
  msgid "Disabled"
86
  msgstr ""
87
 
@@ -97,25 +97,25 @@ msgstr ""
97
  #: includes/class-mla-admin-columns-pro-support.php:715
98
  #: includes/class-mla-admin-columns-pro-support.php:778
99
  #: includes/class-mla-admin-columns-pro-support.php:840
100
- #: includes/class-mla-edit-media.php:1075
101
- #: includes/class-mla-edit-media.php:1112
102
- #: includes/class-mla-edit-media.php:1147
103
- #: includes/class-mla-edit-media.php:1181
104
- #: includes/class-mla-list-table.php:1255
105
- #: includes/class-mla-list-table.php:1304
106
- #: includes/class-mla-list-table.php:1350
107
- #: includes/class-mla-list-table.php:1395
108
  msgid "PARENT"
109
  msgstr ""
110
 
111
  #: includes/class-mla-admin-columns-pro-support-423.php:1027
112
  #: includes/class-mla-admin-columns-pro-support-44.php:1024
113
  #: includes/class-mla-admin-columns-pro-support.php:1065
114
- #: includes/class-mla-core-options.php:611
115
- #: includes/class-mla-core-options.php:868
116
- #: includes/class-mla-core-options.php:899
117
- #: includes/class-mla-core-options.php:913
118
- #: includes/class-mla-list-table.php:561 includes/class-mla-list-table.php:1490
119
  #: includes/class-mla-settings-shortcodes-tab.php:649
120
  msgid "None"
121
  msgstr ""
@@ -123,39 +123,39 @@ msgstr ""
123
  #: includes/class-mla-admin-columns-pro-support-423.php:1117
124
  #: includes/class-mla-admin-columns-pro-support-44.php:1114
125
  #: includes/class-mla-admin-columns-pro-support.php:1155
126
- #: includes/class-mla-list-table.php:1629
127
  msgid "(Private post)"
128
  msgstr ""
129
 
130
  #: includes/class-mla-admin-columns-pro-support-423.php:1121
131
  #: includes/class-mla-admin-columns-pro-support-44.php:1118
132
  #: includes/class-mla-admin-columns-pro-support.php:1159
133
- #: includes/class-mla-ajax.php:366 includes/class-mla-list-table.php:1540
134
- #: includes/class-mla-list-table.php:1569
135
- #: includes/class-mla-list-table.php:1633
136
  msgid "Y/m/d"
137
  msgstr ""
138
 
139
  #: includes/class-mla-admin-columns-pro-support-423.php:1134
140
  #: includes/class-mla-admin-columns-pro-support-44.php:1131
141
  #: includes/class-mla-admin-columns-pro-support.php:1172
142
- #: includes/class-mla-core-options.php:1315
143
- #: includes/class-mla-list-table.php:1646
144
  msgctxt "table_view_singular"
145
  msgid "Unattached"
146
  msgstr ""
147
 
148
  #: includes/class-mla-admin-columns-support-deprecated.php:33
149
  #: includes/class-mla-admin-columns-support.php:43
150
- #: includes/class-mla-core-options.php:561 includes/class-mla-settings.php:426
151
- #: includes/class-mla-settings.php:1450 includes/class-mla-settings.php:1466
152
  #: index.php:46
153
  msgid "Media Library Assistant"
154
  msgstr ""
155
 
156
  #: includes/class-mla-admin-columns-support-deprecated.php:34
157
  #: includes/class-mla-admin-columns-support.php:44
158
- #: includes/class-mla-core-options.php:570
159
  msgid "Assistant"
160
  msgstr ""
161
 
@@ -167,15 +167,15 @@ msgstr ""
167
 
168
  #: includes/class-mla-ajax.php:77 includes/class-mla-ajax.php:94
169
  #: includes/class-mla-ajax.php:111 includes/class-mla-ajax.php:129
170
- #: includes/class-mla-ajax.php:148 includes/class-mla-data-query.php:1363
171
- #: includes/class-mla-data-query.php:1378
172
- #: includes/class-mla-data-query.php:1380
173
- #: includes/class-mla-data-query.php:1894
174
- #: includes/class-mla-data-query.php:1985
175
- #: includes/class-mla-data-query.php:2057
176
- #: includes/class-mla-data-query.php:2152
177
- #: includes/class-mla-data-query.php:2238
178
- #: includes/class-mla-data-query.php:2257
179
  msgid "DEBUG"
180
  msgstr ""
181
 
@@ -207,25 +207,25 @@ msgid ""
207
  "\"%3$d\" count = %4$d."
208
  msgstr ""
209
 
210
- #: includes/class-mla-ajax.php:337 includes/class-mla-core-options.php:1191
211
- #: includes/class-mla-data.php:4286 includes/class-mla-edit-media.php:480
212
- #: includes/class-mla-main.php:2080 includes/class-mla-main.php:2402
213
- #: includes/class-mla-objects.php:348 includes/class-mla-options.php:466
214
  #: includes/mla-main-search-box-template.php:47
215
- #: includes/mla-media-modal-js-template.php:57
216
  msgid "Title"
217
  msgstr ""
218
 
219
- #: includes/class-mla-ajax.php:337 includes/class-mla-main.php:2081
220
  #: includes/class-mla-thumbnail-generation.php:644
221
  msgid "Type"
222
  msgstr ""
223
 
224
- #: includes/class-mla-ajax.php:337 includes/class-mla-main.php:2082
225
  msgid "Date"
226
  msgstr ""
227
 
228
- #: includes/class-mla-ajax.php:337 includes/class-mla-main.php:2083
229
  #: includes/class-mla-settings-custom-fields-tab.php:516
230
  #: includes/class-mla-settings-custom-fields-tab.php:826
231
  #: includes/class-mla-settings-iptc-exif-tab.php:545
@@ -234,8 +234,8 @@ msgstr ""
234
  msgid "Status"
235
  msgstr ""
236
 
237
- #: includes/class-mla-ajax.php:341 includes/class-mla-list-table.php:966
238
- #: includes/class-mla-list-table.php:1131 includes/class-mla-main.php:461
239
  #: includes/class-mla-polylang-support.php:375
240
  #: includes/class-mla-thumbnail-generation.php:97
241
  msgid "(no title)"
@@ -260,19 +260,19 @@ msgstr ""
260
  #: includes/class-mla-data-pdf.php:519 includes/class-mla-data-pdf.php:565
261
  #: includes/class-mla-data-pdf.php:749 includes/class-mla-data-query.php:843
262
  #: includes/class-mla-data.php:50 includes/class-mla-data.php:109
263
- #: includes/class-mla-data.php:193 includes/class-mla-data.php:254
264
- #: includes/class-mla-data.php:322 includes/class-mla-data.php:411
265
- #: includes/class-mla-data.php:563 includes/class-mla-data.php:626
266
- #: includes/class-mla-data.php:1579 includes/class-mla-data.php:1778
267
- #: includes/class-mla-data.php:1784 includes/class-mla-data.php:2134
268
- #: includes/class-mla-data.php:2138 includes/class-mla-data.php:3503
269
- #: includes/class-mla-data.php:3564 includes/class-mla-data.php:3608
270
- #: includes/class-mla-data.php:3986 includes/class-mla-data.php:3999
271
- #: includes/class-mla-data.php:4021 includes/class-mla-data.php:4261
272
- #: includes/class-mla-data.php:4307 includes/class-mla-data.php:4340
273
- #: includes/class-mla-data.php:4356 includes/class-mla-data.php:4630
274
- #: includes/class-mla-edit-media.php:321 includes/class-mla-edit-media.php:899
275
- #: includes/class-mla-edit-media.php:941 includes/class-mla-main.php:709
276
  #: includes/class-mla-main.php:837 includes/class-mla-main.php:839
277
  #: includes/class-mla-main.php:842 includes/class-mla-main.php:902
278
  #: includes/class-mla-main.php:936 includes/class-mla-main.php:945
@@ -281,10 +281,10 @@ msgstr ""
281
  #: includes/class-mla-main.php:1556 includes/class-mla-main.php:1606
282
  #: includes/class-mla-main.php:1716 includes/class-mla-main.php:1745
283
  #: includes/class-mla-main.php:1887 includes/class-mla-main.php:1894
284
- #: includes/class-mla-main.php:2066 includes/class-mla-main.php:2205
285
- #: includes/class-mla-main.php:2534 includes/class-mla-main.php:2542
286
- #: includes/class-mla-main.php:2566 includes/class-mla-main.php:2574
287
- #: includes/class-mla-main.php:2606 includes/class-mla-main.php:2614
288
  #: includes/class-mla-media-modal.php:618 includes/class-mla-mime-types.php:825
289
  #: includes/class-mla-mime-types.php:1209
290
  #: includes/class-mla-mime-types.php:1297
@@ -302,7 +302,7 @@ msgstr ""
302
  #: includes/class-mla-mime-types.php:2525
303
  #: includes/class-mla-mime-types.php:2604
304
  #: includes/class-mla-mime-types.php:2613
305
- #: includes/class-mla-mime-types.php:2645 includes/class-mla-objects.php:245
306
  #: includes/class-mla-options.php:218 includes/class-mla-options.php:434
307
  #: includes/class-mla-options.php:515 includes/class-mla-options.php:570
308
  #: includes/class-mla-options.php:1133 includes/class-mla-options.php:1973
@@ -361,24 +361,24 @@ msgstr ""
361
  #: includes/class-mla-settings-view-tab.php:453
362
  #: includes/class-mla-settings.php:586 includes/class-mla-settings.php:725
363
  #: includes/class-mla-settings.php:762 includes/class-mla-settings.php:902
364
- #: includes/class-mla-settings.php:1311 includes/class-mla-settings.php:1362
365
- #: includes/class-mla-settings.php:1450 includes/class-mla-settings.php:1477
366
- #: includes/class-mla-settings.php:1480 includes/class-mla-settings.php:1484
367
- #: includes/class-mla-settings.php:1779 includes/class-mla-settings.php:1783
368
- #: includes/class-mla-settings.php:1794 includes/class-mla-settings.php:1801
369
- #: includes/class-mla-settings.php:1810 includes/class-mla-settings.php:1847
370
- #: includes/class-mla-settings.php:1855 includes/class-mla-settings.php:1864
371
- #: includes/class-mla-shortcode-support.php:2193
372
- #: includes/class-mla-shortcode-support.php:2282
373
- #: includes/class-mla-shortcode-support.php:3515
374
- #: includes/class-mla-shortcode-support.php:3642
375
- #: includes/class-mla-shortcode-support.php:3674
376
- #: includes/class-mla-shortcode-support.php:4896
377
- #: includes/class-mla-shortcode-support.php:4933
378
- #: includes/class-mla-shortcode-support.php:5378
379
- #: includes/class-mla-shortcode-support.php:5393
380
- #: includes/class-mla-shortcode-support.php:5415
381
- #: includes/class-mla-shortcode-support.php:5430
382
  #: includes/class-mla-thumbnail-generation.php:437
383
  #: includes/class-mla-thumbnail-generation.php:449
384
  #: includes/class-mla-thumbnail-generation.php:461
@@ -395,105 +395,105 @@ msgstr ""
395
  msgid "You are not allowed to edit this Attachment."
396
  msgstr ""
397
 
398
- #: includes/class-mla-core-options.php:413 includes/class-mla-options.php:257
399
  msgid "Attachment Categories"
400
  msgstr ""
401
 
402
- #: includes/class-mla-core-options.php:417
403
  msgid "Check this option to add support for Attachment Categories."
404
  msgstr ""
405
 
406
- #: includes/class-mla-core-options.php:421 includes/class-mla-options.php:272
407
  msgid "Attachment Tags"
408
  msgstr ""
409
 
410
- #: includes/class-mla-core-options.php:425
411
  msgid "Check this option to add support for Attachment Tags."
412
  msgstr ""
413
 
414
- #: includes/class-mla-core-options.php:429 includes/class-mla-settings.php:1060
415
  msgid "Where-used Reporting"
416
  msgstr ""
417
 
418
- #: includes/class-mla-core-options.php:434
419
  msgid "Exclude Revisions"
420
  msgstr ""
421
 
422
- #: includes/class-mla-core-options.php:438
423
  msgid "Check this option to exclude revisions from where-used reporting."
424
  msgstr ""
425
 
426
- #: includes/class-mla-core-options.php:442
427
  msgid "Where-used database access tuning"
428
  msgstr ""
429
 
430
- #: includes/class-mla-core-options.php:447
431
- #: includes/class-mla-edit-media.php:834 includes/class-mla-edit-media.php:1086
432
  msgid "Featured in"
433
  msgstr ""
434
 
435
- #: includes/class-mla-core-options.php:452
436
- #: includes/class-mla-core-options.php:462
437
  msgid "Enabled"
438
  msgstr ""
439
 
440
- #: includes/class-mla-core-options.php:453
441
  msgid "Search database posts and pages for Featured Image attachments."
442
  msgstr ""
443
 
444
- #: includes/class-mla-core-options.php:457
445
- #: includes/class-mla-edit-media.php:838 includes/class-mla-edit-media.php:1124
446
  msgid "Inserted in"
447
  msgstr ""
448
 
449
- #: includes/class-mla-core-options.php:462
450
  msgid "Base"
451
  msgstr ""
452
 
453
- #: includes/class-mla-core-options.php:463
454
  msgid ""
455
  "Search database posts and pages for attachments embedded in content."
456
  "<br>&nbsp;&nbsp;Base = ignore intermediate size suffixes; use path, base "
457
  "name and extension only."
458
  msgstr ""
459
 
460
- #: includes/class-mla-core-options.php:467
461
- #: includes/class-mla-edit-media.php:842 includes/class-mla-edit-media.php:1158
462
- #: includes/class-mla-settings.php:1560
463
  msgid "Gallery in"
464
  msgstr ""
465
 
466
- #: includes/class-mla-core-options.php:472
467
- #: includes/class-mla-core-options.php:482
468
  msgid "Dynamic"
469
  msgstr ""
470
 
471
- #: includes/class-mla-core-options.php:472
472
- #: includes/class-mla-core-options.php:482 includes/class-mla-main.php:2437
473
  #: includes/class-mla-settings-custom-fields-tab.php:756
474
  #: includes/class-mla-settings-iptc-exif-tab.php:862
475
  msgid "Refresh"
476
  msgstr ""
477
 
478
- #: includes/class-mla-core-options.php:472
479
- #: includes/class-mla-core-options.php:482
480
  msgid "Cached"
481
  msgstr ""
482
 
483
- #: includes/class-mla-core-options.php:473
484
  msgid ""
485
  "Search database posts and pages for [ gallery ] shortcode results.<br>&nbsp;"
486
  "&nbsp;Dynamic = once every page load, Cached = once every login, Disabled = "
487
  "never.<br>&nbsp;&nbsp;Refresh = update references, then set to Cached."
488
  msgstr ""
489
 
490
- #: includes/class-mla-core-options.php:477
491
- #: includes/class-mla-edit-media.php:846 includes/class-mla-edit-media.php:1192
492
- #: includes/class-mla-settings.php:1570
493
  msgid "MLA Gallery in"
494
  msgstr ""
495
 
496
- #: includes/class-mla-core-options.php:483
497
  msgid ""
498
  "Search database posts and pages for [mla_gallery] shortcode results."
499
  "<br>&nbsp;&nbsp;Dynamic = once every page load, Cached = once every login, "
@@ -501,123 +501,123 @@ msgid ""
501
  "Cached."
502
  msgstr ""
503
 
504
- #: includes/class-mla-core-options.php:487 includes/class-mla-settings.php:1060
505
  msgid "Taxonomy Support"
506
  msgstr ""
507
 
508
- #: includes/class-mla-core-options.php:492
509
  msgid "Compute Attachments Column"
510
  msgstr ""
511
 
512
- #: includes/class-mla-core-options.php:496
513
  msgid ""
514
  "Check this option to calculate attachments per term in the Attachments "
515
  "Column."
516
  msgstr ""
517
 
518
- #: includes/class-mla-core-options.php:500
519
  msgid "Show Count Column"
520
  msgstr ""
521
 
522
- #: includes/class-mla-core-options.php:504
523
  msgid "Check this option to display the Count column on taxonomy edit screens."
524
  msgstr ""
525
 
526
- #: includes/class-mla-core-options.php:509
527
  msgid ""
528
  "Check the \"<strong>Support</strong>\" box to add the taxonomy to the "
529
  "Assistant and the Edit Media screen."
530
  msgstr ""
531
 
532
- #: includes/class-mla-core-options.php:510
533
  msgid ""
534
  "Check the \"<strong>Inline Edit</strong>\" box to display the taxonomy in "
535
  "the Quick Edit and Bulk Edit areas."
536
  msgstr ""
537
 
538
- #: includes/class-mla-core-options.php:511
539
  msgid ""
540
  "Check the \"<strong>Term Search</strong>\" box to add the taxonomy to the "
541
  "\"Search Media/Terms\" list."
542
  msgstr ""
543
 
544
- #: includes/class-mla-core-options.php:512
545
- #: includes/class-mla-core-options.php:750 includes/class-mla-settings.php:1086
546
- #: includes/class-mla-settings.php:1087 includes/class-mla-settings.php:1088
547
  msgid "For complete documentation"
548
  msgstr ""
549
 
550
- #: includes/class-mla-core-options.php:512
551
- #: includes/class-mla-core-options.php:750 includes/class-mla-settings.php:1086
552
- #: includes/class-mla-settings.php:1087 includes/class-mla-settings.php:1088
553
  msgid "click here"
554
  msgstr ""
555
 
556
- #: includes/class-mla-core-options.php:514
557
  msgid ""
558
  "Check the \"<strong>Checklist</strong>\" box to enable the checklist-style "
559
  "meta box for a flat taxonomy."
560
  msgstr ""
561
 
562
- #: includes/class-mla-core-options.php:515
563
  msgid ""
564
  "You must also check the <strong>\"Enable enhanced checklist taxonomies\"</"
565
  "strong> box below to enable this feature."
566
  msgstr ""
567
 
568
- #: includes/class-mla-core-options.php:516
569
  msgid ""
570
  "Check the \"<strong>Checked On Top</strong>\" box to move checked terms to "
571
  "the top of the checklist-style meta box."
572
  msgstr ""
573
 
574
- #: includes/class-mla-core-options.php:517
575
  msgid ""
576
  "Check the \"<strong>Inline Add Term</strong>\" box to support adding terms "
577
  "in the Quick Edit and Bulk Edit areas."
578
  msgstr ""
579
 
580
- #: includes/class-mla-core-options.php:518
581
  msgid ""
582
  "Use the \"<strong>List Filter</strong>\" option to select the taxonomy (or "
583
  "custom field) on which to filter the Assistant table listing."
584
  msgstr ""
585
 
586
- #: includes/class-mla-core-options.php:519
587
  msgid ""
588
  "To <strong>filter on a custom field</strong>, enter the field name and "
589
  "select ASC (Ascending) or DESC (Descending) order."
590
  msgstr ""
591
 
592
- #: includes/class-mla-core-options.php:548
593
  msgid "Media/Assistant Screen Options"
594
  msgstr ""
595
 
596
- #: includes/class-mla-core-options.php:553
597
  msgid "Admin Menu Options"
598
  msgstr ""
599
 
600
- #: includes/class-mla-core-options.php:558
601
  msgid "Page Title"
602
  msgstr ""
603
 
604
- #: includes/class-mla-core-options.php:563
605
  msgid "Enter the title for the Media/Assistant submenu page"
606
  msgstr ""
607
 
608
- #: includes/class-mla-core-options.php:567
609
  msgid "Menu Title"
610
  msgstr ""
611
 
612
- #: includes/class-mla-core-options.php:572
613
  msgid "Enter the title for the Media/Assistant submenu entry"
614
  msgstr ""
615
 
616
- #: includes/class-mla-core-options.php:576
617
  msgid "Submenu Order"
618
  msgstr ""
619
 
620
- #: includes/class-mla-core-options.php:581
621
  msgid ""
622
  "Enter the position of the Media/Assistant submenu entry.<br>&nbsp;&nbsp;0 = "
623
  "natural order (at bottom),&nbsp;&nbsp;&nbsp;&nbsp;1 - 4 = at top<br>&nbsp;"
@@ -625,304 +625,304 @@ msgid ""
625
  "\""
626
  msgstr ""
627
 
628
- #: includes/class-mla-core-options.php:585
629
  msgid "Display Media/Library"
630
  msgstr ""
631
 
632
- #: includes/class-mla-core-options.php:589
633
  msgid ""
634
  "Check/uncheck this option to display/remove the WordPress Media/Library "
635
  "submenu entry."
636
  msgstr ""
637
 
638
- #: includes/class-mla-core-options.php:593
639
  msgid "Display Media/Assistant list/grid view switcher"
640
  msgstr ""
641
 
642
- #: includes/class-mla-core-options.php:597
643
  msgid ""
644
  "Check/uncheck this option to display/remove the \"list/grid\" view switcher "
645
  "on the Media/Assistant submenu."
646
  msgstr ""
647
 
648
- #: includes/class-mla-core-options.php:601
649
  msgid "Table Defaults"
650
  msgstr ""
651
 
652
- #: includes/class-mla-core-options.php:606
653
  msgid "Order By"
654
  msgstr ""
655
 
656
- #: includes/class-mla-core-options.php:611
657
  msgid "ID/Parent"
658
  msgstr ""
659
 
660
- #: includes/class-mla-core-options.php:612
661
  msgid "Select the column for the sort order of the Assistant table listing."
662
  msgstr ""
663
 
664
- #: includes/class-mla-core-options.php:616
665
  msgid "Order"
666
  msgstr ""
667
 
668
- #: includes/class-mla-core-options.php:621
669
  msgid "Ascending"
670
  msgstr ""
671
 
672
- #: includes/class-mla-core-options.php:621
673
  msgid "Descending"
674
  msgstr ""
675
 
676
- #: includes/class-mla-core-options.php:622
677
- #: includes/class-mla-core-options.php:878
678
  msgid "Choose the sort order."
679
  msgstr ""
680
 
681
- #: includes/class-mla-core-options.php:626 includes/class-mla-main.php:630
682
  msgid "Entries per page"
683
  msgstr ""
684
 
685
- #: includes/class-mla-core-options.php:630
686
  msgid "Enter the number of Media/Assistant submenu table items per page."
687
  msgstr ""
688
 
689
- #: includes/class-mla-core-options.php:639
690
  msgid "Views Width"
691
  msgstr ""
692
 
693
- #: includes/class-mla-core-options.php:644
694
  msgid "Enter the width for the views list, in pixels (px) or percent (%)"
695
  msgstr ""
696
 
697
- #: includes/class-mla-core-options.php:648
698
  msgid "Icon Size"
699
  msgstr ""
700
 
701
- #: includes/class-mla-core-options.php:653
702
  msgid "Enter the size of the thumbnail/icon images, in pixels"
703
  msgstr ""
704
 
705
- #: includes/class-mla-core-options.php:657
706
  msgid "Show Primary Column File Name"
707
  msgstr ""
708
 
709
- #: includes/class-mla-core-options.php:661
710
  msgid ""
711
  "Check/uncheck this option to show/omit the file name from the primary column."
712
  msgstr ""
713
 
714
- #: includes/class-mla-core-options.php:665
715
  msgid "QuickTags editor for bulk description"
716
  msgstr ""
717
 
718
- #: includes/class-mla-core-options.php:669
719
  msgid ""
720
  "Check this option to use the QuickTags editor for the Description field in "
721
  "the Bulk Edit area."
722
  msgstr ""
723
 
724
- #: includes/class-mla-core-options.php:673
725
  msgid "Bulk Chunk Size"
726
  msgstr ""
727
 
728
- #: includes/class-mla-core-options.php:678
729
  msgid "Enter the size of the Bulk Edit and Map All processing chunks"
730
  msgstr ""
731
 
732
- #: includes/class-mla-core-options.php:682
733
  msgid "Taxonomy Filter parameters"
734
  msgstr ""
735
 
736
- #: includes/class-mla-core-options.php:687
737
  msgid "Maximum Depth"
738
  msgstr ""
739
 
740
- #: includes/class-mla-core-options.php:692
741
  msgid ""
742
  "Enter the number of levels displayed for hierarchial taxonomies; enter zero "
743
  "for no limit."
744
  msgstr ""
745
 
746
- #: includes/class-mla-core-options.php:696
747
  msgid "Include Children"
748
  msgstr ""
749
 
750
- #: includes/class-mla-core-options.php:700
751
  msgid ""
752
  "Check/uncheck this option to include/exclude children for hierarchical "
753
  "taxonomies."
754
  msgstr ""
755
 
756
- #: includes/class-mla-core-options.php:704
757
  msgid "Search Media Defaults"
758
  msgstr ""
759
 
760
- #: includes/class-mla-core-options.php:709
761
  msgid "Display Search Controls"
762
  msgstr ""
763
 
764
- #: includes/class-mla-core-options.php:713
765
- #: includes/class-mla-core-options.php:839
766
  msgid ""
767
  "Check/uncheck this option to display/hide the and/or connector and search "
768
  "fields controls."
769
  msgstr ""
770
 
771
- #: includes/class-mla-core-options.php:717
772
  msgid ""
773
  "Use these controls to set defaults for the and/or connector and search "
774
  "fields controls.<br>These defaults will be used for the Search Media boxes "
775
  "on both the Media/Assistant submenu<br>and the Media Manager Modal Window."
776
  msgstr ""
777
 
778
- #: includes/class-mla-core-options.php:731
779
  msgid "Media/Edit Media Enhancements"
780
  msgstr ""
781
 
782
- #: includes/class-mla-core-options.php:736
783
  msgid "Enable &quot;enhanced checklist&quot; taxonomies"
784
  msgstr ""
785
 
786
- #: includes/class-mla-core-options.php:740
787
  msgid ""
788
  "Check this option to enable the \"? Search\" feature for hierarchical "
789
  "taxonomies, e.g., Att. Categories.<br>&nbsp;&nbsp;This option also enables "
790
  "the \"checklist-style\" support for flat taxonomies, e.g., Att. Tags."
791
  msgstr ""
792
 
793
- #: includes/class-mla-core-options.php:744
794
  msgid "Enable Edit Media additional meta boxes"
795
  msgstr ""
796
 
797
- #: includes/class-mla-core-options.php:748
798
  msgid ""
799
  "Check this option to add \"Parent Info\", \"Menu Order\", \"Attachment "
800
  "Metadata\" and four \"where-used\" meta boxes to the Edit Media screen."
801
  msgstr ""
802
 
803
- #: includes/class-mla-core-options.php:749
804
  msgid "You can also use Filters to customize the meta boxes."
805
  msgstr ""
806
 
807
- #: includes/class-mla-core-options.php:754
808
  msgid "Media/Add New Enhancements"
809
  msgstr ""
810
 
811
- #: includes/class-mla-core-options.php:759
812
  msgid "Enable &quot;bulk edit&quot; area"
813
  msgstr ""
814
 
815
- #: includes/class-mla-core-options.php:763
816
  msgid ""
817
  "Check this option to enable the \"Bulk Edit area\" feature on the Media/Add "
818
  "New screen."
819
  msgstr ""
820
 
821
- #: includes/class-mla-core-options.php:767
822
  msgid "&quot;bulk edit&quot; area on top"
823
  msgstr ""
824
 
825
- #: includes/class-mla-core-options.php:771
826
  msgid ""
827
  "Check this option to move the \"Bulk Edit area\" to the top of the Media/Add "
828
  "New screen."
829
  msgstr ""
830
 
831
- #: includes/class-mla-core-options.php:775
832
  msgid "&quot;bulk edit&quot; area initially open"
833
  msgstr ""
834
 
835
- #: includes/class-mla-core-options.php:778
836
  msgid ""
837
  "Check this option to automatically open the \"Bulk Edit area\" when the "
838
  "Media/Add New screen is displayed."
839
  msgstr ""
840
 
841
- #: includes/class-mla-core-options.php:782
842
  msgid "Media Manager/Media Grid Enhancements"
843
  msgstr ""
844
 
845
- #: includes/class-mla-core-options.php:787
846
  msgid "Enable Media Grid Enhancements"
847
  msgstr ""
848
 
849
- #: includes/class-mla-core-options.php:790
850
  msgid ""
851
  "Check/uncheck this option to enable/disable Media Library Grid View "
852
  "Enhancements."
853
  msgstr ""
854
 
855
- #: includes/class-mla-core-options.php:794
856
  msgid "Enable Media Manager Enhancements"
857
  msgstr ""
858
 
859
- #: includes/class-mla-core-options.php:797
860
  msgid ""
861
  "Check/uncheck this option to enable/disable Media Manager Modal Window "
862
  "Enhancements."
863
  msgstr ""
864
 
865
- #: includes/class-mla-core-options.php:801
866
  msgid "Media Manager Enhanced MIME Type filter"
867
  msgstr ""
868
 
869
- #: includes/class-mla-core-options.php:804
870
  msgid ""
871
  "Check this option to filter by more MIME Types, e.g., text, applications."
872
  msgstr ""
873
 
874
- #: includes/class-mla-core-options.php:808
875
  msgid "Media Manager Month and Year filter"
876
  msgstr ""
877
 
878
- #: includes/class-mla-core-options.php:811
879
  msgid "Check this option to filter by month and year uploaded."
880
  msgstr ""
881
 
882
- #: includes/class-mla-core-options.php:815
883
  msgid "Media Manager Category/Tag filter"
884
  msgstr ""
885
 
886
- #: includes/class-mla-core-options.php:818
887
  msgid "Check this option to filter by taxonomy terms."
888
  msgstr ""
889
 
890
- #: includes/class-mla-core-options.php:822
891
  msgid "Media Manager Terms Search popup"
892
  msgstr ""
893
 
894
- #: includes/class-mla-core-options.php:825
895
  msgid "Check this option to enable the \"Terms Search\" popup window."
896
  msgstr ""
897
 
898
- #: includes/class-mla-core-options.php:829
899
  msgid "Media Manager Enhanced Search Media box"
900
  msgstr ""
901
 
902
- #: includes/class-mla-core-options.php:832
903
  msgid "Check this option to enable search box enhancements."
904
  msgstr ""
905
 
906
- #: includes/class-mla-core-options.php:836
907
  msgid "Media Manager Enhanced Search Media Controls"
908
  msgstr ""
909
 
910
- #: includes/class-mla-core-options.php:843
911
  msgid "Media Manager Checklist meta boxes"
912
  msgstr ""
913
 
914
- #: includes/class-mla-core-options.php:846
915
  msgid ""
916
  "Check this option to enable MLA-enhanced meta boxes in the \"ATTACHMENT "
917
  "DETAILS\" pane.<br>&nbsp;&nbsp;This option is for any taxonomy that uses a "
918
  "<strong>\"checklist-style\"</strong> meta box."
919
  msgstr ""
920
 
921
- #: includes/class-mla-core-options.php:850
922
  msgid "Media Manager Flat meta boxes"
923
  msgstr ""
924
 
925
- #: includes/class-mla-core-options.php:853
926
  msgid ""
927
  "Check this option to enable MLA-enhanced meta boxes in the \"ATTACHMENT "
928
  "DETAILS\" pane.<br>&nbsp;&nbsp;This option is for <strong>flat taxonomies</"
@@ -930,211 +930,211 @@ msgid ""
930
  "style\" meta box."
931
  msgstr ""
932
 
933
- #: includes/class-mla-core-options.php:857
934
  msgid "Media Manager auto-fill meta boxes"
935
  msgstr ""
936
 
937
- #: includes/class-mla-core-options.php:860
938
  msgid ""
939
  "Check this option to automatically fill MLA-enhanced meta boxes in the "
940
  "\"ATTACHMENT DETAILS\" pane<br>&nbsp;&nbsp;when the item is selected."
941
  msgstr ""
942
 
943
- #: includes/class-mla-core-options.php:864
944
  msgid "Media Manager Order By"
945
  msgstr ""
946
 
947
- #: includes/class-mla-core-options.php:868
948
- #: includes/class-mla-core-options.php:877
949
- #: includes/class-mla-core-options.php:899
950
- #: includes/class-mla-core-options.php:913
951
- #: includes/class-mla-core-options.php:927 includes/class-mla-settings.php:1137
952
  msgid "Media Manager Default"
953
  msgstr ""
954
 
955
- #: includes/class-mla-core-options.php:868
956
  msgid "Title/Name"
957
  msgstr ""
958
 
959
- #: includes/class-mla-core-options.php:869
960
  msgid ""
961
  "If you want to override the Media Manager default,<br>&nbsp;&nbsp;select a "
962
  "column for the sort order of the Media Library listing."
963
  msgstr ""
964
 
965
- #: includes/class-mla-core-options.php:873
966
  msgid "Media Manager Order"
967
  msgstr ""
968
 
969
- #: includes/class-mla-core-options.php:882
970
  msgid "Attachment Display Settings"
971
  msgstr ""
972
 
973
- #: includes/class-mla-core-options.php:887
974
  msgid "Media Manager Apply Display Settings"
975
  msgstr ""
976
 
977
- #: includes/class-mla-core-options.php:890
978
  msgid ""
979
  "Check this option to always start with the Attachment Display Settings set "
980
  "here,<br>&nbsp;&nbsp;overriding browser-/cookie-based defaults."
981
  msgstr ""
982
 
983
- #: includes/class-mla-core-options.php:894
984
- #: includes/class-mla-core-options.php:896
985
  msgid "Alignment"
986
  msgstr ""
987
 
988
- #: includes/class-mla-core-options.php:896
989
- #: includes/class-mla-core-options.php:910
990
- #: includes/class-mla-core-options.php:924
991
  #, php-format
992
  msgid ""
993
  "Select a value for the default %1$s option in the Attachment Display "
994
  "Settings."
995
  msgstr ""
996
 
997
- #: includes/class-mla-core-options.php:899
998
  msgid "Left"
999
  msgstr ""
1000
 
1001
- #: includes/class-mla-core-options.php:899
1002
  msgid "Center"
1003
  msgstr ""
1004
 
1005
- #: includes/class-mla-core-options.php:899
1006
  msgid "Right"
1007
  msgstr ""
1008
 
1009
- #: includes/class-mla-core-options.php:908
1010
- #: includes/class-mla-core-options.php:910
1011
  msgid "Link To"
1012
  msgstr ""
1013
 
1014
- #: includes/class-mla-core-options.php:913
1015
  msgid "Media File"
1016
  msgstr ""
1017
 
1018
- #: includes/class-mla-core-options.php:913
1019
  msgid "Attachment Page"
1020
  msgstr ""
1021
 
1022
- #: includes/class-mla-core-options.php:913
1023
  msgid "Custom URL"
1024
  msgstr ""
1025
 
1026
- #: includes/class-mla-core-options.php:922
1027
- #: includes/class-mla-core-options.php:924
1028
  msgid "Size"
1029
  msgstr ""
1030
 
1031
- #: includes/class-mla-core-options.php:927
1032
  #: includes/class-mla-thumbnail-generation.php:591
1033
  #: includes/class-mla-thumbnail-generation.php:655
1034
  msgid "Thumbnail"
1035
  msgstr ""
1036
 
1037
- #: includes/class-mla-core-options.php:927
1038
  msgid "Medium"
1039
  msgstr ""
1040
 
1041
- #: includes/class-mla-core-options.php:927
1042
  msgid "Large"
1043
  msgstr ""
1044
 
1045
- #: includes/class-mla-core-options.php:927
1046
  msgid "Full Size"
1047
  msgstr ""
1048
 
1049
- #: includes/class-mla-core-options.php:936
1050
  msgid "Uninstall (Delete) Plugin Settings"
1051
  msgstr ""
1052
 
1053
- #: includes/class-mla-core-options.php:941
1054
  msgid "Delete Option Settings"
1055
  msgstr ""
1056
 
1057
- #: includes/class-mla-core-options.php:944
1058
  msgid ""
1059
  "Check this option to remove all MLA option settings from the database when "
1060
  "the plugin is deleted.<br>&nbsp;&nbsp;<strong>You can make a backup copy</"
1061
  "strong> of your settings below by clicking \""
1062
  msgstr ""
1063
 
1064
- #: includes/class-mla-core-options.php:944 includes/class-mla-settings.php:1062
1065
  msgid "Export ALL Settings"
1066
  msgstr ""
1067
 
1068
- #: includes/class-mla-core-options.php:948
1069
  msgid "Delete Option Settings Backups"
1070
  msgstr ""
1071
 
1072
- #: includes/class-mla-core-options.php:951
1073
  msgid ""
1074
  "Check this option to remove the <code>/wp-content/mla-backup</code> "
1075
  "directory and its contents when the plugin is deleted."
1076
  msgstr ""
1077
 
1078
- #: includes/class-mla-core-options.php:955
1079
  msgid "Default [mla_gallery] Templates and Settings"
1080
  msgstr ""
1081
 
1082
- #: includes/class-mla-core-options.php:960
1083
- #: includes/class-mla-core-options.php:966
1084
- #: includes/class-mla-core-options.php:1004
1085
- #: includes/class-mla-core-options.php:1010
1086
  msgid "Style Template"
1087
  msgstr ""
1088
 
1089
- #: includes/class-mla-core-options.php:966
1090
- #: includes/class-mla-core-options.php:976
1091
- #: includes/class-mla-core-options.php:1010
1092
- #: includes/class-mla-core-options.php:1020
1093
  #, php-format
1094
  msgid "Select the default %1$s for your %2$s shortcodes."
1095
  msgstr ""
1096
 
1097
- #: includes/class-mla-core-options.php:970
1098
- #: includes/class-mla-core-options.php:1014
1099
  msgid "Markup Template"
1100
  msgstr ""
1101
 
1102
- #: includes/class-mla-core-options.php:976
1103
- #: includes/class-mla-core-options.php:1020
1104
  #: includes/class-mla-settings-shortcodes-tab.php:108
1105
  msgid "markup template"
1106
  msgstr ""
1107
 
1108
- #: includes/class-mla-core-options.php:980
1109
- #: includes/class-mla-core-options.php:1024
1110
  msgid "Default columns"
1111
  msgstr ""
1112
 
1113
- #: includes/class-mla-core-options.php:984
1114
  msgid ""
1115
  "Enter the number of [mla_tag_cloud] columns; must be a positive integer."
1116
  msgstr ""
1117
 
1118
- #: includes/class-mla-core-options.php:988
1119
- #: includes/class-mla-core-options.php:1032
1120
  msgid "Default mla_margin"
1121
  msgstr ""
1122
 
1123
- #: includes/class-mla-core-options.php:992
1124
- #: includes/class-mla-core-options.php:1036
1125
  msgid ""
1126
  "Enter the CSS \"margin\" property value, in length (px, em, pt, etc.), "
1127
  "percent (%), \"auto\" or \"inherit\".<br>&nbsp;&nbsp;Enter \"none\" to "
1128
  "remove the property entirely."
1129
  msgstr ""
1130
 
1131
- #: includes/class-mla-core-options.php:996
1132
- #: includes/class-mla-core-options.php:1040
1133
  msgid "Default mla_itemwidth"
1134
  msgstr ""
1135
 
1136
- #: includes/class-mla-core-options.php:1000
1137
- #: includes/class-mla-core-options.php:1044
1138
  msgid ""
1139
  "Enter the CSS \"width\" property value, in length (px, em, pt, etc.), "
1140
  "percent (%), \"auto\" or \"inherit\".<br>&nbsp;&nbsp;Enter \"calculate"
@@ -1144,19 +1144,19 @@ msgid ""
1144
  "the property entirely."
1145
  msgstr ""
1146
 
1147
- #: includes/class-mla-core-options.php:1028
1148
  msgid "Enter the number of [mla_gallery] columns; must be a positive integer."
1149
  msgstr ""
1150
 
1151
- #: includes/class-mla-core-options.php:1048
1152
  msgid "Thumbnail Substitution Support, mla_viewer"
1153
  msgstr ""
1154
 
1155
- #: includes/class-mla-core-options.php:1053
1156
  msgid "Enable thumbnail substitution"
1157
  msgstr ""
1158
 
1159
- #: includes/class-mla-core-options.php:1056
1160
  msgid ""
1161
  "Check this option to allow the \"mla_viewer\" to generate thumbnail images "
1162
  "for PDF documents. Thumbnails are generated dynamically, each time the item "
@@ -1165,32 +1165,32 @@ msgid ""
1165
  "strong>"
1166
  msgstr ""
1167
 
1168
- #: includes/class-mla-core-options.php:1060
1169
  msgid "Enable Featured Images"
1170
  msgstr ""
1171
 
1172
- #: includes/class-mla-core-options.php:1063
1173
  msgid ""
1174
  "Check this option to extend Featured Image support to all Media Library "
1175
  "items. The Featured Image can be used as a thumbnail image for the item in "
1176
  "an [mla_gallery] display."
1177
  msgstr ""
1178
 
1179
- #: includes/class-mla-core-options.php:1067
1180
  msgid "Enable Featured Image Generation"
1181
  msgstr ""
1182
 
1183
- #: includes/class-mla-core-options.php:1070
1184
  msgid ""
1185
  "Check this option to enable the \"Thumbnail\" generation action in the Media/"
1186
  "Assistant submenu Bulk Actions dropdown."
1187
  msgstr ""
1188
 
1189
- #: includes/class-mla-core-options.php:1074
1190
  msgid "Enable explicit Ghostscript check"
1191
  msgstr ""
1192
 
1193
- #: includes/class-mla-core-options.php:1077
1194
  msgid ""
1195
  "Check this option to enable the explicit check for Ghostscript support "
1196
  "required for thumbnail generation. If your Ghostscript software is in a non-"
@@ -1199,37 +1199,37 @@ msgid ""
1199
  "leave this option checked unless you know it is safe to turn it off."
1200
  msgstr ""
1201
 
1202
- #: includes/class-mla-core-options.php:1081
1203
  msgid "Ghostscript path"
1204
  msgstr ""
1205
 
1206
- #: includes/class-mla-core-options.php:1085
1207
  msgid ""
1208
  "If your &ldquo;gs&rdquo; executable is in a non-standard location, enter the "
1209
  "full path and filename here, e.g., &ldquo;/usr/bin/gs&rdquo;. It will "
1210
  "override the search for Ghostscript in other places."
1211
  msgstr ""
1212
 
1213
- #: includes/class-mla-core-options.php:1105
1214
  msgid "Enable custom field mapping"
1215
  msgstr ""
1216
 
1217
- #: includes/class-mla-core-options.php:1108
1218
- #: includes/class-mla-core-options.php:1115
1219
- #: includes/class-mla-core-options.php:1122
1220
- #: includes/class-mla-core-options.php:1139
1221
  msgid "See Help menu."
1222
  msgstr ""
1223
 
1224
- #: includes/class-mla-core-options.php:1112
1225
  msgid "Enable custom field mapping when adding new media"
1226
  msgstr ""
1227
 
1228
- #: includes/class-mla-core-options.php:1119
1229
  msgid "Enable custom field mapping when updating media metadata"
1230
  msgstr ""
1231
 
1232
- #: includes/class-mla-core-options.php:1126
1233
  msgid ""
1234
  "Update the custom field mapping values above, then click Save Changes to "
1235
  "make the updates permanent.<br>You can also make temporary updates and click "
@@ -1237,33 +1237,33 @@ msgid ""
1237
  "saving any rule changes."
1238
  msgstr ""
1239
 
1240
- #: includes/class-mla-core-options.php:1136
1241
  msgid "Enable IPTC/EXIF Mapping"
1242
  msgstr ""
1243
 
1244
- #: includes/class-mla-core-options.php:1143
1245
  msgid "Enable IPTC/EXIF Mapping when adding new media"
1246
  msgstr ""
1247
 
1248
- #: includes/class-mla-core-options.php:1146
1249
  msgid ""
1250
  "Check this option to enable mapping when uploading new media (attachments)."
1251
  "<br>&nbsp;&nbsp;Does NOT affect the operation of the \"Map\" buttons on the "
1252
  "bulk edit, single edit and settings screens."
1253
  msgstr ""
1254
 
1255
- #: includes/class-mla-core-options.php:1150
1256
  msgid "Enable IPTC/EXIF Mapping when updating media metadata"
1257
  msgstr ""
1258
 
1259
- #: includes/class-mla-core-options.php:1153
1260
  msgid ""
1261
  "Check this option to enable mapping when media (attachments) metadata is "
1262
  "regenerated,<br>&nbsp;&nbsp;e.g., when the Media/Edit Media \"Edit Image\" "
1263
  "functions are used."
1264
  msgstr ""
1265
 
1266
- #: includes/class-mla-core-options.php:1157
1267
  msgid ""
1268
  "Update the standard field mapping values above, then click <strong>Save "
1269
  "Changes</strong> to make the updates permanent.<br>You can also make "
@@ -1272,13 +1272,13 @@ msgid ""
1272
  "changes."
1273
  msgstr ""
1274
 
1275
- #: includes/class-mla-core-options.php:1167
1276
  msgid ""
1277
  "Update the taxonomy term mapping values above, then click <strong>Save "
1278
  "Changes</strong> or <strong>Map All Attachments, Taxonomy Terms Now</strong>."
1279
  msgstr ""
1280
 
1281
- #: includes/class-mla-core-options.php:1177
1282
  msgid ""
1283
  "<strong>Update</strong> individual custom field mapping values above, or "
1284
  "make several updates and click <strong>Save Changes</strong> below to apply "
@@ -1289,33 +1289,33 @@ msgid ""
1289
  "changes."
1290
  msgstr ""
1291
 
1292
- #: includes/class-mla-core-options.php:1187
1293
  msgid "IPTC/EXIF Mapping help"
1294
  msgstr ""
1295
 
1296
- #: includes/class-mla-core-options.php:1198 includes/class-mla-data.php:4310
1297
- #: includes/class-mla-edit-media.php:481 includes/class-mla-main.php:2403
1298
  msgid "Name/Slug"
1299
  msgstr ""
1300
 
1301
- #: includes/class-mla-core-options.php:1205 includes/class-mla-data.php:4353
1302
- #: includes/class-mla-edit-media.php:484 includes/class-mla-list-table.php:1432
1303
- #: includes/class-mla-main.php:2407 includes/class-mla-options.php:472
1304
  #: includes/mla-main-search-box-template.php:51
1305
- #: includes/mla-media-modal-js-template.php:65
1306
  msgid "ALT Text"
1307
  msgstr ""
1308
 
1309
- #: includes/class-mla-core-options.php:1212 includes/class-mla-data.php:4366
1310
- #: includes/class-mla-edit-media.php:482 includes/class-mla-main.php:2404
1311
  #: includes/class-mla-options.php:475
1312
  #: includes/mla-main-search-box-template.php:53
1313
- #: includes/mla-media-modal-js-template.php:70
1314
  msgid "Caption"
1315
  msgstr ""
1316
 
1317
- #: includes/class-mla-core-options.php:1219 includes/class-mla-data.php:4375
1318
- #: includes/class-mla-edit-media.php:483 includes/class-mla-main.php:2405
1319
  #: includes/class-mla-options.php:478
1320
  #: includes/class-mla-settings-upload-tab.php:199
1321
  #: includes/class-mla-settings-upload-tab.php:543
@@ -1328,31 +1328,31 @@ msgstr ""
1328
  #: includes/class-mla-template-support.php:178
1329
  #: includes/class-mla-template-support.php:226
1330
  #: includes/mla-main-search-box-template.php:55
1331
- #: includes/mla-media-modal-js-template.php:74
1332
  msgid "Description"
1333
  msgstr ""
1334
 
1335
- #: includes/class-mla-core-options.php:1226 includes/class-mla-data.php:4437
1336
- #: includes/class-mla-data.php:4446 includes/class-mla-edit-media.php:485
1337
- #: includes/class-mla-edit-media.php:683 includes/class-mla-main.php:2409
1338
  msgid "Uploaded on"
1339
  msgstr ""
1340
 
1341
- #: includes/class-mla-core-options.php:1246
1342
  msgid "Enable View and Post MIME Type Support"
1343
  msgstr ""
1344
 
1345
- #: includes/class-mla-core-options.php:1249
1346
  msgid ""
1347
  "Check/uncheck this option to enable/disable Post MIME Type Support, then "
1348
  "click <strong>Save Changes</strong> to record the new setting."
1349
  msgstr ""
1350
 
1351
- #: includes/class-mla-core-options.php:1258
1352
  msgid "Post MIME Types help."
1353
  msgstr ""
1354
 
1355
- #: includes/class-mla-core-options.php:1261
1356
  #: includes/class-mla-mime-types.php:1696
1357
  #: includes/class-mla-settings-custom-fields-tab.php:2470
1358
  #: includes/class-mla-settings-documentation-tab.php:1545
@@ -1362,7 +1362,7 @@ msgctxt "table_view_singular"
1362
  msgid "All"
1363
  msgstr ""
1364
 
1365
- #: includes/class-mla-core-options.php:1262
1366
  #: includes/class-mla-mime-types.php:1697
1367
  #: includes/class-mla-settings-custom-fields-tab.php:2471
1368
  #: includes/class-mla-settings-documentation-tab.php:1546
@@ -1372,174 +1372,174 @@ msgctxt "table_view_plural"
1372
  msgid "All"
1373
  msgstr ""
1374
 
1375
- #: includes/class-mla-core-options.php:1267
1376
- #: includes/class-mla-core-options.php:1321
1377
- #: includes/class-mla-core-options.php:1330
1378
- #: includes/class-mla-core-options.php:1339
1379
- #: includes/class-mla-core-options.php:1348
1380
  msgctxt "post_mime_types_description"
1381
  msgid "Built-in view"
1382
  msgstr ""
1383
 
1384
- #: includes/class-mla-core-options.php:1270
1385
  msgctxt "table_view_singular"
1386
  msgid "Image"
1387
  msgstr ""
1388
 
1389
- #: includes/class-mla-core-options.php:1271
1390
  msgctxt "table_view_plural"
1391
  msgid "Images"
1392
  msgstr ""
1393
 
1394
- #: includes/class-mla-core-options.php:1276
1395
  msgctxt "post_mime_types_description"
1396
  msgid "All image subtypes"
1397
  msgstr ""
1398
 
1399
- #: includes/class-mla-core-options.php:1279
1400
  msgctxt "table_view_singular"
1401
  msgid "Audio"
1402
  msgstr ""
1403
 
1404
- #: includes/class-mla-core-options.php:1280
1405
  msgctxt "table_view_plural"
1406
  msgid "Audio"
1407
  msgstr ""
1408
 
1409
- #: includes/class-mla-core-options.php:1285
1410
  msgctxt "post_mime_types_description"
1411
  msgid "All audio subtypes"
1412
  msgstr ""
1413
 
1414
- #: includes/class-mla-core-options.php:1288
1415
  msgctxt "table_view_singular"
1416
  msgid "Video"
1417
  msgstr ""
1418
 
1419
- #: includes/class-mla-core-options.php:1289
1420
  msgctxt "table_view_plural"
1421
  msgid "Video"
1422
  msgstr ""
1423
 
1424
- #: includes/class-mla-core-options.php:1294
1425
  msgctxt "post_mime_types_description"
1426
  msgid "All video subtypes"
1427
  msgstr ""
1428
 
1429
- #: includes/class-mla-core-options.php:1297
1430
  msgctxt "table_view_singular"
1431
  msgid "Text"
1432
  msgstr ""
1433
 
1434
- #: includes/class-mla-core-options.php:1298
1435
  msgctxt "table_view_plural"
1436
  msgid "Text"
1437
  msgstr ""
1438
 
1439
- #: includes/class-mla-core-options.php:1303
1440
  msgctxt "post_mime_types_description"
1441
  msgid "All text subtypes"
1442
  msgstr ""
1443
 
1444
- #: includes/class-mla-core-options.php:1306
1445
  msgctxt "table_view_singular"
1446
  msgid "Application"
1447
  msgstr ""
1448
 
1449
- #: includes/class-mla-core-options.php:1307
1450
  msgctxt "table_view_plural"
1451
  msgid "Applications"
1452
  msgstr ""
1453
 
1454
- #: includes/class-mla-core-options.php:1312
1455
  msgctxt "post_mime_types_description"
1456
  msgid "All application subtypes"
1457
  msgstr ""
1458
 
1459
- #: includes/class-mla-core-options.php:1316
1460
  msgctxt "table_view_plural"
1461
  msgid "Unattached"
1462
  msgstr ""
1463
 
1464
- #: includes/class-mla-core-options.php:1324
1465
  msgctxt "table_view_singular"
1466
  msgid "Attached"
1467
  msgstr ""
1468
 
1469
- #: includes/class-mla-core-options.php:1325
1470
  msgctxt "table_view_plural"
1471
  msgid "Attached"
1472
  msgstr ""
1473
 
1474
- #: includes/class-mla-core-options.php:1333
1475
  msgctxt "table_view_singular"
1476
  msgid "Mine"
1477
  msgstr ""
1478
 
1479
- #: includes/class-mla-core-options.php:1334
1480
  msgctxt "table_view_plural"
1481
  msgid "Mine"
1482
  msgstr ""
1483
 
1484
- #: includes/class-mla-core-options.php:1342
1485
  msgctxt "table_view_singular"
1486
  msgid "Trash"
1487
  msgstr ""
1488
 
1489
- #: includes/class-mla-core-options.php:1343
1490
  msgctxt "table_view_plural"
1491
  msgid "Trash"
1492
  msgstr ""
1493
 
1494
- #: includes/class-mla-core-options.php:1354
1495
  msgid "Enable Upload MIME Type Support"
1496
  msgstr ""
1497
 
1498
- #: includes/class-mla-core-options.php:1357
1499
  msgid ""
1500
  "Check/uncheck this option to enable/disable Upload MIME Type Support, then "
1501
  "click <strong>Save Changes</strong> to record the new setting."
1502
  msgstr ""
1503
 
1504
- #: includes/class-mla-core-options.php:1366
1505
  msgid "Upload MIME Types help."
1506
  msgstr ""
1507
 
1508
- #: includes/class-mla-core-options.php:1371
1509
  msgid "Enable MLA File Type Icons Support"
1510
  msgstr ""
1511
 
1512
- #: includes/class-mla-core-options.php:1374
1513
  msgid ""
1514
  "Check/uncheck this option to enable/disable MLA File Type Icons Support, "
1515
  "then click <strong>Save Changes</strong> to record the new setting."
1516
  msgstr ""
1517
 
1518
- #: includes/class-mla-core-options.php:1378
1519
  msgid "Always Use MLA MIME Type"
1520
  msgstr ""
1521
 
1522
- #: includes/class-mla-core-options.php:1381
1523
  msgid ""
1524
  "Check this option to override WordPress MIME Type security checks, then "
1525
  "click <strong>Save Changes</strong> to record the new setting."
1526
  msgstr ""
1527
 
1528
- #: includes/class-mla-core-options.php:1385
1529
  msgid "Display Limit"
1530
  msgstr ""
1531
 
1532
- #: includes/class-mla-core-options.php:1389
1533
  msgid ""
1534
  "Enter the maximum number of debug log characters to display; enter zero or "
1535
  "leave blank for no limit."
1536
  msgstr ""
1537
 
1538
- #: includes/class-mla-core-options.php:1393
1539
  msgid "Debug File"
1540
  msgstr ""
1541
 
1542
- #: includes/class-mla-core-options.php:1397
1543
  msgid ""
1544
  "Enter the name of an alternate, MLA-specific debug log file; leave blank to "
1545
  "use the PHP error_log.<br>&nbsp;&nbsp;The WP_CONTENT_DIR value (below) will "
@@ -1547,36 +1547,46 @@ msgid ""
1547
  "\"."
1548
  msgstr ""
1549
 
1550
- #: includes/class-mla-core-options.php:1401
1551
  msgid "Replace PHP error_log file"
1552
  msgstr ""
1553
 
1554
- #: includes/class-mla-core-options.php:1404
1555
  msgid ""
1556
  "Check this option to replace the PHP error_log file with the MLA Debug File."
1557
  "<br>&nbsp;&nbsp;allows capture of PHP messages in the MLA Debug File."
1558
  msgstr ""
1559
 
1560
- #: includes/class-mla-core-options.php:1408
1561
  msgid "PHP Reporting"
1562
  msgstr ""
1563
 
1564
- #: includes/class-mla-core-options.php:1412
1565
  msgid ""
1566
  "Enter a numeric error_reporting value, e.g., 0x7FFF or 32767; leave blank to "
1567
  "use the existing PHP error_reporting value."
1568
  msgstr ""
1569
 
1570
- #: includes/class-mla-core-options.php:1416
1571
  msgid "MLA Reporting"
1572
  msgstr ""
1573
 
1574
- #: includes/class-mla-core-options.php:1420
1575
  msgid ""
1576
  "Enter a numeric MLA_DEBUG_LEVEL value, e.g., 0x0003 or 3; leave blank to use "
1577
  "the existing MLA_DEBUG_LEVEL value."
1578
  msgstr ""
1579
 
 
 
 
 
 
 
 
 
 
 
1580
  #: includes/class-mla-core.php:893
1581
  #, php-format
1582
  msgctxt "error_log"
@@ -1614,11 +1624,11 @@ msgid "+ %s"
1614
  msgstr ""
1615
 
1616
  #: includes/class-mla-core.php:1513 includes/class-mla-edit-media.php:362
1617
- #: includes/class-mla-edit-media.php:418 includes/class-mla-main.php:2072
1618
- #: includes/class-mla-main.php:2268 includes/class-mla-main.php:2334
1619
  #: includes/class-mla-media-modal.php:648
1620
- #: includes/mla-media-modal-js-template.php:45
1621
- #: includes/mla-media-modal-js-template.php:92
1622
  msgid "Search"
1623
  msgstr ""
1624
 
@@ -1798,55 +1808,55 @@ msgctxt "error_log"
1798
  msgid " %1$s: %2$s non-array \"%3$s\""
1799
  msgstr ""
1800
 
1801
- #: includes/class-mla-data-query.php:1363
1802
  #, php-format
1803
  msgctxt "error_log"
1804
  msgid " %1$s: _execute_list_table_query $wp_filter = \"%2$s\"."
1805
  msgstr ""
1806
 
1807
- #: includes/class-mla-data-query.php:1378
1808
  #, php-format
1809
  msgctxt "error_log"
1810
  msgid " %1$s: _execute_list_table_query WP_Query = \"%2$s\"."
1811
  msgstr ""
1812
 
1813
- #: includes/class-mla-data-query.php:1380
1814
  #, php-format
1815
  msgctxt "error_log"
1816
  msgid " %1$s: _execute_list_table_query SQL_request = \"%2$s\"."
1817
  msgstr ""
1818
 
1819
- #: includes/class-mla-data-query.php:1894
1820
  #, php-format
1821
  msgctxt "error_log"
1822
  msgid " %1$s: mla_query_posts_search_filter = \"%2$s\"."
1823
  msgstr ""
1824
 
1825
- #: includes/class-mla-data-query.php:1985
1826
  #, php-format
1827
  msgctxt "error_log"
1828
  msgid " %1$s: mla_query_posts_where_filter = \"%2$s\"."
1829
  msgstr ""
1830
 
1831
- #: includes/class-mla-data-query.php:2057
1832
  #, php-format
1833
  msgctxt "error_log"
1834
  msgid " %1$s: mla_query_posts_join_filter = \"%2$s\"."
1835
  msgstr ""
1836
 
1837
- #: includes/class-mla-data-query.php:2152
1838
  #, php-format
1839
  msgctxt "error_log"
1840
  msgid " %1$s: mla_query_posts_orderby_filter = \"%2$s\"."
1841
  msgstr ""
1842
 
1843
- #: includes/class-mla-data-query.php:2238
1844
  #, php-format
1845
  msgctxt "error_log"
1846
  msgid " %1$s: mla_query_posts_clauses_filter = \"%2$s\"."
1847
  msgstr ""
1848
 
1849
- #: includes/class-mla-data-query.php:2257
1850
  #, php-format
1851
  msgctxt "error_log"
1852
  msgid " %1$s: mla_query_posts_clauses_request_filter = \"%2$s\"."
@@ -1894,41 +1904,41 @@ msgid ""
1894
  "%1$s: mla_parse_array_template no template end delimiter, tail = \"%2$s\"."
1895
  msgstr ""
1896
 
1897
- #: includes/class-mla-data.php:193
1898
  #, php-format
1899
  msgctxt "error_log"
1900
  msgid "%1$s: mla_parse_template no end delimiter, tail = \"%2$s\"."
1901
  msgstr ""
1902
 
1903
- #: includes/class-mla-data.php:254
1904
  #, php-format
1905
  msgctxt "error_log"
1906
  msgid "%1$s: _find_parameter no end delimiter, tail = \"%2$s\"."
1907
  msgstr ""
1908
 
1909
- #: includes/class-mla-data.php:322
1910
  #, php-format
1911
  msgctxt "error_log"
1912
  msgid "%1$s: _find_delimited_substring no end delimiter, tail = \"%2$s\"."
1913
  msgstr ""
1914
 
1915
- #: includes/class-mla-data.php:411
1916
  msgid "Test; no closing parenthesis "
1917
  msgstr ""
1918
 
1919
- #: includes/class-mla-data.php:563
1920
  #, php-format
1921
  msgctxt "error_log"
1922
  msgid "%1$s: _evaluate_template_array_node unknown type \"%2$s\"."
1923
  msgstr ""
1924
 
1925
- #: includes/class-mla-data.php:626
1926
  #, php-format
1927
  msgctxt "error_log"
1928
  msgid "%1$s: _evaluate_template_node unknown type \"%2$s\"."
1929
  msgstr ""
1930
 
1931
- #: includes/class-mla-data.php:1579
1932
  #, php-format
1933
  msgctxt "error_log"
1934
  msgid ""
@@ -1936,29 +1946,45 @@ msgid ""
1936
  "\"."
1937
  msgstr ""
1938
 
1939
- #: includes/class-mla-data.php:1778
1940
  #, php-format
1941
  msgctxt "error_log"
1942
  msgid "%1$s: mla_get_attachment_by_id(%2$d) not found."
1943
  msgstr ""
1944
 
1945
- #: includes/class-mla-data.php:1784
1946
  #, php-format
1947
  msgctxt "error_log"
1948
  msgid "%1$s: mla_get_attachment_by_id(%2$d) wrong post_type \"%3$s\"."
1949
  msgstr ""
1950
 
1951
- #: includes/class-mla-data.php:2134
1952
  msgctxt "error_log"
1953
  msgid "mla_parse_xml_string xml_parse_into_struct failed."
1954
  msgstr ""
1955
 
1956
- #: includes/class-mla-data.php:2138
1957
  msgctxt "error_log"
1958
  msgid "mla_parse_xml_string set option failed."
1959
  msgstr ""
1960
 
1961
- #: includes/class-mla-data.php:3735
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1962
  #: includes/class-mla-settings-custom-fields-tab.php:833
1963
  #: includes/class-mla-settings-custom-fields-tab.php:1552
1964
  #: includes/class-mla-settings-iptc-exif-tab.php:941
@@ -1967,11 +1993,11 @@ msgstr ""
1967
  #: includes/class-mla-settings-view-tab.php:401
1968
  #: includes/class-mla-settings-view-tab.php:802
1969
  #: includes/class-mla-settings-view-tab.php:818
1970
- #: includes/class-mla-wpml-support.php:1595
1971
  msgid "Yes"
1972
  msgstr ""
1973
 
1974
- #: includes/class-mla-data.php:3737
1975
  #: includes/class-mla-settings-custom-fields-tab.php:834
1976
  #: includes/class-mla-settings-custom-fields-tab.php:1554
1977
  #: includes/class-mla-settings-iptc-exif-tab.php:942
@@ -1980,163 +2006,163 @@ msgstr ""
1980
  #: includes/class-mla-settings-view-tab.php:400
1981
  #: includes/class-mla-settings-view-tab.php:804
1982
  #: includes/class-mla-settings-view-tab.php:820
1983
- #: includes/class-mla-wpml-support.php:1596
1984
  msgid "No"
1985
  msgstr ""
1986
 
1987
- #: includes/class-mla-data.php:3983 includes/class-mla-data.php:4107
1988
  #, php-format
1989
  msgid "Deleting %1$s"
1990
  msgstr ""
1991
 
1992
- #: includes/class-mla-data.php:3986
1993
  #, php-format
1994
  msgid "%1$s: meta:%2$s not found"
1995
  msgstr ""
1996
 
1997
- #: includes/class-mla-data.php:3995 includes/class-mla-data.php:4118
1998
- #: includes/class-mla-data.php:4130
1999
  #, php-format
2000
  msgid "Adding %1$s = %2$s"
2001
  msgstr ""
2002
 
2003
- #: includes/class-mla-data.php:3999
2004
  #, php-format
2005
  msgid "%1$s: Adding meta:%2$s; not found"
2006
  msgstr ""
2007
 
2008
- #: includes/class-mla-data.php:4006
2009
  #, php-format
2010
  msgid "Deleting Null meta:%1$s"
2011
  msgstr ""
2012
 
2013
- #: includes/class-mla-data.php:4016 includes/class-mla-data.php:4199
2014
- #: includes/class-mla-data.php:4286 includes/class-mla-data.php:4310
2015
- #: includes/class-mla-data.php:4353 includes/class-mla-data.php:4366
2016
- #: includes/class-mla-data.php:4375 includes/class-mla-data.php:4386
2017
- #: includes/class-mla-data.php:4397 includes/class-mla-data.php:4410
2018
- #: includes/class-mla-data.php:4419 includes/class-mla-data.php:4428
2019
- #: includes/class-mla-data.php:4437 includes/class-mla-data.php:4446
2020
  #: includes/class-mla-mime-types.php:1300
2021
  #: includes/class-mla-mime-types.php:2412
2022
  #, php-format
2023
  msgid "Changing %1$s from \"%2$s\" to \"%3$s\""
2024
  msgstr ""
2025
 
2026
- #: includes/class-mla-data.php:4021
2027
  #, php-format
2028
  msgid "%1$s: Changing meta:%2$s; not found"
2029
  msgstr ""
2030
 
2031
- #: includes/class-mla-data.php:4154
2032
  #, php-format
2033
  msgid "Deleting old %1$s values"
2034
  msgstr ""
2035
 
2036
- #: includes/class-mla-data.php:4184
2037
  #, php-format
2038
  msgid "Changing %1$s from \"%2$s\" to \"%3$s\"; %4$d updates"
2039
  msgstr ""
2040
 
2041
- #: includes/class-mla-data.php:4261
2042
  msgid "Could not retrieve Attachment."
2043
  msgstr ""
2044
 
2045
- #: includes/class-mla-data.php:4307
2046
  #, php-format
2047
  msgid "%1$s: Could not change Name/Slug \"%2$s\"; name already exists"
2048
  msgstr ""
2049
 
2050
- #: includes/class-mla-data.php:4337
2051
  #, php-format
2052
  msgid "Deleting ALT Text, was \"%1$s\""
2053
  msgstr ""
2054
 
2055
- #: includes/class-mla-data.php:4340
2056
  #, php-format
2057
  msgid "%1$s: Could not delete ALT Text, remains \"%2$s\""
2058
  msgstr ""
2059
 
2060
- #: includes/class-mla-data.php:4356
2061
  #, php-format
2062
  msgid "%1$s: Could not change ALT Text from \"%2$s\" to \"%3$s\""
2063
  msgstr ""
2064
 
2065
- #: includes/class-mla-data.php:4386 includes/class-mla-list-table.php:1134
 
2066
  #: includes/class-mla-list-table.php:1137
2067
- #: includes/class-mla-list-table.php:1140
2068
- #: includes/class-mla-list-table.php:1208 includes/class-mla-options.php:2143
2069
  #: includes/class-mla-settings-iptc-exif-tab.php:518
2070
  #: includes/class-mla-settings-iptc-exif-tab.php:911
2071
  msgid "Parent"
2072
  msgstr ""
2073
 
2074
- #: includes/class-mla-data.php:4397 includes/class-mla-edit-media.php:823
2075
- #: includes/class-mla-edit-media.php:1028 includes/class-mla-main.php:2412
2076
  #: includes/class-mla-settings-view-tab.php:126
2077
  #: includes/class-mla-settings-view-tab.php:389
2078
  msgid "Menu Order"
2079
  msgstr ""
2080
 
2081
- #: includes/class-mla-data.php:4410 includes/class-mla-edit-media.php:449
2082
- #: includes/class-mla-list-table.php:1588
2083
- #: includes/class-mla-list-table.php:1591 includes/class-mla-main.php:2211
2084
- #: includes/class-mla-main.php:2371
2085
  msgid "Author"
2086
  msgstr ""
2087
 
2088
- #: includes/class-mla-data.php:4419 includes/class-mla-edit-media.php:474
2089
- #: includes/class-mla-main.php:2424
2090
  msgid "Comments"
2091
  msgstr ""
2092
 
2093
- #: includes/class-mla-data.php:4428 includes/class-mla-edit-media.php:475
2094
- #: includes/class-mla-main.php:2425
2095
  msgid "Pings"
2096
  msgstr ""
2097
 
2098
- #: includes/class-mla-data.php:4476
2099
  #, php-format
2100
  msgid "You cannot assign \"%1$s\" terms"
2101
  msgstr ""
2102
 
2103
- #: includes/class-mla-data.php:4489
2104
  msgctxt "tag delimiter"
2105
  msgid ","
2106
  msgstr ""
2107
 
2108
- #: includes/class-mla-data.php:4528
2109
  msgid "Adding"
2110
  msgstr ""
2111
 
2112
- #: includes/class-mla-data.php:4533
2113
  msgid "Removing"
2114
  msgstr ""
2115
 
2116
- #: includes/class-mla-data.php:4542
2117
  msgid "Replacing"
2118
  msgstr ""
2119
 
2120
- #: includes/class-mla-data.php:4550
2121
  msgid "Ignoring"
2122
  msgstr ""
2123
 
2124
- #: includes/class-mla-data.php:4567
2125
  #, php-format
2126
  msgid "%1$s \"%2$s\" terms"
2127
  msgstr ""
2128
 
2129
- #: includes/class-mla-data.php:4579 includes/class-mla-main.php:1403
2130
  #, php-format
2131
  msgid "Item %1$d, no changes detected."
2132
  msgstr ""
2133
 
2134
- #: includes/class-mla-data.php:4612
2135
  #, php-format
2136
  msgid "Item %1$d updated."
2137
  msgstr ""
2138
 
2139
- #: includes/class-mla-data.php:4630
2140
  #, php-format
2141
  msgid "%1$s: Item %2$d update failed."
2142
  msgstr ""
@@ -2179,17 +2205,17 @@ msgstr ""
2179
  msgid "An ajax.done error has occurred. Please reload the page and try again."
2180
  msgstr ""
2181
 
2182
- #: includes/class-mla-edit-media.php:242 includes/class-mla-main.php:2152
2183
  #, php-format
2184
  msgid "Uploaded on: %s"
2185
  msgstr ""
2186
 
2187
- #: includes/class-mla-edit-media.php:243 includes/class-mla-edit-media.php:695
2188
  msgid "Last modified"
2189
  msgstr ""
2190
 
2191
- #: includes/class-mla-edit-media.php:321 includes/class-mla-main.php:2066
2192
- #: includes/class-mla-main.php:2205 includes/class-mla-media-modal.php:618
2193
  #: includes/class-mla-mime-types.php:825 includes/class-mla-mime-types.php:1466
2194
  #: includes/class-mla-mime-types.php:2645
2195
  #: includes/class-mla-settings-custom-fields-tab.php:570
@@ -2210,35 +2236,35 @@ msgid "%1$s: %2$s non-array \"%3$s\""
2210
  msgstr ""
2211
 
2212
  #: includes/class-mla-edit-media.php:341 includes/class-mla-edit-media.php:397
2213
- #: includes/class-mla-main.php:2247 includes/class-mla-main.php:2313
2214
  msgid "+&nbsp;Add&nbsp;New&nbsp;Term"
2215
  msgstr ""
2216
 
2217
  #: includes/class-mla-edit-media.php:342 includes/class-mla-edit-media.php:398
2218
- #: includes/class-mla-main.php:2248 includes/class-mla-main.php:2314
2219
  msgid "Add New"
2220
  msgstr ""
2221
 
2222
  #: includes/class-mla-edit-media.php:360 includes/class-mla-edit-media.php:416
2223
- #: includes/class-mla-main.php:2266 includes/class-mla-main.php:2332
2224
  msgid "?&nbsp;Search"
2225
  msgstr ""
2226
 
2227
  #: includes/class-mla-edit-media.php:363 includes/class-mla-edit-media.php:419
2228
- #: includes/class-mla-edit-media.php:428 includes/class-mla-main.php:2269
2229
- #: includes/class-mla-main.php:2335 includes/class-mla-main.php:2344
2230
  msgid "Add"
2231
  msgstr ""
2232
 
2233
  #: includes/class-mla-edit-media.php:364 includes/class-mla-edit-media.php:420
2234
- #: includes/class-mla-edit-media.php:429 includes/class-mla-main.php:2270
2235
- #: includes/class-mla-main.php:2336 includes/class-mla-main.php:2345
2236
  msgid "Remove"
2237
  msgstr ""
2238
 
2239
  #: includes/class-mla-edit-media.php:365 includes/class-mla-edit-media.php:421
2240
- #: includes/class-mla-edit-media.php:430 includes/class-mla-main.php:2271
2241
- #: includes/class-mla-main.php:2337 includes/class-mla-main.php:2346
2242
  #: includes/class-mla-settings-custom-fields-tab.php:494
2243
  #: includes/class-mla-settings-custom-fields-tab.php:804
2244
  #: includes/class-mla-settings-custom-fields-tab.php:1538
@@ -2255,13 +2281,13 @@ msgid ""
2255
  "menu for more information."
2256
  msgstr ""
2257
 
2258
- #: includes/class-mla-edit-media.php:470 includes/class-mla-main.php:2418
2259
- #: includes/class-mla-settings.php:1395
2260
  msgid "Reset"
2261
  msgstr ""
2262
 
2263
- #: includes/class-mla-edit-media.php:476 includes/class-mla-main.php:2426
2264
- #: includes/class-mla-main.php:2482
2265
  #: includes/class-mla-settings-custom-fields-tab.php:832
2266
  #: includes/class-mla-settings-iptc-exif-tab.php:940
2267
  #: includes/class-mla-settings-upload-tab.php:120
@@ -2270,77 +2296,77 @@ msgstr ""
2270
  msgid "No Change"
2271
  msgstr ""
2272
 
2273
- #: includes/class-mla-edit-media.php:477 includes/class-mla-main.php:2427
2274
  msgid "Allow"
2275
  msgstr ""
2276
 
2277
- #: includes/class-mla-edit-media.php:478 includes/class-mla-main.php:2428
2278
  msgid "Do not allow"
2279
  msgstr ""
2280
 
2281
- #: includes/class-mla-edit-media.php:486 includes/class-mla-list-table.php:1134
2282
- #: includes/class-mla-list-table.php:1205 includes/class-mla-main.php:2410
2283
  msgid "Parent ID"
2284
  msgstr ""
2285
 
2286
- #: includes/class-mla-edit-media.php:487 includes/class-mla-edit-media.php:1008
2287
- #: includes/class-mla-main.php:2411
2288
  #: includes/class-mla-settings-upload-tab.php:1469
2289
  msgid "Select"
2290
  msgstr ""
2291
 
2292
- #: includes/class-mla-edit-media.php:584
2293
  msgid "Custom field mapping updated."
2294
  msgstr ""
2295
 
2296
- #: includes/class-mla-edit-media.php:585
2297
  msgid "IPTC/EXIF mapping updated."
2298
  msgstr ""
2299
 
2300
- #: includes/class-mla-edit-media.php:586
2301
  msgid "Custom field mapping is disabled."
2302
  msgstr ""
2303
 
2304
- #: includes/class-mla-edit-media.php:587
2305
  msgid "IPTC/EXIF mapping is disabled."
2306
  msgstr ""
2307
 
2308
- #: includes/class-mla-edit-media.php:622 includes/class-mla-main.php:2136
2309
  msgid "Month"
2310
  msgstr ""
2311
 
2312
- #: includes/class-mla-edit-media.php:628 includes/class-mla-main.php:2142
2313
  #, php-format
2314
  msgid "%1$s-%2$s"
2315
  msgstr ""
2316
 
2317
- #: includes/class-mla-edit-media.php:632 includes/class-mla-main.php:2146
2318
  msgid "Day"
2319
  msgstr ""
2320
 
2321
- #: includes/class-mla-edit-media.php:633 includes/class-mla-main.php:2147
2322
  msgid "Year"
2323
  msgstr ""
2324
 
2325
- #: includes/class-mla-edit-media.php:634 includes/class-mla-main.php:2148
2326
  msgid "Hour"
2327
  msgstr ""
2328
 
2329
- #: includes/class-mla-edit-media.php:635 includes/class-mla-main.php:2149
2330
  msgid "Minute"
2331
  msgstr ""
2332
 
2333
- #: includes/class-mla-edit-media.php:639 includes/class-mla-main.php:2154
2334
  #, php-format
2335
  msgid "%1$s %2$s, %3$s @ %4$s:%5$s"
2336
  msgstr ""
2337
 
2338
- #: includes/class-mla-edit-media.php:662
2339
  msgid "OK"
2340
  msgstr ""
2341
 
2342
- #: includes/class-mla-edit-media.php:663 includes/class-mla-main.php:2089
2343
- #: includes/class-mla-main.php:2417
2344
  #: includes/class-mla-polylang-support.php:2083
2345
  #: includes/class-mla-settings-custom-fields-tab.php:522
2346
  #: includes/class-mla-settings-custom-fields-tab.php:753
@@ -2360,18 +2386,18 @@ msgstr ""
2360
  msgid "Cancel"
2361
  msgstr ""
2362
 
2363
- #: includes/class-mla-edit-media.php:679
2364
  msgid "M j, Y @ H:i"
2365
  msgstr ""
2366
 
2367
- #: includes/class-mla-edit-media.php:685 includes/class-mla-list-table.php:696
2368
- #: includes/class-mla-list-table.php:822 includes/class-mla-list-table.php:1089
2369
- #: includes/class-mla-list-table.php:1260
2370
- #: includes/class-mla-list-table.php:1309
2371
- #: includes/class-mla-list-table.php:1355
2372
- #: includes/class-mla-list-table.php:1400
2373
- #: includes/class-mla-list-table.php:1622
2374
- #: includes/class-mla-list-table.php:1975
2375
  #: includes/class-mla-polylang-support.php:378
2376
  #: includes/class-mla-settings-custom-fields-tab.php:1381
2377
  #: includes/class-mla-settings-custom-fields-tab.php:1716
@@ -2385,52 +2411,52 @@ msgstr ""
2385
  msgid "Edit"
2386
  msgstr ""
2387
 
2388
- #: includes/class-mla-edit-media.php:686
2389
  msgid "Edit upload date and time"
2390
  msgstr ""
2391
 
2392
- #: includes/class-mla-edit-media.php:688
2393
  msgid "Upload Date and time"
2394
  msgstr ""
2395
 
2396
- #: includes/class-mla-edit-media.php:719
2397
  msgid "Map Custom Field metadata for this item"
2398
  msgstr ""
2399
 
2400
- #: includes/class-mla-edit-media.php:719 includes/class-mla-main.php:1852
2401
- #: includes/class-mla-main.php:2433
2402
  msgid "Map Custom Field metadata"
2403
  msgstr ""
2404
 
2405
- #: includes/class-mla-edit-media.php:723
2406
  msgid "Map IPTC/EXIF metadata for this item"
2407
  msgstr ""
2408
 
2409
- #: includes/class-mla-edit-media.php:723 includes/class-mla-main.php:1855
2410
- #: includes/class-mla-main.php:2431
2411
  msgid "Map IPTC/EXIF metadata"
2412
  msgstr ""
2413
 
2414
- #: includes/class-mla-edit-media.php:819 includes/class-mla-edit-media.php:1009
2415
  msgid "Parent Info"
2416
  msgstr ""
2417
 
2418
- #: includes/class-mla-edit-media.php:829 includes/class-mla-edit-media.php:1052
2419
  msgid "Attachment Metadata"
2420
  msgstr ""
2421
 
2422
- #: includes/class-mla-edit-media.php:899 includes/class-mla-edit-media.php:941
2423
  #: includes/class-mla-main.php:709 includes/class-mla-settings.php:586
2424
  #, php-format
2425
  msgctxt "error_log"
2426
  msgid "%1$s: %2$s discarding \"%3$s\"; no title/order"
2427
  msgstr ""
2428
 
2429
- #: includes/class-mla-edit-media.php:1007
2430
  msgid "Post Parent"
2431
  msgstr ""
2432
 
2433
- #: includes/class-mla-edit-media.php:1008 includes/class-mla-main.php:2071
2434
  msgid "Select Parent"
2435
  msgstr ""
2436
 
@@ -2452,12 +2478,12 @@ msgid "List View"
2452
  msgstr ""
2453
 
2454
  #: includes/class-mla-list-table.php:567 includes/class-mla-list-table.php:628
2455
- #: includes/class-mla-list-table.php:1134
2456
- #: includes/class-mla-list-table.php:1205
2457
- #: includes/class-mla-list-table.php:1428
2458
- #: includes/class-mla-list-table.php:1472
2459
- #: includes/class-mla-list-table.php:1504
2460
- #: includes/class-mla-list-table.php:1588
2461
  msgid "Filter by"
2462
  msgstr ""
2463
 
@@ -2482,11 +2508,11 @@ msgstr ""
2482
  msgid "Restore this item from the Trash"
2483
  msgstr ""
2484
 
2485
- #: includes/class-mla-list-table.php:809 includes/class-mla-list-table.php:1972
2486
  msgid "Restore"
2487
  msgstr ""
2488
 
2489
- #: includes/class-mla-list-table.php:822
2490
  #: includes/class-mla-settings-custom-fields-tab.php:1381
2491
  #: includes/class-mla-settings-iptc-exif-tab.php:1486
2492
  #: includes/class-mla-settings-shortcodes-tab.php:1096
@@ -2495,7 +2521,7 @@ msgstr ""
2495
  msgid "Edit this item"
2496
  msgstr ""
2497
 
2498
- #: includes/class-mla-list-table.php:823
2499
  #: includes/class-mla-settings-custom-fields-tab.php:1384
2500
  #: includes/class-mla-settings-iptc-exif-tab.php:1489
2501
  #: includes/class-mla-settings-upload-tab.php:930
@@ -2503,7 +2529,7 @@ msgstr ""
2503
  msgid "Edit this item inline"
2504
  msgstr ""
2505
 
2506
- #: includes/class-mla-list-table.php:823 includes/class-mla-main.php:2401
2507
  #: includes/class-mla-options.php:1244
2508
  #: includes/class-mla-settings-custom-fields-tab.php:485
2509
  #: includes/class-mla-settings-custom-fields-tab.php:795
@@ -2516,15 +2542,15 @@ msgstr ""
2516
  msgid "Quick Edit"
2517
  msgstr ""
2518
 
2519
- #: includes/class-mla-list-table.php:829
2520
  msgid "Move this item to the Trash"
2521
  msgstr ""
2522
 
2523
- #: includes/class-mla-list-table.php:829 includes/class-mla-list-table.php:1978
2524
  msgid "Move to Trash"
2525
  msgstr ""
2526
 
2527
- #: includes/class-mla-list-table.php:834
2528
  #: includes/class-mla-settings-custom-fields-tab.php:1392
2529
  #: includes/class-mla-settings-iptc-exif-tab.php:1499
2530
  #: includes/class-mla-settings-shortcodes-tab.php:1102
@@ -2533,8 +2559,8 @@ msgstr ""
2533
  msgid "Delete this item Permanently"
2534
  msgstr ""
2535
 
2536
- #: includes/class-mla-list-table.php:834 includes/class-mla-list-table.php:1973
2537
- #: includes/class-mla-list-table.php:1980
2538
  #: includes/class-mla-settings-custom-fields-tab.php:1392
2539
  #: includes/class-mla-settings-custom-fields-tab.php:1717
2540
  #: includes/class-mla-settings-iptc-exif-tab.php:1499
@@ -2546,84 +2572,84 @@ msgstr ""
2546
  msgid "Delete Permanently"
2547
  msgstr ""
2548
 
2549
- #: includes/class-mla-list-table.php:842 includes/class-mla-list-table.php:1985
2550
  #: includes/class-mla-settings-documentation-tab.php:673
2551
- #: includes/class-mla-settings.php:1385
2552
  msgid "Download"
2553
  msgstr ""
2554
 
2555
- #: includes/class-mla-list-table.php:844
2556
  #: includes/class-mla-settings-documentation-tab.php:676
2557
  #: includes/class-mla-settings-shortcodes-tab.php:1094
2558
  #: includes/class-mla-settings-view-tab.php:377
2559
  msgid "View"
2560
  msgstr ""
2561
 
2562
- #: includes/class-mla-list-table.php:1105
2563
  msgid "File name"
2564
  msgstr ""
2565
 
2566
- #: includes/class-mla-list-table.php:1202
2567
  msgid "(no title: bad ID)"
2568
  msgstr ""
2569
 
2570
- #: includes/class-mla-list-table.php:1475
2571
  #: includes/class-mla-settings-upload-tab.php:192
2572
  #: includes/class-mla-settings-upload-tab.php:537
2573
  msgid "MIME Type"
2574
  msgstr ""
2575
 
2576
- #: includes/class-mla-list-table.php:1508
2577
  msgid "Base File"
2578
  msgstr ""
2579
 
2580
- #: includes/class-mla-list-table.php:1524
2581
- #: includes/class-mla-list-table.php:1557
2582
  msgid "Unpublished"
2583
  msgstr ""
2584
 
2585
- #: includes/class-mla-list-table.php:1533
2586
- #: includes/class-mla-list-table.php:1564
2587
  #, php-format
2588
  msgid "%1$s from now"
2589
  msgstr ""
2590
 
2591
- #: includes/class-mla-list-table.php:1536
2592
- #: includes/class-mla-list-table.php:1566
2593
  #, php-format
2594
  msgid "%1$s ago"
2595
  msgstr ""
2596
 
2597
- #: includes/class-mla-list-table.php:1650
2598
  msgid "Set Parent"
2599
  msgstr ""
2600
 
2601
- #: includes/class-mla-list-table.php:1825
2602
  msgctxt "uploaded files"
2603
  msgid "All"
2604
  msgid_plural "All"
2605
  msgstr[0] ""
2606
  msgstr[1] ""
2607
 
2608
- #: includes/class-mla-list-table.php:2074
2609
  #: includes/class-mla-settings-custom-fields-tab.php:1780
2610
  #: includes/class-mla-settings-iptc-exif-tab.php:1914
2611
  #: includes/class-mla-settings-shortcodes-tab.php:1361
2612
  msgid "Filter"
2613
  msgstr ""
2614
 
2615
- #: includes/class-mla-list-table.php:2077
2616
- #: includes/mla-media-modal-js-template.php:89
2617
  msgid "Terms Search"
2618
  msgstr ""
2619
 
2620
- #: includes/class-mla-list-table.php:2082
2621
  #: includes/class-mla-polylang-support.php:2090
2622
  #: includes/class-mla-thumbnail-generation.php:657
2623
  msgid "Clear Filter-by"
2624
  msgstr ""
2625
 
2626
- #: includes/class-mla-list-table.php:2085
2627
  msgid "Empty Trash"
2628
  msgstr ""
2629
 
@@ -2645,13 +2671,13 @@ msgstr ""
2645
  msgid "Bulk Edit items"
2646
  msgstr ""
2647
 
2648
- #: includes/class-mla-main.php:463 includes/class-mla-main.php:2434
2649
  #: includes/class-mla-settings-custom-fields-tab.php:61
2650
  #: includes/class-mla-settings-iptc-exif-tab.php:61
2651
  msgid "Waiting"
2652
  msgstr ""
2653
 
2654
- #: includes/class-mla-main.php:464 includes/class-mla-main.php:2436
2655
  #: includes/class-mla-settings-custom-fields-tab.php:63
2656
  #: includes/class-mla-settings-iptc-exif-tab.php:63
2657
  msgid "Complete"
@@ -2686,7 +2712,7 @@ msgid_plural "%d items permanently deleted."
2686
  msgstr[0] ""
2687
  msgstr[1] ""
2688
 
2689
- #: includes/class-mla-main.php:611 includes/class-mla-main.php:2621
2690
  #, php-format
2691
  msgid "Item %1$d moved to Trash."
2692
  msgstr ""
@@ -2794,8 +2820,8 @@ msgstr ""
2794
  msgid "search results for"
2795
  msgstr ""
2796
 
2797
- #: includes/class-mla-main.php:1858 includes/class-mla-main.php:2093
2798
- #: includes/class-mla-main.php:2419
2799
  #: includes/class-mla-settings-custom-fields-tab.php:524
2800
  #: includes/class-mla-settings-custom-fields-tab.php:836
2801
  #: includes/class-mla-settings-documentation-tab.php:664
@@ -2810,20 +2836,20 @@ msgstr ""
2810
  msgid "Update"
2811
  msgstr ""
2812
 
2813
- #: includes/class-mla-main.php:2028
2814
  msgid "All Post Types"
2815
  msgstr ""
2816
 
2817
- #: includes/class-mla-main.php:2074
2818
  msgid "For"
2819
  msgstr ""
2820
 
2821
- #: includes/class-mla-main.php:2084
2822
- #: includes/class-mla-shortcode-support.php:1194
2823
  msgid "Unattached"
2824
  msgstr ""
2825
 
2826
- #: includes/class-mla-main.php:2420 includes/class-mla-options.php:1258
2827
  #: includes/class-mla-settings-custom-fields-tab.php:488
2828
  #: includes/class-mla-settings-custom-fields-tab.php:798
2829
  #: includes/class-mla-settings-custom-fields-tab.php:1498
@@ -2833,43 +2859,43 @@ msgstr ""
2833
  msgid "Bulk Edit"
2834
  msgstr ""
2835
 
2836
- #: includes/class-mla-main.php:2435
2837
  msgid "In-process"
2838
  msgstr ""
2839
 
2840
- #: includes/class-mla-main.php:2534
2841
  msgid "You are not allowed to delete this item."
2842
  msgstr ""
2843
 
2844
- #: includes/class-mla-main.php:2542
2845
  #, php-format
2846
  msgid "%1$s: Item %2$d could NOT be deleted."
2847
  msgstr ""
2848
 
2849
- #: includes/class-mla-main.php:2549
2850
  #, php-format
2851
  msgid "Item %1$d permanently deleted."
2852
  msgstr ""
2853
 
2854
- #: includes/class-mla-main.php:2566
2855
  msgid "You are not allowed to move this item out of the Trash."
2856
  msgstr ""
2857
 
2858
- #: includes/class-mla-main.php:2574
2859
  #, php-format
2860
  msgid "%1$s: Item %2$d could NOT be restored from Trash."
2861
  msgstr ""
2862
 
2863
- #: includes/class-mla-main.php:2589
2864
  #, php-format
2865
  msgid "Item %1$d restored from Trash."
2866
  msgstr ""
2867
 
2868
- #: includes/class-mla-main.php:2606
2869
  msgid "You are not allowed to move this item to the Trash."
2870
  msgstr ""
2871
 
2872
- #: includes/class-mla-main.php:2614
2873
  #, php-format
2874
  msgid "%1$s: Item %2$d could NOT be moved to Trash."
2875
  msgstr ""
@@ -3315,30 +3341,38 @@ msgstr ""
3315
  msgid "Attachments"
3316
  msgstr ""
3317
 
3318
- #: includes/class-mla-objects.php:245
 
 
 
 
 
 
 
 
3319
  #, php-format
3320
  msgctxt "error_log"
3321
  msgid ""
3322
  "%1$s: mla_taxonomy_column_filter( \"%2$s\" ) - get_term failed: \"%3$s\""
3323
  msgstr ""
3324
 
3325
- #: includes/class-mla-objects.php:269
3326
  msgid "click to search"
3327
  msgstr ""
3328
 
3329
- #: includes/class-mla-objects.php:301
3330
  msgid "Shortcode(s), HTML and/or Plain Text"
3331
  msgstr ""
3332
 
3333
- #: includes/class-mla-objects.php:309
3334
  msgid "MLA Text"
3335
  msgstr ""
3336
 
3337
- #: includes/class-mla-objects.php:353
3338
  msgid "Automatically add paragraphs"
3339
  msgstr ""
3340
 
3341
- #: includes/class-mla-objects.php:354
3342
  msgid "Add .textwidget div tags"
3343
  msgstr ""
3344
 
@@ -3436,13 +3470,13 @@ msgstr ""
3436
 
3437
  #: includes/class-mla-options.php:462
3438
  #: includes/mla-main-search-box-template.php:60
3439
- #: includes/mla-media-modal-js-template.php:49
3440
  msgid "and"
3441
  msgstr ""
3442
 
3443
  #: includes/class-mla-options.php:464
3444
  #: includes/mla-main-search-box-template.php:61
3445
- #: includes/mla-media-modal-js-template.php:53
3446
  msgid "or"
3447
  msgstr ""
3448
 
@@ -3454,19 +3488,19 @@ msgstr ""
3454
  #: includes/class-mla-settings-shortcodes-tab.php:422
3455
  #: includes/class-mla-settings-shortcodes-tab.php:493
3456
  #: includes/mla-main-search-box-template.php:49
3457
- #: includes/mla-media-modal-js-template.php:61
3458
  msgid "Name"
3459
  msgstr ""
3460
 
3461
  #: includes/class-mla-options.php:481
3462
  #: includes/mla-main-search-box-template.php:57
3463
- #: includes/mla-media-modal-js-template.php:78
3464
  msgid "File"
3465
  msgstr ""
3466
 
3467
  #: includes/class-mla-options.php:484
3468
  #: includes/mla-main-search-box-template.php:58
3469
- #: includes/mla-media-modal-js-template.php:83
3470
  msgid "Terms"
3471
  msgstr ""
3472
 
@@ -3695,9 +3729,9 @@ msgstr ""
3695
  #: includes/class-mla-polylang-support.php:2142
3696
  #: includes/class-mla-polylang-support.php:2455
3697
  #: includes/class-mla-polylang-support.php:2570
3698
- #: includes/class-mla-wpml-support.php:1617
3699
- #: includes/class-mla-wpml-support.php:1707
3700
- #: includes/class-mla-wpml-support.php:2192
3701
  msgid "Language"
3702
  msgstr ""
3703
 
@@ -3712,30 +3746,30 @@ msgstr ""
3712
 
3713
  #: includes/class-mla-polylang-support.php:2492
3714
  #: includes/class-mla-polylang-support.php:2597
3715
- #: includes/class-mla-wpml-support.php:1652
3716
- #: includes/class-mla-wpml-support.php:1755
3717
  msgid "Media/Assistant submenu table"
3718
  msgstr ""
3719
 
3720
  #: includes/class-mla-polylang-support.php:2497
3721
- #: includes/class-mla-wpml-support.php:1657
3722
  msgid "Language Column"
3723
  msgstr ""
3724
 
3725
  #: includes/class-mla-polylang-support.php:2500
3726
- #: includes/class-mla-wpml-support.php:1660
3727
  msgid ""
3728
  "Check this option to add a Language column to the Media/Assistant submenu "
3729
  "table."
3730
  msgstr ""
3731
 
3732
  #: includes/class-mla-polylang-support.php:2504
3733
- #: includes/class-mla-wpml-support.php:1664
3734
  msgid "Translations Column"
3735
  msgstr ""
3736
 
3737
  #: includes/class-mla-polylang-support.php:2507
3738
- #: includes/class-mla-wpml-support.php:1667
3739
  msgid ""
3740
  "Check this option to add a Translation Status column to the Media/Assistant "
3741
  "submenu table."
@@ -3755,47 +3789,47 @@ msgstr ""
3755
 
3756
  #: includes/class-mla-polylang-support.php:2525
3757
  #: includes/class-mla-polylang-support.php:2597
3758
- #: includes/class-mla-wpml-support.php:1671
3759
- #: includes/class-mla-wpml-support.php:1755
3760
  msgid "Term Management"
3761
  msgstr ""
3762
 
3763
  #: includes/class-mla-polylang-support.php:2530
3764
- #: includes/class-mla-wpml-support.php:1676
3765
  msgid "Term Assignment"
3766
  msgstr ""
3767
 
3768
  #: includes/class-mla-polylang-support.php:2533
3769
- #: includes/class-mla-wpml-support.php:1679
3770
  msgid ""
3771
  "Check this option to assign language-specific terms when items are updated."
3772
  msgstr ""
3773
 
3774
  #: includes/class-mla-polylang-support.php:2537
3775
- #: includes/class-mla-wpml-support.php:1683
3776
  msgid "Term Synchronization"
3777
  msgstr ""
3778
 
3779
  #: includes/class-mla-polylang-support.php:2540
3780
- #: includes/class-mla-wpml-support.php:1686
3781
  msgid ""
3782
  "Check this option to synchronize common terms among all item translations."
3783
  msgstr ""
3784
 
3785
  #: includes/class-mla-polylang-support.php:2544
3786
- #: includes/class-mla-wpml-support.php:1690
3787
  msgid "Term Mapping Replication"
3788
  msgstr ""
3789
 
3790
  #: includes/class-mla-polylang-support.php:2547
3791
- #: includes/class-mla-wpml-support.php:1693
3792
  msgid ""
3793
  "When mapping IPTC/EXIF metadata to taxonomy terms, make them available in "
3794
  "all languages."
3795
  msgstr ""
3796
 
3797
  #: includes/class-mla-polylang-support.php:2595
3798
- #: includes/class-mla-wpml-support.php:1753
3799
  msgid "Language Options"
3800
  msgstr ""
3801
 
@@ -3809,7 +3843,7 @@ msgid ""
3809
  msgstr ""
3810
 
3811
  #: includes/class-mla-polylang-support.php:2599
3812
- #: includes/class-mla-wpml-support.php:1757
3813
  #, php-format
3814
  msgid ""
3815
  "You can find more information about multilingual features in the %1$s "
@@ -3817,12 +3851,12 @@ msgid ""
3817
  msgstr ""
3818
 
3819
  #: includes/class-mla-polylang-support.php:2599
3820
- #: includes/class-mla-wpml-support.php:1757
3821
  msgid "Language Options documentation"
3822
  msgstr ""
3823
 
3824
  #: includes/class-mla-polylang-support.php:2599
3825
- #: includes/class-mla-wpml-support.php:1757
3826
  msgid "WPML &amp; Polylang Multilingual Support; the MLA Language Tab"
3827
  msgstr ""
3828
 
@@ -3836,38 +3870,38 @@ msgstr ""
3836
  #: includes/class-mla-settings-upload-tab.php:531
3837
  #: includes/class-mla-settings-view-tab.php:329
3838
  #: includes/class-mla-settings-view-tab.php:375
3839
- #: includes/class-mla-settings.php:1061 includes/class-mla-settings.php:1430
3840
- #: includes/class-mla-settings.php:1432
3841
- #: includes/class-mla-wpml-support.php:1760
3842
  msgid "Save Changes"
3843
  msgstr ""
3844
 
3845
  #: includes/class-mla-polylang-support.php:2603
3846
- #: includes/class-mla-wpml-support.php:1761
3847
  msgid "Delete Language options and restore default settings"
3848
  msgstr ""
3849
 
3850
  #: includes/class-mla-polylang-support.php:2606
3851
  #: includes/class-mla-settings.php:799 includes/class-mla-settings.php:1066
3852
- #: includes/class-mla-wpml-support.php:1764
3853
  msgid "Go to Top"
3854
  msgstr ""
3855
 
3856
  #: includes/class-mla-polylang-support.php:2643
3857
- #: includes/class-mla-wpml-support.php:1801
3858
  msgid "Language settings saved."
3859
  msgstr ""
3860
 
3861
  #: includes/class-mla-polylang-support.php:2674
3862
- #: includes/class-mla-settings.php:1644
3863
- #: includes/class-mla-wpml-support.php:1832
3864
  #, php-format
3865
  msgctxt "message_list"
3866
  msgid "delete_option \"%1$s\""
3867
  msgstr ""
3868
 
3869
  #: includes/class-mla-polylang-support.php:2682
3870
- #: includes/class-mla-wpml-support.php:1840
3871
  msgid "Language settings reset to default values."
3872
  msgstr ""
3873
 
@@ -4430,7 +4464,7 @@ msgid "Example plugin \"%1$s\" not found"
4430
  msgstr ""
4431
 
4432
  #: includes/class-mla-settings-documentation-tab.php:142
4433
- #: includes/class-mla-settings.php:1362
4434
  #, php-format
4435
  msgid "%1$s: Reading the %2$s file ( %3$s ) \"%4$s\"."
4436
  msgstr ""
@@ -4904,8 +4938,8 @@ msgid "Ghostscript support is not installed."
4904
  msgstr ""
4905
 
4906
  #: includes/class-mla-settings-shortcodes-tab.php:683
4907
- #: includes/class-mla-wpml-support.php:1747
4908
- #: includes/class-mla-wpml-support.php:1749
4909
  msgid "WARNING:"
4910
  msgstr ""
4911
 
@@ -5328,7 +5362,7 @@ msgid "No view slug found"
5328
  msgstr ""
5329
 
5330
  #: includes/class-mla-settings.php:426 includes/class-mla-settings.php:652
5331
- #: includes/class-mla-settings.php:1467
5332
  msgid "Settings"
5333
  msgstr ""
5334
 
@@ -5424,360 +5458,414 @@ msgstr ""
5424
  msgid "Delete General options and restore default settings"
5425
  msgstr ""
5426
 
5427
- #: includes/class-mla-settings.php:1086
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5428
  msgid "enhanced version of the WordPress [gallery] shortcode."
5429
  msgstr ""
5430
 
5431
- #: includes/class-mla-settings.php:1087
5432
  msgid "enhanced version of the WordPress Tag Cloud."
5433
  msgstr ""
5434
 
5435
- #: includes/class-mla-settings.php:1088
5436
  msgid ""
5437
  "provides flat or hierarchical lists, dropdown controls and checkbox lists of "
5438
  "taxonomy terms."
5439
  msgstr ""
5440
 
5441
- #: includes/class-mla-settings.php:1100
5442
  msgid "Shortcodes made available by this plugin"
5443
  msgstr ""
5444
 
5445
- #: includes/class-mla-settings.php:1215
5446
  msgid "Debug settings saved."
5447
  msgstr ""
5448
 
5449
- #: includes/class-mla-settings.php:1311
5450
  #, php-format
5451
  msgid "%1$s: Reseting the %2$s file ( %3$s ) \"%4$s\"."
5452
  msgstr ""
5453
 
5454
- #: includes/class-mla-settings.php:1311 includes/class-mla-settings.php:1362
5455
- #: includes/class-mla-settings.php:1385 includes/class-mla-settings.php:1395
5456
- #: includes/class-mla-settings.php:1421
5457
  msgid "Error Log"
5458
  msgstr ""
5459
 
5460
- #: includes/class-mla-settings.php:1372
5461
  #, php-format
5462
  msgid "Error log file (%1$s) not found; click Reset to create it."
5463
  msgstr ""
5464
 
5465
- #: includes/class-mla-settings.php:1416 includes/class-mla-settings.php:1432
5466
  msgid "Debug Options"
5467
  msgstr ""
5468
 
5469
- #: includes/class-mla-settings.php:1419
5470
  msgid "Debug Settings"
5471
  msgstr ""
5472
 
5473
- #: includes/class-mla-settings.php:1423
5474
  #, php-format
5475
  msgid ""
5476
  "You can find more information about the MLA Reporting/MLA_DEBUG_LEVEL values "
5477
  "in the %1$s section of the Documentation tab."
5478
  msgstr ""
5479
 
5480
- #: includes/class-mla-settings.php:1423
5481
  msgid "MLA Debug Tab documentation"
5482
  msgstr ""
5483
 
5484
- #: includes/class-mla-settings.php:1423
5485
  msgid "MLA Debug Tab"
5486
  msgstr ""
5487
 
5488
- #: includes/class-mla-settings.php:1432
5489
  #, php-format
5490
  msgid "Click %1$s to update the %2$s."
5491
  msgstr ""
5492
 
5493
- #: includes/class-mla-settings.php:1451
5494
  msgid "You do not have permission to manage plugin settings."
5495
  msgstr ""
5496
 
5497
- #: includes/class-mla-settings.php:1477
5498
  msgid "Cannot render content tab"
5499
  msgstr ""
5500
 
5501
- #: includes/class-mla-settings.php:1480
5502
  msgid "Unknown content tab"
5503
  msgstr ""
5504
 
5505
- #: includes/class-mla-settings.php:1497
5506
  msgid "Dismiss this notice"
5507
  msgstr ""
5508
 
5509
- #: includes/class-mla-settings.php:1524
5510
  #, php-format
5511
  msgid "%s attachment"
5512
  msgid_plural "%s attachments"
5513
  msgstr[0] ""
5514
  msgstr[1] ""
5515
 
5516
- #: includes/class-mla-settings.php:1526
5517
  #, php-format
5518
  msgid "Deleted custom field value from %1$s."
5519
  msgstr ""
5520
 
5521
- #: includes/class-mla-settings.php:1529
5522
  msgid "No attachments contained this custom field."
5523
  msgstr ""
5524
 
5525
- #: includes/class-mla-settings.php:1560 includes/class-mla-settings.php:1570
5526
  #, php-format
5527
  msgctxt "message_list"
5528
  msgid "%1$s - references updated."
5529
  msgstr ""
5530
 
5531
- #: includes/class-mla-settings.php:1613
5532
  msgid "General settings saved."
5533
  msgstr ""
5534
 
5535
- #: includes/class-mla-settings.php:1652
5536
  msgid "General settings reset to default values."
5537
  msgstr ""
5538
 
5539
- #: includes/class-mla-settings.php:1694
5540
  msgid "select settings"
5541
  msgstr ""
5542
 
5543
- #: includes/class-mla-settings.php:1714
5544
  msgid "Import ALL Settings"
5545
  msgstr ""
5546
 
5547
- #: includes/class-mla-settings.php:1743 includes/class-mla-settings.php:1759
5548
  msgctxt "message_list"
5549
  msgid "exported"
5550
  msgstr ""
5551
 
5552
- #: includes/class-mla-settings.php:1745 includes/class-mla-settings.php:1761
5553
  msgctxt "message_list"
5554
  msgid "skipped"
5555
  msgstr ""
5556
 
5557
- #: includes/class-mla-settings.php:1768
5558
  msgid "ALL settings exported."
5559
  msgstr ""
5560
 
5561
- #: includes/class-mla-settings.php:1779
5562
  #, php-format
5563
  msgid "%1$s: The settings directory ( %2$s ) cannot be created."
5564
  msgstr ""
5565
 
5566
- #: includes/class-mla-settings.php:1783
5567
  #, php-format
5568
  msgid "%1$s: The settings directory ( %2$s ) is not writable."
5569
  msgstr ""
5570
 
5571
- #: includes/class-mla-settings.php:1794
5572
  #, php-format
5573
  msgid "%1$s: The settings file ( %2$s ) could not be opened."
5574
  msgstr ""
5575
 
5576
- #: includes/class-mla-settings.php:1801
5577
  #, php-format
5578
  msgctxt "error_log"
5579
  msgid "%1$s: _export_settings $error_info = \"%2$s\"."
5580
  msgstr ""
5581
 
5582
- #: includes/class-mla-settings.php:1810
5583
  #, php-format
5584
  msgid "%1$s: Writing the settings file ( %2$s ) \"%3$s\"."
5585
  msgstr ""
5586
 
5587
- #: includes/class-mla-settings.php:1816
5588
  #, php-format
5589
- msgid "Settings exported; %1$s settings recorded."
5590
  msgstr ""
5591
 
5592
- #: includes/class-mla-settings.php:1834
5593
  msgid "No settings imported."
5594
  msgstr ""
5595
 
5596
- #: includes/class-mla-settings.php:1843
5597
  msgid "Please select an import settings file from the dropdown list."
5598
  msgstr ""
5599
 
5600
- #: includes/class-mla-settings.php:1847
5601
  msgid "The import settings dropdown selection is missing."
5602
  msgstr ""
5603
 
5604
- #: includes/class-mla-settings.php:1855
5605
  #, php-format
5606
  msgctxt "error_log"
5607
  msgid "%1$s: _import_settings $error_info = \"%2$s\"."
5608
  msgstr ""
5609
 
5610
- #: includes/class-mla-settings.php:1864
5611
  #, php-format
5612
  msgid "%1$s: Reading the settings file ( %2$s ) \"%3$s\"."
5613
  msgstr ""
5614
 
5615
- #: includes/class-mla-settings.php:1883 includes/class-mla-settings.php:1899
5616
  msgctxt "message_list"
5617
  msgid "updated"
5618
  msgstr ""
5619
 
5620
- #: includes/class-mla-settings.php:1886 includes/class-mla-settings.php:1902
5621
  msgctxt "message_list"
5622
  msgid "unchanged"
5623
  msgstr ""
5624
 
5625
- #: includes/class-mla-settings.php:1907
5626
  #, php-format
5627
  msgid "Settings imported; %1$s updated, %2$s unchanged."
5628
  msgstr ""
5629
 
5630
- #: includes/class-mla-shortcode-support.php:524
5631
- #: includes/class-mla-shortcode-support.php:1953
5632
- #: includes/class-mla-shortcode-support.php:4052
5633
- #: includes/class-mla-shortcode-support.php:4358
5634
  msgid "Previous"
5635
  msgstr ""
5636
 
5637
- #: includes/class-mla-shortcode-support.php:525
5638
- #: includes/class-mla-shortcode-support.php:1954
5639
- #: includes/class-mla-shortcode-support.php:4099
5640
- #: includes/class-mla-shortcode-support.php:4364
5641
  msgid "Next"
5642
  msgstr ""
5643
 
5644
- #: includes/class-mla-shortcode-support.php:596
5645
- #: includes/class-mla-shortcode-support.php:602
5646
- #: includes/class-mla-shortcode-support.php:2092
5647
- #: includes/class-mla-shortcode-support.php:2099
5648
- #: includes/class-mla-shortcode-support.php:3412
5649
- #: includes/class-mla-shortcode-support.php:3419
5650
  #: includes/class-mla-template-support.php:598
5651
  msgid "not found"
5652
  msgstr ""
5653
 
5654
- #: includes/class-mla-shortcode-support.php:626
5655
- #: includes/class-mla-shortcode-support.php:2084
5656
- #: includes/class-mla-shortcode-support.php:3404
5657
  msgid "mla_debug REQUEST"
5658
  msgstr ""
5659
 
5660
- #: includes/class-mla-shortcode-support.php:630
5661
- #: includes/class-mla-shortcode-support.php:632
5662
  msgid "mla_debug attributes_errors"
5663
  msgstr ""
5664
 
5665
- #: includes/class-mla-shortcode-support.php:638
5666
- #: includes/class-mla-shortcode-support.php:2085
5667
- #: includes/class-mla-shortcode-support.php:3405
 
5668
  msgid "mla_debug attributes"
5669
  msgstr ""
5670
 
5671
- #: includes/class-mla-shortcode-support.php:639
5672
- #: includes/class-mla-shortcode-support.php:2086
5673
- #: includes/class-mla-shortcode-support.php:3406
 
5674
  msgid "mla_debug arguments"
5675
  msgstr ""
5676
 
5677
- #: includes/class-mla-shortcode-support.php:731
5678
  msgid "mla_debug empty gallery"
5679
  msgstr ""
5680
 
5681
- #: includes/class-mla-shortcode-support.php:762
5682
  msgid ""
5683
  "<strong>Photonic-enhanced [mla_gallery]</strong> type must be "
5684
  "<strong>default</strong>, query = "
5685
  msgstr ""
5686
 
5687
- #: includes/class-mla-shortcode-support.php:1218
5688
  msgid "unknown"
5689
  msgstr ""
5690
 
5691
- #: includes/class-mla-shortcode-support.php:2217
5692
  msgid "mla_debug empty cloud"
5693
  msgstr ""
5694
 
5695
- #: includes/class-mla-shortcode-support.php:3540
 
 
 
 
 
 
 
 
 
 
 
 
5696
  msgid "mla_debug empty list"
5697
  msgstr ""
5698
 
5699
- #: includes/class-mla-shortcode-support.php:3563
5700
  msgid "no-terms"
5701
  msgstr ""
5702
 
5703
- #: includes/class-mla-shortcode-support.php:4896
5704
- #: includes/class-mla-shortcode-support.php:4933
5705
- #: includes/class-mla-shortcode-support.php:5378
5706
- #: includes/class-mla-shortcode-support.php:5393
5707
- #: includes/class-mla-shortcode-support.php:5415
5708
- #: includes/class-mla-shortcode-support.php:5430
5709
  msgid "Invalid mla_gallery"
5710
  msgstr ""
5711
 
5712
- #: includes/class-mla-shortcode-support.php:5747
 
5713
  msgid "mla_debug query"
5714
  msgstr ""
5715
 
5716
- #: includes/class-mla-shortcode-support.php:5748
5717
  msgid "mla_debug request"
5718
  msgstr ""
5719
 
5720
- #: includes/class-mla-shortcode-support.php:5749
5721
  msgid "mla_debug query_vars"
5722
  msgstr ""
5723
 
5724
- #: includes/class-mla-shortcode-support.php:5750
5725
  msgid "mla_debug post_count"
5726
  msgstr ""
5727
 
5728
- #: includes/class-mla-shortcode-support.php:5774
 
 
 
 
5729
  msgid "mla_debug JOIN filter"
5730
  msgstr ""
5731
 
5732
- #: includes/class-mla-shortcode-support.php:5815
5733
  msgid "mla_debug modified JOIN filter"
5734
  msgstr ""
5735
 
5736
- #: includes/class-mla-shortcode-support.php:5840
5737
  msgid "mla_debug WHERE filter"
5738
  msgstr ""
5739
 
5740
- #: includes/class-mla-shortcode-support.php:5877
5741
  msgid "mla_debug modified WHERE filter"
5742
  msgstr ""
5743
 
5744
- #: includes/class-mla-shortcode-support.php:5900
5745
  msgid "mla_debug ORDER BY filter, incoming"
5746
  msgstr ""
5747
 
5748
- #: includes/class-mla-shortcode-support.php:5900
5749
  msgid "Replacement ORDER BY clause"
5750
  msgstr ""
5751
 
5752
- #: includes/class-mla-shortcode-support.php:5941
5753
  msgid "mla_debug posts_clauses filter"
5754
  msgstr ""
5755
 
5756
- #: includes/class-mla-shortcode-support.php:5959
5757
  msgid "mla_debug posts_clauses_request filter"
5758
  msgstr ""
5759
 
5760
- #: includes/class-mla-shortcode-support.php:6191
 
 
 
 
5761
  msgid "Invalid taxonomy"
5762
  msgstr ""
5763
 
5764
- #: includes/class-mla-shortcode-support.php:6382
5765
  msgid "mla_debug query arguments"
5766
  msgstr ""
5767
 
5768
- #: includes/class-mla-shortcode-support.php:6383
5769
  msgid "mla_debug last_query"
5770
  msgstr ""
5771
 
5772
- #: includes/class-mla-shortcode-support.php:6384
5773
  msgid "mla_debug last_error"
5774
  msgstr ""
5775
 
5776
- #: includes/class-mla-shortcode-support.php:6385
5777
  msgid "mla_debug num_rows"
5778
  msgstr ""
5779
 
5780
- #: includes/class-mla-shortcode-support.php:6386
5781
  msgid "mla_debug found_rows"
5782
  msgstr ""
5783
 
@@ -6042,19 +6130,19 @@ msgstr ""
6042
  msgid "Duplicate translation created; update as desired."
6043
  msgstr ""
6044
 
6045
- #: includes/class-mla-wpml-support.php:1597
6046
  msgid "Make media available in all languages"
6047
  msgstr ""
6048
 
6049
- #: includes/class-mla-wpml-support.php:1747
6050
  msgid " WPML Media is not installed."
6051
  msgstr ""
6052
 
6053
- #: includes/class-mla-wpml-support.php:1749
6054
  msgid " WPML Media is not active."
6055
  msgstr ""
6056
 
6057
- #: includes/class-mla-wpml-support.php:1755
6058
  #, php-format
6059
  msgid ""
6060
  "In this tab you can find a number of options for controlling WPML-specific "
@@ -6062,20 +6150,20 @@ msgid ""
6062
  "\"Save Changes\" at the bottom of the tab to save any changes you make."
6063
  msgstr ""
6064
 
6065
- #: includes/class-mla-wpml-support.php:2306
6066
- #: includes/class-mla-wpml-support.php:2312
6067
  #, php-format
6068
  msgid "Edit the %s translation"
6069
  msgstr ""
6070
 
6071
- #: includes/class-mla-wpml-support.php:2318
6072
  #, php-format
6073
  msgid "Add translation to %s"
6074
  msgstr ""
6075
 
6076
  #: includes/mla-main-search-box-template.php:42
6077
  #: includes/mla-main-search-box-template.php:44
6078
- #: includes/mla-media-modal-js-template.php:42
6079
  msgid "Search Media"
6080
  msgstr ""
6081
 
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Media Library Assistant\n"
5
+ "POT-Creation-Date: 2021-07-22 11:52-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@davidlingren.com>\n"
24
  #: includes/class-mla-admin-columns-pro-support-423.php:178
25
  #: includes/class-mla-admin-columns-pro-support-44.php:175
26
  #: includes/class-mla-admin-columns-pro-support.php:193
27
+ #: includes/class-mla-ajax.php:356 includes/class-mla-edit-media.php:1059
28
  #: includes/class-mla-list-table.php:712
29
  msgid "Draft"
30
  msgstr ""
32
  #: includes/class-mla-admin-columns-pro-support-423.php:181
33
  #: includes/class-mla-admin-columns-pro-support-44.php:178
34
  #: includes/class-mla-admin-columns-pro-support.php:196
35
+ #: includes/class-mla-ajax.php:350 includes/class-mla-edit-media.php:1053
36
  #: includes/class-mla-list-table.php:715
37
  msgid "Scheduled"
38
  msgstr ""
40
  #: includes/class-mla-admin-columns-pro-support-423.php:184
41
  #: includes/class-mla-admin-columns-pro-support-44.php:181
42
  #: includes/class-mla-admin-columns-pro-support.php:199
43
+ #: includes/class-mla-edit-media.php:1056 includes/class-mla-list-table.php:718
44
  msgctxt "post state"
45
  msgid "Pending"
46
  msgstr ""
58
  #: includes/class-mla-admin-columns-pro-support.php:433
59
  #: includes/class-mla-data-references.php:310
60
  #: includes/class-mla-data-references.php:634
61
+ #: includes/class-mla-list-table.php:1154
62
  msgid "NO REFERENCE TESTS"
63
  msgstr ""
64
 
74
  #: includes/class-mla-admin-columns-pro-support.php:692
75
  #: includes/class-mla-admin-columns-pro-support.php:759
76
  #: includes/class-mla-admin-columns-pro-support.php:821
77
+ #: includes/class-mla-core-options.php:457
78
+ #: includes/class-mla-core-options.php:467
79
+ #: includes/class-mla-core-options.php:477
80
+ #: includes/class-mla-core-options.php:487
81
+ #: includes/class-mla-list-table.php:1234
82
+ #: includes/class-mla-list-table.php:1279
83
+ #: includes/class-mla-list-table.php:1329
84
+ #: includes/class-mla-list-table.php:1374
85
  msgid "Disabled"
86
  msgstr ""
87
 
97
  #: includes/class-mla-admin-columns-pro-support.php:715
98
  #: includes/class-mla-admin-columns-pro-support.php:778
99
  #: includes/class-mla-admin-columns-pro-support.php:840
100
+ #: includes/class-mla-edit-media.php:1141
101
+ #: includes/class-mla-edit-media.php:1178
102
+ #: includes/class-mla-edit-media.php:1213
103
+ #: includes/class-mla-edit-media.php:1247
104
+ #: includes/class-mla-list-table.php:1252
105
+ #: includes/class-mla-list-table.php:1301
106
+ #: includes/class-mla-list-table.php:1347
107
+ #: includes/class-mla-list-table.php:1392
108
  msgid "PARENT"
109
  msgstr ""
110
 
111
  #: includes/class-mla-admin-columns-pro-support-423.php:1027
112
  #: includes/class-mla-admin-columns-pro-support-44.php:1024
113
  #: includes/class-mla-admin-columns-pro-support.php:1065
114
+ #: includes/class-mla-core-options.php:616
115
+ #: includes/class-mla-core-options.php:873
116
+ #: includes/class-mla-core-options.php:904
117
+ #: includes/class-mla-core-options.php:918
118
+ #: includes/class-mla-list-table.php:561 includes/class-mla-list-table.php:1487
119
  #: includes/class-mla-settings-shortcodes-tab.php:649
120
  msgid "None"
121
  msgstr ""
123
  #: includes/class-mla-admin-columns-pro-support-423.php:1117
124
  #: includes/class-mla-admin-columns-pro-support-44.php:1114
125
  #: includes/class-mla-admin-columns-pro-support.php:1155
126
+ #: includes/class-mla-list-table.php:1626
127
  msgid "(Private post)"
128
  msgstr ""
129
 
130
  #: includes/class-mla-admin-columns-pro-support-423.php:1121
131
  #: includes/class-mla-admin-columns-pro-support-44.php:1118
132
  #: includes/class-mla-admin-columns-pro-support.php:1159
133
+ #: includes/class-mla-ajax.php:366 includes/class-mla-list-table.php:1537
134
+ #: includes/class-mla-list-table.php:1566
135
+ #: includes/class-mla-list-table.php:1630
136
  msgid "Y/m/d"
137
  msgstr ""
138
 
139
  #: includes/class-mla-admin-columns-pro-support-423.php:1134
140
  #: includes/class-mla-admin-columns-pro-support-44.php:1131
141
  #: includes/class-mla-admin-columns-pro-support.php:1172
142
+ #: includes/class-mla-core-options.php:1320
143
+ #: includes/class-mla-list-table.php:1643
144
  msgctxt "table_view_singular"
145
  msgid "Unattached"
146
  msgstr ""
147
 
148
  #: includes/class-mla-admin-columns-support-deprecated.php:33
149
  #: includes/class-mla-admin-columns-support.php:43
150
+ #: includes/class-mla-core-options.php:566 includes/class-mla-settings.php:426
151
+ #: includes/class-mla-settings.php:1446 includes/class-mla-settings.php:1464
152
  #: index.php:46
153
  msgid "Media Library Assistant"
154
  msgstr ""
155
 
156
  #: includes/class-mla-admin-columns-support-deprecated.php:34
157
  #: includes/class-mla-admin-columns-support.php:44
158
+ #: includes/class-mla-core-options.php:575
159
  msgid "Assistant"
160
  msgstr ""
161
 
167
 
168
  #: includes/class-mla-ajax.php:77 includes/class-mla-ajax.php:94
169
  #: includes/class-mla-ajax.php:111 includes/class-mla-ajax.php:129
170
+ #: includes/class-mla-ajax.php:148 includes/class-mla-data-query.php:1388
171
+ #: includes/class-mla-data-query.php:1404
172
+ #: includes/class-mla-data-query.php:1406
173
+ #: includes/class-mla-data-query.php:1920
174
+ #: includes/class-mla-data-query.php:2011
175
+ #: includes/class-mla-data-query.php:2083
176
+ #: includes/class-mla-data-query.php:2178
177
+ #: includes/class-mla-data-query.php:2264
178
+ #: includes/class-mla-data-query.php:2283
179
  msgid "DEBUG"
180
  msgstr ""
181
 
207
  "\"%3$d\" count = %4$d."
208
  msgstr ""
209
 
210
+ #: includes/class-mla-ajax.php:337 includes/class-mla-core-options.php:1196
211
+ #: includes/class-mla-data.php:4321 includes/class-mla-edit-media.php:480
212
+ #: includes/class-mla-main.php:2081 includes/class-mla-main.php:2403
213
+ #: includes/class-mla-objects.php:370 includes/class-mla-options.php:466
214
  #: includes/mla-main-search-box-template.php:47
215
+ #: includes/mla-media-modal-js-template.php:38
216
  msgid "Title"
217
  msgstr ""
218
 
219
+ #: includes/class-mla-ajax.php:337 includes/class-mla-main.php:2082
220
  #: includes/class-mla-thumbnail-generation.php:644
221
  msgid "Type"
222
  msgstr ""
223
 
224
+ #: includes/class-mla-ajax.php:337 includes/class-mla-main.php:2083
225
  msgid "Date"
226
  msgstr ""
227
 
228
+ #: includes/class-mla-ajax.php:337 includes/class-mla-main.php:2084
229
  #: includes/class-mla-settings-custom-fields-tab.php:516
230
  #: includes/class-mla-settings-custom-fields-tab.php:826
231
  #: includes/class-mla-settings-iptc-exif-tab.php:545
234
  msgid "Status"
235
  msgstr ""
236
 
237
+ #: includes/class-mla-ajax.php:341 includes/class-mla-list-table.php:963
238
+ #: includes/class-mla-list-table.php:1128 includes/class-mla-main.php:461
239
  #: includes/class-mla-polylang-support.php:375
240
  #: includes/class-mla-thumbnail-generation.php:97
241
  msgid "(no title)"
260
  #: includes/class-mla-data-pdf.php:519 includes/class-mla-data-pdf.php:565
261
  #: includes/class-mla-data-pdf.php:749 includes/class-mla-data-query.php:843
262
  #: includes/class-mla-data.php:50 includes/class-mla-data.php:109
263
+ #: includes/class-mla-data.php:196 includes/class-mla-data.php:257
264
+ #: includes/class-mla-data.php:325 includes/class-mla-data.php:414
265
+ #: includes/class-mla-data.php:566 includes/class-mla-data.php:629
266
+ #: includes/class-mla-data.php:1598 includes/class-mla-data.php:1797
267
+ #: includes/class-mla-data.php:1803 includes/class-mla-data.php:2153
268
+ #: includes/class-mla-data.php:2157 includes/class-mla-data.php:3522
269
+ #: includes/class-mla-data.php:3583 includes/class-mla-data.php:3627
270
+ #: includes/class-mla-data.php:4021 includes/class-mla-data.php:4034
271
+ #: includes/class-mla-data.php:4056 includes/class-mla-data.php:4296
272
+ #: includes/class-mla-data.php:4342 includes/class-mla-data.php:4375
273
+ #: includes/class-mla-data.php:4391 includes/class-mla-data.php:4665
274
+ #: includes/class-mla-edit-media.php:321 includes/class-mla-edit-media.php:965
275
+ #: includes/class-mla-edit-media.php:1007 includes/class-mla-main.php:709
276
  #: includes/class-mla-main.php:837 includes/class-mla-main.php:839
277
  #: includes/class-mla-main.php:842 includes/class-mla-main.php:902
278
  #: includes/class-mla-main.php:936 includes/class-mla-main.php:945
281
  #: includes/class-mla-main.php:1556 includes/class-mla-main.php:1606
282
  #: includes/class-mla-main.php:1716 includes/class-mla-main.php:1745
283
  #: includes/class-mla-main.php:1887 includes/class-mla-main.php:1894
284
+ #: includes/class-mla-main.php:2067 includes/class-mla-main.php:2206
285
+ #: includes/class-mla-main.php:2535 includes/class-mla-main.php:2543
286
+ #: includes/class-mla-main.php:2567 includes/class-mla-main.php:2575
287
+ #: includes/class-mla-main.php:2607 includes/class-mla-main.php:2615
288
  #: includes/class-mla-media-modal.php:618 includes/class-mla-mime-types.php:825
289
  #: includes/class-mla-mime-types.php:1209
290
  #: includes/class-mla-mime-types.php:1297
302
  #: includes/class-mla-mime-types.php:2525
303
  #: includes/class-mla-mime-types.php:2604
304
  #: includes/class-mla-mime-types.php:2613
305
+ #: includes/class-mla-mime-types.php:2645 includes/class-mla-objects.php:267
306
  #: includes/class-mla-options.php:218 includes/class-mla-options.php:434
307
  #: includes/class-mla-options.php:515 includes/class-mla-options.php:570
308
  #: includes/class-mla-options.php:1133 includes/class-mla-options.php:1973
361
  #: includes/class-mla-settings-view-tab.php:453
362
  #: includes/class-mla-settings.php:586 includes/class-mla-settings.php:725
363
  #: includes/class-mla-settings.php:762 includes/class-mla-settings.php:902
364
+ #: includes/class-mla-settings.php:1312 includes/class-mla-settings.php:1358
365
+ #: includes/class-mla-settings.php:1446 includes/class-mla-settings.php:1475
366
+ #: includes/class-mla-settings.php:1478 includes/class-mla-settings.php:1482
367
+ #: includes/class-mla-settings.php:1777 includes/class-mla-settings.php:1781
368
+ #: includes/class-mla-settings.php:1792 includes/class-mla-settings.php:1799
369
+ #: includes/class-mla-settings.php:1808 includes/class-mla-settings.php:1845
370
+ #: includes/class-mla-settings.php:1853 includes/class-mla-settings.php:1862
371
+ #: includes/class-mla-shortcode-support.php:2229
372
+ #: includes/class-mla-shortcode-support.php:2324
373
+ #: includes/class-mla-shortcode-support.php:3701
374
+ #: includes/class-mla-shortcode-support.php:3865
375
+ #: includes/class-mla-shortcode-support.php:3897
376
+ #: includes/class-mla-shortcode-support.php:5215
377
+ #: includes/class-mla-shortcode-support.php:5285
378
+ #: includes/class-mla-shortcode-support.php:5749
379
+ #: includes/class-mla-shortcode-support.php:5765
380
+ #: includes/class-mla-shortcode-support.php:5788
381
+ #: includes/class-mla-shortcode-support.php:5804
382
  #: includes/class-mla-thumbnail-generation.php:437
383
  #: includes/class-mla-thumbnail-generation.php:449
384
  #: includes/class-mla-thumbnail-generation.php:461
395
  msgid "You are not allowed to edit this Attachment."
396
  msgstr ""
397
 
398
+ #: includes/class-mla-core-options.php:418 includes/class-mla-options.php:257
399
  msgid "Attachment Categories"
400
  msgstr ""
401
 
402
+ #: includes/class-mla-core-options.php:422
403
  msgid "Check this option to add support for Attachment Categories."
404
  msgstr ""
405
 
406
+ #: includes/class-mla-core-options.php:426 includes/class-mla-options.php:272
407
  msgid "Attachment Tags"
408
  msgstr ""
409
 
410
+ #: includes/class-mla-core-options.php:430
411
  msgid "Check this option to add support for Attachment Tags."
412
  msgstr ""
413
 
414
+ #: includes/class-mla-core-options.php:434 includes/class-mla-settings.php:1060
415
  msgid "Where-used Reporting"
416
  msgstr ""
417
 
418
+ #: includes/class-mla-core-options.php:439
419
  msgid "Exclude Revisions"
420
  msgstr ""
421
 
422
+ #: includes/class-mla-core-options.php:443
423
  msgid "Check this option to exclude revisions from where-used reporting."
424
  msgstr ""
425
 
426
+ #: includes/class-mla-core-options.php:447
427
  msgid "Where-used database access tuning"
428
  msgstr ""
429
 
430
+ #: includes/class-mla-core-options.php:452
431
+ #: includes/class-mla-edit-media.php:900 includes/class-mla-edit-media.php:1152
432
  msgid "Featured in"
433
  msgstr ""
434
 
435
+ #: includes/class-mla-core-options.php:457
436
+ #: includes/class-mla-core-options.php:467
437
  msgid "Enabled"
438
  msgstr ""
439
 
440
+ #: includes/class-mla-core-options.php:458
441
  msgid "Search database posts and pages for Featured Image attachments."
442
  msgstr ""
443
 
444
+ #: includes/class-mla-core-options.php:462
445
+ #: includes/class-mla-edit-media.php:904 includes/class-mla-edit-media.php:1190
446
  msgid "Inserted in"
447
  msgstr ""
448
 
449
+ #: includes/class-mla-core-options.php:467
450
  msgid "Base"
451
  msgstr ""
452
 
453
+ #: includes/class-mla-core-options.php:468
454
  msgid ""
455
  "Search database posts and pages for attachments embedded in content."
456
  "<br>&nbsp;&nbsp;Base = ignore intermediate size suffixes; use path, base "
457
  "name and extension only."
458
  msgstr ""
459
 
460
+ #: includes/class-mla-core-options.php:472
461
+ #: includes/class-mla-edit-media.php:908 includes/class-mla-edit-media.php:1224
462
+ #: includes/class-mla-settings.php:1558
463
  msgid "Gallery in"
464
  msgstr ""
465
 
466
+ #: includes/class-mla-core-options.php:477
467
+ #: includes/class-mla-core-options.php:487
468
  msgid "Dynamic"
469
  msgstr ""
470
 
471
+ #: includes/class-mla-core-options.php:477
472
+ #: includes/class-mla-core-options.php:487 includes/class-mla-main.php:2438
473
  #: includes/class-mla-settings-custom-fields-tab.php:756
474
  #: includes/class-mla-settings-iptc-exif-tab.php:862
475
  msgid "Refresh"
476
  msgstr ""
477
 
478
+ #: includes/class-mla-core-options.php:477
479
+ #: includes/class-mla-core-options.php:487
480
  msgid "Cached"
481
  msgstr ""
482
 
483
+ #: includes/class-mla-core-options.php:478
484
  msgid ""
485
  "Search database posts and pages for [ gallery ] shortcode results.<br>&nbsp;"
486
  "&nbsp;Dynamic = once every page load, Cached = once every login, Disabled = "
487
  "never.<br>&nbsp;&nbsp;Refresh = update references, then set to Cached."
488
  msgstr ""
489
 
490
+ #: includes/class-mla-core-options.php:482
491
+ #: includes/class-mla-edit-media.php:912 includes/class-mla-edit-media.php:1258
492
+ #: includes/class-mla-settings.php:1568
493
  msgid "MLA Gallery in"
494
  msgstr ""
495
 
496
+ #: includes/class-mla-core-options.php:488
497
  msgid ""
498
  "Search database posts and pages for [mla_gallery] shortcode results."
499
  "<br>&nbsp;&nbsp;Dynamic = once every page load, Cached = once every login, "
501
  "Cached."
502
  msgstr ""
503
 
504
+ #: includes/class-mla-core-options.php:492 includes/class-mla-settings.php:1060
505
  msgid "Taxonomy Support"
506
  msgstr ""
507
 
508
+ #: includes/class-mla-core-options.php:497
509
  msgid "Compute Attachments Column"
510
  msgstr ""
511
 
512
+ #: includes/class-mla-core-options.php:501
513
  msgid ""
514
  "Check this option to calculate attachments per term in the Attachments "
515
  "Column."
516
  msgstr ""
517
 
518
+ #: includes/class-mla-core-options.php:505
519
  msgid "Show Count Column"
520
  msgstr ""
521
 
522
+ #: includes/class-mla-core-options.php:509
523
  msgid "Check this option to display the Count column on taxonomy edit screens."
524
  msgstr ""
525
 
526
+ #: includes/class-mla-core-options.php:514
527
  msgid ""
528
  "Check the \"<strong>Support</strong>\" box to add the taxonomy to the "
529
  "Assistant and the Edit Media screen."
530
  msgstr ""
531
 
532
+ #: includes/class-mla-core-options.php:515
533
  msgid ""
534
  "Check the \"<strong>Inline Edit</strong>\" box to display the taxonomy in "
535
  "the Quick Edit and Bulk Edit areas."
536
  msgstr ""
537
 
538
+ #: includes/class-mla-core-options.php:516
539
  msgid ""
540
  "Check the \"<strong>Term Search</strong>\" box to add the taxonomy to the "
541
  "\"Search Media/Terms\" list."
542
  msgstr ""
543
 
544
+ #: includes/class-mla-core-options.php:517
545
+ #: includes/class-mla-core-options.php:755 includes/class-mla-settings.php:1093
546
+ #: includes/class-mla-settings.php:1094 includes/class-mla-settings.php:1095
547
  msgid "For complete documentation"
548
  msgstr ""
549
 
550
+ #: includes/class-mla-core-options.php:517
551
+ #: includes/class-mla-core-options.php:755 includes/class-mla-settings.php:1093
552
+ #: includes/class-mla-settings.php:1094 includes/class-mla-settings.php:1095
553
  msgid "click here"
554
  msgstr ""
555
 
556
+ #: includes/class-mla-core-options.php:519
557
  msgid ""
558
  "Check the \"<strong>Checklist</strong>\" box to enable the checklist-style "
559
  "meta box for a flat taxonomy."
560
  msgstr ""
561
 
562
+ #: includes/class-mla-core-options.php:520
563
  msgid ""
564
  "You must also check the <strong>\"Enable enhanced checklist taxonomies\"</"
565
  "strong> box below to enable this feature."
566
  msgstr ""
567
 
568
+ #: includes/class-mla-core-options.php:521
569
  msgid ""
570
  "Check the \"<strong>Checked On Top</strong>\" box to move checked terms to "
571
  "the top of the checklist-style meta box."
572
  msgstr ""
573
 
574
+ #: includes/class-mla-core-options.php:522
575
  msgid ""
576
  "Check the \"<strong>Inline Add Term</strong>\" box to support adding terms "
577
  "in the Quick Edit and Bulk Edit areas."
578
  msgstr ""
579
 
580
+ #: includes/class-mla-core-options.php:523
581
  msgid ""
582
  "Use the \"<strong>List Filter</strong>\" option to select the taxonomy (or "
583
  "custom field) on which to filter the Assistant table listing."
584
  msgstr ""
585
 
586
+ #: includes/class-mla-core-options.php:524
587
  msgid ""
588
  "To <strong>filter on a custom field</strong>, enter the field name and "
589
  "select ASC (Ascending) or DESC (Descending) order."
590
  msgstr ""
591
 
592
+ #: includes/class-mla-core-options.php:553
593
  msgid "Media/Assistant Screen Options"
594
  msgstr ""
595
 
596
+ #: includes/class-mla-core-options.php:558
597
  msgid "Admin Menu Options"
598
  msgstr ""
599
 
600
+ #: includes/class-mla-core-options.php:563
601
  msgid "Page Title"
602
  msgstr ""
603
 
604
+ #: includes/class-mla-core-options.php:568
605
  msgid "Enter the title for the Media/Assistant submenu page"
606
  msgstr ""
607
 
608
+ #: includes/class-mla-core-options.php:572
609
  msgid "Menu Title"
610
  msgstr ""
611
 
612
+ #: includes/class-mla-core-options.php:577
613
  msgid "Enter the title for the Media/Assistant submenu entry"
614
  msgstr ""
615
 
616
+ #: includes/class-mla-core-options.php:581
617
  msgid "Submenu Order"
618
  msgstr ""
619
 
620
+ #: includes/class-mla-core-options.php:586
621
  msgid ""
622
  "Enter the position of the Media/Assistant submenu entry.<br>&nbsp;&nbsp;0 = "
623
  "natural order (at bottom),&nbsp;&nbsp;&nbsp;&nbsp;1 - 4 = at top<br>&nbsp;"
625
  "\""
626
  msgstr ""
627
 
628
+ #: includes/class-mla-core-options.php:590
629
  msgid "Display Media/Library"
630
  msgstr ""
631
 
632
+ #: includes/class-mla-core-options.php:594
633
  msgid ""
634
  "Check/uncheck this option to display/remove the WordPress Media/Library "
635
  "submenu entry."
636
  msgstr ""
637
 
638
+ #: includes/class-mla-core-options.php:598
639
  msgid "Display Media/Assistant list/grid view switcher"
640
  msgstr ""
641
 
642
+ #: includes/class-mla-core-options.php:602
643
  msgid ""
644
  "Check/uncheck this option to display/remove the \"list/grid\" view switcher "
645
  "on the Media/Assistant submenu."
646
  msgstr ""
647
 
648
+ #: includes/class-mla-core-options.php:606
649
  msgid "Table Defaults"
650
  msgstr ""
651
 
652
+ #: includes/class-mla-core-options.php:611
653
  msgid "Order By"
654
  msgstr ""
655
 
656
+ #: includes/class-mla-core-options.php:616
657
  msgid "ID/Parent"
658
  msgstr ""
659
 
660
+ #: includes/class-mla-core-options.php:617
661
  msgid "Select the column for the sort order of the Assistant table listing."
662
  msgstr ""
663
 
664
+ #: includes/class-mla-core-options.php:621
665
  msgid "Order"
666
  msgstr ""
667
 
668
+ #: includes/class-mla-core-options.php:626
669
  msgid "Ascending"
670
  msgstr ""
671
 
672
+ #: includes/class-mla-core-options.php:626
673
  msgid "Descending"
674
  msgstr ""
675
 
676
+ #: includes/class-mla-core-options.php:627
677
+ #: includes/class-mla-core-options.php:883
678
  msgid "Choose the sort order."
679
  msgstr ""
680
 
681
+ #: includes/class-mla-core-options.php:631 includes/class-mla-main.php:630
682
  msgid "Entries per page"
683
  msgstr ""
684
 
685
+ #: includes/class-mla-core-options.php:635
686
  msgid "Enter the number of Media/Assistant submenu table items per page."
687
  msgstr ""
688
 
689
+ #: includes/class-mla-core-options.php:644
690
  msgid "Views Width"
691
  msgstr ""
692
 
693
+ #: includes/class-mla-core-options.php:649
694
  msgid "Enter the width for the views list, in pixels (px) or percent (%)"
695
  msgstr ""
696
 
697
+ #: includes/class-mla-core-options.php:653
698
  msgid "Icon Size"
699
  msgstr ""
700
 
701
+ #: includes/class-mla-core-options.php:658
702
  msgid "Enter the size of the thumbnail/icon images, in pixels"
703
  msgstr ""
704
 
705
+ #: includes/class-mla-core-options.php:662
706
  msgid "Show Primary Column File Name"
707
  msgstr ""
708
 
709
+ #: includes/class-mla-core-options.php:666
710
  msgid ""
711
  "Check/uncheck this option to show/omit the file name from the primary column."
712
  msgstr ""
713
 
714
+ #: includes/class-mla-core-options.php:670
715
  msgid "QuickTags editor for bulk description"
716
  msgstr ""
717
 
718
+ #: includes/class-mla-core-options.php:674
719
  msgid ""
720
  "Check this option to use the QuickTags editor for the Description field in "
721
  "the Bulk Edit area."
722
  msgstr ""
723
 
724
+ #: includes/class-mla-core-options.php:678
725
  msgid "Bulk Chunk Size"
726
  msgstr ""
727
 
728
+ #: includes/class-mla-core-options.php:683
729
  msgid "Enter the size of the Bulk Edit and Map All processing chunks"
730
  msgstr ""
731
 
732
+ #: includes/class-mla-core-options.php:687
733
  msgid "Taxonomy Filter parameters"
734
  msgstr ""
735
 
736
+ #: includes/class-mla-core-options.php:692
737
  msgid "Maximum Depth"
738
  msgstr ""
739
 
740
+ #: includes/class-mla-core-options.php:697
741
  msgid ""
742
  "Enter the number of levels displayed for hierarchial taxonomies; enter zero "
743
  "for no limit."
744
  msgstr ""
745
 
746
+ #: includes/class-mla-core-options.php:701
747
  msgid "Include Children"
748
  msgstr ""
749
 
750
+ #: includes/class-mla-core-options.php:705
751
  msgid ""
752
  "Check/uncheck this option to include/exclude children for hierarchical "
753
  "taxonomies."
754
  msgstr ""
755
 
756
+ #: includes/class-mla-core-options.php:709
757
  msgid "Search Media Defaults"
758
  msgstr ""
759
 
760
+ #: includes/class-mla-core-options.php:714
761
  msgid "Display Search Controls"
762
  msgstr ""
763
 
764
+ #: includes/class-mla-core-options.php:718
765
+ #: includes/class-mla-core-options.php:844
766
  msgid ""
767
  "Check/uncheck this option to display/hide the and/or connector and search "
768
  "fields controls."
769
  msgstr ""
770
 
771
+ #: includes/class-mla-core-options.php:722
772
  msgid ""
773
  "Use these controls to set defaults for the and/or connector and search "
774
  "fields controls.<br>These defaults will be used for the Search Media boxes "
775
  "on both the Media/Assistant submenu<br>and the Media Manager Modal Window."
776
  msgstr ""
777
 
778
+ #: includes/class-mla-core-options.php:736
779
  msgid "Media/Edit Media Enhancements"
780
  msgstr ""
781
 
782
+ #: includes/class-mla-core-options.php:741
783
  msgid "Enable &quot;enhanced checklist&quot; taxonomies"
784
  msgstr ""
785
 
786
+ #: includes/class-mla-core-options.php:745
787
  msgid ""
788
  "Check this option to enable the \"? Search\" feature for hierarchical "
789
  "taxonomies, e.g., Att. Categories.<br>&nbsp;&nbsp;This option also enables "
790
  "the \"checklist-style\" support for flat taxonomies, e.g., Att. Tags."
791
  msgstr ""
792
 
793
+ #: includes/class-mla-core-options.php:749
794
  msgid "Enable Edit Media additional meta boxes"
795
  msgstr ""
796
 
797
+ #: includes/class-mla-core-options.php:753
798
  msgid ""
799
  "Check this option to add \"Parent Info\", \"Menu Order\", \"Attachment "
800
  "Metadata\" and four \"where-used\" meta boxes to the Edit Media screen."
801
  msgstr ""
802
 
803
+ #: includes/class-mla-core-options.php:754
804
  msgid "You can also use Filters to customize the meta boxes."
805
  msgstr ""
806
 
807
+ #: includes/class-mla-core-options.php:759
808
  msgid "Media/Add New Enhancements"
809
  msgstr ""
810
 
811
+ #: includes/class-mla-core-options.php:764
812
  msgid "Enable &quot;bulk edit&quot; area"
813
  msgstr ""
814
 
815
+ #: includes/class-mla-core-options.php:768
816
  msgid ""
817
  "Check this option to enable the \"Bulk Edit area\" feature on the Media/Add "
818
  "New screen."
819
  msgstr ""
820
 
821
+ #: includes/class-mla-core-options.php:772
822
  msgid "&quot;bulk edit&quot; area on top"
823
  msgstr ""
824
 
825
+ #: includes/class-mla-core-options.php:776
826
  msgid ""
827
  "Check this option to move the \"Bulk Edit area\" to the top of the Media/Add "
828
  "New screen."
829
  msgstr ""
830
 
831
+ #: includes/class-mla-core-options.php:780
832
  msgid "&quot;bulk edit&quot; area initially open"
833
  msgstr ""
834
 
835
+ #: includes/class-mla-core-options.php:783
836
  msgid ""
837
  "Check this option to automatically open the \"Bulk Edit area\" when the "
838
  "Media/Add New screen is displayed."
839
  msgstr ""
840
 
841
+ #: includes/class-mla-core-options.php:787
842
  msgid "Media Manager/Media Grid Enhancements"
843
  msgstr ""
844
 
845
+ #: includes/class-mla-core-options.php:792
846
  msgid "Enable Media Grid Enhancements"
847
  msgstr ""
848
 
849
+ #: includes/class-mla-core-options.php:795
850
  msgid ""
851
  "Check/uncheck this option to enable/disable Media Library Grid View "
852
  "Enhancements."
853
  msgstr ""
854
 
855
+ #: includes/class-mla-core-options.php:799
856
  msgid "Enable Media Manager Enhancements"
857
  msgstr ""
858
 
859
+ #: includes/class-mla-core-options.php:802
860
  msgid ""
861
  "Check/uncheck this option to enable/disable Media Manager Modal Window "
862
  "Enhancements."
863
  msgstr ""
864
 
865
+ #: includes/class-mla-core-options.php:806
866
  msgid "Media Manager Enhanced MIME Type filter"
867
  msgstr ""
868
 
869
+ #: includes/class-mla-core-options.php:809
870
  msgid ""
871
  "Check this option to filter by more MIME Types, e.g., text, applications."
872
  msgstr ""
873
 
874
+ #: includes/class-mla-core-options.php:813
875
  msgid "Media Manager Month and Year filter"
876
  msgstr ""
877
 
878
+ #: includes/class-mla-core-options.php:816
879
  msgid "Check this option to filter by month and year uploaded."
880
  msgstr ""
881
 
882
+ #: includes/class-mla-core-options.php:820
883
  msgid "Media Manager Category/Tag filter"
884
  msgstr ""
885
 
886
+ #: includes/class-mla-core-options.php:823
887
  msgid "Check this option to filter by taxonomy terms."
888
  msgstr ""
889
 
890
+ #: includes/class-mla-core-options.php:827
891
  msgid "Media Manager Terms Search popup"
892
  msgstr ""
893
 
894
+ #: includes/class-mla-core-options.php:830
895
  msgid "Check this option to enable the \"Terms Search\" popup window."
896
  msgstr ""
897
 
898
+ #: includes/class-mla-core-options.php:834
899
  msgid "Media Manager Enhanced Search Media box"
900
  msgstr ""
901
 
902
+ #: includes/class-mla-core-options.php:837
903
  msgid "Check this option to enable search box enhancements."
904
  msgstr ""
905
 
906
+ #: includes/class-mla-core-options.php:841
907
  msgid "Media Manager Enhanced Search Media Controls"
908
  msgstr ""
909
 
910
+ #: includes/class-mla-core-options.php:848
911
  msgid "Media Manager Checklist meta boxes"
912
  msgstr ""
913
 
914
+ #: includes/class-mla-core-options.php:851
915
  msgid ""
916
  "Check this option to enable MLA-enhanced meta boxes in the \"ATTACHMENT "
917
  "DETAILS\" pane.<br>&nbsp;&nbsp;This option is for any taxonomy that uses a "
918
  "<strong>\"checklist-style\"</strong> meta box."
919
  msgstr ""
920
 
921
+ #: includes/class-mla-core-options.php:855
922
  msgid "Media Manager Flat meta boxes"
923
  msgstr ""
924
 
925
+ #: includes/class-mla-core-options.php:858
926
  msgid ""
927
  "Check this option to enable MLA-enhanced meta boxes in the \"ATTACHMENT "
928
  "DETAILS\" pane.<br>&nbsp;&nbsp;This option is for <strong>flat taxonomies</"
930
  "style\" meta box."
931
  msgstr ""
932
 
933
+ #: includes/class-mla-core-options.php:862
934
  msgid "Media Manager auto-fill meta boxes"
935
  msgstr ""
936
 
937
+ #: includes/class-mla-core-options.php:865
938
  msgid ""
939
  "Check this option to automatically fill MLA-enhanced meta boxes in the "
940
  "\"ATTACHMENT DETAILS\" pane<br>&nbsp;&nbsp;when the item is selected."
941
  msgstr ""
942
 
943
+ #: includes/class-mla-core-options.php:869
944
  msgid "Media Manager Order By"
945
  msgstr ""
946
 
947
+ #: includes/class-mla-core-options.php:873
948
+ #: includes/class-mla-core-options.php:882
949
+ #: includes/class-mla-core-options.php:904
950
+ #: includes/class-mla-core-options.php:918
951
+ #: includes/class-mla-core-options.php:932 includes/class-mla-settings.php:1144
952
  msgid "Media Manager Default"
953
  msgstr ""
954
 
955
+ #: includes/class-mla-core-options.php:873
956
  msgid "Title/Name"
957
  msgstr ""
958
 
959
+ #: includes/class-mla-core-options.php:874
960
  msgid ""
961
  "If you want to override the Media Manager default,<br>&nbsp;&nbsp;select a "
962
  "column for the sort order of the Media Library listing."
963
  msgstr ""
964
 
965
+ #: includes/class-mla-core-options.php:878
966
  msgid "Media Manager Order"
967
  msgstr ""
968
 
969
+ #: includes/class-mla-core-options.php:887
970
  msgid "Attachment Display Settings"
971
  msgstr ""
972
 
973
+ #: includes/class-mla-core-options.php:892
974
  msgid "Media Manager Apply Display Settings"
975
  msgstr ""
976
 
977
+ #: includes/class-mla-core-options.php:895
978
  msgid ""
979
  "Check this option to always start with the Attachment Display Settings set "
980
  "here,<br>&nbsp;&nbsp;overriding browser-/cookie-based defaults."
981
  msgstr ""
982
 
983
+ #: includes/class-mla-core-options.php:899
984
+ #: includes/class-mla-core-options.php:901
985
  msgid "Alignment"
986
  msgstr ""
987
 
988
+ #: includes/class-mla-core-options.php:901
989
+ #: includes/class-mla-core-options.php:915
990
+ #: includes/class-mla-core-options.php:929
991
  #, php-format
992
  msgid ""
993
  "Select a value for the default %1$s option in the Attachment Display "
994
  "Settings."
995
  msgstr ""
996
 
997
+ #: includes/class-mla-core-options.php:904
998
  msgid "Left"
999
  msgstr ""
1000
 
1001
+ #: includes/class-mla-core-options.php:904
1002
  msgid "Center"
1003
  msgstr ""
1004
 
1005
+ #: includes/class-mla-core-options.php:904
1006
  msgid "Right"
1007
  msgstr ""
1008
 
1009
+ #: includes/class-mla-core-options.php:913
1010
+ #: includes/class-mla-core-options.php:915
1011
  msgid "Link To"
1012
  msgstr ""
1013
 
1014
+ #: includes/class-mla-core-options.php:918
1015
  msgid "Media File"
1016
  msgstr ""
1017
 
1018
+ #: includes/class-mla-core-options.php:918
1019
  msgid "Attachment Page"
1020
  msgstr ""
1021
 
1022
+ #: includes/class-mla-core-options.php:918
1023
  msgid "Custom URL"
1024
  msgstr ""
1025
 
1026
+ #: includes/class-mla-core-options.php:927
1027
+ #: includes/class-mla-core-options.php:929
1028
  msgid "Size"
1029
  msgstr ""
1030
 
1031
+ #: includes/class-mla-core-options.php:932
1032
  #: includes/class-mla-thumbnail-generation.php:591
1033
  #: includes/class-mla-thumbnail-generation.php:655
1034
  msgid "Thumbnail"
1035
  msgstr ""
1036
 
1037
+ #: includes/class-mla-core-options.php:932
1038
  msgid "Medium"
1039
  msgstr ""
1040
 
1041
+ #: includes/class-mla-core-options.php:932
1042
  msgid "Large"
1043
  msgstr ""
1044
 
1045
+ #: includes/class-mla-core-options.php:932
1046
  msgid "Full Size"
1047
  msgstr ""
1048
 
1049
+ #: includes/class-mla-core-options.php:941
1050
  msgid "Uninstall (Delete) Plugin Settings"
1051
  msgstr ""
1052
 
1053
+ #: includes/class-mla-core-options.php:946
1054
  msgid "Delete Option Settings"
1055
  msgstr ""
1056
 
1057
+ #: includes/class-mla-core-options.php:949
1058
  msgid ""
1059
  "Check this option to remove all MLA option settings from the database when "
1060
  "the plugin is deleted.<br>&nbsp;&nbsp;<strong>You can make a backup copy</"
1061
  "strong> of your settings below by clicking \""
1062
  msgstr ""
1063
 
1064
+ #: includes/class-mla-core-options.php:949 includes/class-mla-settings.php:1062
1065
  msgid "Export ALL Settings"
1066
  msgstr ""
1067
 
1068
+ #: includes/class-mla-core-options.php:953
1069
  msgid "Delete Option Settings Backups"
1070
  msgstr ""
1071
 
1072
+ #: includes/class-mla-core-options.php:956
1073
  msgid ""
1074
  "Check this option to remove the <code>/wp-content/mla-backup</code> "
1075
  "directory and its contents when the plugin is deleted."
1076
  msgstr ""
1077
 
1078
+ #: includes/class-mla-core-options.php:960
1079
  msgid "Default [mla_gallery] Templates and Settings"
1080
  msgstr ""
1081
 
1082
+ #: includes/class-mla-core-options.php:965
1083
+ #: includes/class-mla-core-options.php:971
1084
+ #: includes/class-mla-core-options.php:1009
1085
+ #: includes/class-mla-core-options.php:1015
1086
  msgid "Style Template"
1087
  msgstr ""
1088
 
1089
+ #: includes/class-mla-core-options.php:971
1090
+ #: includes/class-mla-core-options.php:981
1091
+ #: includes/class-mla-core-options.php:1015
1092
+ #: includes/class-mla-core-options.php:1025
1093
  #, php-format
1094
  msgid "Select the default %1$s for your %2$s shortcodes."
1095
  msgstr ""
1096
 
1097
+ #: includes/class-mla-core-options.php:975
1098
+ #: includes/class-mla-core-options.php:1019
1099
  msgid "Markup Template"
1100
  msgstr ""
1101
 
1102
+ #: includes/class-mla-core-options.php:981
1103
+ #: includes/class-mla-core-options.php:1025
1104
  #: includes/class-mla-settings-shortcodes-tab.php:108
1105
  msgid "markup template"
1106
  msgstr ""
1107
 
1108
+ #: includes/class-mla-core-options.php:985
1109
+ #: includes/class-mla-core-options.php:1029
1110
  msgid "Default columns"
1111
  msgstr ""
1112
 
1113
+ #: includes/class-mla-core-options.php:989
1114
  msgid ""
1115
  "Enter the number of [mla_tag_cloud] columns; must be a positive integer."
1116
  msgstr ""
1117
 
1118
+ #: includes/class-mla-core-options.php:993
1119
+ #: includes/class-mla-core-options.php:1037
1120
  msgid "Default mla_margin"
1121
  msgstr ""
1122
 
1123
+ #: includes/class-mla-core-options.php:997
1124
+ #: includes/class-mla-core-options.php:1041
1125
  msgid ""
1126
  "Enter the CSS \"margin\" property value, in length (px, em, pt, etc.), "
1127
  "percent (%), \"auto\" or \"inherit\".<br>&nbsp;&nbsp;Enter \"none\" to "
1128
  "remove the property entirely."
1129
  msgstr ""
1130
 
1131
+ #: includes/class-mla-core-options.php:1001
1132
+ #: includes/class-mla-core-options.php:1045
1133
  msgid "Default mla_itemwidth"
1134
  msgstr ""
1135
 
1136
+ #: includes/class-mla-core-options.php:1005
1137
+ #: includes/class-mla-core-options.php:1049
1138
  msgid ""
1139
  "Enter the CSS \"width\" property value, in length (px, em, pt, etc.), "
1140
  "percent (%), \"auto\" or \"inherit\".<br>&nbsp;&nbsp;Enter \"calculate"
1144
  "the property entirely."
1145
  msgstr ""
1146
 
1147
+ #: includes/class-mla-core-options.php:1033
1148
  msgid "Enter the number of [mla_gallery] columns; must be a positive integer."
1149
  msgstr ""
1150
 
1151
+ #: includes/class-mla-core-options.php:1053
1152
  msgid "Thumbnail Substitution Support, mla_viewer"
1153
  msgstr ""
1154
 
1155
+ #: includes/class-mla-core-options.php:1058
1156
  msgid "Enable thumbnail substitution"
1157
  msgstr ""
1158
 
1159
+ #: includes/class-mla-core-options.php:1061
1160
  msgid ""
1161
  "Check this option to allow the \"mla_viewer\" to generate thumbnail images "
1162
  "for PDF documents. Thumbnails are generated dynamically, each time the item "
1165
  "strong>"
1166
  msgstr ""
1167
 
1168
+ #: includes/class-mla-core-options.php:1065
1169
  msgid "Enable Featured Images"
1170
  msgstr ""
1171
 
1172
+ #: includes/class-mla-core-options.php:1068
1173
  msgid ""
1174
  "Check this option to extend Featured Image support to all Media Library "
1175
  "items. The Featured Image can be used as a thumbnail image for the item in "
1176
  "an [mla_gallery] display."
1177
  msgstr ""
1178
 
1179
+ #: includes/class-mla-core-options.php:1072
1180
  msgid "Enable Featured Image Generation"
1181
  msgstr ""
1182
 
1183
+ #: includes/class-mla-core-options.php:1075
1184
  msgid ""
1185
  "Check this option to enable the \"Thumbnail\" generation action in the Media/"
1186
  "Assistant submenu Bulk Actions dropdown."
1187
  msgstr ""
1188
 
1189
+ #: includes/class-mla-core-options.php:1079
1190
  msgid "Enable explicit Ghostscript check"
1191
  msgstr ""
1192
 
1193
+ #: includes/class-mla-core-options.php:1082
1194
  msgid ""
1195
  "Check this option to enable the explicit check for Ghostscript support "
1196
  "required for thumbnail generation. If your Ghostscript software is in a non-"
1199
  "leave this option checked unless you know it is safe to turn it off."
1200
  msgstr ""
1201
 
1202
+ #: includes/class-mla-core-options.php:1086
1203
  msgid "Ghostscript path"
1204
  msgstr ""
1205
 
1206
+ #: includes/class-mla-core-options.php:1090
1207
  msgid ""
1208
  "If your &ldquo;gs&rdquo; executable is in a non-standard location, enter the "
1209
  "full path and filename here, e.g., &ldquo;/usr/bin/gs&rdquo;. It will "
1210
  "override the search for Ghostscript in other places."
1211
  msgstr ""
1212
 
1213
+ #: includes/class-mla-core-options.php:1110
1214
  msgid "Enable custom field mapping"
1215
  msgstr ""
1216
 
1217
+ #: includes/class-mla-core-options.php:1113
1218
+ #: includes/class-mla-core-options.php:1120
1219
+ #: includes/class-mla-core-options.php:1127
1220
+ #: includes/class-mla-core-options.php:1144
1221
  msgid "See Help menu."
1222
  msgstr ""
1223
 
1224
+ #: includes/class-mla-core-options.php:1117
1225
  msgid "Enable custom field mapping when adding new media"
1226
  msgstr ""
1227
 
1228
+ #: includes/class-mla-core-options.php:1124
1229
  msgid "Enable custom field mapping when updating media metadata"
1230
  msgstr ""
1231
 
1232
+ #: includes/class-mla-core-options.php:1131
1233
  msgid ""
1234
  "Update the custom field mapping values above, then click Save Changes to "
1235
  "make the updates permanent.<br>You can also make temporary updates and click "
1237
  "saving any rule changes."
1238
  msgstr ""
1239
 
1240
+ #: includes/class-mla-core-options.php:1141
1241
  msgid "Enable IPTC/EXIF Mapping"
1242
  msgstr ""
1243
 
1244
+ #: includes/class-mla-core-options.php:1148
1245
  msgid "Enable IPTC/EXIF Mapping when adding new media"
1246
  msgstr ""
1247
 
1248
+ #: includes/class-mla-core-options.php:1151
1249
  msgid ""
1250
  "Check this option to enable mapping when uploading new media (attachments)."
1251
  "<br>&nbsp;&nbsp;Does NOT affect the operation of the \"Map\" buttons on the "
1252
  "bulk edit, single edit and settings screens."
1253
  msgstr ""
1254
 
1255
+ #: includes/class-mla-core-options.php:1155
1256
  msgid "Enable IPTC/EXIF Mapping when updating media metadata"
1257
  msgstr ""
1258
 
1259
+ #: includes/class-mla-core-options.php:1158
1260
  msgid ""
1261
  "Check this option to enable mapping when media (attachments) metadata is "
1262
  "regenerated,<br>&nbsp;&nbsp;e.g., when the Media/Edit Media \"Edit Image\" "
1263
  "functions are used."
1264
  msgstr ""
1265
 
1266
+ #: includes/class-mla-core-options.php:1162
1267
  msgid ""
1268
  "Update the standard field mapping values above, then click <strong>Save "
1269
  "Changes</strong> to make the updates permanent.<br>You can also make "
1272
  "changes."
1273
  msgstr ""
1274
 
1275
+ #: includes/class-mla-core-options.php:1172
1276
  msgid ""
1277
  "Update the taxonomy term mapping values above, then click <strong>Save "
1278
  "Changes</strong> or <strong>Map All Attachments, Taxonomy Terms Now</strong>."
1279
  msgstr ""
1280
 
1281
+ #: includes/class-mla-core-options.php:1182
1282
  msgid ""
1283
  "<strong>Update</strong> individual custom field mapping values above, or "
1284
  "make several updates and click <strong>Save Changes</strong> below to apply "
1289
  "changes."
1290
  msgstr ""
1291
 
1292
+ #: includes/class-mla-core-options.php:1192
1293
  msgid "IPTC/EXIF Mapping help"
1294
  msgstr ""
1295
 
1296
+ #: includes/class-mla-core-options.php:1203 includes/class-mla-data.php:4345
1297
+ #: includes/class-mla-edit-media.php:481 includes/class-mla-main.php:2404
1298
  msgid "Name/Slug"
1299
  msgstr ""
1300
 
1301
+ #: includes/class-mla-core-options.php:1210 includes/class-mla-data.php:4388
1302
+ #: includes/class-mla-edit-media.php:484 includes/class-mla-list-table.php:1429
1303
+ #: includes/class-mla-main.php:2408 includes/class-mla-options.php:472
1304
  #: includes/mla-main-search-box-template.php:51
1305
+ #: includes/mla-media-modal-js-template.php:46
1306
  msgid "ALT Text"
1307
  msgstr ""
1308
 
1309
+ #: includes/class-mla-core-options.php:1217 includes/class-mla-data.php:4401
1310
+ #: includes/class-mla-edit-media.php:482 includes/class-mla-main.php:2405
1311
  #: includes/class-mla-options.php:475
1312
  #: includes/mla-main-search-box-template.php:53
1313
+ #: includes/mla-media-modal-js-template.php:51
1314
  msgid "Caption"
1315
  msgstr ""
1316
 
1317
+ #: includes/class-mla-core-options.php:1224 includes/class-mla-data.php:4410
1318
+ #: includes/class-mla-edit-media.php:483 includes/class-mla-main.php:2406
1319
  #: includes/class-mla-options.php:478
1320
  #: includes/class-mla-settings-upload-tab.php:199
1321
  #: includes/class-mla-settings-upload-tab.php:543
1328
  #: includes/class-mla-template-support.php:178
1329
  #: includes/class-mla-template-support.php:226
1330
  #: includes/mla-main-search-box-template.php:55
1331
+ #: includes/mla-media-modal-js-template.php:55
1332
  msgid "Description"
1333
  msgstr ""
1334
 
1335
+ #: includes/class-mla-core-options.php:1231 includes/class-mla-data.php:4472
1336
+ #: includes/class-mla-data.php:4481 includes/class-mla-edit-media.php:485
1337
+ #: includes/class-mla-edit-media.php:749 includes/class-mla-main.php:2410
1338
  msgid "Uploaded on"
1339
  msgstr ""
1340
 
1341
+ #: includes/class-mla-core-options.php:1251
1342
  msgid "Enable View and Post MIME Type Support"
1343
  msgstr ""
1344
 
1345
+ #: includes/class-mla-core-options.php:1254
1346
  msgid ""
1347
  "Check/uncheck this option to enable/disable Post MIME Type Support, then "
1348
  "click <strong>Save Changes</strong> to record the new setting."
1349
  msgstr ""
1350
 
1351
+ #: includes/class-mla-core-options.php:1263
1352
  msgid "Post MIME Types help."
1353
  msgstr ""
1354
 
1355
+ #: includes/class-mla-core-options.php:1266
1356
  #: includes/class-mla-mime-types.php:1696
1357
  #: includes/class-mla-settings-custom-fields-tab.php:2470
1358
  #: includes/class-mla-settings-documentation-tab.php:1545
1362
  msgid "All"
1363
  msgstr ""
1364
 
1365
+ #: includes/class-mla-core-options.php:1267
1366
  #: includes/class-mla-mime-types.php:1697
1367
  #: includes/class-mla-settings-custom-fields-tab.php:2471
1368
  #: includes/class-mla-settings-documentation-tab.php:1546
1372
  msgid "All"
1373
  msgstr ""
1374
 
1375
+ #: includes/class-mla-core-options.php:1272
1376
+ #: includes/class-mla-core-options.php:1326
1377
+ #: includes/class-mla-core-options.php:1335
1378
+ #: includes/class-mla-core-options.php:1344
1379
+ #: includes/class-mla-core-options.php:1353
1380
  msgctxt "post_mime_types_description"
1381
  msgid "Built-in view"
1382
  msgstr ""
1383
 
1384
+ #: includes/class-mla-core-options.php:1275
1385
  msgctxt "table_view_singular"
1386
  msgid "Image"
1387
  msgstr ""
1388
 
1389
+ #: includes/class-mla-core-options.php:1276
1390
  msgctxt "table_view_plural"
1391
  msgid "Images"
1392
  msgstr ""
1393
 
1394
+ #: includes/class-mla-core-options.php:1281
1395
  msgctxt "post_mime_types_description"
1396
  msgid "All image subtypes"
1397
  msgstr ""
1398
 
1399
+ #: includes/class-mla-core-options.php:1284
1400
  msgctxt "table_view_singular"
1401
  msgid "Audio"
1402
  msgstr ""
1403
 
1404
+ #: includes/class-mla-core-options.php:1285
1405
  msgctxt "table_view_plural"
1406
  msgid "Audio"
1407
  msgstr ""
1408
 
1409
+ #: includes/class-mla-core-options.php:1290
1410
  msgctxt "post_mime_types_description"
1411
  msgid "All audio subtypes"
1412
  msgstr ""
1413
 
1414
+ #: includes/class-mla-core-options.php:1293
1415
  msgctxt "table_view_singular"
1416
  msgid "Video"
1417
  msgstr ""
1418
 
1419
+ #: includes/class-mla-core-options.php:1294
1420
  msgctxt "table_view_plural"
1421
  msgid "Video"
1422
  msgstr ""
1423
 
1424
+ #: includes/class-mla-core-options.php:1299
1425
  msgctxt "post_mime_types_description"
1426
  msgid "All video subtypes"
1427
  msgstr ""
1428
 
1429
+ #: includes/class-mla-core-options.php:1302
1430
  msgctxt "table_view_singular"
1431
  msgid "Text"
1432
  msgstr ""
1433
 
1434
+ #: includes/class-mla-core-options.php:1303
1435
  msgctxt "table_view_plural"
1436
  msgid "Text"
1437
  msgstr ""
1438
 
1439
+ #: includes/class-mla-core-options.php:1308
1440
  msgctxt "post_mime_types_description"
1441
  msgid "All text subtypes"
1442
  msgstr ""
1443
 
1444
+ #: includes/class-mla-core-options.php:1311
1445
  msgctxt "table_view_singular"
1446
  msgid "Application"
1447
  msgstr ""
1448
 
1449
+ #: includes/class-mla-core-options.php:1312
1450
  msgctxt "table_view_plural"
1451
  msgid "Applications"
1452
  msgstr ""
1453
 
1454
+ #: includes/class-mla-core-options.php:1317
1455
  msgctxt "post_mime_types_description"
1456
  msgid "All application subtypes"
1457
  msgstr ""
1458
 
1459
+ #: includes/class-mla-core-options.php:1321
1460
  msgctxt "table_view_plural"
1461
  msgid "Unattached"
1462
  msgstr ""
1463
 
1464
+ #: includes/class-mla-core-options.php:1329
1465
  msgctxt "table_view_singular"
1466
  msgid "Attached"
1467
  msgstr ""
1468
 
1469
+ #: includes/class-mla-core-options.php:1330
1470
  msgctxt "table_view_plural"
1471
  msgid "Attached"
1472
  msgstr ""
1473
 
1474
+ #: includes/class-mla-core-options.php:1338
1475
  msgctxt "table_view_singular"
1476
  msgid "Mine"
1477
  msgstr ""
1478
 
1479
+ #: includes/class-mla-core-options.php:1339
1480
  msgctxt "table_view_plural"
1481
  msgid "Mine"
1482
  msgstr ""
1483
 
1484
+ #: includes/class-mla-core-options.php:1347
1485
  msgctxt "table_view_singular"
1486
  msgid "Trash"
1487
  msgstr ""
1488
 
1489
+ #: includes/class-mla-core-options.php:1348
1490
  msgctxt "table_view_plural"
1491
  msgid "Trash"
1492
  msgstr ""
1493
 
1494
+ #: includes/class-mla-core-options.php:1359
1495
  msgid "Enable Upload MIME Type Support"
1496
  msgstr ""
1497
 
1498
+ #: includes/class-mla-core-options.php:1362
1499
  msgid ""
1500
  "Check/uncheck this option to enable/disable Upload MIME Type Support, then "
1501
  "click <strong>Save Changes</strong> to record the new setting."
1502
  msgstr ""
1503
 
1504
+ #: includes/class-mla-core-options.php:1371
1505
  msgid "Upload MIME Types help."
1506
  msgstr ""
1507
 
1508
+ #: includes/class-mla-core-options.php:1376
1509
  msgid "Enable MLA File Type Icons Support"
1510
  msgstr ""
1511
 
1512
+ #: includes/class-mla-core-options.php:1379
1513
  msgid ""
1514
  "Check/uncheck this option to enable/disable MLA File Type Icons Support, "
1515
  "then click <strong>Save Changes</strong> to record the new setting."
1516
  msgstr ""
1517
 
1518
+ #: includes/class-mla-core-options.php:1383
1519
  msgid "Always Use MLA MIME Type"
1520
  msgstr ""
1521
 
1522
+ #: includes/class-mla-core-options.php:1386
1523
  msgid ""
1524
  "Check this option to override WordPress MIME Type security checks, then "
1525
  "click <strong>Save Changes</strong> to record the new setting."
1526
  msgstr ""
1527
 
1528
+ #: includes/class-mla-core-options.php:1390
1529
  msgid "Display Limit"
1530
  msgstr ""
1531
 
1532
+ #: includes/class-mla-core-options.php:1394
1533
  msgid ""
1534
  "Enter the maximum number of debug log characters to display; enter zero or "
1535
  "leave blank for no limit."
1536
  msgstr ""
1537
 
1538
+ #: includes/class-mla-core-options.php:1398
1539
  msgid "Debug File"
1540
  msgstr ""
1541
 
1542
+ #: includes/class-mla-core-options.php:1402
1543
  msgid ""
1544
  "Enter the name of an alternate, MLA-specific debug log file; leave blank to "
1545
  "use the PHP error_log.<br>&nbsp;&nbsp;The WP_CONTENT_DIR value (below) will "
1547
  "\"."
1548
  msgstr ""
1549
 
1550
+ #: includes/class-mla-core-options.php:1406
1551
  msgid "Replace PHP error_log file"
1552
  msgstr ""
1553
 
1554
+ #: includes/class-mla-core-options.php:1409
1555
  msgid ""
1556
  "Check this option to replace the PHP error_log file with the MLA Debug File."
1557
  "<br>&nbsp;&nbsp;allows capture of PHP messages in the MLA Debug File."
1558
  msgstr ""
1559
 
1560
+ #: includes/class-mla-core-options.php:1413
1561
  msgid "PHP Reporting"
1562
  msgstr ""
1563
 
1564
+ #: includes/class-mla-core-options.php:1417
1565
  msgid ""
1566
  "Enter a numeric error_reporting value, e.g., 0x7FFF or 32767; leave blank to "
1567
  "use the existing PHP error_reporting value."
1568
  msgstr ""
1569
 
1570
+ #: includes/class-mla-core-options.php:1421
1571
  msgid "MLA Reporting"
1572
  msgstr ""
1573
 
1574
+ #: includes/class-mla-core-options.php:1425
1575
  msgid ""
1576
  "Enter a numeric MLA_DEBUG_LEVEL value, e.g., 0x0003 or 3; leave blank to use "
1577
  "the existing MLA_DEBUG_LEVEL value."
1578
  msgstr ""
1579
 
1580
+ #: includes/class-mla-core-options.php:1429
1581
+ msgid "Add Tax. Columns"
1582
+ msgstr ""
1583
+
1584
+ #: includes/class-mla-core-options.php:1432
1585
+ msgid ""
1586
+ "Check this option to add Term ID and Term-Taxonomy ID columns to the "
1587
+ "taxonomy edit admin submenu tables."
1588
+ msgstr ""
1589
+
1590
  #: includes/class-mla-core.php:893
1591
  #, php-format
1592
  msgctxt "error_log"
1624
  msgstr ""
1625
 
1626
  #: includes/class-mla-core.php:1513 includes/class-mla-edit-media.php:362
1627
+ #: includes/class-mla-edit-media.php:418 includes/class-mla-main.php:2073
1628
+ #: includes/class-mla-main.php:2269 includes/class-mla-main.php:2335
1629
  #: includes/class-mla-media-modal.php:648
1630
+ #: includes/mla-media-modal-js-template.php:26
1631
+ #: includes/mla-media-modal-js-template.php:73
1632
  msgid "Search"
1633
  msgstr ""
1634
 
1808
  msgid " %1$s: %2$s non-array \"%3$s\""
1809
  msgstr ""
1810
 
1811
+ #: includes/class-mla-data-query.php:1388
1812
  #, php-format
1813
  msgctxt "error_log"
1814
  msgid " %1$s: _execute_list_table_query $wp_filter = \"%2$s\"."
1815
  msgstr ""
1816
 
1817
+ #: includes/class-mla-data-query.php:1404
1818
  #, php-format
1819
  msgctxt "error_log"
1820
  msgid " %1$s: _execute_list_table_query WP_Query = \"%2$s\"."
1821
  msgstr ""
1822
 
1823
+ #: includes/class-mla-data-query.php:1406
1824
  #, php-format
1825
  msgctxt "error_log"
1826
  msgid " %1$s: _execute_list_table_query SQL_request = \"%2$s\"."
1827
  msgstr ""
1828
 
1829
+ #: includes/class-mla-data-query.php:1920
1830
  #, php-format
1831
  msgctxt "error_log"
1832
  msgid " %1$s: mla_query_posts_search_filter = \"%2$s\"."
1833
  msgstr ""
1834
 
1835
+ #: includes/class-mla-data-query.php:2011
1836
  #, php-format
1837
  msgctxt "error_log"
1838
  msgid " %1$s: mla_query_posts_where_filter = \"%2$s\"."
1839
  msgstr ""
1840
 
1841
+ #: includes/class-mla-data-query.php:2083
1842
  #, php-format
1843
  msgctxt "error_log"
1844
  msgid " %1$s: mla_query_posts_join_filter = \"%2$s\"."
1845
  msgstr ""
1846
 
1847
+ #: includes/class-mla-data-query.php:2178
1848
  #, php-format
1849
  msgctxt "error_log"
1850
  msgid " %1$s: mla_query_posts_orderby_filter = \"%2$s\"."
1851
  msgstr ""
1852
 
1853
+ #: includes/class-mla-data-query.php:2264
1854
  #, php-format
1855
  msgctxt "error_log"
1856
  msgid " %1$s: mla_query_posts_clauses_filter = \"%2$s\"."
1857
  msgstr ""
1858
 
1859
+ #: includes/class-mla-data-query.php:2283
1860
  #, php-format
1861
  msgctxt "error_log"
1862
  msgid " %1$s: mla_query_posts_clauses_request_filter = \"%2$s\"."
1904
  "%1$s: mla_parse_array_template no template end delimiter, tail = \"%2$s\"."
1905
  msgstr ""
1906
 
1907
+ #: includes/class-mla-data.php:196
1908
  #, php-format
1909
  msgctxt "error_log"
1910
  msgid "%1$s: mla_parse_template no end delimiter, tail = \"%2$s\"."
1911
  msgstr ""
1912
 
1913
+ #: includes/class-mla-data.php:257
1914
  #, php-format
1915
  msgctxt "error_log"
1916
  msgid "%1$s: _find_parameter no end delimiter, tail = \"%2$s\"."
1917
  msgstr ""
1918
 
1919
+ #: includes/class-mla-data.php:325
1920
  #, php-format
1921
  msgctxt "error_log"
1922
  msgid "%1$s: _find_delimited_substring no end delimiter, tail = \"%2$s\"."
1923
  msgstr ""
1924
 
1925
+ #: includes/class-mla-data.php:414
1926
  msgid "Test; no closing parenthesis "
1927
  msgstr ""
1928
 
1929
+ #: includes/class-mla-data.php:566
1930
  #, php-format
1931
  msgctxt "error_log"
1932
  msgid "%1$s: _evaluate_template_array_node unknown type \"%2$s\"."
1933
  msgstr ""
1934
 
1935
+ #: includes/class-mla-data.php:629
1936
  #, php-format
1937
  msgctxt "error_log"
1938
  msgid "%1$s: _evaluate_template_node unknown type \"%2$s\"."
1939
  msgstr ""
1940
 
1941
+ #: includes/class-mla-data.php:1598
1942
  #, php-format
1943
  msgctxt "error_log"
1944
  msgid ""
1946
  "\"."
1947
  msgstr ""
1948
 
1949
+ #: includes/class-mla-data.php:1797
1950
  #, php-format
1951
  msgctxt "error_log"
1952
  msgid "%1$s: mla_get_attachment_by_id(%2$d) not found."
1953
  msgstr ""
1954
 
1955
+ #: includes/class-mla-data.php:1803
1956
  #, php-format
1957
  msgctxt "error_log"
1958
  msgid "%1$s: mla_get_attachment_by_id(%2$d) wrong post_type \"%3$s\"."
1959
  msgstr ""
1960
 
1961
+ #: includes/class-mla-data.php:2153
1962
  msgctxt "error_log"
1963
  msgid "mla_parse_xml_string xml_parse_into_struct failed."
1964
  msgstr ""
1965
 
1966
+ #: includes/class-mla-data.php:2157
1967
  msgctxt "error_log"
1968
  msgid "mla_parse_xml_string set option failed."
1969
  msgstr ""
1970
 
1971
+ #: includes/class-mla-data.php:3754
1972
+ msgid "Auto"
1973
+ msgstr ""
1974
+
1975
+ #: includes/class-mla-data.php:3757
1976
+ msgid "Manual"
1977
+ msgstr ""
1978
+
1979
+ #: includes/class-mla-data.php:3760
1980
+ msgid "Bracket"
1981
+ msgstr ""
1982
+
1983
+ #: includes/class-mla-data.php:3763
1984
+ msgid "Other"
1985
+ msgstr ""
1986
+
1987
+ #: includes/class-mla-data.php:3770
1988
  #: includes/class-mla-settings-custom-fields-tab.php:833
1989
  #: includes/class-mla-settings-custom-fields-tab.php:1552
1990
  #: includes/class-mla-settings-iptc-exif-tab.php:941
1993
  #: includes/class-mla-settings-view-tab.php:401
1994
  #: includes/class-mla-settings-view-tab.php:802
1995
  #: includes/class-mla-settings-view-tab.php:818
1996
+ #: includes/class-mla-wpml-support.php:1585
1997
  msgid "Yes"
1998
  msgstr ""
1999
 
2000
+ #: includes/class-mla-data.php:3772
2001
  #: includes/class-mla-settings-custom-fields-tab.php:834
2002
  #: includes/class-mla-settings-custom-fields-tab.php:1554
2003
  #: includes/class-mla-settings-iptc-exif-tab.php:942
2006
  #: includes/class-mla-settings-view-tab.php:400
2007
  #: includes/class-mla-settings-view-tab.php:804
2008
  #: includes/class-mla-settings-view-tab.php:820
2009
+ #: includes/class-mla-wpml-support.php:1586
2010
  msgid "No"
2011
  msgstr ""
2012
 
2013
+ #: includes/class-mla-data.php:4018 includes/class-mla-data.php:4142
2014
  #, php-format
2015
  msgid "Deleting %1$s"
2016
  msgstr ""
2017
 
2018
+ #: includes/class-mla-data.php:4021
2019
  #, php-format
2020
  msgid "%1$s: meta:%2$s not found"
2021
  msgstr ""
2022
 
2023
+ #: includes/class-mla-data.php:4030 includes/class-mla-data.php:4153
2024
+ #: includes/class-mla-data.php:4165
2025
  #, php-format
2026
  msgid "Adding %1$s = %2$s"
2027
  msgstr ""
2028
 
2029
+ #: includes/class-mla-data.php:4034
2030
  #, php-format
2031
  msgid "%1$s: Adding meta:%2$s; not found"
2032
  msgstr ""
2033
 
2034
+ #: includes/class-mla-data.php:4041
2035
  #, php-format
2036
  msgid "Deleting Null meta:%1$s"
2037
  msgstr ""
2038
 
2039
+ #: includes/class-mla-data.php:4051 includes/class-mla-data.php:4234
2040
+ #: includes/class-mla-data.php:4321 includes/class-mla-data.php:4345
2041
+ #: includes/class-mla-data.php:4388 includes/class-mla-data.php:4401
2042
+ #: includes/class-mla-data.php:4410 includes/class-mla-data.php:4421
2043
+ #: includes/class-mla-data.php:4432 includes/class-mla-data.php:4445
2044
+ #: includes/class-mla-data.php:4454 includes/class-mla-data.php:4463
2045
+ #: includes/class-mla-data.php:4472 includes/class-mla-data.php:4481
2046
  #: includes/class-mla-mime-types.php:1300
2047
  #: includes/class-mla-mime-types.php:2412
2048
  #, php-format
2049
  msgid "Changing %1$s from \"%2$s\" to \"%3$s\""
2050
  msgstr ""
2051
 
2052
+ #: includes/class-mla-data.php:4056
2053
  #, php-format
2054
  msgid "%1$s: Changing meta:%2$s; not found"
2055
  msgstr ""
2056
 
2057
+ #: includes/class-mla-data.php:4189
2058
  #, php-format
2059
  msgid "Deleting old %1$s values"
2060
  msgstr ""
2061
 
2062
+ #: includes/class-mla-data.php:4219
2063
  #, php-format
2064
  msgid "Changing %1$s from \"%2$s\" to \"%3$s\"; %4$d updates"
2065
  msgstr ""
2066
 
2067
+ #: includes/class-mla-data.php:4296
2068
  msgid "Could not retrieve Attachment."
2069
  msgstr ""
2070
 
2071
+ #: includes/class-mla-data.php:4342
2072
  #, php-format
2073
  msgid "%1$s: Could not change Name/Slug \"%2$s\"; name already exists"
2074
  msgstr ""
2075
 
2076
+ #: includes/class-mla-data.php:4372
2077
  #, php-format
2078
  msgid "Deleting ALT Text, was \"%1$s\""
2079
  msgstr ""
2080
 
2081
+ #: includes/class-mla-data.php:4375
2082
  #, php-format
2083
  msgid "%1$s: Could not delete ALT Text, remains \"%2$s\""
2084
  msgstr ""
2085
 
2086
+ #: includes/class-mla-data.php:4391
2087
  #, php-format
2088
  msgid "%1$s: Could not change ALT Text from \"%2$s\" to \"%3$s\""
2089
  msgstr ""
2090
 
2091
+ #: includes/class-mla-data.php:4421 includes/class-mla-list-table.php:1131
2092
+ #: includes/class-mla-list-table.php:1134
2093
  #: includes/class-mla-list-table.php:1137
2094
+ #: includes/class-mla-list-table.php:1205 includes/class-mla-options.php:2143
 
2095
  #: includes/class-mla-settings-iptc-exif-tab.php:518
2096
  #: includes/class-mla-settings-iptc-exif-tab.php:911
2097
  msgid "Parent"
2098
  msgstr ""
2099
 
2100
+ #: includes/class-mla-data.php:4432 includes/class-mla-edit-media.php:889
2101
+ #: includes/class-mla-edit-media.php:1094 includes/class-mla-main.php:2413
2102
  #: includes/class-mla-settings-view-tab.php:126
2103
  #: includes/class-mla-settings-view-tab.php:389
2104
  msgid "Menu Order"
2105
  msgstr ""
2106
 
2107
+ #: includes/class-mla-data.php:4445 includes/class-mla-edit-media.php:449
2108
+ #: includes/class-mla-list-table.php:1585
2109
+ #: includes/class-mla-list-table.php:1588 includes/class-mla-main.php:2212
2110
+ #: includes/class-mla-main.php:2372
2111
  msgid "Author"
2112
  msgstr ""
2113
 
2114
+ #: includes/class-mla-data.php:4454 includes/class-mla-edit-media.php:474
2115
+ #: includes/class-mla-main.php:2425
2116
  msgid "Comments"
2117
  msgstr ""
2118
 
2119
+ #: includes/class-mla-data.php:4463 includes/class-mla-edit-media.php:475
2120
+ #: includes/class-mla-main.php:2426
2121
  msgid "Pings"
2122
  msgstr ""
2123
 
2124
+ #: includes/class-mla-data.php:4511
2125
  #, php-format
2126
  msgid "You cannot assign \"%1$s\" terms"
2127
  msgstr ""
2128
 
2129
+ #: includes/class-mla-data.php:4524
2130
  msgctxt "tag delimiter"
2131
  msgid ","
2132
  msgstr ""
2133
 
2134
+ #: includes/class-mla-data.php:4563
2135
  msgid "Adding"
2136
  msgstr ""
2137
 
2138
+ #: includes/class-mla-data.php:4568
2139
  msgid "Removing"
2140
  msgstr ""
2141
 
2142
+ #: includes/class-mla-data.php:4577
2143
  msgid "Replacing"
2144
  msgstr ""
2145
 
2146
+ #: includes/class-mla-data.php:4585
2147
  msgid "Ignoring"
2148
  msgstr ""
2149
 
2150
+ #: includes/class-mla-data.php:4602
2151
  #, php-format
2152
  msgid "%1$s \"%2$s\" terms"
2153
  msgstr ""
2154
 
2155
+ #: includes/class-mla-data.php:4614 includes/class-mla-main.php:1403
2156
  #, php-format
2157
  msgid "Item %1$d, no changes detected."
2158
  msgstr ""
2159
 
2160
+ #: includes/class-mla-data.php:4647
2161
  #, php-format
2162
  msgid "Item %1$d updated."
2163
  msgstr ""
2164
 
2165
+ #: includes/class-mla-data.php:4665
2166
  #, php-format
2167
  msgid "%1$s: Item %2$d update failed."
2168
  msgstr ""
2205
  msgid "An ajax.done error has occurred. Please reload the page and try again."
2206
  msgstr ""
2207
 
2208
+ #: includes/class-mla-edit-media.php:242 includes/class-mla-main.php:2153
2209
  #, php-format
2210
  msgid "Uploaded on: %s"
2211
  msgstr ""
2212
 
2213
+ #: includes/class-mla-edit-media.php:243 includes/class-mla-edit-media.php:761
2214
  msgid "Last modified"
2215
  msgstr ""
2216
 
2217
+ #: includes/class-mla-edit-media.php:321 includes/class-mla-main.php:2067
2218
+ #: includes/class-mla-main.php:2206 includes/class-mla-media-modal.php:618
2219
  #: includes/class-mla-mime-types.php:825 includes/class-mla-mime-types.php:1466
2220
  #: includes/class-mla-mime-types.php:2645
2221
  #: includes/class-mla-settings-custom-fields-tab.php:570
2236
  msgstr ""
2237
 
2238
  #: includes/class-mla-edit-media.php:341 includes/class-mla-edit-media.php:397
2239
+ #: includes/class-mla-main.php:2248 includes/class-mla-main.php:2314
2240
  msgid "+&nbsp;Add&nbsp;New&nbsp;Term"
2241
  msgstr ""
2242
 
2243
  #: includes/class-mla-edit-media.php:342 includes/class-mla-edit-media.php:398
2244
+ #: includes/class-mla-main.php:2249 includes/class-mla-main.php:2315
2245
  msgid "Add New"
2246
  msgstr ""
2247
 
2248
  #: includes/class-mla-edit-media.php:360 includes/class-mla-edit-media.php:416
2249
+ #: includes/class-mla-main.php:2267 includes/class-mla-main.php:2333
2250
  msgid "?&nbsp;Search"
2251
  msgstr ""
2252
 
2253
  #: includes/class-mla-edit-media.php:363 includes/class-mla-edit-media.php:419
2254
+ #: includes/class-mla-edit-media.php:428 includes/class-mla-main.php:2270
2255
+ #: includes/class-mla-main.php:2336 includes/class-mla-main.php:2345
2256
  msgid "Add"
2257
  msgstr ""
2258
 
2259
  #: includes/class-mla-edit-media.php:364 includes/class-mla-edit-media.php:420
2260
+ #: includes/class-mla-edit-media.php:429 includes/class-mla-main.php:2271
2261
+ #: includes/class-mla-main.php:2337 includes/class-mla-main.php:2346
2262
  msgid "Remove"
2263
  msgstr ""
2264
 
2265
  #: includes/class-mla-edit-media.php:365 includes/class-mla-edit-media.php:421
2266
+ #: includes/class-mla-edit-media.php:430 includes/class-mla-main.php:2272
2267
+ #: includes/class-mla-main.php:2338 includes/class-mla-main.php:2347
2268
  #: includes/class-mla-settings-custom-fields-tab.php:494
2269
  #: includes/class-mla-settings-custom-fields-tab.php:804
2270
  #: includes/class-mla-settings-custom-fields-tab.php:1538
2281
  "menu for more information."
2282
  msgstr ""
2283
 
2284
+ #: includes/class-mla-edit-media.php:470 includes/class-mla-main.php:2419
2285
+ #: includes/class-mla-settings.php:1391
2286
  msgid "Reset"
2287
  msgstr ""
2288
 
2289
+ #: includes/class-mla-edit-media.php:476 includes/class-mla-main.php:2427
2290
+ #: includes/class-mla-main.php:2483
2291
  #: includes/class-mla-settings-custom-fields-tab.php:832
2292
  #: includes/class-mla-settings-iptc-exif-tab.php:940
2293
  #: includes/class-mla-settings-upload-tab.php:120
2296
  msgid "No Change"
2297
  msgstr ""
2298
 
2299
+ #: includes/class-mla-edit-media.php:477 includes/class-mla-main.php:2428
2300
  msgid "Allow"
2301
  msgstr ""
2302
 
2303
+ #: includes/class-mla-edit-media.php:478 includes/class-mla-main.php:2429
2304
  msgid "Do not allow"
2305
  msgstr ""
2306
 
2307
+ #: includes/class-mla-edit-media.php:486 includes/class-mla-list-table.php:1131
2308
+ #: includes/class-mla-list-table.php:1202 includes/class-mla-main.php:2411
2309
  msgid "Parent ID"
2310
  msgstr ""
2311
 
2312
+ #: includes/class-mla-edit-media.php:487 includes/class-mla-edit-media.php:1074
2313
+ #: includes/class-mla-main.php:2412
2314
  #: includes/class-mla-settings-upload-tab.php:1469
2315
  msgid "Select"
2316
  msgstr ""
2317
 
2318
+ #: includes/class-mla-edit-media.php:650
2319
  msgid "Custom field mapping updated."
2320
  msgstr ""
2321
 
2322
+ #: includes/class-mla-edit-media.php:651
2323
  msgid "IPTC/EXIF mapping updated."
2324
  msgstr ""
2325
 
2326
+ #: includes/class-mla-edit-media.php:652
2327
  msgid "Custom field mapping is disabled."
2328
  msgstr ""
2329
 
2330
+ #: includes/class-mla-edit-media.php:653
2331
  msgid "IPTC/EXIF mapping is disabled."
2332
  msgstr ""
2333
 
2334
+ #: includes/class-mla-edit-media.php:688 includes/class-mla-main.php:2137
2335
  msgid "Month"
2336
  msgstr ""
2337
 
2338
+ #: includes/class-mla-edit-media.php:694 includes/class-mla-main.php:2143
2339
  #, php-format
2340
  msgid "%1$s-%2$s"
2341
  msgstr ""
2342
 
2343
+ #: includes/class-mla-edit-media.php:698 includes/class-mla-main.php:2147
2344
  msgid "Day"
2345
  msgstr ""
2346
 
2347
+ #: includes/class-mla-edit-media.php:699 includes/class-mla-main.php:2148
2348
  msgid "Year"
2349
  msgstr ""
2350
 
2351
+ #: includes/class-mla-edit-media.php:700 includes/class-mla-main.php:2149
2352
  msgid "Hour"
2353
  msgstr ""
2354
 
2355
+ #: includes/class-mla-edit-media.php:701 includes/class-mla-main.php:2150
2356
  msgid "Minute"
2357
  msgstr ""
2358
 
2359
+ #: includes/class-mla-edit-media.php:705 includes/class-mla-main.php:2155
2360
  #, php-format
2361
  msgid "%1$s %2$s, %3$s @ %4$s:%5$s"
2362
  msgstr ""
2363
 
2364
+ #: includes/class-mla-edit-media.php:728
2365
  msgid "OK"
2366
  msgstr ""
2367
 
2368
+ #: includes/class-mla-edit-media.php:729 includes/class-mla-main.php:2090
2369
+ #: includes/class-mla-main.php:2418
2370
  #: includes/class-mla-polylang-support.php:2083
2371
  #: includes/class-mla-settings-custom-fields-tab.php:522
2372
  #: includes/class-mla-settings-custom-fields-tab.php:753
2386
  msgid "Cancel"
2387
  msgstr ""
2388
 
2389
+ #: includes/class-mla-edit-media.php:745
2390
  msgid "M j, Y @ H:i"
2391
  msgstr ""
2392
 
2393
+ #: includes/class-mla-edit-media.php:751 includes/class-mla-list-table.php:696
2394
+ #: includes/class-mla-list-table.php:820 includes/class-mla-list-table.php:1086
2395
+ #: includes/class-mla-list-table.php:1257
2396
+ #: includes/class-mla-list-table.php:1306
2397
+ #: includes/class-mla-list-table.php:1352
2398
+ #: includes/class-mla-list-table.php:1397
2399
+ #: includes/class-mla-list-table.php:1619
2400
+ #: includes/class-mla-list-table.php:1972
2401
  #: includes/class-mla-polylang-support.php:378
2402
  #: includes/class-mla-settings-custom-fields-tab.php:1381
2403
  #: includes/class-mla-settings-custom-fields-tab.php:1716
2411
  msgid "Edit"
2412
  msgstr ""
2413
 
2414
+ #: includes/class-mla-edit-media.php:752
2415
  msgid "Edit upload date and time"
2416
  msgstr ""
2417
 
2418
+ #: includes/class-mla-edit-media.php:754
2419
  msgid "Upload Date and time"
2420
  msgstr ""
2421
 
2422
+ #: includes/class-mla-edit-media.php:785
2423
  msgid "Map Custom Field metadata for this item"
2424
  msgstr ""
2425
 
2426
+ #: includes/class-mla-edit-media.php:785 includes/class-mla-main.php:1852
2427
+ #: includes/class-mla-main.php:2434
2428
  msgid "Map Custom Field metadata"
2429
  msgstr ""
2430
 
2431
+ #: includes/class-mla-edit-media.php:789
2432
  msgid "Map IPTC/EXIF metadata for this item"
2433
  msgstr ""
2434
 
2435
+ #: includes/class-mla-edit-media.php:789 includes/class-mla-main.php:1855
2436
+ #: includes/class-mla-main.php:2432
2437
  msgid "Map IPTC/EXIF metadata"
2438
  msgstr ""
2439
 
2440
+ #: includes/class-mla-edit-media.php:885 includes/class-mla-edit-media.php:1075
2441
  msgid "Parent Info"
2442
  msgstr ""
2443
 
2444
+ #: includes/class-mla-edit-media.php:895 includes/class-mla-edit-media.php:1118
2445
  msgid "Attachment Metadata"
2446
  msgstr ""
2447
 
2448
+ #: includes/class-mla-edit-media.php:965 includes/class-mla-edit-media.php:1007
2449
  #: includes/class-mla-main.php:709 includes/class-mla-settings.php:586
2450
  #, php-format
2451
  msgctxt "error_log"
2452
  msgid "%1$s: %2$s discarding \"%3$s\"; no title/order"
2453
  msgstr ""
2454
 
2455
+ #: includes/class-mla-edit-media.php:1073
2456
  msgid "Post Parent"
2457
  msgstr ""
2458
 
2459
+ #: includes/class-mla-edit-media.php:1074 includes/class-mla-main.php:2072
2460
  msgid "Select Parent"
2461
  msgstr ""
2462
 
2478
  msgstr ""
2479
 
2480
  #: includes/class-mla-list-table.php:567 includes/class-mla-list-table.php:628
2481
+ #: includes/class-mla-list-table.php:1131
2482
+ #: includes/class-mla-list-table.php:1202
2483
+ #: includes/class-mla-list-table.php:1425
2484
+ #: includes/class-mla-list-table.php:1469
2485
+ #: includes/class-mla-list-table.php:1501
2486
+ #: includes/class-mla-list-table.php:1585
2487
  msgid "Filter by"
2488
  msgstr ""
2489
 
2508
  msgid "Restore this item from the Trash"
2509
  msgstr ""
2510
 
2511
+ #: includes/class-mla-list-table.php:809 includes/class-mla-list-table.php:1969
2512
  msgid "Restore"
2513
  msgstr ""
2514
 
2515
+ #: includes/class-mla-list-table.php:820
2516
  #: includes/class-mla-settings-custom-fields-tab.php:1381
2517
  #: includes/class-mla-settings-iptc-exif-tab.php:1486
2518
  #: includes/class-mla-settings-shortcodes-tab.php:1096
2521
  msgid "Edit this item"
2522
  msgstr ""
2523
 
2524
+ #: includes/class-mla-list-table.php:821
2525
  #: includes/class-mla-settings-custom-fields-tab.php:1384
2526
  #: includes/class-mla-settings-iptc-exif-tab.php:1489
2527
  #: includes/class-mla-settings-upload-tab.php:930
2529
  msgid "Edit this item inline"
2530
  msgstr ""
2531
 
2532
+ #: includes/class-mla-list-table.php:821 includes/class-mla-main.php:2402
2533
  #: includes/class-mla-options.php:1244
2534
  #: includes/class-mla-settings-custom-fields-tab.php:485
2535
  #: includes/class-mla-settings-custom-fields-tab.php:795
2542
  msgid "Quick Edit"
2543
  msgstr ""
2544
 
2545
+ #: includes/class-mla-list-table.php:827
2546
  msgid "Move this item to the Trash"
2547
  msgstr ""
2548
 
2549
+ #: includes/class-mla-list-table.php:827 includes/class-mla-list-table.php:1975
2550
  msgid "Move to Trash"
2551
  msgstr ""
2552
 
2553
+ #: includes/class-mla-list-table.php:832
2554
  #: includes/class-mla-settings-custom-fields-tab.php:1392
2555
  #: includes/class-mla-settings-iptc-exif-tab.php:1499
2556
  #: includes/class-mla-settings-shortcodes-tab.php:1102
2559
  msgid "Delete this item Permanently"
2560
  msgstr ""
2561
 
2562
+ #: includes/class-mla-list-table.php:832 includes/class-mla-list-table.php:1970
2563
+ #: includes/class-mla-list-table.php:1977
2564
  #: includes/class-mla-settings-custom-fields-tab.php:1392
2565
  #: includes/class-mla-settings-custom-fields-tab.php:1717
2566
  #: includes/class-mla-settings-iptc-exif-tab.php:1499
2572
  msgid "Delete Permanently"
2573
  msgstr ""
2574
 
2575
+ #: includes/class-mla-list-table.php:840 includes/class-mla-list-table.php:1982
2576
  #: includes/class-mla-settings-documentation-tab.php:673
2577
+ #: includes/class-mla-settings.php:1381
2578
  msgid "Download"
2579
  msgstr ""
2580
 
2581
+ #: includes/class-mla-list-table.php:842
2582
  #: includes/class-mla-settings-documentation-tab.php:676
2583
  #: includes/class-mla-settings-shortcodes-tab.php:1094
2584
  #: includes/class-mla-settings-view-tab.php:377
2585
  msgid "View"
2586
  msgstr ""
2587
 
2588
+ #: includes/class-mla-list-table.php:1102
2589
  msgid "File name"
2590
  msgstr ""
2591
 
2592
+ #: includes/class-mla-list-table.php:1199
2593
  msgid "(no title: bad ID)"
2594
  msgstr ""
2595
 
2596
+ #: includes/class-mla-list-table.php:1472
2597
  #: includes/class-mla-settings-upload-tab.php:192
2598
  #: includes/class-mla-settings-upload-tab.php:537
2599
  msgid "MIME Type"
2600
  msgstr ""
2601
 
2602
+ #: includes/class-mla-list-table.php:1505
2603
  msgid "Base File"
2604
  msgstr ""
2605
 
2606
+ #: includes/class-mla-list-table.php:1521
2607
+ #: includes/class-mla-list-table.php:1554
2608
  msgid "Unpublished"
2609
  msgstr ""
2610
 
2611
+ #: includes/class-mla-list-table.php:1530
2612
+ #: includes/class-mla-list-table.php:1561
2613
  #, php-format
2614
  msgid "%1$s from now"
2615
  msgstr ""
2616
 
2617
+ #: includes/class-mla-list-table.php:1533
2618
+ #: includes/class-mla-list-table.php:1563
2619
  #, php-format
2620
  msgid "%1$s ago"
2621
  msgstr ""
2622
 
2623
+ #: includes/class-mla-list-table.php:1647
2624
  msgid "Set Parent"
2625
  msgstr ""
2626
 
2627
+ #: includes/class-mla-list-table.php:1822
2628
  msgctxt "uploaded files"
2629
  msgid "All"
2630
  msgid_plural "All"
2631
  msgstr[0] ""
2632
  msgstr[1] ""
2633
 
2634
+ #: includes/class-mla-list-table.php:2071
2635
  #: includes/class-mla-settings-custom-fields-tab.php:1780
2636
  #: includes/class-mla-settings-iptc-exif-tab.php:1914
2637
  #: includes/class-mla-settings-shortcodes-tab.php:1361
2638
  msgid "Filter"
2639
  msgstr ""
2640
 
2641
+ #: includes/class-mla-list-table.php:2074
2642
+ #: includes/mla-media-modal-js-template.php:70
2643
  msgid "Terms Search"
2644
  msgstr ""
2645
 
2646
+ #: includes/class-mla-list-table.php:2079
2647
  #: includes/class-mla-polylang-support.php:2090
2648
  #: includes/class-mla-thumbnail-generation.php:657
2649
  msgid "Clear Filter-by"
2650
  msgstr ""
2651
 
2652
+ #: includes/class-mla-list-table.php:2082
2653
  msgid "Empty Trash"
2654
  msgstr ""
2655
 
2671
  msgid "Bulk Edit items"
2672
  msgstr ""
2673
 
2674
+ #: includes/class-mla-main.php:463 includes/class-mla-main.php:2435
2675
  #: includes/class-mla-settings-custom-fields-tab.php:61
2676
  #: includes/class-mla-settings-iptc-exif-tab.php:61
2677
  msgid "Waiting"
2678
  msgstr ""
2679
 
2680
+ #: includes/class-mla-main.php:464 includes/class-mla-main.php:2437
2681
  #: includes/class-mla-settings-custom-fields-tab.php:63
2682
  #: includes/class-mla-settings-iptc-exif-tab.php:63
2683
  msgid "Complete"
2712
  msgstr[0] ""
2713
  msgstr[1] ""
2714
 
2715
+ #: includes/class-mla-main.php:611 includes/class-mla-main.php:2622
2716
  #, php-format
2717
  msgid "Item %1$d moved to Trash."
2718
  msgstr ""
2820
  msgid "search results for"
2821
  msgstr ""
2822
 
2823
+ #: includes/class-mla-main.php:1858 includes/class-mla-main.php:2094
2824
+ #: includes/class-mla-main.php:2420
2825
  #: includes/class-mla-settings-custom-fields-tab.php:524
2826
  #: includes/class-mla-settings-custom-fields-tab.php:836
2827
  #: includes/class-mla-settings-documentation-tab.php:664
2836
  msgid "Update"
2837
  msgstr ""
2838
 
2839
+ #: includes/class-mla-main.php:2029
2840
  msgid "All Post Types"
2841
  msgstr ""
2842
 
2843
+ #: includes/class-mla-main.php:2075
2844
  msgid "For"
2845
  msgstr ""
2846
 
2847
+ #: includes/class-mla-main.php:2085
2848
+ #: includes/class-mla-shortcode-support.php:1208
2849
  msgid "Unattached"
2850
  msgstr ""
2851
 
2852
+ #: includes/class-mla-main.php:2421 includes/class-mla-options.php:1258
2853
  #: includes/class-mla-settings-custom-fields-tab.php:488
2854
  #: includes/class-mla-settings-custom-fields-tab.php:798
2855
  #: includes/class-mla-settings-custom-fields-tab.php:1498
2859
  msgid "Bulk Edit"
2860
  msgstr ""
2861
 
2862
+ #: includes/class-mla-main.php:2436
2863
  msgid "In-process"
2864
  msgstr ""
2865
 
2866
+ #: includes/class-mla-main.php:2535
2867
  msgid "You are not allowed to delete this item."
2868
  msgstr ""
2869
 
2870
+ #: includes/class-mla-main.php:2543
2871
  #, php-format
2872
  msgid "%1$s: Item %2$d could NOT be deleted."
2873
  msgstr ""
2874
 
2875
+ #: includes/class-mla-main.php:2550
2876
  #, php-format
2877
  msgid "Item %1$d permanently deleted."
2878
  msgstr ""
2879
 
2880
+ #: includes/class-mla-main.php:2567
2881
  msgid "You are not allowed to move this item out of the Trash."
2882
  msgstr ""
2883
 
2884
+ #: includes/class-mla-main.php:2575
2885
  #, php-format
2886
  msgid "%1$s: Item %2$d could NOT be restored from Trash."
2887
  msgstr ""
2888
 
2889
+ #: includes/class-mla-main.php:2590
2890
  #, php-format
2891
  msgid "Item %1$d restored from Trash."
2892
  msgstr ""
2893
 
2894
+ #: includes/class-mla-main.php:2607
2895
  msgid "You are not allowed to move this item to the Trash."
2896
  msgstr ""
2897
 
2898
+ #: includes/class-mla-main.php:2615
2899
  #, php-format
2900
  msgid "%1$s: Item %2$d could NOT be moved to Trash."
2901
  msgstr ""
3341
  msgid "Attachments"
3342
  msgstr ""
3343
 
3344
+ #: includes/class-mla-objects.php:158
3345
+ msgid "Term ID"
3346
+ msgstr ""
3347
+
3348
+ #: includes/class-mla-objects.php:159
3349
+ msgid "Term-Tax ID"
3350
+ msgstr ""
3351
+
3352
+ #: includes/class-mla-objects.php:267
3353
  #, php-format
3354
  msgctxt "error_log"
3355
  msgid ""
3356
  "%1$s: mla_taxonomy_column_filter( \"%2$s\" ) - get_term failed: \"%3$s\""
3357
  msgstr ""
3358
 
3359
+ #: includes/class-mla-objects.php:291
3360
  msgid "click to search"
3361
  msgstr ""
3362
 
3363
+ #: includes/class-mla-objects.php:323
3364
  msgid "Shortcode(s), HTML and/or Plain Text"
3365
  msgstr ""
3366
 
3367
+ #: includes/class-mla-objects.php:331
3368
  msgid "MLA Text"
3369
  msgstr ""
3370
 
3371
+ #: includes/class-mla-objects.php:375
3372
  msgid "Automatically add paragraphs"
3373
  msgstr ""
3374
 
3375
+ #: includes/class-mla-objects.php:376
3376
  msgid "Add .textwidget div tags"
3377
  msgstr ""
3378
 
3470
 
3471
  #: includes/class-mla-options.php:462
3472
  #: includes/mla-main-search-box-template.php:60
3473
+ #: includes/mla-media-modal-js-template.php:30
3474
  msgid "and"
3475
  msgstr ""
3476
 
3477
  #: includes/class-mla-options.php:464
3478
  #: includes/mla-main-search-box-template.php:61
3479
+ #: includes/mla-media-modal-js-template.php:34
3480
  msgid "or"
3481
  msgstr ""
3482
 
3488
  #: includes/class-mla-settings-shortcodes-tab.php:422
3489
  #: includes/class-mla-settings-shortcodes-tab.php:493
3490
  #: includes/mla-main-search-box-template.php:49
3491
+ #: includes/mla-media-modal-js-template.php:42
3492
  msgid "Name"
3493
  msgstr ""
3494
 
3495
  #: includes/class-mla-options.php:481
3496
  #: includes/mla-main-search-box-template.php:57
3497
+ #: includes/mla-media-modal-js-template.php:59
3498
  msgid "File"
3499
  msgstr ""
3500
 
3501
  #: includes/class-mla-options.php:484
3502
  #: includes/mla-main-search-box-template.php:58
3503
+ #: includes/mla-media-modal-js-template.php:64
3504
  msgid "Terms"
3505
  msgstr ""
3506
 
3729
  #: includes/class-mla-polylang-support.php:2142
3730
  #: includes/class-mla-polylang-support.php:2455
3731
  #: includes/class-mla-polylang-support.php:2570
3732
+ #: includes/class-mla-wpml-support.php:1607
3733
+ #: includes/class-mla-wpml-support.php:1697
3734
+ #: includes/class-mla-wpml-support.php:2182
3735
  msgid "Language"
3736
  msgstr ""
3737
 
3746
 
3747
  #: includes/class-mla-polylang-support.php:2492
3748
  #: includes/class-mla-polylang-support.php:2597
3749
+ #: includes/class-mla-wpml-support.php:1642
3750
+ #: includes/class-mla-wpml-support.php:1745
3751
  msgid "Media/Assistant submenu table"
3752
  msgstr ""
3753
 
3754
  #: includes/class-mla-polylang-support.php:2497
3755
+ #: includes/class-mla-wpml-support.php:1647
3756
  msgid "Language Column"
3757
  msgstr ""
3758
 
3759
  #: includes/class-mla-polylang-support.php:2500
3760
+ #: includes/class-mla-wpml-support.php:1650
3761
  msgid ""
3762
  "Check this option to add a Language column to the Media/Assistant submenu "
3763
  "table."
3764
  msgstr ""
3765
 
3766
  #: includes/class-mla-polylang-support.php:2504
3767
+ #: includes/class-mla-wpml-support.php:1654
3768
  msgid "Translations Column"
3769
  msgstr ""
3770
 
3771
  #: includes/class-mla-polylang-support.php:2507
3772
+ #: includes/class-mla-wpml-support.php:1657
3773
  msgid ""
3774
  "Check this option to add a Translation Status column to the Media/Assistant "
3775
  "submenu table."
3789
 
3790
  #: includes/class-mla-polylang-support.php:2525
3791
  #: includes/class-mla-polylang-support.php:2597
3792
+ #: includes/class-mla-wpml-support.php:1661
3793
+ #: includes/class-mla-wpml-support.php:1745
3794
  msgid "Term Management"
3795
  msgstr ""
3796
 
3797
  #: includes/class-mla-polylang-support.php:2530
3798
+ #: includes/class-mla-wpml-support.php:1666
3799
  msgid "Term Assignment"
3800
  msgstr ""
3801
 
3802
  #: includes/class-mla-polylang-support.php:2533
3803
+ #: includes/class-mla-wpml-support.php:1669
3804
  msgid ""
3805
  "Check this option to assign language-specific terms when items are updated."
3806
  msgstr ""
3807
 
3808
  #: includes/class-mla-polylang-support.php:2537
3809
+ #: includes/class-mla-wpml-support.php:1673
3810
  msgid "Term Synchronization"
3811
  msgstr ""
3812
 
3813
  #: includes/class-mla-polylang-support.php:2540
3814
+ #: includes/class-mla-wpml-support.php:1676
3815
  msgid ""
3816
  "Check this option to synchronize common terms among all item translations."
3817
  msgstr ""
3818
 
3819
  #: includes/class-mla-polylang-support.php:2544
3820
+ #: includes/class-mla-wpml-support.php:1680
3821
  msgid "Term Mapping Replication"
3822
  msgstr ""
3823
 
3824
  #: includes/class-mla-polylang-support.php:2547
3825
+ #: includes/class-mla-wpml-support.php:1683
3826
  msgid ""
3827
  "When mapping IPTC/EXIF metadata to taxonomy terms, make them available in "
3828
  "all languages."
3829
  msgstr ""
3830
 
3831
  #: includes/class-mla-polylang-support.php:2595
3832
+ #: includes/class-mla-wpml-support.php:1743
3833
  msgid "Language Options"
3834
  msgstr ""
3835
 
3843
  msgstr ""
3844
 
3845
  #: includes/class-mla-polylang-support.php:2599
3846
+ #: includes/class-mla-wpml-support.php:1747
3847
  #, php-format
3848
  msgid ""
3849
  "You can find more information about multilingual features in the %1$s "
3851
  msgstr ""
3852
 
3853
  #: includes/class-mla-polylang-support.php:2599
3854
+ #: includes/class-mla-wpml-support.php:1747
3855
  msgid "Language Options documentation"
3856
  msgstr ""
3857
 
3858
  #: includes/class-mla-polylang-support.php:2599
3859
+ #: includes/class-mla-wpml-support.php:1747
3860
  msgid "WPML &amp; Polylang Multilingual Support; the MLA Language Tab"
3861
  msgstr ""
3862
 
3870
  #: includes/class-mla-settings-upload-tab.php:531
3871
  #: includes/class-mla-settings-view-tab.php:329
3872
  #: includes/class-mla-settings-view-tab.php:375
3873
+ #: includes/class-mla-settings.php:1061 includes/class-mla-settings.php:1426
3874
+ #: includes/class-mla-settings.php:1428
3875
+ #: includes/class-mla-wpml-support.php:1750
3876
  msgid "Save Changes"
3877
  msgstr ""
3878
 
3879
  #: includes/class-mla-polylang-support.php:2603
3880
+ #: includes/class-mla-wpml-support.php:1751
3881
  msgid "Delete Language options and restore default settings"
3882
  msgstr ""
3883
 
3884
  #: includes/class-mla-polylang-support.php:2606
3885
  #: includes/class-mla-settings.php:799 includes/class-mla-settings.php:1066
3886
+ #: includes/class-mla-wpml-support.php:1754
3887
  msgid "Go to Top"
3888
  msgstr ""
3889
 
3890
  #: includes/class-mla-polylang-support.php:2643
3891
+ #: includes/class-mla-wpml-support.php:1791
3892
  msgid "Language settings saved."
3893
  msgstr ""
3894
 
3895
  #: includes/class-mla-polylang-support.php:2674
3896
+ #: includes/class-mla-settings.php:1642
3897
+ #: includes/class-mla-wpml-support.php:1822
3898
  #, php-format
3899
  msgctxt "message_list"
3900
  msgid "delete_option \"%1$s\""
3901
  msgstr ""
3902
 
3903
  #: includes/class-mla-polylang-support.php:2682
3904
+ #: includes/class-mla-wpml-support.php:1830
3905
  msgid "Language settings reset to default values."
3906
  msgstr ""
3907
 
4464
  msgstr ""
4465
 
4466
  #: includes/class-mla-settings-documentation-tab.php:142
4467
+ #: includes/class-mla-settings.php:1358
4468
  #, php-format
4469
  msgid "%1$s: Reading the %2$s file ( %3$s ) \"%4$s\"."
4470
  msgstr ""
4938
  msgstr ""
4939
 
4940
  #: includes/class-mla-settings-shortcodes-tab.php:683
4941
+ #: includes/class-mla-wpml-support.php:1737
4942
+ #: includes/class-mla-wpml-support.php:1739
4943
  msgid "WARNING:"
4944
  msgstr ""
4945
 
5362
  msgstr ""
5363
 
5364
  #: includes/class-mla-settings.php:426 includes/class-mla-settings.php:652
5365
+ #: includes/class-mla-settings.php:1465
5366
  msgid "Settings"
5367
  msgstr ""
5368
 
5458
  msgid "Delete General options and restore default settings"
5459
  msgstr ""
5460
 
5461
+ #: includes/class-mla-settings.php:1068
5462
+ msgid "Donations to Support MLA"
5463
+ msgstr ""
5464
+
5465
+ #: includes/class-mla-settings.php:1069 includes/class-mla-settings.php:1074
5466
+ #: includes/class-mla-settings.php:1457
5467
+ msgid "Donate to our fund"
5468
+ msgstr ""
5469
+
5470
+ #: includes/class-mla-settings.php:1070 includes/class-mla-settings.php:1458
5471
+ msgid "Donate"
5472
+ msgstr ""
5473
+
5474
+ #: includes/class-mla-settings.php:1072
5475
+ #, php-format
5476
+ msgid ""
5477
+ "<strong>I do not solicit nor accept personal donations in support of the "
5478
+ "plugin.</strong> WordPress and its global community means a lot to me and I "
5479
+ "am happy to give something back.\n"
5480
+ "<br />&nbsp;<br />\n"
5481
+ "If you find the Media Library Assistant plugin useful and would like to "
5482
+ "support a great cause, consider a %1$s to our Chateau Seaview Fund at the "
5483
+ "Golden West Chapter of the ALS Association. Every dollar of the fund goes to "
5484
+ "make the lives of people with ALS, their families and caregivers easier. "
5485
+ "Thank you!"
5486
+ msgstr ""
5487
+
5488
+ #: includes/class-mla-settings.php:1074
5489
+ msgid "tax-deductible donation"
5490
+ msgstr ""
5491
+
5492
+ #: includes/class-mla-settings.php:1093
5493
  msgid "enhanced version of the WordPress [gallery] shortcode."
5494
  msgstr ""
5495
 
5496
+ #: includes/class-mla-settings.php:1094
5497
  msgid "enhanced version of the WordPress Tag Cloud."
5498
  msgstr ""
5499
 
5500
+ #: includes/class-mla-settings.php:1095
5501
  msgid ""
5502
  "provides flat or hierarchical lists, dropdown controls and checkbox lists of "
5503
  "taxonomy terms."
5504
  msgstr ""
5505
 
5506
+ #: includes/class-mla-settings.php:1107
5507
  msgid "Shortcodes made available by this plugin"
5508
  msgstr ""
5509
 
5510
+ #: includes/class-mla-settings.php:1222
5511
  msgid "Debug settings saved."
5512
  msgstr ""
5513
 
5514
+ #: includes/class-mla-settings.php:1312
5515
  #, php-format
5516
  msgid "%1$s: Reseting the %2$s file ( %3$s ) \"%4$s\"."
5517
  msgstr ""
5518
 
5519
+ #: includes/class-mla-settings.php:1312 includes/class-mla-settings.php:1358
5520
+ #: includes/class-mla-settings.php:1381 includes/class-mla-settings.php:1391
5521
+ #: includes/class-mla-settings.php:1417
5522
  msgid "Error Log"
5523
  msgstr ""
5524
 
5525
+ #: includes/class-mla-settings.php:1368
5526
  #, php-format
5527
  msgid "Error log file (%1$s) not found; click Reset to create it."
5528
  msgstr ""
5529
 
5530
+ #: includes/class-mla-settings.php:1412 includes/class-mla-settings.php:1428
5531
  msgid "Debug Options"
5532
  msgstr ""
5533
 
5534
+ #: includes/class-mla-settings.php:1415
5535
  msgid "Debug Settings"
5536
  msgstr ""
5537
 
5538
+ #: includes/class-mla-settings.php:1419
5539
  #, php-format
5540
  msgid ""
5541
  "You can find more information about the MLA Reporting/MLA_DEBUG_LEVEL values "
5542
  "in the %1$s section of the Documentation tab."
5543
  msgstr ""
5544
 
5545
+ #: includes/class-mla-settings.php:1419
5546
  msgid "MLA Debug Tab documentation"
5547
  msgstr ""
5548
 
5549
+ #: includes/class-mla-settings.php:1419
5550
  msgid "MLA Debug Tab"
5551
  msgstr ""
5552
 
5553
+ #: includes/class-mla-settings.php:1428
5554
  #, php-format
5555
  msgid "Click %1$s to update the %2$s."
5556
  msgstr ""
5557
 
5558
+ #: includes/class-mla-settings.php:1447
5559
  msgid "You do not have permission to manage plugin settings."
5560
  msgstr ""
5561
 
5562
+ #: includes/class-mla-settings.php:1475
5563
  msgid "Cannot render content tab"
5564
  msgstr ""
5565
 
5566
+ #: includes/class-mla-settings.php:1478
5567
  msgid "Unknown content tab"
5568
  msgstr ""
5569
 
5570
+ #: includes/class-mla-settings.php:1495
5571
  msgid "Dismiss this notice"
5572
  msgstr ""
5573
 
5574
+ #: includes/class-mla-settings.php:1522
5575
  #, php-format
5576
  msgid "%s attachment"
5577
  msgid_plural "%s attachments"
5578
  msgstr[0] ""
5579
  msgstr[1] ""
5580
 
5581
+ #: includes/class-mla-settings.php:1524
5582
  #, php-format
5583
  msgid "Deleted custom field value from %1$s."
5584
  msgstr ""
5585
 
5586
+ #: includes/class-mla-settings.php:1527
5587
  msgid "No attachments contained this custom field."
5588
  msgstr ""
5589
 
5590
+ #: includes/class-mla-settings.php:1558 includes/class-mla-settings.php:1568
5591
  #, php-format
5592
  msgctxt "message_list"
5593
  msgid "%1$s - references updated."
5594
  msgstr ""
5595
 
5596
+ #: includes/class-mla-settings.php:1611
5597
  msgid "General settings saved."
5598
  msgstr ""
5599
 
5600
+ #: includes/class-mla-settings.php:1650
5601
  msgid "General settings reset to default values."
5602
  msgstr ""
5603
 
5604
+ #: includes/class-mla-settings.php:1692
5605
  msgid "select settings"
5606
  msgstr ""
5607
 
5608
+ #: includes/class-mla-settings.php:1712
5609
  msgid "Import ALL Settings"
5610
  msgstr ""
5611
 
5612
+ #: includes/class-mla-settings.php:1741 includes/class-mla-settings.php:1757
5613
  msgctxt "message_list"
5614
  msgid "exported"
5615
  msgstr ""
5616
 
5617
+ #: includes/class-mla-settings.php:1743 includes/class-mla-settings.php:1759
5618
  msgctxt "message_list"
5619
  msgid "skipped"
5620
  msgstr ""
5621
 
5622
+ #: includes/class-mla-settings.php:1766
5623
  msgid "ALL settings exported."
5624
  msgstr ""
5625
 
5626
+ #: includes/class-mla-settings.php:1777
5627
  #, php-format
5628
  msgid "%1$s: The settings directory ( %2$s ) cannot be created."
5629
  msgstr ""
5630
 
5631
+ #: includes/class-mla-settings.php:1781
5632
  #, php-format
5633
  msgid "%1$s: The settings directory ( %2$s ) is not writable."
5634
  msgstr ""
5635
 
5636
+ #: includes/class-mla-settings.php:1792
5637
  #, php-format
5638
  msgid "%1$s: The settings file ( %2$s ) could not be opened."
5639
  msgstr ""
5640
 
5641
+ #: includes/class-mla-settings.php:1799
5642
  #, php-format
5643
  msgctxt "error_log"
5644
  msgid "%1$s: _export_settings $error_info = \"%2$s\"."
5645
  msgstr ""
5646
 
5647
+ #: includes/class-mla-settings.php:1808
5648
  #, php-format
5649
  msgid "%1$s: Writing the settings file ( %2$s ) \"%3$s\"."
5650
  msgstr ""
5651
 
5652
+ #: includes/class-mla-settings.php:1814
5653
  #, php-format
5654
+ msgid "Settings exported; %1$s settings recorded in %2$s."
5655
  msgstr ""
5656
 
5657
+ #: includes/class-mla-settings.php:1832
5658
  msgid "No settings imported."
5659
  msgstr ""
5660
 
5661
+ #: includes/class-mla-settings.php:1841
5662
  msgid "Please select an import settings file from the dropdown list."
5663
  msgstr ""
5664
 
5665
+ #: includes/class-mla-settings.php:1845
5666
  msgid "The import settings dropdown selection is missing."
5667
  msgstr ""
5668
 
5669
+ #: includes/class-mla-settings.php:1853
5670
  #, php-format
5671
  msgctxt "error_log"
5672
  msgid "%1$s: _import_settings $error_info = \"%2$s\"."
5673
  msgstr ""
5674
 
5675
+ #: includes/class-mla-settings.php:1862
5676
  #, php-format
5677
  msgid "%1$s: Reading the settings file ( %2$s ) \"%3$s\"."
5678
  msgstr ""
5679
 
5680
+ #: includes/class-mla-settings.php:1881 includes/class-mla-settings.php:1897
5681
  msgctxt "message_list"
5682
  msgid "updated"
5683
  msgstr ""
5684
 
5685
+ #: includes/class-mla-settings.php:1884 includes/class-mla-settings.php:1900
5686
  msgctxt "message_list"
5687
  msgid "unchanged"
5688
  msgstr ""
5689
 
5690
+ #: includes/class-mla-settings.php:1905
5691
  #, php-format
5692
  msgid "Settings imported; %1$s updated, %2$s unchanged."
5693
  msgstr ""
5694
 
5695
+ #: includes/class-mla-shortcode-support.php:522
5696
+ #: includes/class-mla-shortcode-support.php:1988
5697
+ #: includes/class-mla-shortcode-support.php:4362
5698
+ #: includes/class-mla-shortcode-support.php:4668
5699
  msgid "Previous"
5700
  msgstr ""
5701
 
5702
+ #: includes/class-mla-shortcode-support.php:523
5703
+ #: includes/class-mla-shortcode-support.php:1989
5704
+ #: includes/class-mla-shortcode-support.php:4409
5705
+ #: includes/class-mla-shortcode-support.php:4674
5706
  msgid "Next"
5707
  msgstr ""
5708
 
5709
+ #: includes/class-mla-shortcode-support.php:594
5710
+ #: includes/class-mla-shortcode-support.php:600
5711
+ #: includes/class-mla-shortcode-support.php:2128
5712
+ #: includes/class-mla-shortcode-support.php:2135
5713
+ #: includes/class-mla-shortcode-support.php:3596
5714
+ #: includes/class-mla-shortcode-support.php:3603
5715
  #: includes/class-mla-template-support.php:598
5716
  msgid "not found"
5717
  msgstr ""
5718
 
5719
+ #: includes/class-mla-shortcode-support.php:625
5720
+ #: includes/class-mla-shortcode-support.php:2120
5721
+ #: includes/class-mla-shortcode-support.php:3588
5722
  msgid "mla_debug REQUEST"
5723
  msgstr ""
5724
 
5725
+ #: includes/class-mla-shortcode-support.php:629
5726
+ #: includes/class-mla-shortcode-support.php:631
5727
  msgid "mla_debug attributes_errors"
5728
  msgstr ""
5729
 
5730
+ #: includes/class-mla-shortcode-support.php:637
5731
+ #: includes/class-mla-shortcode-support.php:2121
5732
+ #: includes/class-mla-shortcode-support.php:3589
5733
+ #: includes/class-mla-shortcode-support.php:6391
5734
  msgid "mla_debug attributes"
5735
  msgstr ""
5736
 
5737
+ #: includes/class-mla-shortcode-support.php:638
5738
+ #: includes/class-mla-shortcode-support.php:2122
5739
+ #: includes/class-mla-shortcode-support.php:3590
5740
+ #: includes/class-mla-shortcode-support.php:6392
5741
  msgid "mla_debug arguments"
5742
  msgstr ""
5743
 
5744
+ #: includes/class-mla-shortcode-support.php:730
5745
  msgid "mla_debug empty gallery"
5746
  msgstr ""
5747
 
5748
+ #: includes/class-mla-shortcode-support.php:761
5749
  msgid ""
5750
  "<strong>Photonic-enhanced [mla_gallery]</strong> type must be "
5751
  "<strong>default</strong>, query = "
5752
  msgstr ""
5753
 
5754
+ #: includes/class-mla-shortcode-support.php:1232
5755
  msgid "unknown"
5756
  msgstr ""
5757
 
5758
+ #: includes/class-mla-shortcode-support.php:2259
5759
  msgid "mla_debug empty cloud"
5760
  msgstr ""
5761
 
5762
+ #: includes/class-mla-shortcode-support.php:2378
5763
+ msgid "mla_debug adding ANY terms"
5764
+ msgstr ""
5765
+
5766
+ #: includes/class-mla-shortcode-support.php:2416
5767
+ msgid "mla_debug adding NO terms"
5768
+ msgstr ""
5769
+
5770
+ #: includes/class-mla-shortcode-support.php:2454
5771
+ msgid "mla_debug adding IGNORE terms"
5772
+ msgstr ""
5773
+
5774
+ #: includes/class-mla-shortcode-support.php:3726
5775
  msgid "mla_debug empty list"
5776
  msgstr ""
5777
 
5778
+ #: includes/class-mla-shortcode-support.php:3749
5779
  msgid "no-terms"
5780
  msgstr ""
5781
 
5782
+ #: includes/class-mla-shortcode-support.php:5215
5783
+ #: includes/class-mla-shortcode-support.php:5285
5784
+ #: includes/class-mla-shortcode-support.php:5749
5785
+ #: includes/class-mla-shortcode-support.php:5765
5786
+ #: includes/class-mla-shortcode-support.php:5788
5787
+ #: includes/class-mla-shortcode-support.php:5804
5788
  msgid "Invalid mla_gallery"
5789
  msgstr ""
5790
 
5791
+ #: includes/class-mla-shortcode-support.php:6121
5792
+ #: includes/class-mla-shortcode-support.php:6474
5793
  msgid "mla_debug query"
5794
  msgstr ""
5795
 
5796
+ #: includes/class-mla-shortcode-support.php:6122
5797
  msgid "mla_debug request"
5798
  msgstr ""
5799
 
5800
+ #: includes/class-mla-shortcode-support.php:6123
5801
  msgid "mla_debug query_vars"
5802
  msgstr ""
5803
 
5804
+ #: includes/class-mla-shortcode-support.php:6124
5805
  msgid "mla_debug post_count"
5806
  msgstr ""
5807
 
5808
+ #: includes/class-mla-shortcode-support.php:6125
5809
+ msgid "mla_debug found_posts"
5810
+ msgstr ""
5811
+
5812
+ #: includes/class-mla-shortcode-support.php:6151
5813
  msgid "mla_debug JOIN filter"
5814
  msgstr ""
5815
 
5816
+ #: includes/class-mla-shortcode-support.php:6192
5817
  msgid "mla_debug modified JOIN filter"
5818
  msgstr ""
5819
 
5820
+ #: includes/class-mla-shortcode-support.php:6217
5821
  msgid "mla_debug WHERE filter"
5822
  msgstr ""
5823
 
5824
+ #: includes/class-mla-shortcode-support.php:6254
5825
  msgid "mla_debug modified WHERE filter"
5826
  msgstr ""
5827
 
5828
+ #: includes/class-mla-shortcode-support.php:6277
5829
  msgid "mla_debug ORDER BY filter, incoming"
5830
  msgstr ""
5831
 
5832
+ #: includes/class-mla-shortcode-support.php:6277
5833
  msgid "Replacement ORDER BY clause"
5834
  msgstr ""
5835
 
5836
+ #: includes/class-mla-shortcode-support.php:6318
5837
  msgid "mla_debug posts_clauses filter"
5838
  msgstr ""
5839
 
5840
+ #: includes/class-mla-shortcode-support.php:6336
5841
  msgid "mla_debug posts_clauses_request filter"
5842
  msgstr ""
5843
 
5844
+ #: includes/class-mla-shortcode-support.php:6475
5845
+ msgid "mla_debug results"
5846
+ msgstr ""
5847
+
5848
+ #: includes/class-mla-shortcode-support.php:6707
5849
  msgid "Invalid taxonomy"
5850
  msgstr ""
5851
 
5852
+ #: includes/class-mla-shortcode-support.php:6899
5853
  msgid "mla_debug query arguments"
5854
  msgstr ""
5855
 
5856
+ #: includes/class-mla-shortcode-support.php:6900
5857
  msgid "mla_debug last_query"
5858
  msgstr ""
5859
 
5860
+ #: includes/class-mla-shortcode-support.php:6901
5861
  msgid "mla_debug last_error"
5862
  msgstr ""
5863
 
5864
+ #: includes/class-mla-shortcode-support.php:6902
5865
  msgid "mla_debug num_rows"
5866
  msgstr ""
5867
 
5868
+ #: includes/class-mla-shortcode-support.php:6903
5869
  msgid "mla_debug found_rows"
5870
  msgstr ""
5871
 
6130
  msgid "Duplicate translation created; update as desired."
6131
  msgstr ""
6132
 
6133
+ #: includes/class-mla-wpml-support.php:1587
6134
  msgid "Make media available in all languages"
6135
  msgstr ""
6136
 
6137
+ #: includes/class-mla-wpml-support.php:1737
6138
  msgid " WPML Media is not installed."
6139
  msgstr ""
6140
 
6141
+ #: includes/class-mla-wpml-support.php:1739
6142
  msgid " WPML Media is not active."
6143
  msgstr ""
6144
 
6145
+ #: includes/class-mla-wpml-support.php:1745
6146
  #, php-format
6147
  msgid ""
6148
  "In this tab you can find a number of options for controlling WPML-specific "
6150
  "\"Save Changes\" at the bottom of the tab to save any changes you make."
6151
  msgstr ""
6152
 
6153
+ #: includes/class-mla-wpml-support.php:2296
6154
+ #: includes/class-mla-wpml-support.php:2302
6155
  #, php-format
6156
  msgid "Edit the %s translation"
6157
  msgstr ""
6158
 
6159
+ #: includes/class-mla-wpml-support.php:2308
6160
  #, php-format
6161
  msgid "Add translation to %s"
6162
  msgstr ""
6163
 
6164
  #: includes/mla-main-search-box-template.php:42
6165
  #: includes/mla-main-search-box-template.php:44
6166
+ #: includes/mla-media-modal-js-template.php:24
6167
  msgid "Search Media"
6168
  msgstr ""
6169
 
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: 2021-03-14 20:58-0700\n"
5
- "PO-Revision-Date: 2021-03-14 20:58-0700\n"
6
  "Language-Team: David Lingren <david@davidlingren.com>\n"
7
  "MIME-Version: 1.0\n"
8
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -992,6 +992,14 @@ msgid ""
992
  "the existing MLA_DEBUG_LEVEL value."
993
  msgstr ""
994
 
 
 
 
 
 
 
 
 
995
  #, php-format
996
  msgctxt "error_log"
997
  msgid "%1$s: mla_load_template file \"%2$s\" not found."
@@ -1286,6 +1294,18 @@ msgctxt "error_log"
1286
  msgid "mla_parse_xml_string set option failed."
1287
  msgstr ""
1288
 
 
 
 
 
 
 
 
 
 
 
 
 
1289
  msgid "Yes"
1290
  msgstr ""
1291
 
@@ -2122,6 +2142,12 @@ msgstr ""
2122
  msgid "Attachments"
2123
  msgstr ""
2124
 
 
 
 
 
 
 
2125
  #, php-format
2126
  msgctxt "error_log"
2127
  msgid ""
@@ -3497,6 +3523,31 @@ msgstr ""
3497
  msgid "Delete General options and restore default settings"
3498
  msgstr ""
3499
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3500
  msgid "enhanced version of the WordPress [gallery] shortcode."
3501
  msgstr ""
3502
 
@@ -3622,7 +3673,7 @@ msgid "%1$s: Writing the settings file ( %2$s ) \"%3$s\"."
3622
  msgstr ""
3623
 
3624
  #, php-format
3625
- msgid "Settings exported; %1$s settings recorded."
3626
  msgstr ""
3627
 
3628
  msgid "No settings imported."
@@ -3690,6 +3741,15 @@ msgstr ""
3690
  msgid "mla_debug empty cloud"
3691
  msgstr ""
3692
 
 
 
 
 
 
 
 
 
 
3693
  msgid "mla_debug empty list"
3694
  msgstr ""
3695
 
@@ -3711,6 +3771,9 @@ msgstr ""
3711
  msgid "mla_debug post_count"
3712
  msgstr ""
3713
 
 
 
 
3714
  msgid "mla_debug JOIN filter"
3715
  msgstr ""
3716
 
@@ -3735,6 +3798,9 @@ msgstr ""
3735
  msgid "mla_debug posts_clauses_request filter"
3736
  msgstr ""
3737
 
 
 
 
3738
  msgid "Invalid taxonomy"
3739
  msgstr ""
3740
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Media Library Assistant\n"
4
+ "POT-Creation-Date: 2021-07-22 11:54-0700\n"
5
+ "PO-Revision-Date: 2021-07-22 11:54-0700\n"
6
  "Language-Team: David Lingren <david@davidlingren.com>\n"
7
  "MIME-Version: 1.0\n"
8
  "Content-Type: text/plain; charset=UTF-8\n"
992
  "the existing MLA_DEBUG_LEVEL value."
993
  msgstr ""
994
 
995
+ msgid "Add Tax. Columns"
996
+ msgstr ""
997
+
998
+ msgid ""
999
+ "Check this option to add Term ID and Term-Taxonomy ID columns to the "
1000
+ "taxonomy edit admin submenu tables."
1001
+ msgstr ""
1002
+
1003
  #, php-format
1004
  msgctxt "error_log"
1005
  msgid "%1$s: mla_load_template file \"%2$s\" not found."
1294
  msgid "mla_parse_xml_string set option failed."
1295
  msgstr ""
1296
 
1297
+ msgid "Auto"
1298
+ msgstr ""
1299
+
1300
+ msgid "Manual"
1301
+ msgstr ""
1302
+
1303
+ msgid "Bracket"
1304
+ msgstr ""
1305
+
1306
+ msgid "Other"
1307
+ msgstr ""
1308
+
1309
  msgid "Yes"
1310
  msgstr ""
1311
 
2142
  msgid "Attachments"
2143
  msgstr ""
2144
 
2145
+ msgid "Term ID"
2146
+ msgstr ""
2147
+
2148
+ msgid "Term-Tax ID"
2149
+ msgstr ""
2150
+
2151
  #, php-format
2152
  msgctxt "error_log"
2153
  msgid ""
3523
  msgid "Delete General options and restore default settings"
3524
  msgstr ""
3525
 
3526
+ msgid "Donations to Support MLA"
3527
+ msgstr ""
3528
+
3529
+ msgid "Donate to our fund"
3530
+ msgstr ""
3531
+
3532
+ msgid "Donate"
3533
+ msgstr ""
3534
+
3535
+ #, php-format
3536
+ msgid ""
3537
+ "<strong>I do not solicit nor accept personal donations in support of the "
3538
+ "plugin.</strong> WordPress and its global community means a lot to me and I "
3539
+ "am happy to give something back.\n"
3540
+ "<br />&nbsp;<br />\n"
3541
+ "If you find the Media Library Assistant plugin useful and would like to "
3542
+ "support a great cause, consider a %1$s to our Chateau Seaview Fund at the "
3543
+ "Golden West Chapter of the ALS Association. Every dollar of the fund goes to "
3544
+ "make the lives of people with ALS, their families and caregivers easier. "
3545
+ "Thank you!"
3546
+ msgstr ""
3547
+
3548
+ msgid "tax-deductible donation"
3549
+ msgstr ""
3550
+
3551
  msgid "enhanced version of the WordPress [gallery] shortcode."
3552
  msgstr ""
3553
 
3673
  msgstr ""
3674
 
3675
  #, php-format
3676
+ msgid "Settings exported; %1$s settings recorded in %2$s."
3677
  msgstr ""
3678
 
3679
  msgid "No settings imported."
3741
  msgid "mla_debug empty cloud"
3742
  msgstr ""
3743
 
3744
+ msgid "mla_debug adding ANY terms"
3745
+ msgstr ""
3746
+
3747
+ msgid "mla_debug adding NO terms"
3748
+ msgstr ""
3749
+
3750
+ msgid "mla_debug adding IGNORE terms"
3751
+ msgstr ""
3752
+
3753
  msgid "mla_debug empty list"
3754
  msgstr ""
3755
 
3771
  msgid "mla_debug post_count"
3772
  msgstr ""
3773
 
3774
+ msgid "mla_debug found_posts"
3775
+ msgstr ""
3776
+
3777
  msgid "mla_debug JOIN filter"
3778
  msgstr ""
3779
 
3798
  msgid "mla_debug posts_clauses_request filter"
3799
  msgstr ""
3800
 
3801
+ msgid "mla_debug results"
3802
+ msgstr ""
3803
+
3804
  msgid "Invalid taxonomy"
3805
  msgstr ""
3806
 
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: 2021-03-14 20:57-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@davidlingren.com>\n"
@@ -993,6 +993,14 @@ msgid ""
993
  "the existing MLA_DEBUG_LEVEL value."
994
  msgstr ""
995
 
 
 
 
 
 
 
 
 
996
  #, php-format
997
  msgctxt "error_log"
998
  msgid "%1$s: mla_load_template file \"%2$s\" not found."
@@ -1287,6 +1295,18 @@ msgctxt "error_log"
1287
  msgid "mla_parse_xml_string set option failed."
1288
  msgstr ""
1289
 
 
 
 
 
 
 
 
 
 
 
 
 
1290
  msgid "Yes"
1291
  msgstr ""
1292
 
@@ -2123,6 +2143,12 @@ msgstr ""
2123
  msgid "Attachments"
2124
  msgstr ""
2125
 
 
 
 
 
 
 
2126
  #, php-format
2127
  msgctxt "error_log"
2128
  msgid ""
@@ -3498,6 +3524,31 @@ msgstr ""
3498
  msgid "Delete General options and restore default settings"
3499
  msgstr ""
3500
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3501
  msgid "enhanced version of the WordPress [gallery] shortcode."
3502
  msgstr ""
3503
 
@@ -3623,7 +3674,7 @@ msgid "%1$s: Writing the settings file ( %2$s ) \"%3$s\"."
3623
  msgstr ""
3624
 
3625
  #, php-format
3626
- msgid "Settings exported; %1$s settings recorded."
3627
  msgstr ""
3628
 
3629
  msgid "No settings imported."
@@ -3691,6 +3742,15 @@ msgstr ""
3691
  msgid "mla_debug empty cloud"
3692
  msgstr ""
3693
 
 
 
 
 
 
 
 
 
 
3694
  msgid "mla_debug empty list"
3695
  msgstr ""
3696
 
@@ -3712,6 +3772,9 @@ msgstr ""
3712
  msgid "mla_debug post_count"
3713
  msgstr ""
3714
 
 
 
 
3715
  msgid "mla_debug JOIN filter"
3716
  msgstr ""
3717
 
@@ -3736,6 +3799,9 @@ msgstr ""
3736
  msgid "mla_debug posts_clauses_request filter"
3737
  msgstr ""
3738
 
 
 
 
3739
  msgid "Invalid taxonomy"
3740
  msgstr ""
3741
 
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Media Library Assistant\n"
5
+ "POT-Creation-Date: 2021-07-22 11:54-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@davidlingren.com>\n"
993
  "the existing MLA_DEBUG_LEVEL value."
994
  msgstr ""
995
 
996
+ msgid "Add Tax. Columns"
997
+ msgstr ""
998
+
999
+ msgid ""
1000
+ "Check this option to add Term ID and Term-Taxonomy ID columns to the "
1001
+ "taxonomy edit admin submenu tables."
1002
+ msgstr ""
1003
+
1004
  #, php-format
1005
  msgctxt "error_log"
1006
  msgid "%1$s: mla_load_template file \"%2$s\" not found."
1295
  msgid "mla_parse_xml_string set option failed."
1296
  msgstr ""
1297
 
1298
+ msgid "Auto"
1299
+ msgstr ""
1300
+
1301
+ msgid "Manual"
1302
+ msgstr ""
1303
+
1304
+ msgid "Bracket"
1305
+ msgstr ""
1306
+
1307
+ msgid "Other"
1308
+ msgstr ""
1309
+
1310
  msgid "Yes"
1311
  msgstr ""
1312
 
2143
  msgid "Attachments"
2144
  msgstr ""
2145
 
2146
+ msgid "Term ID"
2147
+ msgstr ""
2148
+
2149
+ msgid "Term-Tax ID"
2150
+ msgstr ""
2151
+
2152
  #, php-format
2153
  msgctxt "error_log"
2154
  msgid ""
3524
  msgid "Delete General options and restore default settings"
3525
  msgstr ""
3526
 
3527
+ msgid "Donations to Support MLA"
3528
+ msgstr ""
3529
+
3530
+ msgid "Donate to our fund"
3531
+ msgstr ""
3532
+
3533
+ msgid "Donate"
3534
+ msgstr ""
3535
+
3536
+ #, php-format
3537
+ msgid ""
3538
+ "<strong>I do not solicit nor accept personal donations in support of the "
3539
+ "plugin.</strong> WordPress and its global community means a lot to me and I "
3540
+ "am happy to give something back.\n"
3541
+ "<br />&nbsp;<br />\n"
3542
+ "If you find the Media Library Assistant plugin useful and would like to "
3543
+ "support a great cause, consider a %1$s to our Chateau Seaview Fund at the "
3544
+ "Golden West Chapter of the ALS Association. Every dollar of the fund goes to "
3545
+ "make the lives of people with ALS, their families and caregivers easier. "
3546
+ "Thank you!"
3547
+ msgstr ""
3548
+
3549
+ msgid "tax-deductible donation"
3550
+ msgstr ""
3551
+
3552
  msgid "enhanced version of the WordPress [gallery] shortcode."
3553
  msgstr ""
3554
 
3674
  msgstr ""
3675
 
3676
  #, php-format
3677
+ msgid "Settings exported; %1$s settings recorded in %2$s."
3678
  msgstr ""
3679
 
3680
  msgid "No settings imported."
3742
  msgid "mla_debug empty cloud"
3743
  msgstr ""
3744
 
3745
+ msgid "mla_debug adding ANY terms"
3746
+ msgstr ""
3747
+
3748
+ msgid "mla_debug adding NO terms"
3749
+ msgstr ""
3750
+
3751
+ msgid "mla_debug adding IGNORE terms"
3752
+ msgstr ""
3753
+
3754
  msgid "mla_debug empty list"
3755
  msgstr ""
3756
 
3772
  msgid "mla_debug post_count"
3773
  msgstr ""
3774
 
3775
+ msgid "mla_debug found_posts"
3776
+ msgstr ""
3777
+
3778
  msgid "mla_debug JOIN filter"
3779
  msgstr ""
3780
 
3799
  msgid "mla_debug posts_clauses_request filter"
3800
  msgstr ""
3801
 
3802
+ msgid "mla_debug results"
3803
+ msgstr ""
3804
+
3805
  msgid "Invalid taxonomy"
3806
  msgstr ""
3807
 
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === Media Library Assistant ===
2
  Contributors: dglingren
3
- Donate link: http://davidlingren.com/#two
4
  Tags: media, media library, gallery, images, categories, tags, attachments, 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.7
7
  Requires PHP: 5.3
8
- Stable tag: 2.95
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -57,6 +57,10 @@ The Media Library Assistant provides several enhancements for managing the Media
57
 
58
  The Assistant is designed to work like the standard Media Library pages, so the learning curve is short and gentle. Contextual help is provided on every new screen to highlight new features.
59
 
 
 
 
 
60
  == Installation ==
61
 
62
  1. Upload `media-library-assistant` and its subfolders to your `/wp-content/plugins/` directory, **OR** Visit the Plugins/Add New page and search for "Media Library Assistant"; click "Install Now" to upload it
@@ -183,72 +187,47 @@ All of the MLA source code has been annotated with "DocBlocks", a special type o
183
 
184
  == Changelog ==
185
 
186
- = 2.95 =
187
- * New: For the Media/Assistant admin submenu, **support for Real Media Library has been added.** You can filter the submenu table display by selecting an RML folder or Gallery in the sidebar at the left-hand side of the screen. Note that this feature requires an update to the RML plugin, so watch for and install that update to activate these features.
188
- * New: For the Media/Assistant admin submenu, Media Manager enhancements and Media/Library Grid Mode enhancements the "Mine" filter/view introduced in WP 5.1 has been added to the list.
189
- * New: For `[mla_gallery]`, **support for Simple Date Parameters has been added.** You can filter the gallery display by year, month, week or day in addition to any other data selection parameters. More information is given in the 'Simple Date Parameters' section of the Settings/Media Library Assistant Documentation tab.
190
- * New: For `[mla_gallery]`, **support for Real Media Library has been added.** You can filter the gallery display by the RML folder, collection or gallery ID in addition to any other data selection parameters. More information is given in the 'Support for the “Real Media Library” Plugin' section of the Settings/Media Library Assistant Documentation tab.
191
- * Fix: For the Media/Assistant admin submenu, the option to hide the Search Media controls has been restored by correcting a defect in escaping the HTML for the form.
192
- * Fix: For keyword and taxonomy term searches, excluded values used in large numbers of items are now handled correctly.
193
- * Fix: For Microsoft Office metadata extraction, removed PHP Fatal Error when the ZipArchive class does not exist.
194
- * Fix: For `[mla_gallery]` pagination controls, handling of `mla_link_href` parameters containing HTML "fragments" has been restored. Fragments are placed at the end of the URL, following query arguments.
195
- * Fix: For the Media/Assistant admin submenu, custom field values containing embedded arrays are now completely decoded for display.
196
- * Fix: For the "MLA Insert Fixit" example plugin, "scaled" Vs "original" images introduced in WP 5.3 are now handled for tools such as "ALT from item".
197
- * Fix: For the "MLA Insert Fixit" example plugin, HTTP/HTTPS mismatches between the site URL and inserted item URLs are now handled for tools such as "ALT from item".
198
- * Fix: For the IPTC/EXIF taxonomy rule full-screen editor, Text/Array Option value changes are now recorded properly.
199
- * Fix: For Gutenberg Blocks such as "Audio" and "Video", MLA enhancements now respect MIME Type filters when returning items for the display.
200
- * Fix: Correct a defect (introduced in v2.84) in parsing content templates with embedded substitution parameters in "test" elements.
201
- * Fix: Correct overwriting of the global $post variable when updating a Media Library item.
202
- * Fix: Correct false detection of Media File Renamer plugin and subsequent PHP "Uncaught Error" during upload processing.
203
-
204
- = 2.94 =
205
- * New: <strong>The "MLA Custom Field Search Example" plugin has been substantially upgraded.</strong> The new version has many more parameters and a new plugin settings page. A Documentation tab on the settings page contains all the information you need to understand and use the new version.
206
- * New: <strong>A new example plugin, "MLA Postie Post After Example"</strong>, adds support for running MLA mapping rules after the "Postie" plugin chron job creates posts and attachments from an email.
207
- * New: The Library Views/Post MIME Type "Table View" custom field queries have been enhanced to allow searching multiple field names or "all fields" for one or more values.
208
- * Fix: The "Smart Media Categories" example plugin has been enhanced to handle additional WordPress alternatives for term assignments and a new option is provided to exclude the Default Post Category from sync processing.
209
- * Fix: Wildcard values for Library Views/Post MIME Type "Table View" custom field queries have been restored.
210
- * Fix: PDF thumbnail streaming for <code>mla_viewer</code> processing has been restored.
211
- * Fix: For the `[mla_gallery]` shortcode, error reporting for the tax_query, date_query and meta_query parameters has been improved.
212
- * Fix: For the `[mla_gallery]` shortcode, proper handling of the <code>size=</code> "icon", "icon_only" and "icon_feature" options has been restored.
213
- * Fix: For the `[mla_gallery]` shortcode, performance is improved by avoiding a redundant LEFT JOIN database query clause (added by WP_Query).
214
- * Fix: For the `[mla_gallery]` shortcode, performance is improved by avoiding LEFT JOIN and WHERE database query clauses added by Real Media Library.
215
- * Fix: Unnecessary "term meta cache" queries have been removed from the Media/Assistant submenu table generation.
216
- * Fix: Handling of disimissible admin messages has been restored.
217
-
218
- = 2.93 =
219
- * New: The "MLA Simple Mapping Hooks Example" plugin has been updated so it will run when attachments are uploaded or updated by the WP/LR Sync plugin.
220
- * New: For the "Smart Media Categories" example plugin, support has been added for the "Postie" plugin chron job that creates posts and attachments from an email.
221
- * Fix: <strong>Correct defect in parsing `request:` substitution parameters containing compound names to access array elements, e.g., `tax_input`.</strong>
222
- * Fix: <strong>For `[mla_gallery]` pagination shortcodes, correct defects in handling substitution parameters containing array values, e.g., `tax_input`.</strong>
223
- * Fix: For the "Smart Media Categories" example plugin, term synchronization now works when multiple attachments are added to a parent in the same page load.
224
-
225
- = 2.92 =
226
- * Fix: Correct Media/Assistant Quick Edit error that deleted term assignments in the WordPress Categories taxonomy.
227
-
228
- = 2.91 =
229
- * Fix: Correct PHP Fatal "Uncaught ArgumentCountError" in some Media Manager query-attachments operations, e.g., Search Media.
230
- * Fix: Correct defect that prevented Media Manager operations such as "Edit Gallery" from retaining all current items when opened.
231
-
232
- = 2.90 =
233
- * New: <strong>A new example plugin, "MLA Parent Custom Field Mapping"</strong>, allows IPTC/EXIF and Custom Field mapping rules to update custom fields in the item's parent post/page rather than the items's own fields. Support for Advanced Custom Fields and WP/LR Sync is included.
234
- * New: <strong>The "MLA Randon Galleries Example" plugin has been greatly enhanced</strong>. The new version has many more parameters and a new plugin options page. A Documentation tab on the settings page contains all the information you need to understand and use the new version.
235
- * New: Three new field level data sources have been added for use in mapping rules, etc. They are `site_url`, `base_url` and `base_dir`. The last two give the location of the uploads directory.
236
- * New: For the `[mla_gallery]` shortcode, a new `size=icon_feature` parameter value will display item icons or the "Featured Image" associated with an item. This can be used to suppress the thumbnails and "PDF Thumbnails" that appear when `size=icon` is specified, but retain the explicitly assigned Featured Images.
237
- * New: For Advanced Custom Fields Pro "Gallery" Fields, restrictions such as minimum/maximum dimensions and sizes are now respected when adding items to the gallery.
238
- * New: For Custom Field or IPTC/EXIF mapping rules, a new "mla_purge_custom_field_values" filter lets you override the default "Purge Values" processing, and a new "mla_mapping_old_custom_value" filter lets you replace the current target value for "Existing Text" processing.
239
- * New: Added support for applying mapping rules to attachments created by "Postie" cron jobs.
240
- * Fix: Systematic review and update of all files for validating, sanitizing and escaping user data to reduce the risk of security exploits.
241
- * Fix: Allow IPTC and XMP metadata extraction from images that fail the WordPress `getimagesize( $path, $info )` logic.
242
- * Fix: For the `[mla_gallery]` shortcode, the default style and markup templates have been adjusted for greater compatibility with the styles and markup used in the WordPress `[gallery]` shortcode.
243
- * Fix: For the Media Manager Modal (popup) Window, changing term assignment(s) for Media Library items no longer changes the corresponding checkbox(s) in the underlying post/page.
244
- * Fix: For Media/Assistant submenu table filtering by a custom field value, dropdown setting is now retained and pagination controls have been repaired.
245
- * Fix: Deprecated reference to `postL10n.dateFormat` has been replaced with `wp.i18n.__`.
246
- * Fix: Handling of `[mla_gallery]` shortcodes with a blank but non-empty parameter string has been corrected.
247
 
248
  = 2.80 - 2.84 =
249
  * 2.84 - WP 5.5 support, new Always Use MLA MIME Type option, CSV Data Source example plugin, Support for PaidMembershipsPro, Simple Taxonomy Ordering, Simple Custom Post Order, Featured Image from URL plugins. Thirteen enhancements in all, twelve fixes.
250
  * 2.83 - Avoid "Fatal error:" with Admin Columns Pro version 5.1+. Fix Attachments area positioning in the Media Manager Modal (popup) Window. Two fixes in all.
251
- * 2.82 - 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.
252
  * 2.81 - 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.
253
  * 2.80 - A new "MLA Phoenix Media Rename Example" plugin supports the Phoenix Media Rename plugin. MLA Insert Fixit example plugin improvements, improved support for other plugins and themes. One enhancement, twelve fixes.
254
 
@@ -355,8 +334,8 @@ All of the MLA source code has been annotated with "DocBlocks", a special type o
355
 
356
  == Upgrade Notice ==
357
 
358
- = 2.95 =
359
- Support for Real Media Library plugin in Media/Assistant and `[mla_gallery]`, MLA Insert Fixit improvements, `[mla_gallery]` simple date parameters, "Mine" filter/view. Four enhancements in all, twelve fixes.
360
 
361
  == Other Notes ==
362
 
1
  === Media Library Assistant ===
2
  Contributors: dglingren
3
+ Donate link: http://davidlingren.com/#donate
4
  Tags: media, media library, gallery, images, categories, tags, attachments, 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.8
7
  Requires PHP: 5.3
8
+ Stable tag: 2.96
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
57
 
58
  The Assistant is designed to work like the standard Media Library pages, so the learning curve is short and gentle. Contextual help is provided on every new screen to highlight new features.
59
 
60
+ **I do not solicit nor accept personal donations in support of the plugin.** WordPress and its global community means a lot to me and I am happy to give something back.
61
+
62
+ If you find the Media Library Assistant plugin useful and would like to support a great cause, consider a [tax-deductible donation](http://webgw.alsa.org/goto/ChateauSeaviewFund") to our [Chateau Seaview Fund](http://webgw.alsa.org/goto/ChateauSeaviewFund") at the Golden West Chapter of the ALS Association. Every dollar of the fund goes to make the lives of people with ALS, their families and caregivers easier. Thank you!
63
+
64
  == Installation ==
65
 
66
  1. Upload `media-library-assistant` and its subfolders to your `/wp-content/plugins/` directory, **OR** Visit the Plugins/Add New page and search for "Media Library Assistant"; click "Install Now" to upload it
187
 
188
  == Changelog ==
189
 
190
+ = 2.96 =
191
+ * New: For the "MLA CSV Data Source Example" plugin, the new "Export Item Values" tool lets you export anything you need from Media Library items, e.g., standard values, taxonomy terms, custom fields and embedded image IPTC/EXIF/XMP metadata.
192
+ * New: For the "MLA UI Elements Example" plugin, the `[muie_archive_list]' shortcode adds date-based archive controls and lists.
193
+ * New: For the "MLA UI Elements Example" plugin, the `[muie_text_box]' shortcode adds a "sticky" text box that survives page refresh and pagination.
194
+ * New: An "ExposureMode" data source has been added to the "Field-level enhanced EXIF CAMERA values".
195
+ * New: A new debugging tool adds Term ID and Term-taxonomy ID columns to the Media/taxonomy edit screens, controlled by a checkbox on the Settings/Media Library Assistant Debug tab.
196
+ * New: Enhanced support for the Enhanced Media Library plugin, including filter support in the Media Manager Modal (popup) Window and Media/Assistant Grid mode.
197
+ * New: For `[mla_tag_cloud]` and `[mla_term_list]`, special "ignore.terms.assigned", "no.terms.assigned", and "any.terms.assigned" values let you add links/controls to the cloud or term list to select all items, items with no term assignments and items with one ore more term assginments.
198
+ * New: For `[mla_gallery]`, a special "any.terms.assigned" value lets you use a simple taxonomy query or a `tax_query` to find items that have one or more term assignments in a given taxonomy.
199
+ * New: For the ",kbmb" Field-level option/format value, if the kilobyte suffix option is empty and the megabyte suffix is present all values above the threshold will be displayed in megabytes.
200
+ * New: For the "MLA Insert Fixit" example plugin, the "Attach Referenced in" tool "ids=" analysis can be applied to any shortcode.
201
+ * New: For the "WooCommerce Fixit Tools" example plugin, new tools to populate the Product Image and Product Gallery from items attached to the Product(s) have been added.
202
+ * New: The full path and file name has been added to the "Settings updated" message for the "Export ALL Settings" function of the Settings/Media Library Assistant General tab.
203
+ * New: Donation links and information have been restored, going to our Chateau Seaview Fund at the Golden West Chapter of the ALS Association.
204
+ * Fix: Handle new "Load More" functions in WP 5.8 Media Manager Modal Window.
205
+ * Fix: Correct handling of spaces in substitution parameter format values, e.g., `,str_replace(s,r)` and `,replace(p,r,v)`.
206
+ * Fix: jQuery migrate "deprecated" notices for JS event shorthand instances have been resolved.
207
+ * Fix: For the Media/Assistant admin submenu, the "Attached" view item count has been corrected.
208
+ * Fix: Handling of array variables in the `request:` prefix has been restored.
209
+ * Fix: For `[mla_gallery]`, displaying the Featured Image for a non-image post type, e.g., post or page, has been restored.
210
+ * Fix: For WPML term processing in "All Languages" mode, the Quick Edit action will update assigned terms in the proper language regardless of the language of selected terms.
211
+ * Fix: For the Media/Assistant admin submenu displayed to members of the "Author" role, Bulk Actions such as "Edit" do not allow the user to select items belionging to other users.
212
+ * Fix: For the "MLA Custom Feed" example plugin, code has been added to ensure that all active feeds are reflected in the WordPress URL rewrite rules and flushed (only) when missing feeds are detected.
213
+ * Fix: For `[mla_tag_cloud]` and `[mla_term_list]`, "pad_counts" values now reflect filtering with the `post_mime_type` data selection parameter..
214
+ * Fix: For `[mla_term_list]`, PHP error messages when using a custom markup template with an empty Open section have been resolved.
215
+ * Fix: Improved toolbar layout and styling for the Media Manager Modal (popup) Window and Media/Assistant Grid mode.
216
+ * Fix: Support for the `ajax_query_attachments_args` filter to support plugins such as Enhanced Media Library and ACF:Image Aspect Ratio Crop Field.
217
+ * Fix: For the Bulk Edit on Upload feature, only one call to the edit processing function is made when all four "Enable ... mapping..." options are disabled.
218
+
219
+ = 2.90 - 2.95 =
220
+ * 2.95 - Support for Real Media Library plugin in Media/Assistant and `[mla_gallery]`, MLA Insert Fixit improvements, `[mla_gallery]` simple date parameters, "Mine" filter/view. Four enhancements in all, twelve fixes.
221
+ * 2.94 - For [mla_gallery], icon handling, mla_viewer, and performance fixes. New and enhanced example plugins. Three enhancements in all, nine fixes.
222
+ * 2.93 - Correct defects in handling array values, e.g., tax_input, in request: parameters and pagination controls. Example plugin enhancements. Two enhancements in all, three fixes.
223
+ * 2.92 - Correct Media/Assistant Quick Edit error that deleted term assignments in the WordPress Categories taxonomy.
224
+ * 2.91 - Correct PHP Fatal Error in Media Manager Search Media operations. Correct defect that caused Media Manager "Edit Gallery" operations to lose existing items. Two fixes in all.
225
+ * 2.90 - WP 5.6 support, thorough review and update of all files for validating, sanitizing and escaping user data to reduce the risk of security exploits, two new example plugins. Seven enhancements in all, seven fixes.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
 
227
  = 2.80 - 2.84 =
228
  * 2.84 - WP 5.5 support, new Always Use MLA MIME Type option, CSV Data Source example plugin, Support for PaidMembershipsPro, Simple Taxonomy Ordering, Simple Custom Post Order, Featured Image from URL plugins. Thirteen enhancements in all, twelve fixes.
229
  * 2.83 - Avoid "Fatal error:" with Admin Columns Pro version 5.1+. Fix Attachments area positioning in the Media Manager Modal (popup) Window. Two fixes in all.
230
+ * 2.82 - 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.
231
  * 2.81 - 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.
232
  * 2.80 - A new "MLA Phoenix Media Rename Example" plugin supports the Phoenix Media Rename plugin. MLA Insert Fixit example plugin improvements, improved support for other plugins and themes. One enhancement, twelve fixes.
233
 
334
 
335
  == Upgrade Notice ==
336
 
337
+ = 2.96 =
338
+ WordPress 5.8 support! New [muie_archive_list] shortcode. CSV export item values. Support for Enhanced Media Library plugin. Donation links are back. Thirteen enhancements in all, fourteen fixes.
339
 
340
  == Other Notes ==
341
 
tpls/admin-display-settings-page.tpl CHANGED
@@ -3,7 +3,9 @@
3
  &nbsp;
4
  <div class="wrap">
5
  <div id="icon-options-general" class="icon32"><br/></div>
6
- <h1>[+Media Library Assistant+] [+version+][+development+] [+Settings+]</h1>
 
 
7
  [+messages+]
8
  [+tablist+]
9
  [+tab_content+]
@@ -115,6 +117,15 @@
115
  <p>
116
  <a href="#backtotop">[+Go to Top+]</a>
117
  </p>
 
 
 
 
 
 
 
 
 
118
 
119
  <!-- template="debug-tab" -->
120
  <h2>[+Debug Options+]</h2>
3
  &nbsp;
4
  <div class="wrap">
5
  <div id="icon-options-general" class="icon32"><br/></div>
6
+ <div id="donate-button-div" class="alignright clear">
7
+ <a title="[+Donate to our fund+]" class="button button-large button-primary" href="http://webgw.alsa.org/goto/ChateauSeaviewFund" target="_blank">[+Donate+]</a>
8
+ </div><h1>[+Media Library Assistant+] [+version+][+development+] [+Settings+]</h1>
9
  [+messages+]
10
  [+tablist+]
11
  [+tab_content+]
117
  <p>
118
  <a href="#backtotop">[+Go to Top+]</a>
119
  </p>
120
+ <h2>[+Donations to Support MLA+]</h2>
121
+ <table width="700" border="0" cellpadding="10">
122
+ <tr>
123
+ <td valign="top">
124
+ <a title="[+Donate to our fund+]" class="button button-large button-primary" href="http://webgw.alsa.org/goto/ChateauSeaviewFund" target="_blank">[+Donate+]</a>
125
+ </td>
126
+ <td>[+Donate Text+]</td>
127
+ </tr>
128
+ </table>
129
 
130
  <!-- template="debug-tab" -->
131
  <h2>[+Debug Options+]</h2>
tpls/documentation-settings-tab.tpl CHANGED
@@ -65,6 +65,7 @@ For more information about the example plugins, jump to <a href="#mla_example_pl
65
  <li><a href="#term_list_display_style_ldc">Term List Display Style (List, Dropdown and Checklist)</a></li>
66
  <li><a href="#term_list_display_style">Term List Display Style (List and Checklist)</a></li>
67
  <li><a href="#term_list_display_style_d">Term List Display Style (Dropdown)</a></li>
 
68
  <li><a href="#term_list_display_content_afl">Term List Display Content (Array, Flat and List)</a></li>
69
  <li><a href="#term_list_display_content">Term List Display Content (Dropdown and Checklist)</a></li>
70
  <li><a href="#term_list_other">Term List Other Parameters</a></li>
@@ -839,10 +840,20 @@ Note that you should use the name/slug strings for taxonomy and terms, not the "
839
  In this example, "attachment_tag" is the WordPress taxonomy name/slug for the taxonomy. If you're using "Att. Category", the slug would be "attachment_category".
840
  </p>
841
  <p>
842
- The default behavior of the simple taxonomy query will match any of the terms in the list. A special value lets you find items that have no assigned terms in the taxonomy. For example, to find items that have no Att. Tags you can code:
843
  </p>
844
  <ul class="mla_settings">
 
845
  <li><code>[mla_gallery attachment_tag=no.terms.assigned]</code></li>
 
 
 
 
 
 
 
 
 
846
  </ul>
847
  <p>
848
  If you have two or more simple taxonomy queries, they will be joined by "AND". MLA enhances the simple taxonomy query form by providing three additional parameters:
@@ -930,20 +941,21 @@ The first example is equivalent to the simple query <code>attachment_tag=artisan
930
  When embedding the shortcode in the body of a post, be very careful when coding the tax_query; it must be a valid PHP array specification. Read and follow the rules and guidelines in the "<a href="#complex_shortcodes">Entering Long/Complex Shortcodes</a>" Documentation section to get the results you want.
931
  </p>
932
  <p>
933
- A special "terms" value, "no.terms.assigned" lets you find items that have no assigned terms in the taxonomy. For example, to find items that have no Att. Tags you can code:</p>
934
  <p><code>[mla_gallery]<br />
935
  tax_query="array(<br />
936
  &nbsp;&nbsp;&nbsp;&nbsp;array(<br />
937
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'taxonomy' =&gt; 'attachment_tag',<br />
938
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'field' =&gt; 'id',<br />
939
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'terms' =&gt; 'no.terms.assigned'<br />
940
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'operator' =&gt; 'NOT IN'<br />
941
  &nbsp;&nbsp;&nbsp;&nbsp;)<br />
942
  )"<br />
943
  [/mla_gallery]
944
  </code></p>
945
  <p>
946
- In addition to <code>'terms' =&gt; 'no.terms.assigned'</code> you must code <code>'field' =&gt; 'id'</code> and <code>'operator' =&gt; 'NOT IN'</code> to get the proper results. The example uses use the <strong>"enclosing shortcode"</strong> format to avoid problems WordPress has in parsing parameters with special characters such as <code>=&gt;</code>.
 
 
 
947
  </p>
948
  <p>
949
  Remember to use <code>post_parent=current</code> if you want to restrict your query to items attached to the current post.
@@ -1439,6 +1451,10 @@ Each item in the tag cloud comprises a term name of varying size, a hyperlink su
1439
  <td>The text size (default 22) of the tag with the highest count value (units given by the unit parameter).</td>
1440
  </tr>
1441
  <tr>
 
 
 
 
1442
  <td class="mla-doc-table-label">unit</td>
1443
  <td>Unit of measure as pertains to the smallest and largest values. This can be any CSS length value, e.g. pt (the default), px, em, %.</td>
1444
  </tr>
@@ -1602,11 +1618,46 @@ Nine parameters provide an easy way to control the contents of tag cloud items w
1602
  <td>replaces the caption text displayed beneath each item. The caption appears for "grid" items and for "list" items when the "captiontag" parameter is present.</td>
1603
  </tr>
1604
  <tr>
 
 
 
 
1605
  <td class="mla-doc-table-label">mla_target</td>
1606
  <td>adds an HTML "target" attribute to the hyperlink for each gallery item; see below</td>
1607
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1608
  </table>
1609
  <p>
 
 
 
1610
  All but the "mla_target" parameter support the <a href="#tag_cloud_markup_parameters">Markup</a>, <a href="#tag_cloud_item_parameters">Item-specific</a>, <a href="#tag_cloud_variable_parameters">Field-level</a> and <a href="#mla_template_parameters">Content Template</a> substitution parameters defined for Markup Templates. For example, if you code "<code>mla_rollover_text='{+slug+} : {+rollover_text+}'</code>, the rollover text will contain the term slug, a colon, and the appropriate "single text" or "multiple text". Simply add "{+" before the substitution parameter name and add "+}" after the name. Note that the enclosing delimiters are different than those used in the templates, since the WordPress shortcode parser reserves square brackets ("[" and "]") for its own use.
1611
  </p>
1612
  <p>
@@ -1617,6 +1668,9 @@ The "mla_link_attributes" parameter accepts any value and adds it to the "&lt;a&
1617
  </p>
1618
  <p>
1619
  The "mla_target" parameter accepts any value and adds an HTML "target" attribute to the hyperlink with that value. For example, if you code <code>mla_target="_blank"</code> the item will open in a new window or tab. You can also use "_self", "_parent", "_top" or the "<em>framename</em>" of a named frame.
 
 
 
1620
  <a name="tag_cloud_data_selection"></a>
1621
  </p>
1622
  <h4>Tag Cloud Data Selection Parameters</h4>
@@ -2088,6 +2142,10 @@ Tag cloud <strong>item-specific substitution parameters</strong> for the Markup
2088
  <td>the text enclosed by the hyperlink, drawn from the term name or mla_link_text parameter</td>
2089
  </tr>
2090
  <tr>
 
 
 
 
2091
  <td class="mla-doc-table-label">thelink</td>
2092
  <td>full hyperlink to the chosen destination as determined by the "link" and "mla_link_href" parameters</td>
2093
  </tr>
@@ -2190,14 +2248,14 @@ The "limit=10" parameter (on <strong>both</strong> shortcodes) limits the term d
2190
  <p>Now we'll make the cloud a convenient way to control a term-specific <code>[mla_gallery]</code>. The next step uses the "mla_link_href" parameter to change the link destination of each cloud term, returning to the current page with the term id of the selected term. We also add the "mla_cloud_current" parameter to each of these new links, so the tag cloud page is retained when a term is selected:
2191
  </p>
2192
  <p>
2193
- <code>[mla_tag_cloud taxonomy=attachment_category number=0 limit=10 mla_link_href="{+page_url+}?current_id={+term_id+}&amp;amp;mla_cloud_current={+request:mla_cloud_current+}"]<br />
2194
  [mla_tag_cloud taxonomy=attachment_category number=0 limit=10 mla_output="paginate_links,prev_next"]</code>
2195
  </p>
2196
  <p>
2197
- The "&amp;amp;" before the "mla_cloud_current" parameter is required to get by the WordPress Visual Editor. The "{+request:mla_cloud_current+}" value copies the current page number from the URL ($_REQUEST array) and adds it to each term's link. Now, let's use the "current_id={+term_id+}" information in the link to compose a term-specific <code>[mla_gallery]</code>:
2198
  </p>
2199
  <p>
2200
- <code>[mla_tag_cloud taxonomy=attachment_category number=0 limit=10 mla_link_href="{+page_url+}?current_id={+term_id+}&amp;amp;mla_cloud_current={+request:mla_cloud_current+}"]<br />
2201
  [mla_tag_cloud taxonomy=attachment_category number=0 limit=10 mla_output="paginate_links,prev_next"]
2202
  <br />&nbsp;<br />
2203
  [mla_gallery post_mime_type=all tax_query="array ( 0 => array ( 'taxonomy' => 'attachment_category', 'field' => 'id', 'terms' => array( {+request:current_id+} ), 'include_children' => false ) )" mla_caption="{+title+}" columns=5 size=icon link=file]</code>
@@ -2209,7 +2267,7 @@ The most complicated part of the new shortcode is the "tax_query" parameter, whi
2209
  We can easily paginate the term-specific gallery by adding a second <code>[mla_gallery]</code> shortcode and a "posts_per_page" parameter to both shortcodes:
2210
  </p>
2211
  <p>
2212
- <code>[mla_tag_cloud taxonomy=attachment_category number=0 limit=10 mla_link_href="{+page_url+}?current_id={+term_id+}&amp;amp;mla_cloud_current={+request:mla_cloud_current+}"]<br />
2213
  [mla_tag_cloud taxonomy=attachment_category number=0 limit=10 mla_output="paginate_links,prev_next"]
2214
  <br />&nbsp;<br />
2215
  [mla_gallery post_mime_type=all tax_query="array ( 0 => array ( 'taxonomy' => 'attachment_category', 'field' => 'id', 'terms' => array( {+request:current_id+} ), 'include_children' => false ) )" mla_caption="{+title+}" columns=5 posts_per_page=5 size=icon link=file]
@@ -2310,7 +2368,7 @@ The example code documents each hook with comments in the filter/action function
2310
  </p>
2311
  <h3>MLA Term List Shortcode</h3>
2312
  <p>
2313
- The <code>[mla_term_list]</code> shortcode function displays hierarchical taxonomy terms in a variety of formats; link lists, dropdown controls and checkbox lists. The list works with both flat (e.g., Att. Tags) and hierarchical taxonomies (e.g., Att. Categories) MLA Term List enhancements for lists and controls include:
2314
  </p>
2315
  <ul class="mla_settings">
2316
  <li>Full support for WordPress categories, tags and custom taxonomies. You can select from any taxonomy or list of taxonomies defined in your site.</li>
@@ -2539,11 +2597,51 @@ Three parameters provide control over the XHTML tags used to enclose each part o
2539
  </table>
2540
  <p>
2541
  These parameters give you some control over the markup used for the list and its elements. For more complex applications you can use style and markup templates to gain complete control over the list display.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2542
  <a name="term_list_display_content_afl"></a>
2543
  </p>
2544
  <h4>Term List Display Content (Array, Flat and List)</h4>
2545
  <p>
2546
- Eight parameters provide an easy way to control the contents of list items without requiring the use of custom Markup templates.
2547
  </p>
2548
  <table>
2549
  <tr>
@@ -2575,11 +2673,18 @@ Eight parameters provide an easy way to control the contents of list items witho
2575
  <td>replaces the caption text displayed beneath each item. The caption appears for "dlist" items and for "list" items when the "captiontag" parameter is present.</td>
2576
  </tr>
2577
  <tr>
 
 
 
 
2578
  <td class="mla-doc-table-label">mla_target</td>
2579
  <td>adds an HTML "target" attribute to the hyperlink for each gallery item; see below</td>
2580
  </tr>
2581
  </table>
2582
  <p>
 
 
 
2583
  All but the "mla_target" parameter support the <a href="#term_list_markup_parameters">Markup</a>, <a href="#term_list_item_parameters">Item-specific</a>, <a href="#term_list_variable_parameters">Field-level</a> and <a href="#mla_template_parameters">Content Template</a> substitution parameters defined for Markup Templates. For example, if you code "<code>mla_rollover_text='{+slug+} : {+rollover_text+}'</code>, the rollover text will contain the term slug, a colon, and the appropriate "single text" or "multiple text". Simply add "{+" before the substitution parameter name and add "+}" after the name. Note that the enclosing delimiters are different than those used in the templates, since the WordPress shortcode parser reserves square brackets ("[" and "]") for its own use.
2584
  </p>
2585
  <p>
@@ -2618,20 +2723,12 @@ Dropdown and Checklist formats do not generate hyperlinks; they generate HTML in
2618
  <td>replaces the entire control with text/markup; <strong>default empty</strong></td>
2619
  </tr>
2620
  <tr>
2621
- <td class="mla-doc-table-label">option_all_text</td>
2622
- <td>Text to display for showing an 'all terms' option. Default will not show an option to select 'all terms'.</td>
2623
- </tr>
2624
- <tr>
2625
- <td class="mla-doc-table-label">option_all_value</td>
2626
- <td>Control value for 'all terms' option. <strong>Default zero</strong>. Numeric values are used for the term_id; text values for the slug.</td>
2627
- </tr>
2628
- <tr>
2629
  <td class="mla-doc-table-label">option_none_text</td>
2630
- <td>Text to display for showing a 'no terms' option. Default will not show an option to select 'no terms'.</td>
2631
  </tr>
2632
  <tr>
2633
  <td class="mla-doc-table-label">option_none_value</td>
2634
- <td>Control value for 'no terms' option. <strong>Default -1</strong>. Numeric values are used for the term_id; text values for the slug.</td>
2635
  </tr>
2636
  </table>
2637
  <p>
@@ -3132,6 +3229,10 @@ Term list <strong>item-specific substitution parameters</strong> for the Markup
3132
  <td>the text enclosed by the hyperlink, drawn from the term name or mla_link_text parameter</td>
3133
  </tr>
3134
  <tr>
 
 
 
 
3135
  <td class="mla-doc-table-label">thelink</td>
3136
  <td>full hyperlink to the chosen destination as determined by the "link" and "mla_link_href" parameters</td>
3137
  </tr>
@@ -3677,6 +3778,10 @@ The <code>[mla_gallery]</code> shortcode can be used in combination with other g
3677
  <td>the name of the shortcode to be called for gallery format and display. You can code "mla_gallery" (recommended) or "no" to disable the alternate shortcode processing.</td>
3678
  </tr>
3679
  <tr>
 
 
 
 
3680
  <td class="mla-doc-table-label">mla_alt_ids_name</td>
3681
  <td>(optional, default "ids") the name of the parameter used to pass a list of attachment ID values to the alternate shortcode</td>
3682
  </tr>
@@ -4512,7 +4617,7 @@ Eight "format" values help you reformat fields or encode them for use in HTML at
4512
  </tr>
4513
  <tr>
4514
  <td class="mla-doc-table-label" style="white-space:nowrap">,kbmb(t,k,m,p)</td>
4515
- <td>Some data values, e.g., file size, are better expressed in kilobytes and megabytes. The "kbmb" format provides this conversion. There are four optional arguments; "t" (threshold), "k" (kilobyte suffix), "m" (megabyte suffix) and "p" (precision). The threshold argument (default 10240; ten kilobytes) sets the dividing amount between bytes and kilobytes. For example, a value of 1536 bytes would display as "1,536", not "1.50 KB" and 15360 bytes would display as "15.5 KB". The "k" and "m" arguments replace the default " KB" and/or " MB" suffix displayed following the numeric value. The "p" argument is the number of decimal places in the result, e.g., a value of 287,709 with a threshold of 1024 displays as "281", "281.0", "280.97", "280.966", or "280.9658" for precisions 0, 1, 2, 3 and 4.</td>
4516
  </tr>
4517
  <tr>
4518
  <td class="mla-doc-table-label" style="white-space:nowrap">,fraction(f,s)</td>
@@ -4950,6 +5055,16 @@ The native format of this data is somewhat complicated, so MLA converts the most
4950
  <td class="mla-doc-table-sublabel">Exposure time, given in seconds.</td>
4951
  </tr>
4952
  <tr>
 
 
 
 
 
 
 
 
 
 
4953
  <td class="mla-doc-table-label">ShutterSpeed<br />(from&nbsp;ExposureTime)</td>
4954
  <td class="mla-doc-table-sublabel">1.04, 1/250</td>
4955
  <td class="mla-doc-table-sublabel">Derived from ExposureTime and more often converted to the more useful "one over something" format.</td>
@@ -4960,13 +5075,8 @@ The native format of this data is somewhat complicated, so MLA converts the most
4960
  <td class="mla-doc-table-sublabel">The F Number.</td>
4961
  </tr>
4962
  <tr>
4963
- <td class="mla-doc-table-label">ExposureBiasValue</td>
4964
- <td class="mla-doc-table-sublabel">-1, +1/3</td>
4965
- <td class="mla-doc-table-sublabel">The exposure bias. The unit is the APEX value, usually in the range of -99.99 to 99.99.</td>
4966
- </tr>
4967
- <tr>
4968
  <td class="mla-doc-table-label">Flash</td>
4969
- <td class="mla-doc-table-sublabel">no, yes</td>
4970
  <td class="mla-doc-table-sublabel">The "flash fired" portion of the flash status.</td>
4971
  </tr>
4972
  <tr>
65
  <li><a href="#term_list_display_style_ldc">Term List Display Style (List, Dropdown and Checklist)</a></li>
66
  <li><a href="#term_list_display_style">Term List Display Style (List and Checklist)</a></li>
67
  <li><a href="#term_list_display_style_d">Term List Display Style (Dropdown)</a></li>
68
+ <li><a href="#term_list_display_content_all">Term List Display Content (all Output Formats)</a></li>
69
  <li><a href="#term_list_display_content_afl">Term List Display Content (Array, Flat and List)</a></li>
70
  <li><a href="#term_list_display_content">Term List Display Content (Dropdown and Checklist)</a></li>
71
  <li><a href="#term_list_other">Term List Other Parameters</a></li>
840
  In this example, "attachment_tag" is the WordPress taxonomy name/slug for the taxonomy. If you're using "Att. Category", the slug would be "attachment_category".
841
  </p>
842
  <p>
843
+ The default behavior of the simple taxonomy query will match any of the terms in the list. Three special values let you find all items, items that have no assigned terms in the taxonomy or any (one or more) assigned terms in the taxonomy. For example, to find items that have no Att. Tags or any Att. Tags you can code:
844
  </p>
845
  <ul class="mla_settings">
846
+ <li><code>[mla_gallery attachment_tag=ignore.terms.assigned]</code></li>
847
  <li><code>[mla_gallery attachment_tag=no.terms.assigned]</code></li>
848
+ <li><code>[mla_gallery attachment_tag=any.terms.assigned]</code></li>
849
+ </ul>
850
+ <p>
851
+ For applications using term id values instead of slugs three numeric synonyms are supported. For example, to find all items, items that have no Att. Tags or any Att. Tags you can code:
852
+ </p>
853
+ <ul class="mla_settings">
854
+ <li><code>[mla_gallery attachment_tag=-3]</code></li>
855
+ <li><code>[mla_gallery attachment_tag=-1]</code></li>
856
+ <li><code>[mla_gallery attachment_tag=-2]</code></li>
857
  </ul>
858
  <p>
859
  If you have two or more simple taxonomy queries, they will be joined by "AND". MLA enhances the simple taxonomy query form by providing three additional parameters:
941
  When embedding the shortcode in the body of a post, be very careful when coding the tax_query; it must be a valid PHP array specification. Read and follow the rules and guidelines in the "<a href="#complex_shortcodes">Entering Long/Complex Shortcodes</a>" Documentation section to get the results you want.
942
  </p>
943
  <p>
944
+ Three special "terms" values, "ignore.terms.assigned", "no.terms.assigned" and "any.terms.assigned", let you find all items, items that have no assigned terms in the taxonomy or any (one or more) assigned terms. For example, to find items that have no Att. Tags you can code:</p>
945
  <p><code>[mla_gallery]<br />
946
  tax_query="array(<br />
947
  &nbsp;&nbsp;&nbsp;&nbsp;array(<br />
948
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'taxonomy' =&gt; 'attachment_tag',<br />
 
949
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'terms' =&gt; 'no.terms.assigned'<br />
 
950
  &nbsp;&nbsp;&nbsp;&nbsp;)<br />
951
  )"<br />
952
  [/mla_gallery]
953
  </code></p>
954
  <p>
955
+ You can also use three numeric synonyms, '-3' for "ignore.terms.assigned", '-1' for "no.terms.assigned" and '-2' for "any.terms.assigned" in applications using numeric term id values in place of slugs.
956
+ </p>
957
+ <p>
958
+ When you code <code>'terms' =&gt; 'ignore.terms.assigned'</code> the entire tax_query will be ignored. When you code <code>'terms' =&gt; 'no.terms.assigned'</code> or <code>'terms' =&gt; 'any.terms.assigned'</code> the only other element you need is <code>taxonomy =&gt;</code>. There is no need for parameters like <code>'field' =&gt;</code> or <code>'operator' =&gt;</code> to get the proper results. The example uses use the <strong>"enclosing shortcode"</strong> format to avoid problems WordPress has in parsing parameters with special characters such as <code>=&gt;</code>.
959
  </p>
960
  <p>
961
  Remember to use <code>post_parent=current</code> if you want to restrict your query to items attached to the current post.
1451
  <td>The text size (default 22) of the tag with the highest count value (units given by the unit parameter).</td>
1452
  </tr>
1453
  <tr>
1454
+ <td class="mla-doc-table-label">default_size</td>
1455
+ <td>The text size (default 12) of the special links (all tags, no tags, any tags) (units given by the unit parameter).</td>
1456
+ </tr>
1457
+ <tr>
1458
  <td class="mla-doc-table-label">unit</td>
1459
  <td>Unit of measure as pertains to the smallest and largest values. This can be any CSS length value, e.g. pt (the default), px, em, %.</td>
1460
  </tr>
1618
  <td>replaces the caption text displayed beneath each item. The caption appears for "grid" items and for "list" items when the "captiontag" parameter is present.</td>
1619
  </tr>
1620
  <tr>
1621
+ <td class="mla-doc-table-label">mla_item_value</td>
1622
+ <td>replaces the <strong>term_id (default)</strong> value of the <code>current_item</code> hyperlink query argument.</td>
1623
+ </tr>
1624
+ <tr>
1625
  <td class="mla-doc-table-label">mla_target</td>
1626
  <td>adds an HTML "target" attribute to the hyperlink for each gallery item; see below</td>
1627
  </tr>
1628
+ <tr>
1629
+ <td class="mla-doc-table-label">&nbsp;</td>
1630
+ <td>&nbsp;</td>
1631
+ </tr>
1632
+ <tr>
1633
+ <td class="mla-doc-table-label">option_all_text</td>
1634
+ <td>Text to display for showing an 'all terms' link. Default will not show a link to select 'all terms'. When this option is selected all items, including items with no term assignments at all, are included in the results.</td>
1635
+ </tr>
1636
+ <tr>
1637
+ <td class="mla-doc-table-label">option_all_value</td>
1638
+ <td>Control value for 'all terms' option. <strong>Default '-3' or 'ignore.terms.assigned'</strong>. Numeric values are used for the term_id; text values for the slug. When this option is selected all items, including items with no term assignments at all, are included in the results.</td>
1639
+ </tr>
1640
+ <tr>
1641
+ <td class="mla-doc-table-label">option_no_terms_text</td>
1642
+ <td>Text to display for showing an 'no terms assigned' link. Default will not show a link to select 'no terms'. When this option is selected only those items with no term assignments at all are included in the results.</td>
1643
+ </tr>
1644
+ <tr>
1645
+ <td class="mla-doc-table-label">option_no_terms_value</td>
1646
+ <td>Control value for 'no terms' option. <strong>Default '-1' or 'no.terms.assigned'</strong>. Numeric values are used for the term_id; text values for the slug. When this option is selected only those items with no term assignments at all are included in the results.</td>
1647
+ </tr>
1648
+ <tr>
1649
+ <td class="mla-doc-table-label">option_any_terms_text</td>
1650
+ <td>Text to display for showing an 'any terms assigned' link. Default will not show a link to select 'any terms assigned'. When this option is selected only those items with one or more term assignments are included in the results.</td>
1651
+ </tr>
1652
+ <tr>
1653
+ <td class="mla-doc-table-label">option_any_terms_value</td>
1654
+ <td>Control value for 'any terms' option. <strong>Default '-2' or 'any.terms.assigned'</strong>. Numeric values are used for the term_id; text values for the slug. When this option is selected only those items with one or more term assignments are included in the results.</td>
1655
+ </tr>
1656
  </table>
1657
  <p>
1658
+ The "mla_item_value" parameter is the most commonly-used. For example, to set the <code>current_item</code> to the term slug instead of the term id you would code <code>mla_item_value="{+slug+}"</code>.
1659
+ </p>
1660
+ <p>
1661
  All but the "mla_target" parameter support the <a href="#tag_cloud_markup_parameters">Markup</a>, <a href="#tag_cloud_item_parameters">Item-specific</a>, <a href="#tag_cloud_variable_parameters">Field-level</a> and <a href="#mla_template_parameters">Content Template</a> substitution parameters defined for Markup Templates. For example, if you code "<code>mla_rollover_text='{+slug+} : {+rollover_text+}'</code>, the rollover text will contain the term slug, a colon, and the appropriate "single text" or "multiple text". Simply add "{+" before the substitution parameter name and add "+}" after the name. Note that the enclosing delimiters are different than those used in the templates, since the WordPress shortcode parser reserves square brackets ("[" and "]") for its own use.
1662
  </p>
1663
  <p>
1668
  </p>
1669
  <p>
1670
  The "mla_target" parameter accepts any value and adds an HTML "target" attribute to the hyperlink with that value. For example, if you code <code>mla_target="_blank"</code> the item will open in a new window or tab. You can also use "_self", "_parent", "_top" or the "<em>framename</em>" of a named frame.
1671
+ </p>
1672
+ <p>
1673
+ The six "option_..." parameters provide an easy way to add special links to the cloud generated by the shortcode. You can add links for selecting all items, items that have no term assignments at all and/or items that have one or more assignments to any term(s) in the taxonomy. The default values for these links are compatible with the simple taxonomy query and tax_query parameters of the <code>[mla_gallery]</code> shortcode.
1674
  <a name="tag_cloud_data_selection"></a>
1675
  </p>
1676
  <h4>Tag Cloud Data Selection Parameters</h4>
2142
  <td>the text enclosed by the hyperlink, drawn from the term name or mla_link_text parameter</td>
2143
  </tr>
2144
  <tr>
2145
+ <td class="mla-doc-table-label">thevalue</td>
2146
+ <td>term id (default), slug or other value as determined by the "mla_item_value" parameter</td>
2147
+ </tr>
2148
+ <tr>
2149
  <td class="mla-doc-table-label">thelink</td>
2150
  <td>full hyperlink to the chosen destination as determined by the "link" and "mla_link_href" parameters</td>
2151
  </tr>
2248
  <p>Now we'll make the cloud a convenient way to control a term-specific <code>[mla_gallery]</code>. The next step uses the "mla_link_href" parameter to change the link destination of each cloud term, returning to the current page with the term id of the selected term. We also add the "mla_cloud_current" parameter to each of these new links, so the tag cloud page is retained when a term is selected:
2249
  </p>
2250
  <p>
2251
+ <code>[mla_tag_cloud taxonomy=attachment_category number=0 limit=10 mla_link_href="{+page_url+}?current_id={+term_id+}&amp;amp;mla_cloud_current={+template:({+request:mla_cloud_current+})|1+}"]<br />
2252
  [mla_tag_cloud taxonomy=attachment_category number=0 limit=10 mla_output="paginate_links,prev_next"]</code>
2253
  </p>
2254
  <p>
2255
+ The "&amp;amp;" before the "mla_cloud_current" parameter is required to get by the WordPress Visual Editor. The "{+request:mla_cloud_current+}" value copies the current page number from the URL ($_REQUEST array) and adds it to each term's link. If the current page number is absent (e.g., on the initial page load) the default value is 1. Now, let's use the "current_id={+term_id+}" information in the link to compose a term-specific <code>[mla_gallery]</code>:
2256
  </p>
2257
  <p>
2258
+ <code>[mla_tag_cloud taxonomy=attachment_category number=0 limit=10 mla_link_href="{+page_url+}?current_id={+term_id+}&amp;amp;mla_cloud_current={+template:({+request:mla_cloud_current+})|1+}"]<br />
2259
  [mla_tag_cloud taxonomy=attachment_category number=0 limit=10 mla_output="paginate_links,prev_next"]
2260
  <br />&nbsp;<br />
2261
  [mla_gallery post_mime_type=all tax_query="array ( 0 => array ( 'taxonomy' => 'attachment_category', 'field' => 'id', 'terms' => array( {+request:current_id+} ), 'include_children' => false ) )" mla_caption="{+title+}" columns=5 size=icon link=file]</code>
2267
  We can easily paginate the term-specific gallery by adding a second <code>[mla_gallery]</code> shortcode and a "posts_per_page" parameter to both shortcodes:
2268
  </p>
2269
  <p>
2270
+ <code>[mla_tag_cloud taxonomy=attachment_category number=0 limit=10 mla_link_href="{+page_url+}?current_id={+term_id+}&amp;amp;mla_cloud_current={+template:({+request:mla_cloud_current+})|1+}"]<br />
2271
  [mla_tag_cloud taxonomy=attachment_category number=0 limit=10 mla_output="paginate_links,prev_next"]
2272
  <br />&nbsp;<br />
2273
  [mla_gallery post_mime_type=all tax_query="array ( 0 => array ( 'taxonomy' => 'attachment_category', 'field' => 'id', 'terms' => array( {+request:current_id+} ), 'include_children' => false ) )" mla_caption="{+title+}" columns=5 posts_per_page=5 size=icon link=file]
2368
  </p>
2369
  <h3>MLA Term List Shortcode</h3>
2370
  <p>
2371
+ The <code>[mla_term_list]</code> shortcode function displays hierarchical taxonomy terms in a variety of formats; link lists, dropdown controls and checkbox lists. The list works with both flat (e.g., Att. Tags) and hierarchical taxonomies (e.g., Att. Categories). MLA Term List enhancements for lists and controls include:
2372
  </p>
2373
  <ul class="mla_settings">
2374
  <li>Full support for WordPress categories, tags and custom taxonomies. You can select from any taxonomy or list of taxonomies defined in your site.</li>
2597
  </table>
2598
  <p>
2599
  These parameters give you some control over the markup used for the list and its elements. For more complex applications you can use style and markup templates to gain complete control over the list display.
2600
+ <a name="term_list_display_content_all"></a>
2601
+ </p>
2602
+ <h4>Term List Display Content (all Output Formats)</h4>
2603
+ <p>
2604
+ Six parameters provide an easy way to add special entries to the links or input controls generated by the shortcode. You can add entries for selecting all items, items that have no term assignments at all and/or items that have one or more assignments to any term(s) in the taxonomy. The default values for these entries are compatible with the simple taxonomy query and tax_query parameters of the <code>[mla_gallery]</code> shortcode.
2605
+ </p>
2606
+ <table>
2607
+ <tr>
2608
+ <td class="mla-doc-table-label">option_all_text</td>
2609
+ <td>Text to display for showing an 'all terms' option. Default will not show an option to select 'all terms'. When this option is selected all items, including items with no term assignments at all, are included in the results.</td>
2610
+ </tr>
2611
+ <tr>
2612
+ <td class="mla-doc-table-label">option_all_value</td>
2613
+ <td>Control value for 'all terms' option. <strong>Default '-3' or 'ignore.terms.assigned'</strong>. Numeric values are used for the term_id; text values for the slug. When this option is selected all items, including items with no term assignments at all, are included in the results.</td>
2614
+ </tr>
2615
+ <tr>
2616
+ <td class="mla-doc-table-label">option_no_terms_text</td>
2617
+ <td>Text to display for showing an 'no terms assigned' option. Default will not show an option to select 'no terms'. When this option is selected only those items with no term assignments at all are included in the results.</td>
2618
+ </tr>
2619
+ <tr>
2620
+ <td class="mla-doc-table-label">option_no_terms_value</td>
2621
+ <td>Control value for 'no terms' option. <strong>Default '-1' or 'no.terms.assigned'</strong>. Numeric values are used for the term_id; text values for the slug. When this option is selected only those items with no term assignments at all are included in the results.</td>
2622
+ </tr>
2623
+ <tr>
2624
+ <td class="mla-doc-table-label">option_any_terms_text</td>
2625
+ <td>Text to display for showing an 'any terms assigned' option. Default will not show an option to select 'any terms assigned'. When this option is selected only those items with one or more term assignments are included in the results.</td>
2626
+ </tr>
2627
+ <tr>
2628
+ <td class="mla-doc-table-label">option_any_terms_value</td>
2629
+ <td>Control value for 'any terms' option. <strong>Default '-2' or 'any.terms.assigned'</strong>. Numeric values are used for the term_id; text values for the slug. When this option is selected only those items with one or more term assignments are included in the results.</td>
2630
+ </tr>
2631
+ </table>
2632
+ <p>
2633
+ The "mla_debug" parameter controls the display of information about the query parameters and SQL statements used to retrieve list items. If you code <code>mla_debug=true</code> you will see a lot of information added to the post or page containing the list. Of course, this parameter should <strong><em>ONLY</em></strong> be used in a development/debugging environment; it's quite ugly.
2634
+ </p>
2635
+ <p>
2636
+ If you code <code>mla_debug=log</code> all of the information will be written to the error log. You can use the <a href="#mla_debug_tab">MLA Debug Tab</a> to view and download the information in the error log.
2637
+ </p>
2638
+ <p>
2639
+ Look for the "mla_debug attribute_errors" entry in the debug output; it will often list the parts of the shortcode parameters that couldn&rsquo;t be parsed. If you see "[mla_gallery" in this entry you probably used the enclosing shortcode format in that shortcode but did not add the "[/mla_gallery]" delimiter to an earlier shortcode.
2640
  <a name="term_list_display_content_afl"></a>
2641
  </p>
2642
  <h4>Term List Display Content (Array, Flat and List)</h4>
2643
  <p>
2644
+ Nine parameters provide an easy way to control the contents of list items without requiring the use of custom Markup templates.
2645
  </p>
2646
  <table>
2647
  <tr>
2673
  <td>replaces the caption text displayed beneath each item. The caption appears for "dlist" items and for "list" items when the "captiontag" parameter is present.</td>
2674
  </tr>
2675
  <tr>
2676
+ <td class="mla-doc-table-label">mla_item_value</td>
2677
+ <td>replaces the <strong>term_id (default)</strong> value of the <code>current_item</code> hyperlink query argument.</td>
2678
+ </tr>
2679
+ <tr>
2680
  <td class="mla-doc-table-label">mla_target</td>
2681
  <td>adds an HTML "target" attribute to the hyperlink for each gallery item; see below</td>
2682
  </tr>
2683
  </table>
2684
  <p>
2685
+ The "mla_item_value" parameter is the most commonly-used. For example, to set the <code>current_item</code> to the term slug instead of the term id you would code <code>mla_item_value="{+slug+}"</code>.
2686
+ </p>
2687
+ <p>
2688
  All but the "mla_target" parameter support the <a href="#term_list_markup_parameters">Markup</a>, <a href="#term_list_item_parameters">Item-specific</a>, <a href="#term_list_variable_parameters">Field-level</a> and <a href="#mla_template_parameters">Content Template</a> substitution parameters defined for Markup Templates. For example, if you code "<code>mla_rollover_text='{+slug+} : {+rollover_text+}'</code>, the rollover text will contain the term slug, a colon, and the appropriate "single text" or "multiple text". Simply add "{+" before the substitution parameter name and add "+}" after the name. Note that the enclosing delimiters are different than those used in the templates, since the WordPress shortcode parser reserves square brackets ("[" and "]") for its own use.
2689
  </p>
2690
  <p>
2723
  <td>replaces the entire control with text/markup; <strong>default empty</strong></td>
2724
  </tr>
2725
  <tr>
 
 
 
 
 
 
 
 
2726
  <td class="mla-doc-table-label">option_none_text</td>
2727
+ <td>Text to display for showing a 'no terms' option, displayed when there are no terms defined in the taxonomy. Default will not show an option to select 'no terms'.</td>
2728
  </tr>
2729
  <tr>
2730
  <td class="mla-doc-table-label">option_none_value</td>
2731
+ <td>Control value for 'no terms' option, displayed when there are no terms defined in the taxonomy. <strong>Default -1</strong>. Numeric values are used for the term_id; text values for the slug.</td>
2732
  </tr>
2733
  </table>
2734
  <p>
3229
  <td>the text enclosed by the hyperlink, drawn from the term name or mla_link_text parameter</td>
3230
  </tr>
3231
  <tr>
3232
+ <td class="mla-doc-table-label">thevalue</td>
3233
+ <td>term id (default), slug or other value as determined by the "mla_item_value" parameter</td>
3234
+ </tr>
3235
+ <tr>
3236
  <td class="mla-doc-table-label">thelink</td>
3237
  <td>full hyperlink to the chosen destination as determined by the "link" and "mla_link_href" parameters</td>
3238
  </tr>
3778
  <td>the name of the shortcode to be called for gallery format and display. You can code "mla_gallery" (recommended) or "no" to disable the alternate shortcode processing.</td>
3779
  </tr>
3780
  <tr>
3781
+ <td class="mla-doc-table-label">mla_alt_parameters</td>
3782
+ <td>(optional, default empty) parameters that would normally be processed by <code>[mla_gallery]</code> and not passed through to the alternate shortcode. For example, if the alternate shortcode is "mla_tag_cloud" or "mla_term_list" you might use this parameter to pass <code>post_mime_type=</code> or <code>mla_debug=</code> on to the alternate shortcode.</td>
3783
+ </tr>
3784
+ <tr>
3785
  <td class="mla-doc-table-label">mla_alt_ids_name</td>
3786
  <td>(optional, default "ids") the name of the parameter used to pass a list of attachment ID values to the alternate shortcode</td>
3787
  </tr>
4617
  </tr>
4618
  <tr>
4619
  <td class="mla-doc-table-label" style="white-space:nowrap">,kbmb(t,k,m,p)</td>
4620
+ <td>Some data values, e.g., file size, are better expressed in kilobytes and megabytes. The "kbmb" format provides this conversion. There are four optional arguments; "t" (threshold), "k" (kilobyte suffix), "m" (megabyte suffix) and "p" (precision). The threshold argument (default 10240; ten kilobytes) sets the dividing amount between bytes and kilobytes. For example, a value of 1536 bytes would display as "1,536", not "1.50 KB" and 15360 bytes would display as "15.5 KB". The "k" and "m" arguments replace the default " KB" and/or " MB" suffix displayed following the numeric value. The "p" argument is the number of decimal places in the result, e.g., a value of 287,709 with a threshold of 1024 displays as "281", "281.0", "280.97", "280.966", or "280.9658" for precisions 0, 1, 2, 3 and 4.<br />&nbsp;<br />If the "k" argument is empty and the "m" argument is present all numbers above the threshold will be displayed in megabytes. For example, the value ",kbmb(10240,,Mb)" or ",kbmb(10240,'',Mb)" would display 15360 bytes "0.015Mb".</td>
4621
  </tr>
4622
  <tr>
4623
  <td class="mla-doc-table-label" style="white-space:nowrap">,fraction(f,s)</td>
5055
  <td class="mla-doc-table-sublabel">Exposure time, given in seconds.</td>
5056
  </tr>
5057
  <tr>
5058
+ <td class="mla-doc-table-label">ExposureBiasValue</td>
5059
+ <td class="mla-doc-table-sublabel">-1, +1/3</td>
5060
+ <td class="mla-doc-table-sublabel">The exposure bias. The unit is the APEX value, usually in the range of -99.99 to 99.99.</td>
5061
+ </tr>
5062
+ <tr>
5063
+ <td class="mla-doc-table-label">ExposureMode</td>
5064
+ <td class="mla-doc-table-sublabel">Auto, Manual, Bracket</td>
5065
+ <td class="mla-doc-table-sublabel">The exposure mode.</td>
5066
+ </tr>
5067
+ <tr>
5068
  <td class="mla-doc-table-label">ShutterSpeed<br />(from&nbsp;ExposureTime)</td>
5069
  <td class="mla-doc-table-sublabel">1.04, 1/250</td>
5070
  <td class="mla-doc-table-sublabel">Derived from ExposureTime and more often converted to the more useful "one over something" format.</td>
5075
  <td class="mla-doc-table-sublabel">The F Number.</td>
5076
  </tr>
5077
  <tr>
 
 
 
 
 
5078
  <td class="mla-doc-table-label">Flash</td>
5079
+ <td class="mla-doc-table-sublabel">No, Yes</td>
5080
  <td class="mla-doc-table-sublabel">The "flash fired" portion of the flash status.</td>
5081
  </tr>
5082
  <tr>