X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/784f914b1e4b1c62d6657e86397c2e83bcee4295..16e7b37c7914d753890c1a05a9335f3b43751eb8:/wp-admin/includes/plugin-install.php diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php index b1727a27..0d932c26 100644 --- a/wp-admin/includes/plugin-install.php +++ b/wp-admin/includes/plugin-install.php @@ -20,7 +20,7 @@ * * The second filter, {@see 'plugins_api'}, allows a plugin to override the WordPress.org * Plugin Install API entirely. If `$action` is 'query_plugins' or 'plugin_information', - * an object MUST be passed. If `$action` is 'hot_tags` or 'hot_categories', an array MUST + * an object MUST be passed. If `$action` is 'hot_tags' or 'hot_categories', an array MUST * be passed. * * Finally, the third filter, {@see 'plugins_api_result'}, makes it possible to filter the @@ -109,11 +109,11 @@ function plugins_api( $action, $args = array() ) { } if ( ! isset( $args->locale ) ) { - $args->locale = get_locale(); + $args->locale = get_user_locale(); } /** - * Filter the WordPress.org Plugin Install API arguments. + * Filters the WordPress.org Plugin Install API arguments. * * Important: An object MUST be returned to this filter. * @@ -125,12 +125,12 @@ function plugins_api( $action, $args = array() ) { $args = apply_filters( 'plugins_api_args', $args, $action ); /** - * Filter the response for the current WordPress.org Plugin Install API request. + * Filters the response for the current WordPress.org Plugin Install API request. * * Passing a non-false value will effectively short-circuit the WordPress.org API request. * * If `$action` is 'query_plugins' or 'plugin_information', an object MUST be passed. - * If `$action` is 'hot_tags` or 'hot_categories', an array should be passed. + * If `$action` is 'hot_tags' or 'hot_categories', an array should be passed. * * @since 2.7.0 * @@ -155,23 +155,45 @@ 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; } /** - * Filter the Plugin Install API response results. + * Filters the Plugin Install API response results. * * @since 2.7.0 * @@ -210,10 +232,11 @@ function install_popular_tags( $args = array() ) { */ function install_dashboard() { ?> -

WordPress Plugin Directory or upload a plugin in .zip format via this page.' ), 'https://wordpress.org/plugins/', self_admin_url( 'plugin-install.php?tab=upload' ) ); ?>

+

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

+ '; } /** - * Display search form for searching plugins. + * Displays a search form for searching plugins. * * @since 2.7.0 + * @since 4.6.0 The `$type_selector` parameter was deprecated. * - * @param bool $type_selector + * @param bool $deprecated Not used. */ -function install_search_form( $type_selector = true ) { - $type = isset($_REQUEST['type']) ? wp_unslash( $_REQUEST['type'] ) : 'term'; - $term = isset($_REQUEST['s']) ? wp_unslash( $_REQUEST['s'] ) : ''; - $input_attrs = ''; - $button_type = 'button screen-reader-text'; - - // assume no $type_selector means it's a simplified search form - if ( ! $type_selector ) { - $input_attrs = 'class="wp-filter-search" placeholder="' . esc_attr__( 'Search Plugins' ) . '" '; - } - +function install_search_form( $deprecated = true ) { + $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; + $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : ''; ?>
- + - -