@@ -69,104 +69,104 @@ discard block |
||
69 | 69 | * @param array $options |
70 | 70 | * @return mixed |
71 | 71 | */ |
72 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
|
72 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) { |
|
73 | 73 | |
74 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
75 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
74 | + EE_Registry::instance()->load_helper('Template'); |
|
75 | + EE_Registry::instance()->load_helper('HTML'); |
|
76 | 76 | |
77 | 77 | $html = ''; |
78 | 78 | // set some default options and merge with incoming |
79 | 79 | $default_options = array( |
80 | - 'show_desc' => true, // true false |
|
80 | + 'show_desc' => true, // true false |
|
81 | 81 | 'odd' => false |
82 | 82 | ); |
83 | - $options = array_merge( $default_options, (array)$options ); |
|
83 | + $options = array_merge($default_options, (array) $options); |
|
84 | 84 | |
85 | - switch( $line_item->type() ) { |
|
85 | + switch ($line_item->type()) { |
|
86 | 86 | |
87 | 87 | case EEM_Line_Item::type_line_item: |
88 | 88 | $this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes; |
89 | - if ( $line_item->OBJ_type() == 'Ticket' ) { |
|
89 | + if ($line_item->OBJ_type() == 'Ticket') { |
|
90 | 90 | // item row |
91 | - $html .= $this->_ticket_row( $line_item, $options ); |
|
91 | + $html .= $this->_ticket_row($line_item, $options); |
|
92 | 92 | // got any kids? |
93 | - foreach ( $line_item->children() as $child_line_item ) { |
|
94 | - $this->display_line_item( $child_line_item, $options ); |
|
93 | + foreach ($line_item->children() as $child_line_item) { |
|
94 | + $this->display_line_item($child_line_item, $options); |
|
95 | 95 | } |
96 | 96 | } else { |
97 | 97 | // item row |
98 | - $html .= $this->_item_row( $line_item, $options ); |
|
98 | + $html .= $this->_item_row($line_item, $options); |
|
99 | 99 | // got any kids? |
100 | - foreach ( $line_item->children() as $child_line_item ) { |
|
101 | - $this->display_line_item( $child_line_item, $options ); |
|
100 | + foreach ($line_item->children() as $child_line_item) { |
|
101 | + $this->display_line_item($child_line_item, $options); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | break; |
105 | 105 | |
106 | 106 | case EEM_Line_Item::type_sub_line_item: |
107 | - $html .= $this->_sub_item_row( $line_item, $options ); |
|
107 | + $html .= $this->_sub_item_row($line_item, $options); |
|
108 | 108 | break; |
109 | 109 | |
110 | 110 | case EEM_Line_Item::type_sub_total: |
111 | 111 | static $sub_total = 0; |
112 | 112 | $event_sub_total = 0; |
113 | - $text = __( 'Sub-Total', 'event_espresso' ); |
|
114 | - if ( $line_item->OBJ_type() == 'Event' ) { |
|
115 | - $options[ 'event_id' ] = $event_id = $line_item->OBJ_ID(); |
|
116 | - if ( ! isset( $this->_events[ $options[ 'event_id' ] ] ) ) { |
|
117 | - $event = EEM_Event::instance()->get_one_by_ID( $options[ 'event_id' ] ); |
|
118 | - if ( $event instanceof EE_Event ) { |
|
119 | - if ( $event->default_registration_status() == EEM_Registration::status_id_not_approved ) { |
|
113 | + $text = __('Sub-Total', 'event_espresso'); |
|
114 | + if ($line_item->OBJ_type() == 'Event') { |
|
115 | + $options['event_id'] = $event_id = $line_item->OBJ_ID(); |
|
116 | + if ( ! isset($this->_events[$options['event_id']])) { |
|
117 | + $event = EEM_Event::instance()->get_one_by_ID($options['event_id']); |
|
118 | + if ($event instanceof EE_Event) { |
|
119 | + if ($event->default_registration_status() == EEM_Registration::status_id_not_approved) { |
|
120 | 120 | return ''; |
121 | 121 | } |
122 | 122 | } |
123 | - $this->_events[ $options[ 'event_id' ] ] = 0; |
|
124 | - $html .= $this->_event_row( $line_item ); |
|
125 | - $text = __( 'Event Sub-Total', 'event_espresso' ); |
|
123 | + $this->_events[$options['event_id']] = 0; |
|
124 | + $html .= $this->_event_row($line_item); |
|
125 | + $text = __('Event Sub-Total', 'event_espresso'); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | $child_line_items = $line_item->children(); |
129 | 129 | // loop thru children |
130 | - foreach( $child_line_items as $child_line_item ) { |
|
130 | + foreach ($child_line_items as $child_line_item) { |
|
131 | 131 | // recursively feed children back into this method |
132 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
132 | + $html .= $this->display_line_item($child_line_item, $options); |
|
133 | 133 | } |
134 | - $event_sub_total += isset( $options[ 'event_id' ] ) ? $this->_events[ $options[ 'event_id' ] ] : 0; |
|
134 | + $event_sub_total += isset($options['event_id']) ? $this->_events[$options['event_id']] : 0; |
|
135 | 135 | $sub_total += $event_sub_total; |
136 | 136 | if ( |
137 | 137 | ( |
138 | 138 | // event subtotals |
139 | 139 | $line_item->code() != 'pre-tax-subtotal' && |
140 | - count( $child_line_items ) > 1 |
|
140 | + count($child_line_items) > 1 |
|
141 | 141 | ) |
142 | 142 | || |
143 | 143 | ( |
144 | 144 | // pre-tax subtotals |
145 | 145 | $line_item->code() == 'pre-tax-subtotal' && |
146 | - count( $this->_events ) > 1 |
|
146 | + count($this->_events) > 1 |
|
147 | 147 | ) |
148 | 148 | ) { |
149 | 149 | $options['sub_total'] = $line_item->OBJ_type() == 'Event' ? $event_sub_total : $sub_total; |
150 | - $html .= $this->_sub_total_row( $line_item, $text, $options ); |
|
150 | + $html .= $this->_sub_total_row($line_item, $text, $options); |
|
151 | 151 | } |
152 | 152 | break; |
153 | 153 | |
154 | 154 | case EEM_Line_Item::type_tax: |
155 | - if ( $this->_show_taxes ) { |
|
156 | - $this->_taxes_html .= $this->_tax_row( $line_item, $options ); |
|
155 | + if ($this->_show_taxes) { |
|
156 | + $this->_taxes_html .= $this->_tax_row($line_item, $options); |
|
157 | 157 | } |
158 | 158 | break; |
159 | 159 | |
160 | 160 | case EEM_Line_Item::type_tax_sub_total: |
161 | - if ( $this->_show_taxes ) { |
|
161 | + if ($this->_show_taxes) { |
|
162 | 162 | $child_line_items = $line_item->children(); |
163 | 163 | // loop thru children |
164 | - foreach( $child_line_items as $child_line_item ) { |
|
164 | + foreach ($child_line_items as $child_line_item) { |
|
165 | 165 | // recursively feed children back into this method |
166 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
166 | + $html .= $this->display_line_item($child_line_item, $options); |
|
167 | 167 | } |
168 | - if ( count( $child_line_items ) > 1 ) { |
|
169 | - $this->_taxes_html .= $this->_total_tax_row( $line_item, __( 'Tax Total', 'event_espresso' ) ); |
|
168 | + if (count($child_line_items) > 1) { |
|
169 | + $this->_taxes_html .= $this->_total_tax_row($line_item, __('Tax Total', 'event_espresso')); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | break; |
@@ -175,25 +175,25 @@ discard block |
||
175 | 175 | // get all child line items |
176 | 176 | $children = $line_item->children(); |
177 | 177 | // loop thru all non-tax child line items |
178 | - foreach( $children as $child_line_item ) { |
|
179 | - if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) { |
|
178 | + foreach ($children as $child_line_item) { |
|
179 | + if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) { |
|
180 | 180 | // recursively feed children back into this method |
181 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
181 | + $html .= $this->display_line_item($child_line_item, $options); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | 185 | // now loop thru tax child line items |
186 | - foreach( $children as $child_line_item ) { |
|
187 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) { |
|
186 | + foreach ($children as $child_line_item) { |
|
187 | + if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) { |
|
188 | 188 | // recursively feed children back into this method |
189 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
189 | + $html .= $this->display_line_item($child_line_item, $options); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | $html .= $this->_taxes_html; |
193 | - $html .= $this->_total_row( $line_item, __('Total', 'event_espresso') ); |
|
193 | + $html .= $this->_total_row($line_item, __('Total', 'event_espresso')); |
|
194 | 194 | |
195 | 195 | |
196 | - $html .= $this->_payments_and_amount_owing_rows( $line_item, $options ); |
|
196 | + $html .= $this->_payments_and_amount_owing_rows($line_item, $options); |
|
197 | 197 | break; |
198 | 198 | |
199 | 199 | } |
@@ -208,11 +208,11 @@ discard block |
||
208 | 208 | * @param EE_Line_Item $line_item |
209 | 209 | * @return mixed |
210 | 210 | */ |
211 | - private function _event_row( EE_Line_Item $line_item ) { |
|
211 | + private function _event_row(EE_Line_Item $line_item) { |
|
212 | 212 | // start of row |
213 | - $html = EEH_HTML::tr( '', 'event-cart-total-row', 'total_tr odd' ); |
|
213 | + $html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd'); |
|
214 | 214 | // event name td |
215 | - $html .= EEH_HTML::td( EEH_HTML::strong( $line_item->name() ), '', 'event-header', '', ' colspan="4"' ); |
|
215 | + $html .= EEH_HTML::td(EEH_HTML::strong($line_item->name()), '', 'event-header', '', ' colspan="4"'); |
|
216 | 216 | // end of row |
217 | 217 | $html .= EEH_HTML::trx(); |
218 | 218 | return $html; |
@@ -227,10 +227,10 @@ discard block |
||
227 | 227 | * @param array $options |
228 | 228 | * @return mixed |
229 | 229 | */ |
230 | - private function _ticket_row( EE_Line_Item $line_item, $options = array() ) { |
|
230 | + private function _ticket_row(EE_Line_Item $line_item, $options = array()) { |
|
231 | 231 | // start of row |
232 | 232 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
233 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
233 | + $html = EEH_HTML::tr('', '', $row_class); |
|
234 | 234 | // name && desc |
235 | 235 | $name_and_desc = apply_filters( |
236 | 236 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name', |
@@ -239,23 +239,23 @@ discard block |
||
239 | 239 | ); |
240 | 240 | $name_and_desc .= apply_filters( |
241 | 241 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc', |
242 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
242 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
243 | 243 | $line_item, |
244 | 244 | $options |
245 | 245 | ); |
246 | 246 | $name_and_desc .= $line_item->is_taxable() ? ' * ' : ''; |
247 | 247 | // name td |
248 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' ); |
|
248 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' ); |
|
249 | 249 | // price td |
250 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
250 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
251 | 251 | // quantity td |
252 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
252 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
253 | 253 | $this->_total_items += $line_item->quantity(); |
254 | 254 | // determine total for line item |
255 | 255 | $total = $line_item->total(); |
256 | - $this->_events[ $options[ 'event_id' ] ] += $total; |
|
256 | + $this->_events[$options['event_id']] += $total; |
|
257 | 257 | // total td |
258 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '', 'item_r jst-rght' ); |
|
258 | + $html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght'); |
|
259 | 259 | // end of row |
260 | 260 | $html .= EEH_HTML::trx(); |
261 | 261 | return $html; |
@@ -270,41 +270,41 @@ discard block |
||
270 | 270 | * @param array $options |
271 | 271 | * @return mixed |
272 | 272 | */ |
273 | - private function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
273 | + private function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
274 | 274 | // start of row |
275 | 275 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
276 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
277 | - $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type() . ': ' : ''; |
|
276 | + $html = EEH_HTML::tr('', '', $row_class); |
|
277 | + $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type().': ' : ''; |
|
278 | 278 | // name && desc |
279 | 279 | $name_and_desc = apply_filters( |
280 | 280 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name', |
281 | - $obj_name . $line_item->name(), |
|
281 | + $obj_name.$line_item->name(), |
|
282 | 282 | $line_item |
283 | 283 | ); |
284 | 284 | $name_and_desc .= apply_filters( |
285 | 285 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc', |
286 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
286 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
287 | 287 | $line_item, |
288 | 288 | $options |
289 | 289 | ); |
290 | 290 | $name_and_desc .= $line_item->is_taxable() ? ' * ' : ''; |
291 | 291 | // name td |
292 | - $html .= EEH_HTML::td( $name_and_desc, '', 'item_l' ); |
|
292 | + $html .= EEH_HTML::td($name_and_desc, '', 'item_l'); |
|
293 | 293 | // price td |
294 | - if ( $line_item->is_percent() ) { |
|
295 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c jst-rght' ); |
|
294 | + if ($line_item->is_percent()) { |
|
295 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c jst-rght'); |
|
296 | 296 | } else { |
297 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
297 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
298 | 298 | } |
299 | 299 | // quantity td |
300 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
300 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
301 | 301 | //$total = $line_item->total() * $line_item->quantity(); |
302 | 302 | $total = $line_item->total(); |
303 | - if( isset( $options[ 'event_id' ] ) && isset( $this->_events[ $options[ 'event_id' ] ] ) ) { |
|
304 | - $this->_events[ $options[ 'event_id' ] ] += $total; |
|
303 | + if (isset($options['event_id']) && isset($this->_events[$options['event_id']])) { |
|
304 | + $this->_events[$options['event_id']] += $total; |
|
305 | 305 | } |
306 | 306 | // total td |
307 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '', 'item_r jst-rght' ); |
|
307 | + $html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght'); |
|
308 | 308 | // end of row |
309 | 309 | $html .= EEH_HTML::trx(); |
310 | 310 | return $html; |
@@ -319,22 +319,22 @@ discard block |
||
319 | 319 | * @param array $options |
320 | 320 | * @return mixed |
321 | 321 | */ |
322 | - private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
|
322 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array()) { |
|
323 | 323 | // start of row |
324 | - $html = EEH_HTML::tr( '', 'item sub-item-row' ); |
|
324 | + $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
325 | 325 | // name && desc |
326 | 326 | $name_and_desc = $line_item->name(); |
327 | - $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
327 | + $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''; |
|
328 | 328 | // name td |
329 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
329 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
330 | 330 | // discount/surcharge td |
331 | - if ( $line_item->is_percent() ) { |
|
332 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c' ); |
|
331 | + if ($line_item->is_percent()) { |
|
332 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c'); |
|
333 | 333 | } else { |
334 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
334 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
335 | 335 | } |
336 | 336 | // total td |
337 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'item_r jst-rght' ); |
|
337 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
338 | 338 | // end of row |
339 | 339 | $html .= EEH_HTML::trx(); |
340 | 340 | return $html; |
@@ -349,21 +349,21 @@ discard block |
||
349 | 349 | * @param array $options |
350 | 350 | * @return mixed |
351 | 351 | */ |
352 | - private function _tax_row( EE_Line_Item $line_item, $options = array() ) { |
|
352 | + private function _tax_row(EE_Line_Item $line_item, $options = array()) { |
|
353 | 353 | // start of row |
354 | - $html = EEH_HTML::tr( '', 'item sub-item tax-total' ); |
|
354 | + $html = EEH_HTML::tr('', 'item sub-item tax-total'); |
|
355 | 355 | // name && desc |
356 | 356 | $name_and_desc = $line_item->name(); |
357 | - $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' . __( ' * taxable items', 'event_espresso' ) . '</span>'; |
|
358 | - $name_and_desc .= $options[ 'show_desc' ] ? '<br/>' . $line_item->desc() : ''; |
|
357 | + $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'.__(' * taxable items', 'event_espresso').'</span>'; |
|
358 | + $name_and_desc .= $options['show_desc'] ? '<br/>'.$line_item->desc() : ''; |
|
359 | 359 | // name td |
360 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
360 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
361 | 361 | // percent td |
362 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', ' jst-rght', '' ); |
|
362 | + $html .= EEH_HTML::td($line_item->percent().'%', '', ' jst-rght', ''); |
|
363 | 363 | // empty td (price) |
364 | - $html .= EEH_HTML::td( EEH_HTML::nbsp() ); |
|
364 | + $html .= EEH_HTML::td(EEH_HTML::nbsp()); |
|
365 | 365 | // total td |
366 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'item_r jst-rght' ); |
|
366 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
367 | 367 | // end of row |
368 | 368 | $html .= EEH_HTML::trx(); |
369 | 369 | return $html; |
@@ -378,17 +378,17 @@ discard block |
||
378 | 378 | * @param string $text |
379 | 379 | * @return mixed |
380 | 380 | */ |
381 | - private function _total_tax_row( EE_Line_Item $line_item, $text = '' ) { |
|
381 | + private function _total_tax_row(EE_Line_Item $line_item, $text = '') { |
|
382 | 382 | $html = ''; |
383 | - if ( $line_item->total() ) { |
|
383 | + if ($line_item->total()) { |
|
384 | 384 | // start of row |
385 | - $html = EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
385 | + $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
386 | 386 | // total td |
387 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="2"' ); |
|
387 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="2"'); |
|
388 | 388 | // empty td (price) |
389 | - $html .= EEH_HTML::td( EEH_HTML::nbsp() ); |
|
389 | + $html .= EEH_HTML::td(EEH_HTML::nbsp()); |
|
390 | 390 | // total td |
391 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' ); |
|
391 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght'); |
|
392 | 392 | // end of row |
393 | 393 | $html .= EEH_HTML::trx(); |
394 | 394 | } |
@@ -405,15 +405,15 @@ discard block |
||
405 | 405 | * @param array $options |
406 | 406 | * @return mixed |
407 | 407 | */ |
408 | - private function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) { |
|
408 | + private function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) { |
|
409 | 409 | $html = ''; |
410 | - if ( $line_item->total() ) { |
|
410 | + if ($line_item->total()) { |
|
411 | 411 | // start of row |
412 | - $html = EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
412 | + $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
413 | 413 | // total td |
414 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' ); |
|
414 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"'); |
|
415 | 415 | // total td |
416 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $options[ 'sub_total' ], false, false ), '', 'total jst-rght' ); |
|
416 | + $html .= EEH_HTML::td(EEH_Template::format_currency($options['sub_total'], false, false), '', 'total jst-rght'); |
|
417 | 417 | // end of row |
418 | 418 | $html .= EEH_HTML::trx(); |
419 | 419 | } |
@@ -430,13 +430,13 @@ discard block |
||
430 | 430 | * @param string $text |
431 | 431 | * @return mixed |
432 | 432 | */ |
433 | - private function _total_row( EE_Line_Item $line_item, $text = '' ) { |
|
433 | + private function _total_row(EE_Line_Item $line_item, $text = '') { |
|
434 | 434 | // start of row |
435 | - $html = EEH_HTML::tr( '', '', 'spco-grand-total total_tr odd' ); |
|
435 | + $html = EEH_HTML::tr('', '', 'spco-grand-total total_tr odd'); |
|
436 | 436 | // total td |
437 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' ); |
|
437 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"'); |
|
438 | 438 | // total td |
439 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' ); |
|
439 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght'); |
|
440 | 440 | // end of row |
441 | 441 | $html .= EEH_HTML::trx(); |
442 | 442 | return $html; |
@@ -451,30 +451,30 @@ discard block |
||
451 | 451 | * @param array $options |
452 | 452 | * @return mixed |
453 | 453 | */ |
454 | - private function _payments_and_amount_owing_rows( EE_Line_Item $line_item, $options = array() ) { |
|
454 | + private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array()) { |
|
455 | 455 | $html = ''; |
456 | 456 | $owing = $line_item->total(); |
457 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $line_item->TXN_ID() ); |
|
458 | - if ( $transaction instanceof EE_Transaction ) { |
|
457 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID()); |
|
458 | + if ($transaction instanceof EE_Transaction) { |
|
459 | 459 | $registration_payments = array(); |
460 | - $registrations = ! empty( $options['registrations'] ) |
|
461 | - ? $options[ 'registrations' ] |
|
460 | + $registrations = ! empty($options['registrations']) |
|
461 | + ? $options['registrations'] |
|
462 | 462 | : $transaction->registrations(); |
463 | - foreach ( $registrations as $registration ) { |
|
464 | - if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) { |
|
463 | + foreach ($registrations as $registration) { |
|
464 | + if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) { |
|
465 | 465 | $registration_payments = $registration_payments + $registration->registration_payments(); |
466 | 466 | } |
467 | 467 | } |
468 | - if ( ! empty( $registration_payments )) { |
|
469 | - foreach ( $registration_payments as $registration_payment ) { |
|
470 | - if ( $registration_payment instanceof EE_Registration_Payment ) { |
|
468 | + if ( ! empty($registration_payments)) { |
|
469 | + foreach ($registration_payments as $registration_payment) { |
|
470 | + if ($registration_payment instanceof EE_Registration_Payment) { |
|
471 | 471 | $owing = $owing - $registration_payment->amount(); |
472 | 472 | $payment = $registration_payment->payment(); |
473 | - if ( $payment instanceof EE_Payment ) { |
|
473 | + if ($payment instanceof EE_Payment) { |
|
474 | 474 | $payment_desc = sprintf( |
475 | - __( 'Payment%1$s Received: %2$s', 'event_espresso' ), |
|
475 | + __('Payment%1$s Received: %2$s', 'event_espresso'), |
|
476 | 476 | $payment->txn_id_chq_nmbr() != '' |
477 | - ? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> ' |
|
477 | + ? ' <span class="small-text">(#'.$payment->txn_id_chq_nmbr().')</span> ' |
|
478 | 478 | : '', |
479 | 479 | $payment->timestamp() |
480 | 480 | ); |
@@ -482,12 +482,12 @@ discard block |
||
482 | 482 | $payment_desc = ''; |
483 | 483 | } |
484 | 484 | // start of row |
485 | - $html .= EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
485 | + $html .= EEH_HTML::tr('', '', 'total_tr odd'); |
|
486 | 486 | // payment desc |
487 | - $html .= EEH_HTML::td( $payment_desc, '', '', '', ' colspan="3"' ); |
|
487 | + $html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"'); |
|
488 | 488 | // total td |
489 | 489 | $html .= EEH_HTML::td( |
490 | - EEH_Template::format_currency( $registration_payment->amount(), false, false ), |
|
490 | + EEH_Template::format_currency($registration_payment->amount(), false, false), |
|
491 | 491 | '', |
492 | 492 | 'total jst-rght' |
493 | 493 | ); |
@@ -495,17 +495,17 @@ discard block |
||
495 | 495 | $html .= EEH_HTML::trx(); |
496 | 496 | } |
497 | 497 | } |
498 | - if ( $line_item->total() ) { |
|
498 | + if ($line_item->total()) { |
|
499 | 499 | // start of row |
500 | - $html .= EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
500 | + $html .= EEH_HTML::tr('', '', 'total_tr odd'); |
|
501 | 501 | // total td |
502 | 502 | $html .= EEH_HTML::td( |
503 | 503 | __('Amount Owing', 'event_espresso'), |
504 | - '', 'total_currency total jst-rght', '', ' colspan="3"' |
|
504 | + '', 'total_currency total jst-rght', '', ' colspan="3"' |
|
505 | 505 | ); |
506 | 506 | // total td |
507 | 507 | $html .= EEH_HTML::td( |
508 | - EEH_Template::format_currency( $owing, false, false ), '', 'total jst-rght' |
|
508 | + EEH_Template::format_currency($owing, false, false), '', 'total jst-rght' |
|
509 | 509 | ); |
510 | 510 | // end of row |
511 | 511 | $html .= EEH_HTML::trx(); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | <?php _e('Adjust the settings for the PayPal Standard payment gateway.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | 5 | <p> |
6 | -<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Paypal Standard.', 'event_espresso' ), "<a href='https://www.paypal.com/multicurrency' target='_blank'>","</a>" ); ?> |
|
6 | +<?php printf(__('See %1$shere%2$s for list of currencies supported by Paypal Standard.', 'event_espresso'), "<a href='https://www.paypal.com/multicurrency' target='_blank'>", "</a>"); ?> |
|
7 | 7 | </p> |
8 | 8 | <h3><?php _e('PayPal Standard Settings', 'event_espresso'); ?></h3> |
9 | 9 | <ul> |
@@ -21,18 +21,18 @@ discard block |
||
21 | 21 | </li> |
22 | 22 | <li> |
23 | 23 | <strong><?php _e('PayPal Calculates Taxes', 'event_espresso'); ?></strong><br /> |
24 | -<?php printf( __('If set to "Yes", we will indicate to PayPal that it should calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>' ); ?><br/> |
|
25 | -<?php _e( 'Note: It may confuse users if Event Espresso initially calculates taxes on the order, and then they go to PayPal and it calculates taxes differently. So it is recommended that if PayPal is calculating taxes, that you do not set any taxes in Event Espresso.', 'event_espresso' );?> |
|
24 | +<?php printf(__('If set to "Yes", we will indicate to PayPal that it should calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>'); ?><br/> |
|
25 | +<?php _e('Note: It may confuse users if Event Espresso initially calculates taxes on the order, and then they go to PayPal and it calculates taxes differently. So it is recommended that if PayPal is calculating taxes, that you do not set any taxes in Event Espresso.', 'event_espresso'); ?> |
|
26 | 26 | </li> |
27 | 27 | <li> |
28 | 28 | <strong><?php _e('PayPal Calculates Shipping', 'event_espresso'); ?></strong><br /> |
29 | 29 | <?php _e('Similar to the "PayPal Calculates Taxes" setting, if this is set to "Yes", we will indicate to PayPal that it should calculate the shipping on each payment (if there are multiple payments for a single transaction, PayPal is permitted to add shipping charges to each payment.)', 'event_espresso'); ?><br/> |
30 | -<?php _e( 'Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso' );?> |
|
30 | +<?php _e('Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso'); ?> |
|
31 | 31 | <li> |
32 | -<strong><?php _e( 'Notes Regarding Paypal Taxes and Shipping', 'event_espresso' );?></strong><br/> |
|
33 | -<?php _e( 'If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso' );?><br/> |
|
34 | -<?php _e( 'However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso' );?><br/> |
|
35 | -<?php _e( 'Also Note: In order for PayPal to properly calculate taxes and shipping, they need to receive the entire order at the same time. So if a user goes to make a payment using PayPal, and their order somehow already has a payment on it, PayPal CANNOT calculate taxes or shipping on that order.', 'event_espresso' );?> |
|
32 | +<strong><?php _e('Notes Regarding Paypal Taxes and Shipping', 'event_espresso'); ?></strong><br/> |
|
33 | +<?php _e('If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso'); ?><br/> |
|
34 | +<?php _e('However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso'); ?><br/> |
|
35 | +<?php _e('Also Note: In order for PayPal to properly calculate taxes and shipping, they need to receive the entire order at the same time. So if a user goes to make a payment using PayPal, and their order somehow already has a payment on it, PayPal CANNOT calculate taxes or shipping on that order.', 'event_espresso'); ?> |
|
36 | 36 | </li> |
37 | 37 | <li> |
38 | 38 | <strong><?php _e('Shipping Address Options', 'event_espresso'); ?></strong><br /> |
@@ -7,6 +7,10 @@ discard block |
||
7 | 7 | |
8 | 8 | protected $_post_type; |
9 | 9 | protected $_meta_field; |
10 | + |
|
11 | + /** |
|
12 | + * @param string $post_type |
|
13 | + */ |
|
10 | 14 | function __construct($post_type, $meta_field_to_chk = ''){ |
11 | 15 | $this->_post_type = $post_type; |
12 | 16 | $this->_meta_field = $meta_field_to_chk; |
@@ -27,7 +31,6 @@ discard block |
||
27 | 31 | } |
28 | 32 | /** |
29 | 33 | * Gets the where default where conditions for a custom post type model |
30 | - * @param string $model_relation_path. Eg, from Event to Payment, this should be "Registration.Transaction.Payment" |
|
31 | 34 | * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions) |
32 | 35 | */ |
33 | 36 | protected function _get_default_where_conditions() { |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | /* |
4 | 4 | * Strategy specifically for adding where conditions specific to CPT models. |
5 | 5 | */ |
6 | -class EE_CPT_Where_Conditions extends EE_Default_Where_Conditions{ |
|
6 | +class EE_CPT_Where_Conditions extends EE_Default_Where_Conditions { |
|
7 | 7 | |
8 | 8 | protected $_post_type; |
9 | 9 | protected $_meta_field; |
10 | - function __construct($post_type, $meta_field_to_chk = ''){ |
|
10 | + function __construct($post_type, $meta_field_to_chk = '') { |
|
11 | 11 | $this->_post_type = $post_type; |
12 | 12 | $this->_meta_field = $meta_field_to_chk; |
13 | 13 | } |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | * @param string $column column name |
18 | 18 | * @return EE_Model_Field_Base |
19 | 19 | */ |
20 | - protected function _get_field_on_column($column){ |
|
20 | + protected function _get_field_on_column($column) { |
|
21 | 21 | $all_fields = $this->_model->field_settings(true); |
22 | - foreach($all_fields as $field_name => $field_obj){ |
|
23 | - if($column == $field_obj->get_table_column()){ |
|
22 | + foreach ($all_fields as $field_name => $field_obj) { |
|
23 | + if ($column == $field_obj->get_table_column()) { |
|
24 | 24 | return $field_obj; |
25 | 25 | } |
26 | 26 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | //find post_type field |
35 | 35 | $post_type_field = $this->_get_field_on_column('post_type'); |
36 | 36 | $status_field = $this->_get_field_on_column('post_status'); |
37 | - return array( $post_type_field->get_name() => $this->_post_type, |
|
38 | - $status_field->get_name() => array('NOT IN',array('auto-draft','trash')) |
|
37 | + return array($post_type_field->get_name() => $this->_post_type, |
|
38 | + $status_field->get_name() => array('NOT IN', array('auto-draft', 'trash')) |
|
39 | 39 | ); |
40 | 40 | } |
41 | 41 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'espresso_events' => 'edit' |
68 | 68 | ); |
69 | 69 | |
70 | - add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) ); |
|
70 | + add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | protected function _ajax_hooks() { |
@@ -93,20 +93,20 @@ discard block |
||
93 | 93 | 'edit' => __('Update Event', 'event_espresso'), |
94 | 94 | 'add_category' => __('Save New Category', 'event_espresso'), |
95 | 95 | 'edit_category' => __('Update Category', 'event_espresso'), |
96 | - 'template_settings' => __( 'Update Settings', 'event_espresso' ) |
|
96 | + 'template_settings' => __('Update Settings', 'event_espresso') |
|
97 | 97 | ) |
98 | 98 | ); |
99 | 99 | } |
100 | 100 | |
101 | 101 | protected function _set_page_routes() { |
102 | 102 | //load formatter helper |
103 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
103 | + EE_Registry::instance()->load_helper('Formatter'); |
|
104 | 104 | //load field generator helper |
105 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
105 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
106 | 106 | |
107 | 107 | //is there a evt_id in the request? |
108 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0; |
|
109 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
108 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0; |
|
109 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
110 | 110 | |
111 | 111 | |
112 | 112 | $this->_page_routes = array( |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | 'help_tour' => array( |
321 | 321 | 'Event_Editor_Help_Tour' |
322 | 322 | ), |
323 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
323 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
324 | 324 | 'require_nonce' => FALSE |
325 | 325 | ), |
326 | 326 | 'edit' => array( |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | 'help_tour' => array( |
377 | 377 | 'Event_Edit_Help_Tour' |
378 | 378 | ), |
379 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
379 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
380 | 380 | 'require_nonce' => FALSE |
381 | 381 | ), |
382 | 382 | 'default_event_settings' => array( |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | 'filename' => 'events_default_settings_status' |
399 | 399 | ) |
400 | 400 | ), |
401 | - 'help_tour' => array( 'Event_Default_Settings_Help_Tour'), |
|
401 | + 'help_tour' => array('Event_Default_Settings_Help_Tour'), |
|
402 | 402 | 'require_nonce' => FALSE |
403 | 403 | ), |
404 | 404 | //template settings |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | 'filename' => 'general_settings_templates' |
415 | 415 | ) |
416 | 416 | ), |
417 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
417 | + 'help_tour' => array('Templates_Help_Tour'), |
|
418 | 418 | 'require_nonce' => FALSE |
419 | 419 | ), |
420 | 420 | //event category stuff |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | 'label' => __('Edit Category', 'event_espresso'), |
439 | 439 | 'order' => 15, |
440 | 440 | 'persistent' => FALSE, |
441 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
441 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
442 | 442 | ), |
443 | 443 | 'help_tabs' => array( |
444 | 444 | 'edit_category_help_tab' => array( |
@@ -508,14 +508,14 @@ discard block |
||
508 | 508 | |
509 | 509 | public function load_scripts_styles() { |
510 | 510 | |
511 | - wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
512 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
511 | + wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
512 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
513 | 513 | wp_enqueue_style('events-admin-css'); |
514 | 514 | wp_enqueue_style('ee-cat-admin'); |
515 | 515 | //todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details |
516 | 516 | //registers for all views |
517 | 517 | //scripts |
518 | - wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE); |
|
518 | + wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | /** |
@@ -533,11 +533,11 @@ discard block |
||
533 | 533 | public function load_scripts_styles_edit() { |
534 | 534 | //styles |
535 | 535 | wp_enqueue_style('espresso-ui-theme'); |
536 | - wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
536 | + wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
537 | 537 | wp_enqueue_style('event-editor-css'); |
538 | 538 | |
539 | 539 | //scripts |
540 | - wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION ); |
|
540 | + wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION); |
|
541 | 541 | wp_enqueue_script('event-datetime-metabox'); |
542 | 542 | |
543 | 543 | } |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | |
573 | 573 | |
574 | 574 | public function admin_init() { |
575 | - EE_Registry::$i18n_js_strings[ 'image_confirm' ] = __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' ); |
|
575 | + EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'); |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | |
@@ -593,45 +593,45 @@ discard block |
||
593 | 593 | */ |
594 | 594 | public function verify_event_edit($event = NULL) { |
595 | 595 | // no event? |
596 | - if ( empty( $event )) { |
|
596 | + if (empty($event)) { |
|
597 | 597 | // set event |
598 | 598 | $event = $this->_cpt_model_obj; |
599 | 599 | } |
600 | 600 | // STILL no event? |
601 | - if ( empty ( $event )) { |
|
601 | + if (empty ($event)) { |
|
602 | 602 | return; |
603 | 603 | } |
604 | 604 | // first check if event is active. |
605 | - if ( $event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed ) { |
|
605 | + if ($event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed) { |
|
606 | 606 | return; |
607 | 607 | } |
608 | 608 | $orig_status = $event->status(); |
609 | 609 | //made it here so it IS active... next check that any of the tickets are sold. |
610 | - if ( $event->is_sold_out( true ) ) { |
|
611 | - if ( $event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out ) { |
|
610 | + if ($event->is_sold_out(true)) { |
|
611 | + if ($event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out) { |
|
612 | 612 | EE_Error::add_attention( |
613 | 613 | sprintf( |
614 | - __( 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You can change the status back to something else before updating if you wish.', 'event_espresso' ), |
|
615 | - EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' ) |
|
614 | + __('Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You can change the status back to something else before updating if you wish.', 'event_espresso'), |
|
615 | + EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence') |
|
616 | 616 | ) |
617 | 617 | ); |
618 | 618 | } |
619 | 619 | return; |
620 | - } else if ( $orig_status === EEM_Event::sold_out ) { |
|
620 | + } else if ($orig_status === EEM_Event::sold_out) { |
|
621 | 621 | EE_Error::add_attention( |
622 | 622 | sprintf( |
623 | - __( 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets. However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.', |
|
624 | - 'event_espresso' ), |
|
625 | - EEH_Template::pretty_status( $event->status(), false, 'sentence' ) |
|
623 | + __('Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets. However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.', |
|
624 | + 'event_espresso'), |
|
625 | + EEH_Template::pretty_status($event->status(), false, 'sentence') |
|
626 | 626 | ) |
627 | 627 | ); |
628 | 628 | } |
629 | 629 | //now we need to determine if the event has any tickets on sale. If not then we dont' show the error |
630 | - if ( ! $event->tickets_on_sale() ) { |
|
630 | + if ( ! $event->tickets_on_sale()) { |
|
631 | 631 | return; |
632 | 632 | } |
633 | 633 | //made it here so show warning |
634 | - EE_Error::add_attention( $this->_edit_event_warning() ); |
|
634 | + EE_Error::add_attention($this->_edit_event_warning()); |
|
635 | 635 | } |
636 | 636 | |
637 | 637 | |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | ), |
672 | 672 | ); |
673 | 673 | |
674 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
674 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
675 | 675 | $this->_views['trash'] = array( |
676 | 676 | 'slug' => 'trash', |
677 | 677 | 'label' => __('Trash', 'event_espresso'), |
@@ -701,39 +701,39 @@ discard block |
||
701 | 701 | 'desc' => __('View Registrations for Event', 'event_espresso') |
702 | 702 | ) |
703 | 703 | ); |
704 | - $items = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items ); |
|
704 | + $items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items); |
|
705 | 705 | $statuses = array( |
706 | 706 | 'sold_out_status' => array( |
707 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out, |
|
708 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' ) |
|
707 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out, |
|
708 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence') |
|
709 | 709 | ), |
710 | 710 | 'active_status' => array( |
711 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active, |
|
712 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' ) |
|
711 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active, |
|
712 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence') |
|
713 | 713 | ), |
714 | 714 | 'upcoming_status' => array( |
715 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming, |
|
716 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' ) |
|
715 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming, |
|
716 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence') |
|
717 | 717 | ), |
718 | 718 | 'postponed_status' => array( |
719 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed, |
|
720 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' ) |
|
719 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed, |
|
720 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence') |
|
721 | 721 | ), |
722 | 722 | 'cancelled_status' => array( |
723 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled, |
|
724 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' ) |
|
723 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled, |
|
724 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence') |
|
725 | 725 | ), |
726 | 726 | 'expired_status' => array( |
727 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired, |
|
728 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' ) |
|
727 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired, |
|
728 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence') |
|
729 | 729 | ), |
730 | 730 | 'inactive_status' => array( |
731 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive, |
|
732 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' ) |
|
731 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive, |
|
732 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence') |
|
733 | 733 | ) |
734 | 734 | ); |
735 | - $statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses ); |
|
736 | - return array_merge( $items, $statuses ); |
|
735 | + $statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses); |
|
736 | + return array_merge($items, $statuses); |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | |
@@ -745,8 +745,8 @@ discard block |
||
745 | 745 | * @return EEM_Event |
746 | 746 | */ |
747 | 747 | private function _event_model() { |
748 | - if ( ! $this->_event_model instanceof EEM_Event ) { |
|
749 | - $this->_event_model = EE_Registry::instance()->load_model( 'Event' ); |
|
748 | + if ( ! $this->_event_model instanceof EEM_Event) { |
|
749 | + $this->_event_model = EE_Registry::instance()->load_model('Event'); |
|
750 | 750 | } |
751 | 751 | return $this->_event_model; |
752 | 752 | } |
@@ -765,12 +765,12 @@ discard block |
||
765 | 765 | * @param string $new_slug what the slug is |
766 | 766 | * @return string The new html string for the permalink area |
767 | 767 | */ |
768 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
768 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
769 | 769 | //make sure this is only when editing |
770 | - if ( !empty( $id ) ) { |
|
771 | - $post = get_post( $id ); |
|
772 | - $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> '; |
|
773 | - $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=\'' . $post->ID . '\']"">'; |
|
770 | + if ( ! empty($id)) { |
|
771 | + $post = get_post($id); |
|
772 | + $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> '; |
|
773 | + $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=\''.$post->ID.'\']"">'; |
|
774 | 774 | } |
775 | 775 | return $return; |
776 | 776 | } |
@@ -786,8 +786,8 @@ discard block |
||
786 | 786 | * @return string html for generated table |
787 | 787 | */ |
788 | 788 | protected function _events_overview_list_table() { |
789 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
790 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) . |
|
789 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
790 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button'). |
|
791 | 791 | $this->_display_legend($this->_event_legend_items()); |
792 | 792 | $this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
793 | 793 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -805,51 +805,51 @@ discard block |
||
805 | 805 | |
806 | 806 | |
807 | 807 | |
808 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
808 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
809 | 809 | |
810 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) { |
|
810 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') { |
|
811 | 811 | //getout we're not processing an event save. |
812 | 812 | return; |
813 | 813 | } |
814 | 814 | |
815 | 815 | $event_values = array( |
816 | - 'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0, |
|
817 | - 'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0, |
|
816 | + 'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0, |
|
817 | + 'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0, |
|
818 | 818 | 'EVT_additional_limit' => min( |
819 | - apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ), |
|
820 | - !empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ), |
|
821 | - 'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID, |
|
822 | - 'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0, |
|
823 | - 'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0, |
|
824 | - 'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL, |
|
825 | - 'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL, |
|
826 | - 'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL |
|
819 | + apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255), |
|
820 | + ! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ), |
|
821 | + 'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID, |
|
822 | + 'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0, |
|
823 | + 'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0, |
|
824 | + 'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL, |
|
825 | + 'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL, |
|
826 | + 'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL |
|
827 | 827 | ); |
828 | 828 | |
829 | 829 | //update event |
830 | - $success = $this->_event_model()->update_by_ID( $event_values, $post_id ); |
|
830 | + $success = $this->_event_model()->update_by_ID($event_values, $post_id); |
|
831 | 831 | |
832 | 832 | |
833 | 833 | //get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
834 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
835 | - $event = $this->_event_model()->get_one( array($get_one_where) ); |
|
834 | + $get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
835 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
836 | 836 | |
837 | 837 | |
838 | 838 | //the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons. |
839 | - $event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) ); |
|
839 | + $event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update'))); |
|
840 | 840 | |
841 | 841 | $att_success = TRUE; |
842 | 842 | |
843 | - foreach ( $event_update_callbacks as $e_callback ) { |
|
844 | - $_succ = call_user_func_array( $e_callback, array( $event, $this->_req_data ) ); |
|
845 | - $att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
843 | + foreach ($event_update_callbacks as $e_callback) { |
|
844 | + $_succ = call_user_func_array($e_callback, array($event, $this->_req_data)); |
|
845 | + $att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | //any errors? |
849 | - if ( $success && FALSE === $att_success ) { |
|
850 | - EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
851 | - } else if ( $success === FALSE ) { |
|
852 | - EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
849 | + if ($success && FALSE === $att_success) { |
|
850 | + EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
851 | + } else if ($success === FALSE) { |
|
852 | + EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
853 | 853 | } |
854 | 854 | } |
855 | 855 | |
@@ -859,14 +859,14 @@ discard block |
||
859 | 859 | /** |
860 | 860 | * @see parent::restore_item() |
861 | 861 | */ |
862 | - protected function _restore_cpt_item( $post_id, $revision_id ) { |
|
862 | + protected function _restore_cpt_item($post_id, $revision_id) { |
|
863 | 863 | //copy existing event meta to new post |
864 | 864 | $post_evt = $this->_event_model()->get_one_by_ID($post_id); |
865 | - if ( $post_evt instanceof EE_Event ) { |
|
865 | + if ($post_evt instanceof EE_Event) { |
|
866 | 866 | //meta revision restore |
867 | - $post_evt->restore_revision( $revision_id ); |
|
867 | + $post_evt->restore_revision($revision_id); |
|
868 | 868 | //related objs restore |
869 | - $post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) ); |
|
869 | + $post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price')); |
|
870 | 870 | } |
871 | 871 | } |
872 | 872 | |
@@ -879,52 +879,52 @@ discard block |
||
879 | 879 | * @param array $data The request data from the form |
880 | 880 | * @return bool Success or fail. |
881 | 881 | */ |
882 | - protected function _default_venue_update( $evtobj, $data ) { |
|
883 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
882 | + protected function _default_venue_update($evtobj, $data) { |
|
883 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
884 | 884 | $venue_model = EE_Registry::instance()->load_model('Venue'); |
885 | 885 | $rows_affected = NULL; |
886 | - $venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL; |
|
886 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL; |
|
887 | 887 | |
888 | 888 | // very important. If we don't have a venue name... |
889 | 889 | // then we'll get out because not necessary to create empty venue |
890 | - if ( empty( $data['venue_title'] ) ) { |
|
890 | + if (empty($data['venue_title'])) { |
|
891 | 891 | return false; |
892 | 892 | } |
893 | 893 | |
894 | 894 | $venue_array = array( |
895 | 895 | 'VNU_wp_user' => $evtobj->get('EVT_wp_user'), |
896 | - 'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL, |
|
897 | - 'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL, |
|
898 | - 'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL, |
|
899 | - 'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL, |
|
900 | - 'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL, |
|
901 | - 'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL, |
|
902 | - 'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL, |
|
903 | - 'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL, |
|
904 | - 'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL, |
|
905 | - 'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL, |
|
906 | - 'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL, |
|
907 | - 'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL, |
|
908 | - 'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL, |
|
909 | - 'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL, |
|
910 | - 'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL, |
|
911 | - 'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0, |
|
896 | + 'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL, |
|
897 | + 'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL, |
|
898 | + 'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL, |
|
899 | + 'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL, |
|
900 | + 'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL, |
|
901 | + 'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL, |
|
902 | + 'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL, |
|
903 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL, |
|
904 | + 'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL, |
|
905 | + 'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL, |
|
906 | + 'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL, |
|
907 | + 'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL, |
|
908 | + 'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL, |
|
909 | + 'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL, |
|
910 | + 'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL, |
|
911 | + 'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0, |
|
912 | 912 | 'status' => 'publish' |
913 | 913 | ); |
914 | 914 | |
915 | 915 | |
916 | 916 | //if we've got the venue_id then we're just updating the existing venue so let's do that and then get out. |
917 | - if ( !empty( $venue_id ) ) { |
|
918 | - $update_where = array( $venue_model->primary_key_name() => $venue_id ); |
|
919 | - $rows_affected = $venue_model->update( $venue_array, array( $update_where ) ); |
|
917 | + if ( ! empty($venue_id)) { |
|
918 | + $update_where = array($venue_model->primary_key_name() => $venue_id); |
|
919 | + $rows_affected = $venue_model->update($venue_array, array($update_where)); |
|
920 | 920 | //we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present. |
921 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
921 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
922 | 922 | return $rows_affected > 0 ? TRUE : FALSE; |
923 | 923 | } else { |
924 | 924 | //we insert the venue |
925 | - $venue_id = $venue_model->insert( $venue_array ); |
|
926 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
927 | - return !empty( $venue_id ) ? TRUE : FALSE; |
|
925 | + $venue_id = $venue_model->insert($venue_array); |
|
926 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
927 | + return ! empty($venue_id) ? TRUE : FALSE; |
|
928 | 928 | } |
929 | 929 | //when we have the ancestor come in it's already been handled by the revision save. |
930 | 930 | } |
@@ -938,55 +938,55 @@ discard block |
||
938 | 938 | * @param array $data The request data from the form |
939 | 939 | * @return bool success or fail |
940 | 940 | */ |
941 | - protected function _default_tickets_update( EE_Event $evtobj, $data ) { |
|
941 | + protected function _default_tickets_update(EE_Event $evtobj, $data) { |
|
942 | 942 | $success = true; |
943 | 943 | $saved_dtt = null; |
944 | 944 | $saved_tickets = array(); |
945 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
945 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
946 | 946 | |
947 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
947 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
948 | 948 | //trim all values to ensure any excess whitespace is removed. |
949 | - $dtt = array_map( 'trim', $dtt ); |
|
950 | - $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
949 | + $dtt = array_map('trim', $dtt); |
|
950 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
951 | 951 | $datetime_values = array( |
952 | - 'DTT_ID' => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL, |
|
952 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL, |
|
953 | 953 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
954 | 954 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
955 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'], |
|
955 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
956 | 956 | 'DTT_order' => $row, |
957 | 957 | ); |
958 | 958 | |
959 | 959 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
960 | 960 | |
961 | - if ( !empty( $dtt['DTT_ID'] ) ) { |
|
962 | - $DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] ); |
|
963 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
964 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
965 | - foreach ( $datetime_values as $field => $value ) { |
|
966 | - $DTM->set( $field, $value ); |
|
961 | + if ( ! empty($dtt['DTT_ID'])) { |
|
962 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']); |
|
963 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
964 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
965 | + foreach ($datetime_values as $field => $value) { |
|
966 | + $DTM->set($field, $value); |
|
967 | 967 | } |
968 | 968 | |
969 | 969 | //make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. We need to do this so we dont' TRASH the parent DTT. |
970 | 970 | $saved_dtts[$DTM->ID()] = $DTM; |
971 | 971 | } else { |
972 | - $DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE ); |
|
973 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
974 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
975 | - $DTM->set_timezone( $evtobj->get_timezone() ); |
|
976 | - foreach ( $datetime_values as $field => $value ) { |
|
977 | - $DTM->set( $field, $value ); |
|
972 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE); |
|
973 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
974 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
975 | + $DTM->set_timezone($evtobj->get_timezone()); |
|
976 | + foreach ($datetime_values as $field => $value) { |
|
977 | + $DTM->set($field, $value); |
|
978 | 978 | } |
979 | 979 | } |
980 | 980 | $DTM->save(); |
981 | 981 | |
982 | - $DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' ); |
|
982 | + $DTT = $evtobj->_add_relation_to($DTM, 'Datetime'); |
|
983 | 983 | |
984 | 984 | //load DTT helper |
985 | 985 | EE_Registry::instance()->load_helper('DTT_Helper'); |
986 | 986 | |
987 | 987 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
988 | - if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) { |
|
989 | - $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') ); |
|
988 | + if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) { |
|
989 | + $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start')); |
|
990 | 990 | $DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days'); |
991 | 991 | $DTT->save(); |
992 | 992 | } |
@@ -994,45 +994,45 @@ discard block |
||
994 | 994 | //now we got to make sure we add the new DTT_ID to the $saved_dtts array because it is possible there was a new one created for the autosave. |
995 | 995 | $saved_dtt = $DTT; |
996 | 996 | |
997 | - $success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
997 | + $success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
998 | 998 | } |
999 | 999 | |
1000 | 1000 | //no dtts get deleted so we don't do any of that logic here. |
1001 | 1001 | //update tickets next |
1002 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array(); |
|
1003 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
1004 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
1002 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
1003 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
1004 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
1005 | 1005 | $update_prices = false; |
1006 | - $ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
1006 | + $ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
1007 | 1007 | |
1008 | 1008 | // trim inputs to ensure any excess whitespace is removed. |
1009 | - $tkt = array_map( 'trim', $tkt ); |
|
1009 | + $tkt = array_map('trim', $tkt); |
|
1010 | 1010 | |
1011 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
1011 | + if (empty($tkt['TKT_start_date'])) { |
|
1012 | 1012 | //let's use now in the set timezone. |
1013 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
1014 | - $tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] ); |
|
1013 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
1014 | + $tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]); |
|
1015 | 1015 | } |
1016 | 1016 | |
1017 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
1017 | + if (empty($tkt['TKT_end_date'])) { |
|
1018 | 1018 | //use the start date of the first datetime |
1019 | 1019 | $dtt = $evtobj->first_datetime(); |
1020 | - $tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] ); |
|
1020 | + $tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]); |
|
1021 | 1021 | } |
1022 | 1022 | |
1023 | 1023 | $TKT_values = array( |
1024 | - 'TKT_ID' => !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL, |
|
1025 | - 'TTM_ID' => !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
1026 | - 'TKT_name' => !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
1027 | - 'TKT_description' => !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '', |
|
1024 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL, |
|
1025 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
1026 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
1027 | + 'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '', |
|
1028 | 1028 | 'TKT_start_date' => $tkt['TKT_start_date'], |
1029 | 1029 | 'TKT_end_date' => $tkt['TKT_end_date'], |
1030 | - 'TKT_qty' => ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1031 | - 'TKT_uses' => ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ], |
|
1032 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
1033 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'], |
|
1030 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1031 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
1032 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
1033 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
1034 | 1034 | 'TKT_row' => $row, |
1035 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row, |
|
1035 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row, |
|
1036 | 1036 | 'TKT_price' => $ticket_price |
1037 | 1037 | ); |
1038 | 1038 | |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | |
1041 | 1041 | |
1042 | 1042 | //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
1043 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
1043 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
1044 | 1044 | $TKT_values['TKT_ID'] = 0; |
1045 | 1045 | $TKT_values['TKT_is_default'] = 0; |
1046 | 1046 | $TKT_values['TKT_price'] = $ticket_price; |
@@ -1051,58 +1051,58 @@ discard block |
||
1051 | 1051 | //we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified. |
1052 | 1052 | //keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
1053 | 1053 | |
1054 | - if ( !empty( $tkt['TKT_ID'] ) ) { |
|
1055 | - $TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] ); |
|
1056 | - if ( $TKT instanceof EE_Ticket ) { |
|
1057 | - $ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false; |
|
1054 | + if ( ! empty($tkt['TKT_ID'])) { |
|
1055 | + $TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']); |
|
1056 | + if ($TKT instanceof EE_Ticket) { |
|
1057 | + $ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false; |
|
1058 | 1058 | //let's just check the total price for the existing ticket and determine if it matches the new total price. if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket. |
1059 | - $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false; |
|
1060 | - $TKT->set_date_format( $incoming_date_formats[ 0 ] ); |
|
1061 | - $TKT->set_time_format( $incoming_date_formats[ 1 ] ); |
|
1059 | + $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false; |
|
1060 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1061 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1062 | 1062 | //set new values |
1063 | - foreach ( $TKT_values as $field => $value ) { |
|
1064 | - if ( $field == 'TKT_qty' ) { |
|
1065 | - $TKT->set_qty( $value ); |
|
1063 | + foreach ($TKT_values as $field => $value) { |
|
1064 | + if ($field == 'TKT_qty') { |
|
1065 | + $TKT->set_qty($value); |
|
1066 | 1066 | } else { |
1067 | - $TKT->set( $field, $value ); |
|
1067 | + $TKT->set($field, $value); |
|
1068 | 1068 | } |
1069 | 1069 | } |
1070 | 1070 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
1071 | - if ( $create_new_TKT ) { |
|
1071 | + if ($create_new_TKT) { |
|
1072 | 1072 | //archive the old ticket first |
1073 | - $TKT->set( 'TKT_deleted', 1 ); |
|
1073 | + $TKT->set('TKT_deleted', 1); |
|
1074 | 1074 | $TKT->save(); |
1075 | 1075 | //make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine. |
1076 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
1076 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
1077 | 1077 | //create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it. |
1078 | 1078 | $TKT = clone $TKT; |
1079 | - $TKT->set( 'TKT_ID', 0 ); |
|
1080 | - $TKT->set( 'TKT_deleted', 0 ); |
|
1081 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1082 | - $TKT->set( 'TKT_sold', 0 ); |
|
1079 | + $TKT->set('TKT_ID', 0); |
|
1080 | + $TKT->set('TKT_deleted', 0); |
|
1081 | + $TKT->set('TKT_price', $ticket_price); |
|
1082 | + $TKT->set('TKT_sold', 0); |
|
1083 | 1083 | //now we need to make sure that $new prices are created as well and attached to new ticket. |
1084 | 1084 | $update_prices = true; |
1085 | 1085 | } |
1086 | 1086 | //make sure price is set if it hasn't been already |
1087 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1087 | + $TKT->set('TKT_price', $ticket_price); |
|
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | } else { |
1091 | 1091 | //no TKT_id so a new TKT |
1092 | 1092 | $TKT_values['TKT_price'] = $ticket_price; |
1093 | - $TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE ); |
|
1094 | - if ( $TKT instanceof EE_Ticket ) { |
|
1093 | + $TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE); |
|
1094 | + if ($TKT instanceof EE_Ticket) { |
|
1095 | 1095 | //need to reset values to properly account for the date formats |
1096 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1097 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1098 | - $TKT->set_timezone( $evtobj->get_timezone() ); |
|
1096 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1097 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1098 | + $TKT->set_timezone($evtobj->get_timezone()); |
|
1099 | 1099 | |
1100 | 1100 | //set new values |
1101 | - foreach ( $TKT_values as $field => $value ) { |
|
1102 | - if ( $field == 'TKT_qty' ) { |
|
1103 | - $TKT->set_qty( $value ); |
|
1101 | + foreach ($TKT_values as $field => $value) { |
|
1102 | + if ($field == 'TKT_qty') { |
|
1103 | + $TKT->set_qty($value); |
|
1104 | 1104 | } else { |
1105 | - $TKT->set( $field, $value ); |
|
1105 | + $TKT->set($field, $value); |
|
1106 | 1106 | } |
1107 | 1107 | } |
1108 | 1108 | |
@@ -1110,32 +1110,32 @@ discard block |
||
1110 | 1110 | } |
1111 | 1111 | } |
1112 | 1112 | // cap ticket qty by datetime reg limits |
1113 | - $TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) ); |
|
1113 | + $TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit'))); |
|
1114 | 1114 | //update ticket. |
1115 | 1115 | $TKT->save(); |
1116 | 1116 | |
1117 | 1117 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
1118 | - if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) { |
|
1119 | - $TKT->set('TKT_end_date', $TKT->get('TKT_start_date') ); |
|
1118 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
1119 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
1120 | 1120 | EE_Registry::instance()->load_helper('DTT_Helper'); |
1121 | 1121 | $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
1122 | 1122 | $TKT->save(); |
1123 | 1123 | } |
1124 | 1124 | |
1125 | 1125 | //initially let's add the ticket to the dtt |
1126 | - $saved_dtt->_add_relation_to( $TKT, 'Ticket' ); |
|
1126 | + $saved_dtt->_add_relation_to($TKT, 'Ticket'); |
|
1127 | 1127 | |
1128 | 1128 | $saved_tickets[$TKT->ID()] = $TKT; |
1129 | 1129 | |
1130 | 1130 | //add prices to ticket |
1131 | - $this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices ); |
|
1131 | + $this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices); |
|
1132 | 1132 | } |
1133 | 1133 | //however now we need to handle permanently deleting tickets via the ui. Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold. However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db. |
1134 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1135 | - $tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) ); |
|
1134 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1135 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
1136 | 1136 | |
1137 | - foreach ( $tickets_removed as $id ) { |
|
1138 | - $id = absint( $id ); |
|
1137 | + foreach ($tickets_removed as $id) { |
|
1138 | + $id = absint($id); |
|
1139 | 1139 | |
1140 | 1140 | //get the ticket for this id |
1141 | 1141 | $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | //need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold) |
1144 | 1144 | $dtts = $tkt_to_remove->get_many_related('Datetime'); |
1145 | 1145 | |
1146 | - foreach( $dtts as $dtt ) { |
|
1146 | + foreach ($dtts as $dtt) { |
|
1147 | 1147 | $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
1148 | 1148 | } |
1149 | 1149 | |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | //finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships) |
1155 | 1155 | $tkt_to_remove->delete_permanently(); |
1156 | 1156 | } |
1157 | - return array( $saved_dtt, $saved_tickets ); |
|
1157 | + return array($saved_dtt, $saved_tickets); |
|
1158 | 1158 | } |
1159 | 1159 | |
1160 | 1160 | |
@@ -1169,31 +1169,31 @@ discard block |
||
1169 | 1169 | * @param bool $new_prices Whether attach existing incoming prices or create new ones. |
1170 | 1170 | * @return void |
1171 | 1171 | */ |
1172 | - private function _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) { |
|
1173 | - foreach ( $prices as $row => $prc ) { |
|
1172 | + private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) { |
|
1173 | + foreach ($prices as $row => $prc) { |
|
1174 | 1174 | $PRC_values = array( |
1175 | - 'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL, |
|
1176 | - 'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL, |
|
1177 | - 'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
1178 | - 'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
1179 | - 'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
1175 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL, |
|
1176 | + 'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL, |
|
1177 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
1178 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
1179 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
1180 | 1180 | 'PRC_is_default' => 0, //make sure prices are NOT set as default from this context |
1181 | 1181 | 'PRC_order' => $row |
1182 | 1182 | ); |
1183 | 1183 | |
1184 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
1184 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
1185 | 1185 | $PRC_values['PRC_ID'] = 0; |
1186 | - $PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE); |
|
1186 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE); |
|
1187 | 1187 | } else { |
1188 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
1188 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
1189 | 1189 | //update this price with new values |
1190 | - foreach ( $PRC_values as $field => $newprc ) { |
|
1191 | - $PRC->set( $field, $newprc ); |
|
1190 | + foreach ($PRC_values as $field => $newprc) { |
|
1191 | + $PRC->set($field, $newprc); |
|
1192 | 1192 | } |
1193 | 1193 | $PRC->save(); |
1194 | 1194 | } |
1195 | 1195 | |
1196 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
1196 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
1197 | 1197 | } |
1198 | 1198 | } |
1199 | 1199 | |
@@ -1216,33 +1216,33 @@ discard block |
||
1216 | 1216 | |
1217 | 1217 | return; //TEMPORARILY EXITING CAUSE THIS IS A TODO |
1218 | 1218 | |
1219 | - $postid = isset( $this->_req_data['post_ID'] ) ? $this->_req_data['post_ID'] : NULL; |
|
1219 | + $postid = isset($this->_req_data['post_ID']) ? $this->_req_data['post_ID'] : NULL; |
|
1220 | 1220 | |
1221 | 1221 | |
1222 | 1222 | //if no postid then get out cause we need it for stuff in here |
1223 | - if ( empty( $postid ) ) return; |
|
1223 | + if (empty($postid)) return; |
|
1224 | 1224 | |
1225 | 1225 | |
1226 | 1226 | //handle datetime saves |
1227 | 1227 | $items = array(); |
1228 | 1228 | |
1229 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $postid ); |
|
1230 | - $event = $this->_event_model()->get_one( array($get_one_where) ); |
|
1229 | + $get_one_where = array($this->_event_model()->primary_key_name() => $postid); |
|
1230 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
1231 | 1231 | |
1232 | 1232 | //now let's get the attached datetimes from the most recent autosave |
1233 | 1233 | $dtts = $event->get_many_related('Datetime'); |
1234 | 1234 | |
1235 | 1235 | $dtt_ids = array(); |
1236 | - foreach( $dtts as $dtt ) { |
|
1236 | + foreach ($dtts as $dtt) { |
|
1237 | 1237 | $dtt_ids[] = $dtt->ID(); |
1238 | 1238 | $order = $dtt->order(); |
1239 | 1239 | $this->_template_args['data']['items']['ID-'.$order] = $dtt->ID(); |
1240 | 1240 | } |
1241 | - $this->_template_args['data']['items']['datetime_IDS'] = serialize( $dtt_ids ); |
|
1241 | + $this->_template_args['data']['items']['datetime_IDS'] = serialize($dtt_ids); |
|
1242 | 1242 | |
1243 | 1243 | //handle DECAF venues |
1244 | 1244 | //we need to make sure that the venue_id gets updated in the form so that future autosaves will properly conntect that venue to the event. |
1245 | - if ( $do_venue_autosaves = apply_filters( 'FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE ) ) { |
|
1245 | + if ($do_venue_autosaves = apply_filters('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE)) { |
|
1246 | 1246 | $venue = $event->get_first_related('Venue'); |
1247 | 1247 | $this->_template_args['data']['items']['venue-id'] = $venue->ID(); |
1248 | 1248 | } |
@@ -1253,23 +1253,23 @@ discard block |
||
1253 | 1253 | |
1254 | 1254 | $ticket_ids = array(); |
1255 | 1255 | $price_ids = array(); |
1256 | - foreach ( $tickets as $ticket ) { |
|
1256 | + foreach ($tickets as $ticket) { |
|
1257 | 1257 | $ticket_ids[] = $price->ID(); |
1258 | 1258 | $ticket_order = $price->get('TKT_order'); |
1259 | - $this->_template_args['data']['items']['edit-ticket-id-' . $ticket_order] = $ticket->ID(); |
|
1260 | - $this->_template_args['data']['items']['edit-ticket-event-id-' . $order] = $event->ID(); |
|
1259 | + $this->_template_args['data']['items']['edit-ticket-id-'.$ticket_order] = $ticket->ID(); |
|
1260 | + $this->_template_args['data']['items']['edit-ticket-event-id-'.$order] = $event->ID(); |
|
1261 | 1261 | |
1262 | 1262 | //now we have to make sure the prices are updated appropriately |
1263 | 1263 | $prices = $ticket->get_many_related('Prices'); |
1264 | 1264 | |
1265 | - foreach ( $prices as $price ) { |
|
1265 | + foreach ($prices as $price) { |
|
1266 | 1266 | $price_ids[] = $price->ID(); |
1267 | 1267 | $price_order = $price->get('PRC_order'); |
1268 | - $this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-' . $ticket_order . '-' . $price_order] = $price->ID(); |
|
1269 | - $this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-' . $ticket_row . '-' . $price_row] = $price->ID(); |
|
1270 | - $this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-' . $ticket_row . '-' . $price_row] = $price->get('PRC_is_default'); |
|
1268 | + $this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-'.$ticket_order.'-'.$price_order] = $price->ID(); |
|
1269 | + $this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-'.$ticket_row.'-'.$price_row] = $price->ID(); |
|
1270 | + $this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-'.$ticket_row.'-'.$price_row] = $price->get('PRC_is_default'); |
|
1271 | 1271 | } |
1272 | - $this->_template_args['data']['items']['price-IDs-ticketrow-' . $ticket_row] = implode(',', $price_ids); |
|
1272 | + $this->_template_args['data']['items']['price-IDs-ticketrow-'.$ticket_row] = implode(',', $price_ids); |
|
1273 | 1273 | } |
1274 | 1274 | $this->_template_args['data']['items']['ticket-IDs'] = implode(',', $ticket_ids); |
1275 | 1275 | } |
@@ -1287,12 +1287,12 @@ discard block |
||
1287 | 1287 | private function _generate_publish_box_extra_content() { |
1288 | 1288 | |
1289 | 1289 | //load formatter helper |
1290 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1290 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1291 | 1291 | |
1292 | 1292 | //args for getting related registrations |
1293 | - $approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) ); |
|
1294 | - $not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) ); |
|
1295 | - $pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) ); |
|
1293 | + $approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved)); |
|
1294 | + $not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved)); |
|
1295 | + $pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment)); |
|
1296 | 1296 | |
1297 | 1297 | |
1298 | 1298 | // publish box |
@@ -1321,9 +1321,9 @@ discard block |
||
1321 | 1321 | ), |
1322 | 1322 | REG_ADMIN_URL |
1323 | 1323 | ), |
1324 | - 'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ), |
|
1325 | - 'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ), |
|
1326 | - 'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ), |
|
1324 | + 'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args), |
|
1325 | + 'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args), |
|
1326 | + 'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args), |
|
1327 | 1327 | 'misc_pub_section_class' => apply_filters( |
1328 | 1328 | 'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class', |
1329 | 1329 | 'misc-pub-section' |
@@ -1342,9 +1342,9 @@ discard block |
||
1342 | 1342 | 'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add', |
1343 | 1343 | $this->_cpt_model_obj |
1344 | 1344 | ); |
1345 | - $publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean(); |
|
1345 | + $publish_box_extra_args['event_editor_overview_add'] = ob_get_clean(); |
|
1346 | 1346 | // load template |
1347 | - EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args ); |
|
1347 | + EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args); |
|
1348 | 1348 | } |
1349 | 1349 | |
1350 | 1350 | |
@@ -1376,16 +1376,16 @@ discard block |
||
1376 | 1376 | $this->verify_cpt_object(); |
1377 | 1377 | add_meta_box( |
1378 | 1378 | 'espresso_event_editor_tickets', |
1379 | - __( 'Event Datetime & Ticket', 'event_espresso' ), |
|
1380 | - array( $this, 'ticket_metabox' ), |
|
1379 | + __('Event Datetime & Ticket', 'event_espresso'), |
|
1380 | + array($this, 'ticket_metabox'), |
|
1381 | 1381 | $this->page_slug, |
1382 | 1382 | 'normal', |
1383 | 1383 | 'high' |
1384 | 1384 | ); |
1385 | 1385 | add_meta_box( |
1386 | 1386 | 'espresso_event_editor_event_options', |
1387 | - __( 'Event Registration Options', 'event_espresso' ), |
|
1388 | - array( $this, 'registration_options_meta_box' ), |
|
1387 | + __('Event Registration Options', 'event_espresso'), |
|
1388 | + array($this, 'registration_options_meta_box'), |
|
1389 | 1389 | $this->page_slug, |
1390 | 1390 | 'side', |
1391 | 1391 | 'default' |
@@ -1415,38 +1415,38 @@ discard block |
||
1415 | 1415 | 'disabled' => '' |
1416 | 1416 | ); |
1417 | 1417 | |
1418 | - $event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL; |
|
1418 | + $event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL; |
|
1419 | 1419 | |
1420 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1420 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1421 | 1421 | |
1422 | 1422 | /** |
1423 | 1423 | * 1. Start with retrieving Datetimes |
1424 | 1424 | * 2. Fore each datetime get related tickets |
1425 | 1425 | * 3. For each ticket get related prices |
1426 | 1426 | */ |
1427 | - $times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id ); |
|
1428 | - EE_Registry::instance()->load_helper('DTT_Helper' ); |
|
1427 | + $times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id); |
|
1428 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
1429 | 1429 | /** @type EE_Datetime $first_datetime */ |
1430 | - $first_datetime = array_slice( $times, 0, 1 ); |
|
1430 | + $first_datetime = array_slice($times, 0, 1); |
|
1431 | 1431 | //do we get related tickets? |
1432 | - if ( $first_datetime[ 0 ]->get( 'DTT_ID' ) !== 0 ) { |
|
1433 | - foreach ( $times as $time ) { |
|
1434 | - if ( $time instanceof EE_Datetime ) { |
|
1432 | + if ($first_datetime[0]->get('DTT_ID') !== 0) { |
|
1433 | + foreach ($times as $time) { |
|
1434 | + if ($time instanceof EE_Datetime) { |
|
1435 | 1435 | $existing_datetime_ids[] = $time->get('DTT_ID'); |
1436 | 1436 | $template_args['time'] = $time; |
1437 | 1437 | $related_tickets = $time->tickets( |
1438 | 1438 | array( |
1439 | - array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), |
|
1439 | + array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), |
|
1440 | 1440 | 'default_where_conditions' => 'none' |
1441 | 1441 | ) |
1442 | 1442 | ); |
1443 | 1443 | |
1444 | - if ( !empty($related_tickets) ) { |
|
1444 | + if ( ! empty($related_tickets)) { |
|
1445 | 1445 | $template_args['total_ticket_rows'] = count($related_tickets); |
1446 | 1446 | $row = 0; |
1447 | - foreach ( $related_tickets as $ticket ) { |
|
1447 | + foreach ($related_tickets as $ticket) { |
|
1448 | 1448 | $existing_ticket_ids[] = $ticket->get('TKT_ID'); |
1449 | - $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row ); |
|
1449 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row); |
|
1450 | 1450 | |
1451 | 1451 | $row++; |
1452 | 1452 | } |
@@ -1454,7 +1454,7 @@ discard block |
||
1454 | 1454 | $template_args['total_ticket_rows'] = 1; |
1455 | 1455 | /** @type EE_Ticket $ticket */ |
1456 | 1456 | $ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object(); |
1457 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket ); |
|
1457 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket); |
|
1458 | 1458 | } |
1459 | 1459 | } |
1460 | 1460 | } |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | $template_args['time'] = $times[0]; |
1463 | 1463 | /** @type EE_Ticket $ticket */ |
1464 | 1464 | $ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
1465 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] ); |
|
1465 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]); |
|
1466 | 1466 | // NOTE: we're just sending the first default row |
1467 | 1467 | // (decaf can't manage default tickets so this should be sufficient); |
1468 | 1468 | } |
@@ -1471,8 +1471,8 @@ discard block |
||
1471 | 1471 | $template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info'); |
1472 | 1472 | $template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
1473 | 1473 | $template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
1474 | - $template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE ); |
|
1475 | - $template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' ); |
|
1474 | + $template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE); |
|
1475 | + $template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'); |
|
1476 | 1476 | EEH_Template::display_template($template, $template_args); |
1477 | 1477 | } |
1478 | 1478 | |
@@ -1487,21 +1487,21 @@ discard block |
||
1487 | 1487 | * @param int $row |
1488 | 1488 | * @return string generated html for the ticket row. |
1489 | 1489 | */ |
1490 | - private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) { |
|
1490 | + private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) { |
|
1491 | 1491 | $template_args = array( |
1492 | - 'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(), |
|
1493 | - 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '', |
|
1492 | + 'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(), |
|
1493 | + 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '', |
|
1494 | 1494 | 'ticketrow' => $skeleton ? 'TICKETNUM' : $row, |
1495 | 1495 | 'TKT_ID' => $ticket->get('TKT_ID'), |
1496 | 1496 | 'TKT_name' => $ticket->get('TKT_name'), |
1497 | 1497 | 'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'), |
1498 | 1498 | 'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'), |
1499 | 1499 | 'TKT_is_default' => $ticket->get('TKT_is_default'), |
1500 | - 'TKT_qty' => $ticket->get_pretty('TKT_qty','input'), |
|
1500 | + 'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'), |
|
1501 | 1501 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1502 | 1502 | 'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'), |
1503 | - 'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
|
1504 | - 'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled' |
|
1503 | + 'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
|
1504 | + 'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled' |
|
1505 | 1505 | ); |
1506 | 1506 | |
1507 | 1507 | $price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object(); |
@@ -1517,23 +1517,23 @@ discard block |
||
1517 | 1517 | |
1518 | 1518 | //make sure we have default start and end dates if skeleton |
1519 | 1519 | //handle rows that should NOT be empty |
1520 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1520 | + if (empty($template_args['TKT_start_date'])) { |
|
1521 | 1521 | //if empty then the start date will be now. |
1522 | 1522 | $template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp')); |
1523 | 1523 | } |
1524 | 1524 | |
1525 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1525 | + if (empty($template_args['TKT_end_date'])) { |
|
1526 | 1526 | //get the earliest datetime (if present); |
1527 | - $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
|
1527 | + $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL; |
|
1528 | 1528 | |
1529 | - if ( !empty( $earliest_dtt ) ) |
|
1529 | + if ( ! empty($earliest_dtt)) |
|
1530 | 1530 | $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
1531 | 1531 | else |
1532 | - $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1532 | + $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y"))); |
|
1533 | 1533 | } |
1534 | 1534 | |
1535 | - $template_args = array_merge( $template_args, $price_args ); |
|
1536 | - $template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket); |
|
1535 | + $template_args = array_merge($template_args, $price_args); |
|
1536 | + $template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket); |
|
1537 | 1537 | return EEH_Template::display_template($template, $template_args, TRUE); |
1538 | 1538 | } |
1539 | 1539 | |
@@ -1562,8 +1562,8 @@ discard block |
||
1562 | 1562 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
1563 | 1563 | $template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description()); |
1564 | 1564 | $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false); |
1565 | - $template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values ); |
|
1566 | - $templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php'; |
|
1565 | + $template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values); |
|
1566 | + $templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php'; |
|
1567 | 1567 | EEH_Template::display_template($templatepath, $template_args); |
1568 | 1568 | } |
1569 | 1569 | |
@@ -1591,21 +1591,21 @@ discard block |
||
1591 | 1591 | $EEME = $this->_event_model(); |
1592 | 1592 | |
1593 | 1593 | $offset = ($current_page - 1) * $per_page; |
1594 | - $limit = $count ? NULL : $offset . ',' . $per_page; |
|
1594 | + $limit = $count ? NULL : $offset.','.$per_page; |
|
1595 | 1595 | $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID'; |
1596 | 1596 | $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC"; |
1597 | 1597 | |
1598 | 1598 | if (isset($this->_req_data['month_range'])) { |
1599 | 1599 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
1600 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1601 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
1600 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1601 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1602 | 1602 | } |
1603 | 1603 | |
1604 | 1604 | $where = array(); |
1605 | 1605 | |
1606 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
1606 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
1607 | 1607 | //determine what post_status our condition will have for the query. |
1608 | - switch ( $status ) { |
|
1608 | + switch ($status) { |
|
1609 | 1609 | case 'month' : |
1610 | 1610 | case 'today' : |
1611 | 1611 | case NULL : |
@@ -1613,7 +1613,7 @@ discard block |
||
1613 | 1613 | break; |
1614 | 1614 | |
1615 | 1615 | case 'draft' : |
1616 | - $where['status'] = array( 'IN', array('draft', 'auto-draft') ); |
|
1616 | + $where['status'] = array('IN', array('draft', 'auto-draft')); |
|
1617 | 1617 | break; |
1618 | 1618 | |
1619 | 1619 | default : |
@@ -1621,43 +1621,43 @@ discard block |
||
1621 | 1621 | } |
1622 | 1622 | |
1623 | 1623 | //categories? |
1624 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
1624 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
1625 | 1625 | |
1626 | - if ( !empty ( $category ) ) { |
|
1626 | + if ( ! empty ($category)) { |
|
1627 | 1627 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
1628 | 1628 | $where['Term_Taxonomy.term_id'] = $category; |
1629 | 1629 | } |
1630 | 1630 | |
1631 | 1631 | //date where conditions |
1632 | - $start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' ); |
|
1632 | + $start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start'); |
|
1633 | 1633 | if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') { |
1634 | - $DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) ); |
|
1635 | - $start = $DateTime->format( implode( ' ', $start_formats ) ); |
|
1636 | - $end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) ); |
|
1637 | - $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) ); |
|
1634 | + $DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone())); |
|
1635 | + $start = $DateTime->format(implode(' ', $start_formats)); |
|
1636 | + $end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1637 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1638 | 1638 | } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') { |
1639 | - $DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1640 | - $start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) ); |
|
1641 | - $end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1642 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1643 | - } else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) { |
|
1644 | - $now = date( 'Y-m-01' ); |
|
1645 | - $DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1646 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1647 | - $end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1648 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1639 | + $DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1640 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1641 | + $end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1642 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1643 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') { |
|
1644 | + $now = date('Y-m-01'); |
|
1645 | + $DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1646 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1647 | + $end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1648 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1649 | 1649 | } |
1650 | 1650 | |
1651 | 1651 | |
1652 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1653 | - $where['EVT_wp_user'] = get_current_user_id(); |
|
1652 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1653 | + $where['EVT_wp_user'] = get_current_user_id(); |
|
1654 | 1654 | } else { |
1655 | - if ( ! isset( $where['status'] ) ) { |
|
1656 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) { |
|
1655 | + if ( ! isset($where['status'])) { |
|
1656 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
1657 | 1657 | $where['OR'] = array( |
1658 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1658 | + 'status*restrict_private' => array('!=', 'private'), |
|
1659 | 1659 | 'AND' => array( |
1660 | - 'status*inclusive' => array( '=', 'private' ), |
|
1660 | + 'status*inclusive' => array('=', 'private'), |
|
1661 | 1661 | 'EVT_wp_user' => get_current_user_id() |
1662 | 1662 | ) |
1663 | 1663 | ); |
@@ -1665,16 +1665,16 @@ discard block |
||
1665 | 1665 | } |
1666 | 1666 | } |
1667 | 1667 | |
1668 | - if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
|
1669 | - if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1668 | + if (isset($this->_req_data['EVT_wp_user'])) { |
|
1669 | + if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1670 | 1670 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1671 | 1671 | } |
1672 | 1672 | } |
1673 | 1673 | |
1674 | 1674 | |
1675 | 1675 | //search query handling |
1676 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1677 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1676 | + if (isset($this->_req_data['s'])) { |
|
1677 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1678 | 1678 | $where['OR'] = array( |
1679 | 1679 | 'EVT_name' => array('LIKE', $search_string), |
1680 | 1680 | 'EVT_desc' => array('LIKE', $search_string), |
@@ -1683,32 +1683,32 @@ discard block |
||
1683 | 1683 | } |
1684 | 1684 | |
1685 | 1685 | |
1686 | - $where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data ); |
|
1687 | - $query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data ); |
|
1686 | + $where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data); |
|
1687 | + $query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data); |
|
1688 | 1688 | |
1689 | 1689 | |
1690 | 1690 | //let's first check if we have special requests coming in. |
1691 | - if ( isset( $this->_req_data['active_status'] ) ) { |
|
1692 | - switch ( $this->_req_data['active_status'] ) { |
|
1691 | + if (isset($this->_req_data['active_status'])) { |
|
1692 | + switch ($this->_req_data['active_status']) { |
|
1693 | 1693 | case 'upcoming' : |
1694 | - return $EEME->get_upcoming_events( $query_params, $count ); |
|
1694 | + return $EEME->get_upcoming_events($query_params, $count); |
|
1695 | 1695 | break; |
1696 | 1696 | |
1697 | 1697 | case 'expired' : |
1698 | - return $EEME->get_expired_events( $query_params, $count ); |
|
1698 | + return $EEME->get_expired_events($query_params, $count); |
|
1699 | 1699 | break; |
1700 | 1700 | |
1701 | 1701 | case 'active' : |
1702 | - return $EEME->get_active_events( $query_params, $count ); |
|
1702 | + return $EEME->get_active_events($query_params, $count); |
|
1703 | 1703 | break; |
1704 | 1704 | |
1705 | 1705 | case 'inactive' : |
1706 | - return $EEME->get_inactive_events( $query_params, $count ); |
|
1706 | + return $EEME->get_inactive_events($query_params, $count); |
|
1707 | 1707 | break; |
1708 | 1708 | } |
1709 | 1709 | } |
1710 | 1710 | |
1711 | - $events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params ); |
|
1711 | + $events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params); |
|
1712 | 1712 | |
1713 | 1713 | return $events; |
1714 | 1714 | } |
@@ -1717,23 +1717,23 @@ discard block |
||
1717 | 1717 | |
1718 | 1718 | |
1719 | 1719 | //handling for WordPress CPT actions (trash, restore, delete) |
1720 | - public function trash_cpt_item( $post_id ) { |
|
1720 | + public function trash_cpt_item($post_id) { |
|
1721 | 1721 | $this->_req_data['EVT_ID'] = $post_id; |
1722 | - $this->_trash_or_restore_event( 'trash', FALSE ); |
|
1722 | + $this->_trash_or_restore_event('trash', FALSE); |
|
1723 | 1723 | } |
1724 | 1724 | |
1725 | 1725 | |
1726 | 1726 | |
1727 | 1727 | |
1728 | - public function restore_cpt_item( $post_id ) { |
|
1728 | + public function restore_cpt_item($post_id) { |
|
1729 | 1729 | $this->_req_data['EVT_ID'] = $post_id; |
1730 | - $this->_trash_or_restore_event( 'draft', FALSE ); |
|
1730 | + $this->_trash_or_restore_event('draft', FALSE); |
|
1731 | 1731 | } |
1732 | 1732 | |
1733 | 1733 | |
1734 | - public function delete_cpt_item( $post_id ) { |
|
1734 | + public function delete_cpt_item($post_id) { |
|
1735 | 1735 | $this->_req_data['EVT_ID'] = $post_id; |
1736 | - $this->_delete_event( FALSE ); |
|
1736 | + $this->_delete_event(FALSE); |
|
1737 | 1737 | } |
1738 | 1738 | |
1739 | 1739 | |
@@ -1745,7 +1745,7 @@ discard block |
||
1745 | 1745 | * @param string $event_status |
1746 | 1746 | * @return void |
1747 | 1747 | */ |
1748 | - protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) { |
|
1748 | + protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) { |
|
1749 | 1749 | //determine the event id and set to array. |
1750 | 1750 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE; |
1751 | 1751 | // loop thru events |
@@ -1753,7 +1753,7 @@ discard block |
||
1753 | 1753 | // clean status |
1754 | 1754 | $event_status = sanitize_key($event_status); |
1755 | 1755 | // grab status |
1756 | - if (!empty($event_status)) { |
|
1756 | + if ( ! empty($event_status)) { |
|
1757 | 1757 | $success = $this->_change_event_status($EVT_ID, $event_status); |
1758 | 1758 | } else { |
1759 | 1759 | $success = FALSE; |
@@ -1767,7 +1767,7 @@ discard block |
||
1767 | 1767 | } |
1768 | 1768 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1769 | 1769 | |
1770 | - if ( $redirect_after ) |
|
1770 | + if ($redirect_after) |
|
1771 | 1771 | $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
1772 | 1772 | } |
1773 | 1773 | |
@@ -1782,7 +1782,7 @@ discard block |
||
1782 | 1782 | // clean status |
1783 | 1783 | $event_status = sanitize_key($event_status); |
1784 | 1784 | // grab status |
1785 | - if (!empty($event_status)) { |
|
1785 | + if ( ! empty($event_status)) { |
|
1786 | 1786 | $success = TRUE; |
1787 | 1787 | //determine the event id and set to array. |
1788 | 1788 | $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
@@ -1817,15 +1817,15 @@ discard block |
||
1817 | 1817 | * @param string $event_status |
1818 | 1818 | * @return bool |
1819 | 1819 | */ |
1820 | - private function _change_event_status( $EVT_ID = 0, $event_status = '') { |
|
1820 | + private function _change_event_status($EVT_ID = 0, $event_status = '') { |
|
1821 | 1821 | // grab event id |
1822 | - if (!$EVT_ID) { |
|
1822 | + if ( ! $EVT_ID) { |
|
1823 | 1823 | $msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso'); |
1824 | 1824 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1825 | 1825 | return FALSE; |
1826 | 1826 | } |
1827 | 1827 | |
1828 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1828 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1829 | 1829 | |
1830 | 1830 | // clean status |
1831 | 1831 | $event_status = sanitize_key($event_status); |
@@ -1851,7 +1851,7 @@ discard block |
||
1851 | 1851 | $hook = FALSE; |
1852 | 1852 | } |
1853 | 1853 | //use class to change status |
1854 | - $this->_cpt_model_obj->set_status( $event_status ); |
|
1854 | + $this->_cpt_model_obj->set_status($event_status); |
|
1855 | 1855 | $success = $this->_cpt_model_obj->save(); |
1856 | 1856 | |
1857 | 1857 | if ($success === FALSE) { |
@@ -1873,15 +1873,15 @@ discard block |
||
1873 | 1873 | * @access protected |
1874 | 1874 | * @param bool $redirect_after |
1875 | 1875 | */ |
1876 | - protected function _delete_event( $redirect_after = TRUE ) { |
|
1876 | + protected function _delete_event($redirect_after = TRUE) { |
|
1877 | 1877 | //determine the event id and set to array. |
1878 | 1878 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL; |
1879 | - $EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID; |
|
1879 | + $EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID; |
|
1880 | 1880 | |
1881 | 1881 | |
1882 | 1882 | // loop thru events |
1883 | 1883 | if ($EVT_ID) { |
1884 | - $success = $this->_permanently_delete_event( $EVT_ID ); |
|
1884 | + $success = $this->_permanently_delete_event($EVT_ID); |
|
1885 | 1885 | // get list of events with no prices |
1886 | 1886 | $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
1887 | 1887 | // remove this event from the list of events with no prices |
@@ -1895,7 +1895,7 @@ discard block |
||
1895 | 1895 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1896 | 1896 | } |
1897 | 1897 | |
1898 | - if ( $redirect_after ) |
|
1898 | + if ($redirect_after) |
|
1899 | 1899 | $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
1900 | 1900 | } |
1901 | 1901 | |
@@ -1913,12 +1913,12 @@ discard block |
||
1913 | 1913 | $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
1914 | 1914 | // loop thru events |
1915 | 1915 | foreach ($EVT_IDs as $EVT_ID) { |
1916 | - $EVT_ID = absint( $EVT_ID ); |
|
1917 | - if ( $EVT_ID ) { |
|
1918 | - $results = $this->_permanently_delete_event( $EVT_ID ); |
|
1916 | + $EVT_ID = absint($EVT_ID); |
|
1917 | + if ($EVT_ID) { |
|
1918 | + $results = $this->_permanently_delete_event($EVT_ID); |
|
1919 | 1919 | $success = $results !== FALSE ? $success : FALSE; |
1920 | 1920 | // remove this event from the list of events with no prices |
1921 | - unset( $espresso_no_ticket_prices[ $EVT_ID ] ); |
|
1921 | + unset($espresso_no_ticket_prices[$EVT_ID]); |
|
1922 | 1922 | } else { |
1923 | 1923 | $success = FALSE; |
1924 | 1924 | $msg = __('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso'); |
@@ -1938,21 +1938,21 @@ discard block |
||
1938 | 1938 | * @param int $EVT_ID |
1939 | 1939 | * @return bool |
1940 | 1940 | */ |
1941 | - private function _permanently_delete_event( $EVT_ID = 0 ) { |
|
1941 | + private function _permanently_delete_event($EVT_ID = 0) { |
|
1942 | 1942 | // grab event id |
1943 | - if ( ! $EVT_ID ) { |
|
1943 | + if ( ! $EVT_ID) { |
|
1944 | 1944 | $msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso'); |
1945 | 1945 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1946 | 1946 | return FALSE; |
1947 | 1947 | } |
1948 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1948 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1949 | 1949 | |
1950 | 1950 | //need to delete related tickets and prices first. |
1951 | 1951 | $datetimes = $this->_cpt_model_obj->get_many_related('Datetime'); |
1952 | - foreach ( $datetimes as $datetime ) { |
|
1952 | + foreach ($datetimes as $datetime) { |
|
1953 | 1953 | $this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime'); |
1954 | 1954 | $tickets = $datetime->get_many_related('Ticket'); |
1955 | - foreach ( $tickets as $ticket ) { |
|
1955 | + foreach ($tickets as $ticket) { |
|
1956 | 1956 | $ticket->_remove_relation_to($datetime, 'Datetime'); |
1957 | 1957 | $ticket->delete_related_permanently('Price'); |
1958 | 1958 | $ticket->delete_permanently(); |
@@ -1962,14 +1962,14 @@ discard block |
||
1962 | 1962 | |
1963 | 1963 | //what about related venues or terms? |
1964 | 1964 | $venues = $this->_cpt_model_obj->get_many_related('Venue'); |
1965 | - foreach ( $venues as $venue ) { |
|
1965 | + foreach ($venues as $venue) { |
|
1966 | 1966 | $this->_cpt_model_obj->_remove_relation_to($venue, 'Venue'); |
1967 | 1967 | } |
1968 | 1968 | |
1969 | 1969 | //any attached question groups? |
1970 | 1970 | $question_groups = $this->_cpt_model_obj->get_many_related('Question_Group'); |
1971 | - if ( !empty( $question_groups ) ) { |
|
1972 | - foreach ( $question_groups as $question_group ) { |
|
1971 | + if ( ! empty($question_groups)) { |
|
1972 | + foreach ($question_groups as $question_group) { |
|
1973 | 1973 | $this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group'); |
1974 | 1974 | } |
1975 | 1975 | } |
@@ -1978,12 +1978,12 @@ discard block |
||
1978 | 1978 | |
1979 | 1979 | |
1980 | 1980 | //Message Template Groups |
1981 | - $this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' ); |
|
1981 | + $this->_cpt_model_obj->_remove_relations('Message_Template_Group'); |
|
1982 | 1982 | |
1983 | 1983 | /** @type EE_Term_Taxonomy[] $term_taxonomies */ |
1984 | 1984 | $term_taxonomies = $this->_cpt_model_obj->term_taxonomies(); |
1985 | 1985 | |
1986 | - foreach ( $term_taxonomies as $term_taxonomy ) { |
|
1986 | + foreach ($term_taxonomies as $term_taxonomy) { |
|
1987 | 1987 | $this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy); |
1988 | 1988 | } |
1989 | 1989 | |
@@ -1997,7 +1997,7 @@ discard block |
||
1997 | 1997 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1998 | 1998 | return FALSE; |
1999 | 1999 | } |
2000 | - do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID ); |
|
2000 | + do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID); |
|
2001 | 2001 | return TRUE; |
2002 | 2002 | } |
2003 | 2003 | |
@@ -2014,7 +2014,7 @@ discard block |
||
2014 | 2014 | */ |
2015 | 2015 | public function total_events() { |
2016 | 2016 | |
2017 | - $count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2017 | + $count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true); |
|
2018 | 2018 | return $count; |
2019 | 2019 | } |
2020 | 2020 | |
@@ -2029,10 +2029,10 @@ discard block |
||
2029 | 2029 | */ |
2030 | 2030 | public function total_events_draft() { |
2031 | 2031 | $where = array( |
2032 | - 'status' => array( 'IN', array('draft', 'auto-draft' ) ) |
|
2032 | + 'status' => array('IN', array('draft', 'auto-draft')) |
|
2033 | 2033 | ); |
2034 | 2034 | |
2035 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2035 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2036 | 2036 | return $count; |
2037 | 2037 | } |
2038 | 2038 | |
@@ -2051,7 +2051,7 @@ discard block |
||
2051 | 2051 | 'status' => 'trash' |
2052 | 2052 | ); |
2053 | 2053 | |
2054 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2054 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2055 | 2055 | return $count; |
2056 | 2056 | } |
2057 | 2057 | |
@@ -2079,11 +2079,11 @@ discard block |
||
2079 | 2079 | // translated |
2080 | 2080 | TRUE |
2081 | 2081 | ); |
2082 | - $this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment; |
|
2082 | + $this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment; |
|
2083 | 2083 | |
2084 | 2084 | $this->_set_add_edit_form_tags('update_default_event_settings'); |
2085 | 2085 | $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
2086 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE); |
|
2086 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE); |
|
2087 | 2087 | $this->display_admin_page_with_sidebar(); |
2088 | 2088 | } |
2089 | 2089 | |
@@ -2109,9 +2109,9 @@ discard block |
||
2109 | 2109 | |
2110 | 2110 | protected function _template_settings() { |
2111 | 2111 | $this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso'); |
2112 | - $this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />'; |
|
2113 | - $this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>'; |
|
2114 | - $this->display_admin_caf_preview_page( 'template_settings_tab' ); |
|
2112 | + $this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />'; |
|
2113 | + $this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>'; |
|
2114 | + $this->display_admin_caf_preview_page('template_settings_tab'); |
|
2115 | 2115 | } |
2116 | 2116 | |
2117 | 2117 | |
@@ -2124,22 +2124,22 @@ discard block |
||
2124 | 2124 | * @return void |
2125 | 2125 | */ |
2126 | 2126 | private function _set_category_object() { |
2127 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
2127 | + if (isset($this->_category->id) && ! empty($this->_category->id)) |
|
2128 | 2128 | return; //already have the category object so get out. |
2129 | 2129 | |
2130 | 2130 | //set default category object |
2131 | 2131 | $this->_set_empty_category_object(); |
2132 | 2132 | |
2133 | 2133 | //only set if we've got an id |
2134 | - if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) { |
|
2134 | + if ( ! isset($this->_req_data['EVT_CAT_ID'])) { |
|
2135 | 2135 | return; |
2136 | 2136 | } |
2137 | 2137 | |
2138 | 2138 | $category_id = absint($this->_req_data['EVT_CAT_ID']); |
2139 | 2139 | |
2140 | - $term = get_term( $category_id, 'espresso_event_categories' ); |
|
2140 | + $term = get_term($category_id, 'espresso_event_categories'); |
|
2141 | 2141 | |
2142 | - if ( !empty( $term ) ) { |
|
2142 | + if ( ! empty($term)) { |
|
2143 | 2143 | $this->_category->category_name = $term->name; |
2144 | 2144 | $this->_category->category_identifier = $term->slug; |
2145 | 2145 | $this->_category->category_desc = $term->description; |
@@ -2153,13 +2153,13 @@ discard block |
||
2153 | 2153 | |
2154 | 2154 | private function _set_empty_category_object() { |
2155 | 2155 | $this->_category = new stdClass(); |
2156 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
2156 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
2157 | 2157 | $this->_category->id = $this->_category->parent = 0; |
2158 | 2158 | } |
2159 | 2159 | |
2160 | 2160 | |
2161 | 2161 | protected function _category_list_table() { |
2162 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2162 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2163 | 2163 | $this->_search_btn_label = __('Categories', 'event_espresso'); |
2164 | 2164 | $this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2'); |
2165 | 2165 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -2169,22 +2169,22 @@ discard block |
||
2169 | 2169 | protected function _category_details($view) { |
2170 | 2170 | |
2171 | 2171 | //load formatter helper |
2172 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
2172 | + EE_Registry::instance()->load_helper('Formatter'); |
|
2173 | 2173 | //load field generator helper |
2174 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
2174 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
2175 | 2175 | |
2176 | 2176 | $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
2177 | 2177 | $this->_set_add_edit_form_tags($route); |
2178 | 2178 | |
2179 | 2179 | $this->_set_category_object(); |
2180 | - $id = !empty($this->_category->id) ? $this->_category->id : ''; |
|
2180 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
2181 | 2181 | |
2182 | 2182 | $delete_action = 'delete_category'; |
2183 | 2183 | |
2184 | 2184 | //custom redirect |
2185 | - $redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url ); |
|
2185 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
2186 | 2186 | |
2187 | - $this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect ); |
|
2187 | + $this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect); |
|
2188 | 2188 | |
2189 | 2189 | //take care of contents |
2190 | 2190 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
@@ -2198,25 +2198,25 @@ discard block |
||
2198 | 2198 | 'type' => 'wp_editor', |
2199 | 2199 | 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
2200 | 2200 | 'class' => 'my_editor_custom', |
2201 | - 'wpeditor_args' => array('media_buttons' => FALSE ) |
|
2201 | + 'wpeditor_args' => array('media_buttons' => FALSE) |
|
2202 | 2202 | ); |
2203 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
2203 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
2204 | 2204 | |
2205 | - $all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) ); |
|
2205 | + $all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id))); |
|
2206 | 2206 | |
2207 | 2207 | //setup category select for term parents. |
2208 | 2208 | $category_select_values[] = array( |
2209 | 2209 | 'text' => __('No Parent', 'event_espresso'), |
2210 | 2210 | 'id' => 0 |
2211 | 2211 | ); |
2212 | - foreach ( $all_terms as $term ) { |
|
2212 | + foreach ($all_terms as $term) { |
|
2213 | 2213 | $category_select_values[] = array( |
2214 | 2214 | 'text' => $term->name, |
2215 | 2215 | 'id' => $term->term_id |
2216 | 2216 | ); |
2217 | 2217 | } |
2218 | 2218 | |
2219 | - $category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent ); |
|
2219 | + $category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent); |
|
2220 | 2220 | |
2221 | 2221 | $template_args = array( |
2222 | 2222 | 'category' => $this->_category, |
@@ -2226,15 +2226,15 @@ discard block |
||
2226 | 2226 | 'disable' => '', |
2227 | 2227 | 'disabled_message' => FALSE |
2228 | 2228 | ); |
2229 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
2230 | - return EEH_Template::display_template($template, $template_args, TRUE ); |
|
2229 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
2230 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
2231 | 2231 | } |
2232 | 2232 | |
2233 | 2233 | |
2234 | 2234 | protected function _delete_categories() { |
2235 | - $cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
2235 | + $cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
2236 | 2236 | |
2237 | - foreach ( $cat_ids as $cat_id ) { |
|
2237 | + foreach ($cat_ids as $cat_id) { |
|
2238 | 2238 | $this->_delete_category($cat_id); |
2239 | 2239 | } |
2240 | 2240 | |
@@ -2242,7 +2242,7 @@ discard block |
||
2242 | 2242 | $query_args = array( |
2243 | 2243 | 'action' => 'category_list' |
2244 | 2244 | ); |
2245 | - $this->_redirect_after_action(0,'','',$query_args); |
|
2245 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
2246 | 2246 | |
2247 | 2247 | } |
2248 | 2248 | |
@@ -2252,61 +2252,61 @@ discard block |
||
2252 | 2252 | |
2253 | 2253 | protected function _delete_category($cat_id) { |
2254 | 2254 | global $wpdb; |
2255 | - $cat_id = absint( $cat_id ); |
|
2256 | - wp_delete_term( $cat_id, 'espresso_event_categories' ); |
|
2255 | + $cat_id = absint($cat_id); |
|
2256 | + wp_delete_term($cat_id, 'espresso_event_categories'); |
|
2257 | 2257 | } |
2258 | 2258 | |
2259 | 2259 | |
2260 | 2260 | |
2261 | 2261 | protected function _insert_or_update_category($new_category) { |
2262 | 2262 | |
2263 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE ); |
|
2263 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE); |
|
2264 | 2264 | $success = 0; //we already have a success message so lets not send another. |
2265 | 2265 | |
2266 | - if ( $cat_id ) { |
|
2266 | + if ($cat_id) { |
|
2267 | 2267 | $query_args = array( |
2268 | 2268 | 'action' => 'edit_category', |
2269 | 2269 | 'EVT_CAT_ID' => $cat_id |
2270 | 2270 | ); |
2271 | 2271 | } else { |
2272 | - $query_args = array( 'action' => 'add_category' ); |
|
2272 | + $query_args = array('action' => 'add_category'); |
|
2273 | 2273 | } |
2274 | - $this->_redirect_after_action( $success, '','', $query_args, TRUE ); |
|
2274 | + $this->_redirect_after_action($success, '', '', $query_args, TRUE); |
|
2275 | 2275 | |
2276 | 2276 | } |
2277 | 2277 | |
2278 | 2278 | |
2279 | 2279 | |
2280 | - private function _insert_category( $update = FALSE ) { |
|
2280 | + private function _insert_category($update = FALSE) { |
|
2281 | 2281 | $cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : ''; |
2282 | - $category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
2283 | - $category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
2284 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
2282 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
2283 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
2284 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
2285 | 2285 | |
2286 | - if ( empty( $category_name ) ) { |
|
2287 | - $msg = __( 'You must add a name for the category.', 'event_espresso' ); |
|
2288 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2286 | + if (empty($category_name)) { |
|
2287 | + $msg = __('You must add a name for the category.', 'event_espresso'); |
|
2288 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2289 | 2289 | return false; |
2290 | 2290 | } |
2291 | 2291 | |
2292 | - $term_args=array( |
|
2292 | + $term_args = array( |
|
2293 | 2293 | 'name'=>$category_name, |
2294 | 2294 | 'description'=>$category_desc, |
2295 | 2295 | 'parent'=>$category_parent |
2296 | 2296 | ); |
2297 | 2297 | //was the category_identifier input disabled? |
2298 | - if(isset($this->_req_data['category_identifier'])){ |
|
2298 | + if (isset($this->_req_data['category_identifier'])) { |
|
2299 | 2299 | $term_args['slug'] = $this->_req_data['category_identifier']; |
2300 | 2300 | } |
2301 | - $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args ); |
|
2301 | + $insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args); |
|
2302 | 2302 | |
2303 | - if ( !is_array( $insert_ids ) ) { |
|
2304 | - $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
2305 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2303 | + if ( ! is_array($insert_ids)) { |
|
2304 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
2305 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2306 | 2306 | } else { |
2307 | 2307 | $cat_id = $insert_ids['term_id']; |
2308 | - $msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name ); |
|
2309 | - EE_Error::add_success( $msg ); |
|
2308 | + $msg = sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name); |
|
2309 | + EE_Error::add_success($msg); |
|
2310 | 2310 | } |
2311 | 2311 | |
2312 | 2312 | return $cat_id; |
@@ -2315,32 +2315,32 @@ discard block |
||
2315 | 2315 | |
2316 | 2316 | |
2317 | 2317 | |
2318 | - public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
2318 | + public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) { |
|
2319 | 2319 | global $wpdb; |
2320 | 2320 | |
2321 | 2321 | //testing term stuff |
2322 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2323 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
2324 | - $limit = ($current_page-1)*$per_page; |
|
2322 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2323 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
2324 | + $limit = ($current_page - 1) * $per_page; |
|
2325 | 2325 | |
2326 | - $where = array( 'taxonomy' => 'espresso_event_categories' ); |
|
2326 | + $where = array('taxonomy' => 'espresso_event_categories'); |
|
2327 | 2327 | |
2328 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2329 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2328 | + if (isset($this->_req_data['s'])) { |
|
2329 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2330 | 2330 | $where['OR'] = array( |
2331 | - 'Term.name' => array( 'LIKE', $sstr), |
|
2332 | - 'description' => array( 'LIKE', $sstr ) |
|
2331 | + 'Term.name' => array('LIKE', $sstr), |
|
2332 | + 'description' => array('LIKE', $sstr) |
|
2333 | 2333 | ); |
2334 | 2334 | } |
2335 | 2335 | |
2336 | 2336 | $query_params = array( |
2337 | - $where , |
|
2338 | - 'order_by' => array( $orderby => $order ), |
|
2339 | - 'limit' => $limit . ',' . $per_page, |
|
2337 | + $where, |
|
2338 | + 'order_by' => array($orderby => $order), |
|
2339 | + 'limit' => $limit.','.$per_page, |
|
2340 | 2340 | 'force_join' => array('Term') |
2341 | 2341 | ); |
2342 | 2342 | |
2343 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
2343 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
2344 | 2344 | |
2345 | 2345 | return $categories; |
2346 | 2346 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
45 | 45 | * @return \Payments_Admin_Page |
46 | 46 | */ |
47 | - public function __construct( $routing = TRUE ) { |
|
48 | - parent::__construct( $routing ); |
|
47 | + public function __construct($routing = TRUE) { |
|
48 | + parent::__construct($routing); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | protected function _set_page_config() { |
131 | 131 | $payment_method_list_config = array( |
132 | 132 | 'nav' => array( |
133 | - 'label' => __( 'Payment Methods', 'event_espresso' ), |
|
133 | + 'label' => __('Payment Methods', 'event_espresso'), |
|
134 | 134 | 'order' => 10 |
135 | 135 | ), |
136 | 136 | 'metaboxes' => $this->_default_espresso_metaboxes, |
137 | 137 | 'help_tabs' => array_merge( |
138 | 138 | array( |
139 | 139 | 'payment_methods_overview_help_tab' => array( |
140 | - 'title' => __( 'Payment Methods Overview', 'event_espresso' ), |
|
140 | + 'title' => __('Payment Methods Overview', 'event_espresso'), |
|
141 | 141 | 'filename' => 'payment_methods_overview' |
142 | 142 | ) |
143 | 143 | ), |
144 | 144 | $this->_add_payment_method_help_tabs() ), |
145 | - 'help_tour' => array( 'Payment_Methods_Selection_Help_Tour' ), |
|
145 | + 'help_tour' => array('Payment_Methods_Selection_Help_Tour'), |
|
146 | 146 | 'require_nonce' => false |
147 | 147 | ); |
148 | 148 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | ) |
161 | 161 | ), |
162 | 162 | //'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ), |
163 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
163 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
164 | 164 | 'require_nonce' => FALSE |
165 | 165 | ), |
166 | 166 | 'payment_log'=>array( |
@@ -179,17 +179,17 @@ discard block |
||
179 | 179 | /** |
180 | 180 | * @return array |
181 | 181 | */ |
182 | - protected function _add_payment_method_help_tabs(){ |
|
182 | + protected function _add_payment_method_help_tabs() { |
|
183 | 183 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
184 | 184 | $payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types(); |
185 | 185 | $all_pmt_help_tabs_config = array(); |
186 | - foreach( $payment_method_types as $payment_method_type ){ |
|
187 | - if ( ! EE_Registry::instance()->CAP->current_user_can( $payment_method_type->cap_name(), 'specific_payment_method_type_access' ) ) { |
|
186 | + foreach ($payment_method_types as $payment_method_type) { |
|
187 | + if ( ! EE_Registry::instance()->CAP->current_user_can($payment_method_type->cap_name(), 'specific_payment_method_type_access')) { |
|
188 | 188 | continue; |
189 | 189 | } |
190 | - foreach( $payment_method_type->help_tabs_config() as $help_tab_name => $config ){ |
|
191 | - $template_args = isset( $config[ 'template_args' ] ) ? $config[ 'template_args' ] : array(); |
|
192 | - $template_args[ 'admin_page_obj' ] = $this; |
|
190 | + foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) { |
|
191 | + $template_args = isset($config['template_args']) ? $config['template_args'] : array(); |
|
192 | + $template_args['admin_page_obj'] = $this; |
|
193 | 193 | $all_pmt_help_tabs_config[$help_tab_name] = array( |
194 | 194 | 'title'=>$config['title'], |
195 | 195 | 'content'=>EEH_Template::display_template( |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | |
217 | 217 | |
218 | 218 | public function load_scripts_styles() { |
219 | - wp_enqueue_script( 'ee_admin_js' ); |
|
220 | - wp_enqueue_script( 'ee-text-links' ); |
|
221 | - wp_enqueue_script( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', array( 'espresso-ui-theme', 'ee-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
219 | + wp_enqueue_script('ee_admin_js'); |
|
220 | + wp_enqueue_script('ee-text-links'); |
|
221 | + wp_enqueue_script('espresso_payments', EE_PAYMENTS_ASSETS_URL.'espresso_payments_admin.js', array('espresso-ui-theme', 'ee-datepicker'), EVENT_ESPRESSO_VERSION, TRUE); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | |
228 | 228 | public function load_scripts_styles_default() { |
229 | 229 | //styles |
230 | - wp_register_style( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', array(), EVENT_ESPRESSO_VERSION ); |
|
231 | - wp_enqueue_style( 'espresso_payments' ); |
|
232 | - wp_enqueue_style( 'ee-text-links' ); |
|
230 | + wp_register_style('espresso_payments', EE_PAYMENTS_ASSETS_URL.'ee-payments.css', array(), EVENT_ESPRESSO_VERSION); |
|
231 | + wp_enqueue_style('espresso_payments'); |
|
232 | + wp_enqueue_style('ee-text-links'); |
|
233 | 233 | //scripts |
234 | 234 | } |
235 | 235 | |
@@ -243,46 +243,46 @@ discard block |
||
243 | 243 | * to the loading process. However, people MUST setup the details for the payment method so its safe to do a |
244 | 244 | * recheck here. |
245 | 245 | */ |
246 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
246 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
247 | 247 | EEM_Payment_Method::instance()->verify_button_urls(); |
248 | - EE_Registry::instance()->load_helper( 'Tabbed_Content' ); |
|
249 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
248 | + EE_Registry::instance()->load_helper('Tabbed_Content'); |
|
249 | + EE_Registry::instance()->load_helper('HTML'); |
|
250 | 250 | //setup tabs, one for each payment method type |
251 | 251 | $tabs = array(); |
252 | 252 | $payment_methods = array(); |
253 | - foreach( EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj ) { |
|
253 | + foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { |
|
254 | 254 | // we don't want to show admin-only PMTs for now |
255 | - if ( $pmt_obj instanceof EE_PMT_Admin_Only ) { |
|
255 | + if ($pmt_obj instanceof EE_PMT_Admin_Only) { |
|
256 | 256 | continue; |
257 | 257 | } |
258 | 258 | //check access |
259 | - if ( ! EE_Registry::instance()->CAP->current_user_can( $pmt_obj->cap_name(), 'specific_payment_method_type_access' ) ) { |
|
259 | + if ( ! EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) { |
|
260 | 260 | continue; |
261 | 261 | } |
262 | 262 | //check for any active pms of that type |
263 | - $payment_method = EEM_Payment_Method::instance()->get_one_of_type( $pmt_obj->system_name() ); |
|
264 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
263 | + $payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name()); |
|
264 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
265 | 265 | $payment_method = EE_Payment_Method::new_instance( |
266 | 266 | array( |
267 | - 'PMD_slug' =>sanitize_key( $pmt_obj->system_name() ), |
|
267 | + 'PMD_slug' =>sanitize_key($pmt_obj->system_name()), |
|
268 | 268 | 'PMD_type' =>$pmt_obj->system_name(), |
269 | 269 | 'PMD_name' =>$pmt_obj->pretty_name(), |
270 | 270 | 'PMD_admin_name' =>$pmt_obj->pretty_name() |
271 | 271 | ) |
272 | 272 | ); |
273 | 273 | } |
274 | - $payment_methods[ $payment_method->slug() ] = $payment_method; |
|
274 | + $payment_methods[$payment_method->slug()] = $payment_method; |
|
275 | 275 | } |
276 | - $payment_methods = apply_filters( 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods ); |
|
277 | - foreach( $payment_methods as $payment_method ) { |
|
278 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
276 | + $payment_methods = apply_filters('FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods); |
|
277 | + foreach ($payment_methods as $payment_method) { |
|
278 | + if ($payment_method instanceof EE_Payment_Method) { |
|
279 | 279 | add_meta_box( |
280 | 280 | //html id |
281 | - 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
281 | + 'espresso_'.$payment_method->slug().'_payment_settings', |
|
282 | 282 | //title |
283 | - sprintf( __( '%s Settings', 'event_espresso' ), $payment_method->admin_name() ), |
|
283 | + sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()), |
|
284 | 284 | //callback |
285 | - array( $this, 'payment_method_settings_meta_box' ), |
|
285 | + array($this, 'payment_method_settings_meta_box'), |
|
286 | 286 | //post type |
287 | 287 | null, |
288 | 288 | //context |
@@ -290,19 +290,19 @@ discard block |
||
290 | 290 | //priority |
291 | 291 | 'default', |
292 | 292 | //callback args |
293 | - array( 'payment_method' => $payment_method ) |
|
293 | + array('payment_method' => $payment_method) |
|
294 | 294 | ); |
295 | 295 | //setup for tabbed content |
296 | - $tabs[ $payment_method->slug() ] = array( |
|
296 | + $tabs[$payment_method->slug()] = array( |
|
297 | 297 | 'label' => $payment_method->admin_name(), |
298 | 298 | 'class' => $payment_method->active() ? 'gateway-active' : '', |
299 | - 'href' => 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
300 | - 'title' => __( 'Modify this Payment Method', 'event_espresso' ), |
|
299 | + 'href' => 'espresso_'.$payment_method->slug().'_payment_settings', |
|
300 | + 'title' => __('Modify this Payment Method', 'event_espresso'), |
|
301 | 301 | 'slug' => $payment_method->slug() |
302 | 302 | ); |
303 | 303 | } |
304 | 304 | } |
305 | - $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug() ); |
|
305 | + $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug()); |
|
306 | 306 | $this->display_admin_page_with_sidebar(); |
307 | 307 | |
308 | 308 | } |
@@ -313,20 +313,20 @@ discard block |
||
313 | 313 | * _get_active_payment_method_slug |
314 | 314 | * @return string |
315 | 315 | */ |
316 | - protected function _get_active_payment_method_slug(){ |
|
316 | + protected function _get_active_payment_method_slug() { |
|
317 | 317 | $payment_method_slug = FALSE; |
318 | 318 | //decide which payment method tab to open first, as dictated by the request's 'payment_method' |
319 | - if ( isset( $this->_req_data['payment_method'] )) { |
|
319 | + if (isset($this->_req_data['payment_method'])) { |
|
320 | 320 | // if they provided the current payment method, use it |
321 | - $payment_method_slug = sanitize_key( $this->_req_data['payment_method'] ); |
|
321 | + $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
|
322 | 322 | } |
323 | - $payment_method = EEM_Payment_Method::instance()->get_one( array( array( 'PMD_slug' => $payment_method_slug ))); |
|
323 | + $payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug))); |
|
324 | 324 | // if that didn't work or wasn't provided, find another way to select the current pm |
325 | - if ( ! $this->_verify_payment_method( $payment_method )) { |
|
325 | + if ( ! $this->_verify_payment_method($payment_method)) { |
|
326 | 326 | // like, looking for an active one |
327 | - $payment_method = EEM_Payment_Method::instance()->get_one_active( 'CART' ); |
|
327 | + $payment_method = EEM_Payment_Method::instance()->get_one_active('CART'); |
|
328 | 328 | // test that one as well |
329 | - if ( $this->_verify_payment_method( $payment_method )) { |
|
329 | + if ($this->_verify_payment_method($payment_method)) { |
|
330 | 330 | $payment_method_slug = $payment_method->slug(); |
331 | 331 | } else { |
332 | 332 | $payment_method_slug = 'paypal_standard'; |
@@ -344,11 +344,11 @@ discard block |
||
344 | 344 | * @param \EE_Payment_Method $payment_method |
345 | 345 | * @return boolean |
346 | 346 | */ |
347 | - protected function _verify_payment_method( $payment_method ){ |
|
347 | + protected function _verify_payment_method($payment_method) { |
|
348 | 348 | if ( |
349 | 349 | $payment_method instanceof EE_Payment_Method && |
350 | 350 | $payment_method->type_obj() instanceof EE_PMT_Base && |
351 | - EE_Registry::instance()->CAP->current_user_can( $payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access' ) |
|
351 | + EE_Registry::instance()->CAP->current_user_can($payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access') |
|
352 | 352 | ) { |
353 | 353 | return TRUE; |
354 | 354 | } |
@@ -365,21 +365,21 @@ discard block |
||
365 | 365 | * @return string |
366 | 366 | * @throws EE_Error |
367 | 367 | */ |
368 | - public function payment_method_settings_meta_box( $post_obj_which_is_null, $metabox ){ |
|
369 | - $payment_method = isset( $metabox['args'], $metabox['args']['payment_method'] ) ? $metabox['args']['payment_method'] : NULL; |
|
370 | - if ( ! $payment_method instanceof EE_Payment_Method ){ |
|
371 | - throw new EE_Error( sprintf( __( 'Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso' ))); |
|
368 | + public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) { |
|
369 | + $payment_method = isset($metabox['args'], $metabox['args']['payment_method']) ? $metabox['args']['payment_method'] : NULL; |
|
370 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
371 | + throw new EE_Error(sprintf(__('Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso'))); |
|
372 | 372 | } |
373 | 373 | $payment_method_scopes = $payment_method->active(); |
374 | 374 | // if the payment method really exists show its form, otherwise the activation template |
375 | - if ( $payment_method->ID() && ! empty( $payment_method_scopes )) { |
|
376 | - $form = $this->_generate_payment_method_settings_form( $payment_method ); |
|
377 | - if ( $form->form_data_present_in( $this->_req_data )) { |
|
378 | - $form->receive_form_submission( $this->_req_data ); |
|
375 | + if ($payment_method->ID() && ! empty($payment_method_scopes)) { |
|
376 | + $form = $this->_generate_payment_method_settings_form($payment_method); |
|
377 | + if ($form->form_data_present_in($this->_req_data)) { |
|
378 | + $form->receive_form_submission($this->_req_data); |
|
379 | 379 | } |
380 | - echo $form->form_open() . $form->get_html_and_js() . $form->form_close(); |
|
380 | + echo $form->form_open().$form->get_html_and_js().$form->form_close(); |
|
381 | 381 | } else { |
382 | - echo $this->_activate_payment_method_button( $payment_method )->get_html_and_js(); |
|
382 | + echo $this->_activate_payment_method_button($payment_method)->get_html_and_js(); |
|
383 | 383 | } |
384 | 384 | } |
385 | 385 | |
@@ -392,14 +392,14 @@ discard block |
||
392 | 392 | * @param \EE_Payment_Method $payment_method |
393 | 393 | * @return \EE_Form_Section_Proper |
394 | 394 | */ |
395 | - protected function _generate_payment_method_settings_form( EE_Payment_Method $payment_method ) { |
|
396 | - if ( ! $payment_method instanceof EE_Payment_Method ){ |
|
395 | + protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method) { |
|
396 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
397 | 397 | return new EE_Form_Section_Proper(); |
398 | 398 | } |
399 | 399 | return new EE_Form_Section_Proper( |
400 | 400 | array( |
401 | - 'name' => $payment_method->slug() . '_settings_form', |
|
402 | - 'html_id' => $payment_method->slug() . '_settings_form', |
|
401 | + 'name' => $payment_method->slug().'_settings_form', |
|
402 | + 'html_id' => $payment_method->slug().'_settings_form', |
|
403 | 403 | 'action' => EE_Admin_Page::add_query_args_and_nonce( |
404 | 404 | array( |
405 | 405 | 'action' => 'update_payment_method', |
@@ -411,12 +411,12 @@ discard block |
||
411 | 411 | 'subsections' => apply_filters( |
412 | 412 | 'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections', |
413 | 413 | array( |
414 | - 'pci_dss_compliance_' . $payment_method->slug() => $this->_pci_dss_compliance( $payment_method ), |
|
415 | - 'currency_support_' . $payment_method->slug() => $this->_currency_support( $payment_method ), |
|
416 | - 'payment_method_settings_' . $payment_method->slug() => $this->_payment_method_settings( $payment_method ), |
|
417 | - 'update_' . $payment_method->slug() => $this->_update_payment_method_button( $payment_method ), |
|
418 | - 'deactivate_' . $payment_method->slug() => $this->_deactivate_payment_method_button( $payment_method ), |
|
419 | - 'fine_print_' . $payment_method->slug() => $this->_fine_print() |
|
414 | + 'pci_dss_compliance_'.$payment_method->slug() => $this->_pci_dss_compliance($payment_method), |
|
415 | + 'currency_support_'.$payment_method->slug() => $this->_currency_support($payment_method), |
|
416 | + 'payment_method_settings_'.$payment_method->slug() => $this->_payment_method_settings($payment_method), |
|
417 | + 'update_'.$payment_method->slug() => $this->_update_payment_method_button($payment_method), |
|
418 | + 'deactivate_'.$payment_method->slug() => $this->_deactivate_payment_method_button($payment_method), |
|
419 | + 'fine_print_'.$payment_method->slug() => $this->_fine_print() |
|
420 | 420 | ), |
421 | 421 | $payment_method |
422 | 422 | ) |
@@ -433,19 +433,19 @@ discard block |
||
433 | 433 | * @param \EE_Payment_Method $payment_method |
434 | 434 | * @return \EE_Form_Section_Proper |
435 | 435 | */ |
436 | - protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) { |
|
437 | - if ( $payment_method->type_obj()->requires_https() ) { |
|
436 | + protected function _pci_dss_compliance(EE_Payment_Method $payment_method) { |
|
437 | + if ($payment_method->type_obj()->requires_https()) { |
|
438 | 438 | return new EE_Form_Section_HTML( |
439 | 439 | EEH_HTML::tr( |
440 | 440 | EEH_HTML::th( |
441 | 441 | EEH_HTML::label( |
442 | - EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' ) |
|
442 | + EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice') |
|
443 | 443 | ) |
444 | - ) . |
|
444 | + ). |
|
445 | 445 | EEH_HTML::td( |
446 | - EEH_HTML::strong( __( 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso' )) . |
|
447 | - EEH_HTML::br() . |
|
448 | - __( 'Learn more about ', 'event_espresso' ) . EEH_HTML::link( 'https://www.pcisecuritystandards.org/merchants/index.php', __( 'PCI DSS compliance', 'event_espresso' )) |
|
446 | + EEH_HTML::strong(__('You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso')). |
|
447 | + EEH_HTML::br(). |
|
448 | + __('Learn more about ', 'event_espresso').EEH_HTML::link('https://www.pcisecuritystandards.org/merchants/index.php', __('PCI DSS compliance', 'event_espresso')) |
|
449 | 449 | ) |
450 | 450 | ) |
451 | 451 | ); |
@@ -463,19 +463,19 @@ discard block |
||
463 | 463 | * @param \EE_Payment_Method $payment_method |
464 | 464 | * @return \EE_Form_Section_Proper |
465 | 465 | */ |
466 | - protected function _currency_support( EE_Payment_Method $payment_method ) { |
|
467 | - if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) { |
|
466 | + protected function _currency_support(EE_Payment_Method $payment_method) { |
|
467 | + if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) { |
|
468 | 468 | return new EE_Form_Section_HTML( |
469 | 469 | EEH_HTML::tr( |
470 | 470 | EEH_HTML::th( |
471 | 471 | EEH_HTML::label( |
472 | - EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' ) |
|
472 | + EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice') |
|
473 | 473 | ) |
474 | - ) . |
|
474 | + ). |
|
475 | 475 | EEH_HTML::td( |
476 | 476 | EEH_HTML::strong( |
477 | 477 | sprintf( |
478 | - __( 'This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'), |
|
478 | + __('This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'), |
|
479 | 479 | EE_Config::instance()->currency->code |
480 | 480 | ) |
481 | 481 | ) |
@@ -495,9 +495,9 @@ discard block |
||
495 | 495 | * @param \EE_Payment_Method $payment_method |
496 | 496 | * @return \EE_Form_Section_HTML |
497 | 497 | */ |
498 | - protected function _payment_method_settings( EE_Payment_Method $payment_method ) { |
|
498 | + protected function _payment_method_settings(EE_Payment_Method $payment_method) { |
|
499 | 499 | //modify the form so we only have/show fields that will be implemented for this version |
500 | - return $this->_simplify_form( $payment_method->type_obj()->settings_form(), $payment_method->name() ); |
|
500 | + return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name()); |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | |
@@ -510,8 +510,8 @@ discard block |
||
510 | 510 | * @return \EE_Payment_Method_Form |
511 | 511 | * @throws \EE_Error |
512 | 512 | */ |
513 | - protected function _simplify_form( $form_section, $payment_method_name = '' ){ |
|
514 | - if ( $form_section instanceof EE_Payment_Method_Form ) { |
|
513 | + protected function _simplify_form($form_section, $payment_method_name = '') { |
|
514 | + if ($form_section instanceof EE_Payment_Method_Form) { |
|
515 | 515 | $form_section->exclude( |
516 | 516 | array( |
517 | 517 | 'PMD_type', //dont want them changing the type |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | ); |
523 | 523 | return $form_section; |
524 | 524 | } else { |
525 | - throw new EE_Error( sprintf( __( 'The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso' ), $payment_method_name )); |
|
525 | + throw new EE_Error(sprintf(__('The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso'), $payment_method_name)); |
|
526 | 526 | } |
527 | 527 | } |
528 | 528 | |
@@ -535,18 +535,18 @@ discard block |
||
535 | 535 | * @param \EE_Payment_Method $payment_method |
536 | 536 | * @return \EE_Form_Section_HTML |
537 | 537 | */ |
538 | - protected function _update_payment_method_button( EE_Payment_Method $payment_method ) { |
|
538 | + protected function _update_payment_method_button(EE_Payment_Method $payment_method) { |
|
539 | 539 | $update_button = new EE_Submit_Input( |
540 | 540 | array( |
541 | - 'html_id' => 'save_' . $payment_method->slug() . '_settings', |
|
542 | - 'default' => sprintf( __( 'Update %s Payment Settings', 'event_espresso' ), $payment_method->admin_name() ), |
|
541 | + 'html_id' => 'save_'.$payment_method->slug().'_settings', |
|
542 | + 'default' => sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()), |
|
543 | 543 | 'html_label' => EEH_HTML::nbsp() |
544 | 544 | ) |
545 | 545 | ); |
546 | 546 | return new EE_Form_Section_HTML( |
547 | - EEH_HTML::no_row( EEH_HTML::br(2) ) . |
|
547 | + EEH_HTML::no_row(EEH_HTML::br(2)). |
|
548 | 548 | EEH_HTML::tr( |
549 | - EEH_HTML::th( __( 'Update Settings', 'event_espresso') ) . |
|
549 | + EEH_HTML::th(__('Update Settings', 'event_espresso')). |
|
550 | 550 | EEH_HTML::td( |
551 | 551 | $update_button->get_html_for_input() |
552 | 552 | ) |
@@ -563,11 +563,11 @@ discard block |
||
563 | 563 | * @param \EE_Payment_Method $payment_method |
564 | 564 | * @return \EE_Form_Section_Proper |
565 | 565 | */ |
566 | - protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) { |
|
567 | - $link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() ); |
|
566 | + protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) { |
|
567 | + $link_text_and_title = sprintf(__('Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name()); |
|
568 | 568 | return new EE_Form_Section_HTML( |
569 | 569 | EEH_HTML::tr( |
570 | - EEH_HTML::th( __( 'Deactivate Payment Method', 'event_espresso') ) . |
|
570 | + EEH_HTML::th(__('Deactivate Payment Method', 'event_espresso')). |
|
571 | 571 | EEH_HTML::td( |
572 | 572 | EEH_HTML::link( |
573 | 573 | EE_Admin_Page::add_query_args_and_nonce( |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | ), |
580 | 580 | $link_text_and_title, |
581 | 581 | $link_text_and_title, |
582 | - 'deactivate_' . $payment_method->slug(), |
|
582 | + 'deactivate_'.$payment_method->slug(), |
|
583 | 583 | 'espresso-button button-secondary' |
584 | 584 | ) |
585 | 585 | ) |
@@ -595,12 +595,12 @@ discard block |
||
595 | 595 | * @param \EE_Payment_Method $payment_method |
596 | 596 | * @return \EE_Form_Section_Proper |
597 | 597 | */ |
598 | - protected function _activate_payment_method_button( EE_Payment_Method $payment_method ) { |
|
599 | - $link_text_and_title = sprintf( __( 'Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name() ); |
|
598 | + protected function _activate_payment_method_button(EE_Payment_Method $payment_method) { |
|
599 | + $link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name()); |
|
600 | 600 | return new EE_Form_Section_Proper( |
601 | 601 | array( |
602 | - 'name' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
603 | - 'html_id' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
602 | + 'name' => 'activate_'.$payment_method->slug().'_settings_form', |
|
603 | + 'html_id' => 'activate_'.$payment_method->slug().'_settings_form', |
|
604 | 604 | 'action' => '#', |
605 | 605 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
606 | 606 | 'subsections' => apply_filters( |
@@ -609,8 +609,8 @@ discard block |
||
609 | 609 | new EE_Form_Section_HTML( |
610 | 610 | EEH_HTML::tr( |
611 | 611 | EEH_HTML::th( |
612 | - EEH_HTML::label( __( 'Click to Activate ', 'event_espresso' )) |
|
613 | - ) . |
|
612 | + EEH_HTML::label(__('Click to Activate ', 'event_espresso')) |
|
613 | + ). |
|
614 | 614 | EEH_HTML::td( |
615 | 615 | EEH_HTML::link( |
616 | 616 | EE_Admin_Page::add_query_args_and_nonce( |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | ), |
623 | 623 | $link_text_and_title, |
624 | 624 | $link_text_and_title, |
625 | - 'activate_' . $payment_method->slug(), |
|
625 | + 'activate_'.$payment_method->slug(), |
|
626 | 626 | 'espresso-button-green button-primary' |
627 | 627 | ) |
628 | 628 | ) |
@@ -644,9 +644,9 @@ discard block |
||
644 | 644 | protected function _fine_print() { |
645 | 645 | return new EE_Form_Section_HTML( |
646 | 646 | EEH_HTML::tr( |
647 | - EEH_HTML::th() . |
|
647 | + EEH_HTML::th(). |
|
648 | 648 | EEH_HTML::td( |
649 | - EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' ) |
|
649 | + EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text') |
|
650 | 650 | ) |
651 | 651 | ) |
652 | 652 | ); |
@@ -658,15 +658,15 @@ discard block |
||
658 | 658 | * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far) |
659 | 659 | * @global WP_User $current_user |
660 | 660 | */ |
661 | - protected function _activate_payment_method(){ |
|
662 | - if(isset($this->_req_data['payment_method_type'])){ |
|
661 | + protected function _activate_payment_method() { |
|
662 | + if (isset($this->_req_data['payment_method_type'])) { |
|
663 | 663 | $payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']); |
664 | 664 | //see if one exists |
665 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
666 | - $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type ); |
|
665 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
666 | + $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type($payment_method_type); |
|
667 | 667 | |
668 | - $this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug())); |
|
669 | - }else{ |
|
668 | + $this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default', 'payment_method'=>$payment_method->slug())); |
|
669 | + } else { |
|
670 | 670 | $this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); |
671 | 671 | } |
672 | 672 | } |
@@ -674,14 +674,14 @@ discard block |
||
674 | 674 | /** |
675 | 675 | * Deactivates the payment method with the specified slug, and redirects. |
676 | 676 | */ |
677 | - protected function _deactivate_payment_method(){ |
|
678 | - if(isset($this->_req_data['payment_method'])){ |
|
677 | + protected function _deactivate_payment_method() { |
|
678 | + if (isset($this->_req_data['payment_method'])) { |
|
679 | 679 | $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
680 | 680 | //deactivate it |
681 | 681 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
682 | - $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug ); |
|
683 | - $this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug)); |
|
684 | - }else{ |
|
682 | + $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug); |
|
683 | + $this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default', 'payment_method'=>$payment_method_slug)); |
|
684 | + } else { |
|
685 | 685 | $this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default')); |
686 | 686 | } |
687 | 687 | } |
@@ -695,39 +695,39 @@ discard block |
||
695 | 695 | * subsequently called 'headers_sent_func' which is _payment_methods_list) |
696 | 696 | * @return void |
697 | 697 | */ |
698 | - protected function _update_payment_method(){ |
|
699 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
698 | + protected function _update_payment_method() { |
|
699 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
700 | 700 | //ok let's find which gateway form to use based on the form input |
701 | 701 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
702 | 702 | /** @var $correct_pmt_form_to_use EE_Payment_Method_Form */ |
703 | 703 | $correct_pmt_form_to_use = NULL; |
704 | 704 | $pmt_obj = NULL; |
705 | - foreach(EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj){ |
|
705 | + foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { |
|
706 | 706 | /** @var $pmt_obj EE_PMT_Base */ |
707 | 707 | //get the form and simplify it, like what we do when we display it |
708 | 708 | $pmt_form = $pmt_obj->settings_form(); |
709 | 709 | $this->_simplify_form($pmt_form); |
710 | - if($pmt_form->form_data_present_in($this->_req_data)){ |
|
710 | + if ($pmt_form->form_data_present_in($this->_req_data)) { |
|
711 | 711 | $correct_pmt_form_to_use = $pmt_form; |
712 | 712 | break; |
713 | 713 | } |
714 | 714 | } |
715 | 715 | //if we couldn't find the correct payment method type... |
716 | - if( ! $correct_pmt_form_to_use ){ |
|
716 | + if ( ! $correct_pmt_form_to_use) { |
|
717 | 717 | EE_Error::add_error(__("We could not find which payment method type your form submission related to. Please contact support", 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
718 | 718 | $this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); |
719 | 719 | } |
720 | 720 | $correct_pmt_form_to_use->receive_form_submission($this->_req_data); |
721 | - if($correct_pmt_form_to_use->is_valid()){ |
|
721 | + if ($correct_pmt_form_to_use->is_valid()) { |
|
722 | 722 | $correct_pmt_form_to_use->save(); |
723 | 723 | $pm = $correct_pmt_form_to_use->get_model_object(); |
724 | 724 | /** @var $pm EE_Payment_Method */ |
725 | - $this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug())); |
|
726 | - }else{ |
|
725 | + $this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default', 'payment_method'=>$pm->slug())); |
|
726 | + } else { |
|
727 | 727 | EE_Error::add_error( |
728 | 728 | sprintf( |
729 | 729 | __('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'), |
730 | - $pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __( '"(unknown)"', 'event_espresso' ) |
|
730 | + $pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __('"(unknown)"', 'event_espresso') |
|
731 | 731 | ), |
732 | 732 | __FILE__, |
733 | 733 | __FUNCTION__, |
@@ -744,11 +744,11 @@ discard block |
||
744 | 744 | protected function _payment_settings() { |
745 | 745 | |
746 | 746 | $this->_template_args['values'] = $this->_yes_no_values; |
747 | - $this->_template_args['show_pending_payment_options'] = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) ? absint( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) : FALSE; |
|
747 | + $this->_template_args['show_pending_payment_options'] = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) ? absint(EE_Registry::instance()->CFG->registration->show_pending_payment_options) : FALSE; |
|
748 | 748 | |
749 | - $this->_set_add_edit_form_tags( 'update_payment_settings' ); |
|
750 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
751 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_PAYMENTS_TEMPLATE_PATH . 'payment_settings.template.php', $this->_template_args, TRUE ); |
|
749 | + $this->_set_add_edit_form_tags('update_payment_settings'); |
|
750 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
751 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_PAYMENTS_TEMPLATE_PATH.'payment_settings.template.php', $this->_template_args, TRUE); |
|
752 | 752 | $this->display_admin_page_with_sidebar(); |
753 | 753 | |
754 | 754 | } |
@@ -762,13 +762,13 @@ discard block |
||
762 | 762 | * @return array |
763 | 763 | */ |
764 | 764 | protected function _update_payment_settings() { |
765 | - EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE; |
|
766 | - EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG ); |
|
765 | + EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset($this->_req_data['show_pending_payment_options']) ? $this->_req_data['show_pending_payment_options'] : FALSE; |
|
766 | + EE_Registry::instance()->CFG = apply_filters('FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG); |
|
767 | 767 | |
768 | 768 | |
769 | - $what = __('Payment Settings','event_espresso'); |
|
770 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ ); |
|
771 | - $this->_redirect_after_action( $success, $what, __('updated','event_espresso'), array( 'action' => 'payment_settings' ) ); |
|
769 | + $what = __('Payment Settings', 'event_espresso'); |
|
770 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__); |
|
771 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), array('action' => 'payment_settings')); |
|
772 | 772 | |
773 | 773 | } |
774 | 774 | protected function _payment_log_overview_list_table() { |
@@ -794,18 +794,18 @@ discard block |
||
794 | 794 | * @param bool $count |
795 | 795 | * @return array |
796 | 796 | */ |
797 | - public function get_payment_logs($per_page = 50, $current_page = 0, $count = false){ |
|
798 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
797 | + public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) { |
|
798 | + EE_Registry::instance()->load_model('Change_Log'); |
|
799 | 799 | //we may need to do multiple queries (joining differently), so we actually wan tan array of query params |
800 | - $query_params = array(array('LOG_type'=> EEM_Change_Log::type_gateway)); |
|
800 | + $query_params = array(array('LOG_type'=> EEM_Change_Log::type_gateway)); |
|
801 | 801 | //check if they've selected a specific payment method |
802 | - if( isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all'){ |
|
802 | + if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') { |
|
803 | 803 | $query_params[0]['OR*pm_or_pay_pm'] = array('Payment.Payment_Method.PMD_ID'=>$this->_req_data['_payment_method'], |
804 | 804 | 'Payment_Method.PMD_ID'=>$this->_req_data['_payment_method']); |
805 | 805 | } |
806 | 806 | //take into account search |
807 | - if(isset($this->_req_data['s']) && $this->_req_data['s']){ |
|
808 | - $similarity_string = array('LIKE','%'.str_replace("","%",$this->_req_data['s']) .'%'); |
|
807 | + if (isset($this->_req_data['s']) && $this->_req_data['s']) { |
|
808 | + $similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%'); |
|
809 | 809 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string; |
810 | 810 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string; |
811 | 811 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string; |
@@ -820,48 +820,48 @@ discard block |
||
820 | 820 | $query_params[0]['OR*s']['LOG_message'] = $similarity_string; |
821 | 821 | |
822 | 822 | } |
823 | - if(isset( $this->_req_data['payment-filter-start-date'] ) && isset( $this->_req_data['payment-filter-end-date'] )){ |
|
823 | + if (isset($this->_req_data['payment-filter-start-date']) && isset($this->_req_data['payment-filter-end-date'])) { |
|
824 | 824 | //add date |
825 | - $start_date =wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] ); |
|
826 | - $end_date = wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] ); |
|
825 | + $start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']); |
|
826 | + $end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']); |
|
827 | 827 | //make sure our timestamps start and end right at the boundaries for each day |
828 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
829 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
828 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
829 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
830 | 830 | |
831 | 831 | //convert to timestamps |
832 | - $start_date = strtotime( $start_date ); |
|
833 | - $end_date = strtotime( $end_date ); |
|
832 | + $start_date = strtotime($start_date); |
|
833 | + $end_date = strtotime($end_date); |
|
834 | 834 | |
835 | 835 | //makes sure start date is the lowest value and vice versa |
836 | - $start_date = min( $start_date, $end_date ); |
|
837 | - $end_date = max( $start_date, $end_date ); |
|
836 | + $start_date = min($start_date, $end_date); |
|
837 | + $end_date = max($start_date, $end_date); |
|
838 | 838 | |
839 | 839 | //convert for query |
840 | - $start_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' ); |
|
841 | - $end_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' ); |
|
840 | + $start_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s'); |
|
841 | + $end_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s'); |
|
842 | 842 | |
843 | - $query_params[0]['LOG_time'] = array('BETWEEN',array($start_date,$end_date)); |
|
843 | + $query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date)); |
|
844 | 844 | |
845 | 845 | } |
846 | - if($count){ |
|
846 | + if ($count) { |
|
847 | 847 | return EEM_Change_Log::instance()->count($query_params); |
848 | 848 | } |
849 | - if(isset($this->_req_data['order'])){ |
|
850 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
849 | + if (isset($this->_req_data['order'])) { |
|
850 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
851 | 851 | $query_params['order_by'] = array('LOG_time' => $sort); |
852 | - }else{ |
|
852 | + } else { |
|
853 | 853 | $query_params['order_by'] = array('LOG_time' => 'DESC'); |
854 | 854 | } |
855 | - $offset = ($current_page-1)*$per_page; |
|
855 | + $offset = ($current_page - 1) * $per_page; |
|
856 | 856 | |
857 | - if( ! isset($this->_req_data['download_results'])){ |
|
858 | - $query_params['limit'] = array( $offset, $per_page ); |
|
857 | + if ( ! isset($this->_req_data['download_results'])) { |
|
858 | + $query_params['limit'] = array($offset, $per_page); |
|
859 | 859 | } |
860 | 860 | |
861 | 861 | |
862 | 862 | |
863 | 863 | //now they've requested to instead just download the file instead of viewing it. |
864 | - if(isset($this->_req_data['download_results'])){ |
|
864 | + if (isset($this->_req_data['download_results'])) { |
|
865 | 865 | $wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params); |
866 | 866 | header('Content-Disposition: attachment'); |
867 | 867 | header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url())); |
@@ -883,36 +883,36 @@ discard block |
||
883 | 883 | * @param EE_Change_Log $logB |
884 | 884 | * @return int |
885 | 885 | */ |
886 | - protected function _sort_logs_again($logA,$logB){ |
|
886 | + protected function _sort_logs_again($logA, $logB) { |
|
887 | 887 | $timeA = $logA->get_raw('LOG_time'); |
888 | 888 | $timeB = $logB->get_raw('LOG_time'); |
889 | - if($timeA == $timeB){ |
|
889 | + if ($timeA == $timeB) { |
|
890 | 890 | return 0; |
891 | 891 | } |
892 | 892 | $comparison = $timeA < $timeB ? -1 : 1; |
893 | - if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){ |
|
893 | + if (strtoupper($this->_sort_logs_again_direction) == 'DESC') { |
|
894 | 894 | return $comparison * -1; |
895 | - }else{ |
|
895 | + } else { |
|
896 | 896 | return $comparison; |
897 | 897 | } |
898 | 898 | } |
899 | 899 | |
900 | 900 | protected function _payment_log_details() { |
901 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
901 | + EE_Registry::instance()->load_model('Change_Log'); |
|
902 | 902 | /** @var $payment_log EE_Change_Log */ |
903 | 903 | $payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']); |
904 | 904 | $payment_method = NULL; |
905 | 905 | $transaction = NULL; |
906 | - if( $payment_log instanceof EE_Change_Log ){ |
|
907 | - if( $payment_log->object() instanceof EE_Payment ){ |
|
906 | + if ($payment_log instanceof EE_Change_Log) { |
|
907 | + if ($payment_log->object() instanceof EE_Payment) { |
|
908 | 908 | $payment_method = $payment_log->object()->payment_method(); |
909 | 909 | $transaction = $payment_log->object()->transaction(); |
910 | - }elseif($payment_log->object() instanceof EE_Payment_Method){ |
|
910 | + }elseif ($payment_log->object() instanceof EE_Payment_Method) { |
|
911 | 911 | $payment_method = $payment_log->object(); |
912 | 912 | } |
913 | 913 | } |
914 | 914 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
915 | - EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php', |
|
915 | + EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php', |
|
916 | 916 | array( |
917 | 917 | 'payment_log'=>$payment_log, |
918 | 918 | 'payment_method'=>$payment_method, |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | protected $_job_step_response = null; |
38 | 38 | |
39 | 39 | |
40 | - public function __construct( $routing = TRUE ) { |
|
41 | - parent::__construct( $routing ); |
|
40 | + public function __construct($routing = TRUE) { |
|
41 | + parent::__construct($routing); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | |
54 | 54 | |
55 | 55 | protected function _ajax_hooks() { |
56 | - add_action('wp_ajax_espresso_batch_continue',array($this,'batch_continue')); |
|
57 | - add_action('wp_ajax_espresso_batch_cleanup',array($this,'batch_cleanup')); |
|
56 | + add_action('wp_ajax_espresso_batch_continue', array($this, 'batch_continue')); |
|
57 | + add_action('wp_ajax_espresso_batch_cleanup', array($this, 'batch_cleanup')); |
|
58 | 58 | |
59 | 59 | } |
60 | 60 | |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | 'nav' => array( |
103 | 103 | 'label' => __('Shortcodes', 'event_espresso'), |
104 | 104 | 'order' => 30), |
105 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_shortcodes_boxes' ) ), |
|
105 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_shortcodes_boxes')), |
|
106 | 106 | 'require_nonce' => FALSE |
107 | 107 | ), |
108 | 108 | 'contact_support' => array( |
109 | 109 | 'nav' => array( |
110 | 110 | 'label' => __('Support', 'event_espresso'), |
111 | 111 | 'order' => 40), |
112 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_support_boxes' ) ), |
|
112 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_support_boxes')), |
|
113 | 113 | 'require_nonce' => FALSE |
114 | 114 | ), |
115 | 115 | 'developers' => array( |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | |
138 | 138 | |
139 | 139 | protected function _installation() { |
140 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_installation.template.php'; |
|
141 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, '', TRUE); |
|
140 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_installation.template.php'; |
|
141 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, '', TRUE); |
|
142 | 142 | $this->display_admin_page_with_sidebar(); |
143 | 143 | } |
144 | 144 | |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | 'other_resources' => __('Other Resources', 'event_espresso') |
164 | 164 | ); |
165 | 165 | |
166 | - foreach ( $boxes as $box => $label ) { |
|
167 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
166 | + foreach ($boxes as $box => $label) { |
|
167 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
168 | 168 | $callback_args = array('template_path' => $template_path); |
169 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
169 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
@@ -187,15 +187,15 @@ discard block |
||
187 | 187 | 'shortcodes_event_listings' => __('Event Listings', 'event_espresso'), |
188 | 188 | 'shortcodes_ticket_selector' => __('Event Ticket Selector', 'event_espresso'), |
189 | 189 | 'shortcodes_category' => __('Event Categories', 'event_espresso'), |
190 | - 'shortcodes_attendee' => __( 'Event Attendees', 'event_espresso' ) |
|
190 | + 'shortcodes_attendee' => __('Event Attendees', 'event_espresso') |
|
191 | 191 | /*'shortcodes_single_events' => __('Single Events', 'event_espresso'),*/ |
192 | 192 | /*'shortcodes_attendee_listings' => __('Attendee Listings', 'event_espresso'),*/ |
193 | 193 | ); |
194 | 194 | |
195 | - foreach ( $boxes as $box => $label ) { |
|
196 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
195 | + foreach ($boxes as $box => $label) { |
|
196 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
197 | 197 | $callback_args = array('template_path' => $template_path); |
198 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
198 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
@@ -214,41 +214,41 @@ discard block |
||
214 | 214 | 'important_information' => __('Important Information', 'event_espresso') |
215 | 215 | ); |
216 | 216 | |
217 | - foreach ( $boxes as $box => $label ) { |
|
218 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
217 | + foreach ($boxes as $box => $label) { |
|
218 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
219 | 219 | $callback_args = array('template_path' => $template_path, 'template_args' => $this->_template_args); |
220 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
220 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
224 | 224 | |
225 | 225 | protected function _developers() { |
226 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'developers_admin_details.template.php'; |
|
227 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true ); |
|
226 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'developers_admin_details.template.php'; |
|
227 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true); |
|
228 | 228 | $this->display_admin_page_with_sidebar(); |
229 | 229 | } |
230 | 230 | |
231 | 231 | public function load_scripts_styles_batch_create() { |
232 | 232 | $job_response = $this->_enqueue_batch_job_scripts_and_styles_and_start_job(); |
233 | - wp_enqueue_script( 'batch_runner', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/batch_runner.js', array( 'progress_bar' )); |
|
234 | - wp_localize_script( 'support_batch_runner', 'ee_job_response', $job_response->to_array() ); |
|
235 | - wp_localize_script( 'support_batch_runner', 'ee_job_i18n', |
|
233 | + wp_enqueue_script('batch_runner', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/batch_runner.js', array('progress_bar')); |
|
234 | + wp_localize_script('support_batch_runner', 'ee_job_response', $job_response->to_array()); |
|
235 | + wp_localize_script('support_batch_runner', 'ee_job_i18n', |
|
236 | 236 | array( |
237 | - 'redirect_url' => $this->_req_data['redirect_url' ], |
|
237 | + 'redirect_url' => $this->_req_data['redirect_url'], |
|
238 | 238 | )); |
239 | 239 | } |
240 | 240 | public function load_scripts_styles_batch_file_create() { |
241 | 241 | //creates a job based on the request variable |
242 | 242 | $job_response = $this->_enqueue_batch_job_scripts_and_styles_and_start_job(); |
243 | - wp_enqueue_script( 'support_batch_file_runner', EE_SUPPORT_ASSETS_URL . 'support_batch_file_runner.js', array( 'batch_runner' ), EVENT_ESPRESSO_VERSION,true); |
|
244 | - wp_localize_script( 'support_batch_file_runner', 'ee_job_response', $job_response->to_array() ); |
|
245 | - wp_localize_script( 'support_batch_file_runner', 'ee_job_i18n', |
|
243 | + wp_enqueue_script('support_batch_file_runner', EE_SUPPORT_ASSETS_URL.'support_batch_file_runner.js', array('batch_runner'), EVENT_ESPRESSO_VERSION, true); |
|
244 | + wp_localize_script('support_batch_file_runner', 'ee_job_response', $job_response->to_array()); |
|
245 | + wp_localize_script('support_batch_file_runner', 'ee_job_i18n', |
|
246 | 246 | array( |
247 | 247 | 'download_and_redirecting' => sprintf( |
248 | 248 | __('File Generation complete. Downloading, and %1$sredirecting%2$s...', 'event_espresso'), |
249 | - '<a href="' . $this->_req_data['redirect_url' ] .'">', |
|
249 | + '<a href="'.$this->_req_data['redirect_url'].'">', |
|
250 | 250 | '</a>' ), |
251 | - 'redirect_url' => $this->_req_data['redirect_url' ], |
|
251 | + 'redirect_url' => $this->_req_data['redirect_url'], |
|
252 | 252 | )); |
253 | 253 | } |
254 | 254 | |
@@ -259,16 +259,16 @@ discard block |
||
259 | 259 | * @return \EventEspressoBatchRequest\Helpers\JobStepResponse |
260 | 260 | */ |
261 | 261 | protected function _enqueue_batch_job_scripts_and_styles_and_start_job() { |
262 | - wp_register_script( 'progress_bar', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.js', array( 'jquery' ) ); |
|
263 | - wp_enqueue_style( 'progress_bar', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.css', array(), EVENT_ESPRESSO_VERSION ); |
|
264 | - wp_enqueue_script( 'batch_runner', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/batch_runner.js', array( 'progress_bar' )); |
|
265 | - $job_handler_classname = stripslashes( $this->_req_data[ 'job_handler' ] ); |
|
262 | + wp_register_script('progress_bar', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/progress_bar.js', array('jquery')); |
|
263 | + wp_enqueue_style('progress_bar', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/progress_bar.css', array(), EVENT_ESPRESSO_VERSION); |
|
264 | + wp_enqueue_script('batch_runner', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/batch_runner.js', array('progress_bar')); |
|
265 | + $job_handler_classname = stripslashes($this->_req_data['job_handler']); |
|
266 | 266 | $request_data = array_diff_key( |
267 | 267 | $this->_req_data, |
268 | - array_flip( array( 'action', 'page' ) ) ); |
|
268 | + array_flip(array('action', 'page')) ); |
|
269 | 269 | $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor(); |
270 | 270 | //eg 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' |
271 | - $job_response = $batch_runner->create_job( $job_handler_classname, $request_data ); |
|
271 | + $job_response = $batch_runner->create_job($job_handler_classname, $request_data); |
|
272 | 272 | //remember the response for later. We need it to display the page body |
273 | 273 | $this->_job_step_response = $job_response; |
274 | 274 | return $job_response; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * Invokes the report-generating code |
278 | 278 | */ |
279 | 279 | protected function batch_create() { |
280 | - echo EEH_Template::locate_template( EE_SUPPORT_ADMIN . 'templates' . DS . 'admin_batch_runner.template.html' ); |
|
280 | + echo EEH_Template::locate_template(EE_SUPPORT_ADMIN.'templates'.DS.'admin_batch_runner.template.html'); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -285,13 +285,13 @@ discard block |
||
285 | 285 | * and then sends the user back to wherever they were before |
286 | 286 | */ |
287 | 287 | protected function batch_file_create() { |
288 | - if( $this->_job_step_response instanceof \EventEspressoBatchRequest\Helpers\JobStepResponse ) { |
|
289 | - $filename = EEH_File::get_filename_from_filepath( $this->_job_step_response->job_parameters()->extra_datum( 'filepath' ) ); |
|
288 | + if ($this->_job_step_response instanceof \EventEspressoBatchRequest\Helpers\JobStepResponse) { |
|
289 | + $filename = EEH_File::get_filename_from_filepath($this->_job_step_response->job_parameters()->extra_datum('filepath')); |
|
290 | 290 | } else { |
291 | - $filename = __( 'Unknown', 'event_espresso' ); |
|
291 | + $filename = __('Unknown', 'event_espresso'); |
|
292 | 292 | } |
293 | 293 | echo EEH_Template::locate_template( |
294 | - EE_SUPPORT_ADMIN . 'templates' . DS . 'admin_batch_file_runner.template.html', |
|
294 | + EE_SUPPORT_ADMIN.'templates'.DS.'admin_batch_file_runner.template.html', |
|
295 | 295 | array( |
296 | 296 | 'filename' => $filename |
297 | 297 | ) |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | * Receives ajax calls for continuing a job |
303 | 303 | */ |
304 | 304 | public function batch_continue() { |
305 | - $job_id = sanitize_text_field( $this->_req_data[ 'job_id' ] ); |
|
305 | + $job_id = sanitize_text_field($this->_req_data['job_id']); |
|
306 | 306 | $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor(); |
307 | - $responseobj = $batch_runner->continue_job( $job_id); |
|
308 | - $this->_template_args[ 'data' ] = $responseobj->to_array(); |
|
307 | + $responseobj = $batch_runner->continue_job($job_id); |
|
308 | + $this->_template_args['data'] = $responseobj->to_array(); |
|
309 | 309 | $this->_return_json(); |
310 | 310 | } |
311 | 311 | |
@@ -314,10 +314,10 @@ discard block |
||
314 | 314 | * @return type |
315 | 315 | */ |
316 | 316 | public function batch_cleanup() { |
317 | - $job_id = sanitize_text_field( $this->_req_data[ 'job_id' ] ); |
|
317 | + $job_id = sanitize_text_field($this->_req_data['job_id']); |
|
318 | 318 | $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor(); |
319 | - $response_obj = $batch_runner->cleanup_job( $job_id ); |
|
320 | - $this->_template_args[ 'data' ] = $response_obj->to_array(); |
|
319 | + $response_obj = $batch_runner->cleanup_job($job_id); |
|
320 | + $this->_template_args['data'] = $response_obj->to_array(); |
|
321 | 321 | $this->_return_json(); |
322 | 322 | } |
323 | 323 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @return EED_Event_Single |
41 | 41 | */ |
42 | 42 | public static function instance() { |
43 | - return parent::get_instance( __CLASS__ ); |
|
43 | + return parent::get_instance(__CLASS__); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @return void |
53 | 53 | */ |
54 | 54 | public static function set_hooks() { |
55 | - add_filter( 'FHEE_run_EE_wp', '__return_true' ); |
|
56 | - add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 ); |
|
57 | - EE_Config::register_route( __( 'event', 'event_espresso' ), 'Event_Single', 'run' ); |
|
55 | + add_filter('FHEE_run_EE_wp', '__return_true'); |
|
56 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
57 | + EE_Config::register_route(__('event', 'event_espresso'), 'Event_Single', 'run'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return void |
65 | 65 | */ |
66 | 66 | public static function set_hooks_admin() { |
67 | - add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 ); |
|
67 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * @return void |
79 | 79 | */ |
80 | 80 | public static function set_definitions() { |
81 | - define( 'EVENT_SINGLE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
82 | - define( 'EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS ); |
|
81 | + define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
82 | + define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @void |
91 | 91 | */ |
92 | - protected function set_config(){ |
|
93 | - $this->set_config_section( 'template_settings' ); |
|
94 | - $this->set_config_class( 'EE_Event_Single_Config' ); |
|
95 | - $this->set_config_name( 'EED_Event_Single' ); |
|
92 | + protected function set_config() { |
|
93 | + $this->set_config_section('template_settings'); |
|
94 | + $this->set_config_class('EE_Event_Single_Config'); |
|
95 | + $this->set_config_name('EED_Event_Single'); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -105,35 +105,35 @@ discard block |
||
105 | 105 | * @param \EE_Event_Single_Config $config |
106 | 106 | * @return \EE_Template_Part_Manager |
107 | 107 | */ |
108 | - public function initialize_template_parts( EE_Event_Single_Config $config = null ) { |
|
108 | + public function initialize_template_parts(EE_Event_Single_Config $config = null) { |
|
109 | 109 | $config = $config instanceof EE_Event_Single_Config ? $config : $this->config(); |
110 | 110 | EEH_Autoloader::instance()->register_template_part_autoloaders(); |
111 | 111 | $template_parts = new EE_Template_Part_Manager(); |
112 | 112 | $template_parts->add_template_part( |
113 | 113 | 'tickets', |
114 | - __( 'Ticket Selector', 'event_espresso' ), |
|
114 | + __('Ticket Selector', 'event_espresso'), |
|
115 | 115 | 'content-espresso_events-tickets.php', |
116 | 116 | $config->display_order_tickets |
117 | 117 | ); |
118 | 118 | $template_parts->add_template_part( |
119 | 119 | 'datetimes', |
120 | - __( 'Dates and Times', 'event_espresso' ), |
|
120 | + __('Dates and Times', 'event_espresso'), |
|
121 | 121 | 'content-espresso_events-datetimes.php', |
122 | 122 | $config->display_order_datetimes |
123 | 123 | ); |
124 | 124 | $template_parts->add_template_part( |
125 | 125 | 'event', |
126 | - __( 'Event Description', 'event_espresso' ), |
|
126 | + __('Event Description', 'event_espresso'), |
|
127 | 127 | 'content-espresso_events-details.php', |
128 | 128 | $config->display_order_event |
129 | 129 | ); |
130 | 130 | $template_parts->add_template_part( |
131 | 131 | 'venue', |
132 | - __( 'Venue Information', 'event_espresso' ), |
|
132 | + __('Venue Information', 'event_espresso'), |
|
133 | 133 | 'content-espresso_events-venues.php', |
134 | 134 | $config->display_order_venue |
135 | 135 | ); |
136 | - do_action( 'AHEE__EED_Event_Single__initialize_template_parts', $template_parts ); |
|
136 | + do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts); |
|
137 | 137 | return $template_parts; |
138 | 138 | } |
139 | 139 | |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | * @param WP $WP |
148 | 148 | * @return void |
149 | 149 | */ |
150 | - public function run( $WP ) { |
|
150 | + public function run($WP) { |
|
151 | 151 | // ensure valid EE_Events_Single_Config() object exists |
152 | 152 | $this->set_config(); |
153 | 153 | // check what template is loaded |
154 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
155 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
154 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
155 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
156 | 156 | // load css |
157 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
158 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
157 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
158 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
@@ -167,26 +167,26 @@ discard block |
||
167 | 167 | * @param string $template |
168 | 168 | * @return string |
169 | 169 | */ |
170 | - public function template_include( $template ) { |
|
170 | + public function template_include($template) { |
|
171 | 171 | global $post; |
172 | 172 | /** @type EE_Event_Single_Config $config */ |
173 | 173 | $config = $this->config(); |
174 | - if ( $config->display_status_banner_single ) { |
|
175 | - add_filter( 'the_title', array( 'EED_Event_Single', 'the_title' ), 100, 2 ); |
|
174 | + if ($config->display_status_banner_single) { |
|
175 | + add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2); |
|
176 | 176 | } |
177 | 177 | // not a custom template? |
178 | 178 | if ( |
179 | 179 | EE_Front_Controller::instance()->get_selected_template() != 'single-espresso_events.php' |
180 | - && ! post_password_required( $post ) |
|
180 | + && ! post_password_required($post) |
|
181 | 181 | ) { |
182 | 182 | EEH_Template::load_espresso_theme_functions(); |
183 | 183 | // then add extra event data via hooks |
184 | - add_action( 'loop_start', array( 'EED_Event_Single', 'loop_start' )); |
|
185 | - add_filter( 'get_the_excerpt', array( 'EED_Event_Single', 'get_the_excerpt' ), 1, 1 ); |
|
186 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
187 | - add_action( 'loop_end', array( 'EED_Event_Single', 'loop_end' )); |
|
184 | + add_action('loop_start', array('EED_Event_Single', 'loop_start')); |
|
185 | + add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1); |
|
186 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
187 | + add_action('loop_end', array('EED_Event_Single', 'loop_end')); |
|
188 | 188 | // don't display entry meta because the existing theme will take car of that |
189 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
189 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
190 | 190 | } |
191 | 191 | return $template; |
192 | 192 | } |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | * @param array $wp_query_array an array containing the WP_Query object |
201 | 201 | * @return void |
202 | 202 | */ |
203 | - public static function loop_start( $wp_query_array ) { |
|
203 | + public static function loop_start($wp_query_array) { |
|
204 | 204 | global $post; |
205 | - do_action( 'AHEE_event_details_before_post', $post, $wp_query_array ); |
|
205 | + do_action('AHEE_event_details_before_post', $post, $wp_query_array); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | * @param int $id |
216 | 216 | * @return string |
217 | 217 | */ |
218 | - public static function the_title( $title = '', $id = 0 ) { |
|
218 | + public static function the_title($title = '', $id = 0) { |
|
219 | 219 | global $post; |
220 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
220 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | * @param string $excerpt |
230 | 230 | * @return string |
231 | 231 | */ |
232 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
232 | + public static function get_the_excerpt($excerpt = '') { |
|
233 | 233 | EED_Event_Single::$using_get_the_excerpt = true; |
234 | - add_filter( 'wp_trim_excerpt', array( 'EED_Event_Single', 'end_get_the_excerpt' ), 999, 1 ); |
|
234 | + add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1); |
|
235 | 235 | return $excerpt; |
236 | 236 | } |
237 | 237 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @param string $text |
245 | 245 | * @return string |
246 | 246 | */ |
247 | - public static function end_get_the_excerpt( $text = '' ) { |
|
247 | + public static function end_get_the_excerpt($text = '') { |
|
248 | 248 | EED_Event_Single::$using_get_the_excerpt = false; |
249 | 249 | return $text; |
250 | 250 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @param string $content |
259 | 259 | * @return string |
260 | 260 | */ |
261 | - public static function event_details( $content ) { |
|
261 | + public static function event_details($content) { |
|
262 | 262 | global $post; |
263 | 263 | static $current_post_ID = 0; |
264 | 264 | if ( |
@@ -273,15 +273,15 @@ discard block |
||
273 | 273 | // We want to allow those plugins to still do their thing and have access to our content, but depending on |
274 | 274 | // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
275 | 275 | // so the following allows this filter to be applied multiple times, but only once for real |
276 | - $current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0; |
|
277 | - if ( EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order ) { |
|
276 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
277 | + if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) { |
|
278 | 278 | // we need to first remove this callback from being applied to the_content() |
279 | 279 | // (otherwise it will recurse and blow up the interweb) |
280 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
280 | + remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
281 | 281 | EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts(); |
282 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
283 | - $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters( $content ); |
|
284 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
282 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
283 | + $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content); |
|
284 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
285 | 285 | } else { |
286 | 286 | $content = EED_Event_Single::use_filterable_display_order(); |
287 | 287 | } |
@@ -302,19 +302,19 @@ discard block |
||
302 | 302 | // it uses the_content() for displaying the $post->post_content |
303 | 303 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
304 | 304 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
305 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
305 | + remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
306 | 306 | //now add additional content |
307 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110, 1 ); |
|
308 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120, 1 ); |
|
309 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130, 1 ); |
|
310 | - do_action( 'AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters' ); |
|
307 | + add_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110, 1); |
|
308 | + add_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120, 1); |
|
309 | + add_filter('the_content', array('EED_Event_Single', 'event_venues'), 130, 1); |
|
310 | + do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters'); |
|
311 | 311 | // now load our template |
312 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
312 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
313 | 313 | //now add our filter back in, plus some others |
314 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
315 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110 ); |
|
316 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120 ); |
|
317 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130 ); |
|
314 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
315 | + remove_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110); |
|
316 | + remove_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120); |
|
317 | + remove_filter('the_content', array('EED_Event_Single', 'event_venues'), 130); |
|
318 | 318 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
319 | 319 | return $content; |
320 | 320 | } |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | * @param string $content |
329 | 329 | * @return string |
330 | 330 | */ |
331 | - public static function event_datetimes( $content ) { |
|
332 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
331 | + public static function event_datetimes($content) { |
|
332 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | * @param string $content |
342 | 342 | * @return string |
343 | 343 | */ |
344 | - public static function event_tickets( $content ) { |
|
345 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
344 | + public static function event_tickets($content) { |
|
345 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | * @param string $content |
355 | 355 | * @return string |
356 | 356 | */ |
357 | - public static function event_venue( $content ) { |
|
358 | - return EED_Event_Single::event_venues( $content ); |
|
357 | + public static function event_venue($content) { |
|
358 | + return EED_Event_Single::event_venues($content); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | * @param string $content |
368 | 368 | * @return string |
369 | 369 | */ |
370 | - public static function event_venues( $content ) { |
|
371 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
370 | + public static function event_venues($content) { |
|
371 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | |
@@ -380,9 +380,9 @@ discard block |
||
380 | 380 | * @param array $wp_query_array an array containing the WP_Query object |
381 | 381 | * @return void |
382 | 382 | */ |
383 | - public static function loop_end( $wp_query_array ) { |
|
383 | + public static function loop_end($wp_query_array) { |
|
384 | 384 | global $post; |
385 | - do_action( 'AHEE_event_details_after_post', $post, $wp_query_array ); |
|
385 | + do_action('AHEE_event_details_after_post', $post, $wp_query_array); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -395,18 +395,18 @@ discard block |
||
395 | 395 | */ |
396 | 396 | public function wp_enqueue_scripts() { |
397 | 397 | // get some style |
398 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && apply_filters( 'FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE )) { |
|
399 | - EE_Registry::instance()->load_helper( 'File' ); |
|
398 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE)) { |
|
399 | + EE_Registry::instance()->load_helper('File'); |
|
400 | 400 | // first check uploads folder |
401 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
402 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
401 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
402 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
403 | 403 | } else { |
404 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
404 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
405 | 405 | } |
406 | - wp_enqueue_script( $this->theme ); |
|
407 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
408 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
409 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
406 | + wp_enqueue_script($this->theme); |
|
407 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
408 | + EE_Registry::instance()->load_helper('Maps'); |
|
409 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
410 | 410 | } |
411 | 411 | } |
412 | 412 | } |
@@ -425,12 +425,12 @@ discard block |
||
425 | 425 | * @return bool |
426 | 426 | */ |
427 | 427 | public static function display_venue() { |
428 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
428 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
429 | 429 | /** @type EE_Event_Single_Config $config */ |
430 | 430 | $config = EED_Event_Single::instance()->config(); |
431 | - $display_venue= isset( $config->display_venue ) ? $config->display_venue : TRUE; |
|
431 | + $display_venue = isset($config->display_venue) ? $config->display_venue : TRUE; |
|
432 | 432 | $venue_name = EEH_Venue_View::venue_name(); |
433 | - return $display_venue && ! empty( $venue_name ) ? TRUE : FALSE; |
|
433 | + return $display_venue && ! empty($venue_name) ? TRUE : FALSE; |
|
434 | 434 | } |
435 | 435 | |
436 | 436 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return EED_Events_Archive |
44 | 44 | */ |
45 | 45 | public static function instance() { |
46 | - return parent::get_instance( __CLASS__ ); |
|
46 | + return parent::get_instance(__CLASS__); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * @return void |
56 | 56 | */ |
57 | 57 | public static function set_hooks() { |
58 | - EE_Config::register_route( EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run' ); |
|
59 | - EE_Config::register_route( 'event_list', 'Events_Archive', 'event_list' ); |
|
60 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
58 | + EE_Config::register_route(EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run'); |
|
59 | + EE_Config::register_route('event_list', 'Events_Archive', 'event_list'); |
|
60 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | public static function set_hooks_admin() { |
70 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
70 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | public static function set_definitions() { |
83 | - define( 'EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
84 | - define( 'EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
83 | + define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
84 | + define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return \EE_Events_Archive_Config |
93 | 93 | */ |
94 | - protected function set_config(){ |
|
95 | - $this->set_config_section( 'template_settings' ); |
|
96 | - $this->set_config_class( 'EE_Events_Archive_Config' ); |
|
97 | - $this->set_config_name( 'EED_Events_Archive' ); |
|
94 | + protected function set_config() { |
|
95 | + $this->set_config_section('template_settings'); |
|
96 | + $this->set_config_class('EE_Events_Archive_Config'); |
|
97 | + $this->set_config_name('EED_Events_Archive'); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -106,35 +106,35 @@ discard block |
||
106 | 106 | * @param \EE_Events_Archive_Config $config |
107 | 107 | * @return \EE_Template_Part_Manager |
108 | 108 | */ |
109 | - public function initialize_template_parts( EE_Events_Archive_Config $config = null ) { |
|
109 | + public function initialize_template_parts(EE_Events_Archive_Config $config = null) { |
|
110 | 110 | $config = $config instanceof EE_Events_Archive_Config ? $config : $this->config(); |
111 | 111 | EEH_Autoloader::instance()->register_template_part_autoloaders(); |
112 | 112 | $template_parts = new EE_Template_Part_Manager(); |
113 | 113 | $template_parts->add_template_part( |
114 | 114 | 'tickets', |
115 | - __( 'Ticket Selector', 'event_espresso' ), |
|
115 | + __('Ticket Selector', 'event_espresso'), |
|
116 | 116 | 'content-espresso_events-tickets.php', |
117 | 117 | $config->display_order_tickets |
118 | 118 | ); |
119 | 119 | $template_parts->add_template_part( |
120 | 120 | 'datetimes', |
121 | - __( 'Dates and Times', 'event_espresso' ), |
|
121 | + __('Dates and Times', 'event_espresso'), |
|
122 | 122 | 'content-espresso_events-datetimes.php', |
123 | 123 | $config->display_order_datetimes |
124 | 124 | ); |
125 | 125 | $template_parts->add_template_part( |
126 | 126 | 'event', |
127 | - __( 'Event Description', 'event_espresso' ), |
|
127 | + __('Event Description', 'event_espresso'), |
|
128 | 128 | 'content-espresso_events-details.php', |
129 | 129 | $config->display_order_event |
130 | 130 | ); |
131 | 131 | $template_parts->add_template_part( |
132 | 132 | 'venue', |
133 | - __( 'Venue Information', 'event_espresso' ), |
|
133 | + __('Venue Information', 'event_espresso'), |
|
134 | 134 | 'content-espresso_events-venues.php', |
135 | 135 | $config->display_order_venue |
136 | 136 | ); |
137 | - do_action( 'AHEE__EED_Event_Archive__initialize_template_parts', $template_parts ); |
|
137 | + do_action('AHEE__EED_Event_Archive__initialize_template_parts', $template_parts); |
|
138 | 138 | return $template_parts; |
139 | 139 | } |
140 | 140 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @param WP $WP |
148 | 148 | * @return void |
149 | 149 | */ |
150 | - public function run( $WP ) { |
|
151 | - do_action( 'AHEE__EED_Events_Archive__before_run' ); |
|
150 | + public function run($WP) { |
|
151 | + do_action('AHEE__EED_Events_Archive__before_run'); |
|
152 | 152 | // ensure valid EE_Events_Archive_Config() object exists |
153 | 153 | $this->set_config(); |
154 | 154 | /** @type EE_Events_Archive_Config $config */ |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | // load other required components |
157 | 157 | $this->load_event_list_assets(); |
158 | 158 | // filter the WP posts_join, posts_where, and posts_orderby SQL clauses |
159 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
159 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
160 | 160 | //add query filters |
161 | 161 | EEH_Event_Query::add_query_filters(); |
162 | 162 | // set params that will get used by the filters |
163 | 163 | EEH_Event_Query::set_query_params( |
164 | - '', // month |
|
165 | - '', // category |
|
166 | - $config->display_expired_events, // show_expired |
|
167 | - 'start_date', // orderby |
|
164 | + '', // month |
|
165 | + '', // category |
|
166 | + $config->display_expired_events, // show_expired |
|
167 | + 'start_date', // orderby |
|
168 | 168 | 'ASC' // sort |
169 | 169 | ); |
170 | 170 | // check what template is loaded |
171 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
171 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -200,30 +200,30 @@ discard block |
||
200 | 200 | * @param string $template |
201 | 201 | * @return string |
202 | 202 | */ |
203 | - public function template_include( $template = '' ) { |
|
203 | + public function template_include($template = '') { |
|
204 | 204 | // don't add content filter for dedicated EE child themes or private posts |
205 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
206 | - if ( ! EEH_Template::is_espresso_theme() ) { |
|
205 | + EE_Registry::instance()->load_helper('Template'); |
|
206 | + if ( ! EEH_Template::is_espresso_theme()) { |
|
207 | 207 | /** @type EE_Events_Archive_Config $config */ |
208 | 208 | $config = $this->config(); |
209 | 209 | // add status banner ? |
210 | - if ( $config->display_status_banner ) { |
|
211 | - add_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 ); |
|
210 | + if ($config->display_status_banner) { |
|
211 | + add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
212 | 212 | } |
213 | 213 | // if NOT a custom template |
214 | - if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' ) { |
|
214 | + if (EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php') { |
|
215 | 215 | // don't display entry meta because the existing theme will take care of that |
216 | - add_filter( 'FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true' ); |
|
216 | + add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true'); |
|
217 | 217 | // load functions.php file for the theme (loaded by WP if using child theme) |
218 | 218 | EEH_Template::load_espresso_theme_functions(); |
219 | 219 | // because we don't know if the theme is using the_excerpt() |
220 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
220 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
221 | 221 | // or the_content |
222 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
222 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
223 | 223 | // and just in case they are running get_the_excerpt() which DESTROYS things |
224 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
224 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
225 | 225 | // don't display entry meta because the existing theme will take care of that |
226 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
226 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | return $template; |
@@ -238,17 +238,17 @@ discard block |
||
238 | 238 | * @param string $excerpt |
239 | 239 | * @return string |
240 | 240 | */ |
241 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
242 | - if ( post_password_required() ) { |
|
241 | + public static function get_the_excerpt($excerpt = '') { |
|
242 | + if (post_password_required()) { |
|
243 | 243 | return $excerpt; |
244 | 244 | } |
245 | - if ( apply_filters( 'FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false ) ) { |
|
246 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
247 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
248 | - $excerpt = EED_Events_Archive::event_details( $excerpt ); |
|
245 | + if (apply_filters('FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false)) { |
|
246 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
247 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
248 | + $excerpt = EED_Events_Archive::event_details($excerpt); |
|
249 | 249 | } else { |
250 | 250 | EED_Events_Archive::$using_get_the_excerpt = true; |
251 | - add_filter( 'wp_trim_excerpt', array( 'EED_Events_Archive', 'end_get_the_excerpt' ), 999, 1 ); |
|
251 | + add_filter('wp_trim_excerpt', array('EED_Events_Archive', 'end_get_the_excerpt'), 999, 1); |
|
252 | 252 | } |
253 | 253 | return $excerpt; |
254 | 254 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @param string $text |
263 | 263 | * @return string |
264 | 264 | */ |
265 | - public static function end_get_the_excerpt( $text = '' ) { |
|
265 | + public static function end_get_the_excerpt($text = '') { |
|
266 | 266 | EED_Events_Archive::$using_get_the_excerpt = false; |
267 | 267 | return $text; |
268 | 268 | } |
@@ -277,10 +277,10 @@ discard block |
||
277 | 277 | * @param string $id |
278 | 278 | * @return string |
279 | 279 | */ |
280 | - public static function the_title( $title = '', $id = '' ) { |
|
280 | + public static function the_title($title = '', $id = '') { |
|
281 | 281 | global $post; |
282 | - if ( $post instanceof WP_Post ) { |
|
283 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
282 | + if ($post instanceof WP_Post) { |
|
283 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
284 | 284 | } |
285 | 285 | return $title; |
286 | 286 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @param string $content |
295 | 295 | * @return string |
296 | 296 | */ |
297 | - public static function event_details( $content ) { |
|
297 | + public static function event_details($content) { |
|
298 | 298 | global $post; |
299 | 299 | static $current_post_ID = 0; |
300 | 300 | if ( |
@@ -303,8 +303,8 @@ discard block |
||
303 | 303 | && ! EED_Events_Archive::$using_get_the_excerpt |
304 | 304 | && ! post_password_required() |
305 | 305 | && ( |
306 | - apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', false ) |
|
307 | - || ! apply_filters( 'FHEE__content_espresso_events__template_loaded', false ) |
|
306 | + apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', false) |
|
307 | + || ! apply_filters('FHEE__content_espresso_events__template_loaded', false) |
|
308 | 308 | ) |
309 | 309 | ) { |
310 | 310 | // Set current post ID to prevent showing content twice, but only if headers have definitely been sent. |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | // We want to allow those plugins to still do their thing and have access to our content, but depending on |
314 | 314 | // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
315 | 315 | // so the following allows this filter to be applied multiple times, but only once for real |
316 | - $current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0; |
|
317 | - if ( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order ) { |
|
316 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
317 | + if (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order) { |
|
318 | 318 | $content = \EED_Events_Archive::use_sortable_display_order(); |
319 | 319 | } else { |
320 | 320 | $content = \EED_Events_Archive::use_filterable_display_order(); |
@@ -333,20 +333,20 @@ discard block |
||
333 | 333 | */ |
334 | 334 | protected static function use_sortable_display_order() { |
335 | 335 | // no further password checks required atm |
336 | - add_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' ); |
|
336 | + add_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
337 | 337 | // we need to first remove this callback from being applied to the_content() or the_excerpt() (otherwise it will recurse and blow up the interweb) |
338 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
339 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
340 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
338 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
339 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
340 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
341 | 341 | // now add additional content depending on whether event is using the_excerpt() or the_content() |
342 | 342 | EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts(); |
343 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
344 | - $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters( $content ); |
|
343 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
344 | + $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters($content); |
|
345 | 345 | // re-add our main filters (or else the next event won't have them) |
346 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
347 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
348 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
349 | - remove_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' ); |
|
346 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
347 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
348 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
349 | + remove_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
350 | 350 | return $content; |
351 | 351 | } |
352 | 352 | |
@@ -361,22 +361,22 @@ discard block |
||
361 | 361 | protected static function use_filterable_display_order() { |
362 | 362 | // we need to first remove this callback from being applied to the_content() |
363 | 363 | // (otherwise it will recurse and blow up the interweb) |
364 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
365 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
366 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
364 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
365 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
366 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
367 | 367 | //now add additional content depending on whether event is using the_excerpt() or the_content() |
368 | 368 | EED_Events_Archive::_add_additional_excerpt_filters(); |
369 | 369 | EED_Events_Archive::_add_additional_content_filters(); |
370 | - do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters' ); |
|
370 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters'); |
|
371 | 371 | // now load our template |
372 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
372 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
373 | 373 | // re-add our main filters (or else the next event won't have them) |
374 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
375 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
376 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
374 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
375 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
376 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
377 | 377 | // but remove the other filters so that they don't get applied to the next post |
378 | 378 | EED_Events_Archive::_remove_additional_events_archive_filters(); |
379 | - do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters' ); |
|
379 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters'); |
|
380 | 380 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
381 | 381 | //return ! empty( $template ) ? $template : $content; |
382 | 382 | return $content; |
@@ -391,11 +391,11 @@ discard block |
||
391 | 391 | * @param string $content |
392 | 392 | * @return string |
393 | 393 | */ |
394 | - public static function event_datetimes( $content ) { |
|
395 | - if ( post_password_required() ) { |
|
394 | + public static function event_datetimes($content) { |
|
395 | + if (post_password_required()) { |
|
396 | 396 | return $content; |
397 | 397 | } |
398 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
398 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | /** |
@@ -405,11 +405,11 @@ discard block |
||
405 | 405 | * @param string $content |
406 | 406 | * @return string |
407 | 407 | */ |
408 | - public static function event_tickets( $content ) { |
|
409 | - if ( post_password_required() ) { |
|
408 | + public static function event_tickets($content) { |
|
409 | + if (post_password_required()) { |
|
410 | 410 | return $content; |
411 | 411 | } |
412 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
412 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | * @param string $content |
422 | 422 | * @return string |
423 | 423 | */ |
424 | - public static function event_venue( $content ) { |
|
425 | - return EED_Events_Archive::event_venues( $content ); |
|
424 | + public static function event_venue($content) { |
|
425 | + return EED_Events_Archive::event_venues($content); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | /** |
@@ -432,11 +432,11 @@ discard block |
||
432 | 432 | * @param string $content |
433 | 433 | * @return string |
434 | 434 | */ |
435 | - public static function event_venues( $content ) { |
|
436 | - if ( post_password_required() ) { |
|
435 | + public static function event_venues($content) { |
|
436 | + if (post_password_required()) { |
|
437 | 437 | return $content; |
438 | 438 | } |
439 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
439 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | |
@@ -448,9 +448,9 @@ discard block |
||
448 | 448 | * @return void |
449 | 449 | */ |
450 | 450 | private static function _add_additional_excerpt_filters() { |
451 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
452 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
453 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
451 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
452 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
453 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | |
@@ -462,9 +462,9 @@ discard block |
||
462 | 462 | * @return void |
463 | 463 | */ |
464 | 464 | private static function _add_additional_content_filters() { |
465 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
466 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
467 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
465 | + add_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
466 | + add_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
467 | + add_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | |
@@ -476,12 +476,12 @@ discard block |
||
476 | 476 | * @return void |
477 | 477 | */ |
478 | 478 | private static function _remove_additional_events_archive_filters() { |
479 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
480 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
481 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
482 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
483 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
484 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
479 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
480 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120); |
|
481 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130); |
|
482 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
483 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120); |
|
484 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | |
@@ -494,17 +494,17 @@ discard block |
||
494 | 494 | */ |
495 | 495 | public static function remove_all_events_archive_filters() { |
496 | 496 | //remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
497 | - remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100 ); |
|
498 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
499 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
500 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
501 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
502 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
503 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
504 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
505 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
497 | + remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 100); |
|
498 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
499 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
500 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120); |
|
501 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130); |
|
502 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
503 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
504 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120); |
|
505 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130); |
|
506 | 506 | // don't display entry meta because the existing theme will take care of that |
507 | - remove_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
507 | + remove_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -519,15 +519,15 @@ discard block |
||
519 | 519 | * @return void |
520 | 520 | */ |
521 | 521 | public function load_event_list_assets() { |
522 | - do_action( 'AHEE__EED_Events_Archive__before_load_assets' ); |
|
523 | - add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
|
524 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
525 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
526 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
527 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
528 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
522 | + do_action('AHEE__EED_Events_Archive__before_load_assets'); |
|
523 | + add_filter('FHEE_load_EE_Session', '__return_true'); |
|
524 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
525 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
526 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
527 | + EE_Registry::instance()->load_helper('Maps'); |
|
528 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
529 | 529 | } |
530 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
530 | + EE_Registry::instance()->load_helper('Event_View'); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | |
@@ -543,14 +543,14 @@ discard block |
||
543 | 543 | */ |
544 | 544 | public function wp_enqueue_scripts() { |
545 | 545 | // get some style |
546 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) { |
|
546 | + if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) { |
|
547 | 547 | // first check uploads folder |
548 | - EE_Registry::instance()->load_helper( 'File' ); |
|
549 | - if ( EEH_File::is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
550 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
548 | + EE_Registry::instance()->load_helper('File'); |
|
549 | + if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
550 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
551 | 551 | } else { |
552 | 552 | } |
553 | - wp_enqueue_style( $this->theme ); |
|
553 | + wp_enqueue_style($this->theme); |
|
554 | 554 | |
555 | 555 | } |
556 | 556 | } |
@@ -568,8 +568,8 @@ discard block |
||
568 | 568 | */ |
569 | 569 | public static function template_settings_form() { |
570 | 570 | $template_settings = EE_Registry::instance()->CFG->template_settings; |
571 | - $template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
572 | - $template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive ); |
|
571 | + $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
572 | + $template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive); |
|
573 | 573 | $events_archive_settings = array( |
574 | 574 | 'display_status_banner' => 0, |
575 | 575 | 'display_description' => 1, |
@@ -578,8 +578,8 @@ discard block |
||
578 | 578 | 'display_venue' => 0, |
579 | 579 | 'display_expired_events' => 0 |
580 | 580 | ); |
581 | - $events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive ); |
|
582 | - EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings ); |
|
581 | + $events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive); |
|
582 | + EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings); |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | |
@@ -595,16 +595,16 @@ discard block |
||
595 | 595 | * @param EE_Request_Handler $REQ |
596 | 596 | * @return EE_Template_Config |
597 | 597 | */ |
598 | - public static function update_template_settings( $CFG, $REQ ) { |
|
598 | + public static function update_template_settings($CFG, $REQ) { |
|
599 | 599 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
600 | 600 | // unless we are resetting the config... |
601 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
602 | - $CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
603 | - $CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
604 | - $CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
605 | - $CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
606 | - $CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
607 | - $CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; } |
|
601 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
602 | + $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
603 | + $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
604 | + $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
605 | + $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
606 | + $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
607 | + $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; } |
|
608 | 608 | return $CFG; |
609 | 609 | } |
610 | 610 | |
@@ -617,10 +617,10 @@ discard block |
||
617 | 617 | * @param string $extra_class |
618 | 618 | * @return string |
619 | 619 | */ |
620 | - public static function event_list_css( $extra_class = '' ) { |
|
621 | - $event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array(); |
|
620 | + public static function event_list_css($extra_class = '') { |
|
621 | + $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
622 | 622 | $event_list_css[] = 'espresso-event-list-event'; |
623 | - return implode( ' ', $event_list_css ); |
|
623 | + return implode(' ', $event_list_css); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | |
@@ -647,9 +647,9 @@ discard block |
||
647 | 647 | * @param $value |
648 | 648 | * @return bool |
649 | 649 | */ |
650 | - public static function display_description( $value ) { |
|
650 | + public static function display_description($value) { |
|
651 | 651 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
652 | - $display_description= isset( $config->display_description ) ? $config->display_description : 1; |
|
652 | + $display_description = isset($config->display_description) ? $config->display_description : 1; |
|
653 | 653 | return $display_description === $value ? TRUE : FALSE; |
654 | 654 | } |
655 | 655 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | */ |
663 | 663 | public static function display_ticket_selector() { |
664 | 664 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
665 | - return isset( $config->display_ticket_selector ) && $config->display_ticket_selector ? TRUE : FALSE; |
|
665 | + return isset($config->display_ticket_selector) && $config->display_ticket_selector ? TRUE : FALSE; |
|
666 | 666 | } |
667 | 667 | |
668 | 668 | |
@@ -674,9 +674,9 @@ discard block |
||
674 | 674 | * @return bool |
675 | 675 | */ |
676 | 676 | public static function display_venue() { |
677 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
677 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
678 | 678 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
679 | - return isset( $config->display_venue ) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
679 | + return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | */ |
689 | 689 | public static function display_datetimes() { |
690 | 690 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
691 | - return isset( $config->display_datetimes ) && $config->display_datetimes ? TRUE : FALSE; |
|
691 | + return isset($config->display_datetimes) && $config->display_datetimes ? TRUE : FALSE; |
|
692 | 692 | } |
693 | 693 | |
694 | 694 | |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | * @return string |
704 | 704 | */ |
705 | 705 | public static function event_list_title() { |
706 | - return apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' )); |
|
706 | + return apply_filters('FHEE__archive_espresso_events_template__upcoming_events_h1', __('Upcoming Events', 'event_espresso')); |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | |
@@ -712,11 +712,11 @@ discard block |
||
712 | 712 | /** |
713 | 713 | * @since 4.4.0 |
714 | 714 | */ |
715 | - public static function _doing_it_wrong_notice( $function = '' ) { |
|
715 | + public static function _doing_it_wrong_notice($function = '') { |
|
716 | 716 | EE_Error::doing_it_wrong( |
717 | 717 | __FUNCTION__, |
718 | 718 | sprintf( |
719 | - __( 'EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso' ), |
|
719 | + __('EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso'), |
|
720 | 720 | $function, |
721 | 721 | '<br />', |
722 | 722 | '4.6.0' |
@@ -732,107 +732,107 @@ discard block |
||
732 | 732 | * @since 4.4.0 |
733 | 733 | */ |
734 | 734 | public function get_post_data() { |
735 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
735 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
736 | 736 | EEH_Event_Query::set_query_params(); |
737 | 737 | } |
738 | 738 | /** |
739 | 739 | * @deprecated |
740 | 740 | * @since 4.4.0 |
741 | 741 | */ |
742 | - public function posts_fields( $SQL, WP_Query $wp_query ) { |
|
743 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
744 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
745 | - return EEH_Event_Query::posts_fields( $SQL, $wp_query ); |
|
742 | + public function posts_fields($SQL, WP_Query $wp_query) { |
|
743 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
744 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
745 | + return EEH_Event_Query::posts_fields($SQL, $wp_query); |
|
746 | 746 | } |
747 | 747 | /** |
748 | 748 | * @deprecated |
749 | 749 | * @since 4.4.0 |
750 | 750 | */ |
751 | - public static function posts_fields_sql_for_orderby( $orderby_params = array() ) { |
|
752 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
753 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
754 | - return EEH_Event_Query::posts_fields_sql_for_orderby( $orderby_params ); |
|
751 | + public static function posts_fields_sql_for_orderby($orderby_params = array()) { |
|
752 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
753 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
754 | + return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params); |
|
755 | 755 | } |
756 | 756 | /** |
757 | 757 | * @deprecated |
758 | 758 | * @since 4.4.0 |
759 | 759 | */ |
760 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
761 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
762 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
763 | - return EEH_Event_Query::posts_join( $SQL, $wp_query ); |
|
760 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
761 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
762 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
763 | + return EEH_Event_Query::posts_join($SQL, $wp_query); |
|
764 | 764 | } |
765 | 765 | /** |
766 | 766 | * @deprecated |
767 | 767 | * @since 4.4.0 |
768 | 768 | */ |
769 | - public static function posts_join_sql_for_terms( $join_terms = NULL ) { |
|
770 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
771 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
772 | - return EEH_Event_Query::posts_join_sql_for_terms( $join_terms ); |
|
769 | + public static function posts_join_sql_for_terms($join_terms = NULL) { |
|
770 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
771 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
772 | + return EEH_Event_Query::posts_join_sql_for_terms($join_terms); |
|
773 | 773 | } |
774 | 774 | /** |
775 | 775 | * @deprecated |
776 | 776 | * @since 4.4.0 |
777 | 777 | */ |
778 | - public static function posts_join_for_orderby( $orderby_params = array() ) { |
|
779 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
780 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
781 | - return EEH_Event_Query::posts_join_for_orderby( $orderby_params ); |
|
778 | + public static function posts_join_for_orderby($orderby_params = array()) { |
|
779 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
780 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
781 | + return EEH_Event_Query::posts_join_for_orderby($orderby_params); |
|
782 | 782 | } |
783 | 783 | /** |
784 | 784 | * @deprecated |
785 | 785 | * @since 4.4.0 |
786 | 786 | */ |
787 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
788 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
789 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
790 | - return EEH_Event_Query::posts_where( $SQL, $wp_query ); |
|
787 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
788 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
789 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
790 | + return EEH_Event_Query::posts_where($SQL, $wp_query); |
|
791 | 791 | } |
792 | 792 | /** |
793 | 793 | * @deprecated |
794 | 794 | * @since 4.4.0 |
795 | 795 | */ |
796 | - public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) { |
|
797 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
798 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
799 | - return EEH_Event_Query::posts_where_sql_for_show_expired( $show_expired ); |
|
796 | + public static function posts_where_sql_for_show_expired($show_expired = FALSE) { |
|
797 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
798 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
799 | + return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired); |
|
800 | 800 | } |
801 | 801 | /** |
802 | 802 | * @deprecated |
803 | 803 | * @since 4.4.0 |
804 | 804 | */ |
805 | - public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) { |
|
806 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
807 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
808 | - return EEH_Event_Query::posts_where_sql_for_event_category_slug( $event_category_slug ); |
|
805 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) { |
|
806 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
807 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
808 | + return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug); |
|
809 | 809 | } |
810 | 810 | /** |
811 | 811 | * @deprecated |
812 | 812 | * @since 4.4.0 |
813 | 813 | */ |
814 | - public static function posts_where_sql_for_event_list_month( $month = NULL ) { |
|
815 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
816 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
817 | - return EEH_Event_Query::posts_where_sql_for_event_list_month( $month ); |
|
814 | + public static function posts_where_sql_for_event_list_month($month = NULL) { |
|
815 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
816 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
817 | + return EEH_Event_Query::posts_where_sql_for_event_list_month($month); |
|
818 | 818 | } |
819 | 819 | /** |
820 | 820 | * @deprecated |
821 | 821 | * @since 4.4.0 |
822 | 822 | */ |
823 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
824 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
825 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
826 | - return EEH_Event_Query::posts_orderby( $SQL, $wp_query ); |
|
823 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
824 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
825 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
826 | + return EEH_Event_Query::posts_orderby($SQL, $wp_query); |
|
827 | 827 | } |
828 | 828 | /** |
829 | 829 | * @deprecated |
830 | 830 | * @since 4.4.0 |
831 | 831 | */ |
832 | - public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
|
833 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
834 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
835 | - return EEH_Event_Query::posts_orderby_sql( $orderby_params, $sort ); |
|
832 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') { |
|
833 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
834 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
835 | + return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort); |
|
836 | 836 | } |
837 | 837 | |
838 | 838 | |
@@ -863,8 +863,8 @@ discard block |
||
863 | 863 | * @param string $extra_class |
864 | 864 | * @return string |
865 | 865 | */ |
866 | -function espresso_event_list_css( $extra_class = '' ) { |
|
867 | - return EED_Events_Archive::event_list_css( $extra_class ); |
|
866 | +function espresso_event_list_css($extra_class = '') { |
|
867 | + return EED_Events_Archive::event_list_css($extra_class); |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | /** |
@@ -878,14 +878,14 @@ discard block |
||
878 | 878 | * @return bool |
879 | 879 | */ |
880 | 880 | function espresso_display_full_description_in_event_list() { |
881 | - return EED_Events_Archive::display_description( 2 ); |
|
881 | + return EED_Events_Archive::display_description(2); |
|
882 | 882 | } |
883 | 883 | |
884 | 884 | /** |
885 | 885 | * @return bool |
886 | 886 | */ |
887 | 887 | function espresso_display_excerpt_in_event_list() { |
888 | - return EED_Events_Archive::display_description( 1 ); |
|
888 | + return EED_Events_Archive::display_description(1); |
|
889 | 889 | } |
890 | 890 | |
891 | 891 | /** |
@@ -3,18 +3,18 @@ |
||
3 | 3 | * Field to only allow tags that are normally allowed on post_content: |
4 | 4 | * address,a,abbr,acronym,area,article,aside,b,big,blockquote,br,button,caption,cite,code,col,del,dd,dfn,details,div,dl,dt,em,fieldset,figure,figcaption,font,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,img,ins,kbd,label,legend,li,map,mark,menu,nav,p,pre,q,s,samp,span,section,small,strike,strong,sub,summary,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,u,ul,ol,var |
5 | 5 | */ |
6 | -class EE_Post_Content_Field extends EE_Full_HTML_Field{ |
|
6 | +class EE_Post_Content_Field extends EE_Full_HTML_Field { |
|
7 | 7 | /** |
8 | 8 | * removes all tags which a WP Post wouldn't allow in its content normally |
9 | 9 | * @param string $value_inputted_for_field_on_model_object |
10 | 10 | * @return string |
11 | 11 | */ |
12 | 12 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
13 | - $value_with_select_tags = wp_kses("$value_inputted_for_field_on_model_object",wp_kses_allowed_html( 'post' )); |
|
13 | + $value_with_select_tags = wp_kses("$value_inputted_for_field_on_model_object", wp_kses_allowed_html('post')); |
|
14 | 14 | return parent::prepare_for_set($value_with_select_tags); |
15 | 15 | } |
16 | 16 | |
17 | - function prepare_for_set_from_db($value_found_in_db_for_model_object){ |
|
17 | + function prepare_for_set_from_db($value_found_in_db_for_model_object) { |
|
18 | 18 | return $value_found_in_db_for_model_object; |
19 | 19 | } |
20 | 20 | } |
21 | 21 | \ No newline at end of file |