Completed
Branch FET/allow-prices-to-be-more-pr... (276f1f)
by
unknown
17:02 queued 13:56
created
core/libraries/form_sections/inputs/EE_Select_Reveal_Input.input.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
             if (empty($sibling_section_name)) {
46 46
                 continue;
47 47
             }
48
-            $sibling_section = $this->find_section_from_path('../' . $sibling_section_name);
48
+            $sibling_section = $this->find_section_from_path('../'.$sibling_section_name);
49 49
             if (
50 50
                 $sibling_section instanceof EE_Form_Section_Base
51 51
                 && ! empty($sibling_section_name)
52 52
             ) {
53
-                $sibling_sections[ $sibling_section_name ] = $sibling_section;
53
+                $sibling_sections[$sibling_section_name] = $sibling_section;
54 54
             }
55 55
         }
56 56
         return $sibling_sections;
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
     public function get_other_js_data($form_other_js_data = array())
67 67
     {
68 68
         $form_other_js_data = parent::get_other_js_data($form_other_js_data);
69
-        if (! isset($form_other_js_data['select_reveal_inputs'])) {
69
+        if ( ! isset($form_other_js_data['select_reveal_inputs'])) {
70 70
             $form_other_js_data['select_reveal_inputs'] = array();
71 71
         }
72 72
         $sibling_input_to_html_id_map = array();
73 73
         foreach ($this->sibling_sections_controlled() as $sibling_section_path => $sibling_section) {
74
-            $sibling_input_to_html_id_map[ $sibling_section_path ] = $sibling_section->html_id();
74
+            $sibling_input_to_html_id_map[$sibling_section_path] = $sibling_section->html_id();
75 75
         }
76
-        $form_other_js_data['select_reveal_inputs'][ $this->html_id() ] = $sibling_input_to_html_id_map;
76
+        $form_other_js_data['select_reveal_inputs'][$this->html_id()] = $sibling_input_to_html_id_map;
77 77
         return $form_other_js_data;
78 78
     }
79 79
 }
Please login to merge, or discard this patch.
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -14,65 +14,65 @@
 block discarded – undo
14 14
  */
15 15
 class EE_Select_Reveal_Input extends EE_Select_Input
16 16
 {
17
-    /**
18
-     * @param array $answer_options Array keys which match a sibling section's name
19
-     *              will show/unhide that sibling subsection. Otherwise, siblings whose names
20
-     *              match array keys of $answer_options are hidden.
21
-     *              Note: internally each array key is considered a relative form input path
22
-     *              (see EE_Form_Section_Base::find_section_from_path) but relative
23
-     *              to THIS INPUT's PARENT section, not this input itself. ie,
24
-     *              a '../' is automatically added onto each each array key, to produce
25
-     *              the relative form input path.
26
-     *              Note however: array keys which are an EMPTY STRING are left as-is
27
-     *
28
-     * @param array $input_settings
29
-     */
30
-    public function __construct($answer_options, $input_settings = array())
31
-    {
32
-        parent::__construct($answer_options, $input_settings);
33
-    }
17
+	/**
18
+	 * @param array $answer_options Array keys which match a sibling section's name
19
+	 *              will show/unhide that sibling subsection. Otherwise, siblings whose names
20
+	 *              match array keys of $answer_options are hidden.
21
+	 *              Note: internally each array key is considered a relative form input path
22
+	 *              (see EE_Form_Section_Base::find_section_from_path) but relative
23
+	 *              to THIS INPUT's PARENT section, not this input itself. ie,
24
+	 *              a '../' is automatically added onto each each array key, to produce
25
+	 *              the relative form input path.
26
+	 *              Note however: array keys which are an EMPTY STRING are left as-is
27
+	 *
28
+	 * @param array $input_settings
29
+	 */
30
+	public function __construct($answer_options, $input_settings = array())
31
+	{
32
+		parent::__construct($answer_options, $input_settings);
33
+	}
34 34
 
35
-    /**
36
-     * Gets all the sibling sections controlled by this reveal select input
37
-     * @return \EE_Form_Section_Base[] keys are their form section paths
38
-     */
39
-    public function sibling_sections_controlled()
40
-    {
41
-        $sibling_sections = array();
42
-        foreach ($this->options() as $sibling_section_name => $sibling_section) {
43
-            // if it's an empty string just leave it alone
44
-            if (empty($sibling_section_name)) {
45
-                continue;
46
-            }
47
-            $sibling_section = $this->find_section_from_path('../' . $sibling_section_name);
48
-            if (
49
-                $sibling_section instanceof EE_Form_Section_Base
50
-                && ! empty($sibling_section_name)
51
-            ) {
52
-                $sibling_sections[ $sibling_section_name ] = $sibling_section;
53
-            }
54
-        }
55
-        return $sibling_sections;
56
-    }
35
+	/**
36
+	 * Gets all the sibling sections controlled by this reveal select input
37
+	 * @return \EE_Form_Section_Base[] keys are their form section paths
38
+	 */
39
+	public function sibling_sections_controlled()
40
+	{
41
+		$sibling_sections = array();
42
+		foreach ($this->options() as $sibling_section_name => $sibling_section) {
43
+			// if it's an empty string just leave it alone
44
+			if (empty($sibling_section_name)) {
45
+				continue;
46
+			}
47
+			$sibling_section = $this->find_section_from_path('../' . $sibling_section_name);
48
+			if (
49
+				$sibling_section instanceof EE_Form_Section_Base
50
+				&& ! empty($sibling_section_name)
51
+			) {
52
+				$sibling_sections[ $sibling_section_name ] = $sibling_section;
53
+			}
54
+		}
55
+		return $sibling_sections;
56
+	}
57 57
 
58
-    /**
59
-     * Adds an entry of 'select_reveal_inputs' to the js data, which is an array
60
-     * whose top-level keys are select reveal input html ids; values are arrays
61
-     * whose keys are select option values and values are the sections they reveal
62
-     * @param array $form_other_js_data
63
-     * @return array
64
-     */
65
-    public function get_other_js_data($form_other_js_data = array())
66
-    {
67
-        $form_other_js_data = parent::get_other_js_data($form_other_js_data);
68
-        if (! isset($form_other_js_data['select_reveal_inputs'])) {
69
-            $form_other_js_data['select_reveal_inputs'] = array();
70
-        }
71
-        $sibling_input_to_html_id_map = array();
72
-        foreach ($this->sibling_sections_controlled() as $sibling_section_path => $sibling_section) {
73
-            $sibling_input_to_html_id_map[ $sibling_section_path ] = $sibling_section->html_id();
74
-        }
75
-        $form_other_js_data['select_reveal_inputs'][ $this->html_id() ] = $sibling_input_to_html_id_map;
76
-        return $form_other_js_data;
77
-    }
58
+	/**
59
+	 * Adds an entry of 'select_reveal_inputs' to the js data, which is an array
60
+	 * whose top-level keys are select reveal input html ids; values are arrays
61
+	 * whose keys are select option values and values are the sections they reveal
62
+	 * @param array $form_other_js_data
63
+	 * @return array
64
+	 */
65
+	public function get_other_js_data($form_other_js_data = array())
66
+	{
67
+		$form_other_js_data = parent::get_other_js_data($form_other_js_data);
68
+		if (! isset($form_other_js_data['select_reveal_inputs'])) {
69
+			$form_other_js_data['select_reveal_inputs'] = array();
70
+		}
71
+		$sibling_input_to_html_id_map = array();
72
+		foreach ($this->sibling_sections_controlled() as $sibling_section_path => $sibling_section) {
73
+			$sibling_input_to_html_id_map[ $sibling_section_path ] = $sibling_section->html_id();
74
+		}
75
+		$form_other_js_data['select_reveal_inputs'][ $this->html_id() ] = $sibling_input_to_html_id_map;
76
+		return $form_other_js_data;
77
+	}
78 78
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_CVV_Input.input.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
         $this->_add_validation_strategy(
24 24
             new EE_Text_Validation_Strategy(
25 25
                 isset($input_settings['validation_error_message'])
26
-                    ?  $input_settings['validation_error_message']
26
+                    ? $input_settings['validation_error_message']
27 27
                     : esc_html__(
28 28
                         'The CVV is either a 3 digit number on the back of your card, or 4 digit number on the front',
29 29
                         'event_espresso'
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -11,43 +11,43 @@
 block discarded – undo
11 11
  */
12 12
 class EE_CVV_Input extends EE_Text_Input
13 13
 {
14
-    /**
15
-     * @param array $input_settings {
16
-     *  @type boolean $include_whats_this_link defaults to true
17
-     * }
18
-     */
19
-    public function __construct($input_settings = array())
20
-    {
21
-        $this->set_sensitive_data_removal_strategy(new EE_CCV_Sensitive_Data_Removal());
22
-        $this->_add_validation_strategy(
23
-            new EE_Text_Validation_Strategy(
24
-                isset($input_settings['validation_error_message'])
25
-                    ?  $input_settings['validation_error_message']
26
-                    : esc_html__(
27
-                        'The CVV is either a 3 digit number on the back of your card, or 4 digit number on the front',
28
-                        'event_espresso'
29
-                    ),
30
-                '~^\d{3,4}$~'
31
-            )
32
-        );
33
-        parent::__construct($input_settings);
34
-        if (
35
-            ! isset($input_settings['include_whats_this_link'])
36
-            || (
37
-                isset($input_settings['include_whats_this_link'])
38
-                 && $input_settings['include_whats_this_link'] === true
39
-            )
40
-        ) {
41
-            $this->_html_label_text = sprintf(
42
-                esc_html_x(
43
-                    '%1$s %2$s(What\'s this?)%3$s',
44
-                    'CVV (What\'s this?)',
45
-                    'event_espresso'
46
-                ),
47
-                $this->_html_label_text,
48
-                '<a href="https://www.cvvnumber.com/" target="_blank" rel="noopener noreferrer">',
49
-                '</a>'
50
-            );
51
-        }
52
-    }
14
+	/**
15
+	 * @param array $input_settings {
16
+	 *  @type boolean $include_whats_this_link defaults to true
17
+	 * }
18
+	 */
19
+	public function __construct($input_settings = array())
20
+	{
21
+		$this->set_sensitive_data_removal_strategy(new EE_CCV_Sensitive_Data_Removal());
22
+		$this->_add_validation_strategy(
23
+			new EE_Text_Validation_Strategy(
24
+				isset($input_settings['validation_error_message'])
25
+					?  $input_settings['validation_error_message']
26
+					: esc_html__(
27
+						'The CVV is either a 3 digit number on the back of your card, or 4 digit number on the front',
28
+						'event_espresso'
29
+					),
30
+				'~^\d{3,4}$~'
31
+			)
32
+		);
33
+		parent::__construct($input_settings);
34
+		if (
35
+			! isset($input_settings['include_whats_this_link'])
36
+			|| (
37
+				isset($input_settings['include_whats_this_link'])
38
+				 && $input_settings['include_whats_this_link'] === true
39
+			)
40
+		) {
41
+			$this->_html_label_text = sprintf(
42
+				esc_html_x(
43
+					'%1$s %2$s(What\'s this?)%3$s',
44
+					'CVV (What\'s this?)',
45
+					'event_espresso'
46
+				),
47
+				$this->_html_label_text,
48
+				'<a href="https://www.cvvnumber.com/" target="_blank" rel="noopener noreferrer">',
49
+				'</a>'
50
+			);
51
+		}
52
+	}
53 53
 }
Please login to merge, or discard this patch.
strategies/display/EE_Text_Input_Display_Strategy.strategy.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -14,59 +14,59 @@
 block discarded – undo
14 14
  */
15 15
 class EE_Text_Input_Display_Strategy extends EE_Display_Strategy_Base
16 16
 {
17
-    /**
18
-     * The html "type" attribute value. default is "text"
19
-     * @var string
20
-     */
21
-    protected $_type;
17
+	/**
18
+	 * The html "type" attribute value. default is "text"
19
+	 * @var string
20
+	 */
21
+	protected $_type;
22 22
 
23 23
 
24 24
 
25
-    /**
26
-     * @param string $type
27
-     */
28
-    public function __construct($type = 'text')
29
-    {
30
-        $this->_type = $type;
31
-        parent::__construct();
32
-    }
25
+	/**
26
+	 * @param string $type
27
+	 */
28
+	public function __construct($type = 'text')
29
+	{
30
+		$this->_type = $type;
31
+		parent::__construct();
32
+	}
33 33
 
34 34
 
35 35
 
36
-    /**
37
-     * Gets the html "type" attribute's value
38
-     * @return string
39
-     */
40
-    public function get_type()
41
-    {
42
-        if (
43
-            $this->_type === 'email'
44
-            && ! apply_filters('FHEE__EE_Text_Input_Display_Strategy__use_html5_email', false)
45
-        ) {
46
-            return 'text';
47
-        }
48
-        return $this->_type;
49
-    }
36
+	/**
37
+	 * Gets the html "type" attribute's value
38
+	 * @return string
39
+	 */
40
+	public function get_type()
41
+	{
42
+		if (
43
+			$this->_type === 'email'
44
+			&& ! apply_filters('FHEE__EE_Text_Input_Display_Strategy__use_html5_email', false)
45
+		) {
46
+			return 'text';
47
+		}
48
+		return $this->_type;
49
+	}
50 50
 
51 51
 
52 52
 
53
-    /**
54
-     *
55
-     * @return string of html to display the field
56
-     */
57
-    public function display()
58
-    {
59
-        $input = '<input type="' . $this->get_type() . '"';
60
-        $input .= ' name="' . $this->_input->html_name() . '"';
61
-        $input .= ' id="' . $this->_input->html_id() . '"';
62
-        $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class();
63
-        $input .= ' class="' . $class . '"';
64
-        // add html5 required
65
-        $input .= $this->_input->required() ? ' required' : '';
66
-        $input .= ' value="' . $this->_input->raw_value_in_form() . '"';
67
-        $input .= ' style="' . $this->_input->html_style() . '"';
68
-        $input .= $this->_input->other_html_attributes();
69
-        $input .= '/>';
70
-        return $input;
71
-    }
53
+	/**
54
+	 *
55
+	 * @return string of html to display the field
56
+	 */
57
+	public function display()
58
+	{
59
+		$input = '<input type="' . $this->get_type() . '"';
60
+		$input .= ' name="' . $this->_input->html_name() . '"';
61
+		$input .= ' id="' . $this->_input->html_id() . '"';
62
+		$class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class();
63
+		$input .= ' class="' . $class . '"';
64
+		// add html5 required
65
+		$input .= $this->_input->required() ? ' required' : '';
66
+		$input .= ' value="' . $this->_input->raw_value_in_form() . '"';
67
+		$input .= ' style="' . $this->_input->html_style() . '"';
68
+		$input .= $this->_input->other_html_attributes();
69
+		$input .= '/>';
70
+		return $input;
71
+	}
72 72
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,15 +56,15 @@
 block discarded – undo
56 56
      */
57 57
     public function display()
58 58
     {
59
-        $input = '<input type="' . $this->get_type() . '"';
60
-        $input .= ' name="' . $this->_input->html_name() . '"';
61
-        $input .= ' id="' . $this->_input->html_id() . '"';
62
-        $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class();
63
-        $input .= ' class="' . $class . '"';
59
+        $input = '<input type="'.$this->get_type().'"';
60
+        $input .= ' name="'.$this->_input->html_name().'"';
61
+        $input .= ' id="'.$this->_input->html_id().'"';
62
+        $class = $this->_input->required() ? $this->_input->required_css_class().' '.$this->_input->html_class() : $this->_input->html_class();
63
+        $input .= ' class="'.$class.'"';
64 64
         // add html5 required
65 65
         $input .= $this->_input->required() ? ' required' : '';
66
-        $input .= ' value="' . $this->_input->raw_value_in_form() . '"';
67
-        $input .= ' style="' . $this->_input->html_style() . '"';
66
+        $input .= ' value="'.$this->_input->raw_value_in_form().'"';
67
+        $input .= ' style="'.$this->_input->html_style().'"';
68 68
         $input .= $this->_input->other_html_attributes();
69 69
         $input .= '/>';
70 70
         return $input;
Please login to merge, or discard this patch.
sensitive_data_removal/EE_CCV_Sensitive_Data_Removal.strategy.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,18 +11,18 @@
 block discarded – undo
11 11
  */
12 12
 class EE_CCV_Sensitive_Data_Removal extends EE_Sensitive_Data_Removal_Base
13 13
 {
14
-    public function remove_sensitive_data($normalized_value)
15
-    {
16
-        // Get the ccv Length
17
-        $ccv_lenght = strlen($normalized_value);
18
-        // Replace all characters of credit card except the last four and dashes
19
-        for ($i = 0; $i < $ccv_lenght; $i++) {
20
-            if ($normalized_value[ $i ] == '-') {
21
-                continue;
22
-            }
23
-            $normalized_value[ $i ] = 'X';
24
-        }
25
-        // Return the masked Credit Card #
26
-        return $normalized_value;
27
-    }
14
+	public function remove_sensitive_data($normalized_value)
15
+	{
16
+		// Get the ccv Length
17
+		$ccv_lenght = strlen($normalized_value);
18
+		// Replace all characters of credit card except the last four and dashes
19
+		for ($i = 0; $i < $ccv_lenght; $i++) {
20
+			if ($normalized_value[ $i ] == '-') {
21
+				continue;
22
+			}
23
+			$normalized_value[ $i ] = 'X';
24
+		}
25
+		// Return the masked Credit Card #
26
+		return $normalized_value;
27
+	}
28 28
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@
 block discarded – undo
17 17
         $ccv_lenght = strlen($normalized_value);
18 18
         // Replace all characters of credit card except the last four and dashes
19 19
         for ($i = 0; $i < $ccv_lenght; $i++) {
20
-            if ($normalized_value[ $i ] == '-') {
20
+            if ($normalized_value[$i] == '-') {
21 21
                 continue;
22 22
             }
23
-            $normalized_value[ $i ] = 'X';
23
+            $normalized_value[$i] = 'X';
24 24
         }
25 25
         // Return the masked Credit Card #
26 26
         return $normalized_value;
Please login to merge, or discard this patch.
sensitive_data_removal/EE_Credit_Card_Sensitive_Data_Removal.strategy.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,18 +11,18 @@
 block discarded – undo
11 11
  */
12 12
 class EE_Credit_Card_Sensitive_Data_Removal extends EE_Sensitive_Data_Removal_Base
13 13
 {
14
-    public function remove_sensitive_data($normalized_value)
15
-    {
16
-        // Get the cc Length
17
-        $cc_length = strlen($normalized_value);
18
-        // Replace all characters of credit card except the last four and dashes
19
-        for ($i = 0; $i < $cc_length - 4; $i++) {
20
-            if ($normalized_value[ $i ] == '-') {
21
-                continue;
22
-            }
23
-            $normalized_value[ $i ] = 'X';
24
-        }
25
-        // Return the masked Credit Card #
26
-        return $normalized_value;
27
-    }
14
+	public function remove_sensitive_data($normalized_value)
15
+	{
16
+		// Get the cc Length
17
+		$cc_length = strlen($normalized_value);
18
+		// Replace all characters of credit card except the last four and dashes
19
+		for ($i = 0; $i < $cc_length - 4; $i++) {
20
+			if ($normalized_value[ $i ] == '-') {
21
+				continue;
22
+			}
23
+			$normalized_value[ $i ] = 'X';
24
+		}
25
+		// Return the masked Credit Card #
26
+		return $normalized_value;
27
+	}
28 28
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@
 block discarded – undo
17 17
         $cc_length = strlen($normalized_value);
18 18
         // Replace all characters of credit card except the last four and dashes
19 19
         for ($i = 0; $i < $cc_length - 4; $i++) {
20
-            if ($normalized_value[ $i ] == '-') {
20
+            if ($normalized_value[$i] == '-') {
21 21
                 continue;
22 22
             }
23
-            $normalized_value[ $i ] = 'X';
23
+            $normalized_value[$i] = 'X';
24 24
         }
25 25
         // Return the masked Credit Card #
26 26
         return $normalized_value;
Please login to merge, or discard this patch.
strategies/validation/EE_Max_Length_Validation_Strategy.strategy.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
     public function get_jquery_validation_rule_array()
45 45
     {
46 46
         if ($this->_max_length !== EE_INF) {
47
-            return array( 'maxlength' => $this->_max_length, 'messages' => array( 'maxlength' => $this->get_validation_error_message() ) );
47
+            return array('maxlength' => $this->_max_length, 'messages' => array('maxlength' => $this->get_validation_error_message()));
48 48
         } else {
49 49
             return array();
50 50
         }
Please login to merge, or discard this patch.
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -11,41 +11,41 @@
 block discarded – undo
11 11
  */
12 12
 class EE_Max_Length_Validation_Strategy extends EE_Validation_Strategy_Base
13 13
 {
14
-    protected $_max_length;
14
+	protected $_max_length;
15 15
 
16
-    public function __construct($validation_error_message = null, $max_length = EE_INF)
17
-    {
18
-        $this->_max_length = $max_length;
19
-        if ($validation_error_message === null) {
20
-            $validation_error_message = sprintf(esc_html__('Input is too long. Maximum number of characters is %1$s', 'event_espresso'), $max_length);
21
-        }
22
-        parent::__construct($validation_error_message);
23
-    }
16
+	public function __construct($validation_error_message = null, $max_length = EE_INF)
17
+	{
18
+		$this->_max_length = $max_length;
19
+		if ($validation_error_message === null) {
20
+			$validation_error_message = sprintf(esc_html__('Input is too long. Maximum number of characters is %1$s', 'event_espresso'), $max_length);
21
+		}
22
+		parent::__construct($validation_error_message);
23
+	}
24 24
 
25
-    /**
26
-     * @param $normalized_value
27
-     */
28
-    public function validate($normalized_value)
29
-    {
30
-        if (
31
-            $this->_max_length !== EE_INF &&
32
-                $normalized_value &&
33
-                is_string($normalized_value) &&
34
-                 strlen($normalized_value) > $this->_max_length
35
-        ) {
36
-            throw new EE_Validation_Error($this->get_validation_error_message(), 'maxlength');
37
-        }
38
-    }
25
+	/**
26
+	 * @param $normalized_value
27
+	 */
28
+	public function validate($normalized_value)
29
+	{
30
+		if (
31
+			$this->_max_length !== EE_INF &&
32
+				$normalized_value &&
33
+				is_string($normalized_value) &&
34
+				 strlen($normalized_value) > $this->_max_length
35
+		) {
36
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'maxlength');
37
+		}
38
+	}
39 39
 
40
-    /**
41
-     * @return array
42
-     */
43
-    public function get_jquery_validation_rule_array()
44
-    {
45
-        if ($this->_max_length !== EE_INF) {
46
-            return array( 'maxlength' => $this->_max_length, 'messages' => array( 'maxlength' => $this->get_validation_error_message() ) );
47
-        } else {
48
-            return array();
49
-        }
50
-    }
40
+	/**
41
+	 * @return array
42
+	 */
43
+	public function get_jquery_validation_rule_array()
44
+	{
45
+		if ($this->_max_length !== EE_INF) {
46
+			return array( 'maxlength' => $this->_max_length, 'messages' => array( 'maxlength' => $this->get_validation_error_message() ) );
47
+		} else {
48
+			return array();
49
+		}
50
+	}
51 51
 }
Please login to merge, or discard this patch.
strategies/validation/EE_Min_Length_Validation_Strategy.strategy.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,6 +40,6 @@
 block discarded – undo
40 40
      */
41 41
     public function get_jquery_validation_rule_array()
42 42
     {
43
-        return array( 'minlength' => $this->_min_length, 'messages' => array( 'minlength' => $this->get_validation_error_message() ) );
43
+        return array('minlength' => $this->_min_length, 'messages' => array('minlength' => $this->get_validation_error_message()));
44 44
     }
45 45
 }
Please login to merge, or discard this patch.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -11,34 +11,34 @@
 block discarded – undo
11 11
  */
12 12
 class EE_Min_Length_Validation_Strategy extends EE_Validation_Strategy_Base
13 13
 {
14
-    protected $_min_length;
14
+	protected $_min_length;
15 15
 
16
-    public function __construct($validation_error_message = null, $min_length = 0)
17
-    {
18
-        $this->_min_length = $min_length;
19
-        parent::__construct($validation_error_message);
20
-    }
16
+	public function __construct($validation_error_message = null, $min_length = 0)
17
+	{
18
+		$this->_min_length = $min_length;
19
+		parent::__construct($validation_error_message);
20
+	}
21 21
 
22
-    /**
23
-     * @param $normalized_value
24
-     */
25
-    public function validate($normalized_value)
26
-    {
27
-        if (
28
-            $this->_min_length > 0 &&
29
-                $normalized_value &&
30
-                is_string($normalized_value) &&
31
-                strlen($normalized_value) < $this->_min_length
32
-        ) {
33
-            throw new EE_Validation_Error($this->get_validation_error_message(), 'minlength');
34
-        }
35
-    }
22
+	/**
23
+	 * @param $normalized_value
24
+	 */
25
+	public function validate($normalized_value)
26
+	{
27
+		if (
28
+			$this->_min_length > 0 &&
29
+				$normalized_value &&
30
+				is_string($normalized_value) &&
31
+				strlen($normalized_value) < $this->_min_length
32
+		) {
33
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'minlength');
34
+		}
35
+	}
36 36
 
37
-    /**
38
-     * @return array
39
-     */
40
-    public function get_jquery_validation_rule_array()
41
-    {
42
-        return array( 'minlength' => $this->_min_length, 'messages' => array( 'minlength' => $this->get_validation_error_message() ) );
43
-    }
37
+	/**
38
+	 * @return array
39
+	 */
40
+	public function get_jquery_validation_rule_array()
41
+	{
42
+		return array( 'minlength' => $this->_min_length, 'messages' => array( 'minlength' => $this->get_validation_error_message() ) );
43
+	}
44 44
 }
Please login to merge, or discard this patch.
strategies/validation/EE_Text_Validation_Strategy.strategy.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
     public function validate($normalized_value)
30 30
     {
31 31
         $string_normalized_value = (string) $normalized_value;
32
-        if ($this->_regex &&  $string_normalized_value) {
33
-            if (! preg_match($this->_regex, $string_normalized_value)) {
32
+        if ($this->_regex && $string_normalized_value) {
33
+            if ( ! preg_match($this->_regex, $string_normalized_value)) {
34 34
                 throw new EE_Validation_Error($this->get_validation_error_message(), 'regex');
35 35
             }
36 36
         }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     public function get_jquery_validation_rule_array()
43 43
     {
44 44
         if ($this->_regex !== null) {
45
-            return array( 'regex' => $this->regex_js(), 'messages' => array( 'regex' => $this->get_validation_error_message() ) );
45
+            return array('regex' => $this->regex_js(), 'messages' => array('regex' => $this->get_validation_error_message()));
46 46
         } else {
47 47
             return array();
48 48
         }
Please login to merge, or discard this patch.
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -10,53 +10,53 @@
 block discarded – undo
10 10
  */
11 11
 class EE_Text_Validation_Strategy extends EE_Validation_Strategy_Base
12 12
 {
13
-    protected $_regex = null;
14
-    /**
15
-     *
16
-     * @param string $validation_error_message
17
-     * @param string $regex a PHP regex; the javascript regex will be derived from this
18
-     */
19
-    public function __construct($validation_error_message = null, $regex = null)
20
-    {
21
-        $this->_regex = $regex;
22
-        parent::__construct($validation_error_message);
23
-    }
13
+	protected $_regex = null;
14
+	/**
15
+	 *
16
+	 * @param string $validation_error_message
17
+	 * @param string $regex a PHP regex; the javascript regex will be derived from this
18
+	 */
19
+	public function __construct($validation_error_message = null, $regex = null)
20
+	{
21
+		$this->_regex = $regex;
22
+		parent::__construct($validation_error_message);
23
+	}
24 24
 
25
-    /**
26
-     * @param $normalized_value
27
-     */
28
-    public function validate($normalized_value)
29
-    {
30
-        $string_normalized_value = (string) $normalized_value;
31
-        if ($this->_regex &&  $string_normalized_value) {
32
-            if (! preg_match($this->_regex, $string_normalized_value)) {
33
-                throw new EE_Validation_Error($this->get_validation_error_message(), 'regex');
34
-            }
35
-        }
36
-    }
25
+	/**
26
+	 * @param $normalized_value
27
+	 */
28
+	public function validate($normalized_value)
29
+	{
30
+		$string_normalized_value = (string) $normalized_value;
31
+		if ($this->_regex &&  $string_normalized_value) {
32
+			if (! preg_match($this->_regex, $string_normalized_value)) {
33
+				throw new EE_Validation_Error($this->get_validation_error_message(), 'regex');
34
+			}
35
+		}
36
+	}
37 37
 
38
-    /**
39
-     * @return array
40
-     */
41
-    public function get_jquery_validation_rule_array()
42
-    {
43
-        if ($this->_regex !== null) {
44
-            return array( 'regex' => $this->regex_js(), 'messages' => array( 'regex' => $this->get_validation_error_message() ) );
45
-        } else {
46
-            return array();
47
-        }
48
-    }
38
+	/**
39
+	 * @return array
40
+	 */
41
+	public function get_jquery_validation_rule_array()
42
+	{
43
+		if ($this->_regex !== null) {
44
+			return array( 'regex' => $this->regex_js(), 'messages' => array( 'regex' => $this->get_validation_error_message() ) );
45
+		} else {
46
+			return array();
47
+		}
48
+	}
49 49
 
50 50
 /**
51 51
  * Translates a PHP regex into a javscript regex (eg, PHP needs separate delimieters, whereas
52 52
  * javscript does not
53 53
  * @return string
54 54
  */
55
-    public function regex_js()
56
-    {
57
-        // first character must be the delimiter
58
-        $delimeter = $this->_regex[0];
59
-        $last_occurence_of_delimieter = strrpos($this->_regex, $delimeter);
60
-        return substr($this->_regex, 1, $last_occurence_of_delimieter - 1);
61
-    }
55
+	public function regex_js()
56
+	{
57
+		// first character must be the delimiter
58
+		$delimeter = $this->_regex[0];
59
+		$last_occurence_of_delimieter = strrpos($this->_regex, $delimeter);
60
+		return substr($this->_regex, 1, $last_occurence_of_delimieter - 1);
61
+	}
62 62
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/form_handlers/FormHandler.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function form($for_display = false)
173 173
     {
174
-        if (! $this->formIsValid()) {
174
+        if ( ! $this->formIsValid()) {
175 175
             return null;
176 176
         }
177 177
         if ($for_display) {
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
      */
275 275
     public function setFormName($form_name)
276 276
     {
277
-        if (! is_string($form_name)) {
277
+        if ( ! is_string($form_name)) {
278 278
             throw new InvalidDataTypeException('$form_name', $form_name, 'string');
279 279
         }
280 280
         $this->form_name = $form_name;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
      */
299 299
     public function setAdminName($admin_name)
300 300
     {
301
-        if (! is_string($admin_name)) {
301
+        if ( ! is_string($admin_name)) {
302 302
             throw new InvalidDataTypeException('$admin_name', $admin_name, 'string');
303 303
         }
304 304
         $this->admin_name = $admin_name;
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      */
323 323
     public function setSlug($slug)
324 324
     {
325
-        if (! is_string($slug)) {
325
+        if ( ! is_string($slug)) {
326 326
             throw new InvalidDataTypeException('$slug', $slug, 'string');
327 327
         }
328 328
         $this->slug = $slug;
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
      */
346 346
     public function setSubmitBtnText($submit_btn_text)
347 347
     {
348
-        if (! is_string($submit_btn_text)) {
348
+        if ( ! is_string($submit_btn_text)) {
349 349
             throw new InvalidDataTypeException('$submit_btn_text', $submit_btn_text, 'string');
350 350
         }
351 351
         if (empty($submit_btn_text)) {
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
      */
375 375
     public function setFormAction($form_action)
376 376
     {
377
-        if (! is_string($form_action)) {
377
+        if ( ! is_string($form_action)) {
378 378
             throw new InvalidDataTypeException('$form_action', $form_action, 'string');
379 379
         }
380 380
         $this->form_action = $form_action;
@@ -493,11 +493,11 @@  discard block
 block discarded – undo
493 493
         $text = ! empty($text) ? $text : $this->submitBtnText();
494 494
         return new EE_Submit_Input(
495 495
             array(
496
-                'html_name'             => 'ee-form-submit-' . $this->slug(),
497
-                'html_id'               => 'ee-form-submit-' . $this->slug(),
496
+                'html_name'             => 'ee-form-submit-'.$this->slug(),
497
+                'html_id'               => 'ee-form-submit-'.$this->slug(),
498 498
                 'html_class'            => 'ee-form-submit',
499 499
                 'html_label'            => '&nbsp;',
500
-                'other_html_attributes' => ' rel="' . $this->slug() . '"',
500
+                'other_html_attributes' => ' rel="'.$this->slug().'"',
501 501
                 'default'               => $text,
502 502
             )
503 503
         );
@@ -513,11 +513,11 @@  discard block
 block discarded – undo
513 513
      */
514 514
     public function appendSubmitButton($text = '')
515 515
     {
516
-        if ($this->form->subsection_exists($this->slug() . '-submit-btn')) {
516
+        if ($this->form->subsection_exists($this->slug().'-submit-btn')) {
517 517
             return;
518 518
         }
519 519
         $this->form->add_subsections(
520
-            array($this->slug() . '-submit-btn' => $this->generateSubmitButton($text)),
520
+            array($this->slug().'-submit-btn' => $this->generateSubmitButton($text)),
521 521
             null,
522 522
             false
523 523
         );
@@ -534,11 +534,11 @@  discard block
 block discarded – undo
534 534
     {
535 535
         $cancel_button = new EE_Submit_Input(
536 536
             array(
537
-                'html_name'             => 'ee-form-submit-' . $this->slug(), // YES! Same name as submit !!!
538
-                'html_id'               => 'ee-cancel-form-' . $this->slug(),
537
+                'html_name'             => 'ee-form-submit-'.$this->slug(), // YES! Same name as submit !!!
538
+                'html_id'               => 'ee-cancel-form-'.$this->slug(),
539 539
                 'html_class'            => 'ee-cancel-form',
540 540
                 'html_label'            => '&nbsp;',
541
-                'other_html_attributes' => ' rel="' . $this->slug() . '"',
541
+                'other_html_attributes' => ' rel="'.$this->slug().'"',
542 542
                 'default'               => ! empty($text) ? $text : esc_html__('Cancel', 'event_espresso'),
543 543
             )
544 544
         );
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
         $this->form->add_subsections(
559 559
             array(
560 560
                 'clear-submit-btn-float' => new EE_Form_Section_HTML(
561
-                    EEH_HTML::div('', '', 'clear-float') . EEH_HTML::divx()
561
+                    EEH_HTML::div('', '', 'clear-float').EEH_HTML::divx()
562 562
                 ),
563 563
             ),
564 564
             null,
@@ -644,11 +644,11 @@  discard block
 block discarded – undo
644 644
      */
645 645
     public function process($submitted_form_data = array())
646 646
     {
647
-        if (! $this->form()->was_submitted($submitted_form_data)) {
647
+        if ( ! $this->form()->was_submitted($submitted_form_data)) {
648 648
             throw new InvalidFormSubmissionException($this->form_name);
649 649
         }
650 650
         $this->form(true)->receive_form_submission($submitted_form_data);
651
-        if (! $this->form()->is_valid()) {
651
+        if ( ! $this->form()->is_valid()) {
652 652
             throw new InvalidFormSubmissionException(
653 653
                 $this->form_name,
654 654
                 sprintf(
Please login to merge, or discard this patch.
Indentation   +638 added lines, -638 removed lines patch added patch discarded remove patch
@@ -28,642 +28,642 @@
 block discarded – undo
28 28
  */
29 29
 abstract class FormHandler implements FormHandlerInterface
30 30
 {
31
-    /**
32
-     * will add opening and closing HTML form tags as well as a submit button
33
-     */
34
-    const ADD_FORM_TAGS_AND_SUBMIT = 'add_form_tags_and_submit';
35
-
36
-    /**
37
-     * will add opening and closing HTML form tags but NOT a submit button
38
-     */
39
-    const ADD_FORM_TAGS_ONLY = 'add_form_tags_only';
40
-
41
-    /**
42
-     * will NOT add opening and closing HTML form tags but will add a submit button
43
-     */
44
-    const ADD_FORM_SUBMIT_ONLY = 'add_form_submit_only';
45
-
46
-    /**
47
-     * will NOT add opening and closing HTML form tags NOR a submit button
48
-     */
49
-    const DO_NOT_SETUP_FORM = 'do_not_setup_form';
50
-
51
-    /**
52
-     * if set to false, then this form has no displayable content,
53
-     * and will only be used for processing data sent passed via GET or POST
54
-     * defaults to true ( ie: form has displayable content )
55
-     *
56
-     * @var boolean $displayable
57
-     */
58
-    private $displayable = true;
59
-
60
-    /**
61
-     * @var string $form_name
62
-     */
63
-    private $form_name;
64
-
65
-    /**
66
-     * @var string $admin_name
67
-     */
68
-    private $admin_name;
69
-
70
-    /**
71
-     * @var string $slug
72
-     */
73
-    private $slug;
74
-
75
-    /**
76
-     * @var string $submit_btn_text
77
-     */
78
-    private $submit_btn_text;
79
-
80
-    /**
81
-     * @var string $form_action
82
-     */
83
-    private $form_action;
84
-
85
-    /**
86
-     * form params in key value pairs
87
-     * can be added to form action URL or as hidden inputs
88
-     *
89
-     * @var array $form_args
90
-     */
91
-    private $form_args = array();
92
-
93
-    /**
94
-     * value of one of the string constant above
95
-     *
96
-     * @var string $form_config
97
-     */
98
-    private $form_config;
99
-
100
-    /**
101
-     * whether or not the form was determined to be invalid
102
-     *
103
-     * @var boolean $form_has_errors
104
-     */
105
-    private $form_has_errors;
106
-
107
-    /**
108
-     * the absolute top level form section being used on the page
109
-     *
110
-     * @var EE_Form_Section_Proper $form
111
-     */
112
-    private $form;
113
-
114
-    /**
115
-     * @var EE_Registry $registry
116
-     */
117
-    protected $registry;
118
-
119
-    // phpcs:disable PEAR.Functions.ValidDefaultValue.NotAtEnd
120
-
121
-
122
-    /**
123
-     * Form constructor.
124
-     *
125
-     * @param string           $form_name
126
-     * @param string           $admin_name
127
-     * @param string           $slug
128
-     * @param string           $form_action
129
-     * @param string           $form_config
130
-     * @param EE_Registry|null $registry
131
-     */
132
-    public function __construct(
133
-        $form_name,
134
-        $admin_name,
135
-        $slug,
136
-        $form_action = '',
137
-        $form_config = FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
138
-        EE_Registry $registry = null
139
-    ) {
140
-        $this->setFormName($form_name);
141
-        $this->setAdminName($admin_name);
142
-        $this->setSlug($slug);
143
-        $this->setFormAction($form_action);
144
-        $this->setFormConfig($form_config);
145
-        $this->setSubmitBtnText(esc_html__('Submit', 'event_espresso'));
146
-        $this->registry = $registry;
147
-    }
148
-
149
-
150
-    /**
151
-     * @return array
152
-     */
153
-    public static function getFormConfigConstants()
154
-    {
155
-        return array(
156
-            FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
157
-            FormHandler::ADD_FORM_TAGS_ONLY,
158
-            FormHandler::ADD_FORM_SUBMIT_ONLY,
159
-            FormHandler::DO_NOT_SETUP_FORM,
160
-        );
161
-    }
162
-
163
-
164
-    /**
165
-     * @param bool $for_display
166
-     * @return EE_Form_Section_Proper
167
-     * @throws EE_Error
168
-     * @throws LogicException
169
-     */
170
-    public function form($for_display = false)
171
-    {
172
-        if (! $this->formIsValid()) {
173
-            return null;
174
-        }
175
-        if ($for_display) {
176
-            $form_config = $this->formConfig();
177
-            if (
178
-                $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
179
-                || $form_config === FormHandler::ADD_FORM_SUBMIT_ONLY
180
-            ) {
181
-                $this->appendSubmitButton();
182
-                $this->clearFormButtonFloats();
183
-            }
184
-        }
185
-        return $this->form;
186
-    }
187
-
188
-
189
-    /**
190
-     * @return boolean
191
-     * @throws LogicException
192
-     */
193
-    public function formIsValid()
194
-    {
195
-        if ($this->form instanceof EE_Form_Section_Proper) {
196
-            return true;
197
-        }
198
-        $form = apply_filters(
199
-            'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__formIsValid__generated_form_object',
200
-            $this->generate(),
201
-            $this
202
-        );
203
-        if ($this->verifyForm($form)) {
204
-            $this->setForm($form);
205
-        }
206
-        return true;
207
-    }
208
-
209
-
210
-    /**
211
-     * @param EE_Form_Section_Proper|null $form
212
-     * @return bool
213
-     * @throws LogicException
214
-     */
215
-    public function verifyForm(EE_Form_Section_Proper $form = null)
216
-    {
217
-        $form = $form !== null ? $form : $this->form;
218
-        if ($form instanceof EE_Form_Section_Proper) {
219
-            return true;
220
-        }
221
-        throw new LogicException(
222
-            sprintf(
223
-                esc_html__('The "%1$s" form is invalid or missing. %2$s', 'event_espresso'),
224
-                $this->form_name,
225
-                var_export($form, true)
226
-            )
227
-        );
228
-    }
229
-
230
-
231
-    /**
232
-     * @param EE_Form_Section_Proper $form
233
-     */
234
-    public function setForm(EE_Form_Section_Proper $form)
235
-    {
236
-        $this->form = $form;
237
-    }
238
-
239
-
240
-    /**
241
-     * @return boolean
242
-     */
243
-    public function displayable()
244
-    {
245
-        return $this->displayable;
246
-    }
247
-
248
-
249
-    /**
250
-     * @param boolean $displayable
251
-     */
252
-    public function setDisplayable($displayable = false)
253
-    {
254
-        $this->displayable = filter_var($displayable, FILTER_VALIDATE_BOOLEAN);
255
-    }
256
-
257
-
258
-    /**
259
-     * a public name for the form that can be displayed on the frontend of a site
260
-     *
261
-     * @return string
262
-     */
263
-    public function formName()
264
-    {
265
-        return $this->form_name;
266
-    }
267
-
268
-
269
-    /**
270
-     * @param string $form_name
271
-     * @throws InvalidDataTypeException
272
-     */
273
-    public function setFormName($form_name)
274
-    {
275
-        if (! is_string($form_name)) {
276
-            throw new InvalidDataTypeException('$form_name', $form_name, 'string');
277
-        }
278
-        $this->form_name = $form_name;
279
-    }
280
-
281
-
282
-    /**
283
-     * a public name for the form that can be displayed, but only in the admin
284
-     *
285
-     * @return string
286
-     */
287
-    public function adminName()
288
-    {
289
-        return $this->admin_name;
290
-    }
291
-
292
-
293
-    /**
294
-     * @param string $admin_name
295
-     * @throws InvalidDataTypeException
296
-     */
297
-    public function setAdminName($admin_name)
298
-    {
299
-        if (! is_string($admin_name)) {
300
-            throw new InvalidDataTypeException('$admin_name', $admin_name, 'string');
301
-        }
302
-        $this->admin_name = $admin_name;
303
-    }
304
-
305
-
306
-    /**
307
-     * a URL friendly string that can be used for identifying the form
308
-     *
309
-     * @return string
310
-     */
311
-    public function slug()
312
-    {
313
-        return $this->slug;
314
-    }
315
-
316
-
317
-    /**
318
-     * @param string $slug
319
-     * @throws InvalidDataTypeException
320
-     */
321
-    public function setSlug($slug)
322
-    {
323
-        if (! is_string($slug)) {
324
-            throw new InvalidDataTypeException('$slug', $slug, 'string');
325
-        }
326
-        $this->slug = $slug;
327
-    }
328
-
329
-
330
-    /**
331
-     * @return string
332
-     */
333
-    public function submitBtnText()
334
-    {
335
-        return $this->submit_btn_text;
336
-    }
337
-
338
-
339
-    /**
340
-     * @param string $submit_btn_text
341
-     * @throws InvalidDataTypeException
342
-     * @throws InvalidArgumentException
343
-     */
344
-    public function setSubmitBtnText($submit_btn_text)
345
-    {
346
-        if (! is_string($submit_btn_text)) {
347
-            throw new InvalidDataTypeException('$submit_btn_text', $submit_btn_text, 'string');
348
-        }
349
-        if (empty($submit_btn_text)) {
350
-            throw new InvalidArgumentException(
351
-                esc_html__('Can not set Submit button text because an empty string was provided.', 'event_espresso')
352
-            );
353
-        }
354
-        $this->submit_btn_text = $submit_btn_text;
355
-    }
356
-
357
-
358
-    /**
359
-     * @return string
360
-     */
361
-    public function formAction()
362
-    {
363
-        return ! empty($this->form_args)
364
-            ? add_query_arg($this->form_args, $this->form_action)
365
-            : $this->form_action;
366
-    }
367
-
368
-
369
-    /**
370
-     * @param string $form_action
371
-     * @throws InvalidDataTypeException
372
-     */
373
-    public function setFormAction($form_action)
374
-    {
375
-        if (! is_string($form_action)) {
376
-            throw new InvalidDataTypeException('$form_action', $form_action, 'string');
377
-        }
378
-        $this->form_action = $form_action;
379
-    }
380
-
381
-
382
-    /**
383
-     * @param array $form_args
384
-     * @throws InvalidDataTypeException
385
-     * @throws InvalidArgumentException
386
-     */
387
-    public function addFormActionArgs($form_args = array())
388
-    {
389
-        if (is_object($form_args)) {
390
-            throw new InvalidDataTypeException(
391
-                '$form_args',
392
-                $form_args,
393
-                'anything other than an object was expected.'
394
-            );
395
-        }
396
-        if (empty($form_args)) {
397
-            throw new InvalidArgumentException(
398
-                esc_html__('The redirect arguments can not be an empty array.', 'event_espresso')
399
-            );
400
-        }
401
-        $this->form_args = array_merge($this->form_args, $form_args);
402
-    }
403
-
404
-
405
-    /**
406
-     * @return string
407
-     */
408
-    public function formConfig()
409
-    {
410
-        return $this->form_config;
411
-    }
412
-
413
-
414
-    /**
415
-     * @param string $form_config
416
-     * @throws DomainException
417
-     */
418
-    public function setFormConfig($form_config)
419
-    {
420
-        if (
421
-            ! in_array(
422
-                $form_config,
423
-                array(
424
-                FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
425
-                FormHandler::ADD_FORM_TAGS_ONLY,
426
-                FormHandler::ADD_FORM_SUBMIT_ONLY,
427
-                FormHandler::DO_NOT_SETUP_FORM,
428
-                ),
429
-                true
430
-            )
431
-        ) {
432
-            throw new DomainException(
433
-                sprintf(
434
-                    esc_html__(
435
-                        '"%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',
436
-                        'event_espresso'
437
-                    ),
438
-                    $form_config
439
-                )
440
-            );
441
-        }
442
-        $this->form_config = $form_config;
443
-    }
444
-
445
-
446
-    /**
447
-     * called after the form is instantiated
448
-     * and used for performing any logic that needs to occur early
449
-     * before any of the other methods are called.
450
-     * returns true if everything is ok to proceed,
451
-     * and false if no further form logic should be implemented
452
-     *
453
-     * @return boolean
454
-     */
455
-    public function initialize()
456
-    {
457
-        $this->form_has_errors = EE_Error::has_error(true);
458
-        return true;
459
-    }
460
-
461
-
462
-    /**
463
-     * used for setting up css and js
464
-     *
465
-     * @return void
466
-     * @throws LogicException
467
-     * @throws EE_Error
468
-     */
469
-    public function enqueueStylesAndScripts()
470
-    {
471
-        $this->form()->enqueue_js();
472
-    }
473
-
474
-
475
-    /**
476
-     * creates and returns the actual form
477
-     *
478
-     * @return EE_Form_Section_Proper
479
-     */
480
-    abstract public function generate();
481
-
482
-
483
-    /**
484
-     * creates and returns an EE_Submit_Input labeled "Submit"
485
-     *
486
-     * @param string $text
487
-     * @return EE_Submit_Input
488
-     */
489
-    public function generateSubmitButton($text = '')
490
-    {
491
-        $text = ! empty($text) ? $text : $this->submitBtnText();
492
-        return new EE_Submit_Input(
493
-            array(
494
-                'html_name'             => 'ee-form-submit-' . $this->slug(),
495
-                'html_id'               => 'ee-form-submit-' . $this->slug(),
496
-                'html_class'            => 'ee-form-submit',
497
-                'html_label'            => '&nbsp;',
498
-                'other_html_attributes' => ' rel="' . $this->slug() . '"',
499
-                'default'               => $text,
500
-            )
501
-        );
502
-    }
503
-
504
-
505
-    /**
506
-     * calls generateSubmitButton() and appends it onto the form along with a float clearing div
507
-     *
508
-     * @param string $text
509
-     * @return void
510
-     * @throws EE_Error
511
-     */
512
-    public function appendSubmitButton($text = '')
513
-    {
514
-        if ($this->form->subsection_exists($this->slug() . '-submit-btn')) {
515
-            return;
516
-        }
517
-        $this->form->add_subsections(
518
-            array($this->slug() . '-submit-btn' => $this->generateSubmitButton($text)),
519
-            null,
520
-            false
521
-        );
522
-    }
523
-
524
-
525
-    /**
526
-     * creates and returns an EE_Submit_Input labeled "Cancel"
527
-     *
528
-     * @param string $text
529
-     * @return EE_Submit_Input
530
-     */
531
-    public function generateCancelButton($text = '')
532
-    {
533
-        $cancel_button = new EE_Submit_Input(
534
-            array(
535
-                'html_name'             => 'ee-form-submit-' . $this->slug(), // YES! Same name as submit !!!
536
-                'html_id'               => 'ee-cancel-form-' . $this->slug(),
537
-                'html_class'            => 'ee-cancel-form',
538
-                'html_label'            => '&nbsp;',
539
-                'other_html_attributes' => ' rel="' . $this->slug() . '"',
540
-                'default'               => ! empty($text) ? $text : esc_html__('Cancel', 'event_espresso'),
541
-            )
542
-        );
543
-        $cancel_button->set_button_css_attributes(false);
544
-        return $cancel_button;
545
-    }
546
-
547
-
548
-    /**
549
-     * appends a float clearing div onto end of form
550
-     *
551
-     * @return void
552
-     * @throws EE_Error
553
-     */
554
-    public function clearFormButtonFloats()
555
-    {
556
-        $this->form->add_subsections(
557
-            array(
558
-                'clear-submit-btn-float' => new EE_Form_Section_HTML(
559
-                    EEH_HTML::div('', '', 'clear-float') . EEH_HTML::divx()
560
-                ),
561
-            ),
562
-            null,
563
-            false
564
-        );
565
-    }
566
-
567
-
568
-    /**
569
-     * takes the generated form and displays it along with ony other non-form HTML that may be required
570
-     * returns a string of HTML that can be directly echoed in a template
571
-     *
572
-     * @return string
573
-     * @throws \InvalidArgumentException
574
-     * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
575
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
576
-     * @throws LogicException
577
-     * @throws EE_Error
578
-     */
579
-    public function display()
580
-    {
581
-        $form_html = apply_filters(
582
-            'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form',
583
-            ''
584
-        );
585
-        $form_config = $this->formConfig();
586
-        if (
587
-            $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
588
-            || $form_config === FormHandler::ADD_FORM_TAGS_ONLY
589
-        ) {
590
-            $additional_props = $this->requiresMultipartEnctype()
591
-                ? ' enctype="multipart/form-data"'
592
-                : '';
593
-            $form_html .= $this->form()->form_open(
594
-                $this->formAction(),
595
-                'POST',
596
-                $additional_props
597
-            );
598
-        }
599
-        $form_html .= $this->form(true)->get_html();
600
-        if (
601
-            $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
602
-            || $form_config === FormHandler::ADD_FORM_TAGS_ONLY
603
-        ) {
604
-            $form_html .= $this->form()->form_close();
605
-        }
606
-        $form_html .= apply_filters(
607
-            'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__after_form',
608
-            ''
609
-        );
610
-        return $form_html;
611
-    }
612
-
613
-    /**
614
-     * Determines if this form needs "enctype='multipart/form-data'" or not.
615
-     * @since 4.9.80.p
616
-     * @return bool
617
-     * @throws EE_Error
618
-     */
619
-    public function requiresMultipartEnctype()
620
-    {
621
-        foreach ($this->form()->inputs_in_subsections() as $input) {
622
-            if ($input instanceof EE_File_Input) {
623
-                return true;
624
-            }
625
-        }
626
-        return false;
627
-    }
628
-
629
-
630
-    /**
631
-     * handles processing the form submission
632
-     * returns true or false depending on whether the form was processed successfully or not
633
-     *
634
-     * @param array $submitted_form_data
635
-     * @return array
636
-     * @throws \InvalidArgumentException
637
-     * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
638
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
639
-     * @throws EE_Error
640
-     * @throws LogicException
641
-     * @throws InvalidFormSubmissionException
642
-     */
643
-    public function process($submitted_form_data = array())
644
-    {
645
-        if (! $this->form()->was_submitted($submitted_form_data)) {
646
-            throw new InvalidFormSubmissionException($this->form_name);
647
-        }
648
-        $this->form(true)->receive_form_submission($submitted_form_data);
649
-        if (! $this->form()->is_valid()) {
650
-            throw new InvalidFormSubmissionException(
651
-                $this->form_name,
652
-                sprintf(
653
-                    esc_html__(
654
-                        'The "%1$s" form is invalid. Please correct the following errors and resubmit: %2$s %3$s',
655
-                        'event_espresso'
656
-                    ),
657
-                    $this->form_name,
658
-                    '<br />',
659
-                    implode('<br />', $this->form()->get_validation_errors_accumulated())
660
-                )
661
-            );
662
-        }
663
-        return apply_filters(
664
-            'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__process__valid_data',
665
-            $this->form()->valid_data(),
666
-            $this
667
-        );
668
-    }
31
+	/**
32
+	 * will add opening and closing HTML form tags as well as a submit button
33
+	 */
34
+	const ADD_FORM_TAGS_AND_SUBMIT = 'add_form_tags_and_submit';
35
+
36
+	/**
37
+	 * will add opening and closing HTML form tags but NOT a submit button
38
+	 */
39
+	const ADD_FORM_TAGS_ONLY = 'add_form_tags_only';
40
+
41
+	/**
42
+	 * will NOT add opening and closing HTML form tags but will add a submit button
43
+	 */
44
+	const ADD_FORM_SUBMIT_ONLY = 'add_form_submit_only';
45
+
46
+	/**
47
+	 * will NOT add opening and closing HTML form tags NOR a submit button
48
+	 */
49
+	const DO_NOT_SETUP_FORM = 'do_not_setup_form';
50
+
51
+	/**
52
+	 * if set to false, then this form has no displayable content,
53
+	 * and will only be used for processing data sent passed via GET or POST
54
+	 * defaults to true ( ie: form has displayable content )
55
+	 *
56
+	 * @var boolean $displayable
57
+	 */
58
+	private $displayable = true;
59
+
60
+	/**
61
+	 * @var string $form_name
62
+	 */
63
+	private $form_name;
64
+
65
+	/**
66
+	 * @var string $admin_name
67
+	 */
68
+	private $admin_name;
69
+
70
+	/**
71
+	 * @var string $slug
72
+	 */
73
+	private $slug;
74
+
75
+	/**
76
+	 * @var string $submit_btn_text
77
+	 */
78
+	private $submit_btn_text;
79
+
80
+	/**
81
+	 * @var string $form_action
82
+	 */
83
+	private $form_action;
84
+
85
+	/**
86
+	 * form params in key value pairs
87
+	 * can be added to form action URL or as hidden inputs
88
+	 *
89
+	 * @var array $form_args
90
+	 */
91
+	private $form_args = array();
92
+
93
+	/**
94
+	 * value of one of the string constant above
95
+	 *
96
+	 * @var string $form_config
97
+	 */
98
+	private $form_config;
99
+
100
+	/**
101
+	 * whether or not the form was determined to be invalid
102
+	 *
103
+	 * @var boolean $form_has_errors
104
+	 */
105
+	private $form_has_errors;
106
+
107
+	/**
108
+	 * the absolute top level form section being used on the page
109
+	 *
110
+	 * @var EE_Form_Section_Proper $form
111
+	 */
112
+	private $form;
113
+
114
+	/**
115
+	 * @var EE_Registry $registry
116
+	 */
117
+	protected $registry;
118
+
119
+	// phpcs:disable PEAR.Functions.ValidDefaultValue.NotAtEnd
120
+
121
+
122
+	/**
123
+	 * Form constructor.
124
+	 *
125
+	 * @param string           $form_name
126
+	 * @param string           $admin_name
127
+	 * @param string           $slug
128
+	 * @param string           $form_action
129
+	 * @param string           $form_config
130
+	 * @param EE_Registry|null $registry
131
+	 */
132
+	public function __construct(
133
+		$form_name,
134
+		$admin_name,
135
+		$slug,
136
+		$form_action = '',
137
+		$form_config = FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
138
+		EE_Registry $registry = null
139
+	) {
140
+		$this->setFormName($form_name);
141
+		$this->setAdminName($admin_name);
142
+		$this->setSlug($slug);
143
+		$this->setFormAction($form_action);
144
+		$this->setFormConfig($form_config);
145
+		$this->setSubmitBtnText(esc_html__('Submit', 'event_espresso'));
146
+		$this->registry = $registry;
147
+	}
148
+
149
+
150
+	/**
151
+	 * @return array
152
+	 */
153
+	public static function getFormConfigConstants()
154
+	{
155
+		return array(
156
+			FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
157
+			FormHandler::ADD_FORM_TAGS_ONLY,
158
+			FormHandler::ADD_FORM_SUBMIT_ONLY,
159
+			FormHandler::DO_NOT_SETUP_FORM,
160
+		);
161
+	}
162
+
163
+
164
+	/**
165
+	 * @param bool $for_display
166
+	 * @return EE_Form_Section_Proper
167
+	 * @throws EE_Error
168
+	 * @throws LogicException
169
+	 */
170
+	public function form($for_display = false)
171
+	{
172
+		if (! $this->formIsValid()) {
173
+			return null;
174
+		}
175
+		if ($for_display) {
176
+			$form_config = $this->formConfig();
177
+			if (
178
+				$form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
179
+				|| $form_config === FormHandler::ADD_FORM_SUBMIT_ONLY
180
+			) {
181
+				$this->appendSubmitButton();
182
+				$this->clearFormButtonFloats();
183
+			}
184
+		}
185
+		return $this->form;
186
+	}
187
+
188
+
189
+	/**
190
+	 * @return boolean
191
+	 * @throws LogicException
192
+	 */
193
+	public function formIsValid()
194
+	{
195
+		if ($this->form instanceof EE_Form_Section_Proper) {
196
+			return true;
197
+		}
198
+		$form = apply_filters(
199
+			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__formIsValid__generated_form_object',
200
+			$this->generate(),
201
+			$this
202
+		);
203
+		if ($this->verifyForm($form)) {
204
+			$this->setForm($form);
205
+		}
206
+		return true;
207
+	}
208
+
209
+
210
+	/**
211
+	 * @param EE_Form_Section_Proper|null $form
212
+	 * @return bool
213
+	 * @throws LogicException
214
+	 */
215
+	public function verifyForm(EE_Form_Section_Proper $form = null)
216
+	{
217
+		$form = $form !== null ? $form : $this->form;
218
+		if ($form instanceof EE_Form_Section_Proper) {
219
+			return true;
220
+		}
221
+		throw new LogicException(
222
+			sprintf(
223
+				esc_html__('The "%1$s" form is invalid or missing. %2$s', 'event_espresso'),
224
+				$this->form_name,
225
+				var_export($form, true)
226
+			)
227
+		);
228
+	}
229
+
230
+
231
+	/**
232
+	 * @param EE_Form_Section_Proper $form
233
+	 */
234
+	public function setForm(EE_Form_Section_Proper $form)
235
+	{
236
+		$this->form = $form;
237
+	}
238
+
239
+
240
+	/**
241
+	 * @return boolean
242
+	 */
243
+	public function displayable()
244
+	{
245
+		return $this->displayable;
246
+	}
247
+
248
+
249
+	/**
250
+	 * @param boolean $displayable
251
+	 */
252
+	public function setDisplayable($displayable = false)
253
+	{
254
+		$this->displayable = filter_var($displayable, FILTER_VALIDATE_BOOLEAN);
255
+	}
256
+
257
+
258
+	/**
259
+	 * a public name for the form that can be displayed on the frontend of a site
260
+	 *
261
+	 * @return string
262
+	 */
263
+	public function formName()
264
+	{
265
+		return $this->form_name;
266
+	}
267
+
268
+
269
+	/**
270
+	 * @param string $form_name
271
+	 * @throws InvalidDataTypeException
272
+	 */
273
+	public function setFormName($form_name)
274
+	{
275
+		if (! is_string($form_name)) {
276
+			throw new InvalidDataTypeException('$form_name', $form_name, 'string');
277
+		}
278
+		$this->form_name = $form_name;
279
+	}
280
+
281
+
282
+	/**
283
+	 * a public name for the form that can be displayed, but only in the admin
284
+	 *
285
+	 * @return string
286
+	 */
287
+	public function adminName()
288
+	{
289
+		return $this->admin_name;
290
+	}
291
+
292
+
293
+	/**
294
+	 * @param string $admin_name
295
+	 * @throws InvalidDataTypeException
296
+	 */
297
+	public function setAdminName($admin_name)
298
+	{
299
+		if (! is_string($admin_name)) {
300
+			throw new InvalidDataTypeException('$admin_name', $admin_name, 'string');
301
+		}
302
+		$this->admin_name = $admin_name;
303
+	}
304
+
305
+
306
+	/**
307
+	 * a URL friendly string that can be used for identifying the form
308
+	 *
309
+	 * @return string
310
+	 */
311
+	public function slug()
312
+	{
313
+		return $this->slug;
314
+	}
315
+
316
+
317
+	/**
318
+	 * @param string $slug
319
+	 * @throws InvalidDataTypeException
320
+	 */
321
+	public function setSlug($slug)
322
+	{
323
+		if (! is_string($slug)) {
324
+			throw new InvalidDataTypeException('$slug', $slug, 'string');
325
+		}
326
+		$this->slug = $slug;
327
+	}
328
+
329
+
330
+	/**
331
+	 * @return string
332
+	 */
333
+	public function submitBtnText()
334
+	{
335
+		return $this->submit_btn_text;
336
+	}
337
+
338
+
339
+	/**
340
+	 * @param string $submit_btn_text
341
+	 * @throws InvalidDataTypeException
342
+	 * @throws InvalidArgumentException
343
+	 */
344
+	public function setSubmitBtnText($submit_btn_text)
345
+	{
346
+		if (! is_string($submit_btn_text)) {
347
+			throw new InvalidDataTypeException('$submit_btn_text', $submit_btn_text, 'string');
348
+		}
349
+		if (empty($submit_btn_text)) {
350
+			throw new InvalidArgumentException(
351
+				esc_html__('Can not set Submit button text because an empty string was provided.', 'event_espresso')
352
+			);
353
+		}
354
+		$this->submit_btn_text = $submit_btn_text;
355
+	}
356
+
357
+
358
+	/**
359
+	 * @return string
360
+	 */
361
+	public function formAction()
362
+	{
363
+		return ! empty($this->form_args)
364
+			? add_query_arg($this->form_args, $this->form_action)
365
+			: $this->form_action;
366
+	}
367
+
368
+
369
+	/**
370
+	 * @param string $form_action
371
+	 * @throws InvalidDataTypeException
372
+	 */
373
+	public function setFormAction($form_action)
374
+	{
375
+		if (! is_string($form_action)) {
376
+			throw new InvalidDataTypeException('$form_action', $form_action, 'string');
377
+		}
378
+		$this->form_action = $form_action;
379
+	}
380
+
381
+
382
+	/**
383
+	 * @param array $form_args
384
+	 * @throws InvalidDataTypeException
385
+	 * @throws InvalidArgumentException
386
+	 */
387
+	public function addFormActionArgs($form_args = array())
388
+	{
389
+		if (is_object($form_args)) {
390
+			throw new InvalidDataTypeException(
391
+				'$form_args',
392
+				$form_args,
393
+				'anything other than an object was expected.'
394
+			);
395
+		}
396
+		if (empty($form_args)) {
397
+			throw new InvalidArgumentException(
398
+				esc_html__('The redirect arguments can not be an empty array.', 'event_espresso')
399
+			);
400
+		}
401
+		$this->form_args = array_merge($this->form_args, $form_args);
402
+	}
403
+
404
+
405
+	/**
406
+	 * @return string
407
+	 */
408
+	public function formConfig()
409
+	{
410
+		return $this->form_config;
411
+	}
412
+
413
+
414
+	/**
415
+	 * @param string $form_config
416
+	 * @throws DomainException
417
+	 */
418
+	public function setFormConfig($form_config)
419
+	{
420
+		if (
421
+			! in_array(
422
+				$form_config,
423
+				array(
424
+				FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
425
+				FormHandler::ADD_FORM_TAGS_ONLY,
426
+				FormHandler::ADD_FORM_SUBMIT_ONLY,
427
+				FormHandler::DO_NOT_SETUP_FORM,
428
+				),
429
+				true
430
+			)
431
+		) {
432
+			throw new DomainException(
433
+				sprintf(
434
+					esc_html__(
435
+						'"%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',
436
+						'event_espresso'
437
+					),
438
+					$form_config
439
+				)
440
+			);
441
+		}
442
+		$this->form_config = $form_config;
443
+	}
444
+
445
+
446
+	/**
447
+	 * called after the form is instantiated
448
+	 * and used for performing any logic that needs to occur early
449
+	 * before any of the other methods are called.
450
+	 * returns true if everything is ok to proceed,
451
+	 * and false if no further form logic should be implemented
452
+	 *
453
+	 * @return boolean
454
+	 */
455
+	public function initialize()
456
+	{
457
+		$this->form_has_errors = EE_Error::has_error(true);
458
+		return true;
459
+	}
460
+
461
+
462
+	/**
463
+	 * used for setting up css and js
464
+	 *
465
+	 * @return void
466
+	 * @throws LogicException
467
+	 * @throws EE_Error
468
+	 */
469
+	public function enqueueStylesAndScripts()
470
+	{
471
+		$this->form()->enqueue_js();
472
+	}
473
+
474
+
475
+	/**
476
+	 * creates and returns the actual form
477
+	 *
478
+	 * @return EE_Form_Section_Proper
479
+	 */
480
+	abstract public function generate();
481
+
482
+
483
+	/**
484
+	 * creates and returns an EE_Submit_Input labeled "Submit"
485
+	 *
486
+	 * @param string $text
487
+	 * @return EE_Submit_Input
488
+	 */
489
+	public function generateSubmitButton($text = '')
490
+	{
491
+		$text = ! empty($text) ? $text : $this->submitBtnText();
492
+		return new EE_Submit_Input(
493
+			array(
494
+				'html_name'             => 'ee-form-submit-' . $this->slug(),
495
+				'html_id'               => 'ee-form-submit-' . $this->slug(),
496
+				'html_class'            => 'ee-form-submit',
497
+				'html_label'            => '&nbsp;',
498
+				'other_html_attributes' => ' rel="' . $this->slug() . '"',
499
+				'default'               => $text,
500
+			)
501
+		);
502
+	}
503
+
504
+
505
+	/**
506
+	 * calls generateSubmitButton() and appends it onto the form along with a float clearing div
507
+	 *
508
+	 * @param string $text
509
+	 * @return void
510
+	 * @throws EE_Error
511
+	 */
512
+	public function appendSubmitButton($text = '')
513
+	{
514
+		if ($this->form->subsection_exists($this->slug() . '-submit-btn')) {
515
+			return;
516
+		}
517
+		$this->form->add_subsections(
518
+			array($this->slug() . '-submit-btn' => $this->generateSubmitButton($text)),
519
+			null,
520
+			false
521
+		);
522
+	}
523
+
524
+
525
+	/**
526
+	 * creates and returns an EE_Submit_Input labeled "Cancel"
527
+	 *
528
+	 * @param string $text
529
+	 * @return EE_Submit_Input
530
+	 */
531
+	public function generateCancelButton($text = '')
532
+	{
533
+		$cancel_button = new EE_Submit_Input(
534
+			array(
535
+				'html_name'             => 'ee-form-submit-' . $this->slug(), // YES! Same name as submit !!!
536
+				'html_id'               => 'ee-cancel-form-' . $this->slug(),
537
+				'html_class'            => 'ee-cancel-form',
538
+				'html_label'            => '&nbsp;',
539
+				'other_html_attributes' => ' rel="' . $this->slug() . '"',
540
+				'default'               => ! empty($text) ? $text : esc_html__('Cancel', 'event_espresso'),
541
+			)
542
+		);
543
+		$cancel_button->set_button_css_attributes(false);
544
+		return $cancel_button;
545
+	}
546
+
547
+
548
+	/**
549
+	 * appends a float clearing div onto end of form
550
+	 *
551
+	 * @return void
552
+	 * @throws EE_Error
553
+	 */
554
+	public function clearFormButtonFloats()
555
+	{
556
+		$this->form->add_subsections(
557
+			array(
558
+				'clear-submit-btn-float' => new EE_Form_Section_HTML(
559
+					EEH_HTML::div('', '', 'clear-float') . EEH_HTML::divx()
560
+				),
561
+			),
562
+			null,
563
+			false
564
+		);
565
+	}
566
+
567
+
568
+	/**
569
+	 * takes the generated form and displays it along with ony other non-form HTML that may be required
570
+	 * returns a string of HTML that can be directly echoed in a template
571
+	 *
572
+	 * @return string
573
+	 * @throws \InvalidArgumentException
574
+	 * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
575
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
576
+	 * @throws LogicException
577
+	 * @throws EE_Error
578
+	 */
579
+	public function display()
580
+	{
581
+		$form_html = apply_filters(
582
+			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form',
583
+			''
584
+		);
585
+		$form_config = $this->formConfig();
586
+		if (
587
+			$form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
588
+			|| $form_config === FormHandler::ADD_FORM_TAGS_ONLY
589
+		) {
590
+			$additional_props = $this->requiresMultipartEnctype()
591
+				? ' enctype="multipart/form-data"'
592
+				: '';
593
+			$form_html .= $this->form()->form_open(
594
+				$this->formAction(),
595
+				'POST',
596
+				$additional_props
597
+			);
598
+		}
599
+		$form_html .= $this->form(true)->get_html();
600
+		if (
601
+			$form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
602
+			|| $form_config === FormHandler::ADD_FORM_TAGS_ONLY
603
+		) {
604
+			$form_html .= $this->form()->form_close();
605
+		}
606
+		$form_html .= apply_filters(
607
+			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__after_form',
608
+			''
609
+		);
610
+		return $form_html;
611
+	}
612
+
613
+	/**
614
+	 * Determines if this form needs "enctype='multipart/form-data'" or not.
615
+	 * @since 4.9.80.p
616
+	 * @return bool
617
+	 * @throws EE_Error
618
+	 */
619
+	public function requiresMultipartEnctype()
620
+	{
621
+		foreach ($this->form()->inputs_in_subsections() as $input) {
622
+			if ($input instanceof EE_File_Input) {
623
+				return true;
624
+			}
625
+		}
626
+		return false;
627
+	}
628
+
629
+
630
+	/**
631
+	 * handles processing the form submission
632
+	 * returns true or false depending on whether the form was processed successfully or not
633
+	 *
634
+	 * @param array $submitted_form_data
635
+	 * @return array
636
+	 * @throws \InvalidArgumentException
637
+	 * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
638
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
639
+	 * @throws EE_Error
640
+	 * @throws LogicException
641
+	 * @throws InvalidFormSubmissionException
642
+	 */
643
+	public function process($submitted_form_data = array())
644
+	{
645
+		if (! $this->form()->was_submitted($submitted_form_data)) {
646
+			throw new InvalidFormSubmissionException($this->form_name);
647
+		}
648
+		$this->form(true)->receive_form_submission($submitted_form_data);
649
+		if (! $this->form()->is_valid()) {
650
+			throw new InvalidFormSubmissionException(
651
+				$this->form_name,
652
+				sprintf(
653
+					esc_html__(
654
+						'The "%1$s" form is invalid. Please correct the following errors and resubmit: %2$s %3$s',
655
+						'event_espresso'
656
+					),
657
+					$this->form_name,
658
+					'<br />',
659
+					implode('<br />', $this->form()->get_validation_errors_accumulated())
660
+				)
661
+			);
662
+		}
663
+		return apply_filters(
664
+			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__process__valid_data',
665
+			$this->form()->valid_data(),
666
+			$this
667
+		);
668
+	}
669 669
 }
Please login to merge, or discard this patch.