diff -r 490d5cc509ed -r cf61fcea0001 wp/wp-admin/includes/translation-install.php --- a/wp/wp-admin/includes/translation-install.php Tue Jun 09 11:14:17 2015 +0000 +++ b/wp/wp-admin/includes/translation-install.php Mon Oct 14 17:39:30 2019 +0200 @@ -1,6 +1,6 @@ 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, $options ); } if ( is_wp_error( $request ) ) { - $res = new WP_Error( 'translations_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( 'translations_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 = json_decode( wp_remote_retrieve_body( $request ), true ); if ( ! is_object( $res ) && ! is_array( $res ) ) { - $res = new WP_Error( 'translations_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 ) ); + $res = new WP_Error( 'translations_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 ) + ); } } } /** - * Filter the Translation Install API response results. + * Filters the Translation Installation API response results. * * @since 4.0.0 * @@ -94,7 +115,7 @@ * in an error, an empty array will be returned. */ function wp_get_available_translations() { - if ( ! defined( 'WP_INSTALLING' ) && false !== ( $translations = get_site_transient( 'available_translations' ) ) ) { + if ( ! wp_installing() && false !== ( $translations = get_site_transient( 'available_translations' ) ) ) { return $translations; } @@ -124,6 +145,8 @@ * * @since 4.0.0 * + * @global string $wp_local_package + * * @param array $languages Array of available languages (populated via the Translation API). */ function wp_install_language_form( $languages ) { @@ -179,7 +202,7 @@ return $download; } - if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) { + if ( ! wp_is_file_mod_allowed( 'download_language_pack' ) ) { return false; } @@ -222,7 +245,7 @@ * @return bool Returns true on success, false on failure. */ function wp_can_install_language_pack() { - if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) { + if ( ! wp_is_file_mod_allowed( 'can_install_language_pack' ) ) { return false; }