plugin updates

This commit is contained in:
Tony Volpe
2024-11-25 13:10:11 -05:00
parent 864fe717f9
commit 76d447655a
48 changed files with 1945 additions and 200 deletions
+31
View File
@@ -53,6 +53,37 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
<a href="contribute.php" class="nav-tab"><?php _e( 'Get Involved' ); ?></a> <a href="contribute.php" class="nav-tab"><?php _e( 'Get Involved' ); ?></a>
</nav> </nav>
<div class="about__section changelog has-subtle-background-color">
<div class="column">
<h2><?php _e( 'Maintenance and Security Releases' ); ?></h2>
<p>
<?php
printf(
/* translators: 1: WordPress version number, 2: Plural number of bugs. */
_n(
'<strong>Version %1$s</strong> addressed %2$s bug.',
'<strong>Version %1$s</strong> addressed %2$s bugs.',
16
),
'6.7.1',
'16'
);
?>
<?php
printf(
/* translators: %s: HelpHub URL. */
__( 'For more information, see <a href="%s">the release notes</a>.' ),
sprintf(
/* translators: %s: WordPress version. */
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
sanitize_title( '6.7.1' )
)
);
?>
</p>
</div>
</div>
<div class="about__section"> <div class="about__section">
<div class="column"> <div class="column">
<h2> <h2>
+1 -1
View File
@@ -2463,7 +2463,7 @@ h1.nav-tab-wrapper, /* Back-compat for pre-4.4 */
} }
.nav-menus-php .metabox-holder .accordion-section-title span.dashicons.dashicons-arrow-down::before { .nav-menus-php .metabox-holder .accordion-section-title span.dashicons.dashicons-arrow-down::before {
position: relative; position: relative;
right: -1px right: -1px;
} }
.nav-menus-php .metabox-holder .accordion-section.open .accordion-section-title span.dashicons.dashicons-arrow-down { .nav-menus-php .metabox-holder .accordion-section.open .accordion-section-title span.dashicons.dashicons-arrow-down {
+1 -1
View File
@@ -2462,7 +2462,7 @@ h1.nav-tab-wrapper, /* Back-compat for pre-4.4 */
} }
.nav-menus-php .metabox-holder .accordion-section-title span.dashicons.dashicons-arrow-down::before { .nav-menus-php .metabox-holder .accordion-section-title span.dashicons.dashicons-arrow-down::before {
position: relative; position: relative;
left: -1px left: -1px;
} }
.nav-menus-php .metabox-holder .accordion-section.open .accordion-section-title span.dashicons.dashicons-arrow-down { .nav-menus-php .metabox-holder .accordion-section.open .accordion-section-title span.dashicons.dashicons-arrow-down {
+5 -2
View File
@@ -554,7 +554,8 @@ body.trashing #publish-settings {
.15s border-color ease-in-out; .15s border-color ease-in-out;
} }
.accordion-section-title:has(button.accordion-trigger) { .accordion-section-title:has(button.accordion-trigger),
#customize-controls .current-panel .control-section > h3.accordion-section-title:has(button.accordion-trigger) {
padding: 0; padding: 0;
} }
@@ -562,9 +563,10 @@ body.trashing #publish-settings {
all: unset; all: unset;
width: 100%; width: 100%;
height: 100%; height: 100%;
padding: 10px 14px 11px 10px; padding: 10px 14px 11px 30px;
display: flex; display: flex;
align-items: center; align-items: center;
box-sizing: border-box;
} }
.accordion-section-title button.accordion-trigger:has(.menu-in-location) { .accordion-section-title button.accordion-trigger:has(.menu-in-location) {
@@ -588,6 +590,7 @@ body.trashing #publish-settings {
#customize-outer-theme-controls .accordion-section-title:after { #customize-outer-theme-controls .accordion-section-title:after {
content: "\f341"; content: "\f341";
color: #a7aaad; color: #a7aaad;
pointer-events: none;
} }
#customize-theme-controls .accordion-section-content, #customize-theme-controls .accordion-section-content,
File diff suppressed because one or more lines are too long
+5 -2
View File
@@ -553,7 +553,8 @@ body.trashing #publish-settings {
.15s border-color ease-in-out; .15s border-color ease-in-out;
} }
.accordion-section-title:has(button.accordion-trigger) { .accordion-section-title:has(button.accordion-trigger),
#customize-controls .current-panel .control-section > h3.accordion-section-title:has(button.accordion-trigger) {
padding: 0; padding: 0;
} }
@@ -561,9 +562,10 @@ body.trashing #publish-settings {
all: unset; all: unset;
width: 100%; width: 100%;
height: 100%; height: 100%;
padding: 10px 10px 11px 14px; padding: 10px 30px 11px 14px;
display: flex; display: flex;
align-items: center; align-items: center;
box-sizing: border-box;
} }
.accordion-section-title button.accordion-trigger:has(.menu-in-location) { .accordion-section-title button.accordion-trigger:has(.menu-in-location) {
@@ -587,6 +589,7 @@ body.trashing #publish-settings {
#customize-outer-theme-controls .accordion-section-title:after { #customize-outer-theme-controls .accordion-section-title:after {
content: "\f345"; content: "\f345";
color: #a7aaad; color: #a7aaad;
pointer-events: none;
} }
#customize-theme-controls .accordion-section-content, #customize-theme-controls .accordion-section-content,
File diff suppressed because one or more lines are too long
+5 -5
View File
@@ -270,11 +270,11 @@ p {
vertical-align: baseline; vertical-align: baseline;
} }
.login .wp-login-logo { .login h1 {
text-align: center; text-align: center;
} }
.login .wp-login-logo a { .login h1 a {
background-image: url(../images/w-logo-blue.png?ver=20131202); background-image: url(../images/w-logo-blue.png?ver=20131202);
background-image: none, url(../images/wordpress-logo.svg?ver=20131107); background-image: none, url(../images/wordpress-logo.svg?ver=20131107);
background-size: 84px; background-size: 84px;
@@ -324,13 +324,13 @@ p {
.login #nav a:hover, .login #nav a:hover,
.login #backtoblog a:hover, .login #backtoblog a:hover,
.login .wp-login-logo a:hover { .login h1 a:hover {
color: #135e96; color: #135e96;
} }
.login #nav a:focus, .login #nav a:focus,
.login #backtoblog a:focus, .login #backtoblog a:focus,
.login .wp-login-logo a:focus { .login h1 a:focus {
color: #043959; color: #043959;
} }
@@ -391,7 +391,7 @@ body.interim-login {
margin: 5px auto 20px; margin: 5px auto 20px;
} }
.interim-login.login .wp-login-logo a { .interim-login.login h1 a {
width: auto; width: auto;
} }
+1 -1
View File
File diff suppressed because one or more lines are too long
+5 -5
View File
@@ -269,11 +269,11 @@ p {
vertical-align: baseline; vertical-align: baseline;
} }
.login .wp-login-logo { .login h1 {
text-align: center; text-align: center;
} }
.login .wp-login-logo a { .login h1 a {
background-image: url(../images/w-logo-blue.png?ver=20131202); background-image: url(../images/w-logo-blue.png?ver=20131202);
background-image: none, url(../images/wordpress-logo.svg?ver=20131107); background-image: none, url(../images/wordpress-logo.svg?ver=20131107);
background-size: 84px; background-size: 84px;
@@ -323,13 +323,13 @@ p {
.login #nav a:hover, .login #nav a:hover,
.login #backtoblog a:hover, .login #backtoblog a:hover,
.login .wp-login-logo a:hover { .login h1 a:hover {
color: #135e96; color: #135e96;
} }
.login #nav a:focus, .login #nav a:focus,
.login #backtoblog a:focus, .login #backtoblog a:focus,
.login .wp-login-logo a:focus { .login h1 a:focus {
color: #043959; color: #043959;
} }
@@ -390,7 +390,7 @@ body.interim-login {
margin: 5px auto 20px; margin: 5px auto 20px;
} }
.interim-login.login .wp-login-logo a { .interim-login.login h1 a {
width: auto; width: auto;
} }
+1 -1
View File
File diff suppressed because one or more lines are too long
+15 -3
View File
@@ -319,7 +319,7 @@
$selected = 'selected'; $selected = 'selected';
} }
$html += '<option ' + $selected + ' value="0">No Parent</option>'; $html += '<option ' + $selected + ' value="0">' + wp.i18n._x( 'No Parent', 'menu item without a parent in navigation menu' ) + '</option>';
$.each( menuItems, function() { $.each( menuItems, function() {
var menuItem = $(this), var menuItem = $(this),
@@ -364,7 +364,13 @@
if ( i == itemPosition ) { if ( i == itemPosition ) {
$selected = 'selected'; $selected = 'selected';
} }
$html += '<option ' + $selected + ' value="' + i + '">' + i + ' of ' + totalMenuItems + '</option>'; var itemString = wp.i18n.sprintf(
/* translators: 1: The current menu item number, 2: The total number of menu items. */
wp.i18n._x( '%1$s of %2$s', 'part of a total number of menu items' ),
i,
totalMenuItems
);
$html += '<option ' + $selected + ' value="' + i + '">' + itemString + '</option>';
} }
} else { } else {
@@ -380,7 +386,13 @@
if ( i == itemPosition ) { if ( i == itemPosition ) {
$selected = 'selected'; $selected = 'selected';
} }
$html += '<option ' + $selected + ' value="' + i + '">' + i + ' of ' + totalSubMenuItems + '</option>'; var submenuString = wp.i18n.sprintf(
/* translators: 1: The current submenu item number, 2: The total number of submenu items. */
wp.i18n._x( '%1$s of %2$s', 'part of a total number of menu items' ),
i,
totalSubMenuItems
);
$html += '<option ' + $selected + ' value="' + i + '">' + submenuString + '</option>';
} }
} }
+1 -1
View File
File diff suppressed because one or more lines are too long
+4 -2
View File
@@ -659,8 +659,10 @@ jQuery( function($) {
'li.popular-category > label input[type="checkbox"]', 'li.popular-category > label input[type="checkbox"]',
function() { function() {
var t = $(this), c = t.is(':checked'), id = t.val(); var t = $(this), c = t.is(':checked'), id = t.val();
if ( id && t.parents('#taxonomy-'+taxonomy).length ) if ( id && t.parents('#taxonomy-'+taxonomy).length ) {
$('#in-' + taxonomy + '-' + id + ', #in-popular-' + taxonomy + '-' + id).prop( 'checked', c ); $('input[id^="in-' + taxonomy + '-' + id + '"]').prop('checked', c);
$('input#in-popular-' + taxonomy + '-' + id).prop('checked', c);
}
} }
); );
+1 -1
View File
File diff suppressed because one or more lines are too long
@@ -5,7 +5,7 @@
* Plugin Name: Classic Editor * Plugin Name: Classic Editor
* Plugin URI: https://wordpress.org/plugins/classic-editor/ * Plugin URI: https://wordpress.org/plugins/classic-editor/
* Description: Enables the WordPress classic editor and the old-style Edit Post screen with TinyMCE, Meta Boxes, etc. Supports the older plugins that extend this screen. * Description: Enables the WordPress classic editor and the old-style Edit Post screen with TinyMCE, Meta Boxes, etc. Supports the older plugins that extend this screen.
* Version: 1.6.5 * Version: 1.6.6
* Author: WordPress Contributors * Author: WordPress Contributors
* Author URI: https://github.com/WordPress/classic-editor/ * Author URI: https://github.com/WordPress/classic-editor/
* License: GPLv2 or later * License: GPLv2 or later
@@ -65,10 +65,17 @@ class Classic_Editor {
// Always remove the "Try Gutenberg" dashboard widget. See https://core.trac.wordpress.org/ticket/44635. // Always remove the "Try Gutenberg" dashboard widget. See https://core.trac.wordpress.org/ticket/44635.
remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' ); remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' );
// Fix for Safari 18 negative horizontal margin on floats. // Fix for Safari 18 negative horizontal margin on floats.
add_action( 'admin_print_styles', array( __CLASS__, 'safari_18_temp_fix' ) ); add_action( 'admin_print_styles', array( __CLASS__, 'safari_18_temp_fix' ) );
// Fix for the Categories postbox for WP 6.7.1.
global $wp_version;
if ( '6.7.1' === $wp_version && is_admin() ) {
add_action( 'wp_default_scripts', array( __CLASS__, 'replace_post_js' ), 11 );
}
if ( ! $block_editor && ! $gutenberg ) { if ( ! $block_editor && ! $gutenberg ) {
return; return;
} }
@@ -459,7 +466,7 @@ class Classic_Editor {
if ( ! $user_can_edit || ! $settings['allow-users'] ) { if ( ! $user_can_edit || ! $settings['allow-users'] ) {
return; return;
} }
if ( $user instanceof WP_User ) { if ( $user instanceof WP_User ) {
$user_id = (int) $user->ID; $user_id = (int) $user->ID;
} else { } else {
@@ -977,7 +984,7 @@ class Classic_Editor {
delete_option( 'classic-editor-replace' ); delete_option( 'classic-editor-replace' );
delete_option( 'classic-editor-allow-users' ); delete_option( 'classic-editor-allow-users' );
} }
/** /**
* Temporary fix for Safari 18 negative horizontal margin on floats. * Temporary fix for Safari 18 negative horizontal margin on floats.
* See: https://core.trac.wordpress.org/ticket/62082 and * See: https://core.trac.wordpress.org/ticket/62082 and
@@ -986,10 +993,10 @@ class Classic_Editor {
*/ */
public static function safari_18_temp_fix() { public static function safari_18_temp_fix() {
global $current_screen; global $current_screen;
if ( isset( $current_screen->base ) && 'post' === $current_screen->base ) { if ( isset( $current_screen->base ) && 'post' === $current_screen->base ) {
$clear = is_rtl() ? 'right' : 'left'; $clear = is_rtl() ? 'right' : 'left';
?> ?>
<style id="classic-editor-safari-18-temp-fix"> <style id="classic-editor-safari-18-temp-fix">
_::-webkit-full-page-media, _:future, :root #post-body #postbox-container-2 { _::-webkit-full-page-media, _:future, :root #post-body #postbox-container-2 {
@@ -999,6 +1006,34 @@ class Classic_Editor {
<?php <?php
} }
} }
/**
* Temporary fix for the Categories postbox on the classic Edit Post screen.
* See: https://core.trac.wordpress.org/ticket/62504.
*/
public static function replace_post_js( $scripts ) {
$script = $scripts->query( 'post', 'registered' );
$suffix = wp_scripts_get_suffix();
if ( $script ) {
if ( '62504-20241121' === $script->ver ) {
// The script src was replaced from another plugin.
return;
}
$script->src = plugins_url( 'scripts/', __FILE__ ) . "post{$suffix}.js";
$script->ver = '62504-20241121';
} else {
$scripts->add(
'post',
plugins_url( 'scripts/', __FILE__ ) . "post{$suffix}.js",
array( 'suggest', 'wp-lists', 'postbox', 'tags-box', 'underscore', 'word-count', 'wp-a11y', 'wp-sanitize', 'clipboard' ),
'62504-20241121',
1
);
$scripts->set_translations( 'post' );
}
}
} }
add_action( 'plugins_loaded', array( 'Classic_Editor', 'init_actions' ) ); add_action( 'plugins_loaded', array( 'Classic_Editor', 'init_actions' ) );
@@ -2,8 +2,8 @@
Contributors: wordpressdotorg, azaozz, melchoyce, chanthaboune, alexislloyd, pento, youknowriad, desrosj, luciano-croce, ironprogrammer Contributors: wordpressdotorg, azaozz, melchoyce, chanthaboune, alexislloyd, pento, youknowriad, desrosj, luciano-croce, ironprogrammer
Tags: gutenberg, disable, disable gutenberg, editor, classic editor, block editor Tags: gutenberg, disable, disable gutenberg, editor, classic editor, block editor
Requires at least: 4.9 Requires at least: 4.9
Tested up to: 6.6 Tested up to: 6.7
Stable tag: 1.6.5 Stable tag: 1.6.6
Requires PHP: 5.2.4 Requires PHP: 5.2.4
License: GPLv2 or later License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -29,6 +29,9 @@ By default, this plugin hides all functionality available in the new block edito
== Changelog == == Changelog ==
= 1.6.6 =
* Added fix for selecting/deselecting multiple unwanted categories in WordPress 6.7.1 when clicking on a category checkbox on the old Edit Post screen.
= 1.6.5 = = 1.6.5 =
* Added fix for Safari 18 negative horizontal margin on floats. * Added fix for Safari 18 negative horizontal margin on floats.
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -211,11 +211,9 @@ var wpmfGalleryModule;
uploader.bind('BeforeUpload', function(up, file) { uploader.bind('BeforeUpload', function(up, file) {
var multipart_params = up.settings.multipart_params; var multipart_params = up.settings.multipart_params;
multipart_params['wpmf_nonce'] = wmpf_nonce; multipart_params['wpmf_nonce'] = wmpf_nonce;
multipart_params['no_move'] = 1;
multipart_params['wpmf_folder'] = get_wpmf_folder; multipart_params['wpmf_folder'] = get_wpmf_folder;
if (is_local_to_cloud) { if (is_local_to_cloud) {
multipart_params['id_category'] = get_wpmf_folder; multipart_params['id_category'] = get_wpmf_folder;
multipart_params['no_move'] = null;
multipart_params['current_category'] = 0; multipart_params['current_category'] = 0;
} }
up.settings.multipart_params = multipart_params; up.settings.multipart_params = multipart_params;
@@ -225,7 +223,6 @@ var wpmfGalleryModule;
uploader.bind('BeforeUpload', function(up, file) { uploader.bind('BeforeUpload', function(up, file) {
var multipart_params = up.settings.multipart_params; var multipart_params = up.settings.multipart_params;
multipart_params['wpmf_folder'] = 0; multipart_params['wpmf_folder'] = 0;
multipart_params['no_move'] = 1;
multipart_params['wpmf_nonce'] = wmpf_nonce; multipart_params['wpmf_nonce'] = wmpf_nonce;
if (get_wpmf_folder) { if (get_wpmf_folder) {
multipart_params['wpmf_folder'] = get_wpmf_folder; multipart_params['wpmf_folder'] = get_wpmf_folder;
@@ -242,7 +239,6 @@ var wpmfGalleryModule;
multipart_params['wpmf_nonce'] = wmpf_nonce; multipart_params['wpmf_nonce'] = wmpf_nonce;
if (is_local_to_cloud) { if (is_local_to_cloud) {
multipart_params['id_category'] = id_category; multipart_params['id_category'] = id_category;
multipart_params['no_move'] = null;
multipart_params['current_category'] = 0; multipart_params['current_category'] = 0;
} else { } else {
multipart_params['wpmf_folder'] = id_category; multipart_params['wpmf_folder'] = id_category;
@@ -251,6 +247,48 @@ var wpmfGalleryModule;
}); });
}) })
}); });
//change url thumbnail when upload to cloud
setInterval(function(){
// Check if element exist
if ($('#media-items .media-item').length > 0) {
const ele_pinky = document.querySelectorAll(".pinkynail");
const title = document.querySelectorAll(".attachment-details .media-list-subtitle");
const ele_button_copy = document.querySelectorAll(".attachment-details .attachment-tools button");
const media_item = document.querySelectorAll(".media-item");
if (ele_pinky && title && ele_button_copy && media_item) {
for (let i = 0; i < ele_pinky.length; i++) {
var src = ele_pinky[i].currentSrc;
var file_name = title[i].innerHTML;
var ext = file_name.split('.').pop();
var element_id = media_item[i].id;
if (src && file_name && ext && element_id) {
var url_thumb = ele_button_copy[i].dataset.clipboardText;
//check type of file
if(url_thumb) {
if (file_name.indexOf('.pdf') > 0 || file_name.indexOf('.doc') > 0) {
url_thumb = wpmf.vars.site_url + '/wp-includes/images/media/document.svg';
} else if (file_name.indexOf('.mp3') > 0) {
url_thumb = wpmf.vars.site_url + '/wp-includes/images/media/audio.svg';
} else if (file_name.indexOf('.mp4') > 0) {
url_thumb = wpmf.vars.site_url + '/wp-includes/images/media/video.svg';
} else if (file_name.indexOf('.avif') > 0 && url_thumb.indexOf('admin-ajax.php?action=wpmf_onedrive_download') < 0 && url_thumb.indexOf('dl.dropboxusercontent.com') < 0 && url_thumb.indexOf('drive.google.com') < 0) {
url_thumb = wpmf.vars.site_url + '/wp-includes/images/media/default.svg';
} else if (file_name.indexOf('.xls') > 0 || file_name.indexOf('.csv') > 0) {
url_thumb = wpmf.vars.site_url + '/wp-includes/images/media/spreadsheet.svg';
} else if (file_name.indexOf('.pptx') > 0) {
url_thumb = wpmf.vars.site_url + '/wp-includes/images/media/interactive.svg';
} else if (file_name.indexOf('.txt') > 0) {
url_thumb = wpmf.vars.site_url + '/wp-includes/images/media/text.svg';
}
var element_image = '#' + element_id + ' img';
$(element_image).attr('src', url_thumb);
}
}
}
}
}
}, 1500);
}); });
})(jQuery); })(jQuery);
@@ -214,22 +214,23 @@ var wpmfFoldersModule = void 0,
} }
} }
}) })
//Select tag for media
$('#doaction').on('click', function (e) { $('#doaction').on('click', function (e) {
var action = $('#bulk-action-selector-top').val(); var action = $('#bulk-action-selector-top').val();
if (wpmf.vars.wpmf_pagenow === 'upload.php' && action == 'tag') { //get list post id
e.preventDefault(); var cboxes = document.getElementsByName('media[]');
//get list post id var post_ids = [];
var cboxes = document.getElementsByName('media[]'); var len = cboxes.length;
var post_ids = []; if (cboxes !== 'undefined') {
var len = cboxes.length; for (var i=0; i<len; i++) {
if (cboxes !== 'undefined') { if(cboxes[i].checked) {
for (var i=0; i<len; i++) { post_ids.push(cboxes[i].value);
if(cboxes[i].checked) {
post_ids.push(cboxes[i].value);
}
} }
} }
}
//Select tag for media
if (wpmf.vars.wpmf_pagenow === 'upload.php' && action == 'tag') {
e.preventDefault();
if (post_ids.length > 0) { if (post_ids.length > 0) {
var html = "<p class='tag-note'>To select a tag, first choose one from the existing list. If the tag you need isn't there, you can create a new one.</p>"; var html = "<p class='tag-note'>To select a tag, first choose one from the existing list. If the tag you need isn't there, you can create a new one.</p>";
html += '<input name="tags-outside" class="tagify--outside" value="" placeholder="Write tags to add below">'; html += '<input name="tags-outside" class="tagify--outside" value="" placeholder="Write tags to add below">';
@@ -333,6 +334,80 @@ var wpmfFoldersModule = void 0,
} }
}); });
//fix delete file submit on list view
$('.wp-list-table .row-actions .delete .submitdelete').attr('onclick', 'return');
$('.wp-list-table .row-actions .delete .submitdelete').off('click').on('click', function (e) {
e.preventDefault();
var confirm = showNotice.warn();
if (confirm) {
var href = $(this).attr('href');
var id = href.substring(
href.indexOf("post=") + 5,
href.lastIndexOf("&")
);
if (id && !isNaN(id)){
$.ajax({
type: "POST",
url: wpmf.vars.ajaxurl,
data: {
action: "wpmf",
task: "delete_file",
id: id,
wpmf_nonce: wpmf.vars.wpmf_nonce
},
success: function success(response) {
if (response.status) {
window.location.reload();
}
}
});
}
}
});
// add iframe to play mp4 in attachment detail on google drive
$('#wp-media-grid .media-frame').off('click').on('click', function (e) {
var file_name = $(".attachment-info .details .filename").html();
if (file_name && file_name.indexOf('.mp4') > 0) {
var src = $('.thumbnail-video img').attr('src');
if (src && src.indexOf('drive.google.com') > 0) {
//get id video
var id = src.substring(
src.indexOf("id=") + 3,
src.lastIndexOf("&")
);
$('.wp-video').remove();
$('.thumbnail-video .details-image').remove();
$('.thumbnail-video').attr('style', 'width: 480px; height: 270px');
if (id) {
var html = "<iframe src='https://drive.google.com/file/d/" + id + "/preview' width='100%' height='100%' allow='autoplay'";
html += "></iframe>";
$('.thumbnail-video').append(html);
}
}
} else if (file_name && file_name.indexOf('.mp3') > 0) {
var src = $('.thumbnail-audio .wp-audio-shortcode mediaelementwrapper audio').attr('src');
if (src && src.indexOf('drive.google.com') > 0) {
//get id video
var id = src.substring(
src.indexOf("id=") + 3,
src.lastIndexOf("&e")
);
//get width and height video
$('.wp-audio').remove();
if (id) {
var html = "<iframe src='https://drive.google.com/file/d/" + id + "/preview' allow='autoplay'";
html += "></iframe>";
$('.thumbnail-audio').append(html);
}
}
}
//fix style for google item
if (file_name && file_name.indexOf('.mp3') > 0 || file_name && file_name.indexOf('.csv') > 0 || file_name && file_name.indexOf('.zip') > 0) {
$('.thumbnail .details-image').attr('style', 'background-image:none');
}
})
// add bulk upload to s3 button // add bulk upload to s3 button
if (parseInt(wpmf.vars.copy_files_to_bucket) === 1) { if (parseInt(wpmf.vars.copy_files_to_bucket) === 1) {
if (!$current_frame.find('.bulk-upload-s3-btn').length) { if (!$current_frame.find('.bulk-upload-s3-btn').length) {
@@ -558,7 +633,6 @@ var wpmfFoldersModule = void 0,
} }
var multipart_params = up.settings.multipart_params; var multipart_params = up.settings.multipart_params;
multipart_params['wpmf_nonce'] = wpmf.vars.wpmf_nonce; multipart_params['wpmf_nonce'] = wpmf.vars.wpmf_nonce;
multipart_params['no_move'] = 1;
multipart_params['wpmf_folder'] = e.wpmf_folder; multipart_params['wpmf_folder'] = e.wpmf_folder;
up.settings.multipart_params = multipart_params; up.settings.multipart_params = multipart_params;
}); });
@@ -921,7 +995,7 @@ var wpmfFoldersModule = void 0,
/** /**
* We extend the AttachmentFilters view to add our own filtering * We extend the AttachmentFilters view to add our own filtering
*/ */
if (typeof wp.media.view.AttachmentFilters !== "undefined") { if (typeof wp.media !== 'undefined' && typeof wp.media.view !== 'undefined' && typeof wp.media.view.AttachmentFilters !== "undefined") {
wp.media.view.AttachmentFilters['wpmf_categories'] = wp.media.view.AttachmentFilters.extend({ wp.media.view.AttachmentFilters['wpmf_categories'] = wp.media.view.AttachmentFilters.extend({
className: 'wpmf-media-categories attachment-filters', className: 'wpmf-media-categories attachment-filters',
id: 'wpmf-media-category', id: 'wpmf-media-category',
@@ -963,7 +1037,9 @@ var wpmfFoldersModule = void 0,
} }
// render filter // render filter
var myAttachmentsBrowser = wp.media.view.AttachmentsBrowser; if (typeof wp.media !== "undefined" && typeof wp.media.view !== "undefined" && typeof wp.media.view.AttachmentsBrowser !== "undefined") {
var myAttachmentsBrowser = wp.media.view.AttachmentsBrowser;
}
if (typeof myAttachmentsBrowser !== "undefined") { if (typeof myAttachmentsBrowser !== "undefined") {
wp.media.view.AttachmentsBrowser = wp.media.view.AttachmentsBrowser.extend({ wp.media.view.AttachmentsBrowser = wp.media.view.AttachmentsBrowser.extend({
@@ -1011,7 +1087,9 @@ var wpmfFoldersModule = void 0,
} }
// order image gallery // order image gallery
var myMediaControllerGalleryEdit = wp.media.controller.GalleryEdit; if (typeof wp.media !== "undefined" && typeof wp.media.controller !== "undefined" && typeof wp.media.controller.GalleryEdit !== "undefined") {
var myMediaControllerGalleryEdit = wp.media.controller.GalleryEdit;
}
if (typeof myMediaControllerGalleryEdit !== "undefined") { if (typeof myMediaControllerGalleryEdit !== "undefined") {
wp.media.controller.GalleryEdit = wp.media.controller.GalleryEdit.extend({ wp.media.controller.GalleryEdit = wp.media.controller.GalleryEdit.extend({
gallerySettings: function gallerySettings(browser) { gallerySettings: function gallerySettings(browser) {
@@ -1063,7 +1141,9 @@ var wpmfFoldersModule = void 0,
} }
// Reload folders after searching // Reload folders after searching
var mySearch = wp.media.view.Search; if (typeof wp.media !== "undefined" && typeof wp.media.view !== "undefined" && typeof wp.media.view.Search !== "undefined") {
var mySearch = wp.media.view.Search;
}
var search_initialized = false; var search_initialized = false;
if (typeof mySearch !== "undefined") { if (typeof mySearch !== "undefined") {
wp.media.view.Search = wp.media.view.Search.extend({ wp.media.view.Search = wp.media.view.Search.extend({
@@ -1502,7 +1582,7 @@ var wpmfFoldersModule = void 0,
} }
if (parseInt(wpmf.vars.wpmf_post_type) !== 1 || !$('#wpb_visual_composer').is(":visible")) { if (parseInt(wpmf.vars.wpmf_post_type) !== 1 || !$('#wpb_visual_composer').is(":visible")) {
if (typeof wp.media.frame !== 'undefined' && typeof wp.media.frame._state !== 'undefined') { if (typeof wp.media !== 'undefined' && typeof wp.media.frame !== 'undefined' && typeof wp.media.frame._state !== 'undefined') {
var first_file = files[0]; var first_file = files[0];
var relativePath = first_file.relativePath; var relativePath = first_file.relativePath;
var relativePaths = relativePath.split('/'); var relativePaths = relativePath.split('/');
@@ -87,7 +87,12 @@ class WpMediaFolder
add_filter('wp_prepare_attachment_for_js', array($this, 'svgsResponseForSvg'), 10, 3); add_filter('wp_prepare_attachment_for_js', array($this, 'svgsResponseForSvg'), 10, 3);
add_filter('wp_prepare_attachment_for_js', array($this, 'prepareAttachmentForJs'), 10, 3); add_filter('wp_prepare_attachment_for_js', array($this, 'prepareAttachmentForJs'), 10, 3);
add_action('admin_footer', array($this, 'editorFooter')); add_action('admin_footer', array($this, 'editorFooter'));
$format_mediatitle = wpmfGetOption('format_mediatitle');
$format_mediatitle = 1;
$settings = get_option('wpmf_settings');
if (isset($settings) && isset($settings['format_mediatitle'])) {
$format_mediatitle = $settings['format_mediatitle'];
}
if ((int) $format_mediatitle === 1) { if ((int) $format_mediatitle === 1) {
add_action('add_attachment', array($this, 'updateFileTitle')); add_action('add_attachment', array($this, 'updateFileTitle'));
} }
@@ -121,6 +126,7 @@ class WpMediaFolder
add_action('pre_get_posts', array($this, 'addTagFilter'), 10, 1); add_action('pre_get_posts', array($this, 'addTagFilter'), 10, 1);
add_filter('attachment_fields_to_edit', array($this, 'changeTagSlugToName'), 10, 2); add_filter('attachment_fields_to_edit', array($this, 'changeTagSlugToName'), 10, 2);
add_filter('attachment_fields_to_edit', array($this, 'addTagHelps'), 10, 2); add_filter('attachment_fields_to_edit', array($this, 'addTagHelps'), 10, 2);
add_action('pre_delete_attachment', array($this, 'deleteAttachmentCloud'), 11, 2);
} }
/** /**
@@ -3489,9 +3495,31 @@ class WpMediaFolder
$attach_data = wp_generate_attachment_metadata($id_file, $file_dir . $newname); $attach_data = wp_generate_attachment_metadata($id_file, $file_dir . $newname);
wp_update_attachment_metadata($id_file, $attach_data); wp_update_attachment_metadata($id_file, $attach_data);
} }
//check is cloud
$id_category_new = $id_category;
$parent = $this->getFolderParent($id_category, $id_category);
$cloud_folder_type = wpmfGetCloudFolderType($parent);
if ($cloud_folder_type !== 'local') {
$id_category = 0;
}
do_action('wpmf_add_attachment', $id_file, $id_category); do_action('wpmf_add_attachment', $id_file, $id_category);
// set attachment to term // set attachment to term
wp_set_object_terms((int)$id_file, (int)$id_category, WPMF_TAXO, false); wp_set_object_terms((int)$id_file, (int)$id_category_new, WPMF_TAXO, false);
if ($cloud_folder_type !== 'local') {
// check current folder
$current_category = 0;
// compability with WPML plugin
WpmfHelper::moveFileWpml($id_file, $current_category, $parent);
wp_remove_object_terms((int) $id_file, $current_category, WPMF_TAXO);
$params = array('trigger' => 'move_attachment');
$params['local_to_cloud'] = 1;
do_action('wpmf_attachment_set_folder', $id_file, (int)$parent, $params);
}
wp_send_json(array('status' => true, 'id_file' => $id_file, 'name' => $newname, 'id_category' => $id_category)); wp_send_json(array('status' => true, 'id_file' => $id_file, 'name' => $newname, 'id_category' => $id_category));
@@ -3690,6 +3718,21 @@ class WpMediaFolder
if (is_wp_error($inserted)) { if (is_wp_error($inserted)) {
wp_send_json(array('status' => false, 'msg' => $inserted->get_error_message())); wp_send_json(array('status' => false, 'msg' => $inserted->get_error_message()));
} else { } else {
// create physical folder
$folder_options = get_option('wpmf_queue_options');
if (isset($folder_options['enable_physical_folders']) && !empty($folder_options['enable_physical_folders'])) {
$cat_path = get_term_parents_list($inserted['term_id'], WPMF_TAXO, array(
'separator' => '/',
'link' => false,
'format' => 'name',
));
$upload_dir = wp_upload_dir();
$folder_dir = $upload_dir['basedir'] . '/' . trim($cat_path, '/');
if (!file_exists($folder_dir)) {
wp_mkdir_p($folder_dir);
}
}
// update term_group for new term // update term_group for new term
$updateted = wp_update_term($inserted['term_id'], WPMF_TAXO, array('term_group' => $user_id)); $updateted = wp_update_term($inserted['term_id'], WPMF_TAXO, array('term_group' => $user_id));
$termInfos = get_term($updateted['term_id'], WPMF_TAXO); $termInfos = get_term($updateted['term_id'], WPMF_TAXO);
@@ -3826,11 +3869,12 @@ class WpMediaFolder
/** /**
* Do remove multiple folders * Do remove multiple folders
* *
* @param string $folder_list Folder list id * @param string $folder_list Folder list id
* @param boolean $remove_on_cloud Remove file on cloud
* *
* @return boolean * @return boolean
*/ */
public function doRemoveFolders($folder_list) public function doRemoveFolders($folder_list, $remove_on_cloud = true)
{ {
$wpmf_list_sync_media = get_option('wpmf_list_sync_media'); $wpmf_list_sync_media = get_option('wpmf_list_sync_media');
$wpmf_ao_lastRun = get_option('wpmf_ao_lastRun'); $wpmf_ao_lastRun = get_option('wpmf_ao_lastRun');
@@ -3877,7 +3921,9 @@ class WpMediaFolder
$type = get_term_meta((int) $sub_folder_id, 'wpmf_drive_root_type', true); $type = get_term_meta((int) $sub_folder_id, 'wpmf_drive_root_type', true);
if (empty($type)) { if (empty($type)) {
$term = get_term($sub_folder_id, WPMF_TAXO); $term = get_term($sub_folder_id, WPMF_TAXO);
do_action('wpmf_before_delete_folder', $term); if ($remove_on_cloud) {
do_action('wpmf_before_delete_folder', $term);
}
wp_delete_term($sub_folder_id, WPMF_TAXO); wp_delete_term($sub_folder_id, WPMF_TAXO);
/** /**
* Delete a folder * Delete a folder
@@ -3904,6 +3950,9 @@ class WpMediaFolder
} }
} else { } else {
foreach ($attachments as $attachment_id) { foreach ($attachments as $attachment_id) {
if (!$remove_on_cloud) {
remove_action('pre_delete_attachment', array($this, 'deleteAttachmentCloud'), 11);
}
wp_delete_attachment($attachment_id); wp_delete_attachment($attachment_id);
} }
@@ -5895,31 +5944,31 @@ class WpMediaFolder
$option_cloud_google_drive = get_option(self::$option_google_drive_config); $option_cloud_google_drive = get_option(self::$option_google_drive_config);
$folder_google_drive = get_terms(array('name' => 'Google Drive', 'parent' => 0, 'hide_empty' => false, 'taxonomy' => WPMF_TAXO)); $folder_google_drive = get_terms(array('name' => 'Google Drive', 'parent' => 0, 'hide_empty' => false, 'taxonomy' => WPMF_TAXO));
if (!is_wp_error($folder_google_drive) && $folder_google_drive && (!isset($option_cloud_google_drive['connected']) || $option_cloud_google_drive['connected'] !== 1)) { if (!is_wp_error($folder_google_drive) && $folder_google_drive && (!isset($option_cloud_google_drive['connected']) || $option_cloud_google_drive['connected'] !== 1)) {
$this->doRemoveFolders($folder_google_drive[0]->term_id); $this->doRemoveFolders($folder_google_drive[0]->term_id, false);
} }
//on Dropbox //on Dropbox
$option_cloud_dropbox = get_option(self::$option_dropbox_config); $option_cloud_dropbox = get_option(self::$option_dropbox_config);
$folder_dropbox = get_terms(array('name' => 'Dropbox', 'parent' => 0, 'hide_empty' => false, 'taxonomy' => WPMF_TAXO)); $folder_dropbox = get_terms(array('name' => 'Dropbox', 'parent' => 0, 'hide_empty' => false, 'taxonomy' => WPMF_TAXO));
if (!is_wp_error($folder_dropbox) && $folder_dropbox && empty($option_cloud_dropbox['dropboxToken'])) { if (!is_wp_error($folder_dropbox) && $folder_dropbox && empty($option_cloud_dropbox['dropboxToken'])) {
$this->doRemoveFolders((int)$folder_dropbox[0]->term_id); $this->doRemoveFolders((int)$folder_dropbox[0]->term_id, false);
} }
//on One Drive //on One Drive
$option_cloud_one_drive = get_option(self::$option_one_drive_config); $option_cloud_one_drive = get_option(self::$option_one_drive_config);
$folder_one_drive = get_terms(array('name' => 'Onedrive', 'parent' => 0, 'hide_empty' => false, 'taxonomy' => WPMF_TAXO)); $folder_one_drive = get_terms(array('name' => 'Onedrive', 'parent' => 0, 'hide_empty' => false, 'taxonomy' => WPMF_TAXO));
if (!is_wp_error($folder_one_drive) && $folder_one_drive && !isset($option_cloud_one_drive['connected'])) { if (!is_wp_error($folder_one_drive) && $folder_one_drive && !isset($option_cloud_one_drive['connected'])) {
$this->doRemoveFolders((int)$folder_one_drive[0]->term_id); $this->doRemoveFolders((int)$folder_one_drive[0]->term_id, false);
} }
//on One Drive business //on One Drive business
$option_cloud_one_drive_business = get_option(self::$option_one_drive_business_config); $option_cloud_one_drive_business = get_option(self::$option_one_drive_business_config);
$folder_one_drive_business = get_terms(array('name' => 'Onedrive Business', 'parent' => 0, 'hide_empty' => false, 'taxonomy' => WPMF_TAXO)); $folder_one_drive_business = get_terms(array('name' => 'Onedrive Business', 'parent' => 0, 'hide_empty' => false, 'taxonomy' => WPMF_TAXO));
if (!is_wp_error($folder_one_drive_business) && $folder_one_drive_business && !isset($option_cloud_one_drive_business['connected'])) { if (!is_wp_error($folder_one_drive_business) && $folder_one_drive_business && !isset($option_cloud_one_drive_business['connected'])) {
$this->doRemoveFolders((int)$folder_one_drive_business[0]->term_id); $this->doRemoveFolders((int)$folder_one_drive_business[0]->term_id, false);
} }
//on Next Cloud //on Next Cloud
$connect_nextcloud = wpmfGetOption('connect_nextcloud'); $connect_nextcloud = wpmfGetOption('connect_nextcloud');
$folder_next_cloud = get_terms(array('name' => 'Nextcloud', 'parent' => 0, 'hide_empty' => false, 'taxonomy' => WPMF_TAXO)); $folder_next_cloud = get_terms(array('name' => 'Nextcloud', 'parent' => 0, 'hide_empty' => false, 'taxonomy' => WPMF_TAXO));
if (!is_wp_error($folder_next_cloud) && $folder_next_cloud && empty($connect_nextcloud)) { if (!is_wp_error($folder_next_cloud) && $folder_next_cloud && empty($connect_nextcloud)) {
$this->doRemoveFolders((int)$folder_next_cloud[0]->term_id); $this->doRemoveFolders((int)$folder_next_cloud[0]->term_id, false);
} }
} }
@@ -6033,4 +6082,17 @@ class WpMediaFolder
return $form_fields; return $form_fields;
} }
/**
* Delete file on cloud
*
* @param object $null Null.
* @param object $post Post.
*
* @return void
*/
public function deleteAttachmentCloud($null, $post)
{
do_action('wpmf_delete_attachment_cloud', $post->ID);
}
} }
@@ -176,9 +176,7 @@ class JUQueueActions
'update_database' => false, 'update_database' => false,
'action' => 'wpmf_physical_folders' 'action' => 'wpmf_physical_folders'
); );
if (!isset($_POST['no_move']) && wp_verify_nonce($_POST['wpmf_nonce'], 'wpmf_nonce')) { JUQueueHelper::moveFile($datas);
JUQueueHelper::moveFile($datas);
}
} }
if (isset($data['file']) && isset($destination) && $destination) { if (isset($data['file']) && isset($destination) && $destination) {
@@ -3,7 +3,7 @@ Tags: media, folder
Requires at least: 4.7.0 Requires at least: 4.7.0
Tested up to: 6.7 Tested up to: 6.7
Requires PHP: 5.6 Requires PHP: 5.6
Stable tag: 5.9.11 Stable tag: 5.9.12
License: GPLv2 or later License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -20,6 +20,10 @@ Stop searching for an image through thousand of media, just navigate like you do
= Changelog = = Changelog =
= 5.9.12 =
* Fix : Thumbnail display issue on file uploads in some cases
* Fix : Error physical folder upload
= 5.9.11 = = 5.9.11 =
* Fix : Disable warning _load_textdomain_just_in_time in WordPress 6.7 * Fix : Disable warning _load_textdomain_just_in_time in WordPress 6.7
* Fix : Error when missing required PHP DOM extension * Fix : Error when missing required PHP DOM extension
@@ -163,7 +163,7 @@ class JUCheckRequirements
if (!function_exists('get_plugin_data')) { if (!function_exists('get_plugin_data')) {
include_once(ABSPATH . 'wp-admin/includes/plugin.php'); include_once(ABSPATH . 'wp-admin/includes/plugin.php');
} }
$addonData = get_plugin_data(WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . self::$path, false); $addonData = get_plugin_data(WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . self::$path, false, false);
self::$version = isset($addonData['Version']) ? $addonData['Version'] : null; self::$version = isset($addonData['Version']) ? $addonData['Version'] : null;
} }
@@ -201,7 +201,7 @@ class JUCheckRequirements
} }
/* translators: Plugins name and requirement module name */ /* translators: Plugins name and requirement module name */
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText
$message = __('<strong>%s</strong> requires php extension <strong>%s</strong> installed.' . $additionsMessage, self::$namedomain); $message = '<strong>%s</strong> requires php extension <strong>%s</strong> installed.' . $additionsMessage;
self::addText( self::addText(
$type, $type,
sprintf(strip_tags($message, '<strong>'), self::$name, $module) sprintf(strip_tags($message, '<strong>'), self::$name, $module)
@@ -228,7 +228,7 @@ class JUCheckRequirements
} }
/* translators: Plugins name and requirement class name */ /* translators: Plugins name and requirement class name */
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText
$message = __('<strong>%s</strong> requires php class <strong>%s</strong> to be enable.' . $additionsMessage, self::$namedomain); $message = '<strong>%s</strong> requires php class <strong>%s</strong> to be enable.' . $additionsMessage;
self::addText( self::addText(
$type, $type,
sprintf(strip_tags($message, '<strong>'), self::$name, $class) sprintf(strip_tags($message, '<strong>'), self::$name, $class)
@@ -254,7 +254,7 @@ class JUCheckRequirements
} }
/* translators: Plugins name and requirement function name */ /* translators: Plugins name and requirement function name */
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText
$message = __('<strong>%s</strong> requires php function <strong>%s</strong> to be enable.' . $additionsMessage, self::$namedomain); $message = '<strong>%s</strong> requires php function <strong>%s</strong> to be enable.' . $additionsMessage;
self::addText( self::addText(
$type, $type,
sprintf(strip_tags($message, '<strong>'), self::$name, $function) sprintf(strip_tags($message, '<strong>'), self::$name, $function)
@@ -274,7 +274,7 @@ class JUCheckRequirements
if (version_compare(PHP_VERSION, self::$requirePhpVersion, '<')) { if (version_compare(PHP_VERSION, self::$requirePhpVersion, '<')) {
/* translators: Plugins name and version */ /* translators: Plugins name and version */
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText
$message = __('<strong>%1$s</strong> need at least PHP %2$s version, please update php before installing the plugin.', self::$namedomain); $message = '<strong>%1$s</strong> need at least PHP %2$s version, please update php before installing the plugin.';
self::addText( self::addText(
'error', 'error',
sprintf(strip_tags($message, '<strong>'), self::$name, self::$requirePhpVersion) sprintf(strip_tags($message, '<strong>'), self::$name, self::$requirePhpVersion)
@@ -300,7 +300,7 @@ class JUCheckRequirements
if (!is_plugin_active($plugin['path'])) { if (!is_plugin_active($plugin['path'])) {
/* translators: Plugins name and plugin requirement name */ /* translators: Plugins name and plugin requirement name */
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText
$message = __('<strong>%1$s</strong> requires <strong>%2$s</strong> plugin to be activated.', self::$namedomain); $message = '<strong>%1$s</strong> requires <strong>%2$s</strong> plugin to be activated.';
self::addText( self::addText(
isset($plugin['type']) ? $plugin['type'] : 'error', isset($plugin['type']) ? $plugin['type'] : 'error',
sprintf(strip_tags($message, '<strong>'), self::$name, $plugin['name']) sprintf(strip_tags($message, '<strong>'), self::$name, $plugin['name'])
@@ -311,13 +311,13 @@ class JUCheckRequirements
// Check minimum of require plugin version if set // Check minimum of require plugin version if set
if (isset($plugin['requireVersion']) && $plugin['requireVersion'] !== '') { if (isset($plugin['requireVersion']) && $plugin['requireVersion'] !== '') {
$requireVersion = $plugin['requireVersion']; $requireVersion = $plugin['requireVersion'];
$addonData = get_plugin_data($pluginPath, false); $addonData = get_plugin_data($pluginPath, false, false);
$installedVersion = (isset($addonData['Version']) && strpos($addonData['Version'], '{{version') === false) ? $addonData['Version'] : null; $installedVersion = (isset($addonData['Version']) && strpos($addonData['Version'], '{{version') === false) ? $addonData['Version'] : null;
if ($installedVersion !== null) { if ($installedVersion !== null) {
if (self::versionCompare((string) $installedVersion, '<', (string) $requireVersion)) { if (self::versionCompare((string) $installedVersion, '<', (string) $requireVersion)) {
/* translators: Plugins name and requirement function name */ /* translators: Plugins name and requirement function name */
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText
$message = __('<strong>%1$s %2$s</strong> requires at least <strong>%3$s %4$s</strong>.', self::$namedomain); $message = '<strong>%1$s %2$s</strong> requires at least <strong>%3$s %4$s</strong>.';
self::addText( self::addText(
'error', 'error',
sprintf(strip_tags($message, '<strong>'), self::$name, self::$version, $plugin['name'], $requireVersion) sprintf(strip_tags($message, '<strong>'), self::$name, self::$version, $plugin['name'], $requireVersion)
@@ -356,13 +356,13 @@ class JUCheckRequirements
if (function_exists('get_plugin_data')) { if (function_exists('get_plugin_data')) {
$pluginPath = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $addonPath; $pluginPath = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $addonPath;
if (file_exists($pluginPath)) { if (file_exists($pluginPath)) {
$addonData = get_plugin_data($pluginPath, false); $addonData = get_plugin_data($pluginPath, false, false);
$addonVersion = (isset($addonData['Version']) && strpos($addonData['Version'], '{{version') === false) ? $addonData['Version'] : null; $addonVersion = (isset($addonData['Version']) && strpos($addonData['Version'], '{{version') === false) ? $addonData['Version'] : null;
if ($addonVersion !== null) { if ($addonVersion !== null) {
if (self::versionCompare($addonVersion, '<', $requireVersion)) { if (self::versionCompare($addonVersion, '<', $requireVersion)) {
/* translators: Plugins name and requirement function name */ /* translators: Plugins name and requirement function name */
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText
$message = __('Minimum required version of <strong>%1$s is %2$s</strong> to work with <strong>%3$s %4$s</strong>. Please update the plugin automatically or manually by downloading the latest version from JoomUnited website.', self::$namedomain); $message = 'Minimum required version of <strong>%1$s is %2$s</strong> to work with <strong>%3$s %4$s</strong>. Please update the plugin automatically or manually by downloading the latest version from JoomUnited website.';
self::addText( self::addText(
'warning', 'warning',
sprintf(strip_tags($message, '<strong>'), $addonData['Name'], $requireVersion, self::$name, self::$version) sprintf(strip_tags($message, '<strong>'), $addonData['Name'], $requireVersion, self::$name, self::$version)
@@ -4,7 +4,7 @@
Plugin URI: http://www.joomunited.com Plugin URI: http://www.joomunited.com
Description: WP media Folder is a WordPress plugin that enhance the WordPress media manager by adding a folder manager inside. Description: WP media Folder is a WordPress plugin that enhance the WordPress media manager by adding a folder manager inside.
Author: Joomunited Author: Joomunited
Version: 5.9.11 Version: 5.9.12
Update URI: https://www.joomunited.com/juupdater_files/wp-media-folder.json Update URI: https://www.joomunited.com/juupdater_files/wp-media-folder.json
Author URI: http://www.joomunited.com Author URI: http://www.joomunited.com
Text Domain: wpmf Text Domain: wpmf
@@ -79,7 +79,7 @@ if (!defined('WPMF_TAXO')) {
define('_WPMF_GALLERY_PREFIX', '_wpmf_gallery_'); define('_WPMF_GALLERY_PREFIX', '_wpmf_gallery_');
define('WPMF_PLUGIN_URL', plugin_dir_url(__FILE__)); define('WPMF_PLUGIN_URL', plugin_dir_url(__FILE__));
define('WPMF_DOMAIN', 'wpmf'); define('WPMF_DOMAIN', 'wpmf');
define('WPMF_VERSION', '5.9.11'); define('WPMF_VERSION', '5.9.12');
define('WPMF_HIDE_USER_MEDIA_FOLDER_ROOT', true); define('WPMF_HIDE_USER_MEDIA_FOLDER_ROOT', true);
// disable warning function _load_textdomain_just_in_time was called incorrectly // disable warning function _load_textdomain_just_in_time was called incorrectly
@@ -245,15 +245,17 @@ if (is_admin()) {
* ***** DO NOT REMOVE ***** * ***** DO NOT REMOVE *****
* End translate for queue class * End translate for queue class
*/ */
$args = wpmfGetQueueOptions(false); add_action('init', function () {
$wpmfQueue = call_user_func('\Joomunited\Queue\JuMainQueue::getInstance', 'wpmf'); $args = wpmfGetQueueOptions(false);
$wpmfQueue->init($args); $wpmfQueue = call_user_func('\Joomunited\Queue\JuMainQueue::getInstance', 'wpmf');
$folder_options = get_option('wpmf_queue_options'); $wpmfQueue->init($args);
if (!empty($folder_options['enable_physical_folders'])) { $folder_options = get_option('wpmf_queue_options');
require_once WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/physical-folder' . DIRECTORY_SEPARATOR . 'wpmf.php'; if (!empty($folder_options['enable_physical_folders'])) {
new JUQueueActions(); require_once WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/physical-folder' . DIRECTORY_SEPARATOR . 'wpmf.php';
require_once WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/physical-folder' . DIRECTORY_SEPARATOR . 'helper.php'; new JUQueueActions();
} require_once WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/physical-folder' . DIRECTORY_SEPARATOR . 'helper.php';
}
});
add_action( add_action(
'wpmf_before_delete_folder', 'wpmf_before_delete_folder',
@@ -286,50 +288,66 @@ if (is_admin()) {
} }
} }
}, 10); }, 10);
add_action('wpmf_delete_attachment', function ($id) {
$queue_id = get_post_meta($id, 'wpmf_sync_queue', true);
$wpmfQueue = \Joomunited\Queue\JuMainQueue::getInstance('wpmf');
if (!empty($queue_id)) {
if (is_array($queue_id)) {
foreach ($queue_id as $queueID) {
$wpmfQueue->deleteQueue($queueID);
}
} else {
$wpmfQueue->deleteQueue($queue_id);
}
}
}, 10);
} }
if (!class_exists('\Joomunited\WPMF\JUCheckRequirements')) { add_action('init', function () {
require_once(trailingslashit(dirname(__FILE__)) . 'requirements.php'); if (!class_exists('\Joomunited\WPMF\JUCheckRequirements')) {
} require_once(trailingslashit(dirname(__FILE__)) . 'requirements.php');
if (class_exists('\Joomunited\WPMF\JUCheckRequirements')) {
// Plugins name for translate
$args = array(
'plugin_name' => esc_html__('WP Media Folder', 'wpmf'),
'plugin_path' => wpmfGetPath(),
'plugin_textdomain' => 'wpmf',
'requirements' => array(
'php_version' => '5.6',
'php_modules' => array(
'curl' => 'warning'
),
'functions' => array(
'gd_info' => 'warning'
),
// Minimum addons version
'addons_version' => array(
'wpmfAddons' => '3.6.9',
'wpmfGalleryAddons' => '2.4.6'
)
),
);
$wpmfCheck = call_user_func('\Joomunited\WPMF\JUCheckRequirements::init', $args);
if (!$wpmfCheck['success']) {
// Do not load anything more
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- No action, nonce is not required
unset($_GET['activate']);
return;
} }
if (isset($wpmfCheck) && !empty($wpmfCheck['load'])) { if (class_exists('\Joomunited\WPMF\JUCheckRequirements')) {
foreach ($wpmfCheck['load'] as $addonName) { // Plugins name for translate
if (function_exists($addonName . 'Init')) { $args = array(
call_user_func($addonName . 'Init'); 'plugin_name' => esc_html__('WP Media Folder', 'wpmf'),
'plugin_path' => wpmfGetPath(),
'plugin_textdomain' => 'wpmf',
'requirements' => array(
'php_version' => '7.4',
'php_modules' => array(
'curl' => 'warning'
),
'functions' => array(
'gd_info' => 'warning'
),
// Minimum addons version
'addons_version' => array(
'wpmfAddons' => '3.6.9',
'wpmfGalleryAddons' => '2.4.6'
)
),
);
$wpmfCheck = call_user_func('\Joomunited\WPMF\JUCheckRequirements::init', $args);
if (!$wpmfCheck['success']) {
// Do not load anything more
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- No action, nonce is not required
unset($_GET['activate']);
return;
}
if (isset($wpmfCheck) && !empty($wpmfCheck['load'])) {
foreach ($wpmfCheck['load'] as $addonName) {
if (function_exists($addonName . 'Init')) {
call_user_func($addonName . 'Init');
}
} }
} }
} }
} });
/** /**
* Get queue options * Get queue options
@@ -890,6 +908,7 @@ function wpmfGetOption($option_name)
require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-helper.php'); require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-helper.php');
$frontend = get_option('wpmf_option_mediafolder'); $frontend = get_option('wpmf_option_mediafolder');
if (!empty($frontend) || is_admin()) { if (!empty($frontend) || is_admin()) {
global $wpmfwatermark; global $wpmfwatermark;
require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-main.php'); require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-main.php');
@@ -1252,8 +1271,10 @@ if (isset($enable_gallery) && (int) $enable_gallery === 1) {
} }
if (is_admin()) { if (is_admin()) {
require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-wp-folder-option.php'); add_action('init', function () {
new WpmfMediaFolderOption; require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-wp-folder-option.php');
new WpmfMediaFolderOption;
});
} }
$wpmf_option_singlefile = get_option('wpmf_option_singlefile'); $wpmf_option_singlefile = get_option('wpmf_option_singlefile');
@@ -1271,12 +1292,14 @@ if (isset($wpmf_option_lightboximage) && (int) $wpmf_option_lightboximage === 1)
require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-pdf-embed.php'); require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-pdf-embed.php');
new WpmfPdfEmbed(); new WpmfPdfEmbed();
// load gif file on page load or not add_action('init', function () {
$load_gif = wpmfGetOption('load_gif'); // load gif file on page load or not
if (isset($load_gif) && (int) $load_gif === 0) { $load_gif = wpmfGetOption('load_gif');
require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-load-gif.php'); if (isset($load_gif) && (int) $load_gif === 0) {
new WpmfLoadGif(); require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-load-gif.php');
} new WpmfLoadGif();
}
});
require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-folder-post-type.php'); require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-folder-post-type.php');
new WpmfMediaFolderPostType(); new WpmfMediaFolderPostType();
@@ -1636,10 +1659,13 @@ function wpmfRenderVideoIcon($attachment_id)
return ''; return '';
} }
$remote_video = wpmfGetOption('hide_remote_video'); add_action('init', function () {
if ($remote_video) { $remote_video = wpmfGetOption('hide_remote_video');
add_filter('the_content', 'wpmfFindImages'); if ($remote_video) {
} add_filter('the_content', 'wpmfFindImages');
}
});
/** /**
* Find image in content * Find image in content
@@ -1707,7 +1733,7 @@ function wpmfFindImages($content)
} }
} }
} }
// otherwise returns the database content // otherwise returns the database content
return $content; return $content;
} }
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+4 -11
View File
@@ -103,20 +103,13 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
return new WP_Error( 'error_loading_image', __( 'File does not exist?' ), $this->file ); return new WP_Error( 'error_loading_image', __( 'File does not exist?' ), $this->file );
} }
// WebP may not work with imagecreatefromstring(). // Handle WebP and AVIF mime types explicitly, falling back to imagecreatefromstring.
if ( if (
function_exists( 'imagecreatefromwebp' ) && function_exists( 'imagecreatefromwebp' ) && ( 'image/webp' === wp_get_image_mime( $this->file ) )
( 'image/webp' === wp_get_image_mime( $this->file ) )
) { ) {
$this->image = @imagecreatefromwebp( $this->file ); $this->image = @imagecreatefromwebp( $this->file );
} else { } elseif (
$this->image = @imagecreatefromstring( $file_contents ); function_exists( 'imagecreatefromavif' ) && ( 'image/avif' === wp_get_image_mime( $this->file ) )
}
// AVIF may not work with imagecreatefromstring().
if (
function_exists( 'imagecreatefromavif' ) &&
( 'image/avif' === wp_get_image_mime( $this->file ) )
) { ) {
$this->image = @imagecreatefromavif( $this->file ); $this->image = @imagecreatefromavif( $this->file );
} else { } else {
@@ -153,6 +153,16 @@ class WP_Textdomain_Registry {
* @param string $path Language directory path. * @param string $path Language directory path.
*/ */
public function set_custom_path( $domain, $path ) { public function set_custom_path( $domain, $path ) {
// If just-in-time loading was triggered before, reset the entry so it can be tried again.
if ( isset( $this->all[ $domain ] ) ) {
$this->all[ $domain ] = array_filter( $this->all[ $domain ] );
}
if ( empty( $this->current[ $domain ] ) ) {
unset( $this->current[ $domain ] );
}
$this->custom_paths[ $domain ] = rtrim( $path, '/' ); $this->custom_paths[ $domain ] = rtrim( $path, '/' );
} }
@@ -336,7 +346,7 @@ class WP_Textdomain_Registry {
* If no path is found for the given locale and a custom path has been set * If no path is found for the given locale and a custom path has been set
* using load_plugin_textdomain/load_theme_textdomain, use that one. * using load_plugin_textdomain/load_theme_textdomain, use that one.
*/ */
if ( 'en_US' !== $locale && isset( $this->custom_paths[ $domain ] ) ) { if ( isset( $this->custom_paths[ $domain ] ) ) {
$fallback_location = rtrim( $this->custom_paths[ $domain ], '/' ) . '/'; $fallback_location = rtrim( $this->custom_paths[ $domain ], '/' ) . '/';
$this->set( $domain, $locale, $fallback_location ); $this->set( $domain, $locale, $fallback_location );
return $fallback_location; return $fallback_location;
+1
View File
@@ -611,6 +611,7 @@ add_action( 'wp_footer', 'wp_enqueue_stored_styles', 1 );
add_action( 'wp_default_styles', 'wp_default_styles' ); add_action( 'wp_default_styles', 'wp_default_styles' );
add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 ); add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 );
add_action( 'wp_head', 'wp_print_auto_sizes_contain_css_fix', 1 );
add_action( 'wp_head', 'wp_maybe_inline_styles', 1 ); // Run for styles enqueued in <head>. add_action( 'wp_head', 'wp_maybe_inline_styles', 1 ); // Run for styles enqueued in <head>.
add_action( 'wp_footer', 'wp_maybe_inline_styles', 1 ); // Run for late-loaded styles in the footer. add_action( 'wp_footer', 'wp_maybe_inline_styles', 1 ); // Run for late-loaded styles in the footer.
@@ -1157,6 +1157,33 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
$token_type = $this->get_token_type(); $token_type = $this->get_token_type();
switch ( $token_type ) { switch ( $token_type ) {
case '#doctype':
$doctype = $this->get_doctype_info();
if ( null === $doctype ) {
break;
}
$html .= '<!DOCTYPE';
if ( $doctype->name ) {
$html .= " {$doctype->name}";
}
if ( null !== $doctype->public_identifier ) {
$quote = str_contains( $doctype->public_identifier, '"' ) ? "'" : '"';
$html .= " PUBLIC {$quote}{$doctype->public_identifier}{$quote}";
}
if ( null !== $doctype->system_identifier ) {
if ( null === $doctype->public_identifier ) {
$html .= ' SYSTEM';
}
$quote = str_contains( $doctype->system_identifier, '"' ) ? "'" : '"';
$html .= " {$quote}{$doctype->system_identifier}{$quote}";
}
$html .= '>';
break;
case '#text': case '#text':
$html .= htmlspecialchars( $this->get_modifiable_text(), ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML5, 'UTF-8' ); $html .= htmlspecialchars( $this->get_modifiable_text(), ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML5, 'UTF-8' );
break; break;
@@ -1173,10 +1200,6 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
case '#cdata-section': case '#cdata-section':
$html .= "<![CDATA[{$this->get_modifiable_text()}]]>"; $html .= "<![CDATA[{$this->get_modifiable_text()}]]>";
break; break;
case 'html':
$html .= '<!DOCTYPE html>';
break;
} }
if ( '#tag' !== $token_type ) { if ( '#tag' !== $token_type ) {
@@ -584,7 +584,8 @@ final class WP_Interactivity_API {
} elseif ( is_object( $current ) && isset( $current->$path_segment ) ) { } elseif ( is_object( $current ) && isset( $current->$path_segment ) ) {
$current = $current->$path_segment; $current = $current->$path_segment;
} else { } else {
return null; $current = null;
break;
} }
if ( $current instanceof Closure ) { if ( $current instanceof Closure ) {
@@ -1089,19 +1090,6 @@ HTML;
if ( 'enter' === $mode && ! $this->has_processed_router_region ) { if ( 'enter' === $mode && ! $this->has_processed_router_region ) {
$this->has_processed_router_region = true; $this->has_processed_router_region = true;
/*
* Initialize the `core/router` store.
* If the store is not initialized like this with minimal
* navigation object, the interactivity-router script module
* errors.
*/
$this->state(
'core/router',
array(
'navigation' => new stdClass(),
)
);
// Enqueues as an inline style. // Enqueues as an inline style.
wp_register_style( 'wp-interactivity-router-animations', false ); wp_register_style( 'wp-interactivity-router-animations', false );
wp_add_inline_style( 'wp-interactivity-router-animations', $this->get_router_animation_styles() ); wp_add_inline_style( 'wp-interactivity-router-animations', $this->get_router_animation_styles() );
+2 -1
View File
@@ -47222,7 +47222,8 @@ function PatternList({
return true; return true;
} }
if (selectedCategory === 'uncategorized') { if (selectedCategory === 'uncategorized') {
const hasKnownCategory = pattern.categories.some(category => registeredPatternCategories.includes(category)); var _pattern$categories$s;
const hasKnownCategory = (_pattern$categories$s = pattern.categories?.some(category => registeredPatternCategories.includes(category))) !== null && _pattern$categories$s !== void 0 ? _pattern$categories$s : false;
return !pattern.categories?.length || !hasKnownCategory; return !pattern.categories?.length || !hasKnownCategory;
} }
return pattern.categories?.includes(selectedCategory); return pattern.categories?.includes(selectedCategory);
File diff suppressed because one or more lines are too long
+3 -1
View File
@@ -57454,7 +57454,9 @@ function FormFileUpload({
// @todo: Temporary fix a bug that prevents Chromium browsers from selecting ".heic" files // @todo: Temporary fix a bug that prevents Chromium browsers from selecting ".heic" files
// from the file upload. See https://core.trac.wordpress.org/ticket/62268#comment:4. // from the file upload. See https://core.trac.wordpress.org/ticket/62268#comment:4.
// This can be removed once the Chromium fix is in the stable channel. // This can be removed once the Chromium fix is in the stable channel.
const compatAccept = !!accept?.includes('image/*') ? `${accept}, image/heic, image/heif` : accept; // Prevent Safari from adding "image/heic" and "image/heif" to the accept attribute.
const isSafari = globalThis.window?.navigator.userAgent.includes('Safari') && !globalThis.window?.navigator.userAgent.includes('Chrome') && !globalThis.window?.navigator.userAgent.includes('Chromium');
const compatAccept = !isSafari && !!accept?.includes('image/*') ? `${accept}, image/heic, image/heif` : accept;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "components-form-file-upload", className: "components-form-file-upload",
children: [ui, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { children: [ui, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", {
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -683,7 +683,7 @@ function CreatePatternModalContents({
function getTermLabels(pattern, categories) { function getTermLabels(pattern, categories) {
// Theme patterns rely on core pattern categories. // Theme patterns rely on core pattern categories.
if (pattern.type !== PATTERN_TYPES.user) { if (pattern.type !== PATTERN_TYPES.user) {
return categories.core?.filter(category => pattern.categories.includes(category.name)).map(category => category.label); return categories.core?.filter(category => pattern.categories?.includes(category.name)).map(category => category.label);
} }
return categories.user?.filter(category => pattern.wp_pattern_category.includes(category.id)).map(category => category.label); return categories.user?.filter(category => pattern.wp_pattern_category.includes(category.id)).map(category => category.label);
} }
File diff suppressed because one or more lines are too long
+26 -3
View File
@@ -985,6 +985,9 @@ function load_default_textdomain( $locale = null ) {
* @since 4.6.0 The function now tries to load the .mo file from the languages directory first. * @since 4.6.0 The function now tries to load the .mo file from the languages directory first.
* @since 6.7.0 Translations are no longer immediately loaded, but handed off to the just-in-time loading mechanism. * @since 6.7.0 Translations are no longer immediately loaded, but handed off to the just-in-time loading mechanism.
* *
* @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
* @global array<string, WP_Translations|NOOP_Translations> $l10n An array of all currently loaded text domains.
*
* @param string $domain Unique identifier for retrieving translated strings * @param string $domain Unique identifier for retrieving translated strings
* @param string|false $deprecated Optional. Deprecated. Use the $plugin_rel_path parameter instead. * @param string|false $deprecated Optional. Deprecated. Use the $plugin_rel_path parameter instead.
* Default false. * Default false.
@@ -994,7 +997,8 @@ function load_default_textdomain( $locale = null ) {
*/ */
function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path = false ) { function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path = false ) {
/** @var WP_Textdomain_Registry $wp_textdomain_registry */ /** @var WP_Textdomain_Registry $wp_textdomain_registry */
global $wp_textdomain_registry; /** @var array<string, WP_Translations|NOOP_Translations> $l10n */
global $wp_textdomain_registry, $l10n;
if ( ! is_string( $domain ) ) { if ( ! is_string( $domain ) ) {
return false; return false;
@@ -1011,6 +1015,11 @@ function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path
$wp_textdomain_registry->set_custom_path( $domain, $path ); $wp_textdomain_registry->set_custom_path( $domain, $path );
// If just-in-time loading was triggered before, reset the entry so it can be tried again.
if ( isset( $l10n[ $domain ] ) && $l10n[ $domain ] instanceof NOOP_Translations ) {
unset( $l10n[ $domain ] );
}
return true; return true;
} }
@@ -1022,6 +1031,7 @@ function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path
* @since 6.7.0 Translations are no longer immediately loaded, but handed off to the just-in-time loading mechanism. * @since 6.7.0 Translations are no longer immediately loaded, but handed off to the just-in-time loading mechanism.
* *
* @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry. * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
* @global array<string, WP_Translations|NOOP_Translations> $l10n An array of all currently loaded text domains.
* *
* @param string $domain Text domain. Unique identifier for retrieving translated strings. * @param string $domain Text domain. Unique identifier for retrieving translated strings.
* @param string $mu_plugin_rel_path Optional. Relative to `WPMU_PLUGIN_DIR` directory in which the .mo * @param string $mu_plugin_rel_path Optional. Relative to `WPMU_PLUGIN_DIR` directory in which the .mo
@@ -1030,7 +1040,8 @@ function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path
*/ */
function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) { function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
/** @var WP_Textdomain_Registry $wp_textdomain_registry */ /** @var WP_Textdomain_Registry $wp_textdomain_registry */
global $wp_textdomain_registry; /** @var array<string, WP_Translations|NOOP_Translations> $l10n */
global $wp_textdomain_registry, $l10n;
if ( ! is_string( $domain ) ) { if ( ! is_string( $domain ) ) {
return false; return false;
@@ -1040,6 +1051,11 @@ function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
$wp_textdomain_registry->set_custom_path( $domain, $path ); $wp_textdomain_registry->set_custom_path( $domain, $path );
// If just-in-time loading was triggered before, reset the entry so it can be tried again.
if ( isset( $l10n[ $domain ] ) && $l10n[ $domain ] instanceof NOOP_Translations ) {
unset( $l10n[ $domain ] );
}
return true; return true;
} }
@@ -1056,6 +1072,7 @@ function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
* @since 6.7.0 Translations are no longer immediately loaded, but handed off to the just-in-time loading mechanism. * @since 6.7.0 Translations are no longer immediately loaded, but handed off to the just-in-time loading mechanism.
* *
* @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry. * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
* @global array<string, WP_Translations|NOOP_Translations> $l10n An array of all currently loaded text domains.
* *
* @param string $domain Text domain. Unique identifier for retrieving translated strings. * @param string $domain Text domain. Unique identifier for retrieving translated strings.
* @param string|false $path Optional. Path to the directory containing the .mo file. * @param string|false $path Optional. Path to the directory containing the .mo file.
@@ -1064,7 +1081,8 @@ function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
*/ */
function load_theme_textdomain( $domain, $path = false ) { function load_theme_textdomain( $domain, $path = false ) {
/** @var WP_Textdomain_Registry $wp_textdomain_registry */ /** @var WP_Textdomain_Registry $wp_textdomain_registry */
global $wp_textdomain_registry; /** @var array<string, WP_Translations|NOOP_Translations> $l10n */
global $wp_textdomain_registry, $l10n;
if ( ! is_string( $domain ) ) { if ( ! is_string( $domain ) ) {
return false; return false;
@@ -1076,6 +1094,11 @@ function load_theme_textdomain( $domain, $path = false ) {
$wp_textdomain_registry->set_custom_path( $domain, $path ); $wp_textdomain_registry->set_custom_path( $domain, $path );
// If just-in-time loading was triggered before, reset the entry so it can be tried again.
if ( isset( $l10n[ $domain ] ) && $l10n[ $domain ] instanceof NOOP_Translations ) {
unset( $l10n[ $domain ] );
}
return true; return true;
} }
+50 -2
View File
@@ -1137,8 +1137,12 @@ function wp_get_attachment_image( $attachment_id, $size = 'thumbnail', $icon = f
} }
} }
/** This filter is documented in wp-includes/media.php */
$add_auto_sizes = apply_filters( 'wp_img_tag_add_auto_sizes', true );
// Adds 'auto' to the sizes attribute if applicable. // Adds 'auto' to the sizes attribute if applicable.
if ( if (
$add_auto_sizes &&
isset( $attr['loading'] ) && isset( $attr['loading'] ) &&
'lazy' === $attr['loading'] && 'lazy' === $attr['loading'] &&
isset( $attr['sizes'] ) && isset( $attr['sizes'] ) &&
@@ -1985,6 +1989,17 @@ function wp_filter_content_tags( $content, $context = null ) {
* @return string The filtered image tag markup. * @return string The filtered image tag markup.
*/ */
function wp_img_tag_add_auto_sizes( string $image ): string { function wp_img_tag_add_auto_sizes( string $image ): string {
/**
* Filters whether auto-sizes for lazy loaded images is enabled.
*
* @since 6.7.1
*
* @param boolean $enabled Whether auto-sizes for lazy loaded images is enabled.
*/
if ( ! apply_filters( 'wp_img_tag_add_auto_sizes', true ) ) {
return $image;
}
$processor = new WP_HTML_Tag_Processor( $image ); $processor = new WP_HTML_Tag_Processor( $image );
// Bail if there is no IMG tag. // Bail if there is no IMG tag.
@@ -1993,8 +2008,19 @@ function wp_img_tag_add_auto_sizes( string $image ): string {
} }
// Bail early if the image is not lazy-loaded. // Bail early if the image is not lazy-loaded.
$value = $processor->get_attribute( 'loading' ); $loading = $processor->get_attribute( 'loading' );
if ( ! is_string( $value ) || 'lazy' !== strtolower( trim( $value, " \t\f\r\n" ) ) ) { if ( ! is_string( $loading ) || 'lazy' !== strtolower( trim( $loading, " \t\f\r\n" ) ) ) {
return $image;
}
/*
* Bail early if the image doesn't have a width attribute.
* Per WordPress Core itself, lazy-loaded images should always have a width attribute.
* However, it is possible that lazy-loading could be added by a plugin, where we don't have that guarantee.
* As such, it still makes sense to ensure presence of a width attribute here in order to use `sizes=auto`.
*/
$width = $processor->get_attribute( 'width' );
if ( ! is_string( $width ) || '' === $width ) {
return $image; return $image;
} }
@@ -2029,6 +2055,28 @@ function wp_sizes_attribute_includes_valid_auto( string $sizes_attr ): bool {
return 'auto' === strtolower( trim( $first_size, " \t\f\r\n" ) ); return 'auto' === strtolower( trim( $first_size, " \t\f\r\n" ) );
} }
/**
* Prints a CSS rule to fix potential visual issues with images using `sizes=auto`.
*
* This rule overrides the similar rule in the default user agent stylesheet, to avoid images that use e.g.
* `width: auto` or `width: fit-content` to appear smaller.
*
* @since 6.7.1
* @see https://html.spec.whatwg.org/multipage/rendering.html#img-contain-size
* @see https://core.trac.wordpress.org/ticket/62413
*/
function wp_print_auto_sizes_contain_css_fix() {
/** This filter is documented in wp-includes/media.php */
$add_auto_sizes = apply_filters( 'wp_img_tag_add_auto_sizes', true );
if ( ! $add_auto_sizes ) {
return;
}
?>
<style>img:is([sizes="auto" i], [sizes^="auto," i]) { contain-intrinsic-size: 3000px 1500px }</style>
<?php
}
/** /**
* Adds optimization attributes to an `img` HTML tag. * Adds optimization attributes to an `img` HTML tag.
* *
+10 -10
View File
@@ -2479,16 +2479,7 @@ if ( ! function_exists( 'wp_salt' ) ) :
static $duplicated_keys; static $duplicated_keys;
if ( null === $duplicated_keys ) { if ( null === $duplicated_keys ) {
$duplicated_keys = array( $duplicated_keys = array();
'put your unique phrase here' => true,
);
/*
* translators: This string should only be translated if wp-config-sample.php is localized.
* You can check the localized release package or
* https://i18n.svn.wordpress.org/<locale code>/branches/<wp version>/dist/wp-config-sample.php
*/
$duplicated_keys[ __( 'put your unique phrase here' ) ] = true;
foreach ( array( 'AUTH', 'SECURE_AUTH', 'LOGGED_IN', 'NONCE', 'SECRET' ) as $first ) { foreach ( array( 'AUTH', 'SECURE_AUTH', 'LOGGED_IN', 'NONCE', 'SECRET' ) as $first ) {
foreach ( array( 'KEY', 'SALT' ) as $second ) { foreach ( array( 'KEY', 'SALT' ) as $second ) {
@@ -2499,6 +2490,15 @@ if ( ! function_exists( 'wp_salt' ) ) :
$duplicated_keys[ $value ] = isset( $duplicated_keys[ $value ] ); $duplicated_keys[ $value ] = isset( $duplicated_keys[ $value ] );
} }
} }
$duplicated_keys['put your unique phrase here'] = true;
/*
* translators: This string should only be translated if wp-config-sample.php is localized.
* You can check the localized release package or
* https://i18n.svn.wordpress.org/<locale code>/branches/<wp version>/dist/wp-config-sample.php
*/
$duplicated_keys[ __( 'put your unique phrase here' ) ] = true;
} }
/* /*
+1 -1
View File
@@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.7'; $wp_version = '6.7.1';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.