Completed
Branch BUG/11252/payment-method-regis... (ef7b02)
by
unknown
52:18 queued 38:58
created
line_item_display/EE_Invoice_Line_Item_Display_Strategy.strategy.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EE_Invoice_Line_Item_Display_Strategy
5
- *
6
- * Description
7
- *
8
- * @package         Event Espresso
9
- * @subpackage    core
10
- * @author				Brent Christensen
11
- * 
12
- *
13
- */
3
+  *
4
+  * Class EE_Invoice_Line_Item_Display_Strategy
5
+  *
6
+  * Description
7
+  *
8
+  * @package         Event Espresso
9
+  * @subpackage    core
10
+  * @author				Brent Christensen
11
+  * 
12
+  *
13
+  */
14 14
 class EE_Invoice_Line_Item_Display_Strategy implements EEI_Line_Item_Display {
15 15
 
16 16
 	/**
Please login to merge, or discard this patch.
form_sections/strategies/display/EE_Select_Display_Strategy.strategy.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -11,49 +11,49 @@  discard block
 block discarded – undo
11 11
  * 
12 12
  *
13 13
  */
14
-class EE_Select_Display_Strategy extends EE_Display_Strategy_Base{
14
+class EE_Select_Display_Strategy extends EE_Display_Strategy_Base {
15 15
 
16 16
 	/**
17 17
 	 *
18 18
 	 * @throws EE_Error
19 19
 	 * @return string of html to display the field
20 20
 	 */
21
-	function display(){
22
-		if( ! $this->_input instanceof EE_Form_Input_With_Options_Base){
23
-			throw new EE_Error( sprintf( __( 'Cannot use Select Display Strategy with an input that doesn\'t have options', 'event_espresso' )));
21
+	function display() {
22
+		if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) {
23
+			throw new EE_Error(sprintf(__('Cannot use Select Display Strategy with an input that doesn\'t have options', 'event_espresso')));
24 24
 		}
25 25
 
26
-		$html = EEH_HTML::nl( 0, 'select' );
26
+		$html = EEH_HTML::nl(0, 'select');
27 27
 		$html .= '<select';
28
-		$html .= ' id="' . $this->_input->html_id() . '"';
29
-		$html .= ' name="' . $this->_input->html_name() . '"';
30
-		$class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class();
31
-		$html .= ' class="' . $class . '"';
28
+		$html .= ' id="'.$this->_input->html_id().'"';
29
+		$html .= ' name="'.$this->_input->html_name().'"';
30
+		$class = $this->_input->required() ? $this->_input->required_css_class().' '.$this->_input->html_class() : $this->_input->html_class();
31
+		$html .= ' class="'.$class.'"';
32 32
 		// add html5 required
33 33
 		$html .= $this->_input->required() ? ' required' : '';
34
-		$html .= ' style="' . $this->_input->html_style() . '"';
35
-		$html .= ' ' . $this->_input->other_html_attributes();
34
+		$html .= ' style="'.$this->_input->html_style().'"';
35
+		$html .= ' '.$this->_input->other_html_attributes();
36 36
 		$html .= '>';
37 37
 
38
-		if ( EEH_Array::is_multi_dimensional_array( $this->_input->options() )) {
39
-			EEH_HTML::indent( 1, 'optgroup' );
40
-			foreach( $this->_input->options() as $opt_group_label => $opt_group ){
38
+		if (EEH_Array::is_multi_dimensional_array($this->_input->options())) {
39
+			EEH_HTML::indent(1, 'optgroup');
40
+			foreach ($this->_input->options() as $opt_group_label => $opt_group) {
41 41
 			    if ( ! empty($opt_group_label)) {
42
-                    $html .= EEH_HTML::nl(0, 'optgroup') . '<optgroup label="' . esc_attr($opt_group_label) . '">';
42
+                    $html .= EEH_HTML::nl(0, 'optgroup').'<optgroup label="'.esc_attr($opt_group_label).'">';
43 43
                 }
44
-				EEH_HTML::indent( 1, 'option' );
45
-				$html .= $this->_display_options( $opt_group );
44
+				EEH_HTML::indent(1, 'option');
45
+				$html .= $this->_display_options($opt_group);
46 46
 				EEH_HTML::indent( -1, 'option' );
47 47
                 if ( ! empty($opt_group_label)) {
48
-                    $html .= EEH_HTML::nl( 0, 'optgroup' ) . '</optgroup>';
48
+                    $html .= EEH_HTML::nl(0, 'optgroup').'</optgroup>';
49 49
 			    }
50 50
 			}
51 51
 			EEH_HTML::indent( -1, 'optgroup' );
52 52
 		} else {
53
-			$html.=$this->_display_options( $this->_input->options() );
53
+			$html .= $this->_display_options($this->_input->options());
54 54
 		}
55 55
 
56
-		$html.= EEH_HTML::nl( 0, 'select' ) . '</select>';
56
+		$html .= EEH_HTML::nl(0, 'select').'</select>';
57 57
 		return $html;
58 58
 	}
59 59
 
@@ -64,15 +64,15 @@  discard block
 block discarded – undo
64 64
 	 * @param array $options
65 65
 	 * @return string
66 66
 	 */
67
-	protected function _display_options($options){
67
+	protected function _display_options($options) {
68 68
 		$html = '';
69
-		EEH_HTML::indent( 1, 'option' );
70
-		foreach( $options as $value => $display_text ){
69
+		EEH_HTML::indent(1, 'option');
70
+		foreach ($options as $value => $display_text) {
71 71
 		    //even if this input uses EE_Text_Normalization if one of the array keys is a numeric string, like "123",
72 72
             //PHP will have converted it to a PHP integer (eg 123). So we need to make sure it's a string
73
-            $unnormalized_value = $this->_input->get_normalization_strategy()->unnormalize_one( $value );
74
-            $selected = $this->_check_if_option_selected($unnormalized_value ) ? ' selected="selected"' : '';
75
-            $html.= EEH_HTML::nl( 0, 'option' ) . '<option value="' . esc_attr($unnormalized_value ) . '"' . $selected . '>' . $display_text . '</option>';
73
+            $unnormalized_value = $this->_input->get_normalization_strategy()->unnormalize_one($value);
74
+            $selected = $this->_check_if_option_selected($unnormalized_value) ? ' selected="selected"' : '';
75
+            $html .= EEH_HTML::nl(0, 'option').'<option value="'.esc_attr($unnormalized_value).'"'.$selected.'>'.$display_text.'</option>';
76 76
 		}
77 77
 		EEH_HTML::indent( -1, 'option' );
78 78
 		return $html;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @param string|int $option_value unnormalized value option (string). How it will appear in the HTML.
87 87
 	 * @return string
88 88
 	 */
89
-	protected function _check_if_option_selected($option_value ){
89
+	protected function _check_if_option_selected($option_value) {
90 90
 		return $option_value === $this->_input->raw_value();
91 91
 	}
92 92
 
Please login to merge, or discard this patch.
form_sections/strategies/display/EE_Select2_Display_Strategy.strategy.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * 
13 13
  *
14 14
  */
15
-class EE_Select2_Display_Strategy extends EE_Select_Display_Strategy{
15
+class EE_Select2_Display_Strategy extends EE_Select_Display_Strategy {
16 16
 
17 17
 	/**
18 18
 	 * Arguments that will be passed into the select2 javascript constructor
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param array $select2_js_args pass in the EXACT array of JS arguments you want
26 26
 	 * to pass into the select2 js/html input. See https://select2.github.io
27 27
 	 */
28
-	public function __construct( $select2_js_args = array() ) {
28
+	public function __construct($select2_js_args = array()) {
29 29
 		$this->_select2_js_args = $select2_js_args;
30 30
 		parent::__construct();
31 31
 	}
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 	public function enqueue_js() {
38 38
 		// need to first deregister the select2 script in case some other plugin **cough cough Toolset Types cough**
39 39
 		// is carelessly registering an older version of Select2 on admin pages that don't even belong to them
40
-		wp_deregister_script( 'select2' );
41
-		wp_deregister_style( 'select2' );
42
-		wp_register_script( 'select2', EE_GLOBAL_ASSETS_URL . 'scripts/select2.min.js', array(), '4.0.2', true );
43
-		wp_register_style( 'select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all' );
44
-		wp_enqueue_script( 'form_section_select2_init', EE_GLOBAL_ASSETS_URL . 'scripts/form_section_select2_init.js', array( 'select2' ), '1.0.0', true );
45
-		wp_enqueue_style( 'select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all' );
40
+		wp_deregister_script('select2');
41
+		wp_deregister_style('select2');
42
+		wp_register_script('select2', EE_GLOBAL_ASSETS_URL.'scripts/select2.min.js', array(), '4.0.2', true);
43
+		wp_register_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all');
44
+		wp_enqueue_script('form_section_select2_init', EE_GLOBAL_ASSETS_URL.'scripts/form_section_select2_init.js', array('select2'), '1.0.0', true);
45
+		wp_enqueue_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all');
46 46
 	}
47 47
 
48 48
 	/**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * Sets the exact js args which will be passed into the select2 js/html input
58 58
 	 * @param array $js_args
59 59
 	 */
60
-	public function set_js_args( $js_args ) {
60
+	public function set_js_args($js_args) {
61 61
 		$this->_select2_js_args = $js_args;
62 62
 	}
63 63
 
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 	 * @param array $other_js_data
67 67
 	 * @return array
68 68
 	 */
69
-	public function get_other_js_data( $other_js_data = array() ) {
70
-		$other_js_data = parent::get_other_js_data( $other_js_data );
71
-		if( ! isset( $other_js_data[ 'select2s' ] ) ) {
69
+	public function get_other_js_data($other_js_data = array()) {
70
+		$other_js_data = parent::get_other_js_data($other_js_data);
71
+		if ( ! isset($other_js_data['select2s'])) {
72 72
 			$other_js_data['select2s'] = array();
73 73
 		}
74
-		$other_js_data[ 'select2s' ][ $this->_input->html_id() ] = $this->get_js_args();
74
+		$other_js_data['select2s'][$this->_input->html_id()] = $this->get_js_args();
75 75
 		return $other_js_data;
76 76
 	}
77 77
 }
78 78
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Country_Select_Input.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php  if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); }
1
+<?php  if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3 3
  * Class EE_Country_Select_Input
4 4
  *
@@ -11,23 +11,23 @@  discard block
 block discarded – undo
11 11
  * 
12 12
  *
13 13
  */
14
-class EE_Country_Select_Input extends EE_Select_Input{
14
+class EE_Country_Select_Input extends EE_Select_Input {
15 15
 
16 16
 	/**
17 17
 	 * @param array $country_options
18 18
 	 * @param array $input_settings
19 19
 	 * @return EE_Country_Select_Input
20 20
 	 */
21
-	public function __construct( $country_options = NULL, $input_settings = array() ){
21
+	public function __construct($country_options = NULL, $input_settings = array()) {
22 22
 		$country_options = apply_filters(
23 23
 			'FHEE__EE_Country_Select_Input____construct__country_options',
24
-			$this->get_country_answer_options( $country_options ),
24
+			$this->get_country_answer_options($country_options),
25 25
 			$this
26 26
 		);
27
-		$input_settings['html_class'] = isset( $input_settings['html_class'] )
28
-			? $input_settings['html_class'] . ' ee-country-select-js'
27
+		$input_settings['html_class'] = isset($input_settings['html_class'])
28
+			? $input_settings['html_class'].' ee-country-select-js'
29 29
 			: 'ee-country-select-js';
30
-		parent::__construct( $country_options, $input_settings );
30
+		parent::__construct($country_options, $input_settings);
31 31
 	}
32 32
 
33 33
 
@@ -38,16 +38,16 @@  discard block
 block discarded – undo
38 38
 	 * @param array $country_options
39 39
 	 * @return array
40 40
 	 */
41
-	public function get_country_answer_options( $country_options = NULL ){
41
+	public function get_country_answer_options($country_options = NULL) {
42 42
 		// if passed something that is NOT an array
43
-		if ( ! is_array( $country_options )) {
43
+		if ( ! is_array($country_options)) {
44 44
 			// get possibly cached list of countries
45 45
 			$countries = EEM_Country::instance()->get_all_active_countries();
46
-			if ( ! empty( $countries )) {
47
-				$country_options[ '' ] = '';
48
-				foreach( $countries as $country ){
49
-					if ( $country instanceof EE_Country ) {
50
-						$country_options[ $country->ID() ] = $country->name();
46
+			if ( ! empty($countries)) {
47
+				$country_options[''] = '';
48
+				foreach ($countries as $country) {
49
+					if ($country instanceof EE_Country) {
50
+						$country_options[$country->ID()] = $country->name();
51 51
 					}
52 52
 				}
53 53
 			} else {
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Checkbox_Multi_Input.input.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3 3
  *
4 4
  * Class EE_Checkbox_Multi_Input
@@ -11,16 +11,16 @@  discard block
 block discarded – undo
11 11
  * 
12 12
  *
13 13
  */
14
-class EE_Checkbox_Multi_Input extends EE_Form_Input_With_Options_Base{
14
+class EE_Checkbox_Multi_Input extends EE_Form_Input_With_Options_Base {
15 15
 
16 16
 	/**
17 17
 	 * @param array $input_settings
18 18
 	 * @param array | EE_Question_Option[] $answer_options
19 19
 	 */
20
-	public function __construct( $answer_options, $input_settings = array() ) {
21
-		$this->_set_display_strategy( new EE_Checkbox_Display_Strategy() );
22
-		$this->_add_validation_strategy( new EE_Many_Valued_Validation_Strategy( array( new EE_Enum_Validation_Strategy( isset( $input_settings[ 'validation_error_message' ] ) ? $input_settings[ 'validation_error_message' ] : NULL ) )));
20
+	public function __construct($answer_options, $input_settings = array()) {
21
+		$this->_set_display_strategy(new EE_Checkbox_Display_Strategy());
22
+		$this->_add_validation_strategy(new EE_Many_Valued_Validation_Strategy(array(new EE_Enum_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL))));
23 23
 		$this->_multiple_selections = TRUE;
24
-		parent::__construct( $answer_options, $input_settings );
24
+		parent::__construct($answer_options, $input_settings);
25 25
 	}
26 26
 }
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
payment_methods/Paypal_Standard/EE_PMT_Paypal_Standard.pm.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * 
11 11
  *
12 12
  */
13
-class EE_PMT_Paypal_Standard extends EE_PMT_Base{
13
+class EE_PMT_Paypal_Standard extends EE_PMT_Base {
14 14
 
15 15
 	const shipping_info_none = 1;
16 16
 	const shipping_info_optional = 0;
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @param \EE_Transaction $transaction
47 47
 	 * @return NULL
48 48
 	 */
49
-	public function generate_new_billing_form( EE_Transaction $transaction = NULL ) {
49
+	public function generate_new_billing_form(EE_Transaction $transaction = NULL) {
50 50
 		return NULL;
51 51
 	}
52 52
 
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
 	 * @throws \EE_Error
60 60
 	 */
61 61
 	public function generate_new_settings_form() {
62
-		require_once( $this->file_folder() . 'EE_Paypal_Standard_Form.form.php' );
63
-		$form =  new EE_Paypal_Standard_Form( $this );
64
-		$form->get_input( 'PMD_debug_mode' )->set_html_label_text(
65
-			sprintf( __( "Use PayPal Sandbox %s", 'event_espresso' ), $this->get_help_tab_link() )
62
+		require_once($this->file_folder().'EE_Paypal_Standard_Form.form.php');
63
+		$form = new EE_Paypal_Standard_Form($this);
64
+		$form->get_input('PMD_debug_mode')->set_html_label_text(
65
+			sprintf(__("Use PayPal Sandbox %s", 'event_espresso'), $this->get_help_tab_link())
66 66
 		);
67
-		$form->get_input( 'shipping_details' )->set_html_label_text(
68
-			sprintf( __( "Shipping Address Options %s", "event_espresso" ), $this->get_help_tab_link() )
67
+		$form->get_input('shipping_details')->set_html_label_text(
68
+			sprintf(__("Shipping Address Options %s", "event_espresso"), $this->get_help_tab_link())
69 69
 		);
70 70
 		return $form;
71 71
 	}
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @see EE_PMT_Base::help_tabs_config()
78 78
 	 * @return array
79 79
 	 */
80
-	public function help_tabs_config(){
80
+	public function help_tabs_config() {
81 81
 		return array(
82 82
 			$this->get_help_tab_name() => array(
83 83
 				'title'=>  __("PayPal Standard Settings", 'event_espresso'),
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
 	 * @return EE_Payment
100 100
 	 * @throws \EE_Error
101 101
 	 */
102
-	public function finalize_payment_for($transaction){
102
+	public function finalize_payment_for($transaction) {
103 103
 		// PayPal standard actually sends the IPN info along with the user when they return to our site
104 104
 		// so in case the IPN is arriving later, let's try to process an IPN!
105
-		if( $_SERVER['REQUEST_METHOD'] === 'POST' ){
106
-			return $this->handle_ipn($_POST, $transaction );
107
-		}else{
108
-			return parent::finalize_payment_for( $transaction );
105
+		if ($_SERVER['REQUEST_METHOD'] === 'POST') {
106
+			return $this->handle_ipn($_POST, $transaction);
107
+		} else {
108
+			return parent::finalize_payment_for($transaction);
109 109
 		}
110 110
 	}
111 111
 
Please login to merge, or discard this patch.
core/middleware/EE_Detect_File_Editor_Request.core.php 2 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -13,45 +13,45 @@
 block discarded – undo
13 13
 class EE_Detect_File_Editor_Request extends EE_Middleware
14 14
 {
15 15
 
16
-    /**
17
-     * Converts a Request to a Response
18
-     *
19
-     * @param EE_Request  $request
20
-     * @param EE_Response $response
21
-     * @return EE_Response
22
-     */
23
-    public function handle_request(EE_Request $request, EE_Response $response)
24
-    {
25
-        $this->_request = $request;
26
-        $this->_response = $response;
27
-        $this->setFiltersForRequest();
28
-        $this->_response = $this->process_request_stack($this->_request, $this->_response);
29
-        return $this->_response;
30
-    }
16
+	/**
17
+	 * Converts a Request to a Response
18
+	 *
19
+	 * @param EE_Request  $request
20
+	 * @param EE_Response $response
21
+	 * @return EE_Response
22
+	 */
23
+	public function handle_request(EE_Request $request, EE_Response $response)
24
+	{
25
+		$this->_request = $request;
26
+		$this->_response = $response;
27
+		$this->setFiltersForRequest();
28
+		$this->_response = $this->process_request_stack($this->_request, $this->_response);
29
+		return $this->_response;
30
+	}
31 31
 
32 32
 
33
-    /**
34
-     * This sets any filters that need set on this request.
35
-     */
36
-    protected function setFiltersForRequest()
37
-    {
38
-        if (! $this->isFileEditorRequest()) {
39
-            return;
40
-        }
41
-        add_filter('FHEE_load_EE_Session', '__return_false', 999);
42
-    }
33
+	/**
34
+	 * This sets any filters that need set on this request.
35
+	 */
36
+	protected function setFiltersForRequest()
37
+	{
38
+		if (! $this->isFileEditorRequest()) {
39
+			return;
40
+		}
41
+		add_filter('FHEE_load_EE_Session', '__return_false', 999);
42
+	}
43 43
 
44 44
 
45
-    /**
46
-     * Conditions for a "file editor request"
47
-     * @see wp-admin/includes/file.php
48
-     *      The file editor does a loopback request to the admin AND to the frontend when checking active theme or
49
-     *      active plugin edits.  So these conditions consider that.
50
-     * @return bool
51
-     */
52
-    protected function isFileEditorRequest()
53
-    {
54
-        return $this->_request->get('wp_scrape_key')
55
-               && $this->_request->get('wp_scrape_nonce');
56
-    }
45
+	/**
46
+	 * Conditions for a "file editor request"
47
+	 * @see wp-admin/includes/file.php
48
+	 *      The file editor does a loopback request to the admin AND to the frontend when checking active theme or
49
+	 *      active plugin edits.  So these conditions consider that.
50
+	 * @return bool
51
+	 */
52
+	protected function isFileEditorRequest()
53
+	{
54
+		return $this->_request->get('wp_scrape_key')
55
+			   && $this->_request->get('wp_scrape_nonce');
56
+	}
57 57
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      */
36 36
     protected function setFiltersForRequest()
37 37
     {
38
-        if (! $this->isFileEditorRequest()) {
38
+        if ( ! $this->isFileEditorRequest()) {
39 39
             return;
40 40
         }
41 41
         add_filter('FHEE_load_EE_Session', '__return_false', 999);
Please login to merge, or discard this patch.
core/EE_Bootstrap.core.php 1 patch
Indentation   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -29,192 +29,192 @@
 block discarded – undo
29 29
 class EE_Bootstrap
30 30
 {
31 31
 
32
-    /**
33
-     * @var EE_Request $request
34
-     */
35
-    protected $request;
36
-
37
-    /**
38
-     * @var EE_Response $response
39
-     */
40
-    protected $response;
41
-
42
-    /**
43
-     * @var EE_Request_Stack_Builder $request_stack_builder
44
-     */
45
-    protected $request_stack_builder;
46
-
47
-    /**
48
-     * @var EE_Request_Stack $_request_stack
49
-     */
50
-    protected $request_stack;
51
-
52
-
53
-
54
-    public function __construct(EE_Request $request, EE_Response $response)
55
-    {
56
-        $this->request = $request;
57
-        $this->response = $response;
58
-        // construct request stack and run middleware apps as soon as all WP plugins are loaded
59
-        add_action('plugins_loaded', array($this, 'run_request_stack'), 0);
60
-        // set framework for the rest of EE to hook into when loading
61
-        add_action('plugins_loaded', array('EE_Bootstrap', 'load_espresso_addons'), 1);
62
-        add_action('plugins_loaded', array('EE_Bootstrap', 'detect_activations_or_upgrades'), 3);
63
-        add_action('plugins_loaded', array('EE_Bootstrap', 'load_core_configuration'), 5);
64
-        add_action('plugins_loaded', array('EE_Bootstrap', 'register_shortcodes_modules_and_widgets'), 7);
65
-        add_action('plugins_loaded', array('EE_Bootstrap', 'brew_espresso'), 9);
66
-    }
67
-
68
-
69
-
70
-    /**
71
-     * run_request_stack
72
-     * construct request stack and run middleware apps
73
-     *
74
-     * @throws EE_Error
75
-     * @throws InvalidArgumentException
76
-     */
77
-    public function run_request_stack()
78
-    {
79
-        $this->load_autoloader();
80
-        $this->set_autoloaders_for_required_files();
81
-        $this->request_stack_builder = $this->build_request_stack();
82
-        $this->request_stack = $this->request_stack_builder->resolve(
83
-            new EE_Load_Espresso_Core()
84
-        );
85
-        $this->request_stack->handle_request($this->request, $this->response);
86
-        $this->request_stack->handle_response();
87
-    }
88
-
89
-
90
-
91
-    /**
92
-     * load_autoloader
93
-     */
94
-    protected function load_autoloader()
95
-    {
96
-        // load interfaces
97
-        espresso_load_required(
98
-            'EEH_Autoloader',
99
-            EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php'
100
-        );
101
-        EEH_Autoloader::instance();
102
-    }
103
-
104
-
105
-
106
-    /**
107
-     * load_required_files
108
-     *
109
-     * @throws EE_Error
110
-     */
111
-    protected function set_autoloaders_for_required_files()
112
-    {
113
-        // load interfaces
114
-        EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true);
115
-        // load helpers
116
-        EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS);
117
-        // load request stack
118
-        EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack' . DS);
119
-        // load middleware
120
-        EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware' . DS);
121
-    }
122
-
123
-
124
-
125
-    /**
126
-     * build_request_stack
127
-     *
128
-     * @return EE_Request_Stack_Builder
129
-     * @throws InvalidArgumentException
130
-     */
131
-    public function build_request_stack()
132
-    {
133
-        $request_stack_builder = new EE_Request_Stack_Builder();
134
-        $stack_apps = apply_filters(
135
-            'FHEE__EE_Bootstrap__build_request_stack__stack_apps',
136
-            array(
137
-                'EE_Detect_File_Editor_Request',
138
-                'EE_Detect_Login',
139
-                'EE_Recommended_Versions',
140
-                'EE_Alpha_Banner_Warning',
141
-            )
142
-        );
143
-        // load middleware onto stack : FILO (First In Last Out)
144
-        foreach ((array)$stack_apps as $stack_app) {
145
-            //$request_stack_builder->push( $stack_app );
146
-            $request_stack_builder->unshift($stack_app);
147
-        }
148
-        return apply_filters(
149
-            'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder',
150
-            $request_stack_builder
151
-        );
152
-    }
153
-
154
-
155
-
156
-    /**
157
-     * load_espresso_addons
158
-     * runs during the WP 'plugins_loaded' action at priority 1
159
-     * and is the initial loading phase for EE addons
160
-     * no other logic should be performed at this point
161
-     */
162
-    public static function load_espresso_addons()
163
-    {
164
-        do_action('AHEE__EE_Bootstrap__load_espresso_addons');
165
-    }
166
-
167
-
168
-
169
-    /**
170
-     * detect_activations_or_upgrades
171
-     * runs during the WP 'plugins_loaded' action at priority 3
172
-     * Now that all of the addons have been loaded,
173
-     * we can determine if anything needs activating or upgrading
174
-     */
175
-    public static function detect_activations_or_upgrades()
176
-    {
177
-        do_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades');
178
-    }
179
-
180
-
181
-
182
-    /**
183
-     * load_core_configuration
184
-     * runs during the WP 'plugins_loaded' action at priority 5
185
-     * Now that the database is assumed to be at the correct version
186
-     * we can load and set all of the system configurations
187
-     */
188
-    public static function load_core_configuration()
189
-    {
190
-        do_action('AHEE__EE_Bootstrap__load_core_configuration');
191
-    }
192
-
193
-
194
-
195
-    /**
196
-     * register_shortcodes_modules_and_widgets
197
-     * runs during the WP 'plugins_loaded' action at priority 7
198
-     * and handles registering all o four shortcodes, modules and widgets
199
-     * so that they are ready to be used throughout the system
200
-     */
201
-    public static function register_shortcodes_modules_and_widgets()
202
-    {
203
-        do_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets');
204
-    }
205
-
206
-
207
-
208
-    /**
209
-     * brew_espresso
210
-     * runs during the WP 'plugins_loaded' action at priority 9
211
-     * bootstrapping is considered complete at this point,
212
-     * so let the fun begin...
213
-     */
214
-    public static function brew_espresso()
215
-    {
216
-        do_action('AHEE__EE_Bootstrap__brew_espresso');
217
-    }
32
+	/**
33
+	 * @var EE_Request $request
34
+	 */
35
+	protected $request;
36
+
37
+	/**
38
+	 * @var EE_Response $response
39
+	 */
40
+	protected $response;
41
+
42
+	/**
43
+	 * @var EE_Request_Stack_Builder $request_stack_builder
44
+	 */
45
+	protected $request_stack_builder;
46
+
47
+	/**
48
+	 * @var EE_Request_Stack $_request_stack
49
+	 */
50
+	protected $request_stack;
51
+
52
+
53
+
54
+	public function __construct(EE_Request $request, EE_Response $response)
55
+	{
56
+		$this->request = $request;
57
+		$this->response = $response;
58
+		// construct request stack and run middleware apps as soon as all WP plugins are loaded
59
+		add_action('plugins_loaded', array($this, 'run_request_stack'), 0);
60
+		// set framework for the rest of EE to hook into when loading
61
+		add_action('plugins_loaded', array('EE_Bootstrap', 'load_espresso_addons'), 1);
62
+		add_action('plugins_loaded', array('EE_Bootstrap', 'detect_activations_or_upgrades'), 3);
63
+		add_action('plugins_loaded', array('EE_Bootstrap', 'load_core_configuration'), 5);
64
+		add_action('plugins_loaded', array('EE_Bootstrap', 'register_shortcodes_modules_and_widgets'), 7);
65
+		add_action('plugins_loaded', array('EE_Bootstrap', 'brew_espresso'), 9);
66
+	}
67
+
68
+
69
+
70
+	/**
71
+	 * run_request_stack
72
+	 * construct request stack and run middleware apps
73
+	 *
74
+	 * @throws EE_Error
75
+	 * @throws InvalidArgumentException
76
+	 */
77
+	public function run_request_stack()
78
+	{
79
+		$this->load_autoloader();
80
+		$this->set_autoloaders_for_required_files();
81
+		$this->request_stack_builder = $this->build_request_stack();
82
+		$this->request_stack = $this->request_stack_builder->resolve(
83
+			new EE_Load_Espresso_Core()
84
+		);
85
+		$this->request_stack->handle_request($this->request, $this->response);
86
+		$this->request_stack->handle_response();
87
+	}
88
+
89
+
90
+
91
+	/**
92
+	 * load_autoloader
93
+	 */
94
+	protected function load_autoloader()
95
+	{
96
+		// load interfaces
97
+		espresso_load_required(
98
+			'EEH_Autoloader',
99
+			EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php'
100
+		);
101
+		EEH_Autoloader::instance();
102
+	}
103
+
104
+
105
+
106
+	/**
107
+	 * load_required_files
108
+	 *
109
+	 * @throws EE_Error
110
+	 */
111
+	protected function set_autoloaders_for_required_files()
112
+	{
113
+		// load interfaces
114
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true);
115
+		// load helpers
116
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS);
117
+		// load request stack
118
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack' . DS);
119
+		// load middleware
120
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware' . DS);
121
+	}
122
+
123
+
124
+
125
+	/**
126
+	 * build_request_stack
127
+	 *
128
+	 * @return EE_Request_Stack_Builder
129
+	 * @throws InvalidArgumentException
130
+	 */
131
+	public function build_request_stack()
132
+	{
133
+		$request_stack_builder = new EE_Request_Stack_Builder();
134
+		$stack_apps = apply_filters(
135
+			'FHEE__EE_Bootstrap__build_request_stack__stack_apps',
136
+			array(
137
+				'EE_Detect_File_Editor_Request',
138
+				'EE_Detect_Login',
139
+				'EE_Recommended_Versions',
140
+				'EE_Alpha_Banner_Warning',
141
+			)
142
+		);
143
+		// load middleware onto stack : FILO (First In Last Out)
144
+		foreach ((array)$stack_apps as $stack_app) {
145
+			//$request_stack_builder->push( $stack_app );
146
+			$request_stack_builder->unshift($stack_app);
147
+		}
148
+		return apply_filters(
149
+			'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder',
150
+			$request_stack_builder
151
+		);
152
+	}
153
+
154
+
155
+
156
+	/**
157
+	 * load_espresso_addons
158
+	 * runs during the WP 'plugins_loaded' action at priority 1
159
+	 * and is the initial loading phase for EE addons
160
+	 * no other logic should be performed at this point
161
+	 */
162
+	public static function load_espresso_addons()
163
+	{
164
+		do_action('AHEE__EE_Bootstrap__load_espresso_addons');
165
+	}
166
+
167
+
168
+
169
+	/**
170
+	 * detect_activations_or_upgrades
171
+	 * runs during the WP 'plugins_loaded' action at priority 3
172
+	 * Now that all of the addons have been loaded,
173
+	 * we can determine if anything needs activating or upgrading
174
+	 */
175
+	public static function detect_activations_or_upgrades()
176
+	{
177
+		do_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades');
178
+	}
179
+
180
+
181
+
182
+	/**
183
+	 * load_core_configuration
184
+	 * runs during the WP 'plugins_loaded' action at priority 5
185
+	 * Now that the database is assumed to be at the correct version
186
+	 * we can load and set all of the system configurations
187
+	 */
188
+	public static function load_core_configuration()
189
+	{
190
+		do_action('AHEE__EE_Bootstrap__load_core_configuration');
191
+	}
192
+
193
+
194
+
195
+	/**
196
+	 * register_shortcodes_modules_and_widgets
197
+	 * runs during the WP 'plugins_loaded' action at priority 7
198
+	 * and handles registering all o four shortcodes, modules and widgets
199
+	 * so that they are ready to be used throughout the system
200
+	 */
201
+	public static function register_shortcodes_modules_and_widgets()
202
+	{
203
+		do_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets');
204
+	}
205
+
206
+
207
+
208
+	/**
209
+	 * brew_espresso
210
+	 * runs during the WP 'plugins_loaded' action at priority 9
211
+	 * bootstrapping is considered complete at this point,
212
+	 * so let the fun begin...
213
+	 */
214
+	public static function brew_espresso()
215
+	{
216
+		do_action('AHEE__EE_Bootstrap__brew_espresso');
217
+	}
218 218
 
219 219
 
220 220
 
Please login to merge, or discard this patch.
core/libraries/form_sections/form_handlers/FormHandler.php 1 patch
Indentation   +639 added lines, -639 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 use EventEspresso\core\exceptions\InvalidFormSubmissionException;
16 16
 
17 17
 if (! defined('EVENT_ESPRESSO_VERSION')) {
18
-    exit('No direct script access allowed');
18
+	exit('No direct script access allowed');
19 19
 }
20 20
 
21 21
 
@@ -34,644 +34,644 @@  discard block
 block discarded – undo
34 34
 abstract class FormHandler implements FormHandlerInterface
35 35
 {
36 36
 
37
-    /**
38
-     * will add opening and closing HTML form tags as well as a submit button
39
-     */
40
-    const ADD_FORM_TAGS_AND_SUBMIT = 'add_form_tags_and_submit';
41
-
42
-    /**
43
-     * will add opening and closing HTML form tags but NOT a submit button
44
-     */
45
-    const ADD_FORM_TAGS_ONLY = 'add_form_tags_only';
46
-
47
-    /**
48
-     * will NOT add opening and closing HTML form tags but will add a submit button
49
-     */
50
-    const ADD_FORM_SUBMIT_ONLY = 'add_form_submit_only';
51
-
52
-    /**
53
-     * will NOT add opening and closing HTML form tags NOR a submit button
54
-     */
55
-    const DO_NOT_SETUP_FORM = 'do_not_setup_form';
56
-
57
-    /**
58
-     * if set to false, then this form has no displayable content,
59
-     * and will only be used for processing data sent passed via GET or POST
60
-     * defaults to true ( ie: form has displayable content )
61
-     *
62
-     * @var boolean $displayable
63
-     */
64
-    private $displayable = true;
65
-
66
-    /**
67
-     * @var string $form_name
68
-     */
69
-    private $form_name;
70
-
71
-    /**
72
-     * @var string $admin_name
73
-     */
74
-    private $admin_name;
75
-
76
-    /**
77
-     * @var string $slug
78
-     */
79
-    private $slug;
80
-
81
-    /**
82
-     * @var string $submit_btn_text
83
-     */
84
-    private $submit_btn_text;
85
-
86
-    /**
87
-     * @var string $form_action
88
-     */
89
-    private $form_action;
90
-
91
-    /**
92
-     * form params in key value pairs
93
-     * can be added to form action URL or as hidden inputs
94
-     *
95
-     * @var array $form_args
96
-     */
97
-    private $form_args = array();
98
-
99
-    /**
100
-     * value of one of the string constant above
101
-     *
102
-     * @var string $form_config
103
-     */
104
-    private $form_config;
105
-
106
-    /**
107
-     * whether or not the form was determined to be invalid
108
-     *
109
-     * @var boolean $form_has_errors
110
-     */
111
-    private $form_has_errors;
112
-
113
-    /**
114
-     * the absolute top level form section being used on the page
115
-     *
116
-     * @var EE_Form_Section_Proper $form
117
-     */
118
-    private $form;
119
-
120
-    /**
121
-     * @var EE_Registry $registry
122
-     */
123
-    protected $registry;
124
-
125
-
126
-
127
-    /**
128
-     * Form constructor.
129
-     *
130
-     * @param string      $form_name
131
-     * @param string      $admin_name
132
-     * @param string      $slug
133
-     * @param string      $form_action
134
-     * @param string      $form_config
135
-     * @param EE_Registry $registry
136
-     * @throws InvalidDataTypeException
137
-     * @throws DomainException
138
-     * @throws InvalidArgumentException
139
-     */
140
-    public function __construct(
141
-        $form_name,
142
-        $admin_name,
143
-        $slug,
144
-        $form_action = '',
145
-        $form_config = FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
146
-        EE_Registry $registry
147
-    ) {
148
-        $this->setFormName($form_name);
149
-        $this->setAdminName($admin_name);
150
-        $this->setSlug($slug);
151
-        $this->setFormAction($form_action);
152
-        $this->setFormConfig($form_config);
153
-        $this->setSubmitBtnText(esc_html__('Submit', 'event_espresso'));
154
-        $this->registry = $registry;
155
-    }
156
-
157
-
158
-
159
-    /**
160
-     * @return array
161
-     */
162
-    public static function getFormConfigConstants()
163
-    {
164
-        return array(
165
-            FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
166
-            FormHandler::ADD_FORM_TAGS_ONLY,
167
-            FormHandler::ADD_FORM_SUBMIT_ONLY,
168
-            FormHandler::DO_NOT_SETUP_FORM,
169
-        );
170
-    }
171
-
172
-
173
-
174
-    /**
175
-     * @param bool $for_display
176
-     * @return EE_Form_Section_Proper
177
-     * @throws EE_Error
178
-     * @throws LogicException
179
-     */
180
-    public function form($for_display = false)
181
-    {
182
-        if (! $this->formIsValid()) {
183
-            return null;
184
-        }
185
-        if ($for_display) {
186
-            $form_config = $this->formConfig();
187
-            if (
188
-                $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
189
-                || $form_config === FormHandler::ADD_FORM_SUBMIT_ONLY
190
-            ) {
191
-                $this->appendSubmitButton();
192
-                $this->clearFormButtonFloats();
193
-            }
194
-        }
195
-        return $this->form;
196
-    }
197
-
198
-
199
-
200
-    /**
201
-     * @return boolean
202
-     * @throws LogicException
203
-     */
204
-    public function formIsValid()
205
-    {
206
-        if ($this->form instanceof EE_Form_Section_Proper) {
207
-            return true;
208
-        }
209
-        $form = apply_filters(
210
-            'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__formIsValid__generated_form_object',
211
-            $this->generate(),
212
-            $this
213
-        );
214
-        if ($this->verifyForm($form)) {
215
-            $this->setForm($form);
216
-        }
217
-        return true;
218
-    }
219
-
220
-
221
-
222
-    /**
223
-     * @param EE_Form_Section_Proper|null $form
224
-     * @return bool
225
-     * @throws LogicException
226
-     */
227
-    public function verifyForm(EE_Form_Section_Proper $form = null)
228
-    {
229
-        $form = $form !== null ? $form : $this->form;
230
-        if ($form instanceof EE_Form_Section_Proper) {
231
-            return true;
232
-        }
233
-        throw new LogicException(
234
-            sprintf(
235
-                esc_html__('The "%1$s" form is invalid or missing. %2$s', 'event_espresso'),
236
-                $this->form_name,
237
-                var_export($form, true)
238
-            )
239
-        );
240
-    }
241
-
242
-
243
-
244
-    /**
245
-     * @param EE_Form_Section_Proper $form
246
-     */
247
-    public function setForm(EE_Form_Section_Proper $form)
248
-    {
249
-        $this->form = $form;
250
-    }
251
-
252
-
253
-
254
-    /**
255
-     * @return boolean
256
-     */
257
-    public function displayable()
258
-    {
259
-        return $this->displayable;
260
-    }
261
-
262
-
263
-
264
-    /**
265
-     * @param boolean $displayable
266
-     */
267
-    public function setDisplayable($displayable = false)
268
-    {
269
-        $this->displayable = filter_var($displayable, FILTER_VALIDATE_BOOLEAN);
270
-    }
271
-
272
-
273
-
274
-    /**
275
-     * a public name for the form that can be displayed on the frontend of a site
276
-     *
277
-     * @return string
278
-     */
279
-    public function formName()
280
-    {
281
-        return $this->form_name;
282
-    }
283
-
284
-
285
-
286
-    /**
287
-     * @param string $form_name
288
-     * @throws InvalidDataTypeException
289
-     */
290
-    public function setFormName($form_name)
291
-    {
292
-        if (! is_string($form_name)) {
293
-            throw new InvalidDataTypeException('$form_name', $form_name, 'string');
294
-        }
295
-        $this->form_name = $form_name;
296
-    }
297
-
298
-
299
-
300
-    /**
301
-     * a public name for the form that can be displayed, but only in the admin
302
-     *
303
-     * @return string
304
-     */
305
-    public function adminName()
306
-    {
307
-        return $this->admin_name;
308
-    }
309
-
310
-
311
-
312
-    /**
313
-     * @param string $admin_name
314
-     * @throws InvalidDataTypeException
315
-     */
316
-    public function setAdminName($admin_name)
317
-    {
318
-        if (! is_string($admin_name)) {
319
-            throw new InvalidDataTypeException('$admin_name', $admin_name, 'string');
320
-        }
321
-        $this->admin_name = $admin_name;
322
-    }
323
-
324
-
325
-
326
-    /**
327
-     * a URL friendly string that can be used for identifying the form
328
-     *
329
-     * @return string
330
-     */
331
-    public function slug()
332
-    {
333
-        return $this->slug;
334
-    }
335
-
336
-
337
-
338
-    /**
339
-     * @param string $slug
340
-     * @throws InvalidDataTypeException
341
-     */
342
-    public function setSlug($slug)
343
-    {
344
-        if (! is_string($slug)) {
345
-            throw new InvalidDataTypeException('$slug', $slug, 'string');
346
-        }
347
-        $this->slug = $slug;
348
-    }
349
-
350
-
351
-
352
-    /**
353
-     * @return string
354
-     */
355
-    public function submitBtnText()
356
-    {
357
-        return $this->submit_btn_text;
358
-    }
359
-
360
-
361
-
362
-    /**
363
-     * @param string $submit_btn_text
364
-     * @throws InvalidDataTypeException
365
-     * @throws InvalidArgumentException
366
-     */
367
-    public function setSubmitBtnText($submit_btn_text)
368
-    {
369
-        if (! is_string($submit_btn_text)) {
370
-            throw new InvalidDataTypeException('$submit_btn_text', $submit_btn_text, 'string');
371
-        }
372
-        if (empty($submit_btn_text)) {
373
-            throw new InvalidArgumentException(
374
-                esc_html__('Can not set Submit button text because an empty string was provided.', 'event_espresso')
375
-            );
376
-        }
377
-        $this->submit_btn_text = $submit_btn_text;
378
-    }
379
-
380
-
381
-
382
-    /**
383
-     * @return string
384
-     */
385
-    public function formAction()
386
-    {
387
-        return ! empty($this->form_args)
388
-            ? add_query_arg($this->form_args, $this->form_action)
389
-            : $this->form_action;
390
-    }
391
-
392
-
393
-
394
-    /**
395
-     * @param string $form_action
396
-     * @throws InvalidDataTypeException
397
-     */
398
-    public function setFormAction($form_action)
399
-    {
400
-        if (! is_string($form_action)) {
401
-            throw new InvalidDataTypeException('$form_action', $form_action, 'string');
402
-        }
403
-        $this->form_action = $form_action;
404
-    }
405
-
406
-
407
-
408
-    /**
409
-     * @param array $form_args
410
-     * @throws InvalidDataTypeException
411
-     * @throws InvalidArgumentException
412
-     */
413
-    public function addFormActionArgs($form_args = array())
414
-    {
415
-        if (is_object($form_args)) {
416
-            throw new InvalidDataTypeException(
417
-                '$form_args',
418
-                $form_args,
419
-                'anything other than an object was expected.'
420
-            );
421
-        }
422
-        if (empty($form_args)) {
423
-            throw new InvalidArgumentException(
424
-                esc_html__('The redirect arguments can not be an empty array.', 'event_espresso')
425
-            );
426
-        }
427
-        $this->form_args = array_merge($this->form_args, $form_args);
428
-    }
429
-
430
-
431
-
432
-    /**
433
-     * @return string
434
-     */
435
-    public function formConfig()
436
-    {
437
-        return $this->form_config;
438
-    }
439
-
440
-
441
-
442
-    /**
443
-     * @param string $form_config
444
-     * @throws DomainException
445
-     */
446
-    public function setFormConfig($form_config)
447
-    {
448
-        if (
449
-        ! in_array(
450
-            $form_config,
451
-            array(
452
-                FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
453
-                FormHandler::ADD_FORM_TAGS_ONLY,
454
-                FormHandler::ADD_FORM_SUBMIT_ONLY,
455
-                FormHandler::DO_NOT_SETUP_FORM,
456
-            ),
457
-            true
458
-        )
459
-        ) {
460
-            throw new DomainException(
461
-                sprintf(
462
-                    esc_html__('"%1$s" is not a valid value for the form config. Please use one of the class constants on \EventEspresso\core\libraries\form_sections\form_handlers\Form',
463
-                        'event_espresso'),
464
-                    $form_config
465
-                )
466
-            );
467
-        }
468
-        $this->form_config = $form_config;
469
-    }
470
-
471
-
472
-
473
-    /**
474
-     * called after the form is instantiated
475
-     * and used for performing any logic that needs to occur early
476
-     * before any of the other methods are called.
477
-     * returns true if everything is ok to proceed,
478
-     * and false if no further form logic should be implemented
479
-     *
480
-     * @return boolean
481
-     */
482
-    public function initialize()
483
-    {
484
-        $this->form_has_errors = EE_Error::has_error(true);
485
-        return true;
486
-    }
487
-
488
-
489
-
490
-    /**
491
-     * used for setting up css and js
492
-     *
493
-     * @return void
494
-     * @throws LogicException
495
-     * @throws EE_Error
496
-     */
497
-    public function enqueueStylesAndScripts()
498
-    {
499
-        $this->form()->enqueue_js();
500
-    }
501
-
502
-
503
-
504
-    /**
505
-     * creates and returns the actual form
506
-     *
507
-     * @return EE_Form_Section_Proper
508
-     */
509
-    abstract public function generate();
510
-
511
-
512
-
513
-    /**
514
-     * creates and returns an EE_Submit_Input labeled "Submit"
515
-     *
516
-     * @param string $text
517
-     * @return EE_Submit_Input
518
-     */
519
-    public function generateSubmitButton($text = '')
520
-    {
521
-        $text = ! empty($text) ? $text : $this->submitBtnText();
522
-        return new EE_Submit_Input(
523
-            array(
524
-                'html_name'             => 'ee-form-submit-' . $this->slug(),
525
-                'html_id'               => 'ee-form-submit-' . $this->slug(),
526
-                'html_class'            => 'ee-form-submit',
527
-                'html_label'            => '&nbsp;',
528
-                'other_html_attributes' => ' rel="' . $this->slug() . '"',
529
-                'default'               => $text,
530
-            )
531
-        );
532
-    }
533
-
534
-
535
-
536
-    /**
537
-     * calls generateSubmitButton() and appends it onto the form along with a float clearing div
538
-     *
539
-     * @param string $text
540
-     * @return void
541
-     * @throws EE_Error
542
-     */
543
-    public function appendSubmitButton($text = '')
544
-    {
545
-        if ($this->form->subsection_exists($this->slug() . '-submit-btn')) {
546
-            return;
547
-        }
548
-        $this->form->add_subsections(
549
-            array($this->slug() . '-submit-btn' => $this->generateSubmitButton($text)),
550
-            null,
551
-            false
552
-        );
553
-    }
554
-
555
-
556
-
557
-    /**
558
-     * creates and returns an EE_Submit_Input labeled "Cancel"
559
-     *
560
-     * @param string $text
561
-     * @return EE_Submit_Input
562
-     */
563
-    public function generateCancelButton($text = '')
564
-    {
565
-        $cancel_button = new EE_Submit_Input(
566
-            array(
567
-                'html_name'             => 'ee-form-submit-' . $this->slug(), // YES! Same name as submit !!!
568
-                'html_id'               => 'ee-cancel-form-' . $this->slug(),
569
-                'html_class'            => 'ee-cancel-form',
570
-                'html_label'            => '&nbsp;',
571
-                'other_html_attributes' => ' rel="' . $this->slug() . '"',
572
-                'default'               => ! empty($text) ? $text : esc_html__('Cancel', 'event_espresso'),
573
-            )
574
-        );
575
-        $cancel_button->set_button_css_attributes(false);
576
-        return $cancel_button;
577
-    }
578
-
579
-
580
-
581
-    /**
582
-     * appends a float clearing div onto end of form
583
-     *
584
-     * @return void
585
-     * @throws EE_Error
586
-     */
587
-    public function clearFormButtonFloats()
588
-    {
589
-        $this->form->add_subsections(
590
-            array(
591
-                'clear-submit-btn-float' => new EE_Form_Section_HTML(
592
-                    EEH_HTML::div('', '', 'clear-float') . EEH_HTML::divx()
593
-                ),
594
-            ),
595
-            null,
596
-            false
597
-        );
598
-    }
599
-
600
-
601
-
602
-    /**
603
-     * takes the generated form and displays it along with ony other non-form HTML that may be required
604
-     * returns a string of HTML that can be directly echoed in a template
605
-     *
606
-     * @return string
607
-     * @throws LogicException
608
-     * @throws EE_Error
609
-     */
610
-    public function display()
611
-    {
612
-        $form_html = apply_filters(
613
-            'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form',
614
-            ''
615
-        );
616
-        $form_config = $this->formConfig();
617
-        if (
618
-            $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
619
-            || $form_config === FormHandler::ADD_FORM_TAGS_ONLY
620
-        ) {
621
-            $form_html .= $this->form()->form_open($this->formAction());
622
-        }
623
-        $form_html .= $this->form(true)->get_html($this->form_has_errors);
624
-        if (
625
-            $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
626
-            || $form_config === FormHandler::ADD_FORM_TAGS_ONLY
627
-        ) {
628
-            $form_html .= $this->form()->form_close();
629
-        }
630
-        $form_html .= apply_filters(
631
-            'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__after_form',
632
-            ''
633
-        );
634
-        return $form_html;
635
-    }
636
-
637
-
638
-
639
-    /**
640
-     * handles processing the form submission
641
-     * returns true or false depending on whether the form was processed successfully or not
642
-     *
643
-     * @param array $submitted_form_data
644
-     * @return array
645
-     * @throws EE_Error
646
-     * @throws LogicException
647
-     * @throws InvalidFormSubmissionException
648
-     */
649
-    public function process($submitted_form_data = array())
650
-    {
651
-        if (! $this->form()->was_submitted($submitted_form_data)) {
652
-            throw new InvalidFormSubmissionException($this->form_name);
653
-        }
654
-        $this->form(true)->receive_form_submission($submitted_form_data);
655
-        if (! $this->form()->is_valid()) {
656
-            throw new InvalidFormSubmissionException(
657
-                $this->form_name,
658
-                sprintf(
659
-                    esc_html__(
660
-                        'The "%1$s" form is invalid. Please correct the following errors and resubmit: %2$s %3$s',
661
-                        'event_espresso'
662
-                    ),
663
-                    $this->form_name,
664
-                    '<br />',
665
-                    $this->form()->submission_error_message()
666
-                )
667
-            );
668
-        }
669
-        return apply_filters(
670
-            'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__process__valid_data',
671
-            $this->form()->valid_data(),
672
-            $this
673
-        );
674
-    }
37
+	/**
38
+	 * will add opening and closing HTML form tags as well as a submit button
39
+	 */
40
+	const ADD_FORM_TAGS_AND_SUBMIT = 'add_form_tags_and_submit';
41
+
42
+	/**
43
+	 * will add opening and closing HTML form tags but NOT a submit button
44
+	 */
45
+	const ADD_FORM_TAGS_ONLY = 'add_form_tags_only';
46
+
47
+	/**
48
+	 * will NOT add opening and closing HTML form tags but will add a submit button
49
+	 */
50
+	const ADD_FORM_SUBMIT_ONLY = 'add_form_submit_only';
51
+
52
+	/**
53
+	 * will NOT add opening and closing HTML form tags NOR a submit button
54
+	 */
55
+	const DO_NOT_SETUP_FORM = 'do_not_setup_form';
56
+
57
+	/**
58
+	 * if set to false, then this form has no displayable content,
59
+	 * and will only be used for processing data sent passed via GET or POST
60
+	 * defaults to true ( ie: form has displayable content )
61
+	 *
62
+	 * @var boolean $displayable
63
+	 */
64
+	private $displayable = true;
65
+
66
+	/**
67
+	 * @var string $form_name
68
+	 */
69
+	private $form_name;
70
+
71
+	/**
72
+	 * @var string $admin_name
73
+	 */
74
+	private $admin_name;
75
+
76
+	/**
77
+	 * @var string $slug
78
+	 */
79
+	private $slug;
80
+
81
+	/**
82
+	 * @var string $submit_btn_text
83
+	 */
84
+	private $submit_btn_text;
85
+
86
+	/**
87
+	 * @var string $form_action
88
+	 */
89
+	private $form_action;
90
+
91
+	/**
92
+	 * form params in key value pairs
93
+	 * can be added to form action URL or as hidden inputs
94
+	 *
95
+	 * @var array $form_args
96
+	 */
97
+	private $form_args = array();
98
+
99
+	/**
100
+	 * value of one of the string constant above
101
+	 *
102
+	 * @var string $form_config
103
+	 */
104
+	private $form_config;
105
+
106
+	/**
107
+	 * whether or not the form was determined to be invalid
108
+	 *
109
+	 * @var boolean $form_has_errors
110
+	 */
111
+	private $form_has_errors;
112
+
113
+	/**
114
+	 * the absolute top level form section being used on the page
115
+	 *
116
+	 * @var EE_Form_Section_Proper $form
117
+	 */
118
+	private $form;
119
+
120
+	/**
121
+	 * @var EE_Registry $registry
122
+	 */
123
+	protected $registry;
124
+
125
+
126
+
127
+	/**
128
+	 * Form constructor.
129
+	 *
130
+	 * @param string      $form_name
131
+	 * @param string      $admin_name
132
+	 * @param string      $slug
133
+	 * @param string      $form_action
134
+	 * @param string      $form_config
135
+	 * @param EE_Registry $registry
136
+	 * @throws InvalidDataTypeException
137
+	 * @throws DomainException
138
+	 * @throws InvalidArgumentException
139
+	 */
140
+	public function __construct(
141
+		$form_name,
142
+		$admin_name,
143
+		$slug,
144
+		$form_action = '',
145
+		$form_config = FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
146
+		EE_Registry $registry
147
+	) {
148
+		$this->setFormName($form_name);
149
+		$this->setAdminName($admin_name);
150
+		$this->setSlug($slug);
151
+		$this->setFormAction($form_action);
152
+		$this->setFormConfig($form_config);
153
+		$this->setSubmitBtnText(esc_html__('Submit', 'event_espresso'));
154
+		$this->registry = $registry;
155
+	}
156
+
157
+
158
+
159
+	/**
160
+	 * @return array
161
+	 */
162
+	public static function getFormConfigConstants()
163
+	{
164
+		return array(
165
+			FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
166
+			FormHandler::ADD_FORM_TAGS_ONLY,
167
+			FormHandler::ADD_FORM_SUBMIT_ONLY,
168
+			FormHandler::DO_NOT_SETUP_FORM,
169
+		);
170
+	}
171
+
172
+
173
+
174
+	/**
175
+	 * @param bool $for_display
176
+	 * @return EE_Form_Section_Proper
177
+	 * @throws EE_Error
178
+	 * @throws LogicException
179
+	 */
180
+	public function form($for_display = false)
181
+	{
182
+		if (! $this->formIsValid()) {
183
+			return null;
184
+		}
185
+		if ($for_display) {
186
+			$form_config = $this->formConfig();
187
+			if (
188
+				$form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
189
+				|| $form_config === FormHandler::ADD_FORM_SUBMIT_ONLY
190
+			) {
191
+				$this->appendSubmitButton();
192
+				$this->clearFormButtonFloats();
193
+			}
194
+		}
195
+		return $this->form;
196
+	}
197
+
198
+
199
+
200
+	/**
201
+	 * @return boolean
202
+	 * @throws LogicException
203
+	 */
204
+	public function formIsValid()
205
+	{
206
+		if ($this->form instanceof EE_Form_Section_Proper) {
207
+			return true;
208
+		}
209
+		$form = apply_filters(
210
+			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__formIsValid__generated_form_object',
211
+			$this->generate(),
212
+			$this
213
+		);
214
+		if ($this->verifyForm($form)) {
215
+			$this->setForm($form);
216
+		}
217
+		return true;
218
+	}
219
+
220
+
221
+
222
+	/**
223
+	 * @param EE_Form_Section_Proper|null $form
224
+	 * @return bool
225
+	 * @throws LogicException
226
+	 */
227
+	public function verifyForm(EE_Form_Section_Proper $form = null)
228
+	{
229
+		$form = $form !== null ? $form : $this->form;
230
+		if ($form instanceof EE_Form_Section_Proper) {
231
+			return true;
232
+		}
233
+		throw new LogicException(
234
+			sprintf(
235
+				esc_html__('The "%1$s" form is invalid or missing. %2$s', 'event_espresso'),
236
+				$this->form_name,
237
+				var_export($form, true)
238
+			)
239
+		);
240
+	}
241
+
242
+
243
+
244
+	/**
245
+	 * @param EE_Form_Section_Proper $form
246
+	 */
247
+	public function setForm(EE_Form_Section_Proper $form)
248
+	{
249
+		$this->form = $form;
250
+	}
251
+
252
+
253
+
254
+	/**
255
+	 * @return boolean
256
+	 */
257
+	public function displayable()
258
+	{
259
+		return $this->displayable;
260
+	}
261
+
262
+
263
+
264
+	/**
265
+	 * @param boolean $displayable
266
+	 */
267
+	public function setDisplayable($displayable = false)
268
+	{
269
+		$this->displayable = filter_var($displayable, FILTER_VALIDATE_BOOLEAN);
270
+	}
271
+
272
+
273
+
274
+	/**
275
+	 * a public name for the form that can be displayed on the frontend of a site
276
+	 *
277
+	 * @return string
278
+	 */
279
+	public function formName()
280
+	{
281
+		return $this->form_name;
282
+	}
283
+
284
+
285
+
286
+	/**
287
+	 * @param string $form_name
288
+	 * @throws InvalidDataTypeException
289
+	 */
290
+	public function setFormName($form_name)
291
+	{
292
+		if (! is_string($form_name)) {
293
+			throw new InvalidDataTypeException('$form_name', $form_name, 'string');
294
+		}
295
+		$this->form_name = $form_name;
296
+	}
297
+
298
+
299
+
300
+	/**
301
+	 * a public name for the form that can be displayed, but only in the admin
302
+	 *
303
+	 * @return string
304
+	 */
305
+	public function adminName()
306
+	{
307
+		return $this->admin_name;
308
+	}
309
+
310
+
311
+
312
+	/**
313
+	 * @param string $admin_name
314
+	 * @throws InvalidDataTypeException
315
+	 */
316
+	public function setAdminName($admin_name)
317
+	{
318
+		if (! is_string($admin_name)) {
319
+			throw new InvalidDataTypeException('$admin_name', $admin_name, 'string');
320
+		}
321
+		$this->admin_name = $admin_name;
322
+	}
323
+
324
+
325
+
326
+	/**
327
+	 * a URL friendly string that can be used for identifying the form
328
+	 *
329
+	 * @return string
330
+	 */
331
+	public function slug()
332
+	{
333
+		return $this->slug;
334
+	}
335
+
336
+
337
+
338
+	/**
339
+	 * @param string $slug
340
+	 * @throws InvalidDataTypeException
341
+	 */
342
+	public function setSlug($slug)
343
+	{
344
+		if (! is_string($slug)) {
345
+			throw new InvalidDataTypeException('$slug', $slug, 'string');
346
+		}
347
+		$this->slug = $slug;
348
+	}
349
+
350
+
351
+
352
+	/**
353
+	 * @return string
354
+	 */
355
+	public function submitBtnText()
356
+	{
357
+		return $this->submit_btn_text;
358
+	}
359
+
360
+
361
+
362
+	/**
363
+	 * @param string $submit_btn_text
364
+	 * @throws InvalidDataTypeException
365
+	 * @throws InvalidArgumentException
366
+	 */
367
+	public function setSubmitBtnText($submit_btn_text)
368
+	{
369
+		if (! is_string($submit_btn_text)) {
370
+			throw new InvalidDataTypeException('$submit_btn_text', $submit_btn_text, 'string');
371
+		}
372
+		if (empty($submit_btn_text)) {
373
+			throw new InvalidArgumentException(
374
+				esc_html__('Can not set Submit button text because an empty string was provided.', 'event_espresso')
375
+			);
376
+		}
377
+		$this->submit_btn_text = $submit_btn_text;
378
+	}
379
+
380
+
381
+
382
+	/**
383
+	 * @return string
384
+	 */
385
+	public function formAction()
386
+	{
387
+		return ! empty($this->form_args)
388
+			? add_query_arg($this->form_args, $this->form_action)
389
+			: $this->form_action;
390
+	}
391
+
392
+
393
+
394
+	/**
395
+	 * @param string $form_action
396
+	 * @throws InvalidDataTypeException
397
+	 */
398
+	public function setFormAction($form_action)
399
+	{
400
+		if (! is_string($form_action)) {
401
+			throw new InvalidDataTypeException('$form_action', $form_action, 'string');
402
+		}
403
+		$this->form_action = $form_action;
404
+	}
405
+
406
+
407
+
408
+	/**
409
+	 * @param array $form_args
410
+	 * @throws InvalidDataTypeException
411
+	 * @throws InvalidArgumentException
412
+	 */
413
+	public function addFormActionArgs($form_args = array())
414
+	{
415
+		if (is_object($form_args)) {
416
+			throw new InvalidDataTypeException(
417
+				'$form_args',
418
+				$form_args,
419
+				'anything other than an object was expected.'
420
+			);
421
+		}
422
+		if (empty($form_args)) {
423
+			throw new InvalidArgumentException(
424
+				esc_html__('The redirect arguments can not be an empty array.', 'event_espresso')
425
+			);
426
+		}
427
+		$this->form_args = array_merge($this->form_args, $form_args);
428
+	}
429
+
430
+
431
+
432
+	/**
433
+	 * @return string
434
+	 */
435
+	public function formConfig()
436
+	{
437
+		return $this->form_config;
438
+	}
439
+
440
+
441
+
442
+	/**
443
+	 * @param string $form_config
444
+	 * @throws DomainException
445
+	 */
446
+	public function setFormConfig($form_config)
447
+	{
448
+		if (
449
+		! in_array(
450
+			$form_config,
451
+			array(
452
+				FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
453
+				FormHandler::ADD_FORM_TAGS_ONLY,
454
+				FormHandler::ADD_FORM_SUBMIT_ONLY,
455
+				FormHandler::DO_NOT_SETUP_FORM,
456
+			),
457
+			true
458
+		)
459
+		) {
460
+			throw new DomainException(
461
+				sprintf(
462
+					esc_html__('"%1$s" is not a valid value for the form config. Please use one of the class constants on \EventEspresso\core\libraries\form_sections\form_handlers\Form',
463
+						'event_espresso'),
464
+					$form_config
465
+				)
466
+			);
467
+		}
468
+		$this->form_config = $form_config;
469
+	}
470
+
471
+
472
+
473
+	/**
474
+	 * called after the form is instantiated
475
+	 * and used for performing any logic that needs to occur early
476
+	 * before any of the other methods are called.
477
+	 * returns true if everything is ok to proceed,
478
+	 * and false if no further form logic should be implemented
479
+	 *
480
+	 * @return boolean
481
+	 */
482
+	public function initialize()
483
+	{
484
+		$this->form_has_errors = EE_Error::has_error(true);
485
+		return true;
486
+	}
487
+
488
+
489
+
490
+	/**
491
+	 * used for setting up css and js
492
+	 *
493
+	 * @return void
494
+	 * @throws LogicException
495
+	 * @throws EE_Error
496
+	 */
497
+	public function enqueueStylesAndScripts()
498
+	{
499
+		$this->form()->enqueue_js();
500
+	}
501
+
502
+
503
+
504
+	/**
505
+	 * creates and returns the actual form
506
+	 *
507
+	 * @return EE_Form_Section_Proper
508
+	 */
509
+	abstract public function generate();
510
+
511
+
512
+
513
+	/**
514
+	 * creates and returns an EE_Submit_Input labeled "Submit"
515
+	 *
516
+	 * @param string $text
517
+	 * @return EE_Submit_Input
518
+	 */
519
+	public function generateSubmitButton($text = '')
520
+	{
521
+		$text = ! empty($text) ? $text : $this->submitBtnText();
522
+		return new EE_Submit_Input(
523
+			array(
524
+				'html_name'             => 'ee-form-submit-' . $this->slug(),
525
+				'html_id'               => 'ee-form-submit-' . $this->slug(),
526
+				'html_class'            => 'ee-form-submit',
527
+				'html_label'            => '&nbsp;',
528
+				'other_html_attributes' => ' rel="' . $this->slug() . '"',
529
+				'default'               => $text,
530
+			)
531
+		);
532
+	}
533
+
534
+
535
+
536
+	/**
537
+	 * calls generateSubmitButton() and appends it onto the form along with a float clearing div
538
+	 *
539
+	 * @param string $text
540
+	 * @return void
541
+	 * @throws EE_Error
542
+	 */
543
+	public function appendSubmitButton($text = '')
544
+	{
545
+		if ($this->form->subsection_exists($this->slug() . '-submit-btn')) {
546
+			return;
547
+		}
548
+		$this->form->add_subsections(
549
+			array($this->slug() . '-submit-btn' => $this->generateSubmitButton($text)),
550
+			null,
551
+			false
552
+		);
553
+	}
554
+
555
+
556
+
557
+	/**
558
+	 * creates and returns an EE_Submit_Input labeled "Cancel"
559
+	 *
560
+	 * @param string $text
561
+	 * @return EE_Submit_Input
562
+	 */
563
+	public function generateCancelButton($text = '')
564
+	{
565
+		$cancel_button = new EE_Submit_Input(
566
+			array(
567
+				'html_name'             => 'ee-form-submit-' . $this->slug(), // YES! Same name as submit !!!
568
+				'html_id'               => 'ee-cancel-form-' . $this->slug(),
569
+				'html_class'            => 'ee-cancel-form',
570
+				'html_label'            => '&nbsp;',
571
+				'other_html_attributes' => ' rel="' . $this->slug() . '"',
572
+				'default'               => ! empty($text) ? $text : esc_html__('Cancel', 'event_espresso'),
573
+			)
574
+		);
575
+		$cancel_button->set_button_css_attributes(false);
576
+		return $cancel_button;
577
+	}
578
+
579
+
580
+
581
+	/**
582
+	 * appends a float clearing div onto end of form
583
+	 *
584
+	 * @return void
585
+	 * @throws EE_Error
586
+	 */
587
+	public function clearFormButtonFloats()
588
+	{
589
+		$this->form->add_subsections(
590
+			array(
591
+				'clear-submit-btn-float' => new EE_Form_Section_HTML(
592
+					EEH_HTML::div('', '', 'clear-float') . EEH_HTML::divx()
593
+				),
594
+			),
595
+			null,
596
+			false
597
+		);
598
+	}
599
+
600
+
601
+
602
+	/**
603
+	 * takes the generated form and displays it along with ony other non-form HTML that may be required
604
+	 * returns a string of HTML that can be directly echoed in a template
605
+	 *
606
+	 * @return string
607
+	 * @throws LogicException
608
+	 * @throws EE_Error
609
+	 */
610
+	public function display()
611
+	{
612
+		$form_html = apply_filters(
613
+			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form',
614
+			''
615
+		);
616
+		$form_config = $this->formConfig();
617
+		if (
618
+			$form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
619
+			|| $form_config === FormHandler::ADD_FORM_TAGS_ONLY
620
+		) {
621
+			$form_html .= $this->form()->form_open($this->formAction());
622
+		}
623
+		$form_html .= $this->form(true)->get_html($this->form_has_errors);
624
+		if (
625
+			$form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
626
+			|| $form_config === FormHandler::ADD_FORM_TAGS_ONLY
627
+		) {
628
+			$form_html .= $this->form()->form_close();
629
+		}
630
+		$form_html .= apply_filters(
631
+			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__after_form',
632
+			''
633
+		);
634
+		return $form_html;
635
+	}
636
+
637
+
638
+
639
+	/**
640
+	 * handles processing the form submission
641
+	 * returns true or false depending on whether the form was processed successfully or not
642
+	 *
643
+	 * @param array $submitted_form_data
644
+	 * @return array
645
+	 * @throws EE_Error
646
+	 * @throws LogicException
647
+	 * @throws InvalidFormSubmissionException
648
+	 */
649
+	public function process($submitted_form_data = array())
650
+	{
651
+		if (! $this->form()->was_submitted($submitted_form_data)) {
652
+			throw new InvalidFormSubmissionException($this->form_name);
653
+		}
654
+		$this->form(true)->receive_form_submission($submitted_form_data);
655
+		if (! $this->form()->is_valid()) {
656
+			throw new InvalidFormSubmissionException(
657
+				$this->form_name,
658
+				sprintf(
659
+					esc_html__(
660
+						'The "%1$s" form is invalid. Please correct the following errors and resubmit: %2$s %3$s',
661
+						'event_espresso'
662
+					),
663
+					$this->form_name,
664
+					'<br />',
665
+					$this->form()->submission_error_message()
666
+				)
667
+			);
668
+		}
669
+		return apply_filters(
670
+			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__process__valid_data',
671
+			$this->form()->valid_data(),
672
+			$this
673
+		);
674
+	}
675 675
 
676 676
 
677 677
 
Please login to merge, or discard this patch.