@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param array $options |
50 | 50 | * @return mixed |
51 | 51 | */ |
52 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
|
52 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) { |
|
53 | 53 | |
54 | 54 | $html = ''; |
55 | 55 | // set some default options and merge with incoming |
@@ -60,40 +60,40 @@ discard block |
||
60 | 60 | 'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr', |
61 | 61 | 'total_tr_css_class' => 'admin-primary-mbox-total-tr' |
62 | 62 | ); |
63 | - $options = array_merge( $default_options, (array)$options ); |
|
63 | + $options = array_merge($default_options, (array) $options); |
|
64 | 64 | |
65 | - switch( $line_item->type() ) { |
|
65 | + switch ($line_item->type()) { |
|
66 | 66 | |
67 | 67 | case EEM_Line_Item::type_line_item: |
68 | 68 | // item row |
69 | - $html .= $this->_item_row( $line_item, $options ); |
|
69 | + $html .= $this->_item_row($line_item, $options); |
|
70 | 70 | break; |
71 | 71 | |
72 | 72 | case EEM_Line_Item::type_sub_line_item: |
73 | - $html .= $this->_sub_item_row( $line_item, $options ); |
|
73 | + $html .= $this->_sub_item_row($line_item, $options); |
|
74 | 74 | break; |
75 | 75 | |
76 | 76 | case EEM_Line_Item::type_sub_total: |
77 | 77 | //loop through children |
78 | 78 | $child_line_items = $line_item->children(); |
79 | 79 | //loop through children |
80 | - foreach ( $child_line_items as $child_line_item ) { |
|
80 | + foreach ($child_line_items as $child_line_item) { |
|
81 | 81 | //recursively feed children back into this method |
82 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
82 | + $html .= $this->display_line_item($child_line_item, $options); |
|
83 | 83 | } |
84 | - $html .= $this->_sub_total_row( $line_item, $options ); |
|
84 | + $html .= $this->_sub_total_row($line_item, $options); |
|
85 | 85 | break; |
86 | 86 | |
87 | 87 | case EEM_Line_Item::type_tax: |
88 | - if ( $this->_show_taxes ) { |
|
89 | - $this->_taxes_html .= $this->_tax_row( $line_item, $options ); |
|
88 | + if ($this->_show_taxes) { |
|
89 | + $this->_taxes_html .= $this->_tax_row($line_item, $options); |
|
90 | 90 | } |
91 | 91 | break; |
92 | 92 | |
93 | 93 | case EEM_Line_Item::type_tax_sub_total: |
94 | - foreach( $line_item->children() as $child_line_item ) { |
|
95 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax ) { |
|
96 | - $this->display_line_item( $child_line_item, $options ); |
|
94 | + foreach ($line_item->children() as $child_line_item) { |
|
95 | + if ($child_line_item->type() == EEM_Line_Item::type_tax) { |
|
96 | + $this->display_line_item($child_line_item, $options); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | break; |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | $children = $line_item->children(); |
106 | 106 | |
107 | 107 | // loop thru all non-tax child line items |
108 | - foreach( $children as $child_line_item ) { |
|
109 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
108 | + foreach ($children as $child_line_item) { |
|
109 | + $html .= $this->display_line_item($child_line_item, $options); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $html .= $this->_taxes_html; |
113 | - $html .= $this->_total_row( $line_item, $options ); |
|
114 | - if ( $options['use_table_wrapper'] ) { |
|
115 | - $html = $this->_table_header( $options ) . $html . $this->_table_footer( $options ); |
|
113 | + $html .= $this->_total_row($line_item, $options); |
|
114 | + if ($options['use_table_wrapper']) { |
|
115 | + $html = $this->_table_header($options).$html.$this->_table_footer($options); |
|
116 | 116 | } |
117 | 117 | break; |
118 | 118 | |
@@ -129,15 +129,15 @@ discard block |
||
129 | 129 | * @param array $options |
130 | 130 | * @return string |
131 | 131 | */ |
132 | - protected function _table_header( $options ) { |
|
133 | - $html = EEH_HTML::table( '','', $options['table_css_class'] ); |
|
132 | + protected function _table_header($options) { |
|
133 | + $html = EEH_HTML::table('', '', $options['table_css_class']); |
|
134 | 134 | $html .= EEH_HTML::thead(); |
135 | 135 | $html .= EEH_HTML::tr(); |
136 | - $html .= EEH_HTML::th( __( 'Name', 'event_espresso' ), '', 'jst-left' ); |
|
137 | - $html .= EEH_HTML::th( __( 'Type', 'event_espresso'), '', 'jst-left' ); |
|
138 | - $html .= EEH_HTML::th( __( 'Amount', 'event_espresso' ), '', 'jst-cntr' ); |
|
139 | - $html .= EEH_HTML::th( __( 'Qty', 'event_espresso' ), '', 'jst-cntr' ); |
|
140 | - $html .= EEH_HTML::th( __( 'Line Total', 'event_espresso'), '', 'jst-cntr' ); |
|
136 | + $html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left'); |
|
137 | + $html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left'); |
|
138 | + $html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr'); |
|
139 | + $html .= EEH_HTML::th(__('Qty', 'event_espresso'), '', 'jst-cntr'); |
|
140 | + $html .= EEH_HTML::th(__('Line Total', 'event_espresso'), '', 'jst-cntr'); |
|
141 | 141 | $html .= EEH_HTML::tbody(); |
142 | 142 | return $html; |
143 | 143 | } |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | * @param array $options array of options for the table. |
150 | 150 | * @return string |
151 | 151 | */ |
152 | - protected function _table_footer( $options ) { |
|
153 | - return EEH_HTML::tbodyx() . EEH_HTML::tablex(); |
|
152 | + protected function _table_footer($options) { |
|
153 | + return EEH_HTML::tbodyx().EEH_HTML::tablex(); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -162,12 +162,12 @@ discard block |
||
162 | 162 | * @param array $options |
163 | 163 | * @return mixed |
164 | 164 | */ |
165 | - protected function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
165 | + protected function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
166 | 166 | $line_item_related_object = $line_item->get_object(); |
167 | 167 | $parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->get_object() : null; |
168 | 168 | // start of row |
169 | 169 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
170 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
170 | + $html = EEH_HTML::tr('', '', $row_class); |
|
171 | 171 | |
172 | 172 | |
173 | 173 | //Name Column |
@@ -175,44 +175,44 @@ discard block |
||
175 | 175 | |
176 | 176 | //related object scope. |
177 | 177 | $parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object ? $parent_line_item_related_object->name() : ''; |
178 | - $parent_related_object_name = empty( $parent_related_object_name ) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name; |
|
178 | + $parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name; |
|
179 | 179 | $parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links ? $parent_line_item_related_object->get_admin_details_link() : ''; |
180 | 180 | |
181 | 181 | |
182 | 182 | $name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name(); |
183 | - $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html; |
|
183 | + $name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' : $name_html; |
|
184 | 184 | $name_html .= $line_item->is_taxable() ? ' *' : ''; |
185 | 185 | //maybe preface with icon? |
186 | - $name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html; |
|
187 | - $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>'; |
|
188 | - $name_html .= sprintf( |
|
189 | - _x( '%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
|
186 | + $name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon().$name_html : $name_html; |
|
187 | + $name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>'; |
|
188 | + $name_html .= sprintf( |
|
189 | + _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
|
190 | 190 | '<span class="ee-line-item-related-parent-object">', |
191 | - $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __( 'Item:', 'event_espresso' ), |
|
192 | - $parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name, |
|
191 | + $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __('Item:', 'event_espresso'), |
|
192 | + $parent_related_object_link ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>' : $parent_related_object_name, |
|
193 | 193 | '</span>' |
194 | 194 | ); |
195 | - $html .= EEH_HTML::td( $name_html, '', 'jst-left' ); |
|
195 | + $html .= EEH_HTML::td($name_html, '', 'jst-left'); |
|
196 | 196 | |
197 | 197 | //Type Column |
198 | - $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() . '<br />' : ''; |
|
198 | + $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n().'<br />' : ''; |
|
199 | 199 | $code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : ''; |
200 | - $type_html .= ! empty( $code ) ? '<span class="ee-line-item-id">' . sprintf( __( 'Code: %s', 'event_espresso' ), $code ) . '</span>' : ''; |
|
201 | - $html .= EEH_HTML::td( $type_html, '', 'jst-left' ); |
|
200 | + $type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : ''; |
|
201 | + $html .= EEH_HTML::td($type_html, '', 'jst-left'); |
|
202 | 202 | |
203 | 203 | |
204 | 204 | //Amount Column |
205 | - if ( $line_item->is_percent() ) { |
|
206 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'jst-rght' ); |
|
205 | + if ($line_item->is_percent()) { |
|
206 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght'); |
|
207 | 207 | } else { |
208 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'jst-rght' ); |
|
208 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght'); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | //QTY column |
212 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'jst-rght' ); |
|
212 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'jst-rght'); |
|
213 | 213 | |
214 | 214 | //total column |
215 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' ); |
|
215 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
216 | 216 | |
217 | 217 | //finish things off and return |
218 | 218 | $html .= EEH_HTML::trx(); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * @param array $options |
229 | 229 | * @return mixed |
230 | 230 | */ |
231 | - protected function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
|
231 | + protected function _sub_item_row(EE_Line_Item $line_item, $options = array()) { |
|
232 | 232 | //for now we're not showing sub-items |
233 | 233 | return ''; |
234 | 234 | } |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | * @param array $options |
243 | 243 | * @return mixed |
244 | 244 | */ |
245 | - protected function _tax_row( EE_Line_Item $line_item, $options = array() ) { |
|
245 | + protected function _tax_row(EE_Line_Item $line_item, $options = array()) { |
|
246 | 246 | // start of row |
247 | - $html = EEH_HTML::tr( '', 'admin-primary-mbox-taxes-tr' ); |
|
247 | + $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr'); |
|
248 | 248 | // name th |
249 | - $html .= EEH_HTML::th( $line_item->name() . '(' . $line_item->get_pretty( 'LIN_percent' ) . '%)', '', 'jst-rght', '', ' colspan="4"' ); |
|
249 | + $html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="4"'); |
|
250 | 250 | // total th |
251 | - $html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' ); |
|
251 | + $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
252 | 252 | // end of row |
253 | 253 | $html .= EEH_HTML::trx(); |
254 | 254 | return $html; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * @param array $options |
266 | 266 | * @return mixed |
267 | 267 | */ |
268 | - protected function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) { |
|
268 | + protected function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) { |
|
269 | 269 | //currently not showing subtotal row |
270 | 270 | return ''; |
271 | 271 | } |
@@ -279,15 +279,15 @@ discard block |
||
279 | 279 | * @param array $options |
280 | 280 | * @return mixed |
281 | 281 | */ |
282 | - protected function _total_row( EE_Line_Item $line_item, $options = array() ) { |
|
282 | + protected function _total_row(EE_Line_Item $line_item, $options = array()) { |
|
283 | 283 | // start of row |
284 | - $html = EEH_HTML::tr( '', '', 'admin-primary-mbox-total-tr' ); |
|
284 | + $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr'); |
|
285 | 285 | // Total th label |
286 | - $total_label = sprintf( __( 'Transaction Total %s', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' ); |
|
287 | - $html .= EEH_HTML::th( $total_label, '', 'jst-rght', '', ' colspan="4"' ); |
|
286 | + $total_label = sprintf(__('Transaction Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')'); |
|
287 | + $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"'); |
|
288 | 288 | // total th |
289 | 289 | |
290 | - $html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' ); |
|
290 | + $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
291 | 291 | // end of row |
292 | 292 | $html .= EEH_HTML::trx(); |
293 | 293 | return $html; |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | /** |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | * @return EE_Payment |
21 | 21 | * @throws \EE_Error |
22 | 22 | */ |
23 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
24 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
25 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
23 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
24 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
25 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * @return EE_Payment |
35 | 35 | * @throws \EE_Error |
36 | 36 | */ |
37 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
38 | - return new self( $props_n_values, true, $timezone ); |
|
37 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
38 | + return new self($props_n_values, true, $timezone); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @param int $TXN_ID |
48 | 48 | * @throws \EE_Error |
49 | 49 | */ |
50 | - public function set_transaction_id( $TXN_ID = 0 ) { |
|
51 | - $this->set( 'TXN_ID', $TXN_ID ); |
|
50 | + public function set_transaction_id($TXN_ID = 0) { |
|
51 | + $this->set('TXN_ID', $TXN_ID); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @throws \EE_Error |
61 | 61 | */ |
62 | 62 | public function transaction() { |
63 | - return $this->get_first_related( 'Transaction' ); |
|
63 | + return $this->get_first_related('Transaction'); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * @param string $STS_ID |
73 | 73 | * @throws \EE_Error |
74 | 74 | */ |
75 | - public function set_status( $STS_ID = '' ) { |
|
76 | - $this->set( 'STS_ID', $STS_ID ); |
|
75 | + public function set_status($STS_ID = '') { |
|
76 | + $this->set('STS_ID', $STS_ID); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * @param int $timestamp |
86 | 86 | * @throws \EE_Error |
87 | 87 | */ |
88 | - public function set_timestamp( $timestamp = 0 ) { |
|
89 | - $this->set( 'PAY_timestamp', $timestamp ); |
|
88 | + public function set_timestamp($timestamp = 0) { |
|
89 | + $this->set('PAY_timestamp', $timestamp); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | * @param string $PAY_source |
99 | 99 | * @throws \EE_Error |
100 | 100 | */ |
101 | - public function set_source( $PAY_source = '' ) { |
|
102 | - $this->set( 'PAY_source', $PAY_source ); |
|
101 | + public function set_source($PAY_source = '') { |
|
102 | + $this->set('PAY_source', $PAY_source); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | * @param float $amount |
112 | 112 | * @throws \EE_Error |
113 | 113 | */ |
114 | - public function set_amount( $amount = 0.00 ) { |
|
115 | - $this->set( 'PAY_amount', (float)$amount ); |
|
114 | + public function set_amount($amount = 0.00) { |
|
115 | + $this->set('PAY_amount', (float) $amount); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | * @param string $gateway_response |
125 | 125 | * @throws \EE_Error |
126 | 126 | */ |
127 | - public function set_gateway_response( $gateway_response = '' ) { |
|
128 | - $this->set( 'PAY_gateway_response', $gateway_response ); |
|
127 | + public function set_gateway_response($gateway_response = '') { |
|
128 | + $this->set('PAY_gateway_response', $gateway_response); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | ), |
149 | 149 | '4.6.0' |
150 | 150 | ); |
151 | - return $this->payment_method() ? $this->payment_method()->name() : __( 'Unknown', 'event_espresso' ); |
|
151 | + return $this->payment_method() ? $this->payment_method()->name() : __('Unknown', 'event_espresso'); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | * @param string $txn_id_chq_nmbr |
161 | 161 | * @throws \EE_Error |
162 | 162 | */ |
163 | - public function set_txn_id_chq_nmbr( $txn_id_chq_nmbr = '' ) { |
|
164 | - $this->set( 'PAY_txn_id_chq_nmbr', $txn_id_chq_nmbr ); |
|
163 | + public function set_txn_id_chq_nmbr($txn_id_chq_nmbr = '') { |
|
164 | + $this->set('PAY_txn_id_chq_nmbr', $txn_id_chq_nmbr); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param string $po_number |
174 | 174 | * @throws \EE_Error |
175 | 175 | */ |
176 | - public function set_po_number( $po_number = '' ) { |
|
177 | - $this->set( 'PAY_po_number', $po_number ); |
|
176 | + public function set_po_number($po_number = '') { |
|
177 | + $this->set('PAY_po_number', $po_number); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * @param string $extra_accntng |
187 | 187 | * @throws \EE_Error |
188 | 188 | */ |
189 | - public function set_extra_accntng( $extra_accntng = '' ) { |
|
190 | - $this->set( 'PAY_extra_accntng', $extra_accntng ); |
|
189 | + public function set_extra_accntng($extra_accntng = '') { |
|
190 | + $this->set('PAY_extra_accntng', $extra_accntng); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | * @param bool $via_admin |
200 | 200 | * @throws \EE_Error |
201 | 201 | */ |
202 | - public function set_payment_made_via_admin( $via_admin = false ) { |
|
203 | - if ( $via_admin ) { |
|
204 | - $this->set( 'PAY_source', EEM_Payment_Method::scope_admin ); |
|
202 | + public function set_payment_made_via_admin($via_admin = false) { |
|
203 | + if ($via_admin) { |
|
204 | + $this->set('PAY_source', EEM_Payment_Method::scope_admin); |
|
205 | 205 | } else { |
206 | - $this->set( 'PAY_source', EEM_Payment_Method::scope_cart ); |
|
206 | + $this->set('PAY_source', EEM_Payment_Method::scope_cart); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | * @param string|array $details |
217 | 217 | * @throws \EE_Error |
218 | 218 | */ |
219 | - public function set_details( $details = '' ) { |
|
220 | - if ( is_array( $details ) ) { |
|
221 | - array_walk_recursive( $details, array( $this, '_strip_all_tags_within_array' ) ); |
|
219 | + public function set_details($details = '') { |
|
220 | + if (is_array($details)) { |
|
221 | + array_walk_recursive($details, array($this, '_strip_all_tags_within_array')); |
|
222 | 222 | } else { |
223 | - $details = wp_strip_all_tags( $details ); |
|
223 | + $details = wp_strip_all_tags($details); |
|
224 | 224 | } |
225 | - $this->set( 'PAY_details', $details ); |
|
225 | + $this->set('PAY_details', $details); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | * @param string $redirect_url |
234 | 234 | * @throws \EE_Error |
235 | 235 | */ |
236 | - public function set_redirect_url( $redirect_url ) { |
|
237 | - $this->set( 'PAY_redirect_url', $redirect_url ); |
|
236 | + public function set_redirect_url($redirect_url) { |
|
237 | + $this->set('PAY_redirect_url', $redirect_url); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | * @param array $redirect_args |
246 | 246 | * @throws \EE_Error |
247 | 247 | */ |
248 | - public function set_redirect_args( $redirect_args ) { |
|
249 | - $this->set( 'PAY_redirect_args', $redirect_args ); |
|
248 | + public function set_redirect_args($redirect_args) { |
|
249 | + $this->set('PAY_redirect_args', $redirect_args); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @throws \EE_Error |
259 | 259 | */ |
260 | 260 | public function TXN_ID() { |
261 | - return $this->get( 'TXN_ID' ); |
|
261 | + return $this->get('TXN_ID'); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @throws \EE_Error |
271 | 271 | */ |
272 | 272 | public function status() { |
273 | - return $this->get( 'STS_ID' ); |
|
273 | + return $this->get('STS_ID'); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @throws \EE_Error |
283 | 283 | */ |
284 | 284 | public function STS_ID() { |
285 | - return $this->get( 'STS_ID' ); |
|
285 | + return $this->get('STS_ID'); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -296,8 +296,8 @@ discard block |
||
296 | 296 | * @return string |
297 | 297 | * @throws \EE_Error |
298 | 298 | */ |
299 | - public function timestamp( $dt_frmt = '', $tm_frmt = '' ) { |
|
300 | - return $this->get_i18n_datetime( 'PAY_timestamp', trim( $dt_frmt . ' ' . $tm_frmt) ); |
|
299 | + public function timestamp($dt_frmt = '', $tm_frmt = '') { |
|
300 | + return $this->get_i18n_datetime('PAY_timestamp', trim($dt_frmt.' '.$tm_frmt)); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @throws \EE_Error |
310 | 310 | */ |
311 | 311 | public function source() { |
312 | - return $this->get( 'PAY_source' ); |
|
312 | + return $this->get('PAY_source'); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * @throws \EE_Error |
323 | 323 | */ |
324 | 324 | public function amount() { |
325 | - return (float)$this->get( 'PAY_amount' ); |
|
325 | + return (float) $this->get('PAY_amount'); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @throws \EE_Error |
333 | 333 | */ |
334 | 334 | public function amount_no_code() { |
335 | - return $this->get_pretty( 'PAY_amount', 'no_currency_code' ); |
|
335 | + return $this->get_pretty('PAY_amount', 'no_currency_code'); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | * @throws \EE_Error |
345 | 345 | */ |
346 | 346 | public function gateway_response() { |
347 | - return $this->get( 'PAY_gateway_response' ); |
|
347 | + return $this->get('PAY_gateway_response'); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * @throws \EE_Error |
357 | 357 | */ |
358 | 358 | public function txn_id_chq_nmbr() { |
359 | - return $this->get( 'PAY_txn_id_chq_nmbr' ); |
|
359 | + return $this->get('PAY_txn_id_chq_nmbr'); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * @throws \EE_Error |
369 | 369 | */ |
370 | 370 | public function po_number() { |
371 | - return $this->get( 'PAY_po_number' ); |
|
371 | + return $this->get('PAY_po_number'); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | * @throws \EE_Error |
381 | 381 | */ |
382 | 382 | public function extra_accntng() { |
383 | - return $this->get( 'PAY_extra_accntng' ); |
|
383 | + return $this->get('PAY_extra_accntng'); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | * @throws \EE_Error |
393 | 393 | */ |
394 | 394 | public function payment_made_via_admin() { |
395 | - return ( $this->get( 'PAY_source' ) === EEM_Payment_Method::scope_admin ); |
|
395 | + return ($this->get('PAY_source') === EEM_Payment_Method::scope_admin); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | * @throws \EE_Error |
405 | 405 | */ |
406 | 406 | public function details() { |
407 | - return $this->get( 'PAY_details' ); |
|
407 | + return $this->get('PAY_details'); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | * @throws \EE_Error |
417 | 417 | */ |
418 | 418 | public function redirect_url() { |
419 | - return $this->get( 'PAY_redirect_url' ); |
|
419 | + return $this->get('PAY_redirect_url'); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | * @throws \EE_Error |
429 | 429 | */ |
430 | 430 | public function redirect_args() { |
431 | - return $this->get( 'PAY_redirect_args' ); |
|
431 | + return $this->get('PAY_redirect_args'); |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | |
@@ -440,8 +440,8 @@ discard block |
||
440 | 440 | * @return void |
441 | 441 | * @throws \EE_Error |
442 | 442 | */ |
443 | - public function e_pretty_status( $show_icons = false ) { |
|
444 | - echo $this->pretty_status( $show_icons ); |
|
443 | + public function e_pretty_status($show_icons = false) { |
|
444 | + echo $this->pretty_status($show_icons); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | |
@@ -453,14 +453,14 @@ discard block |
||
453 | 453 | * @return string |
454 | 454 | * @throws \EE_Error |
455 | 455 | */ |
456 | - public function pretty_status( $show_icons = false ) { |
|
456 | + public function pretty_status($show_icons = false) { |
|
457 | 457 | $status = EEM_Status::instance()->localized_status( |
458 | - array( $this->STS_ID() => __( 'unknown', 'event_espresso' ) ), |
|
458 | + array($this->STS_ID() => __('unknown', 'event_espresso')), |
|
459 | 459 | false, |
460 | 460 | 'sentence' |
461 | 461 | ); |
462 | 462 | $icon = ''; |
463 | - switch ( $this->STS_ID() ) { |
|
463 | + switch ($this->STS_ID()) { |
|
464 | 464 | case EEM_Payment::status_id_approved: |
465 | 465 | $icon = $show_icons |
466 | 466 | ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | : ''; |
483 | 483 | break; |
484 | 484 | } |
485 | - return $icon . $status[ $this->STS_ID() ]; |
|
485 | + return $icon.$status[$this->STS_ID()]; |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | * @throws \EE_Error |
495 | 495 | */ |
496 | 496 | public function is_approved() { |
497 | - return $this->status_is( EEM_Payment::status_id_approved ); |
|
497 | + return $this->status_is(EEM_Payment::status_id_approved); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * @return boolean whether the status of this payment equals the status id |
509 | 509 | * @throws \EE_Error |
510 | 510 | */ |
511 | - protected function status_is( $STS_ID ) { |
|
511 | + protected function status_is($STS_ID) { |
|
512 | 512 | return $STS_ID === $this->STS_ID() ? true : false; |
513 | 513 | } |
514 | 514 | |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | * @throws \EE_Error |
522 | 522 | */ |
523 | 523 | public function is_pending() { |
524 | - return $this->status_is( EEM_Payment::status_id_pending ); |
|
524 | + return $this->status_is(EEM_Payment::status_id_pending); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | * @throws \EE_Error |
534 | 534 | */ |
535 | 535 | public function is_cancelled() { |
536 | - return $this->status_is( EEM_Payment::status_id_cancelled ); |
|
536 | + return $this->status_is(EEM_Payment::status_id_cancelled); |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | * @throws \EE_Error |
546 | 546 | */ |
547 | 547 | public function is_declined() { |
548 | - return $this->status_is( EEM_Payment::status_id_declined ); |
|
548 | + return $this->status_is(EEM_Payment::status_id_declined); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | * @throws \EE_Error |
558 | 558 | */ |
559 | 559 | public function is_failed() { |
560 | - return $this->status_is( EEM_Payment::status_id_failed ); |
|
560 | + return $this->status_is(EEM_Payment::status_id_failed); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | * @throws \EE_Error |
582 | 582 | */ |
583 | 583 | public function status_obj() { |
584 | - return $this->get_first_related( 'Status' ); |
|
584 | + return $this->get_first_related('Status'); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | |
@@ -593,8 +593,8 @@ discard block |
||
593 | 593 | * @return EE_Extra_Meta |
594 | 594 | * @throws \EE_Error |
595 | 595 | */ |
596 | - public function extra_meta( $query_params = array() ) { |
|
597 | - return $this->get_many_related( 'Extra_Meta', $query_params ); |
|
596 | + public function extra_meta($query_params = array()) { |
|
597 | + return $this->get_many_related('Extra_Meta', $query_params); |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | * @throws \EE_Error |
609 | 609 | */ |
610 | 610 | public function payment_method() { |
611 | - return $this->get_first_related( 'Payment_Method' ); |
|
611 | + return $this->get_first_related('Payment_Method'); |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | |
@@ -626,18 +626,18 @@ discard block |
||
626 | 626 | * @return string html |
627 | 627 | * @throws \EE_Error |
628 | 628 | */ |
629 | - public function redirect_form( $inside_form_html = null ) { |
|
629 | + public function redirect_form($inside_form_html = null) { |
|
630 | 630 | $redirect_url = $this->redirect_url(); |
631 | - if ( ! empty( $redirect_url ) ) { |
|
631 | + if ( ! empty($redirect_url)) { |
|
632 | 632 | // what ? no inner form content? |
633 | - if ( $inside_form_html === null ) { |
|
633 | + if ($inside_form_html === null) { |
|
634 | 634 | $inside_form_html = EEH_HTML::p( |
635 | 635 | sprintf( |
636 | 636 | __( |
637 | 637 | 'If you are not automatically redirected to the payment website within 10 seconds... %1$s %2$s Click Here %3$s', |
638 | 638 | 'event_espresso' |
639 | 639 | ), |
640 | - EEH_HTML::br( 2 ), |
|
640 | + EEH_HTML::br(2), |
|
641 | 641 | '<input type="submit" value="', |
642 | 642 | '">' |
643 | 643 | ), |
@@ -653,22 +653,22 @@ discard block |
||
653 | 653 | ); |
654 | 654 | //if it's a GET request, we need to remove all the GET params in the querystring |
655 | 655 | //and put them into the form instead |
656 | - if ( $method === 'GET' ) { |
|
657 | - $querystring = parse_url( $redirect_url, PHP_URL_QUERY ); |
|
656 | + if ($method === 'GET') { |
|
657 | + $querystring = parse_url($redirect_url, PHP_URL_QUERY); |
|
658 | 658 | $get_params = null; |
659 | - parse_str( $querystring, $get_params ); |
|
660 | - $inside_form_html .= $this->_args_as_inputs( $get_params ); |
|
661 | - $redirect_url = str_replace( '?' . $querystring, '', $redirect_url ); |
|
659 | + parse_str($querystring, $get_params); |
|
660 | + $inside_form_html .= $this->_args_as_inputs($get_params); |
|
661 | + $redirect_url = str_replace('?'.$querystring, '', $redirect_url); |
|
662 | 662 | } |
663 | - $form = EEH_HTML::nl( 1 ) |
|
663 | + $form = EEH_HTML::nl(1) |
|
664 | 664 | . '<form method="' |
665 | 665 | . $method |
666 | 666 | . '" name="gateway_form" action="' |
667 | 667 | . $redirect_url |
668 | 668 | . '">'; |
669 | - $form .= EEH_HTML::nl( 1 ) . $this->redirect_args_as_inputs(); |
|
669 | + $form .= EEH_HTML::nl(1).$this->redirect_args_as_inputs(); |
|
670 | 670 | $form .= $inside_form_html; |
671 | - $form .= EEH_HTML::nl( -1 ) . '</form>' . EEH_HTML::nl( -1 ); |
|
671 | + $form .= EEH_HTML::nl( -1 ).'</form>'.EEH_HTML::nl( -1 ); |
|
672 | 672 | return $form; |
673 | 673 | } else { |
674 | 674 | return null; |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | * @throws \EE_Error |
686 | 686 | */ |
687 | 687 | public function redirect_args_as_inputs() { |
688 | - return $this->_args_as_inputs( $this->redirect_args() ); |
|
688 | + return $this->_args_as_inputs($this->redirect_args()); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | |
@@ -697,15 +697,15 @@ discard block |
||
697 | 697 | * @param array $args key-value pairs |
698 | 698 | * @return string |
699 | 699 | */ |
700 | - protected function _args_as_inputs( $args ) { |
|
700 | + protected function _args_as_inputs($args) { |
|
701 | 701 | $html = ''; |
702 | - if ( $args !== null && is_array( $args ) ) { |
|
703 | - foreach ( $args as $name => $value ) { |
|
704 | - $html .= EEH_HTML::nl( 0 ) |
|
702 | + if ($args !== null && is_array($args)) { |
|
703 | + foreach ($args as $name => $value) { |
|
704 | + $html .= EEH_HTML::nl(0) |
|
705 | 705 | . '<input type="hidden" name="' |
706 | 706 | . $name |
707 | 707 | . '" value="' |
708 | - . esc_attr( $value ) |
|
708 | + . esc_attr($value) |
|
709 | 709 | . '"/>'; |
710 | 710 | } |
711 | 711 | } |
@@ -734,14 +734,14 @@ discard block |
||
734 | 734 | * @access private |
735 | 735 | * @param mixed $item |
736 | 736 | */ |
737 | - private function _strip_all_tags_within_array( &$item ) { |
|
738 | - if ( is_object( $item ) ) { |
|
739 | - $item = (array)$item; |
|
737 | + private function _strip_all_tags_within_array(&$item) { |
|
738 | + if (is_object($item)) { |
|
739 | + $item = (array) $item; |
|
740 | 740 | } |
741 | - if ( is_array( $item ) ) { |
|
742 | - array_walk_recursive( $item, array( $this, '_strip_all_tags_within_array' ) ); |
|
741 | + if (is_array($item)) { |
|
742 | + array_walk_recursive($item, array($this, '_strip_all_tags_within_array')); |
|
743 | 743 | } else { |
744 | - $item = wp_strip_all_tags( $item ); |
|
744 | + $item = wp_strip_all_tags($item); |
|
745 | 745 | } |
746 | 746 | } |
747 | 747 | |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | $original_status = EEH_Array::is_set( |
759 | 759 | $this->_props_n_values_provided_in_constructor, |
760 | 760 | 'STS_ID', |
761 | - $this->get_model()->field_settings_for( 'STS_ID' )->get_default_value() |
|
761 | + $this->get_model()->field_settings_for('STS_ID')->get_default_value() |
|
762 | 762 | ); |
763 | 763 | $current_status = $this->status(); |
764 | 764 | if ( |
@@ -784,11 +784,11 @@ discard block |
||
784 | 784 | * @return mixed |
785 | 785 | * @throws \EE_Error |
786 | 786 | */ |
787 | - public function get_pretty( $field_name, $extra_cache_ref = null ) { |
|
788 | - if ( $field_name === 'PAY_gateway' ) { |
|
789 | - return $this->payment_method() ? $this->payment_method()->name() : __( 'Unknown', 'event_espresso' ); |
|
787 | + public function get_pretty($field_name, $extra_cache_ref = null) { |
|
788 | + if ($field_name === 'PAY_gateway') { |
|
789 | + return $this->payment_method() ? $this->payment_method()->name() : __('Unknown', 'event_espresso'); |
|
790 | 790 | } |
791 | - return $this->_get_cached_property( $field_name, true, $extra_cache_ref ); |
|
791 | + return $this->_get_cached_property($field_name, true, $extra_cache_ref); |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | |
@@ -800,8 +800,8 @@ discard block |
||
800 | 800 | * @return EE_Registration_Payment[] |
801 | 801 | * @throws \EE_Error |
802 | 802 | */ |
803 | - public function registration_payments( $query_params = array() ) { |
|
804 | - return $this->get_many_related( 'Registration_Payment', $query_params ); |
|
803 | + public function registration_payments($query_params = array()) { |
|
804 | + return $this->get_many_related('Registration_Payment', $query_params); |
|
805 | 805 | } |
806 | 806 | |
807 | 807 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * @param bool $routing |
43 | 43 | * @return \Extend_Transactions_Admin_Page |
44 | 44 | */ |
45 | - public function __construct( $routing = TRUE ) { |
|
46 | - parent::__construct( $routing ); |
|
47 | - define( 'TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/templates/'); |
|
48 | - define( 'TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/assets/'); |
|
49 | - define( 'TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'transactions/assets/'); |
|
45 | + public function __construct($routing = TRUE) { |
|
46 | + parent::__construct($routing); |
|
47 | + define('TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'transactions/templates/'); |
|
48 | + define('TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'transactions/assets/'); |
|
49 | + define('TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'transactions/assets/'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @return void |
59 | 59 | */ |
60 | 60 | protected function _extend_page_config() { |
61 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'transactions'; |
|
61 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'transactions'; |
|
62 | 62 | |
63 | 63 | $new_page_routes = array( |
64 | 64 | 'reports' => array( |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | ) |
68 | 68 | ); |
69 | 69 | |
70 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
70 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
71 | 71 | |
72 | 72 | $new_page_config = array( |
73 | 73 | 'reports' => array( |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | 'require_nonce' => FALSE |
86 | 86 | ) |
87 | 87 | ); |
88 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
88 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * @return void |
98 | 98 | */ |
99 | 99 | public function load_scripts_styles_reports() { |
100 | - wp_register_script( 'ee-txn-reports-js', TXN_CAF_ASSETS_URL . 'ee-transaction-admin-reports.js', array( 'google-charts' ), EVENT_ESPRESSO_VERSION, true ); |
|
101 | - wp_enqueue_script( 'ee-txn-reports-js' ); |
|
100 | + wp_register_script('ee-txn-reports-js', TXN_CAF_ASSETS_URL.'ee-transaction-admin-reports.js', array('google-charts'), EVENT_ESPRESSO_VERSION, true); |
|
101 | + wp_enqueue_script('ee-txn-reports-js'); |
|
102 | 102 | $this->_transaction_reports_js_setup(); |
103 | 103 | EE_Registry::$i18n_js_strings['currency_format'] = EEH_Money::get_format_for_google_charts(); |
104 | 104 | } |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @return void |
126 | 126 | */ |
127 | 127 | protected function _transaction_reports() { |
128 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
128 | + $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php'; |
|
129 | 129 | $this->_admin_page_title = __('Transactions', 'event_espresso'); |
130 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_reports_template_data, TRUE ); |
|
130 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_reports_template_data, TRUE); |
|
131 | 131 | |
132 | 132 | // the final template wrapper |
133 | 133 | $this->display_admin_page_with_no_sidebar(); |
@@ -142,42 +142,42 @@ discard block |
||
142 | 142 | * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated. |
143 | 143 | * @return string |
144 | 144 | */ |
145 | - private function _revenue_per_day_report( $period = '-1 month' ) { |
|
145 | + private function _revenue_per_day_report($period = '-1 month') { |
|
146 | 146 | |
147 | 147 | $report_ID = 'txn-admin-revenue-per-day-report-dv'; |
148 | 148 | |
149 | 149 | $TXN = EEM_Transaction::instance(); |
150 | 150 | |
151 | - $results = $TXN->get_revenue_per_day_report( $period ); |
|
151 | + $results = $TXN->get_revenue_per_day_report($period); |
|
152 | 152 | $results = (array) $results; |
153 | 153 | $revenue = array(); |
154 | 154 | $subtitle = ''; |
155 | 155 | |
156 | - if ( $results ) { |
|
157 | - $revenue[] = array( __( 'Date (only shows dates that have a revenue greater than 1)', 'event_espresso' ), __( 'Total Revenue', 'event_espresso' ) ); |
|
158 | - foreach ( $results as $result ) { |
|
159 | - if ( $result->revenue > 1 ) { |
|
160 | - $revenue[] = array( $result->txnDate, (float) $result->revenue ); |
|
156 | + if ($results) { |
|
157 | + $revenue[] = array(__('Date (only shows dates that have a revenue greater than 1)', 'event_espresso'), __('Total Revenue', 'event_espresso')); |
|
158 | + foreach ($results as $result) { |
|
159 | + if ($result->revenue > 1) { |
|
160 | + $revenue[] = array($result->txnDate, (float) $result->revenue); |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | 164 | //setup the date range. |
165 | - $beginning_date = new DateTime( 'now' . $period, new DateTimeZone( EEH_DTT_Helper::get_timezone() ) ); |
|
166 | - $ending_date = new DateTime( 'now', new DateTimeZone( EEH_DTT_Helper::get_timezone() ) ); |
|
167 | - $subtitle = sprintf( _x( 'For the period: %s to %s', 'Used to give date range', 'event_espresso' ), $beginning_date->format( 'Y-m-d' ), $ending_date->format( 'Y-m-d' ) ); |
|
165 | + $beginning_date = new DateTime('now'.$period, new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
166 | + $ending_date = new DateTime('now', new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
167 | + $subtitle = sprintf(_x('For the period: %s to %s', 'Used to give date range', 'event_espresso'), $beginning_date->format('Y-m-d'), $ending_date->format('Y-m-d')); |
|
168 | 168 | } |
169 | 169 | |
170 | - $report_title = esc_html__( 'Total Revenue per Day', 'event_espresso' ); |
|
170 | + $report_title = esc_html__('Total Revenue per Day', 'event_espresso'); |
|
171 | 171 | |
172 | 172 | $report_params = array( |
173 | 173 | 'title' => $report_title, |
174 | 174 | 'subtitle' => $subtitle, |
175 | 175 | 'id' => $report_ID, |
176 | 176 | 'revenue' => $revenue, |
177 | - 'noResults' => empty( $revenue ), |
|
178 | - 'noTxnMsg' => sprintf( __( '%sThere are currently no transaction records in the last month for this report.%s', 'event_espresso' ), '<h2>' . $report_title . '</h2><p>', '</p>' ) |
|
177 | + 'noResults' => empty($revenue), |
|
178 | + 'noTxnMsg' => sprintf(__('%sThere are currently no transaction records in the last month for this report.%s', 'event_espresso'), '<h2>'.$report_title.'</h2><p>', '</p>') |
|
179 | 179 | ); |
180 | - wp_localize_script( 'ee-txn-reports-js', 'txnRevPerDay', $report_params ); |
|
180 | + wp_localize_script('ee-txn-reports-js', 'txnRevPerDay', $report_params); |
|
181 | 181 | |
182 | 182 | return $report_ID; |
183 | 183 | } |
@@ -191,43 +191,43 @@ discard block |
||
191 | 191 | * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated. |
192 | 192 | * @return int |
193 | 193 | */ |
194 | - private function _revenue_per_event_report( $period = '-1 month' ) { |
|
194 | + private function _revenue_per_event_report($period = '-1 month') { |
|
195 | 195 | |
196 | 196 | $report_ID = 'txn-admin-revenue-per-event-report-dv'; |
197 | 197 | |
198 | 198 | $TXN = EEM_Transaction::instance(); |
199 | - $results = $TXN->get_revenue_per_event_report( $period ); |
|
199 | + $results = $TXN->get_revenue_per_event_report($period); |
|
200 | 200 | $results = (array) $results; |
201 | 201 | $revenue = array(); |
202 | 202 | $subtitle = ''; |
203 | 203 | |
204 | - if ( $results ) { |
|
205 | - $revenue[] = array( __( 'Event (only events that have a revenue greater than 1 are shown)', 'event_espresso' ), __( 'Total Revenue', 'event_espresso' ) ); |
|
206 | - foreach ( $results as $result ) { |
|
207 | - if ( $result->revenue > 1 ) { |
|
208 | - $event_name = stripslashes( html_entity_decode( $result->event_name, ENT_QUOTES, 'UTF-8' ) ); |
|
209 | - $event_name = wp_trim_words( $event_name, 5, '...' ); |
|
210 | - $revenue[] = array( $event_name, (float) $result->revenue ); |
|
204 | + if ($results) { |
|
205 | + $revenue[] = array(__('Event (only events that have a revenue greater than 1 are shown)', 'event_espresso'), __('Total Revenue', 'event_espresso')); |
|
206 | + foreach ($results as $result) { |
|
207 | + if ($result->revenue > 1) { |
|
208 | + $event_name = stripslashes(html_entity_decode($result->event_name, ENT_QUOTES, 'UTF-8')); |
|
209 | + $event_name = wp_trim_words($event_name, 5, '...'); |
|
210 | + $revenue[] = array($event_name, (float) $result->revenue); |
|
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
214 | 214 | //setup the date range. |
215 | - $beginning_date = new DateTime( 'now' . $period, new DateTimeZone( EEH_DTT_Helper::get_timezone() ) ); |
|
216 | - $ending_date = new DateTime( 'now', new DateTimeZone( EEH_DTT_Helper::get_timezone() ) ); |
|
217 | - $subtitle = sprintf( _x( 'For the period: %s to %s', 'Used to give date range', 'event_espresso' ), $beginning_date->format( 'Y-m-d' ), $ending_date->format( 'Y-m-d' ) ); |
|
215 | + $beginning_date = new DateTime('now'.$period, new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
216 | + $ending_date = new DateTime('now', new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
217 | + $subtitle = sprintf(_x('For the period: %s to %s', 'Used to give date range', 'event_espresso'), $beginning_date->format('Y-m-d'), $ending_date->format('Y-m-d')); |
|
218 | 218 | } |
219 | 219 | |
220 | - $report_title = esc_html__( 'Total Revenue per Event', 'event_espresso' ); |
|
220 | + $report_title = esc_html__('Total Revenue per Event', 'event_espresso'); |
|
221 | 221 | |
222 | 222 | $report_params = array( |
223 | 223 | 'title' => $report_title, |
224 | 224 | 'subtitle' => $subtitle, |
225 | 225 | 'id' => $report_ID, |
226 | 226 | 'revenue' => $revenue, |
227 | - 'noResults' => empty( $revenue ), |
|
228 | - 'noTxnMsg' => sprintf( __( '%sThere are currently no transaction records in the last month for this report.%s', 'event_espresso' ), '<h2>' . $report_title . '</h2><p>', '</p>' ) |
|
227 | + 'noResults' => empty($revenue), |
|
228 | + 'noTxnMsg' => sprintf(__('%sThere are currently no transaction records in the last month for this report.%s', 'event_espresso'), '<h2>'.$report_title.'</h2><p>', '</p>') |
|
229 | 229 | ); |
230 | - wp_localize_script( 'ee-txn-reports-js', 'txnRevPerEvent', $report_params ); |
|
230 | + wp_localize_script('ee-txn-reports-js', 'txnRevPerEvent', $report_params); |
|
231 | 231 | |
232 | 232 | return $report_ID; |
233 | 233 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | </table> |
52 | 52 | <div class="ee-editor-footer-container"> |
53 | 53 | <div class="ee-editor-id-container"> |
54 | - <span class="ee-item-id"><?php echo $DTT_ID ? sprintf( esc_html__( 'Datetime ID: %d', 'event_espresso' ), $DTT_ID ) : ''; ?></span> |
|
54 | + <span class="ee-item-id"><?php echo $DTT_ID ? sprintf(esc_html__('Datetime ID: %d', 'event_espresso'), $DTT_ID) : ''; ?></span> |
|
55 | 55 | </div> |
56 | 56 | <div class="save-cancel-button-container"> |
57 | 57 | <button data-context="short-ticket" data-datetime-row="<?php echo $dtt_row; ?>" class="button-primary ee-create-button"> |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | <td class="ee-tkt-order-field"><span class="ee-status-strip-td ee-status-strip<?php echo $tkt_status_class; ?>"></span><input type="hidden" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_order]" class="edit-ticket-TKT_order" value ="<?php echo $TKT_order; ?>"></td> |
4 | 4 | <td><input maxlength="245" type="text" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_name]" class="edit-ticket-TKT_name ee-large-text-inp" placeholder="Ticket Title" value="<?php echo $TKT_name; ?>"></td> |
5 | 5 | <td> |
6 | - <?php if ( $disabled ) : ?> |
|
6 | + <?php if ($disabled) : ?> |
|
7 | 7 | <input type="hidden" id="edit-ticket-TKT_start_date-<?php echo $tkt_row; ?>" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_start_date]" class="edit-ticket-TKT_start_date ee-text-inp" value="<?php echo $TKT_start_date; ?>" > |
8 | 8 | <input type="text" name="archived_ticket[TKT_start_date]" class="edit-ticket-TKT_start_date ee-text-inp" value="<?php echo $TKT_start_date; ?>" disabled> |
9 | 9 | <?php else : ?> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | <?php endif; ?> |
12 | 12 | </td> |
13 | 13 | <td> |
14 | - <?php if ( $disabled ) : ?> |
|
14 | + <?php if ($disabled) : ?> |
|
15 | 15 | <input type="hidden" id="edit-ticket-TKT_end_date-<?php echo $tkt_row; ?>" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_end_date]" class="edit-ticket-TKT_end_date ee-text-inp" value="<?php echo $TKT_end_date; ?>" > |
16 | 16 | <input type="text" name="archived_ticket[TKT_end_date]" class="edit-ticket-TKT_end_date ee-text-inp" value="<?php echo $TKT_end_date; ?>" disabled> |
17 | 17 | <?php else : ?> |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | <?php endif; ?> |
20 | 20 | </td> |
21 | 21 | <td> |
22 | - <?php if ( $disabled ) : ?> |
|
22 | + <?php if ($disabled) : ?> |
|
23 | 23 | <input id="edit-ticket-TKT_base_price-<?php echo $tkt_row; ?>" type="hidden" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_base_price]" class="edit-ticket-TKT_base_price ee-small-text-inp edit-price-PRC_amount ee-numeric" value="<?php echo $TKT_base_price; ?>"> |
24 | 24 | <input type="text" name="archived_ticket[<?php echo $tkt_row; ?>][TKT_base_price]" class="edit-ticket-TKT_base_price ee-small-text-inp edit-price-PRC_amount ee-numeric" value="<?php echo $TKT_base_price; ?>" disabled> |
25 | 25 | <?php else : ?> |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | <input type="hidden" id="edit-ticket-TKT_base_price_ID-<?php echo $tkt_row; ?>" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_base_price_ID]" value="<?php echo $TKT_base_price_ID; ?>"> |
29 | 29 | </td> |
30 | 30 | <td> |
31 | - <?php if ( $disabled ) : ?> |
|
31 | + <?php if ($disabled) : ?> |
|
32 | 32 | <input type="hidden" class="edit-ticket-TKT_qty ee-small-text-inp ee-numeric" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_qty]" value="<?php echo $TKT_qty_for_input; ?>"> |
33 | 33 | <input type="text" class="edit-ticket-TKT_qty ee-small-text-inp ee-numeric" name="archived_ticket[<?php echo $tkt_row; ?>][TKT_qty]" value="<?php echo $TKT_qty_for_input; ?>" disabled> |
34 | 34 | <?php else : ?> |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | <input type="hidden" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_ID]" class="edit-ticket-TKT_ID" value="<?php echo $TKT_ID; ?>"> |
50 | 50 | <input type="hidden" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_row]" class="edit-ticket-TKT_row" value="<?php echo $tkt_row; ?>"> |
51 | 51 | |
52 | - <!--<div class="total-price-container"><?php printf( esc_html__('Total Final Price: %s', 'event_espresso'), '<span class="ticket-price-amount">' . $TKT_price . '</span>'); ?> </div>--> |
|
52 | + <!--<div class="total-price-container"><?php printf(esc_html__('Total Final Price: %s', 'event_espresso'), '<span class="ticket-price-amount">'.$TKT_price.'</span>'); ?> </div>--> |
|
53 | 53 | <textarea name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_description]" class="edit-ticket-TKT_description ee-full-textarea-inp" placeholder="Ticket Description"><?php echo $TKT_description; ?></textarea> |
54 | 54 | |
55 | - <?php do_action( 'AHEE__event_tickets_datetime_ticket_row_template_after_desc', $tkt_row, $TKT_ID ); ?> |
|
55 | + <?php do_action('AHEE__event_tickets_datetime_ticket_row_template_after_desc', $tkt_row, $TKT_ID); ?> |
|
56 | 56 | |
57 | 57 | <div class="basic-ticket-container"> |
58 | 58 | <h4 class="tickets-heading"><?php esc_html_e('Ticket Details', 'event_espresso'); ?></h4> |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | <tbody> |
69 | 69 | <tr> |
70 | 70 | <td> |
71 | - <?php if ( $disabled ) : ?> |
|
71 | + <?php if ($disabled) : ?> |
|
72 | 72 | <input type="hidden" class="edit-ticket-TKT_uses ee-small-text-inp ee-numeric" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_uses]" value="<?php echo $TKT_uses; ?>"> |
73 | 73 | <input type="text" class="edit-ticket-TKT_uses ee-small-text-inp ee-numeric" name="archived_ticket[<?php echo $tkt_row; ?>][TKT_uses]" value="<?php echo $TKT_uses; ?>" disabled> |
74 | 74 | <?php else : ?> |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | <?php endif; ?> |
77 | 77 | </td> |
78 | 78 | <td> |
79 | - <?php if ( $disabled ) : ?> |
|
79 | + <?php if ($disabled) : ?> |
|
80 | 80 | <input type="hidden" class="edit-ticket-TKT_min ee-small-text-inp ee-numeric" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_min]" value="<?php echo $TKT_min; ?>"> |
81 | 81 | <input type="text" class="edit-ticket-TKT_min ee-small-text-inp ee-numeric" name="archived_ticket[<?php echo $tkt_row; ?>][TKT_min]" value="<?php echo $TKT_min; ?>" disabled> |
82 | 82 | <?php else: ?> |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | <?php endif; ?> |
85 | 85 | </td> |
86 | 86 | <td> |
87 | - <?php if ( $disabled ) : ?> |
|
87 | + <?php if ($disabled) : ?> |
|
88 | 88 | <input type="hidden" class="edit-ticket-TKT_max ee-small-text-inp ee-numeric" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_max]" value="<?php echo $TKT_max; ?>"> |
89 | 89 | <input type="text" class="edit-ticket-TKT_max ee-small-text-inp ee-numeric" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_max]" value="<?php echo $TKT_max; ?>" disabled> |
90 | 90 | <?php else : ?> |
@@ -102,15 +102,15 @@ discard block |
||
102 | 102 | <label for="edit-ticket-TKT_required"><?php esc_html_e('This ticket is required (will appear first in frontend ticket lists).', 'event_espresso'); ?></label> |
103 | 103 | </div> |
104 | 104 | <div class="ticket-is-taxable-container"> |
105 | - <?php if ( !empty($tax_rows) ) { ?> |
|
106 | - <?php if ( $disabled ) : ?> |
|
105 | + <?php if ( ! empty($tax_rows)) { ?> |
|
106 | + <?php if ($disabled) : ?> |
|
107 | 107 | <?php |
108 | - $tax_value = !empty( $TKT_taxable ) ? 1 : 0; |
|
108 | + $tax_value = ! empty($TKT_taxable) ? 1 : 0; |
|
109 | 109 | ?> |
110 | - <input class="TKT-taxable-checkbox" type="hidden" name="<?php echo $edit_tickets_name;?>[<?php echo $tkt_row; ?>][TKT_taxable]" value="<?php echo $tax_value; ?>"> |
|
110 | + <input class="TKT-taxable-checkbox" type="hidden" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_taxable]" value="<?php echo $tax_value; ?>"> |
|
111 | 111 | <input class="TKT-taxable-checkbox" id="edit-ticket-TKT_taxable-<?php echo $tkt_row; ?>" type="checkbox" name="archived_ticket[<?php echo $tkt_row; ?>][TKT_taxable]" value="1"<?php echo $TKT_taxable; ?> disabled> |
112 | 112 | <?php else : ?> |
113 | - <input class="TKT-taxable-checkbox" id="edit-ticket-TKT_taxable-<?php echo $tkt_row; ?>" type="checkbox" name="<?php echo $edit_tickets_name;?>[<?php echo $tkt_row; ?>][TKT_taxable]" value="1"<?php echo $TKT_taxable; ?>> |
|
113 | + <input class="TKT-taxable-checkbox" id="edit-ticket-TKT_taxable-<?php echo $tkt_row; ?>" type="checkbox" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_taxable]" value="1"<?php echo $TKT_taxable; ?>> |
|
114 | 114 | <?php endif; ?> |
115 | 115 | <label for="edit-ticket-TKT_taxable-<?php echo $tkt_row; ?>"> <?php esc_html_e('This ticket is taxable.', 'event_espresso'); ?> |
116 | 116 | <?php } //end tax_rows check ?> |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | <?php echo $ticket_datetimes_list; ?> |
168 | 168 | </ul> |
169 | 169 | |
170 | - <?php do_action( 'AHEE__event_tickets_datetime_ticket_row_template__advanced_details_end', $tkt_row, $TKT_ID ); ?> |
|
170 | + <?php do_action('AHEE__event_tickets_datetime_ticket_row_template__advanced_details_end', $tkt_row, $TKT_ID); ?> |
|
171 | 171 | <div class="ee-editor-footer-container"> |
172 | 172 | <div class="ee-editor-id-container"> |
173 | - <span class="ee-item-id"><?php echo $TKT_ID ? sprintf( esc_html__( 'Ticket ID: %d', 'event_espresso' ), $TKT_ID ) : ''; ?></span> |
|
173 | + <span class="ee-item-id"><?php echo $TKT_ID ? sprintf(esc_html__('Ticket ID: %d', 'event_espresso'), $TKT_ID) : ''; ?></span> |
|
174 | 174 | </div> |
175 | 175 | <div class="save-cancel-button-container"> |
176 | 176 | <label for="edit-ticket-TKT_is_default_selector"><?php esc_html_e('use this new ticket as a default ticket for any new events', 'event_espresso'); ?></label> |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @since $VID:$ |
15 | 15 | * |
16 | 16 | */ |
17 | -abstract class EE_PMT_Base{ |
|
17 | +abstract class EE_PMT_Base { |
|
18 | 18 | |
19 | 19 | const onsite = 'on-site'; |
20 | 20 | const offsite = 'off-site'; |
@@ -95,31 +95,31 @@ discard block |
||
95 | 95 | * @return EE_PMT_Base |
96 | 96 | */ |
97 | 97 | function __construct($pm_instance = NULL) { |
98 | - if ( $pm_instance instanceof EE_Payment_Method ){ |
|
98 | + if ($pm_instance instanceof EE_Payment_Method) { |
|
99 | 99 | $this->set_instance($pm_instance); |
100 | 100 | } |
101 | - if($this->_gateway){ |
|
102 | - $this->_gateway->set_payment_model( EEM_Payment::instance() ); |
|
103 | - $this->_gateway->set_payment_log( EEM_Change_Log::instance() ); |
|
104 | - $this->_gateway->set_template_helper( new EEH_Template() ); |
|
105 | - $this->_gateway->set_line_item_helper( new EEH_Line_Item() ); |
|
106 | - $this->_gateway->set_money_helper( new EEH_Money() ); |
|
101 | + if ($this->_gateway) { |
|
102 | + $this->_gateway->set_payment_model(EEM_Payment::instance()); |
|
103 | + $this->_gateway->set_payment_log(EEM_Change_Log::instance()); |
|
104 | + $this->_gateway->set_template_helper(new EEH_Template()); |
|
105 | + $this->_gateway->set_line_item_helper(new EEH_Line_Item()); |
|
106 | + $this->_gateway->set_money_helper(new EEH_Money()); |
|
107 | 107 | } |
108 | - if ( ! isset( $this->_has_billing_form ) ) { |
|
108 | + if ( ! isset($this->_has_billing_form)) { |
|
109 | 109 | // by default, On Site gateways have a billing form |
110 | - if ( $this->payment_occurs() == EE_PMT_Base::onsite ) { |
|
111 | - $this->set_has_billing_form( true ); |
|
110 | + if ($this->payment_occurs() == EE_PMT_Base::onsite) { |
|
111 | + $this->set_has_billing_form(true); |
|
112 | 112 | } else { |
113 | - $this->set_has_billing_form( false ); |
|
113 | + $this->set_has_billing_form(false); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | - if( ! $this->_pretty_name){ |
|
117 | + if ( ! $this->_pretty_name) { |
|
118 | 118 | throw new EE_Error(sprintf(__("You must set the pretty name for the Payment Method Type in the constructor (_pretty_name), and please make it internationalized", "event_espresso"))); |
119 | 119 | } |
120 | 120 | //if the child didn't specify a default button, use the credit card one |
121 | - if( $this->_default_button_url === NULL){ |
|
122 | - $this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods' . DS . 'pay-by-credit-card.png'; |
|
121 | + if ($this->_default_button_url === NULL) { |
|
122 | + $this->_default_button_url = EE_PLUGIN_DIR_URL.'payment_methods'.DS.'pay-by-credit-card.png'; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * @param boolean $has_billing_form |
130 | 130 | */ |
131 | - public function set_has_billing_form( $has_billing_form ) { |
|
132 | - $this->_has_billing_form = filter_var( $has_billing_form, FILTER_VALIDATE_BOOLEAN ); |
|
131 | + public function set_has_billing_form($has_billing_form) { |
|
132 | + $this->_has_billing_form = filter_var($has_billing_form, FILTER_VALIDATE_BOOLEAN); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | /** |
138 | 138 | * sets the file_folder property |
139 | 139 | */ |
140 | - protected function _set_file_folder(){ |
|
140 | + protected function _set_file_folder() { |
|
141 | 141 | $reflector = new ReflectionClass(get_class($this)); |
142 | 142 | $fn = $reflector->getFileName(); |
143 | - $this->_file_folder = dirname($fn).DS; |
|
143 | + $this->_file_folder = dirname($fn).DS; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | /** |
149 | 149 | * sets the file URL with a trailing slash for this PMT |
150 | 150 | */ |
151 | - protected function _set_file_url(){ |
|
152 | - $plugins_dir_fixed = str_replace('\\',DS,WP_PLUGIN_DIR); |
|
153 | - $file_folder_fixed = str_replace('\\',DS,$this->file_folder()); |
|
154 | - $file_path = str_replace($plugins_dir_fixed,WP_PLUGIN_URL,$file_folder_fixed); |
|
151 | + protected function _set_file_url() { |
|
152 | + $plugins_dir_fixed = str_replace('\\', DS, WP_PLUGIN_DIR); |
|
153 | + $file_folder_fixed = str_replace('\\', DS, $this->file_folder()); |
|
154 | + $file_path = str_replace($plugins_dir_fixed, WP_PLUGIN_URL, $file_folder_fixed); |
|
155 | 155 | $this->_file_url = $file_path; |
156 | 156 | } |
157 | 157 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * Gets the default description on all payment methods of this type |
160 | 160 | * @return string |
161 | 161 | */ |
162 | - public function default_description(){ |
|
162 | + public function default_description() { |
|
163 | 163 | return $this->_default_description; |
164 | 164 | } |
165 | 165 | |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | * Returns the folder containing the PMT child class, with a trailing slash |
170 | 170 | * @return string |
171 | 171 | */ |
172 | - public function file_folder(){ |
|
173 | - if( ! $this->_file_folder ) { |
|
172 | + public function file_folder() { |
|
173 | + if ( ! $this->_file_folder) { |
|
174 | 174 | $this->_set_file_folder(); |
175 | 175 | } |
176 | 176 | return $this->_file_folder; |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | /** |
182 | 182 | * @return string |
183 | 183 | */ |
184 | - public function file_url(){ |
|
185 | - if( ! $this->_file_url ) { |
|
184 | + public function file_url() { |
|
185 | + if ( ! $this->_file_url) { |
|
186 | 186 | $this->_set_file_url(); |
187 | 187 | } |
188 | 188 | return $this->_file_url; |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | * Its important teh payment method instance is set before |
196 | 196 | * @param EE_Payment_Method $payment_method_instance |
197 | 197 | */ |
198 | - function set_instance($payment_method_instance){ |
|
198 | + function set_instance($payment_method_instance) { |
|
199 | 199 | $this->_pm_instance = $payment_method_instance; |
200 | 200 | //if they have already requested the settings form, make sure its |
201 | 201 | //data matches this model object |
202 | - if($this->_settings_form){ |
|
202 | + if ($this->_settings_form) { |
|
203 | 203 | $this->settings_form()->populate_model_obj($payment_method_instance); |
204 | 204 | } |
205 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
205 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
206 | 206 | $this->_gateway->set_settings($payment_method_instance->settings_array()); |
207 | 207 | } |
208 | 208 | } |
@@ -213,14 +213,14 @@ discard block |
||
213 | 213 | * Gets teh form for displaying to admins where they setup the payment method |
214 | 214 | * @return EE_Payment_Method_Form |
215 | 215 | */ |
216 | - function settings_form(){ |
|
217 | - if( ! $this->_settings_form){ |
|
216 | + function settings_form() { |
|
217 | + if ( ! $this->_settings_form) { |
|
218 | 218 | $this->_settings_form = $this->generate_new_settings_form(); |
219 | - $this->_settings_form->set_payment_method_type( $this ); |
|
220 | - $this->_settings_form->_construct_finalize(NULL, NULL ); |
|
219 | + $this->_settings_form->set_payment_method_type($this); |
|
220 | + $this->_settings_form->_construct_finalize(NULL, NULL); |
|
221 | 221 | //if we have already assigned a model object to this pmt, make |
222 | 222 | //sure its reflected in teh form we just generated |
223 | - if($this->_pm_instance){ |
|
223 | + if ($this->_pm_instance) { |
|
224 | 224 | $this->_settings_form->populate_model_obj($this->_pm_instance); |
225 | 225 | } |
226 | 226 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * this payment method type's settings form later in the request |
247 | 247 | * @param EE_Payment_Method_Form $form |
248 | 248 | */ |
249 | - public function set_settings_form($form){ |
|
249 | + public function set_settings_form($form) { |
|
250 | 250 | $this->_settings_form = $form; |
251 | 251 | } |
252 | 252 | |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | * @param array $extra_args |
270 | 270 | * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form|null |
271 | 271 | */ |
272 | - public function billing_form( EE_Transaction $transaction = NULL, $extra_args = array() ){ |
|
272 | + public function billing_form(EE_Transaction $transaction = NULL, $extra_args = array()) { |
|
273 | 273 | // has billing form already been regenerated ? or overwrite cache? |
274 | - if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form ){ |
|
275 | - $this->_billing_form = $this->generate_new_billing_form( $transaction, $extra_args ); |
|
274 | + if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) { |
|
275 | + $this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args); |
|
276 | 276 | } |
277 | 277 | //if we know who the attendee is, and this is a billing form |
278 | 278 | //that uses attendee info, populate it |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | $transaction instanceof EE_Transaction && |
282 | 282 | $transaction->primary_registration() instanceof EE_Registration && |
283 | 283 | $transaction->primary_registration()->attendee() instanceof EE_Attendee |
284 | - ){ |
|
285 | - $this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() ); |
|
284 | + ) { |
|
285 | + $this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee()); |
|
286 | 286 | } |
287 | 287 | return $this->_billing_form; |
288 | 288 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | * @param \EE_Transaction $transaction |
294 | 294 | * @return \EE_Billing_Info_Form |
295 | 295 | */ |
296 | - abstract function generate_new_billing_form( EE_Transaction $transaction = NULL ); |
|
296 | + abstract function generate_new_billing_form(EE_Transaction $transaction = NULL); |
|
297 | 297 | |
298 | 298 | |
299 | 299 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @param \EE_Billing_Info_Form $billing_form |
305 | 305 | * @return \EE_Billing_Info_Form |
306 | 306 | */ |
307 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
307 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
308 | 308 | return $billing_form; |
309 | 309 | } |
310 | 310 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * if you have form |
316 | 316 | * @param EE_Payment_Method $form |
317 | 317 | */ |
318 | - public function set_billing_form($form){ |
|
318 | + public function set_billing_form($form) { |
|
319 | 319 | $this->_billing_form = $form; |
320 | 320 | } |
321 | 321 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | * Returns whether or not this payment method requires HTTPS to be used |
326 | 326 | * @return boolean |
327 | 327 | */ |
328 | - function requires_https(){ |
|
328 | + function requires_https() { |
|
329 | 329 | return $this->_requires_https; |
330 | 330 | } |
331 | 331 | |
@@ -343,9 +343,9 @@ discard block |
||
343 | 343 | * @return EE_Payment |
344 | 344 | * @throws EE_Error |
345 | 345 | */ |
346 | - function process_payment( EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null,$fail_url = '', $method = 'CART', $by_admin = false ){ |
|
346 | + function process_payment(EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null, $fail_url = '', $method = 'CART', $by_admin = false) { |
|
347 | 347 | // @todo: add surcharge for the payment method, if any |
348 | - if ( $this->_gateway ) { |
|
348 | + if ($this->_gateway) { |
|
349 | 349 | //there is a gateway, so we're going to make a payment object |
350 | 350 | //but wait! do they already have a payment in progress that we thought was failed? |
351 | 351 | $duplicate_properties = array( |
@@ -356,10 +356,10 @@ discard block |
||
356 | 356 | 'PAY_amount' => $amount !== null ? $amount : $transaction->remaining(), |
357 | 357 | 'PAY_gateway_response' => null, |
358 | 358 | ); |
359 | - $payment = EEM_Payment::instance()->get_one( array( $duplicate_properties )); |
|
359 | + $payment = EEM_Payment::instance()->get_one(array($duplicate_properties)); |
|
360 | 360 | //if we didn't already have a payment in progress for the same thing, |
361 | 361 | //then we actually want to make a new payment |
362 | - if ( ! $payment instanceof EE_Payment ){ |
|
362 | + if ( ! $payment instanceof EE_Payment) { |
|
363 | 363 | $payment = EE_Payment::new_instance( |
364 | 364 | array_merge( |
365 | 365 | $duplicate_properties, |
@@ -375,10 +375,10 @@ discard block |
||
375 | 375 | } |
376 | 376 | //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 |
377 | 377 | $payment->save(); |
378 | - $billing_values = $this->_get_billing_values_from_form( $billing_info ); |
|
378 | + $billing_values = $this->_get_billing_values_from_form($billing_info); |
|
379 | 379 | |
380 | 380 | // Offsite Gateway |
381 | - if( $this->_gateway instanceof EE_Offsite_Gateway ){ |
|
381 | + if ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
382 | 382 | |
383 | 383 | $payment = $this->_gateway->set_redirection_info( |
384 | 384 | $payment, |
@@ -394,17 +394,17 @@ discard block |
||
394 | 394 | ); |
395 | 395 | $payment->save(); |
396 | 396 | // Onsite Gateway |
397 | - } elseif ( $this->_gateway instanceof EE_Onsite_Gateway ) { |
|
397 | + } elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
398 | 398 | |
399 | - $payment = $this->_gateway->do_direct_payment($payment,$billing_values); |
|
399 | + $payment = $this->_gateway->do_direct_payment($payment, $billing_values); |
|
400 | 400 | $payment->save(); |
401 | 401 | |
402 | 402 | } else { |
403 | 403 | throw new EE_Error( |
404 | 404 | sprintf( |
405 | - __('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)', 'event_espresso' ), |
|
405 | + __('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)', 'event_espresso'), |
|
406 | 406 | get_class($this), |
407 | - gettype( $this->_gateway ) |
|
407 | + gettype($this->_gateway) |
|
408 | 408 | ) |
409 | 409 | ); |
410 | 410 | } |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | } |
427 | 427 | |
428 | 428 | // if there is billing info, clean it and save it now |
429 | - if( $billing_info instanceof EE_Billing_Attendee_Info_Form ){ |
|
430 | - $this->_save_billing_info_to_attendee( $billing_info, $transaction ); |
|
429 | + if ($billing_info instanceof EE_Billing_Attendee_Info_Form) { |
|
430 | + $this->_save_billing_info_to_attendee($billing_info, $transaction); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | return $payment; |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | * @param EE_Billing_Info_Form $billing_form |
441 | 441 | * @return array |
442 | 442 | */ |
443 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
444 | - if($billing_form instanceof EE_Form_Section_Proper ){ |
|
445 | - return $billing_form->input_pretty_values( true ); |
|
446 | - }else{ |
|
443 | + protected function _get_billing_values_from_form($billing_form) { |
|
444 | + if ($billing_form instanceof EE_Form_Section_Proper) { |
|
445 | + return $billing_form->input_pretty_values(true); |
|
446 | + } else { |
|
447 | 447 | return NULL; |
448 | 448 | } |
449 | 449 | } |
@@ -457,13 +457,13 @@ discard block |
||
457 | 457 | * @return EE_Payment |
458 | 458 | * @throws EE_Error |
459 | 459 | */ |
460 | - public function handle_ipn($req_data,$transaction){ |
|
460 | + public function handle_ipn($req_data, $transaction) { |
|
461 | 461 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
462 | - if( ! $this->_gateway instanceof EE_Offsite_Gateway){ |
|
463 | - throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r( $this->_gateway, TRUE ))); |
|
462 | + if ( ! $this->_gateway instanceof EE_Offsite_Gateway) { |
|
463 | + throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r($this->_gateway, TRUE))); |
|
464 | 464 | |
465 | 465 | } |
466 | - $payment = $this->_gateway->handle_payment_update( $req_data, $transaction ); |
|
466 | + $payment = $this->_gateway->handle_payment_update($req_data, $transaction); |
|
467 | 467 | return $payment; |
468 | 468 | } |
469 | 469 | |
@@ -476,22 +476,22 @@ discard block |
||
476 | 476 | * @param EE_Transaction $transaction |
477 | 477 | * @return boolean success |
478 | 478 | */ |
479 | - protected function _save_billing_info_to_attendee($billing_form, $transaction){ |
|
480 | - if( ! $transaction || ! $transaction instanceof EE_Transaction){ |
|
479 | + protected function _save_billing_info_to_attendee($billing_form, $transaction) { |
|
480 | + if ( ! $transaction || ! $transaction instanceof EE_Transaction) { |
|
481 | 481 | EE_Error::add_error(__("Cannot save billing info because no transaction was specified", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
482 | 482 | return false; |
483 | 483 | } |
484 | 484 | $primary_reg = $transaction->primary_registration(); |
485 | - if( ! $primary_reg ){ |
|
485 | + if ( ! $primary_reg) { |
|
486 | 486 | EE_Error::add_error(__("Cannot save billing info because the transaction has no primary registration", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
487 | 487 | return false; |
488 | 488 | } |
489 | 489 | $attendee = $primary_reg->attendee(); |
490 | - if( ! $attendee ){ |
|
490 | + if ( ! $attendee) { |
|
491 | 491 | EE_Error::add_error(__("Cannot save billing info because the transaction's primary registration has no attendee!", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
492 | 492 | return false; |
493 | 493 | } |
494 | - return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method() ); |
|
494 | + return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method()); |
|
495 | 495 | |
496 | 496 | } |
497 | 497 | |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | * @param array $req_data |
505 | 505 | * @return EE_Payment |
506 | 506 | */ |
507 | - protected function find_payment_for_ipn( EE_Transaction $transaction, $req_data = array() ){ |
|
507 | + protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array()) { |
|
508 | 508 | return $transaction->last_payment(); |
509 | 509 | } |
510 | 510 | |
@@ -521,8 +521,8 @@ discard block |
||
521 | 521 | * and identifies the IPN as being for this payment method (not just fo ra payment method of this type) |
522 | 522 | * @throws EE_Error |
523 | 523 | */ |
524 | - public function handle_unclaimed_ipn( $req_data = array() ){ |
|
525 | - throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this) )); |
|
524 | + public function handle_unclaimed_ipn($req_data = array()) { |
|
525 | + throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this))); |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | * @param EE_Transaction $transaction |
539 | 539 | * @return EE_Payment |
540 | 540 | */ |
541 | - public function finalize_payment_for($transaction){ |
|
541 | + public function finalize_payment_for($transaction) { |
|
542 | 542 | return $transaction->last_payment(); |
543 | 543 | } |
544 | 544 | |
@@ -548,10 +548,10 @@ discard block |
||
548 | 548 | * Whether or not this payment method's gateway supports sending refund requests |
549 | 549 | * @return boolean |
550 | 550 | */ |
551 | - public function supports_sending_refunds(){ |
|
552 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
551 | + public function supports_sending_refunds() { |
|
552 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
553 | 553 | return $this->_gateway->supports_sending_refunds(); |
554 | - }else{ |
|
554 | + } else { |
|
555 | 555 | return false; |
556 | 556 | } |
557 | 557 | } |
@@ -565,14 +565,14 @@ discard block |
||
565 | 565 | * @throws EE_Error |
566 | 566 | * @return EE_Payment |
567 | 567 | */ |
568 | - public function process_refund( EE_Payment $payment, $refund_info = array()){ |
|
569 | - if ( $this->_gateway && $this->_gateway instanceof EE_Gateway ) { |
|
570 | - return $this->_gateway->do_direct_refund( $payment, $refund_info ); |
|
568 | + public function process_refund(EE_Payment $payment, $refund_info = array()) { |
|
569 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
570 | + return $this->_gateway->do_direct_refund($payment, $refund_info); |
|
571 | 571 | } else { |
572 | 572 | throw new EE_Error( |
573 | 573 | sprintf( |
574 | - __( 'Payment Method Type "%s" does not support sending refund requests', 'event_espresso' ), |
|
575 | - get_class( $this ) |
|
574 | + __('Payment Method Type "%s" does not support sending refund requests', 'event_espresso'), |
|
575 | + get_class($this) |
|
576 | 576 | ) |
577 | 577 | ); |
578 | 578 | } |
@@ -586,15 +586,15 @@ discard block |
||
586 | 586 | * @return string |
587 | 587 | * @throws EE_Error |
588 | 588 | */ |
589 | - public function payment_occurs(){ |
|
590 | - if( ! $this->_gateway){ |
|
589 | + public function payment_occurs() { |
|
590 | + if ( ! $this->_gateway) { |
|
591 | 591 | return EE_PMT_Base::offline; |
592 | - }elseif($this->_gateway instanceof EE_Onsite_Gateway){ |
|
592 | + }elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
593 | 593 | return EE_PMT_Base::onsite; |
594 | - }elseif($this->_gateway instanceof EE_Offsite_Gateway){ |
|
594 | + }elseif ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
595 | 595 | return EE_PMT_Base::offsite; |
596 | - }else{ |
|
597 | - throw new EE_Error(sprintf(__("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", "event_espresso"),get_class($this))); |
|
596 | + } else { |
|
597 | + throw new EE_Error(sprintf(__("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", "event_espresso"), get_class($this))); |
|
598 | 598 | } |
599 | 599 | } |
600 | 600 | |
@@ -607,8 +607,8 @@ discard block |
||
607 | 607 | * @param EE_Payment $payment |
608 | 608 | * @return string |
609 | 609 | */ |
610 | - public function payment_overview_content(EE_Payment $payment){ |
|
611 | - return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance,'payment'=>$payment) , true); |
|
610 | + public function payment_overview_content(EE_Payment $payment) { |
|
611 | + return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance, 'payment'=>$payment), true); |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | * @type array $template_args any arguments you want passed to the template file while rendering. |
622 | 622 | * Keys will be variable names and values with be their values. |
623 | 623 | */ |
624 | - public function help_tabs_config(){ |
|
624 | + public function help_tabs_config() { |
|
625 | 625 | return array(); |
626 | 626 | } |
627 | 627 | |
@@ -632,9 +632,9 @@ discard block |
||
632 | 632 | * the payment method's table's PMT_type column) |
633 | 633 | * @return string |
634 | 634 | */ |
635 | - public function system_name(){ |
|
635 | + public function system_name() { |
|
636 | 636 | $classname = get_class($this); |
637 | - return str_replace("EE_PMT_",'',$classname); |
|
637 | + return str_replace("EE_PMT_", '', $classname); |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | * A pretty i18n version of the PMT name |
644 | 644 | * @return string |
645 | 645 | */ |
646 | - public function pretty_name(){ |
|
646 | + public function pretty_name() { |
|
647 | 647 | return $this->_pretty_name; |
648 | 648 | } |
649 | 649 | |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | * Gets the default absolute URL to the payment method type's button |
654 | 654 | * @return string |
655 | 655 | */ |
656 | - public function default_button_url(){ |
|
656 | + public function default_button_url() { |
|
657 | 657 | return $this->_default_button_url; |
658 | 658 | } |
659 | 659 | |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | * Gets the gateway used by this payment method (if any) |
664 | 664 | * @return EE_Gateway |
665 | 665 | */ |
666 | - public function get_gateway(){ |
|
666 | + public function get_gateway() { |
|
667 | 667 | return $this->_gateway; |
668 | 668 | } |
669 | 669 | |
@@ -672,8 +672,8 @@ discard block |
||
672 | 672 | /** |
673 | 673 | * @return string html for the link to a help tab |
674 | 674 | */ |
675 | - public function get_help_tab_link(){ |
|
676 | - return EEH_Template::get_help_tab_link( $this->get_help_tab_name() ); |
|
675 | + public function get_help_tab_link() { |
|
676 | + return EEH_Template::get_help_tab_link($this->get_help_tab_name()); |
|
677 | 677 | } |
678 | 678 | |
679 | 679 | |
@@ -682,8 +682,8 @@ discard block |
||
682 | 682 | * Returns the name of the help tab for this PMT |
683 | 683 | * @return string |
684 | 684 | */ |
685 | - public function get_help_tab_name(){ |
|
686 | - return 'ee_' . strtolower( $this->system_name() ) . '_help_tab'; |
|
685 | + public function get_help_tab_name() { |
|
686 | + return 'ee_'.strtolower($this->system_name()).'_help_tab'; |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | /** |
@@ -691,8 +691,8 @@ discard block |
||
691 | 691 | * this PMT by an admin |
692 | 692 | * @return string |
693 | 693 | */ |
694 | - public function cap_name(){ |
|
695 | - return 'ee_payment_method_' . strtolower( $this->system_name() ); |
|
694 | + public function cap_name() { |
|
695 | + return 'ee_payment_method_'.strtolower($this->system_name()); |
|
696 | 696 | } |
697 | 697 | |
698 | 698 | /** |
@@ -704,9 +704,9 @@ discard block |
||
704 | 704 | * @param EE_Payment $payment |
705 | 705 | * @return void |
706 | 706 | */ |
707 | - public function update_txn_based_on_payment( $payment ){ |
|
708 | - if( $this->_gateway instanceof EE_Gateway ){ |
|
709 | - $this->_gateway->update_txn_based_on_payment( $payment ); |
|
707 | + public function update_txn_based_on_payment($payment) { |
|
708 | + if ($this->_gateway instanceof EE_Gateway) { |
|
709 | + $this->_gateway->update_txn_based_on_payment($payment); |
|
710 | 710 | } |
711 | 711 | } |
712 | 712 | |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | * @return string |
722 | 722 | */ |
723 | 723 | public function introductory_html() { |
724 | - return EEH_Template::locate_template( $this->file_folder() . 'templates' . DS . strtolower( $this->system_name() ) . '_intro.template.php', array( 'pmt_obj' => $this, 'pm_instance' => $this->_pm_instance ) ); |
|
724 | + return EEH_Template::locate_template($this->file_folder().'templates'.DS.strtolower($this->system_name()).'_intro.template.php', array('pmt_obj' => $this, 'pm_instance' => $this->_pm_instance)); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
45 | 45 | * @return \Payments_Admin_Page |
46 | 46 | */ |
47 | - public function __construct( $routing = TRUE ) { |
|
48 | - parent::__construct( $routing ); |
|
47 | + public function __construct($routing = TRUE) { |
|
48 | + parent::__construct($routing); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | protected function _set_page_config() { |
131 | 131 | $payment_method_list_config = array( |
132 | 132 | 'nav' => array( |
133 | - 'label' => __( 'Payment Methods', 'event_espresso' ), |
|
133 | + 'label' => __('Payment Methods', 'event_espresso'), |
|
134 | 134 | 'order' => 10 |
135 | 135 | ), |
136 | 136 | 'metaboxes' => $this->_default_espresso_metaboxes, |
137 | 137 | 'help_tabs' => array_merge( |
138 | 138 | array( |
139 | 139 | 'payment_methods_overview_help_tab' => array( |
140 | - 'title' => __( 'Payment Methods Overview', 'event_espresso' ), |
|
140 | + 'title' => __('Payment Methods Overview', 'event_espresso'), |
|
141 | 141 | 'filename' => 'payment_methods_overview' |
142 | 142 | ) |
143 | 143 | ), |
144 | 144 | $this->_add_payment_method_help_tabs() ), |
145 | - 'help_tour' => array( 'Payment_Methods_Selection_Help_Tour' ), |
|
145 | + 'help_tour' => array('Payment_Methods_Selection_Help_Tour'), |
|
146 | 146 | 'require_nonce' => false |
147 | 147 | ); |
148 | 148 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | ) |
161 | 161 | ), |
162 | 162 | //'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ), |
163 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
163 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
164 | 164 | 'require_nonce' => FALSE |
165 | 165 | ), |
166 | 166 | 'payment_log'=>array( |
@@ -179,17 +179,17 @@ discard block |
||
179 | 179 | /** |
180 | 180 | * @return array |
181 | 181 | */ |
182 | - protected function _add_payment_method_help_tabs(){ |
|
182 | + protected function _add_payment_method_help_tabs() { |
|
183 | 183 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
184 | 184 | $payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types(); |
185 | 185 | $all_pmt_help_tabs_config = array(); |
186 | - foreach( $payment_method_types as $payment_method_type ){ |
|
187 | - if ( ! EE_Registry::instance()->CAP->current_user_can( $payment_method_type->cap_name(), 'specific_payment_method_type_access' ) ) { |
|
186 | + foreach ($payment_method_types as $payment_method_type) { |
|
187 | + if ( ! EE_Registry::instance()->CAP->current_user_can($payment_method_type->cap_name(), 'specific_payment_method_type_access')) { |
|
188 | 188 | continue; |
189 | 189 | } |
190 | - foreach( $payment_method_type->help_tabs_config() as $help_tab_name => $config ){ |
|
191 | - $template_args = isset( $config[ 'template_args' ] ) ? $config[ 'template_args' ] : array(); |
|
192 | - $template_args[ 'admin_page_obj' ] = $this; |
|
190 | + foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) { |
|
191 | + $template_args = isset($config['template_args']) ? $config['template_args'] : array(); |
|
192 | + $template_args['admin_page_obj'] = $this; |
|
193 | 193 | $all_pmt_help_tabs_config[$help_tab_name] = array( |
194 | 194 | 'title'=>$config['title'], |
195 | 195 | 'content'=>EEH_Template::display_template( |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | |
217 | 217 | |
218 | 218 | public function load_scripts_styles() { |
219 | - wp_enqueue_script( 'ee_admin_js' ); |
|
220 | - wp_enqueue_script( 'ee-text-links' ); |
|
221 | - wp_enqueue_script( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', array( 'espresso-ui-theme', 'ee-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
219 | + wp_enqueue_script('ee_admin_js'); |
|
220 | + wp_enqueue_script('ee-text-links'); |
|
221 | + wp_enqueue_script('espresso_payments', EE_PAYMENTS_ASSETS_URL.'espresso_payments_admin.js', array('espresso-ui-theme', 'ee-datepicker'), EVENT_ESPRESSO_VERSION, TRUE); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | |
228 | 228 | public function load_scripts_styles_default() { |
229 | 229 | //styles |
230 | - wp_register_style( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', array(), EVENT_ESPRESSO_VERSION ); |
|
231 | - wp_enqueue_style( 'espresso_payments' ); |
|
232 | - wp_enqueue_style( 'ee-text-links' ); |
|
230 | + wp_register_style('espresso_payments', EE_PAYMENTS_ASSETS_URL.'ee-payments.css', array(), EVENT_ESPRESSO_VERSION); |
|
231 | + wp_enqueue_style('espresso_payments'); |
|
232 | + wp_enqueue_style('ee-text-links'); |
|
233 | 233 | //scripts |
234 | 234 | } |
235 | 235 | |
@@ -243,44 +243,44 @@ discard block |
||
243 | 243 | * to the loading process. However, people MUST setup the details for the payment method so its safe to do a |
244 | 244 | * recheck here. |
245 | 245 | */ |
246 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
246 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
247 | 247 | EEM_Payment_Method::instance()->verify_button_urls(); |
248 | 248 | //setup tabs, one for each payment method type |
249 | 249 | $tabs = array(); |
250 | 250 | $payment_methods = array(); |
251 | - foreach( EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj ) { |
|
251 | + foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { |
|
252 | 252 | // we don't want to show admin-only PMTs for now |
253 | - if ( $pmt_obj instanceof EE_PMT_Admin_Only ) { |
|
253 | + if ($pmt_obj instanceof EE_PMT_Admin_Only) { |
|
254 | 254 | continue; |
255 | 255 | } |
256 | 256 | //check access |
257 | - if ( ! EE_Registry::instance()->CAP->current_user_can( $pmt_obj->cap_name(), 'specific_payment_method_type_access' ) ) { |
|
257 | + if ( ! EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) { |
|
258 | 258 | continue; |
259 | 259 | } |
260 | 260 | //check for any active pms of that type |
261 | - $payment_method = EEM_Payment_Method::instance()->get_one_of_type( $pmt_obj->system_name() ); |
|
262 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
261 | + $payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name()); |
|
262 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
263 | 263 | $payment_method = EE_Payment_Method::new_instance( |
264 | 264 | array( |
265 | - 'PMD_slug' =>sanitize_key( $pmt_obj->system_name() ), |
|
265 | + 'PMD_slug' =>sanitize_key($pmt_obj->system_name()), |
|
266 | 266 | 'PMD_type' =>$pmt_obj->system_name(), |
267 | 267 | 'PMD_name' =>$pmt_obj->pretty_name(), |
268 | 268 | 'PMD_admin_name' =>$pmt_obj->pretty_name() |
269 | 269 | ) |
270 | 270 | ); |
271 | 271 | } |
272 | - $payment_methods[ $payment_method->slug() ] = $payment_method; |
|
272 | + $payment_methods[$payment_method->slug()] = $payment_method; |
|
273 | 273 | } |
274 | - $payment_methods = apply_filters( 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods ); |
|
275 | - foreach( $payment_methods as $payment_method ) { |
|
276 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
274 | + $payment_methods = apply_filters('FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods); |
|
275 | + foreach ($payment_methods as $payment_method) { |
|
276 | + if ($payment_method instanceof EE_Payment_Method) { |
|
277 | 277 | add_meta_box( |
278 | 278 | //html id |
279 | - 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
279 | + 'espresso_'.$payment_method->slug().'_payment_settings', |
|
280 | 280 | //title |
281 | - sprintf( __( '%s Settings', 'event_espresso' ), $payment_method->admin_name() ), |
|
281 | + sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()), |
|
282 | 282 | //callback |
283 | - array( $this, 'payment_method_settings_meta_box' ), |
|
283 | + array($this, 'payment_method_settings_meta_box'), |
|
284 | 284 | //post type |
285 | 285 | null, |
286 | 286 | //context |
@@ -288,19 +288,19 @@ discard block |
||
288 | 288 | //priority |
289 | 289 | 'default', |
290 | 290 | //callback args |
291 | - array( 'payment_method' => $payment_method ) |
|
291 | + array('payment_method' => $payment_method) |
|
292 | 292 | ); |
293 | 293 | //setup for tabbed content |
294 | - $tabs[ $payment_method->slug() ] = array( |
|
294 | + $tabs[$payment_method->slug()] = array( |
|
295 | 295 | 'label' => $payment_method->admin_name(), |
296 | 296 | 'class' => $payment_method->active() ? 'gateway-active' : '', |
297 | - 'href' => 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
298 | - 'title' => __( 'Modify this Payment Method', 'event_espresso' ), |
|
297 | + 'href' => 'espresso_'.$payment_method->slug().'_payment_settings', |
|
298 | + 'title' => __('Modify this Payment Method', 'event_espresso'), |
|
299 | 299 | 'slug' => $payment_method->slug() |
300 | 300 | ); |
301 | 301 | } |
302 | 302 | } |
303 | - $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug() ); |
|
303 | + $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug()); |
|
304 | 304 | $this->display_admin_page_with_sidebar(); |
305 | 305 | |
306 | 306 | } |
@@ -311,20 +311,20 @@ discard block |
||
311 | 311 | * _get_active_payment_method_slug |
312 | 312 | * @return string |
313 | 313 | */ |
314 | - protected function _get_active_payment_method_slug(){ |
|
314 | + protected function _get_active_payment_method_slug() { |
|
315 | 315 | $payment_method_slug = FALSE; |
316 | 316 | //decide which payment method tab to open first, as dictated by the request's 'payment_method' |
317 | - if ( isset( $this->_req_data['payment_method'] )) { |
|
317 | + if (isset($this->_req_data['payment_method'])) { |
|
318 | 318 | // if they provided the current payment method, use it |
319 | - $payment_method_slug = sanitize_key( $this->_req_data['payment_method'] ); |
|
319 | + $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
|
320 | 320 | } |
321 | - $payment_method = EEM_Payment_Method::instance()->get_one( array( array( 'PMD_slug' => $payment_method_slug ))); |
|
321 | + $payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug))); |
|
322 | 322 | // if that didn't work or wasn't provided, find another way to select the current pm |
323 | - if ( ! $this->_verify_payment_method( $payment_method )) { |
|
323 | + if ( ! $this->_verify_payment_method($payment_method)) { |
|
324 | 324 | // like, looking for an active one |
325 | - $payment_method = EEM_Payment_Method::instance()->get_one_active( 'CART' ); |
|
325 | + $payment_method = EEM_Payment_Method::instance()->get_one_active('CART'); |
|
326 | 326 | // test that one as well |
327 | - if ( $this->_verify_payment_method( $payment_method )) { |
|
327 | + if ($this->_verify_payment_method($payment_method)) { |
|
328 | 328 | $payment_method_slug = $payment_method->slug(); |
329 | 329 | } else { |
330 | 330 | $payment_method_slug = 'paypal_standard'; |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | * @param \EE_Payment_Method $payment_method |
343 | 343 | * @return boolean |
344 | 344 | */ |
345 | - protected function _verify_payment_method( $payment_method ){ |
|
345 | + protected function _verify_payment_method($payment_method) { |
|
346 | 346 | if ( |
347 | 347 | $payment_method instanceof EE_Payment_Method && |
348 | 348 | $payment_method->type_obj() instanceof EE_PMT_Base && |
349 | - EE_Registry::instance()->CAP->current_user_can( $payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access' ) |
|
349 | + EE_Registry::instance()->CAP->current_user_can($payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access') |
|
350 | 350 | ) { |
351 | 351 | return TRUE; |
352 | 352 | } |
@@ -363,21 +363,21 @@ discard block |
||
363 | 363 | * @return string |
364 | 364 | * @throws EE_Error |
365 | 365 | */ |
366 | - public function payment_method_settings_meta_box( $post_obj_which_is_null, $metabox ){ |
|
367 | - $payment_method = isset( $metabox['args'], $metabox['args']['payment_method'] ) ? $metabox['args']['payment_method'] : NULL; |
|
368 | - if ( ! $payment_method instanceof EE_Payment_Method ){ |
|
369 | - throw new EE_Error( sprintf( __( 'Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso' ))); |
|
366 | + public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) { |
|
367 | + $payment_method = isset($metabox['args'], $metabox['args']['payment_method']) ? $metabox['args']['payment_method'] : NULL; |
|
368 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
369 | + throw new EE_Error(sprintf(__('Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso'))); |
|
370 | 370 | } |
371 | 371 | $payment_method_scopes = $payment_method->active(); |
372 | 372 | // if the payment method really exists show its form, otherwise the activation template |
373 | - if ( $payment_method->ID() && ! empty( $payment_method_scopes )) { |
|
374 | - $form = $this->_generate_payment_method_settings_form( $payment_method ); |
|
375 | - if ( $form->form_data_present_in( $this->_req_data )) { |
|
376 | - $form->receive_form_submission( $this->_req_data ); |
|
373 | + if ($payment_method->ID() && ! empty($payment_method_scopes)) { |
|
374 | + $form = $this->_generate_payment_method_settings_form($payment_method); |
|
375 | + if ($form->form_data_present_in($this->_req_data)) { |
|
376 | + $form->receive_form_submission($this->_req_data); |
|
377 | 377 | } |
378 | - echo $form->form_open() . $form->get_html_and_js() . $form->form_close(); |
|
378 | + echo $form->form_open().$form->get_html_and_js().$form->form_close(); |
|
379 | 379 | } else { |
380 | - echo $this->_activate_payment_method_button( $payment_method )->get_html_and_js(); |
|
380 | + echo $this->_activate_payment_method_button($payment_method)->get_html_and_js(); |
|
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
@@ -390,14 +390,14 @@ discard block |
||
390 | 390 | * @param \EE_Payment_Method $payment_method |
391 | 391 | * @return \EE_Form_Section_Proper |
392 | 392 | */ |
393 | - protected function _generate_payment_method_settings_form( EE_Payment_Method $payment_method ) { |
|
394 | - if ( ! $payment_method instanceof EE_Payment_Method ){ |
|
393 | + protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method) { |
|
394 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
395 | 395 | return new EE_Form_Section_Proper(); |
396 | 396 | } |
397 | 397 | return new EE_Form_Section_Proper( |
398 | 398 | array( |
399 | - 'name' => $payment_method->slug() . '_settings_form', |
|
400 | - 'html_id' => $payment_method->slug() . '_settings_form', |
|
399 | + 'name' => $payment_method->slug().'_settings_form', |
|
400 | + 'html_id' => $payment_method->slug().'_settings_form', |
|
401 | 401 | 'action' => EE_Admin_Page::add_query_args_and_nonce( |
402 | 402 | array( |
403 | 403 | 'action' => 'update_payment_method', |
@@ -409,12 +409,12 @@ discard block |
||
409 | 409 | 'subsections' => apply_filters( |
410 | 410 | 'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections', |
411 | 411 | array( |
412 | - 'pci_dss_compliance_' . $payment_method->slug() => $this->_pci_dss_compliance( $payment_method ), |
|
413 | - 'currency_support_' . $payment_method->slug() => $this->_currency_support( $payment_method ), |
|
414 | - 'payment_method_settings_' . $payment_method->slug() => $this->_payment_method_settings( $payment_method ), |
|
415 | - 'update_' . $payment_method->slug() => $this->_update_payment_method_button( $payment_method ), |
|
416 | - 'deactivate_' . $payment_method->slug() => $this->_deactivate_payment_method_button( $payment_method ), |
|
417 | - 'fine_print_' . $payment_method->slug() => $this->_fine_print() |
|
412 | + 'pci_dss_compliance_'.$payment_method->slug() => $this->_pci_dss_compliance($payment_method), |
|
413 | + 'currency_support_'.$payment_method->slug() => $this->_currency_support($payment_method), |
|
414 | + 'payment_method_settings_'.$payment_method->slug() => $this->_payment_method_settings($payment_method), |
|
415 | + 'update_'.$payment_method->slug() => $this->_update_payment_method_button($payment_method), |
|
416 | + 'deactivate_'.$payment_method->slug() => $this->_deactivate_payment_method_button($payment_method), |
|
417 | + 'fine_print_'.$payment_method->slug() => $this->_fine_print() |
|
418 | 418 | ), |
419 | 419 | $payment_method |
420 | 420 | ) |
@@ -431,19 +431,19 @@ discard block |
||
431 | 431 | * @param \EE_Payment_Method $payment_method |
432 | 432 | * @return \EE_Form_Section_Proper |
433 | 433 | */ |
434 | - protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) { |
|
435 | - if ( $payment_method->type_obj()->requires_https() ) { |
|
434 | + protected function _pci_dss_compliance(EE_Payment_Method $payment_method) { |
|
435 | + if ($payment_method->type_obj()->requires_https()) { |
|
436 | 436 | return new EE_Form_Section_HTML( |
437 | 437 | EEH_HTML::tr( |
438 | 438 | EEH_HTML::th( |
439 | 439 | EEH_HTML::label( |
440 | - EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' ) |
|
440 | + EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice') |
|
441 | 441 | ) |
442 | - ) . |
|
442 | + ). |
|
443 | 443 | EEH_HTML::td( |
444 | - EEH_HTML::strong( __( 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso' )) . |
|
445 | - EEH_HTML::br() . |
|
446 | - __( 'Learn more about ', 'event_espresso' ) . EEH_HTML::link( 'https://www.pcisecuritystandards.org/merchants/index.php', __( 'PCI DSS compliance', 'event_espresso' )) |
|
444 | + EEH_HTML::strong(__('You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso')). |
|
445 | + EEH_HTML::br(). |
|
446 | + __('Learn more about ', 'event_espresso').EEH_HTML::link('https://www.pcisecuritystandards.org/merchants/index.php', __('PCI DSS compliance', 'event_espresso')) |
|
447 | 447 | ) |
448 | 448 | ) |
449 | 449 | ); |
@@ -461,19 +461,19 @@ discard block |
||
461 | 461 | * @param \EE_Payment_Method $payment_method |
462 | 462 | * @return \EE_Form_Section_Proper |
463 | 463 | */ |
464 | - protected function _currency_support( EE_Payment_Method $payment_method ) { |
|
465 | - if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) { |
|
464 | + protected function _currency_support(EE_Payment_Method $payment_method) { |
|
465 | + if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) { |
|
466 | 466 | return new EE_Form_Section_HTML( |
467 | 467 | EEH_HTML::tr( |
468 | 468 | EEH_HTML::th( |
469 | 469 | EEH_HTML::label( |
470 | - EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' ) |
|
470 | + EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice') |
|
471 | 471 | ) |
472 | - ) . |
|
472 | + ). |
|
473 | 473 | EEH_HTML::td( |
474 | 474 | EEH_HTML::strong( |
475 | 475 | sprintf( |
476 | - __( 'This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'), |
|
476 | + __('This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'), |
|
477 | 477 | EE_Config::instance()->currency->code |
478 | 478 | ) |
479 | 479 | ) |
@@ -493,9 +493,9 @@ discard block |
||
493 | 493 | * @param \EE_Payment_Method $payment_method |
494 | 494 | * @return \EE_Form_Section_HTML |
495 | 495 | */ |
496 | - protected function _payment_method_settings( EE_Payment_Method $payment_method ) { |
|
496 | + protected function _payment_method_settings(EE_Payment_Method $payment_method) { |
|
497 | 497 | //modify the form so we only have/show fields that will be implemented for this version |
498 | - return $this->_simplify_form( $payment_method->type_obj()->settings_form(), $payment_method->name() ); |
|
498 | + return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name()); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | * @return \EE_Payment_Method_Form |
509 | 509 | * @throws \EE_Error |
510 | 510 | */ |
511 | - protected function _simplify_form( $form_section, $payment_method_name = '' ){ |
|
512 | - if ( $form_section instanceof EE_Payment_Method_Form ) { |
|
511 | + protected function _simplify_form($form_section, $payment_method_name = '') { |
|
512 | + if ($form_section instanceof EE_Payment_Method_Form) { |
|
513 | 513 | $form_section->exclude( |
514 | 514 | array( |
515 | 515 | 'PMD_type', //dont want them changing the type |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | ); |
521 | 521 | return $form_section; |
522 | 522 | } else { |
523 | - throw new EE_Error( sprintf( __( 'The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso' ), $payment_method_name )); |
|
523 | + throw new EE_Error(sprintf(__('The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso'), $payment_method_name)); |
|
524 | 524 | } |
525 | 525 | } |
526 | 526 | |
@@ -533,18 +533,18 @@ discard block |
||
533 | 533 | * @param \EE_Payment_Method $payment_method |
534 | 534 | * @return \EE_Form_Section_HTML |
535 | 535 | */ |
536 | - protected function _update_payment_method_button( EE_Payment_Method $payment_method ) { |
|
536 | + protected function _update_payment_method_button(EE_Payment_Method $payment_method) { |
|
537 | 537 | $update_button = new EE_Submit_Input( |
538 | 538 | array( |
539 | - 'html_id' => 'save_' . $payment_method->slug() . '_settings', |
|
540 | - 'default' => sprintf( __( 'Update %s Payment Settings', 'event_espresso' ), $payment_method->admin_name() ), |
|
539 | + 'html_id' => 'save_'.$payment_method->slug().'_settings', |
|
540 | + 'default' => sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()), |
|
541 | 541 | 'html_label' => EEH_HTML::nbsp() |
542 | 542 | ) |
543 | 543 | ); |
544 | 544 | return new EE_Form_Section_HTML( |
545 | - EEH_HTML::no_row( EEH_HTML::br(2) ) . |
|
545 | + EEH_HTML::no_row(EEH_HTML::br(2)). |
|
546 | 546 | EEH_HTML::tr( |
547 | - EEH_HTML::th( __( 'Update Settings', 'event_espresso') ) . |
|
547 | + EEH_HTML::th(__('Update Settings', 'event_espresso')). |
|
548 | 548 | EEH_HTML::td( |
549 | 549 | $update_button->get_html_for_input() |
550 | 550 | ) |
@@ -561,11 +561,11 @@ discard block |
||
561 | 561 | * @param \EE_Payment_Method $payment_method |
562 | 562 | * @return \EE_Form_Section_Proper |
563 | 563 | */ |
564 | - protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) { |
|
565 | - $link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() ); |
|
564 | + protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) { |
|
565 | + $link_text_and_title = sprintf(__('Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name()); |
|
566 | 566 | return new EE_Form_Section_HTML( |
567 | 567 | EEH_HTML::tr( |
568 | - EEH_HTML::th( __( 'Deactivate Payment Method', 'event_espresso') ) . |
|
568 | + EEH_HTML::th(__('Deactivate Payment Method', 'event_espresso')). |
|
569 | 569 | EEH_HTML::td( |
570 | 570 | EEH_HTML::link( |
571 | 571 | EE_Admin_Page::add_query_args_and_nonce( |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | ), |
578 | 578 | $link_text_and_title, |
579 | 579 | $link_text_and_title, |
580 | - 'deactivate_' . $payment_method->slug(), |
|
580 | + 'deactivate_'.$payment_method->slug(), |
|
581 | 581 | 'espresso-button button-secondary' |
582 | 582 | ) |
583 | 583 | ) |
@@ -593,12 +593,12 @@ discard block |
||
593 | 593 | * @param \EE_Payment_Method $payment_method |
594 | 594 | * @return \EE_Form_Section_Proper |
595 | 595 | */ |
596 | - protected function _activate_payment_method_button( EE_Payment_Method $payment_method ) { |
|
597 | - $link_text_and_title = sprintf( __( 'Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name() ); |
|
596 | + protected function _activate_payment_method_button(EE_Payment_Method $payment_method) { |
|
597 | + $link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name()); |
|
598 | 598 | return new EE_Form_Section_Proper( |
599 | 599 | array( |
600 | - 'name' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
601 | - 'html_id' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
600 | + 'name' => 'activate_'.$payment_method->slug().'_settings_form', |
|
601 | + 'html_id' => 'activate_'.$payment_method->slug().'_settings_form', |
|
602 | 602 | 'action' => '#', |
603 | 603 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
604 | 604 | 'subsections' => apply_filters( |
@@ -606,17 +606,17 @@ discard block |
||
606 | 606 | array( |
607 | 607 | new EE_Form_Section_HTML( |
608 | 608 | EEH_HTML::tr( |
609 | - EEH_HTML::td( $payment_method->type_obj()->introductory_html(), |
|
609 | + EEH_HTML::td($payment_method->type_obj()->introductory_html(), |
|
610 | 610 | '', |
611 | 611 | '', |
612 | 612 | '', |
613 | 613 | 'colspan="2"' |
614 | 614 | ) |
615 | - ) . |
|
615 | + ). |
|
616 | 616 | EEH_HTML::tr( |
617 | 617 | EEH_HTML::th( |
618 | - EEH_HTML::label( __( 'Click to Activate ', 'event_espresso' )) |
|
619 | - ) . |
|
618 | + EEH_HTML::label(__('Click to Activate ', 'event_espresso')) |
|
619 | + ). |
|
620 | 620 | EEH_HTML::td( |
621 | 621 | EEH_HTML::link( |
622 | 622 | EE_Admin_Page::add_query_args_and_nonce( |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | ), |
629 | 629 | $link_text_and_title, |
630 | 630 | $link_text_and_title, |
631 | - 'activate_' . $payment_method->slug(), |
|
631 | + 'activate_'.$payment_method->slug(), |
|
632 | 632 | 'espresso-button-green button-primary' |
633 | 633 | ) |
634 | 634 | ) |
@@ -650,9 +650,9 @@ discard block |
||
650 | 650 | protected function _fine_print() { |
651 | 651 | return new EE_Form_Section_HTML( |
652 | 652 | EEH_HTML::tr( |
653 | - EEH_HTML::th() . |
|
653 | + EEH_HTML::th(). |
|
654 | 654 | EEH_HTML::td( |
655 | - EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' ) |
|
655 | + EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text') |
|
656 | 656 | ) |
657 | 657 | ) |
658 | 658 | ); |
@@ -664,15 +664,15 @@ discard block |
||
664 | 664 | * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far) |
665 | 665 | * @global WP_User $current_user |
666 | 666 | */ |
667 | - protected function _activate_payment_method(){ |
|
668 | - if(isset($this->_req_data['payment_method_type'])){ |
|
667 | + protected function _activate_payment_method() { |
|
668 | + if (isset($this->_req_data['payment_method_type'])) { |
|
669 | 669 | $payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']); |
670 | 670 | //see if one exists |
671 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
672 | - $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type ); |
|
671 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
672 | + $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type($payment_method_type); |
|
673 | 673 | |
674 | - $this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug())); |
|
675 | - }else{ |
|
674 | + $this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default', 'payment_method'=>$payment_method->slug())); |
|
675 | + } else { |
|
676 | 676 | $this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); |
677 | 677 | } |
678 | 678 | } |
@@ -680,14 +680,14 @@ discard block |
||
680 | 680 | /** |
681 | 681 | * Deactivates the payment method with the specified slug, and redirects. |
682 | 682 | */ |
683 | - protected function _deactivate_payment_method(){ |
|
684 | - if(isset($this->_req_data['payment_method'])){ |
|
683 | + protected function _deactivate_payment_method() { |
|
684 | + if (isset($this->_req_data['payment_method'])) { |
|
685 | 685 | $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
686 | 686 | //deactivate it |
687 | 687 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
688 | - $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug ); |
|
689 | - $this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug)); |
|
690 | - }else{ |
|
688 | + $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug); |
|
689 | + $this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default', 'payment_method'=>$payment_method_slug)); |
|
690 | + } else { |
|
691 | 691 | $this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default')); |
692 | 692 | } |
693 | 693 | } |
@@ -701,39 +701,39 @@ discard block |
||
701 | 701 | * subsequently called 'headers_sent_func' which is _payment_methods_list) |
702 | 702 | * @return void |
703 | 703 | */ |
704 | - protected function _update_payment_method(){ |
|
705 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
704 | + protected function _update_payment_method() { |
|
705 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
706 | 706 | //ok let's find which gateway form to use based on the form input |
707 | 707 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
708 | 708 | /** @var $correct_pmt_form_to_use EE_Payment_Method_Form */ |
709 | 709 | $correct_pmt_form_to_use = NULL; |
710 | 710 | $pmt_obj = NULL; |
711 | - foreach(EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj){ |
|
711 | + foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { |
|
712 | 712 | /** @var $pmt_obj EE_PMT_Base */ |
713 | 713 | //get the form and simplify it, like what we do when we display it |
714 | 714 | $pmt_form = $pmt_obj->settings_form(); |
715 | 715 | $this->_simplify_form($pmt_form); |
716 | - if($pmt_form->form_data_present_in($this->_req_data)){ |
|
716 | + if ($pmt_form->form_data_present_in($this->_req_data)) { |
|
717 | 717 | $correct_pmt_form_to_use = $pmt_form; |
718 | 718 | break; |
719 | 719 | } |
720 | 720 | } |
721 | 721 | //if we couldn't find the correct payment method type... |
722 | - if( ! $correct_pmt_form_to_use ){ |
|
722 | + if ( ! $correct_pmt_form_to_use) { |
|
723 | 723 | EE_Error::add_error(__("We could not find which payment method type your form submission related to. Please contact support", 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
724 | 724 | $this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); |
725 | 725 | } |
726 | 726 | $correct_pmt_form_to_use->receive_form_submission($this->_req_data); |
727 | - if($correct_pmt_form_to_use->is_valid()){ |
|
727 | + if ($correct_pmt_form_to_use->is_valid()) { |
|
728 | 728 | $correct_pmt_form_to_use->save(); |
729 | 729 | $pm = $correct_pmt_form_to_use->get_model_object(); |
730 | 730 | /** @var $pm EE_Payment_Method */ |
731 | - $this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug())); |
|
732 | - }else{ |
|
731 | + $this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default', 'payment_method'=>$pm->slug())); |
|
732 | + } else { |
|
733 | 733 | EE_Error::add_error( |
734 | 734 | sprintf( |
735 | 735 | __('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'), |
736 | - $pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __( '"(unknown)"', 'event_espresso' ) |
|
736 | + $pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __('"(unknown)"', 'event_espresso') |
|
737 | 737 | ), |
738 | 738 | __FILE__, |
739 | 739 | __FUNCTION__, |
@@ -750,11 +750,11 @@ discard block |
||
750 | 750 | protected function _payment_settings() { |
751 | 751 | |
752 | 752 | $this->_template_args['values'] = $this->_yes_no_values; |
753 | - $this->_template_args['show_pending_payment_options'] = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) ? absint( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) : FALSE; |
|
753 | + $this->_template_args['show_pending_payment_options'] = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) ? absint(EE_Registry::instance()->CFG->registration->show_pending_payment_options) : FALSE; |
|
754 | 754 | |
755 | - $this->_set_add_edit_form_tags( 'update_payment_settings' ); |
|
756 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
757 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_PAYMENTS_TEMPLATE_PATH . 'payment_settings.template.php', $this->_template_args, TRUE ); |
|
755 | + $this->_set_add_edit_form_tags('update_payment_settings'); |
|
756 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
757 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_PAYMENTS_TEMPLATE_PATH.'payment_settings.template.php', $this->_template_args, TRUE); |
|
758 | 758 | $this->display_admin_page_with_sidebar(); |
759 | 759 | |
760 | 760 | } |
@@ -768,13 +768,13 @@ discard block |
||
768 | 768 | * @return array |
769 | 769 | */ |
770 | 770 | protected function _update_payment_settings() { |
771 | - EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE; |
|
772 | - EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG ); |
|
771 | + EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset($this->_req_data['show_pending_payment_options']) ? $this->_req_data['show_pending_payment_options'] : FALSE; |
|
772 | + EE_Registry::instance()->CFG = apply_filters('FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG); |
|
773 | 773 | |
774 | 774 | |
775 | - $what = __('Payment Settings','event_espresso'); |
|
776 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ ); |
|
777 | - $this->_redirect_after_action( $success, $what, __('updated','event_espresso'), array( 'action' => 'payment_settings' ) ); |
|
775 | + $what = __('Payment Settings', 'event_espresso'); |
|
776 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__); |
|
777 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), array('action' => 'payment_settings')); |
|
778 | 778 | |
779 | 779 | } |
780 | 780 | protected function _payment_log_overview_list_table() { |
@@ -800,18 +800,18 @@ discard block |
||
800 | 800 | * @param bool $count |
801 | 801 | * @return array |
802 | 802 | */ |
803 | - public function get_payment_logs($per_page = 50, $current_page = 0, $count = false){ |
|
804 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
803 | + public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) { |
|
804 | + EE_Registry::instance()->load_model('Change_Log'); |
|
805 | 805 | //we may need to do multiple queries (joining differently), so we actually wan tan array of query params |
806 | - $query_params = array(array('LOG_type'=> EEM_Change_Log::type_gateway)); |
|
806 | + $query_params = array(array('LOG_type'=> EEM_Change_Log::type_gateway)); |
|
807 | 807 | //check if they've selected a specific payment method |
808 | - if( isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all'){ |
|
808 | + if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') { |
|
809 | 809 | $query_params[0]['OR*pm_or_pay_pm'] = array('Payment.Payment_Method.PMD_ID'=>$this->_req_data['_payment_method'], |
810 | 810 | 'Payment_Method.PMD_ID'=>$this->_req_data['_payment_method']); |
811 | 811 | } |
812 | 812 | //take into account search |
813 | - if(isset($this->_req_data['s']) && $this->_req_data['s']){ |
|
814 | - $similarity_string = array('LIKE','%'.str_replace("","%",$this->_req_data['s']) .'%'); |
|
813 | + if (isset($this->_req_data['s']) && $this->_req_data['s']) { |
|
814 | + $similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%'); |
|
815 | 815 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string; |
816 | 816 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string; |
817 | 817 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string; |
@@ -826,48 +826,48 @@ discard block |
||
826 | 826 | $query_params[0]['OR*s']['LOG_message'] = $similarity_string; |
827 | 827 | |
828 | 828 | } |
829 | - if(isset( $this->_req_data['payment-filter-start-date'] ) && isset( $this->_req_data['payment-filter-end-date'] )){ |
|
829 | + if (isset($this->_req_data['payment-filter-start-date']) && isset($this->_req_data['payment-filter-end-date'])) { |
|
830 | 830 | //add date |
831 | - $start_date =wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] ); |
|
832 | - $end_date = wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] ); |
|
831 | + $start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']); |
|
832 | + $end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']); |
|
833 | 833 | //make sure our timestamps start and end right at the boundaries for each day |
834 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
835 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
834 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
835 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
836 | 836 | |
837 | 837 | //convert to timestamps |
838 | - $start_date = strtotime( $start_date ); |
|
839 | - $end_date = strtotime( $end_date ); |
|
838 | + $start_date = strtotime($start_date); |
|
839 | + $end_date = strtotime($end_date); |
|
840 | 840 | |
841 | 841 | //makes sure start date is the lowest value and vice versa |
842 | - $start_date = min( $start_date, $end_date ); |
|
843 | - $end_date = max( $start_date, $end_date ); |
|
842 | + $start_date = min($start_date, $end_date); |
|
843 | + $end_date = max($start_date, $end_date); |
|
844 | 844 | |
845 | 845 | //convert for query |
846 | - $start_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' ); |
|
847 | - $end_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' ); |
|
846 | + $start_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s'); |
|
847 | + $end_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s'); |
|
848 | 848 | |
849 | - $query_params[0]['LOG_time'] = array('BETWEEN',array($start_date,$end_date)); |
|
849 | + $query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date)); |
|
850 | 850 | |
851 | 851 | } |
852 | - if($count){ |
|
852 | + if ($count) { |
|
853 | 853 | return EEM_Change_Log::instance()->count($query_params); |
854 | 854 | } |
855 | - if(isset($this->_req_data['order'])){ |
|
856 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
855 | + if (isset($this->_req_data['order'])) { |
|
856 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
857 | 857 | $query_params['order_by'] = array('LOG_time' => $sort); |
858 | - }else{ |
|
858 | + } else { |
|
859 | 859 | $query_params['order_by'] = array('LOG_time' => 'DESC'); |
860 | 860 | } |
861 | - $offset = ($current_page-1)*$per_page; |
|
861 | + $offset = ($current_page - 1) * $per_page; |
|
862 | 862 | |
863 | - if( ! isset($this->_req_data['download_results'])){ |
|
864 | - $query_params['limit'] = array( $offset, $per_page ); |
|
863 | + if ( ! isset($this->_req_data['download_results'])) { |
|
864 | + $query_params['limit'] = array($offset, $per_page); |
|
865 | 865 | } |
866 | 866 | |
867 | 867 | |
868 | 868 | |
869 | 869 | //now they've requested to instead just download the file instead of viewing it. |
870 | - if(isset($this->_req_data['download_results'])){ |
|
870 | + if (isset($this->_req_data['download_results'])) { |
|
871 | 871 | $wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params); |
872 | 872 | header('Content-Disposition: attachment'); |
873 | 873 | header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url())); |
@@ -889,36 +889,36 @@ discard block |
||
889 | 889 | * @param EE_Change_Log $logB |
890 | 890 | * @return int |
891 | 891 | */ |
892 | - protected function _sort_logs_again($logA,$logB){ |
|
892 | + protected function _sort_logs_again($logA, $logB) { |
|
893 | 893 | $timeA = $logA->get_raw('LOG_time'); |
894 | 894 | $timeB = $logB->get_raw('LOG_time'); |
895 | - if($timeA == $timeB){ |
|
895 | + if ($timeA == $timeB) { |
|
896 | 896 | return 0; |
897 | 897 | } |
898 | 898 | $comparison = $timeA < $timeB ? -1 : 1; |
899 | - if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){ |
|
899 | + if (strtoupper($this->_sort_logs_again_direction) == 'DESC') { |
|
900 | 900 | return $comparison * -1; |
901 | - }else{ |
|
901 | + } else { |
|
902 | 902 | return $comparison; |
903 | 903 | } |
904 | 904 | } |
905 | 905 | |
906 | 906 | protected function _payment_log_details() { |
907 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
907 | + EE_Registry::instance()->load_model('Change_Log'); |
|
908 | 908 | /** @var $payment_log EE_Change_Log */ |
909 | 909 | $payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']); |
910 | 910 | $payment_method = NULL; |
911 | 911 | $transaction = NULL; |
912 | - if( $payment_log instanceof EE_Change_Log ){ |
|
913 | - if( $payment_log->object() instanceof EE_Payment ){ |
|
912 | + if ($payment_log instanceof EE_Change_Log) { |
|
913 | + if ($payment_log->object() instanceof EE_Payment) { |
|
914 | 914 | $payment_method = $payment_log->object()->payment_method(); |
915 | 915 | $transaction = $payment_log->object()->transaction(); |
916 | - }elseif($payment_log->object() instanceof EE_Payment_Method){ |
|
916 | + }elseif ($payment_log->object() instanceof EE_Payment_Method) { |
|
917 | 917 | $payment_method = $payment_log->object(); |
918 | 918 | } |
919 | 919 | } |
920 | 920 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
921 | - EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php', |
|
921 | + EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php', |
|
922 | 922 | array( |
923 | 923 | 'payment_log'=>$payment_log, |
924 | 924 | 'payment_method'=>$payment_method, |
@@ -1,1 +1,1 @@ |
||
1 | -<?php printf( esc_html__('Authorize.Net AIM is an on-site payment method for accepting credit and debit card payments and is available to event organizers in the United States, Canada, United Kingdom, and Australia. An account with Authorize.Net is required to accept payments. Need an Authorize.Net account? %1$sClick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/authorizenetaim/" target="_blank">','</a>' ); |
|
2 | 1 | \ No newline at end of file |
2 | +<?php printf(esc_html__('Authorize.Net AIM is an on-site payment method for accepting credit and debit card payments and is available to event organizers in the United States, Canada, United Kingdom, and Australia. An account with Authorize.Net is required to accept payments. Need an Authorize.Net account? %1$sClick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/authorizenetaim/" target="_blank">', '</a>'); |
|
3 | 3 | \ No newline at end of file |
@@ -1,1 +1,1 @@ |
||
1 | -<?php printf( esc_html__('Mijireh is an off-site payment method for accepting payments online through over 80+ payment gateways and is available to event organizers in many countries. An account with Mijireh is required to accept payments. Need a Mijireh account? %1$sClick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/mijireh/" target="_blank">','</a>' ); |
|
2 | 1 | \ No newline at end of file |
2 | +<?php printf(esc_html__('Mijireh is an off-site payment method for accepting payments online through over 80+ payment gateways and is available to event organizers in many countries. An account with Mijireh is required to accept payments. Need a Mijireh account? %1$sClick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/mijireh/" target="_blank">', '</a>'); |
|
3 | 3 | \ No newline at end of file |