Media Library Assistant - Version 2.73

Version Description

  • New: The (optional) "checklist-style" formatting of flat taxonomies has been extended to the Media/Assistant Quick Edit and Bulk Edit areas.
  • New: The (optional) "checked-on-top" formatting of checklist taxonomies has been extended to the Media/Assistant Quick Edit and Bulk Edit areas.
  • New: A new "MLA Parent Search Example" plugin has been added. It adds a parent: prefix to the Media/Assistant Search Media text box that allows searches for items whose parent post/page matches the specified values.
  • New: A new "MLA JavaScript Example" plugin has been added. It shows a simple method of adding and localizing scripts, using the WP Featherlight lightbox plugin as a sample application.
  • New: For the [mla_gallery] shortcode, the post_type and post_status parameters now accept multiple values.
  • Fix: For the Media/Assistant admin submenu, the correct SERVER_URI value is now generated for multisite and "subdirectory" WordPress installs.
  • Fix: For "checklist style" flat taxonomy metaboxes, terms with quote marks in the name are now handled properly.
  • Fix: For the [mla_tag_cloud] shortcode, the "Tag Cloud Pagination Parameters" have been restored.
  • Fix: Restore Admin Columns Pro "default column" support for columns such as EXIF values.
Download this release

Release Info

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

Code changes from version 2.72 to 2.73

css/mla-add-new-bulk-edit-rtl.css CHANGED
@@ -174,10 +174,6 @@
174
  margin-right: 18px;
175
  }
176
 
177
- #mla-add-new-bulk-edit-div span.catshow {
178
- display: none;
179
- }
180
-
181
  #mla-add-new-bulk-edit-div fieldset ul.cat-checklist li,
182
  #mla-add-new-bulk-edit-div fieldset ul.cat-checklist input {
183
  margin: 0;
174
  margin-right: 18px;
175
  }
176
 
 
 
 
 
177
  #mla-add-new-bulk-edit-div fieldset ul.cat-checklist li,
178
  #mla-add-new-bulk-edit-div fieldset ul.cat-checklist input {
179
  margin: 0;
css/mla-add-new-bulk-edit.css CHANGED
@@ -174,10 +174,6 @@
174
  margin-left: 18px;
175
  }
176
 
177
- #mla-add-new-bulk-edit-div span.catshow {
178
- display: none;
179
- }
180
-
181
  #mla-add-new-bulk-edit-div fieldset ul.cat-checklist li,
182
  #mla-add-new-bulk-edit-div fieldset ul.cat-checklist input {
183
  margin: 0;
174
  margin-left: 18px;
175
  }
176
 
 
 
 
 
177
  #mla-add-new-bulk-edit-div fieldset ul.cat-checklist li,
178
  #mla-add-new-bulk-edit-div fieldset ul.cat-checklist input {
179
  margin: 0;
css/mla-style-rtl.css CHANGED
@@ -95,11 +95,6 @@ div.mla_errors {
95
  line-height: 1.2
96
  }
97
 
98
- .quick-edit-row-attachment fieldset.inline-edit-col-center span.catshow,
99
- .bulk-edit-row-attachment fieldset.inline-edit-col-center span.catshow {
100
- display: none
101
- }
102
-
103
  .quick-edit-row-attachment fieldset.inline-edit-col-left label span.input-text-wrap,
104
  .quick-edit-row-attachment fieldset.inline-edit-col-right label span.input-text-wrap,
105
  .bulk-edit-row-attachment fieldset.inline-edit-col-right label span.input-text-wrap {
95
  line-height: 1.2
96
  }
97
 
 
 
 
 
 
98
  .quick-edit-row-attachment fieldset.inline-edit-col-left label span.input-text-wrap,
99
  .quick-edit-row-attachment fieldset.inline-edit-col-right label span.input-text-wrap,
100
  .bulk-edit-row-attachment fieldset.inline-edit-col-right label span.input-text-wrap {
css/mla-style.css CHANGED
@@ -95,11 +95,6 @@ div.mla_errors {
95
  line-height: 1.2
96
  }
97
 
98
- .quick-edit-row-attachment fieldset.inline-edit-col-center span.catshow,
99
- .bulk-edit-row-attachment fieldset.inline-edit-col-center span.catshow {
100
- display: none
101
- }
102
-
103
  .quick-edit-row-attachment fieldset.inline-edit-col-left label span.input-text-wrap,
104
  .quick-edit-row-attachment fieldset.inline-edit-col-right label span.input-text-wrap,
105
  .bulk-edit-row-attachment fieldset.inline-edit-col-right label span.input-text-wrap {
95
  line-height: 1.2
96
  }
97
 
 
 
 
 
 
98
  .quick-edit-row-attachment fieldset.inline-edit-col-left label span.input-text-wrap,
99
  .quick-edit-row-attachment fieldset.inline-edit-col-right label span.input-text-wrap,
100
  .bulk-edit-row-attachment fieldset.inline-edit-col-right label span.input-text-wrap {
examples/plugins/mla-custom-field-search-example.php CHANGED
@@ -170,7 +170,7 @@ class MLACustomFieldSearchExample {
170
  if ( isset( self::$custom_field_parameters['debug'] ) ) {
171
  MLAData::$query_parameters['debug'] = self::$custom_field_parameters['debug'];
172
  MLAData::$search_parameters['debug'] = self::$custom_field_parameters['debug'];
173
- MLA::mla_debug_mode( self::$custom_field_parameters['debug'] );
174
  }
175
 
176
  // Apply default field name?
170
  if ( isset( self::$custom_field_parameters['debug'] ) ) {
171
  MLAData::$query_parameters['debug'] = self::$custom_field_parameters['debug'];
172
  MLAData::$search_parameters['debug'] = self::$custom_field_parameters['debug'];
173
+ MLACore::mla_debug_mode( self::$custom_field_parameters['debug'] );
174
  }
175
 
176
  // Apply default field name?
examples/plugins/mla-javascript-example/mla-javascript-example.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Enqueues a JavaScript file with some WP Featherlight plugin enhancements
4
+ *
5
+ * In this example, a small JavaScript file is used to enhance the captions displayed
6
+ * by the WP Featherlight lightbox/gallery plugin (https://wordpress.org/plugins/wp-featherlight/).
7
+ *
8
+ * To activate the lightbox nd enhanced captions, add the following parameter to your [mla_gallery] shortcode:
9
+ *
10
+ * mla_link_attributes='data-featherlight="image" mla-caption="{+post_excerpt,attr+}"'
11
+ *
12
+ * Created for support topic "limit caption length"
13
+ * opened on 3/7/2018 by "customle".
14
+ * https://wordpress.org/support/topic/limit-caption-length/
15
+ *
16
+ * @package MLA JavaScript Example
17
+ * @version 1.00
18
+ */
19
+
20
+ /*
21
+ Plugin Name: MLA JavaScript Example
22
+ Plugin URI: http://fairtradejudaica.org/media-library-assistant-a-wordpress-plugin/
23
+ Description: Enqueues a JavaScript file with some WP Featherlight plugin enhancements
24
+ Author: David Lingren
25
+ Version: 1.00
26
+ Author URI: http://fairtradejudaica.org/our-story/staff/
27
+
28
+ Copyright 2018 David Lingren
29
+
30
+ This program is free software; you can redistribute it and/or modify
31
+ it under the terms of the GNU General Public License as published by
32
+ the Free Software Foundation; either version 2 of the License, or
33
+ (at your option) any later version.
34
+
35
+ This program is distributed in the hope that it will be useful,
36
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
37
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38
+ GNU General Public License for more details.
39
+
40
+ You can get a copy of the GNU General Public License by writing to the
41
+ Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
42
+ */
43
+
44
+ /**
45
+ * Class MLA Copy Item Example adds a "Copy" bulk action and makes copies of existing items.
46
+ *
47
+ * @package MLA Copy Item Example
48
+ * @since 1.00
49
+ */
50
+ class MLAJavaScriptExample {
51
+ /**
52
+ * Uniquely identifies the example plugin
53
+ *
54
+ * @since 1.00
55
+ *
56
+ * @var string
57
+ */
58
+ const MLA_PLUGIN_SLUG = 'mla-javascript-example';
59
+
60
+ /**
61
+ * Initialization function, similar to __construct()
62
+ *
63
+ * @since 1.00
64
+ */
65
+ public static function initialize() {
66
+ // The filters are only useful in the front end section
67
+ if ( is_admin() )
68
+ return;
69
+
70
+ // Defined in /wp-content/plugins/wp-featherlight/includes/class-scripts.php
71
+ add_filter( 'wp_featherlight_captions', 'MLAJavaScriptExample::wp_featherlight_captions', 10, 1 );
72
+
73
+ // Defined in /wp-includes/script-loader.php
74
+ add_action( 'wp_enqueue_scripts', 'MLAJavaScriptExample::wp_enqueue_scripts', 10, 0 );
75
+ }
76
+
77
+ /**
78
+ * Disable WP Featherlight's lightbox captions
79
+ *
80
+ * @since 1.00
81
+ *
82
+ * @return boolean true to allow captions, false to disable them
83
+ */
84
+ public static function wp_featherlight_captions( $captions ) {
85
+ return false;
86
+ }
87
+
88
+ /**
89
+ * Load the plugin's Style Sheet and Javascript files
90
+ *
91
+ * @since 1.00
92
+ *
93
+ * @return void
94
+ */
95
+ public static function wp_enqueue_scripts() {
96
+ $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
97
+
98
+ /* This code loads CSS style sheet(s), if needed * /
99
+ global $wp_locale;
100
+ if ( $wp_locale->is_rtl() ) {
101
+ wp_register_style( self::MLA_PLUGIN_SLUG . '-css', plugin_dir_url( __FILE__ ) . 'mla-javascript-rtl.css', false, MLACore::CURRENT_MLA_VERSION );
102
+ } else {
103
+ wp_register_style( self::MLA_PLUGIN_SLUG . '-css', plugin_dir_url( __FILE__ ) . 'mla-javascript.css', false, MLACore::CURRENT_MLA_VERSION );
104
+ }
105
+
106
+ wp_enqueue_style( self::MLA_PLUGIN_SLUG . '-css' );
107
+ // */
108
+
109
+ wp_enqueue_script( self::MLA_PLUGIN_SLUG . '-js', plugin_dir_url( __FILE__ ) . "mla-javascript{$suffix}.js",
110
+ array( 'jquery' ), MLACore::CURRENT_MLA_VERSION, false );
111
+
112
+ $script_variables = array(
113
+ 'fullCaptionId' => 'mla-caption',
114
+ );
115
+
116
+ wp_localize_script( self::MLA_PLUGIN_SLUG . '-js', 'mla_javascript_example_vars', $script_variables );
117
+ } // wp_enqueue_scripts
118
+ } // Class MLAJavaScriptExample
119
+
120
+ // Install the filters at an early opportunity
121
+ add_action('init', 'MLAJavaScriptExample::initialize');
122
+ ?>
examples/plugins/mla-javascript-example/mla-javascript-rtl.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ @charset "utf-8";
2
+ /**
3
+ * CSS Document
4
+ *
5
+ * This file contains styling attributes for the MLA JavaScript Example plugin
6
+ */
7
+
8
+ #mla-example-style {
9
+ text-align:right;
10
+ }
11
+
examples/plugins/mla-javascript-example/mla-javascript.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ @charset "utf-8";
2
+ /**
3
+ * CSS Document
4
+ *
5
+ * This file contains styling attributes for the MLA JavaScript Example plugin
6
+ */
7
+
8
+ #mla-example-style {
9
+ text-align:left;
10
+ }
11
+
examples/plugins/mla-javascript-example/mla-javascript.js ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global ajaxurl */
2
+
3
+ var jQuery,
4
+ mla_javascript_example_vars,
5
+ mlaJavaScriptExample = {
6
+ // Properties
7
+ // mlaJavaScriptExample.settings.fullCaptionId
8
+ settings: {},
9
+
10
+ // Utility functions, if any
11
+ utility: {
12
+ example : function() {
13
+ }
14
+ },
15
+
16
+ // Components
17
+ featherlightCaption: null
18
+ };
19
+
20
+ ( function( $ ) {
21
+ "use strict";
22
+
23
+ /**
24
+ * Localized settings and strings
25
+ */
26
+ mlaJavaScriptExample.settings = typeof mla_javascript_example_vars === 'undefined' ? {} : mla_javascript_example_vars;
27
+ mla_javascript_example_vars = void 0; // delete won't work on Globals
28
+
29
+ mlaJavaScriptExample.featherlightCaption = {
30
+ init : function(){
31
+ $.featherlight.defaults.afterContent = mlaJavaScriptExample.featherlightCaption.mlaCaption;
32
+ },
33
+
34
+ mlaCaption : function() {
35
+ var object = this.$instance,
36
+ target = this.$currentTarget,
37
+ caption = target.attr( mlaJavaScriptExample.settings.fullCaptionId );
38
+
39
+ object.find( '.caption' ).remove();
40
+ if ( ( typeof caption !== 'undefined' ) && ( 0 !== caption.length ) ) {
41
+ var $captionElm = $( '<div class="caption">' ).appendTo( object.find( '.featherlight-content' ) );
42
+ $captionElm[0].innerHTML = caption;
43
+ }
44
+ }
45
+ }; // mlaJavaScriptExample.featherlightCaption
46
+
47
+ $( document ).ready( function() {
48
+ mlaJavaScriptExample.featherlightCaption.init();
49
+ });
50
+ })( jQuery );
examples/plugins/mla-javascript-example/mla-javascript.min.js ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global ajaxurl */
2
+
3
+ var jQuery,
4
+ mla_javascript_example_vars,
5
+ mlaJavaScriptExample = {
6
+ // Properties
7
+ // mlaJavaScriptExample.settings.fullCaptionId
8
+ settings: {},
9
+
10
+ // Utility functions, if any
11
+ utility: {
12
+ example : function() {
13
+ }
14
+ },
15
+
16
+ // Components
17
+ featherlightCaption: null
18
+ };
19
+
20
+ ( function( $ ) {
21
+ "use strict";
22
+
23
+ /**
24
+ * Localized settings and strings
25
+ */
26
+ mlaJavaScriptExample.settings = typeof mla_javascript_example_vars === 'undefined' ? {} : mla_javascript_example_vars;
27
+ mla_javascript_example_vars = void 0; // delete won't work on Globals
28
+
29
+ mlaJavaScriptExample.featherlightCaption = {
30
+ init : function(){
31
+ $.featherlight.defaults.afterContent = mlaJavaScriptExample.featherlightCaption.mlaCaption;
32
+ },
33
+
34
+ mlaCaption : function() {
35
+ var object = this.$instance,
36
+ target = this.$currentTarget,
37
+ caption = target.attr( mlaJavaScriptExample.settings.fullCaptionId );
38
+
39
+ object.find( '.caption' ).remove();
40
+ if ( ( typeof caption !== 'undefined' ) && ( 0 !== caption.length ) ) {
41
+ var $captionElm = $( '<div class="caption">' ).appendTo( object.find( '.featherlight-content' ) );
42
+ $captionElm[0].innerHTML = caption;
43
+ }
44
+ }
45
+ }; // mlaJavaScriptExample.featherlightCaption
46
+
47
+ $( document ).ready( function() {
48
+ mlaJavaScriptExample.featherlightCaption.init();
49
+ });
50
+ })( jQuery );
examples/plugins/mla-parent-search-example.php ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Extends the Media/Assistant "Search Media" box to "parent" post/page values
4
+ *
5
+ * In this example, a "parent:" prefix is detected in the Media/Assistant "search media" text
6
+ * box and the Media Manager Modal (popup) Window. The search is modified to query posts and
7
+ * pages for matching objects. Then, the ID values of the matching objects are used to find
8
+ * Media Library items by matching the post_parent database field.
9
+ *
10
+ * This example plugin uses four of the many filters available in the Media/Assistant Submenu
11
+ * and illustrates some of the techniques you can use to customize the submenu table display.
12
+ *
13
+ * Created for support topic "Search wordpress media library by attached post title"
14
+ * opened on 2/11/2018 by "norbou".
15
+ * https://wordpress.org/support/topic/search-wordpress-media-library-by-attached-post-title/
16
+ *
17
+ * @package MLA Parent Search Example
18
+ * @version 1.00
19
+ */
20
+
21
+ /*
22
+ Plugin Name: MLA Parent Search Example
23
+ Plugin URI: http://fairtradejudaica.org/media-library-assistant-a-wordpress-plugin/
24
+ Description: Extends the Media/Assistant "Search Media" box to custom field values
25
+ Author: David Lingren
26
+ Version: 1.00
27
+ Author URI: http://fairtradejudaica.org/our-story/staff/
28
+
29
+ Copyright 2018 David Lingren
30
+
31
+ This program is free software; you can redistribute it and/or modify
32
+ it under the terms of the GNU General Public License as published by
33
+ the Free Software Foundation; either version 2 of the License, or
34
+ (at your option) any later version.
35
+
36
+ This program is distributed in the hope that it will be useful,
37
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
38
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39
+ GNU General Public License for more details.
40
+
41
+ You can get a copy of the GNU General Public License by writing to the
42
+ Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
43
+ */
44
+
45
+ /**
46
+ * Class MLA Parent Search Example extends the Media/Assistant "Search Media" box
47
+ * to custom field values
48
+ *
49
+ * @package MLA Parent Search Example
50
+ * @since 1.00
51
+ */
52
+ class MLAParentSearchExample {
53
+ /**
54
+ * Initialization function, similar to __construct()
55
+ *
56
+ * @since 1.00
57
+ *
58
+ * @return void
59
+ */
60
+ public static function initialize() {
61
+ // The filters are only useful for the admin section; exit in the front-end posts/pages
62
+ if ( ! is_admin() )
63
+ return;
64
+
65
+ // Defined in /media-library-assistant/includes/class-mla-main.php
66
+ add_filter( 'mla_list_table_new_instance', 'MLAParentSearchExample::mla_list_table_new_instance', 10, 1 );
67
+
68
+ // Defined in /media-library-assistant/includes/class-mla-data.php
69
+ add_filter( 'mla_list_table_query_final_terms', 'MLAParentSearchExample::mla_list_table_query_final_terms', 10, 1 );
70
+
71
+ // Defined in /media-library-assistant/includes/class-mla-media-modal.php
72
+ add_filter( 'mla_media_modal_query_initial_terms', 'MLAParentSearchExample::mla_media_modal_query_initial_terms', 10, 2 );
73
+
74
+ // Defined in /media-library-assistant/includes/class-mla-data.php
75
+ add_filter( 'mla_media_modal_query_final_terms', 'MLAParentSearchExample::mla_media_modal_query_final_terms', 10, 1 );
76
+ }
77
+
78
+ /**
79
+ * Extend the MLA_List_Table class
80
+ *
81
+ * This filter gives you an opportunity to extend the MLA_List_Table class.
82
+ * You can also use this filter to inspect or modify any of the $_REQUEST arguments.
83
+ *
84
+ * @since 1.00
85
+ *
86
+ * @param object $mla_list_table NULL, to indicate no extension/use the base class.
87
+ *
88
+ * @return object updated mla_list_table object.
89
+ */
90
+ public static function mla_list_table_new_instance( $mla_list_table ) {
91
+ /*
92
+ * Look for the special "parent:" prefix in the Search Media text box,
93
+ * after checking for the "debug" prefixes.
94
+ */
95
+ if ( isset( $_REQUEST['s'] ) ) {
96
+ switch ( substr( $_REQUEST['s'], 0, 3 ) ) {
97
+ case '>|<':
98
+ self::$parent_search_parameters['debug'] = 'console';
99
+ $start = 3;
100
+ break;
101
+ case '<|>':
102
+ self::$parent_search_parameters['debug'] = 'log';
103
+ $start = 3;
104
+ break;
105
+ default:
106
+ $start = 0;
107
+ }
108
+
109
+ if ( 'parent:' == substr( $_REQUEST['s'], $start, 7 ) ) {
110
+ self::$parent_search_parameters['s'] = substr( $_REQUEST['s'], $start + 7 );
111
+ unset( $_REQUEST['s'] );
112
+ self::$parent_search_parameters['mla_search_connector'] = $_REQUEST['mla_search_connector'];
113
+ unset( $_REQUEST['mla_search_connector'] );
114
+ self::$parent_search_parameters['mla_search_fields'] = $_REQUEST['mla_search_fields'];
115
+ unset( $_REQUEST['mla_search_fields'] );
116
+
117
+ // alt-text is meaningless for posts and pages
118
+ $alt_index = array_search( 'alt-text', self::$parent_search_parameters['mla_search_fields'] );
119
+ if ( false !== $alt_index ) {
120
+ unset( self::$parent_search_parameters['mla_search_fields'][ $alt_index ] );
121
+ }
122
+ } else {
123
+ self::$parent_search_parameters = array();
124
+ }
125
+ } // isset s=parent:
126
+ error_log( __LINE__ . ' MLAParentSearchExample::mla_list_table_new_instance parent_search_parameters = ' . var_export( self::$parent_search_parameters, true ), 0 );
127
+ error_log( __LINE__ . ' MLAParentSearchExample::mla_list_table_new_instance _REQUEST = ' . var_export( $_REQUEST, true ), 0 );
128
+
129
+ return $mla_list_table;
130
+ } // mla_list_table_new_instance
131
+
132
+ /**
133
+ * Custom Field Search "parameters"
134
+ *
135
+ * @since 1.00
136
+ *
137
+ * @var array
138
+ */
139
+ public static $parent_search_parameters = array();
140
+
141
+ /**
142
+ * Filter the WP_Query request parameters for the prepare_items query
143
+ *
144
+ * Gives you an opportunity to change the terms of the prepare_items query
145
+ * after they are processed by the "Prepare List Table Query" handler.
146
+ *
147
+ * @since 1.00
148
+ *
149
+ * @param array WP_Query request prepared by "Prepare List Table Query"
150
+ *
151
+ * @return array updated WP_Query request
152
+ */
153
+ public static function mla_list_table_query_final_terms( $request ) {
154
+ /*
155
+ * If $request['offset'] and $request['posts_per_page'] are set, this is the "prepare_items" request.
156
+ * If they are NOT set, this is a "view count" request, i.e., to get the count for a custom view.
157
+ *
158
+ * MLAData::$query_parameters and MLAData::$search_parameters contain
159
+ * additional parameters used in some List Table queries.
160
+ */
161
+ if ( ! ( isset( $request['offset'] ) && isset( $request['posts_per_page'] ) ) ) {
162
+ return $request;
163
+ }
164
+ error_log( __LINE__ . ' MLAParentSearchExample::mla_list_table_query_final_terms request = ' . var_export( $request, true ), 0 );
165
+
166
+ if ( empty( self::$parent_search_parameters ) ) {
167
+ return $request;
168
+ }
169
+
170
+ if ( isset( self::$parent_search_parameters['debug'] ) ) {
171
+ MLAData::$query_parameters['debug'] = self::$parent_search_parameters['debug'];
172
+ MLAData::$search_parameters['debug'] = self::$parent_search_parameters['debug'];
173
+ MLACore::mla_debug_mode( self::$parent_search_parameters['debug'] );
174
+ }
175
+
176
+ // Construct a search for the parent posts/pages
177
+ $parent_query = array(
178
+ 'orderby' => 'ID',
179
+ 'order' => 'ASC',
180
+ 'post_mime_type' => 'all',
181
+ 'post_type' => 'post,page',
182
+ 'post_status' => 'publish',
183
+ 's' => self::$parent_search_parameters['s'],
184
+ 'mla_search_connector' => self::$parent_search_parameters['mla_search_connector'],
185
+ 'mla_search_fields' => implode( ',', self::$parent_search_parameters['mla_search_fields'] ),
186
+ );
187
+ error_log( __LINE__ . ' MLAParentSearchExample::mla_list_table_query_final_terms parent_query = ' . var_export( $parent_query, true ), 0 );
188
+ $parents = MLAShortcodes::mla_get_shortcode_attachments( 0, $parent_query );
189
+ $ids = array();
190
+ foreach( $parents as $parent ) {
191
+ $ids[] = $parent->ID;
192
+ }
193
+ error_log( __LINE__ . ' MLAParentSearchExample::mla_list_table_query_final_terms ids = ' . var_export( $ids, true ), 0 );
194
+ $request['post_parent__in'] = $ids;
195
+ error_log( __LINE__ . ' MLAParentSearchExample::mla_list_table_query_final_terms request = ' . var_export( $request, true ), 0 );
196
+
197
+ return $request;
198
+ } // mla_list_table_query_final_terms
199
+
200
+ /**
201
+ * MLA Edit Media "Query Attachments" initial terms Filter
202
+ *
203
+ * Gives you an opportunity to change the terms of the
204
+ * Media Manager Modal Window "Query Attachments" query
205
+ * before they are pre-processed by the MLA handler.
206
+ *
207
+ * @since 1.00
208
+ *
209
+ * @param array WP_Query terms supported for "Query Attachments"
210
+ * @param array All terms passed in the request
211
+ */
212
+ public static function mla_media_modal_query_initial_terms( $query, $raw_query ) {
213
+ /*
214
+ * Look for the special "parent:" prefix in the Search Media text box,
215
+ * after checking for the "debug" prefixes.
216
+ */
217
+ if ( isset( $query['mla_search_value'] ) ) {
218
+ switch ( substr( $query['mla_search_value'], 0, 3 ) ) {
219
+ case '>|<':
220
+ self::$parent_search_parameters['debug'] = 'console';
221
+ $start = 3;
222
+ break;
223
+ case '<|>':
224
+ self::$parent_search_parameters['debug'] = 'log';
225
+ $start = 3;
226
+ break;
227
+ default:
228
+ $start = 0;
229
+ }
230
+
231
+ if ( 'parent:' == substr( $query['mla_search_value'], $start, 7 ) ) {
232
+ self::$parent_search_parameters['s'] = substr( $query['mla_search_value'], $start + 7 );
233
+ unset( $query['mla_search_value'] );
234
+ self::$parent_search_parameters['mla_search_connector'] = $query['mla_search_connector'];
235
+ unset( $query['mla_search_connector'] );
236
+ self::$parent_search_parameters['mla_search_fields'] = $query['mla_search_fields'];
237
+ unset( $query['mla_search_fields'] );
238
+ } else {
239
+ self::$parent_search_parameters = array();
240
+ }
241
+ } // isset mla_search_value=parent:
242
+ error_log( __LINE__ . ' MLAParentSearchExample::mla_media_modal_query_initial_terms query = ' . var_export( $query, true ), 0 );
243
+ error_log( __LINE__ . ' MLAParentSearchExample::mla_media_modal_query_initial_terms parent_search_parameters = ' . var_export( self::$parent_search_parameters, true ), 0 );
244
+
245
+ return $query;
246
+ }
247
+
248
+ /**
249
+ * MLA Edit Media "Query Attachments" final terms Filter
250
+ *
251
+ * Gives you an opportunity to change the terms of the
252
+ * Media Manager Modal Window "Query Attachments" query
253
+ * after they are processed by the "Prepare List Table Query" handler.
254
+ *
255
+ * @since 1.00
256
+ *
257
+ * @param array WP_Query request prepared by "Prepare List Table Query"
258
+ */
259
+ public static function mla_media_modal_query_final_terms( $request ) {
260
+ /*
261
+ * The logic used in the Media/Assistant Search Media box will work here as well
262
+ */
263
+ return MLAParentSearchExample::mla_list_table_query_final_terms( $request );
264
+ }
265
+ } // Class MLAParentSearchExample
266
+
267
+ /*
268
+ * Install the filters at an early opportunity
269
+ */
270
+ add_action('init', 'MLAParentSearchExample::initialize');
271
+ ?>
examples/plugins/mla-zip-archive-example.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Creates a Bulk Action that downloads one or more Media Library files as a ZIP archive.
4
  *
5
  * Created for support topic "Att Categories menu returns 404 error"
6
  * opened on 11/17/2014 by "activecontent".
@@ -13,7 +13,7 @@
13
  /*
14
  Plugin Name: MLA Download ZIP Example
15
  Plugin URI: http://fairtradejudaica.org/media-library-assistant-a-wordpress-plugin/
16
- Description: Creates a Bulk Action that downloads one or more Media Library files as a ZIP archive
17
  Author: David Lingren
18
  Version: 1.01
19
  Author URI: http://fairtradejudaica.org/our-story/staff/
1
  <?php
2
  /**
3
+ * Creates a "Download" Bulk Action that downloads one or more Media Library files as a ZIP archive.
4
  *
5
  * Created for support topic "Att Categories menu returns 404 error"
6
  * opened on 11/17/2014 by "activecontent".
13
  /*
14
  Plugin Name: MLA Download ZIP Example
15
  Plugin URI: http://fairtradejudaica.org/media-library-assistant-a-wordpress-plugin/
16
+ Description: Creates a "Download" Bulk Action that downloads one or more Media Library files as a ZIP archive
17
  Author: David Lingren
18
  Version: 1.01
19
  Author URI: http://fairtradejudaica.org/our-story/staff/
includes/class-mla-admin-columns-support.php CHANGED
@@ -173,6 +173,23 @@ class AC_Addon_MLA_ListScreen extends AC_ListScreen_Media {
173
  return apply_filters( 'mla_list_table_get_columns', MLAQuery::$default_columns );
174
  }
175
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  /**
177
  * Return an MLA version of a Media Library item
178
  *
173
  return apply_filters( 'mla_list_table_get_columns', MLAQuery::$default_columns );
174
  }
175
 
176
+ /**
177
+ * Return the column value for AC/ACP custom columns, e.g., EXIF values
178
+ *
179
+ * @param string|null $content
180
+ * @param WP_Post $post
181
+ * @param string $column_name
182
+ *
183
+ * @return string|false
184
+ */
185
+ public function column_default_value( $content, $post, $column_name ) {
186
+ if ( is_null( $content ) ) {
187
+ $content = $this->get_display_value_by_column_name( $column_name, $post->ID );
188
+ }
189
+
190
+ return $content;
191
+ }
192
+
193
  /**
194
  * Return an MLA version of a Media Library item
195
  *
includes/class-mla-core.php CHANGED
@@ -21,7 +21,7 @@ class MLACore {
21
  *
22
  * @var string
23
  */
24
- const CURRENT_MLA_VERSION = '2.72';
25
 
26
  /**
27
  * Slug for registering and enqueueing plugin style sheets (moved from class-mla-main.php)
@@ -1777,10 +1777,8 @@ class MLA_Checklist_Walker extends Walker_Category {
1777
 
1778
  $class = in_array( $taxonomy_object->term_id, $popular_cats ) ? ' class="popular-category"' : '';
1779
 
1780
- /*
1781
- * For flat taxonomies, <input> value is $taxonomy_object->name instead of $taxonomy_object->term_id
1782
- */
1783
- $output .= "\n<li id='{$taxonomy}-{$taxonomy_object->term_id}'$class>" . '<label class="selectit MLA"><input value="' . $taxonomy_object->name . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $taxonomy_object->term_id . '"' . checked( in_array( $taxonomy_object->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters('the_category', $taxonomy_object->name )) . '</label>';
1784
  }
1785
 
1786
  /**
21
  *
22
  * @var string
23
  */
24
+ const CURRENT_MLA_VERSION = '2.73';
25
 
26
  /**
27
  * Slug for registering and enqueueing plugin style sheets (moved from class-mla-main.php)
1777
 
1778
  $class = in_array( $taxonomy_object->term_id, $popular_cats ) ? ' class="popular-category"' : '';
1779
 
1780
+ // For flat taxonomies, <input> value is $taxonomy_object->name instead of $taxonomy_object->term_id
1781
+ $output .= "\n<li id='{$taxonomy}-{$taxonomy_object->term_id}'$class>" . '<label class="selectit MLA"><input value="' . esc_attr( $taxonomy_object->name ) . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $taxonomy_object->term_id . '"' . checked( in_array( $taxonomy_object->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters('the_category', $taxonomy_object->name )) . '</label>';
 
 
1782
  }
1783
 
1784
  /**
includes/class-mla-data-query.php CHANGED
@@ -119,10 +119,10 @@ class MLAQuery {
119
  if ( -1 === $ID ) {
120
  return NULL;
121
  }
122
-
123
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-data-references.php' );
124
  }
125
-
126
  return MLAReferences::mla_fetch_attachment_references_handler( $ID, $parent, $add_references );
127
  }
128
 
@@ -145,10 +145,10 @@ class MLAQuery {
145
  if ( !class_exists( 'MLAReferences' ) ) {
146
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-data-references.php' );
147
  }
148
-
149
  return MLAReferences::mla_attachment_array_fetch_references_handler( $attachments );
150
  }
151
-
152
  /**
153
  * Invalidates the $mla_galleries or $galleries array and cached values
154
  *
@@ -361,7 +361,7 @@ class MLAQuery {
361
 
362
  return $terms;
363
  }
364
-
365
  /**
366
  * Get the total number of attachment posts
367
  *
@@ -781,9 +781,7 @@ class MLAQuery {
781
  }
782
 
783
  break;
784
- /*
785
- * ids allows hooks to supply a persistent list of items
786
- */
787
  case 'ids':
788
  if ( is_array( $value ) ) {
789
  $clean_request[ 'post__in' ] = $value;
@@ -791,38 +789,35 @@ class MLAQuery {
791
  $clean_request[ 'post__in' ] = array_map( 'absint', explode( ',', $value ) );
792
  }
793
  break;
794
- /*
795
- * post__in and post__not_in are used in the Media Modal Ajax queries
796
- */
797
  case 'post__in':
798
  case 'post__not_in':
799
  case 'post_mime_type':
 
 
 
800
  $clean_request[ $key ] = $value;
801
  break;
802
  case 'parent':
803
  case 'post_parent':
804
  $clean_request[ 'post_parent' ] = absint( $value );
805
  break;
806
- /*
807
- * ['m'] - filter by year and month of post, e.g., 201204
808
- */
809
  case 'author':
810
  case 'm':
811
  $clean_request[ $key ] = absint( $value );
812
  break;
813
- /*
814
- * ['mla_filter_term'] - filter by taxonomy term ID (-1 allowed), or by custom field
815
- */
816
  case 'mla_filter_term':
817
  if ( MLACoreOptions::MLA_FILTER_METAKEY == MLACore::mla_taxonomy_support('', 'filter') ) {
818
  if ( MLACoreOptions::ALL_MLA_FILTER_METAKEY != $value ) {
819
  $clean_request['mla-metakey'] = MLACore::mla_taxonomy_support('', 'metakey');
820
  $clean_request['mla-metavalue'] = stripslashes( $value );
821
  }
822
-
823
  break;
824
  }
825
-
826
  $clean_request[ $key ] = intval( $value );
827
  break;
828
  case 'order':
@@ -913,9 +908,7 @@ class MLAQuery {
913
  } // switch $key
914
  } // foreach $raw_request
915
 
916
- /*
917
- * Pass query and search parameters to the filters for _execute_list_table_query
918
- */
919
  self::$query_parameters = array( self::MLA_ALT_TEXT_SUBQUERY => false, self::MLA_FILE_SUBQUERY => false, self::MLA_TABLE_VIEW_SUBQUERY => false, self::MLA_ORDERBY_SUBQUERY => false, 'orderby' => $clean_request['orderby'], 'order' => $clean_request['order'] );
920
  self::$query_parameters['detached'] = isset( $clean_request['detached'] ) ? $clean_request['detached'] : NULL;
921
  self::$search_parameters = array( 'debug' => 'none' );
@@ -1153,11 +1146,11 @@ class MLAQuery {
1153
  if ( false !== $wpmf_pre_get_posts_priority ) {
1154
  remove_action( 'pre_get_posts', array( $GLOBALS['wp_media_folder'], 'wpmf_pre_get_posts' ), $wpmf_pre_get_posts_priority );
1155
  }
1156
-
1157
  if ( false !== $wpmf_pre_get_posts1_priority ) {
1158
  remove_action( 'pre_get_posts', array( $GLOBALS['wp_media_folder'], 'wpmf_pre_get_posts1' ), $wpmf_pre_get_posts1_priority );
1159
  }
1160
-
1161
  if ( isset( self::$query_parameters['debug'] ) ) {
1162
  global $wp_filter;
1163
  $debug_array = array( 'posts_search' => $wp_filter['posts_search'], 'posts_join' => $wp_filter['posts_join'], 'posts_where' => $wp_filter['posts_where'], 'posts_orderby' => $wp_filter['posts_orderby'] );
@@ -1187,11 +1180,11 @@ class MLAQuery {
1187
  if ( false !== $wpmf_pre_get_posts1_priority ) {
1188
  add_action( 'pre_get_posts', array( $GLOBALS['wp_media_folder'], 'wpmf_pre_get_posts1' ), $wpmf_pre_get_posts1_priority );
1189
  }
1190
-
1191
  if ( false !== $wpmf_pre_get_posts_priority ) {
1192
  add_action( 'pre_get_posts', array( $GLOBALS['wp_media_folder'], 'wpmf_pre_get_posts' ), $wpmf_pre_get_posts_priority );
1193
  }
1194
-
1195
  if ( function_exists( 'relevanssi_prevent_default_request' ) ) {
1196
  remove_filter( 'relevanssi_admin_search_ok', 'MLAQuery::mla_query_relevanssi_admin_search_ok_filter' );
1197
  }
@@ -1296,7 +1289,7 @@ class MLAQuery {
1296
  if ( false === strpos( $trim_list, $delimiter ) ) {
1297
  $trim_list .= $delimiter;
1298
  }
1299
-
1300
  $whole_string = trim( $whole_string, $trim_list );
1301
  $phrases = array();
1302
 
@@ -1350,7 +1343,7 @@ class MLAQuery {
1350
  // Restore quotes for word-boundary check
1351
  $phrases[] = $current_delimiter . $argument . $current_delimiter;
1352
  }
1353
-
1354
  $whole_string = trim( substr( $whole_string, $index ), $trim_list );
1355
  } // strlen( $whole_string )
1356
 
@@ -1374,7 +1367,7 @@ class MLAQuery {
1374
  $phrase_delimiter = isset( $terms_search_parameters['phrase_delimiter'] ) ? $terms_search_parameters['phrase_delimiter'] : ' ';
1375
  $tax_clause = '';
1376
  $tax_index = 0;
1377
-
1378
  $terms = self::_parse_terms_search( $terms_search_parameters['phrases'], $term_delimiter );
1379
  if ( 1 < count( $terms ) ) {
1380
  $terms_connector = '(';
119
  if ( -1 === $ID ) {
120
  return NULL;
121
  }
122
+
123
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-data-references.php' );
124
  }
125
+
126
  return MLAReferences::mla_fetch_attachment_references_handler( $ID, $parent, $add_references );
127
  }
128
 
145
  if ( !class_exists( 'MLAReferences' ) ) {
146
  require_once( MLA_PLUGIN_PATH . 'includes/class-mla-data-references.php' );
147
  }
148
+
149
  return MLAReferences::mla_attachment_array_fetch_references_handler( $attachments );
150
  }
151
+
152
  /**
153
  * Invalidates the $mla_galleries or $galleries array and cached values
154
  *
361
 
362
  return $terms;
363
  }
364
+
365
  /**
366
  * Get the total number of attachment posts
367
  *
781
  }
782
 
783
  break;
784
+ // ids allows hooks to supply a persistent list of items
 
 
785
  case 'ids':
786
  if ( is_array( $value ) ) {
787
  $clean_request[ 'post__in' ] = $value;
789
  $clean_request[ 'post__in' ] = array_map( 'absint', explode( ',', $value ) );
790
  }
791
  break;
792
+ // post__in and post__not_in are used in the Media Modal Ajax queries
 
 
793
  case 'post__in':
794
  case 'post__not_in':
795
  case 'post_mime_type':
796
+ // post_parent__in and post_parent__not_in are used in example plugins
797
+ case 'post_parent__in':
798
+ case 'post_parent__not_in':
799
  $clean_request[ $key ] = $value;
800
  break;
801
  case 'parent':
802
  case 'post_parent':
803
  $clean_request[ 'post_parent' ] = absint( $value );
804
  break;
805
+ // ['m'] - filter by year and month of post, e.g., 201204
 
 
806
  case 'author':
807
  case 'm':
808
  $clean_request[ $key ] = absint( $value );
809
  break;
810
+ // ['mla_filter_term'] - filter by taxonomy term ID (-1 allowed), or by custom field
 
 
811
  case 'mla_filter_term':
812
  if ( MLACoreOptions::MLA_FILTER_METAKEY == MLACore::mla_taxonomy_support('', 'filter') ) {
813
  if ( MLACoreOptions::ALL_MLA_FILTER_METAKEY != $value ) {
814
  $clean_request['mla-metakey'] = MLACore::mla_taxonomy_support('', 'metakey');
815
  $clean_request['mla-metavalue'] = stripslashes( $value );
816
  }
817
+
818
  break;
819
  }
820
+
821
  $clean_request[ $key ] = intval( $value );
822
  break;
823
  case 'order':
908
  } // switch $key
909
  } // foreach $raw_request
910
 
911
+ // Pass query and search parameters to the filters for _execute_list_table_query
 
 
912
  self::$query_parameters = array( self::MLA_ALT_TEXT_SUBQUERY => false, self::MLA_FILE_SUBQUERY => false, self::MLA_TABLE_VIEW_SUBQUERY => false, self::MLA_ORDERBY_SUBQUERY => false, 'orderby' => $clean_request['orderby'], 'order' => $clean_request['order'] );
913
  self::$query_parameters['detached'] = isset( $clean_request['detached'] ) ? $clean_request['detached'] : NULL;
914
  self::$search_parameters = array( 'debug' => 'none' );
1146
  if ( false !== $wpmf_pre_get_posts_priority ) {
1147
  remove_action( 'pre_get_posts', array( $GLOBALS['wp_media_folder'], 'wpmf_pre_get_posts' ), $wpmf_pre_get_posts_priority );
1148
  }
1149
+
1150
  if ( false !== $wpmf_pre_get_posts1_priority ) {
1151
  remove_action( 'pre_get_posts', array( $GLOBALS['wp_media_folder'], 'wpmf_pre_get_posts1' ), $wpmf_pre_get_posts1_priority );
1152
  }
1153
+
1154
  if ( isset( self::$query_parameters['debug'] ) ) {
1155
  global $wp_filter;
1156
  $debug_array = array( 'posts_search' => $wp_filter['posts_search'], 'posts_join' => $wp_filter['posts_join'], 'posts_where' => $wp_filter['posts_where'], 'posts_orderby' => $wp_filter['posts_orderby'] );
1180
  if ( false !== $wpmf_pre_get_posts1_priority ) {
1181
  add_action( 'pre_get_posts', array( $GLOBALS['wp_media_folder'], 'wpmf_pre_get_posts1' ), $wpmf_pre_get_posts1_priority );
1182
  }
1183
+
1184
  if ( false !== $wpmf_pre_get_posts_priority ) {
1185
  add_action( 'pre_get_posts', array( $GLOBALS['wp_media_folder'], 'wpmf_pre_get_posts' ), $wpmf_pre_get_posts_priority );
1186
  }
1187
+
1188
  if ( function_exists( 'relevanssi_prevent_default_request' ) ) {
1189
  remove_filter( 'relevanssi_admin_search_ok', 'MLAQuery::mla_query_relevanssi_admin_search_ok_filter' );
1190
  }
1289
  if ( false === strpos( $trim_list, $delimiter ) ) {
1290
  $trim_list .= $delimiter;
1291
  }
1292
+
1293
  $whole_string = trim( $whole_string, $trim_list );
1294
  $phrases = array();
1295
 
1343
  // Restore quotes for word-boundary check
1344
  $phrases[] = $current_delimiter . $argument . $current_delimiter;
1345
  }
1346
+
1347
  $whole_string = trim( substr( $whole_string, $index ), $trim_list );
1348
  } // strlen( $whole_string )
1349
 
1367
  $phrase_delimiter = isset( $terms_search_parameters['phrase_delimiter'] ) ? $terms_search_parameters['phrase_delimiter'] : ' ';
1368
  $tax_clause = '';
1369
  $tax_index = 0;
1370
+
1371
  $terms = self::_parse_terms_search( $terms_search_parameters['phrases'], $term_delimiter );
1372
  if ( 1 < count( $terms ) ) {
1373
  $terms_connector = '(';
includes/class-mla-data.php CHANGED
@@ -4318,7 +4318,7 @@ class MLAData {
4318
  }
4319
 
4320
  $terms_after = array();
4321
- if ( $hierarchical ) {
4322
  $terms = array_map( 'intval', $terms );
4323
  $terms = array_unique( $terms );
4324
 
4318
  }
4319
 
4320
  $terms_after = array();
4321
+ if ( $hierarchical || MLACore::mla_taxonomy_support( $taxonomy, 'flat-checklist' )) {
4322
  $terms = array_map( 'intval', $terms );
4323
  $terms = array_unique( $terms );
4324
 
includes/class-mla-edit-media.php CHANGED
@@ -305,10 +305,12 @@ class MLAEdit {
305
  $hierarchical_taxonomies = array();
306
  $flat_taxonomies = array();
307
  foreach ( $taxonomies as $tax_name => $tax_object ) {
308
- if ( $tax_object->hierarchical && $tax_object->show_ui && MLACore::mla_taxonomy_support($tax_name, 'quick-edit') ) {
309
- $hierarchical_taxonomies[$tax_name] = $tax_object;
310
- } elseif ( $tax_object->show_ui && MLACore::mla_taxonomy_support($tax_name, 'quick-edit') ) {
311
- $flat_taxonomies[$tax_name] = $tax_object;
 
 
312
  }
313
  }
314
 
@@ -319,10 +321,7 @@ class MLAEdit {
319
  return;
320
  }
321
 
322
- /*
323
- * The left-hand column contains the hierarchical taxonomies,
324
- * e.g., Attachment Category
325
- */
326
  $category_fieldset = '';
327
 
328
  if ( count( $hierarchical_taxonomies ) ) {
@@ -330,25 +329,23 @@ class MLAEdit {
330
 
331
  foreach ( $hierarchical_taxonomies as $tax_name => $tax_object ) {
332
  if ( current_user_can( $tax_object->cap->assign_terms ) ) {
333
- ob_start();
334
- wp_terms_checklist( NULL, array( 'taxonomy' => $tax_name, 'popular_cats' => array(), ) );
335
- $tax_checklist = ob_get_contents();
336
- ob_end_clean();
337
-
338
- $page_values = array(
339
  'tax_html' => esc_html( $tax_object->labels->name ),
340
- 'more' => __( 'more', 'media-library-assistant' ),
341
- 'less' => __( 'less', 'media-library-assistant' ),
342
  'tax_attr' => esc_attr( $tax_name ),
343
  'tax_checklist' => $tax_checklist,
344
  'Add' => __( 'Add', 'media-library-assistant' ),
345
  'Remove' => __( 'Remove', 'media-library-assistant' ),
346
  'Replace' => __( 'Replace', 'media-library-assistant' ),
347
- );
348
- $category_block = MLAData::mla_parse_template( $page_template_array['category_block'], $page_values );
349
- $taxonomy_options = MLAData::mla_parse_template( $page_template_array['taxonomy_options'], $page_values );
350
-
351
- $bulk_category_blocks .= $category_block . $taxonomy_options;
352
  } // current_user_can
353
  } // foreach $hierarchical_taxonomies
354
 
@@ -358,10 +355,7 @@ class MLAEdit {
358
  $category_fieldset = MLAData::mla_parse_template( $page_template_array['category_fieldset'], $page_values );
359
  } // count( $hierarchical_taxonomies )
360
 
361
- /*
362
- * The middle column contains the flat taxonomies,
363
- * e.g., Attachment Tag
364
- */
365
  $tag_fieldset = '';
366
 
367
  if ( count( $flat_taxonomies ) ) {
@@ -369,17 +363,34 @@ class MLAEdit {
369
 
370
  foreach ( $flat_taxonomies as $tax_name => $tax_object ) {
371
  if ( current_user_can( $tax_object->cap->assign_terms ) ) {
372
- $page_values = array(
373
- 'tax_html' => esc_html( $tax_object->labels->name ),
374
- 'tax_attr' => esc_attr( $tax_name ),
375
- 'Add' => __( 'Add', 'media-library-assistant' ),
376
- 'Remove' => __( 'Remove', 'media-library-assistant' ),
377
- 'Replace' => __( 'Replace', 'media-library-assistant' ),
378
- );
379
- $tag_block = MLAData::mla_parse_template( $page_template_array['tag_block'], $page_values );
380
- $taxonomy_options = MLAData::mla_parse_template( $page_template_array['taxonomy_options'], $page_values );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
 
382
- $bulk_tag_blocks .= $tag_block . $taxonomy_options;
 
383
  } // current_user_can
384
  } // foreach $flat_taxonomies
385
 
@@ -389,9 +400,7 @@ class MLAEdit {
389
  $tag_fieldset = MLAData::mla_parse_template( $page_template_array['tag_fieldset'], $page_values );
390
  } // count( $flat_taxonomies )
391
 
392
- /*
393
- * The right-hand column contains the standard and custom fields
394
- */
395
  if ( $authors = MLA::mla_authors_dropdown( -1 ) ) {
396
  $authors_dropdown = ' <label class="inline-edit-author alignright">' . "\n";
397
  $authors_dropdown .= ' <span class="title">' . __( 'Author', 'media-library-assistant' ) . '</span>' . "\n";
305
  $hierarchical_taxonomies = array();
306
  $flat_taxonomies = array();
307
  foreach ( $taxonomies as $tax_name => $tax_object ) {
308
+ if ( $tax_object->show_ui && MLACore::mla_taxonomy_support($tax_name, 'quick-edit') ) {
309
+ if ( $tax_object->hierarchical ) {
310
+ $hierarchical_taxonomies[$tax_name] = $tax_object;
311
+ } else {
312
+ $flat_taxonomies[$tax_name] = $tax_object;
313
+ }
314
  }
315
  }
316
 
321
  return;
322
  }
323
 
324
+ // The left-hand column contains the hierarchical taxonomies,e.g., Att. Category
 
 
 
325
  $category_fieldset = '';
326
 
327
  if ( count( $hierarchical_taxonomies ) ) {
329
 
330
  foreach ( $hierarchical_taxonomies as $tax_name => $tax_object ) {
331
  if ( current_user_can( $tax_object->cap->assign_terms ) ) {
332
+ ob_start();
333
+ wp_terms_checklist( NULL, array( 'taxonomy' => $tax_name, 'popular_cats' => array(), ) );
334
+ $tax_checklist = ob_get_contents();
335
+ ob_end_clean();
336
+
337
+ $page_values = array(
338
  'tax_html' => esc_html( $tax_object->labels->name ),
 
 
339
  'tax_attr' => esc_attr( $tax_name ),
340
  'tax_checklist' => $tax_checklist,
341
  'Add' => __( 'Add', 'media-library-assistant' ),
342
  'Remove' => __( 'Remove', 'media-library-assistant' ),
343
  'Replace' => __( 'Replace', 'media-library-assistant' ),
344
+ );
345
+ $category_block = MLAData::mla_parse_template( $page_template_array['category_block'], $page_values );
346
+ $taxonomy_options = MLAData::mla_parse_template( $page_template_array['taxonomy_options'], $page_values );
347
+
348
+ $bulk_category_blocks .= $category_block . $taxonomy_options;
349
  } // current_user_can
350
  } // foreach $hierarchical_taxonomies
351
 
355
  $category_fieldset = MLAData::mla_parse_template( $page_template_array['category_fieldset'], $page_values );
356
  } // count( $hierarchical_taxonomies )
357
 
358
+ // The middle column contains the flat taxonomies, e.g., Att. Tag
 
 
 
359
  $tag_fieldset = '';
360
 
361
  if ( count( $flat_taxonomies ) ) {
363
 
364
  foreach ( $flat_taxonomies as $tax_name => $tax_object ) {
365
  if ( current_user_can( $tax_object->cap->assign_terms ) ) {
366
+ if ( MLACore::mla_taxonomy_support( $tax_name, 'flat-checklist' ) ) {
367
+ ob_start();
368
+ wp_terms_checklist( NULL, array( 'taxonomy' => $tax_name, 'popular_cats' => array(), ) );
369
+ $tax_checklist = ob_get_contents();
370
+ ob_end_clean();
371
+
372
+ $page_values = array(
373
+ 'tax_html' => esc_html( $tax_object->labels->name ),
374
+ 'tax_attr' => esc_attr( $tax_name ),
375
+ 'tax_checklist' => $tax_checklist,
376
+ 'Add' => __( 'Add', 'media-library-assistant' ),
377
+ 'Remove' => __( 'Remove', 'media-library-assistant' ),
378
+ 'Replace' => __( 'Replace', 'media-library-assistant' ),
379
+ );
380
+ $tag_block = MLAData::mla_parse_template( $page_template_array['category_block'], $page_values );
381
+ } else {
382
+ $page_values = array(
383
+ 'tax_html' => esc_html( $tax_object->labels->name ),
384
+ 'tax_attr' => esc_attr( $tax_name ),
385
+ 'Add' => __( 'Add', 'media-library-assistant' ),
386
+ 'Remove' => __( 'Remove', 'media-library-assistant' ),
387
+ 'Replace' => __( 'Replace', 'media-library-assistant' ),
388
+ );
389
+ $tag_block = MLAData::mla_parse_template( $page_template_array['tag_block'], $page_values );
390
+ }
391
 
392
+ $taxonomy_options = MLAData::mla_parse_template( $page_template_array['taxonomy_options'], $page_values );
393
+ $bulk_tag_blocks .= $tag_block . $taxonomy_options;
394
  } // current_user_can
395
  } // foreach $flat_taxonomies
396
 
400
  $tag_fieldset = MLAData::mla_parse_template( $page_template_array['tag_fieldset'], $page_values );
401
  } // count( $flat_taxonomies )
402
 
403
+ // The right-hand column contains the standard and custom fields
 
 
404
  if ( $authors = MLA::mla_authors_dropdown( -1 ) ) {
405
  $authors_dropdown = ' <label class="inline-edit-author alignright">' . "\n";
406
  $authors_dropdown .= ' <span class="title">' . __( 'Author', 'media-library-assistant' ) . '</span>' . "\n";
includes/class-mla-list-table.php CHANGED
@@ -925,13 +925,13 @@ class MLA_List_Table extends WP_List_Table {
925
  }
926
 
927
  $ids = array();
928
-
929
- if ( $tax_object->hierarchical ) {
930
  foreach( $terms as $term ) {
931
  $ids[] = $term->term_id;
932
  }
933
 
934
- $inline_data .= ' <div class="mla_category" id="' . $tax_name . '_' . $item->ID . '">'
 
935
  . implode( ',', $ids ) . "</div>\r\n";
936
  } else {
937
  foreach( $terms as $term ) {
925
  }
926
 
927
  $ids = array();
928
+ if ( $tax_object->hierarchical || MLACore::mla_taxonomy_support( $tax_name, 'flat-checklist' ) ) {
 
929
  foreach( $terms as $term ) {
930
  $ids[] = $term->term_id;
931
  }
932
 
933
+ $inline_class = MLACore::mla_taxonomy_support( $tax_name, 'checked-on-top' ) ? 'mla_category checked_on_top' : 'mla_category';
934
+ $inline_data .= ' <div class="' . $inline_class . '" id="' . $tax_name . '_' . $item->ID . '">'
935
  . implode( ',', $ids ) . "</div>\r\n";
936
  } else {
937
  foreach( $terms as $term ) {
includes/class-mla-main.php CHANGED
@@ -1011,6 +1011,8 @@ class MLA {
1011
 
1012
  // Ignore empty updates
1013
  if ( $hierarchical = is_array( $terms ) ) {
 
 
1014
  if ( false !== ( $index = array_search( 0, $terms ) ) ) {
1015
  unset( $terms[ $index ] );
1016
  }
@@ -1039,6 +1041,7 @@ class MLA {
1039
  $terms = array_unique( $terms );
1040
  }
1041
 
 
1042
  if ( empty( $terms ) && 'replace' != $tax_action ) {
1043
  continue;
1044
  }
@@ -1359,8 +1362,14 @@ class MLA {
1359
  * @return void
1360
  */
1361
  public static function mla_render_admin_page( ) {
1362
- // Prevent _wp_http_referer recursion with method="get"
1363
- $_SERVER['REQUEST_URI'] = '/wp-admin/upload.php?page=mla-menu';
 
 
 
 
 
 
1364
 
1365
  /*
1366
  * WordPress class-wp-list-table.php doesn't look in hidden fields to set
@@ -1762,7 +1771,10 @@ class MLA {
1762
  // Flat taxonomy strings must be cleaned up and duplicates removed
1763
  $tax_output = array();
1764
  foreach ( $_REQUEST['tax_input'] as $tax_name => $tax_value ) {
1765
- if ( ! is_array( $tax_value ) ) {
 
 
 
1766
  $comma = _x( ',', 'tag_delimiter', 'media-library-assistant' );
1767
  if ( ',' != $comma ) {
1768
  $tax_value = str_replace( $comma, ',', $tax_value );
@@ -1993,10 +2005,12 @@ class MLA {
1993
  $hierarchical_taxonomies = array();
1994
  $flat_taxonomies = array();
1995
  foreach ( $taxonomies as $tax_name => $tax_object ) {
1996
- if ( $tax_object->hierarchical && $tax_object->show_ui && MLACore::mla_taxonomy_support($tax_name, 'quick-edit') ) {
1997
- $hierarchical_taxonomies[$tax_name] = $tax_object;
1998
- } elseif ( $tax_object->show_ui && MLACore::mla_taxonomy_support($tax_name, 'quick-edit') ) {
1999
- $flat_taxonomies[$tax_name] = $tax_object;
 
 
2000
  }
2001
  }
2002
 
@@ -2025,9 +2039,7 @@ class MLA {
2025
  $custom_fields .= MLAData::mla_parse_template( $page_template_array['custom_field'], $page_values );
2026
  }
2027
 
2028
- /*
2029
- * The middle column contains the hierarchical taxonomies, e.g., Attachment Category
2030
- */
2031
  $quick_middle_column = '';
2032
  $bulk_middle_column = '';
2033
 
@@ -2044,8 +2056,6 @@ class MLA {
2044
 
2045
  $page_values = array(
2046
  'tax_html' => esc_html( $tax_object->labels->name ),
2047
- 'more' => __( 'more', 'media-library-assistant' ),
2048
- 'less' => __( 'less', 'media-library-assistant' ),
2049
  'tax_attr' => esc_attr( $tax_name ),
2050
  'tax_checklist' => $tax_checklist,
2051
  'Add' => __( 'Add', 'media-library-assistant' ),
@@ -2071,9 +2081,7 @@ class MLA {
2071
  $bulk_middle_column = MLAData::mla_parse_template( $page_template_array['category_fieldset'], $page_values );
2072
  } // count( $hierarchical_taxonomies )
2073
 
2074
- /*
2075
- * The right-hand column contains the flat taxonomies, e.g., Attachment Tag
2076
- */
2077
  $quick_right_column = '';
2078
  $bulk_right_column = '';
2079
 
@@ -2083,14 +2091,32 @@ class MLA {
2083
 
2084
  foreach ( $flat_taxonomies as $tax_name => $tax_object ) {
2085
  if ( current_user_can( $tax_object->cap->assign_terms ) ) {
2086
- $page_values = array(
2087
- 'tax_html' => esc_html( $tax_object->labels->name ),
2088
- 'tax_attr' => esc_attr( $tax_name ),
2089
- 'Add' => __( 'Add', 'media-library-assistant' ),
2090
- 'Remove' => __( 'Remove', 'media-library-assistant' ),
2091
- 'Replace' => __( 'Replace', 'media-library-assistant' ),
2092
- );
2093
- $tag_block = MLAData::mla_parse_template( $page_template_array['tag_block'], $page_values );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2094
  $taxonomy_options = MLAData::mla_parse_template( $page_template_array['taxonomy_options'], $page_values );
2095
 
2096
  $quick_tag_blocks .= $tag_block;
1011
 
1012
  // Ignore empty updates
1013
  if ( $hierarchical = is_array( $terms ) ) {
1014
+ // Make sure term_id values are integers, not strings, for flat-checklist
1015
+ $terms = array_map( 'absint', $terms );
1016
  if ( false !== ( $index = array_search( 0, $terms ) ) ) {
1017
  unset( $terms[ $index ] );
1018
  }
1041
  $terms = array_unique( $terms );
1042
  }
1043
 
1044
+ MLACore::mla_debug_add( __LINE__ . " MLA::mla_prepare_bulk_edits( {$post_id}, {$taxonomy}, {$tax_action} ) terms = " . var_export( $terms, true ), MLACore::MLA_DEBUG_CATEGORY_AJAX );
1045
  if ( empty( $terms ) && 'replace' != $tax_action ) {
1046
  continue;
1047
  }
1362
  * @return void
1363
  */
1364
  public static function mla_render_admin_page( ) {
1365
+ // Prevent _wp_http_referer recursion with method="get", preserve WPML/Polylang language selection
1366
+ $_SERVER['REQUEST_URI'] = parse_url( admin_url( 'upload.php' ), PHP_URL_PATH ) . '?page=mla-menu';
1367
+
1368
+ $query = array();
1369
+ parse_str( strval( $_SERVER[ 'QUERY_STRING' ] ), $query );
1370
+ if ( !empty( $query['lang'] ) ) {
1371
+ $_SERVER['REQUEST_URI'] .= '&lang=' . $query['lang'];
1372
+ }
1373
 
1374
  /*
1375
  * WordPress class-wp-list-table.php doesn't look in hidden fields to set
1771
  // Flat taxonomy strings must be cleaned up and duplicates removed
1772
  $tax_output = array();
1773
  foreach ( $_REQUEST['tax_input'] as $tax_name => $tax_value ) {
1774
+ if ( is_array( $tax_value ) ) {
1775
+ // Make sure term_id values are integers, not strings, for flat-checklist
1776
+ $tax_value = array_map( 'absint', $tax_value );
1777
+ } else {
1778
  $comma = _x( ',', 'tag_delimiter', 'media-library-assistant' );
1779
  if ( ',' != $comma ) {
1780
  $tax_value = str_replace( $comma, ',', $tax_value );
2005
  $hierarchical_taxonomies = array();
2006
  $flat_taxonomies = array();
2007
  foreach ( $taxonomies as $tax_name => $tax_object ) {
2008
+ if ( $tax_object->show_ui && MLACore::mla_taxonomy_support($tax_name, 'quick-edit') ) {
2009
+ if ( $tax_object->hierarchical ) {
2010
+ $hierarchical_taxonomies[$tax_name] = $tax_object;
2011
+ } else {
2012
+ $flat_taxonomies[$tax_name] = $tax_object;
2013
+ }
2014
  }
2015
  }
2016
 
2039
  $custom_fields .= MLAData::mla_parse_template( $page_template_array['custom_field'], $page_values );
2040
  }
2041
 
2042
+ // The middle column contains the hierarchical taxonomies, e.g., Att. Category
 
 
2043
  $quick_middle_column = '';
2044
  $bulk_middle_column = '';
2045
 
2056
 
2057
  $page_values = array(
2058
  'tax_html' => esc_html( $tax_object->labels->name ),
 
 
2059
  'tax_attr' => esc_attr( $tax_name ),
2060
  'tax_checklist' => $tax_checklist,
2061
  'Add' => __( 'Add', 'media-library-assistant' ),
2081
  $bulk_middle_column = MLAData::mla_parse_template( $page_template_array['category_fieldset'], $page_values );
2082
  } // count( $hierarchical_taxonomies )
2083
 
2084
+ // The right-hand column contains the flat taxonomies, e.g., Att. Tag
 
 
2085
  $quick_right_column = '';
2086
  $bulk_right_column = '';
2087
 
2091
 
2092
  foreach ( $flat_taxonomies as $tax_name => $tax_object ) {
2093
  if ( current_user_can( $tax_object->cap->assign_terms ) ) {
2094
+ if ( MLACore::mla_taxonomy_support( $tax_name, 'flat-checklist' ) ) {
2095
+ ob_start();
2096
+ wp_terms_checklist( NULL, array( 'taxonomy' => $tax_name, 'popular_cats' => array(), ) );
2097
+ $tax_checklist = ob_get_contents();
2098
+ ob_end_clean();
2099
+
2100
+ $page_values = array(
2101
+ 'tax_html' => esc_html( $tax_object->labels->name ),
2102
+ 'tax_attr' => esc_attr( $tax_name ),
2103
+ 'tax_checklist' => $tax_checklist,
2104
+ 'Add' => __( 'Add', 'media-library-assistant' ),
2105
+ 'Remove' => __( 'Remove', 'media-library-assistant' ),
2106
+ 'Replace' => __( 'Replace', 'media-library-assistant' ),
2107
+ );
2108
+ $tag_block = MLAData::mla_parse_template( $page_template_array['category_block'], $page_values );
2109
+ } else {
2110
+ $page_values = array(
2111
+ 'tax_html' => esc_html( $tax_object->labels->name ),
2112
+ 'tax_attr' => esc_attr( $tax_name ),
2113
+ 'Add' => __( 'Add', 'media-library-assistant' ),
2114
+ 'Remove' => __( 'Remove', 'media-library-assistant' ),
2115
+ 'Replace' => __( 'Replace', 'media-library-assistant' ),
2116
+ );
2117
+ $tag_block = MLAData::mla_parse_template( $page_template_array['tag_block'], $page_values );
2118
+ }
2119
+
2120
  $taxonomy_options = MLAData::mla_parse_template( $page_template_array['taxonomy_options'], $page_values );
2121
 
2122
  $quick_tag_blocks .= $tag_block;
includes/class-mla-mime-types.php CHANGED
@@ -29,7 +29,8 @@ class MLAMime {
29
  add_filter( 'ext2type', 'MLAMime::mla_ext2type_filter', 0x7FFFFFFF, 1 );
30
 
31
  // Check for active debug setting
32
- if ( ( MLACore::$mla_debug_level & 1 ) && ( MLACore::$mla_debug_level & MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE ) ) {
 
33
  add_filter( 'sanitize_mime_type', 'MLAMime::mla_sanitize_mime_type_filter', 0x7FFFFFFF, 2 );
34
  add_filter( 'wp_check_filetype_and_ext', 'MLAMime::mla_wp_check_filetype_and_ext_filter', 0x7FFFFFFF, 4 );
35
  }
@@ -55,6 +56,15 @@ class MLAMime {
55
  //add_filter( 'wp_mime_type_icon', 'MLAMime::mla_wp_mime_type_icon_filter', 0x7FFFFFFF, 3 );
56
  }
57
 
 
 
 
 
 
 
 
 
 
58
  /**
59
  * Disable MIME filtering during option initialization
60
  *
@@ -105,8 +115,11 @@ class MLAMime {
105
  * @return string Updated sanitized MIME type
106
  */
107
  public static function mla_sanitize_mime_type_filter( $sanitized_mime_type, $raw_mime_type ) {
108
- global $wp_filter;
109
- //MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_sanitize_mime_type_filter( $sanitized_mime_type, $raw_mime_type ) wp_filter = " . var_export( $wp_filter['sanitize_mime_type'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
 
 
 
110
 
111
  return $sanitized_mime_type;
112
  } // mla_sanitize_mime_type_filter
@@ -142,10 +155,12 @@ class MLAMime {
142
  * @return array The updated associations array.
143
  */
144
  public static function mla_ext2type_filter( $standard_types ) {
145
- global $wp_filter;
 
146
 
147
- MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_ext2type_filter standard_types = " . var_export( $standard_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
148
- //MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_ext2type_filter wp_filter = " . var_export( $wp_filter['ext2type'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
 
149
 
150
  if ( self::$disable_mla_filtering ) {
151
  self::$mla_core_icon_types = $standard_types;
@@ -189,7 +204,10 @@ class MLAMime {
189
  self::$mla_icon_type_associations[ $icon_type ] = $extensions;
190
  unset( self::$mla_icon_type_associations['.bad.value.'] );
191
 
192
- MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_ext2type_filter mla_icon_type_associations = " . var_export( self::$mla_icon_type_associations, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
 
 
 
193
  return self::$mla_icon_type_associations;
194
  } // mla_ext2type_filter
195
 
@@ -209,10 +227,12 @@ class MLAMime {
209
  * @return array Updated array( ext, type, proper_filename (string or false) )
210
  */
211
  public static function mla_wp_check_filetype_and_ext_filter( $validate, $file, $filename, $mimes ) {
212
- global $wp_filter;
213
- MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_wp_check_filetype_and_ext_filter( $file, $filename ) validate = " . var_export( $validate, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
214
- MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_wp_check_filetype_and_ext_filter mimes = " . var_export( $mimes, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
215
- //MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_wp_check_filetype_and_ext_filter wp_filter = " . var_export( $wp_filter['wp_check_filetype_and_ext'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
 
 
216
 
217
  return $validate;
218
  } // mla_wp_check_filetype_and_ext_filter
@@ -234,12 +254,12 @@ class MLAMime {
234
  * @return array Updated MIME types
235
  */
236
  public static function mla_mime_types_filter( $mime_types ) {
237
- global $wp_filter;
238
  static $first_call = true;
239
 
240
- if ( $first_call ) {
 
241
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_mime_types_filter mime_types = " . var_export( $mime_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
242
- //MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_mime_types_filter wp_filter = " . var_export( $wp_filter['mime_types'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
243
  }
244
 
245
  if ( self::$disable_mla_filtering || ! self::_get_upload_mime_templates() ) {
@@ -286,11 +306,11 @@ class MLAMime {
286
  $items[ $extensions ] = $mime_type;
287
  unset( $items['.bad.value.'] );
288
 
289
- if ( $first_call ) {
290
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_mime_types_filter items = " . var_export( $items, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
291
- $first_call = false;
292
  }
293
 
 
294
  return $items; // $mime_types;
295
  } // mla_mime_types_filter
296
 
@@ -317,12 +337,12 @@ class MLAMime {
317
  * @return array Updated allowed MIME types
318
  */
319
  public static function mla_upload_mimes_filter( $mime_types, $user = NULL ) {
320
- global $wp_filter;
321
- static $first_call = false;
322
 
323
- if ( $first_call ) {
 
324
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_upload_mimes_filter mime_types = " . var_export( $mime_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
325
- //MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_upload_mimes_filter wp_filter = " . var_export( $wp_filter['upload_mimes'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
326
  }
327
 
328
  if ( self::$disable_mla_filtering || ! self::_get_upload_mime_templates() ) {
@@ -368,11 +388,11 @@ class MLAMime {
368
  unset( $items['html'] );
369
  }
370
 
371
- if ( $first_call ) {
372
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_upload_mimes_filter( $unfiltered ) items = " . var_export( $items, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
373
- $first_call = false;
374
  }
375
 
 
376
  return $items;
377
  } // mla_upload_mimes_filter
378
 
@@ -399,12 +419,12 @@ class MLAMime {
399
  * @return array Updated allowed MIME types
400
  */
401
  public static function mla_post_mime_types_filter( $post_mime_types ) {
402
- global $wp_filter;
403
- static $first_call = false;
404
 
405
- if ( $first_call ) {
 
406
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_post_mime_types_filter post_mime_types = " . var_export( $post_mime_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
407
- //MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_post_mime_types_filter wp_filter = " . var_export( $wp_filter['upload_mimes'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
408
  }
409
 
410
  if ( self::$disable_mla_filtering || ! self::_get_post_mime_templates() ) {
@@ -442,11 +462,11 @@ class MLAMime {
442
  );
443
  }
444
 
445
- if ( $first_call ) {
446
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_post_mime_types_filter new_mime_types = " . var_export( $new_mime_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
447
- $first_call = false;
448
  }
449
 
 
450
  return $new_mime_types;
451
  } // mla_post_mime_types_filter
452
 
29
  add_filter( 'ext2type', 'MLAMime::mla_ext2type_filter', 0x7FFFFFFF, 1 );
30
 
31
  // Check for active debug setting
32
+ self::$mla_debug_active = ( MLACore::$mla_debug_level & 1 ) && ( MLACore::$mla_debug_level & MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
33
+ if ( self::$mla_debug_active ) {
34
  add_filter( 'sanitize_mime_type', 'MLAMime::mla_sanitize_mime_type_filter', 0x7FFFFFFF, 2 );
35
  add_filter( 'wp_check_filetype_and_ext', 'MLAMime::mla_wp_check_filetype_and_ext_filter', 0x7FFFFFFF, 4 );
36
  }
56
  //add_filter( 'wp_mime_type_icon', 'MLAMime::mla_wp_mime_type_icon_filter', 0x7FFFFFFF, 3 );
57
  }
58
 
59
+ /**
60
+ * Execute MLACore::mla_debug_add() statements to record debug information
61
+ *
62
+ * @since 2.73
63
+ *
64
+ * @var boolean
65
+ */
66
+ private static $mla_debug_active = false;
67
+
68
  /**
69
  * Disable MIME filtering during option initialization
70
  *
115
  * @return string Updated sanitized MIME type
116
  */
117
  public static function mla_sanitize_mime_type_filter( $sanitized_mime_type, $raw_mime_type ) {
118
+ if ( self::$mla_debug_active ) {
119
+ global $wp_filter;
120
+
121
+ MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_sanitize_mime_type_filter( $sanitized_mime_type, $raw_mime_type ) wp_filter = " . var_export( $wp_filter['sanitize_mime_type'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
122
+ }
123
 
124
  return $sanitized_mime_type;
125
  } // mla_sanitize_mime_type_filter
155
  * @return array The updated associations array.
156
  */
157
  public static function mla_ext2type_filter( $standard_types ) {
158
+ if ( self::$mla_debug_active ) {
159
+ global $wp_filter;
160
 
161
+ MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_ext2type_filter standard_types = " . var_export( $standard_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
162
+ MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_ext2type_filter wp_filter = " . var_export( $wp_filter['ext2type'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
163
+ }
164
 
165
  if ( self::$disable_mla_filtering ) {
166
  self::$mla_core_icon_types = $standard_types;
204
  self::$mla_icon_type_associations[ $icon_type ] = $extensions;
205
  unset( self::$mla_icon_type_associations['.bad.value.'] );
206
 
207
+ if ( self::$mla_debug_active ) {
208
+ MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_ext2type_filter mla_icon_type_associations = " . var_export( self::$mla_icon_type_associations, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
209
+ }
210
+
211
  return self::$mla_icon_type_associations;
212
  } // mla_ext2type_filter
213
 
227
  * @return array Updated array( ext, type, proper_filename (string or false) )
228
  */
229
  public static function mla_wp_check_filetype_and_ext_filter( $validate, $file, $filename, $mimes ) {
230
+ if ( self::$mla_debug_active ) {
231
+ global $wp_filter;
232
+ MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_wp_check_filetype_and_ext_filter( $file, $filename ) validate = " . var_export( $validate, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
233
+ MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_wp_check_filetype_and_ext_filter mimes = " . var_export( $mimes, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
234
+ MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_wp_check_filetype_and_ext_filter wp_filter = " . var_export( $wp_filter['wp_check_filetype_and_ext'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
235
+ }
236
 
237
  return $validate;
238
  } // mla_wp_check_filetype_and_ext_filter
254
  * @return array Updated MIME types
255
  */
256
  public static function mla_mime_types_filter( $mime_types ) {
 
257
  static $first_call = true;
258
 
259
+ if ( self::$mla_debug_active && $first_call ) {
260
+ global $wp_filter;
261
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_mime_types_filter mime_types = " . var_export( $mime_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
262
+ MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_mime_types_filter wp_filter = " . var_export( $wp_filter['mime_types'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
263
  }
264
 
265
  if ( self::$disable_mla_filtering || ! self::_get_upload_mime_templates() ) {
306
  $items[ $extensions ] = $mime_type;
307
  unset( $items['.bad.value.'] );
308
 
309
+ if ( self::$mla_debug_active && $first_call ) {
310
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_mime_types_filter items = " . var_export( $items, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
 
311
  }
312
 
313
+ $first_call = false;
314
  return $items; // $mime_types;
315
  } // mla_mime_types_filter
316
 
337
  * @return array Updated allowed MIME types
338
  */
339
  public static function mla_upload_mimes_filter( $mime_types, $user = NULL ) {
340
+ static $first_call = true;
 
341
 
342
+ if ( self::$mla_debug_active && $first_call ) {
343
+ global $wp_filter;
344
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_upload_mimes_filter mime_types = " . var_export( $mime_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
345
+ MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_upload_mimes_filter wp_filter = " . var_export( $wp_filter['upload_mimes'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
346
  }
347
 
348
  if ( self::$disable_mla_filtering || ! self::_get_upload_mime_templates() ) {
388
  unset( $items['html'] );
389
  }
390
 
391
+ if ( self::$mla_debug_active && $first_call ) {
392
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_upload_mimes_filter( $unfiltered ) items = " . var_export( $items, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
 
393
  }
394
 
395
+ $first_call = false;
396
  return $items;
397
  } // mla_upload_mimes_filter
398
 
419
  * @return array Updated allowed MIME types
420
  */
421
  public static function mla_post_mime_types_filter( $post_mime_types ) {
422
+ static $first_call = true;
 
423
 
424
+ if ( self::$mla_debug_active && $first_call ) {
425
+ global $wp_filter;
426
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_post_mime_types_filter post_mime_types = " . var_export( $post_mime_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
427
+ MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_post_mime_types_filter wp_filter = " . var_export( $wp_filter['upload_mimes'], true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
428
  }
429
 
430
  if ( self::$disable_mla_filtering || ! self::_get_post_mime_templates() ) {
462
  );
463
  }
464
 
465
+ if ( self::$mla_debug_active && $first_call ) {
466
  MLACore::mla_debug_add( __LINE__ . " MLAMime::mla_post_mime_types_filter new_mime_types = " . var_export( $new_mime_types, true ), MLACore::MLA_DEBUG_CATEGORY_MIME_TYPE );
 
467
  }
468
 
469
+ $first_call = false;
470
  return $new_mime_types;
471
  } // mla_post_mime_types_filter
472
 
includes/class-mla-shortcode-support.php CHANGED
@@ -1854,7 +1854,7 @@ class MLAShortcode_Support {
1854
  if ( empty( $template ) ) {
1855
  $output_parameters = array_map( 'strtolower', array_map( 'trim', explode( ',', $arguments['mla_output'] ) ) );
1856
 
1857
- if ( !in_array( $output_parameters[0], array( 'flat', 'list', 'ulist', 'olist', 'dlist', 'grid', 'array' ) ) ) {
1858
  $output_parameters[0] = 'flat';
1859
  }
1860
 
@@ -1965,7 +1965,7 @@ class MLAShortcode_Support {
1965
 
1966
  $output_parameters = array_map( 'strtolower', array_map( 'trim', explode( ',', $arguments['mla_output'] ) ) );
1967
 
1968
- if ( !in_array( $output_parameters[0], array( 'flat', 'list', 'ulist', 'olist', 'dlist', 'grid', 'array' ) ) ) {
1969
  $output_parameters[0] = 'flat';
1970
  }
1971
 
@@ -4459,19 +4459,13 @@ class MLAShortcode_Support {
4459
  public static function mla_get_shortcode_attachments( $post_parent, $attr, $return_found_rows = NULL ) {
4460
  global $wp_query;
4461
 
4462
- /*
4463
- * Parameters passed to the where and orderby filter functions
4464
- */
4465
  self::$query_parameters = array();
4466
 
4467
- /*
4468
- * Parameters passed to the posts_search filter function in MLAData
4469
- */
4470
  MLAQuery::$search_parameters = array( 'debug' => 'none' );
4471
 
4472
- /*
4473
- * Make sure $attr is an array, even if it's empty
4474
- */
4475
  if ( empty( $attr ) ) {
4476
  $attr = array();
4477
  } elseif ( is_string( $attr ) ) {
@@ -4724,9 +4718,16 @@ class MLAShortcode_Support {
4724
  self::$mla_get_shortcode_dynamic_attachments_parameters['tax_include_children'] = $attr['tax_include_children'];
4725
  }
4726
 
4727
- /*
4728
- * $query_arguments has been initialized in the taxonomy code above.
4729
- */
 
 
 
 
 
 
 
4730
  $is_tax_query = ! ($use_children = empty( $query_arguments ));
4731
  foreach ($arguments as $key => $value ) {
4732
  /*
@@ -5341,6 +5342,7 @@ class MLAShortcode_Support {
5341
  MLACore::mla_debug_add( '<strong>' . __( 'mla_debug post_count', 'media-library-assistant' ) . '</strong> = ' . var_export( MLAShortcodes::$mla_gallery_wp_query_object->post_count, true ) );
5342
  }
5343
 
 
5344
  MLAShortcodes::$mla_gallery_wp_query_object = NULL;
5345
  return $attachments;
5346
  }
1854
  if ( empty( $template ) ) {
1855
  $output_parameters = array_map( 'strtolower', array_map( 'trim', explode( ',', $arguments['mla_output'] ) ) );
1856
 
1857
+ if ( !in_array( $output_parameters[0], array( 'flat', 'list', 'ulist', 'olist', 'dlist', 'grid', 'array', 'next_link', 'current_link', 'previous_link', 'next_page', 'previous_page', 'paginate_links' ) ) ) {
1858
  $output_parameters[0] = 'flat';
1859
  }
1860
 
1965
 
1966
  $output_parameters = array_map( 'strtolower', array_map( 'trim', explode( ',', $arguments['mla_output'] ) ) );
1967
 
1968
+ if ( !in_array( $output_parameters[0], array( 'flat', 'list', 'ulist', 'olist', 'dlist', 'grid', 'array', 'next_link', 'current_link', 'previous_link', 'next_page', 'previous_page', 'paginate_links' ) ) ) {
1969
  $output_parameters[0] = 'flat';
1970
  }
1971
 
4459
  public static function mla_get_shortcode_attachments( $post_parent, $attr, $return_found_rows = NULL ) {
4460
  global $wp_query;
4461
 
4462
+ // Parameters passed to the where and orderby filter functions
 
 
4463
  self::$query_parameters = array();
4464
 
4465
+ // Parameters passed to the posts_search filter function in MLAData
 
 
4466
  MLAQuery::$search_parameters = array( 'debug' => 'none' );
4467
 
4468
+ // Make sure $attr is an array, even if it's empty
 
 
4469
  if ( empty( $attr ) ) {
4470
  $attr = array();
4471
  } elseif ( is_string( $attr ) ) {
4718
  self::$mla_get_shortcode_dynamic_attachments_parameters['tax_include_children'] = $attr['tax_include_children'];
4719
  }
4720
 
4721
+ // Convert lists to arrays
4722
+ if ( is_string( $arguments['post_type'] ) ) {
4723
+ $arguments['post_type'] = explode( ',', $arguments['post_type'] );
4724
+ }
4725
+
4726
+ if ( is_string( $arguments['post_status'] ) ) {
4727
+ $arguments['post_status'] = explode( ',', $arguments['post_status'] );
4728
+ }
4729
+
4730
+ // $query_arguments has been initialized in the taxonomy code above.
4731
  $is_tax_query = ! ($use_children = empty( $query_arguments ));
4732
  foreach ($arguments as $key => $value ) {
4733
  /*
5342
  MLACore::mla_debug_add( '<strong>' . __( 'mla_debug post_count', 'media-library-assistant' ) . '</strong> = ' . var_export( MLAShortcodes::$mla_gallery_wp_query_object->post_count, true ) );
5343
  }
5344
 
5345
+ MLAQuery::$search_parameters = array( 'debug' => 'none' );
5346
  MLAShortcodes::$mla_gallery_wp_query_object = NULL;
5347
  return $attachments;
5348
  }
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.72
10
  */
11
 
12
  /*
@@ -16,7 +16,7 @@ Description: Enhances the Media Library; powerful [mla_gallery] [mla_tag_cloud]
16
  Author: David Lingren, Fair Trade Judaica
17
  Text Domain: media-library-assistant
18
  Domain Path: /languages
19
- Version: 2.72
20
  Author URI: http://fairtradejudaica.org/our-story/staff/
21
 
22
  Copyright 2011-2018 David Lingren
6
  * will the rest of the plugin be loaded and run.
7
  *
8
  * @package Media Library Assistant
9
+ * @version 2.73
10
  */
11
 
12
  /*
16
  Author: David Lingren, Fair Trade Judaica
17
  Text Domain: media-library-assistant
18
  Domain Path: /languages
19
+ Version: 2.73
20
  Author URI: http://fairtradejudaica.org/our-story/staff/
21
 
22
  Copyright 2011-2018 David Lingren
js/mla-inline-edit-scripts.js CHANGED
@@ -89,6 +89,7 @@ var jQuery,
89
  return mla.inlineEditAttachment.revert();
90
  }
91
  });
 
92
  // Clicking "Refresh" submits the form, refreshing the page
93
  $('#bulk_refresh', progressRow).click(function(){
94
  $( '#bulk-progress a' ).prop( 'disabled', true );
@@ -101,15 +102,6 @@ var jQuery,
101
  return false;
102
  });
103
 
104
- // hiearchical taxonomies expandable?
105
- $('span.catshow').click(function(){
106
- $(this).hide().next().show().parent().next().addClass("cat-hover");
107
- });
108
-
109
- $('span.cathide').click(function(){
110
- $(this).hide().prev().show().parent().next().removeClass("cat-hover");
111
- });
112
-
113
  $('select[name="_status"] option[value="future"]', bulkRow).remove();
114
 
115
  $('#doaction, #doaction2').click(function(e){
@@ -394,7 +386,7 @@ var jQuery,
394
  },
395
 
396
  quickEdit : function(id) {
397
- var t = this, fields, editRow, rowData, icon, fIndex;
398
  t.revert();
399
 
400
  if ( typeof(id) == 'object' )
@@ -444,13 +436,24 @@ var jQuery,
444
  $('label.inline-edit-image-alt', editRow).hide();
445
  }
446
 
 
 
 
 
 
447
  // hierarchical taxonomies
448
  $('.mla_category', rowData).each(function(){
449
- var term_ids = $(this).text(), taxname;
450
 
451
  if ( term_ids ) {
452
  taxname = $(this).attr('id').replace('_'+id, '');
453
  $('ul.'+taxname+'-checklist :checkbox', editRow).val(term_ids.split(','));
 
 
 
 
 
 
454
  }
455
  });
456
 
89
  return mla.inlineEditAttachment.revert();
90
  }
91
  });
92
+
93
  // Clicking "Refresh" submits the form, refreshing the page
94
  $('#bulk_refresh', progressRow).click(function(){
95
  $( '#bulk-progress a' ).prop( 'disabled', true );
102
  return false;
103
  });
104
 
 
 
 
 
 
 
 
 
 
105
  $('select[name="_status"] option[value="future"]', bulkRow).remove();
106
 
107
  $('#doaction, #doaction2').click(function(e){
386
  },
387
 
388
  quickEdit : function(id) {
389
+ var t = this, fields, editRow, rowData, checkedOnTop = [], icon, fIndex;
390
  t.revert();
391
 
392
  if ( typeof(id) == 'object' )
436
  $('label.inline-edit-image-alt', editRow).hide();
437
  }
438
 
439
+ // checklist taxonomies having "checked terms on top"
440
+ $('.checked_on_top', rowData).each(function(){
441
+ checkedOnTop[checkedOnTop.length] = $(this).attr('id').replace('_'+id, '');
442
+ });
443
+
444
  // hierarchical taxonomies
445
  $('.mla_category', rowData).each(function(){
446
+ var term_ids = $(this).text(), taxname, checkedLabels, checkedTerms;
447
 
448
  if ( term_ids ) {
449
  taxname = $(this).attr('id').replace('_'+id, '');
450
  $('ul.'+taxname+'-checklist :checkbox', editRow).val(term_ids.split(','));
451
+
452
+ if ( -1 !== checkedOnTop.indexOf( taxname ) ) {
453
+ checkedLabels = $('ul.'+taxname+'-checklist li :checked', editRow ).parents( 'label' ).remove().toArray().reverse();
454
+ checkedTerms = $( '<li></li>' ).html( checkedLabels );
455
+ $('ul.'+taxname+'-checklist', editRow ).prepend( checkedTerms );
456
+ }
457
  }
458
  });
459
 
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]}},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");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)}});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("span.catshow").click(function(){a(this).hide().next().show().parent().next().addClass("cat-hover")});a("span.cathide").click(function(){a(this).hide().prev().show().parent().next().removeClass("cat-hover")});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.widefat tbody").prepend(a("#bulk-edit")).prepend('<tr class="hidden"></tr>')}else{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+" .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.widefat 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.widefat 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.widefat 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,i,c,h=a("table.widefat .inline-edit-save .spinner"),d=a("#bulk-progress .inline-edit-save .error"),j=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++){i=a("#ttle"+g[f],j).remove();a("a",i).hide();e.append(i)}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(n,l){var o="no response.data",k,m;if(mla.settings.useSpinnerClass){h.removeClass("is-active")}else{h.hide()}if(n){if(!n.success){if(n.responseData){o=n.data}d.html(JSON.stringify(n)).show();mla.bulkEdit.offset=mla.bulkEdit.idsCount}else{m=a("#bulk-progress-running div").remove();a.each(m,function(){var p,q=a(this).html(),r=a(this).attr("id").substr(4);if("string"===typeof(n.data.item_results[r]["result"])){p=n.data.item_results[r]["result"];a(this).html(q+" ("+r+") - "+p)}a("#attachment-"+r).remove()});a("#bulk-progress-complete").append(m);mla.bulkEdit.complete+=mla.bulkEdit.running;mla.bulkEdit.running=0;mla.bulkEdit.unchanged+=n.data.unchanged;mla.bulkEdit.success+=n.data.success;mla.bulkEdit.failure+=n.data.failure;k=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(k).show()}}else{d.html(mla.settings.error).show();mla.bulkEdit.offset=mla.bulkEdit.idsCount}if(mla.bulkEdit.doCancel){d.html(mla.settings.bulkCanceled+". "+k).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(l,k){if(200==l.status){d.text("("+k+") "+l.responseText)}else{d.text(mla.settings.ajaxFailError+" ("+k+"), jqXHR( "+l.status+", "+l.statusText+", "+l.responseText+")")}})},quickEdit:function(h){var d=this,b,c,f,e,g;d.revert();if(typeof(h)=="object"){h=mla.utility.getId(h)}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+h).hide().after(c).after('<tr class="hidden"></tr>')}else{if(a(d.what+h).hasClass("alternate")){a(c).addClass("alternate")}a(d.what+h).hide().after(c)}f=a("#inline_"+h);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+"-"+h+" .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(".mla_category",f).each(function(){var i=a(this).text(),j;if(i){j=a(this).attr("id").replace("_"+h,"");a("ul."+j+"-checklist :checkbox",c).val(i.split(","))}});a(".mla_tags",f).each(function(){var l=a(this).text(),m=a(this).attr("id").replace("_"+h,""),k=a("textarea.tax_input_"+m,c),i=mla.settings.comma,j;if(l){if(","!==i){l=l.replace(/,/g,i)}k.val(l)}j=a(".lang",f).text();if(0<j.length){j="&lang="+j}else{j=""}k.suggest(ajaxurl+"?action=ajax-tag-search&tax="+m+"&preview_id="+h+j,{delay:500,minchars:2,multiple:true,multipleSep:mla.settings.comma+" "})});f=a(c).attr("id","edit-"+h).addClass("inline-editor").show().position().top;a(".ptitle",c).focus();a("html, body").animate({scrollTop:f},"fast");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.widefat .inline-edit-save .spinner").addClass("is-active")}else{a("table.widefat .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.widefat .inline-edit-save .spinner").removeClass("is-active")}else{a("table.widefat .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.widefat tr.inline-editor").attr("id"),d=a("table.widefat #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.widefat .inline-edit-save .spinner").removeClass("is-active")}else{a("table.widefat .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}}}a("#bulk-edit-set-parent",d).on("click",function(){return mla.inlineEditAttachment.bulkParentOpen()})}}return false},revert:function(){var b=a("table.widefat tr.inline-editor").attr("id");if(b){if(mla.settings.useSpinnerClass){a("table.widefat .inline-edit-save .spinner").removeClass("is-active")}else{a("table.widefat .inline-edit-save .spinner").hide()}if("bulk-edit"==b){if(mla.settings.useSpinnerClass){a("table.widefat #bulk-edit").removeClass("inline-editor").hide().siblings("tr.hidden").remove()}else{a("table.widefat #bulk-edit").removeClass("inline-editor").hide()}a("#bulk-titles").html("");a("#inlineedit").append(a("#bulk-edit"))}else{if("bulk-progress"==b){a("table.widefat #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]}},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");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)}});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.widefat tbody").prepend(a("#bulk-edit")).prepend('<tr class="hidden"></tr>')}else{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+" .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.widefat 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.widefat 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.widefat 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,i,c,h=a("table.widefat .inline-edit-save .spinner"),d=a("#bulk-progress .inline-edit-save .error"),j=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++){i=a("#ttle"+g[f],j).remove();a("a",i).hide();e.append(i)}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(n,l){var o="no response.data",k,m;if(mla.settings.useSpinnerClass){h.removeClass("is-active")}else{h.hide()}if(n){if(!n.success){if(n.responseData){o=n.data}d.html(JSON.stringify(n)).show();mla.bulkEdit.offset=mla.bulkEdit.idsCount}else{m=a("#bulk-progress-running div").remove();a.each(m,function(){var p,q=a(this).html(),r=a(this).attr("id").substr(4);if("string"===typeof(n.data.item_results[r]["result"])){p=n.data.item_results[r]["result"];a(this).html(q+" ("+r+") - "+p)}a("#attachment-"+r).remove()});a("#bulk-progress-complete").append(m);mla.bulkEdit.complete+=mla.bulkEdit.running;mla.bulkEdit.running=0;mla.bulkEdit.unchanged+=n.data.unchanged;mla.bulkEdit.success+=n.data.success;mla.bulkEdit.failure+=n.data.failure;k=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(k).show()}}else{d.html(mla.settings.error).show();mla.bulkEdit.offset=mla.bulkEdit.idsCount}if(mla.bulkEdit.doCancel){d.html(mla.settings.bulkCanceled+". "+k).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(l,k){if(200==l.status){d.text("("+k+") "+l.responseText)}else{d.text(mla.settings.ajaxFailError+" ("+k+"), jqXHR( "+l.status+", "+l.statusText+", "+l.responseText+")")}})},quickEdit:function(i){var d=this,b,c,f,h=[],e,g;d.revert();if(typeof(i)=="object"){i=mla.utility.getId(i)}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+i).hide().after(c).after('<tr class="hidden"></tr>')}else{if(a(d.what+i).hasClass("alternate")){a(c).addClass("alternate")}a(d.what+i).hide().after(c)}f=a("#inline_"+i);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+"-"+i+" .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("_"+i,"")});a(".mla_category",f).each(function(){var l=a(this).text(),m,k,j;if(l){m=a(this).attr("id").replace("_"+i,"");a("ul."+m+"-checklist :checkbox",c).val(l.split(","));if(-1!==h.indexOf(m)){k=a("ul."+m+"-checklist li :checked",c).parents("label").remove().toArray().reverse();j=a("<li></li>").html(k);a("ul."+m+"-checklist",c).prepend(j)}}});a(".mla_tags",f).each(function(){var m=a(this).text(),n=a(this).attr("id").replace("_"+i,""),l=a("textarea.tax_input_"+n,c),j=mla.settings.comma,k;if(m){if(","!==j){m=m.replace(/,/g,j)}l.val(m)}k=a(".lang",f).text();if(0<k.length){k="&lang="+k}else{k=""}l.suggest(ajaxurl+"?action=ajax-tag-search&tax="+n+"&preview_id="+i+k,{delay:500,minchars:2,multiple:true,multipleSep:mla.settings.comma+" "})});f=a(c).attr("id","edit-"+i).addClass("inline-editor").show().position().top;a(".ptitle",c).focus();a("html, body").animate({scrollTop:f},"fast");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.widefat .inline-edit-save .spinner").addClass("is-active")}else{a("table.widefat .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.widefat .inline-edit-save .spinner").removeClass("is-active")}else{a("table.widefat .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.widefat tr.inline-editor").attr("id"),d=a("table.widefat #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.widefat .inline-edit-save .spinner").removeClass("is-active")}else{a("table.widefat .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}}}a("#bulk-edit-set-parent",d).on("click",function(){return mla.inlineEditAttachment.bulkParentOpen()})}}return false},revert:function(){var b=a("table.widefat tr.inline-editor").attr("id");if(b){if(mla.settings.useSpinnerClass){a("table.widefat .inline-edit-save .spinner").removeClass("is-active")}else{a("table.widefat .inline-edit-save .spinner").hide()}if("bulk-edit"==b){if(mla.settings.useSpinnerClass){a("table.widefat #bulk-edit").removeClass("inline-editor").hide().siblings("tr.hidden").remove()}else{a("table.widefat #bulk-edit").removeClass("inline-editor").hide()}a("#bulk-titles").html("");a("#inlineedit").append(a("#bulk-edit"))}else{if("bulk-progress"==b){a("table.widefat #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);
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === Media Library Assistant ===
2
  Contributors: dglingren
3
  Donate link: http://fairtradejudaica.org/media-library-assistant-a-wordpress-plugin/
4
- Tags: attachments, gallery, images, media, media library, tag cloud, media-tags, media tags, tags, media categories, categories, IPTC, EXIF, XMP, GPS, PDF, metadata, photos, photographs, photoblog, photo albums, lightroom, MIME, mime-type, icon, upload, file extensions, WPML, Polylang
5
  Requires at least: 3.5.0
6
- Tested up to: 4.9.1
7
  Requires PHP: 5.3
8
- Stable tag: 2.72
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -155,11 +155,11 @@ Some of the MLA features such as where-used reporting and ALT Text sorting/searc
155
 
156
  Rest assured, custom templates and all of your option settings persist unchanged whenever you update to a new MLA version.
157
 
158
- You can also back a backup of your templates and settings from the Settings/Media Library Assistant General tab. Scroll to the bottom of the page and click Export ALL Settings to create a backup file. You can create as many files as you like; they are date and time stamped so you can restore the one you want later.
159
 
160
  In addition, you can deactivate and even delete the plugin without losing the settings. They will be there when you reinstall and activate in the future.
161
 
162
- You can permanently delete the settings and (optionally) the backup files if you are removing MLA for good. The Uninstall (Delete) Plugin Settings section of the General tab enables these options.
163
 
164
  = Are other language versions available? =
165
 
@@ -183,6 +183,17 @@ All of the MLA source code has been annotated with "DocBlocks", a special type o
183
 
184
  == Changelog ==
185
 
 
 
 
 
 
 
 
 
 
 
 
186
  = 2.72 =
187
  * Fix: Remove "Circular Reference" PHP Warnings in class-mla-mime-types.php.
188
 
@@ -310,8 +321,8 @@ All of the MLA source code has been annotated with "DocBlocks", a special type o
310
 
311
  == Upgrade Notice ==
312
 
313
- = 2.72 =
314
- Remove "Circular Reference" PHP Warnings in class-mla-mime-types.php.
315
 
316
  == Other Notes ==
317
 
1
  === Media Library Assistant ===
2
  Contributors: dglingren
3
  Donate link: http://fairtradejudaica.org/media-library-assistant-a-wordpress-plugin/
4
+ Tags: attachments, gallery, images, media, media library, tags, categories, IPTC, EXIF, XMP, GPS, PDF, metadata, photos, photographs, photo albums, MIME, mime-type, icon, upload, file extensions, WPML, Polylang
5
  Requires at least: 3.5.0
6
+ Tested up to: 4.9.5
7
  Requires PHP: 5.3
8
+ Stable tag: 2.73
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
155
 
156
  Rest assured, custom templates and all of your option settings persist unchanged whenever you update to a new MLA version.
157
 
158
+ You can also back a backup of your templates and settings from the Settings/Media Library Assistant General tab. Scroll to the bottom of the page and click "Export ALL Settings" to create a backup file. You can create as many files as you like; they are date and time stamped so you can restore the one you want later.
159
 
160
  In addition, you can deactivate and even delete the plugin without losing the settings. They will be there when you reinstall and activate in the future.
161
 
162
+ You can permanently delete the settings and (optionally) the backup files if you are removing MLA for good. The "Uninstall (Delete)" Plugin Settings section of the General tab enables these options.
163
 
164
  = Are other language versions available? =
165
 
183
 
184
  == Changelog ==
185
 
186
+ = 2.73 =
187
+ * New: The (optional) "checklist-style" formatting of flat taxonomies has been extended to the Media/Assistant Quick Edit and Bulk Edit areas.
188
+ * New: The (optional) "checked-on-top" formatting of checklist taxonomies has been extended to the Media/Assistant Quick Edit and Bulk Edit areas.
189
+ * New: A new "MLA Parent Search Example" plugin has been added. It adds a `parent:` prefix to the Media/Assistant Search Media text box that allows searches for items whose parent post/page matches the specified values.
190
+ * New: A new "MLA JavaScript Example" plugin has been added. It shows a simple method of adding and localizing scripts, using the WP Featherlight lightbox plugin as a sample application.
191
+ * New: For the `[mla_gallery]` shortcode, the `post_type` and `post_status` parameters now accept multiple values.
192
+ * Fix: For the Media/Assistant admin submenu, the correct SERVER_URI value is now generated for multisite and "subdirectory" WordPress installs.
193
+ * Fix: For "checklist style" flat taxonomy metaboxes, terms with quote marks in the name are now handled properly.
194
+ * Fix: For the `[mla_tag_cloud]` shortcode, the "Tag Cloud Pagination Parameters" have been restored.
195
+ * Fix: Restore Admin Columns Pro "default column" support for columns such as EXIF values.
196
+
197
  = 2.72 =
198
  * Fix: Remove "Circular Reference" PHP Warnings in class-mla-mime-types.php.
199
 
321
 
322
  == Upgrade Notice ==
323
 
324
+ = 2.73 =
325
+ Checklist-style flat taxonomy improvements, Admin Columns Pro fix, new and improved example plugins, e.g., "parent search". Five enhancements, four fixes.
326
 
327
  == Other Notes ==
328
 
tpls/admin-inline-edit-form.tpl CHANGED
@@ -2,10 +2,7 @@
2
  <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
3
  [+category_blocks+] </div></fieldset>
4
  <!-- template="category_block" -->
5
- <span class="title inline-edit-categories-label">[+tax_html+]
6
- <span class="catshow">[[+more+]]</span>
7
- <span class="cathide" style="display:none;">[[+less+]]</span>
8
- </span>
9
  <input type="hidden" name="tax_input[[+tax_attr+]][]" value="0" />
10
  <ul class="cat-checklist [+tax_attr+]-checklist">
11
  [+tax_checklist+]
2
  <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
3
  [+category_blocks+] </div></fieldset>
4
  <!-- template="category_block" -->
5
+ <span class="title inline-edit-categories-label">[+tax_html+]</span>
 
 
 
6
  <input type="hidden" name="tax_input[[+tax_attr+]][]" value="0" />
7
  <ul class="cat-checklist [+tax_attr+]-checklist">
8
  [+tax_checklist+]
tpls/documentation-settings-tab.tpl CHANGED
@@ -722,7 +722,7 @@ You can add <code>post_parent=all</code> to include or exclude attachments regar
722
  The "id" parameter lets you specify a post ID for your query. The gallery will display images which are attached to that post. If the "id" parameter is not specified, the <code>[mla_gallery]</code> behavior differs from the <code>[gallery]</code> behavior. If your query uses taxonomy or custom field parameters, "author", "author_name" or "s" (search term), then the query will NOT be restricted to items attached to the current post. This lets you build a gallery with any combination of Media Library items that match the parameters.
723
  </p>
724
  <p>
725
- The "ids" parameter lets you specify a list of Post IDs. The attachment(s) matching the "ids" values will be displayed in the order specified by the list.
726
  </p>
727
  <p>
728
  You can use the "post_parent" to override the default behavior. If you set "post_parent" to a specific post ID, only the items attached to that post are displayed. You can also specify multiple values separated by commas, e.g., <code>post_parent=1,2,3</code>. There are four additional values available:
@@ -969,7 +969,7 @@ For compatibility with the WordPress <code>[gallery]</code> shortcode, this para
969
  </p>
970
  <h4>Post Type, Post Status</h4>
971
  <p>
972
- For compatibility with the WordPress <code>[gallery]</code> shortcode, these parameters default to <code>post_type=attachment</code>, <code>post_status=inherit</code>. You can override the defaults to, for example, display items in the trash (<code>post_status=trash</code>).
973
  </p>
974
  <p>
975
  You can change the <code>post_type</code> parameter to compose a "gallery" of WordPress objects such as posts, pages and custom post types. For example, to display a gallery of the published posts in a particular category you can code something like:
722
  The "id" parameter lets you specify a post ID for your query. The gallery will display images which are attached to that post. If the "id" parameter is not specified, the <code>[mla_gallery]</code> behavior differs from the <code>[gallery]</code> behavior. If your query uses taxonomy or custom field parameters, "author", "author_name" or "s" (search term), then the query will NOT be restricted to items attached to the current post. This lets you build a gallery with any combination of Media Library items that match the parameters.
723
  </p>
724
  <p>
725
+ The "ids" parameter lets you specify a list of item/attachment IDs. The attachment(s) matching the "ids" values will be displayed in the order specified by the list.
726
  </p>
727
  <p>
728
  You can use the "post_parent" to override the default behavior. If you set "post_parent" to a specific post ID, only the items attached to that post are displayed. You can also specify multiple values separated by commas, e.g., <code>post_parent=1,2,3</code>. There are four additional values available:
969
  </p>
970
  <h4>Post Type, Post Status</h4>
971
  <p>
972
+ For compatibility with the WordPress <code>[gallery]</code> shortcode, these parameters default to <code>post_type=attachment</code>, <code>post_status=inherit</code>. You can override the defaults to, for example, display items in the trash (<code>post_status=trash</code>). You can specify more than one value in a comma-separated list, e.g., <code>post_type="post,page"</code>.
973
  </p>
974
  <p>
975
  You can change the <code>post_type</code> parameter to compose a "gallery" of WordPress objects such as posts, pages and custom post types. For example, to display a gallery of the published posts in a particular category you can code something like:
tpls/mla-add-new-bulk-edit.tpl CHANGED
@@ -3,10 +3,7 @@
3
  [+category_blocks+]
4
  </div></fieldset>
5
  <!-- template="category_block" -->
6
- <span class="title inline-edit-categories-label">[+tax_html+]
7
- <span class="catshow">[[+more+]]</span>
8
- <span class="cathide" style="display:none;">[[+less+]]</span>
9
- </span>
10
  <input type="hidden" name="tax_input[[+tax_attr+]][]" value="0" />
11
  <ul class="cat-checklist [+tax_attr+]-checklist">
12
  [+tax_checklist+]
3
  [+category_blocks+]
4
  </div></fieldset>
5
  <!-- template="category_block" -->
6
+ <span class="title inline-edit-categories-label">[+tax_html+]</span>
 
 
 
7
  <input type="hidden" name="tax_input[[+tax_attr+]][]" value="0" />
8
  <ul class="cat-checklist [+tax_attr+]-checklist">
9
  [+tax_checklist+]