wp/wp-admin/includes/class-bulk-upgrader-skin.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 19 3d72ae0968f4
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    37 
    37 
    38 	/**
    38 	/**
    39 	 */
    39 	 */
    40 	public function add_strings() {
    40 	public function add_strings() {
    41 		$this->upgrader->strings['skin_upgrade_start'] = __( 'The update process is starting. This process may take a while on some hosts, so please be patient.' );
    41 		$this->upgrader->strings['skin_upgrade_start'] = __( 'The update process is starting. This process may take a while on some hosts, so please be patient.' );
    42 		/* translators: 1: Title of an update, 2: Error message */
    42 		/* translators: 1: Title of an update, 2: Error message. */
    43 		$this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while updating %1$s: %2$s' );
    43 		$this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while updating %1$s: %2$s' );
    44 		/* translators: %s: Title of an update */
    44 		/* translators: %s: Title of an update. */
    45 		$this->upgrader->strings['skin_update_failed'] = __( 'The update of %s failed.' );
    45 		$this->upgrader->strings['skin_update_failed'] = __( 'The update of %s failed.' );
    46 		/* translators: %s: Title of an update */
    46 		/* translators: %s: Title of an update. */
    47 		$this->upgrader->strings['skin_update_successful'] = __( '%s updated successfully.' );
    47 		$this->upgrader->strings['skin_update_successful'] = __( '%s updated successfully.' );
    48 		$this->upgrader->strings['skin_upgrade_end']       = __( 'All updates have been completed.' );
    48 		$this->upgrader->strings['skin_upgrade_end']       = __( 'All updates have been completed.' );
    49 	}
    49 	}
    50 
    50 
    51 	/**
    51 	/**
    52 	 * @param string $string
    52 	 * @param string $string
       
    53 	 * @param mixed  ...$args Optional text replacements.
    53 	 */
    54 	 */
    54 	public function feedback( $string ) {
    55 	public function feedback( $string, ...$args ) {
    55 		if ( isset( $this->upgrader->strings[ $string ] ) ) {
    56 		if ( isset( $this->upgrader->strings[ $string ] ) ) {
    56 			$string = $this->upgrader->strings[ $string ];
    57 			$string = $this->upgrader->strings[ $string ];
    57 		}
    58 		}
    58 
    59 
    59 		if ( strpos( $string, '%' ) !== false ) {
    60 		if ( strpos( $string, '%' ) !== false ) {
    60 			$args = func_get_args();
       
    61 			$args = array_splice( $args, 1 );
       
    62 			if ( $args ) {
    61 			if ( $args ) {
    63 				$args   = array_map( 'strip_tags', $args );
    62 				$args   = array_map( 'strip_tags', $args );
    64 				$args   = array_map( 'esc_html', $args );
    63 				$args   = array_map( 'esc_html', $args );
    65 				$string = vsprintf( $string, $args );
    64 				$string = vsprintf( $string, $args );
    66 			}
    65 			}