wp/wp-admin/includes/update.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
   118  * @param string $version Version string to query.
   118  * @param string $version Version string to query.
   119  * @param string $locale  Locale to query.
   119  * @param string $locale  Locale to query.
   120  * @return array|false An array of checksums on success, false on failure.
   120  * @return array|false An array of checksums on success, false on failure.
   121  */
   121  */
   122 function get_core_checksums( $version, $locale ) {
   122 function get_core_checksums( $version, $locale ) {
   123 	$http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), null, '&' );
   123 	$http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), '', '&' );
   124 	$url      = $http_url;
   124 	$url      = $http_url;
   125 
   125 
   126 	$ssl = wp_http_supports( array( 'ssl' ) );
   126 	$ssl = wp_http_supports( array( 'ssl' ) );
   127 	if ( $ssl ) {
   127 	if ( $ssl ) {
   128 		$url = set_url_scheme( $url, 'https' );
   128 		$url = set_url_scheme( $url, 'https' );
   275 }
   275 }
   276 
   276 
   277 /**
   277 /**
   278  * @since 2.3.0
   278  * @since 2.3.0
   279  *
   279  *
   280  * @global string $pagenow
   280  * @global string $pagenow The filename of the current screen.
   281  * @return void|false
   281  * @return void|false
   282  */
   282  */
   283 function update_nag() {
   283 function update_nag() {
       
   284 	global $pagenow;
       
   285 
   284 	if ( is_multisite() && ! current_user_can( 'update_core' ) ) {
   286 	if ( is_multisite() && ! current_user_can( 'update_core' ) ) {
   285 		return false;
   287 		return false;
   286 	}
   288 	}
   287 
       
   288 	global $pagenow;
       
   289 
   289 
   290 	if ( 'update-core.php' === $pagenow ) {
   290 	if ( 'update-core.php' === $pagenow ) {
   291 		return;
   291 		return;
   292 	}
   292 	}
   293 
   293 
   532 					)
   532 					)
   533 				);
   533 				);
   534 			} else {
   534 			} else {
   535 				printf(
   535 				printf(
   536 					/* translators: 1: Plugin name, 2: Details URL, 3: Additional link attributes, 4: Version number 5: URL to Update PHP page. */
   536 					/* translators: 1: Plugin name, 2: Details URL, 3: Additional link attributes, 4: Version number 5: URL to Update PHP page. */
   537 					__( 'There is a new version of %1$s available, but it doesn&#8217;t work with your version of PHP. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s">learn more about updating PHP</a>.' ),
   537 					__( 'There is a new version of %1$s available, but it does not work with your version of PHP. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s">learn more about updating PHP</a>.' ),
   538 					$plugin_name,
   538 					$plugin_name,
   539 					esc_url( $details_url ),
   539 					esc_url( $details_url ),
   540 					sprintf(
   540 					sprintf(
   541 						'class="thickbox open-plugin-details-modal" aria-label="%s"',
   541 						'class="thickbox open-plugin-details-modal" aria-label="%s"',
   542 						/* translators: 1: Plugin name, 2: Version number. */
   542 						/* translators: 1: Plugin name, 2: Version number. */
   556 		 * The dynamic portion of the hook name, `$file`, refers to the path
   556 		 * The dynamic portion of the hook name, `$file`, refers to the path
   557 		 * of the plugin's primary file relative to the plugins directory.
   557 		 * of the plugin's primary file relative to the plugins directory.
   558 		 *
   558 		 *
   559 		 * @since 2.8.0
   559 		 * @since 2.8.0
   560 		 *
   560 		 *
   561 		 * @param array $plugin_data {
   561 		 * @param array  $plugin_data An array of plugin metadata. See get_plugin_data()
   562 		 *     An array of plugin metadata.
   562 		 *                            and the {@see 'plugin_row_meta'} filter for the list
       
   563 		 *                            of possible values.
       
   564 		 * @param object $response {
       
   565 		 *     An object of metadata about the available plugin update.
   563 		 *
   566 		 *
   564 		 *     @type string $name        The human-readable name of the plugin.
   567 		 *     @type string   $id           Plugin ID, e.g. `w.org/plugins/[plugin-name]`.
   565 		 *     @type string $plugin_uri  Plugin URI.
   568 		 *     @type string   $slug         Plugin slug.
   566 		 *     @type string $version     Plugin version.
   569 		 *     @type string   $plugin       Plugin basename.
   567 		 *     @type string $description Plugin description.
   570 		 *     @type string   $new_version  New plugin version.
   568 		 *     @type string $author      Plugin author.
   571 		 *     @type string   $url          Plugin URL.
   569 		 *     @type string $author_uri  Plugin author URI.
   572 		 *     @type string   $package      Plugin update package URL.
   570 		 *     @type string $text_domain Plugin text domain.
   573 		 *     @type string[] $icons        An array of plugin icon URLs.
   571 		 *     @type string $domain_path Relative path to the plugin's .mo file(s).
   574 		 *     @type string[] $banners      An array of plugin banner URLs.
   572 		 *     @type bool   $network     Whether the plugin can only be activated network wide.
   575 		 *     @type string[] $banners_rtl  An array of plugin RTL banner URLs.
   573 		 *     @type string $title       The human-readable title of the plugin.
   576 		 *     @type string   $requires     The version of WordPress which the plugin requires.
   574 		 *     @type string $author_name Plugin author's name.
   577 		 *     @type string   $tested       The version of WordPress the plugin is tested against.
   575 		 *     @type bool   $update      Whether there's an available update. Default null.
   578 		 *     @type string   $requires_php The version of PHP which the plugin requires.
   576 		 * }
       
   577 		 * @param array $response {
       
   578 		 *     An array of metadata about the available plugin update.
       
   579 		 *
       
   580 		 *     @type int    $id          Plugin ID.
       
   581 		 *     @type string $slug        Plugin slug.
       
   582 		 *     @type string $new_version New plugin version.
       
   583 		 *     @type string $url         Plugin URL.
       
   584 		 *     @type string $package     Plugin update package URL.
       
   585 		 * }
   579 		 * }
   586 		 */
   580 		 */
   587 		do_action( "in_plugin_update_message-{$file}", $plugin_data, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
   581 		do_action( "in_plugin_update_message-{$file}", $plugin_data, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
   588 
   582 
   589 		echo '</p></div></td></tr>';
   583 		echo '</p></div></td></tr>';
   726 		}
   720 		}
   727 	} else {
   721 	} else {
   728 		if ( ! $compatible_wp && ! $compatible_php ) {
   722 		if ( ! $compatible_wp && ! $compatible_php ) {
   729 			printf(
   723 			printf(
   730 				/* translators: %s: Theme name. */
   724 				/* translators: %s: Theme name. */
   731 				__( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
   725 				__( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
   732 				$theme['Name']
   726 				$theme['Name']
   733 			);
   727 			);
   734 			if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   728 			if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
   735 				printf(
   729 				printf(
   736 					/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   730 					/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
   754 				wp_update_php_annotation( '</p><p><em>', '</em>' );
   748 				wp_update_php_annotation( '</p><p><em>', '</em>' );
   755 			}
   749 			}
   756 		} elseif ( ! $compatible_wp ) {
   750 		} elseif ( ! $compatible_wp ) {
   757 			printf(
   751 			printf(
   758 				/* translators: %s: Theme name. */
   752 				/* translators: %s: Theme name. */
   759 				__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
   753 				__( 'There is a new version of %s available, but it does not work with your version of WordPress.' ),
   760 				$theme['Name']
   754 				$theme['Name']
   761 			);
   755 			);
   762 			if ( current_user_can( 'update_core' ) ) {
   756 			if ( current_user_can( 'update_core' ) ) {
   763 				printf(
   757 				printf(
   764 					/* translators: %s: URL to WordPress Updates screen. */
   758 					/* translators: %s: URL to WordPress Updates screen. */
   767 				);
   761 				);
   768 			}
   762 			}
   769 		} elseif ( ! $compatible_php ) {
   763 		} elseif ( ! $compatible_php ) {
   770 			printf(
   764 			printf(
   771 				/* translators: %s: Theme name. */
   765 				/* translators: %s: Theme name. */
   772 				__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
   766 				__( 'There is a new version of %s available, but it does not work with your version of PHP.' ),
   773 				$theme['Name']
   767 				$theme['Name']
   774 			);
   768 			);
   775 			if ( current_user_can( 'update_php' ) ) {
   769 			if ( current_user_can( 'update_php' ) ) {
   776 				printf(
   770 				printf(
   777 					/* translators: %s: URL to Update PHP page. */
   771 					/* translators: %s: URL to Update PHP page. */