PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | class/class-mainwp-notification.php +62 -2 6.0.12 → 6.2.1 View file →
@@ -286,9 +286,10 @@
286 286 static::send_wp_mail(
287 287 $emails,
288 288 $subject,
289 289 $mail_content,
290 - $content_type
290 + $content_type,
291 + $site_mo
291 292 );
292 293 }
293 294 }
294 295
@@ -324,8 +325,41 @@
324 325 }
325 326
326 327
327 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 + /**
328 362 * Method send_wp_mail().
329 363 *
330 364 * Send email via wp_mail().
331 365 *
@@ -332,10 +366,11 @@
332 366 * @param string $email send to email.
333 367 * @param string $subject email content.
334 368 * @param string $mail_content Text format.
335 369 * @param string $content_type email content.
370 + * @param mixed $object_sending Optional object associated with the email being sent.
336 371 */
337 - public static function send_wp_mail( $email, $subject, $mail_content, $content_type = '' ) {
372 + public static function send_wp_mail( $email, $subject, $mail_content, $content_type = '', $object_sending = null ) {
338 373 if ( empty( $content_type ) ) {
339 374 $content_type = "Content-Type: text/html; charset=\"utf-8\"\r\n";
340 375 }
341 376
@@ -346,8 +381,33 @@
346 381
347 382 $custom_header = apply_filters( 'mainwp_send_mail_from_header', false, $email, $subject );
348 383 if ( is_array( $custom_header ) && isset( $custom_header['from_name'] ) && isset( $custom_header['from_email'] ) && ! empty( $custom_header['from_name'] ) && ! empty( $custom_header['from_email'] ) ) {
349 384 $from_header = $custom_header;
385 + }
386 +
387 + /**
388 + * Fires before an email is sent via wp_mail().
389 + *
390 + * @since 6.1.6
391 + *
392 + * @param string $email Recipient email address.
393 + * @param string $subject Email subject.
394 + * @param string $mail_content Email message content.
395 + * @param string $content_type Email content type.
396 + * @param object|mixed $object_sending Object associated with the email being sent.
397 + */
398 + $email = apply_filters(
399 + 'mainwp_wp_mail_to',
400 + $email,
401 + $subject,
402 + $mail_content,
403 + $content_type,
404 + $object_sending
405 + );
406 +
407 + if ( empty( $email ) ) {
408 + // stop send.
409 + return false;
350 410 }
351 411
352 412 return wp_mail(
353 413 $email,