wp/wp-admin/includes/class-wp-upgrader-skin.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
--- a/wp/wp-admin/includes/class-wp-upgrader-skin.php	Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-admin/includes/class-wp-upgrader-skin.php	Fri Sep 05 18:40:08 2025 +0200
@@ -13,13 +13,13 @@
  * @since 2.8.0
  * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php.
  */
+#[AllowDynamicProperties]
 class WP_Upgrader_Skin {
 
 	/**
 	 * Holds the upgrader data.
 	 *
 	 * @since 2.8.0
-	 *
 	 * @var WP_Upgrader
 	 */
 	public $upgrader;
@@ -28,7 +28,6 @@
 	 * Whether header is done.
 	 *
 	 * @since 2.8.0
-	 *
 	 * @var bool
 	 */
 	public $done_header = false;
@@ -37,7 +36,6 @@
 	 * Whether footer is done.
 	 *
 	 * @since 2.8.0
-	 *
 	 * @var bool
 	 */
 	public $done_footer = false;
@@ -46,7 +44,6 @@
 	 * Holds the result of an upgrade.
 	 *
 	 * @since 2.8.0
-	 *
 	 * @var string|bool|WP_Error
 	 */
 	public $result = false;
@@ -55,7 +52,6 @@
 	 * Holds the options of an upgrade.
 	 *
 	 * @since 2.8.0
-	 *
 	 * @var array
 	 */
 	public $options = array();
@@ -81,6 +77,8 @@
 	}
 
 	/**
+	 * Sets the relationship between the skin being used and the upgrader.
+	 *
 	 * @since 2.8.0
 	 *
 	 * @param WP_Upgrader $upgrader
@@ -93,6 +91,8 @@
 	}
 
 	/**
+	 * Sets up the strings used in the update process.
+	 *
 	 * @since 3.0.0
 	 */
 	public function add_strings() {
@@ -140,6 +140,8 @@
 	}
 
 	/**
+	 * Displays the header before the update process.
+	 *
 	 * @since 2.8.0
 	 */
 	public function header() {
@@ -152,6 +154,8 @@
 	}
 
 	/**
+	 * Displays the footer following the update process.
+	 *
 	 * @since 2.8.0
 	 */
 	public function footer() {
@@ -163,6 +167,8 @@
 	}
 
 	/**
+	 * Displays an error message about the update.
+	 *
 	 * @since 2.8.0
 	 *
 	 * @param string|WP_Error $errors Errors.
@@ -185,6 +191,8 @@
 	}
 
 	/**
+	 * Displays a message about the update.
+	 *
 	 * @since 2.8.0
 	 * @since 5.9.0 Renamed `$string` (a PHP reserved keyword) to `$feedback` for PHP 8 named parameter support.
 	 *
@@ -196,7 +204,7 @@
 			$feedback = $this->upgrader->strings[ $feedback ];
 		}
 
-		if ( strpos( $feedback, '%' ) !== false ) {
+		if ( str_contains( $feedback, '%' ) ) {
 			if ( $args ) {
 				$args     = array_map( 'strip_tags', $args );
 				$args     = array_map( 'esc_html', $args );
@@ -210,21 +218,21 @@
 	}
 
 	/**
-	 * Action to perform before an update.
+	 * Performs an action before an update.
 	 *
 	 * @since 2.8.0
 	 */
 	public function before() {}
 
 	/**
-	 * Action to perform following an update.
+	 * Performs an action following an update.
 	 *
 	 * @since 2.8.0
 	 */
 	public function after() {}
 
 	/**
-	 * Output JavaScript that calls function to decrement the update counts.
+	 * Outputs JavaScript that calls function to decrement the update counts.
 	 *
 	 * @since 3.9.0
 	 *
@@ -239,7 +247,14 @@
 		if ( defined( 'IFRAME_REQUEST' ) ) {
 			echo '<script type="text/javascript">
 					if ( window.postMessage && JSON ) {
-						window.parent.postMessage( JSON.stringify( { action: "decrementUpdateCount", upgradeType: "' . $type . '" } ), window.location.protocol + "//" + window.location.hostname );
+						window.parent.postMessage(
+							JSON.stringify( {
+								action: "decrementUpdateCount",
+								upgradeType: "' . $type . '"
+							} ),
+							window.location.protocol + "//" + window.location.hostname
+								+ ( "" !== window.location.port ? ":" + window.location.port : "" )
+						);
 					}
 				</script>';
 		} else {
@@ -254,11 +269,15 @@
 	}
 
 	/**
+	 * Displays the header before the bulk update process.
+	 *
 	 * @since 3.0.0
 	 */
 	public function bulk_header() {}
 
 	/**
+	 * Displays the footer following the bulk update process.
+	 *
 	 * @since 3.0.0
 	 */
 	public function bulk_footer() {}
@@ -269,7 +288,7 @@
 	 * @since 5.5.0
 	 *
 	 * @param WP_Error $wp_error WP_Error object.
-	 * @return bool
+	 * @return bool True if the error should be hidden, false otherwise.
 	 */
 	public function hide_process_failed( $wp_error ) {
 		return false;