Completed
Branch FET/add-loco-translate-support (7d9689)
by
unknown
26:14 queued 18:13
created
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.
form_sections/payment_methods/EE_Billing_Attendee_Info_Form.form.php 2 patches
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -14,139 +14,139 @@
 block discarded – undo
14 14
 class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form
15 15
 {
16 16
 
17
-    /**
18
-     *
19
-     * @param EE_Payment_Method $payment_method
20
-     * @param array $options_array @see EE_Form_Section_Proper::__construct()
21
-     */
22
-    public function __construct(EE_Payment_Method $payment_method, $options_array = array())
23
-    {
24
-        $options_array['subsections'] = array_merge(
25
-            array(
26
-                'first_name'    => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __('First Name', 'event_espresso') )),
27
-                'last_name'     => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __('Last Name', 'event_espresso') )),
28
-                'email'             => new EE_Email_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso') )),
29
-                'address'           => new EE_Text_Input(array( 'html_label_text'=>  __('Address', 'event_espresso'), 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address' )),
30
-                'address2'      => new EE_Text_Input(array( 'html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2' )),
31
-                'city'                  => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso') )),
32
-                'state'                 => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input(null, array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __('State', 'event_espresso') ))),
33
-                'country'           => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input(null, array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __('Country', 'event_espresso') ))),
34
-                'zip'                   => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso') )),
35
-                'phone'         => new EE_Text_Input(array( 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso') )),
36
-            ),
37
-            isset($options_array['subsections']) ? $options_array['subsections'] : array()
38
-        );
17
+	/**
18
+	 *
19
+	 * @param EE_Payment_Method $payment_method
20
+	 * @param array $options_array @see EE_Form_Section_Proper::__construct()
21
+	 */
22
+	public function __construct(EE_Payment_Method $payment_method, $options_array = array())
23
+	{
24
+		$options_array['subsections'] = array_merge(
25
+			array(
26
+				'first_name'    => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __('First Name', 'event_espresso') )),
27
+				'last_name'     => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __('Last Name', 'event_espresso') )),
28
+				'email'             => new EE_Email_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso') )),
29
+				'address'           => new EE_Text_Input(array( 'html_label_text'=>  __('Address', 'event_espresso'), 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address' )),
30
+				'address2'      => new EE_Text_Input(array( 'html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2' )),
31
+				'city'                  => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso') )),
32
+				'state'                 => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input(null, array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __('State', 'event_espresso') ))),
33
+				'country'           => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input(null, array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __('Country', 'event_espresso') ))),
34
+				'zip'                   => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso') )),
35
+				'phone'         => new EE_Text_Input(array( 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso') )),
36
+			),
37
+			isset($options_array['subsections']) ? $options_array['subsections'] : array()
38
+		);
39 39
 
40
-        parent::__construct($payment_method, $options_array);
41
-    }
40
+		parent::__construct($payment_method, $options_array);
41
+	}
42 42
 
43
-    /**
44
-     * Sets the defaults for the billing form according to the attendee's details
45
-     * @param EE_Attendee $attendee
46
-     */
47
-    public function populate_from_attendee($attendee)
48
-    {
49
-        $attendee = EEM_Attendee::instance()->ensure_is_obj($attendee);
50
-        /** @var $attendee EE_Attendee */
51
-        $this->populate_defaults(
52
-            apply_filters(
53
-                'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee',
54
-                array(
55
-                    'first_name'=>$attendee->fname(),
56
-                    'last_name'=>$attendee->lname(),
57
-                    'email'=>$attendee->email(),
58
-                    'address'=>$attendee->address(),
59
-                    'address2'=>$attendee->address2(),
60
-                    'city'=>$attendee->city(),
61
-                    'state'=> $attendee->state_ID(),
62
-                    'country'=> $attendee->country_ID(),
63
-                    'zip'=>$attendee->zip(),
64
-                    'phone'=>$attendee->phone(),
65
-                ),
66
-                $attendee,
67
-                $this
68
-            )
69
-        );
70
-    }
43
+	/**
44
+	 * Sets the defaults for the billing form according to the attendee's details
45
+	 * @param EE_Attendee $attendee
46
+	 */
47
+	public function populate_from_attendee($attendee)
48
+	{
49
+		$attendee = EEM_Attendee::instance()->ensure_is_obj($attendee);
50
+		/** @var $attendee EE_Attendee */
51
+		$this->populate_defaults(
52
+			apply_filters(
53
+				'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee',
54
+				array(
55
+					'first_name'=>$attendee->fname(),
56
+					'last_name'=>$attendee->lname(),
57
+					'email'=>$attendee->email(),
58
+					'address'=>$attendee->address(),
59
+					'address2'=>$attendee->address2(),
60
+					'city'=>$attendee->city(),
61
+					'state'=> $attendee->state_ID(),
62
+					'country'=> $attendee->country_ID(),
63
+					'zip'=>$attendee->zip(),
64
+					'phone'=>$attendee->phone(),
65
+				),
66
+				$attendee,
67
+				$this
68
+			)
69
+		);
70
+	}
71 71
 
72 72
 
73 73
 
74
-    /**
75
-     * copy_billing_form_data_to_attendee
76
-     * copies info from the billing form to the attendee's details
77
-     * @param \EE_Attendee $attendee - the attendee object to copy details to
78
-     * @return \EE_Attendee
79
-     */
80
-    public function copy_billing_form_data_to_attendee(EE_Attendee $attendee)
81
-    {
82
-        // grab billing form data
83
-        $data = $this->valid_data();
84
-        // copy first_name
85
-        if (! empty($data['first_name'])) {
86
-            $attendee->set_fname($data['first_name']);
87
-        }
88
-        // copy last_name
89
-        if (! empty($data['last_name'])) {
90
-            $attendee->set_lname($data['last_name']);
91
-        }
92
-        // copy email
93
-        if (! empty($data['email'])) {
94
-            $attendee->set_email($data['email']);
95
-        }
96
-        // copy address
97
-        if (! empty($data['address'])) {
98
-            $attendee->set_address($data['address']);
99
-        }
100
-        // copy address2
101
-        if (! empty($data['address2'])) {
102
-            $attendee->set_address2($data['address2']);
103
-        }
104
-        // copy city
105
-        if (! empty($data['city'])) {
106
-            $attendee->set_city($data['city']);
107
-        }
108
-        // copy state
109
-        if (! empty($data['state'])) {
110
-            $attendee->set_state($data['state']);
111
-        }
112
-        // copy country
113
-        if (! empty($data['country'])) {
114
-            $attendee->set_country($data['country']);
115
-        }
116
-        // copy zip
117
-        if (! empty($data['zip'])) {
118
-            $attendee->set_zip($data['zip']);
119
-        }
120
-        // copy phone
121
-        if (! empty($data['phone'])) {
122
-            $attendee->set_phone($data['phone']);
123
-        }
124
-        return $attendee;
125
-    }
74
+	/**
75
+	 * copy_billing_form_data_to_attendee
76
+	 * copies info from the billing form to the attendee's details
77
+	 * @param \EE_Attendee $attendee - the attendee object to copy details to
78
+	 * @return \EE_Attendee
79
+	 */
80
+	public function copy_billing_form_data_to_attendee(EE_Attendee $attendee)
81
+	{
82
+		// grab billing form data
83
+		$data = $this->valid_data();
84
+		// copy first_name
85
+		if (! empty($data['first_name'])) {
86
+			$attendee->set_fname($data['first_name']);
87
+		}
88
+		// copy last_name
89
+		if (! empty($data['last_name'])) {
90
+			$attendee->set_lname($data['last_name']);
91
+		}
92
+		// copy email
93
+		if (! empty($data['email'])) {
94
+			$attendee->set_email($data['email']);
95
+		}
96
+		// copy address
97
+		if (! empty($data['address'])) {
98
+			$attendee->set_address($data['address']);
99
+		}
100
+		// copy address2
101
+		if (! empty($data['address2'])) {
102
+			$attendee->set_address2($data['address2']);
103
+		}
104
+		// copy city
105
+		if (! empty($data['city'])) {
106
+			$attendee->set_city($data['city']);
107
+		}
108
+		// copy state
109
+		if (! empty($data['state'])) {
110
+			$attendee->set_state($data['state']);
111
+		}
112
+		// copy country
113
+		if (! empty($data['country'])) {
114
+			$attendee->set_country($data['country']);
115
+		}
116
+		// copy zip
117
+		if (! empty($data['zip'])) {
118
+			$attendee->set_zip($data['zip']);
119
+		}
120
+		// copy phone
121
+		if (! empty($data['phone'])) {
122
+			$attendee->set_phone($data['phone']);
123
+		}
124
+		return $attendee;
125
+	}
126 126
 
127 127
 
128
-    /**
129
-     * create_attendee_from_billing_form_data
130
-     * uses info from the billing form to create a new attendee
131
-     * @return \EE_Attendee
132
-     */
133
-    public function create_attendee_from_billing_form_data()
134
-    {
135
-        // grab billing form data
136
-        $data = $this->valid_data();
137
-        return EE_Attendee::new_instance(array(
138
-            'ATT_fname'         => ! empty($data['first_name']) ? $data['first_name'] : '',
139
-            'ATT_lname'         => ! empty($data['last_name']) ? $data['last_name'] : '',
140
-            'ATT_email'         => ! empty($data['email']) ? $data['email'] : '',
141
-            'ATT_address'       => ! empty($data['address']) ? $data['address'] : '',
142
-            'ATT_address2'  => ! empty($data['address2']) ? $data['address2'] : '',
143
-            'ATT_city'          => ! empty($data['city']) ? $data['city'] : '',
144
-            'STA_ID'                => ! empty($data['state']) ? $data['state'] : '',
145
-            'CNT_ISO'           => ! empty($data['country']) ? $data['country'] : '',
146
-            'ATT_zip'               => ! empty($data['zip']) ? $data['zip'] : '',
147
-            'ATT_phone'         => ! empty($data['phone']) ? $data['phone'] : '',
148
-        ));
149
-    }
128
+	/**
129
+	 * create_attendee_from_billing_form_data
130
+	 * uses info from the billing form to create a new attendee
131
+	 * @return \EE_Attendee
132
+	 */
133
+	public function create_attendee_from_billing_form_data()
134
+	{
135
+		// grab billing form data
136
+		$data = $this->valid_data();
137
+		return EE_Attendee::new_instance(array(
138
+			'ATT_fname'         => ! empty($data['first_name']) ? $data['first_name'] : '',
139
+			'ATT_lname'         => ! empty($data['last_name']) ? $data['last_name'] : '',
140
+			'ATT_email'         => ! empty($data['email']) ? $data['email'] : '',
141
+			'ATT_address'       => ! empty($data['address']) ? $data['address'] : '',
142
+			'ATT_address2'  => ! empty($data['address2']) ? $data['address2'] : '',
143
+			'ATT_city'          => ! empty($data['city']) ? $data['city'] : '',
144
+			'STA_ID'                => ! empty($data['state']) ? $data['state'] : '',
145
+			'CNT_ISO'           => ! empty($data['country']) ? $data['country'] : '',
146
+			'ATT_zip'               => ! empty($data['zip']) ? $data['zip'] : '',
147
+			'ATT_phone'         => ! empty($data['phone']) ? $data['phone'] : '',
148
+		));
149
+	}
150 150
 }
151 151
 
152 152
 // End of file EE_Billing_Attendee_Info_Form.form.php
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
     {
24 24
         $options_array['subsections'] = array_merge(
25 25
             array(
26
-                'first_name'    => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __('First Name', 'event_espresso') )),
27
-                'last_name'     => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __('Last Name', 'event_espresso') )),
28
-                'email'             => new EE_Email_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso') )),
29
-                'address'           => new EE_Text_Input(array( 'html_label_text'=>  __('Address', 'event_espresso'), 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address' )),
30
-                'address2'      => new EE_Text_Input(array( 'html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2' )),
31
-                'city'                  => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso') )),
32
-                'state'                 => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input(null, array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __('State', 'event_espresso') ))),
33
-                'country'           => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input(null, array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __('Country', 'event_espresso') ))),
34
-                'zip'                   => new EE_Text_Input(array( 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso') )),
35
-                'phone'         => new EE_Text_Input(array( 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso') )),
26
+                'first_name'    => new EE_Text_Input(array('required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __('First Name', 'event_espresso'))),
27
+                'last_name'     => new EE_Text_Input(array('required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __('Last Name', 'event_espresso'))),
28
+                'email'             => new EE_Email_Input(array('required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso'))),
29
+                'address'           => new EE_Text_Input(array('html_label_text'=>  __('Address', 'event_espresso'), 'required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address')),
30
+                'address2'      => new EE_Text_Input(array('html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2')),
31
+                'city'                  => new EE_Text_Input(array('required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso'))),
32
+                'state'                 => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input(null, array('required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __('State', 'event_espresso')))),
33
+                'country'           => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input(null, array('required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __('Country', 'event_espresso')))),
34
+                'zip'                   => new EE_Text_Input(array('required'=>true, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso'))),
35
+                'phone'         => new EE_Text_Input(array('html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso'))),
36 36
             ),
37 37
             isset($options_array['subsections']) ? $options_array['subsections'] : array()
38 38
         );
@@ -82,43 +82,43 @@  discard block
 block discarded – undo
82 82
         // grab billing form data
83 83
         $data = $this->valid_data();
84 84
         // copy first_name
85
-        if (! empty($data['first_name'])) {
85
+        if ( ! empty($data['first_name'])) {
86 86
             $attendee->set_fname($data['first_name']);
87 87
         }
88 88
         // copy last_name
89
-        if (! empty($data['last_name'])) {
89
+        if ( ! empty($data['last_name'])) {
90 90
             $attendee->set_lname($data['last_name']);
91 91
         }
92 92
         // copy email
93
-        if (! empty($data['email'])) {
93
+        if ( ! empty($data['email'])) {
94 94
             $attendee->set_email($data['email']);
95 95
         }
96 96
         // copy address
97
-        if (! empty($data['address'])) {
97
+        if ( ! empty($data['address'])) {
98 98
             $attendee->set_address($data['address']);
99 99
         }
100 100
         // copy address2
101
-        if (! empty($data['address2'])) {
101
+        if ( ! empty($data['address2'])) {
102 102
             $attendee->set_address2($data['address2']);
103 103
         }
104 104
         // copy city
105
-        if (! empty($data['city'])) {
105
+        if ( ! empty($data['city'])) {
106 106
             $attendee->set_city($data['city']);
107 107
         }
108 108
         // copy state
109
-        if (! empty($data['state'])) {
109
+        if ( ! empty($data['state'])) {
110 110
             $attendee->set_state($data['state']);
111 111
         }
112 112
         // copy country
113
-        if (! empty($data['country'])) {
113
+        if ( ! empty($data['country'])) {
114 114
             $attendee->set_country($data['country']);
115 115
         }
116 116
         // copy zip
117
-        if (! empty($data['zip'])) {
117
+        if ( ! empty($data['zip'])) {
118 118
             $attendee->set_zip($data['zip']);
119 119
         }
120 120
         // copy phone
121
-        if (! empty($data['phone'])) {
121
+        if ( ! empty($data['phone'])) {
122 122
             $attendee->set_phone($data['phone']);
123 123
         }
124 124
         return $attendee;
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.
core/libraries/form_sections/EE_Sample_Form.form.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1,60 +1,60 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
core/libraries/payment_methods/EE_Offsite_Gateway.lib.php 1 patch
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -15,117 +15,117 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
core/libraries/payment_methods/EE_PMT_Base.lib.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             $this->_gateway->set_unsupported_character_remover(new AsciiOnly());
118 118
             do_action('AHEE__EE_PMT_Base___construct__done_initializing_gateway_class', $this, $this->_gateway);
119 119
         }
120
-        if (! isset($this->_has_billing_form)) {
120
+        if ( ! isset($this->_has_billing_form)) {
121 121
             // by default, On Site gateways have a billing form
122 122
             if ($this->payment_occurs() == EE_PMT_Base::onsite) {
123 123
                 $this->set_has_billing_form(true);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
             }
127 127
         }
128 128
 
129
-        if (! $this->_pretty_name) {
129
+        if ( ! $this->_pretty_name) {
130 130
             throw new EE_Error(
131 131
                 sprintf(
132 132
                     __(
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         }
139 139
         // if the child didn't specify a default button, use the credit card one
140 140
         if ($this->_default_button_url === null) {
141
-            $this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods' . DS . 'pay-by-credit-card.png';
141
+            $this->_default_button_url = EE_PLUGIN_DIR_URL.'payment_methods'.DS.'pay-by-credit-card.png';
142 142
         }
143 143
     }
144 144
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     {
160 160
         $reflector = new ReflectionClass(get_class($this));
161 161
         $fn = $reflector->getFileName();
162
-        $this->_file_folder = dirname($fn) . DS;
162
+        $this->_file_folder = dirname($fn).DS;
163 163
     }
164 164
 
165 165
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      */
193 193
     public function file_folder()
194 194
     {
195
-        if (! $this->_file_folder) {
195
+        if ( ! $this->_file_folder) {
196 196
             $this->_set_file_folder();
197 197
         }
198 198
         return $this->_file_folder;
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      */
205 205
     public function file_url()
206 206
     {
207
-        if (! $this->_file_url) {
207
+        if ( ! $this->_file_url) {
208 208
             $this->_set_file_url();
209 209
         }
210 210
         return $this->_file_url;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
      */
239 239
     public function settings_form()
240 240
     {
241
-        if (! $this->_settings_form) {
241
+        if ( ! $this->_settings_form) {
242 242
             $this->_settings_form = $this->generate_new_settings_form();
243 243
             $this->_settings_form->set_payment_method_type($this);
244 244
             // if we have already assigned a model object to this pmt, make
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
     public function billing_form(EE_Transaction $transaction = null, $extra_args = array())
293 293
     {
294 294
         // has billing form already been regenerated ? or overwrite cache?
295
-        if (! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) {
295
+        if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) {
296 296
             $this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args);
297 297
         }
298 298
         // if we know who the attendee is, and this is a billing form
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             $payment = EEM_Payment::instance()->get_one(array($duplicate_properties));
395 395
             // if we didn't already have a payment in progress for the same thing,
396 396
             // then we actually want to make a new payment
397
-            if (! $payment instanceof EE_Payment) {
397
+            if ( ! $payment instanceof EE_Payment) {
398 398
                 $payment = EE_Payment::new_instance(
399 399
                     array_merge(
400 400
                         $duplicate_properties,
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
     public function handle_ipn($req_data, $transaction)
496 496
     {
497 497
         $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
498
-        if (! $this->_gateway instanceof EE_Offsite_Gateway) {
498
+        if ( ! $this->_gateway instanceof EE_Offsite_Gateway) {
499 499
             throw new EE_Error(
500 500
                 sprintf(
501 501
                     __("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"),
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
      */
519 519
     protected function _save_billing_info_to_attendee($billing_form, $transaction)
520 520
     {
521
-        if (! $transaction || ! $transaction instanceof EE_Transaction) {
521
+        if ( ! $transaction || ! $transaction instanceof EE_Transaction) {
522 522
             EE_Error::add_error(
523 523
                 __("Cannot save billing info because no transaction was specified", "event_espresso"),
524 524
                 __FILE__,
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
             return false;
529 529
         }
530 530
         $primary_reg = $transaction->primary_registration();
531
-        if (! $primary_reg) {
531
+        if ( ! $primary_reg) {
532 532
             EE_Error::add_error(
533 533
                 __("Cannot save billing info because the transaction has no primary registration", "event_espresso"),
534 534
                 __FILE__,
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
             return false;
539 539
         }
540 540
         $attendee = $primary_reg->attendee();
541
-        if (! $attendee) {
541
+        if ( ! $attendee) {
542 542
             EE_Error::add_error(
543 543
                 __(
544 544
                     "Cannot save billing info because the transaction's primary registration has no attendee!",
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
      */
652 652
     public function payment_occurs()
653 653
     {
654
-        if (! $this->_gateway) {
654
+        if ( ! $this->_gateway) {
655 655
             return EE_PMT_Base::offline;
656 656
         } elseif ($this->_gateway instanceof EE_Onsite_Gateway) {
657 657
             return EE_PMT_Base::onsite;
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
     public function payment_overview_content(EE_Payment $payment)
683 683
     {
684 684
         return EEH_Template::display_template(
685
-            EE_LIBRARIES . 'payment_methods' . DS . 'templates' . DS . 'payment_details_content.template.php',
685
+            EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php',
686 686
             array('payment_method' => $this->_pm_instance, 'payment' => $payment),
687 687
             true
688 688
         );
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
      */
770 770
     public function get_help_tab_name()
771 771
     {
772
-        return 'ee_' . strtolower($this->system_name()) . '_help_tab';
772
+        return 'ee_'.strtolower($this->system_name()).'_help_tab';
773 773
     }
774 774
 
775 775
     /**
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
      */
781 781
     public function cap_name()
782 782
     {
783
-        return 'ee_payment_method_' . strtolower($this->system_name());
783
+        return 'ee_payment_method_'.strtolower($this->system_name());
784 784
     }
785 785
 
786 786
     /**
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
     public function introductory_html()
815 815
     {
816 816
         return EEH_Template::locate_template(
817
-            $this->file_folder() . 'templates' . DS . strtolower($this->system_name()) . '_intro.template.php',
817
+            $this->file_folder().'templates'.DS.strtolower($this->system_name()).'_intro.template.php',
818 818
             array('pmt_obj' => $this, 'pm_instance' => $this->_pm_instance)
819 819
         );
820 820
     }
Please login to merge, or discard this patch.
Indentation   +808 added lines, -808 removed lines patch added patch discarded remove patch
@@ -21,812 +21,812 @@
 block discarded – undo
21 21
 abstract class EE_PMT_Base
22 22
 {
23 23
 
24
-    const onsite = 'on-site';
25
-    const offsite = 'off-site';
26
-    const offline = 'off-line';
27
-
28
-    /**
29
-     * @var EE_Payment_Method
30
-     */
31
-    protected $_pm_instance = null;
32
-
33
-    /**
34
-     * @var boolean
35
-     */
36
-    protected $_requires_https = false;
37
-
38
-    /**
39
-     * @var boolean
40
-     */
41
-    protected $_has_billing_form;
42
-
43
-    /**
44
-     * @var EE_Gateway
45
-     */
46
-    protected $_gateway = null;
47
-
48
-    /**
49
-     * @var EE_Payment_Method_Form
50
-     */
51
-    protected $_settings_form = null;
52
-
53
-    /**
54
-     * @var EE_Form_Section_Proper
55
-     */
56
-    protected $_billing_form = null;
57
-
58
-    /**
59
-     * @var boolean
60
-     */
61
-    protected $_cache_billing_form = true;
62
-
63
-    /**
64
-     * String of the absolute path to the folder containing this file, with a trailing slash.
65
-     * eg '/public_html/wp-site/wp-content/plugins/event-espresso/payment_methods/Invoice/'
66
-     *
67
-     * @var string
68
-     */
69
-    protected $_file_folder = null;
70
-
71
-    /**
72
-     * String to the absolute URL to this file (useful for getting its web-accessible resources
73
-     * like images, js, or css)
74
-     *
75
-     * @var string
76
-     */
77
-    protected $_file_url = null;
78
-
79
-    /**
80
-     * Pretty name for the payment method
81
-     *
82
-     * @var string
83
-     */
84
-    protected $_pretty_name = null;
85
-
86
-    /**
87
-     *
88
-     * @var string
89
-     */
90
-    protected $_default_button_url = null;
91
-
92
-    /**
93
-     *
94
-     * @var string
95
-     */
96
-    protected $_default_description = null;
97
-
98
-
99
-    /**
100
-     *
101
-     * @param EE_Payment_Method $pm_instance
102
-     * @throws EE_Error
103
-     * @return EE_PMT_Base
104
-     */
105
-    public function __construct($pm_instance = null)
106
-    {
107
-        if ($pm_instance instanceof EE_Payment_Method) {
108
-            $this->set_instance($pm_instance);
109
-        }
110
-        if ($this->_gateway) {
111
-            $this->_gateway->set_payment_model(EEM_Payment::instance());
112
-            $this->_gateway->set_payment_log(EEM_Change_Log::instance());
113
-            $this->_gateway->set_template_helper(new EEH_Template());
114
-            $this->_gateway->set_line_item_helper(new EEH_Line_Item());
115
-            $this->_gateway->set_money_helper(new EEH_Money());
116
-            $this->_gateway->set_gateway_data_formatter(new GatewayDataFormatter());
117
-            $this->_gateway->set_unsupported_character_remover(new AsciiOnly());
118
-            do_action('AHEE__EE_PMT_Base___construct__done_initializing_gateway_class', $this, $this->_gateway);
119
-        }
120
-        if (! isset($this->_has_billing_form)) {
121
-            // by default, On Site gateways have a billing form
122
-            if ($this->payment_occurs() == EE_PMT_Base::onsite) {
123
-                $this->set_has_billing_form(true);
124
-            } else {
125
-                $this->set_has_billing_form(false);
126
-            }
127
-        }
128
-
129
-        if (! $this->_pretty_name) {
130
-            throw new EE_Error(
131
-                sprintf(
132
-                    __(
133
-                        "You must set the pretty name for the Payment Method Type in the constructor (_pretty_name), and please make it internationalized",
134
-                        "event_espresso"
135
-                    )
136
-                )
137
-            );
138
-        }
139
-        // if the child didn't specify a default button, use the credit card one
140
-        if ($this->_default_button_url === null) {
141
-            $this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods' . DS . 'pay-by-credit-card.png';
142
-        }
143
-    }
144
-
145
-
146
-    /**
147
-     * @param boolean $has_billing_form
148
-     */
149
-    public function set_has_billing_form($has_billing_form)
150
-    {
151
-        $this->_has_billing_form = filter_var($has_billing_form, FILTER_VALIDATE_BOOLEAN);
152
-    }
153
-
154
-
155
-    /**
156
-     * sets the file_folder property
157
-     */
158
-    protected function _set_file_folder()
159
-    {
160
-        $reflector = new ReflectionClass(get_class($this));
161
-        $fn = $reflector->getFileName();
162
-        $this->_file_folder = dirname($fn) . DS;
163
-    }
164
-
165
-
166
-    /**
167
-     * sets the file URL with a trailing slash for this PMT
168
-     */
169
-    protected function _set_file_url()
170
-    {
171
-        $plugins_dir_fixed = str_replace('\\', DS, WP_PLUGIN_DIR);
172
-        $file_folder_fixed = str_replace('\\', DS, $this->file_folder());
173
-        $file_path = str_replace($plugins_dir_fixed, WP_PLUGIN_URL, $file_folder_fixed);
174
-        $this->_file_url = $file_path;
175
-    }
176
-
177
-    /**
178
-     * Gets the default description on all payment methods of this type
179
-     *
180
-     * @return string
181
-     */
182
-    public function default_description()
183
-    {
184
-        return $this->_default_description;
185
-    }
186
-
187
-
188
-    /**
189
-     * Returns the folder containing the PMT child class, with a trailing slash
190
-     *
191
-     * @return string
192
-     */
193
-    public function file_folder()
194
-    {
195
-        if (! $this->_file_folder) {
196
-            $this->_set_file_folder();
197
-        }
198
-        return $this->_file_folder;
199
-    }
200
-
201
-
202
-    /**
203
-     * @return string
204
-     */
205
-    public function file_url()
206
-    {
207
-        if (! $this->_file_url) {
208
-            $this->_set_file_url();
209
-        }
210
-        return $this->_file_url;
211
-    }
212
-
213
-
214
-    /**
215
-     * Sets the payment method instance this payment method type is for.
216
-     * Its important teh payment method instance is set before
217
-     *
218
-     * @param EE_Payment_Method $payment_method_instance
219
-     */
220
-    public function set_instance($payment_method_instance)
221
-    {
222
-        $this->_pm_instance = $payment_method_instance;
223
-        // if they have already requested the settings form, make sure its
224
-        // data matches this model object
225
-        if ($this->_settings_form) {
226
-            $this->settings_form()->populate_model_obj($payment_method_instance);
227
-        }
228
-        if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
229
-            $this->_gateway->set_settings($payment_method_instance->settings_array());
230
-        }
231
-    }
232
-
233
-
234
-    /**
235
-     * Gets teh form for displaying to admins where they setup the payment method
236
-     *
237
-     * @return EE_Payment_Method_Form
238
-     */
239
-    public function settings_form()
240
-    {
241
-        if (! $this->_settings_form) {
242
-            $this->_settings_form = $this->generate_new_settings_form();
243
-            $this->_settings_form->set_payment_method_type($this);
244
-            // if we have already assigned a model object to this pmt, make
245
-            // sure its reflected in teh form we just generated
246
-            if ($this->_pm_instance) {
247
-                $this->_settings_form->populate_model_obj($this->_pm_instance);
248
-            }
249
-        }
250
-        return $this->_settings_form;
251
-    }
252
-
253
-
254
-    /**
255
-     * Gets the form for all the settings related to this payment method type
256
-     *
257
-     * @return EE_Payment_Method_Form
258
-     */
259
-    abstract public function generate_new_settings_form();
260
-
261
-
262
-    /**
263
-     * Sets the form for settings. This may be useful if we have already received
264
-     * a form submission and have form data it in, and want to use it anytime we're showing
265
-     * this payment method type's settings form later in the request
266
-     *
267
-     * @param EE_Payment_Method_Form $form
268
-     */
269
-    public function set_settings_form($form)
270
-    {
271
-        $this->_settings_form = $form;
272
-    }
273
-
274
-
275
-    /**
276
-     * @return boolean
277
-     */
278
-    public function has_billing_form()
279
-    {
280
-        return $this->_has_billing_form;
281
-    }
282
-
283
-
284
-    /**
285
-     * Gets the form for displaying to attendees where they can enter their billing info
286
-     * which will be sent to teh gateway (can be null)
287
-     *
288
-     * @param \EE_Transaction $transaction
289
-     * @param array           $extra_args
290
-     * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form|null
291
-     */
292
-    public function billing_form(EE_Transaction $transaction = null, $extra_args = array())
293
-    {
294
-        // has billing form already been regenerated ? or overwrite cache?
295
-        if (! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) {
296
-            $this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args);
297
-        }
298
-        // if we know who the attendee is, and this is a billing form
299
-        // that uses attendee info, populate it
300
-        if (apply_filters(
301
-            'FHEE__populate_billing_form_fields_from_attendee',
302
-            ($this->_billing_form instanceof EE_Billing_Attendee_Info_Form
303
-                && $transaction instanceof EE_Transaction
304
-                && $transaction->primary_registration() instanceof EE_Registration
305
-                && $transaction->primary_registration()->attendee() instanceof EE_Attendee
306
-            ),
307
-            $this->_billing_form,
308
-            $transaction
309
-        )) {
310
-            $this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee());
311
-        }
312
-        return $this->_billing_form;
313
-    }
314
-
315
-
316
-    /**
317
-     * Creates the billing form for this payment method type
318
-     *
319
-     * @param \EE_Transaction $transaction
320
-     * @return \EE_Billing_Info_Form
321
-     */
322
-    abstract public function generate_new_billing_form(EE_Transaction $transaction = null);
323
-
324
-
325
-    /**
326
-     * apply_billing_form_debug_settings
327
-     * applies debug data to the form
328
-     *
329
-     * @param \EE_Billing_Info_Form $billing_form
330
-     * @return \EE_Billing_Info_Form
331
-     */
332
-    public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form)
333
-    {
334
-        return $billing_form;
335
-    }
336
-
337
-
338
-    /**
339
-     * Sets the billing form for this payment method type. You may want to use this
340
-     * if you have form
341
-     *
342
-     * @param EE_Payment_Method $form
343
-     */
344
-    public function set_billing_form($form)
345
-    {
346
-        $this->_billing_form = $form;
347
-    }
348
-
349
-
350
-    /**
351
-     * Returns whether or not this payment method requires HTTPS to be used
352
-     *
353
-     * @return boolean
354
-     */
355
-    public function requires_https()
356
-    {
357
-        return $this->_requires_https;
358
-    }
359
-
360
-
361
-    /**
362
-     *
363
-     * @param EE_Transaction       $transaction
364
-     * @param float                $amount
365
-     * @param EE_Billing_Info_Form $billing_info
366
-     * @param string               $return_url
367
-     * @param string               $fail_url
368
-     * @param string               $method
369
-     * @param bool                 $by_admin
370
-     * @return EE_Payment
371
-     * @throws EE_Error
372
-     */
373
-    public function process_payment(
374
-        EE_Transaction $transaction,
375
-        $amount = null,
376
-        $billing_info = null,
377
-        $return_url = null,
378
-        $fail_url = '',
379
-        $method = 'CART',
380
-        $by_admin = false
381
-    ) {
382
-        // @todo: add surcharge for the payment method, if any
383
-        if ($this->_gateway) {
384
-            // there is a gateway, so we're going to make a payment object
385
-            // but wait! do they already have a payment in progress that we thought was failed?
386
-            $duplicate_properties = array(
387
-                'STS_ID'               => EEM_Payment::status_id_failed,
388
-                'TXN_ID'               => $transaction->ID(),
389
-                'PMD_ID'               => $this->_pm_instance->ID(),
390
-                'PAY_source'           => $method,
391
-                'PAY_amount'           => $amount !== null ? $amount : $transaction->remaining(),
392
-                'PAY_gateway_response' => null,
393
-            );
394
-            $payment = EEM_Payment::instance()->get_one(array($duplicate_properties));
395
-            // if we didn't already have a payment in progress for the same thing,
396
-            // then we actually want to make a new payment
397
-            if (! $payment instanceof EE_Payment) {
398
-                $payment = EE_Payment::new_instance(
399
-                    array_merge(
400
-                        $duplicate_properties,
401
-                        array(
402
-                            'PAY_timestamp'       => time(),
403
-                            'PAY_txn_id_chq_nmbr' => null,
404
-                            'PAY_po_number'       => null,
405
-                            'PAY_extra_accntng'   => null,
406
-                            'PAY_details'         => null,
407
-                        )
408
-                    )
409
-                );
410
-            }
411
-            // make sure the payment has been saved to show we started it, and so it has an ID should the gateway try to log it
412
-            $payment->save();
413
-            $billing_values = $this->_get_billing_values_from_form($billing_info);
414
-
415
-            //  Offsite Gateway
416
-            if ($this->_gateway instanceof EE_Offsite_Gateway) {
417
-                $payment = $this->_gateway->set_redirection_info(
418
-                    $payment,
419
-                    $billing_values,
420
-                    $return_url,
421
-                    EE_Config::instance()->core->txn_page_url(
422
-                        array(
423
-                            'e_reg_url_link'    => $transaction->primary_registration()->reg_url_link(),
424
-                            'ee_payment_method' => $this->_pm_instance->slug(),
425
-                        )
426
-                    ),
427
-                    $fail_url
428
-                );
429
-                $payment->save();
430
-                //  Onsite Gateway
431
-            } elseif ($this->_gateway instanceof EE_Onsite_Gateway) {
432
-                $payment = $this->_gateway->do_direct_payment($payment, $billing_values);
433
-                $payment->save();
434
-            } else {
435
-                throw new EE_Error(
436
-                    sprintf(
437
-                        __(
438
-                            'Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)',
439
-                            'event_espresso'
440
-                        ),
441
-                        get_class($this),
442
-                        gettype($this->_gateway)
443
-                    )
444
-                );
445
-            }
446
-        } else {
447
-            // no gateway provided
448
-            // there is no payment. Must be an offline gateway
449
-            // create a payment object anyways, but dont save it
450
-            $payment = EE_Payment::new_instance(
451
-                array(
452
-                    'STS_ID'        => EEM_Payment::status_id_pending,
453
-                    'TXN_ID'        => $transaction->ID(),
454
-                    'PMD_ID'        => $transaction->payment_method_ID(),
455
-                    'PAY_amount'    => 0.00,
456
-                    'PAY_timestamp' => time(),
457
-                )
458
-            );
459
-        }
460
-
461
-        // if there is billing info, clean it and save it now
462
-        if ($billing_info instanceof EE_Billing_Attendee_Info_Form) {
463
-            $this->_save_billing_info_to_attendee($billing_info, $transaction);
464
-        }
465
-
466
-        return $payment;
467
-    }
468
-
469
-    /**
470
-     * Gets the values we want to pass onto the gateway. Normally these
471
-     * are just the 'pretty' values, but there may be times the data may need
472
-     * a  little massaging. Proper subsections will become arrays of inputs
473
-     *
474
-     * @param EE_Billing_Info_Form $billing_form
475
-     * @return array
476
-     */
477
-    protected function _get_billing_values_from_form($billing_form)
478
-    {
479
-        if ($billing_form instanceof EE_Form_Section_Proper) {
480
-            return $billing_form->input_pretty_values(true);
481
-        } else {
482
-            return null;
483
-        }
484
-    }
485
-
486
-
487
-    /**
488
-     * Handles an instant payment notification when the transaction is known (by default).
489
-     *
490
-     * @param array          $req_data
491
-     * @param EE_Transaction $transaction
492
-     * @return EE_Payment
493
-     * @throws EE_Error
494
-     */
495
-    public function handle_ipn($req_data, $transaction)
496
-    {
497
-        $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
498
-        if (! $this->_gateway instanceof EE_Offsite_Gateway) {
499
-            throw new EE_Error(
500
-                sprintf(
501
-                    __("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"),
502
-                    print_r($this->_gateway, true)
503
-                )
504
-            );
505
-        }
506
-        $payment = $this->_gateway->handle_payment_update($req_data, $transaction);
507
-        return $payment;
508
-    }
509
-
510
-
511
-    /**
512
-     * Saves the billing info onto the attendee of the primary registrant on this transaction, and
513
-     * cleans it first.
514
-     *
515
-     * @param EE_Billing_Attendee_Info_Form $billing_form
516
-     * @param EE_Transaction                $transaction
517
-     * @return boolean success
518
-     */
519
-    protected function _save_billing_info_to_attendee($billing_form, $transaction)
520
-    {
521
-        if (! $transaction || ! $transaction instanceof EE_Transaction) {
522
-            EE_Error::add_error(
523
-                __("Cannot save billing info because no transaction was specified", "event_espresso"),
524
-                __FILE__,
525
-                __FUNCTION__,
526
-                __LINE__
527
-            );
528
-            return false;
529
-        }
530
-        $primary_reg = $transaction->primary_registration();
531
-        if (! $primary_reg) {
532
-            EE_Error::add_error(
533
-                __("Cannot save billing info because the transaction has no primary registration", "event_espresso"),
534
-                __FILE__,
535
-                __FUNCTION__,
536
-                __LINE__
537
-            );
538
-            return false;
539
-        }
540
-        $attendee = $primary_reg->attendee();
541
-        if (! $attendee) {
542
-            EE_Error::add_error(
543
-                __(
544
-                    "Cannot save billing info because the transaction's primary registration has no attendee!",
545
-                    "event_espresso"
546
-                ),
547
-                __FILE__,
548
-                __FUNCTION__,
549
-                __LINE__
550
-            );
551
-            return false;
552
-        }
553
-        return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method());
554
-    }
555
-
556
-
557
-    /**
558
-     * Gets the payment this IPN is for. Children may often want to
559
-     * override this to inspect the request
560
-     *
561
-     * @param EE_Transaction $transaction
562
-     * @param array          $req_data
563
-     * @return EE_Payment
564
-     */
565
-    protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array())
566
-    {
567
-        return $transaction->last_payment();
568
-    }
569
-
570
-
571
-    /**
572
-     * In case generic code cannot provide the payment processor with a specific payment method
573
-     * and transaction, it will try calling this method on each activate payment method.
574
-     * If the payment method is able to identify the request as being for it, it should fetch
575
-     * the payment its for and return it. If not, it should throw an EE_Error to indicate it cannot
576
-     * handle the IPN
577
-     *
578
-     * @param array $req_data
579
-     * @return EE_Payment only if this payment method can find the info its needs from $req_data
580
-     * and identifies the IPN as being for this payment method (not just fo ra payment method of this type)
581
-     * @throws EE_Error
582
-     */
583
-    public function handle_unclaimed_ipn($req_data = array())
584
-    {
585
-        throw new EE_Error(
586
-            sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this))
587
-        );
588
-    }
589
-
590
-
591
-    /**
592
-     * Logic to be accomplished when the payment attempt is complete.
593
-     * Most payment methods don't need to do anything at this point; but some, like Mijireh, do.
594
-     * (Mijireh is an offsite gateway which doesn't send an IPN. So when the user returns to EE from
595
-     * mijireh, this method needs to be called so the Mijireh PM can ping Mijireh to know the status
596
-     * of the payment). Fed a transaction because it's always assumed to be the last payment that
597
-     * we're dealing with. Returns that last payment (if there is one)
598
-     *
599
-     * @param EE_Transaction $transaction
600
-     * @return EE_Payment
601
-     */
602
-    public function finalize_payment_for($transaction)
603
-    {
604
-        return $transaction->last_payment();
605
-    }
606
-
607
-
608
-    /**
609
-     * Whether or not this payment method's gateway supports sending refund requests
610
-     *
611
-     * @return boolean
612
-     */
613
-    public function supports_sending_refunds()
614
-    {
615
-        if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
616
-            return $this->_gateway->supports_sending_refunds();
617
-        } else {
618
-            return false;
619
-        }
620
-    }
621
-
622
-
623
-    /**
624
-     *
625
-     * @param EE_Payment $payment
626
-     * @param array      $refund_info
627
-     * @throws EE_Error
628
-     * @return EE_Payment
629
-     */
630
-    public function process_refund(EE_Payment $payment, $refund_info = array())
631
-    {
632
-        if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
633
-            return $this->_gateway->do_direct_refund($payment, $refund_info);
634
-        } else {
635
-            throw new EE_Error(
636
-                sprintf(
637
-                    __('Payment Method Type "%s" does not support sending refund requests', 'event_espresso'),
638
-                    get_class($this)
639
-                )
640
-            );
641
-        }
642
-    }
643
-
644
-
645
-    /**
646
-     * Returns one the class's constants onsite,offsite, or offline, depending on this
647
-     * payment method's gateway.
648
-     *
649
-     * @return string
650
-     * @throws EE_Error
651
-     */
652
-    public function payment_occurs()
653
-    {
654
-        if (! $this->_gateway) {
655
-            return EE_PMT_Base::offline;
656
-        } elseif ($this->_gateway instanceof EE_Onsite_Gateway) {
657
-            return EE_PMT_Base::onsite;
658
-        } elseif ($this->_gateway instanceof EE_Offsite_Gateway) {
659
-            return EE_PMT_Base::offsite;
660
-        } else {
661
-            throw new EE_Error(
662
-                sprintf(
663
-                    __(
664
-                        "Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those",
665
-                        "event_espresso"
666
-                    ),
667
-                    get_class($this)
668
-                )
669
-            );
670
-        }
671
-    }
672
-
673
-
674
-    /**
675
-     * For adding any html output ab ove the payment overview.
676
-     * Many gateways won't want ot display anything, so this function just returns an empty string.
677
-     * Other gateways may want to override this, such as offline gateways.
678
-     *
679
-     * @param EE_Payment $payment
680
-     * @return string
681
-     */
682
-    public function payment_overview_content(EE_Payment $payment)
683
-    {
684
-        return EEH_Template::display_template(
685
-            EE_LIBRARIES . 'payment_methods' . DS . 'templates' . DS . 'payment_details_content.template.php',
686
-            array('payment_method' => $this->_pm_instance, 'payment' => $payment),
687
-            true
688
-        );
689
-    }
690
-
691
-
692
-    /**
693
-     * @return array where keys are the help tab name,
694
-     * values are: array {
695
-     * @type string $title         i18n name for the help tab
696
-     * @type string $filename      name of the file located in ./help_tabs/ (ie, in a folder next to this file)
697
-     * @type array  $template_args any arguments you want passed to the template file while rendering.
698
-     *                Keys will be variable names and values with be their values.
699
-     */
700
-    public function help_tabs_config()
701
-    {
702
-        return array();
703
-    }
704
-
705
-
706
-    /**
707
-     * The system name for this PMT (eg AIM, Paypal_Pro, Invoice... what gets put into
708
-     * the payment method's table's PMT_type column)
709
-     *
710
-     * @return string
711
-     */
712
-    public function system_name()
713
-    {
714
-        $classname = get_class($this);
715
-        return str_replace("EE_PMT_", '', $classname);
716
-    }
717
-
718
-
719
-    /**
720
-     * A pretty i18n version of the PMT name. Often the same as the "pretty_name", but you can change it by overriding
721
-     * this method.
722
-     * @return string
723
-     */
724
-    public function defaultFrontendName()
725
-    {
726
-        return $this->pretty_name();
727
-    }
728
-
729
-
730
-    /**
731
-     * A pretty i18n version of the PMT name
732
-     *
733
-     * @return string
734
-     */
735
-    public function pretty_name()
736
-    {
737
-        return $this->_pretty_name;
738
-    }
739
-
740
-
741
-    /**
742
-     * Gets the default absolute URL to the payment method type's button
743
-     *
744
-     * @return string
745
-     */
746
-    public function default_button_url()
747
-    {
748
-        return $this->_default_button_url;
749
-    }
750
-
751
-
752
-    /**
753
-     * Gets the gateway used by this payment method (if any)
754
-     *
755
-     * @return EE_Gateway
756
-     */
757
-    public function get_gateway()
758
-    {
759
-        return $this->_gateway;
760
-    }
761
-
762
-
763
-    /**
764
-     * @return string html for the link to a help tab
765
-     */
766
-    public function get_help_tab_link()
767
-    {
768
-        return EEH_Template::get_help_tab_link(
769
-            $this->get_help_tab_name(),
770
-            'espresso_payment_settings',
771
-            'default'
772
-        );
773
-    }
774
-
775
-
776
-    /**
777
-     * Returns the name of the help tab for this PMT
778
-     *
779
-     * @return string
780
-     */
781
-    public function get_help_tab_name()
782
-    {
783
-        return 'ee_' . strtolower($this->system_name()) . '_help_tab';
784
-    }
785
-
786
-    /**
787
-     * The name of the wp capability that should be associated with the usage of
788
-     * this PMT by an admin
789
-     *
790
-     * @return string
791
-     */
792
-    public function cap_name()
793
-    {
794
-        return 'ee_payment_method_' . strtolower($this->system_name());
795
-    }
796
-
797
-    /**
798
-     * Called by client code to tell the gateway that if it wants to change
799
-     * the transaction or line items or registrations related to teh payment it already
800
-     * processed (we think, but possibly not) that now's the time to do it.
801
-     * It is expected that gateways will store any info they need for this on the PAY_details,
802
-     * or maybe an extra meta value
803
-     *
804
-     * @param EE_Payment $payment
805
-     * @return void
806
-     */
807
-    public function update_txn_based_on_payment($payment)
808
-    {
809
-        if ($this->_gateway instanceof EE_Gateway) {
810
-            $this->_gateway->update_txn_based_on_payment($payment);
811
-        }
812
-    }
813
-
814
-    /**
815
-     * Returns a string of HTML describing this payment method type for an admin,
816
-     * primarily intended for them to read before activating it.
817
-     * The easiest way to set this is to create a folder 'templates' alongside
818
-     * your EE_PMT_{System_Name} file, and in it create a file named "{system_name}_intro.template.php".
819
-     * Eg, if your payment method file is named "EE_PMT_Foo_Bar.pm.php",
820
-     * then you'd create a file named "templates" in the same folder as it, and name the file
821
-     * "foo_bar_intro.template.php", and its content will be returned by this method
822
-     *
823
-     * @return string
824
-     */
825
-    public function introductory_html()
826
-    {
827
-        return EEH_Template::locate_template(
828
-            $this->file_folder() . 'templates' . DS . strtolower($this->system_name()) . '_intro.template.php',
829
-            array('pmt_obj' => $this, 'pm_instance' => $this->_pm_instance)
830
-        );
831
-    }
24
+	const onsite = 'on-site';
25
+	const offsite = 'off-site';
26
+	const offline = 'off-line';
27
+
28
+	/**
29
+	 * @var EE_Payment_Method
30
+	 */
31
+	protected $_pm_instance = null;
32
+
33
+	/**
34
+	 * @var boolean
35
+	 */
36
+	protected $_requires_https = false;
37
+
38
+	/**
39
+	 * @var boolean
40
+	 */
41
+	protected $_has_billing_form;
42
+
43
+	/**
44
+	 * @var EE_Gateway
45
+	 */
46
+	protected $_gateway = null;
47
+
48
+	/**
49
+	 * @var EE_Payment_Method_Form
50
+	 */
51
+	protected $_settings_form = null;
52
+
53
+	/**
54
+	 * @var EE_Form_Section_Proper
55
+	 */
56
+	protected $_billing_form = null;
57
+
58
+	/**
59
+	 * @var boolean
60
+	 */
61
+	protected $_cache_billing_form = true;
62
+
63
+	/**
64
+	 * String of the absolute path to the folder containing this file, with a trailing slash.
65
+	 * eg '/public_html/wp-site/wp-content/plugins/event-espresso/payment_methods/Invoice/'
66
+	 *
67
+	 * @var string
68
+	 */
69
+	protected $_file_folder = null;
70
+
71
+	/**
72
+	 * String to the absolute URL to this file (useful for getting its web-accessible resources
73
+	 * like images, js, or css)
74
+	 *
75
+	 * @var string
76
+	 */
77
+	protected $_file_url = null;
78
+
79
+	/**
80
+	 * Pretty name for the payment method
81
+	 *
82
+	 * @var string
83
+	 */
84
+	protected $_pretty_name = null;
85
+
86
+	/**
87
+	 *
88
+	 * @var string
89
+	 */
90
+	protected $_default_button_url = null;
91
+
92
+	/**
93
+	 *
94
+	 * @var string
95
+	 */
96
+	protected $_default_description = null;
97
+
98
+
99
+	/**
100
+	 *
101
+	 * @param EE_Payment_Method $pm_instance
102
+	 * @throws EE_Error
103
+	 * @return EE_PMT_Base
104
+	 */
105
+	public function __construct($pm_instance = null)
106
+	{
107
+		if ($pm_instance instanceof EE_Payment_Method) {
108
+			$this->set_instance($pm_instance);
109
+		}
110
+		if ($this->_gateway) {
111
+			$this->_gateway->set_payment_model(EEM_Payment::instance());
112
+			$this->_gateway->set_payment_log(EEM_Change_Log::instance());
113
+			$this->_gateway->set_template_helper(new EEH_Template());
114
+			$this->_gateway->set_line_item_helper(new EEH_Line_Item());
115
+			$this->_gateway->set_money_helper(new EEH_Money());
116
+			$this->_gateway->set_gateway_data_formatter(new GatewayDataFormatter());
117
+			$this->_gateway->set_unsupported_character_remover(new AsciiOnly());
118
+			do_action('AHEE__EE_PMT_Base___construct__done_initializing_gateway_class', $this, $this->_gateway);
119
+		}
120
+		if (! isset($this->_has_billing_form)) {
121
+			// by default, On Site gateways have a billing form
122
+			if ($this->payment_occurs() == EE_PMT_Base::onsite) {
123
+				$this->set_has_billing_form(true);
124
+			} else {
125
+				$this->set_has_billing_form(false);
126
+			}
127
+		}
128
+
129
+		if (! $this->_pretty_name) {
130
+			throw new EE_Error(
131
+				sprintf(
132
+					__(
133
+						"You must set the pretty name for the Payment Method Type in the constructor (_pretty_name), and please make it internationalized",
134
+						"event_espresso"
135
+					)
136
+				)
137
+			);
138
+		}
139
+		// if the child didn't specify a default button, use the credit card one
140
+		if ($this->_default_button_url === null) {
141
+			$this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods' . DS . 'pay-by-credit-card.png';
142
+		}
143
+	}
144
+
145
+
146
+	/**
147
+	 * @param boolean $has_billing_form
148
+	 */
149
+	public function set_has_billing_form($has_billing_form)
150
+	{
151
+		$this->_has_billing_form = filter_var($has_billing_form, FILTER_VALIDATE_BOOLEAN);
152
+	}
153
+
154
+
155
+	/**
156
+	 * sets the file_folder property
157
+	 */
158
+	protected function _set_file_folder()
159
+	{
160
+		$reflector = new ReflectionClass(get_class($this));
161
+		$fn = $reflector->getFileName();
162
+		$this->_file_folder = dirname($fn) . DS;
163
+	}
164
+
165
+
166
+	/**
167
+	 * sets the file URL with a trailing slash for this PMT
168
+	 */
169
+	protected function _set_file_url()
170
+	{
171
+		$plugins_dir_fixed = str_replace('\\', DS, WP_PLUGIN_DIR);
172
+		$file_folder_fixed = str_replace('\\', DS, $this->file_folder());
173
+		$file_path = str_replace($plugins_dir_fixed, WP_PLUGIN_URL, $file_folder_fixed);
174
+		$this->_file_url = $file_path;
175
+	}
176
+
177
+	/**
178
+	 * Gets the default description on all payment methods of this type
179
+	 *
180
+	 * @return string
181
+	 */
182
+	public function default_description()
183
+	{
184
+		return $this->_default_description;
185
+	}
186
+
187
+
188
+	/**
189
+	 * Returns the folder containing the PMT child class, with a trailing slash
190
+	 *
191
+	 * @return string
192
+	 */
193
+	public function file_folder()
194
+	{
195
+		if (! $this->_file_folder) {
196
+			$this->_set_file_folder();
197
+		}
198
+		return $this->_file_folder;
199
+	}
200
+
201
+
202
+	/**
203
+	 * @return string
204
+	 */
205
+	public function file_url()
206
+	{
207
+		if (! $this->_file_url) {
208
+			$this->_set_file_url();
209
+		}
210
+		return $this->_file_url;
211
+	}
212
+
213
+
214
+	/**
215
+	 * Sets the payment method instance this payment method type is for.
216
+	 * Its important teh payment method instance is set before
217
+	 *
218
+	 * @param EE_Payment_Method $payment_method_instance
219
+	 */
220
+	public function set_instance($payment_method_instance)
221
+	{
222
+		$this->_pm_instance = $payment_method_instance;
223
+		// if they have already requested the settings form, make sure its
224
+		// data matches this model object
225
+		if ($this->_settings_form) {
226
+			$this->settings_form()->populate_model_obj($payment_method_instance);
227
+		}
228
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
229
+			$this->_gateway->set_settings($payment_method_instance->settings_array());
230
+		}
231
+	}
232
+
233
+
234
+	/**
235
+	 * Gets teh form for displaying to admins where they setup the payment method
236
+	 *
237
+	 * @return EE_Payment_Method_Form
238
+	 */
239
+	public function settings_form()
240
+	{
241
+		if (! $this->_settings_form) {
242
+			$this->_settings_form = $this->generate_new_settings_form();
243
+			$this->_settings_form->set_payment_method_type($this);
244
+			// if we have already assigned a model object to this pmt, make
245
+			// sure its reflected in teh form we just generated
246
+			if ($this->_pm_instance) {
247
+				$this->_settings_form->populate_model_obj($this->_pm_instance);
248
+			}
249
+		}
250
+		return $this->_settings_form;
251
+	}
252
+
253
+
254
+	/**
255
+	 * Gets the form for all the settings related to this payment method type
256
+	 *
257
+	 * @return EE_Payment_Method_Form
258
+	 */
259
+	abstract public function generate_new_settings_form();
260
+
261
+
262
+	/**
263
+	 * Sets the form for settings. This may be useful if we have already received
264
+	 * a form submission and have form data it in, and want to use it anytime we're showing
265
+	 * this payment method type's settings form later in the request
266
+	 *
267
+	 * @param EE_Payment_Method_Form $form
268
+	 */
269
+	public function set_settings_form($form)
270
+	{
271
+		$this->_settings_form = $form;
272
+	}
273
+
274
+
275
+	/**
276
+	 * @return boolean
277
+	 */
278
+	public function has_billing_form()
279
+	{
280
+		return $this->_has_billing_form;
281
+	}
282
+
283
+
284
+	/**
285
+	 * Gets the form for displaying to attendees where they can enter their billing info
286
+	 * which will be sent to teh gateway (can be null)
287
+	 *
288
+	 * @param \EE_Transaction $transaction
289
+	 * @param array           $extra_args
290
+	 * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form|null
291
+	 */
292
+	public function billing_form(EE_Transaction $transaction = null, $extra_args = array())
293
+	{
294
+		// has billing form already been regenerated ? or overwrite cache?
295
+		if (! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) {
296
+			$this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args);
297
+		}
298
+		// if we know who the attendee is, and this is a billing form
299
+		// that uses attendee info, populate it
300
+		if (apply_filters(
301
+			'FHEE__populate_billing_form_fields_from_attendee',
302
+			($this->_billing_form instanceof EE_Billing_Attendee_Info_Form
303
+				&& $transaction instanceof EE_Transaction
304
+				&& $transaction->primary_registration() instanceof EE_Registration
305
+				&& $transaction->primary_registration()->attendee() instanceof EE_Attendee
306
+			),
307
+			$this->_billing_form,
308
+			$transaction
309
+		)) {
310
+			$this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee());
311
+		}
312
+		return $this->_billing_form;
313
+	}
314
+
315
+
316
+	/**
317
+	 * Creates the billing form for this payment method type
318
+	 *
319
+	 * @param \EE_Transaction $transaction
320
+	 * @return \EE_Billing_Info_Form
321
+	 */
322
+	abstract public function generate_new_billing_form(EE_Transaction $transaction = null);
323
+
324
+
325
+	/**
326
+	 * apply_billing_form_debug_settings
327
+	 * applies debug data to the form
328
+	 *
329
+	 * @param \EE_Billing_Info_Form $billing_form
330
+	 * @return \EE_Billing_Info_Form
331
+	 */
332
+	public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form)
333
+	{
334
+		return $billing_form;
335
+	}
336
+
337
+
338
+	/**
339
+	 * Sets the billing form for this payment method type. You may want to use this
340
+	 * if you have form
341
+	 *
342
+	 * @param EE_Payment_Method $form
343
+	 */
344
+	public function set_billing_form($form)
345
+	{
346
+		$this->_billing_form = $form;
347
+	}
348
+
349
+
350
+	/**
351
+	 * Returns whether or not this payment method requires HTTPS to be used
352
+	 *
353
+	 * @return boolean
354
+	 */
355
+	public function requires_https()
356
+	{
357
+		return $this->_requires_https;
358
+	}
359
+
360
+
361
+	/**
362
+	 *
363
+	 * @param EE_Transaction       $transaction
364
+	 * @param float                $amount
365
+	 * @param EE_Billing_Info_Form $billing_info
366
+	 * @param string               $return_url
367
+	 * @param string               $fail_url
368
+	 * @param string               $method
369
+	 * @param bool                 $by_admin
370
+	 * @return EE_Payment
371
+	 * @throws EE_Error
372
+	 */
373
+	public function process_payment(
374
+		EE_Transaction $transaction,
375
+		$amount = null,
376
+		$billing_info = null,
377
+		$return_url = null,
378
+		$fail_url = '',
379
+		$method = 'CART',
380
+		$by_admin = false
381
+	) {
382
+		// @todo: add surcharge for the payment method, if any
383
+		if ($this->_gateway) {
384
+			// there is a gateway, so we're going to make a payment object
385
+			// but wait! do they already have a payment in progress that we thought was failed?
386
+			$duplicate_properties = array(
387
+				'STS_ID'               => EEM_Payment::status_id_failed,
388
+				'TXN_ID'               => $transaction->ID(),
389
+				'PMD_ID'               => $this->_pm_instance->ID(),
390
+				'PAY_source'           => $method,
391
+				'PAY_amount'           => $amount !== null ? $amount : $transaction->remaining(),
392
+				'PAY_gateway_response' => null,
393
+			);
394
+			$payment = EEM_Payment::instance()->get_one(array($duplicate_properties));
395
+			// if we didn't already have a payment in progress for the same thing,
396
+			// then we actually want to make a new payment
397
+			if (! $payment instanceof EE_Payment) {
398
+				$payment = EE_Payment::new_instance(
399
+					array_merge(
400
+						$duplicate_properties,
401
+						array(
402
+							'PAY_timestamp'       => time(),
403
+							'PAY_txn_id_chq_nmbr' => null,
404
+							'PAY_po_number'       => null,
405
+							'PAY_extra_accntng'   => null,
406
+							'PAY_details'         => null,
407
+						)
408
+					)
409
+				);
410
+			}
411
+			// make sure the payment has been saved to show we started it, and so it has an ID should the gateway try to log it
412
+			$payment->save();
413
+			$billing_values = $this->_get_billing_values_from_form($billing_info);
414
+
415
+			//  Offsite Gateway
416
+			if ($this->_gateway instanceof EE_Offsite_Gateway) {
417
+				$payment = $this->_gateway->set_redirection_info(
418
+					$payment,
419
+					$billing_values,
420
+					$return_url,
421
+					EE_Config::instance()->core->txn_page_url(
422
+						array(
423
+							'e_reg_url_link'    => $transaction->primary_registration()->reg_url_link(),
424
+							'ee_payment_method' => $this->_pm_instance->slug(),
425
+						)
426
+					),
427
+					$fail_url
428
+				);
429
+				$payment->save();
430
+				//  Onsite Gateway
431
+			} elseif ($this->_gateway instanceof EE_Onsite_Gateway) {
432
+				$payment = $this->_gateway->do_direct_payment($payment, $billing_values);
433
+				$payment->save();
434
+			} else {
435
+				throw new EE_Error(
436
+					sprintf(
437
+						__(
438
+							'Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)',
439
+							'event_espresso'
440
+						),
441
+						get_class($this),
442
+						gettype($this->_gateway)
443
+					)
444
+				);
445
+			}
446
+		} else {
447
+			// no gateway provided
448
+			// there is no payment. Must be an offline gateway
449
+			// create a payment object anyways, but dont save it
450
+			$payment = EE_Payment::new_instance(
451
+				array(
452
+					'STS_ID'        => EEM_Payment::status_id_pending,
453
+					'TXN_ID'        => $transaction->ID(),
454
+					'PMD_ID'        => $transaction->payment_method_ID(),
455
+					'PAY_amount'    => 0.00,
456
+					'PAY_timestamp' => time(),
457
+				)
458
+			);
459
+		}
460
+
461
+		// if there is billing info, clean it and save it now
462
+		if ($billing_info instanceof EE_Billing_Attendee_Info_Form) {
463
+			$this->_save_billing_info_to_attendee($billing_info, $transaction);
464
+		}
465
+
466
+		return $payment;
467
+	}
468
+
469
+	/**
470
+	 * Gets the values we want to pass onto the gateway. Normally these
471
+	 * are just the 'pretty' values, but there may be times the data may need
472
+	 * a  little massaging. Proper subsections will become arrays of inputs
473
+	 *
474
+	 * @param EE_Billing_Info_Form $billing_form
475
+	 * @return array
476
+	 */
477
+	protected function _get_billing_values_from_form($billing_form)
478
+	{
479
+		if ($billing_form instanceof EE_Form_Section_Proper) {
480
+			return $billing_form->input_pretty_values(true);
481
+		} else {
482
+			return null;
483
+		}
484
+	}
485
+
486
+
487
+	/**
488
+	 * Handles an instant payment notification when the transaction is known (by default).
489
+	 *
490
+	 * @param array          $req_data
491
+	 * @param EE_Transaction $transaction
492
+	 * @return EE_Payment
493
+	 * @throws EE_Error
494
+	 */
495
+	public function handle_ipn($req_data, $transaction)
496
+	{
497
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
498
+		if (! $this->_gateway instanceof EE_Offsite_Gateway) {
499
+			throw new EE_Error(
500
+				sprintf(
501
+					__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"),
502
+					print_r($this->_gateway, true)
503
+				)
504
+			);
505
+		}
506
+		$payment = $this->_gateway->handle_payment_update($req_data, $transaction);
507
+		return $payment;
508
+	}
509
+
510
+
511
+	/**
512
+	 * Saves the billing info onto the attendee of the primary registrant on this transaction, and
513
+	 * cleans it first.
514
+	 *
515
+	 * @param EE_Billing_Attendee_Info_Form $billing_form
516
+	 * @param EE_Transaction                $transaction
517
+	 * @return boolean success
518
+	 */
519
+	protected function _save_billing_info_to_attendee($billing_form, $transaction)
520
+	{
521
+		if (! $transaction || ! $transaction instanceof EE_Transaction) {
522
+			EE_Error::add_error(
523
+				__("Cannot save billing info because no transaction was specified", "event_espresso"),
524
+				__FILE__,
525
+				__FUNCTION__,
526
+				__LINE__
527
+			);
528
+			return false;
529
+		}
530
+		$primary_reg = $transaction->primary_registration();
531
+		if (! $primary_reg) {
532
+			EE_Error::add_error(
533
+				__("Cannot save billing info because the transaction has no primary registration", "event_espresso"),
534
+				__FILE__,
535
+				__FUNCTION__,
536
+				__LINE__
537
+			);
538
+			return false;
539
+		}
540
+		$attendee = $primary_reg->attendee();
541
+		if (! $attendee) {
542
+			EE_Error::add_error(
543
+				__(
544
+					"Cannot save billing info because the transaction's primary registration has no attendee!",
545
+					"event_espresso"
546
+				),
547
+				__FILE__,
548
+				__FUNCTION__,
549
+				__LINE__
550
+			);
551
+			return false;
552
+		}
553
+		return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method());
554
+	}
555
+
556
+
557
+	/**
558
+	 * Gets the payment this IPN is for. Children may often want to
559
+	 * override this to inspect the request
560
+	 *
561
+	 * @param EE_Transaction $transaction
562
+	 * @param array          $req_data
563
+	 * @return EE_Payment
564
+	 */
565
+	protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array())
566
+	{
567
+		return $transaction->last_payment();
568
+	}
569
+
570
+
571
+	/**
572
+	 * In case generic code cannot provide the payment processor with a specific payment method
573
+	 * and transaction, it will try calling this method on each activate payment method.
574
+	 * If the payment method is able to identify the request as being for it, it should fetch
575
+	 * the payment its for and return it. If not, it should throw an EE_Error to indicate it cannot
576
+	 * handle the IPN
577
+	 *
578
+	 * @param array $req_data
579
+	 * @return EE_Payment only if this payment method can find the info its needs from $req_data
580
+	 * and identifies the IPN as being for this payment method (not just fo ra payment method of this type)
581
+	 * @throws EE_Error
582
+	 */
583
+	public function handle_unclaimed_ipn($req_data = array())
584
+	{
585
+		throw new EE_Error(
586
+			sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this))
587
+		);
588
+	}
589
+
590
+
591
+	/**
592
+	 * Logic to be accomplished when the payment attempt is complete.
593
+	 * Most payment methods don't need to do anything at this point; but some, like Mijireh, do.
594
+	 * (Mijireh is an offsite gateway which doesn't send an IPN. So when the user returns to EE from
595
+	 * mijireh, this method needs to be called so the Mijireh PM can ping Mijireh to know the status
596
+	 * of the payment). Fed a transaction because it's always assumed to be the last payment that
597
+	 * we're dealing with. Returns that last payment (if there is one)
598
+	 *
599
+	 * @param EE_Transaction $transaction
600
+	 * @return EE_Payment
601
+	 */
602
+	public function finalize_payment_for($transaction)
603
+	{
604
+		return $transaction->last_payment();
605
+	}
606
+
607
+
608
+	/**
609
+	 * Whether or not this payment method's gateway supports sending refund requests
610
+	 *
611
+	 * @return boolean
612
+	 */
613
+	public function supports_sending_refunds()
614
+	{
615
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
616
+			return $this->_gateway->supports_sending_refunds();
617
+		} else {
618
+			return false;
619
+		}
620
+	}
621
+
622
+
623
+	/**
624
+	 *
625
+	 * @param EE_Payment $payment
626
+	 * @param array      $refund_info
627
+	 * @throws EE_Error
628
+	 * @return EE_Payment
629
+	 */
630
+	public function process_refund(EE_Payment $payment, $refund_info = array())
631
+	{
632
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
633
+			return $this->_gateway->do_direct_refund($payment, $refund_info);
634
+		} else {
635
+			throw new EE_Error(
636
+				sprintf(
637
+					__('Payment Method Type "%s" does not support sending refund requests', 'event_espresso'),
638
+					get_class($this)
639
+				)
640
+			);
641
+		}
642
+	}
643
+
644
+
645
+	/**
646
+	 * Returns one the class's constants onsite,offsite, or offline, depending on this
647
+	 * payment method's gateway.
648
+	 *
649
+	 * @return string
650
+	 * @throws EE_Error
651
+	 */
652
+	public function payment_occurs()
653
+	{
654
+		if (! $this->_gateway) {
655
+			return EE_PMT_Base::offline;
656
+		} elseif ($this->_gateway instanceof EE_Onsite_Gateway) {
657
+			return EE_PMT_Base::onsite;
658
+		} elseif ($this->_gateway instanceof EE_Offsite_Gateway) {
659
+			return EE_PMT_Base::offsite;
660
+		} else {
661
+			throw new EE_Error(
662
+				sprintf(
663
+					__(
664
+						"Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those",
665
+						"event_espresso"
666
+					),
667
+					get_class($this)
668
+				)
669
+			);
670
+		}
671
+	}
672
+
673
+
674
+	/**
675
+	 * For adding any html output ab ove the payment overview.
676
+	 * Many gateways won't want ot display anything, so this function just returns an empty string.
677
+	 * Other gateways may want to override this, such as offline gateways.
678
+	 *
679
+	 * @param EE_Payment $payment
680
+	 * @return string
681
+	 */
682
+	public function payment_overview_content(EE_Payment $payment)
683
+	{
684
+		return EEH_Template::display_template(
685
+			EE_LIBRARIES . 'payment_methods' . DS . 'templates' . DS . 'payment_details_content.template.php',
686
+			array('payment_method' => $this->_pm_instance, 'payment' => $payment),
687
+			true
688
+		);
689
+	}
690
+
691
+
692
+	/**
693
+	 * @return array where keys are the help tab name,
694
+	 * values are: array {
695
+	 * @type string $title         i18n name for the help tab
696
+	 * @type string $filename      name of the file located in ./help_tabs/ (ie, in a folder next to this file)
697
+	 * @type array  $template_args any arguments you want passed to the template file while rendering.
698
+	 *                Keys will be variable names and values with be their values.
699
+	 */
700
+	public function help_tabs_config()
701
+	{
702
+		return array();
703
+	}
704
+
705
+
706
+	/**
707
+	 * The system name for this PMT (eg AIM, Paypal_Pro, Invoice... what gets put into
708
+	 * the payment method's table's PMT_type column)
709
+	 *
710
+	 * @return string
711
+	 */
712
+	public function system_name()
713
+	{
714
+		$classname = get_class($this);
715
+		return str_replace("EE_PMT_", '', $classname);
716
+	}
717
+
718
+
719
+	/**
720
+	 * A pretty i18n version of the PMT name. Often the same as the "pretty_name", but you can change it by overriding
721
+	 * this method.
722
+	 * @return string
723
+	 */
724
+	public function defaultFrontendName()
725
+	{
726
+		return $this->pretty_name();
727
+	}
728
+
729
+
730
+	/**
731
+	 * A pretty i18n version of the PMT name
732
+	 *
733
+	 * @return string
734
+	 */
735
+	public function pretty_name()
736
+	{
737
+		return $this->_pretty_name;
738
+	}
739
+
740
+
741
+	/**
742
+	 * Gets the default absolute URL to the payment method type's button
743
+	 *
744
+	 * @return string
745
+	 */
746
+	public function default_button_url()
747
+	{
748
+		return $this->_default_button_url;
749
+	}
750
+
751
+
752
+	/**
753
+	 * Gets the gateway used by this payment method (if any)
754
+	 *
755
+	 * @return EE_Gateway
756
+	 */
757
+	public function get_gateway()
758
+	{
759
+		return $this->_gateway;
760
+	}
761
+
762
+
763
+	/**
764
+	 * @return string html for the link to a help tab
765
+	 */
766
+	public function get_help_tab_link()
767
+	{
768
+		return EEH_Template::get_help_tab_link(
769
+			$this->get_help_tab_name(),
770
+			'espresso_payment_settings',
771
+			'default'
772
+		);
773
+	}
774
+
775
+
776
+	/**
777
+	 * Returns the name of the help tab for this PMT
778
+	 *
779
+	 * @return string
780
+	 */
781
+	public function get_help_tab_name()
782
+	{
783
+		return 'ee_' . strtolower($this->system_name()) . '_help_tab';
784
+	}
785
+
786
+	/**
787
+	 * The name of the wp capability that should be associated with the usage of
788
+	 * this PMT by an admin
789
+	 *
790
+	 * @return string
791
+	 */
792
+	public function cap_name()
793
+	{
794
+		return 'ee_payment_method_' . strtolower($this->system_name());
795
+	}
796
+
797
+	/**
798
+	 * Called by client code to tell the gateway that if it wants to change
799
+	 * the transaction or line items or registrations related to teh payment it already
800
+	 * processed (we think, but possibly not) that now's the time to do it.
801
+	 * It is expected that gateways will store any info they need for this on the PAY_details,
802
+	 * or maybe an extra meta value
803
+	 *
804
+	 * @param EE_Payment $payment
805
+	 * @return void
806
+	 */
807
+	public function update_txn_based_on_payment($payment)
808
+	{
809
+		if ($this->_gateway instanceof EE_Gateway) {
810
+			$this->_gateway->update_txn_based_on_payment($payment);
811
+		}
812
+	}
813
+
814
+	/**
815
+	 * Returns a string of HTML describing this payment method type for an admin,
816
+	 * primarily intended for them to read before activating it.
817
+	 * The easiest way to set this is to create a folder 'templates' alongside
818
+	 * your EE_PMT_{System_Name} file, and in it create a file named "{system_name}_intro.template.php".
819
+	 * Eg, if your payment method file is named "EE_PMT_Foo_Bar.pm.php",
820
+	 * then you'd create a file named "templates" in the same folder as it, and name the file
821
+	 * "foo_bar_intro.template.php", and its content will be returned by this method
822
+	 *
823
+	 * @return string
824
+	 */
825
+	public function introductory_html()
826
+	{
827
+		return EEH_Template::locate_template(
828
+			$this->file_folder() . 'templates' . DS . strtolower($this->system_name()) . '_intro.template.php',
829
+			array('pmt_obj' => $this, 'pm_instance' => $this->_pm_instance)
830
+		);
831
+	}
832 832
 }
Please login to merge, or discard this patch.
core/libraries/payment_methods/EE_Onsite_Gateway.lib.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -15,36 +15,36 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.