wp/wp-admin/includes/class-automatic-upgrader-skin.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
     6  * @subpackage Upgrader
     6  * @subpackage Upgrader
     7  * @since 4.6.0
     7  * @since 4.6.0
     8  */
     8  */
     9 
     9 
    10 /**
    10 /**
    11  * Upgrader Skin for Automatic WordPress Upgrades
    11  * Upgrader Skin for Automatic WordPress Upgrades.
    12  *
    12  *
    13  * This skin is designed to be used when no output is intended, all output
    13  * This skin is designed to be used when no output is intended, all output
    14  * is captured and stored for the caller to process and log/email/discard.
    14  * is captured and stored for the caller to process and log/email/discard.
    15  *
    15  *
    16  * @since 3.7.0
    16  * @since 3.7.0
    50 		ob_end_clean();
    50 		ob_end_clean();
    51 		return $result;
    51 		return $result;
    52 	}
    52 	}
    53 
    53 
    54 	/**
    54 	/**
    55 	 * @return array
    55 	 * Retrieves the upgrade messages.
       
    56 	 *
       
    57 	 * @since 3.7.0
       
    58 	 *
       
    59 	 * @return string[] Messages during an upgrade.
    56 	 */
    60 	 */
    57 	public function get_upgrade_messages() {
    61 	public function get_upgrade_messages() {
    58 		return $this->messages;
    62 		return $this->messages;
    59 	}
    63 	}
    60 
    64 
    61 	/**
    65 	/**
    62 	 * @param string|array|WP_Error $data
    66 	 * Stores a message about the upgrade.
       
    67 	 *
       
    68 	 * @since 3.7.0
       
    69 	 *
       
    70 	 * @param string|array|WP_Error $data    Message data.
    63 	 * @param mixed                 ...$args Optional text replacements.
    71 	 * @param mixed                 ...$args Optional text replacements.
    64 	 */
    72 	 */
    65 	public function feedback( $data, ...$args ) {
    73 	public function feedback( $data, ...$args ) {
    66 		if ( is_wp_error( $data ) ) {
    74 		if ( is_wp_error( $data ) ) {
    67 			$string = $data->get_error_message();
    75 			$string = $data->get_error_message();
   101 
   109 
   102 		$this->messages[] = $string;
   110 		$this->messages[] = $string;
   103 	}
   111 	}
   104 
   112 
   105 	/**
   113 	/**
       
   114 	 * Creates a new output buffer.
       
   115 	 *
       
   116 	 * @since 3.7.0
   106 	 */
   117 	 */
   107 	public function header() {
   118 	public function header() {
   108 		ob_start();
   119 		ob_start();
   109 	}
   120 	}
   110 
   121 
   111 	/**
   122 	/**
       
   123 	 * Retrieves the buffered content, deletes the buffer, and processes the output.
       
   124 	 *
       
   125 	 * @since 3.7.0
   112 	 */
   126 	 */
   113 	public function footer() {
   127 	public function footer() {
   114 		$output = ob_get_clean();
   128 		$output = ob_get_clean();
   115 		if ( ! empty( $output ) ) {
   129 		if ( ! empty( $output ) ) {
   116 			$this->feedback( $output );
   130 			$this->feedback( $output );