X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/607b7e02d77e7326161e8ec15639052d2040f745..16e7b37c7914d753890c1a05a9335f3b43751eb8:/wp-admin/includes/plugin-install.php diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php index 4d558cf0..0d932c26 100644 --- a/wp-admin/includes/plugin-install.php +++ b/wp-admin/includes/plugin-install.php @@ -109,7 +109,7 @@ function plugins_api( $action, $args = array() ) { } if ( ! isset( $args->locale ) ) { - $args->locale = get_locale(); + $args->locale = get_user_locale(); } /** @@ -155,16 +155,38 @@ function plugins_api( $action, $args = array() ) { $request = wp_remote_post( $url, $http_args ); if ( $ssl && is_wp_error( $request ) ) { - trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); + trigger_error( + sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), + headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE + ); $request = wp_remote_post( $http_url, $http_args ); } if ( is_wp_error($request) ) { - $res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), $request->get_error_message() ); + $res = new WP_Error( 'plugins_api_failed', + sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ), + $request->get_error_message() + ); } else { $res = maybe_unserialize( wp_remote_retrieve_body( $request ) ); - if ( ! is_object( $res ) && ! is_array( $res ) ) - $res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), wp_remote_retrieve_body( $request ) ); + if ( ! is_object( $res ) && ! is_array( $res ) ) { + $res = new WP_Error( 'plugins_api_failed', + sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ), + wp_remote_retrieve_body( $request ) + ); + } } } elseif ( !is_wp_error($res) ) { $res->external = true; @@ -210,7 +232,7 @@ function install_popular_tags( $args = array() ) { */ function install_dashboard() { ?> -

WordPress Plugin Directory or upload a plugin in .zip format by clicking the button at the top of this page.' ), 'https://wordpress.org/plugins/' ); ?>

+

WordPress Plugin Directory or upload a plugin in .zip format by clicking the button at the top of this page.' ), __( 'https://wordpress.org/plugins/' ) ); ?>

@@ -263,9 +285,9 @@ function install_search_form( $deprecated = true ) { - 'search-submit' ) ); ?> + 'search-submit' ) ); ?> - + tested ) ) { ?>
  • tested; ?>
  • - active_installs ) ) { ?> + active_installs ) ) { ?>
  • active_installs >= 1000000 ) { _ex( '1+ Million', 'Active plugin installs' ); + } elseif ( 0 == $api->active_installs ) { + _ex( 'Less Than 10', 'Active plugin installs' ); } else { echo number_format_i18n( $api->active_installs ) . '+'; } ?>
  • slug ) && empty( $api->external ) ) { ?> -
  • +
  • homepage ) ) { ?>
  • donate_link ) && empty( $api->contributors ) ) { ?> @@ -630,9 +660,11 @@ function install_plugin_information() {
    tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) ) { + $wp_version = get_bloginfo( 'version' ); + + if ( ! empty( $api->tested ) && version_compare( substr( $wp_version, 0, strlen( $api->tested ) ), $api->tested, '>' ) ) { echo '

    ' . __( 'Warning: This plugin has not been tested with your current version of WordPress.' ) . '

    '; - } elseif ( ! empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) ) { + } elseif ( ! empty( $api->requires ) && version_compare( substr( $wp_version, 0, strlen( $api->requires ) ), $api->requires, '<' ) ) { echo '

    ' . __( 'Warning: This plugin has not been marked as compatible with your version of WordPress.' ) . '

    '; }