WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Recovery_Mode_Email_Service::send_recovery_mode_email() private WP 5.2.0

Sends the Recovery Mode email to the site admin email address.

Это метод класса: WP_Recovery_Mode_Email_Service{}

Возвращает

true/false. Whether the email was sent successfully.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->send_recovery_mode_email( $rate_limit, $error, $extension );
$rate_limit(число) (обязательный)
Number of seconds before another email can be sent.
$error(массив) (обязательный)
Error details from {@see error_get_last()}
$extension(массив) (обязательный)
Extension that caused the error.

Список изменений

С версии 5.2.0 Введена.

Код WP_Recovery_Mode_Email_Service::send_recovery_mode_email() WP 5.5.1

wp-includes/class-wp-recovery-mode-email-service.php
<?php
private function send_recovery_mode_email( $rate_limit, $error, $extension ) {

	$url      = $this->link_service->generate_url();
	$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );

	$switched_locale = false;

	// The switch_to_locale() function is loaded before it can actually be used.
	if ( function_exists( 'switch_to_locale' ) && isset( $GLOBALS['wp_locale_switcher'] ) ) {
		$switched_locale = switch_to_locale( get_locale() );
	}

	if ( $extension ) {
		$cause   = $this->get_cause( $extension );
		$details = wp_strip_all_tags( wp_get_extension_error_description( $error ) );

		if ( $details ) {
			$header  = __( 'Error Details' );
			$details = "\n\n" . $header . "\n" . str_pad( '', strlen( $header ), '=' ) . "\n" . $details;
		}
	} else {
		$cause   = '';
		$details = '';
	}

	/**
	 * Filters the support message sent with the the fatal error protection email.
	 *
	 * @since 5.2.0
	 *
	 * @param string $message The Message to include in the email.
	 */
	$support = apply_filters( 'recovery_email_support_info', __( 'Please contact your host for assistance with investigating this issue further.' ) );

	/**
	 * Filters the debug information included in the fatal error protection email.
	 *
	 * @since 5.3.0
	 *
	 * @param array $message An associative array of debug information.
	 */
	$debug = apply_filters( 'recovery_email_debug_info', $this->get_debug( $extension ) );

	/* translators: Do not translate LINK, EXPIRES, CAUSE, DETAILS, SITEURL, PAGEURL, SUPPORT. DEBUG: those are placeholders. */
	$message = __(
		'Howdy!

Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email.
###CAUSE###
First, visit your website (###SITEURL###) and check for any visible issues. Next, visit the page where the error was caught (###PAGEURL###) and check for any visible issues.

###SUPPORT###

If your site appears broken and you can\'t access your dashboard normally, WordPress now has a special "recovery mode". This lets you safely login to your dashboard and investigate further.

###LINK###

To keep your site safe, this link will expire in ###EXPIRES###. Don\'t worry about that, though: a new link will be emailed to you if the error occurs again after it expires.

When seeking help with this issue, you may be asked for some of the following information:
###DEBUG###

###DETAILS###'
	);
	$message = str_replace(
		array(
			'###LINK###',
			'###EXPIRES###',
			'###CAUSE###',
			'###DETAILS###',
			'###SITEURL###',
			'###PAGEURL###',
			'###SUPPORT###',
			'###DEBUG###',
		),
		array(
			$url,
			human_time_diff( time() + $rate_limit ),
			$cause ? "\n{$cause}\n" : "\n",
			$details,
			home_url( '/' ),
			home_url( $_SERVER['REQUEST_URI'] ),
			$support,
			implode( "\r\n", $debug ),
		),
		$message
	);

	$email = array(
		'to'      => $this->get_recovery_mode_email_address(),
		/* translators: %s: Site title. */
		'subject' => __( '[%s] Your Site is Experiencing a Technical Issue' ),
		'message' => $message,
		'headers' => '',
	);

	/**
	 * Filter the contents of the Recovery Mode email.
	 *
	 * @since 5.2.0
	 *
	 * @param array  $email Used to build wp_mail().
	 * @param string $url   URL to enter recovery mode.
	 */
	$email = apply_filters( 'recovery_mode_email', $email, $url );

	$sent = wp_mail(
		$email['to'],
		wp_specialchars_decode( sprintf( $email['subject'], $blogname ) ),
		$email['message'],
		$email['headers']
	);

	if ( $switched_locale ) {
		restore_previous_locale();
	}

	return $sent;
}