| @@ -325,8 +325,41 @@ | ||
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | |
| 328 | 328 | /** |
| 329 | + * Start notification for auto update info. | |
| 330 | + * | |
| 331 | + * @param array $admin_email_settings Admin email settings. | |
| 332 | + * @param array $params Parameters for the notification. | |
| 333 | + * | |
| 334 | + * @return void | |
| 335 | + */ | |
| 336 | + public static function start_notification_auto_updates_info( $admin_email_settings, $params = array() ) { | |
| 337 | + | |
| 338 | + $email = isset( $admin_email_settings['recipients'] ) ? $admin_email_settings['recipients'] : ''; | |
| 339 | + $subject = isset( $admin_email_settings['subject'] ) ? $admin_email_settings['subject'] : ''; | |
| 340 | + $plain_text = isset( $params['plain_text'] ) ? $params['plain_text'] : false; | |
| 341 | + $mail_content = isset( $params['mail_content'] ) ? $params['mail_content'] : ''; | |
| 342 | + | |
| 343 | + if ( $plain_text ) { | |
| 344 | + $content_type = "Content-Type: text/plain; charset=\"utf-8\"\r\n"; | |
| 345 | + } else { | |
| 346 | + $content_type = "Content-Type: text/html; charset=\"utf-8\"\r\n"; | |
| 347 | + } | |
| 348 | + | |
| 349 | + if ( ! empty( $email ) && ! empty( $mail_content ) ) { | |
| 350 | + MainWP_Logger::instance()->log_events( 'auto-updates', 'Auto updates notification :: send mail' ); | |
| 351 | + static::send_wp_mail( | |
| 352 | + $email, | |
| 353 | + $subject, | |
| 354 | + $mail_content, | |
| 355 | + $content_type | |
| 356 | + ); | |
| 357 | + } | |
| 358 | + } | |
| 359 | + | |
| 360 | + | |
| 361 | + /** | |
| 329 | 362 | * Method send_wp_mail(). |
| 330 | 363 | * |
| 331 | 364 | * Send email via wp_mail(). |
| 332 | 365 | * |