Friendlier strings with links to the support forums when experiencing problems talking to api.wordpress.org. fixes #20605
git-svn-id: http://core.svn.wordpress.org/trunk@20752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
519af69e93
commit
1a5249997e
|
@ -43,11 +43,11 @@ function plugins_api($action, $args = null) {
|
||||||
if ( false === $res ) {
|
if ( false === $res ) {
|
||||||
$request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'timeout' => 15, 'body' => array('action' => $action, 'request' => serialize($args))) );
|
$request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'timeout' => 15, 'body' => array('action' => $action, 'request' => serialize($args))) );
|
||||||
if ( is_wp_error($request) ) {
|
if ( is_wp_error($request) ) {
|
||||||
$res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occurred during the API request.'), $request->get_error_message() );
|
$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 <a href="http://wordpress.org/support/">support forums</a>.' ), $request->get_error_message() );
|
||||||
} else {
|
} else {
|
||||||
$res = maybe_unserialize( wp_remote_retrieve_body( $request ) );
|
$res = maybe_unserialize( wp_remote_retrieve_body( $request ) );
|
||||||
if ( ! is_object( $res ) && ! is_array( $res ) )
|
if ( ! is_object( $res ) && ! is_array( $res ) )
|
||||||
$res = new WP_Error('plugins_api_failed', __('An unknown error occurred during the API request.'), wp_remote_retrieve_body( $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 <a href="http://wordpress.org/support/">support forums</a>.' ), wp_remote_retrieve_body( $request ) );
|
||||||
}
|
}
|
||||||
} elseif ( !is_wp_error($res) ) {
|
} elseif ( !is_wp_error($res) ) {
|
||||||
$res->external = true;
|
$res->external = true;
|
||||||
|
|
|
@ -283,11 +283,11 @@ function themes_api($action, $args = null) {
|
||||||
if ( ! $res ) {
|
if ( ! $res ) {
|
||||||
$request = wp_remote_post('http://api.wordpress.org/themes/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) );
|
$request = wp_remote_post('http://api.wordpress.org/themes/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) );
|
||||||
if ( is_wp_error($request) ) {
|
if ( is_wp_error($request) ) {
|
||||||
$res = new WP_Error('themes_api_failed', __('An Unexpected HTTP Error occurred during the API request.'), $request->get_error_message() );
|
$res = new WP_Error('themes_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 <a href="http://wordpress.org/support/">support forums</a>.' ), $request->get_error_message() );
|
||||||
} else {
|
} else {
|
||||||
$res = maybe_unserialize( wp_remote_retrieve_body( $request ) );
|
$res = maybe_unserialize( wp_remote_retrieve_body( $request ) );
|
||||||
if ( ! is_object( $res ) && ! is_array( $res ) )
|
if ( ! is_object( $res ) && ! is_array( $res ) )
|
||||||
$res = new WP_Error('themes_api_failed', __('An unknown error occurred during the API request.'), wp_remote_retrieve_body( $request ) );
|
$res = new WP_Error('themes_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 <a href="http://wordpress.org/support/">support forums</a>.' ), wp_remote_retrieve_body( $request ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue