Skip to content

Commit b7bc9f1

Browse files
committed
Merge branch 'trunk' into collaboration/table-awareness-object-cache
# Conflicts: # src/wp-includes/collaboration/class-wp-http-polling-collaboration-server.php # tests/phpunit/tests/rest-api/rest-sync-server.php
2 parents e4d0951 + 3b11171 commit b7bc9f1

16 files changed

Lines changed: 392 additions & 32 deletions

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
},
3333
"lock": false
3434
},
35+
"autoload-dev": {
36+
"psr-4": {
37+
"WordPress\\PHPStan\\": "tests/phpstan/"
38+
}
39+
},
3540
"scripts": {
3641
"phpstan": "@php ./vendor/bin/phpstan analyse --memory-limit=2G",
3742
"compat": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --standard=phpcompat.xml.dist --report=summary,source",

src/wp-admin/css/common.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,6 @@ a#remove-post-thumbnail:hover,
961961

962962
#publishing-action .spinner {
963963
float: none;
964-
margin-top: 5px;
965964
}
966965

967966
#misc-publishing-actions {
@@ -2460,7 +2459,7 @@ h1.nav-tab-wrapper, /* Back-compat for pre-4.4 */
24602459
filter: alpha(opacity=70);
24612460
width: 20px;
24622461
height: 20px;
2463-
margin: 4px 10px 0;
2462+
margin: 10px 10px 0;
24642463
}
24652464

24662465
.spinner.is-active,
@@ -2480,6 +2479,7 @@ h1.nav-tab-wrapper, /* Back-compat for pre-4.4 */
24802479
}
24812480
#template .submit .spinner {
24822481
float: none;
2482+
vertical-align: top;
24832483
}
24842484

24852485
.metabox-holder .stuffbox > h3, /* Back-compat for pre-4.4 */

src/wp-admin/css/customize-controls.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ body {
7070

7171
#customize-save-button-wrapper {
7272
float: right;
73-
margin-top: 3px; /* Vertically center 40px button in 45px header */
73+
margin-top: 7px; /* Vertically center 32px button in 45px header */
7474
}
7575

7676
body:not(.ready) #customize-save-button-wrapper .save {
@@ -572,6 +572,10 @@ body.trashing #publish-settings {
572572
display: block;
573573
}
574574

575+
.accordion-section-title button.accordion-trigger .spinner {
576+
margin-top: 0;
577+
}
578+
575579
@media (prefers-reduced-motion: reduce) {
576580
#customize-theme-controls .accordion-section-title,
577581
#customize-outer-theme-controls .accordion-section-title {
@@ -2996,9 +3000,8 @@ body.adding-widget .add-new-widget:before,
29963000
}
29973001

29983002
.wp-core-ui.wp-customizer .button {
2999-
min-height: 30px;
30003003
padding: 0 14px;
3001-
line-height: 2;
3004+
line-height: 2.14285714; /* 30px */
30023005
font-size: 14px;
30033006
vertical-align: middle;
30043007
}

src/wp-admin/css/list-tables.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,7 @@ tr.inline-edit-row td {
11041104
}
11051105

11061106
.inline-edit-row select {
1107+
line-height: 2.14285714; /* 30px for 32px height with 14px font */
11071108
padding-right: 24px;
11081109
}
11091110

src/wp-admin/css/themes.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,7 +1967,7 @@ body.full-overlay-active {
19671967

19681968
.theme-install-overlay .wp-full-overlay-header .button {
19691969
float: right;
1970-
margin: 3px 10px 0 0; /* Vertically center 40px button in 45px header */
1970+
margin: 7px 10px 0 0; /* Vertically center 32px button in 45px header */
19711971
}
19721972

19731973
.theme-install-overlay .wp-full-overlay-sidebar {
@@ -2053,8 +2053,6 @@ body.full-overlay-active {
20532053

20542054
.theme-install-overlay .wp-full-overlay-header .button {
20552055
font-size: 13px;
2056-
line-height: 2.15384615;
2057-
min-height: 30px;
20582056
}
20592057

20602058
.theme-browser .theme .theme-actions .button {

src/wp-admin/customize.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,13 @@
198198
<?php if ( $compatible_wp && $compatible_php ) : ?>
199199
<?php $save_text = $wp_customize->is_theme_active() ? __( 'Publish' ) : __( 'Activate &amp; Publish' ); ?>
200200
<div id="customize-save-button-wrapper" class="customize-save-button-wrapper" >
201-
<?php submit_button( $save_text, 'primary save', 'save', false ); ?>
202-
<button id="publish-settings" class="publish-settings button-primary button dashicons dashicons-admin-generic" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled></button>
201+
<?php submit_button( $save_text, 'primary button-compact save', 'save', false ); ?>
202+
<button id="publish-settings" class="publish-settings button-primary button-compact button dashicons dashicons-admin-generic" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled></button>
203203
</div>
204204
<?php else : ?>
205205
<?php $save_text = _x( 'Cannot Activate', 'theme' ); ?>
206206
<div id="customize-save-button-wrapper" class="customize-save-button-wrapper disabled" >
207-
<button class="button button-primary disabled" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled><?php echo $save_text; ?></button>
207+
<button class="button button-primary button-compact disabled" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled><?php echo $save_text; ?></button>
208208
</div>
209209
<?php endif; ?>
210210
<span class="spinner"></span>

src/wp-admin/theme-install.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -487,18 +487,18 @@
487487
$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
488488
?>
489489
<# if ( ! data.active ) { #>
490-
<a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
490+
<a class="button button-primary button-compact activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
491491
<# } else { #>
492-
<button class="button button-primary disabled"><?php _ex( 'Activated', 'theme' ); ?></button>
492+
<button class="button button-primary button-compact disabled"><?php _ex( 'Activated', 'theme' ); ?></button>
493493
<# } #>
494494
<# } else { #>
495-
<a class="button button-primary disabled" ><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
495+
<a class="button button-primary button-compact disabled" ><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
496496
<# } #>
497497
<# } else { #>
498498
<# if ( data.compatible_wp && data.compatible_php ) { #>
499-
<a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a>
499+
<a href="{{ data.install_url }}" class="button button-primary button-compact theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a>
500500
<# } else { #>
501-
<a class="button button-primary disabled" ><?php _ex( 'Cannot Install', 'theme' ); ?></a>
501+
<a class="button button-primary button-compact disabled" ><?php _ex( 'Cannot Install', 'theme' ); ?></a>
502502
<# } #>
503503
<# } #>
504504
</div>

src/wp-includes/collaboration/class-wp-http-polling-collaboration-server.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,13 @@ private function process_collaboration_update( string $room, string $client_id,
529529
}
530530

531531
/*
532-
* Reaching this point means there's a newer compaction,
533-
* so we can silently ignore this one.
532+
* A newer compaction already advanced the cursor, but we
533+
* can not safely drop an update. The incoming bytes still encode
534+
* operations other clients may not have seen, so store them as a
535+
* regular update. Y.applyUpdateV2 merges state-as-update blobs
536+
* idempotently, so overlap with the existing compaction is safe.
534537
*/
535-
return true;
538+
return $this->add_update( $room, $client_id, self::UPDATE_TYPE_UPDATE, $data );
536539

537540
case self::UPDATE_TYPE_SYNC_STEP1:
538541
case self::UPDATE_TYPE_SYNC_STEP2:

src/wp-includes/http.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,26 @@ function ms_allowed_http_request_hosts( $is_external, $host ) {
716716
* When a specific component has been requested: null if the component
717717
* doesn't exist in the given URL; a string or - in the case of
718718
* PHP_URL_PORT - integer when it does. See parse_url()'s return values.
719+
*
720+
* @phpstan-param int<-1, 7> $component
721+
* @phpstan-return (
722+
* $component is -1
723+
* ? false|array{
724+
* scheme?: string,
725+
* host?: string,
726+
* port?: int<0, 65535>,
727+
* user?: string,
728+
* pass?: string,
729+
* path?: string,
730+
* query?: string,
731+
* fragment?: string,
732+
* }
733+
* : (
734+
* $component is 2
735+
* ? int<0, 65535>|null
736+
* : string|null
737+
* )
738+
* )
719739
*/
720740
function wp_parse_url( $url, $component = -1 ) {
721741
$to_unset = array();
@@ -763,6 +783,36 @@ function wp_parse_url( $url, $component = -1 ) {
763783
* When a specific component has been requested: null if the component
764784
* doesn't exist in the given URL; a string or - in the case of
765785
* PHP_URL_PORT - integer when it does. See parse_url()'s return values.
786+
*
787+
* @phpstan-param false|array{
788+
* scheme?: string,
789+
* host?: string,
790+
* port?: int<0, 65535>,
791+
* user?: string,
792+
* pass?: string,
793+
* path?: string,
794+
* query?: string,
795+
* fragment?: string,
796+
* } $url_parts
797+
* @phpstan-param int<-1, 7> $component
798+
* @phpstan-return (
799+
* $component is -1
800+
* ? false|array{
801+
* scheme?: string,
802+
* host?: string,
803+
* port?: int<0, 65535>,
804+
* user?: string,
805+
* pass?: string,
806+
* path?: string,
807+
* query?: string,
808+
* fragment?: string,
809+
* }
810+
* : (
811+
* $component is 2
812+
* ? int<0, 65535>|null
813+
* : string|null
814+
* )
815+
* )
766816
*/
767817
function _get_component_from_parsed_url_array( $url_parts, $component = -1 ) {
768818
if ( -1 === $component ) {
@@ -789,6 +839,9 @@ function _get_component_from_parsed_url_array( $url_parts, $component = -1 ) {
789839
*
790840
* @param int $constant PHP_URL_* constant.
791841
* @return string|false The named key or false.
842+
*
843+
* @phpstan-param int<-1, 7> $constant
844+
* @phpstan-return 'scheme'|'host'|'port'|'user'|'pass'|'path'|'query'|'fragment'|false
792845
*/
793846
function _wp_translate_php_url_constant_to_key( $constant ) {
794847
$translation = array(

src/wp-includes/l10n.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,7 @@ function load_script_module_textdomain( string $id, string $domain = 'default',
12061206
* @return string|false The JSON-encoded translated strings on success, false otherwise.
12071207
*/
12081208
function _load_script_textdomain_from_src( string $handle, string $src, string $domain, string $path, bool $is_module ) {
1209+
/** @var WP_Textdomain_Registry $wp_textdomain_registry */
12091210
global $wp_textdomain_registry;
12101211

12111212
$locale = determine_locale();
@@ -1214,7 +1215,9 @@ function _load_script_textdomain_from_src( string $handle, string $src, string $
12141215
$path = $wp_textdomain_registry->get( $domain, $locale );
12151216
}
12161217

1217-
$path = untrailingslashit( $path );
1218+
if ( $path ) {
1219+
$path = untrailingslashit( $path );
1220+
}
12181221

12191222
// If a path was given and the handle file exists simply return it.
12201223
$file_base = 'default' === $domain ? $locale : $domain . '-' . $locale;
@@ -1231,8 +1234,17 @@ function _load_script_textdomain_from_src( string $handle, string $src, string $
12311234
$relative = false;
12321235
$languages_path = WP_LANG_DIR;
12331236

1234-
$src_url = wp_parse_url( $src );
1237+
$src_url = wp_parse_url( $src );
1238+
if ( ! $src_url ) {
1239+
return load_script_translations( false, $handle, $domain );
1240+
}
1241+
$src_url['path'] ??= '';
1242+
12351243
$content_url = wp_parse_url( content_url() );
1244+
if ( ! $content_url ) {
1245+
return load_script_translations( false, $handle, $domain );
1246+
}
1247+
12361248
$plugins_url = wp_parse_url( plugins_url() );
12371249
$site_url = wp_parse_url( site_url() );
12381250
$theme_root = get_theme_root();
@@ -1304,7 +1316,7 @@ function _load_script_textdomain_from_src( string $handle, string $src, string $
13041316
$relative = apply_filters( 'load_script_textdomain_relative_path', $relative, $src, $is_module );
13051317

13061318
// If the source is not from WP.
1307-
if ( false === $relative ) {
1319+
if ( ! is_string( $relative ) ) {
13081320
return load_script_translations( false, $handle, $domain );
13091321
}
13101322

0 commit comments

Comments
 (0)