pyrocms/pyrocms — pull request #2349 by Solinx (2013-02-01 18:03:56+00:00)
Title: Refactoring the Contact plugin

The code of the contact plugin has been refactored on a few aspects.

1. Improvements related to PSR-2

2. Only validate input if submitted
The validation library is only loaded when necessary.

3. Handling of form submit after validation is cleaned up
Code for the e-mail, the database entry, and autoresponse mail was mixed without reason and without hints in comments.

4. Error messages for the email events
I first simplified the code for setting an error message and then put it in a separate method because there are two email events.

Note: Following the example of another locally referenced method I used self::method to call my new method. Curiously enough the other method is not declared as 'static'. Because I'm not certain about how you load your classes I copied this.

Note: This code relies on the eloquent Contact model: https://github.com/pyrocms/pyrocms/pull/2346

Refactoring the plugin was mentioned here:
https://github.com/pyrocms/pyrocms/issues/2324