@@ -14,30 +14,30 @@ |
||
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 |
@@ -11,11 +11,11 @@ |
||
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 | } |
@@ -21,150 +21,150 @@ |
||
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 | } |
@@ -14,74 +14,74 @@ |
||
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 |
@@ -81,7 +81,7 @@ |
||
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 |
@@ -2,47 +2,47 @@ |
||
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 | } |
@@ -1,60 +1,60 @@ |
||
1 | 1 | <?php |
2 | 2 | class EE_Sample_Form extends EE_Form_Section_Proper |
3 | 3 | { |
4 | - public function __construct() |
|
5 | - { |
|
6 | - $this->_subsections = array( |
|
7 | - 'h1'=>new EE_Form_Section_HTML('hello wordl'), |
|
8 | - 'name'=>new EE_Text_Input(array('required'=>true,'default'=>'your name here')), |
|
9 | - 'email'=>new EE_Email_Input(array('required'=>false)), |
|
10 | - 'shirt_size'=>new EE_Select_Input(array(''=>'Please select...', 's'=> __("Small", "event_espresso"),'m'=> __("Medium", "event_espresso"),'l'=> __("Large", "event_espresso")), array('required'=>true,'default'=>'s')), |
|
11 | - 'month_normal'=>new EE_Month_Input(), |
|
12 | - 'month_leading_zero'=>new EE_Month_Input(true), |
|
13 | - 'year_2'=>new EE_Year_Input(false, 1, 1), |
|
14 | - 'year_4'=>new EE_Year_Input(true, 0, 10, array('default'=>'2017')), |
|
15 | - 'yes_no'=>new EE_Yes_No_Input(array('html_label_text'=> __("Yes or No", "event_espresso"))), |
|
16 | - 'credit_card'=>new EE_Credit_Card_Input(), |
|
17 | - 'image_1'=>new EE_Admin_File_Uploader_Input(), |
|
18 | - 'image_2'=>new EE_Admin_File_Uploader_Input(), |
|
19 | - 'skillz'=>new EE_Checkbox_Multi_Input(array('php'=>'PHP','mysql'=>'MYSQL'), array('default'=>array('php'))), |
|
20 | - 'float'=>new EE_Float_Input(), |
|
21 | - 'essay'=>new EE_Text_Area_Input(), |
|
22 | - 'amenities'=>new EE_Select_Multiple_Input( |
|
23 | - array( |
|
24 | - 'hottub'=>'Hot Tub', |
|
25 | - 'balcony'=>"Balcony", |
|
26 | - 'skylight'=>'SkyLight', |
|
27 | - 'no_axe'=>'No Axe Murderers' |
|
28 | - ), |
|
29 | - array( |
|
30 | - 'default'=>array( |
|
31 | - 'hottub', |
|
32 | - 'no_axe' ), |
|
33 | - ) |
|
34 | - ), |
|
35 | - 'payment_methods'=>new EE_Select_Multi_Model_Input(EEM_Payment_Method::instance()->get_all()), |
|
36 | - ); |
|
37 | - $this->_layout_strategy = new EE_Div_Per_Section_Layout(); |
|
38 | - parent::__construct(); |
|
39 | - } |
|
4 | + public function __construct() |
|
5 | + { |
|
6 | + $this->_subsections = array( |
|
7 | + 'h1'=>new EE_Form_Section_HTML('hello wordl'), |
|
8 | + 'name'=>new EE_Text_Input(array('required'=>true,'default'=>'your name here')), |
|
9 | + 'email'=>new EE_Email_Input(array('required'=>false)), |
|
10 | + 'shirt_size'=>new EE_Select_Input(array(''=>'Please select...', 's'=> __("Small", "event_espresso"),'m'=> __("Medium", "event_espresso"),'l'=> __("Large", "event_espresso")), array('required'=>true,'default'=>'s')), |
|
11 | + 'month_normal'=>new EE_Month_Input(), |
|
12 | + 'month_leading_zero'=>new EE_Month_Input(true), |
|
13 | + 'year_2'=>new EE_Year_Input(false, 1, 1), |
|
14 | + 'year_4'=>new EE_Year_Input(true, 0, 10, array('default'=>'2017')), |
|
15 | + 'yes_no'=>new EE_Yes_No_Input(array('html_label_text'=> __("Yes or No", "event_espresso"))), |
|
16 | + 'credit_card'=>new EE_Credit_Card_Input(), |
|
17 | + 'image_1'=>new EE_Admin_File_Uploader_Input(), |
|
18 | + 'image_2'=>new EE_Admin_File_Uploader_Input(), |
|
19 | + 'skillz'=>new EE_Checkbox_Multi_Input(array('php'=>'PHP','mysql'=>'MYSQL'), array('default'=>array('php'))), |
|
20 | + 'float'=>new EE_Float_Input(), |
|
21 | + 'essay'=>new EE_Text_Area_Input(), |
|
22 | + 'amenities'=>new EE_Select_Multiple_Input( |
|
23 | + array( |
|
24 | + 'hottub'=>'Hot Tub', |
|
25 | + 'balcony'=>"Balcony", |
|
26 | + 'skylight'=>'SkyLight', |
|
27 | + 'no_axe'=>'No Axe Murderers' |
|
28 | + ), |
|
29 | + array( |
|
30 | + 'default'=>array( |
|
31 | + 'hottub', |
|
32 | + 'no_axe' ), |
|
33 | + ) |
|
34 | + ), |
|
35 | + 'payment_methods'=>new EE_Select_Multi_Model_Input(EEM_Payment_Method::instance()->get_all()), |
|
36 | + ); |
|
37 | + $this->_layout_strategy = new EE_Div_Per_Section_Layout(); |
|
38 | + parent::__construct(); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Extra validation for the 'name' input. |
|
43 | - * @param EE_Text_Input $form_input |
|
44 | - */ |
|
45 | - public function _validate_name($form_input) |
|
46 | - { |
|
47 | - if ($form_input->raw_value() != 'Mike') { |
|
48 | - $form_input->add_validation_error(__("You are not mike. You must be brent or darren. Thats ok, I guess", 'event_espresso'), 'not-mike'); |
|
49 | - } |
|
50 | - } |
|
41 | + /** |
|
42 | + * Extra validation for the 'name' input. |
|
43 | + * @param EE_Text_Input $form_input |
|
44 | + */ |
|
45 | + public function _validate_name($form_input) |
|
46 | + { |
|
47 | + if ($form_input->raw_value() != 'Mike') { |
|
48 | + $form_input->add_validation_error(__("You are not mike. You must be brent or darren. Thats ok, I guess", 'event_espresso'), 'not-mike'); |
|
49 | + } |
|
50 | + } |
|
51 | 51 | |
52 | - public function _validate() |
|
53 | - { |
|
54 | - parent::_validate(); |
|
55 | - if ($this->_subsections['shirt_size']->normalized_value() =='s' |
|
56 | - && $this->_subsections['year_4']->normalized_value() < 2010) { |
|
57 | - $this->add_validation_error(__("If you want a small shirt, you should be born after 2010. Otherwise theyre just too big", 'event_espresso'), 'too-old'); |
|
58 | - } |
|
59 | - } |
|
52 | + public function _validate() |
|
53 | + { |
|
54 | + parent::_validate(); |
|
55 | + if ($this->_subsections['shirt_size']->normalized_value() =='s' |
|
56 | + && $this->_subsections['year_4']->normalized_value() < 2010) { |
|
57 | + $this->add_validation_error(__("If you want a small shirt, you should be born after 2010. Otherwise theyre just too big", 'event_espresso'), 'too-old'); |
|
58 | + } |
|
59 | + } |
|
60 | 60 | } |
@@ -5,9 +5,9 @@ discard block |
||
5 | 5 | { |
6 | 6 | $this->_subsections = array( |
7 | 7 | 'h1'=>new EE_Form_Section_HTML('hello wordl'), |
8 | - 'name'=>new EE_Text_Input(array('required'=>true,'default'=>'your name here')), |
|
8 | + 'name'=>new EE_Text_Input(array('required'=>true, 'default'=>'your name here')), |
|
9 | 9 | 'email'=>new EE_Email_Input(array('required'=>false)), |
10 | - 'shirt_size'=>new EE_Select_Input(array(''=>'Please select...', 's'=> __("Small", "event_espresso"),'m'=> __("Medium", "event_espresso"),'l'=> __("Large", "event_espresso")), array('required'=>true,'default'=>'s')), |
|
10 | + 'shirt_size'=>new EE_Select_Input(array(''=>'Please select...', 's'=> __("Small", "event_espresso"), 'm'=> __("Medium", "event_espresso"), 'l'=> __("Large", "event_espresso")), array('required'=>true, 'default'=>'s')), |
|
11 | 11 | 'month_normal'=>new EE_Month_Input(), |
12 | 12 | 'month_leading_zero'=>new EE_Month_Input(true), |
13 | 13 | 'year_2'=>new EE_Year_Input(false, 1, 1), |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | 'credit_card'=>new EE_Credit_Card_Input(), |
17 | 17 | 'image_1'=>new EE_Admin_File_Uploader_Input(), |
18 | 18 | 'image_2'=>new EE_Admin_File_Uploader_Input(), |
19 | - 'skillz'=>new EE_Checkbox_Multi_Input(array('php'=>'PHP','mysql'=>'MYSQL'), array('default'=>array('php'))), |
|
19 | + 'skillz'=>new EE_Checkbox_Multi_Input(array('php'=>'PHP', 'mysql'=>'MYSQL'), array('default'=>array('php'))), |
|
20 | 20 | 'float'=>new EE_Float_Input(), |
21 | 21 | 'essay'=>new EE_Text_Area_Input(), |
22 | 22 | 'amenities'=>new EE_Select_Multiple_Input( |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public function _validate() |
53 | 53 | { |
54 | 54 | parent::_validate(); |
55 | - if ($this->_subsections['shirt_size']->normalized_value() =='s' |
|
55 | + if ($this->_subsections['shirt_size']->normalized_value() == 's' |
|
56 | 56 | && $this->_subsections['year_4']->normalized_value() < 2010) { |
57 | 57 | $this->add_validation_error(__("If you want a small shirt, you should be born after 2010. Otherwise theyre just too big", 'event_espresso'), 'too-old'); |
58 | 58 | } |
@@ -15,117 +15,117 @@ |
||
15 | 15 | abstract class EE_Offsite_Gateway extends EE_Gateway |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * whether or not the gateway uses an IPN |
|
20 | - * that is sent in a separate request than the returning registrant. |
|
21 | - * if false, then we need to process the payment results manually |
|
22 | - * as soon as the registrant returns from the off-site gateway |
|
23 | - * |
|
24 | - * @type bool |
|
25 | - */ |
|
26 | - protected $_uses_separate_IPN_request = false; |
|
18 | + /** |
|
19 | + * whether or not the gateway uses an IPN |
|
20 | + * that is sent in a separate request than the returning registrant. |
|
21 | + * if false, then we need to process the payment results manually |
|
22 | + * as soon as the registrant returns from the off-site gateway |
|
23 | + * |
|
24 | + * @type bool |
|
25 | + */ |
|
26 | + protected $_uses_separate_IPN_request = false; |
|
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * @return EE_Offsite_Gateway |
|
31 | - */ |
|
32 | - public function __construct() |
|
33 | - { |
|
34 | - $this->_supports_receiving_refunds = true; |
|
35 | - parent::__construct(); |
|
36 | - } |
|
29 | + /** |
|
30 | + * @return EE_Offsite_Gateway |
|
31 | + */ |
|
32 | + public function __construct() |
|
33 | + { |
|
34 | + $this->_supports_receiving_refunds = true; |
|
35 | + parent::__construct(); |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * Adds information into the payment object's redirect_url and redirect_args so |
|
41 | - * client code can use that payment to know where (and with what information) |
|
42 | - * to redirect the user to in order to make the payment on the offsite gateway's website. |
|
43 | - * Saving the payment from within this method is unnecessary, |
|
44 | - * as it is the responsibility of client code to save it. |
|
45 | - * |
|
46 | - * @param EE_Payment $payment to process |
|
47 | - * @param array $billing_info |
|
48 | - * @param string $return_url URL to send the user to after a successful payment on the payment provider's |
|
49 | - * website |
|
50 | - * @param string $notify_url URL to send the instant payment notification |
|
51 | - * @param string $cancel_url URL to send the user to after a cancelled payment attempt on teh payment |
|
52 | - * provider's website |
|
53 | - * @return EE_Payment |
|
54 | - */ |
|
55 | - abstract public function set_redirection_info( |
|
56 | - $payment, |
|
57 | - $billing_info = array(), |
|
58 | - $return_url = null, |
|
59 | - $notify_url = null, |
|
60 | - $cancel_url = null |
|
61 | - ); |
|
39 | + /** |
|
40 | + * Adds information into the payment object's redirect_url and redirect_args so |
|
41 | + * client code can use that payment to know where (and with what information) |
|
42 | + * to redirect the user to in order to make the payment on the offsite gateway's website. |
|
43 | + * Saving the payment from within this method is unnecessary, |
|
44 | + * as it is the responsibility of client code to save it. |
|
45 | + * |
|
46 | + * @param EE_Payment $payment to process |
|
47 | + * @param array $billing_info |
|
48 | + * @param string $return_url URL to send the user to after a successful payment on the payment provider's |
|
49 | + * website |
|
50 | + * @param string $notify_url URL to send the instant payment notification |
|
51 | + * @param string $cancel_url URL to send the user to after a cancelled payment attempt on teh payment |
|
52 | + * provider's website |
|
53 | + * @return EE_Payment |
|
54 | + */ |
|
55 | + abstract public function set_redirection_info( |
|
56 | + $payment, |
|
57 | + $billing_info = array(), |
|
58 | + $return_url = null, |
|
59 | + $notify_url = null, |
|
60 | + $cancel_url = null |
|
61 | + ); |
|
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * Often used for IPNs. But applies the info in $update_info to the payment. |
|
66 | - * What is $update_info? Often the contents of $_REQUEST, but not necessarily. Whatever |
|
67 | - * the payment method passes in. Saving the payment from within this method is unnecessary, |
|
68 | - * as it is the responsibility of client code to save it. |
|
69 | - * |
|
70 | - * @param array $update_info of whatever |
|
71 | - * @param EEI_Transaction $transaction |
|
72 | - * @return EEI_Payment updated |
|
73 | - */ |
|
74 | - abstract public function handle_payment_update($update_info, $transaction); |
|
64 | + /** |
|
65 | + * Often used for IPNs. But applies the info in $update_info to the payment. |
|
66 | + * What is $update_info? Often the contents of $_REQUEST, but not necessarily. Whatever |
|
67 | + * the payment method passes in. Saving the payment from within this method is unnecessary, |
|
68 | + * as it is the responsibility of client code to save it. |
|
69 | + * |
|
70 | + * @param array $update_info of whatever |
|
71 | + * @param EEI_Transaction $transaction |
|
72 | + * @return EEI_Payment updated |
|
73 | + */ |
|
74 | + abstract public function handle_payment_update($update_info, $transaction); |
|
75 | 75 | |
76 | 76 | |
77 | - /** |
|
78 | - * uses_separate_IPN_request |
|
79 | - * |
|
80 | - * return true or false for whether or not the gateway uses an IPN |
|
81 | - * that is sent in a separate request than the returning registrant. |
|
82 | - * if false, then we need to process the payment results manually |
|
83 | - * as soon as the registrant returns from the off-site gateway |
|
84 | - * |
|
85 | - * @deprecated since version 4.8.39.rc.001 please use handle_IPN_in_this_request() instead |
|
86 | - * |
|
87 | - * @return bool |
|
88 | - */ |
|
89 | - public function uses_separate_IPN_request() |
|
90 | - { |
|
91 | - return $this->_uses_separate_IPN_request; |
|
92 | - } |
|
77 | + /** |
|
78 | + * uses_separate_IPN_request |
|
79 | + * |
|
80 | + * return true or false for whether or not the gateway uses an IPN |
|
81 | + * that is sent in a separate request than the returning registrant. |
|
82 | + * if false, then we need to process the payment results manually |
|
83 | + * as soon as the registrant returns from the off-site gateway |
|
84 | + * |
|
85 | + * @deprecated since version 4.8.39.rc.001 please use handle_IPN_in_this_request() instead |
|
86 | + * |
|
87 | + * @return bool |
|
88 | + */ |
|
89 | + public function uses_separate_IPN_request() |
|
90 | + { |
|
91 | + return $this->_uses_separate_IPN_request; |
|
92 | + } |
|
93 | 93 | |
94 | 94 | |
95 | - /** |
|
96 | - * set_uses_separate_IPN_request |
|
97 | - * |
|
98 | - * @access protected |
|
99 | - * @param boolean $uses_separate_IPN_request |
|
100 | - */ |
|
101 | - protected function set_uses_separate_IPN_request($uses_separate_IPN_request) |
|
102 | - { |
|
103 | - $this->_uses_separate_IPN_request = filter_var($uses_separate_IPN_request, FILTER_VALIDATE_BOOLEAN); |
|
104 | - } |
|
95 | + /** |
|
96 | + * set_uses_separate_IPN_request |
|
97 | + * |
|
98 | + * @access protected |
|
99 | + * @param boolean $uses_separate_IPN_request |
|
100 | + */ |
|
101 | + protected function set_uses_separate_IPN_request($uses_separate_IPN_request) |
|
102 | + { |
|
103 | + $this->_uses_separate_IPN_request = filter_var($uses_separate_IPN_request, FILTER_VALIDATE_BOOLEAN); |
|
104 | + } |
|
105 | 105 | |
106 | - /** |
|
107 | - * Allows gateway to dynamically decide whether or not to handle a payment update |
|
108 | - * by overriding this method. By default, if this is a "true" IPN (meaning |
|
109 | - * it's a separate request from when the user returns from the offsite gateway) |
|
110 | - * and this gateway class is setup to handle IPNs in separate "true" IPNs, then |
|
111 | - * this will return true, otherwise it will return false. |
|
112 | - * If however, this is a request when the user is returning |
|
113 | - * from an offsite gateway, and this gateway class is setup to process the payment |
|
114 | - * data when the user returns, then this will return true. |
|
115 | - * |
|
116 | - * @param array $request_data |
|
117 | - * @param boolean $separate_IPN_request |
|
118 | - * @return boolean |
|
119 | - */ |
|
120 | - public function handle_IPN_in_this_request($request_data, $separate_IPN_request) |
|
121 | - { |
|
122 | - if ($separate_IPN_request) { |
|
123 | - // payment data being sent in a request separate from the user |
|
124 | - // it is this other request that will update the TXN and payment info |
|
125 | - return $this->_uses_separate_IPN_request; |
|
126 | - } else { |
|
127 | - // it's a request where the user returned from an offsite gateway WITH the payment data |
|
128 | - return ! $this->_uses_separate_IPN_request; |
|
129 | - } |
|
130 | - } |
|
106 | + /** |
|
107 | + * Allows gateway to dynamically decide whether or not to handle a payment update |
|
108 | + * by overriding this method. By default, if this is a "true" IPN (meaning |
|
109 | + * it's a separate request from when the user returns from the offsite gateway) |
|
110 | + * and this gateway class is setup to handle IPNs in separate "true" IPNs, then |
|
111 | + * this will return true, otherwise it will return false. |
|
112 | + * If however, this is a request when the user is returning |
|
113 | + * from an offsite gateway, and this gateway class is setup to process the payment |
|
114 | + * data when the user returns, then this will return true. |
|
115 | + * |
|
116 | + * @param array $request_data |
|
117 | + * @param boolean $separate_IPN_request |
|
118 | + * @return boolean |
|
119 | + */ |
|
120 | + public function handle_IPN_in_this_request($request_data, $separate_IPN_request) |
|
121 | + { |
|
122 | + if ($separate_IPN_request) { |
|
123 | + // payment data being sent in a request separate from the user |
|
124 | + // it is this other request that will update the TXN and payment info |
|
125 | + return $this->_uses_separate_IPN_request; |
|
126 | + } else { |
|
127 | + // it's a request where the user returned from an offsite gateway WITH the payment data |
|
128 | + return ! $this->_uses_separate_IPN_request; |
|
129 | + } |
|
130 | + } |
|
131 | 131 | } |
@@ -15,36 +15,36 @@ |
||
15 | 15 | abstract class EE_Onsite_Gateway extends EE_Gateway |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @return EE_Onsite_Gateway |
|
20 | - */ |
|
21 | - public function __construct() |
|
22 | - { |
|
23 | - $this->_supports_sending_refunds = true; |
|
24 | - parent::__construct(); |
|
25 | - } |
|
18 | + /** |
|
19 | + * @return EE_Onsite_Gateway |
|
20 | + */ |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + $this->_supports_sending_refunds = true; |
|
24 | + parent::__construct(); |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * Asks the gateway to do whatever it does to process the payment. Onsite gateways will |
|
29 | - * usually send a request directly to the payment provider and update the payment's status based on that; |
|
30 | - * whereas offsite gateways will usually just update the payment with the URL and query parameters to use |
|
31 | - * for sending the request via http_remote_request(). Saving the payment from within this method is unnecessary, |
|
32 | - * as it is the responsibility of client code to save it. |
|
33 | - * |
|
34 | - * @param EEI_Payment $payment |
|
35 | - * @param array $billing_info { |
|
36 | - * @type $first_name string |
|
37 | - * @type $last_name string |
|
38 | - * @type $email string |
|
39 | - * @type $address string |
|
40 | - * @type $address2 string |
|
41 | - * @type $city string |
|
42 | - * @type $state string name of the state (NOT int) |
|
43 | - * @type $country string 2-character ISO code see http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 |
|
44 | - * @type $zip string |
|
45 | - * @type $phone string |
|
46 | - * } unless a child class specifies these array keys are NOT present |
|
47 | - * @return EE_Payment updated |
|
48 | - */ |
|
49 | - abstract public function do_direct_payment($payment, $billing_info = null); |
|
27 | + /** |
|
28 | + * Asks the gateway to do whatever it does to process the payment. Onsite gateways will |
|
29 | + * usually send a request directly to the payment provider and update the payment's status based on that; |
|
30 | + * whereas offsite gateways will usually just update the payment with the URL and query parameters to use |
|
31 | + * for sending the request via http_remote_request(). Saving the payment from within this method is unnecessary, |
|
32 | + * as it is the responsibility of client code to save it. |
|
33 | + * |
|
34 | + * @param EEI_Payment $payment |
|
35 | + * @param array $billing_info { |
|
36 | + * @type $first_name string |
|
37 | + * @type $last_name string |
|
38 | + * @type $email string |
|
39 | + * @type $address string |
|
40 | + * @type $address2 string |
|
41 | + * @type $city string |
|
42 | + * @type $state string name of the state (NOT int) |
|
43 | + * @type $country string 2-character ISO code see http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 |
|
44 | + * @type $zip string |
|
45 | + * @type $phone string |
|
46 | + * } unless a child class specifies these array keys are NOT present |
|
47 | + * @return EE_Payment updated |
|
48 | + */ |
|
49 | + abstract public function do_direct_payment($payment, $billing_info = null); |
|
50 | 50 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
3 | - exit('No direct script access allowed'); |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * payment_details_content |
@@ -10,5 +10,5 @@ discard block |
||
10 | 10 | */ |
11 | 11 | $gateway_response = $payment->gateway_response(); |
12 | 12 | if (! empty($gateway_response)) { |
13 | - echo '<span class="error payment-problem">' . $gateway_response . '</span>'; |
|
13 | + echo '<span class="error payment-problem">' . $gateway_response . '</span>'; |
|
14 | 14 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('No direct script access allowed'); |
4 | 4 | } |
5 | 5 | /** |
@@ -9,6 +9,6 @@ discard block |
||
9 | 9 | * @var EE_Payment_Method $payment_method |
10 | 10 | */ |
11 | 11 | $gateway_response = $payment->gateway_response(); |
12 | -if (! empty($gateway_response)) { |
|
13 | - echo '<span class="error payment-problem">' . $gateway_response . '</span>'; |
|
12 | +if ( ! empty($gateway_response)) { |
|
13 | + echo '<span class="error payment-problem">'.$gateway_response.'</span>'; |
|
14 | 14 | } |