PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.34
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.34
6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 6.5.4 All 140 releases
formidable / classes / models / FrmNotification.php

FrmNotification.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.34, at classes/models/FrmNotification.php

77 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 class FrmNotification {
7 public function __construct() {
8 self::hook_emails_to_action();
9 }
10
11 /**
12 * Trigger an email action
13 *
14 * @param object $action
15 * @param object $entry
16 * @param object $form
17 *
18 * @return void
19 */
20 public static function trigger_email( $action, $entry, $form ) {
21 $email = new FrmEmail( $action, $entry, $form );
22
23 if ( ! $email->should_send() ) {
24 return;
25 }
26
27 $sent = $email->send();
28
29 if ( $sent ) {
30 self::print_recipients( $email->package_atts() );
31 }
32 }
33
34 /**
35 * Remove the trigger_email function from the frm_trigger_email_action hook
36 *
37 * @since 2.03.04
38 *
39 * @return void
40 */
41 public static function stop_emails() {
42 remove_action( 'frm_trigger_email_action', 'FrmNotification::trigger_email', 10 );
43 }
44
45 /**
46 * Hook the trigger_email function to frm_trigger_email_action action
47 *
48 * @since 2.03.04
49 *
50 * @return void
51 */
52 public static function hook_emails_to_action() {
53 add_action( 'frm_trigger_email_action', 'FrmNotification::trigger_email', 10, 3 );
54 }
55
56 /**
57 * Print the recipients
58 *
59 * @since 2.03.04
60 *
61 * @param array $atts
62 *
63 * @return void
64 */
65 private static function print_recipients( $atts ) {
66 if ( ! apply_filters( 'frm_echo_emails', false ) ) {
67 return;
68 }
69
70 $sent_to = array_merge( (array) $atts['to_email'], (array) $atts['cc'], (array) $atts['bcc'] );
71 $sent_to = array_filter( $sent_to );
72 $temp = str_replace( '<', '&lt;', $sent_to );
73 echo ' ';
74 FrmAppHelper::kses_echo( implode( ', ', $temp ) );
75 }
76 }
77