Version Description
- New: For the "Field-level Substitution Parameters", a new "mso:" prefix gives access to the Document Properties embedded in Office Open XML file formats (e.g., docx, xlsx, pptx). More information is given in the "Prefix values" section of the Settings/Media Library Assistant Documentation tab.
- New: For the Bulk Edit, a new
[+reverse_index+]
substitution parameter counts down from the number of selected items to one. More informatin is in the Help menu for the Media/Assistant admin screen. - New: For the "WooCommerce Fixit" example plugin, product category thumbnail information is added to the "Woo Used In" Media/Assistant table column.
- Fix: IPTC/EXIF and Custom Field mapping logic updated for compatibility with WordPress 5.3.
- Fix: Updated Media Manager Modal Window and Media/Library Grid view styles for compatibility with WordPress 5.3.
- Fix: For the Settings/Media Library Assistant Example Plugins page, update the
MLA_Upgrader_Skin
code for compatibility with WordPress 5.3. - Fix: For the Settings/Media Library Assistant IPTC/EXIF tab, PHP Notices for invalid taxonomy rules have been resolved.
- Fix: For the "replace()" option/format value, empty replacement values are now allowed.
- Fix: For custom field mapping rules, "Option: Array" now works with multi-level nested subarrays.
- Fix: For custom field mapping rules, "Delete NULL Values" now works with "Format: Raw".
- Fix: For "WordPress-style" PDF thumbnail generation, occasional PHP "Illegal string offset 'sizes'" errors have been resolved.
Download this release
Release Info
Developer | dglingren |
Plugin | Media Library Assistant |
Version | 2.81 |
Comparing to | |
See all releases |
Code changes from version 2.80 to 2.81
- examples/plugins/woofixit.php +49 -9
- includes/class-mla-core.php +1 -1
- includes/class-mla-data-office.php +98 -0
- includes/class-mla-data-source.php +9 -1
- includes/class-mla-data.php +313 -128
- includes/class-mla-options.php +61 -13
- includes/class-mla-settings-documentation-tab.php +94 -35
- includes/class-mla-settings-iptc-exif-tab.php +1 -0
- includes/class-mla-thumbnail-generation.php +4 -0
- includes/mla-main-search-box-template.php +1 -1
- includes/mla-media-modal-js-template.php +19 -2
- index.php +1 -1
- js/mla-media-modal-scripts.js +3 -1
- js/mla-media-modal-scripts.min.js +1 -1
- readme.txt +17 -4
- tpls/admin-display-settings-example-tab.tpl +3 -3
- tpls/admin-display-settings-upload-tab.tpl +3 -3
- tpls/documentation-settings-tab.tpl +31 -0
- tpls/help-for-media_page_mla-menu.tpl +1 -1
examples/plugins/woofixit.php
CHANGED
@@ -76,8 +76,12 @@
|
|
76 |
* opened on 10/18/2018 by "alx359".
|
77 |
* https://wordpress.org/support/topic/wc-fixit-tools-replace-all-item-name-slug/
|
78 |
*
|
|
|
|
|
|
|
|
|
79 |
* @package WooCommerce Fixit
|
80 |
-
* @version 2.
|
81 |
*/
|
82 |
|
83 |
/*
|
@@ -85,10 +89,10 @@ Plugin Name: WooCommerce Fixit
|
|
85 |
Plugin URI: http://davidlingren.com/
|
86 |
Description: Adds "product:" and "product_terms:" custom substitution prefixes and adds a Tools/Woo Fixit submenu with buttons to perform a variety of MLA/WooCommerce repair and enhancement operations.
|
87 |
Author: David Lingren
|
88 |
-
Version: 2.
|
89 |
Author URI: http://davidlingren.com/
|
90 |
|
91 |
-
Copyright 2014-
|
92 |
|
93 |
This program is free software; you can redistribute it and/or modify
|
94 |
it under the terms of the GNU General Public License as published by
|
@@ -118,7 +122,7 @@ class Woo_Fixit {
|
|
118 |
*
|
119 |
* @var string
|
120 |
*/
|
121 |
-
const CURRENT_VERSION = '2.
|
122 |
|
123 |
/**
|
124 |
* Slug prefix for registering and enqueueing submenu pages, style sheets and scripts
|
@@ -753,7 +757,7 @@ class Woo_Fixit {
|
|
753 |
|
754 |
/**
|
755 |
* Array of Attachments giving Product assignments:
|
756 |
-
* attachment_id => array( '_thumbnail_id' => array( thumbnail_ids ), '_product_image_gallery' => array( gallery_ids )
|
757 |
*
|
758 |
* @since 1.00
|
759 |
*
|
@@ -785,13 +789,28 @@ class Woo_Fixit {
|
|
785 |
$upper_bound = 0x7FFFFFFF;
|
786 |
}
|
787 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
788 |
$query = sprintf( 'SELECT m.*, p.post_title FROM %1$s as m INNER JOIN %2$s as p ON m.post_id = p.ID WHERE ( p.post_type = \'product\' ) AND ( p.ID >= %3$d ) AND ( p.ID <= %4$d) AND ( m.meta_key IN ( \'_product_image_gallery\', \'_thumbnail_id\' ) ) GROUP BY m.post_id, m.meta_id ORDER BY m.post_id', $wpdb->postmeta, $wpdb->posts, $lower_bound, $upper_bound );
|
789 |
$results = $wpdb->get_results( $query );
|
790 |
//error_log( __LINE__ . ' Woo_Fixit::_build_product_attachments() $results = ' . var_export( $results, true ), 0 );
|
791 |
|
792 |
-
self::$product_attachments = array();
|
793 |
-
self::$attachment_products = array();
|
794 |
-
|
795 |
foreach ( $results as $result ) {
|
796 |
if ( $build_pa ) {
|
797 |
self::$product_attachments[ $result->post_id ]['post_title'] = trim( $result->post_title );
|
@@ -1731,6 +1750,8 @@ VALUES ( {$attachment},'_wp_attachment_image_alt','{$text}' )";
|
|
1731 |
$insert_count = 0;
|
1732 |
$thumbnail_count = 0;
|
1733 |
$gallery_count = 0;
|
|
|
|
|
1734 |
foreach( self::$attachment_products as $post_id => $result ) {
|
1735 |
if ( empty( $result['_thumbnail_id'] ) ) {
|
1736 |
$thumbnails = array();
|
@@ -1744,6 +1765,12 @@ VALUES ( {$attachment},'_wp_attachment_image_alt','{$text}' )";
|
|
1744 |
$galleries = $result['_product_image_gallery'];
|
1745 |
}
|
1746 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1747 |
// Compose references
|
1748 |
$references = '';
|
1749 |
$thumbnail_text = '';
|
@@ -1766,9 +1793,22 @@ VALUES ( {$attachment},'_wp_attachment_image_alt','{$text}' )";
|
|
1766 |
$references .= 'Galleries: ' . $gallery_text;
|
1767 |
}
|
1768 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1769 |
if ( !empty( $references ) ) {
|
1770 |
$thumbnail_count += count( $thumbnails );
|
1771 |
$gallery_count += count( $galleries );
|
|
|
1772 |
|
1773 |
// Insert the new values
|
1774 |
$insert_query = "INSERT INTO {$wpdb->postmeta} ( `post_id`,`meta_key`,`meta_value` )
|
@@ -1778,7 +1818,7 @@ VALUES ( {$attachment},'_wp_attachment_image_alt','{$text}' )";
|
|
1778 |
} // found references
|
1779 |
} // foreach product
|
1780 |
|
1781 |
-
return "_where_used() deleted {$delete_count} items(s) in "Woo Used In", then inserted {$insert_count} items(s) with {$thumbnail_count} thumbnail(s)
|
1782 |
} // _where_used
|
1783 |
|
1784 |
/**
|
76 |
* opened on 10/18/2018 by "alx359".
|
77 |
* https://wordpress.org/support/topic/wc-fixit-tools-replace-all-item-name-slug/
|
78 |
*
|
79 |
+
* Enhanced for support topic "Product categories thumbnails"
|
80 |
+
* opened on 9/18/2019 by "wimvl".
|
81 |
+
* https://wordpress.org/support/topic/product-categories-thumbnails-2/
|
82 |
+
*
|
83 |
* @package WooCommerce Fixit
|
84 |
+
* @version 2.05
|
85 |
*/
|
86 |
|
87 |
/*
|
89 |
Plugin URI: http://davidlingren.com/
|
90 |
Description: Adds "product:" and "product_terms:" custom substitution prefixes and adds a Tools/Woo Fixit submenu with buttons to perform a variety of MLA/WooCommerce repair and enhancement operations.
|
91 |
Author: David Lingren
|
92 |
+
Version: 2.05
|
93 |
Author URI: http://davidlingren.com/
|
94 |
|
95 |
+
Copyright 2014-2019 David Lingren
|
96 |
|
97 |
This program is free software; you can redistribute it and/or modify
|
98 |
it under the terms of the GNU General Public License as published by
|
122 |
*
|
123 |
* @var string
|
124 |
*/
|
125 |
+
const CURRENT_VERSION = '2.05';
|
126 |
|
127 |
/**
|
128 |
* Slug prefix for registering and enqueueing submenu pages, style sheets and scripts
|
757 |
|
758 |
/**
|
759 |
* Array of Attachments giving Product assignments:
|
760 |
+
* attachment_id => array( '_thumbnail_id' => array( thumbnail_ids ), '_product_image_gallery' => array( gallery_ids ), 'category_thumbnail' => array( term_id => name ) )
|
761 |
*
|
762 |
* @since 1.00
|
763 |
*
|
789 |
$upper_bound = 0x7FFFFFFF;
|
790 |
}
|
791 |
|
792 |
+
self::$product_attachments = array();
|
793 |
+
self::$attachment_products = array();
|
794 |
+
|
795 |
+
$query = sprintf( 'SELECT t.term_id, t.name, tm.meta_value FROM %1$s as t INNER JOIN %2$s as tt ON t.term_id = tt.term_id INNER JOIN %3$s as tm ON t.term_id = tm.term_id WHERE ( ( tt.taxonomy = \'product_cat\' ) AND ( tm.meta_key = \'thumbnail_id\' ) AND ( tm.meta_value > 0 ) AND ( tm.meta_value >= %4$d ) AND ( tm.meta_value <= %5$d) ) ORDER BY tm.meta_value, t.term_id', $wpdb->terms, $wpdb->term_taxonomy, $wpdb->termmeta, $lower_bound, $upper_bound );
|
796 |
+
$results = $wpdb->get_results( $query );
|
797 |
+
//error_log( __LINE__ . ' Woo_Fixit::_build_product_attachments() $results = ' . var_export( $results, true ), 0 );
|
798 |
+
foreach ( $results as $result ) {
|
799 |
+
$key = (integer) $result->meta_value;
|
800 |
+
if ( isset( self::$attachment_products[ $key ] ) ) {
|
801 |
+
self::$attachment_products[ $key ]['category_thumbnail'][ (integer) $result->term_id ] = $result->name;
|
802 |
+
} else {
|
803 |
+
self::$attachment_products[ $key ]['category_thumbnail'] = array( (integer) $result->term_id => $result->name );
|
804 |
+
}
|
805 |
+
}
|
806 |
+
//error_log( __LINE__ . ' Woo_Fixit::_build_product_attachments() self::$attachment_products = ' . var_export( self::$attachment_products, true ), 0 );
|
807 |
+
|
808 |
+
unset( $results );
|
809 |
+
|
810 |
$query = sprintf( 'SELECT m.*, p.post_title FROM %1$s as m INNER JOIN %2$s as p ON m.post_id = p.ID WHERE ( p.post_type = \'product\' ) AND ( p.ID >= %3$d ) AND ( p.ID <= %4$d) AND ( m.meta_key IN ( \'_product_image_gallery\', \'_thumbnail_id\' ) ) GROUP BY m.post_id, m.meta_id ORDER BY m.post_id', $wpdb->postmeta, $wpdb->posts, $lower_bound, $upper_bound );
|
811 |
$results = $wpdb->get_results( $query );
|
812 |
//error_log( __LINE__ . ' Woo_Fixit::_build_product_attachments() $results = ' . var_export( $results, true ), 0 );
|
813 |
|
|
|
|
|
|
|
814 |
foreach ( $results as $result ) {
|
815 |
if ( $build_pa ) {
|
816 |
self::$product_attachments[ $result->post_id ]['post_title'] = trim( $result->post_title );
|
1750 |
$insert_count = 0;
|
1751 |
$thumbnail_count = 0;
|
1752 |
$gallery_count = 0;
|
1753 |
+
$category_count = 0;
|
1754 |
+
|
1755 |
foreach( self::$attachment_products as $post_id => $result ) {
|
1756 |
if ( empty( $result['_thumbnail_id'] ) ) {
|
1757 |
$thumbnails = array();
|
1765 |
$galleries = $result['_product_image_gallery'];
|
1766 |
}
|
1767 |
|
1768 |
+
if ( empty( $result['category_thumbnail'] ) ) {
|
1769 |
+
$categories = array();
|
1770 |
+
} else {
|
1771 |
+
$categories = $result['category_thumbnail'];
|
1772 |
+
}
|
1773 |
+
|
1774 |
// Compose references
|
1775 |
$references = '';
|
1776 |
$thumbnail_text = '';
|
1793 |
$references .= 'Galleries: ' . $gallery_text;
|
1794 |
}
|
1795 |
|
1796 |
+
$category_text = '';
|
1797 |
+
foreach ( $categories as $term_id => $category ) {
|
1798 |
+
$category_text .= sprintf( '(%1$d) %2$s,', $term_id, $category );
|
1799 |
+
}
|
1800 |
+
if ( !empty( $category_text ) ) {
|
1801 |
+
if ( !empty( $references ) ) {
|
1802 |
+
$references .= '; ';
|
1803 |
+
}
|
1804 |
+
|
1805 |
+
$references .= 'Categories: ' . $category_text;
|
1806 |
+
}
|
1807 |
+
|
1808 |
if ( !empty( $references ) ) {
|
1809 |
$thumbnail_count += count( $thumbnails );
|
1810 |
$gallery_count += count( $galleries );
|
1811 |
+
$category_count += count( $categories );
|
1812 |
|
1813 |
// Insert the new values
|
1814 |
$insert_query = "INSERT INTO {$wpdb->postmeta} ( `post_id`,`meta_key`,`meta_value` )
|
1818 |
} // found references
|
1819 |
} // foreach product
|
1820 |
|
1821 |
+
return "_where_used() deleted {$delete_count} items(s) in "Woo Used In", then inserted {$insert_count} items(s) with {$thumbnail_count} thumbnail(s), {$gallery_count} gallery(s) and {$category_count} category thumbnails.\n";
|
1822 |
} // _where_used
|
1823 |
|
1824 |
/**
|
includes/class-mla-core.php
CHANGED
@@ -21,7 +21,7 @@ class MLACore {
|
|
21 |
*
|
22 |
* @var string
|
23 |
*/
|
24 |
-
const CURRENT_MLA_VERSION = '2.
|
25 |
|
26 |
/**
|
27 |
* Slug for registering and enqueueing plugin style sheets (moved from class-mla-main.php)
|
21 |
*
|
22 |
* @var string
|
23 |
*/
|
24 |
+
const CURRENT_MLA_VERSION = '2.81';
|
25 |
|
26 |
/**
|
27 |
* Slug for registering and enqueueing plugin style sheets (moved from class-mla-main.php)
|
includes/class-mla-data-office.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Meta data parsing functions for Microsoft Office documents
|
4 |
+
*
|
5 |
+
* @package Media Library Assistant
|
6 |
+
* @since 2.82
|
7 |
+
* /
|
8 |
+
|
9 |
+
$reader = new XMLReader();
|
10 |
+
|
11 |
+
$reader->open('zip://' . dirname(__FILE__) . '/test.odt#meta.xml');
|
12 |
+
$odt_meta = array();
|
13 |
+
while ($reader->read()) {
|
14 |
+
if ($reader->nodeType == XMLREADER::ELEMENT) {
|
15 |
+
$elm = $reader->name;
|
16 |
+
} else {
|
17 |
+
if ($reader->nodeType == XMLREADER::END_ELEMENT && $reader->name == 'office:meta') {
|
18 |
+
break;
|
19 |
+
}
|
20 |
+
if (!trim($reader->value)) {
|
21 |
+
continue;
|
22 |
+
}
|
23 |
+
$odt_meta[$elm] = $reader->value;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
print_r($odt_meta);
|
27 |
+
// */
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Class MLA (Media Library Assistant) Office extracts meta data from Microsoft Office files
|
31 |
+
*
|
32 |
+
* @package Media Library Assistant
|
33 |
+
* @since 2.82
|
34 |
+
*/
|
35 |
+
class MLAOffice {
|
36 |
+
/**
|
37 |
+
* Extract Metadata from a Microsoft Office file
|
38 |
+
*
|
39 |
+
* @since 2.82
|
40 |
+
*
|
41 |
+
* @param string full path to the desired file
|
42 |
+
*
|
43 |
+
* @return array ( 'mso' => array( key => value ) ) for each metadata field, in string format
|
44 |
+
*/
|
45 |
+
public static function mla_extract_office_metadata( $file_name ) {
|
46 |
+
$metadata = array();
|
47 |
+
|
48 |
+
if ( ! file_exists( $file_name ) ) {
|
49 |
+
return array( 'mso' => $metadata );
|
50 |
+
}
|
51 |
+
|
52 |
+
$zip = new ZipArchive();
|
53 |
+
if ( TRUE !== $zip->open( $file_name ) ) {
|
54 |
+
MLACore::mla_debug_add( __LINE__ . ' ' . __( 'ERROR', 'media-library-assistant' ) . ': ' . _x( 'mla_extract_office_metadata zip open failed.', 'error_log', 'media-library-assistant' ), MLACore::MLA_DEBUG_CATEGORY_ANY );
|
55 |
+
return array( 'mso' => $metadata );
|
56 |
+
}
|
57 |
+
|
58 |
+
$index = $zip->locateName('docProps/app.xml');
|
59 |
+
if ( $index ) {
|
60 |
+
$xml = $zip->getFromIndex( $index );
|
61 |
+
$metadata = MLAData::mla_parse_xml_string( $xml );
|
62 |
+
|
63 |
+
if ( NULL === $metadata ) {
|
64 |
+
MLACore::mla_debug_add( __LINE__ . ' ' . __( 'ERROR', 'media-library-assistant' ) . ': ' . _x( 'mla_extract_office_metadata mla_parse_xml_string( docProps/app.xml ) failed.', 'error_log', 'media-library-assistant' ), MLACore::MLA_DEBUG_CATEGORY_ANY );
|
65 |
+
$metadata = array();
|
66 |
+
}
|
67 |
+
} else {
|
68 |
+
MLACore::mla_debug_add( __LINE__ . ' ' . __( 'ERROR', 'media-library-assistant' ) . ': ' . _x( 'mla_extract_office_metadata locateName( docProps/app.xml ) failed.', 'error_log', 'media-library-assistant' ), MLACore::MLA_DEBUG_CATEGORY_ANY );
|
69 |
+
}
|
70 |
+
|
71 |
+
$app_namespace = '';
|
72 |
+
if ( isset( $metadata['app'] ) && !empty( $metadata['app']['xmlns'] ) ) {
|
73 |
+
$app_namespace = $metadata['app']['xmlns'];
|
74 |
+
unset ( $metadata['app']['xmlns'] );
|
75 |
+
}
|
76 |
+
|
77 |
+
$index = $zip->locateName('docProps/core.xml');
|
78 |
+
if ( $index ) {
|
79 |
+
$xml = $zip->getFromIndex( $index );
|
80 |
+
$core = MLAData::mla_parse_xml_string( $xml );
|
81 |
+
|
82 |
+
if ( NULL === $core ) {
|
83 |
+
MLACore::mla_debug_add( __LINE__ . ' ' . __( 'ERROR', 'media-library-assistant' ) . ': ' . _x( 'mla_extract_office_metadata mla_parse_xml_string( docProps/core.xml ) failed.', 'error_log', 'media-library-assistant' ), MLACore::MLA_DEBUG_CATEGORY_ANY );
|
84 |
+
} else {
|
85 |
+
$metadata = array_merge( $metadata, $core );
|
86 |
+
}
|
87 |
+
} else {
|
88 |
+
MLACore::mla_debug_add( __LINE__ . ' ' . __( 'ERROR', 'media-library-assistant' ) . ': ' . _x( 'mla_extract_office_metadata locateName( docProps/core.xml ) failed.', 'error_log', 'media-library-assistant' ), MLACore::MLA_DEBUG_CATEGORY_ANY );
|
89 |
+
}
|
90 |
+
|
91 |
+
if ( !empty( $app_namespace ) ) {
|
92 |
+
$metadata['xmlns']['app'] = $app_namespace;
|
93 |
+
}
|
94 |
+
|
95 |
+
return array( 'mso' => $metadata );
|
96 |
+
}
|
97 |
+
} // class MLAOffice
|
98 |
+
?>
|
includes/class-mla-data-source.php
CHANGED
@@ -482,7 +482,7 @@ class MLAData_Source {
|
|
482 |
$item_values = MLAData::mla_expand_field_level_parameters( $template, NULL, $item_values, $post_id, $data_value['keep_existing'], $default_option, $attachment_metadata );
|
483 |
|
484 |
if ( 'array' == $default_option ) {
|
485 |
-
$result = MLAData::mla_parse_array_template( $template, $item_values );
|
486 |
$result = MLAData_Source::_evaluate_array_result( $result, $data_value['option'], $data_value['keep_existing'] );
|
487 |
} else {
|
488 |
$result = MLAData::mla_parse_template( $template, $item_values );
|
@@ -795,6 +795,14 @@ class MLAData_Source {
|
|
795 |
}
|
796 |
}
|
797 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
798 |
case 'found_rows':
|
799 |
if ( class_exists( 'MLA' ) && !empty( MLA::$bulk_edit_data_source['cb_count'] ) ) {
|
800 |
$result = MLA::$bulk_edit_data_source['cb_count'];
|
482 |
$item_values = MLAData::mla_expand_field_level_parameters( $template, NULL, $item_values, $post_id, $data_value['keep_existing'], $default_option, $attachment_metadata );
|
483 |
|
484 |
if ( 'array' == $default_option ) {
|
485 |
+
$result = MLAData::mla_parse_array_template( $template, $item_values, $data_value['option'] );
|
486 |
$result = MLAData_Source::_evaluate_array_result( $result, $data_value['option'], $data_value['keep_existing'] );
|
487 |
} else {
|
488 |
$result = MLAData::mla_parse_template( $template, $item_values );
|
795 |
}
|
796 |
}
|
797 |
break;
|
798 |
+
case 'reverse_index':
|
799 |
+
if ( class_exists( 'MLA' ) && !empty( MLA::$bulk_edit_data_source['cb_index'] ) && !empty( MLA::$bulk_edit_data_source['cb_count'] ) ) {
|
800 |
+
$result = 1 + MLA::$bulk_edit_data_source['cb_count'] - MLA::$bulk_edit_data_source['cb_index'];
|
801 |
+
if ( !empty( $data_value['format'] ) ) {
|
802 |
+
$result += absint( $data_value['format'] );
|
803 |
+
}
|
804 |
+
}
|
805 |
+
break;
|
806 |
case 'found_rows':
|
807 |
if ( class_exists( 'MLA' ) && !empty( MLA::$bulk_edit_data_source['cb_count'] ) ) {
|
808 |
$result = MLA::$bulk_edit_data_source['cb_count'];
|
includes/class-mla-data.php
CHANGED
@@ -81,11 +81,12 @@ class MLAData {
|
|
81 |
*
|
82 |
* @param string A formatting string containing [+placeholders+]
|
83 |
* @param array An associative array containing keys and values e.g. array('key' => 'value')
|
|
|
84 |
*
|
85 |
* @return mixed string or array, depending on placeholder values. Placeholders corresponding
|
86 |
* to the keys of the markup_values will be replaced with their values.
|
87 |
*/
|
88 |
-
public static function mla_parse_array_template( $tpl, $markup_values ) {
|
89 |
$result = array();
|
90 |
$offset = 0;
|
91 |
while ( false !== $start = strpos( $tpl, '[+', $offset ) ) {
|
@@ -124,9 +125,7 @@ class MLAData {
|
|
124 |
$result[] = substr( $tpl, $offset );
|
125 |
}
|
126 |
|
127 |
-
|
128 |
-
* Build a final result, eliminating empty elements and expanding array elements
|
129 |
-
*/
|
130 |
$final = array();
|
131 |
foreach ( $result as $element ) {
|
132 |
if ( is_scalar( $element ) ) {
|
@@ -138,13 +137,13 @@ class MLAData {
|
|
138 |
foreach ($element as $key => $value ) {
|
139 |
if ( is_scalar( $value ) ) {
|
140 |
$value = trim( $value );
|
|
|
|
|
141 |
} elseif ( ! empty( $value ) ) {
|
142 |
$value = var_export( $value, true );
|
143 |
}
|
144 |
|
145 |
-
|
146 |
-
* Preserve any keys with string values
|
147 |
-
*/
|
148 |
if ( ! empty( $value ) ) {
|
149 |
if ( is_integer( $key ) ) {
|
150 |
$final[] = $value;
|
@@ -431,9 +430,8 @@ class MLAData {
|
|
431 |
*/
|
432 |
private static function _evaluate_template_array_node( $node, $markup_values = array() ) {
|
433 |
$result = array();
|
434 |
-
|
435 |
-
|
436 |
-
*/
|
437 |
if ( ! isset( $node['type'] ) ) {
|
438 |
foreach ( $node as $value ) {
|
439 |
$node_result = self::_evaluate_template_array_node( $value, $markup_values );
|
@@ -443,7 +441,7 @@ class MLAData {
|
|
443 |
} else { // array of sub-nodes
|
444 |
switch ( $node['type'] ) {
|
445 |
case 'string':
|
446 |
-
$result[] = self::mla_parse_array_template( $node['value'], $markup_values );
|
447 |
break;
|
448 |
case 'test':
|
449 |
$node_value = $node['value'];
|
@@ -596,9 +594,7 @@ class MLAData {
|
|
596 |
}
|
597 |
}
|
598 |
|
599 |
-
|
600 |
-
* Step 3: walk the element tree and process each node
|
601 |
-
*/
|
602 |
if ( $return_arrays ) {
|
603 |
$results = self::_evaluate_template_array_node( $root_element, $markup_values );
|
604 |
} else {
|
@@ -1106,7 +1102,7 @@ class MLAData {
|
|
1106 |
}
|
1107 |
}
|
1108 |
|
1109 |
-
if ( empty( $pattern ) ||
|
1110 |
// No pattern or no replacement - return unaltered value
|
1111 |
break;
|
1112 |
}
|
@@ -1431,6 +1427,17 @@ class MLAData {
|
|
1431 |
$markup_values[ $key ] = $record;
|
1432 |
}
|
1433 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1434 |
break;
|
1435 |
case 'matches':
|
1436 |
$markup_values[ $key ] = isset( MLAData::$regex_matches[ $value['value'] ] ) ? MLAData::$regex_matches[ $value['value'] ] : '';
|
@@ -2037,91 +2044,44 @@ class MLAData {
|
|
2037 |
}
|
2038 |
|
2039 |
/**
|
2040 |
-
* Extract
|
2041 |
*
|
2042 |
-
* @since 2.
|
2043 |
*
|
2044 |
-
* @param string
|
2045 |
-
* @param integer offset within the file of the search start point
|
2046 |
*
|
2047 |
* @return mixed array of metadata values or NULL on failure
|
2048 |
*/
|
2049 |
-
public static function
|
2050 |
-
//error_log( __LINE__ . " MLAData::
|
2051 |
-
|
2052 |
-
$xmp_chunk = file_get_contents( $file_name, true, NULL, $file_offset, $chunksize );
|
2053 |
-
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata( {$file_offset} ) chunk = \r\n" . MLAData::mla_hex_dump( $xmp_chunk ), 0 );
|
2054 |
-
|
2055 |
-
/*
|
2056 |
-
* If necessary and possible, advance the $xmp_chunk through the file until it contains the start tag
|
2057 |
-
*/
|
2058 |
-
if ( false === ( $start_tag = strpos( $xmp_chunk, '<x:xmpmeta' ) ) && ( $chunksize == strlen( $xmp_chunk ) ) ) {
|
2059 |
-
$new_offset = $file_offset + ( $chunksize - 16 );
|
2060 |
-
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata( {$new_offset} ) ", 0 );
|
2061 |
-
$xmp_chunk = file_get_contents( $file_name, true, NULL, $new_offset, $chunksize );
|
2062 |
-
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata( {$new_offset} ) chunk = \r\n" . MLAData::mla_hex_dump( $xmp_chunk ), 0 );
|
2063 |
-
while ( false === ( $start_tag = strpos( $xmp_chunk, '<x:xmpmeta' ) ) && ( $chunksize == strlen( $xmp_chunk ) ) ) {
|
2064 |
-
$new_offset = $new_offset + ( $chunksize - 16 );
|
2065 |
-
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata( {$new_offset} ) ", 0 );
|
2066 |
-
$xmp_chunk = file_get_contents( $file_name, true, NULL, $new_offset, $chunksize );
|
2067 |
-
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata( {$new_offset} ) chunk = \r\n" . MLAData::mla_hex_dump( $xmp_chunk ), 0 );
|
2068 |
-
} // while not found
|
2069 |
-
} else { // if not found
|
2070 |
-
$new_offset = $file_offset;
|
2071 |
-
}
|
2072 |
-
|
2073 |
-
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata( {$start_tag} ) ", 0 );
|
2074 |
-
if ( false === $start_tag ) {
|
2075 |
-
return NULL;
|
2076 |
-
}
|
2077 |
|
2078 |
-
|
2079 |
-
|
2080 |
-
|
2081 |
-
if ( false === ( $end_tag = strpos( $xmp_chunk, '</x:xmpmeta>', $start_tag ) ) && ( $chunksize == strlen( $xmp_chunk ) ) ) {
|
2082 |
-
$new_offset = $new_offset + $start_tag;
|
2083 |
-
$start_tag = 0;
|
2084 |
-
$new_chunksize = $chunksize + $chunksize;
|
2085 |
-
$xmp_chunk = file_get_contents( $file_name, true, NULL, $new_offset, $new_chunksize );
|
2086 |
-
while ( false === ( $end_tag = strpos( $xmp_chunk, '</x:xmpmeta>' ) ) && ( $new_chunksize == strlen( $xmp_chunk ) ) ) {
|
2087 |
-
$new_chunksize = $new_chunksize + $chunksize;
|
2088 |
-
$xmp_chunk = file_get_contents( $file_name, true, NULL, $new_offset, $new_chunksize );
|
2089 |
-
} // while not found
|
2090 |
-
} // if not found
|
2091 |
-
|
2092 |
-
if ( false === $end_tag ) {
|
2093 |
-
return NULL;
|
2094 |
-
}
|
2095 |
-
|
2096 |
-
$xmp_string = "<?xml version='1.0'?>\n" . substr($xmp_chunk, $start_tag, ( $end_tag + 12 ) - $start_tag );
|
2097 |
-
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata xmp_string = " . var_export( $xmp_string, true ), 0 );
|
2098 |
-
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata xmp_string = \r\n" . MLAData::mla_hex_dump( $xmp_string ), 0 );
|
2099 |
-
// experimental damage repair for GodsHillPC
|
2100 |
-
$xmp_string = str_replace( "\000", '0', $xmp_string );
|
2101 |
-
$xmp_values = array();
|
2102 |
$xml_parser = xml_parser_create('UTF-8');
|
2103 |
if ( xml_parser_set_option( $xml_parser, XML_OPTION_SKIP_WHITE, 0 ) && xml_parser_set_option( $xml_parser, XML_OPTION_CASE_FOLDING, 0 ) ) {
|
2104 |
-
if ( 0 == xml_parse_into_struct( $xml_parser, $
|
2105 |
-
MLACore::mla_debug_add( __LINE__ . __( 'ERROR', 'media-library-assistant' ) . ': ' . _x( '
|
2106 |
-
$
|
2107 |
}
|
2108 |
} else {
|
2109 |
-
MLACore::mla_debug_add( __LINE__ . __( 'ERROR', 'media-library-assistant' ) . ': ' . _x( '
|
2110 |
}
|
2111 |
|
2112 |
xml_parser_free($xml_parser);
|
2113 |
|
2114 |
-
if ( empty( $
|
2115 |
return NULL;
|
2116 |
}
|
2117 |
-
//error_log( __LINE__ . " MLAData::
|
2118 |
|
2119 |
$levels = array();
|
2120 |
$current_level = 0;
|
2121 |
$results = array();
|
2122 |
$xmlns = array();
|
2123 |
-
foreach ( $
|
2124 |
-
//error_log( __LINE__ . " MLAData::
|
2125 |
$language = 'x-default';
|
2126 |
$node_attributes = array();
|
2127 |
if ( isset( $value['attributes'] ) ) {
|
@@ -2161,13 +2121,13 @@ class MLAData {
|
|
2161 |
switch ( $value['type'] ) {
|
2162 |
case 'open':
|
2163 |
$levels[ ++$current_level ] = array( 'key' => $value['tag'], 'values' => $node_attributes );
|
2164 |
-
//error_log( __LINE__ . " MLAData::
|
2165 |
break;
|
2166 |
case 'close':
|
2167 |
if ( 0 < --$current_level ) {
|
2168 |
$top_level = array_pop( $levels );
|
2169 |
-
//error_log( __LINE__ . " MLAData::
|
2170 |
-
//error_log( __LINE__ . " MLAData::
|
2171 |
if ( 'rdf:li' == $top_level['key'] ) {
|
2172 |
$levels[ $current_level ]['values'][] = $top_level['values'];
|
2173 |
} else {
|
@@ -2178,14 +2138,14 @@ class MLAData {
|
|
2178 |
}
|
2179 |
}
|
2180 |
}
|
2181 |
-
//error_log( __LINE__ . " MLAData::
|
2182 |
break;
|
2183 |
case 'complete':
|
2184 |
if ( 'x-default' != $language ) {
|
2185 |
break;
|
2186 |
}
|
2187 |
|
2188 |
-
//error_log( __LINE__ . " MLAData::
|
2189 |
if ( empty( $node_attributes ) ) {
|
2190 |
if ( isset( $value['value'] ) ) {
|
2191 |
$complete_value = self::_bin_to_utf8( $value['value'] );
|
@@ -2193,12 +2153,17 @@ class MLAData {
|
|
2193 |
$complete_value = '';
|
2194 |
}
|
2195 |
} else {
|
2196 |
-
|
|
|
|
|
|
|
|
|
|
|
2197 |
}
|
2198 |
|
2199 |
-
//error_log( __LINE__ . " MLAData::
|
2200 |
-
//error_log( __LINE__ . " MLAData::
|
2201 |
-
//error_log( __LINE__ . " MLAData::
|
2202 |
if ( 'rdf:li' == $value['tag'] ) {
|
2203 |
$levels[ $current_level ]['values'][] = $complete_value;
|
2204 |
} else {
|
@@ -2210,47 +2175,92 @@ class MLAData {
|
|
2210 |
}
|
2211 |
}
|
2212 |
|
2213 |
-
//error_log( __LINE__ . " MLAData::
|
2214 |
break;
|
2215 |
default:
|
2216 |
-
//error_log( __LINE__ . " MLAData::
|
2217 |
} // switch on type
|
2218 |
-
//error_log( __LINE__ . " MLAData::
|
2219 |
} // foreach value
|
2220 |
-
//error_log( __LINE__ . " MLAData::
|
2221 |
-
//error_log( __LINE__ . " MLAData::
|
2222 |
|
2223 |
-
|
2224 |
-
* Parse "namespace:name" names into arrays of simple names
|
2225 |
-
* NOTE: The string "XAP" or "xap" appears in some namespaces, keywords,
|
2226 |
-
* and related names in stored XMP data. It reflects an early internal
|
2227 |
-
* code name for XMP; the names have been preserved for compatibility purposes.
|
2228 |
-
*/
|
2229 |
$namespace_arrays = array();
|
2230 |
-
|
2231 |
-
|
2232 |
-
|
2233 |
-
|
2234 |
-
|
2235 |
-
|
2236 |
-
|
2237 |
-
|
2238 |
-
|
2239 |
-
|
2240 |
-
|
2241 |
-
|
2242 |
-
|
2243 |
-
|
2244 |
-
|
2245 |
-
|
2246 |
-
|
2247 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2248 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2249 |
}
|
2250 |
-
|
2251 |
-
|
2252 |
-
|
2253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2254 |
|
2255 |
/*
|
2256 |
* Try to populate all the PDF-standard keys (except Trapped)
|
@@ -2278,7 +2288,12 @@ class MLAData {
|
|
2278 |
}
|
2279 |
|
2280 |
if ( ! isset( $results['Subject'] ) ) {
|
2281 |
-
|
|
|
|
|
|
|
|
|
|
|
2282 |
if ( ! empty( $replacement ) ) {
|
2283 |
$results['Subject'] = $replacement;
|
2284 |
}
|
@@ -2311,7 +2326,53 @@ class MLAData {
|
|
2311 |
}
|
2312 |
} // Keywords
|
2313 |
|
2314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2315 |
if ( is_array( $namespace_arrays['dc']['subject'] ) ) {
|
2316 |
foreach ( $namespace_arrays['dc']['subject'] as $term ) {
|
2317 |
$term = trim( $term, " \n\t\r\0\x0B," );
|
@@ -2325,7 +2386,7 @@ class MLAData {
|
|
2325 |
$keywords[ $term ] = $term;
|
2326 |
}
|
2327 |
}
|
2328 |
-
} // dc:subject
|
2329 |
|
2330 |
if ( ! empty( $keywords ) ) {
|
2331 |
if ( 1 == count( $keywords ) ) {
|
@@ -2346,11 +2407,16 @@ class MLAData {
|
|
2346 |
if ( ! empty( $replacement ) ) {
|
2347 |
$results['Creator'] = $replacement;
|
2348 |
} else {
|
2349 |
-
$replacement = self::_nonempty_value( $namespace_arrays, '
|
2350 |
if ( ! empty( $replacement ) ) {
|
2351 |
$results['Creator'] = $replacement;
|
2352 |
-
}
|
2353 |
-
$
|
|
|
|
|
|
|
|
|
|
|
2354 |
}
|
2355 |
}
|
2356 |
}
|
@@ -2363,6 +2429,11 @@ class MLAData {
|
|
2363 |
$replacement = self::_nonempty_value( $namespace_arrays, 'xap', 'CreateDate' );
|
2364 |
if ( ! empty( $replacement ) ) {
|
2365 |
$results['CreationDate'] = $replacement;
|
|
|
|
|
|
|
|
|
|
|
2366 |
}
|
2367 |
}
|
2368 |
}
|
@@ -2375,6 +2446,11 @@ class MLAData {
|
|
2375 |
$replacement = self::_nonempty_value( $namespace_arrays, 'xap', 'ModifyDate' );
|
2376 |
if ( ! empty( $replacement ) ) {
|
2377 |
$results['ModDate'] = $replacement;
|
|
|
|
|
|
|
|
|
|
|
2378 |
}
|
2379 |
}
|
2380 |
}
|
@@ -2384,6 +2460,67 @@ class MLAData {
|
|
2384 |
}
|
2385 |
|
2386 |
$results = array_merge( $results, $namespace_arrays );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2387 |
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata results = " . var_export( $results, true ), 0 );
|
2388 |
return $results;
|
2389 |
}
|
@@ -2905,6 +3042,41 @@ class MLAData {
|
|
2905 |
return self::mla_find_array_element( $exif_key, $item_metadata['mla_exif_metadata'], $option, $keep_existing );
|
2906 |
}
|
2907 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2908 |
/**
|
2909 |
* Parse one XMP metadata field
|
2910 |
*
|
@@ -3240,7 +3412,8 @@ class MLAData {
|
|
3240 |
'mla_iptc_metadata' => array(),
|
3241 |
'mla_exif_metadata' => array(),
|
3242 |
'mla_xmp_metadata' => array(),
|
3243 |
-
'mla_pdf_metadata' => array()
|
|
|
3244 |
);
|
3245 |
|
3246 |
if ( 0 != $post_id ) {
|
@@ -3265,6 +3438,18 @@ class MLAData {
|
|
3265 |
return $results;
|
3266 |
}
|
3267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3268 |
$size = getimagesize( $path, $info );
|
3269 |
MLACore::mla_debug_add( __LINE__ . ' mla_fetch_attachment_image_metadata getimagesize returns ' . var_export( $size, true ), MLACore::MLA_DEBUG_CATEGORY_METADATA );
|
3270 |
MLACore::mla_debug_add( __LINE__ . ' mla_fetch_attachment_image_metadata getimagesize info keys = ' . var_export( array_keys( $info ), true ), MLACore::MLA_DEBUG_CATEGORY_METADATA );
|
81 |
*
|
82 |
* @param string A formatting string containing [+placeholders+]
|
83 |
* @param array An associative array containing keys and values e.g. array('key' => 'value')
|
84 |
+
* @param string Option value
|
85 |
*
|
86 |
* @return mixed string or array, depending on placeholder values. Placeholders corresponding
|
87 |
* to the keys of the markup_values will be replaced with their values.
|
88 |
*/
|
89 |
+
public static function mla_parse_array_template( $tpl, $markup_values, $option = 'export' ) {
|
90 |
$result = array();
|
91 |
$offset = 0;
|
92 |
while ( false !== $start = strpos( $tpl, '[+', $offset ) ) {
|
125 |
$result[] = substr( $tpl, $offset );
|
126 |
}
|
127 |
|
128 |
+
// Build a final result, eliminating empty elements and expanding array elements
|
|
|
|
|
129 |
$final = array();
|
130 |
foreach ( $result as $element ) {
|
131 |
if ( is_scalar( $element ) ) {
|
137 |
foreach ($element as $key => $value ) {
|
138 |
if ( is_scalar( $value ) ) {
|
139 |
$value = trim( $value );
|
140 |
+
} elseif ( is_array( $value ) && 'array' === $option ) {
|
141 |
+
// no change
|
142 |
} elseif ( ! empty( $value ) ) {
|
143 |
$value = var_export( $value, true );
|
144 |
}
|
145 |
|
146 |
+
// Preserve any keys with string values
|
|
|
|
|
147 |
if ( ! empty( $value ) ) {
|
148 |
if ( is_integer( $key ) ) {
|
149 |
$final[] = $value;
|
430 |
*/
|
431 |
private static function _evaluate_template_array_node( $node, $markup_values = array() ) {
|
432 |
$result = array();
|
433 |
+
|
434 |
+
// Check for an array of sub-nodes
|
|
|
435 |
if ( ! isset( $node['type'] ) ) {
|
436 |
foreach ( $node as $value ) {
|
437 |
$node_result = self::_evaluate_template_array_node( $value, $markup_values );
|
441 |
} else { // array of sub-nodes
|
442 |
switch ( $node['type'] ) {
|
443 |
case 'string':
|
444 |
+
$result[] = self::mla_parse_array_template( $node['value'], $markup_values, 'array' );
|
445 |
break;
|
446 |
case 'test':
|
447 |
$node_value = $node['value'];
|
594 |
}
|
595 |
}
|
596 |
|
597 |
+
// Step 3: walk the element tree and process each node
|
|
|
|
|
598 |
if ( $return_arrays ) {
|
599 |
$results = self::_evaluate_template_array_node( $root_element, $markup_values );
|
600 |
} else {
|
1102 |
}
|
1103 |
}
|
1104 |
|
1105 |
+
if ( empty( $pattern ) || is_null( $replacement ) ) {
|
1106 |
// No pattern or no replacement - return unaltered value
|
1107 |
break;
|
1108 |
}
|
1427 |
$markup_values[ $key ] = $record;
|
1428 |
}
|
1429 |
|
1430 |
+
break;
|
1431 |
+
case 'mso':
|
1432 |
+
if ( is_null( $attachment_metadata ) ) {
|
1433 |
+
if ( 0 < $post_id ) {
|
1434 |
+
$attachment_metadata = self::mla_fetch_attachment_image_metadata( $post_id );
|
1435 |
+
} else {
|
1436 |
+
break;
|
1437 |
+
}
|
1438 |
+
}
|
1439 |
+
|
1440 |
+
$markup_values[ $key ] = self::mla_mso_metadata_value( $value['value'], $attachment_metadata['mla_mso_metadata'], $value['option'], $keep_existing );
|
1441 |
break;
|
1442 |
case 'matches':
|
1443 |
$markup_values[ $key ] = isset( MLAData::$regex_matches[ $value['value'] ] ) ? MLAData::$regex_matches[ $value['value'] ] : '';
|
2044 |
}
|
2045 |
|
2046 |
/**
|
2047 |
+
* Extract XML meta data from a string; for XMP and MS Office files
|
2048 |
*
|
2049 |
+
* @since 2.82
|
2050 |
*
|
2051 |
+
* @param string XML structure
|
|
|
2052 |
*
|
2053 |
* @return mixed array of metadata values or NULL on failure
|
2054 |
*/
|
2055 |
+
public static function mla_parse_xml_string( &$xml_string ) {
|
2056 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string xml_string = " . var_export( $xml_string, true ), 0 );
|
2057 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string xml_string = \r\n" . MLAData::mla_hex_dump( $xml_string ), 0 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2058 |
|
2059 |
+
// damage repair for GodsHillPC
|
2060 |
+
$xml_string = str_replace( "\000", '0', $xml_string );
|
2061 |
+
$xml_values = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2062 |
$xml_parser = xml_parser_create('UTF-8');
|
2063 |
if ( xml_parser_set_option( $xml_parser, XML_OPTION_SKIP_WHITE, 0 ) && xml_parser_set_option( $xml_parser, XML_OPTION_CASE_FOLDING, 0 ) ) {
|
2064 |
+
if ( 0 == xml_parse_into_struct( $xml_parser, $xml_string, $xml_values ) ) {
|
2065 |
+
MLACore::mla_debug_add( __LINE__ . __( 'ERROR', 'media-library-assistant' ) . ': ' . _x( 'mla_parse_xml_string xml_parse_into_struct failed.', 'error_log', 'media-library-assistant' ), MLACore::MLA_DEBUG_CATEGORY_ANY );
|
2066 |
+
$xml_values = array();
|
2067 |
}
|
2068 |
} else {
|
2069 |
+
MLACore::mla_debug_add( __LINE__ . __( 'ERROR', 'media-library-assistant' ) . ': ' . _x( 'mla_parse_xml_string set option failed.', 'error_log', 'media-library-assistant' ), MLACore::MLA_DEBUG_CATEGORY_ANY );
|
2070 |
}
|
2071 |
|
2072 |
xml_parser_free($xml_parser);
|
2073 |
|
2074 |
+
if ( empty( $xml_values ) ) {
|
2075 |
return NULL;
|
2076 |
}
|
2077 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string xml_values = " . var_export( $xml_values, true ), 0 );
|
2078 |
|
2079 |
$levels = array();
|
2080 |
$current_level = 0;
|
2081 |
$results = array();
|
2082 |
$xmlns = array();
|
2083 |
+
foreach ( $xml_values as $index => $value ) {
|
2084 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string xml_values( {$index} ) value = " . var_export( $value, true ), 0 );
|
2085 |
$language = 'x-default';
|
2086 |
$node_attributes = array();
|
2087 |
if ( isset( $value['attributes'] ) ) {
|
2121 |
switch ( $value['type'] ) {
|
2122 |
case 'open':
|
2123 |
$levels[ ++$current_level ] = array( 'key' => $value['tag'], 'values' => $node_attributes );
|
2124 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string xml_values( {$current_level}, {$index} ) case 'open': top_level = " . var_export( $levels[ $current_level ], true ), 0 );
|
2125 |
break;
|
2126 |
case 'close':
|
2127 |
if ( 0 < --$current_level ) {
|
2128 |
$top_level = array_pop( $levels );
|
2129 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string xml_values( {$current_level}, {$index} ) case 'close': top_level = " . var_export( $top_level, true ), 0 );
|
2130 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string xml_values( {$current_level}, {$index} ) case 'close': levels( {$current_level} ) before = " . var_export( $levels, true ), 0 );
|
2131 |
if ( 'rdf:li' == $top_level['key'] ) {
|
2132 |
$levels[ $current_level ]['values'][] = $top_level['values'];
|
2133 |
} else {
|
2138 |
}
|
2139 |
}
|
2140 |
}
|
2141 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string xml_values( {$current_level}, {$index} ) case 'close': levels( {$current_level} ) after = " . var_export( $levels, true ), 0 );
|
2142 |
break;
|
2143 |
case 'complete':
|
2144 |
if ( 'x-default' != $language ) {
|
2145 |
break;
|
2146 |
}
|
2147 |
|
2148 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string xml_values( {$index} ) case 'complete': node_attributes = " . var_export( $node_attributes, true ), 0 );
|
2149 |
if ( empty( $node_attributes ) ) {
|
2150 |
if ( isset( $value['value'] ) ) {
|
2151 |
$complete_value = self::_bin_to_utf8( $value['value'] );
|
2153 |
$complete_value = '';
|
2154 |
}
|
2155 |
} else {
|
2156 |
+
// Check for MS Office handling of dcterms
|
2157 |
+
if ( 0 === strpos( $value['tag'], 'dcterms:' ) && isset( $value['value'] ) ) {
|
2158 |
+
$complete_value = self::_bin_to_utf8( $value['value'] );
|
2159 |
+
} else {
|
2160 |
+
$complete_value = $node_attributes;
|
2161 |
+
}
|
2162 |
}
|
2163 |
|
2164 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string xml_values( {$index} ) case 'complete': value = " . var_export( $value, true ), 0 );
|
2165 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string xml_values( {$index} ) case 'complete': complete_value = " . var_export( $complete_value, true ), 0 );
|
2166 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string xml_values( {$index} ) case 'complete': (array) complete_value = " . var_export( (array) $complete_value, true ), 0 );
|
2167 |
if ( 'rdf:li' == $value['tag'] ) {
|
2168 |
$levels[ $current_level ]['values'][] = $complete_value;
|
2169 |
} else {
|
2175 |
}
|
2176 |
}
|
2177 |
|
2178 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string xml_values( {$index}, {$current_level} ) case 'complete': values = " . var_export( $levels[ $current_level ]['values'], true ), 0 );
|
2179 |
break;
|
2180 |
default:
|
2181 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string xml_values( {$index}, {$current_level} ) ignoring type = " . var_export( $value['type'], true ), 0 );
|
2182 |
} // switch on type
|
2183 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string xml_values( {$index}, {$current_level} ) levels = " . var_export( $levels, true ), 0 );
|
2184 |
} // foreach value
|
2185 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string levels = " . var_export( $levels, true ), 0 );
|
2186 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string xmlns = " . var_export( $xmlns, true ), 0 );
|
2187 |
|
2188 |
+
// Parse "namespace:name" names into arrays of simple names
|
|
|
|
|
|
|
|
|
|
|
2189 |
$namespace_arrays = array();
|
2190 |
+
$metadata_source = '';
|
2191 |
+
if ( isset( $levels[1] ) && isset( $levels[1]['values'] ) ) {
|
2192 |
+
if ( isset( $levels[1]['values']['rdf:RDF'] ) && isset( $levels[1]['values']['rdf:RDF']['rdf:Description'] ) ) {
|
2193 |
+
/*
|
2194 |
+
* XMP parsing
|
2195 |
+
* NOTE: The string "XAP" or "xap" appears in some namespaces, keywords,
|
2196 |
+
* and related names in stored XMP data. It reflects an early internal
|
2197 |
+
* code name for XMP; the names have been preserved for compatibility purposes.
|
2198 |
+
*/
|
2199 |
+
$metadata_source = 'xmp';
|
2200 |
+
foreach ( $levels[1]['values']['rdf:RDF']['rdf:Description'] as $key => $value ) {
|
2201 |
+
if ( is_string( $value ) ) {
|
2202 |
+
$value = self::_parse_iso8601_date( self::mla_parse_pdf_date( $value ) );
|
2203 |
+
} elseif ( is_array( $value ) ) {
|
2204 |
+
$value = self::_parse_xmp_array( $value );
|
2205 |
+
}
|
2206 |
+
|
2207 |
+
if ( false !== ($colon = strpos( $key, ':' ) ) ) {
|
2208 |
+
$array_name = substr( $key, 0, $colon );
|
2209 |
+
$array_index = substr( $key, $colon + 1 );
|
2210 |
+
$namespace_arrays[ $array_name ][ $array_index ] = $value;
|
2211 |
+
|
2212 |
+
if ( ! isset( $results[ $array_index ] ) && in_array( $array_name, array( 'xmp', 'xmpMM', 'xmpRights', 'xap', 'xapMM', 'dc', 'pdf', 'pdfx', 'mwg-rs' ) ) ) {
|
2213 |
+
if ( is_array( $value ) && 1 == count( $value ) && isset( $value[0] ) ) {
|
2214 |
+
$results[ $array_index ] = $value[0];
|
2215 |
+
} else {
|
2216 |
+
$results[ $array_index ] = $value;
|
2217 |
+
}
|
2218 |
}
|
2219 |
+
} // found namespace
|
2220 |
+
} // foreach Description
|
2221 |
+
} else {
|
2222 |
+
/*
|
2223 |
+
* Microsoft Office parsing
|
2224 |
+
* Core properties are similar to XMP; Extended properties in "app.xml" do not have
|
2225 |
+
* a namespace prepended to them.
|
2226 |
+
*/
|
2227 |
+
$metadata_source = 'mso';
|
2228 |
+
$is_app_xml = isset( $levels[1]['key'] ) && ( 'Properties' === $levels[1]['key'] );
|
2229 |
+
foreach ( $levels[1]['values'] as $key => $value ) {
|
2230 |
+
if ( is_string( $value ) ) {
|
2231 |
+
$value = self::_parse_iso8601_date( self::mla_parse_pdf_date( $value ) );
|
2232 |
+
} elseif ( is_array( $value ) ) {
|
2233 |
+
$value = self::_parse_xmp_array( $value );
|
2234 |
}
|
2235 |
+
|
2236 |
+
if ( false !== ($colon = strpos( $key, ':' ) ) ) {
|
2237 |
+
$array_name = substr( $key, 0, $colon );
|
2238 |
+
$array_index = substr( $key, $colon + 1 );
|
2239 |
+
$namespace_arrays[ $array_name ][ $array_index ] = $value;
|
2240 |
+
|
2241 |
+
if ( ! isset( $results[ $array_index ] ) && in_array( $array_name, array( 'cp', 'dc', 'dcterms' ) ) ) {
|
2242 |
+
if ( is_array( $value ) && 1 == count( $value ) && isset( $value[0] ) ) {
|
2243 |
+
$results[ $array_index ] = $value[0];
|
2244 |
+
} else {
|
2245 |
+
$results[ $array_index ] = $value;
|
2246 |
+
}
|
2247 |
+
}
|
2248 |
+
// found namespace
|
2249 |
+
} elseif ( $is_app_xml ) {
|
2250 |
+
$namespace_arrays[ 'app' ][ $key ] = $value;
|
2251 |
+
|
2252 |
+
if ( ! isset( $results[ $key ] ) ) {
|
2253 |
+
if ( is_array( $value ) && 1 == count( $value ) && isset( $value[0] ) ) {
|
2254 |
+
$results[ $key ] = $value[0];
|
2255 |
+
} else {
|
2256 |
+
$results[ $key ] = $value;
|
2257 |
+
}
|
2258 |
+
}
|
2259 |
+
} // $is_app_xml
|
2260 |
+
} // foreach Description
|
2261 |
+
}
|
2262 |
+
} // isset( $levels[1]['values']
|
2263 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xml_string results = " . var_export( $results, true ), 0 );
|
2264 |
|
2265 |
/*
|
2266 |
* Try to populate all the PDF-standard keys (except Trapped)
|
2288 |
}
|
2289 |
|
2290 |
if ( ! isset( $results['Subject'] ) ) {
|
2291 |
+
if ( 'xmp' == $metadata_source ) {
|
2292 |
+
$replacement = self::_nonempty_value( $namespace_arrays, 'dc', 'description' );
|
2293 |
+
} else {
|
2294 |
+
$replacement = self::_nonempty_value( $namespace_arrays, 'dc', 'subject' );
|
2295 |
+
}
|
2296 |
+
|
2297 |
if ( ! empty( $replacement ) ) {
|
2298 |
$results['Subject'] = $replacement;
|
2299 |
}
|
2326 |
}
|
2327 |
} // Keywords
|
2328 |
|
2329 |
+
// MS Office has both keywords and categories
|
2330 |
+
if ( ( 'mso' == $metadata_source ) && isset( $namespace_arrays['cp'] ) && isset( $namespace_arrays['cp']['keywords'] ) ) {
|
2331 |
+
$cp_keywords = $namespace_arrays['cp']['keywords'];
|
2332 |
+
if ( false !== strpos( $cp_keywords, ';' ) ) {
|
2333 |
+
$terms = array_map( 'trim', explode( ';', $cp_keywords ) );
|
2334 |
+
foreach ( $terms as $term )
|
2335 |
+
if ( ! empty( $term ) ) {
|
2336 |
+
$keywords[ $term ] = $term;
|
2337 |
+
}
|
2338 |
+
} elseif ( false !== strpos( $cp_keywords, ',' ) ) {
|
2339 |
+
$terms = array_map( 'trim', explode( ',', $cp_keywords ) );
|
2340 |
+
foreach ( $terms as $term )
|
2341 |
+
if ( ! empty( $term ) ) {
|
2342 |
+
$keywords[ $term ] = $term;
|
2343 |
+
}
|
2344 |
+
} else {
|
2345 |
+
$term = trim( $cp_keywords );
|
2346 |
+
if ( ! empty( $term ) ) {
|
2347 |
+
$keywords[ $term ] = $term;
|
2348 |
+
}
|
2349 |
+
}
|
2350 |
+
} // MSO cp:keywords
|
2351 |
+
|
2352 |
+
if ( ( 'mso' == $metadata_source ) && isset( $namespace_arrays['cp'] ) && isset( $namespace_arrays['cp']['category'] ) ) {
|
2353 |
+
$cp_keywords = $namespace_arrays['cp']['category'];
|
2354 |
+
if ( false !== strpos( $cp_keywords, ';' ) ) {
|
2355 |
+
$terms = array_map( 'trim', explode( ';', $cp_keywords ) );
|
2356 |
+
foreach ( $terms as $term )
|
2357 |
+
if ( ! empty( $term ) ) {
|
2358 |
+
$keywords[ $term ] = $term;
|
2359 |
+
}
|
2360 |
+
} elseif ( false !== strpos( $cp_keywords, ',' ) ) {
|
2361 |
+
$terms = array_map( 'trim', explode( ',', $cp_keywords ) );
|
2362 |
+
foreach ( $terms as $term )
|
2363 |
+
if ( ! empty( $term ) ) {
|
2364 |
+
$keywords[ $term ] = $term;
|
2365 |
+
}
|
2366 |
+
} else {
|
2367 |
+
$term = trim( $cp_keywords );
|
2368 |
+
if ( ! empty( $term ) ) {
|
2369 |
+
$keywords[ $term ] = $term;
|
2370 |
+
}
|
2371 |
+
}
|
2372 |
+
} // MSO cp:category
|
2373 |
+
|
2374 |
+
// XMP puts keywords in the"dc:subject" field, unlike MSO
|
2375 |
+
if ( ( 'xmp' == $metadata_source ) && isset( $namespace_arrays['dc'] ) && isset( $namespace_arrays['dc']['subject'] ) ) {
|
2376 |
if ( is_array( $namespace_arrays['dc']['subject'] ) ) {
|
2377 |
foreach ( $namespace_arrays['dc']['subject'] as $term ) {
|
2378 |
$term = trim( $term, " \n\t\r\0\x0B," );
|
2386 |
$keywords[ $term ] = $term;
|
2387 |
}
|
2388 |
}
|
2389 |
+
} // XMP dc:subject
|
2390 |
|
2391 |
if ( ! empty( $keywords ) ) {
|
2392 |
if ( 1 == count( $keywords ) ) {
|
2407 |
if ( ! empty( $replacement ) ) {
|
2408 |
$results['Creator'] = $replacement;
|
2409 |
} else {
|
2410 |
+
$replacement = self::_nonempty_value( $namespace_arrays, 'app', 'Application' );
|
2411 |
if ( ! empty( $replacement ) ) {
|
2412 |
$results['Creator'] = $replacement;
|
2413 |
+
} else {
|
2414 |
+
$replacement = self::_nonempty_value( $namespace_arrays, 'xap', 'CreatorTool' );
|
2415 |
+
if ( ! empty( $replacement ) ) {
|
2416 |
+
$results['Creator'] = $replacement;
|
2417 |
+
} elseif ( ! empty( $results['Producer'] ) ) {
|
2418 |
+
$results['Creator'] = $results['Producer'];
|
2419 |
+
}
|
2420 |
}
|
2421 |
}
|
2422 |
}
|
2429 |
$replacement = self::_nonempty_value( $namespace_arrays, 'xap', 'CreateDate' );
|
2430 |
if ( ! empty( $replacement ) ) {
|
2431 |
$results['CreationDate'] = $replacement;
|
2432 |
+
} else {
|
2433 |
+
$replacement = self::_nonempty_value( $namespace_arrays, 'dcterms', 'created' );
|
2434 |
+
if ( ! empty( $replacement ) ) {
|
2435 |
+
$results['CreationDate'] = $replacement;
|
2436 |
+
}
|
2437 |
}
|
2438 |
}
|
2439 |
}
|
2446 |
$replacement = self::_nonempty_value( $namespace_arrays, 'xap', 'ModifyDate' );
|
2447 |
if ( ! empty( $replacement ) ) {
|
2448 |
$results['ModDate'] = $replacement;
|
2449 |
+
} else {
|
2450 |
+
$replacement = self::_nonempty_value( $namespace_arrays, 'dcterms', 'modified' );
|
2451 |
+
if ( ! empty( $replacement ) ) {
|
2452 |
+
$results['ModDate'] = $replacement;
|
2453 |
+
}
|
2454 |
}
|
2455 |
}
|
2456 |
}
|
2460 |
}
|
2461 |
|
2462 |
$results = array_merge( $results, $namespace_arrays );
|
2463 |
+
return $results;
|
2464 |
+
}
|
2465 |
+
|
2466 |
+
/**
|
2467 |
+
* Extract XMP meta data from a file
|
2468 |
+
*
|
2469 |
+
* @since 2.10
|
2470 |
+
*
|
2471 |
+
* @param string full path and file name
|
2472 |
+
* @param integer offset within the file of the search start point
|
2473 |
+
*
|
2474 |
+
* @return mixed array of metadata values or NULL on failure
|
2475 |
+
*/
|
2476 |
+
public static function mla_parse_xmp_metadata( $file_name, $file_offset ) {
|
2477 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata( {$file_name}, {$file_offset} ) ", 0 );
|
2478 |
+
$chunksize = 16384;
|
2479 |
+
$xmp_chunk = file_get_contents( $file_name, true, NULL, $file_offset, $chunksize );
|
2480 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata( {$file_offset} ) chunk = \r\n" . MLAData::mla_hex_dump( $xmp_chunk ), 0 );
|
2481 |
+
|
2482 |
+
// If necessary and possible, advance the $xmp_chunk through the file until it contains the start tag
|
2483 |
+
if ( false === ( $start_tag = strpos( $xmp_chunk, '<x:xmpmeta' ) ) && ( $chunksize == strlen( $xmp_chunk ) ) ) {
|
2484 |
+
$new_offset = $file_offset + ( $chunksize - 16 );
|
2485 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata( {$new_offset} ) ", 0 );
|
2486 |
+
$xmp_chunk = file_get_contents( $file_name, true, NULL, $new_offset, $chunksize );
|
2487 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata( {$new_offset} ) chunk = \r\n" . MLAData::mla_hex_dump( $xmp_chunk ), 0 );
|
2488 |
+
while ( false === ( $start_tag = strpos( $xmp_chunk, '<x:xmpmeta' ) ) && ( $chunksize == strlen( $xmp_chunk ) ) ) {
|
2489 |
+
$new_offset = $new_offset + ( $chunksize - 16 );
|
2490 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata( {$new_offset} ) ", 0 );
|
2491 |
+
$xmp_chunk = file_get_contents( $file_name, true, NULL, $new_offset, $chunksize );
|
2492 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata( {$new_offset} ) chunk = \r\n" . MLAData::mla_hex_dump( $xmp_chunk ), 0 );
|
2493 |
+
} // while not found
|
2494 |
+
} else { // if not found
|
2495 |
+
$new_offset = $file_offset;
|
2496 |
+
}
|
2497 |
+
|
2498 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata( {$start_tag} ) ", 0 );
|
2499 |
+
if ( false === $start_tag ) {
|
2500 |
+
return NULL;
|
2501 |
+
}
|
2502 |
+
|
2503 |
+
// If necessary and possible, expand the $xmp_chunk until it contains the start tag
|
2504 |
+
if ( false === ( $end_tag = strpos( $xmp_chunk, '</x:xmpmeta>', $start_tag ) ) && ( $chunksize == strlen( $xmp_chunk ) ) ) {
|
2505 |
+
$new_offset = $new_offset + $start_tag;
|
2506 |
+
$start_tag = 0;
|
2507 |
+
$new_chunksize = $chunksize + $chunksize;
|
2508 |
+
$xmp_chunk = file_get_contents( $file_name, true, NULL, $new_offset, $new_chunksize );
|
2509 |
+
while ( false === ( $end_tag = strpos( $xmp_chunk, '</x:xmpmeta>' ) ) && ( $new_chunksize == strlen( $xmp_chunk ) ) ) {
|
2510 |
+
$new_chunksize = $new_chunksize + $chunksize;
|
2511 |
+
$xmp_chunk = file_get_contents( $file_name, true, NULL, $new_offset, $new_chunksize );
|
2512 |
+
} // while not found
|
2513 |
+
} // if not found
|
2514 |
+
|
2515 |
+
if ( false === $end_tag ) {
|
2516 |
+
return NULL;
|
2517 |
+
}
|
2518 |
+
|
2519 |
+
$xmp_string = "<?xml version='1.0'?>\n" . substr($xmp_chunk, $start_tag, ( $end_tag + 12 ) - $start_tag );
|
2520 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata xmp_string = " . var_export( $xmp_string, true ), 0 );
|
2521 |
+
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata xmp_string = \r\n" . MLAData::mla_hex_dump( $xmp_string ), 0 );
|
2522 |
+
|
2523 |
+
$results = MLAData::mla_parse_xml_string( $xmp_string );
|
2524 |
//error_log( __LINE__ . " MLAData::mla_parse_xmp_metadata results = " . var_export( $results, true ), 0 );
|
2525 |
return $results;
|
2526 |
}
|
3042 |
return self::mla_find_array_element( $exif_key, $item_metadata['mla_exif_metadata'], $option, $keep_existing );
|
3043 |
}
|
3044 |
|
3045 |
+
/**
|
3046 |
+
* Parse one MS Office metadata field
|
3047 |
+
*
|
3048 |
+
* Also handles the special pseudo-value 'ALL_MSO'.
|
3049 |
+
*
|
3050 |
+
* @since 2.82
|
3051 |
+
*
|
3052 |
+
* @param string field name
|
3053 |
+
* @param array MS Office metadata array
|
3054 |
+
* @param string data option; 'text'|'single'|'export'|'array'|'multi'
|
3055 |
+
* @param boolean Optional: for option 'multi', retain existing values
|
3056 |
+
*
|
3057 |
+
* @return mixed string/array representation of metadata value or an empty string
|
3058 |
+
*/
|
3059 |
+
public static function mla_mso_metadata_value( $mso_key, $mso_metadata, $option = 'text', $keep_existing = false ) {
|
3060 |
+
if ( 'ALL_MSO' == $mso_key ) {
|
3061 |
+
$clean_data = array();
|
3062 |
+
if ( is_array( $mso_metadata ) ) {
|
3063 |
+
foreach ( $mso_metadata as $key => $value ) {
|
3064 |
+
if ( is_array( $value ) ) {
|
3065 |
+
$clean_data[ $key ] = '(ARRAY)';
|
3066 |
+
} elseif ( is_string( $value ) ) {
|
3067 |
+
$clean_data[ $key ] = self::_bin_to_utf8( substr( $value, 0, 256 ) );
|
3068 |
+
} else {
|
3069 |
+
$clean_data[ $key ] = $value;
|
3070 |
+
}
|
3071 |
+
}
|
3072 |
+
}
|
3073 |
+
|
3074 |
+
return var_export( $clean_data, true);
|
3075 |
+
}
|
3076 |
+
|
3077 |
+
return self::mla_find_array_element($mso_key, $mso_metadata, $option, $keep_existing );
|
3078 |
+
}
|
3079 |
+
|
3080 |
/**
|
3081 |
* Parse one XMP metadata field
|
3082 |
*
|
3412 |
'mla_iptc_metadata' => array(),
|
3413 |
'mla_exif_metadata' => array(),
|
3414 |
'mla_xmp_metadata' => array(),
|
3415 |
+
'mla_pdf_metadata' => array(),
|
3416 |
+
'mla_mso_metadata' => array()
|
3417 |
);
|
3418 |
|
3419 |
if ( 0 != $post_id ) {
|
3438 |
return $results;
|
3439 |
}
|
3440 |
|
3441 |
+
$filetype = wp_check_filetype( $path );
|
3442 |
+
if ( false !== strpos( $filetype['type'], 'vnd.openxmlformats-officedocument' ) ) {
|
3443 |
+
if ( !class_exists( 'MLAOffice' ) ) {
|
3444 |
+
require_once( MLA_PLUGIN_PATH . 'includes/class-mla-data-office.php' );
|
3445 |
+
}
|
3446 |
+
|
3447 |
+
$mso_metadata = MLAOffice::mla_extract_office_metadata( $path );
|
3448 |
+
$results['mla_mso_metadata'] = $mso_metadata['mso'];
|
3449 |
+
MLACore::mla_debug_add( __LINE__ . ' mla_fetch_attachment_image_metadata results = ' . var_export( $results, true ), MLACore::MLA_DEBUG_CATEGORY_METADATA );
|
3450 |
+
return $results;
|
3451 |
+
}
|
3452 |
+
|
3453 |
$size = getimagesize( $path, $info );
|
3454 |
MLACore::mla_debug_add( __LINE__ . ' mla_fetch_attachment_image_metadata getimagesize returns ' . var_export( $size, true ), MLACore::MLA_DEBUG_CATEGORY_METADATA );
|
3455 |
MLACore::mla_debug_add( __LINE__ . ' mla_fetch_attachment_image_metadata getimagesize info keys = ' . var_export( array_keys( $info ), true ), MLACore::MLA_DEBUG_CATEGORY_METADATA );
|
includes/class-mla-options.php
CHANGED
@@ -32,6 +32,7 @@ class MLAOptions {
|
|
32 |
add_filter( 'wp_handle_upload', 'MLAOptions::mla_wp_handle_upload_filter', 1, 1 );
|
33 |
|
34 |
add_action( 'add_attachment', 'MLAOptions::mla_add_attachment_action', 0x7FFFFFFF, 1 );
|
|
|
35 |
add_filter( 'wp_update_attachment_metadata', 'MLAOptions::mla_update_attachment_metadata_filter', 0x7FFFFFFF, 2 );
|
36 |
|
37 |
MLACore::mla_debug_add( __LINE__ . " MLAOptions::initialize( " . $_SERVER['REQUEST_URI'] . " ) hooks set", MLACore::MLA_DEBUG_CATEGORY_REST );
|
@@ -403,7 +404,7 @@ class MLAOptions {
|
|
403 |
unset( $tax_checklist_add_term[ $tax_name ] );
|
404 |
}
|
405 |
}
|
406 |
-
|
407 |
$value = array (
|
408 |
'tax_support' => $tax_support,
|
409 |
'tax_quick_edit' => $tax_quick_edit,
|
@@ -539,7 +540,7 @@ class MLAOptions {
|
|
539 |
if ( empty( $current_value ) ) {
|
540 |
$current_value = get_option( 'posts_per_page', $value['std'] );
|
541 |
}
|
542 |
-
|
543 |
$option_values = array(
|
544 |
'key' => $key,
|
545 |
'value' => $value['name'],
|
@@ -554,14 +555,14 @@ class MLAOptions {
|
|
554 |
$new_value = isset( $args[ $key ] ) ? $args[ $key ] : get_option( 'posts_per_page', $value['std'] );
|
555 |
|
556 |
$result = update_user_option( $user_id, $key, $new_value, true );
|
557 |
-
|
558 |
/* translators: 1: option name, e.g., taxonomy_support */
|
559 |
return '<br>' . sprintf( __( 'Update custom %1$s', 'media-library-assistant' ), $key ) . "\r\n";
|
560 |
case 'delete':
|
561 |
case 'reset':
|
562 |
$user_id = get_current_user_id();
|
563 |
delete_user_option( $user_id, $key, true );
|
564 |
-
|
565 |
/* translators: 1: option name, e.g., taxonomy_support */
|
566 |
return '<br>' . sprintf( __( 'Reset custom %1$s', 'media-library-assistant' ), $key ) . "\r\n";
|
567 |
default:
|
@@ -643,6 +644,18 @@ class MLAOptions {
|
|
643 |
*/
|
644 |
private static $add_attachment_id = 0;
|
645 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
646 |
/**
|
647 |
* Set $add_attachment_id to just-inserted attachment
|
648 |
*
|
@@ -659,6 +672,7 @@ class MLAOptions {
|
|
659 |
public static function mla_add_attachment_action( $post_ID ) {
|
660 |
MLACore::mla_debug_add( __LINE__ . " MLAOptions::mla_add_attachment_action( $post_ID )", MLACore::MLA_DEBUG_CATEGORY_METADATA );
|
661 |
MLAOptions::$add_attachment_id = $post_ID;
|
|
|
662 |
do_action('mla_add_attachment', $post_ID);
|
663 |
} // mla_add_attachment_action
|
664 |
|
@@ -695,6 +709,29 @@ class MLAOptions {
|
|
695 |
return $updates;
|
696 |
} // _update_attachment_metadata
|
697 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
698 |
/**
|
699 |
* Perform IPTC/EXIF and Custom Field mapping on just-inserted attachment
|
700 |
*
|
@@ -712,8 +749,16 @@ class MLAOptions {
|
|
712 |
*/
|
713 |
public static function mla_update_attachment_metadata_filter( $data, $post_id ) {
|
714 |
$options = array ();
|
715 |
-
$options['is_upload'] = MLAOptions::$add_attachment_id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
716 |
MLAOptions::$add_attachment_id = 0;
|
|
|
717 |
|
718 |
$options['enable_iptc_exif_mapping'] = 'checked' == MLACore::mla_get_option( 'enable_iptc_exif_mapping' );
|
719 |
$options['enable_custom_field_mapping'] = 'checked' == MLACore::mla_get_option( 'enable_custom_field_mapping' );
|
@@ -854,9 +899,7 @@ class MLAOptions {
|
|
854 |
|
855 |
$custom_updates = array();
|
856 |
foreach ( $settings as $setting_key => $setting_value ) {
|
857 |
-
|
858 |
-
* Convert checkbox value(s)
|
859 |
-
*/
|
860 |
$setting_value['no_null'] = isset( $setting_value['no_null'] ) && ( false !== $setting_value['no_null'] );
|
861 |
|
862 |
$setting_value['key'] = $setting_key;
|
@@ -916,7 +959,7 @@ class MLAOptions {
|
|
916 |
$custom_updates[ $setting_value['name'] ] = $new_text;
|
917 |
}
|
918 |
} else { // } keep_existing
|
919 |
-
if ( ' '
|
920 |
$new_text = NULL;
|
921 |
}
|
922 |
|
@@ -1271,8 +1314,8 @@ class MLAOptions {
|
|
1271 |
* @return string HTML table row markup for 'render' else message(s) reflecting the results of the operation.
|
1272 |
*/
|
1273 |
public static function mla_custom_field_option_handler( $action, $key, $value, $args = NULL ) {
|
1274 |
-
|
1275 |
-
return "MLAOptions::mla_custom_field_option_handler( $action, $key ) deprecated.";
|
1276 |
|
1277 |
// Added in 2.63
|
1278 |
MLAOptions::_load_option_templates();
|
@@ -1872,6 +1915,11 @@ return "MLAOptions::mla_custom_field_option_handler( $action, $key ) deprecated.
|
|
1872 |
* @return string HTML markup with select field options
|
1873 |
*/
|
1874 |
public static function mla_compose_parent_option_list( $taxonomy, $selection = 0 ) {
|
|
|
|
|
|
|
|
|
|
|
1875 |
$dropdown_options = array(
|
1876 |
'show_option_all' => '',
|
1877 |
'show_option_none' => '— ' . __( 'None (select a value)', 'media-library-assistant' ) . ' —',
|
@@ -2346,8 +2394,8 @@ return "MLAOptions::mla_custom_field_option_handler( $action, $key ) deprecated.
|
|
2346 |
* @return string HTML table row markup for 'render' else message(s) reflecting the results of the operation.
|
2347 |
*/
|
2348 |
public static function mla_iptc_exif_option_handler( $action, $key, $value, $args = NULL ) {
|
2349 |
-
|
2350 |
-
return " MLAOptions::mla_iptc_exif_option_handler( $action, $key ) deprecated.";
|
2351 |
|
2352 |
// Added in 2.63
|
2353 |
MLAOptions::_load_option_templates();
|
32 |
add_filter( 'wp_handle_upload', 'MLAOptions::mla_wp_handle_upload_filter', 1, 1 );
|
33 |
|
34 |
add_action( 'add_attachment', 'MLAOptions::mla_add_attachment_action', 0x7FFFFFFF, 1 );
|
35 |
+
add_filter( 'wp_generate_attachment_metadata', 'MLAOptions::mla_generate_attachment_metadata_filter', 0x7FFFFFFF, 2 );
|
36 |
add_filter( 'wp_update_attachment_metadata', 'MLAOptions::mla_update_attachment_metadata_filter', 0x7FFFFFFF, 2 );
|
37 |
|
38 |
MLACore::mla_debug_add( __LINE__ . " MLAOptions::initialize( " . $_SERVER['REQUEST_URI'] . " ) hooks set", MLACore::MLA_DEBUG_CATEGORY_REST );
|
404 |
unset( $tax_checklist_add_term[ $tax_name ] );
|
405 |
}
|
406 |
}
|
407 |
+
|
408 |
$value = array (
|
409 |
'tax_support' => $tax_support,
|
410 |
'tax_quick_edit' => $tax_quick_edit,
|
540 |
if ( empty( $current_value ) ) {
|
541 |
$current_value = get_option( 'posts_per_page', $value['std'] );
|
542 |
}
|
543 |
+
|
544 |
$option_values = array(
|
545 |
'key' => $key,
|
546 |
'value' => $value['name'],
|
555 |
$new_value = isset( $args[ $key ] ) ? $args[ $key ] : get_option( 'posts_per_page', $value['std'] );
|
556 |
|
557 |
$result = update_user_option( $user_id, $key, $new_value, true );
|
558 |
+
|
559 |
/* translators: 1: option name, e.g., taxonomy_support */
|
560 |
return '<br>' . sprintf( __( 'Update custom %1$s', 'media-library-assistant' ), $key ) . "\r\n";
|
561 |
case 'delete':
|
562 |
case 'reset':
|
563 |
$user_id = get_current_user_id();
|
564 |
delete_user_option( $user_id, $key, true );
|
565 |
+
|
566 |
/* translators: 1: option name, e.g., taxonomy_support */
|
567 |
return '<br>' . sprintf( __( 'Reset custom %1$s', 'media-library-assistant' ), $key ) . "\r\n";
|
568 |
default:
|
644 |
*/
|
645 |
private static $add_attachment_id = 0;
|
646 |
|
647 |
+
/**
|
648 |
+
* Identifies when attachments are first added to the Media Library.
|
649 |
+
*
|
650 |
+
* Ensures that IPTC/EXIF and Custom Field mapping is only performed when the attachment is first
|
651 |
+
* added to the Media Library, after intermediate sizes are generated (WP 5.3+).
|
652 |
+
*
|
653 |
+
* @since 1.70
|
654 |
+
*
|
655 |
+
* @var string
|
656 |
+
*/
|
657 |
+
private static $upload_status = '';
|
658 |
+
|
659 |
/**
|
660 |
* Set $add_attachment_id to just-inserted attachment
|
661 |
*
|
672 |
public static function mla_add_attachment_action( $post_ID ) {
|
673 |
MLACore::mla_debug_add( __LINE__ . " MLAOptions::mla_add_attachment_action( $post_ID )", MLACore::MLA_DEBUG_CATEGORY_METADATA );
|
674 |
MLAOptions::$add_attachment_id = $post_ID;
|
675 |
+
MLAOptions::$upload_status = 'started';
|
676 |
do_action('mla_add_attachment', $post_ID);
|
677 |
} // mla_add_attachment_action
|
678 |
|
709 |
return $updates;
|
710 |
} // _update_attachment_metadata
|
711 |
|
712 |
+
/**
|
713 |
+
* This filter tests the MLAOptions::$upload_status variable set by the mla_add_attachment_action
|
714 |
+
* to ensure that mapping is only performed after the generation of all intermediate sizes is complete.
|
715 |
+
*
|
716 |
+
* The filter is applied by function wp_generate_attachment_metadata() in /wp-includes/image.php
|
717 |
+
*
|
718 |
+
* @since 2.81
|
719 |
+
*
|
720 |
+
* @param array Attachment metadata for just-inserted attachment
|
721 |
+
* @param integer ID of just-inserted attachment
|
722 |
+
*
|
723 |
+
* @return array Updated attachment metadata
|
724 |
+
*/
|
725 |
+
public static function mla_generate_attachment_metadata_filter( $data, $post_id ) {
|
726 |
+
if ( 'started' === MLAOptions::$upload_status ) {
|
727 |
+
MLAOptions::$upload_status = 'complete';
|
728 |
+
}
|
729 |
+
|
730 |
+
$upload_status = MLAOptions::$upload_status;
|
731 |
+
MLACore::mla_debug_add( __LINE__ . " MLAOptions::mla_generate_attachment_metadata_filter( $post_id, $upload_status ) \$data = " . var_export( $data, true ), MLACore::MLA_DEBUG_CATEGORY_METADATA );
|
732 |
+
return $data;
|
733 |
+
} // mla_generate_attachment_metadata_filter
|
734 |
+
|
735 |
/**
|
736 |
* Perform IPTC/EXIF and Custom Field mapping on just-inserted attachment
|
737 |
*
|
749 |
*/
|
750 |
public static function mla_update_attachment_metadata_filter( $data, $post_id ) {
|
751 |
$options = array ();
|
752 |
+
$options['is_upload'] = MLAOptions::$add_attachment_id === $post_id;
|
753 |
+
$options['upload_complete'] = MLAOptions::$upload_status === 'complete';
|
754 |
+
|
755 |
+
// WP 5.3+ calls this filter each time an intermediate size is generated; ignore those calls
|
756 |
+
if ( $options['is_upload'] && !$options['upload_complete'] ) {
|
757 |
+
return $data;
|
758 |
+
}
|
759 |
+
|
760 |
MLAOptions::$add_attachment_id = 0;
|
761 |
+
MLAOptions::$upload_status = '';
|
762 |
|
763 |
$options['enable_iptc_exif_mapping'] = 'checked' == MLACore::mla_get_option( 'enable_iptc_exif_mapping' );
|
764 |
$options['enable_custom_field_mapping'] = 'checked' == MLACore::mla_get_option( 'enable_custom_field_mapping' );
|
899 |
|
900 |
$custom_updates = array();
|
901 |
foreach ( $settings as $setting_key => $setting_value ) {
|
902 |
+
// Convert checkbox value(s)
|
|
|
|
|
903 |
$setting_value['no_null'] = isset( $setting_value['no_null'] ) && ( false !== $setting_value['no_null'] );
|
904 |
|
905 |
$setting_value['key'] = $setting_key;
|
959 |
$custom_updates[ $setting_value['name'] ] = $new_text;
|
960 |
}
|
961 |
} else { // } keep_existing
|
962 |
+
if ( $setting_value['no_null'] && ( ( ' ' === $new_text ) || ( ( 'raw' == $setting_value['format'] ) && empty( $new_text ) ) ) ) {
|
963 |
$new_text = NULL;
|
964 |
}
|
965 |
|
1314 |
* @return string HTML table row markup for 'render' else message(s) reflecting the results of the operation.
|
1315 |
*/
|
1316 |
public static function mla_custom_field_option_handler( $action, $key, $value, $args = NULL ) {
|
1317 |
+
MLACore::mla_debug_add( __LINE__ . " MLAOptions::mla_custom_field_option_handler( $action, $key )", MLACore::MLA_DEBUG_CATEGORY_ANY );
|
1318 |
+
return "MLAOptions::mla_custom_field_option_handler( $action, $key ) deprecated.";
|
1319 |
|
1320 |
// Added in 2.63
|
1321 |
MLAOptions::_load_option_templates();
|
1915 |
* @return string HTML markup with select field options
|
1916 |
*/
|
1917 |
public static function mla_compose_parent_option_list( $taxonomy, $selection = 0 ) {
|
1918 |
+
// Return empty list for invalid taxonomies
|
1919 |
+
if ( ! taxonomy_exists( $taxonomy ) ) {
|
1920 |
+
return '<option value="0" selected="selected">— ' . __( 'None (select a value)', 'media-library-assistant' ) . ' —</option>';
|
1921 |
+
}
|
1922 |
+
|
1923 |
$dropdown_options = array(
|
1924 |
'show_option_all' => '',
|
1925 |
'show_option_none' => '— ' . __( 'None (select a value)', 'media-library-assistant' ) . ' —',
|
2394 |
* @return string HTML table row markup for 'render' else message(s) reflecting the results of the operation.
|
2395 |
*/
|
2396 |
public static function mla_iptc_exif_option_handler( $action, $key, $value, $args = NULL ) {
|
2397 |
+
MLACore::mla_debug_add( __LINE__ . " MLAOptions::mla_iptc_exif_option_handler( $action, $key )", MLACore::MLA_DEBUG_CATEGORY_ANY );
|
2398 |
+
return " MLAOptions::mla_iptc_exif_option_handler( $action, $key ) deprecated.";
|
2399 |
|
2400 |
// Added in 2.63
|
2401 |
MLAOptions::_load_option_templates();
|
includes/class-mla-settings-documentation-tab.php
CHANGED
@@ -989,7 +989,12 @@ class MLA_Example_List_Table extends WP_List_Table {
|
|
989 |
$source_root = MLA_PLUGIN_PATH . 'examples/plugins/' . $source_dir;
|
990 |
$target_root = WP_PLUGIN_DIR . '/' . $source_dir;
|
991 |
|
992 |
-
|
|
|
|
|
|
|
|
|
|
|
993 |
$upgrader->init();
|
994 |
$result = $upgrader->fs_connect( array( WP_PLUGIN_DIR, $target_root ) );
|
995 |
if ( is_wp_error($result) ) {
|
@@ -1614,50 +1619,104 @@ class MLA_Example_List_Table extends WP_List_Table {
|
|
1614 |
}
|
1615 |
} // class MLA_Example_List_Table
|
1616 |
|
1617 |
-
|
1618 |
-
* Skin for the MLA_Example_List_Table Install and Update functions.
|
1619 |
-
*
|
1620 |
-
* Extends the core WP_Upgrader_Skin class.
|
1621 |
-
*
|
1622 |
-
* @package Media Library Assistant
|
1623 |
-
* @since 2.32
|
1624 |
-
*/
|
1625 |
-
class MLA_Upgrader_Skin extends WP_Upgrader_Skin {
|
1626 |
/**
|
1627 |
-
*
|
1628 |
*
|
1629 |
-
*
|
1630 |
*
|
1631 |
-
* @
|
|
|
1632 |
*/
|
1633 |
-
|
1634 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1635 |
/**
|
1636 |
-
*
|
1637 |
*
|
1638 |
-
*
|
1639 |
*
|
1640 |
-
* @
|
|
|
1641 |
*/
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1653 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1654 |
}
|
1655 |
-
|
1656 |
-
if ( empty( $feedback ) ) {
|
1657 |
-
return;
|
1658 |
-
}
|
1659 |
-
|
1660 |
-
$this->feedback[] = $feedback;
|
1661 |
}
|
1662 |
}
|
1663 |
|
989 |
$source_root = MLA_PLUGIN_PATH . 'examples/plugins/' . $source_dir;
|
990 |
$target_root = WP_PLUGIN_DIR . '/' . $source_dir;
|
991 |
|
992 |
+
if ( version_compare( get_bloginfo('version'), '5.2.9', '>' ) ) {
|
993 |
+
$upgrader = new WP_Upgrader( new MLA_Upgrader_Skin_53() );
|
994 |
+
} else {
|
995 |
+
$upgrader = new WP_Upgrader( new MLA_Upgrader_Skin() );
|
996 |
+
}
|
997 |
+
|
998 |
$upgrader->init();
|
999 |
$result = $upgrader->fs_connect( array( WP_PLUGIN_DIR, $target_root ) );
|
1000 |
if ( is_wp_error($result) ) {
|
1619 |
}
|
1620 |
} // class MLA_Example_List_Table
|
1621 |
|
1622 |
+
if ( version_compare( get_bloginfo('version'), '5.2.9', '>' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1623 |
/**
|
1624 |
+
* Skin for the MLA_Example_List_Table Install and Update functions.
|
1625 |
*
|
1626 |
+
* Extends the core WP_Upgrader_Skin class for WP Version 5.3 and later.
|
1627 |
*
|
1628 |
+
* @package Media Library Assistant
|
1629 |
+
* @since 2.81
|
1630 |
*/
|
1631 |
+
class MLA_Upgrader_Skin_53 extends WP_Upgrader_Skin {
|
1632 |
+
/**
|
1633 |
+
* Messages sent to MLA_Upgrader_Skin::feedback()
|
1634 |
+
*
|
1635 |
+
* @since 2.32
|
1636 |
+
*
|
1637 |
+
* @var array
|
1638 |
+
*/
|
1639 |
+
public $feedback = array();
|
1640 |
+
|
1641 |
+
/**
|
1642 |
+
* Receive feedback from the WP_Upgrader::install() process
|
1643 |
+
*
|
1644 |
+
* @since 2.32
|
1645 |
+
*
|
1646 |
+
* @param string $string
|
1647 |
+
* @param mixed ...$args Optional text replacements.
|
1648 |
+
*/
|
1649 |
+
public function feedback( $string, ...$args ) {
|
1650 |
+
if ( isset( $this->upgrader->strings[$string] ) ) {
|
1651 |
+
$feedback = $this->upgrader->strings[$string];
|
1652 |
+
} else {
|
1653 |
+
$feedback = $string;
|
1654 |
+
}
|
1655 |
+
|
1656 |
+
if ( strpos( $feedback, '%' ) !== false ) {
|
1657 |
+
if ( $args ) {
|
1658 |
+
$args = array_map( 'strip_tags', $args );
|
1659 |
+
$args = array_map( 'esc_html', $args );
|
1660 |
+
$feedback = vsprintf( $feedback, $args );
|
1661 |
+
}
|
1662 |
+
}
|
1663 |
+
|
1664 |
+
if ( empty( $feedback ) ) {
|
1665 |
+
return;
|
1666 |
+
}
|
1667 |
+
|
1668 |
+
$this->feedback[] = $feedback;
|
1669 |
+
}
|
1670 |
+
}
|
1671 |
+
} else {
|
1672 |
/**
|
1673 |
+
* Skin for the MLA_Example_List_Table Install and Update functions.
|
1674 |
*
|
1675 |
+
* Extends the core WP_Upgrader_Skin class.
|
1676 |
*
|
1677 |
+
* @package Media Library Assistant
|
1678 |
+
* @since 2.32
|
1679 |
*/
|
1680 |
+
class MLA_Upgrader_Skin extends WP_Upgrader_Skin {
|
1681 |
+
/**
|
1682 |
+
* Messages sent to MLA_Upgrader_Skin::feedback()
|
1683 |
+
*
|
1684 |
+
* @since 2.32
|
1685 |
+
*
|
1686 |
+
* @var array
|
1687 |
+
*/
|
1688 |
+
public $feedback = array();
|
1689 |
+
|
1690 |
+
/**
|
1691 |
+
* Receive feedback from the WP_Upgrader::install() process
|
1692 |
+
*
|
1693 |
+
* @since 2.32
|
1694 |
+
*
|
1695 |
+
* @param string $string
|
1696 |
+
*/
|
1697 |
+
public function feedback( $string ) {
|
1698 |
+
if ( isset( $this->upgrader->strings[$string] ) ) {
|
1699 |
+
$feedback = $this->upgrader->strings[$string];
|
1700 |
+
} else {
|
1701 |
+
$feedback = $string;
|
1702 |
}
|
1703 |
+
|
1704 |
+
if ( strpos( $feedback, '%' ) !== false ) {
|
1705 |
+
$args = func_get_args();
|
1706 |
+
$args = array_splice( $args, 1 );
|
1707 |
+
if ( $args ) {
|
1708 |
+
$args = array_map( 'strip_tags', $args );
|
1709 |
+
$args = array_map( 'esc_html', $args );
|
1710 |
+
$feedback = vsprintf( $feedback, $args );
|
1711 |
+
}
|
1712 |
+
}
|
1713 |
+
|
1714 |
+
if ( empty( $feedback ) ) {
|
1715 |
+
return;
|
1716 |
+
}
|
1717 |
+
|
1718 |
+
$this->feedback[] = $feedback;
|
1719 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1720 |
}
|
1721 |
}
|
1722 |
|
includes/class-mla-settings-iptc-exif-tab.php
CHANGED
@@ -2119,6 +2119,7 @@ class MLA_IPTC_EXIF_Query {
|
|
2119 |
$value['option'] = 'text';
|
2120 |
$value['no_null'] = false;
|
2121 |
$value['read_only'] = false;
|
|
|
2122 |
$value['deleted'] = false;
|
2123 |
|
2124 |
if ( isset( $value['active'] ) && $value['active'] ) {
|
2119 |
$value['option'] = 'text';
|
2120 |
$value['no_null'] = false;
|
2121 |
$value['read_only'] = false;
|
2122 |
+
$value['changed'] = false;
|
2123 |
$value['deleted'] = false;
|
2124 |
|
2125 |
if ( isset( $value['active'] ) && $value['active'] ) {
|
includes/class-mla-thumbnail-generation.php
CHANGED
@@ -265,6 +265,10 @@ class MLA_Thumbnail {
|
|
265 |
private static function _generate_wordpress_thumbnail( $post_id, $file, $args, $old_sizes = NULL ) {
|
266 |
// Get the metadata for the original (PDF) attachment.
|
267 |
$item_data = wp_get_attachment_metadata( $post_id );
|
|
|
|
|
|
|
|
|
268 |
|
269 |
// Make the file path relative to the upload dir.
|
270 |
$item_relative_path = _wp_relative_upload_path( $file );
|
265 |
private static function _generate_wordpress_thumbnail( $post_id, $file, $args, $old_sizes = NULL ) {
|
266 |
// Get the metadata for the original (PDF) attachment.
|
267 |
$item_data = wp_get_attachment_metadata( $post_id );
|
268 |
+
MLACore::mla_debug_add( __LINE__ . " MLA_Thumbnail::_generate_wordpress_thumbnail( $post_id, $file ) item_data = " . var_export( $item_data, true ), MLACore::MLA_DEBUG_CATEGORY_THUMBNAIL );
|
269 |
+
if ( !is_array( $item_data ) ) {
|
270 |
+
$item_data = array();
|
271 |
+
}
|
272 |
|
273 |
// Make the file path relative to the upload dir.
|
274 |
$item_relative_path = _wp_relative_upload_path( $file );
|
includes/mla-main-search-box-template.php
CHANGED
@@ -25,7 +25,7 @@ if ( !empty( $_REQUEST['s'] ) ) {
|
|
25 |
}
|
26 |
|
27 |
if ( 'checked' == MLACore::mla_get_option( MLACoreOptions::MLA_SEARCH_MEDIA_FILTER_SHOW_CONTROLS ) ) {
|
28 |
-
$controls_style = 'style="
|
29 |
} else {
|
30 |
$controls_style = 'style="display: none;"';
|
31 |
}
|
25 |
}
|
26 |
|
27 |
if ( 'checked' == MLACore::mla_get_option( MLACoreOptions::MLA_SEARCH_MEDIA_FILTER_SHOW_CONTROLS ) ) {
|
28 |
+
$controls_style = 'style="float: left;"';
|
29 |
} else {
|
30 |
$controls_style = 'style="display: none;"';
|
31 |
}
|
includes/mla-media-modal-js-template.php
CHANGED
@@ -13,6 +13,23 @@
|
|
13 |
*/
|
14 |
global $post;
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
$supported_taxonomies = MLACore::mla_supported_taxonomies('support');
|
17 |
if ( empty( $supported_taxonomies ) ) {
|
18 |
$terms_style = 'style="display: none;"';
|
@@ -25,7 +42,7 @@ if ( empty( $supported_taxonomies ) ) {
|
|
25 |
<label class="screen-reader-text" for="mla-media-search-input"><?php _e( 'Search Media', 'media-library-assistant' ); ?>:</label>
|
26 |
<input name="s[mla_search_value]" class="search" id="mla-media-search-input" style="width: 100%; max-width: 100%" type="search" value="{{ data.searchValue }}" placeholder="{{ data.searchBoxPlaceholder }}" />
|
27 |
</div>
|
28 |
-
<input name="mla_search_submit" class="button media-button mla-search-submit-button" id="mla-search-submit" type="submit" style="float: none" value="<?php _e( 'Search', 'media-library-assistant' ); ?>" /><br>
|
29 |
<ul class="mla-search-options" style="{{ data.searchBoxControlsStyle }}">
|
30 |
<li>
|
31 |
<input type="radio" name="s[mla_search_connector]" value="AND" <# if ( 'OR' !== data.searchConnector ) { #>checked="checked"<# } #> />
|
@@ -69,7 +86,7 @@ if ( empty( $supported_taxonomies ) ) {
|
|
69 |
</ul>
|
70 |
</script>
|
71 |
<script type="text/html" id="tmpl-mla-terms-search-button">
|
72 |
-
<input
|
73 |
</script>
|
74 |
<script type="text/html" id="tmpl-mla-simulate-search-button">
|
75 |
<input style="display:none" type="button" name="mla_search_submit" id="mla-search-submit" class="button" value="<?php _e( 'Search', 'media-library-assistant' ); ?>" />
|
13 |
*/
|
14 |
global $post;
|
15 |
|
16 |
+
if ( version_compare( get_bloginfo('version'), '5.2.9', '>' ) ) {
|
17 |
+
$margin = 'margin-top: 32px; ';
|
18 |
+
|
19 |
+
// Do not adjust margin-top for Media/Library Grid mode
|
20 |
+
if ( function_exists( 'get_current_screen' ) ) {
|
21 |
+
$screen = get_current_screen();
|
22 |
+
|
23 |
+
if ( is_object( $screen ) ) {
|
24 |
+
if ( 'upload' == $screen->base ) {
|
25 |
+
$margin = '';
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}
|
29 |
+
} else {
|
30 |
+
$margin = '';
|
31 |
+
}
|
32 |
+
|
33 |
$supported_taxonomies = MLACore::mla_supported_taxonomies('support');
|
34 |
if ( empty( $supported_taxonomies ) ) {
|
35 |
$terms_style = 'style="display: none;"';
|
42 |
<label class="screen-reader-text" for="mla-media-search-input"><?php _e( 'Search Media', 'media-library-assistant' ); ?>:</label>
|
43 |
<input name="s[mla_search_value]" class="search" id="mla-media-search-input" style="width: 100%; max-width: 100%" type="search" value="{{ data.searchValue }}" placeholder="{{ data.searchBoxPlaceholder }}" />
|
44 |
</div>
|
45 |
+
<input name="mla_search_submit" class="button media-button mla-search-submit-button" id="mla-search-submit" type="submit" style="<?php echo $margin; ?>float: none" value="<?php _e( 'Search', 'media-library-assistant' ); ?>" /><br>
|
46 |
<ul class="mla-search-options" style="{{ data.searchBoxControlsStyle }}">
|
47 |
<li>
|
48 |
<input type="radio" name="s[mla_search_connector]" value="AND" <# if ( 'OR' !== data.searchConnector ) { #>checked="checked"<# } #> />
|
86 |
</ul>
|
87 |
</script>
|
88 |
<script type="text/html" id="tmpl-mla-terms-search-button">
|
89 |
+
<input name="mla_terms_search" id="mla-terms-search" class="button media-button button-large mla-terms-search-button" style="<?php echo $margin; ?>" type="button" value="<?php _e( 'Terms Search', 'media-library-assistant' ); ?>" />
|
90 |
</script>
|
91 |
<script type="text/html" id="tmpl-mla-simulate-search-button">
|
92 |
<input style="display:none" type="button" name="mla_search_submit" id="mla-search-submit" class="button" value="<?php _e( 'Search', 'media-library-assistant' ); ?>" />
|
index.php
CHANGED
@@ -16,7 +16,7 @@ Description: Enhances the Media Library; powerful [mla_gallery] [mla_tag_cloud]
|
|
16 |
Author: David Lingren
|
17 |
Text Domain: media-library-assistant
|
18 |
Domain Path: /languages
|
19 |
-
Version: 2.
|
20 |
Author URI: http://davidlingren.com/
|
21 |
|
22 |
Copyright 2011-2019 David Lingren
|
16 |
Author: David Lingren
|
17 |
Text Domain: media-library-assistant
|
18 |
Domain Path: /languages
|
19 |
+
Version: 2.81
|
20 |
Author URI: http://davidlingren.com/
|
21 |
|
22 |
Copyright 2011-2019 David Lingren
|
js/mla-media-modal-scripts.js
CHANGED
@@ -875,13 +875,15 @@ console.log( 'listening to controller events' );
|
|
875 |
},
|
876 |
|
877 |
hideDefaultSearch: function() {
|
878 |
-
var defaultSearch = $( '#media-search-input', mlaModal.settings.$el )
|
|
|
879 |
|
880 |
if ( 0 === defaultSearch.length ) {
|
881 |
defaultSearch = $( 'div.media-toolbar-primary > input.search', mlaModal.settings.$el )
|
882 |
}
|
883 |
|
884 |
defaultSearch.hide();
|
|
|
885 |
},
|
886 |
|
887 |
updateFilters: function( taxonomy, selectMarkup ) {
|
875 |
},
|
876 |
|
877 |
hideDefaultSearch: function() {
|
878 |
+
var defaultSearch = $( '#media-search-input', mlaModal.settings.$el ),
|
879 |
+
defaultSearchLabel = $( '.media-search-input-label', mlaModal.settings.$el );
|
880 |
|
881 |
if ( 0 === defaultSearch.length ) {
|
882 |
defaultSearch = $( 'div.media-toolbar-primary > input.search', mlaModal.settings.$el )
|
883 |
}
|
884 |
|
885 |
defaultSearch.hide();
|
886 |
+
defaultSearchLabel.hide();
|
887 |
},
|
888 |
|
889 |
updateFilters: function( taxonomy, selectMarkup ) {
|
js/mla-media-modal-scripts.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var wp,wpAjax,ajaxurl,jQuery,_,getUserSetting,setUserSetting,deleteUserSetting,mlaTaxonomy,mlaModal={strings:{},settings:{},initialHTML:{},uploading:false,cid:null,utility:{originalMediaAjax:null,mlaAttachmentsBrowser:null,parseTermsOptions:null,arrayCleanup:null,parseTaxonomyId:null,hookCompatTaxonomies:null,fillCompatTaxonomies:null,supportCompatTaxonomies:null},tagBox:null};(function(d){var c=wp.media.view.AttachmentsBrowser,b=wp.media.view.AttachmentCompat,a=wp.media.model.Selection;mlaModal.strings=typeof wp.media.view.l10n.mla_strings==="undefined"?{}:wp.media.view.l10n.mla_strings;delete wp.media.view.l10n.mla_strings;mlaModal.settings=typeof wp.media.view.settings.mla_settings==="undefined"?{screen:"unknown",enableMediaGrid:false,enableMediaModal:false}:wp.media.view.settings.mla_settings;delete wp.media.view.settings.mla_settings;if(!(mlaModal.settings.enableMediaGrid||mlaModal.settings.enableMediaModal)){return}if(("grid"===mlaModal.settings.screen)&&false===mlaModal.settings.enableMediaGrid){return}if(("modal"===mlaModal.settings.screen)&&false===mlaModal.settings.enableMediaModal){return}mlaModal.settings.pagenow=typeof pagenow==="undefined"?"unknown":pagenow;if(mlaModal.settings.pagenow==="toolset_page_views-editor"){return}mlaModal.utility.originalMediaAjax=wp.media.ajax;wp.media.ajax=function(k,g){var j=mlaModal.settings.state,i,f,h,e;if(_.isObject(k)){g=k}else{g=g||{};g.data=_.extend(g.data||{},{action:k})}if("query-attachments"==g.data.action){i=g.data.query;f=typeof i.s;if("object"==f){h=i.s}else{if("string"==f){h={mla_search_value:i.s}}else{h={mla_search_value:""}}}if("undefined"!=typeof i.post_mime_type){mlaModal.settings.query[j].filterMime=i.post_mime_type}else{mlaModal.settings.query[j].filterMime="all"}if("undefined"!=typeof h.mla_filter_month){mlaModal.settings.query[j].filterMonth=h.mla_filter_month}else{if("undefined"!=typeof i.year){mlaModal.settings.query[j].filterMonth=(100*i.year)+(1*i.monthnum)}else{}}if("undefined"!=typeof h.mla_filter_term){mlaModal.settings.query[j].filterTerm=h.mla_filter_term}if("undefined"!=typeof h.mla_search_value){mlaModal.settings.query[j].searchValue=h.mla_search_value}e={mla_filter_month:mlaModal.settings.query[j].filterMonth,mla_filter_term:mlaModal.settings.query[j].filterTerm,mla_terms_search:mlaModal.settings.query[j].termsSearch,mla_search_clicks:mlaModal.settings.query[j].searchClicks,mla_search_value:mlaModal.settings.query[j].searchValue,mla_search_fields:mlaModal.settings.query[j].searchFields,mla_search_connector:mlaModal.settings.query[j].searchConnector};mlaModal.settings.query[j].termsSearch="";d("#mla-terms-search-input").html("").val("");g.data.query.s=e}return mlaModal.utility.originalMediaAjax.call(this,g)};if(mlaModal.settings.enableMimeTypes){wp.media.view.AttachmentFilters.Mla=wp.media.view.AttachmentFilters.extend({createFilters:function(){var f=this.controller._state,e={};_.each(mlaModal.settings.allMimeTypes||{},function(h,g){if(("grid"===mlaModal.settings.screen)||("trash"!==g)){e[g]={text:h,props:{type:g,uploadedTo:null,orderby:"date",order:"DESC"}}}});e.all={text:wp.media.view.l10n.allMediaItems,props:{type:null,uploadedTo:null,orderby:"date",order:"DESC"},priority:10};if(wp.media.view.settings.post.id){e.uploaded={text:wp.media.view.l10n.uploadedToThisPost,props:{type:null,uploadedTo:wp.media.view.settings.post.id,orderby:"menuOrder",order:"ASC"},priority:20}}this.filters=e;if("undefined"===typeof e[mlaModal.settings.query[f].filterMime]){mlaModal.settings.query[f].filterMime="all"}if(mlaModal.settings.query[f].filterMime!="all"){this.model.set(e[mlaModal.settings.query[f].filterMime].props,{silent:false})}},select:function(){var h=this.controller._state,e=this.model,g=mlaModal.settings.query[h].filterMime,f=e.toJSON();if(false===mlaModal.settings.enableSearchBox){if("string"==typeof f.search){mlaModal.settings.query[h].searchValue=f.search}else{mlaModal.settings.query[h].searchValue=""}}_.find(this.filters,function(j,k){var i=_.all(j.props,function(m,l){return m===(_.isUndefined(f[l])?null:f[l])});if(i){return g=k}});this.$el.val(g)},change:function(){var f=d(this.el).closest("div.media-toolbar"),e=this.filters[this.el.value];if(e){this.model.set(e.props,{silent:true});d("#mla-search-submit",f).click()}}});wp.media.view.AttachmentFilters.MlaUploaded=wp.media.view.AttachmentFilters.extend({createFilters:function(){var f=this.model.get("type"),e=wp.media.view.settings.mimeTypes,i,h=this.controller._state,g={};if(e&&f){i=e[f]}_.each(mlaModal.settings.uploadMimeTypes||{},function(k,j){if(("grid"===mlaModal.settings.screen)||("trash"!==j)){g[j]={text:k,props:{type:j,uploadedTo:null,orderby:"date",order:"DESC"}}}});g.all={text:i||wp.media.view.l10n.allMediaItems,props:{uploadedTo:null,orderby:"date",order:"DESC"},priority:10};g.uploaded={text:wp.media.view.l10n.uploadedToThisPost,props:{type:null,uploadedTo:wp.media.view.settings.post.id,orderby:"menuOrder",order:"ASC"},priority:20};g.unattached={text:wp.media.view.l10n.unattached,props:{uploadedTo:0,orderby:"menuOrder",order:"ASC"},priority:50};this.filters=g;if("undefined"===typeof g[mlaModal.settings.query[h].filterUploaded]){mlaModal.settings.query[h].filterUploaded="all"}if(mlaModal.settings.query[h].filterUploaded!="all"){this.model.set(g[mlaModal.settings.query[h].filterUploaded].props,{silent:false})}},select:function(){var h=this.controller._state,e=this.model,g=mlaModal.settings.query[h].filterMime,f=e.toJSON();if(false===mlaModal.settings.enableSearchBox){if("string"==typeof f.search){mlaModal.settings.query[h].searchValue=f.search}else{mlaModal.settings.query[h].searchValue=""}}_.find(this.filters,function(j,k){var i=_.all(j.props,function(m,l){return m===(_.isUndefined(f[l])?null:f[l])});if(i){return g=k}});this.$el.val(g)},change:function(){var f=d(this.el).closest("div.media-toolbar"),e=this.filters[this.el.value];if(e){this.model.set(e.props,{silent:true});d("#mla-search-submit",f).click()}}})}if(mlaModal.settings.enableMonthsDropdown){wp.media.view.AttachmentFilters.MlaMonths=wp.media.view.AttachmentFilters.extend({className:"attachment-filters",id:"media-attachment-date-filters",createFilters:function(){var f=this.controller._state,e={};_.each(mlaModal.settings.months||{},function(h,g){e[g]={text:h,props:{s:{mla_filter_month:g}}}});this.filters=e;if("undefined"===typeof e[mlaModal.settings.query[f].filterMonth]){mlaModal.settings.query[f].filterMonth=0}if(mlaModal.settings.query[f].filterMonth>0){this.model.set(e[mlaModal.settings.query[f].filterMonth].props,{silent:false})}},select:function(){var h=this.controller._state,e=this.model,g=mlaModal.settings.query[h].filterMonth,f=e.toJSON();if(_.isUndefined(f.s)){f.s={}}if(false===mlaModal.settings.enableSearchBox){if("string"==typeof f.search){mlaModal.settings.query[h].searchValue=f.search}else{mlaModal.settings.query[h].searchValue=""}}if(_.isUndefined(f.s.mla_filter_month)){f.s.mla_filter_month=mlaModal.settings.query[h].filterMonth}else{mlaModal.settings.query[h].filterMonth=f.s.mla_filter_month}_.find(this.filters,function(j,k){var i=_.all(j.props,function(l){return l.mla_filter_month==mlaModal.settings.query[h].filterMonth});if(i){return g=k}});this.$el.val(g)},change:function(){var e=this.filters[this.el.value],f;if(e){f={s:{mla_filter_month:e.props.s.mla_filter_month}};this.model.set(f)}}})}if(mlaModal.settings.enableTermsDropdown){wp.media.view.AttachmentFilters.MlaTerms=wp.media.view.AttachmentFilters.extend({className:"attachment-filters",id:"media-attachment-term-filters",createFilters:function(){var h=this.controller._state,e,f,g={};_.each(mlaModal.settings.termsText||{},function(j,i){if(mlaModal.settings.termsCustom){f=mlaModal.settings.termsValue[i]}else{f=parseInt(mlaModal.settings.termsValue[i])}g[i]={text:j,props:{s:{mla_filter_term:f}}}});this.filters=g;e=_.indexOf(mlaModal.settings.termsValue,mlaModal.settings.query[h].filterTerm);if(e>0){this.model.set(g[e].props,{silent:false})}},select:function(){var h=this.controller._state,e=this.model,g=mlaModal.settings.query[h].filterTerm,f=e.toJSON();if(_.isUndefined(f.s)){f.s={}}if(false===mlaModal.settings.enableSearchBox){if("string"==typeof f.search){mlaModal.settings.query[h].searchValue=f.search}else{mlaModal.settings.query[h].searchValue=""}}if(_.isUndefined(f.s.mla_filter_term)){f.s.mla_filter_term=mlaModal.settings.query[h].filterTerm}else{mlaModal.settings.query[h].filterTerm=f.s.mla_filter_term}_.find(this.filters,function(j,k){var i=_.all(j.props,function(l){return l.mla_filter_term==mlaModal.settings.query[h].filterTerm});if(i){return g=k}});this.$el.val(g)},change:function(){var e=this.filters[this.el.value],f;if(e){f={s:{mla_filter_term:e.props.s.mla_filter_term}};this.model.set(f)}}})}if(mlaModal.settings.enableTermsSearch){wp.media.view.MlaTermsSearch=wp.media.View.extend({tagName:"span",className:"mla-terms-search",template:wp.media.template("mla-terms-search-button"),attributes:{type:"mla-terms-search-button"},events:{change:"termsSearchOpen",click:"termsSearchOpen"},render:function(){this.$el.html(this.template(mlaModal.strings));return this},termsSearchOpen:function(f){var e=d(this.el).closest("div.media-toolbar");if(("click"==f.type)&&("mla_terms_search"===f.target.name)){mlaTaxonomy.termsSearch.open();d("#mla-terms-search-form").off("submit");d("#mla-terms-search-form").submit(function(j){var g,i,h={phrases:"",taxonomies:[]};j.preventDefault();g=d("#mla-terms-search-form").serializeArray();for(i=0;i<g.length;i++){switch(g[i].name){case"mla_terms_search[phrases]":h.phrases=g[i].value;break;case"mla_terms_search[radio_phrases]":h.radio_phrases=g[i].value;break;case"mla_terms_search[radio_terms]":h.radio_terms=g[i].value;break;case"mla_terms_search[taxonomies][]":h.taxonomies[h.taxonomies.length]=g[i].value;break}}mlaModal.settings.query[mlaModal.settings.state].termsSearch=h;d("#mla-search-submit",e).click();return false});d("#mla-terms-search-input").keypress(function(g){if(13==g.which){g.preventDefault();d("#mla-terms-search-submit").click()}})}}})}if(mlaModal.settings.enableSearchBox){wp.media.view.MlaSearch=wp.media.View.extend({tagName:"div",className:"mla-search-box",template:wp.media.template("mla-search-box"),attributes:{type:"mla-search-box"},events:{input:"search",change:"search",click:"search",search:"search",MlaSearch:"search"},initialize:function(){var e=this.controller._state;if("undefined"===typeof mlaModal.settings.query[e]){mlaModal.settings.query[e]=_.clone(mlaModal.settings.query.initial);mlaModal.settings.query[e].searchFields=_.clone(mlaModal.settings.query.initial.searchFields)}},render:function(){var f=this.controller._state,e=_.extend(mlaModal.strings,mlaModal.settings.query[f]);this.$el.html(this.template(e));return this},search:function(g){var h=this.controller._state,e,i,f;if(("input"==g.type)&&("s[mla_search_value]"==g.target.name)){mlaModal.settings.query[h].searchValue=g.target.value;return}if(("click"==g.type)&&("mla_search_submit"!=g.target.name)){return}switch(g.target.name){case"s[mla_search_value]":mlaModal.settings.query[h].searchValue=g.target.value;break;case"mla_search_submit":e={mla_filter_month:mlaModal.settings.query[h].filterMonth,mla_filter_term:mlaModal.settings.query[h].filterTerm,mla_terms_search:mlaModal.settings.query[h].termsSearch,mla_search_clicks:mlaModal.settings.query[h].searchClicks++,mla_search_value:mlaModal.settings.query[h].searchValue,mla_search_fields:mlaModal.settings.query[h].searchFields,mla_search_connector:mlaModal.settings.query[h].searchConnector};this.model.set({s:e});break;case"s[mla_search_connector]":mlaModal.settings.query[h].searchConnector=g.target.value;break;case"s[mla_search_title]":i=mlaModal.settings.query[h].searchFields;f=i.indexOf("title");if(-1==f){i.push("title")}else{i.splice(f,1)}mlaModal.settings.query[h].searchFields=i;break;case"s[mla_search_name]":f=mlaModal.settings.query[h].searchFields.indexOf("name");if(-1==f){mlaModal.settings.query[h].searchFields.push("name")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_alt_text]":f=mlaModal.settings.query[h].searchFields.indexOf("alt-text");if(-1==f){mlaModal.settings.query[h].searchFields.push("alt-text")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_excerpt]":f=mlaModal.settings.query[h].searchFields.indexOf("excerpt");if(-1==f){mlaModal.settings.query[h].searchFields.push("excerpt")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_content]":f=mlaModal.settings.query[h].searchFields.indexOf("content");if(-1==f){mlaModal.settings.query[h].searchFields.push("content")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_file]":f=mlaModal.settings.query[h].searchFields.indexOf("file");if(-1==f){mlaModal.settings.query[h].searchFields.push("file")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_terms]":f=mlaModal.settings.query[h].searchFields.indexOf("terms");if(-1==f){mlaModal.settings.query[h].searchFields.push("terms")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break}}})}else{wp.media.view.MlaSearch=wp.media.View.extend({tagName:"span",className:"mla-simulate-search-button",template:wp.media.template("mla-simulate-search-button"),attributes:{type:"mla-simulate-search-button"},events:{click:"simulateSearch"},render:function(){this.$el.html(this.template(mlaModal.strings));return this},simulateSearch:function(){var f=this.controller._state,e={mla_filter_month:mlaModal.settings.query[f].filterMonth,mla_filter_term:mlaModal.settings.query[f].filterTerm,mla_terms_search:mlaModal.settings.query[f].termsSearch,mla_search_clicks:mlaModal.settings.query[f].searchClicks++,mla_search_value:mlaModal.settings.query[f].searchValue,mla_search_fields:mlaModal.settings.query[f].searchFields,mla_search_connector:mlaModal.settings.query[f].searchConnector};this.model.set({s:e})}})}if(mlaModal.settings.enableMimeTypes||mlaModal.settings.enableMonthsDropdown||mlaModal.settings.enableTermsDropdown||mlaModal.settings.enableTermsSearch||mlaModal.settings.enableSearchBox){wp.media.view.AttachmentsBrowser=wp.media.view.AttachmentsBrowser.extend({createToolbar:function(){var e,f=this.controller._state;mlaModal.settings.state=f;mlaModal.settings.$el=this.controller.$el;if("undefined"===typeof mlaModal.settings.query[f]){mlaModal.settings.query[f]=_.clone(mlaModal.settings.query.initial);mlaModal.settings.query[f].searchFields=_.clone(mlaModal.settings.query.initial.searchFields)}c.prototype.createToolbar.apply(this,arguments);mlaModal.utility.mlaAttachmentsBrowser=this;e=this.options.filters;if(typeof window.eml!=="undefined"){d(".media-toolbar",this.$el).css("overflow","hidden")}if(("all"===e)&&mlaModal.settings.enableMimeTypes){this.toolbar.unset("filters",{silent:true});this.toolbar.set("filters",new wp.media.view.AttachmentFilters.Mla({controller:this.controller,model:this.collection.props,priority:-80}).render())}if(("uploaded"===e)&&mlaModal.settings.enableMimeTypes){this.toolbar.unset("filters",{silent:true});this.toolbar.set("filters",new wp.media.view.AttachmentFilters.MlaUploaded({controller:this.controller,model:this.collection.props,priority:-80}).render())}if(this.options.search&&mlaModal.settings.enableMonthsDropdown){this.toolbar.unset("dateFilter",{silent:true});this.toolbar.set("dateFilter",new wp.media.view.AttachmentFilters.MlaMonths({controller:this.controller,model:this.collection.props,priority:-75}).render())}if(this.options.search&&mlaModal.settings.enableTermsDropdown){this.toolbar.set("terms",new wp.media.view.AttachmentFilters.MlaTerms({controller:this.controller,model:this.collection.props,priority:-50}).render())}if(this.options.search&&mlaModal.settings.enableTermsSearch){this.toolbar.set("termsSearch",new wp.media.view.MlaTermsSearch({controller:this.controller,model:this.collection.props,priority:-50}).render())}if(this.options.search){if(mlaModal.settings.enableSearchBox){this.controller.on("content:activate",this.hideDefaultSearch);this.controller.on("edit:activate",this.hideDefaultSearch);this.controller.on("router:render",this.hideDefaultSearch);this.controller.on("uploader:ready",this.hideDefaultSearch);this.toolbar.set("MlaSearch",new wp.media.view.MlaSearch({controller:this.controller,model:this.collection.props,priority:60}).render())}else{this.toolbar.set("MlaSearch",new wp.media.view.MlaSearch({controller:this.controller,model:this.collection.props,priority:70}).render())}}},hideDefaultSearch:function(){var e=d("#media-search-input",mlaModal.settings.$el);if(0===e.length){e=d("div.media-toolbar-primary > input.search",mlaModal.settings.$el)}e.hide()},updateFilters:function(e,f){var g={};if(this.options.search&&mlaModal.settings.enableTermsDropdown&&mlaModal.settings.termsTaxonomy==e){g=mlaModal.utility.parseTermsOptions(f);mlaModal.settings.termsClass=g.termsClass;mlaModal.settings.termsText=g.termsText;mlaModal.settings.termsValue=g.termsValue;this.toolbar.unset("terms",{silent:true});this.toolbar.set("terms",new wp.media.view.AttachmentFilters.MlaTerms({controller:this.controller,model:this.collection.props,priority:-80}).render())}}})}mlaModal.utility.parseTermsOptions=function(k){var j={termsClass:[mlaModal.settings.termsClass[0],mlaModal.settings.termsClass[1]],termsText:[mlaModal.settings.termsText[0],mlaModal.settings.termsText[1]],termsValue:[mlaModal.settings.termsValue[0],mlaModal.settings.termsValue[1]]},g=2,e,f,i=/\<option(( class=\"([^\"]+)\" )|( ))value=((\'([^\']+)\')|(\"([^\"]+)\"))([^\>]*)\>([^\<]*)\<.*/g,h=[];if("object"===typeof k){g=mlaModal.settings.termsValue.length;for(e=2;e<g;e++){h[e]={termsClass:mlaModal.settings.termsClass[e],termsText:mlaModal.settings.termsText[e],termsValue:mlaModal.settings.termsValue[e]};if("undefined"!==typeof k[mlaModal.settings.termsValue[e]]){delete k[mlaModal.settings.termsValue[e]]}}for(f in k){h[e++]={termsClass:"level-0",termsText:k[f],termsValue:f.toString()}}if(g===e){return{termsClass:mlaModal.settings.termsClass,termsText:mlaModal.settings.termsText,termsValue:mlaModal.settings.termsValue}}h.sort(function(m,l){if(m.termsText>l.termsText){return 1}else{if(m.termsText<l.termsText){return -1}else{return 0}}});e=2;for(f in h){j.termsClass[e]=h[f].termsClass;j.termsText[e]=h[f].termsText;j.termsValue[e++]=h[f].termsValue}return j}h=i.exec(k);while(null!==(h=i.exec(k))){j.termsClass[g]=h[3];j.termsValue[g]=("undefined"===typeof h[6])?h[9]:h[7];j.termsText[g++]=h[11].replace(" ",mlaModal.settings.termsIndent)}return j};mlaModal.utility.arrayCleanup=function(g){var f=[],e=("string"===typeof g);if(e){g=g.split(mlaModal.settings.comma)}jQuery.each(g,function(h,i){i=jQuery.trim(i);if(i&&jQuery.inArray(i,f)==-1){f.push(i)}});f.sort();if(e){f=f.join(mlaModal.settings.comma)}return f};mlaModal.utility.parseTaxonomyId=function(f){var e=f.split("-");e.shift();e.shift();return e.join("-")};mlaModal.tagBox={cleanTags:function(f){var e=mlaModal.settings.comma;if(","!==e){f=f.replace(new RegExp(e,"g"),",")}f=f.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"");if(","!==e){f=f.replace(/,/g,e)}return f},parseTags:function(h){var l=h.id,f=l.split("-check-num-")[1],i=d(h).closest(".tagsdiv"),k=i.find(".the-tags"),e=mlaModal.settings.comma,g=k.val().split(e),j=[];delete g[f];d.each(g,function(m,n){n=d.trim(n);if(n){j.push(n)}});k.val(this.cleanTags(j.join(e)));this.quickClicks(i);return false},quickClicks:function(g){var j=d(".the-tags",g),h=d(".tagchecklist",g),i=d(g).attr("id"),e,f;if(!j.length){return}f=j.prop("disabled");e=j.val().split(mlaModal.settings.comma);h.empty();d.each(e,function(m,n){var l,k;n=d.trim(n);if(!n){return}if(mlaModal.settings.generateTagUl){l=d("<li />").text(n)}else{l=d("<span />").text(n)}if(!f){if(mlaModal.settings.generateTagButtons){k=d('<button class="ntdelbutton" id="'+i+"-check-num-"+m+'" type="button"><span class="remove-tag-icon" aria-hidden="true"></span><span class="screen-reader-text">'+mlaModal.settings.removeTerm+": "+n+"</span></button>")}else{k=d('<a id="'+i+"-check-num-"+m+'" class="ntdelbutton">X</a>')}k.click(function(){mlaModal.tagBox.parseTags(this)});l.prepend(" ").prepend(k)}h.append(l)})},flushTags:function(k,h,g){var m,e,i,n=d(".the-tags",k),j=d("input.newtag",k),l=mlaModal.settings.comma;h=h||false;i=h?d(h).text():j.val();m=n.val();e=m?m+l+i:i;e=mlaModal.utility.arrayCleanup(this.cleanTags(e));n.val(e);this.quickClicks(k);if(!h){j.val("")}if("undefined"==typeof(g)){j.focus()}return false},getCloud:function(f,e){d.post(ajaxurl,{action:"get-tagcloud",tax:e},function(h,g){if(0===h||"success"!=g){h=wpAjax.broken}h=d('<p id="tagcloud-'+e+'" class="the-tagcloud">'+h+"</p>");d("a",h).click(function(){mlaModal.tagBox.flushTags(d(this).closest(".mla-taxonomy-field").children(".tagsdiv"),this);return false});d("#"+f).after(h)})},init:function(i,e,g){var h,f;h=d("#mla-taxonomy-"+e,g);f=d("div.ajaxtag",h);mlaModal.tagBox.quickClicks(h);d("input.tagadd",f).click(function(){mlaModal.tagBox.flushTags(d(this).closest(".tagsdiv"))});d("input.newtag",f).keyup(function(j){if(13==j.which){mlaModal.tagBox.flushTags(h);return false}}).keypress(function(j){if(13==j.which){j.preventDefault();return false}}).each(function(){d(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+e,{delay:500,resultsClass:"mla_ac_results",selectClass:"mla_ac_over",matchClass:"mla_ac_match",minchars:2,multiple:true,multipleSep:mlaModal.settings.comma+" "})});h.siblings(":first").click(function(){mlaModal.tagBox.getCloud(d("a",this).attr("id"),e);d("a",this).unbind().click(function(){d(this).siblings(".the-tagcloud").toggle();return false});return false});d(".compat-field-"+e+" td",g).on("mouseleave",function(){var m,k=this,j=mlaModal.utility.arrayCleanup(d(".server-tags",k).val()),l=mlaModal.utility.arrayCleanup(d(".the-tags",k).val());if(j===l){return}d(k).css("opacity","0.5");m={id:i};m[e]=l;wp.media.post(mlaModal.settings.ajaxUpdateCompatAction,m).done(function(o){var p,n,q;for(n in o){if("object"===typeof(o[n]["object-terms"])){if(null!==mlaModal.utility.mlaAttachmentsBrowser){mlaModal.utility.mlaAttachmentsBrowser.updateFilters(n,o[n]["object-terms"])}delete o[n]["object-terms"]}for(q in o[n]){d("#"+q,k).replaceWith(o[n][q])}p=d("#mla-taxonomy-"+n,k);mlaModal.tagBox.quickClicks(p)}d(k).css("opacity","1.0")})});h.on("change",function(j){j.stopPropagation();return false});d(".the-tags, .server-tags .newtag",h).on("change",function(j){j.stopPropagation();return false})}};if(mlaModal.settings.enableDetailsCategory||mlaModal.settings.enableDetailsTag){wp.media.view.AttachmentCompat=wp.media.view.AttachmentCompat.extend({initialize:function(){b.prototype.initialize.apply(this,arguments);this.on("ready",function(){mlaModal.utility.hookCompatTaxonomies(this.model.get("id"),this.el)})}})}if(mlaModal.settings.enableDetailsCategory||mlaModal.settings.enableDetailsTag){wp.media.model.Selection=wp.media.model.Selection.extend({initialize:function(){a.prototype.initialize.apply(this,arguments);this.on("selection:reset",function(){mlaModal.cid=null});this.on("selection:unsingle",function(){mlaModal.cid=null});this.on("selection:single",function(e){mlaModal.cid=e.cid});this.on("change:uploading",function(){mlaModal.uploading=true});this.on("change",function(e){var f=false,g;if(mlaModal.uploading&&mlaModal.cid===e.cid){mlaModal.uploading=false;f=true}else{if(false===e.attributes.uploading){g=_.clone(e.changed);delete g.title;delete g.caption;delete g.alt;delete g.description;if(!_.isEmpty(g)){f=true}}}if(true===f){mlaModal.utility.hookCompatTaxonomies(e.get("id"),mlaModal.settings.$el)}})}})}mlaModal.utility.hookCompatTaxonomies=function(h,f){var e,g=null;d(".mla-taxonomy-field .categorydiv",f).each(function(){e=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));if(-1!=mlaModal.settings.enhancedTaxonomies.indexOf(e)){d(".compat-field-"+e+" th",f).click({id:h,currentTaxonomy:e,el:f},function(i){mlaModal.utility.fillCompatTaxonomies(i.data)});d("tr.compat-field-"+e,f).each(function(){if(d(this).hasClass("mla-taxonomy-row")){d(this).show()}else{d(this).remove()}});if(null===g){g=e}}else{d("tr.compat-field-"+e,f).each(function(){if(d(this).hasClass("mla-taxonomy-row")){d(this).remove()}})}});d(".mla-taxonomy-field .tagsdiv",f).each(function(){e=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));if(-1!=mlaModal.settings.enhancedTaxonomies.indexOf(e)){d(".compat-field-"+e+" th",f).click({id:h,currentTaxonomy:e,el:f},function(i){mlaModal.utility.fillCompatTaxonomies(i.data)});d("tr.compat-field-"+e,f).each(function(){if(d(this).hasClass("mla-taxonomy-row")){d(this).show()}else{d(this).remove()}});if(null===g){g=e}}else{d("tr.compat-field-"+e,f).each(function(){if(d(this).hasClass("mla-taxonomy-row")){d(this).remove()}})}});if(mlaModal.settings.enableTermsAutofill&&null!==g){d(".compat-field-"+g+" th",f).click()}};mlaModal.utility.fillCompatTaxonomies=function(i){var f=i.el,h=[],e,g;d(".mla-taxonomy-field .categorydiv",f).each(function(){e=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));h[h.length]=e;g=".compat-field-"+e;if("undefined"===typeof(mlaModal.initialHTML[e])){mlaModal.initialHTML[e]=d(g,f).html()}else{d(g,f).html(mlaModal.initialHTML[e])}d(g+" .categorydiv",f).html(mlaModal.strings.loadingText)});d(".mla-taxonomy-field .tagsdiv",f).each(function(){e=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));h[h.length]=e;g=".compat-field-"+e;if("undefined"===typeof(mlaModal.initialHTML[e])){mlaModal.initialHTML[e]=d(g,f).html()}else{d(g,f).html(mlaModal.initialHTML[e])}d(g+" .tagsdiv",f).html(mlaModal.strings.loadingText)});if(h.length){wp.media.post(mlaModal.settings.ajaxFillCompatAction,{id:i.id,query:h}).done(function(k){var j,l;for(j in k){l=".compat-field-"+j;d(l,f).html(k[j])}mlaModal.utility.supportCompatTaxonomies(i);d(".compat-field-"+i.currentTaxonomy+" td",f).show()})}};mlaModal.utility.supportCompatTaxonomies=function(g){var f=g.id,e=g.el;if(mlaModal.settings.enableDetailsCategory){d(".mla-taxonomy-field .categorydiv",e).each(function(){var j=d(this),h,k,i,n,l,p,o,m;i=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));n=i+"_tab";l="#mla-"+i;p="#mla-new-"+i;o="#mla-search-"+i;m="#mla-attachments-"+f+"-"+i;if(i=="category"){n="cats"}j.find(".category-tabs").show();d(".compat-field-"+i+" th",e).click(function(){d(this).siblings("td").slideToggle()});j.on("mouseleave",function(){var t,q,s=[],r=j.find(l+"-checklist input:checked");r.each(function(){s[s.length]=d(this).val()});s.sort(function(v,u){return v-u});s=s.join(",");q=j.siblings(m).val();if(q===s){return}j.siblings(m).val(s);j.prop("disabled",true);t={id:f};t[i]=s;wp.media.post(mlaModal.settings.ajaxUpdateCompatAction,t).done(function(v){var u,w;for(u in v){for(w in v[u]){j.find("#"+w).html(v[u][w])}}j.find(o).val("");j.find(l+"-searcher").addClass("mla-hidden-children");j.prop("disabled",false)})});j.on('change input[type="checkbox"]',function(q){q.stopPropagation();return false});j.find(l+"-tabs a").click(function(){var q=d(this).attr("href");d(this).parent().addClass("tabs").siblings("li").removeClass("tabs");j.find(l+"-tabs").siblings(".tabs-panel").hide();j.find(q).show();d(this).focus();if("#mla-"+i+"-all"==q){deleteUserSetting(n)}else{setUserSetting(n,"pop")}return false});if(getUserSetting(n)){j.find(l+'-tabs a[href="#mla-'+i+'-pop"]').click()}j.find(l+"-add-toggle").click(function(){j.find(l+"-searcher").addClass("mla-hidden-children");j.find(l+"-adder").toggleClass("mla-hidden-children");j.find(l+'-tabs a[href="#mla-'+i+'-all"]').click();j.find(l+"-checklist li").show();j.find(l+"-checklist-pop li").show();if(false===j.find(l+"-adder").hasClass("mla-hidden-children")){j.find(p).val("").removeClass("form-input-tip");j.find(p).focus()}return false});j.find(p).keypress(function(q){if(13===q.keyCode){q.preventDefault();j.find(l+"-add-submit").click()}});j.find(l+"-add-submit").click(function(){j.find(p).focus()});h=function(q){if(!j.find(p).val()){return false}q.data+="&"+j.find(l+"-checklist :checked").serialize();j.prop("disabled",true);return q};k=function(v,u){var t,q=j.find("#new"+i+"_parent");j.prop("disabled",false);if("undefined"!=u.parsed.responses[0]&&(t=u.parsed.responses[0].supplemental.newcat_parent)){q.before(t);q.remove();if(null!==mlaModal.utility.mlaAttachmentsBrowser){mlaModal.utility.mlaAttachmentsBrowser.updateFilters(i,t)}}};j.find(l+"-checklist").wpList({alt:"",response:"mla-"+i+"-ajax-response",addBefore:h,addAfter:k});j.find(l+"-checklist, "+l+"-checklist-pop").on("click",'li.popular-category > label input[type="checkbox"]',function(){var q=d(this),s=q.is(":checked"),r=q.val();if(r&&q.parents("#mla-taxonomy-"+i).length){d("#in-"+i+"-"+r+", #in-popular-"+i+"-"+r).prop("checked",s)}});d.extend(d.expr[":"],{matchTerms:function(s,r,q,t){return(s.textContent||s.innerText||"").toLowerCase().indexOf((q[3]||"").toLowerCase())>=0}});j.find(o).keypress(function(q){if(13===q.keyCode){q.preventDefault();j.find(o).val("");j.find(l+"-searcher").addClass("mla-hidden-children");j.find(l+"-checklist li").show();j.find(l+"-checklist-pop li").show();return}});j.find(o).keyup(function(s){var u,t,v,r,q;if(13===s.keyCode){s.preventDefault();j.find(l+"-search-toggle").focus();return}u=j.find(o).val();t=j.find(l+"-checklist li");v=j.find(l+"-checklist-pop li");if(0<u.length){t.hide();v.hide()}else{t.show();v.show()}r=j.find(l+"-checklist label:matchTerms('"+u+"')");r.closest("li").find("li").andSelf().show();r.parents(l+"-checklist li").show();q=j.find(l+"-checklist-pop label:matchTerms('"+u+"')");q.closest("li").find("li").andSelf().show();q.parents(l+"-checklist li").show()});j.find(l+"-search-toggle").click(function(){j.find(l+"-adder ").addClass("mla-hidden-children");j.find(l+"-searcher").toggleClass("mla-hidden-children");j.find(l+'-tabs a[href="#mla-'+i+'-all"]').click();j.find(l+"-checklist li").show();j.find(l+"-checklist-pop li").show();if(false===j.find(l+"-searcher").hasClass("mla-hidden-children")){j.find(o).val("").removeClass("form-input-tip");j.find(o).focus()}return false})})}if(mlaModal.settings.enableDetailsTag){d(".mla-taxonomy-field .tagsdiv",e).each(function(){var h=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));d(".compat-field-"+h+" th",e).click(function(){d(this).siblings("td").slideToggle()});mlaModal.tagBox.init(f,h,e)})}}}(jQuery));
|
1 |
+
var wp,wpAjax,ajaxurl,jQuery,_,getUserSetting,setUserSetting,deleteUserSetting,mlaTaxonomy,mlaModal={strings:{},settings:{},initialHTML:{},uploading:false,cid:null,utility:{originalMediaAjax:null,mlaAttachmentsBrowser:null,parseTermsOptions:null,arrayCleanup:null,parseTaxonomyId:null,hookCompatTaxonomies:null,fillCompatTaxonomies:null,supportCompatTaxonomies:null},tagBox:null};(function(d){var c=wp.media.view.AttachmentsBrowser,b=wp.media.view.AttachmentCompat,a=wp.media.model.Selection;mlaModal.strings=typeof wp.media.view.l10n.mla_strings==="undefined"?{}:wp.media.view.l10n.mla_strings;delete wp.media.view.l10n.mla_strings;mlaModal.settings=typeof wp.media.view.settings.mla_settings==="undefined"?{screen:"unknown",enableMediaGrid:false,enableMediaModal:false}:wp.media.view.settings.mla_settings;delete wp.media.view.settings.mla_settings;if(!(mlaModal.settings.enableMediaGrid||mlaModal.settings.enableMediaModal)){return}if(("grid"===mlaModal.settings.screen)&&false===mlaModal.settings.enableMediaGrid){return}if(("modal"===mlaModal.settings.screen)&&false===mlaModal.settings.enableMediaModal){return}mlaModal.settings.pagenow=typeof pagenow==="undefined"?"unknown":pagenow;if(mlaModal.settings.pagenow==="toolset_page_views-editor"){return}mlaModal.utility.originalMediaAjax=wp.media.ajax;wp.media.ajax=function(k,g){var j=mlaModal.settings.state,i,f,h,e;if(_.isObject(k)){g=k}else{g=g||{};g.data=_.extend(g.data||{},{action:k})}if("query-attachments"==g.data.action){i=g.data.query;f=typeof i.s;if("object"==f){h=i.s}else{if("string"==f){h={mla_search_value:i.s}}else{h={mla_search_value:""}}}if("undefined"!=typeof i.post_mime_type){mlaModal.settings.query[j].filterMime=i.post_mime_type}else{mlaModal.settings.query[j].filterMime="all"}if("undefined"!=typeof h.mla_filter_month){mlaModal.settings.query[j].filterMonth=h.mla_filter_month}else{if("undefined"!=typeof i.year){mlaModal.settings.query[j].filterMonth=(100*i.year)+(1*i.monthnum)}else{}}if("undefined"!=typeof h.mla_filter_term){mlaModal.settings.query[j].filterTerm=h.mla_filter_term}if("undefined"!=typeof h.mla_search_value){mlaModal.settings.query[j].searchValue=h.mla_search_value}e={mla_filter_month:mlaModal.settings.query[j].filterMonth,mla_filter_term:mlaModal.settings.query[j].filterTerm,mla_terms_search:mlaModal.settings.query[j].termsSearch,mla_search_clicks:mlaModal.settings.query[j].searchClicks,mla_search_value:mlaModal.settings.query[j].searchValue,mla_search_fields:mlaModal.settings.query[j].searchFields,mla_search_connector:mlaModal.settings.query[j].searchConnector};mlaModal.settings.query[j].termsSearch="";d("#mla-terms-search-input").html("").val("");g.data.query.s=e}return mlaModal.utility.originalMediaAjax.call(this,g)};if(mlaModal.settings.enableMimeTypes){wp.media.view.AttachmentFilters.Mla=wp.media.view.AttachmentFilters.extend({createFilters:function(){var f=this.controller._state,e={};_.each(mlaModal.settings.allMimeTypes||{},function(h,g){if(("grid"===mlaModal.settings.screen)||("trash"!==g)){e[g]={text:h,props:{type:g,uploadedTo:null,orderby:"date",order:"DESC"}}}});e.all={text:wp.media.view.l10n.allMediaItems,props:{type:null,uploadedTo:null,orderby:"date",order:"DESC"},priority:10};if(wp.media.view.settings.post.id){e.uploaded={text:wp.media.view.l10n.uploadedToThisPost,props:{type:null,uploadedTo:wp.media.view.settings.post.id,orderby:"menuOrder",order:"ASC"},priority:20}}this.filters=e;if("undefined"===typeof e[mlaModal.settings.query[f].filterMime]){mlaModal.settings.query[f].filterMime="all"}if(mlaModal.settings.query[f].filterMime!="all"){this.model.set(e[mlaModal.settings.query[f].filterMime].props,{silent:false})}},select:function(){var h=this.controller._state,e=this.model,g=mlaModal.settings.query[h].filterMime,f=e.toJSON();if(false===mlaModal.settings.enableSearchBox){if("string"==typeof f.search){mlaModal.settings.query[h].searchValue=f.search}else{mlaModal.settings.query[h].searchValue=""}}_.find(this.filters,function(j,k){var i=_.all(j.props,function(m,l){return m===(_.isUndefined(f[l])?null:f[l])});if(i){return g=k}});this.$el.val(g)},change:function(){var f=d(this.el).closest("div.media-toolbar"),e=this.filters[this.el.value];if(e){this.model.set(e.props,{silent:true});d("#mla-search-submit",f).click()}}});wp.media.view.AttachmentFilters.MlaUploaded=wp.media.view.AttachmentFilters.extend({createFilters:function(){var f=this.model.get("type"),e=wp.media.view.settings.mimeTypes,i,h=this.controller._state,g={};if(e&&f){i=e[f]}_.each(mlaModal.settings.uploadMimeTypes||{},function(k,j){if(("grid"===mlaModal.settings.screen)||("trash"!==j)){g[j]={text:k,props:{type:j,uploadedTo:null,orderby:"date",order:"DESC"}}}});g.all={text:i||wp.media.view.l10n.allMediaItems,props:{uploadedTo:null,orderby:"date",order:"DESC"},priority:10};g.uploaded={text:wp.media.view.l10n.uploadedToThisPost,props:{type:null,uploadedTo:wp.media.view.settings.post.id,orderby:"menuOrder",order:"ASC"},priority:20};g.unattached={text:wp.media.view.l10n.unattached,props:{uploadedTo:0,orderby:"menuOrder",order:"ASC"},priority:50};this.filters=g;if("undefined"===typeof g[mlaModal.settings.query[h].filterUploaded]){mlaModal.settings.query[h].filterUploaded="all"}if(mlaModal.settings.query[h].filterUploaded!="all"){this.model.set(g[mlaModal.settings.query[h].filterUploaded].props,{silent:false})}},select:function(){var h=this.controller._state,e=this.model,g=mlaModal.settings.query[h].filterMime,f=e.toJSON();if(false===mlaModal.settings.enableSearchBox){if("string"==typeof f.search){mlaModal.settings.query[h].searchValue=f.search}else{mlaModal.settings.query[h].searchValue=""}}_.find(this.filters,function(j,k){var i=_.all(j.props,function(m,l){return m===(_.isUndefined(f[l])?null:f[l])});if(i){return g=k}});this.$el.val(g)},change:function(){var f=d(this.el).closest("div.media-toolbar"),e=this.filters[this.el.value];if(e){this.model.set(e.props,{silent:true});d("#mla-search-submit",f).click()}}})}if(mlaModal.settings.enableMonthsDropdown){wp.media.view.AttachmentFilters.MlaMonths=wp.media.view.AttachmentFilters.extend({className:"attachment-filters",id:"media-attachment-date-filters",createFilters:function(){var f=this.controller._state,e={};_.each(mlaModal.settings.months||{},function(h,g){e[g]={text:h,props:{s:{mla_filter_month:g}}}});this.filters=e;if("undefined"===typeof e[mlaModal.settings.query[f].filterMonth]){mlaModal.settings.query[f].filterMonth=0}if(mlaModal.settings.query[f].filterMonth>0){this.model.set(e[mlaModal.settings.query[f].filterMonth].props,{silent:false})}},select:function(){var h=this.controller._state,e=this.model,g=mlaModal.settings.query[h].filterMonth,f=e.toJSON();if(_.isUndefined(f.s)){f.s={}}if(false===mlaModal.settings.enableSearchBox){if("string"==typeof f.search){mlaModal.settings.query[h].searchValue=f.search}else{mlaModal.settings.query[h].searchValue=""}}if(_.isUndefined(f.s.mla_filter_month)){f.s.mla_filter_month=mlaModal.settings.query[h].filterMonth}else{mlaModal.settings.query[h].filterMonth=f.s.mla_filter_month}_.find(this.filters,function(j,k){var i=_.all(j.props,function(l){return l.mla_filter_month==mlaModal.settings.query[h].filterMonth});if(i){return g=k}});this.$el.val(g)},change:function(){var e=this.filters[this.el.value],f;if(e){f={s:{mla_filter_month:e.props.s.mla_filter_month}};this.model.set(f)}}})}if(mlaModal.settings.enableTermsDropdown){wp.media.view.AttachmentFilters.MlaTerms=wp.media.view.AttachmentFilters.extend({className:"attachment-filters",id:"media-attachment-term-filters",createFilters:function(){var h=this.controller._state,e,f,g={};_.each(mlaModal.settings.termsText||{},function(j,i){if(mlaModal.settings.termsCustom){f=mlaModal.settings.termsValue[i]}else{f=parseInt(mlaModal.settings.termsValue[i])}g[i]={text:j,props:{s:{mla_filter_term:f}}}});this.filters=g;e=_.indexOf(mlaModal.settings.termsValue,mlaModal.settings.query[h].filterTerm);if(e>0){this.model.set(g[e].props,{silent:false})}},select:function(){var h=this.controller._state,e=this.model,g=mlaModal.settings.query[h].filterTerm,f=e.toJSON();if(_.isUndefined(f.s)){f.s={}}if(false===mlaModal.settings.enableSearchBox){if("string"==typeof f.search){mlaModal.settings.query[h].searchValue=f.search}else{mlaModal.settings.query[h].searchValue=""}}if(_.isUndefined(f.s.mla_filter_term)){f.s.mla_filter_term=mlaModal.settings.query[h].filterTerm}else{mlaModal.settings.query[h].filterTerm=f.s.mla_filter_term}_.find(this.filters,function(j,k){var i=_.all(j.props,function(l){return l.mla_filter_term==mlaModal.settings.query[h].filterTerm});if(i){return g=k}});this.$el.val(g)},change:function(){var e=this.filters[this.el.value],f;if(e){f={s:{mla_filter_term:e.props.s.mla_filter_term}};this.model.set(f)}}})}if(mlaModal.settings.enableTermsSearch){wp.media.view.MlaTermsSearch=wp.media.View.extend({tagName:"span",className:"mla-terms-search",template:wp.media.template("mla-terms-search-button"),attributes:{type:"mla-terms-search-button"},events:{change:"termsSearchOpen",click:"termsSearchOpen"},render:function(){this.$el.html(this.template(mlaModal.strings));return this},termsSearchOpen:function(f){var e=d(this.el).closest("div.media-toolbar");if(("click"==f.type)&&("mla_terms_search"===f.target.name)){mlaTaxonomy.termsSearch.open();d("#mla-terms-search-form").off("submit");d("#mla-terms-search-form").submit(function(j){var g,i,h={phrases:"",taxonomies:[]};j.preventDefault();g=d("#mla-terms-search-form").serializeArray();for(i=0;i<g.length;i++){switch(g[i].name){case"mla_terms_search[phrases]":h.phrases=g[i].value;break;case"mla_terms_search[radio_phrases]":h.radio_phrases=g[i].value;break;case"mla_terms_search[radio_terms]":h.radio_terms=g[i].value;break;case"mla_terms_search[taxonomies][]":h.taxonomies[h.taxonomies.length]=g[i].value;break}}mlaModal.settings.query[mlaModal.settings.state].termsSearch=h;d("#mla-search-submit",e).click();return false});d("#mla-terms-search-input").keypress(function(g){if(13==g.which){g.preventDefault();d("#mla-terms-search-submit").click()}})}}})}if(mlaModal.settings.enableSearchBox){wp.media.view.MlaSearch=wp.media.View.extend({tagName:"div",className:"mla-search-box",template:wp.media.template("mla-search-box"),attributes:{type:"mla-search-box"},events:{input:"search",change:"search",click:"search",search:"search",MlaSearch:"search"},initialize:function(){var e=this.controller._state;if("undefined"===typeof mlaModal.settings.query[e]){mlaModal.settings.query[e]=_.clone(mlaModal.settings.query.initial);mlaModal.settings.query[e].searchFields=_.clone(mlaModal.settings.query.initial.searchFields)}},render:function(){var f=this.controller._state,e=_.extend(mlaModal.strings,mlaModal.settings.query[f]);this.$el.html(this.template(e));return this},search:function(g){var h=this.controller._state,e,i,f;if(("input"==g.type)&&("s[mla_search_value]"==g.target.name)){mlaModal.settings.query[h].searchValue=g.target.value;return}if(("click"==g.type)&&("mla_search_submit"!=g.target.name)){return}switch(g.target.name){case"s[mla_search_value]":mlaModal.settings.query[h].searchValue=g.target.value;break;case"mla_search_submit":e={mla_filter_month:mlaModal.settings.query[h].filterMonth,mla_filter_term:mlaModal.settings.query[h].filterTerm,mla_terms_search:mlaModal.settings.query[h].termsSearch,mla_search_clicks:mlaModal.settings.query[h].searchClicks++,mla_search_value:mlaModal.settings.query[h].searchValue,mla_search_fields:mlaModal.settings.query[h].searchFields,mla_search_connector:mlaModal.settings.query[h].searchConnector};this.model.set({s:e});break;case"s[mla_search_connector]":mlaModal.settings.query[h].searchConnector=g.target.value;break;case"s[mla_search_title]":i=mlaModal.settings.query[h].searchFields;f=i.indexOf("title");if(-1==f){i.push("title")}else{i.splice(f,1)}mlaModal.settings.query[h].searchFields=i;break;case"s[mla_search_name]":f=mlaModal.settings.query[h].searchFields.indexOf("name");if(-1==f){mlaModal.settings.query[h].searchFields.push("name")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_alt_text]":f=mlaModal.settings.query[h].searchFields.indexOf("alt-text");if(-1==f){mlaModal.settings.query[h].searchFields.push("alt-text")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_excerpt]":f=mlaModal.settings.query[h].searchFields.indexOf("excerpt");if(-1==f){mlaModal.settings.query[h].searchFields.push("excerpt")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_content]":f=mlaModal.settings.query[h].searchFields.indexOf("content");if(-1==f){mlaModal.settings.query[h].searchFields.push("content")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_file]":f=mlaModal.settings.query[h].searchFields.indexOf("file");if(-1==f){mlaModal.settings.query[h].searchFields.push("file")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break;case"s[mla_search_terms]":f=mlaModal.settings.query[h].searchFields.indexOf("terms");if(-1==f){mlaModal.settings.query[h].searchFields.push("terms")}else{mlaModal.settings.query[h].searchFields.splice(f,1)}break}}})}else{wp.media.view.MlaSearch=wp.media.View.extend({tagName:"span",className:"mla-simulate-search-button",template:wp.media.template("mla-simulate-search-button"),attributes:{type:"mla-simulate-search-button"},events:{click:"simulateSearch"},render:function(){this.$el.html(this.template(mlaModal.strings));return this},simulateSearch:function(){var f=this.controller._state,e={mla_filter_month:mlaModal.settings.query[f].filterMonth,mla_filter_term:mlaModal.settings.query[f].filterTerm,mla_terms_search:mlaModal.settings.query[f].termsSearch,mla_search_clicks:mlaModal.settings.query[f].searchClicks++,mla_search_value:mlaModal.settings.query[f].searchValue,mla_search_fields:mlaModal.settings.query[f].searchFields,mla_search_connector:mlaModal.settings.query[f].searchConnector};this.model.set({s:e})}})}if(mlaModal.settings.enableMimeTypes||mlaModal.settings.enableMonthsDropdown||mlaModal.settings.enableTermsDropdown||mlaModal.settings.enableTermsSearch||mlaModal.settings.enableSearchBox){wp.media.view.AttachmentsBrowser=wp.media.view.AttachmentsBrowser.extend({createToolbar:function(){var e,f=this.controller._state;mlaModal.settings.state=f;mlaModal.settings.$el=this.controller.$el;if("undefined"===typeof mlaModal.settings.query[f]){mlaModal.settings.query[f]=_.clone(mlaModal.settings.query.initial);mlaModal.settings.query[f].searchFields=_.clone(mlaModal.settings.query.initial.searchFields)}c.prototype.createToolbar.apply(this,arguments);mlaModal.utility.mlaAttachmentsBrowser=this;e=this.options.filters;if(typeof window.eml!=="undefined"){d(".media-toolbar",this.$el).css("overflow","hidden")}if(("all"===e)&&mlaModal.settings.enableMimeTypes){this.toolbar.unset("filters",{silent:true});this.toolbar.set("filters",new wp.media.view.AttachmentFilters.Mla({controller:this.controller,model:this.collection.props,priority:-80}).render())}if(("uploaded"===e)&&mlaModal.settings.enableMimeTypes){this.toolbar.unset("filters",{silent:true});this.toolbar.set("filters",new wp.media.view.AttachmentFilters.MlaUploaded({controller:this.controller,model:this.collection.props,priority:-80}).render())}if(this.options.search&&mlaModal.settings.enableMonthsDropdown){this.toolbar.unset("dateFilter",{silent:true});this.toolbar.set("dateFilter",new wp.media.view.AttachmentFilters.MlaMonths({controller:this.controller,model:this.collection.props,priority:-75}).render())}if(this.options.search&&mlaModal.settings.enableTermsDropdown){this.toolbar.set("terms",new wp.media.view.AttachmentFilters.MlaTerms({controller:this.controller,model:this.collection.props,priority:-50}).render())}if(this.options.search&&mlaModal.settings.enableTermsSearch){this.toolbar.set("termsSearch",new wp.media.view.MlaTermsSearch({controller:this.controller,model:this.collection.props,priority:-50}).render())}if(this.options.search){if(mlaModal.settings.enableSearchBox){this.controller.on("content:activate",this.hideDefaultSearch);this.controller.on("edit:activate",this.hideDefaultSearch);this.controller.on("router:render",this.hideDefaultSearch);this.controller.on("uploader:ready",this.hideDefaultSearch);this.toolbar.set("MlaSearch",new wp.media.view.MlaSearch({controller:this.controller,model:this.collection.props,priority:60}).render())}else{this.toolbar.set("MlaSearch",new wp.media.view.MlaSearch({controller:this.controller,model:this.collection.props,priority:70}).render())}}},hideDefaultSearch:function(){var e=d("#media-search-input",mlaModal.settings.$el),f=d(".media-search-input-label",mlaModal.settings.$el);if(0===e.length){e=d("div.media-toolbar-primary > input.search",mlaModal.settings.$el)}e.hide();f.hide()},updateFilters:function(e,f){var g={};if(this.options.search&&mlaModal.settings.enableTermsDropdown&&mlaModal.settings.termsTaxonomy==e){g=mlaModal.utility.parseTermsOptions(f);mlaModal.settings.termsClass=g.termsClass;mlaModal.settings.termsText=g.termsText;mlaModal.settings.termsValue=g.termsValue;this.toolbar.unset("terms",{silent:true});this.toolbar.set("terms",new wp.media.view.AttachmentFilters.MlaTerms({controller:this.controller,model:this.collection.props,priority:-80}).render())}}})}mlaModal.utility.parseTermsOptions=function(k){var j={termsClass:[mlaModal.settings.termsClass[0],mlaModal.settings.termsClass[1]],termsText:[mlaModal.settings.termsText[0],mlaModal.settings.termsText[1]],termsValue:[mlaModal.settings.termsValue[0],mlaModal.settings.termsValue[1]]},g=2,e,f,i=/\<option(( class=\"([^\"]+)\" )|( ))value=((\'([^\']+)\')|(\"([^\"]+)\"))([^\>]*)\>([^\<]*)\<.*/g,h=[];if("object"===typeof k){g=mlaModal.settings.termsValue.length;for(e=2;e<g;e++){h[e]={termsClass:mlaModal.settings.termsClass[e],termsText:mlaModal.settings.termsText[e],termsValue:mlaModal.settings.termsValue[e]};if("undefined"!==typeof k[mlaModal.settings.termsValue[e]]){delete k[mlaModal.settings.termsValue[e]]}}for(f in k){h[e++]={termsClass:"level-0",termsText:k[f],termsValue:f.toString()}}if(g===e){return{termsClass:mlaModal.settings.termsClass,termsText:mlaModal.settings.termsText,termsValue:mlaModal.settings.termsValue}}h.sort(function(m,l){if(m.termsText>l.termsText){return 1}else{if(m.termsText<l.termsText){return -1}else{return 0}}});e=2;for(f in h){j.termsClass[e]=h[f].termsClass;j.termsText[e]=h[f].termsText;j.termsValue[e++]=h[f].termsValue}return j}h=i.exec(k);while(null!==(h=i.exec(k))){j.termsClass[g]=h[3];j.termsValue[g]=("undefined"===typeof h[6])?h[9]:h[7];j.termsText[g++]=h[11].replace(" ",mlaModal.settings.termsIndent)}return j};mlaModal.utility.arrayCleanup=function(g){var f=[],e=("string"===typeof g);if(e){g=g.split(mlaModal.settings.comma)}jQuery.each(g,function(h,i){i=jQuery.trim(i);if(i&&jQuery.inArray(i,f)==-1){f.push(i)}});f.sort();if(e){f=f.join(mlaModal.settings.comma)}return f};mlaModal.utility.parseTaxonomyId=function(f){var e=f.split("-");e.shift();e.shift();return e.join("-")};mlaModal.tagBox={cleanTags:function(f){var e=mlaModal.settings.comma;if(","!==e){f=f.replace(new RegExp(e,"g"),",")}f=f.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"");if(","!==e){f=f.replace(/,/g,e)}return f},parseTags:function(h){var l=h.id,f=l.split("-check-num-")[1],i=d(h).closest(".tagsdiv"),k=i.find(".the-tags"),e=mlaModal.settings.comma,g=k.val().split(e),j=[];delete g[f];d.each(g,function(m,n){n=d.trim(n);if(n){j.push(n)}});k.val(this.cleanTags(j.join(e)));this.quickClicks(i);return false},quickClicks:function(g){var j=d(".the-tags",g),h=d(".tagchecklist",g),i=d(g).attr("id"),e,f;if(!j.length){return}f=j.prop("disabled");e=j.val().split(mlaModal.settings.comma);h.empty();d.each(e,function(m,n){var l,k;n=d.trim(n);if(!n){return}if(mlaModal.settings.generateTagUl){l=d("<li />").text(n)}else{l=d("<span />").text(n)}if(!f){if(mlaModal.settings.generateTagButtons){k=d('<button class="ntdelbutton" id="'+i+"-check-num-"+m+'" type="button"><span class="remove-tag-icon" aria-hidden="true"></span><span class="screen-reader-text">'+mlaModal.settings.removeTerm+": "+n+"</span></button>")}else{k=d('<a id="'+i+"-check-num-"+m+'" class="ntdelbutton">X</a>')}k.click(function(){mlaModal.tagBox.parseTags(this)});l.prepend(" ").prepend(k)}h.append(l)})},flushTags:function(k,h,g){var m,e,i,n=d(".the-tags",k),j=d("input.newtag",k),l=mlaModal.settings.comma;h=h||false;i=h?d(h).text():j.val();m=n.val();e=m?m+l+i:i;e=mlaModal.utility.arrayCleanup(this.cleanTags(e));n.val(e);this.quickClicks(k);if(!h){j.val("")}if("undefined"==typeof(g)){j.focus()}return false},getCloud:function(f,e){d.post(ajaxurl,{action:"get-tagcloud",tax:e},function(h,g){if(0===h||"success"!=g){h=wpAjax.broken}h=d('<p id="tagcloud-'+e+'" class="the-tagcloud">'+h+"</p>");d("a",h).click(function(){mlaModal.tagBox.flushTags(d(this).closest(".mla-taxonomy-field").children(".tagsdiv"),this);return false});d("#"+f).after(h)})},init:function(i,e,g){var h,f;h=d("#mla-taxonomy-"+e,g);f=d("div.ajaxtag",h);mlaModal.tagBox.quickClicks(h);d("input.tagadd",f).click(function(){mlaModal.tagBox.flushTags(d(this).closest(".tagsdiv"))});d("input.newtag",f).keyup(function(j){if(13==j.which){mlaModal.tagBox.flushTags(h);return false}}).keypress(function(j){if(13==j.which){j.preventDefault();return false}}).each(function(){d(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+e,{delay:500,resultsClass:"mla_ac_results",selectClass:"mla_ac_over",matchClass:"mla_ac_match",minchars:2,multiple:true,multipleSep:mlaModal.settings.comma+" "})});h.siblings(":first").click(function(){mlaModal.tagBox.getCloud(d("a",this).attr("id"),e);d("a",this).unbind().click(function(){d(this).siblings(".the-tagcloud").toggle();return false});return false});d(".compat-field-"+e+" td",g).on("mouseleave",function(){var m,k=this,j=mlaModal.utility.arrayCleanup(d(".server-tags",k).val()),l=mlaModal.utility.arrayCleanup(d(".the-tags",k).val());if(j===l){return}d(k).css("opacity","0.5");m={id:i};m[e]=l;wp.media.post(mlaModal.settings.ajaxUpdateCompatAction,m).done(function(o){var p,n,q;for(n in o){if("object"===typeof(o[n]["object-terms"])){if(null!==mlaModal.utility.mlaAttachmentsBrowser){mlaModal.utility.mlaAttachmentsBrowser.updateFilters(n,o[n]["object-terms"])}delete o[n]["object-terms"]}for(q in o[n]){d("#"+q,k).replaceWith(o[n][q])}p=d("#mla-taxonomy-"+n,k);mlaModal.tagBox.quickClicks(p)}d(k).css("opacity","1.0")})});h.on("change",function(j){j.stopPropagation();return false});d(".the-tags, .server-tags .newtag",h).on("change",function(j){j.stopPropagation();return false})}};if(mlaModal.settings.enableDetailsCategory||mlaModal.settings.enableDetailsTag){wp.media.view.AttachmentCompat=wp.media.view.AttachmentCompat.extend({initialize:function(){b.prototype.initialize.apply(this,arguments);this.on("ready",function(){mlaModal.utility.hookCompatTaxonomies(this.model.get("id"),this.el)})}})}if(mlaModal.settings.enableDetailsCategory||mlaModal.settings.enableDetailsTag){wp.media.model.Selection=wp.media.model.Selection.extend({initialize:function(){a.prototype.initialize.apply(this,arguments);this.on("selection:reset",function(){mlaModal.cid=null});this.on("selection:unsingle",function(){mlaModal.cid=null});this.on("selection:single",function(e){mlaModal.cid=e.cid});this.on("change:uploading",function(){mlaModal.uploading=true});this.on("change",function(e){var f=false,g;if(mlaModal.uploading&&mlaModal.cid===e.cid){mlaModal.uploading=false;f=true}else{if(false===e.attributes.uploading){g=_.clone(e.changed);delete g.title;delete g.caption;delete g.alt;delete g.description;if(!_.isEmpty(g)){f=true}}}if(true===f){mlaModal.utility.hookCompatTaxonomies(e.get("id"),mlaModal.settings.$el)}})}})}mlaModal.utility.hookCompatTaxonomies=function(h,f){var e,g=null;d(".mla-taxonomy-field .categorydiv",f).each(function(){e=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));if(-1!=mlaModal.settings.enhancedTaxonomies.indexOf(e)){d(".compat-field-"+e+" th",f).click({id:h,currentTaxonomy:e,el:f},function(i){mlaModal.utility.fillCompatTaxonomies(i.data)});d("tr.compat-field-"+e,f).each(function(){if(d(this).hasClass("mla-taxonomy-row")){d(this).show()}else{d(this).remove()}});if(null===g){g=e}}else{d("tr.compat-field-"+e,f).each(function(){if(d(this).hasClass("mla-taxonomy-row")){d(this).remove()}})}});d(".mla-taxonomy-field .tagsdiv",f).each(function(){e=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));if(-1!=mlaModal.settings.enhancedTaxonomies.indexOf(e)){d(".compat-field-"+e+" th",f).click({id:h,currentTaxonomy:e,el:f},function(i){mlaModal.utility.fillCompatTaxonomies(i.data)});d("tr.compat-field-"+e,f).each(function(){if(d(this).hasClass("mla-taxonomy-row")){d(this).show()}else{d(this).remove()}});if(null===g){g=e}}else{d("tr.compat-field-"+e,f).each(function(){if(d(this).hasClass("mla-taxonomy-row")){d(this).remove()}})}});if(mlaModal.settings.enableTermsAutofill&&null!==g){d(".compat-field-"+g+" th",f).click()}};mlaModal.utility.fillCompatTaxonomies=function(i){var f=i.el,h=[],e,g;d(".mla-taxonomy-field .categorydiv",f).each(function(){e=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));h[h.length]=e;g=".compat-field-"+e;if("undefined"===typeof(mlaModal.initialHTML[e])){mlaModal.initialHTML[e]=d(g,f).html()}else{d(g,f).html(mlaModal.initialHTML[e])}d(g+" .categorydiv",f).html(mlaModal.strings.loadingText)});d(".mla-taxonomy-field .tagsdiv",f).each(function(){e=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));h[h.length]=e;g=".compat-field-"+e;if("undefined"===typeof(mlaModal.initialHTML[e])){mlaModal.initialHTML[e]=d(g,f).html()}else{d(g,f).html(mlaModal.initialHTML[e])}d(g+" .tagsdiv",f).html(mlaModal.strings.loadingText)});if(h.length){wp.media.post(mlaModal.settings.ajaxFillCompatAction,{id:i.id,query:h}).done(function(k){var j,l;for(j in k){l=".compat-field-"+j;d(l,f).html(k[j])}mlaModal.utility.supportCompatTaxonomies(i);d(".compat-field-"+i.currentTaxonomy+" td",f).show()})}};mlaModal.utility.supportCompatTaxonomies=function(g){var f=g.id,e=g.el;if(mlaModal.settings.enableDetailsCategory){d(".mla-taxonomy-field .categorydiv",e).each(function(){var j=d(this),h,k,i,n,l,p,o,m;i=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));n=i+"_tab";l="#mla-"+i;p="#mla-new-"+i;o="#mla-search-"+i;m="#mla-attachments-"+f+"-"+i;if(i=="category"){n="cats"}j.find(".category-tabs").show();d(".compat-field-"+i+" th",e).click(function(){d(this).siblings("td").slideToggle()});j.on("mouseleave",function(){var t,q,s=[],r=j.find(l+"-checklist input:checked");r.each(function(){s[s.length]=d(this).val()});s.sort(function(v,u){return v-u});s=s.join(",");q=j.siblings(m).val();if(q===s){return}j.siblings(m).val(s);j.prop("disabled",true);t={id:f};t[i]=s;wp.media.post(mlaModal.settings.ajaxUpdateCompatAction,t).done(function(v){var u,w;for(u in v){for(w in v[u]){j.find("#"+w).html(v[u][w])}}j.find(o).val("");j.find(l+"-searcher").addClass("mla-hidden-children");j.prop("disabled",false)})});j.on('change input[type="checkbox"]',function(q){q.stopPropagation();return false});j.find(l+"-tabs a").click(function(){var q=d(this).attr("href");d(this).parent().addClass("tabs").siblings("li").removeClass("tabs");j.find(l+"-tabs").siblings(".tabs-panel").hide();j.find(q).show();d(this).focus();if("#mla-"+i+"-all"==q){deleteUserSetting(n)}else{setUserSetting(n,"pop")}return false});if(getUserSetting(n)){j.find(l+'-tabs a[href="#mla-'+i+'-pop"]').click()}j.find(l+"-add-toggle").click(function(){j.find(l+"-searcher").addClass("mla-hidden-children");j.find(l+"-adder").toggleClass("mla-hidden-children");j.find(l+'-tabs a[href="#mla-'+i+'-all"]').click();j.find(l+"-checklist li").show();j.find(l+"-checklist-pop li").show();if(false===j.find(l+"-adder").hasClass("mla-hidden-children")){j.find(p).val("").removeClass("form-input-tip");j.find(p).focus()}return false});j.find(p).keypress(function(q){if(13===q.keyCode){q.preventDefault();j.find(l+"-add-submit").click()}});j.find(l+"-add-submit").click(function(){j.find(p).focus()});h=function(q){if(!j.find(p).val()){return false}q.data+="&"+j.find(l+"-checklist :checked").serialize();j.prop("disabled",true);return q};k=function(v,u){var t,q=j.find("#new"+i+"_parent");j.prop("disabled",false);if("undefined"!=u.parsed.responses[0]&&(t=u.parsed.responses[0].supplemental.newcat_parent)){q.before(t);q.remove();if(null!==mlaModal.utility.mlaAttachmentsBrowser){mlaModal.utility.mlaAttachmentsBrowser.updateFilters(i,t)}}};j.find(l+"-checklist").wpList({alt:"",response:"mla-"+i+"-ajax-response",addBefore:h,addAfter:k});j.find(l+"-checklist, "+l+"-checklist-pop").on("click",'li.popular-category > label input[type="checkbox"]',function(){var q=d(this),s=q.is(":checked"),r=q.val();if(r&&q.parents("#mla-taxonomy-"+i).length){d("#in-"+i+"-"+r+", #in-popular-"+i+"-"+r).prop("checked",s)}});d.extend(d.expr[":"],{matchTerms:function(s,r,q,t){return(s.textContent||s.innerText||"").toLowerCase().indexOf((q[3]||"").toLowerCase())>=0}});j.find(o).keypress(function(q){if(13===q.keyCode){q.preventDefault();j.find(o).val("");j.find(l+"-searcher").addClass("mla-hidden-children");j.find(l+"-checklist li").show();j.find(l+"-checklist-pop li").show();return}});j.find(o).keyup(function(s){var u,t,v,r,q;if(13===s.keyCode){s.preventDefault();j.find(l+"-search-toggle").focus();return}u=j.find(o).val();t=j.find(l+"-checklist li");v=j.find(l+"-checklist-pop li");if(0<u.length){t.hide();v.hide()}else{t.show();v.show()}r=j.find(l+"-checklist label:matchTerms('"+u+"')");r.closest("li").find("li").andSelf().show();r.parents(l+"-checklist li").show();q=j.find(l+"-checklist-pop label:matchTerms('"+u+"')");q.closest("li").find("li").andSelf().show();q.parents(l+"-checklist li").show()});j.find(l+"-search-toggle").click(function(){j.find(l+"-adder ").addClass("mla-hidden-children");j.find(l+"-searcher").toggleClass("mla-hidden-children");j.find(l+'-tabs a[href="#mla-'+i+'-all"]').click();j.find(l+"-checklist li").show();j.find(l+"-checklist-pop li").show();if(false===j.find(l+"-searcher").hasClass("mla-hidden-children")){j.find(o).val("").removeClass("form-input-tip");j.find(o).focus()}return false})})}if(mlaModal.settings.enableDetailsTag){d(".mla-taxonomy-field .tagsdiv",e).each(function(){var h=mlaModal.utility.parseTaxonomyId(d(this).attr("id"));d(".compat-field-"+h+" th",e).click(function(){d(this).siblings("td").slideToggle()});mlaModal.tagBox.init(f,h,e)})}}}(jQuery));
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: dglingren
|
|
3 |
Donate link: http://davidlingren.com/#two
|
4 |
Tags: attachments, gallery, images, media, media library, tags, categories, IPTC, EXIF, XMP, GPS, PDF, metadata, photos, photographs, photo albums, MIME, mime-type, icon, upload, file extensions, WPML, Polylang
|
5 |
Requires at least: 3.5.0
|
6 |
-
Tested up to: 5.
|
7 |
Requires PHP: 5.3
|
8 |
-
Stable tag: 2.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -181,6 +181,19 @@ All of the MLA source code has been annotated with "DocBlocks", a special type o
|
|
181 |
|
182 |
== Changelog ==
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
= 2.80 =
|
185 |
* New: A new "MLA Phoenix Media Rename Example" plugin has been added to the "Examples" family in the Settings/Media Library Assistant Documentation tab. It adds support for the Phoenix Media Rename plugin's "Filename" column to the Media/Assistant submenu table.
|
186 |
* Fix: For the Media/Assistant admin submenu screen, avoid "headers already sent" error with JoomUnited's WP Media Folders.
|
@@ -315,8 +328,8 @@ All of the MLA source code has been annotated with "DocBlocks", a special type o
|
|
315 |
|
316 |
== Upgrade Notice ==
|
317 |
|
318 |
-
= 2.
|
319 |
-
|
320 |
|
321 |
== Other Notes ==
|
322 |
|
3 |
Donate link: http://davidlingren.com/#two
|
4 |
Tags: attachments, gallery, images, media, media library, tags, categories, IPTC, EXIF, XMP, GPS, PDF, metadata, photos, photographs, photo albums, MIME, mime-type, icon, upload, file extensions, WPML, Polylang
|
5 |
Requires at least: 3.5.0
|
6 |
+
Tested up to: 5.3
|
7 |
Requires PHP: 5.3
|
8 |
+
Stable tag: 2.81
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
181 |
|
182 |
== Changelog ==
|
183 |
|
184 |
+
= 2.81 =
|
185 |
+
* New: For the "Field-level Substitution Parameters", a new "mso:" prefix gives access to the Document Properties embedded in Office Open XML file formats (e.g., docx, xlsx, pptx). More information is given in the "Prefix values" section of the Settings/Media Library Assistant Documentation tab.
|
186 |
+
* New: For the Bulk Edit, a new `[+reverse_index+]` substitution parameter counts down from the number of selected items to one. More informatin is in the Help menu for the Media/Assistant admin screen.
|
187 |
+
* New: For the "WooCommerce Fixit" example plugin, product category thumbnail information is added to the "Woo Used In" Media/Assistant table column.
|
188 |
+
* Fix: IPTC/EXIF and Custom Field mapping logic updated for compatibility with WordPress 5.3.
|
189 |
+
* Fix: Updated Media Manager Modal Window and Media/Library Grid view styles for compatibility with WordPress 5.3.
|
190 |
+
* Fix: For the Settings/Media Library Assistant Example Plugins page, update the `MLA_Upgrader_Skin` code for compatibility with WordPress 5.3.
|
191 |
+
* Fix: For the Settings/Media Library Assistant IPTC/EXIF tab, PHP Notices for invalid taxonomy rules have been resolved.
|
192 |
+
* Fix: For the "replace()" option/format value, empty replacement values are now allowed.
|
193 |
+
* Fix: For custom field mapping rules, "Option: Array" now works with multi-level nested subarrays.
|
194 |
+
* Fix: For custom field mapping rules, "Delete NULL Values" now works with "Format: Raw".
|
195 |
+
* Fix: For "WordPress-style" PDF thumbnail generation, occasional PHP "Illegal string offset 'sizes'" errors have been resolved.
|
196 |
+
|
197 |
= 2.80 =
|
198 |
* New: A new "MLA Phoenix Media Rename Example" plugin has been added to the "Examples" family in the Settings/Media Library Assistant Documentation tab. It adds support for the Phoenix Media Rename plugin's "Filename" column to the Media/Assistant submenu table.
|
199 |
* Fix: For the Media/Assistant admin submenu screen, avoid "headers already sent" error with JoomUnited's WP Media Folders.
|
328 |
|
329 |
== Upgrade Notice ==
|
330 |
|
331 |
+
= 2.81 =
|
332 |
+
Compatibility updates for WordPress 5.3. New "mso:" prefix gives access to the Document Properties embedded in Office Open XML file formats (e.g., docx, xlsx, pptx). Three enhancements, eight fixes.
|
333 |
|
334 |
== Other Notes ==
|
335 |
|
tpls/admin-display-settings-example-tab.tpl
CHANGED
@@ -9,9 +9,9 @@
|
|
9 |
[+_wpnonce+]
|
10 |
<p class="search-box" style="margin-top: 1em">
|
11 |
<label class="screen-reader-text" for="mla-search-example-input">[+Search Example Plugins+]:</label>
|
12 |
-
<input
|
13 |
-
<input
|
14 |
-
<span class="description"
|
15 |
</p>
|
16 |
</form>
|
17 |
<br class="clear" />
|
9 |
[+_wpnonce+]
|
10 |
<p class="search-box" style="margin-top: 1em">
|
11 |
<label class="screen-reader-text" for="mla-search-example-input">[+Search Example Plugins+]:</label>
|
12 |
+
<input style="float: left" id="mla-search-example-input" name="s" type="search" value="[+s+]" />
|
13 |
+
<input class="button" style="float: right" name="mla-example-search" id="mla-search-example-submit" type="submit" value="[+Search Plugins+]" />
|
14 |
+
<br /><span class="description" style="float: left">[+Search help+]</span>
|
15 |
</p>
|
16 |
</form>
|
17 |
<br class="clear" />
|
tpls/admin-display-settings-upload-tab.tpl
CHANGED
@@ -110,9 +110,9 @@
|
|
110 |
[+results+]
|
111 |
<p class="search-box" style="margin-top: 1em">
|
112 |
<label class="screen-reader-text" for="mla-search-uploads-input">Search Upload MIME Types:</label>
|
113 |
-
<input
|
114 |
-
<input
|
115 |
-
<span class="description"
|
116 |
</p>
|
117 |
</form>
|
118 |
<br class="clear" />
|
110 |
[+results+]
|
111 |
<p class="search-box" style="margin-top: 1em">
|
112 |
<label class="screen-reader-text" for="mla-search-uploads-input">Search Upload MIME Types:</label>
|
113 |
+
<input style="float: left;" id="mla-search-uploads-input" name="s" type="search" value="[+s+]" />
|
114 |
+
<input style="float: right;" name="" id="mla-search-uploads-submit" class="button" type="submit" value="[+Search Uploads+]" />
|
115 |
+
<br /><span class="description" style="float: left;">[+To search by+]</span>
|
116 |
</p>
|
117 |
</form>
|
118 |
<br class="clear" />
|
tpls/documentation-settings-tab.tpl
CHANGED
@@ -4315,6 +4315,37 @@ MLA adds three fields of its own to the XMP metadata information:
|
|
4315 |
The ALL_XMP value is altered in two ways. First, values of more than 256 characters are truncated to 256 characters. This prevents large fields such as image thumbnails from dominating the display. Second, array values are replaced by an "(ARRAY)" placeholder, e.g., <code>'History' => '(ARRAY)'</code>. You can explore array values individually by coding something like <code>[+xmp:History,export+]</code> to expand all levels within the array or <code>[+xmp:mwg-rs,unpack+]</code> to expand one level within the array. You can go deeper in the array hierarchy with compound names, e.g., <code>[+xmp:mwg-rs.RegionList,unpack+]</code> or <code>[+xmp:mwg-rs.RegionList.*.Description.Name+]</code>.
|
4316 |
<br /> </td>
|
4317 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4318 |
<tr>
|
4319 |
<td class="mla-doc-table-label">id3</td>
|
4320 |
<td>
|
4315 |
The ALL_XMP value is altered in two ways. First, values of more than 256 characters are truncated to 256 characters. This prevents large fields such as image thumbnails from dominating the display. Second, array values are replaced by an "(ARRAY)" placeholder, e.g., <code>'History' => '(ARRAY)'</code>. You can explore array values individually by coding something like <code>[+xmp:History,export+]</code> to expand all levels within the array or <code>[+xmp:mwg-rs,unpack+]</code> to expand one level within the array. You can go deeper in the array hierarchy with compound names, e.g., <code>[+xmp:mwg-rs.RegionList,unpack+]</code> or <code>[+xmp:mwg-rs.RegionList.*.Description.Name+]</code>.
|
4316 |
<br /> </td>
|
4317 |
</tr>
|
4318 |
+
<tr>
|
4319 |
+
<td class="mla-doc-table-label">mso</td>
|
4320 |
+
<td>
|
4321 |
+
For Microsoft Office documents, data defined by the <a href="https://en.wikipedia.org/wiki/Office_Open_XML_file_formats#Document_properties" title="Wikipedia Article" target="_blank">Office Open XML file formats</a>, if present. The formats (e.g., docx, xlsx, pptx) were developed by Microsoft and first appeared in Microsoft Office 2007. MLA provides access to the "Document Properties" data in three ways:
|
4322 |
+
<ol>
|
4323 |
+
<li>
|
4324 |
+
MLA will copy appropriate values from the Document Properties data into the nine "<a href="#pdf_metadata">PDF Document Information Dictionary</a>" fields to populate them as often as possible. For example, the "creator" value(s) in the "dc" namespace ("dc.creator") might be copied to an empty "Author" field, or the "cp.keywords" and "cp.category" value(s) might be copied to an empty Keywords field.
|
4325 |
+
</li>
|
4326 |
+
<li>
|
4327 |
+
Additional values in the "cp", "dc", "dcterms" and "app" namespaces are copied up to the root level for easier access. For example, the "cp.description" value can be accessed as "description", without the "cp." portion of the compound name.
|
4328 |
+
</li>
|
4329 |
+
<li>
|
4330 |
+
The "Extended Properties" are copied to the "app." array at the root level. For example, Word documents contain information such as "app.Pages", "app.Words" and "app.Characters". The native values of some fields, e.g., "app.HeadingPairs", can be an array.
|
4331 |
+
</li>
|
4332 |
+
</ol>
|
4333 |
+
MLA adds two fields of its own to the MS Office metadata information:
|
4334 |
+
<br /> <br />
|
4335 |
+
<table>
|
4336 |
+
<tr>
|
4337 |
+
<td class="mla-doc-table-label">xmlns</td>
|
4338 |
+
<td>an array of the namespaces found in the document, such as <code>'dc' => 'http://purl.org/dc/elements/1.1/'</code></td>
|
4339 |
+
</tr>
|
4340 |
+
<tr>
|
4341 |
+
<td class="mla-doc-table-label">ALL_MSO</td>
|
4342 |
+
<td>a special "pseudo value" that returns a string representation of all the metadata. You can use this pseudo-value to examine the metadata in a document, find field names and see what values are present.</td>
|
4343 |
+
</tr>
|
4344 |
+
</table>
|
4345 |
+
<br />
|
4346 |
+
The ALL_MSO value is altered in two ways. First, values of more than 256 characters are truncated to 256 characters. This prevents large fields from dominating the display. Second, array values are replaced by an "(ARRAY)" placeholder, e.g., <code>'Keywords' => '(ARRAY)'</code>. You can explore array values individually by coding something like <code>[+mso:TitlesOfParts,export+]</code> to expand all levels within the array or <code>[+mso:Keywords,unpack+]</code> to expand one level within the array. You can go deeper in the array hierarchy with compound names, e.g., <code>[+mso:HeadingPairs.vector,unpack+]</code>.
|
4347 |
+
<br /> </td>
|
4348 |
+
</tr>
|
4349 |
<tr>
|
4350 |
<td class="mla-doc-table-label">id3</td>
|
4351 |
<td>
|
tpls/help-for-media_page_mla-menu.tpl
CHANGED
@@ -70,7 +70,7 @@ There are four where-used reporting categories and you can turn them on or off w
|
|
70 |
<p>The taxonomies that appear in the Bulk Edit area can be a subset of the taxonomies supported on the single item edit screen. You can select which taxonomies appear by entering your choice(s) in the Settings/Media Library Assistant General tab.</p>
|
71 |
<p>You can update the Title, Caption, Description and ALT Text values for all of the selected attachments. You can use a <a href="[+settingsURL+]?page=mla-settings-menu-documentation&mla_tab=documentation#mla_template_parameters" target="_blank">Content Template</a> to customize the values based on attachment-specific data sources. You can also delete the content of a field by entering the special <code>template:[+empty+]</code> value.</p>
|
72 |
<p>You can update the "Uploaded on" date/time values for all the selected attachments, using a Content Template for attachment-specific data sources. More information on this powerful feature is in the <a href="[+settingsURL+]?page=mla-settings-menu-documentation&mla_tab=documentation#date_iptc_exif_mapping" target="_blank">IPTC/EXIF Mapping and Bulk Editing for the "Uploaded on" Standard Field</a> section of the Documentation tab.</p>
|
73 |
-
<p>In the Bulk Edit area
|
74 |
<!-- template="mla-available-actions" -->
|
75 |
<!-- title="Available Actions" order="100" -->
|
76 |
<p>Hovering over a row reveals action links such as Edit, Quick Edit, Move to Trash and Delete Permanently. Clicking Edit displays a simple screen to edit that individual file’s metadata. Clicking Move to Trash will assign the file to the Trash pile but will not affect pages or posts to which it is attached. Clicking Delete Permanently will delete the file from the media library (as well as from any posts to which it is currently attached). Clicking Quick Edit displays an inline form to edit the file's metadata without leaving the menu screen.</p>
|
70 |
<p>The taxonomies that appear in the Bulk Edit area can be a subset of the taxonomies supported on the single item edit screen. You can select which taxonomies appear by entering your choice(s) in the Settings/Media Library Assistant General tab.</p>
|
71 |
<p>You can update the Title, Caption, Description and ALT Text values for all of the selected attachments. You can use a <a href="[+settingsURL+]?page=mla-settings-menu-documentation&mla_tab=documentation#mla_template_parameters" target="_blank">Content Template</a> to customize the values based on attachment-specific data sources. You can also delete the content of a field by entering the special <code>template:[+empty+]</code> value.</p>
|
72 |
<p>You can update the "Uploaded on" date/time values for all the selected attachments, using a Content Template for attachment-specific data sources. More information on this powerful feature is in the <a href="[+settingsURL+]?page=mla-settings-menu-documentation&mla_tab=documentation#date_iptc_exif_mapping" target="_blank">IPTC/EXIF Mapping and Bulk Editing for the "Uploaded on" Standard Field</a> section of the Documentation tab.</p>
|
73 |
+
<p>In the Bulk Edit area three additional substitution parameter values are available. The <code>[+found_rows+]</code> value contains the total number of items that will be processed. The <code>[+index+]</code> value starts at one and is incremented for each item processed. You can add an offset, e.g., <code>[+index,99+]</code> will give a starting value of 100. The <code>[+reverse_index+]</code> value starts at the total number of items and is decremented for each item processed. You can add an offset, e.g., <code>[+reverse_index,99+]</code> will give a starting value of 110 if there are ten total items.</p>
|
74 |
<!-- template="mla-available-actions" -->
|
75 |
<!-- title="Available Actions" order="100" -->
|
76 |
<p>Hovering over a row reveals action links such as Edit, Quick Edit, Move to Trash and Delete Permanently. Clicking Edit displays a simple screen to edit that individual file’s metadata. Clicking Move to Trash will assign the file to the Trash pile but will not affect pages or posts to which it is attached. Clicking Delete Permanently will delete the file from the media library (as well as from any posts to which it is currently attached). Clicking Quick Edit displays an inline form to edit the file's metadata without leaving the menu screen.</p>
|