Skip to content

Commit

Permalink
Add spam check example.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Aug 26, 2014
1 parent afd22ea commit 442fee1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions whups/config/hooks.php.dist
Expand Up @@ -58,10 +58,10 @@ class Whups_Hooks
*/
// public function ticket_update($ticket, $changes)
// {
// // Example: If a comment has been added to a closed ticket, re-open
// // the ticket and set the state to "assigned". You might
// // want to use numeric ids for the 'to' item in a real life
// // hook.
// // Example #1: If a comment has been added to a closed ticket,
// // re-open the ticket and set the state to "assigned".
// // You might want to use numeric ids for the 'to' item in
// // a real life hook.
// /* We only want to change the ticket state if it is closed, a comment
// * has been added, and the state hasn't been changed already. */
// if (!empty($changes['comment']) &&
Expand All @@ -77,6 +77,12 @@ class Whups_Hooks
// 'from_name' => $ticket->get('state_name'));
// }
//
// // Example #2: Simple spam check.
// if (isset($changes['comment']['to']) &&
// stripos($changes['comment']['to'], 'some spam text') !== false) {
// throw new Whups_Exception('Spammer!');
// }
//
// return $changes;
// }
}

0 comments on commit 442fee1

Please sign in to comment.