Skip to content

Commit 33811f9

Browse files
authored
Merge branch 'trunk' into remove-ie-conditionals
2 parents 185f311 + ce984ff commit 33811f9

File tree

96 files changed

+4101
-1243
lines changed

Some content is hidden

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

96 files changed

+4101
-1243
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ services:
7070
- wpdevnet
7171

7272
ports:
73-
- "3306"
73+
- "${LOCAL_DB_PORTS-3306}"
7474

7575
environment:
7676
MYSQL_ROOT_PASSWORD: password

src/js/_enqueues/lib/emoji-loader.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* @output wp-includes/js/wp-emoji-loader.js
33
*/
44

5+
/* eslint-env es6 */
6+
57
// Note: This is loaded as a script module, so there is no need for an IIFE to prevent pollution of the global scope.
68

79
/**
@@ -12,15 +14,13 @@
1214
* @property {?string} source.concatemoji
1315
* @property {?string} source.twemoji
1416
* @property {?string} source.wpemoji
15-
* @property {?boolean} DOMReady
16-
* @property {?Function} readyCallback
1717
*/
1818

1919
const settings = /** @type {WPEmojiSettings} */ (
2020
JSON.parse( document.getElementById( 'wp-emoji-settings' ).textContent )
2121
);
2222

23-
// For compatibility with other scripts that read from this global.
23+
// For compatibility with other scripts that read from this global, in particular wp-includes/js/wp-emoji.js (source file: js/_enqueues/wp/emoji.js).
2424
window._wpemojiSettings = settings;
2525

2626
/**
@@ -422,17 +422,8 @@ new Promise( ( resolve ) => {
422422
settings.supports.everythingExceptFlag &&
423423
! settings.supports.flag;
424424

425-
// Sets DOMReady to false and assigns a ready function to settings.
426-
settings.DOMReady = false;
427-
settings.readyCallback = () => {
428-
settings.DOMReady = true;
429-
};
430-
} )
431-
.then( () => {
432425
// When the browser can not render everything we need to load a polyfill.
433426
if ( ! settings.supports.everything ) {
434-
settings.readyCallback();
435-
436427
const src = settings.source || {};
437428

438429
if ( src.concatemoji ) {

src/js/_enqueues/wp/emoji.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -277,16 +277,7 @@
277277
return twemoji.parse( object, params );
278278
}
279279

280-
/**
281-
* Initialize our emoji support, and set up listeners.
282-
*/
283-
if ( settings ) {
284-
if ( settings.DOMReady ) {
285-
load();
286-
} else {
287-
settings.readyCallback = load;
288-
}
289-
}
280+
load();
290281

291282
return {
292283
parse: parse,

src/js/_enqueues/wp/sanitize.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* @output wp-includes/js/wp-sanitize.js
33
*/
44

5+
/* eslint-env es6 */
6+
57
( function () {
68

79
window.wp = window.wp || {};
@@ -16,24 +18,24 @@
1618
/**
1719
* Strip HTML tags.
1820
*
19-
* @param {string} text Text to strip the HTML tags from.
21+
* @param {string} text - Text to strip the HTML tags from.
2022
*
21-
* @return Stripped text.
23+
* @return {string} Stripped text.
2224
*/
2325
stripTags: function( text ) {
24-
text = text || '';
26+
let _text = text || '';
27+
28+
// Do the search-replace until there is nothing to be replaced.
29+
do {
30+
// Keep pre-replace text for comparison.
31+
text = _text;
2532

26-
// Do the replacement.
27-
var _text = text
33+
// Do the replacement.
34+
_text = text
2835
.replace( /<!--[\s\S]*?(-->|$)/g, '' )
2936
.replace( /<(script|style)[^>]*>[\s\S]*?(<\/\1>|$)/ig, '' )
3037
.replace( /<\/?[a-z][\s\S]*?(>|$)/ig, '' );
31-
32-
// If the initial text is not equal to the modified text,
33-
// do the search-replace again, until there is nothing to be replaced.
34-
if ( _text !== text ) {
35-
return wp.sanitize.stripTags( _text );
36-
}
38+
} while ( _text !== text );
3739

3840
// Return the text with stripped tags.
3941
return _text;
@@ -42,12 +44,12 @@
4244
/**
4345
* Strip HTML tags and convert HTML entities.
4446
*
45-
* @param {string} text Text to strip tags and convert HTML entities.
47+
* @param {string} text - Text to strip tags and convert HTML entities.
4648
*
47-
* @return Sanitized text. False on failure.
49+
* @return {string} Sanitized text.
4850
*/
4951
stripTagsAndEncodeText: function( text ) {
50-
var _text = wp.sanitize.stripTags( text ),
52+
let _text = wp.sanitize.stripTags( text ),
5153
textarea = document.createElement( 'textarea' );
5254

5355
try {

src/wp-activate.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@
6464

6565
nocache_headers();
6666

67-
if ( is_object( $wp_object_cache ) ) {
68-
$wp_object_cache->cache_enabled = false;
69-
}
70-
7167
// Fix for page title.
7268
$wp_query->is_404 = false;
7369

src/wp-admin/admin.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,26 +72,30 @@
7272
* @param bool $do_mu_upgrade Whether to perform the Multisite upgrade routine. Default true.
7373
*/
7474
if ( apply_filters( 'do_mu_upgrade', true ) ) {
75-
$c = get_blog_count();
75+
$blog_count = get_blog_count();
7676

7777
/*
7878
* If there are 50 or fewer sites, run every time. Otherwise, throttle to reduce load:
7979
* attempt to do no more than threshold value, with some +/- allowed.
8080
*/
81-
if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int) ( $c / 50 ) ) === 1 ) ) {
81+
if ( $blog_count <= 50 || ( $blog_count > 50 && mt_rand( 0, (int) ( $blog_count / 50 ) ) === 1 ) ) {
8282
require_once ABSPATH . WPINC . '/http.php';
83+
8384
$response = wp_remote_get(
8485
admin_url( 'upgrade.php?step=1' ),
8586
array(
8687
'timeout' => 120,
8788
'httpversion' => '1.1',
8889
)
8990
);
91+
9092
/** This action is documented in wp-admin/network/upgrade.php */
9193
do_action( 'after_mu_upgrade', $response );
94+
9295
unset( $response );
9396
}
94-
unset( $c );
97+
98+
unset( $blog_count );
9599
}
96100
}
97101

src/wp-admin/plugin-editor.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@
9393
$posted_content = null;
9494

9595
if ( 'POST' === $_SERVER['REQUEST_METHOD'] ) {
96-
$r = wp_edit_theme_plugin_file( wp_unslash( $_POST ) );
97-
if ( is_wp_error( $r ) ) {
98-
$edit_error = $r;
96+
$edit_result = wp_edit_theme_plugin_file( wp_unslash( $_POST ) );
97+
98+
if ( is_wp_error( $edit_result ) ) {
99+
$edit_error = $edit_result;
100+
99101
if ( check_ajax_referer( 'edit-plugin_' . $file, 'nonce', false ) && isset( $_POST['newcontent'] ) ) {
100102
$posted_content = wp_unslash( $_POST['newcontent'] );
101103
}
@@ -122,9 +124,10 @@
122124
} else {
123125
// Get the extension of the file.
124126
if ( preg_match( '/\.([^.]+)$/', $real_file, $matches ) ) {
125-
$ext = strtolower( $matches[1] );
127+
$extension = strtolower( $matches[1] );
128+
126129
// If extension is not in the acceptable list, skip it.
127-
if ( ! in_array( $ext, $editable_extensions, true ) ) {
130+
if ( ! in_array( $extension, $editable_extensions, true ) ) {
128131
wp_die( sprintf( '<p>%s</p>', __( 'Files of this type are not editable.' ) ) );
129132
}
130133
}

src/wp-admin/revision.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
require ABSPATH . 'wp-admin/includes/revision.php';
1616

1717
/**
18-
* @global int $revision Optional. The revision ID.
19-
* @global string $action The action to take.
20-
* Accepts 'restore', 'view' or 'edit'.
21-
* @global int $from The revision to compare from.
22-
* @global int $to Optional, required if revision missing. The revision to compare to.
18+
* @global int $revision_id Optional. The revision ID.
19+
* @global string $action The action to take. Accepts 'restore', 'view', or 'edit'.
20+
* @global int $from The revision to compare from.
21+
* @global int $to Optional, required if revision missing. The revision to compare to.
2322
*/
2423

2524
$revision_id = ! empty( $_REQUEST['revision'] ) ? absint( $_REQUEST['revision'] ) : 0;

src/wp-admin/theme-editor.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,11 @@
121121
$posted_content = null;
122122

123123
if ( 'POST' === $_SERVER['REQUEST_METHOD'] ) {
124-
$r = wp_edit_theme_plugin_file( wp_unslash( $_POST ) );
125-
if ( is_wp_error( $r ) ) {
126-
$edit_error = $r;
124+
$edit_result = wp_edit_theme_plugin_file( wp_unslash( $_POST ) );
125+
126+
if ( is_wp_error( $edit_result ) ) {
127+
$edit_error = $edit_result;
128+
127129
if ( check_ajax_referer( 'edit-theme_' . $stylesheet . '_' . $relative_file, 'nonce', false ) && isset( $_POST['newcontent'] ) ) {
128130
$posted_content = wp_unslash( $_POST['newcontent'] );
129131
}

src/wp-content/themes/twentyfifteen/functions.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,14 @@ function twentyfifteen_fonts_url() {
412412
* @since Twenty Fifteen 1.1
413413
*/
414414
function twentyfifteen_javascript_detection() {
415-
echo "<script>(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script>\n";
415+
$js = "(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);";
416+
$js .= "\n//# sourceURL=" . rawurlencode( __FUNCTION__ );
417+
418+
if ( function_exists( 'wp_print_inline_script_tag' ) ) {
419+
wp_print_inline_script_tag( $js );
420+
} else {
421+
echo "<script>$js</script>\n";
422+
}
416423
}
417424
add_action( 'wp_head', 'twentyfifteen_javascript_detection', 0 );
418425

0 commit comments

Comments
 (0)