wp/wp-admin/update-core.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
    46 		$updates = get_core_updates();
    46 		$updates = get_core_updates();
    47 		if ( $updates && 1 === count( $updates ) ) {
    47 		if ( $updates && 1 === count( $updates ) ) {
    48 			// If the only available update is a partial builds, it doesn't need a language-specific version string.
    48 			// If the only available update is a partial builds, it doesn't need a language-specific version string.
    49 			$version_string = $update->current;
    49 			$version_string = $update->current;
    50 		}
    50 		}
       
    51 	} elseif ( 'en_US' === $update->locale && 'en_US' !== get_locale() ) {
       
    52 		$version_string = sprintf( '%s–%s', $update->current, $update->locale );
    51 	}
    53 	}
    52 
    54 
    53 	$current = false;
    55 	$current = false;
    54 	if ( ! isset( $update->response ) || 'latest' === $update->response ) {
    56 	if ( ! isset( $update->response ) || 'latest' === $update->response ) {
    55 		$current = true;
    57 		$current = true;
   152 
   154 
   153 	echo '<p>';
   155 	echo '<p>';
   154 	echo $message;
   156 	echo $message;
   155 	echo '</p>';
   157 	echo '</p>';
   156 
   158 
   157 	echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">';
   159 	echo '<form method="post" action="' . esc_url( $form_action ) . '" name="upgrade" class="upgrade">';
   158 	wp_nonce_field( 'upgrade-core' );
   160 	wp_nonce_field( 'upgrade-core' );
   159 
   161 
   160 	echo '<p>';
   162 	echo '<p>';
   161 	echo '<input name="version" value="' . esc_attr( $update->current ) . '" type="hidden" />';
   163 	echo '<input name="version" value="' . esc_attr( $update->current ) . '" type="hidden" />';
   162 	echo '<input name="locale" value="' . esc_attr( $update->locale ) . '" type="hidden" />';
   164 	echo '<input name="locale" value="' . esc_attr( $update->locale ) . '" type="hidden" />';
   202 		array(
   204 		array(
   203 			'dismissed' => true,
   205 			'dismissed' => true,
   204 			'available' => false,
   206 			'available' => false,
   205 		)
   207 		)
   206 	);
   208 	);
       
   209 
   207 	if ( $dismissed ) {
   210 	if ( $dismissed ) {
   208 
       
   209 		$show_text = esc_js( __( 'Show hidden updates' ) );
   211 		$show_text = esc_js( __( 'Show hidden updates' ) );
   210 		$hide_text = esc_js( __( 'Hide hidden updates' ) );
   212 		$hide_text = esc_js( __( 'Hide hidden updates' ) );
   211 		?>
   213 		?>
   212 	<script type="text/javascript">
   214 		<script type="text/javascript">
   213 		jQuery(function( $ ) {
   215 			jQuery( function( $ ) {
   214 			$( 'dismissed-updates' ).show();
   216 				$( '#show-dismissed' ).on( 'click', function() {
   215 			$( '#show-dismissed' ).toggle( function() { $( this ).text( '<?php echo $hide_text; ?>' ).attr( 'aria-expanded', 'true' ); }, function() { $( this ).text( '<?php echo $show_text; ?>' ).attr( 'aria-expanded', 'false' ); } );
   217 					var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
   216 			$( '#show-dismissed' ).click( function() { $( '#dismissed-updates' ).toggle( 'fast' ); } );
   218 
   217 		});
   219 					if ( isExpanded ) {
   218 	</script>
   220 						$( this ).text( '<?php echo $show_text; ?>' ).attr( 'aria-expanded', 'false' );
       
   221 					} else {
       
   222 						$( this ).text( '<?php echo $hide_text; ?>' ).attr( 'aria-expanded', 'true' );
       
   223 					}
       
   224 
       
   225 					$( '#dismissed-updates' ).toggle( 'fast' );
       
   226 				});
       
   227 			});
       
   228 		</script>
   219 		<?php
   229 		<?php
   220 		echo '<p class="hide-if-no-js"><button type="button" class="button" id="show-dismissed" aria-expanded="false">' . __( 'Show hidden updates' ) . '</button></p>';
   230 		echo '<p class="hide-if-no-js"><button type="button" class="button" id="show-dismissed" aria-expanded="false">' . __( 'Show hidden updates' ) . '</button></p>';
   221 		echo '<ul id="dismissed-updates" class="core-updates dismissed">';
   231 		echo '<ul id="dismissed-updates" class="core-updates dismissed">';
   222 		foreach ( (array) $dismissed as $update ) {
   232 		foreach ( (array) $dismissed as $update ) {
   223 			echo '<li>';
   233 			echo '<li>';
   523 
   533 
   524 		$requires_php   = isset( $plugin_data->update->requires_php ) ? $plugin_data->update->requires_php : null;
   534 		$requires_php   = isset( $plugin_data->update->requires_php ) ? $plugin_data->update->requires_php : null;
   525 		$compatible_php = is_php_version_compatible( $requires_php );
   535 		$compatible_php = is_php_version_compatible( $requires_php );
   526 
   536 
   527 		if ( ! $compatible_php && current_user_can( 'update_php' ) ) {
   537 		if ( ! $compatible_php && current_user_can( 'update_php' ) ) {
   528 			$compat .= '<br>' . __( 'This update doesn&#8217;t work with your version of PHP.' ) . '&nbsp;';
   538 			$compat .= '<br>' . __( 'This update does not work with your version of PHP.' ) . '&nbsp;';
   529 			$compat .= sprintf(
   539 			$compat .= sprintf(
   530 				/* translators: %s: URL to Update PHP page. */
   540 				/* translators: %s: URL to Update PHP page. */
   531 				__( '<a href="%s">Learn more about updating PHP</a>.' ),
   541 				__( '<a href="%s">Learn more about updating PHP</a>.' ),
   532 				esc_url( wp_get_update_php_url() )
   542 				esc_url( wp_get_update_php_url() )
   533 			);
   543 			);
   669 		$compatible_php = is_php_version_compatible( $requires_php );
   679 		$compatible_php = is_php_version_compatible( $requires_php );
   670 
   680 
   671 		$compat = '';
   681 		$compat = '';
   672 
   682 
   673 		if ( ! $compatible_wp && ! $compatible_php ) {
   683 		if ( ! $compatible_wp && ! $compatible_php ) {
   674 			$compat .= '<br>' . __( 'This update doesn&#8217;t work with your versions of WordPress and PHP.' ) . '&nbsp;';
   684 			$compat .= '<br>' . __( 'This update does not work with your versions of WordPress and PHP.' ) . '&nbsp;';
   675 			if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   685 			if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   676 				$compat .= sprintf(
   686 				$compat .= sprintf(
   677 					/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   687 					/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   678 					__( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
   688 					__( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
   679 					self_admin_url( 'update-core.php' ),
   689 					self_admin_url( 'update-core.php' ),
   703 				if ( $annotation ) {
   713 				if ( $annotation ) {
   704 					$compat .= '</p><p><em>' . $annotation . '</em>';
   714 					$compat .= '</p><p><em>' . $annotation . '</em>';
   705 				}
   715 				}
   706 			}
   716 			}
   707 		} elseif ( ! $compatible_wp ) {
   717 		} elseif ( ! $compatible_wp ) {
   708 			$compat .= '<br>' . __( 'This update doesn&#8217;t work with your version of WordPress.' ) . '&nbsp;';
   718 			$compat .= '<br>' . __( 'This update does not work with your version of WordPress.' ) . '&nbsp;';
   709 			if ( current_user_can( 'update_core' ) ) {
   719 			if ( current_user_can( 'update_core' ) ) {
   710 				$compat .= sprintf(
   720 				$compat .= sprintf(
   711 					/* translators: %s: URL to WordPress Updates screen. */
   721 					/* translators: %s: URL to WordPress Updates screen. */
   712 					__( '<a href="%s">Please update WordPress</a>.' ),
   722 					__( '<a href="%s">Please update WordPress</a>.' ),
   713 					self_admin_url( 'update-core.php' )
   723 					self_admin_url( 'update-core.php' )
   714 				);
   724 				);
   715 			}
   725 			}
   716 		} elseif ( ! $compatible_php ) {
   726 		} elseif ( ! $compatible_php ) {
   717 			$compat .= '<br>' . __( 'This update doesn&#8217;t work with your version of PHP.' ) . '&nbsp;';
   727 			$compat .= '<br>' . __( 'This update does not work with your version of PHP.' ) . '&nbsp;';
   718 			if ( current_user_can( 'update_php' ) ) {
   728 			if ( current_user_can( 'update_php' ) ) {
   719 				$compat .= sprintf(
   729 				$compat .= sprintf(
   720 					/* translators: %s: URL to Update PHP page. */
   730 					/* translators: %s: URL to Update PHP page. */
   721 					__( '<a href="%s">Learn more about updating PHP</a>.' ),
   731 					__( '<a href="%s">Learn more about updating PHP</a>.' ),
   722 					esc_url( wp_get_update_php_url() )
   732 					esc_url( wp_get_update_php_url() )
   743 					?>
   753 					?>
   744 				</label>
   754 				</label>
   745 			<?php endif; ?>
   755 			<?php endif; ?>
   746 		</td>
   756 		</td>
   747 		<td class="plugin-title"><p>
   757 		<td class="plugin-title"><p>
   748 			<img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" />
   758 			<img src="<?php echo esc_url( $theme->get_screenshot() . '?ver=' . $theme->version ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" />
   749 			<strong><?php echo $theme->display( 'Name' ); ?></strong>
   759 			<strong><?php echo $theme->display( 'Name' ); ?></strong>
   750 			<?php
   760 			<?php
   751 			printf(
   761 			printf(
   752 				/* translators: 1: Theme version, 2: New version. */
   762 				/* translators: 1: Theme version, 2: New version. */
   753 				__( 'You have version %1$s installed. Update to %2$s.' ),
   763 				__( 'You have version %1$s installed. Update to %2$s.' ),
  1042 	printf( __( 'Current version: %s' ), get_bloginfo( 'version' ) );
  1052 	printf( __( 'Current version: %s' ), get_bloginfo( 'version' ) );
  1043 	echo '</h2>';
  1053 	echo '</h2>';
  1044 
  1054 
  1045 	echo '<p class="update-last-checked">';
  1055 	echo '<p class="update-last-checked">';
  1046 	/* translators: 1: Date, 2: Time. */
  1056 	/* translators: 1: Date, 2: Time. */
  1047 	printf( __( 'Last checked on %1$s at %2$s.' ), date_i18n( __( 'F j, Y' ), $last_update_check ), date_i18n( __( 'g:i a' ), $last_update_check ) );
  1057 	printf( __( 'Last checked on %1$s at %2$s.' ), date_i18n( __( 'F j, Y' ), $last_update_check ), date_i18n( __( 'g:i a T' ), $last_update_check ) );
  1048 	echo ' <a href="' . esc_url( self_admin_url( 'update-core.php?force-check=1' ) ) . '">' . __( 'Check again.' ) . '</a>';
  1058 	echo ' <a href="' . esc_url( self_admin_url( 'update-core.php?force-check=1' ) ) . '">' . __( 'Check again.' ) . '</a>';
  1049 	echo '</p>';
  1059 	echo '</p>';
  1050 
  1060 
  1051 	if ( current_user_can( 'update_core' ) ) {
  1061 	if ( current_user_can( 'update_core' ) ) {
  1052 		core_auto_updates_settings();
  1062 		core_auto_updates_settings();
  1134 	}
  1144 	}
  1135 
  1145 
  1136 	$url = 'update.php?action=update-selected&plugins=' . urlencode( implode( ',', $plugins ) );
  1146 	$url = 'update.php?action=update-selected&plugins=' . urlencode( implode( ',', $plugins ) );
  1137 	$url = wp_nonce_url( $url, 'bulk-update-plugins' );
  1147 	$url = wp_nonce_url( $url, 'bulk-update-plugins' );
  1138 
  1148 
       
  1149 	// Used in the HTML title tag.
  1139 	$title = __( 'Update Plugins' );
  1150 	$title = __( 'Update Plugins' );
  1140 
  1151 
  1141 	require_once ABSPATH . 'wp-admin/admin-header.php';
  1152 	require_once ABSPATH . 'wp-admin/admin-header.php';
  1142 	?>
  1153 	?>
  1143 	<div class="wrap">
  1154 	<div class="wrap">
  1174 	}
  1185 	}
  1175 
  1186 
  1176 	$url = 'update.php?action=update-selected-themes&themes=' . urlencode( implode( ',', $themes ) );
  1187 	$url = 'update.php?action=update-selected-themes&themes=' . urlencode( implode( ',', $themes ) );
  1177 	$url = wp_nonce_url( $url, 'bulk-update-themes' );
  1188 	$url = wp_nonce_url( $url, 'bulk-update-themes' );
  1178 
  1189 
       
  1190 	// Used in the HTML title tag.
  1179 	$title = __( 'Update Themes' );
  1191 	$title = __( 'Update Themes' );
  1180 
  1192 
  1181 	require_once ABSPATH . 'wp-admin/admin-header.php';
  1193 	require_once ABSPATH . 'wp-admin/admin-header.php';
  1182 	?>
  1194 	?>
  1183 	<div class="wrap">
  1195 	<div class="wrap">