@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -defined( 'ABSPATH' ) || die(); |
|
| 2 | +defined('ABSPATH') || die(); |
|
| 3 | 3 | /* |
| 4 | 4 | Plugin Name: WFV - Form Validation |
| 5 | 5 | Plugin URI: https://macder.github.io/wfv/ |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | License URI: https://github.com/macder/wfv-validation/blob/master/LICENSE |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -define( 'WFV_VALIDATE_VERSION', '0.11.2' ); |
|
| 15 | -define( 'WFV_VALIDATE__MINIMUM_WP_VERSION', '3.7' ); |
|
| 16 | -define( 'WFV_VALIDATE__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
| 14 | +define('WFV_VALIDATE_VERSION', '0.11.2'); |
|
| 15 | +define('WFV_VALIDATE__MINIMUM_WP_VERSION', '3.7'); |
|
| 16 | +define('WFV_VALIDATE__PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
| 17 | 17 | |
| 18 | -require_once WFV_VALIDATE__PLUGIN_DIR . '/vendor/autoload.php'; |
|
| 18 | +require_once WFV_VALIDATE__PLUGIN_DIR.'/vendor/autoload.php'; |
|
| 19 | 19 | |
| 20 | 20 | use WFV\FormComposite; |
| 21 | 21 | use WFV\Agent\InspectionAgent; |
@@ -33,19 +33,19 @@ discard block |
||
| 33 | 33 | * @param array $form Form arguments |
| 34 | 34 | * @param bool $trim Trim whitespace from beginning and end of string |
| 35 | 35 | */ |
| 36 | -function wfv_create( $action, array &$form, $trim = true ) { |
|
| 37 | - $guard = new InspectionAgent( $action ); |
|
| 36 | +function wfv_create($action, array &$form, $trim = true) { |
|
| 37 | + $guard = new InspectionAgent($action); |
|
| 38 | 38 | |
| 39 | - $builder = new FormArtisan( $form ); |
|
| 40 | - $form = ( new Director( $action ) ) |
|
| 41 | - ->with( 'input', $guard ) |
|
| 42 | - ->with( 'rules' ) |
|
| 43 | - ->with( 'errors' ) |
|
| 44 | - ->with( 'factory' ) |
|
| 45 | - ->with( 'validator' ) |
|
| 46 | - ->compose( $builder ); |
|
| 39 | + $builder = new FormArtisan($form); |
|
| 40 | + $form = (new Director($action)) |
|
| 41 | + ->with('input', $guard) |
|
| 42 | + ->with('rules') |
|
| 43 | + ->with('errors') |
|
| 44 | + ->with('factory') |
|
| 45 | + ->with('validator') |
|
| 46 | + ->compose($builder); |
|
| 47 | 47 | |
| 48 | - if( $form->input()->is_populated() ) { |
|
| 48 | + if ($form->input()->is_populated()) { |
|
| 49 | 49 | $form->validate(); |
| 50 | 50 | } |
| 51 | 51 | } |