Completed
Branch models-cleanup/model-relations (db5ca7)
by
unknown
13:03 queued 08:35
created
sensitive_data_removal/EE_Sensitive_Data_Removal_Base.strategy.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,16 +11,16 @@
 block discarded – undo
11 11
  */
12 12
 abstract class EE_Sensitive_Data_Removal_Base extends EE_Form_Input_Strategy_Base
13 13
 {
14
-    /**
15
-     * Removes all the sensitive data from this normalized value.
16
-     * For example, should could 'mask' a credit card from
17
-     * '1234 1234 1234 1234' TO '**** **** **** 1234'.
18
-     * Or turn a ccv number from
19
-     * '123' to '***',
20
-     * or turn a password from
21
-     * 'CantHac7Th15' to '*************',
22
-     * or just leave htevalue as-is
23
-     * @return mixed
24
-     */
25
-    abstract public function remove_sensitive_data($normalized_value);
14
+	/**
15
+	 * Removes all the sensitive data from this normalized value.
16
+	 * For example, should could 'mask' a credit card from
17
+	 * '1234 1234 1234 1234' TO '**** **** **** 1234'.
18
+	 * Or turn a ccv number from
19
+	 * '123' to '***',
20
+	 * or turn a password from
21
+	 * 'CantHac7Th15' to '*************',
22
+	 * or just leave htevalue as-is
23
+	 * @return mixed
24
+	 */
25
+	abstract public function remove_sensitive_data($normalized_value);
26 26
 }
Please login to merge, or discard this patch.
sensitive_data_removal/EE_All_Sensitive_Data_Removal.strategy.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -11,23 +11,23 @@
 block discarded – undo
11 11
  */
12 12
 class EE_All_Sensitive_Data_Removal extends EE_Sensitive_Data_Removal_Base
13 13
 {
14
-    public function remove_sensitive_data($normalized_value)
15
-    {
16
-        switch (gettype($normalized_value)) {
17
-            case "boolean":
18
-                return false;
19
-            case "integer":
20
-            case "double":
21
-                return 0;
22
-            case "string":
23
-                return '';
24
-            case "array":
25
-                return array();
26
-            case "object":
27
-            case "resource":
28
-            case "NULL":
29
-            default:
30
-                return null;
31
-        }
32
-    }
14
+	public function remove_sensitive_data($normalized_value)
15
+	{
16
+		switch (gettype($normalized_value)) {
17
+			case "boolean":
18
+				return false;
19
+			case "integer":
20
+			case "double":
21
+				return 0;
22
+			case "string":
23
+				return '';
24
+			case "array":
25
+				return array();
26
+			case "object":
27
+			case "resource":
28
+			case "NULL":
29
+			default:
30
+				return null;
31
+		}
32
+	}
33 33
 }
Please login to merge, or discard this patch.
strategies/sensitive_data_removal/EE_No_Sensitive_Data_Removal.strategy.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@
 block discarded – undo
11 11
  */
12 12
 class EE_No_Sensitive_Data_Removal extends EE_Sensitive_Data_Removal_Base
13 13
 {
14
-    public function remove_sensitive_data($normalized_value)
15
-    {
16
-        return $normalized_value;
17
-    }
14
+	public function remove_sensitive_data($normalized_value)
15
+	{
16
+		return $normalized_value;
17
+	}
18 18
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/base/EE_Form_Section_HTML.form.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,30 +14,30 @@
 block discarded – undo
14 14
 class EE_Form_Section_HTML extends EE_Form_Section_Base
15 15
 {
16 16
 
17
-    protected $_html = '';
17
+	protected $_html = '';
18 18
 
19 19
 
20 20
 
21
-    /**
22
-     * @param string $html
23
-     * @param array $options_array
24
-     */
25
-    public function __construct($html = '', $options_array = array())
26
-    {
27
-        $this->_html = $html;
28
-        parent::__construct($options_array);
29
-    }
21
+	/**
22
+	 * @param string $html
23
+	 * @param array $options_array
24
+	 */
25
+	public function __construct($html = '', $options_array = array())
26
+	{
27
+		$this->_html = $html;
28
+		parent::__construct($options_array);
29
+	}
30 30
 
31 31
 
32 32
 
33
-    /**
34
-     * Returns the HTML
35
-     * @return string
36
-     */
37
-    public function get_html()
38
-    {
39
-        return $this->_html;
40
-    }
33
+	/**
34
+	 * Returns the HTML
35
+	 * @return string
36
+	 */
37
+	public function get_html()
38
+	{
39
+		return $this->_html;
40
+	}
41 41
 }
42 42
 
43 43
 // End of file EE_Form_Section_HTML.form.php
Please login to merge, or discard this patch.
libraries/form_sections/base/EE_Form_Section_HTML_From_Template.form.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@
 block discarded – undo
11 11
  */
12 12
 class EE_Form_Section_HTML_From_Template extends EE_Form_Section_HTML
13 13
 {
14
-    public function __construct($template_file, $args = array(), $options_array = array())
15
-    {
16
-        $html = EEH_Template::locate_template($template_file, $args);
14
+	public function __construct($template_file, $args = array(), $options_array = array())
15
+	{
16
+		$html = EEH_Template::locate_template($template_file, $args);
17 17
 
18 18
 //      echo " filepath:$template_file html $html";
19
-        parent::__construct($html, $options_array);
20
-    }
19
+		parent::__construct($html, $options_array);
20
+	}
21 21
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/base/EE_Form_Section_Validatable.form.php 1 patch
Indentation   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -21,150 +21,150 @@
 block discarded – undo
21 21
 abstract class EE_Form_Section_Validatable extends EE_Form_Section_Base
22 22
 {
23 23
 
24
-    /**
25
-     * Array of validation errors in this section. Does not contain validation errors in subsections, however.
26
-     * Those are stored individually on each subsection.
27
-     *
28
-     * @var EE_Validation_Error[]
29
-     */
30
-    protected $_validation_errors = array();
31
-
32
-
33
-
34
-    /**
35
-     * Errors on this form section. Note: EE_Form_Section_Proper
36
-     * has another function for getting all errors in this form section and subsections
37
-     * called get_validation_errors_accumulated
38
-     *
39
-     * @return EE_Validation_Error[]
40
-     */
41
-    public function get_validation_errors()
42
-    {
43
-        return $this->_validation_errors;
44
-    }
45
-
46
-
47
-
48
-    /**
49
-     * returns a comma-separated list of all the validation errors in it.
50
-     * If we want this to be customizable, we may decide to create a strategy for displaying it
51
-     *
52
-     * @return string
53
-     */
54
-    public function get_validation_error_string()
55
-    {
56
-        $validation_error_messages = array();
57
-        if ($this->get_validation_errors()) {
58
-            foreach ($this->get_validation_errors() as $validation_error) {
59
-                if ($validation_error instanceof EE_Validation_Error) {
60
-                    $validation_error_messages[] = $validation_error->getMessage();
61
-                }
62
-            }
63
-        }
64
-        return implode(", ", $validation_error_messages);
65
-    }
66
-
67
-
68
-
69
-    /**
70
-     * Performs validation on this form section (and subsections). Should be called after _normalize()
71
-     *
72
-     * @return boolean of whether or not the form section is valid
73
-     */
74
-    abstract protected function _validate();
75
-
76
-
77
-
78
-    /**
79
-     * Checks if this field has any validation errors
80
-     *
81
-     * @return boolean
82
-     */
83
-    public function is_valid()
84
-    {
85
-        if (count($this->_validation_errors)) {
86
-            return false;
87
-        } else {
88
-            return true;
89
-        }
90
-    }
91
-
92
-
93
-
94
-    /**
95
-     * Sanitizes input for this form section
96
-     *
97
-     * @param array $req_data is the full request data like $_POST
98
-     * @return boolean of whether a normalization error occurred
99
-     */
100
-    abstract protected function _normalize($req_data);
101
-
102
-
103
-
104
-    /**
105
-     * Creates a validation error from the arguments provided, and adds it to the form section's list.
106
-     * If such an EE_Validation_Error object is passed in as the first arg, simply sets this as its form section, and
107
-     * adds it to the list of validation errors of errors
108
-     *
109
-     * @param mixed     $message_or_object  internationalized string describing the validation error; or it could be a
110
-     *                                      proper EE_Validation_Error object
111
-     * @param string    $error_code         a short key which can be used to uniquely identify the error
112
-     * @param Exception $previous_exception if there was an exception that caused the error, that exception
113
-     * @return void
114
-     */
115
-    public function add_validation_error($message_or_object, $error_code = null, $previous_exception = null)
116
-    {
117
-        if ($message_or_object instanceof EE_Validation_Error) {
118
-            $validation_error = $message_or_object;
119
-            $validation_error->set_form_section($this);
120
-        } else {
121
-            $validation_error = new EE_Validation_Error($message_or_object, $error_code, $this, $previous_exception);
122
-        }
123
-        $this->_validation_errors[] = $validation_error;
124
-    }
125
-
126
-
127
-
128
-    /**
129
-     * When generating the JS for the jquery validation rules like<br>
130
-     * <code>$( "#myform" ).validate({
131
-     * rules: {
132
-     * password: "required",
133
-     * password_again: {
134
-     * equalTo: "#password"
135
-     * }
136
-     * }
137
-     * });</code>
138
-     * gets the sections like
139
-     * <br><code>password: "required",
140
-     * password_again: {
141
-     * equalTo: "#password"
142
-     * }</code>
143
-     * except we leave it as a PHP object, and leave wp_localize_script to
144
-     * turn it into a JSON object which can be used by the js
145
-     *
146
-     * @return array
147
-     */
148
-    abstract public function get_jquery_validation_rules();
149
-
150
-
151
-
152
-    /**
153
-     * Checks if this form section's data is present in the req data specified
154
-     *
155
-     * @param array $req_data usually $_POST, if null that's what's used
156
-     * @return boolean
157
-     */
158
-    abstract public function form_data_present_in($req_data = null);
159
-
160
-
161
-
162
-    /**
163
-     * Removes teh sensitive data from this form section (usually done after
164
-     * utilizing the data business function, but before saving it somewhere. Eg,
165
-     * may remove a password from the form after verifying it was correct)
166
-     *
167
-     * @return void
168
-     */
169
-    abstract public function clean_sensitive_data();
24
+	/**
25
+	 * Array of validation errors in this section. Does not contain validation errors in subsections, however.
26
+	 * Those are stored individually on each subsection.
27
+	 *
28
+	 * @var EE_Validation_Error[]
29
+	 */
30
+	protected $_validation_errors = array();
31
+
32
+
33
+
34
+	/**
35
+	 * Errors on this form section. Note: EE_Form_Section_Proper
36
+	 * has another function for getting all errors in this form section and subsections
37
+	 * called get_validation_errors_accumulated
38
+	 *
39
+	 * @return EE_Validation_Error[]
40
+	 */
41
+	public function get_validation_errors()
42
+	{
43
+		return $this->_validation_errors;
44
+	}
45
+
46
+
47
+
48
+	/**
49
+	 * returns a comma-separated list of all the validation errors in it.
50
+	 * If we want this to be customizable, we may decide to create a strategy for displaying it
51
+	 *
52
+	 * @return string
53
+	 */
54
+	public function get_validation_error_string()
55
+	{
56
+		$validation_error_messages = array();
57
+		if ($this->get_validation_errors()) {
58
+			foreach ($this->get_validation_errors() as $validation_error) {
59
+				if ($validation_error instanceof EE_Validation_Error) {
60
+					$validation_error_messages[] = $validation_error->getMessage();
61
+				}
62
+			}
63
+		}
64
+		return implode(", ", $validation_error_messages);
65
+	}
66
+
67
+
68
+
69
+	/**
70
+	 * Performs validation on this form section (and subsections). Should be called after _normalize()
71
+	 *
72
+	 * @return boolean of whether or not the form section is valid
73
+	 */
74
+	abstract protected function _validate();
75
+
76
+
77
+
78
+	/**
79
+	 * Checks if this field has any validation errors
80
+	 *
81
+	 * @return boolean
82
+	 */
83
+	public function is_valid()
84
+	{
85
+		if (count($this->_validation_errors)) {
86
+			return false;
87
+		} else {
88
+			return true;
89
+		}
90
+	}
91
+
92
+
93
+
94
+	/**
95
+	 * Sanitizes input for this form section
96
+	 *
97
+	 * @param array $req_data is the full request data like $_POST
98
+	 * @return boolean of whether a normalization error occurred
99
+	 */
100
+	abstract protected function _normalize($req_data);
101
+
102
+
103
+
104
+	/**
105
+	 * Creates a validation error from the arguments provided, and adds it to the form section's list.
106
+	 * If such an EE_Validation_Error object is passed in as the first arg, simply sets this as its form section, and
107
+	 * adds it to the list of validation errors of errors
108
+	 *
109
+	 * @param mixed     $message_or_object  internationalized string describing the validation error; or it could be a
110
+	 *                                      proper EE_Validation_Error object
111
+	 * @param string    $error_code         a short key which can be used to uniquely identify the error
112
+	 * @param Exception $previous_exception if there was an exception that caused the error, that exception
113
+	 * @return void
114
+	 */
115
+	public function add_validation_error($message_or_object, $error_code = null, $previous_exception = null)
116
+	{
117
+		if ($message_or_object instanceof EE_Validation_Error) {
118
+			$validation_error = $message_or_object;
119
+			$validation_error->set_form_section($this);
120
+		} else {
121
+			$validation_error = new EE_Validation_Error($message_or_object, $error_code, $this, $previous_exception);
122
+		}
123
+		$this->_validation_errors[] = $validation_error;
124
+	}
125
+
126
+
127
+
128
+	/**
129
+	 * When generating the JS for the jquery validation rules like<br>
130
+	 * <code>$( "#myform" ).validate({
131
+	 * rules: {
132
+	 * password: "required",
133
+	 * password_again: {
134
+	 * equalTo: "#password"
135
+	 * }
136
+	 * }
137
+	 * });</code>
138
+	 * gets the sections like
139
+	 * <br><code>password: "required",
140
+	 * password_again: {
141
+	 * equalTo: "#password"
142
+	 * }</code>
143
+	 * except we leave it as a PHP object, and leave wp_localize_script to
144
+	 * turn it into a JSON object which can be used by the js
145
+	 *
146
+	 * @return array
147
+	 */
148
+	abstract public function get_jquery_validation_rules();
149
+
150
+
151
+
152
+	/**
153
+	 * Checks if this form section's data is present in the req data specified
154
+	 *
155
+	 * @param array $req_data usually $_POST, if null that's what's used
156
+	 * @return boolean
157
+	 */
158
+	abstract public function form_data_present_in($req_data = null);
159
+
160
+
161
+
162
+	/**
163
+	 * Removes teh sensitive data from this form section (usually done after
164
+	 * utilizing the data business function, but before saving it somewhere. Eg,
165
+	 * may remove a password from the form after verifying it was correct)
166
+	 *
167
+	 * @return void
168
+	 */
169
+	abstract public function clean_sensitive_data();
170 170
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/payment_methods/EE_Billing_Info_Form.form.php 2 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -14,74 +14,74 @@
 block discarded – undo
14 14
 class EE_Billing_Info_Form extends EE_Form_Section_Proper
15 15
 {
16 16
 
17
-    /**
18
-     * The payment method this billing form is for
19
-     * @var EE_Payment_Method
20
-     */
21
-    protected $_pm_instance;
22
-
23
-
24
-
25
-    /**
26
-     *
27
-     * @param EE_Payment_Method $payment_method
28
-     * @param array $options_array @see EE_Form_Section_Proper::__construct()
29
-     */
30
-    public function __construct(EE_Payment_Method $payment_method, $options_array = array())
31
-    {
32
-        $this->_pm_instance = $payment_method;
33
-        $this->_layout_strategy = new EE_Div_Per_Section_Layout();
34
-        parent::__construct($options_array);
35
-    }
36
-
37
-
38
-
39
-    /**
40
-     * Sets the payment method for this billing form
41
-     * @param EE_Payment_Method $payment_method
42
-     * @return void
43
-     */
44
-    public function set_payment_method(EE_Payment_Method $payment_method)
45
-    {
46
-        $this->_pm_instance = $payment_method;
47
-    }
48
-
49
-
50
-
51
-    /**
52
-     * Returns the instance of the payment method this billing form is for
53
-     * @return EE_Payment_Method
54
-     */
55
-    public function payment_method()
56
-    {
57
-        return $this->_pm_instance;
58
-    }
59
-
60
-
61
-
62
-    /**
63
-     * payment_fields_autofilled_notice_html
64
-     * @return string
65
-     */
66
-    public function payment_fields_autofilled_notice_html()
67
-    {
68
-        return  new EE_Form_Section_HTML(
69
-            EEH_HTML::p(
70
-                apply_filters('FHEE__EE_Billing_Info_Form__payment_fields_autofilled_notice_html_text', __('Payment fields have been autofilled because you are in debug mode', 'event_espresso')),
71
-                '',
72
-                'important-notice'
73
-            )
74
-        );
75
-    }
76
-
77
-
78
-
79
-    /**
80
-     * @return string
81
-     */
82
-    public function html_class()
83
-    {
84
-        return ! empty($this->_html_class) ? $this->_html_class . ' ee-billing-form' : 'ee-billing-form';
85
-    }
17
+	/**
18
+	 * The payment method this billing form is for
19
+	 * @var EE_Payment_Method
20
+	 */
21
+	protected $_pm_instance;
22
+
23
+
24
+
25
+	/**
26
+	 *
27
+	 * @param EE_Payment_Method $payment_method
28
+	 * @param array $options_array @see EE_Form_Section_Proper::__construct()
29
+	 */
30
+	public function __construct(EE_Payment_Method $payment_method, $options_array = array())
31
+	{
32
+		$this->_pm_instance = $payment_method;
33
+		$this->_layout_strategy = new EE_Div_Per_Section_Layout();
34
+		parent::__construct($options_array);
35
+	}
36
+
37
+
38
+
39
+	/**
40
+	 * Sets the payment method for this billing form
41
+	 * @param EE_Payment_Method $payment_method
42
+	 * @return void
43
+	 */
44
+	public function set_payment_method(EE_Payment_Method $payment_method)
45
+	{
46
+		$this->_pm_instance = $payment_method;
47
+	}
48
+
49
+
50
+
51
+	/**
52
+	 * Returns the instance of the payment method this billing form is for
53
+	 * @return EE_Payment_Method
54
+	 */
55
+	public function payment_method()
56
+	{
57
+		return $this->_pm_instance;
58
+	}
59
+
60
+
61
+
62
+	/**
63
+	 * payment_fields_autofilled_notice_html
64
+	 * @return string
65
+	 */
66
+	public function payment_fields_autofilled_notice_html()
67
+	{
68
+		return  new EE_Form_Section_HTML(
69
+			EEH_HTML::p(
70
+				apply_filters('FHEE__EE_Billing_Info_Form__payment_fields_autofilled_notice_html_text', __('Payment fields have been autofilled because you are in debug mode', 'event_espresso')),
71
+				'',
72
+				'important-notice'
73
+			)
74
+		);
75
+	}
76
+
77
+
78
+
79
+	/**
80
+	 * @return string
81
+	 */
82
+	public function html_class()
83
+	{
84
+		return ! empty($this->_html_class) ? $this->_html_class . ' ee-billing-form' : 'ee-billing-form';
85
+	}
86 86
 }
87 87
 // End of file EE_Billing_Info_Form.form.php
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
      */
82 82
     public function html_class()
83 83
     {
84
-        return ! empty($this->_html_class) ? $this->_html_class . ' ee-billing-form' : 'ee-billing-form';
84
+        return ! empty($this->_html_class) ? $this->_html_class.' ee-billing-form' : 'ee-billing-form';
85 85
     }
86 86
 }
87 87
 // End of file EE_Billing_Info_Form.form.php
Please login to merge, or discard this patch.
libraries/form_sections/payment_methods/EE_Payment_Method_Form.form.php 2 patches
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -9,195 +9,195 @@
 block discarded – undo
9 9
 class EE_Payment_Method_Form extends EE_Model_Form_Section
10 10
 {
11 11
 
12
-    /**
13
-     * All the subsection inputs that correspond ot extra meta rows
14
-     * for this payment method
15
-     *
16
-     * @var EE_Form_Input_Base[]
17
-     */
18
-    protected $_extra_meta_inputs = array();
19
-
20
-    /**
21
-     * Because payment method form might DELAY part of construction, we want to remember
22
-     * what options were passed in
23
-     *
24
-     * @var array
25
-     */
26
-    protected $_options_array = array();
27
-
28
-    /**
29
-     * The payment method type for this form
30
-     *
31
-     * @var EE_PMT_Base
32
-     */
33
-    protected $_payment_method_type;
34
-
35
-
36
-
37
-    /**
38
-     * @param array      $options_array       {
39
-     * @type string      $extra_meta_inputs   should be EE_Form_Section_Validatable[] which
40
-     *                                        will be _subsections and will be saved as extra meta on the payment
41
-     *                                        method object;
42
-     * @type EE_PMT_Base $payment_method_type the payment method type this form is for
43
-     * @see EE_Model_Form_Section::__construct() for more
44
-     *                                        }
45
-     */
46
-    public function __construct($options_array = array())
47
-    {
48
-        $this->_model = EEM_Payment_Method::instance();
49
-        $this->_options_array = $options_array;
50
-        if (isset($options_array['payment_method_type'])) {
51
-            $this->_payment_method_type = $options_array['payment_method_type'];
52
-        }
53
-        $options_array = $this->_options_array;
54
-        if (isset($options_array['extra_meta_inputs'])) {
55
-            $this->_extra_meta_inputs = array_merge($this->_extra_meta_inputs, $options_array['extra_meta_inputs']);
56
-        }
57
-        if ($this->_extra_meta_inputs) {
58
-            $this->_subsections = array_merge($this->_subsections, $this->_extra_meta_inputs);
59
-        }
60
-        $this->_subsections['PMD_button_url'] = new EE_Admin_File_Uploader_Input(
61
-            array('html_label_text' => __('Button URL', 'event_espresso'))
62
-        );
63
-        $this->_subsections['PMD_scope'] = new EE_Checkbox_Multi_Input(
64
-            EEM_Payment_Method::instance()->scopes(),
65
-            array(
66
-                'html_label_text' => $this->_model->field_settings_for('PMD_scope')->get_nicename()
67
-                                     . EEH_Template::get_help_tab_link('payment_methods_overview'),
68
-            )
69
-        );
70
-        // setup the currency options
71
-        $this->_subsections['Currency'] = new EE_Select_Multi_Model_Input(
72
-            EEM_Currency::instance()->get_all_currencies_usable_by($this->_payment_method_type),
73
-            array(
74
-                'html_label_text' => __('Currencies Supported', 'event_espresso'),
75
-                'required'        => true,
76
-            )
77
-        );
78
-        $this->_subsections['PMD_order'] = new EE_Text_Input(array(
79
-            'html_label_text'        => __('Order', 'event_espresso'),
80
-            'html_help_text'         => __('Lowest numbers will be shown first', 'event_espresso'),
81
-            'normalization_strategy' => new EE_Int_Normalization(),
82
-            'validation_strategies'  => array(
83
-                new EE_Int_Validation_Strategy(),
84
-            ),
85
-            'default'                => 0,
86
-        ));
87
-        $this->_layout_strategy = new EE_Admin_Two_Column_Layout();
88
-        parent::__construct($options_array);
89
-        $debug_mode = isset($this->_subsections['PMD_debug_mode']) ? $this->_subsections['PMD_debug_mode'] : null;
90
-        if ($debug_mode instanceof EE_Form_Input_Base) {
91
-            $debug_mode->set_html_help_text(__(
92
-                'This payment method has a Sandbox Server (also known as Testing Server, Development Server, Quality Assurance Server, etc). While in debug mode and using this sandbox server, real payments will not be processed.',
93
-                'event_espresso'
94
-            ));
95
-        }
96
-    }
97
-
98
-
99
-
100
-    /**
101
-     * Finishes construction given the parent form section and this form section's name
102
-     *
103
-     * @param EE_Form_Section_Proper $parent_form_section
104
-     * @param string                 $name
105
-     * @throws EE_Error
106
-     */
107
-    public function _construct_finalize($parent_form_section, $name)
108
-    {
109
-        if (! $this->_payment_method_type instanceof EE_PMT_Base) {
110
-            throw new EE_Error(sprintf(__(
111
-                'Payment Method forms must have set their payment method type BEFORE calling _construct_finalize',
112
-                'event_espresso'
113
-            )));
114
-        }
115
-        // set the name of this form based on the payment method type
116
-        if (! $this->_name && ! $name) {
117
-            $name = str_replace(" ", "_", ucwords(str_replace("_", " ", ($this->_payment_method_type->system_name()))))
118
-                    . "_Settings_Form";
119
-        }
120
-        parent::_construct_finalize($parent_form_section, $name);
121
-    }
122
-
123
-
124
-
125
-    /**
126
-     * @param $payment_method_type
127
-     * @throws EE_Error
128
-     */
129
-    public function set_payment_method_type($payment_method_type)
130
-    {
131
-        if (! $payment_method_type instanceof EE_PMT_Base) {
132
-            throw new EE_Error(sprintf(__(
133
-                "Payment Method forms MUST set a payment method type by using _set_payment_method_type",
134
-                "event_espresso"
135
-            )));
136
-        }
137
-        $this->_payment_method_type = $payment_method_type;
138
-    }
139
-
140
-
141
-
142
-    /**
143
-     * extends the model form section's save method to also save the extra meta field values
144
-     *
145
-     * @return int ID of the payment method inserted, or true on update
146
-     */
147
-    public function save()
148
-    {
149
-        $parent_save_val = parent::save();
150
-        if ($this->_model_object && $this->_model_object->ID()) {
151
-            foreach ($this->_extra_meta_inputs as $input_name => $input) {
152
-                $this->_model_object->update_extra_meta($input_name, $input->normalized_value());
153
-            }
154
-        }
155
-        return $parent_save_val;
156
-    }
157
-
158
-
159
-
160
-    /**
161
-     * Overrides parent's populate_model_obj to also populate the extra meta fields
162
-     *
163
-     * @param EE_Base_Class $model_obj
164
-     */
165
-    public function populate_model_obj($model_obj)
166
-    {
167
-        $model_obj = $this->_model->ensure_is_obj($model_obj);
168
-        parent::populate_model_obj($model_obj);
169
-        $extra_meta = $model_obj->all_extra_meta_array();
170
-        foreach ($this->_extra_meta_inputs as $input_name => $extra_meta_input) {
171
-            if (isset($extra_meta[ $input_name ])) {
172
-                $extra_meta_input->set_default($extra_meta[ $input_name ]);
173
-            }
174
-        }
175
-    }
176
-
177
-
178
-
179
-    /**
180
-     * gets the default name of this form section if none is specified
181
-     *
182
-     * @return string
183
-     */
184
-    protected function _set_default_name_if_empty()
185
-    {
186
-        if (! $this->_name) {
187
-            $default_name = str_replace("EEM_", "", get_class($this->_model)) . "_Model_Form";
188
-            $this->_name = $default_name;
189
-        }
190
-    }
191
-
192
-
193
-
194
-    /**
195
-     * Gets all the extra meta inputs in this form
196
-     *
197
-     * @return EE_Form_Input_Base[]
198
-     */
199
-    public function extra_meta_inputs()
200
-    {
201
-        return $this->_extra_meta_inputs;
202
-    }
12
+	/**
13
+	 * All the subsection inputs that correspond ot extra meta rows
14
+	 * for this payment method
15
+	 *
16
+	 * @var EE_Form_Input_Base[]
17
+	 */
18
+	protected $_extra_meta_inputs = array();
19
+
20
+	/**
21
+	 * Because payment method form might DELAY part of construction, we want to remember
22
+	 * what options were passed in
23
+	 *
24
+	 * @var array
25
+	 */
26
+	protected $_options_array = array();
27
+
28
+	/**
29
+	 * The payment method type for this form
30
+	 *
31
+	 * @var EE_PMT_Base
32
+	 */
33
+	protected $_payment_method_type;
34
+
35
+
36
+
37
+	/**
38
+	 * @param array      $options_array       {
39
+	 * @type string      $extra_meta_inputs   should be EE_Form_Section_Validatable[] which
40
+	 *                                        will be _subsections and will be saved as extra meta on the payment
41
+	 *                                        method object;
42
+	 * @type EE_PMT_Base $payment_method_type the payment method type this form is for
43
+	 * @see EE_Model_Form_Section::__construct() for more
44
+	 *                                        }
45
+	 */
46
+	public function __construct($options_array = array())
47
+	{
48
+		$this->_model = EEM_Payment_Method::instance();
49
+		$this->_options_array = $options_array;
50
+		if (isset($options_array['payment_method_type'])) {
51
+			$this->_payment_method_type = $options_array['payment_method_type'];
52
+		}
53
+		$options_array = $this->_options_array;
54
+		if (isset($options_array['extra_meta_inputs'])) {
55
+			$this->_extra_meta_inputs = array_merge($this->_extra_meta_inputs, $options_array['extra_meta_inputs']);
56
+		}
57
+		if ($this->_extra_meta_inputs) {
58
+			$this->_subsections = array_merge($this->_subsections, $this->_extra_meta_inputs);
59
+		}
60
+		$this->_subsections['PMD_button_url'] = new EE_Admin_File_Uploader_Input(
61
+			array('html_label_text' => __('Button URL', 'event_espresso'))
62
+		);
63
+		$this->_subsections['PMD_scope'] = new EE_Checkbox_Multi_Input(
64
+			EEM_Payment_Method::instance()->scopes(),
65
+			array(
66
+				'html_label_text' => $this->_model->field_settings_for('PMD_scope')->get_nicename()
67
+									 . EEH_Template::get_help_tab_link('payment_methods_overview'),
68
+			)
69
+		);
70
+		// setup the currency options
71
+		$this->_subsections['Currency'] = new EE_Select_Multi_Model_Input(
72
+			EEM_Currency::instance()->get_all_currencies_usable_by($this->_payment_method_type),
73
+			array(
74
+				'html_label_text' => __('Currencies Supported', 'event_espresso'),
75
+				'required'        => true,
76
+			)
77
+		);
78
+		$this->_subsections['PMD_order'] = new EE_Text_Input(array(
79
+			'html_label_text'        => __('Order', 'event_espresso'),
80
+			'html_help_text'         => __('Lowest numbers will be shown first', 'event_espresso'),
81
+			'normalization_strategy' => new EE_Int_Normalization(),
82
+			'validation_strategies'  => array(
83
+				new EE_Int_Validation_Strategy(),
84
+			),
85
+			'default'                => 0,
86
+		));
87
+		$this->_layout_strategy = new EE_Admin_Two_Column_Layout();
88
+		parent::__construct($options_array);
89
+		$debug_mode = isset($this->_subsections['PMD_debug_mode']) ? $this->_subsections['PMD_debug_mode'] : null;
90
+		if ($debug_mode instanceof EE_Form_Input_Base) {
91
+			$debug_mode->set_html_help_text(__(
92
+				'This payment method has a Sandbox Server (also known as Testing Server, Development Server, Quality Assurance Server, etc). While in debug mode and using this sandbox server, real payments will not be processed.',
93
+				'event_espresso'
94
+			));
95
+		}
96
+	}
97
+
98
+
99
+
100
+	/**
101
+	 * Finishes construction given the parent form section and this form section's name
102
+	 *
103
+	 * @param EE_Form_Section_Proper $parent_form_section
104
+	 * @param string                 $name
105
+	 * @throws EE_Error
106
+	 */
107
+	public function _construct_finalize($parent_form_section, $name)
108
+	{
109
+		if (! $this->_payment_method_type instanceof EE_PMT_Base) {
110
+			throw new EE_Error(sprintf(__(
111
+				'Payment Method forms must have set their payment method type BEFORE calling _construct_finalize',
112
+				'event_espresso'
113
+			)));
114
+		}
115
+		// set the name of this form based on the payment method type
116
+		if (! $this->_name && ! $name) {
117
+			$name = str_replace(" ", "_", ucwords(str_replace("_", " ", ($this->_payment_method_type->system_name()))))
118
+					. "_Settings_Form";
119
+		}
120
+		parent::_construct_finalize($parent_form_section, $name);
121
+	}
122
+
123
+
124
+
125
+	/**
126
+	 * @param $payment_method_type
127
+	 * @throws EE_Error
128
+	 */
129
+	public function set_payment_method_type($payment_method_type)
130
+	{
131
+		if (! $payment_method_type instanceof EE_PMT_Base) {
132
+			throw new EE_Error(sprintf(__(
133
+				"Payment Method forms MUST set a payment method type by using _set_payment_method_type",
134
+				"event_espresso"
135
+			)));
136
+		}
137
+		$this->_payment_method_type = $payment_method_type;
138
+	}
139
+
140
+
141
+
142
+	/**
143
+	 * extends the model form section's save method to also save the extra meta field values
144
+	 *
145
+	 * @return int ID of the payment method inserted, or true on update
146
+	 */
147
+	public function save()
148
+	{
149
+		$parent_save_val = parent::save();
150
+		if ($this->_model_object && $this->_model_object->ID()) {
151
+			foreach ($this->_extra_meta_inputs as $input_name => $input) {
152
+				$this->_model_object->update_extra_meta($input_name, $input->normalized_value());
153
+			}
154
+		}
155
+		return $parent_save_val;
156
+	}
157
+
158
+
159
+
160
+	/**
161
+	 * Overrides parent's populate_model_obj to also populate the extra meta fields
162
+	 *
163
+	 * @param EE_Base_Class $model_obj
164
+	 */
165
+	public function populate_model_obj($model_obj)
166
+	{
167
+		$model_obj = $this->_model->ensure_is_obj($model_obj);
168
+		parent::populate_model_obj($model_obj);
169
+		$extra_meta = $model_obj->all_extra_meta_array();
170
+		foreach ($this->_extra_meta_inputs as $input_name => $extra_meta_input) {
171
+			if (isset($extra_meta[ $input_name ])) {
172
+				$extra_meta_input->set_default($extra_meta[ $input_name ]);
173
+			}
174
+		}
175
+	}
176
+
177
+
178
+
179
+	/**
180
+	 * gets the default name of this form section if none is specified
181
+	 *
182
+	 * @return string
183
+	 */
184
+	protected function _set_default_name_if_empty()
185
+	{
186
+		if (! $this->_name) {
187
+			$default_name = str_replace("EEM_", "", get_class($this->_model)) . "_Model_Form";
188
+			$this->_name = $default_name;
189
+		}
190
+	}
191
+
192
+
193
+
194
+	/**
195
+	 * Gets all the extra meta inputs in this form
196
+	 *
197
+	 * @return EE_Form_Input_Base[]
198
+	 */
199
+	public function extra_meta_inputs()
200
+	{
201
+		return $this->_extra_meta_inputs;
202
+	}
203 203
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public function _construct_finalize($parent_form_section, $name)
108 108
     {
109
-        if (! $this->_payment_method_type instanceof EE_PMT_Base) {
109
+        if ( ! $this->_payment_method_type instanceof EE_PMT_Base) {
110 110
             throw new EE_Error(sprintf(__(
111 111
                 'Payment Method forms must have set their payment method type BEFORE calling _construct_finalize',
112 112
                 'event_espresso'
113 113
             )));
114 114
         }
115 115
         // set the name of this form based on the payment method type
116
-        if (! $this->_name && ! $name) {
116
+        if ( ! $this->_name && ! $name) {
117 117
             $name = str_replace(" ", "_", ucwords(str_replace("_", " ", ($this->_payment_method_type->system_name()))))
118 118
                     . "_Settings_Form";
119 119
         }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function set_payment_method_type($payment_method_type)
130 130
     {
131
-        if (! $payment_method_type instanceof EE_PMT_Base) {
131
+        if ( ! $payment_method_type instanceof EE_PMT_Base) {
132 132
             throw new EE_Error(sprintf(__(
133 133
                 "Payment Method forms MUST set a payment method type by using _set_payment_method_type",
134 134
                 "event_espresso"
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
         parent::populate_model_obj($model_obj);
169 169
         $extra_meta = $model_obj->all_extra_meta_array();
170 170
         foreach ($this->_extra_meta_inputs as $input_name => $extra_meta_input) {
171
-            if (isset($extra_meta[ $input_name ])) {
172
-                $extra_meta_input->set_default($extra_meta[ $input_name ]);
171
+            if (isset($extra_meta[$input_name])) {
172
+                $extra_meta_input->set_default($extra_meta[$input_name]);
173 173
             }
174 174
         }
175 175
     }
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
      */
184 184
     protected function _set_default_name_if_empty()
185 185
     {
186
-        if (! $this->_name) {
187
-            $default_name = str_replace("EEM_", "", get_class($this->_model)) . "_Model_Form";
186
+        if ( ! $this->_name) {
187
+            $default_name = str_replace("EEM_", "", get_class($this->_model))."_Model_Form";
188 188
             $this->_name = $default_name;
189 189
         }
190 190
     }
Please login to merge, or discard this patch.
core/libraries/form_sections/helpers/EE_Validation_Error.error.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -2,47 +2,47 @@
 block discarded – undo
2 2
 
3 3
 class EE_Validation_Error extends Exception
4 4
 {
5
-    /**
6
-     * Form Section from which this error originated.
7
-     * @var EE_Form_Section
8
-     */
9
-    protected $_form_section;
10
-    /**
11
-     * a short string for uniquely identifying the error, which isn't internationalized and
12
-     * machines can use to identify the error
13
-     * @var string
14
-     */
15
-    protected $_string_code;
5
+	/**
6
+	 * Form Section from which this error originated.
7
+	 * @var EE_Form_Section
8
+	 */
9
+	protected $_form_section;
10
+	/**
11
+	 * a short string for uniquely identifying the error, which isn't internationalized and
12
+	 * machines can use to identify the error
13
+	 * @var string
14
+	 */
15
+	protected $_string_code;
16 16
 
17
-    /**
18
-     * When creating a validation error, we need to know which field the error relates to.
19
-     * @param string $message message you want to display about this error
20
-     * @param string $string_code a code for uniquely identifying the exception
21
-     * @param EE_Form_Section_Validatable $form_section
22
-     * @param Exception $previous if there was an exception that caused this exception
23
-     */
24
-    public function __construct($message = null, $string_code = null, $form_section = null, $previous = null)
25
-    {
26
-        $this->_form_section = $form_section;
27
-        $this->_string_code = $string_code;
28
-        parent::__construct($message, 500, $previous);
29
-    }
17
+	/**
18
+	 * When creating a validation error, we need to know which field the error relates to.
19
+	 * @param string $message message you want to display about this error
20
+	 * @param string $string_code a code for uniquely identifying the exception
21
+	 * @param EE_Form_Section_Validatable $form_section
22
+	 * @param Exception $previous if there was an exception that caused this exception
23
+	 */
24
+	public function __construct($message = null, $string_code = null, $form_section = null, $previous = null)
25
+	{
26
+		$this->_form_section = $form_section;
27
+		$this->_string_code = $string_code;
28
+		parent::__construct($message, 500, $previous);
29
+	}
30 30
 
31
-    /**
32
-     * returns teh form section which caused the error.
33
-     * @return EE_Form_Section_Validatable
34
-     */
35
-    public function get_form_section()
36
-    {
37
-        return $this->_form_section;
38
-    }
39
-    /**
40
-     * Sets teh form seciton of the error, in case it wasnt set previously
41
-     * @param EE_Form_Section_Validatable $form_section
42
-     * @return void
43
-     */
44
-    public function set_form_section($form_section)
45
-    {
46
-        $this->_form_section = $form_section;
47
-    }
31
+	/**
32
+	 * returns teh form section which caused the error.
33
+	 * @return EE_Form_Section_Validatable
34
+	 */
35
+	public function get_form_section()
36
+	{
37
+		return $this->_form_section;
38
+	}
39
+	/**
40
+	 * Sets teh form seciton of the error, in case it wasnt set previously
41
+	 * @param EE_Form_Section_Validatable $form_section
42
+	 * @return void
43
+	 */
44
+	public function set_form_section($form_section)
45
+	{
46
+		$this->_form_section = $form_section;
47
+	}
48 48
 }
Please login to merge, or discard this patch.