Skip to content

Commit 5bbcb9c

Browse files
committed
Merge remote-tracking branch 'upstream/trunk' into trunk
2 parents 84c1f50 + d5a3a14 commit 5bbcb9c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+884
-350
lines changed

.github/workflows/upgrade-develop-testing.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,17 @@ jobs:
6363
php: [ '7.2', '8.4' ]
6464
db-type: [ 'mysql' ]
6565
db-version: [ '5.7', '8.4' ]
66-
wp: [ '6.5', '6.6', '6.7' ]
66+
# WordPress 4.9 is the oldest version that supports PHP 7.2.
67+
wp: [ '4.9', '6.5', '6.6', '6.7' ]
6768
multisite: [ false, true ]
6869

6970
exclude:
7071
# The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218.
7172
- php: '7.2'
7273
db-version: '8.4'
74+
# WordPress 4.9 does not support PHP 8.4.
75+
- php: '8.4'
76+
wp: '4.9'
7377
with:
7478
os: ${{ matrix.os }}
7579
php: ${{ matrix.php }}

jsdoc.conf.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"linenums": true
2020
},
2121
"opts": {
22-
"template": "./node_modules/ink-docstrap/template",
2322
"recurse": true,
2423
"private": true
2524
}

package-lock.json

Lines changed: 0 additions & 163 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
"grunt-rtlcss": "~2.0.2",
6060
"grunt-sass": "~4.0.0",
6161
"grunt-webpack": "7.0.0",
62-
"ink-docstrap": "1.3.2",
6362
"install-changed": "1.1.0",
6463
"postcss": "8.5.3",
6564
"prettier": "npm:[email protected]",

src/js/_enqueues/admin/tags.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ jQuery( function($) {
5555
$('a.tag-link-' + data.match(/tag_ID=(\d+)/)[1]).remove();
5656

5757
} else if ( '-1' == r ) {
58-
$('#ajax-response').empty().append('<div class="error"><p>' + wp.i18n.__( 'Sorry, you are not allowed to do that.' ) + '</p></div>');
58+
$('#ajax-response').empty().append('<div class="notice notice-error"><p>' + wp.i18n.__( 'Sorry, you are not allowed to do that.' ) + '</p></div>');
5959
tr.children().css('backgroundColor', '');
6060

6161
} else {
62-
$('#ajax-response').empty().append('<div class="error"><p>' + wp.i18n.__( 'An error occurred while processing your request. Please try again later.' ) + '</p></div>');
62+
$('#ajax-response').empty().append('<div class="notice notice-error"><p>' + wp.i18n.__( 'An error occurred while processing your request. Please try again later.' ) + '</p></div>');
6363
tr.children().css('backgroundColor', '');
6464
}
6565
});

src/js/_enqueues/lib/nav-menu.js

Lines changed: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,13 +1102,53 @@
11021102
}, 500 ) );
11031103

11041104
$('#add-custom-links input[type="text"]').on( 'keypress', function(e){
1105-
$('#customlinkdiv').removeClass('form-invalid');
1105+
$( '#customlinkdiv' ).removeClass( 'form-invalid' );
1106+
$( '#custom-menu-item-url' ).removeAttr( 'aria-invalid' ).removeAttr( 'aria-describedby' );
1107+
$( '#custom-url-error' ).hide();
11061108

11071109
if ( e.keyCode === 13 ) {
11081110
e.preventDefault();
11091111
$( '#submit-customlinkdiv' ).trigger( 'click' );
11101112
}
11111113
});
1114+
1115+
$( '#submit-customlinkdiv' ).on( 'click', function (e) {
1116+
var urlInput = $( '#custom-menu-item-url' ),
1117+
url = urlInput.val().trim(),
1118+
errorMessage = $( '#custom-url-error' ),
1119+
urlWrap = $( '#menu-item-url-wrap' ),
1120+
urlRegex;
1121+
1122+
// Hide the error message initially
1123+
errorMessage.hide();
1124+
urlWrap.removeClass( 'has-error' );
1125+
1126+
/*
1127+
* Allow URLs including:
1128+
* - http://example.com/
1129+
* - //example.com
1130+
* - /directory/
1131+
* - ?query-param
1132+
* - #target
1133+
* - mailto:[email protected]
1134+
*
1135+
* Any further validation will be handled on the server when the setting is attempted to be saved,
1136+
* so this pattern does not need to be complete.
1137+
*/
1138+
urlRegex = /^((\w+:)?\/\/\w.*|\w+:(?!\/\/$)|\/|\?|#)/;
1139+
if ( ! urlRegex.test( url ) ) {
1140+
e.preventDefault();
1141+
urlInput.addClass( 'form-invalid' )
1142+
.attr( 'aria-invalid', 'true' )
1143+
.attr( 'aria-describedby', 'custom-url-error' );
1144+
1145+
errorMessage.show();
1146+
var errorText = errorMessage.text();
1147+
urlWrap.addClass( 'has-error' );
1148+
// Announce error message via screen reader
1149+
wp.a11y.speak( errorText, 'assertive' );
1150+
}
1151+
});
11121152
},
11131153

11141154
/**
@@ -1221,8 +1261,8 @@
12211261
deletionSpeech = menus.itemsDeleted.replace( '%s', itemsPendingDeletion );
12221262
wp.a11y.speak( deletionSpeech, 'polite' );
12231263
that.disableBulkSelection();
1224-
menus.updateParentDropdown();
1225-
menus.updateOrderDropdown();
1264+
$( '#menu-to-edit' ).updateParentDropdown();
1265+
$( '#menu-to-edit' ).updateOrderDropdown();
12261266
}
12271267
});
12281268
},
@@ -1389,15 +1429,29 @@
13891429

13901430
addCustomLink : function( processMethod ) {
13911431
var url = $('#custom-menu-item-url').val().toString(),
1392-
label = $('#custom-menu-item-name').val();
1432+
label = $('#custom-menu-item-name').val(),
1433+
urlRegex;
13931434

13941435
if ( '' !== url ) {
13951436
url = url.trim();
13961437
}
13971438

13981439
processMethod = processMethod || api.addMenuItemToBottom;
13991440

1400-
if ( '' === url || 'https://' == url || 'http://' == url ) {
1441+
/*
1442+
* Allow URLs including:
1443+
* - http://example.com/
1444+
* - //example.com
1445+
* - /directory/
1446+
* - ?query-param
1447+
* - #target
1448+
* - mailto:[email protected]
1449+
*
1450+
* Any further validation will be handled on the server when the setting is attempted to be saved,
1451+
* so this pattern does not need to be complete.
1452+
*/
1453+
urlRegex = /^((\w+:)?\/\/\w.*|\w+:(?!\/\/$)|\/|\?|#)/;
1454+
if ( ! urlRegex.test( url ) ) {
14011455
$('#customlinkdiv').addClass('form-invalid');
14021456
return false;
14031457
}
@@ -1762,8 +1816,8 @@
17621816
}
17631817
api.refreshAdvancedAccessibility();
17641818
wp.a11y.speak( menus.itemRemoved );
1765-
menus.updateParentDropdown();
1766-
menus.updateOrderDropdown();
1819+
$( '#menu-to-edit' ).updateParentDropdown();
1820+
$( '#menu-to-edit' ).updateOrderDropdown();
17671821
});
17681822
},
17691823

src/js/_enqueues/vendor/plupload/handlers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function prepareMediaItemInit( fileObj ) {
204204

205205
// Generic error message.
206206
function wpQueueError( message ) {
207-
jQuery( '#media-upload-error' ).show().html( '<div class="error"><p>' + message + '</p></div>' );
207+
jQuery( '#media-upload-error' ).show().html( '<div class="notice notice-error"><p>' + message + '</p></div>' );
208208
}
209209

210210
// File-specific error messages.

0 commit comments

Comments
 (0)