wp/wp-includes/class-wp-recovery-mode-email-service.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
    38 	 * Sends the recovery mode email if the rate limit has not been sent.
    38 	 * Sends the recovery mode email if the rate limit has not been sent.
    39 	 *
    39 	 *
    40 	 * @since 5.2.0
    40 	 * @since 5.2.0
    41 	 *
    41 	 *
    42 	 * @param int   $rate_limit Number of seconds before another email can be sent.
    42 	 * @param int   $rate_limit Number of seconds before another email can be sent.
    43 	 * @param array $error      Error details from {@see error_get_last()}
    43 	 * @param array $error      Error details from `error_get_last()`.
    44 	 * @param array $extension {
    44 	 * @param array $extension {
    45 	 *     The extension that caused the error.
    45 	 *     The extension that caused the error.
    46 	 *
    46 	 *
    47 	 *     @type string $slug The extension slug. The plugin or theme's directory.
    47 	 *     @type string $slug The extension slug. The plugin or theme's directory.
    48 	 *     @type string $type The extension type. Either 'plugin' or 'theme'.
    48 	 *     @type string $type The extension type. Either 'plugin' or 'theme'.
    99 	 * Sends the Recovery Mode email to the site admin email address.
    99 	 * Sends the Recovery Mode email to the site admin email address.
   100 	 *
   100 	 *
   101 	 * @since 5.2.0
   101 	 * @since 5.2.0
   102 	 *
   102 	 *
   103 	 * @param int   $rate_limit Number of seconds before another email can be sent.
   103 	 * @param int   $rate_limit Number of seconds before another email can be sent.
   104 	 * @param array $error      Error details from {@see error_get_last()}
   104 	 * @param array $error      Error details from `error_get_last()`.
   105 	 * @param array $extension  Extension that caused the error.
   105 	 * @param array $extension {
       
   106 	 *     The extension that caused the error.
       
   107 	 *
       
   108 	 *     @type string $slug The extension slug. The directory of the plugin or theme.
       
   109 	 *     @type string $type The extension type. Either 'plugin' or 'theme'.
       
   110 	 * }
   106 	 * @return bool Whether the email was sent successfully.
   111 	 * @return bool Whether the email was sent successfully.
   107 	 */
   112 	 */
   108 	private function send_recovery_mode_email( $rate_limit, $error, $extension ) {
   113 	private function send_recovery_mode_email( $rate_limit, $error, $extension ) {
   109 
   114 
   110 		$url      = $this->link_service->generate_url();
   115 		$url      = $this->link_service->generate_url();
   254 	/**
   259 	/**
   255 	 * Gets the description indicating the possible cause for the error.
   260 	 * Gets the description indicating the possible cause for the error.
   256 	 *
   261 	 *
   257 	 * @since 5.2.0
   262 	 * @since 5.2.0
   258 	 *
   263 	 *
   259 	 * @param array $extension The extension that caused the error.
   264 	 * @param array $extension {
       
   265 	 *     The extension that caused the error.
       
   266 	 *
       
   267 	 *     @type string $slug The extension slug. The directory of the plugin or theme.
       
   268 	 *     @type string $type The extension type. Either 'plugin' or 'theme'.
       
   269 	 * }
   260 	 * @return string Message about which extension caused the error.
   270 	 * @return string Message about which extension caused the error.
   261 	 */
   271 	 */
   262 	private function get_cause( $extension ) {
   272 	private function get_cause( $extension ) {
   263 
   273 
   264 		if ( 'plugin' === $extension['type'] ) {
   274 		if ( 'plugin' === $extension['type'] ) {
   286 	/**
   296 	/**
   287 	 * Return the details for a single plugin based on the extension data from an error.
   297 	 * Return the details for a single plugin based on the extension data from an error.
   288 	 *
   298 	 *
   289 	 * @since 5.3.0
   299 	 * @since 5.3.0
   290 	 *
   300 	 *
   291 	 * @param array $extension The extension that caused the error.
   301 	 * @param array $extension {
       
   302 	 *     The extension that caused the error.
       
   303 	 *
       
   304 	 *     @type string $slug The extension slug. The directory of the plugin or theme.
       
   305 	 *     @type string $type The extension type. Either 'plugin' or 'theme'.
       
   306 	 * }
   292 	 * @return array|false A plugin array {@see get_plugins()} or `false` if no plugin was found.
   307 	 * @return array|false A plugin array {@see get_plugins()} or `false` if no plugin was found.
   293 	 */
   308 	 */
   294 	private function get_plugin( $extension ) {
   309 	private function get_plugin( $extension ) {
   295 		if ( ! function_exists( 'get_plugins' ) ) {
   310 		if ( ! function_exists( 'get_plugins' ) ) {
   296 			require_once ABSPATH . 'wp-admin/includes/plugin.php';
   311 			require_once ABSPATH . 'wp-admin/includes/plugin.php';
   315 	/**
   330 	/**
   316 	 * Return debug information in an easy to manipulate format.
   331 	 * Return debug information in an easy to manipulate format.
   317 	 *
   332 	 *
   318 	 * @since 5.3.0
   333 	 * @since 5.3.0
   319 	 *
   334 	 *
   320 	 * @param array $extension The extension that caused the error.
   335 	 * @param array $extension {
       
   336 	 *     The extension that caused the error.
       
   337 	 *
       
   338 	 *     @type string $slug The extension slug. The directory of the plugin or theme.
       
   339 	 *     @type string $type The extension type. Either 'plugin' or 'theme'.
       
   340 	 * }
   321 	 * @return array An associative array of debug information.
   341 	 * @return array An associative array of debug information.
   322 	 */
   342 	 */
   323 	private function get_debug( $extension ) {
   343 	private function get_debug( $extension ) {
   324 		$theme      = wp_get_theme();
   344 		$theme      = wp_get_theme();
   325 		$wp_version = get_bloginfo( 'version' );
   345 		$wp_version = get_bloginfo( 'version' );
   336 				__( 'WordPress version %s' ),
   356 				__( 'WordPress version %s' ),
   337 				$wp_version
   357 				$wp_version
   338 			),
   358 			),
   339 			'theme' => sprintf(
   359 			'theme' => sprintf(
   340 				/* translators: 1: Current active theme name. 2: Current active theme version. */
   360 				/* translators: 1: Current active theme name. 2: Current active theme version. */
   341 				__( 'Current theme: %1$s (version %2$s)' ),
   361 				__( 'Active theme: %1$s (version %2$s)' ),
   342 				$theme->get( 'Name' ),
   362 				$theme->get( 'Name' ),
   343 				$theme->get( 'Version' )
   363 				$theme->get( 'Version' )
   344 			),
   364 			),
   345 		);
   365 		);
   346 
   366