wp/wp-includes/class-wp-recovery-mode-email-service.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    73 				)
    73 				)
    74 			);
    74 			);
    75 		}
    75 		}
    76 
    76 
    77 		$err_message = sprintf(
    77 		$err_message = sprintf(
    78 			/* translators: 1. Last sent as a human time diff, 2. Wait time as a human time diff. */
    78 			/* translators: 1: Last sent as a human time diff, 2: Wait time as a human time diff. */
    79 			__( 'A recovery link was already sent %1$s ago. Please wait another %2$s before requesting a new email.' ),
    79 			__( 'A recovery link was already sent %1$s ago. Please wait another %2$s before requesting a new email.' ),
    80 			human_time_diff( $last_sent ),
    80 			human_time_diff( $last_sent ),
    81 			human_time_diff( $last_sent + $rate_limit )
    81 			human_time_diff( $last_sent + $rate_limit )
    82 		);
    82 		);
    83 
    83 
   192 			),
   192 			),
   193 			$message
   193 			$message
   194 		);
   194 		);
   195 
   195 
   196 		$email = array(
   196 		$email = array(
   197 			'to'      => $this->get_recovery_mode_email_address(),
   197 			'to'          => $this->get_recovery_mode_email_address(),
   198 			/* translators: %s: Site title. */
   198 			/* translators: %s: Site title. */
   199 			'subject' => __( '[%s] Your Site is Experiencing a Technical Issue' ),
   199 			'subject'     => __( '[%s] Your Site is Experiencing a Technical Issue' ),
   200 			'message' => $message,
   200 			'message'     => $message,
   201 			'headers' => '',
   201 			'headers'     => '',
       
   202 			'attachments' => '',
   202 		);
   203 		);
   203 
   204 
   204 		/**
   205 		/**
   205 		 * Filter the contents of the Recovery Mode email.
   206 		 * Filters the contents of the Recovery Mode email.
   206 		 *
   207 		 *
   207 		 * @since 5.2.0
   208 		 * @since 5.2.0
   208 		 *
   209 		 * @since 5.6.0 The `$email` argument includes the `attachments` key.
   209 		 * @param array  $email Used to build wp_mail().
   210 		 *
       
   211 		 * @param array  $email {
       
   212 		 *     Used to build a call to wp_mail().
       
   213 		 *
       
   214 		 *     @type string|array $to          Array or comma-separated list of email addresses to send message.
       
   215 		 *     @type string       $subject     Email subject
       
   216 		 *     @type string       $message     Message contents
       
   217 		 *     @type string|array $headers     Optional. Additional headers.
       
   218 		 *     @type string|array $attachments Optional. Files to attach.
       
   219 		 * }
   210 		 * @param string $url   URL to enter recovery mode.
   220 		 * @param string $url   URL to enter recovery mode.
   211 		 */
   221 		 */
   212 		$email = apply_filters( 'recovery_mode_email', $email, $url );
   222 		$email = apply_filters( 'recovery_mode_email', $email, $url );
   213 
   223 
   214 		$sent = wp_mail(
   224 		$sent = wp_mail(
   215 			$email['to'],
   225 			$email['to'],
   216 			wp_specialchars_decode( sprintf( $email['subject'], $blogname ) ),
   226 			wp_specialchars_decode( sprintf( $email['subject'], $blogname ) ),
   217 			$email['message'],
   227 			$email['message'],
   218 			$email['headers']
   228 			$email['headers'],
       
   229 			$email['attachments']
   219 		);
   230 		);
   220 
   231 
   221 		if ( $switched_locale ) {
   232 		if ( $switched_locale ) {
   222 			restore_previous_locale();
   233 			restore_previous_locale();
   223 		}
   234 		}
   276 	 * Return the details for a single plugin based on the extension data from an error.
   287 	 * Return the details for a single plugin based on the extension data from an error.
   277 	 *
   288 	 *
   278 	 * @since 5.3.0
   289 	 * @since 5.3.0
   279 	 *
   290 	 *
   280 	 * @param array $extension The extension that caused the error.
   291 	 * @param array $extension The extension that caused the error.
   281 	 * @return bool|array A plugin array {@see get_plugins()} or `false` if no plugin was found.
   292 	 * @return array|false A plugin array {@see get_plugins()} or `false` if no plugin was found.
   282 	 */
   293 	 */
   283 	private function get_plugin( $extension ) {
   294 	private function get_plugin( $extension ) {
   284 		if ( ! function_exists( 'get_plugins' ) ) {
   295 		if ( ! function_exists( 'get_plugins' ) ) {
   285 			require_once ABSPATH . 'wp-admin/includes/plugin.php';
   296 			require_once ABSPATH . 'wp-admin/includes/plugin.php';
   286 		}
   297 		}
   318 		} else {
   329 		} else {
   319 			$plugin = null;
   330 			$plugin = null;
   320 		}
   331 		}
   321 
   332 
   322 		$debug = array(
   333 		$debug = array(
   323 			/* translators: %s: Current WordPress version number. */
       
   324 			'wp'    => sprintf(
   334 			'wp'    => sprintf(
       
   335 				/* translators: %s: Current WordPress version number. */
   325 				__( 'WordPress version %s' ),
   336 				__( 'WordPress version %s' ),
   326 				$wp_version
   337 				$wp_version
   327 			),
   338 			),
   328 			'theme' => sprintf(
   339 			'theme' => sprintf(
   329 				/* translators: 1: Current active theme name. 2: Current active theme version. */
   340 				/* translators: 1: Current active theme name. 2: Current active theme version. */