PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 4.3.6
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v4.3.6
6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 3.6.66 All 195 releases
fluentform / app / Services / FormBuilder / NotificationParser.php

NotificationParser.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 4.3.6, at app/Services/FormBuilder/NotificationParser.php

43 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App\Services\FormBuilder;
4
5 use FluentForm\App\Services\FormBuilder\ShortCodeParser;
6
7 class NotificationParser
8 {
9 protected static $cache = null;
10
11 /**
12 * Parse Norifications
13 * @param array $notifications
14 * @param int $insertId
15 * @param array $data
16 * @param object $form
17 * @return bool $cache
18 */
19 public static function parse($notifications, $insertId, $data, $form, $cache = true)
20 {
21 if ($cache && !is_null(static::$cache)) {
22 return static::$cache;
23 }
24
25 foreach ($notifications as &$notification) {
26 static::setRecepient($notification, $data);
27
28 $notification = ShortCodeParser::parse(
29 $notification, $insertId, $data, $form
30 );
31 }
32
33 return $cache ? (static::$cache = $notifications) : $notifications;
34 }
35
36 protected static function setRecepient(&$notification, $data)
37 {
38 if (isset($notification['sendTo']) && $notification['sendTo']['type'] == 'field') {
39 $notification['sendTo']['email'] = $data[$notification['sendTo']['field']];
40 }
41 }
42 }
43