@@ -39,7 +39,7 @@ |
||
39 | 39 | public function notificationRecipients($comment) { |
40 | 40 | // Override this in your extending class to declare recipients |
41 | 41 | $list = array(); |
42 | - if($adminEmail = Email::config()->admin_email) { |
|
42 | + if ($adminEmail = Email::config()->admin_email) { |
|
43 | 43 | $list[] = $adminEmail; |
44 | 44 | } |
45 | 45 | $this->owner->extend('updateNotificationRecipients', $list, $comment); |
@@ -14,11 +14,11 @@ discard block |
||
14 | 14 | */ |
15 | 15 | public function onAfterPostComment(Comment $comment) { |
16 | 16 | $parent = $comment->getParent(); |
17 | - if(!$parent) return; |
|
17 | + if (!$parent) return; |
|
18 | 18 | |
19 | 19 | // Ask parent to submit all recipients |
20 | 20 | $recipients = $parent->notificationRecipients($comment); |
21 | - foreach($recipients as $recipient) { |
|
21 | + foreach ($recipients as $recipient) { |
|
22 | 22 | $this->notifyCommentRecipient($comment, $parent, $recipient); |
23 | 23 | } |
24 | 24 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @return boolean |
34 | 34 | */ |
35 | 35 | public function isValidEmail($email) { |
36 | - if(!$email) return false; |
|
36 | + if (!$email) return false; |
|
37 | 37 | |
38 | 38 | $pcrePattern = '^[a-z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&\'*+/=?^_`{|}~-]+)*' |
39 | 39 | . '@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$'; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $to = $recipient instanceof Member |
62 | 62 | ? $recipient->Email |
63 | 63 | : $recipient; |
64 | - if(!$this->isValidEmail($to)) return; |
|
64 | + if (!$this->isValidEmail($to)) return; |
|
65 | 65 | |
66 | 66 | // Prepare the email |
67 | 67 | $email = new Email(); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | 'Comment' => $comment, |
75 | 75 | 'Recipient' => $recipient |
76 | 76 | )); |
77 | - if($recipient instanceof Member) { |
|
77 | + if ($recipient instanceof Member) { |
|
78 | 78 | $email->populateTemplate(array( |
79 | 79 | 'ApproveLink' => $comment->ApproveLink($recipient), |
80 | 80 | 'HamLink' => $comment->HamLink($recipient), |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | // Until invokeWithExtensions supports multiple arguments |
87 | - if(method_exists($this->owner, 'updateCommentNotification')) { |
|
87 | + if (method_exists($this->owner, 'updateCommentNotification')) { |
|
88 | 88 | $this->owner->updateCommentNotification($email, $comment, $recipient); |
89 | 89 | } |
90 | 90 | $this->owner->extend('updateCommentNotification', $email, $comment, $recipient); |
@@ -14,7 +14,9 @@ discard block |
||
14 | 14 | */ |
15 | 15 | public function onAfterPostComment(Comment $comment) { |
16 | 16 | $parent = $comment->getParent(); |
17 | - if(!$parent) return; |
|
17 | + if(!$parent) { |
|
18 | + return; |
|
19 | + } |
|
18 | 20 | |
19 | 21 | // Ask parent to submit all recipients |
20 | 22 | $recipients = $parent->notificationRecipients($comment); |
@@ -33,7 +35,9 @@ discard block |
||
33 | 35 | * @return boolean |
34 | 36 | */ |
35 | 37 | public function isValidEmail($email) { |
36 | - if(!$email) return false; |
|
38 | + if(!$email) { |
|
39 | + return false; |
|
40 | + } |
|
37 | 41 | |
38 | 42 | $pcrePattern = '^[a-z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&\'*+/=?^_`{|}~-]+)*' |
39 | 43 | . '@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$'; |
@@ -61,7 +65,9 @@ discard block |
||
61 | 65 | $to = $recipient instanceof Member |
62 | 66 | ? $recipient->Email |
63 | 67 | : $recipient; |
64 | - if(!$this->isValidEmail($to)) return; |
|
68 | + if(!$this->isValidEmail($to)) { |
|
69 | + return; |
|
70 | + } |
|
65 | 71 | |
66 | 72 | // Prepare the email |
67 | 73 | $email = new Email(); |