X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/wordpress.git/blobdiff_plain/138998bbd8f7a1ac38b2f1eacbdf7cd522be4b13..ef91a7f4f3c6468973e192335a27ec0e0faca0b5:/wp-admin/includes/plugin-install.php?ds=inline diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php index bb450e12..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'] ) : ''; ?> ' . __( 'These suggestions are based on the plugins you and other users have installed.' ) . ''; break; + case 'install_plugins_beta' : + printf( + '' . __( 'You are using a development version of WordPress. These feature plugins are also under development. Learn more.' ) . '
', + 'https://make.wordpress.org/core/handbook/about/release-cycle/features-as-plugins/' + ); + break; } ?> @@ -347,9 +370,16 @@ function display_plugins_table() { * * @since 3.0.0 * - * @param array|object $api - * @param bool $loop - * @return type + * @param array|object $api Data about the plugin retrieved from the API. + * @param bool $loop Optional. Disable further loops. Default false. + * @return array { + * Plugin installation status data. + * + * @type string $status Status of a plugin. Could be one of 'install', 'update_available', 'latest_installed' or 'newer_installed'. + * @type string $url Plugin installation URL. + * @type string $version The most recent version of the plugin. + * @type string $file Plugin filename relative to the plugins directory. + * } */ function install_plugin_install_status($api, $loop = false) { // This function is called recursively, $loop prevents further loops. @@ -422,7 +452,6 @@ function install_plugin_install_status($api, $loop = false) { * @since 2.7.0 * * @global string $tab - * @global string $wp_version */ function install_plugin_information() { global $tab; @@ -531,63 +560,75 @@ function install_plugin_information() { echo "\n"; - $date_format = __( 'M j, Y @ H:i' ); - - if ( ! empty( $api->last_updated ) ) { - $last_updated_timestamp = strtotime( $api->last_updated ); - } - ?> -' . __( 'Warning: This plugin has not been tested with your current version of WordPress.' ) . '
' . __( 'Warning: This plugin has not been marked as compatible with your version of WordPress.' ) . '
' . __( 'Warning: This plugin has not been tested with your current version of WordPress.' ) . '
' . __( 'Warning: This plugin has not been marked as compatible with your version of WordPress.' ) . '