@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * This is used to output a single |
48 | 48 | * @param EE_Line_Item $line_item |
49 | 49 | * @param array $options |
50 | - * @return mixed |
|
50 | + * @return string |
|
51 | 51 | */ |
52 | 52 | public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
53 | 53 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @param EE_Line_Item $line_item |
165 | 165 | * @param array $options |
166 | - * @return mixed |
|
166 | + * @return string |
|
167 | 167 | */ |
168 | 168 | protected function _item_row( EE_Line_Item $line_item, $options = array() ) { |
169 | 169 | $line_item_related_object = $line_item->get_object(); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @param EE_Line_Item $line_item |
231 | 231 | * @param array $options |
232 | - * @return mixed |
|
232 | + * @return string |
|
233 | 233 | */ |
234 | 234 | protected function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
235 | 235 | //for now we're not showing sub-items |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * |
244 | 244 | * @param EE_Line_Item $line_item |
245 | 245 | * @param array $options |
246 | - * @return mixed |
|
246 | + * @return string |
|
247 | 247 | */ |
248 | 248 | protected function _tax_row( EE_Line_Item $line_item, $options = array() ) { |
249 | 249 | // start of row |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * @param EE_Line_Item $line_item |
267 | 267 | * @param string $text |
268 | 268 | * @param array $options |
269 | - * @return mixed |
|
269 | + * @return string |
|
270 | 270 | */ |
271 | 271 | protected function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) { |
272 | 272 | //currently not showing subtotal row |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @param EE_Line_Item $line_item |
282 | 282 | * @param array $options |
283 | - * @return mixed |
|
283 | + * @return string |
|
284 | 284 | */ |
285 | 285 | protected function _total_row( EE_Line_Item $line_item, $options = array() ) { |
286 | 286 | // start of row |
@@ -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,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -574,7 +576,7 @@ discard block |
||
574 | 576 | if($item->transaction()){ |
575 | 577 | $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
576 | 578 | return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
577 | - }else{ |
|
579 | + } else{ |
|
578 | 580 | return __("None", "event_espresso"); |
579 | 581 | } |
580 | 582 | } |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | /** |
55 | 55 | * @param \Registrations_Admin_Page $admin_page |
56 | 56 | */ |
57 | - public function __construct( Registrations_Admin_Page $admin_page ){ |
|
58 | - if ( ! empty( $_GET['event_id'] ) ) { |
|
57 | + public function __construct(Registrations_Admin_Page $admin_page) { |
|
58 | + if ( ! empty($_GET['event_id'])) { |
|
59 | 59 | $extra_query_args = array(); |
60 | - foreach ( $admin_page->get_views() as $key => $view_details ) { |
|
61 | - $extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] ); |
|
60 | + foreach ($admin_page->get_views() as $key => $view_details) { |
|
61 | + $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']); |
|
62 | 62 | } |
63 | - $this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args ); |
|
63 | + $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
64 | 64 | } |
65 | 65 | parent::__construct($admin_page); |
66 | 66 | $this->_status = $this->_admin_page->get_registration_status_array(); |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @return void |
76 | 76 | */ |
77 | 77 | protected function _setup_data() { |
78 | - $this->_data = $this->_admin_page->get_registrations( $this->_per_page ); |
|
79 | - $this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE ); |
|
78 | + $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
79 | + $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -93,30 +93,30 @@ discard block |
||
93 | 93 | 'ajax' => TRUE, |
94 | 94 | 'screen' => $this->_admin_page->get_current_screen()->id |
95 | 95 | ); |
96 | - $ID_column_name = __( 'ID', 'event_espresso' ); |
|
96 | + $ID_column_name = __('ID', 'event_espresso'); |
|
97 | 97 | $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
98 | - $ID_column_name .= __( 'Registrant Name', 'event_espresso' ); |
|
98 | + $ID_column_name .= __('Registrant Name', 'event_espresso'); |
|
99 | 99 | $ID_column_name .= '</span> '; |
100 | - if ( isset( $_GET['event_id'] )) { |
|
100 | + if (isset($_GET['event_id'])) { |
|
101 | 101 | $this->_columns = array( |
102 | 102 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
103 | 103 | '_REG_ID' => $ID_column_name, |
104 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
104 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
105 | 105 | 'ATT_email' => __('Email', 'event_espresso'), |
106 | - '_REG_date' => __( 'Reg Date', 'event_espresso' ), |
|
107 | - 'PRC_amount' => __( 'TKT Price', 'event_espresso' ), |
|
108 | - '_REG_final_price' => __( 'Final Price', 'event_espresso' ), |
|
109 | - 'TXN_total' => __( 'Total Txn', 'event_espresso' ), |
|
106 | + '_REG_date' => __('Reg Date', 'event_espresso'), |
|
107 | + 'PRC_amount' => __('TKT Price', 'event_espresso'), |
|
108 | + '_REG_final_price' => __('Final Price', 'event_espresso'), |
|
109 | + 'TXN_total' => __('Total Txn', 'event_espresso'), |
|
110 | 110 | 'TXN_paid' => __('Paid', 'event_espresso'), |
111 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
111 | + 'actions' => __('Actions', 'event_espresso') |
|
112 | 112 | ); |
113 | 113 | $this->_bottom_buttons = array( |
114 | 114 | 'report'=> array( |
115 | 115 | 'route' => 'registrations_report', |
116 | 116 | 'extra_request' => |
117 | 117 | array( |
118 | - 'EVT_ID'=> isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null, |
|
119 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) |
|
118 | + 'EVT_ID'=> isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
119 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") |
|
120 | 120 | ) |
121 | 121 | ), |
122 | 122 | ); |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | $this->_columns = array( |
125 | 125 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
126 | 126 | '_REG_ID' => $ID_column_name, |
127 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
128 | - '_REG_date' => __( 'TXN Date', 'event_espresso' ), |
|
129 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
130 | - 'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ), |
|
131 | - '_REG_final_price' => __( 'Price', 'event_espresso' ), |
|
132 | - '_REG_paid' => __( 'Paid', 'event_espresso' ), |
|
133 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
127 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
128 | + '_REG_date' => __('TXN Date', 'event_espresso'), |
|
129 | + 'event_name' => __('Event', 'event_espresso'), |
|
130 | + 'DTT_EVT_start' => __('Event Date', 'event_espresso'), |
|
131 | + '_REG_final_price' => __('Price', 'event_espresso'), |
|
132 | + '_REG_paid' => __('Paid', 'event_espresso'), |
|
133 | + 'actions' => __('Actions', 'event_espresso') |
|
134 | 134 | ); |
135 | 135 | $this->_bottom_buttons = array( |
136 | 136 | 'report_all'=> array( |
137 | 137 | 'route' => 'registrations_report', |
138 | 138 | 'extra_request' => array( |
139 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) |
|
139 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
140 | 140 | ), |
141 | 141 | ); |
142 | 142 | } |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | $this->_primary_column = '_REG_ID'; |
145 | 145 | |
146 | 146 | $this->_sortable_columns = array( |
147 | - '_REG_date' => array( '_REG_date' => TRUE ), //true means its already sorted |
|
148 | - 'ATT_fname' => array( 'ATT_fname' => FALSE ), |
|
149 | - 'event_name' => array( 'event_name' => FALSE ), |
|
150 | - 'DTT_EVT_start' => array( 'DTT_EVT_start' => FALSE ), |
|
151 | - '_REG_ID' => array( '_REG_ID' => FALSE ), |
|
147 | + '_REG_date' => array('_REG_date' => TRUE), //true means its already sorted |
|
148 | + 'ATT_fname' => array('ATT_fname' => FALSE), |
|
149 | + 'event_name' => array('event_name' => FALSE), |
|
150 | + 'DTT_EVT_start' => array('DTT_EVT_start' => FALSE), |
|
151 | + '_REG_ID' => array('_REG_ID' => FALSE), |
|
152 | 152 | ); |
153 | 153 | |
154 | 154 | $this->_hidden_columns = array(); |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | * @param EE_Registration $item the current item |
163 | 163 | * @return string |
164 | 164 | */ |
165 | - protected function _get_row_class( $item ) { |
|
166 | - $class = parent::_get_row_class( $item ); |
|
165 | + protected function _get_row_class($item) { |
|
166 | + $class = parent::_get_row_class($item); |
|
167 | 167 | //add status class |
168 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
169 | - if ( $this->_has_checkbox_column ) { |
|
168 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
169 | + if ($this->_has_checkbox_column) { |
|
170 | 170 | $class .= ' has-checkbox-column'; |
171 | 171 | } |
172 | 172 | return $class; |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | * @param EE_Registration $registration |
181 | 181 | * @throws \EE_Error |
182 | 182 | */ |
183 | - protected function _set_related_details( EE_Registration $registration ) { |
|
183 | + protected function _set_related_details(EE_Registration $registration) { |
|
184 | 184 | |
185 | - $transaction = $registration->get_first_related( 'Transaction' ); |
|
185 | + $transaction = $registration->get_first_related('Transaction'); |
|
186 | 186 | $status = $transaction instanceof EE_Transaction |
187 | 187 | ? $transaction->status_ID() |
188 | 188 | : EEM_Transaction::failed_status_code; |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | 'status' => $status, |
192 | 192 | 'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0, |
193 | 193 | 'title_attr' => sprintf( |
194 | - __( 'View Transaction Details (%s)', 'event_espresso' ), |
|
195 | - EEH_Template::pretty_status( $status, false, 'sentence' ) |
|
194 | + __('View Transaction Details (%s)', 'event_espresso'), |
|
195 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
196 | 196 | ) |
197 | 197 | ); |
198 | 198 | |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | 'status' => $status, |
204 | 204 | 'id' => $event instanceof EE_Event ? $event->ID() : 0, |
205 | 205 | 'title_attr' => sprintf( |
206 | - __( 'Edit Event (%s)', 'event_espresso' ), |
|
207 | - EEH_Template::pretty_status( $status, false, 'sentence' ) |
|
206 | + __('Edit Event (%s)', 'event_espresso'), |
|
207 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
208 | 208 | ) |
209 | 209 | ); |
210 | 210 | } |
@@ -221,30 +221,30 @@ discard block |
||
221 | 221 | |
222 | 222 | //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods. |
223 | 223 | |
224 | - $cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : ''; |
|
225 | - $cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
226 | - $reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : ''; |
|
224 | + $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
225 | + $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
226 | + $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : ''; |
|
227 | 227 | |
228 | - $filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category ); |
|
229 | - $filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category ); |
|
228 | + $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
229 | + $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
230 | 230 | |
231 | 231 | $status = array(); |
232 | - $status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') ); |
|
233 | - foreach ( $this->_status as $key => $value ) { |
|
234 | - $status[] = array( 'id' => $key, 'text' => $value ); |
|
232 | + $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso')); |
|
233 | + foreach ($this->_status as $key => $value) { |
|
234 | + $status[] = array('id' => $key, 'text' => $value); |
|
235 | 235 | } |
236 | - if ( $this->_view !== 'incomplete' ) { |
|
236 | + if ($this->_view !== 'incomplete') { |
|
237 | 237 | $filters[] = EEH_Form_Fields::select_input( |
238 | 238 | '_reg_status', |
239 | 239 | $status, |
240 | - isset( $this->_req_data['_reg_status'] ) |
|
241 | - ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] )) |
|
240 | + isset($this->_req_data['_reg_status']) |
|
241 | + ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) |
|
242 | 242 | : '' |
243 | 243 | ); |
244 | 244 | } |
245 | 245 | |
246 | - if ( isset( $this->_req_data['event_id'] ) ) { |
|
247 | - $filters[] = EEH_Form_Fields::hidden_input( 'event_id', $this->_req_data['event_id'], 'reg_event_id' ); |
|
246 | + if (isset($this->_req_data['event_id'])) { |
|
247 | + $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | return $filters; |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | $this->_views['all']['count'] = $this->_total_registrations(); |
264 | 264 | $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
265 | 265 | $this->_views['today']['count'] = $this->_total_registrations_today(); |
266 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) { |
|
267 | - $this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' ); |
|
268 | - $this->_views['trash']['count'] = $this->_total_registrations( 'trash' ); |
|
266 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) { |
|
267 | + $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
268 | + $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
269 | 269 | } |
270 | 270 | } |
271 | 271 | |
@@ -279,23 +279,23 @@ discard block |
||
279 | 279 | * @return int |
280 | 280 | * @throws \EE_Error |
281 | 281 | */ |
282 | - protected function _total_registrations( $view = '' ){ |
|
282 | + protected function _total_registrations($view = '') { |
|
283 | 283 | $_where = array(); |
284 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
285 | - if( $EVT_ID ) { |
|
284 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
285 | + if ($EVT_ID) { |
|
286 | 286 | $_where['EVT_ID'] = $EVT_ID; |
287 | 287 | } |
288 | - switch ( $view ) { |
|
288 | + switch ($view) { |
|
289 | 289 | case 'trash' : |
290 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
290 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
291 | 291 | break; |
292 | 292 | case 'incomplete' : |
293 | 293 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
294 | 294 | break; |
295 | 295 | default : |
296 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
296 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
297 | 297 | } |
298 | - return EEM_Registration::instance()->count( array( $_where )); |
|
298 | + return EEM_Registration::instance()->count(array($_where)); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | |
@@ -307,32 +307,32 @@ discard block |
||
307 | 307 | * @return int |
308 | 308 | * @throws \EE_Error |
309 | 309 | */ |
310 | - protected function _total_registrations_this_month(){ |
|
311 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
312 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
310 | + protected function _total_registrations_this_month() { |
|
311 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
312 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
313 | 313 | $this_year_r = date('Y', current_time('timestamp')); |
314 | 314 | $time_start = ' 00:00:00'; |
315 | 315 | $time_end = ' 23:59:59'; |
316 | 316 | $this_month_r = date('m', current_time('timestamp')); |
317 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
317 | + $days_this_month = date('t', current_time('timestamp')); |
|
318 | 318 | //setup date query. |
319 | 319 | $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
320 | 320 | 'REG_date', |
321 | - $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
321 | + $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, |
|
322 | 322 | 'Y-m-d H:i:s' |
323 | 323 | ); |
324 | 324 | $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
325 | 325 | 'REG_date', |
326 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
326 | + $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, |
|
327 | 327 | 'Y-m-d H:i:s' |
328 | 328 | ); |
329 | - $_where['REG_date']= array('BETWEEN', |
|
329 | + $_where['REG_date'] = array('BETWEEN', |
|
330 | 330 | array( |
331 | 331 | $beginning_string, |
332 | 332 | $end_string |
333 | 333 | )); |
334 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
335 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
334 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
335 | + return EEM_Registration::instance()->count(array($_where)); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | |
@@ -344,20 +344,20 @@ discard block |
||
344 | 344 | * @return int |
345 | 345 | * @throws \EE_Error |
346 | 346 | */ |
347 | - protected function _total_registrations_today(){ |
|
347 | + protected function _total_registrations_today() { |
|
348 | 348 | |
349 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
350 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
349 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
350 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
351 | 351 | $current_date = date('Y-m-d', current_time('timestamp')); |
352 | 352 | $time_start = ' 00:00:00'; |
353 | 353 | $time_end = ' 23:59:59'; |
354 | - $_where['REG_date']= array('BETWEEN', |
|
354 | + $_where['REG_date'] = array('BETWEEN', |
|
355 | 355 | array( |
356 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ), |
|
357 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' ) |
|
356 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'), |
|
357 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s') |
|
358 | 358 | )); |
359 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
360 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
359 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
360 | + return EEM_Registration::instance()->count(array($_where)); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -370,12 +370,12 @@ discard block |
||
370 | 370 | * @return string |
371 | 371 | * @throws \EE_Error |
372 | 372 | */ |
373 | - public function column_cb($item){ |
|
373 | + public function column_cb($item) { |
|
374 | 374 | /** checkbox/lock **/ |
375 | - $transaction = $item->get_first_related( 'Transaction' ); |
|
376 | - $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
|
375 | + $transaction = $item->get_first_related('Transaction'); |
|
376 | + $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0; |
|
377 | 377 | return $payment_count > 0 |
378 | - ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) |
|
378 | + ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()) |
|
379 | 379 | . '<span class="ee-lock-icon"></span>' |
380 | 380 | : sprintf( |
381 | 381 | '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', |
@@ -393,14 +393,14 @@ discard block |
||
393 | 393 | * @return string |
394 | 394 | * @throws \EE_Error |
395 | 395 | */ |
396 | - public function column__REG_ID(EE_Registration $item){ |
|
396 | + public function column__REG_ID(EE_Registration $item) { |
|
397 | 397 | $attendee = $item->attendee(); |
398 | 398 | $content = $item->ID(); |
399 | 399 | $content .= '<div class="show-on-mobile-view-only">'; |
400 | 400 | $content .= '<br>'; |
401 | 401 | $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
402 | - $content .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
403 | - $content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
402 | + $content .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
403 | + $content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
404 | 404 | $content .= '</div>'; |
405 | 405 | return $content; |
406 | 406 | } |
@@ -415,12 +415,12 @@ discard block |
||
415 | 415 | * @return string |
416 | 416 | * @throws \EE_Error |
417 | 417 | */ |
418 | - public function column__REG_date(EE_Registration $item){ |
|
418 | + public function column__REG_date(EE_Registration $item) { |
|
419 | 419 | $this->_set_related_details($item); |
420 | 420 | //Build row actions |
421 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
422 | - $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
|
423 | - $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
|
421 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL); |
|
422 | + $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date'); |
|
423 | + $view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>'; |
|
424 | 424 | return $view_link; |
425 | 425 | } |
426 | 426 | |
@@ -434,18 +434,18 @@ discard block |
||
434 | 434 | * @return string |
435 | 435 | * @throws \EE_Error |
436 | 436 | */ |
437 | - public function column_event_name(EE_Registration $item){ |
|
438 | - $this->_set_related_details( $item ); |
|
437 | + public function column_event_name(EE_Registration $item) { |
|
438 | + $this->_set_related_details($item); |
|
439 | 439 | // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
440 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$item->event_ID() ), EVENTS_ADMIN_URL ); |
|
440 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$item->event_ID()), EVENTS_ADMIN_URL); |
|
441 | 441 | $event_name = $item->event_name(); |
442 | 442 | $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); |
443 | - $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID() ) ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr( $this->_event_details['title_attr'] ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ) ; |
|
443 | + $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID()) ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'); |
|
444 | 444 | |
445 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'event_id'=>$item->event_ID() ), REG_ADMIN_URL ); |
|
446 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Filter this list to only show registrations for %s', 'event_espresso' ), $event_name ) .'">' . __( 'View Registrations', 'event_espresso' ) . '</a>'; |
|
445 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id'=>$item->event_ID()), REG_ADMIN_URL); |
|
446 | + $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name).'">'.__('View Registrations', 'event_espresso').'</a>'; |
|
447 | 447 | |
448 | - return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) ); |
|
448 | + return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | |
@@ -458,18 +458,18 @@ discard block |
||
458 | 458 | * @return string |
459 | 459 | * @throws \EE_Error |
460 | 460 | */ |
461 | - public function column_DTT_EVT_start(EE_Registration $item){ |
|
461 | + public function column_DTT_EVT_start(EE_Registration $item) { |
|
462 | 462 | $datetime_strings = array(); |
463 | - $ticket = $item->ticket( TRUE ); |
|
464 | - if ( $ticket instanceof EE_Ticket ) { |
|
463 | + $ticket = $item->ticket(TRUE); |
|
464 | + if ($ticket instanceof EE_Ticket) { |
|
465 | 465 | $remove_defaults = array('default_where_conditions' => 'none'); |
466 | 466 | $datetimes = $ticket->datetimes($remove_defaults); |
467 | - foreach($datetimes as $datetime){ |
|
468 | - $datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
467 | + foreach ($datetimes as $datetime) { |
|
468 | + $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
469 | 469 | } |
470 | - return implode("<br />",$datetime_strings); |
|
470 | + return implode("<br />", $datetime_strings); |
|
471 | 471 | } else { |
472 | - return __( 'There is no ticket on this registration', 'event_espresso' ); |
|
472 | + return __('There is no ticket on this registration', 'event_espresso'); |
|
473 | 473 | } |
474 | 474 | } |
475 | 475 | |
@@ -483,45 +483,45 @@ discard block |
||
483 | 483 | * @return string |
484 | 484 | * @throws \EE_Error |
485 | 485 | */ |
486 | - public function column_ATT_fname(EE_Registration $item){ |
|
486 | + public function column_ATT_fname(EE_Registration $item) { |
|
487 | 487 | $attendee = $item->attendee(); |
488 | 488 | |
489 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
489 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
490 | 490 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
491 | - $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' : $attendee_name; |
|
491 | + $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' : $attendee_name; |
|
492 | 492 | $link .= $item->count() === 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : ''; |
493 | 493 | |
494 | 494 | $t = $item->get_first_related('Transaction'); |
495 | 495 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
496 | 496 | |
497 | 497 | //append group count to name |
498 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
498 | + $link .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
499 | 499 | |
500 | 500 | //append reg_code |
501 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
501 | + $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
502 | 502 | |
503 | 503 | //reg status text for accessibility |
504 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
504 | + $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
505 | 505 | |
506 | 506 | //trash/restore/delete actions |
507 | 507 | $actions = array(); |
508 | - if ( $this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) { |
|
509 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
510 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>'; |
|
511 | - } elseif ( $this->_view === 'trash' ) { |
|
508 | + if ($this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) { |
|
509 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
510 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
511 | + } elseif ($this->_view === 'trash') { |
|
512 | 512 | // restore registration link |
513 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) { |
|
514 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
515 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
513 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) { |
|
514 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
515 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
516 | 516 | } |
517 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) { |
|
518 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
517 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) { |
|
518 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
519 | 519 | |
520 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
520 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>'; |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | |
524 | - return sprintf('%1$s %2$s', $link, $this->row_actions($actions) ); |
|
524 | + return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * @return string |
535 | 535 | * @throws \EE_Error |
536 | 536 | */ |
537 | - public function column_ATT_email( EE_Registration $item ) { |
|
537 | + public function column_ATT_email(EE_Registration $item) { |
|
538 | 538 | $attendee = $item->get_first_related('Attendee'); |
539 | 539 | return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email(); |
540 | 540 | } |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * @param \EE_Registration $item |
549 | 549 | * @return string |
550 | 550 | */ |
551 | - public function column__REG_count(EE_Registration $item){ |
|
552 | - return sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size()); |
|
551 | + public function column__REG_count(EE_Registration $item) { |
|
552 | + return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
@@ -561,16 +561,16 @@ discard block |
||
561 | 561 | * @param \EE_Registration $item |
562 | 562 | * @return string |
563 | 563 | */ |
564 | - public function column_PRC_amount(EE_Registration $item){ |
|
564 | + public function column_PRC_amount(EE_Registration $item) { |
|
565 | 565 | $ticket = $item->ticket(); |
566 | 566 | |
567 | - $content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : ''; |
|
567 | + $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : ''; |
|
568 | 568 | |
569 | - if ( $item->final_price() > 0 ) { |
|
570 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
569 | + if ($item->final_price() > 0) { |
|
570 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
571 | 571 | } else { |
572 | 572 | // free event |
573 | - $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
573 | + $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>'; |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | return $content; |
@@ -586,11 +586,11 @@ discard block |
||
586 | 586 | * @param \EE_Registration $item |
587 | 587 | * @return string |
588 | 588 | */ |
589 | - public function column__REG_final_price(EE_Registration $item){ |
|
589 | + public function column__REG_final_price(EE_Registration $item) { |
|
590 | 590 | $ticket = $item->ticket(); |
591 | - $content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />'; |
|
591 | + $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />'; |
|
592 | 592 | |
593 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
593 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
594 | 594 | return $content; |
595 | 595 | |
596 | 596 | } |
@@ -604,13 +604,13 @@ discard block |
||
604 | 604 | * @param \EE_Registration $item |
605 | 605 | * @return string |
606 | 606 | */ |
607 | - public function column__REG_paid(EE_Registration $item){ |
|
607 | + public function column__REG_paid(EE_Registration $item) { |
|
608 | 608 | $payment_method = $item->payment_method(); |
609 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
609 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
610 | 610 | |
611 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
612 | - if ( $item->paid() > 0 ) { |
|
613 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
611 | + $content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>'; |
|
612 | + if ($item->paid() > 0) { |
|
613 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
614 | 614 | } |
615 | 615 | return $content; |
616 | 616 | } |
@@ -625,11 +625,11 @@ discard block |
||
625 | 625 | * @return string |
626 | 626 | * @throws \EE_Error |
627 | 627 | */ |
628 | - public function column_TXN_total(EE_Registration $item){ |
|
629 | - if($item->transaction()){ |
|
630 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
631 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
632 | - }else{ |
|
628 | + public function column_TXN_total(EE_Registration $item) { |
|
629 | + if ($item->transaction()) { |
|
630 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
631 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>'; |
|
632 | + } else { |
|
633 | 633 | return __("None", "event_espresso"); |
634 | 634 | } |
635 | 635 | } |
@@ -644,15 +644,15 @@ discard block |
||
644 | 644 | * @return string |
645 | 645 | * @throws \EE_Error |
646 | 646 | */ |
647 | - public function column_TXN_paid(EE_Registration $item){ |
|
647 | + public function column_TXN_paid(EE_Registration $item) { |
|
648 | 648 | |
649 | - if ( $item->count() === 1 ) { |
|
649 | + if ($item->count() === 1) { |
|
650 | 650 | $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance(); |
651 | - if ( $transaction->paid() >= $transaction->total() ) { |
|
651 | + if ($transaction->paid() >= $transaction->total()) { |
|
652 | 652 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
653 | 653 | } else { |
654 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
655 | - return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
654 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
655 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
656 | 656 | } |
657 | 657 | } |
658 | 658 | |
@@ -672,44 +672,44 @@ discard block |
||
672 | 672 | */ |
673 | 673 | public function column_actions(EE_Registration $item) { |
674 | 674 | $attendee = $item->attendee(); |
675 | - $this->_set_related_details( $item ); |
|
675 | + $this->_set_related_details($item); |
|
676 | 676 | |
677 | 677 | //Build row actions |
678 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
679 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL ); |
|
678 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
679 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL); |
|
680 | 680 | |
681 | 681 | // page=attendees&event_admin_reports=resend_email®istration_id=43653465634&event_id=2&form_action=resend_email |
682 | 682 | //$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID ); |
683 | - $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true ); |
|
683 | + $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true); |
|
684 | 684 | |
685 | 685 | |
686 | 686 | //Build row actions |
687 | - $view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? ' |
|
687 | + $view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? ' |
|
688 | 688 | <li> |
689 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
689 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
690 | 690 | <div class="dashicons dashicons-clipboard"></div> |
691 | 691 | </a> |
692 | 692 | </li>' : ''; |
693 | 693 | |
694 | - $edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) && $attendee instanceof EE_Attendee ?' |
|
694 | + $edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? ' |
|
695 | 695 | <li> |
696 | - <a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text"> |
|
696 | + <a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text"> |
|
697 | 697 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div> |
698 | 698 | </a> |
699 | 699 | </li>' : ''; |
700 | 700 | |
701 | - $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? ' |
|
701 | + $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? ' |
|
702 | 702 | <li> |
703 | - <a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
703 | + <a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text"> |
|
704 | 704 | <div class="dashicons dashicons-email-alt"></div> |
705 | 705 | </a> |
706 | 706 | </li>' : ''; |
707 | 707 | |
708 | 708 | // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb |
709 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
710 | - $view_txn_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? ' |
|
709 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL); |
|
710 | + $view_txn_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? ' |
|
711 | 711 | <li> |
712 | - <a class="ee-status-color-' . $this->_transaction_details['status'] . ' tiny-text" href="'.$view_txn_lnk_url.'" title="' . $this->_transaction_details['title_attr'] . '"> |
|
712 | + <a class="ee-status-color-' . $this->_transaction_details['status'].' tiny-text" href="'.$view_txn_lnk_url.'" title="'.$this->_transaction_details['title_attr'].'"> |
|
713 | 713 | <div class="dashicons dashicons-cart"></div> |
714 | 714 | </a> |
715 | 715 | </li>' : ''; |
@@ -718,10 +718,10 @@ discard block |
||
718 | 718 | $dl_invoice_lnk = ''; |
719 | 719 | $dl_invoice_lnk_url = $item->invoice_url(); |
720 | 720 | //only show invoice link if message type is active. |
721 | - if ( $attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
721 | + if ($attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active('invoice')) { |
|
722 | 722 | $dl_invoice_lnk = ' |
723 | 723 | <li> |
724 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
724 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
725 | 725 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
726 | 726 | </a> |
727 | 727 | </li>'; |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | |
730 | 730 | $filtered_messages_link = ''; |
731 | 731 | //message list table link (filtered by REG_ID |
732 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
732 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
733 | 733 | $filtered_messages_link = '<li>' |
734 | 734 | . EEH_MSG_Template::get_message_action_link( |
735 | 735 | 'see_notifications_for', |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | . '</li>'; |
742 | 742 | } |
743 | 743 | |
744 | - return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk . $filtered_messages_link, $item, 'ul', 'reg-overview-actions-ul' ); |
|
744 | + return $this->_action_string($view_lnk.$edit_lnk.$resend_reg_lnk.$view_txn_lnk.$dl_invoice_lnk.$filtered_messages_link, $item, 'ul', 'reg-overview-actions-ul'); |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | } |
@@ -214,7 +214,7 @@ |
||
214 | 214 | /** |
215 | 215 | * _get_table_filters |
216 | 216 | * @access protected |
217 | - * @return array |
|
217 | + * @return string[] |
|
218 | 218 | */ |
219 | 219 | protected function _get_table_filters() { |
220 | 220 | $filters = array(); |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | * @return string |
371 | 371 | * @throws \EE_Error |
372 | 372 | */ |
373 | - public function column_cb($item){ |
|
373 | + public function column_cb($item){ |
|
374 | 374 | /** checkbox/lock **/ |
375 | 375 | $transaction = $item->get_first_related( 'Transaction' ); |
376 | 376 | $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
377 | - return $payment_count > 0 |
|
378 | - ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) |
|
379 | - . '<span class="ee-lock-icon"></span>' |
|
380 | - : sprintf( |
|
381 | - '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', |
|
382 | - $item->ID() |
|
383 | - ); |
|
384 | - } |
|
377 | + return $payment_count > 0 |
|
378 | + ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) |
|
379 | + . '<span class="ee-lock-icon"></span>' |
|
380 | + : sprintf( |
|
381 | + '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', |
|
382 | + $item->ID() |
|
383 | + ); |
|
384 | + } |
|
385 | 385 | |
386 | 386 | |
387 | 387 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | */ |
418 | 418 | public function column__REG_date(EE_Registration $item){ |
419 | 419 | $this->_set_related_details($item); |
420 | - //Build row actions |
|
420 | + //Build row actions |
|
421 | 421 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
422 | 422 | $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
423 | 423 | $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | } else { |
472 | 472 | return __( 'There is no ticket on this registration', 'event_espresso' ); |
473 | 473 | } |
474 | - } |
|
474 | + } |
|
475 | 475 | |
476 | 476 | |
477 | 477 | |
@@ -494,14 +494,14 @@ discard block |
||
494 | 494 | $t = $item->get_first_related('Transaction'); |
495 | 495 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
496 | 496 | |
497 | - //append group count to name |
|
498 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
497 | + //append group count to name |
|
498 | + $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
499 | 499 | |
500 | - //append reg_code |
|
501 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
500 | + //append reg_code |
|
501 | + $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
502 | 502 | |
503 | - //reg status text for accessibility |
|
504 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
503 | + //reg status text for accessibility |
|
504 | + $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
505 | 505 | |
506 | 506 | //trash/restore/delete actions |
507 | 507 | $actions = array(); |
@@ -731,14 +731,14 @@ discard block |
||
731 | 731 | //message list table link (filtered by REG_ID |
732 | 732 | if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
733 | 733 | $filtered_messages_link = '<li>' |
734 | - . EEH_MSG_Template::get_message_action_link( |
|
734 | + . EEH_MSG_Template::get_message_action_link( |
|
735 | 735 | 'see_notifications_for', |
736 | 736 | null, |
737 | 737 | array( |
738 | 738 | '_REG_ID' => $item->ID() |
739 | 739 | ) |
740 | 740 | ) |
741 | - . '</li>'; |
|
741 | + . '</li>'; |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk . $filtered_messages_link, $item, 'ul', 'reg-overview-actions-ul' ); |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * the purpose of this file is to simply contain any action/filter hook callbacks etc for specific aspects of EE related to caffeinated (regular) use. Before putting any code in here, First be certain that it isn't better to define and use the hook in a specific caffeinated/whatever class or file. |
4 | 6 | */ |
@@ -25,32 +25,32 @@ discard block |
||
25 | 25 | * ------------------------------------------------------------------------ |
26 | 26 | */ |
27 | 27 | // defined some new constants related to caffeinated folder |
28 | -define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' ); |
|
29 | -define('EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS); |
|
30 | -define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS); |
|
31 | -define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS ); |
|
28 | +define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/'); |
|
29 | +define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS); |
|
30 | +define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS); |
|
31 | +define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS); |
|
32 | 32 | class EE_Brewing_Regular extends EE_Base { |
33 | 33 | |
34 | 34 | public function __construct() { |
35 | - if ( defined( 'EE_CAFF_PATH' )) { |
|
35 | + if (defined('EE_CAFF_PATH')) { |
|
36 | 36 | // activation |
37 | - add_action( 'AHEE__EEH_Activation__initialize_db_content', array( $this, 'initialize_caf_db_content' )); |
|
37 | + add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); |
|
38 | 38 | // load caff init |
39 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'caffeinated_init' )); |
|
39 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); |
|
40 | 40 | // make it so the PDF receipt doesn't show our shameless plug |
41 | - add_filter( 'FHEE_Invoice__send_invoice__shameless_plug', '__return_false' ); |
|
41 | + add_filter('FHEE_Invoice__send_invoice__shameless_plug', '__return_false'); |
|
42 | 42 | // add caffeinated modules |
43 | - add_filter( 'FHEE__EE_Config__register_modules__modules_to_register', array( $this, 'caffeinated_modules_to_register' )); |
|
43 | + add_filter('FHEE__EE_Config__register_modules__modules_to_register', array($this, 'caffeinated_modules_to_register')); |
|
44 | 44 | // load caff scripts |
45 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_caffeinated_scripts'), 10 ); |
|
45 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); |
|
46 | 46 | |
47 | - add_filter( 'FHEE__EE_Registry__load_helper__helper_paths', array( $this, 'caf_helper_paths' ), 10 ); |
|
47 | + add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
48 | 48 | |
49 | - add_filter( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array( $this, 'caf_payment_methods' ) ); |
|
49 | + add_filter('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array($this, 'caf_payment_methods')); |
|
50 | 50 | // caffeinated constructed |
51 | - do_action( 'AHEE__EE_Brewing_Regular__construct__complete' ); |
|
51 | + do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
52 | 52 | //seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer |
53 | - add_filter( 'FHEE__ee_show_affiliate_links', '__return_false' ); |
|
53 | + add_filter('FHEE__ee_show_affiliate_links', '__return_false'); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | * @param array $paths original helper paths array |
61 | 61 | * @return array new array of paths |
62 | 62 | */ |
63 | - public function caf_helper_paths( $paths ) { |
|
64 | - $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
63 | + public function caf_helper_paths($paths) { |
|
64 | + $paths[] = EE_CAF_CORE.'helpers'.DS; |
|
65 | 65 | return $paths; |
66 | 66 | } |
67 | 67 | |
@@ -77,22 +77,22 @@ discard block |
||
77 | 77 | * Right now, we ASSUME the only price types in the system are default ones |
78 | 78 | * @global type $wpdb |
79 | 79 | */ |
80 | - function initialize_caf_db_content(){ |
|
80 | + function initialize_caf_db_content() { |
|
81 | 81 | // echo "initialize caf db content!"; |
82 | 82 | global $wpdb; |
83 | 83 | |
84 | 84 | //use same method of getting creator id as the version introducing the change |
85 | - $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id',get_current_user_id()); |
|
85 | + $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
86 | 86 | |
87 | 87 | $price_type_table = $wpdb->prefix."esp_price_type"; |
88 | 88 | $price_table = $wpdb->prefix."esp_price"; |
89 | 89 | |
90 | - if ( EEH_Activation::table_exists( $price_type_table ) ) { |
|
90 | + if (EEH_Activation::table_exists($price_type_table)) { |
|
91 | 91 | |
92 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';//include trashed price types |
|
93 | - $tax_price_type_count = $wpdb->get_var( $SQL ); |
|
92 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; //include trashed price types |
|
93 | + $tax_price_type_count = $wpdb->get_var($SQL); |
|
94 | 94 | |
95 | - if ( $tax_price_type_count <= 1) { |
|
95 | + if ($tax_price_type_count <= 1) { |
|
96 | 96 | $result = $wpdb->insert($price_type_table, |
97 | 97 | array( |
98 | 98 | 'PRT_name'=> __("Regional Tax", "event_espresso"), |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | 'PRT_wp_user' => $default_creator_id |
104 | 104 | ), |
105 | 105 | array( |
106 | - '%s',//PRT_name |
|
107 | - '%d',//PBT_id |
|
108 | - '%d',//PRT_is_percent |
|
109 | - '%d',//PRT_order |
|
110 | - '%d',//PRT_deleted |
|
106 | + '%s', //PRT_name |
|
107 | + '%d', //PBT_id |
|
108 | + '%d', //PRT_is_percent |
|
109 | + '%d', //PRT_order |
|
110 | + '%d', //PRT_deleted |
|
111 | 111 | '%d', //PRT_wp_user |
112 | 112 | )); |
113 | 113 | //federal tax |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | 'PRT_wp_user' => $default_creator_id, |
122 | 122 | ), |
123 | 123 | array( |
124 | - '%s',//PRT_name |
|
125 | - '%d',//PBT_id |
|
126 | - '%d',//PRT_is_percent |
|
127 | - '%d',//PRT_order |
|
128 | - '%d',//PRT_deleted |
|
124 | + '%s', //PRT_name |
|
125 | + '%d', //PBT_id |
|
126 | + '%d', //PRT_is_percent |
|
127 | + '%d', //PRT_order |
|
128 | + '%d', //PRT_deleted |
|
129 | 129 | '%d' //PRT_wp_user |
130 | 130 | )); |
131 | - if( $result){ |
|
131 | + if ($result) { |
|
132 | 132 | $wpdb->insert($price_table, |
133 | 133 | array( |
134 | 134 | 'PRT_ID'=>$wpdb->insert_id, |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | 'PRC_wp_user' => $default_creator_id |
144 | 144 | ), |
145 | 145 | array( |
146 | - '%d',//PRT_id |
|
147 | - '%f',//PRC_amount |
|
148 | - '%s',//PRC_name |
|
149 | - '%s',//PRC_desc |
|
150 | - '%d',//PRC_is_default |
|
151 | - '%d',//PRC_overrides |
|
152 | - '%d',//PRC_deleted |
|
153 | - '%d',//PRC_order |
|
154 | - '%d',//PRC_parent |
|
146 | + '%d', //PRT_id |
|
147 | + '%f', //PRC_amount |
|
148 | + '%s', //PRC_name |
|
149 | + '%s', //PRC_desc |
|
150 | + '%d', //PRC_is_default |
|
151 | + '%d', //PRC_overrides |
|
152 | + '%d', //PRC_deleted |
|
153 | + '%d', //PRC_order |
|
154 | + '%d', //PRC_parent |
|
155 | 155 | '%d' //PRC_wp_user |
156 | 156 | )); |
157 | 157 | } |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | * @param array $modules_to_register |
172 | 172 | * @return array |
173 | 173 | */ |
174 | - public function caffeinated_modules_to_register( $modules_to_register = array() ){ |
|
175 | - if ( is_readable( EE_CAFF_PATH . 'modules' )) { |
|
176 | - $caffeinated_modules_to_register = glob( EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR ); |
|
177 | - if ( is_array( $caffeinated_modules_to_register ) && ! empty( $caffeinated_modules_to_register )) { |
|
178 | - $modules_to_register = array_merge( $modules_to_register, $caffeinated_modules_to_register ); |
|
174 | + public function caffeinated_modules_to_register($modules_to_register = array()) { |
|
175 | + if (is_readable(EE_CAFF_PATH.'modules')) { |
|
176 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR); |
|
177 | + if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
178 | + $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | return $modules_to_register; |
@@ -183,19 +183,19 @@ discard block |
||
183 | 183 | |
184 | 184 | |
185 | 185 | |
186 | - public function caffeinated_init(){ |
|
186 | + public function caffeinated_init() { |
|
187 | 187 | // EE_Register_CPTs hooks |
188 | - add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( $this, 'filter_taxonomies' ), 10 ); |
|
189 | - add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array( $this, 'filter_cpts' ), 10 ); |
|
190 | - add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array( $this, 'nav_metabox_items' ), 10 ); |
|
191 | - EE_Registry::instance()->load_file( EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE ); |
|
188 | + add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array($this, 'filter_taxonomies'), 10); |
|
189 | + add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array($this, 'filter_cpts'), 10); |
|
190 | + add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array($this, 'nav_metabox_items'), 10); |
|
191 | + EE_Registry::instance()->load_file(EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE); |
|
192 | 192 | // caffeinated_init__complete hook |
193 | - do_action( 'AHEE__EE_Brewing_Regular__caffeinated_init__complete' ); |
|
193 | + do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
197 | 197 | |
198 | - public function enqueue_caffeinated_scripts(){ |
|
198 | + public function enqueue_caffeinated_scripts() { |
|
199 | 199 | // sound of crickets... |
200 | 200 | } |
201 | 201 | |
@@ -204,23 +204,23 @@ discard block |
||
204 | 204 | * callbacks below here |
205 | 205 | */ |
206 | 206 | |
207 | - public function filter_taxonomies( $taxonomy_array ) { |
|
207 | + public function filter_taxonomies($taxonomy_array) { |
|
208 | 208 | $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = TRUE; |
209 | 209 | return $taxonomy_array; |
210 | 210 | } |
211 | 211 | |
212 | 212 | |
213 | 213 | |
214 | - public function filter_cpts( $cpt_array ) { |
|
214 | + public function filter_cpts($cpt_array) { |
|
215 | 215 | $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = TRUE; |
216 | 216 | return $cpt_array; |
217 | 217 | } |
218 | 218 | |
219 | 219 | |
220 | - public function nav_metabox_items( $menuitems ) { |
|
220 | + public function nav_metabox_items($menuitems) { |
|
221 | 221 | $menuitems[] = array( |
222 | 222 | 'title' => __('Venue List', 'event_espresso'), |
223 | - 'url' => get_post_type_archive_link( 'espresso_venues' ), |
|
223 | + 'url' => get_post_type_archive_link('espresso_venues'), |
|
224 | 224 | 'description' => __('Archive page for all venues.', 'event_espresso') |
225 | 225 | ); |
226 | 226 | return $menuitems; |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | * @param array $payment_method_paths |
232 | 232 | * @return array values are folder paths to payment method folders |
233 | 233 | */ |
234 | - public function caf_payment_methods( $payment_method_paths ) { |
|
235 | - $caf_payment_methods_paths = glob( EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR ); |
|
236 | - $payment_method_paths = array_merge( $payment_method_paths, $caf_payment_methods_paths ); |
|
234 | + public function caf_payment_methods($payment_method_paths) { |
|
235 | + $caf_payment_methods_paths = glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR); |
|
236 | + $payment_method_paths = array_merge($payment_method_paths, $caf_payment_methods_paths); |
|
237 | 237 | return $payment_method_paths; |
238 | 238 | } |
239 | 239 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * |
4 | 6 | * EED_Ticket_Selector_Caff |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE ); |
3 | 5 | if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) { |
4 | 6 | set_error_handler( array( 'EE_Error', 'error_handler' )); |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE ); |
3 | -if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) { |
|
4 | - set_error_handler( array( 'EE_Error', 'error_handler' )); |
|
5 | - register_shutdown_function( array( 'EE_Error', 'fatal_error_handler' )); |
|
3 | +if (defined('WP_DEBUG') && WP_DEBUG === TRUE && defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS === TRUE) { |
|
4 | + set_error_handler(array('EE_Error', 'error_handler')); |
|
5 | + register_shutdown_function(array('EE_Error', 'fatal_error_handler')); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @access private |
65 | 65 | * @var boolean |
66 | 66 | */ |
67 | - private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE ); |
|
67 | + private static $_espresso_notices = array('success' => FALSE, 'errors' => FALSE, 'attention' => FALSE); |
|
68 | 68 | |
69 | 69 | |
70 | 70 | |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | * @access public |
76 | 76 | * @echo string |
77 | 77 | */ |
78 | - function __construct( $message, $code = 0, Exception $previous = NULL ) { |
|
79 | - if ( version_compare( phpversion(), '5.3.0', '<' )) { |
|
80 | - parent::__construct( $message, $code ); |
|
78 | + function __construct($message, $code = 0, Exception $previous = NULL) { |
|
79 | + if (version_compare(phpversion(), '5.3.0', '<')) { |
|
80 | + parent::__construct($message, $code); |
|
81 | 81 | } else { |
82 | - parent::__construct( $message, $code, $previous ); |
|
82 | + parent::__construct($message, $code, $previous); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | * @param $line |
95 | 95 | * @return void |
96 | 96 | */ |
97 | - public static function error_handler( $code, $message, $file, $line ) { |
|
98 | - $type = EE_Error::error_type( $code ); |
|
97 | + public static function error_handler($code, $message, $file, $line) { |
|
98 | + $type = EE_Error::error_type($code); |
|
99 | 99 | $site = site_url(); |
100 | - switch ( $site ) { |
|
100 | + switch ($site) { |
|
101 | 101 | case 'http://ee4.eventespresso.com/' : |
102 | 102 | case 'http://ee4decaf.eventespresso.com/' : |
103 | 103 | case 'http://ee4hf.eventespresso.com/' : |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | $to = '[email protected]'; |
111 | 111 | break; |
112 | 112 | default : |
113 | - $to = get_option( 'admin_email' ); |
|
113 | + $to = get_option('admin_email'); |
|
114 | 114 | } |
115 | - $subject = $type . ' ' . $message . ' in ' . EVENT_ESPRESSO_VERSION . ' on ' . site_url(); |
|
116 | - $msg = EE_Error::_format_error( $type, $message, $file, $line ); |
|
117 | - if ( function_exists( 'wp_mail' )) { |
|
118 | - add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' )); |
|
119 | - wp_mail( $to, $subject, $msg ); |
|
115 | + $subject = $type.' '.$message.' in '.EVENT_ESPRESSO_VERSION.' on '.site_url(); |
|
116 | + $msg = EE_Error::_format_error($type, $message, $file, $line); |
|
117 | + if (function_exists('wp_mail')) { |
|
118 | + add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type')); |
|
119 | + wp_mail($to, $subject, $msg); |
|
120 | 120 | } |
121 | 121 | echo '<div id="message" class="espresso-notices error"><p>'; |
122 | - echo $type . ': ' . $message . '<br />' . $file . ' line ' . $line; |
|
122 | + echo $type.': '.$message.'<br />'.$file.' line '.$line; |
|
123 | 123 | echo '<br /></p></div>'; |
124 | 124 | } |
125 | 125 | |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * @param $code |
133 | 133 | * @return string |
134 | 134 | */ |
135 | - public static function error_type( $code ) { |
|
136 | - switch( $code ) { |
|
135 | + public static function error_type($code) { |
|
136 | + switch ($code) { |
|
137 | 137 | case E_ERROR: // 1 // |
138 | 138 | return 'E_ERROR'; |
139 | 139 | case E_WARNING: // 2 // |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public static function fatal_error_handler() { |
181 | 181 | $last_error = error_get_last(); |
182 | - if ( $last_error['type'] === E_ERROR ) { |
|
183 | - EE_Error::error_handler( E_ERROR, $last_error['message'], $last_error['file'], $last_error['line'] ); |
|
182 | + if ($last_error['type'] === E_ERROR) { |
|
183 | + EE_Error::error_handler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param $line |
196 | 196 | * @return string |
197 | 197 | */ |
198 | - private static function _format_error( $code, $message, $file, $line ) { |
|
198 | + private static function _format_error($code, $message, $file, $line) { |
|
199 | 199 | $html = "<table cellpadding='5'><thead bgcolor='#f8f8f8'><th>Item</th><th align='left'>Details</th></thead><tbody>"; |
200 | 200 | $html .= "<tr valign='top'><td><b>Code</b></td><td>$code</td></tr>"; |
201 | 201 | $html .= "<tr valign='top'><td><b>Error</b></td><td>$message</td></tr>"; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param $content_type |
214 | 214 | * @return string |
215 | 215 | */ |
216 | - public static function set_content_type( $content_type ) { |
|
216 | + public static function set_content_type($content_type) { |
|
217 | 217 | return 'text/html'; |
218 | 218 | } |
219 | 219 | |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function get_error() { |
229 | 229 | |
230 | - if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){ |
|
230 | + if (apply_filters('FHEE__EE_Error__get_error__show_normal_exceptions', FALSE)) { |
|
231 | 231 | throw $this; |
232 | 232 | } |
233 | 233 | // get separate user and developer messages if they exist |
234 | - $msg = explode( '||', $this->getMessage() ); |
|
234 | + $msg = explode('||', $this->getMessage()); |
|
235 | 235 | $user_msg = $msg[0]; |
236 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
236 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
237 | 237 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
238 | 238 | |
239 | 239 | // add details to _all_exceptions array |
240 | 240 | $x_time = time(); |
241 | - self::$_all_exceptions[ $x_time ]['name'] = get_class( $this ); |
|
242 | - self::$_all_exceptions[ $x_time ]['file'] = $this->getFile(); |
|
243 | - self::$_all_exceptions[ $x_time ]['line'] = $this->getLine(); |
|
244 | - self::$_all_exceptions[ $x_time ]['msg'] = $msg; |
|
245 | - self::$_all_exceptions[ $x_time ]['code'] = $this->getCode(); |
|
246 | - self::$_all_exceptions[ $x_time ]['trace'] = $this->getTrace(); |
|
247 | - self::$_all_exceptions[ $x_time ]['string'] = $this->getTraceAsString(); |
|
241 | + self::$_all_exceptions[$x_time]['name'] = get_class($this); |
|
242 | + self::$_all_exceptions[$x_time]['file'] = $this->getFile(); |
|
243 | + self::$_all_exceptions[$x_time]['line'] = $this->getLine(); |
|
244 | + self::$_all_exceptions[$x_time]['msg'] = $msg; |
|
245 | + self::$_all_exceptions[$x_time]['code'] = $this->getCode(); |
|
246 | + self::$_all_exceptions[$x_time]['trace'] = $this->getTrace(); |
|
247 | + self::$_all_exceptions[$x_time]['string'] = $this->getTraceAsString(); |
|
248 | 248 | self::$_error_count++; |
249 | 249 | |
250 | 250 | //add_action( 'shutdown', array( $this, 'display_errors' )); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @access public |
260 | 260 | * @return boolean |
261 | 261 | */ |
262 | - public static function has_error(){ |
|
262 | + public static function has_error() { |
|
263 | 263 | return self::$_error_count ? TRUE : FALSE; |
264 | 264 | } |
265 | 265 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @access public |
271 | 271 | * @echo string |
272 | 272 | */ |
273 | - public function display_errors(){ |
|
273 | + public function display_errors() { |
|
274 | 274 | |
275 | 275 | $trace_details = ''; |
276 | 276 | |
@@ -331,18 +331,18 @@ discard block |
||
331 | 331 | </style> |
332 | 332 | <div id="ee-error-message" class="error">'; |
333 | 333 | |
334 | - if ( ! WP_DEBUG ) { |
|
334 | + if ( ! WP_DEBUG) { |
|
335 | 335 | $output .= ' |
336 | 336 | <p>'; |
337 | 337 | } |
338 | 338 | |
339 | 339 | // cycle thru errors |
340 | - foreach ( self::$_all_exceptions as $time => $ex ) { |
|
340 | + foreach (self::$_all_exceptions as $time => $ex) { |
|
341 | 341 | |
342 | 342 | // process trace info |
343 | - if ( empty( $ex['trace'] )) { |
|
343 | + if (empty($ex['trace'])) { |
|
344 | 344 | |
345 | - $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' ); |
|
345 | + $trace_details .= __('Sorry, but no trace information was available for this exception.', 'event_espresso'); |
|
346 | 346 | |
347 | 347 | } else { |
348 | 348 | |
@@ -357,50 +357,50 @@ discard block |
||
357 | 357 | <th scope="col" align="left">Method( arguments )</th> |
358 | 358 | </tr>'; |
359 | 359 | |
360 | - $last_on_stack = count( $ex['trace'] ) - 1; |
|
360 | + $last_on_stack = count($ex['trace']) - 1; |
|
361 | 361 | // reverse array so that stack is in proper chronological order |
362 | - $sorted_trace = array_reverse( $ex['trace'] ); |
|
362 | + $sorted_trace = array_reverse($ex['trace']); |
|
363 | 363 | |
364 | - foreach ( $sorted_trace as $nmbr => $trace ) { |
|
364 | + foreach ($sorted_trace as $nmbr => $trace) { |
|
365 | 365 | |
366 | - $file = isset( $trace['file'] ) ? $trace['file'] : '' ; |
|
367 | - $class = isset( $trace['class'] ) ? $trace['class'] : ''; |
|
368 | - $type = isset( $trace['type'] ) ? $trace['type'] : ''; |
|
369 | - $function = isset( $trace['function'] ) ? $trace['function'] : ''; |
|
370 | - $args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : ''; |
|
371 | - $line = isset( $trace['line'] ) ? $trace['line'] : ''; |
|
366 | + $file = isset($trace['file']) ? $trace['file'] : ''; |
|
367 | + $class = isset($trace['class']) ? $trace['class'] : ''; |
|
368 | + $type = isset($trace['type']) ? $trace['type'] : ''; |
|
369 | + $function = isset($trace['function']) ? $trace['function'] : ''; |
|
370 | + $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : ''; |
|
371 | + $line = isset($trace['line']) ? $trace['line'] : ''; |
|
372 | 372 | $zebra = $nmbr % 2 ? ' odd' : ''; |
373 | 373 | |
374 | - if ( empty( $file ) && ! empty( $class )) { |
|
375 | - $a = new ReflectionClass( $class ); |
|
374 | + if (empty($file) && ! empty($class)) { |
|
375 | + $a = new ReflectionClass($class); |
|
376 | 376 | $file = $a->getFileName(); |
377 | - if ( empty( $line ) && ! empty( $function )) { |
|
378 | - $b = new ReflectionMethod( $class, $function ); |
|
377 | + if (empty($line) && ! empty($function)) { |
|
378 | + $b = new ReflectionMethod($class, $function); |
|
379 | 379 | $line = $b->getStartLine(); |
380 | 380 | } |
381 | 381 | } |
382 | 382 | |
383 | - if ( $nmbr == $last_on_stack ) { |
|
383 | + if ($nmbr == $last_on_stack) { |
|
384 | 384 | $file = $ex['file'] != '' ? $ex['file'] : $file; |
385 | 385 | $line = $ex['line'] != '' ? $ex['line'] : $line; |
386 | - $error_code = self::generate_error_code ( $file, $trace['function'], $line ); |
|
386 | + $error_code = self::generate_error_code($file, $trace['function'], $line); |
|
387 | 387 | } |
388 | 388 | |
389 | - $nmbr_dsply = ! empty( $nmbr ) ? $nmbr : ' '; |
|
390 | - $line_dsply = ! empty( $line ) ? $line : ' '; |
|
391 | - $file_dsply = ! empty( $file ) ? $file : ' '; |
|
392 | - $class_dsply = ! empty( $class ) ? $class : ' '; |
|
393 | - $type_dsply = ! empty( $type ) ? $type : ' '; |
|
394 | - $function_dsply = ! empty( $function ) ? $function : ' '; |
|
395 | - $args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : ''; |
|
389 | + $nmbr_dsply = ! empty($nmbr) ? $nmbr : ' '; |
|
390 | + $line_dsply = ! empty($line) ? $line : ' '; |
|
391 | + $file_dsply = ! empty($file) ? $file : ' '; |
|
392 | + $class_dsply = ! empty($class) ? $class : ' '; |
|
393 | + $type_dsply = ! empty($type) ? $type : ' '; |
|
394 | + $function_dsply = ! empty($function) ? $function : ' '; |
|
395 | + $args_dsply = ! empty($args) ? '( '.$args.' )' : ''; |
|
396 | 396 | |
397 | 397 | $trace_details .= ' |
398 | 398 | <tr> |
399 | - <td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td> |
|
400 | - <td align="right" class="' . $zebra . '">' . $line_dsply . '</td> |
|
401 | - <td align="left" class="' . $zebra . '">' . $file_dsply . '</td> |
|
402 | - <td align="left" class="' . $zebra . '">' . $class_dsply . '</td> |
|
403 | - <td align="left" class="' . $zebra . '">' . $type_dsply . $function_dsply . $args_dsply . '</td> |
|
399 | + <td align="right" class="' . $zebra.'">'.$nmbr_dsply.'</td> |
|
400 | + <td align="right" class="' . $zebra.'">'.$line_dsply.'</td> |
|
401 | + <td align="left" class="' . $zebra.'">'.$file_dsply.'</td> |
|
402 | + <td align="left" class="' . $zebra.'">'.$class_dsply.'</td> |
|
403 | + <td align="left" class="' . $zebra.'">'.$type_dsply.$function_dsply.$args_dsply.'</td> |
|
404 | 404 | </tr>'; |
405 | 405 | |
406 | 406 | |
@@ -415,9 +415,9 @@ discard block |
||
415 | 415 | $ex['code'] = $ex['code'] ? $ex['code'] : $error_code; |
416 | 416 | |
417 | 417 | // add generic non-identifying messages for non-privileged uesrs |
418 | - if ( ! WP_DEBUG ) { |
|
418 | + if ( ! WP_DEBUG) { |
|
419 | 419 | |
420 | - $output .= '<span class="ee-error-user-msg-spn">' . trim( $ex['msg'] ) . '</span> <sup>' . $ex['code'] . '</sup><br />'; |
|
420 | + $output .= '<span class="ee-error-user-msg-spn">'.trim($ex['msg']).'</span> <sup>'.$ex['code'].'</sup><br />'; |
|
421 | 421 | |
422 | 422 | } else { |
423 | 423 | |
@@ -425,24 +425,24 @@ discard block |
||
425 | 425 | $output .= ' |
426 | 426 | <div class="ee-error-dev-msg-dv"> |
427 | 427 | <p class="ee-error-dev-msg-pg"> |
428 | - <strong class="ee-error-dev-msg-str">An ' . $ex['name'] . ' exception was thrown!</strong> <span>code: ' . $ex['code'] . '</span><br /> |
|
429 | - <span class="big-text">"' . trim( $ex['msg'] ) . '"</span><br/> |
|
430 | - <a id="display-ee-error-trace-' . self::$_error_count . $time . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-' . self::$_error_count . $time . '"> |
|
431 | - ' . __( 'click to view backtrace and class/method details', 'event_espresso' ) . ' |
|
428 | + <strong class="ee-error-dev-msg-str">An ' . $ex['name'].' exception was thrown!</strong> <span>code: '.$ex['code'].'</span><br /> |
|
429 | + <span class="big-text">"' . trim($ex['msg']).'"</span><br/> |
|
430 | + <a id="display-ee-error-trace-' . self::$_error_count.$time.'" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-'.self::$_error_count.$time.'"> |
|
431 | + ' . __('click to view backtrace and class/method details', 'event_espresso').' |
|
432 | 432 | </a><br /> |
433 | 433 | <span class="small-text lt-grey-text">'.$ex['file'].' ( line no: '.$ex['line'].' )</span> |
434 | 434 | </p> |
435 | - <div id="ee-error-trace-' . self::$_error_count . $time . '-dv" class="ee-error-trace-dv" style="display: none;"> |
|
435 | + <div id="ee-error-trace-' . self::$_error_count.$time.'-dv" class="ee-error-trace-dv" style="display: none;"> |
|
436 | 436 | ' . $trace_details; |
437 | 437 | |
438 | - if ( ! empty( $class )) { |
|
438 | + if ( ! empty($class)) { |
|
439 | 439 | $output .= ' |
440 | 440 | <div style="padding:3px; margin:0 0 1em; border:1px solid #666; background:#fff; border-radius:3px;"> |
441 | 441 | <div style="padding:1em 2em; border:1px solid #666; background:#f9f9f9;"> |
442 | 442 | <h3>Class Details</h3>'; |
443 | - $a = new ReflectionClass( $class ); |
|
443 | + $a = new ReflectionClass($class); |
|
444 | 444 | $output .= ' |
445 | - <pre>' . $a . '</pre> |
|
445 | + <pre>' . $a.'</pre> |
|
446 | 446 | </div> |
447 | 447 | </div>'; |
448 | 448 | } |
@@ -454,14 +454,14 @@ discard block |
||
454 | 454 | |
455 | 455 | } |
456 | 456 | |
457 | - $this->write_to_error_log( $time, $ex ); |
|
457 | + $this->write_to_error_log($time, $ex); |
|
458 | 458 | |
459 | 459 | } |
460 | 460 | |
461 | 461 | // remove last linebreak |
462 | - $output = substr( $output, 0, ( count( $output ) - 7 )); |
|
462 | + $output = substr($output, 0, (count($output) - 7)); |
|
463 | 463 | |
464 | - if ( ! WP_DEBUG ) { |
|
464 | + if ( ! WP_DEBUG) { |
|
465 | 465 | $output .= ' |
466 | 466 | </p>'; |
467 | 467 | } |
@@ -469,10 +469,10 @@ discard block |
||
469 | 469 | $output .= ' |
470 | 470 | </div>'; |
471 | 471 | |
472 | - $output .= self::_print_scripts( TRUE ); |
|
472 | + $output .= self::_print_scripts(TRUE); |
|
473 | 473 | |
474 | - if ( defined( 'DOING_AJAX' )) { |
|
475 | - echo json_encode( array( 'error' => $output )); |
|
474 | + if (defined('DOING_AJAX')) { |
|
475 | + echo json_encode(array('error' => $output)); |
|
476 | 476 | exit(); |
477 | 477 | } |
478 | 478 | |
@@ -492,29 +492,29 @@ discard block |
||
492 | 492 | * @ param array $arguments |
493 | 493 | * @ return string |
494 | 494 | */ |
495 | - private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) { |
|
495 | + private function _convert_args_to_string($arguments = array(), $array = FALSE) { |
|
496 | 496 | |
497 | 497 | $arg_string = ''; |
498 | - if ( ! empty( $arguments )) { |
|
498 | + if ( ! empty($arguments)) { |
|
499 | 499 | |
500 | 500 | $args = array(); |
501 | 501 | |
502 | - foreach ( $arguments as $arg ) { |
|
502 | + foreach ($arguments as $arg) { |
|
503 | 503 | |
504 | - if ( ! empty( $arg )) { |
|
504 | + if ( ! empty($arg)) { |
|
505 | 505 | |
506 | - if ( is_string( $arg )) { |
|
507 | - $args[] = " '" . $arg . "'"; |
|
508 | - } elseif ( is_array( $arg )) { |
|
509 | - $args[] = 'ARRAY(' . $this->_convert_args_to_string( $arg, TRUE ); |
|
510 | - } elseif ( is_null( $arg )) { |
|
506 | + if (is_string($arg)) { |
|
507 | + $args[] = " '".$arg."'"; |
|
508 | + } elseif (is_array($arg)) { |
|
509 | + $args[] = 'ARRAY('.$this->_convert_args_to_string($arg, TRUE); |
|
510 | + } elseif (is_null($arg)) { |
|
511 | 511 | $args[] = ' NULL'; |
512 | - } elseif ( is_bool( $arg )) { |
|
513 | - $args[] = ( $arg ) ? ' TRUE' : ' FALSE'; |
|
514 | - } elseif ( is_object( $arg )) { |
|
515 | - $args[] = ' OBJECT ' . get_class( $arg ); |
|
516 | - } elseif ( is_resource( $arg )) { |
|
517 | - $args[] = get_resource_type( $arg ); |
|
512 | + } elseif (is_bool($arg)) { |
|
513 | + $args[] = ($arg) ? ' TRUE' : ' FALSE'; |
|
514 | + } elseif (is_object($arg)) { |
|
515 | + $args[] = ' OBJECT '.get_class($arg); |
|
516 | + } elseif (is_resource($arg)) { |
|
517 | + $args[] = get_resource_type($arg); |
|
518 | 518 | } else { |
519 | 519 | $args[] = $arg; |
520 | 520 | } |
@@ -522,9 +522,9 @@ discard block |
||
522 | 522 | } |
523 | 523 | |
524 | 524 | } |
525 | - $arg_string = implode( ', ', $args ); |
|
525 | + $arg_string = implode(', ', $args); |
|
526 | 526 | } |
527 | - if ( $array ) { |
|
527 | + if ($array) { |
|
528 | 528 | $arg_string .= ' )'; |
529 | 529 | } |
530 | 530 | return $arg_string; |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | * @param string $line the line number where the error occurred - just use __LINE__ |
545 | 545 | * @return void |
546 | 546 | */ |
547 | - public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
548 | - self::_add_notice ( 'errors', $msg, $file, $func, $line ); |
|
547 | + public static function add_error($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
548 | + self::_add_notice('errors', $msg, $file, $func, $line); |
|
549 | 549 | self::$_error_count++; |
550 | 550 | } |
551 | 551 | |
@@ -558,11 +558,11 @@ discard block |
||
558 | 558 | * @param string $line |
559 | 559 | * @throws EE_Error |
560 | 560 | */ |
561 | - public static function throw_exception_if_debugging( $msg = null, $file = null, $func = null, $line = null ) { |
|
562 | - if( WP_DEBUG ) { |
|
563 | - throw new EE_Error( $msg ); |
|
564 | - } else { |
|
565 | - EE_Error::add_error( $msg, $file, $func, $line ); |
|
561 | + public static function throw_exception_if_debugging($msg = null, $file = null, $func = null, $line = null) { |
|
562 | + if (WP_DEBUG) { |
|
563 | + throw new EE_Error($msg); |
|
564 | + } else { |
|
565 | + EE_Error::add_error($msg, $file, $func, $line); |
|
566 | 566 | } |
567 | 567 | } |
568 | 568 | |
@@ -580,8 +580,8 @@ discard block |
||
580 | 580 | * @param string $line the line number where the error occurred - just use __LINE__ |
581 | 581 | * @return void |
582 | 582 | */ |
583 | - public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
584 | - self::_add_notice ( 'success', $msg, $file, $func, $line ); |
|
583 | + public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
584 | + self::_add_notice('success', $msg, $file, $func, $line); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | |
@@ -598,8 +598,8 @@ discard block |
||
598 | 598 | * @param string $line the line number where the error occurred - just use __LINE__ |
599 | 599 | * @return void |
600 | 600 | */ |
601 | - public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
602 | - self::_add_notice ( 'attention', $msg, $file, $func, $line ); |
|
601 | + public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
602 | + self::_add_notice('attention', $msg, $file, $func, $line); |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | |
@@ -617,12 +617,12 @@ discard block |
||
617 | 617 | * @param string $line the line number where the error occurred - just use __LINE__ |
618 | 618 | * @return void |
619 | 619 | */ |
620 | - private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
621 | - if ( empty( $msg )) { |
|
620 | + private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
621 | + if (empty($msg)) { |
|
622 | 622 | EE_Error::doing_it_wrong( |
623 | - 'EE_Error::add_' . $type . '()', |
|
623 | + 'EE_Error::add_'.$type.'()', |
|
624 | 624 | sprintf( |
625 | - __( 'Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso' ), |
|
625 | + __('Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso'), |
|
626 | 626 | $type, |
627 | 627 | $file, |
628 | 628 | $line |
@@ -630,17 +630,17 @@ discard block |
||
630 | 630 | EVENT_ESPRESSO_VERSION |
631 | 631 | ); |
632 | 632 | } |
633 | - if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) { |
|
633 | + if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) { |
|
634 | 634 | EE_Error::doing_it_wrong( |
635 | 635 | 'EE_Error::add_error()', |
636 | - __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso' ), |
|
636 | + __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso'), |
|
637 | 637 | EVENT_ESPRESSO_VERSION |
638 | 638 | ); |
639 | 639 | } |
640 | 640 | // get separate user and developer messages if they exist |
641 | - $msg = explode( '||', $msg ); |
|
641 | + $msg = explode('||', $msg); |
|
642 | 642 | $user_msg = $msg[0]; |
643 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
643 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
644 | 644 | /** |
645 | 645 | * Do an action so other code can be triggered when a notice is created |
646 | 646 | * @param string $type can be 'errors', 'attention', or 'success' |
@@ -650,22 +650,22 @@ discard block |
||
650 | 650 | * @param string $func function where error was generated |
651 | 651 | * @param string $line line where error was generated |
652 | 652 | */ |
653 | - do_action( 'AHEE__EE_Error___add_notice', $type, $user_msg, $dev_msg, $file, $func, $line ); |
|
653 | + do_action('AHEE__EE_Error___add_notice', $type, $user_msg, $dev_msg, $file, $func, $line); |
|
654 | 654 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
655 | 655 | // add notice if message exists |
656 | - if ( ! empty( $msg )) { |
|
656 | + if ( ! empty($msg)) { |
|
657 | 657 | // get error code |
658 | - $notice_code = EE_Error::generate_error_code( $file, $func, $line ); |
|
659 | - if ( WP_DEBUG && $type == 'errors' ) { |
|
660 | - $msg .= '<br/><span class="tiny-text">' . $notice_code . '</span>'; |
|
658 | + $notice_code = EE_Error::generate_error_code($file, $func, $line); |
|
659 | + if (WP_DEBUG && $type == 'errors') { |
|
660 | + $msg .= '<br/><span class="tiny-text">'.$notice_code.'</span>'; |
|
661 | 661 | } |
662 | 662 | // add notice. Index by code if it's not blank |
663 | - if( $notice_code ) { |
|
664 | - self::$_espresso_notices[ $type ][ $notice_code ] = $msg; |
|
663 | + if ($notice_code) { |
|
664 | + self::$_espresso_notices[$type][$notice_code] = $msg; |
|
665 | 665 | } else { |
666 | - self::$_espresso_notices[ $type ][] = $msg; |
|
666 | + self::$_espresso_notices[$type][] = $msg; |
|
667 | 667 | } |
668 | - add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 ); |
|
668 | + add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1); |
|
669 | 669 | } |
670 | 670 | |
671 | 671 | } |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | * @access private |
720 | 720 | * @return void |
721 | 721 | */ |
722 | - public static function reset_notices(){ |
|
722 | + public static function reset_notices() { |
|
723 | 723 | self::$_espresso_notices['success'] = FALSE; |
724 | 724 | self::$_espresso_notices['attention'] = FALSE; |
725 | 725 | self::$_espresso_notices['errors'] = FALSE; |
@@ -732,14 +732,14 @@ discard block |
||
732 | 732 | * @access public |
733 | 733 | * @return int |
734 | 734 | */ |
735 | - public static function has_notices(){ |
|
735 | + public static function has_notices() { |
|
736 | 736 | $has_notices = 0; |
737 | 737 | // check for success messages |
738 | - $has_notices = self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] ) ? 3 : $has_notices; |
|
738 | + $has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices; |
|
739 | 739 | // check for attention messages |
740 | - $has_notices = self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ? 2 : $has_notices; |
|
740 | + $has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices; |
|
741 | 741 | // check for error messages |
742 | - $has_notices = self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ? 1 : $has_notices; |
|
742 | + $has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices; |
|
743 | 743 | return $has_notices; |
744 | 744 | } |
745 | 745 | |
@@ -754,9 +754,9 @@ discard block |
||
754 | 754 | */ |
755 | 755 | public static function get_vanilla_notices() { |
756 | 756 | return array( |
757 | - 'success' => isset( self::$_espresso_notices['success'] ) ? self::$_espresso_notices['success'] : array(), |
|
758 | - 'attention' => isset( self::$_espresso_notices['attention'] ) ? self::$_espresso_notices['attention'] : array(), |
|
759 | - 'errors' => isset( self::$_espresso_notices['errors'] ) ? self::$_espresso_notices['errors'] : array(), |
|
757 | + 'success' => isset(self::$_espresso_notices['success']) ? self::$_espresso_notices['success'] : array(), |
|
758 | + 'attention' => isset(self::$_espresso_notices['attention']) ? self::$_espresso_notices['attention'] : array(), |
|
759 | + 'errors' => isset(self::$_espresso_notices['errors']) ? self::$_espresso_notices['errors'] : array(), |
|
760 | 760 | ); |
761 | 761 | } |
762 | 762 | |
@@ -772,8 +772,8 @@ discard block |
||
772 | 772 | * @param boolean $remove_empty whether or not to unset empty messages |
773 | 773 | * @return array |
774 | 774 | */ |
775 | - public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) { |
|
776 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
775 | + public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) { |
|
776 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
777 | 777 | |
778 | 778 | $success_messages = ''; |
779 | 779 | $attention_messages = ''; |
@@ -783,44 +783,44 @@ discard block |
||
783 | 783 | // EEH_Debug_Tools::printr( self::$_espresso_notices, 'espresso_notices <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
784 | 784 | |
785 | 785 | // either save notices to the db |
786 | - if ( $save_to_transient ) { |
|
787 | - update_option( 'ee_notices', self::$_espresso_notices ); |
|
786 | + if ($save_to_transient) { |
|
787 | + update_option('ee_notices', self::$_espresso_notices); |
|
788 | 788 | return; |
789 | 789 | } |
790 | 790 | // grab any notices that have been previously saved |
791 | - if ( $notices = get_option( 'ee_notices', FALSE )) { |
|
792 | - foreach ( $notices as $type => $notice ) { |
|
793 | - if ( is_array( $notice ) && ! empty( $notice )) { |
|
791 | + if ($notices = get_option('ee_notices', FALSE)) { |
|
792 | + foreach ($notices as $type => $notice) { |
|
793 | + if (is_array($notice) && ! empty($notice)) { |
|
794 | 794 | // make sure that existsing notice type is an array |
795 | - self::$_espresso_notices[ $type ] = is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array(); |
|
795 | + self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array(); |
|
796 | 796 | // merge stored notices with any newly created ones |
797 | - self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice ); |
|
797 | + self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice); |
|
798 | 798 | $print_scripts = TRUE; |
799 | 799 | } |
800 | 800 | } |
801 | 801 | // now clear any stored notices |
802 | - update_option( 'ee_notices', FALSE ); |
|
802 | + update_option('ee_notices', FALSE); |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | // check for success messages |
806 | - if ( self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] )) { |
|
806 | + if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) { |
|
807 | 807 | // combine messages |
808 | - $success_messages .= implode( self::$_espresso_notices['success'], '<br />' ); |
|
808 | + $success_messages .= implode(self::$_espresso_notices['success'], '<br />'); |
|
809 | 809 | $print_scripts = TRUE; |
810 | 810 | } |
811 | 811 | |
812 | 812 | // check for attention messages |
813 | - if ( self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ) { |
|
813 | + if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) { |
|
814 | 814 | // combine messages |
815 | - $attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' ); |
|
815 | + $attention_messages .= implode(self::$_espresso_notices['attention'], '<br />'); |
|
816 | 816 | $print_scripts = TRUE; |
817 | 817 | } |
818 | 818 | |
819 | 819 | // check for error messages |
820 | - if ( self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ) { |
|
821 | - $error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' ); |
|
820 | + if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) { |
|
821 | + $error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso'); |
|
822 | 822 | // combine messages |
823 | - $error_messages .= implode( self::$_espresso_notices['errors'], '<br />' ); |
|
823 | + $error_messages .= implode(self::$_espresso_notices['errors'], '<br />'); |
|
824 | 824 | $print_scripts = TRUE; |
825 | 825 | } |
826 | 826 | |
@@ -834,21 +834,21 @@ discard block |
||
834 | 834 | $css_id = is_admin() ? 'message' : 'espresso-notices-success'; |
835 | 835 | $css_class = is_admin() ? 'updated fade' : 'success fade-away'; |
836 | 836 | //showMessage( $success_messages ); |
837 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>'; |
|
837 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>'; |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | if ($attention_messages != '') { |
841 | 841 | $css_id = is_admin() ? 'message' : 'espresso-notices-attention'; |
842 | 842 | $css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away'; |
843 | 843 | //showMessage( $error_messages, TRUE ); |
844 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>'; |
|
844 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>'; |
|
845 | 845 | } |
846 | 846 | |
847 | 847 | if ($error_messages != '') { |
848 | 848 | $css_id = is_admin() ? 'message' : 'espresso-notices-error'; |
849 | 849 | $css_class = is_admin() ? 'error' : 'error fade-away'; |
850 | 850 | //showMessage( $error_messages, TRUE ); |
851 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>'; |
|
851 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>'; |
|
852 | 852 | } |
853 | 853 | |
854 | 854 | $notices .= '</div>'; |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | 'errors' => $error_messages |
862 | 862 | ); |
863 | 863 | |
864 | - if ( $remove_empty ) { |
|
864 | + if ($remove_empty) { |
|
865 | 865 | // remove empty notices |
866 | 866 | foreach ($notices as $type => $notice) { |
867 | 867 | if (empty($notice)) { |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | } |
872 | 872 | } |
873 | 873 | |
874 | - if ( $print_scripts ) { |
|
874 | + if ($print_scripts) { |
|
875 | 875 | self::_print_scripts(); |
876 | 876 | } |
877 | 877 | |
@@ -891,17 +891,17 @@ discard block |
||
891 | 891 | * @param bool $force_update allows one to enforce the reappearance of a persistent message. |
892 | 892 | * @return void |
893 | 893 | */ |
894 | - public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) { |
|
895 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
896 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
894 | + public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) { |
|
895 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
896 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
897 | 897 | //maybe initialize persistent_admin_notices |
898 | - if ( empty( $persistent_admin_notices )) { |
|
899 | - add_option( 'ee_pers_admin_notices', array(), '', 'no' ); |
|
898 | + if (empty($persistent_admin_notices)) { |
|
899 | + add_option('ee_pers_admin_notices', array(), '', 'no'); |
|
900 | 900 | } |
901 | - $pan_name = sanitize_key( $pan_name ); |
|
902 | - if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) { |
|
903 | - $persistent_admin_notices[ $pan_name ] = $pan_message; |
|
904 | - update_option( 'ee_pers_admin_notices', $persistent_admin_notices ); |
|
901 | + $pan_name = sanitize_key($pan_name); |
|
902 | + if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) { |
|
903 | + $persistent_admin_notices[$pan_name] = $pan_message; |
|
904 | + update_option('ee_pers_admin_notices', $persistent_admin_notices); |
|
905 | 905 | } |
906 | 906 | } |
907 | 907 | } |
@@ -917,34 +917,34 @@ discard block |
||
917 | 917 | * @param bool $return_immediately |
918 | 918 | * @return void |
919 | 919 | */ |
920 | - public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) { |
|
921 | - $pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name; |
|
922 | - if ( ! empty( $pan_name )) { |
|
923 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
920 | + public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) { |
|
921 | + $pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name; |
|
922 | + if ( ! empty($pan_name)) { |
|
923 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
924 | 924 | // check if notice we wish to dismiss is actually in the $persistent_admin_notices array |
925 | - if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) { |
|
925 | + if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) { |
|
926 | 926 | // completely delete nag notice, or just NULL message so that it can NOT be added again ? |
927 | - if ( $purge ) { |
|
928 | - unset( $persistent_admin_notices[ $pan_name ] ); |
|
927 | + if ($purge) { |
|
928 | + unset($persistent_admin_notices[$pan_name]); |
|
929 | 929 | } else { |
930 | - $persistent_admin_notices[ $pan_name ] = NULL; |
|
930 | + $persistent_admin_notices[$pan_name] = NULL; |
|
931 | 931 | } |
932 | - if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) { |
|
933 | - EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
932 | + if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) { |
|
933 | + EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__); |
|
934 | 934 | } |
935 | 935 | } |
936 | 936 | } |
937 | - if ( $return_immediately ) { |
|
937 | + if ($return_immediately) { |
|
938 | 938 | return; |
939 | - } else if ( EE_Registry::instance()->REQ->ajax ) { |
|
939 | + } else if (EE_Registry::instance()->REQ->ajax) { |
|
940 | 940 | // grab any notices and concatenate into string |
941 | - echo json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE )))); |
|
941 | + echo json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE)))); |
|
942 | 942 | exit(); |
943 | 943 | } else { |
944 | 944 | // save errors to a transient to be displayed on next request (after redirect) |
945 | - EE_Error::get_notices( FALSE, TRUE ); |
|
946 | - $return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : ''; |
|
947 | - wp_safe_redirect( urldecode( $return_url )); |
|
945 | + EE_Error::get_notices(FALSE, TRUE); |
|
946 | + $return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : ''; |
|
947 | + wp_safe_redirect(urldecode($return_url)); |
|
948 | 948 | } |
949 | 949 | } |
950 | 950 | |
@@ -959,20 +959,20 @@ discard block |
||
959 | 959 | * @param string $return_url URL to go back to aftger nag notice is dismissed |
960 | 960 | * @return string |
961 | 961 | */ |
962 | - public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) { |
|
963 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
962 | + public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') { |
|
963 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
964 | 964 | $args = array( |
965 | 965 | 'nag_notice' => $pan_name, |
966 | - 'return_url' => urlencode( $return_url ), |
|
966 | + 'return_url' => urlencode($return_url), |
|
967 | 967 | 'ajax_url' => WP_AJAX_URL, |
968 | - 'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' ) |
|
968 | + 'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso') |
|
969 | 969 | ); |
970 | - wp_localize_script( 'espresso_core', 'ee_dismiss', $args ); |
|
970 | + wp_localize_script('espresso_core', 'ee_dismiss', $args); |
|
971 | 971 | return ' |
972 | - <div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
973 | - <p>' . $pan_message . '</p> |
|
974 | - <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '"> |
|
975 | - <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .' |
|
972 | + <div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
973 | + <p>' . $pan_message.'</p> |
|
974 | + <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'"> |
|
975 | + <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').' |
|
976 | 976 | </a> |
977 | 977 | <div style="clear:both;"></div> |
978 | 978 | </div>'; |
@@ -988,24 +988,24 @@ discard block |
||
988 | 988 | * @param string $return_url |
989 | 989 | * @return array |
990 | 990 | */ |
991 | - public static function get_persistent_admin_notices( $return_url = '' ) { |
|
991 | + public static function get_persistent_admin_notices($return_url = '') { |
|
992 | 992 | $notices = ''; |
993 | 993 | // check for persistent admin notices |
994 | 994 | //filter the list though so plugins can notify the admin in a different way if they want |
995 | 995 | $persistent_admin_notices = apply_filters( |
996 | 996 | 'FHEE__EE_Error__get_persistent_admin_notices', |
997 | - get_option( 'ee_pers_admin_notices', FALSE ), |
|
997 | + get_option('ee_pers_admin_notices', FALSE), |
|
998 | 998 | 'ee_pers_admin_notices', |
999 | 999 | $return_url |
1000 | 1000 | ); |
1001 | - if ( $persistent_admin_notices ) { |
|
1001 | + if ($persistent_admin_notices) { |
|
1002 | 1002 | // load scripts |
1003 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1004 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1005 | - wp_enqueue_script( 'ee_error_js' ); |
|
1003 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1004 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1005 | + wp_enqueue_script('ee_error_js'); |
|
1006 | 1006 | // and display notices |
1007 | - foreach( $persistent_admin_notices as $pan_name => $pan_message ) { |
|
1008 | - $notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url ); |
|
1007 | + foreach ($persistent_admin_notices as $pan_name => $pan_message) { |
|
1008 | + $notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url); |
|
1009 | 1009 | } |
1010 | 1010 | } |
1011 | 1011 | return $notices; |
@@ -1020,26 +1020,26 @@ discard block |
||
1020 | 1020 | * @param bool $force_print |
1021 | 1021 | * @return void |
1022 | 1022 | */ |
1023 | - private static function _print_scripts( $force_print = FALSE ) { |
|
1024 | - if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) { |
|
1025 | - if ( wp_script_is( 'ee_error_js', 'enqueued' )) { |
|
1023 | + private static function _print_scripts($force_print = FALSE) { |
|
1024 | + if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) { |
|
1025 | + if (wp_script_is('ee_error_js', 'enqueued')) { |
|
1026 | 1026 | return; |
1027 | - } else if ( wp_script_is( 'ee_error_js', 'registered' )) { |
|
1028 | - add_filter( 'FHEE_load_css', '__return_true' ); |
|
1029 | - add_filter( 'FHEE_load_js', '__return_true' ); |
|
1030 | - wp_enqueue_script( 'ee_error_js' ); |
|
1031 | - wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG )); |
|
1027 | + } else if (wp_script_is('ee_error_js', 'registered')) { |
|
1028 | + add_filter('FHEE_load_css', '__return_true'); |
|
1029 | + add_filter('FHEE_load_js', '__return_true'); |
|
1030 | + wp_enqueue_script('ee_error_js'); |
|
1031 | + wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG)); |
|
1032 | 1032 | } |
1033 | 1033 | } else { |
1034 | 1034 | return ' |
1035 | 1035 | <script> |
1036 | 1036 | /* <![CDATA[ */ |
1037 | -var ee_settings = {"wp_debug":"' . WP_DEBUG . '"}; |
|
1037 | +var ee_settings = {"wp_debug":"' . WP_DEBUG.'"}; |
|
1038 | 1038 | /* ]]> */ |
1039 | 1039 | </script> |
1040 | -<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script> |
|
1041 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
1042 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
1040 | +<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script> |
|
1041 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
1042 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
1043 | 1043 | '; |
1044 | 1044 | |
1045 | 1045 | } |
@@ -1073,11 +1073,11 @@ discard block |
||
1073 | 1073 | * @ param string $line |
1074 | 1074 | * @ return string |
1075 | 1075 | */ |
1076 | - public static function generate_error_code ( $file = '', $func = '', $line = '' ) { |
|
1077 | - $file = explode( '.', basename( $file )); |
|
1078 | - $error_code = ! empty( $file[0] ) ? $file[0] : ''; |
|
1079 | - $error_code .= ! empty( $func ) ? ' - ' . $func : ''; |
|
1080 | - $error_code .= ! empty( $line ) ? ' - ' . $line : ''; |
|
1076 | + public static function generate_error_code($file = '', $func = '', $line = '') { |
|
1077 | + $file = explode('.', basename($file)); |
|
1078 | + $error_code = ! empty($file[0]) ? $file[0] : ''; |
|
1079 | + $error_code .= ! empty($func) ? ' - '.$func : ''; |
|
1080 | + $error_code .= ! empty($line) ? ' - '.$line : ''; |
|
1081 | 1081 | return $error_code; |
1082 | 1082 | } |
1083 | 1083 | |
@@ -1093,36 +1093,36 @@ discard block |
||
1093 | 1093 | * @ param object $ex |
1094 | 1094 | * @ return void |
1095 | 1095 | */ |
1096 | - public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) { |
|
1096 | + public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) { |
|
1097 | 1097 | |
1098 | - if ( ! $ex ) { |
|
1098 | + if ( ! $ex) { |
|
1099 | 1099 | return; |
1100 | 1100 | } |
1101 | 1101 | |
1102 | - if ( ! $time ) { |
|
1102 | + if ( ! $time) { |
|
1103 | 1103 | $time = time(); |
1104 | 1104 | } |
1105 | 1105 | |
1106 | - $exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
1107 | - $exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . '] Exception Details' . PHP_EOL; |
|
1108 | - $exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL; |
|
1109 | - $exception_log .= 'Code: '. $ex['code'] . PHP_EOL; |
|
1110 | - $exception_log .= 'File: '. $ex['file'] . PHP_EOL; |
|
1111 | - $exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL; |
|
1112 | - $exception_log .= 'Stack trace: ' . PHP_EOL; |
|
1113 | - $exception_log .= $ex['string'] . PHP_EOL; |
|
1114 | - $exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
1106 | + $exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
1107 | + $exception_log .= '['.date('Y-m-d H:i:s', $time).'] Exception Details'.PHP_EOL; |
|
1108 | + $exception_log .= 'Message: '.$ex['msg'].PHP_EOL; |
|
1109 | + $exception_log .= 'Code: '.$ex['code'].PHP_EOL; |
|
1110 | + $exception_log .= 'File: '.$ex['file'].PHP_EOL; |
|
1111 | + $exception_log .= 'Line No: '.$ex['line'].PHP_EOL; |
|
1112 | + $exception_log .= 'Stack trace: '.PHP_EOL; |
|
1113 | + $exception_log .= $ex['string'].PHP_EOL; |
|
1114 | + $exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
1115 | 1115 | |
1116 | 1116 | try { |
1117 | - EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ); |
|
1118 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' ); |
|
1119 | - if ( ! $clear ) { |
|
1117 | + EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file); |
|
1118 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs'); |
|
1119 | + if ( ! $clear) { |
|
1120 | 1120 | //get existing log file and append new log info |
1121 | - $exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log; |
|
1121 | + $exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log; |
|
1122 | 1122 | } |
1123 | - EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log ); |
|
1124 | - } catch( EE_Error $e ){ |
|
1125 | - EE_Error::add_error( sprintf( __( 'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() )); |
|
1123 | + EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log); |
|
1124 | + } catch (EE_Error $e) { |
|
1125 | + EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage())); |
|
1126 | 1126 | return; |
1127 | 1127 | } |
1128 | 1128 | |
@@ -1158,8 +1158,8 @@ discard block |
||
1158 | 1158 | $applies_when = '', |
1159 | 1159 | $error_type = null |
1160 | 1160 | ) { |
1161 | - if ( defined('WP_DEBUG') && WP_DEBUG ) { |
|
1162 | - EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version, $applies_when, $error_type ); |
|
1161 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
1162 | + EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version, $applies_when, $error_type); |
|
1163 | 1163 | } |
1164 | 1164 | } |
1165 | 1165 | |
@@ -1193,13 +1193,13 @@ discard block |
||
1193 | 1193 | */ |
1194 | 1194 | function espresso_error_enqueue_scripts() { |
1195 | 1195 | // js for error handling |
1196 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
1197 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
1196 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE); |
|
1197 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE); |
|
1198 | 1198 | } |
1199 | -if ( is_admin() ) { |
|
1200 | - add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
1199 | +if (is_admin()) { |
|
1200 | + add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
1201 | 1201 | } else { |
1202 | - add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
1202 | + add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 |
@@ -40,11 +40,11 @@ |
||
40 | 40 | if($version_string <= '4.3.0' && $version_string >= '4.2.0' ){ |
41 | 41 | // echo "$version_string can be migrated fro"; |
42 | 42 | return true; |
43 | - }elseif( ! $version_string ){ |
|
43 | + } elseif( ! $version_string ){ |
|
44 | 44 | // echo "no version string provided: $version_string"; |
45 | 45 | //no version string provided... this must be pre 4.2 |
46 | 46 | return false;//changed mind. dont want people thinking they should migrate yet because they cant |
47 | - }else{ |
|
47 | + } else{ |
|
48 | 48 | // echo "$version_string doesnt apply"; |
49 | 49 | return false; |
50 | 50 | } |
@@ -10,18 +10,18 @@ discard block |
||
10 | 10 | //(all other times it gets resurrected from a wordpress option) |
11 | 11 | $stages = glob(EE_CORE.'data_migration_scripts/4_3_0_stages/*'); |
12 | 12 | $class_to_filepath = array(); |
13 | -if ( ! empty( $stages ) ) { |
|
14 | - foreach($stages as $filepath){ |
|
13 | +if ( ! empty($stages)) { |
|
14 | + foreach ($stages as $filepath) { |
|
15 | 15 | $matches = array(); |
16 | - preg_match('~4_3_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
16 | + preg_match('~4_3_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
17 | 17 | $class_to_filepath[$matches[1]] = $filepath; |
18 | 18 | } |
19 | 19 | } |
20 | 20 | //give addons a chance to autoload their stages too |
21 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_3_0__autoloaded_stages',$class_to_filepath); |
|
21 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_3_0__autoloaded_stages', $class_to_filepath); |
|
22 | 22 | EEH_Autoloader::register_autoloader($class_to_filepath); |
23 | 23 | |
24 | -class EE_DMS_Core_4_3_0 extends EE_Data_Migration_Script_Base{ |
|
24 | +class EE_DMS_Core_4_3_0 extends EE_Data_Migration_Script_Base { |
|
25 | 25 | |
26 | 26 | |
27 | 27 | |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | } |
38 | 38 | public function can_migrate_from_version($version_array) { |
39 | 39 | $version_string = $version_array['Core']; |
40 | - if($version_string <= '4.3.0' && $version_string >= '4.2.0' ){ |
|
40 | + if ($version_string <= '4.3.0' && $version_string >= '4.2.0') { |
|
41 | 41 | // echo "$version_string can be migrated fro"; |
42 | 42 | return true; |
43 | - }elseif( ! $version_string ){ |
|
43 | + }elseif ( ! $version_string) { |
|
44 | 44 | // echo "no version string provided: $version_string"; |
45 | 45 | //no version string provided... this must be pre 4.2 |
46 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
47 | - }else{ |
|
46 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
47 | + } else { |
|
48 | 48 | // echo "$version_string doesnt apply"; |
49 | 49 | return false; |
50 | 50 | } |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | } |
55 | 55 | public function schema_changes_before_migration() { |
56 | 56 | //relies on 4.1's EEH_Activation::create_table |
57 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
58 | - $table_name='esp_answer'; |
|
59 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
57 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
58 | + $table_name = 'esp_answer'; |
|
59 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
60 | 60 | REG_ID INT UNSIGNED NOT NULL, |
61 | 61 | QST_ID INT UNSIGNED NOT NULL, |
62 | 62 | ANS_value TEXT NOT NULL, |
63 | 63 | PRIMARY KEY (ANS_ID)"; |
64 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
64 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
65 | 65 | |
66 | 66 | $table_name = 'esp_attendee_meta'; |
67 | 67 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | CNT_is_EU TINYINT(1) DEFAULT '0', |
101 | 101 | CNT_active TINYINT(1) DEFAULT '0', |
102 | 102 | PRIMARY KEY (CNT_ISO)"; |
103 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' ); |
|
103 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
104 | 104 | |
105 | 105 | |
106 | 106 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | |
125 | 125 | |
126 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' ); |
|
126 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
127 | 127 | $table_name = 'esp_event_meta'; |
128 | 128 | $sql = " |
129 | 129 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
@@ -140,41 +140,41 @@ discard block |
||
140 | 140 | EVT_external_URL VARCHAR(200) NULL, |
141 | 141 | EVT_donations TINYINT(1) NULL, |
142 | 142 | PRIMARY KEY (EVTM_ID)"; |
143 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
143 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
144 | 144 | |
145 | 145 | |
146 | 146 | |
147 | - $table_name='esp_event_question_group'; |
|
148 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
147 | + $table_name = 'esp_event_question_group'; |
|
148 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
149 | 149 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
150 | 150 | QSG_ID INT UNSIGNED NOT NULL, |
151 | 151 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
152 | 152 | PRIMARY KEY (EQG_ID)"; |
153 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
153 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
154 | 154 | |
155 | 155 | |
156 | 156 | |
157 | - $table_name='esp_event_venue'; |
|
158 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
157 | + $table_name = 'esp_event_venue'; |
|
158 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
159 | 159 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
160 | 160 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
161 | 161 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
162 | 162 | PRIMARY KEY (EVV_ID)"; |
163 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
163 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
164 | 164 | |
165 | 165 | |
166 | 166 | |
167 | - $table_name='esp_extra_meta'; |
|
168 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
167 | + $table_name = 'esp_extra_meta'; |
|
168 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
169 | 169 | OBJ_ID INT(11) DEFAULT NULL, |
170 | 170 | EXM_type VARCHAR(45) DEFAULT NULL, |
171 | 171 | EXM_key VARCHAR(45) DEFAULT NULL, |
172 | 172 | EXM_value TEXT, |
173 | 173 | PRIMARY KEY (EXM_ID)"; |
174 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
174 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
175 | 175 | |
176 | - $table_name='esp_line_item'; |
|
177 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
176 | + $table_name = 'esp_line_item'; |
|
177 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
178 | 178 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
179 | 179 | TXN_ID INT(11) DEFAULT NULL, |
180 | 180 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | OBJ_ID INT(11) DEFAULT NULL, |
191 | 191 | OBJ_type VARCHAR(45)DEFAULT NULL, |
192 | 192 | PRIMARY KEY (LIN_ID)"; |
193 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' ); |
|
193 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
194 | 194 | |
195 | 195 | $table_name = 'esp_message_template'; |
196 | 196 | $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | KEY GRP_ID (GRP_ID)"; |
203 | 203 | $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
204 | 204 | |
205 | - EEH_Activation::drop_index( 'esp_message_template_group', 'EVT_ID' ); |
|
205 | + EEH_Activation::drop_index('esp_message_template_group', 'EVT_ID'); |
|
206 | 206 | |
207 | 207 | $table_name = 'esp_message_template_group'; |
208 | 208 | $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
218 | 218 | PRIMARY KEY (GRP_ID), |
219 | 219 | KEY MTP_user_id (MTP_user_id)"; |
220 | - $this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB'); |
|
220 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
221 | 221 | |
222 | 222 | $table_name = 'esp_event_message_template'; |
223 | 223 | $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | PRIMARY KEY (EMT_ID), |
227 | 227 | KEY EVT_ID (EVT_ID), |
228 | 228 | KEY GRP_ID (GRP_ID)"; |
229 | - $this->_table_is_new_in_this_version( $table_name, $sql, 'ENGINE=InnoDB'); |
|
229 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
230 | 230 | |
231 | 231 | |
232 | 232 | |
@@ -335,8 +335,8 @@ discard block |
||
335 | 335 | |
336 | 336 | |
337 | 337 | |
338 | - $table_name='esp_question'; |
|
339 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
338 | + $table_name = 'esp_question'; |
|
339 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
340 | 340 | QST_display_text TEXT NOT NULL, |
341 | 341 | QST_admin_label VARCHAR(255) NOT NULL, |
342 | 342 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -348,12 +348,12 @@ discard block |
||
348 | 348 | QST_wp_user BIGINT UNSIGNED NULL, |
349 | 349 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
350 | 350 | PRIMARY KEY (QST_ID)'; |
351 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
351 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
352 | 352 | |
353 | - EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' ); |
|
353 | + EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
354 | 354 | |
355 | 355 | $table_name = 'esp_question_group'; |
356 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
356 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
357 | 357 | QSG_name VARCHAR(255) NOT NULL, |
358 | 358 | QSG_identifier VARCHAR(100) NOT NULL, |
359 | 359 | QSG_desc TEXT NULL, |
@@ -364,29 +364,29 @@ discard block |
||
364 | 364 | QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
365 | 365 | PRIMARY KEY (QSG_ID), |
366 | 366 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
367 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
367 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
368 | 368 | |
369 | 369 | |
370 | 370 | |
371 | - $table_name='esp_question_group_question'; |
|
372 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
371 | + $table_name = 'esp_question_group_question'; |
|
372 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
373 | 373 | QSG_ID INT UNSIGNED NOT NULL, |
374 | 374 | QST_ID INT UNSIGNED NOT NULL, |
375 | 375 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
376 | 376 | PRIMARY KEY (QGQ_ID) "; |
377 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
377 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
378 | 378 | |
379 | 379 | |
380 | 380 | |
381 | - $table_name='esp_question_option'; |
|
382 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
381 | + $table_name = 'esp_question_option'; |
|
382 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
383 | 383 | QSO_value VARCHAR(255) NOT NULL, |
384 | 384 | QSO_desc TEXT NOT NULL, |
385 | 385 | QST_ID INT UNSIGNED NOT NULL, |
386 | 386 | QSO_order INT UNSIGNED NOT NULL DEFAULT 0, |
387 | 387 | QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
388 | 388 | PRIMARY KEY (QSO_ID)"; |
389 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
389 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
390 | 390 | |
391 | 391 | |
392 | 392 | |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | |
420 | 420 | |
421 | 421 | |
422 | - $table_name='esp_checkin'; |
|
423 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
422 | + $table_name = 'esp_checkin'; |
|
423 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
424 | 424 | REG_ID INT(10) UNSIGNED NOT NULL, |
425 | 425 | DTT_ID INT(10) UNSIGNED NOT NULL, |
426 | 426 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
495 | 495 | |
496 | 496 | |
497 | - $script_with_defaults = EE_Registry::instance()->load_dms( 'Core_4_1_0' ); |
|
497 | + $script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
498 | 498 | //setting up the DEFAULT stats and countries is also essential for the data migrations to run |
499 | 499 | //(because many need to convert old string states to foreign keys into the states table) |
500 | 500 | $script_with_defaults->insert_default_states(); |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | return true; |
517 | 517 | } |
518 | 518 | |
519 | - public function migration_page_hooks(){ |
|
519 | + public function migration_page_hooks() { |
|
520 | 520 | |
521 | 521 | } |
522 | 522 | |
@@ -532,34 +532,34 @@ discard block |
||
532 | 532 | |
533 | 533 | global $wpdb; |
534 | 534 | $ticket_table = $wpdb->prefix."esp_ticket"; |
535 | - if ( EEH_Activation::table_exists( $ticket_table ) ) { |
|
535 | + if (EEH_Activation::table_exists($ticket_table)) { |
|
536 | 536 | |
537 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
537 | + $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table; |
|
538 | 538 | $tickets_exist = $wpdb->get_var($SQL); |
539 | 539 | |
540 | - if ( ! $tickets_exist ) { |
|
540 | + if ( ! $tickets_exist) { |
|
541 | 541 | $SQL = "INSERT INTO $ticket_table |
542 | 542 | ( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_deleted ) VALUES |
543 | - ( 1, 0, '" . __("Free Ticket", "event_espresso") . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);"; |
|
544 | - $SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL ); |
|
543 | + ( 1, 0, '".__("Free Ticket", "event_espresso")."', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);"; |
|
544 | + $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL); |
|
545 | 545 | $wpdb->query($SQL); |
546 | 546 | } |
547 | 547 | } |
548 | 548 | $ticket_price_table = $wpdb->prefix."esp_ticket_price"; |
549 | 549 | |
550 | - if ( EEH_Activation::table_exists( $ticket_price_table ) ) { |
|
550 | + if (EEH_Activation::table_exists($ticket_price_table)) { |
|
551 | 551 | |
552 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
552 | + $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table; |
|
553 | 553 | $ticket_prc_exist = $wpdb->get_var($SQL); |
554 | 554 | |
555 | - if ( ! $ticket_prc_exist ) { |
|
555 | + if ( ! $ticket_prc_exist) { |
|
556 | 556 | |
557 | 557 | $SQL = "INSERT INTO $ticket_price_table |
558 | 558 | ( TKP_ID, TKT_ID, PRC_ID ) VALUES |
559 | 559 | ( 1, 1, 1 ) |
560 | 560 | "; |
561 | 561 | |
562 | - $SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL ); |
|
562 | + $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
563 | 563 | $wpdb->query($SQL); |
564 | 564 | } |
565 | 565 | } |
@@ -42,11 +42,11 @@ |
||
42 | 42 | if($version_string <= '4.5.0' && $version_string >= '4.3.0' ){ |
43 | 43 | // echo "$version_string can be migrated from"; |
44 | 44 | return true; |
45 | - }elseif( ! $version_string ){ |
|
45 | + } elseif( ! $version_string ){ |
|
46 | 46 | // echo "no version string provided: $version_string"; |
47 | 47 | //no version string provided... this must be pre 4.3 |
48 | 48 | return false;//changed mind. dont want people thinking they should migrate yet because they cant |
49 | - }else{ |
|
49 | + } else{ |
|
50 | 50 | // echo "$version_string doesnt apply"; |
51 | 51 | return false; |
52 | 52 | } |
@@ -12,16 +12,16 @@ discard block |
||
12 | 12 | //(all other times it gets resurrected from a wordpress option) |
13 | 13 | $stages = glob(EE_CORE.'data_migration_scripts/4_5_0_stages/*'); |
14 | 14 | $class_to_filepath = array(); |
15 | -foreach($stages as $filepath){ |
|
15 | +foreach ($stages as $filepath) { |
|
16 | 16 | $matches = array(); |
17 | - preg_match('~4_5_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
17 | + preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
18 | 18 | $class_to_filepath[$matches[1]] = $filepath; |
19 | 19 | } |
20 | 20 | //give addons a chance to autoload their stages too |
21 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages',$class_to_filepath); |
|
21 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages', $class_to_filepath); |
|
22 | 22 | EEH_Autoloader::register_autoloader($class_to_filepath); |
23 | 23 | |
24 | -class EE_DMS_Core_4_5_0 extends EE_Data_Migration_Script_Base{ |
|
24 | +class EE_DMS_Core_4_5_0 extends EE_Data_Migration_Script_Base { |
|
25 | 25 | |
26 | 26 | |
27 | 27 | |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | } |
40 | 40 | public function can_migrate_from_version($version_array) { |
41 | 41 | $version_string = $version_array['Core']; |
42 | - if($version_string <= '4.5.0' && $version_string >= '4.3.0' ){ |
|
42 | + if ($version_string <= '4.5.0' && $version_string >= '4.3.0') { |
|
43 | 43 | // echo "$version_string can be migrated from"; |
44 | 44 | return true; |
45 | - }elseif( ! $version_string ){ |
|
45 | + }elseif ( ! $version_string) { |
|
46 | 46 | // echo "no version string provided: $version_string"; |
47 | 47 | //no version string provided... this must be pre 4.3 |
48 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
49 | - }else{ |
|
48 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
49 | + } else { |
|
50 | 50 | // echo "$version_string doesnt apply"; |
51 | 51 | return false; |
52 | 52 | } |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | } |
57 | 57 | public function schema_changes_before_migration() { |
58 | 58 | //relies on 4.1's EEH_Activation::create_table |
59 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
60 | - $table_name='esp_answer'; |
|
61 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
59 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
60 | + $table_name = 'esp_answer'; |
|
61 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
62 | 62 | REG_ID INT UNSIGNED NOT NULL, |
63 | 63 | QST_ID INT UNSIGNED NOT NULL, |
64 | 64 | ANS_value TEXT NOT NULL, |
65 | 65 | PRIMARY KEY (ANS_ID)"; |
66 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
66 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
67 | 67 | |
68 | 68 | $table_name = 'esp_attendee_meta'; |
69 | 69 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | CNT_is_EU TINYINT(1) DEFAULT '0', |
103 | 103 | CNT_active TINYINT(1) DEFAULT '0', |
104 | 104 | PRIMARY KEY (CNT_ISO)"; |
105 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' ); |
|
105 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
106 | 106 | |
107 | 107 | $table_name = 'esp_datetime'; |
108 | 108 | $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | |
125 | 125 | |
126 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' ); |
|
126 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
127 | 127 | $table_name = 'esp_event_meta'; |
128 | 128 | $sql = " |
129 | 129 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
@@ -140,41 +140,41 @@ discard block |
||
140 | 140 | EVT_external_URL VARCHAR(200) NULL, |
141 | 141 | EVT_donations TINYINT(1) NULL, |
142 | 142 | PRIMARY KEY (EVTM_ID)"; |
143 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
143 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
144 | 144 | |
145 | 145 | |
146 | 146 | |
147 | - $table_name='esp_event_question_group'; |
|
148 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
147 | + $table_name = 'esp_event_question_group'; |
|
148 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
149 | 149 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
150 | 150 | QSG_ID INT UNSIGNED NOT NULL, |
151 | 151 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
152 | 152 | PRIMARY KEY (EQG_ID)"; |
153 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
153 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
154 | 154 | |
155 | 155 | |
156 | 156 | |
157 | - $table_name='esp_event_venue'; |
|
158 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
157 | + $table_name = 'esp_event_venue'; |
|
158 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
159 | 159 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
160 | 160 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
161 | 161 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
162 | 162 | PRIMARY KEY (EVV_ID)"; |
163 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
163 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
164 | 164 | |
165 | 165 | |
166 | 166 | |
167 | - $table_name='esp_extra_meta'; |
|
168 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
167 | + $table_name = 'esp_extra_meta'; |
|
168 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
169 | 169 | OBJ_ID INT(11) DEFAULT NULL, |
170 | 170 | EXM_type VARCHAR(45) DEFAULT NULL, |
171 | 171 | EXM_key VARCHAR(45) DEFAULT NULL, |
172 | 172 | EXM_value TEXT, |
173 | 173 | PRIMARY KEY (EXM_ID)"; |
174 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
174 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
175 | 175 | |
176 | - $table_name='esp_line_item'; |
|
177 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
176 | + $table_name = 'esp_line_item'; |
|
177 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
178 | 178 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
179 | 179 | TXN_ID INT(11) DEFAULT NULL, |
180 | 180 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | OBJ_ID INT(11) DEFAULT NULL, |
191 | 191 | OBJ_type VARCHAR(45)DEFAULT NULL, |
192 | 192 | PRIMARY KEY (LIN_ID)"; |
193 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' ); |
|
193 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
194 | 194 | |
195 | 195 | $table_name = 'esp_message_template'; |
196 | 196 | $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | KEY GRP_ID (GRP_ID)"; |
203 | 203 | $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
204 | 204 | |
205 | - EEH_Activation::drop_index( 'esp_message_template_group', 'EVT_ID' ); |
|
205 | + EEH_Activation::drop_index('esp_message_template_group', 'EVT_ID'); |
|
206 | 206 | |
207 | 207 | $table_name = 'esp_message_template_group'; |
208 | 208 | $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
218 | 218 | PRIMARY KEY (GRP_ID), |
219 | 219 | KEY MTP_user_id (MTP_user_id)"; |
220 | - $this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB'); |
|
220 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
221 | 221 | |
222 | 222 | $table_name = 'esp_event_message_template'; |
223 | 223 | $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | PRIMARY KEY (EMT_ID), |
227 | 227 | KEY EVT_ID (EVT_ID), |
228 | 228 | KEY GRP_ID (GRP_ID)"; |
229 | - $this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB'); |
|
229 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
230 | 230 | |
231 | 231 | |
232 | 232 | $table_name = 'esp_payment'; |
@@ -276,8 +276,8 @@ discard block |
||
276 | 276 | PRIMARY KEY (TTM_ID)"; |
277 | 277 | $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
278 | 278 | |
279 | - $table_name='esp_question'; |
|
280 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
279 | + $table_name = 'esp_question'; |
|
280 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
281 | 281 | QST_display_text TEXT NOT NULL, |
282 | 282 | QST_admin_label VARCHAR(255) NOT NULL, |
283 | 283 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -289,27 +289,27 @@ discard block |
||
289 | 289 | QST_wp_user BIGINT UNSIGNED NULL, |
290 | 290 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
291 | 291 | PRIMARY KEY (QST_ID)'; |
292 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
292 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
293 | 293 | |
294 | - $table_name='esp_question_group_question'; |
|
295 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
294 | + $table_name = 'esp_question_group_question'; |
|
295 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
296 | 296 | QSG_ID INT UNSIGNED NOT NULL, |
297 | 297 | QST_ID INT UNSIGNED NOT NULL, |
298 | 298 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
299 | 299 | PRIMARY KEY (QGQ_ID) "; |
300 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
300 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
301 | 301 | |
302 | 302 | |
303 | 303 | |
304 | - $table_name='esp_question_option'; |
|
305 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
304 | + $table_name = 'esp_question_option'; |
|
305 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
306 | 306 | QSO_value VARCHAR(255) NOT NULL, |
307 | 307 | QSO_desc TEXT NOT NULL, |
308 | 308 | QST_ID INT UNSIGNED NOT NULL, |
309 | 309 | QSO_order INT UNSIGNED NOT NULL DEFAULT 0, |
310 | 310 | QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
311 | 311 | PRIMARY KEY (QSO_ID)"; |
312 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
312 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
313 | 313 | |
314 | 314 | |
315 | 315 | |
@@ -342,8 +342,8 @@ discard block |
||
342 | 342 | |
343 | 343 | |
344 | 344 | |
345 | - $table_name='esp_checkin'; |
|
346 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
345 | + $table_name = 'esp_checkin'; |
|
346 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
347 | 347 | REG_ID INT(10) UNSIGNED NOT NULL, |
348 | 348 | DTT_ID INT(10) UNSIGNED NOT NULL, |
349 | 349 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | PRC_wp_user BIGINT UNSIGNED NULL, |
432 | 432 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
433 | 433 | PRIMARY KEY (PRC_ID)"; |
434 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
434 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
435 | 435 | |
436 | 436 | $table_name = "esp_price_type"; |
437 | 437 | $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -468,12 +468,12 @@ discard block |
||
468 | 468 | TKT_parent INT(10) UNSIGNED DEFAULT '0', |
469 | 469 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
470 | 470 | PRIMARY KEY (TKT_ID)"; |
471 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' ); |
|
471 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
472 | 472 | |
473 | - EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' ); |
|
473 | + EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
474 | 474 | |
475 | 475 | $table_name = 'esp_question_group'; |
476 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
476 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
477 | 477 | QSG_name VARCHAR(255) NOT NULL, |
478 | 478 | QSG_identifier VARCHAR(100) NOT NULL, |
479 | 479 | QSG_desc TEXT NULL, |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | QSG_wp_user BIGINT UNSIGNED NULL, |
486 | 486 | PRIMARY KEY (QSG_ID), |
487 | 487 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
488 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' ); |
|
488 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
489 | 489 | |
490 | 490 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
491 | 491 | |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | return true; |
510 | 510 | } |
511 | 511 | |
512 | - public function migration_page_hooks(){ |
|
512 | + public function migration_page_hooks() { |
|
513 | 513 | |
514 | 514 | } |
515 | 515 | |
@@ -523,21 +523,21 @@ discard block |
||
523 | 523 | global $wpdb; |
524 | 524 | $price_type_table = $wpdb->prefix."esp_price_type"; |
525 | 525 | |
526 | - if ( EEH_Activation::table_exists( $price_type_table ) ) { |
|
526 | + if (EEH_Activation::table_exists($price_type_table)) { |
|
527 | 527 | |
528 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
529 | - $price_types_exist = $wpdb->get_var( $SQL ); |
|
528 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table; |
|
529 | + $price_types_exist = $wpdb->get_var($SQL); |
|
530 | 530 | |
531 | - if ( ! $price_types_exist ) { |
|
531 | + if ( ! $price_types_exist) { |
|
532 | 532 | $user_id = EEH_Activation::get_default_creator_id(); |
533 | 533 | $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES |
534 | - (1, '" . __('Base Price', 'event_espresso') . "', 1, 0, 0, $user_id, 0), |
|
535 | - (2, '" . __('Percent Discount', 'event_espresso') . "', 2, 1, 20, $user_id, 0), |
|
536 | - (3, '" . __('Dollar Discount', 'event_espresso') . "', 2, 0, 30, $user_id, 0), |
|
537 | - (4, '" . __('Percent Surcharge', 'event_espresso') . "', 3, 1, 40, $user_id, 0), |
|
538 | - (5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3, 0, 50, $user_id, 0);"; |
|
539 | - $SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL ); |
|
540 | - $wpdb->query( $SQL ); |
|
534 | + (1, '".__('Base Price', 'event_espresso')."', 1, 0, 0, $user_id, 0), |
|
535 | + (2, '".__('Percent Discount', 'event_espresso')."', 2, 1, 20, $user_id, 0), |
|
536 | + (3, '".__('Dollar Discount', 'event_espresso')."', 2, 0, 30, $user_id, 0), |
|
537 | + (4, '".__('Percent Surcharge', 'event_espresso')."', 3, 1, 40, $user_id, 0), |
|
538 | + (5, '".__('Dollar Surcharge', 'event_espresso')."', 3, 0, 50, $user_id, 0);"; |
|
539 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL); |
|
540 | + $wpdb->query($SQL); |
|
541 | 541 | } |
542 | 542 | } |
543 | 543 | } |
@@ -557,17 +557,17 @@ discard block |
||
557 | 557 | global $wpdb; |
558 | 558 | $price_table = $wpdb->prefix."esp_price"; |
559 | 559 | |
560 | - if ( EEH_Activation::table_exists( $price_table ) ) { |
|
560 | + if (EEH_Activation::table_exists($price_table)) { |
|
561 | 561 | |
562 | - $SQL = 'SELECT COUNT(PRC_ID) FROM ' .$price_table; |
|
563 | - $prices_exist = $wpdb->get_var( $SQL ); |
|
562 | + $SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table; |
|
563 | + $prices_exist = $wpdb->get_var($SQL); |
|
564 | 564 | |
565 | - if ( ! $prices_exist ) { |
|
565 | + if ( ! $prices_exist) { |
|
566 | 566 | $user_id = EEH_Activation::get_default_creator_id(); |
567 | 567 | $SQL = "INSERT INTO $price_table |
568 | 568 | (PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc, PRC_is_default, PRC_overrides, PRC_wp_user, PRC_order, PRC_deleted, PRC_parent ) VALUES |
569 | 569 | (1, 1, '0.00', 'Free Admission', '', 1, NULL, $user_id, 0, 0, 0);"; |
570 | - $SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL ); |
|
570 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL); |
|
571 | 571 | $wpdb->query($SQL); |
572 | 572 | } |
573 | 573 | } |
@@ -585,35 +585,35 @@ discard block |
||
585 | 585 | |
586 | 586 | global $wpdb; |
587 | 587 | $ticket_table = $wpdb->prefix."esp_ticket"; |
588 | - if ( EEH_Activation::table_exists( $ticket_table ) ) { |
|
588 | + if (EEH_Activation::table_exists($ticket_table)) { |
|
589 | 589 | |
590 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
590 | + $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table; |
|
591 | 591 | $tickets_exist = $wpdb->get_var($SQL); |
592 | 592 | |
593 | - if ( ! $tickets_exist ) { |
|
593 | + if ( ! $tickets_exist) { |
|
594 | 594 | $user_id = EEH_Activation::get_default_creator_id(); |
595 | 595 | $SQL = "INSERT INTO $ticket_table |
596 | 596 | ( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_wp_user, TKT_deleted ) VALUES |
597 | - ( 1, 0, '" . __("Free Ticket", "event_espresso") . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);"; |
|
598 | - $SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL ); |
|
597 | + ( 1, 0, '".__("Free Ticket", "event_espresso")."', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);"; |
|
598 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL); |
|
599 | 599 | $wpdb->query($SQL); |
600 | 600 | } |
601 | 601 | } |
602 | 602 | $ticket_price_table = $wpdb->prefix."esp_ticket_price"; |
603 | 603 | |
604 | - if ( EEH_Activation::table_exists( $ticket_price_table ) ) { |
|
604 | + if (EEH_Activation::table_exists($ticket_price_table)) { |
|
605 | 605 | |
606 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
606 | + $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table; |
|
607 | 607 | $ticket_prc_exist = $wpdb->get_var($SQL); |
608 | 608 | |
609 | - if ( ! $ticket_prc_exist ) { |
|
609 | + if ( ! $ticket_prc_exist) { |
|
610 | 610 | |
611 | 611 | $SQL = "INSERT INTO $ticket_price_table |
612 | 612 | ( TKP_ID, TKT_ID, PRC_ID ) VALUES |
613 | 613 | ( 1, 1, 1 ) |
614 | 614 | "; |
615 | 615 | |
616 | - $SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL ); |
|
616 | + $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
617 | 617 | $wpdb->query($SQL); |
618 | 618 | } |
619 | 619 | } |
@@ -65,11 +65,11 @@ |
||
65 | 65 | if($version_string <= '4.6.0' && $version_string >= '4.5.0' ){ |
66 | 66 | // echo "$version_string can be migrated from"; |
67 | 67 | return true; |
68 | - }elseif( ! $version_string ){ |
|
68 | + } elseif( ! $version_string ){ |
|
69 | 69 | // echo "no version string provided: $version_string"; |
70 | 70 | //no version string provided... this must be pre 4.3 |
71 | 71 | return false;//changed mind. dont want people thinking they should migrate yet because they cant |
72 | - }else{ |
|
72 | + } else{ |
|
73 | 73 | // echo "$version_string doesnt apply"; |
74 | 74 | return false; |
75 | 75 | } |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | //(all other times it gets resurrected from a wordpress option) |
11 | 11 | $stages = glob(EE_CORE.'data_migration_scripts/4_6_0_stages/*'); |
12 | 12 | $class_to_filepath = array(); |
13 | -foreach($stages as $filepath){ |
|
13 | +foreach ($stages as $filepath) { |
|
14 | 14 | $matches = array(); |
15 | - preg_match('~4_6_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
15 | + preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
16 | 16 | $class_to_filepath[$matches[1]] = $filepath; |
17 | 17 | } |
18 | 18 | //give addons a chance to autoload their stages too |
19 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages',$class_to_filepath); |
|
19 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages', $class_to_filepath); |
|
20 | 20 | EEH_Autoloader::register_autoloader($class_to_filepath); |
21 | 21 | |
22 | 22 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @since 4.6.0 |
33 | 33 | * |
34 | 34 | */ |
35 | -class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base{ |
|
35 | +class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base { |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * return EE_DMS_Core_4_6_0 |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function can_migrate_from_version($version_array) { |
64 | 64 | $version_string = $version_array['Core']; |
65 | - if($version_string <= '4.6.0' && $version_string >= '4.5.0' ){ |
|
65 | + if ($version_string <= '4.6.0' && $version_string >= '4.5.0') { |
|
66 | 66 | // echo "$version_string can be migrated from"; |
67 | 67 | return true; |
68 | - }elseif( ! $version_string ){ |
|
68 | + }elseif ( ! $version_string) { |
|
69 | 69 | // echo "no version string provided: $version_string"; |
70 | 70 | //no version string provided... this must be pre 4.3 |
71 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | - }else{ |
|
71 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | + } else { |
|
73 | 73 | // echo "$version_string doesnt apply"; |
74 | 74 | return false; |
75 | 75 | } |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function schema_changes_before_migration() { |
93 | 93 | //relies on 4.1's EEH_Activation::create_table |
94 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
95 | - $table_name='esp_answer'; |
|
96 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
94 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
95 | + $table_name = 'esp_answer'; |
|
96 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
97 | 97 | REG_ID INT UNSIGNED NOT NULL, |
98 | 98 | QST_ID INT UNSIGNED NOT NULL, |
99 | 99 | ANS_value TEXT NOT NULL, |
100 | 100 | PRIMARY KEY (ANS_ID)"; |
101 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
101 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
102 | 102 | |
103 | 103 | $table_name = 'esp_attendee_meta'; |
104 | 104 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | CNT_is_EU TINYINT(1) DEFAULT '0', |
138 | 138 | CNT_active TINYINT(1) DEFAULT '0', |
139 | 139 | PRIMARY KEY (CNT_ISO)"; |
140 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' ); |
|
140 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
141 | 141 | |
142 | 142 | $table_name = 'esp_currency'; |
143 | 143 | $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
148 | 148 | CUR_active TINYINT(1) DEFAULT '0', |
149 | 149 | PRIMARY KEY (CUR_code)"; |
150 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
150 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
151 | 151 | |
152 | 152 | |
153 | 153 | $table_name = 'esp_currency_payment_method'; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | |
179 | 179 | |
180 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' ); |
|
180 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
181 | 181 | $table_name = 'esp_event_meta'; |
182 | 182 | $sql = " |
183 | 183 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
@@ -194,41 +194,41 @@ discard block |
||
194 | 194 | EVT_external_URL VARCHAR(200) NULL, |
195 | 195 | EVT_donations TINYINT(1) NULL, |
196 | 196 | PRIMARY KEY (EVTM_ID)"; |
197 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
197 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
198 | 198 | |
199 | 199 | |
200 | 200 | |
201 | - $table_name='esp_event_question_group'; |
|
202 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
201 | + $table_name = 'esp_event_question_group'; |
|
202 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
203 | 203 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
204 | 204 | QSG_ID INT UNSIGNED NOT NULL, |
205 | 205 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
206 | 206 | PRIMARY KEY (EQG_ID)"; |
207 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
207 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
208 | 208 | |
209 | 209 | |
210 | 210 | |
211 | - $table_name='esp_event_venue'; |
|
212 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
211 | + $table_name = 'esp_event_venue'; |
|
212 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
213 | 213 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
214 | 214 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
215 | 215 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
216 | 216 | PRIMARY KEY (EVV_ID)"; |
217 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
217 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
218 | 218 | |
219 | 219 | |
220 | 220 | |
221 | - $table_name='esp_extra_meta'; |
|
222 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
221 | + $table_name = 'esp_extra_meta'; |
|
222 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
223 | 223 | OBJ_ID INT(11) DEFAULT NULL, |
224 | 224 | EXM_type VARCHAR(45) DEFAULT NULL, |
225 | 225 | EXM_key VARCHAR(45) DEFAULT NULL, |
226 | 226 | EXM_value TEXT, |
227 | 227 | PRIMARY KEY (EXM_ID)"; |
228 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
228 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
229 | 229 | |
230 | - $table_name='esp_line_item'; |
|
231 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
230 | + $table_name = 'esp_line_item'; |
|
231 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
232 | 232 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
233 | 233 | TXN_ID INT(11) DEFAULT NULL, |
234 | 234 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | OBJ_ID INT(11) DEFAULT NULL, |
245 | 245 | OBJ_type VARCHAR(45)DEFAULT NULL, |
246 | 246 | PRIMARY KEY (LIN_ID)"; |
247 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' ); |
|
247 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
248 | 248 | |
249 | 249 | $table_name = 'esp_log'; |
250 | 250 | $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | KEY GRP_ID (GRP_ID)"; |
268 | 268 | $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
269 | 269 | |
270 | - EEH_Activation::drop_index( 'esp_message_template_group', 'EVT_ID' ); |
|
270 | + EEH_Activation::drop_index('esp_message_template_group', 'EVT_ID'); |
|
271 | 271 | |
272 | 272 | $table_name = 'esp_message_template_group'; |
273 | 273 | $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
283 | 283 | PRIMARY KEY (GRP_ID), |
284 | 284 | KEY MTP_user_id (MTP_user_id)"; |
285 | - $this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB'); |
|
285 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
286 | 286 | |
287 | 287 | $table_name = 'esp_event_message_template'; |
288 | 288 | $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | PRIMARY KEY (EMT_ID), |
292 | 292 | KEY EVT_ID (EVT_ID), |
293 | 293 | KEY GRP_ID (GRP_ID)"; |
294 | - $this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB'); |
|
294 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
295 | 295 | |
296 | 296 | |
297 | 297 | $table_name = 'esp_payment'; |
@@ -359,8 +359,8 @@ discard block |
||
359 | 359 | PRIMARY KEY (TTM_ID)"; |
360 | 360 | $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
361 | 361 | |
362 | - $table_name='esp_question'; |
|
363 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
362 | + $table_name = 'esp_question'; |
|
363 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
364 | 364 | QST_display_text TEXT NOT NULL, |
365 | 365 | QST_admin_label VARCHAR(255) NOT NULL, |
366 | 366 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -372,27 +372,27 @@ discard block |
||
372 | 372 | QST_wp_user BIGINT UNSIGNED NULL, |
373 | 373 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
374 | 374 | PRIMARY KEY (QST_ID)'; |
375 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
375 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
376 | 376 | |
377 | - $table_name='esp_question_group_question'; |
|
378 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
377 | + $table_name = 'esp_question_group_question'; |
|
378 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
379 | 379 | QSG_ID INT UNSIGNED NOT NULL, |
380 | 380 | QST_ID INT UNSIGNED NOT NULL, |
381 | 381 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
382 | 382 | PRIMARY KEY (QGQ_ID) "; |
383 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
383 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
384 | 384 | |
385 | 385 | |
386 | 386 | |
387 | - $table_name='esp_question_option'; |
|
388 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
387 | + $table_name = 'esp_question_option'; |
|
388 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
389 | 389 | QSO_value VARCHAR(255) NOT NULL, |
390 | 390 | QSO_desc TEXT NOT NULL, |
391 | 391 | QST_ID INT UNSIGNED NOT NULL, |
392 | 392 | QSO_order INT UNSIGNED NOT NULL DEFAULT 0, |
393 | 393 | QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
394 | 394 | PRIMARY KEY (QSO_ID)"; |
395 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
395 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
396 | 396 | |
397 | 397 | |
398 | 398 | |
@@ -425,8 +425,8 @@ discard block |
||
425 | 425 | |
426 | 426 | |
427 | 427 | |
428 | - $table_name='esp_checkin'; |
|
429 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
428 | + $table_name = 'esp_checkin'; |
|
429 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
430 | 430 | REG_ID INT(10) UNSIGNED NOT NULL, |
431 | 431 | DTT_ID INT(10) UNSIGNED NOT NULL, |
432 | 432 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | PRC_wp_user BIGINT UNSIGNED NULL, |
516 | 516 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
517 | 517 | PRIMARY KEY (PRC_ID)"; |
518 | - $this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB'); |
|
518 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
519 | 519 | |
520 | 520 | $table_name = "esp_price_type"; |
521 | 521 | $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -552,12 +552,12 @@ discard block |
||
552 | 552 | TKT_parent INT(10) UNSIGNED DEFAULT '0', |
553 | 553 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
554 | 554 | PRIMARY KEY (TKT_ID)"; |
555 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' ); |
|
555 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
556 | 556 | |
557 | - EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' ); |
|
557 | + EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
558 | 558 | |
559 | 559 | $table_name = 'esp_question_group'; |
560 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
560 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
561 | 561 | QSG_name VARCHAR(255) NOT NULL, |
562 | 562 | QSG_identifier VARCHAR(100) NOT NULL, |
563 | 563 | QSG_desc TEXT NULL, |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | QSG_wp_user BIGINT UNSIGNED NULL, |
570 | 570 | PRIMARY KEY (QSG_ID), |
571 | 571 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
572 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' ); |
|
572 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
573 | 573 | |
574 | 574 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
575 | 575 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -597,15 +597,15 @@ discard block |
||
597 | 597 | return true; |
598 | 598 | } |
599 | 599 | |
600 | - public function migration_page_hooks(){ |
|
600 | + public function migration_page_hooks() { |
|
601 | 601 | |
602 | 602 | } |
603 | 603 | |
604 | - public function add_default_admin_only_payments(){ |
|
604 | + public function add_default_admin_only_payments() { |
|
605 | 605 | global $wpdb; |
606 | 606 | $table_name = $wpdb->prefix."esp_payment_method"; |
607 | 607 | $user_id = EEH_Activation::get_default_creator_id(); |
608 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
608 | + if (EEH_Activation::table_exists($table_name)) { |
|
609 | 609 | |
610 | 610 | $SQL = "SELECT COUNT( * ) FROM $table_name"; |
611 | 611 | $existing_payment_methods = $wpdb->get_var($SQL); |
@@ -626,11 +626,11 @@ discard block |
||
626 | 626 | //so admins can record payments for them from the admin page |
627 | 627 | |
628 | 628 | |
629 | - foreach($default_admin_only_payment_methods as $nicename => $description){ |
|
629 | + foreach ($default_admin_only_payment_methods as $nicename => $description) { |
|
630 | 630 | $slug = sanitize_key($nicename); |
631 | 631 | //check that such a payment method exists |
632 | - $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s",$slug)); |
|
633 | - if( ! $exists){ |
|
632 | + $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug)); |
|
633 | + if ( ! $exists) { |
|
634 | 634 | $values = array( |
635 | 635 | 'PMD_type'=>'Admin_Only', |
636 | 636 | 'PMD_name'=>$nicename, |
@@ -644,17 +644,17 @@ discard block |
||
644 | 644 | $table_name, |
645 | 645 | $values, |
646 | 646 | array( |
647 | - '%s',//PMD_type |
|
648 | - '%s',//PMD_name |
|
649 | - '%s',//PMD_admin_name |
|
650 | - '%s',//PMD_admin_desc |
|
651 | - '%s',//PMD_slug |
|
652 | - '%d',//PMD_wp_user |
|
653 | - '%s',//PMD_scope |
|
647 | + '%s', //PMD_type |
|
648 | + '%s', //PMD_name |
|
649 | + '%s', //PMD_admin_name |
|
650 | + '%s', //PMD_admin_desc |
|
651 | + '%s', //PMD_slug |
|
652 | + '%d', //PMD_wp_user |
|
653 | + '%s', //PMD_scope |
|
654 | 654 | ) |
655 | 655 | ); |
656 | - if( ! $success ){ |
|
657 | - $this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration", "event_espresso"),$this->_json_encode($values))); |
|
656 | + if ( ! $success) { |
|
657 | + $this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration", "event_espresso"), $this->_json_encode($values))); |
|
658 | 658 | } |
659 | 659 | } |
660 | 660 | } |
@@ -672,11 +672,11 @@ discard block |
||
672 | 672 | |
673 | 673 | global $wpdb; |
674 | 674 | $currency_table = $wpdb->prefix."esp_currency"; |
675 | - if ( EEH_Activation::table_exists( $currency_table ) ) { |
|
675 | + if (EEH_Activation::table_exists($currency_table)) { |
|
676 | 676 | |
677 | 677 | $SQL = "SELECT COUNT('CUR_code') FROM $currency_table"; |
678 | 678 | $countries = $wpdb->get_var($SQL); |
679 | - if ( ! $countries ) { |
|
679 | + if ( ! $countries) { |
|
680 | 680 | $SQL = "INSERT INTO $currency_table |
681 | 681 | ( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES |
682 | 682 | ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -75,12 +76,12 @@ discard block |
||
75 | 76 | if($payment_method_type instanceof EE_PMT_Base && |
76 | 77 | $payment_method_type->get_gateway()){ |
77 | 78 | $currencies_supported = $payment_method_type->get_gateway()->currencies_supported(); |
78 | - }else{ |
|
79 | + } else{ |
|
79 | 80 | $currencies_supported = EE_Gateway::all_currencies_supported; |
80 | 81 | } |
81 | 82 | if($currencies_supported == EE_Gateway::all_currencies_supported || empty( $currencies_supported ) ) { |
82 | 83 | $currencies = $this->get_all_active(); |
83 | - }else{ |
|
84 | + } else{ |
|
84 | 85 | $currencies = $this->get_all_active(array(array('CUR_code'=>array('IN',$currencies_supported)))); |
85 | 86 | } |
86 | 87 | return $currencies; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,32 +25,32 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EEM_Currency extends EEM_Base{ |
|
28 | +class EEM_Currency extends EEM_Base { |
|
29 | 29 | // private instance of the Attendee object |
30 | 30 | protected static $_instance = NULL; |
31 | 31 | |
32 | - protected function __construct( $timezone = NULL ) { |
|
33 | - $this->singular_item = __('Currency','event_espresso'); |
|
34 | - $this->plural_item = __('Currencies','event_espresso'); |
|
32 | + protected function __construct($timezone = NULL) { |
|
33 | + $this->singular_item = __('Currency', 'event_espresso'); |
|
34 | + $this->plural_item = __('Currencies', 'event_espresso'); |
|
35 | 35 | $this->_tables = array( |
36 | 36 | 'Currency'=> new EE_Primary_Table('esp_currency', 'CUR_code') |
37 | 37 | ); |
38 | 38 | $this->_fields = array( |
39 | 39 | 'Currency'=>array( |
40 | - 'CUR_code'=> new EE_Primary_Key_String_Field('CUR_code', __('Currency Code','event_espresso')), |
|
41 | - 'CUR_single' => new EE_Plain_Text_Field('CUR_single', __('Currency Name Singular','event_espresso'), false), |
|
42 | - 'CUR_plural' => new EE_Plain_Text_Field('CUR_plural', __('Currency Name Plural','event_espresso'), false), |
|
43 | - 'CUR_sign' => new EE_Plain_Text_Field('CUR_sign', __('Currency Sign','event_espresso'), false), |
|
44 | - 'CUR_dec_plc' => new EE_Integer_Field('CUR_dec_plc', __('Currency Decimal Places','event_espresso'), false, 2), |
|
45 | - 'CUR_active'=>new EE_Boolean_Field('CUR_active', __('Active?', 'event_espresso'), false,true), |
|
40 | + 'CUR_code'=> new EE_Primary_Key_String_Field('CUR_code', __('Currency Code', 'event_espresso')), |
|
41 | + 'CUR_single' => new EE_Plain_Text_Field('CUR_single', __('Currency Name Singular', 'event_espresso'), false), |
|
42 | + 'CUR_plural' => new EE_Plain_Text_Field('CUR_plural', __('Currency Name Plural', 'event_espresso'), false), |
|
43 | + 'CUR_sign' => new EE_Plain_Text_Field('CUR_sign', __('Currency Sign', 'event_espresso'), false), |
|
44 | + 'CUR_dec_plc' => new EE_Integer_Field('CUR_dec_plc', __('Currency Decimal Places', 'event_espresso'), false, 2), |
|
45 | + 'CUR_active'=>new EE_Boolean_Field('CUR_active', __('Active?', 'event_espresso'), false, true), |
|
46 | 46 | )); |
47 | 47 | $this->_model_relations = array( |
48 | 48 | 'Payment_Method'=>new EE_HABTM_Relation('Currency_Payment_Method'), |
49 | 49 | ); |
50 | 50 | //this model is generally available for reading |
51 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
51 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
52 | 52 | |
53 | - parent::__construct( $timezone ); |
|
53 | + parent::__construct($timezone); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | * @param array $query_params see EEM_Base::get_all |
60 | 60 | * @return EE_Currency[] |
61 | 61 | */ |
62 | - public function get_all_active($query_params = array()){ |
|
62 | + public function get_all_active($query_params = array()) { |
|
63 | 63 | $query_params[0]['CUR_active'] = true; |
64 | - if( ! isset($query_params['order_by'])){ |
|
65 | - $query_params['order_by'] = array('CUR_code'=>'ASC','CUR_single'=>'ASC'); |
|
64 | + if ( ! isset($query_params['order_by'])) { |
|
65 | + $query_params['order_by'] = array('CUR_code'=>'ASC', 'CUR_single'=>'ASC'); |
|
66 | 66 | } |
67 | 67 | return $this->get_all($query_params); |
68 | 68 | } |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | * @param EE_PMT_Base $payment_method_type |
72 | 72 | * @return EE_Currency[] |
73 | 73 | */ |
74 | - public function get_all_currencies_usable_by($payment_method_type){ |
|
75 | - if($payment_method_type instanceof EE_PMT_Base && |
|
76 | - $payment_method_type->get_gateway()){ |
|
74 | + public function get_all_currencies_usable_by($payment_method_type) { |
|
75 | + if ($payment_method_type instanceof EE_PMT_Base && |
|
76 | + $payment_method_type->get_gateway()) { |
|
77 | 77 | $currencies_supported = $payment_method_type->get_gateway()->currencies_supported(); |
78 | - }else{ |
|
78 | + } else { |
|
79 | 79 | $currencies_supported = EE_Gateway::all_currencies_supported; |
80 | 80 | } |
81 | - if($currencies_supported == EE_Gateway::all_currencies_supported || empty( $currencies_supported ) ) { |
|
81 | + if ($currencies_supported == EE_Gateway::all_currencies_supported || empty($currencies_supported)) { |
|
82 | 82 | $currencies = $this->get_all_active(); |
83 | - }else{ |
|
84 | - $currencies = $this->get_all_active(array(array('CUR_code'=>array('IN',$currencies_supported)))); |
|
83 | + } else { |
|
84 | + $currencies = $this->get_all_active(array(array('CUR_code'=>array('IN', $currencies_supported)))); |
|
85 | 85 | } |
86 | 86 | return $currencies; |
87 | 87 | } |