@@ -111,7 +111,7 @@ |
||
111 | 111 | //we only care to do this for frontend reads and when the user can't edit the item |
112 | 112 | if ( |
113 | 113 | $request_type !== \EEM_Base::caps_read |
114 | - || $model->exists( |
|
114 | + || $model->exists( |
|
115 | 115 | $model->alter_query_params_to_restrict_by_ID( |
116 | 116 | $primary_key_string, |
117 | 117 | array( |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\libraries\rest_api; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @param string $model_context one of the return values from EEM_Base::valid_cap_contexts() |
24 | 24 | * @return boolean |
25 | 25 | */ |
26 | - public static function current_user_has_partial_access_to( $model, $model_context = \EEM_Base::caps_read ) { |
|
26 | + public static function current_user_has_partial_access_to($model, $model_context = \EEM_Base::caps_read) { |
|
27 | 27 | if ( |
28 | 28 | apply_filters( |
29 | 29 | 'FHEE__Capabilities__current_user_has_partial_access_to__override_begin', |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | ) { |
35 | 35 | return true; |
36 | 36 | } |
37 | - foreach ( $model->caps_missing( $model_context ) as $capability_name => $restriction_obj ) { |
|
38 | - if ( $restriction_obj instanceof \EE_Return_None_Where_Conditions ) { |
|
37 | + foreach ($model->caps_missing($model_context) as $capability_name => $restriction_obj) { |
|
38 | + if ($restriction_obj instanceof \EE_Return_None_Where_Conditions) { |
|
39 | 39 | return false; |
40 | 40 | } |
41 | 41 | } |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @param string $request_type one of the constants on WP_JSON_Server |
63 | 63 | * @return array |
64 | 64 | */ |
65 | - public static function get_missing_permissions( $model, $request_type = \EEM_Base::caps_read ) { |
|
66 | - return $model->caps_missing( $request_type ); |
|
65 | + public static function get_missing_permissions($model, $request_type = \EEM_Base::caps_read) { |
|
66 | + return $model->caps_missing($request_type); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * @param string $model_context one of the return values from EEM_Base::valid_cap_contexts() |
77 | 77 | * @return string |
78 | 78 | */ |
79 | - public static function get_missing_permissions_string( $model, $model_context = \EEM_Base::caps_read ) { |
|
80 | - return implode( ',', array_keys( self::get_missing_permissions( $model, $model_context ) ) ); |
|
79 | + public static function get_missing_permissions_string($model, $model_context = \EEM_Base::caps_read) { |
|
80 | + return implode(',', array_keys(self::get_missing_permissions($model, $model_context))); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | //if they didn't provide the primary key string, we'll just hope we can figure it out |
104 | 104 | //from the entity (although it's preferred client code does it, because the entity might be missing |
105 | 105 | //necessary fields for creating the primary key string, or they could be named differently) |
106 | - if ( $primary_key_string === null ) { |
|
106 | + if ($primary_key_string === null) { |
|
107 | 107 | $primary_key_string = $model->get_index_primary_key_string( |
108 | - $model->deduce_fields_n_values_from_cols_n_values( $entity ) |
|
108 | + $model->deduce_fields_n_values_from_cols_n_values($entity) |
|
109 | 109 | ); |
110 | 110 | } |
111 | 111 | //we only care to do this for frontend reads and when the user can't edit the item |
@@ -123,14 +123,14 @@ discard block |
||
123 | 123 | ) { |
124 | 124 | return $entity; |
125 | 125 | } |
126 | - foreach ( $model->field_settings() as $field_name => $field_obj ) { |
|
126 | + foreach ($model->field_settings() as $field_name => $field_obj) { |
|
127 | 127 | if ( |
128 | - $model_version_info->field_has_rendered_format( $field_obj ) |
|
129 | - && isset( $entity[ $field_name ] ) |
|
130 | - && is_array( $entity[ $field_name ] ) |
|
131 | - && isset( $entity[ $field_name ]['raw'] ) |
|
128 | + $model_version_info->field_has_rendered_format($field_obj) |
|
129 | + && isset($entity[$field_name]) |
|
130 | + && is_array($entity[$field_name]) |
|
131 | + && isset($entity[$field_name]['raw']) |
|
132 | 132 | ) { |
133 | - unset( $entity[ $field_name ]['raw'] ); |
|
133 | + unset($entity[$field_name]['raw']); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | //theoretically we may want to filter out specific fields for specific models |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * @param mixed $data incoming data object|array. Suggested that child classes use type hinting for expected |
267 | 267 | * data object. But here parent will be generic because we don't know what's coming in. |
268 | 268 | */ |
269 | - public function __construct( $data ) { |
|
269 | + public function __construct($data) { |
|
270 | 270 | $this->_data = $data; |
271 | 271 | $this->_setup_data(); |
272 | 272 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * |
289 | 289 | * @return mixed The prepped data for db |
290 | 290 | */ |
291 | - static public function convert_data_for_persistent_storage( $data ) { |
|
291 | + static public function convert_data_for_persistent_storage($data) { |
|
292 | 292 | return $data; |
293 | 293 | } |
294 | 294 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * |
305 | 305 | * @return mixed |
306 | 306 | */ |
307 | - static public function convert_data_from_persistent_storage( $data ) { |
|
307 | + static public function convert_data_from_persistent_storage($data) { |
|
308 | 308 | return $data; |
309 | 309 | } |
310 | 310 | |
@@ -331,8 +331,8 @@ discard block |
||
331 | 331 | protected function _assemble_data() { |
332 | 332 | //verify that reg_objs is set |
333 | 333 | if ( |
334 | - ! is_array( $this->reg_objs ) |
|
335 | - && ! reset( $this->reg_objs ) instanceof EE_Registration |
|
334 | + ! is_array($this->reg_objs) |
|
335 | + && ! reset($this->reg_objs) instanceof EE_Registration |
|
336 | 336 | ) { |
337 | 337 | throw new EE_Error( |
338 | 338 | __( |
@@ -347,84 +347,84 @@ discard block |
||
347 | 347 | $answers = $questions = $attendees = $line_items = $registrations = array(); |
348 | 348 | $total_ticket_count = 0; |
349 | 349 | |
350 | - if ( ! empty( $this->reg_objs ) ) { |
|
350 | + if ( ! empty($this->reg_objs)) { |
|
351 | 351 | $event_attendee_count = array(); |
352 | - foreach ( $this->reg_objs as $reg ) { |
|
352 | + foreach ($this->reg_objs as $reg) { |
|
353 | 353 | |
354 | 354 | if ( |
355 | - $this->_skip_registration_for_processing( $reg ) |
|
355 | + $this->_skip_registration_for_processing($reg) |
|
356 | 356 | ) { |
357 | 357 | continue; |
358 | 358 | } |
359 | 359 | |
360 | 360 | $evt_id = $reg->event_ID(); |
361 | 361 | /** @type EE_Ticket $ticket */ |
362 | - $ticket = $reg->get_first_related( 'Ticket' ); |
|
362 | + $ticket = $reg->get_first_related('Ticket'); |
|
363 | 363 | $relateddatetime = $ticket->datetimes(); |
364 | 364 | $total_ticket_count++; |
365 | - $tickets[ $ticket->ID() ]['ticket'] = $ticket; |
|
366 | - $tickets[ $ticket->ID() ]['count'] = is_array( $tickets[ $ticket->ID() ] ) |
|
367 | - && isset( $tickets[ $ticket->ID() ]['count'] ) |
|
368 | - ? $tickets[ $ticket->ID() ]['count'] + 1 |
|
365 | + $tickets[$ticket->ID()]['ticket'] = $ticket; |
|
366 | + $tickets[$ticket->ID()]['count'] = is_array($tickets[$ticket->ID()]) |
|
367 | + && isset($tickets[$ticket->ID()]['count']) |
|
368 | + ? $tickets[$ticket->ID()]['count'] + 1 |
|
369 | 369 | : 1; |
370 | - $tickets[ $ticket->ID() ]['att_objs'][ $reg->attendee_ID() ] = $reg->attendee(); |
|
371 | - $tickets[ $ticket->ID() ]['dtt_objs'] = $relateddatetime; |
|
372 | - $tickets[ $ticket->ID() ]['reg_objs'][ $reg->ID() ] = $reg; |
|
370 | + $tickets[$ticket->ID()]['att_objs'][$reg->attendee_ID()] = $reg->attendee(); |
|
371 | + $tickets[$ticket->ID()]['dtt_objs'] = $relateddatetime; |
|
372 | + $tickets[$ticket->ID()]['reg_objs'][$reg->ID()] = $reg; |
|
373 | 373 | $event = $reg->event(); |
374 | - $tickets[ $ticket->ID() ]['EE_Event'] = $event; |
|
375 | - $evtcache[ $evt_id ] = $event; |
|
376 | - $eventsetup[ $evt_id ]['reg_objs'][ $reg->ID() ] = $reg; |
|
377 | - $eventsetup[ $evt_id ]['tkt_objs'][ $ticket->ID() ] = $ticket; |
|
378 | - $eventsetup[ $evt_id ]['att_objs'][ $reg->attendee_ID() ] = $reg->attendee(); |
|
379 | - $event_attendee_count[ $evt_id ] = isset( $event_attendee_count[ $evt_id ] ) |
|
380 | - ? $event_attendee_count[ $evt_id ] + 1 |
|
374 | + $tickets[$ticket->ID()]['EE_Event'] = $event; |
|
375 | + $evtcache[$evt_id] = $event; |
|
376 | + $eventsetup[$evt_id]['reg_objs'][$reg->ID()] = $reg; |
|
377 | + $eventsetup[$evt_id]['tkt_objs'][$ticket->ID()] = $ticket; |
|
378 | + $eventsetup[$evt_id]['att_objs'][$reg->attendee_ID()] = $reg->attendee(); |
|
379 | + $event_attendee_count[$evt_id] = isset($event_attendee_count[$evt_id]) |
|
380 | + ? $event_attendee_count[$evt_id] + 1 |
|
381 | 381 | : 0; |
382 | - $attendees[ $reg->attendee_ID() ]['line_ref'][] = $evt_id; |
|
383 | - $attendees[ $reg->attendee_ID() ]['att_obj'] = $reg->attendee(); |
|
384 | - $attendees[ $reg->attendee_ID() ]['reg_objs'][ $reg->ID() ] = $reg; |
|
382 | + $attendees[$reg->attendee_ID()]['line_ref'][] = $evt_id; |
|
383 | + $attendees[$reg->attendee_ID()]['att_obj'] = $reg->attendee(); |
|
384 | + $attendees[$reg->attendee_ID()]['reg_objs'][$reg->ID()] = $reg; |
|
385 | 385 | //$attendees[ $reg->attendee_ID() ]['registration_id'] = $reg->ID(); |
386 | - $attendees[ $reg->attendee_ID() ]['attendee_email'] = $reg->attendee() instanceof EE_Attendee |
|
386 | + $attendees[$reg->attendee_ID()]['attendee_email'] = $reg->attendee() instanceof EE_Attendee |
|
387 | 387 | ? $reg->attendee()->email() |
388 | 388 | : ''; |
389 | - $attendees[ $reg->attendee_ID() ]['tkt_objs'][ $ticket->ID() ] = $ticket; |
|
390 | - $attendees[ $reg->attendee_ID() ]['evt_objs'][ $evt_id ] = $event; |
|
389 | + $attendees[$reg->attendee_ID()]['tkt_objs'][$ticket->ID()] = $ticket; |
|
390 | + $attendees[$reg->attendee_ID()]['evt_objs'][$evt_id] = $event; |
|
391 | 391 | |
392 | 392 | //registrations |
393 | - $registrations[ $reg->ID() ]['tkt_obj'] = $ticket; |
|
394 | - $registrations[ $reg->ID() ]['evt_obj'] = $event; |
|
395 | - $registrations[ $reg->ID() ]['reg_obj'] = $reg; |
|
396 | - $registrations[ $reg->ID() ]['att_obj'] = $reg->attendee(); |
|
393 | + $registrations[$reg->ID()]['tkt_obj'] = $ticket; |
|
394 | + $registrations[$reg->ID()]['evt_obj'] = $event; |
|
395 | + $registrations[$reg->ID()]['reg_obj'] = $reg; |
|
396 | + $registrations[$reg->ID()]['att_obj'] = $reg->attendee(); |
|
397 | 397 | |
398 | 398 | //set up answer objects |
399 | - $rel_ans = $reg->get_many_related( 'Answer' ); |
|
400 | - foreach ( $rel_ans as $ansid => $answer ) { |
|
401 | - if ( ! isset( $questions[ $ansid ] ) ) { |
|
402 | - $questions[ $ansid ] = $answer->get_first_related( 'Question' ); |
|
399 | + $rel_ans = $reg->get_many_related('Answer'); |
|
400 | + foreach ($rel_ans as $ansid => $answer) { |
|
401 | + if ( ! isset($questions[$ansid])) { |
|
402 | + $questions[$ansid] = $answer->get_first_related('Question'); |
|
403 | 403 | } |
404 | - $answers[ $ansid ] = $answer; |
|
405 | - $registrations[ $reg->ID() ]['ans_objs'][ $ansid ] = $answer; |
|
404 | + $answers[$ansid] = $answer; |
|
405 | + $registrations[$reg->ID()]['ans_objs'][$ansid] = $answer; |
|
406 | 406 | } |
407 | 407 | |
408 | - foreach ( $relateddatetime as $dtt_id => $datetime ) { |
|
409 | - $eventsetup[ $evt_id ]['dtt_objs'][ $dtt_id ] = $datetime; |
|
410 | - $registrations[ $reg->ID() ]['dtt_objs'][ $dtt_id ] = $datetime; |
|
408 | + foreach ($relateddatetime as $dtt_id => $datetime) { |
|
409 | + $eventsetup[$evt_id]['dtt_objs'][$dtt_id] = $datetime; |
|
410 | + $registrations[$reg->ID()]['dtt_objs'][$dtt_id] = $datetime; |
|
411 | 411 | |
412 | - if ( isset( $datetimes[ $dtt_id ] ) ) { |
|
412 | + if (isset($datetimes[$dtt_id])) { |
|
413 | 413 | continue; //already have this info in the datetimes array. |
414 | 414 | } |
415 | 415 | |
416 | - $datetimes[ $dtt_id ]['tkt_objs'][] = $ticket; |
|
417 | - $datetimes[ $dtt_id ]['datetime'] = $datetime; |
|
418 | - $datetimes[ $dtt_id ]['evt_objs'][ $evt_id ] = $event; |
|
419 | - $datetimes[ $dtt_id ]['reg_objs'][ $reg->ID() ] = $reg; |
|
416 | + $datetimes[$dtt_id]['tkt_objs'][] = $ticket; |
|
417 | + $datetimes[$dtt_id]['datetime'] = $datetime; |
|
418 | + $datetimes[$dtt_id]['evt_objs'][$evt_id] = $event; |
|
419 | + $datetimes[$dtt_id]['reg_objs'][$reg->ID()] = $reg; |
|
420 | 420 | } |
421 | 421 | } |
422 | 422 | |
423 | 423 | //let's loop through the unique event=>reg items and setup data on them |
424 | 424 | |
425 | - if ( ! empty( $eventsetup ) ) { |
|
426 | - foreach ( $eventsetup as $evt_id => $items ) { |
|
427 | - if ( $this->txn instanceof EE_Transaction ) { |
|
425 | + if ( ! empty($eventsetup)) { |
|
426 | + foreach ($eventsetup as $evt_id => $items) { |
|
427 | + if ($this->txn instanceof EE_Transaction) { |
|
428 | 428 | $ticket_line_items_for_event = EEM_Line_Item::instance()->get_all( |
429 | 429 | array( |
430 | 430 | array( |
@@ -437,25 +437,25 @@ discard block |
||
437 | 437 | } else { |
438 | 438 | $ticket_line_items_for_event = array(); |
439 | 439 | } |
440 | - $events[ $evt_id ] = array( |
|
440 | + $events[$evt_id] = array( |
|
441 | 441 | 'ID' => $evt_id, |
442 | - 'event' => $evtcache[ $evt_id ], |
|
443 | - 'name' => $evtcache[ $evt_id ] instanceof EE_Event ? $evtcache[ $evt_id ]->name() : '', |
|
444 | - 'total_attendees' => $event_attendee_count[ $evt_id ], |
|
442 | + 'event' => $evtcache[$evt_id], |
|
443 | + 'name' => $evtcache[$evt_id] instanceof EE_Event ? $evtcache[$evt_id]->name() : '', |
|
444 | + 'total_attendees' => $event_attendee_count[$evt_id], |
|
445 | 445 | 'reg_objs' => $items['reg_objs'], |
446 | 446 | 'tkt_objs' => $items['tkt_objs'], |
447 | 447 | 'att_objs' => $items['att_objs'], |
448 | - 'dtt_objs' => isset( $items['dtt_objs'] ) ? $items['dtt_objs'] : array(), |
|
448 | + 'dtt_objs' => isset($items['dtt_objs']) ? $items['dtt_objs'] : array(), |
|
449 | 449 | 'line_items' => $ticket_line_items_for_event, |
450 | 450 | ); |
451 | 451 | |
452 | 452 | //make sure the tickets have the line items setup for them. |
453 | - foreach ( $ticket_line_items_for_event as $line_id => $line_item ) { |
|
454 | - if ( $line_item instanceof EE_Line_Item ) { |
|
455 | - $tickets[ $line_item->ticket()->ID() ]['line_item'] = $line_item; |
|
456 | - $tickets[ $line_item->ticket()->ID() ]['sub_line_items'] = $line_item->children(); |
|
457 | - $line_items[ $line_item->ID() ]['children'] = $line_item->children(); |
|
458 | - $line_items[ $line_item->ID() ]['EE_Ticket'] = $line_item->ticket(); |
|
453 | + foreach ($ticket_line_items_for_event as $line_id => $line_item) { |
|
454 | + if ($line_item instanceof EE_Line_Item) { |
|
455 | + $tickets[$line_item->ticket()->ID()]['line_item'] = $line_item; |
|
456 | + $tickets[$line_item->ticket()->ID()]['sub_line_items'] = $line_item->children(); |
|
457 | + $line_items[$line_item->ID()]['children'] = $line_item->children(); |
|
458 | + $line_items[$line_item->ID()]['EE_Ticket'] = $line_item->ticket(); |
|
459 | 459 | } |
460 | 460 | } |
461 | 461 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | $this->total_ticket_count = $total_ticket_count; |
478 | 478 | $this->registrations = $registrations; |
479 | 479 | |
480 | - if ( $this->txn instanceof EE_Transaction ) { |
|
480 | + if ($this->txn instanceof EE_Transaction) { |
|
481 | 481 | $this->tax_line_items = $this->txn->tax_items(); |
482 | 482 | $this->additional_line_items = $this->txn->non_ticket_line_items(); |
483 | 483 | $this->payments = $this->txn->payments(); |
@@ -487,10 +487,10 @@ discard block |
||
487 | 487 | //let's get just the primary_attendee_data! First we get the primary registration object. |
488 | 488 | $primary_reg = $this->txn->primary_registration(); |
489 | 489 | // verify |
490 | - if ( $primary_reg instanceof EE_Registration ) { |
|
490 | + if ($primary_reg instanceof EE_Registration) { |
|
491 | 491 | |
492 | 492 | // get attendee object |
493 | - if ( $primary_reg->attendee() instanceof EE_Attendee ) { |
|
493 | + if ($primary_reg->attendee() instanceof EE_Attendee) { |
|
494 | 494 | |
495 | 495 | //now we can setup the primary_attendee_data array |
496 | 496 | $this->primary_attendee_data = array( |
@@ -534,8 +534,8 @@ discard block |
||
534 | 534 | * @return bool returning true means we DO want to skip processing. returning false means we DON'T want to skip |
535 | 535 | * processing |
536 | 536 | */ |
537 | - protected function _skip_registration_for_processing( EE_Registration $registration ) { |
|
538 | - if ( empty( $this->filtered_reg_status ) ) { |
|
537 | + protected function _skip_registration_for_processing(EE_Registration $registration) { |
|
538 | + if (empty($this->filtered_reg_status)) { |
|
539 | 539 | return false; |
540 | 540 | } |
541 | 541 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | * @return float total taxes to apply to ticket. |
39 | 39 | * @throws \EE_Error |
40 | 40 | */ |
41 | - public static function get_total_taxes_for_admin( EE_Ticket $ticket ) { |
|
41 | + public static function get_total_taxes_for_admin(EE_Ticket $ticket) { |
|
42 | 42 | $tax = 0; |
43 | 43 | $total_tax = 0; |
44 | 44 | //This first checks to see if the given ticket is taxable. |
45 | - if ( ! $ticket->get( 'TKT_taxable' ) ) { |
|
45 | + if ( ! $ticket->get('TKT_taxable')) { |
|
46 | 46 | return $tax; |
47 | 47 | } |
48 | 48 | //get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
49 | - $subtotal = self::get_subtotal_for_admin( $ticket ); |
|
49 | + $subtotal = self::get_subtotal_for_admin($ticket); |
|
50 | 50 | //get taxes |
51 | 51 | $taxes = self::get_taxes_for_admin(); |
52 | 52 | //apply taxes to subtotal |
53 | - foreach ( $taxes as $tax ) { |
|
53 | + foreach ($taxes as $tax) { |
|
54 | 54 | //assuming taxes are not cumulative |
55 | - $total_tax += $subtotal * $tax->get( 'PRC_amount' ) / 100; |
|
55 | + $total_tax += $subtotal * $tax->get('PRC_amount') / 100; |
|
56 | 56 | } |
57 | 57 | return $total_tax; |
58 | 58 | } |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public static function get_total_taxes_percentage() { |
70 | 70 | $total_tax_percent = 0; |
71 | - foreach ( self::get_taxes_for_admin() as $tax_price ) { |
|
72 | - $total_tax_percent += $tax_price->get( 'PRC_amount' ); |
|
71 | + foreach (self::get_taxes_for_admin() as $tax_price) { |
|
72 | + $total_tax_percent += $tax_price->get('PRC_amount'); |
|
73 | 73 | } |
74 | 74 | return $total_tax_percent; |
75 | 75 | } |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | * @return float |
82 | 82 | * @throws \EE_Error |
83 | 83 | */ |
84 | - public static function get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
84 | + public static function get_subtotal_for_admin(EE_Ticket $ticket) { |
|
85 | 85 | $TKT_ID = $ticket->ID(); |
86 | - return isset( self::$_subtotal[ $TKT_ID ] ) |
|
87 | - ? self::$_subtotal[ $TKT_ID ] |
|
88 | - : self::_get_subtotal_for_admin( $ticket ); |
|
86 | + return isset(self::$_subtotal[$TKT_ID]) |
|
87 | + ? self::$_subtotal[$TKT_ID] |
|
88 | + : self::_get_subtotal_for_admin($ticket); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -97,37 +97,37 @@ discard block |
||
97 | 97 | * @return float subtotal calculated from all EE_Price[] on Ticket. |
98 | 98 | * @throws \EE_Error |
99 | 99 | */ |
100 | - private static function _get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
100 | + private static function _get_subtotal_for_admin(EE_Ticket $ticket) { |
|
101 | 101 | $subtotal = 0; |
102 | 102 | //get all prices |
103 | 103 | $prices = $ticket->get_many_related( |
104 | 104 | 'Price', |
105 | 105 | array( |
106 | 106 | 'default_where_conditions' => 'none', |
107 | - 'order_by' => array( 'PRC_order' => 'ASC' ), |
|
107 | + 'order_by' => array('PRC_order' => 'ASC'), |
|
108 | 108 | ) |
109 | 109 | ); |
110 | 110 | //let's loop through them (base price is always the first item) |
111 | - foreach ( $prices as $price ) { |
|
112 | - if ( $price instanceof EE_Price ) { |
|
111 | + foreach ($prices as $price) { |
|
112 | + if ($price instanceof EE_Price) { |
|
113 | 113 | $price_type = $price->type_obj(); |
114 | - if ( $price_type instanceof EE_Price_Type ) { |
|
115 | - switch ( $price->type_obj()->base_type() ) { |
|
114 | + if ($price_type instanceof EE_Price_Type) { |
|
115 | + switch ($price->type_obj()->base_type()) { |
|
116 | 116 | case 1: // base price |
117 | 117 | case 3: // surcharges |
118 | - $subtotal += $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 |
|
119 | - : $price->get( 'PRC_amount' ); |
|
118 | + $subtotal += $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 |
|
119 | + : $price->get('PRC_amount'); |
|
120 | 120 | break; |
121 | 121 | case 2: // discounts |
122 | - $subtotal -= $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 |
|
123 | - : $price->get( 'PRC_amount' ); |
|
122 | + $subtotal -= $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 |
|
123 | + : $price->get('PRC_amount'); |
|
124 | 124 | break; |
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
128 | 128 | } |
129 | 129 | $TKT_ID = $ticket->ID(); |
130 | - self::$_subtotal = array( $TKT_ID => $subtotal ); |
|
130 | + self::$_subtotal = array($TKT_ID => $subtotal); |
|
131 | 131 | return $subtotal; |
132 | 132 | } |
133 | 133 | |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | * @throws \EE_Error |
141 | 141 | */ |
142 | 142 | public static function get_taxes_for_admin() { |
143 | - if ( empty( self::$_default_taxes ) ) { |
|
144 | - self::$_default_taxes = EE_Registry::instance()->load_model( 'Price' )->get_all( |
|
145 | - array( array( 'Price_Type.PBT_ID' => 4 ) ) |
|
143 | + if (empty(self::$_default_taxes)) { |
|
144 | + self::$_default_taxes = EE_Registry::instance()->load_model('Price')->get_all( |
|
145 | + array(array('Price_Type.PBT_ID' => 4)) |
|
146 | 146 | ); |
147 | 147 | } |
148 | 148 | return self::$_default_taxes; |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | * |
484 | 484 | * @final |
485 | 485 | * @access protected |
486 | - * @return void |
|
486 | + * @return false|null |
|
487 | 487 | */ |
488 | 488 | final protected function _page_setup() { |
489 | 489 | |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | * All this method does is verify the incoming request and make sure that routes exist for it. We do this early so we know if we need to drop out. |
758 | 758 | * |
759 | 759 | * @access protected |
760 | - * @return void |
|
760 | + * @return false|null |
|
761 | 761 | */ |
762 | 762 | protected function _verify_routes() { |
763 | 763 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | /** |
820 | 820 | * this method simply verifies a given route and makes sure its an actual route available for the loaded page |
821 | 821 | * @param string $route the route name we're verifying |
822 | - * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
822 | + * @return boolean (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
823 | 823 | */ |
824 | 824 | protected function _verify_route( $route ) { |
825 | 825 | if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
@@ -3411,7 +3411,7 @@ discard block |
||
3411 | 3411 | |
3412 | 3412 | |
3413 | 3413 | /** |
3414 | - * @return mixed |
|
3414 | + * @return string[] |
|
3415 | 3415 | */ |
3416 | 3416 | public function default_espresso_metaboxes() { |
3417 | 3417 | return $this->_default_espresso_metaboxes; |
@@ -3429,7 +3429,7 @@ discard block |
||
3429 | 3429 | |
3430 | 3430 | |
3431 | 3431 | /** |
3432 | - * @return mixed |
|
3432 | + * @return string |
|
3433 | 3433 | */ |
3434 | 3434 | public function wp_page_slug() { |
3435 | 3435 | return $this->_wp_page_slug; |
@@ -1311,8 +1311,8 @@ discard block |
||
1311 | 1311 | * verifies user access for this admin page |
1312 | 1312 | * @param string $route_to_check if present then the capability for the route matching this string is checked. |
1313 | 1313 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1314 | - * @return BOOL|wp_die() |
|
1315 | - */ |
|
1314 | + * @return BOOL|wp_die() |
|
1315 | + */ |
|
1316 | 1316 | public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
1317 | 1317 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1318 | 1318 | $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
@@ -1698,11 +1698,11 @@ discard block |
||
1698 | 1698 | |
1699 | 1699 | |
1700 | 1700 | /** |
1701 | - * admin_footer_scripts_eei18n_js_strings |
|
1702 | - * |
|
1703 | - * @access public |
|
1704 | - * @return void |
|
1705 | - */ |
|
1701 | + * admin_footer_scripts_eei18n_js_strings |
|
1702 | + * |
|
1703 | + * @access public |
|
1704 | + * @return void |
|
1705 | + */ |
|
1706 | 1706 | public function admin_footer_scripts_eei18n_js_strings() { |
1707 | 1707 | |
1708 | 1708 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
@@ -1758,11 +1758,11 @@ discard block |
||
1758 | 1758 | |
1759 | 1759 | |
1760 | 1760 | /** |
1761 | - * load enhanced xdebug styles for ppl with failing eyesight |
|
1762 | - * |
|
1763 | - * @access public |
|
1764 | - * @return void |
|
1765 | - */ |
|
1761 | + * load enhanced xdebug styles for ppl with failing eyesight |
|
1762 | + * |
|
1763 | + * @access public |
|
1764 | + * @return void |
|
1765 | + */ |
|
1766 | 1766 | public function add_xdebug_style() { |
1767 | 1767 | echo '<style>.xdebug-error { font-size:1.5em; }</style>'; |
1768 | 1768 | } |
@@ -1819,9 +1819,9 @@ discard block |
||
1819 | 1819 | |
1820 | 1820 | /** |
1821 | 1821 | * set current view for List Table |
1822 | - * @access public |
|
1823 | - * @return array |
|
1824 | - */ |
|
1822 | + * @access public |
|
1823 | + * @return array |
|
1824 | + */ |
|
1825 | 1825 | protected function _set_list_table_view() { |
1826 | 1826 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1827 | 1827 | |
@@ -1910,7 +1910,7 @@ discard block |
||
1910 | 1910 | * @access protected |
1911 | 1911 | * @param int $max_entries total number of rows in the table |
1912 | 1912 | * @return string |
1913 | - */ |
|
1913 | + */ |
|
1914 | 1914 | protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
1915 | 1915 | |
1916 | 1916 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1955,9 +1955,9 @@ discard block |
||
1955 | 1955 | |
1956 | 1956 | /** |
1957 | 1957 | * _set_search_attributes |
1958 | - * @access protected |
|
1959 | - * @return void |
|
1960 | - */ |
|
1958 | + * @access protected |
|
1959 | + * @return void |
|
1960 | + */ |
|
1961 | 1961 | public function _set_search_attributes() { |
1962 | 1962 | $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
1963 | 1963 | $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
@@ -1977,7 +1977,7 @@ discard block |
||
1977 | 1977 | * @link http://codex.wordpress.org/Function_Reference/add_meta_box |
1978 | 1978 | * @access private |
1979 | 1979 | * @return void |
1980 | - */ |
|
1980 | + */ |
|
1981 | 1981 | private function _add_registered_meta_boxes() { |
1982 | 1982 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1983 | 1983 | |
@@ -2027,13 +2027,13 @@ discard block |
||
2027 | 2027 | * @return void |
2028 | 2028 | */ |
2029 | 2029 | private function _add_screen_columns() { |
2030 | - if ( |
|
2031 | - is_array($this->_route_config) |
|
2032 | - && isset( $this->_route_config['columns'] ) |
|
2033 | - && is_array($this->_route_config['columns']) |
|
2034 | - && count( $this->_route_config['columns'] ) === 2 |
|
2035 | - ) { |
|
2036 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2030 | + if ( |
|
2031 | + is_array($this->_route_config) |
|
2032 | + && isset( $this->_route_config['columns'] ) |
|
2033 | + && is_array($this->_route_config['columns']) |
|
2034 | + && count( $this->_route_config['columns'] ) === 2 |
|
2035 | + ) { |
|
2036 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2037 | 2037 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
2038 | 2038 | $screen_id = $this->_current_screen->id; |
2039 | 2039 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
@@ -2213,7 +2213,6 @@ discard block |
||
2213 | 2213 | * Note: currently there is no validation for this. However if you want the delete button, the |
2214 | 2214 | * save, and save and close buttons to work properly, then you will want to include a |
2215 | 2215 | * values for the name and id arguments. |
2216 | - |
|
2217 | 2216 | * |
2218 | 2217 | *@todo Add in validation for name/id arguments. |
2219 | 2218 | * @param string $name key used for the action ID (i.e. event_id) |
@@ -2272,9 +2271,9 @@ discard block |
||
2272 | 2271 | |
2273 | 2272 | /** |
2274 | 2273 | * displays an error message to ppl who have javascript disabled |
2275 | - * @access private |
|
2276 | - * @return string |
|
2277 | - */ |
|
2274 | + * @access private |
|
2275 | + * @return string |
|
2276 | + */ |
|
2278 | 2277 | private function _display_no_javascript_warning() { |
2279 | 2278 | ?> |
2280 | 2279 | <noscript> |
@@ -2297,9 +2296,9 @@ discard block |
||
2297 | 2296 | |
2298 | 2297 | /** |
2299 | 2298 | * displays espresso success and/or error notices |
2300 | - * @access private |
|
2301 | - * @return string |
|
2302 | - */ |
|
2299 | + * @access private |
|
2300 | + * @return string |
|
2301 | + */ |
|
2303 | 2302 | private function _display_espresso_notices() { |
2304 | 2303 | $notices = $this->_get_transient( TRUE ); |
2305 | 2304 | echo stripslashes($notices); |
@@ -2311,10 +2310,10 @@ discard block |
||
2311 | 2310 | |
2312 | 2311 | |
2313 | 2312 | /** |
2314 | - * spinny things pacify the masses |
|
2315 | - * @access private |
|
2316 | - * @return string |
|
2317 | - */ |
|
2313 | + * spinny things pacify the masses |
|
2314 | + * @access private |
|
2315 | + * @return string |
|
2316 | + */ |
|
2318 | 2317 | protected function _add_admin_page_ajax_loading_img() { |
2319 | 2318 | ?> |
2320 | 2319 | <div id="espresso-ajax-loading" class="ajax-loading-grey"> |
@@ -2328,10 +2327,10 @@ discard block |
||
2328 | 2327 | |
2329 | 2328 | |
2330 | 2329 | /** |
2331 | - * add admin page overlay for modal boxes |
|
2332 | - * @access private |
|
2333 | - * @return string |
|
2334 | - */ |
|
2330 | + * add admin page overlay for modal boxes |
|
2331 | + * @access private |
|
2332 | + * @return string |
|
2333 | + */ |
|
2335 | 2334 | protected function _add_admin_page_overlay() { |
2336 | 2335 | ?> |
2337 | 2336 | <div id="espresso-admin-page-overlay-dv" class=""></div> |
@@ -2393,10 +2392,10 @@ discard block |
||
2393 | 2392 | |
2394 | 2393 | |
2395 | 2394 | /** |
2396 | - * generates HTML wrapper for an admin details page |
|
2397 | - * @access public |
|
2398 | - * @return void |
|
2399 | - */ |
|
2395 | + * generates HTML wrapper for an admin details page |
|
2396 | + * @access public |
|
2397 | + * @return void |
|
2398 | + */ |
|
2400 | 2399 | public function display_admin_page_with_sidebar() { |
2401 | 2400 | |
2402 | 2401 | $this->_display_admin_page(TRUE); |
@@ -2406,10 +2405,10 @@ discard block |
||
2406 | 2405 | |
2407 | 2406 | |
2408 | 2407 | /** |
2409 | - * generates HTML wrapper for an admin details page (except no sidebar) |
|
2410 | - * @access public |
|
2411 | - * @return void |
|
2412 | - */ |
|
2408 | + * generates HTML wrapper for an admin details page (except no sidebar) |
|
2409 | + * @access public |
|
2410 | + * @return void |
|
2411 | + */ |
|
2413 | 2412 | public function display_admin_page_with_no_sidebar() { |
2414 | 2413 | $this->_display_admin_page(); |
2415 | 2414 | } |
@@ -2448,18 +2447,18 @@ discard block |
||
2448 | 2447 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
2449 | 2448 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2450 | 2449 | $this->_template_args['admin_page_wrapper_div_id'] = $this->_cpt_route |
2451 | - ? 'poststuff' |
|
2452 | - : 'espresso-default-admin'; |
|
2450 | + ? 'poststuff' |
|
2451 | + : 'espresso-default-admin'; |
|
2453 | 2452 | |
2454 | - $template_path = $sidebar |
|
2455 | - ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' |
|
2456 | - : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2453 | + $template_path = $sidebar |
|
2454 | + ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' |
|
2455 | + : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2457 | 2456 | |
2458 | 2457 | if ( defined('DOING_AJAX' ) && DOING_AJAX ){ |
2459 | 2458 | $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
2460 | - } |
|
2459 | + } |
|
2461 | 2460 | |
2462 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2461 | + $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2463 | 2462 | |
2464 | 2463 | $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
2465 | 2464 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
@@ -2672,11 +2671,11 @@ discard block |
||
2672 | 2671 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2673 | 2672 | if ( NULL === error_get_last() || ! headers_sent() ) |
2674 | 2673 | header('Content-Type: application/json; charset=UTF-8'); |
2675 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2676 | - echo wp_json_encode( $json ); |
|
2677 | - } else { |
|
2678 | - echo json_encode( $json ); |
|
2679 | - } |
|
2674 | + if( function_exists( 'wp_json_encode' ) ) { |
|
2675 | + echo wp_json_encode( $json ); |
|
2676 | + } else { |
|
2677 | + echo json_encode( $json ); |
|
2678 | + } |
|
2680 | 2679 | exit(); |
2681 | 2680 | } |
2682 | 2681 | |
@@ -2715,11 +2714,11 @@ discard block |
||
2715 | 2714 | |
2716 | 2715 | |
2717 | 2716 | /** |
2718 | - * generates HTML wrapper with Tabbed nav for an admin page |
|
2719 | - * @access public |
|
2720 | - * @param boolean $about whether to use the special about page wrapper or default. |
|
2721 | - * @return void |
|
2722 | - */ |
|
2717 | + * generates HTML wrapper with Tabbed nav for an admin page |
|
2718 | + * @access public |
|
2719 | + * @param boolean $about whether to use the special about page wrapper or default. |
|
2720 | + * @return void |
|
2721 | + */ |
|
2723 | 2722 | public function admin_page_wrapper($about = FALSE) { |
2724 | 2723 | |
2725 | 2724 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2776,9 +2775,9 @@ discard block |
||
2776 | 2775 | */ |
2777 | 2776 | private function _sort_nav_tabs( $a, $b ) { |
2778 | 2777 | if ($a['order'] == $b['order']) { |
2779 | - return 0; |
|
2780 | - } |
|
2781 | - return ($a['order'] < $b['order']) ? -1 : 1; |
|
2778 | + return 0; |
|
2779 | + } |
|
2780 | + return ($a['order'] < $b['order']) ? -1 : 1; |
|
2782 | 2781 | } |
2783 | 2782 | |
2784 | 2783 |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
159 | 159 | * @access public |
160 | 160 | */ |
161 | - public function __construct( $routing = TRUE ) { |
|
161 | + public function __construct($routing = TRUE) { |
|
162 | 162 | |
163 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
163 | + if (strpos($this->_get_dir(), 'caffeinated') !== false) |
|
164 | 164 | $this->_is_caf = TRUE; |
165 | 165 | |
166 | 166 | $this->_yes_no_values = array( |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | |
173 | 173 | //set the _req_data property. |
174 | - $this->_req_data = array_merge( $_GET, $_POST ); |
|
174 | + $this->_req_data = array_merge($_GET, $_POST); |
|
175 | 175 | |
176 | 176 | |
177 | 177 | //routing enabled? |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $this->_do_other_page_hooks(); |
193 | 193 | |
194 | 194 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
195 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
195 | + if (method_exists($this, '_before_page_setup')) |
|
196 | 196 | $this->_before_page_setup(); |
197 | 197 | |
198 | 198 | //set up page dependencies |
@@ -462,16 +462,16 @@ discard block |
||
462 | 462 | */ |
463 | 463 | protected function _global_ajax_hooks() { |
464 | 464 | //for lazy loading of metabox content |
465 | - add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 ); |
|
465 | + add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | |
469 | 469 | |
470 | 470 | public function ajax_metabox_content() { |
471 | - $contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : ''; |
|
472 | - $url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : ''; |
|
471 | + $contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : ''; |
|
472 | + $url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : ''; |
|
473 | 473 | |
474 | - self::cached_rss_display( $contentid, $url ); |
|
474 | + self::cached_rss_display($contentid, $url); |
|
475 | 475 | wp_die(); |
476 | 476 | } |
477 | 477 | |
@@ -490,87 +490,87 @@ discard block |
||
490 | 490 | //requires? |
491 | 491 | |
492 | 492 | //admin_init stuff - global - we're setting this REALLY early so if EE_Admin pages have to hook into other WP pages they can. But keep in mind, not everything is available from the EE_Admin Page object at this point. |
493 | - add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 ); |
|
493 | + add_action('admin_init', array($this, 'admin_init_global'), 5); |
|
494 | 494 | |
495 | 495 | |
496 | 496 | //next verify if we need to load anything... |
497 | - $this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : ''; |
|
498 | - $this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) ); |
|
497 | + $this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : ''; |
|
498 | + $this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this)))); |
|
499 | 499 | |
500 | 500 | global $ee_menu_slugs; |
501 | 501 | $ee_menu_slugs = (array) $ee_menu_slugs; |
502 | 502 | |
503 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
503 | + if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE; |
|
504 | 504 | |
505 | 505 | |
506 | 506 | // becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first |
507 | - if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) { |
|
508 | - $this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
507 | + if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) { |
|
508 | + $this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
509 | 509 | } |
510 | 510 | // then set blank or -1 action values to 'default' |
511 | - $this->_req_action = isset( $this->_req_data['action'] ) && ! empty( $this->_req_data['action'] ) && $this->_req_data['action'] != -1 ? sanitize_key( $this->_req_data['action'] ) : 'default'; |
|
511 | + $this->_req_action = isset($this->_req_data['action']) && ! empty($this->_req_data['action']) && $this->_req_data['action'] != -1 ? sanitize_key($this->_req_data['action']) : 'default'; |
|
512 | 512 | |
513 | 513 | //if action is 'default' after the above BUT we have 'route' var set, then let's use the route as the action. This covers cases where we're coming in from a list table that isn't on the default route. |
514 | - $this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action; |
|
514 | + $this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
|
515 | 515 | |
516 | 516 | //however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be |
517 | 517 | $this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
518 | 518 | |
519 | 519 | $this->_current_view = $this->_req_action; |
520 | - $this->_req_nonce = $this->_req_action . '_nonce'; |
|
520 | + $this->_req_nonce = $this->_req_action.'_nonce'; |
|
521 | 521 | $this->_define_page_props(); |
522 | 522 | |
523 | - $this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ), $this->_admin_base_url ); |
|
523 | + $this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url); |
|
524 | 524 | |
525 | 525 | //default things |
526 | - $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' ); |
|
526 | + $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box'); |
|
527 | 527 | |
528 | 528 | //set page configs |
529 | 529 | $this->_set_page_routes(); |
530 | 530 | $this->_set_page_config(); |
531 | 531 | |
532 | 532 | //let's include any referrer data in our default_query_args for this route for "stickiness". |
533 | - if ( isset( $this->_req_data['wp_referer'] ) ) { |
|
533 | + if (isset($this->_req_data['wp_referer'])) { |
|
534 | 534 | $this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer']; |
535 | 535 | } |
536 | 536 | |
537 | 537 | //for caffeinated and other extended functionality. If there is a _extend_page_config method then let's run that to modify the all the various page configuration arrays |
538 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
538 | + if (method_exists($this, '_extend_page_config')) |
|
539 | 539 | $this->_extend_page_config(); |
540 | 540 | |
541 | 541 | //for CPT and other extended functionality. If there is an _extend_page_config_for_cpt then let's run that to modify all the various page configuration arrays. |
542 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
542 | + if (method_exists($this, '_extend_page_config_for_cpt')) |
|
543 | 543 | $this->_extend_page_config_for_cpt(); |
544 | 544 | |
545 | 545 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
546 | - $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
|
547 | - $this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this ); |
|
546 | + $this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this); |
|
547 | + $this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this); |
|
548 | 548 | |
549 | 549 | |
550 | 550 | //if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action |
551 | - if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) { |
|
552 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 ); |
|
551 | + if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) { |
|
552 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
556 | 556 | //next route only if routing enabled |
557 | - if ( $this->_routing && !defined('DOING_AJAX') ) { |
|
557 | + if ($this->_routing && ! defined('DOING_AJAX')) { |
|
558 | 558 | |
559 | 559 | $this->_verify_routes(); |
560 | 560 | |
561 | 561 | //next let's just check user_access and kill if no access |
562 | 562 | $this->check_user_access(); |
563 | 563 | |
564 | - if ( $this->_is_UI_request ) { |
|
564 | + if ($this->_is_UI_request) { |
|
565 | 565 | //admin_init stuff - global, all views for this page class, specific view |
566 | - add_action( 'admin_init', array( $this, 'admin_init' ), 10 ); |
|
567 | - if ( method_exists( $this, 'admin_init_' . $this->_current_view )) { |
|
568 | - add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 ); |
|
566 | + add_action('admin_init', array($this, 'admin_init'), 10); |
|
567 | + if (method_exists($this, 'admin_init_'.$this->_current_view)) { |
|
568 | + add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | } else { |
572 | 572 | //hijack regular WP loading and route admin request immediately |
573 | - @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); |
|
573 | + @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT)); |
|
574 | 574 | $this->route_admin_request(); |
575 | 575 | } |
576 | 576 | } |
@@ -587,18 +587,18 @@ discard block |
||
587 | 587 | * @return void |
588 | 588 | */ |
589 | 589 | private function _do_other_page_hooks() { |
590 | - $registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() ); |
|
590 | + $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array()); |
|
591 | 591 | |
592 | - foreach ( $registered_pages as $page ) { |
|
592 | + foreach ($registered_pages as $page) { |
|
593 | 593 | |
594 | 594 | //now let's setup the file name and class that should be present |
595 | 595 | $classname = str_replace('.class.php', '', $page); |
596 | 596 | |
597 | 597 | //autoloaders should take care of loading file |
598 | - if ( !class_exists( $classname ) ) { |
|
599 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page); |
|
600 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname ); |
|
601 | - throw new EE_Error( implode( '||', $error_msg )); |
|
598 | + if ( ! class_exists($classname)) { |
|
599 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page); |
|
600 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname); |
|
601 | + throw new EE_Error(implode('||', $error_msg)); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | $a = new ReflectionClass($classname); |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | public function load_page_dependencies() { |
614 | 614 | try { |
615 | 615 | $this->_load_page_dependencies(); |
616 | - } catch ( EE_Error $e ) { |
|
616 | + } catch (EE_Error $e) { |
|
617 | 617 | $e->get_error(); |
618 | 618 | } |
619 | 619 | } |
@@ -631,16 +631,16 @@ discard block |
||
631 | 631 | $this->_current_screen = get_current_screen(); |
632 | 632 | |
633 | 633 | //load admin_notices - global, page class, and view specific |
634 | - add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 ); |
|
635 | - add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 ); |
|
636 | - if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) { |
|
637 | - add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 ); |
|
634 | + add_action('admin_notices', array($this, 'admin_notices_global'), 5); |
|
635 | + add_action('admin_notices', array($this, 'admin_notices'), 10); |
|
636 | + if (method_exists($this, 'admin_notices_'.$this->_current_view)) { |
|
637 | + add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15); |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | //load network admin_notices - global, page class, and view specific |
641 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 ); |
|
642 | - if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) { |
|
643 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) ); |
|
641 | + add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5); |
|
642 | + if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) { |
|
643 | + add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view)); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | //this will save any per_page screen options if they are present |
@@ -656,8 +656,8 @@ discard block |
||
656 | 656 | //add screen options - global, page child class, and view specific |
657 | 657 | $this->_add_global_screen_options(); |
658 | 658 | $this->_add_screen_options(); |
659 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
660 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
659 | + if (method_exists($this, '_add_screen_options_'.$this->_current_view)) |
|
660 | + call_user_func(array($this, '_add_screen_options_'.$this->_current_view)); |
|
661 | 661 | |
662 | 662 | |
663 | 663 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -668,33 +668,33 @@ discard block |
||
668 | 668 | //add feature_pointers - global, page child class, and view specific |
669 | 669 | $this->_add_feature_pointers(); |
670 | 670 | $this->_add_global_feature_pointers(); |
671 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
672 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
671 | + if (method_exists($this, '_add_feature_pointer_'.$this->_current_view)) |
|
672 | + call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view)); |
|
673 | 673 | |
674 | 674 | //enqueue scripts/styles - global, page class, and view specific |
675 | - add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
|
676 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
|
677 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
678 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
675 | + add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5); |
|
676 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10); |
|
677 | + if (method_exists($this, 'load_scripts_styles_'.$this->_current_view)) |
|
678 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15); |
|
679 | 679 | |
680 | - add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
|
680 | + add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100); |
|
681 | 681 | |
682 | 682 | //admin_print_footer_scripts - global, page child class, and view specific. NOTE, despite the name, whenever possible, scripts should NOT be loaded using this. In most cases that's doing_it_wrong(). But adding hidden container elements etc. is a good use case. Notice the late priority we're giving these |
683 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
|
684 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
|
685 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
686 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
683 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99); |
|
684 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100); |
|
685 | + if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view)) |
|
686 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101); |
|
687 | 687 | |
688 | 688 | //admin footer scripts |
689 | - add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
|
690 | - add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
|
691 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
692 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
689 | + add_action('admin_footer', array($this, 'admin_footer_global'), 99); |
|
690 | + add_action('admin_footer', array($this, 'admin_footer'), 100); |
|
691 | + if (method_exists($this, 'admin_footer_'.$this->_current_view)) |
|
692 | + add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101); |
|
693 | 693 | |
694 | 694 | |
695 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
|
695 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug); |
|
696 | 696 | //targeted hook |
697 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action ); |
|
697 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action); |
|
698 | 698 | |
699 | 699 | } |
700 | 700 | |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | private function _set_defaults() { |
710 | 710 | $this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL; |
711 | 711 | |
712 | - $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
712 | + $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
713 | 713 | |
714 | 714 | $this->default_nav_tab_name = 'overview'; |
715 | 715 | |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | public function route_admin_request() { |
737 | 737 | try { |
738 | 738 | $this->_route_admin_request(); |
739 | - } catch ( EE_Error $e ) { |
|
739 | + } catch (EE_Error $e) { |
|
740 | 740 | $e->get_error(); |
741 | 741 | } |
742 | 742 | } |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | $this->_wp_page_slug = $wp_page_slug; |
748 | 748 | |
749 | 749 | //if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls... |
750 | - if ( is_network_admin() ) { |
|
750 | + if (is_network_admin()) { |
|
751 | 751 | $this->_wp_page_slug .= '-network'; |
752 | 752 | } |
753 | 753 | } |
@@ -760,53 +760,53 @@ discard block |
||
760 | 760 | * @return void |
761 | 761 | */ |
762 | 762 | protected function _verify_routes() { |
763 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
763 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
764 | 764 | |
765 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
765 | + if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE; |
|
766 | 766 | |
767 | 767 | $this->_route = FALSE; |
768 | 768 | $func = FALSE; |
769 | 769 | $args = array(); |
770 | 770 | |
771 | 771 | // check that the page_routes array is not empty |
772 | - if ( empty( $this->_page_routes )) { |
|
772 | + if (empty($this->_page_routes)) { |
|
773 | 773 | // user error msg |
774 | - $error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title ); |
|
774 | + $error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
775 | 775 | // developer error msg |
776 | - $error_msg .= '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' ); |
|
777 | - throw new EE_Error( $error_msg ); |
|
776 | + $error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso'); |
|
777 | + throw new EE_Error($error_msg); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | // and that the requested page route exists |
781 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
782 | - $this->_route = $this->_page_routes[ $this->_req_action ]; |
|
781 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
782 | + $this->_route = $this->_page_routes[$this->_req_action]; |
|
783 | 783 | $this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array(); |
784 | 784 | } else { |
785 | 785 | // user error msg |
786 | - $error_msg = sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
786 | + $error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
787 | 787 | // developer error msg |
788 | - $error_msg .= '||' . $error_msg . sprintf( __( ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso' ), $this->_req_action ); |
|
789 | - throw new EE_Error( $error_msg ); |
|
788 | + $error_msg .= '||'.$error_msg.sprintf(__(' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso'), $this->_req_action); |
|
789 | + throw new EE_Error($error_msg); |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | // and that a default route exists |
793 | - if ( ! array_key_exists( 'default', $this->_page_routes )) { |
|
793 | + if ( ! array_key_exists('default', $this->_page_routes)) { |
|
794 | 794 | // user error msg |
795 | - $error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
795 | + $error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title); |
|
796 | 796 | // developer error msg |
797 | - $error_msg .= '||' . $error_msg . __( ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso' ); |
|
798 | - throw new EE_Error( $error_msg ); |
|
797 | + $error_msg .= '||'.$error_msg.__(' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso'); |
|
798 | + throw new EE_Error($error_msg); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | |
802 | 802 | //first lets' catch if the UI request has EVER been set. |
803 | - if ( $this->_is_UI_request === NULL ) { |
|
803 | + if ($this->_is_UI_request === NULL) { |
|
804 | 804 | //lets set if this is a UI request or not. |
805 | - $this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE; |
|
805 | + $this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE; |
|
806 | 806 | |
807 | 807 | |
808 | 808 | //wait a minute... we might have a noheader in the route array |
809 | - $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
809 | + $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | $this->_set_current_labels(); |
@@ -821,15 +821,15 @@ discard block |
||
821 | 821 | * @param string $route the route name we're verifying |
822 | 822 | * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
823 | 823 | */ |
824 | - protected function _verify_route( $route ) { |
|
825 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
824 | + protected function _verify_route($route) { |
|
825 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
826 | 826 | return true; |
827 | 827 | } else { |
828 | 828 | // user error msg |
829 | - $error_msg = sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
829 | + $error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
830 | 830 | // developer error msg |
831 | - $error_msg .= '||' . $error_msg . sprintf( __( ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso' ), $route ); |
|
832 | - throw new EE_Error( $error_msg ); |
|
831 | + $error_msg .= '||'.$error_msg.sprintf(__(' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso'), $route); |
|
832 | + throw new EE_Error($error_msg); |
|
833 | 833 | } |
834 | 834 | } |
835 | 835 | |
@@ -843,18 +843,18 @@ discard block |
||
843 | 843 | * @param string $nonce_ref The nonce reference string (name0) |
844 | 844 | * @return mixed (bool|die) |
845 | 845 | */ |
846 | - protected function _verify_nonce( $nonce, $nonce_ref ) { |
|
846 | + protected function _verify_nonce($nonce, $nonce_ref) { |
|
847 | 847 | // verify nonce against expected value |
848 | - if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) { |
|
848 | + if ( ! wp_verify_nonce($nonce, $nonce_ref)) { |
|
849 | 849 | // these are not the droids you are looking for !!! |
850 | - $msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' ); |
|
851 | - if ( WP_DEBUG ) { |
|
852 | - $msg .= "\n " . sprintf( __('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso' ), __CLASS__ ); |
|
850 | + $msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>'); |
|
851 | + if (WP_DEBUG) { |
|
852 | + $msg .= "\n ".sprintf(__('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso'), __CLASS__); |
|
853 | 853 | } |
854 | - if ( ! defined( 'DOING_AJAX' )) { |
|
855 | - wp_die( $msg ); |
|
854 | + if ( ! defined('DOING_AJAX')) { |
|
855 | + wp_die($msg); |
|
856 | 856 | } else { |
857 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
857 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
858 | 858 | $this->_return_json(); |
859 | 859 | } |
860 | 860 | } |
@@ -872,63 +872,63 @@ discard block |
||
872 | 872 | * @return void |
873 | 873 | */ |
874 | 874 | protected function _route_admin_request() { |
875 | - if ( ! $this->_is_UI_request ) |
|
875 | + if ( ! $this->_is_UI_request) |
|
876 | 876 | $this->_verify_routes(); |
877 | 877 | |
878 | - $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
|
878 | + $nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE; |
|
879 | 879 | |
880 | - if ( $this->_req_action != 'default' && $nonce_check ) { |
|
880 | + if ($this->_req_action != 'default' && $nonce_check) { |
|
881 | 881 | // set nonce from post data |
882 | - $nonce = isset($this->_req_data[ $this->_req_nonce ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce ] ) : ''; |
|
883 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
882 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
883 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
884 | 884 | } |
885 | 885 | //set the nav_tabs array but ONLY if this is UI_request |
886 | - if ( $this->_is_UI_request ) |
|
886 | + if ($this->_is_UI_request) |
|
887 | 887 | $this->_set_nav_tabs(); |
888 | 888 | |
889 | 889 | // grab callback function |
890 | - $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
|
890 | + $func = is_array($this->_route) ? $this->_route['func'] : $this->_route; |
|
891 | 891 | |
892 | 892 | // check if callback has args |
893 | - $args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array(); |
|
893 | + $args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array(); |
|
894 | 894 | |
895 | 895 | $error_msg = ''; |
896 | 896 | |
897 | 897 | //action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request') |
898 | - if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
899 | - do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this ); |
|
898 | + if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
899 | + do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | //right before calling the route, let's remove _wp_http_referer from the $_SERVER[REQUEST_URI] global (its now in _req_data for route processing). |
903 | - $_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
903 | + $_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
904 | 904 | |
905 | - if ( ! empty( $func )) { |
|
905 | + if ( ! empty($func)) { |
|
906 | 906 | $base_call = $addon_call = FALSE; |
907 | 907 | //try to access page route via this class |
908 | - if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func ), $args ) ) === FALSE ) { |
|
908 | + if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) { |
|
909 | 909 | // user error msg |
910 | - $error_msg = __( 'An error occurred. The requested page route could not be found.', 'event_espresso' ); |
|
910 | + $error_msg = __('An error occurred. The requested page route could not be found.', 'event_espresso'); |
|
911 | 911 | // developer error msg |
912 | - $error_msg .= '||' . sprintf( __( 'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso' ), $func ); |
|
912 | + $error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso'), $func); |
|
913 | 913 | } |
914 | 914 | |
915 | 915 | //for pluggability by addons first let's see if just the function exists (this will also work in the case where $func is an array indicating class/method) |
916 | 916 | $args['admin_page_object'] = $this; //send along this admin page object for access by addons. |
917 | 917 | |
918 | - if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) { |
|
919 | - $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' ); |
|
920 | - $error_msg .= '||' . sprintf( __('Page route "%s" could not be called. Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func ); |
|
918 | + if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) { |
|
919 | + $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso'); |
|
920 | + $error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | |
924 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
925 | - throw new EE_Error( $error_msg ); |
|
924 | + if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE) |
|
925 | + throw new EE_Error($error_msg); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | //if we've routed and this route has a no headers route AND a sent_headers_route, then we need to reset the routing properties to the new route. |
929 | 929 | //now if UI request is FALSE and noheader is true AND we have a headers_sent_route in the route array then let's set UI_request to true because the no header route has a second func after headers have been sent. |
930 | - if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) { |
|
931 | - $this->_reset_routing_properties( $this->_route['headers_sent_route'] ); |
|
930 | + if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) { |
|
931 | + $this->_reset_routing_properties($this->_route['headers_sent_route']); |
|
932 | 932 | } |
933 | 933 | } |
934 | 934 | |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | * @param string $new_route New (non header) route to redirect to. |
945 | 945 | * @return void |
946 | 946 | */ |
947 | - protected function _reset_routing_properties( $new_route ) { |
|
947 | + protected function _reset_routing_properties($new_route) { |
|
948 | 948 | $this->_is_UI_request = TRUE; |
949 | 949 | //now we set the current route to whatever the headers_sent_route is set at |
950 | 950 | $this->_req_data['action'] = $new_route; |
@@ -990,23 +990,23 @@ discard block |
||
990 | 990 | * @param bool $exclude_nonce If true, the the nonce will be excluded from the generated nonce. |
991 | 991 | * @return string |
992 | 992 | */ |
993 | - public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) { |
|
993 | + public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) { |
|
994 | 994 | |
995 | 995 | //if there is a _wp_http_referer include the values from the request but only if sticky = true |
996 | - if ( $sticky ) { |
|
996 | + if ($sticky) { |
|
997 | 997 | $request = $_REQUEST; |
998 | - unset( $request['_wp_http_referer'] ); |
|
999 | - unset( $request['wp_referer'] ); |
|
1000 | - foreach ( $request as $key => $value ) { |
|
998 | + unset($request['_wp_http_referer']); |
|
999 | + unset($request['wp_referer']); |
|
1000 | + foreach ($request as $key => $value) { |
|
1001 | 1001 | //do not add nonces |
1002 | - if ( strpos( $key, 'nonce' ) !== false ) { |
|
1002 | + if (strpos($key, 'nonce') !== false) { |
|
1003 | 1003 | continue; |
1004 | 1004 | } |
1005 | - $args['wp_referer[' . $key . ']'] = $value; |
|
1005 | + $args['wp_referer['.$key.']'] = $value; |
|
1006 | 1006 | } |
1007 | 1007 | } |
1008 | 1008 | |
1009 | - return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce ); |
|
1009 | + return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce); |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | |
@@ -1022,8 +1022,8 @@ discard block |
||
1022 | 1022 | * @uses EEH_Template::get_help_tab_link() |
1023 | 1023 | * @return string generated link |
1024 | 1024 | */ |
1025 | - protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) { |
|
1026 | - return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text ); |
|
1025 | + protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) { |
|
1026 | + return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text); |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | |
@@ -1040,30 +1040,30 @@ discard block |
||
1040 | 1040 | */ |
1041 | 1041 | protected function _add_help_tabs() { |
1042 | 1042 | $tour_buttons = ''; |
1043 | - if ( isset( $this->_page_config[$this->_req_action] ) ) { |
|
1043 | + if (isset($this->_page_config[$this->_req_action])) { |
|
1044 | 1044 | $config = $this->_page_config[$this->_req_action]; |
1045 | 1045 | |
1046 | 1046 | //is there a help tour for the current route? if there is let's setup the tour buttons |
1047 | - if ( isset( $this->_help_tour[$this->_req_action]) ) { |
|
1047 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1048 | 1048 | $tb = array(); |
1049 | 1049 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1050 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1050 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1051 | 1051 | //if this is the end tour then we don't need to setup a button |
1052 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1052 | + if ($tour instanceof EE_Help_Tour_final_stop) |
|
1053 | 1053 | continue; |
1054 | - $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
|
1054 | + $tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>'; |
|
1055 | 1055 | } |
1056 | 1056 | $tour_buttons .= implode('<br />', $tb); |
1057 | 1057 | $tour_buttons .= '</div></div>'; |
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1061 | - if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
|
1061 | + if (is_array($config) && isset($config['help_sidebar'])) { |
|
1062 | 1062 | //check that the callback given is valid |
1063 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1064 | - throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) ); |
|
1063 | + if ( ! method_exists($this, $config['help_sidebar'])) |
|
1064 | + throw new EE_Error(sprintf(__('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this))); |
|
1065 | 1065 | |
1066 | - $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
|
1066 | + $content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar']))); |
|
1067 | 1067 | |
1068 | 1068 | $content .= $tour_buttons; //add help tour buttons. |
1069 | 1069 | |
@@ -1072,49 +1072,49 @@ discard block |
||
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | //if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar. |
1075 | - if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) { |
|
1075 | + if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) { |
|
1076 | 1076 | $this->_current_screen->set_help_sidebar($tour_buttons); |
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | //handle if no help_tabs are set so the sidebar will still show for the help tour buttons |
1080 | - if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) { |
|
1080 | + if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) { |
|
1081 | 1081 | $_ht['id'] = $this->page_slug; |
1082 | 1082 | $_ht['title'] = __('Help Tours', 'event_espresso'); |
1083 | - $_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>'; |
|
1083 | + $_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>'; |
|
1084 | 1084 | $this->_current_screen->add_help_tab($_ht); |
1085 | 1085 | }/**/ |
1086 | 1086 | |
1087 | 1087 | |
1088 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1088 | + if ( ! isset($config['help_tabs'])) return; //no help tabs for this route |
|
1089 | 1089 | |
1090 | - foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
|
1090 | + foreach ((array) $config['help_tabs'] as $tab_id => $cfg) { |
|
1091 | 1091 | //we're here so there ARE help tabs! |
1092 | 1092 | |
1093 | 1093 | //make sure we've got what we need |
1094 | - if ( !isset( $cfg['title'] ) ) |
|
1095 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1094 | + if ( ! isset($cfg['title'])) |
|
1095 | + throw new EE_Error(__('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso')); |
|
1096 | 1096 | |
1097 | 1097 | |
1098 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1099 | - throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') ); |
|
1098 | + if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) |
|
1099 | + throw new EE_Error(__('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso')); |
|
1100 | 1100 | |
1101 | 1101 | |
1102 | 1102 | |
1103 | 1103 | //first priority goes to content. |
1104 | - if ( !empty($cfg['content'] ) ) { |
|
1105 | - $content = !empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1104 | + if ( ! empty($cfg['content'])) { |
|
1105 | + $content = ! empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1106 | 1106 | |
1107 | 1107 | //second priority goes to filename |
1108 | - } else if ( !empty($cfg['filename'] ) ) { |
|
1109 | - $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php'; |
|
1108 | + } else if ( ! empty($cfg['filename'])) { |
|
1109 | + $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php'; |
|
1110 | 1110 | |
1111 | 1111 | |
1112 | 1112 | //it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too) |
1113 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path; |
|
1113 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path; |
|
1114 | 1114 | |
1115 | 1115 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1116 | - if ( !is_readable($file_path) && !isset($cfg['callback']) ) { |
|
1117 | - EE_Error::add_error( sprintf( __('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content. Please check that the string you set for the help tab on this route (%s) is the correct spelling. The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1116 | + if ( ! is_readable($file_path) && ! isset($cfg['callback'])) { |
|
1117 | + EE_Error::add_error(sprintf(__('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content. Please check that the string you set for the help tab on this route (%s) is the correct spelling. The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path), __FILE__, __FUNCTION__, __LINE__); |
|
1118 | 1118 | return; |
1119 | 1119 | } |
1120 | 1120 | $template_args['admin_page_obj'] = $this; |
@@ -1125,21 +1125,21 @@ discard block |
||
1125 | 1125 | |
1126 | 1126 | |
1127 | 1127 | //check if callback is valid |
1128 | - if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) { |
|
1129 | - EE_Error::add_error( sprintf( __('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content. Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title'] ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1128 | + if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) { |
|
1129 | + EE_Error::add_error(sprintf(__('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content. Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title']), __FILE__, __FUNCTION__, __LINE__); |
|
1130 | 1130 | return; |
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | //setup config array for help tab method |
1134 | - $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id; |
|
1134 | + $id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id; |
|
1135 | 1135 | $_ht = array( |
1136 | 1136 | 'id' => $id, |
1137 | 1137 | 'title' => $cfg['title'], |
1138 | - 'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL, |
|
1138 | + 'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL, |
|
1139 | 1139 | 'content' => $content |
1140 | 1140 | ); |
1141 | 1141 | |
1142 | - $this->_current_screen->add_help_tab( $_ht ); |
|
1142 | + $this->_current_screen->add_help_tab($_ht); |
|
1143 | 1143 | } |
1144 | 1144 | } |
1145 | 1145 | } |
@@ -1159,49 +1159,49 @@ discard block |
||
1159 | 1159 | $this->_help_tour = array(); |
1160 | 1160 | |
1161 | 1161 | //exit early if help tours are turned off globally |
1162 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1162 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)) |
|
1163 | 1163 | return; |
1164 | 1164 | |
1165 | 1165 | //loop through _page_config to find any help_tour defined |
1166 | - foreach ( $this->_page_config as $route => $config ) { |
|
1166 | + foreach ($this->_page_config as $route => $config) { |
|
1167 | 1167 | //we're only going to set things up for this route |
1168 | - if ( $route !== $this->_req_action ) |
|
1168 | + if ($route !== $this->_req_action) |
|
1169 | 1169 | continue; |
1170 | 1170 | |
1171 | - if ( isset( $config['help_tour'] ) ) { |
|
1171 | + if (isset($config['help_tour'])) { |
|
1172 | 1172 | |
1173 | - foreach( $config['help_tour'] as $tour ) { |
|
1174 | - $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php'; |
|
1173 | + foreach ($config['help_tour'] as $tour) { |
|
1174 | + $file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php'; |
|
1175 | 1175 | //let's see if we can get that file... if not its possible this is a decaf route not set in caffienated so lets try and get the caffeinated equivalent |
1176 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path; |
|
1176 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path; |
|
1177 | 1177 | |
1178 | 1178 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1179 | - if ( !is_readable($file_path) ) { |
|
1180 | - EE_Error::add_error( sprintf( __('The file path given for the help tour (%s) is not a valid path. Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1179 | + if ( ! is_readable($file_path)) { |
|
1180 | + EE_Error::add_error(sprintf(__('The file path given for the help tour (%s) is not a valid path. Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour), __FILE__, __FUNCTION__, __LINE__); |
|
1181 | 1181 | return; |
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | require_once $file_path; |
1185 | - if ( !class_exists( $tour ) ) { |
|
1186 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour); |
|
1187 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this) ); |
|
1188 | - throw new EE_Error( implode( '||', $error_msg )); |
|
1185 | + if ( ! class_exists($tour)) { |
|
1186 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour); |
|
1187 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this)); |
|
1188 | + throw new EE_Error(implode('||', $error_msg)); |
|
1189 | 1189 | } |
1190 | 1190 | $a = new ReflectionClass($tour); |
1191 | 1191 | $tour_obj = $a->newInstance($this->_is_caf); |
1192 | 1192 | |
1193 | 1193 | $tours[] = $tour_obj; |
1194 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj ); |
|
1194 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj); |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | //let's inject the end tour stop element common to all pages... this will only get seen once per machine. |
1198 | 1198 | $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf); |
1199 | 1199 | $tours[] = $end_stop_tour; |
1200 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour ); |
|
1200 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour); |
|
1201 | 1201 | } |
1202 | 1202 | } |
1203 | 1203 | |
1204 | - if ( !empty( $tours ) ) |
|
1204 | + if ( ! empty($tours)) |
|
1205 | 1205 | $this->_help_tour['tours'] = $tours; |
1206 | 1206 | |
1207 | 1207 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
@@ -1217,12 +1217,12 @@ discard block |
||
1217 | 1217 | * @return void |
1218 | 1218 | */ |
1219 | 1219 | protected function _add_qtips() { |
1220 | - if ( isset( $this->_route_config['qtips'] ) ) { |
|
1220 | + if (isset($this->_route_config['qtips'])) { |
|
1221 | 1221 | $qtips = (array) $this->_route_config['qtips']; |
1222 | 1222 | //load qtip loader |
1223 | 1223 | $path = array( |
1224 | - $this->_get_dir() . '/qtips/', |
|
1225 | - EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/' |
|
1224 | + $this->_get_dir().'/qtips/', |
|
1225 | + EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/' |
|
1226 | 1226 | ); |
1227 | 1227 | EEH_Qtip_Loader::instance()->register($qtips, $path); |
1228 | 1228 | } |
@@ -1239,41 +1239,41 @@ discard block |
||
1239 | 1239 | * @return void |
1240 | 1240 | */ |
1241 | 1241 | protected function _set_nav_tabs() { |
1242 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1242 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1243 | 1243 | $i = 0; |
1244 | - foreach ( $this->_page_config as $slug => $config ) { |
|
1245 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1244 | + foreach ($this->_page_config as $slug => $config) { |
|
1245 | + if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav']))) |
|
1246 | 1246 | continue; //no nav tab for this config |
1247 | 1247 | |
1248 | 1248 | //check for persistent flag |
1249 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1249 | + if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action) |
|
1250 | 1250 | continue; //nav tab is only to appear when route requested. |
1251 | 1251 | |
1252 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1252 | + if ( ! $this->check_user_access($slug, TRUE)) |
|
1253 | 1253 | continue; //no nav tab becasue current user does not have access. |
1254 | 1254 | |
1255 | - $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
|
1255 | + $css_class = isset($config['css_class']) ? $config['css_class'].' ' : ''; |
|
1256 | 1256 | $this->_nav_tabs[$slug] = array( |
1257 | - 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ), |
|
1258 | - 'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ), |
|
1259 | - 'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class, |
|
1260 | - 'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i |
|
1257 | + 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url), |
|
1258 | + 'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)), |
|
1259 | + 'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class, |
|
1260 | + 'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i |
|
1261 | 1261 | ); |
1262 | 1262 | $i++; |
1263 | 1263 | } |
1264 | 1264 | |
1265 | 1265 | //if $this->_nav_tabs is empty then lets set the default |
1266 | - if ( empty( $this->_nav_tabs ) ) { |
|
1266 | + if (empty($this->_nav_tabs)) { |
|
1267 | 1267 | $this->_nav_tabs[$this->default_nav_tab_name] = array( |
1268 | 1268 | 'url' => $this->admin_base_url, |
1269 | - 'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ), |
|
1269 | + 'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)), |
|
1270 | 1270 | 'css_class' => 'nav-tab-active', |
1271 | 1271 | 'order' => 10 |
1272 | 1272 | ); |
1273 | 1273 | } |
1274 | 1274 | |
1275 | 1275 | //now let's sort the tabs according to order |
1276 | - usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' )); |
|
1276 | + usort($this->_nav_tabs, array($this, '_sort_nav_tabs')); |
|
1277 | 1277 | |
1278 | 1278 | } |
1279 | 1279 | |
@@ -1289,10 +1289,10 @@ discard block |
||
1289 | 1289 | * @return void |
1290 | 1290 | */ |
1291 | 1291 | private function _set_current_labels() { |
1292 | - if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) { |
|
1293 | - foreach ( $this->_route_config['labels'] as $label => $text ) { |
|
1294 | - if ( is_array($text) ) { |
|
1295 | - foreach ( $text as $sublabel => $subtext ) { |
|
1292 | + if (is_array($this->_route_config) && isset($this->_route_config['labels'])) { |
|
1293 | + foreach ($this->_route_config['labels'] as $label => $text) { |
|
1294 | + if (is_array($text)) { |
|
1295 | + foreach ($text as $sublabel => $subtext) { |
|
1296 | 1296 | $this->_labels[$label][$sublabel] = $subtext; |
1297 | 1297 | } |
1298 | 1298 | } else { |
@@ -1313,24 +1313,24 @@ discard block |
||
1313 | 1313 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1314 | 1314 | * @return BOOL|wp_die() |
1315 | 1315 | */ |
1316 | - public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
|
1317 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1318 | - $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
|
1319 | - $capability = ! empty( $route_to_check ) && isset( $this->_page_routes[$route_to_check] ) && is_array( $this->_page_routes[$route_to_check] ) && ! empty( $this->_page_routes[$route_to_check]['capability'] ) ? $this->_page_routes[$route_to_check]['capability'] : NULL; |
|
1316 | + public function check_user_access($route_to_check = '', $verify_only = FALSE) { |
|
1317 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1318 | + $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check; |
|
1319 | + $capability = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check]) && is_array($this->_page_routes[$route_to_check]) && ! empty($this->_page_routes[$route_to_check]['capability']) ? $this->_page_routes[$route_to_check]['capability'] : NULL; |
|
1320 | 1320 | |
1321 | - if ( empty( $capability ) && empty( $route_to_check ) ) { |
|
1322 | - $capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability']; |
|
1321 | + if (empty($capability) && empty($route_to_check)) { |
|
1322 | + $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability']; |
|
1323 | 1323 | } else { |
1324 | - $capability = empty( $capability ) ? 'manage_options' : $capability; |
|
1324 | + $capability = empty($capability) ? 'manage_options' : $capability; |
|
1325 | 1325 | } |
1326 | 1326 | |
1327 | - $id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0; |
|
1327 | + $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0; |
|
1328 | 1328 | |
1329 | - if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) { |
|
1330 | - if ( $verify_only ) { |
|
1329 | + if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) { |
|
1330 | + if ($verify_only) { |
|
1331 | 1331 | return FALSE; |
1332 | 1332 | } else { |
1333 | - wp_die( __('You do not have access to this route.', 'event_espresso' ) ); |
|
1333 | + wp_die(__('You do not have access to this route.', 'event_espresso')); |
|
1334 | 1334 | } |
1335 | 1335 | } |
1336 | 1336 | return TRUE; |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | $this->_add_admin_page_overlay(); |
1408 | 1408 | |
1409 | 1409 | //if metaboxes are present we need to add the nonce field |
1410 | - if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) { |
|
1410 | + if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) { |
|
1411 | 1411 | wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
1412 | 1412 | wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
1413 | 1413 | } |
@@ -1426,19 +1426,19 @@ discard block |
||
1426 | 1426 | */ |
1427 | 1427 | public function admin_footer_global() { |
1428 | 1428 | //dialog container for dialog helper |
1429 | - $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n"; |
|
1429 | + $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n"; |
|
1430 | 1430 | $d_cont .= '<div class="ee-notices"></div>'; |
1431 | 1431 | $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>'; |
1432 | 1432 | $d_cont .= '</div>'; |
1433 | 1433 | echo $d_cont; |
1434 | 1434 | |
1435 | 1435 | //help tour stuff? |
1436 | - if ( isset( $this->_help_tour[$this->_req_action] ) ) { |
|
1436 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1437 | 1437 | echo implode('<br />', $this->_help_tour[$this->_req_action]); |
1438 | 1438 | } |
1439 | 1439 | |
1440 | 1440 | //current set timezone for timezone js |
1441 | - echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>'; |
|
1441 | + echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>'; |
|
1442 | 1442 | } |
1443 | 1443 | |
1444 | 1444 | |
@@ -1462,18 +1462,18 @@ discard block |
||
1462 | 1462 | * @access protected |
1463 | 1463 | * @return string content |
1464 | 1464 | */ |
1465 | - protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) { |
|
1465 | + protected function _set_help_popup_content($help_array = array(), $display = FALSE) { |
|
1466 | 1466 | $content = ''; |
1467 | 1467 | |
1468 | - $help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array; |
|
1469 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php'; |
|
1468 | + $help_array = empty($help_array) ? $this->_get_help_content() : $help_array; |
|
1469 | + $template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php'; |
|
1470 | 1470 | |
1471 | 1471 | |
1472 | 1472 | //loop through the array and setup content |
1473 | - foreach ( $help_array as $trigger => $help ) { |
|
1473 | + foreach ($help_array as $trigger => $help) { |
|
1474 | 1474 | //make sure the array is setup properly |
1475 | - if ( !isset($help['title']) || !isset($help['content'] ) ) { |
|
1476 | - throw new EE_Error( __('Does not look like the popup content array has been setup correctly. Might want to double check that. Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso') ); |
|
1475 | + if ( ! isset($help['title']) || ! isset($help['content'])) { |
|
1476 | + throw new EE_Error(__('Does not look like the popup content array has been setup correctly. Might want to double check that. Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso')); |
|
1477 | 1477 | } |
1478 | 1478 | |
1479 | 1479 | //we're good so let'd setup the template vars and then assign parsed template content to our content. |
@@ -1483,10 +1483,10 @@ discard block |
||
1483 | 1483 | 'help_popup_content' => $help['content'] |
1484 | 1484 | ); |
1485 | 1485 | |
1486 | - $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
1486 | + $content .= EEH_Template::display_template($template_path, $template_args, TRUE); |
|
1487 | 1487 | } |
1488 | 1488 | |
1489 | - if ( $display ) |
|
1489 | + if ($display) |
|
1490 | 1490 | echo $content; |
1491 | 1491 | else |
1492 | 1492 | return $content; |
@@ -1503,18 +1503,18 @@ discard block |
||
1503 | 1503 | */ |
1504 | 1504 | private function _get_help_content() { |
1505 | 1505 | //what is the method we're looking for? |
1506 | - $method_name = '_help_popup_content_' . $this->_req_action; |
|
1506 | + $method_name = '_help_popup_content_'.$this->_req_action; |
|
1507 | 1507 | |
1508 | 1508 | //if method doesn't exist let's get out. |
1509 | - if ( !method_exists( $this, $method_name ) ) |
|
1509 | + if ( ! method_exists($this, $method_name)) |
|
1510 | 1510 | return array(); |
1511 | 1511 | |
1512 | 1512 | //k we're good to go let's retrieve the help array |
1513 | - $help_array = call_user_func( array( $this, $method_name ) ); |
|
1513 | + $help_array = call_user_func(array($this, $method_name)); |
|
1514 | 1514 | |
1515 | 1515 | //make sure we've got an array! |
1516 | - if ( !is_array($help_array) ) { |
|
1517 | - throw new EE_Error( __('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso' ) ); |
|
1516 | + if ( ! is_array($help_array)) { |
|
1517 | + throw new EE_Error(__('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso')); |
|
1518 | 1518 | } |
1519 | 1519 | |
1520 | 1520 | return $help_array; |
@@ -1536,27 +1536,27 @@ discard block |
||
1536 | 1536 | * @param array $dimensions an array of dimensions for the box (array(h,w)) |
1537 | 1537 | * @return string |
1538 | 1538 | */ |
1539 | - protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
|
1539 | + protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) { |
|
1540 | 1540 | |
1541 | - if ( defined('DOING_AJAX') ) return; |
|
1541 | + if (defined('DOING_AJAX')) return; |
|
1542 | 1542 | |
1543 | 1543 | //let's check and see if there is any content set for this popup. If there isn't then we'll include a default title and content so that developers know something needs to be corrected |
1544 | 1544 | $help_array = $this->_get_help_content(); |
1545 | 1545 | $help_content = ''; |
1546 | 1546 | |
1547 | - if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) { |
|
1547 | + if (empty($help_array) || ! isset($help_array[$trigger_id])) { |
|
1548 | 1548 | $help_array[$trigger_id] = array( |
1549 | 1549 | 'title' => __('Missing Content', 'event_espresso'), |
1550 | 1550 | 'content' => __('A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)', 'event_espresso') |
1551 | 1551 | ); |
1552 | - $help_content = $this->_set_help_popup_content( $help_array, FALSE ); |
|
1552 | + $help_content = $this->_set_help_popup_content($help_array, FALSE); |
|
1553 | 1553 | } |
1554 | 1554 | |
1555 | 1555 | //let's setup the trigger |
1556 | - $content = '<a class="ee-dialog" href="?height='. $dimensions[0] . '&width=' . $dimensions[1] . '&inlineId=' . $trigger_id . '" target="_blank"><span class="question ee-help-popup-question"></span></a>'; |
|
1557 | - $content = $content . $help_content; |
|
1556 | + $content = '<a class="ee-dialog" href="?height='.$dimensions[0].'&width='.$dimensions[1].'&inlineId='.$trigger_id.'" target="_blank"><span class="question ee-help-popup-question"></span></a>'; |
|
1557 | + $content = $content.$help_content; |
|
1558 | 1558 | |
1559 | - if ( $display ) |
|
1559 | + if ($display) |
|
1560 | 1560 | echo $content; |
1561 | 1561 | else |
1562 | 1562 | return $content; |
@@ -1613,15 +1613,15 @@ discard block |
||
1613 | 1613 | public function load_global_scripts_styles() { |
1614 | 1614 | /** STYLES **/ |
1615 | 1615 | // add debugging styles |
1616 | - if ( WP_DEBUG ) { |
|
1617 | - add_action('admin_head', array( $this, 'add_xdebug_style' )); |
|
1616 | + if (WP_DEBUG) { |
|
1617 | + add_action('admin_head', array($this, 'add_xdebug_style')); |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | //register all styles |
1621 | - wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(),EVENT_ESPRESSO_VERSION ); |
|
1622 | - wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1621 | + wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION); |
|
1622 | + wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1623 | 1623 | //helpers styles |
1624 | - wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1624 | + wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION); |
|
1625 | 1625 | //enqueue global styles |
1626 | 1626 | wp_enqueue_style('ee-admin-css'); |
1627 | 1627 | |
@@ -1629,66 +1629,66 @@ discard block |
||
1629 | 1629 | /** SCRIPTS **/ |
1630 | 1630 | |
1631 | 1631 | //register all scripts |
1632 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1633 | - wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1634 | - wp_register_script('ee_admin_js', EE_ADMIN_URL . 'assets/ee-admin-page.js', array( 'espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true ); |
|
1632 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1633 | + wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1634 | + wp_register_script('ee_admin_js', EE_ADMIN_URL.'assets/ee-admin-page.js', array('espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
1635 | 1635 | |
1636 | - wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true ); |
|
1636 | + wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL.'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true); |
|
1637 | 1637 | // register jQuery Validate - see /includes/functions/wp_hooks.php |
1638 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
1638 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
1639 | 1639 | add_filter('FHEE_load_joyride', '__return_true'); |
1640 | 1640 | |
1641 | 1641 | //script for sorting tables |
1642 | - wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL . "assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1642 | + wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL."assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1643 | 1643 | //script for parsing uri's |
1644 | - wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1644 | + wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1645 | 1645 | //and parsing associative serialized form elements |
1646 | - wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1646 | + wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1647 | 1647 | //helpers scripts |
1648 | - wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1649 | - wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1650 | - wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1651 | - wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1648 | + wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1649 | + wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1650 | + wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1651 | + wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1652 | 1652 | |
1653 | 1653 | //google charts |
1654 | - wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false ); |
|
1654 | + wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false); |
|
1655 | 1655 | |
1656 | 1656 | //enqueue global scripts |
1657 | 1657 | |
1658 | 1658 | //taking care of metaboxes |
1659 | - if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) { |
|
1659 | + if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) { |
|
1660 | 1660 | wp_enqueue_script('dashboard'); |
1661 | 1661 | } |
1662 | 1662 | |
1663 | 1663 | //enqueue thickbox for ee help popups. default is to enqueue unless its explicitly set to false since we're assuming all EE pages will have popups |
1664 | - if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) { |
|
1664 | + if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) { |
|
1665 | 1665 | wp_enqueue_script('ee_admin_js'); |
1666 | 1666 | wp_enqueue_style('ee-admin-css'); |
1667 | 1667 | } |
1668 | 1668 | |
1669 | 1669 | |
1670 | 1670 | //localize script for ajax lazy loading |
1671 | - $lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') ); |
|
1672 | - wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1671 | + $lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content')); |
|
1672 | + wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1673 | 1673 | |
1674 | 1674 | |
1675 | 1675 | /** |
1676 | 1676 | * help tour stuff |
1677 | 1677 | */ |
1678 | - if ( !empty( $this->_help_tour ) ) { |
|
1678 | + if ( ! empty($this->_help_tour)) { |
|
1679 | 1679 | |
1680 | 1680 | //register the js for kicking things off |
1681 | - wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1681 | + wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1682 | 1682 | |
1683 | 1683 | //setup tours for the js tour object |
1684 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1684 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1685 | 1685 | $tours[] = array( |
1686 | 1686 | 'id' => $tour->get_slug(), |
1687 | 1687 | 'options' => $tour->get_options() |
1688 | 1688 | ); |
1689 | 1689 | } |
1690 | 1690 | |
1691 | - wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) ); |
|
1691 | + wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours)); |
|
1692 | 1692 | |
1693 | 1693 | //admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour |
1694 | 1694 | } |
@@ -1706,52 +1706,52 @@ discard block |
||
1706 | 1706 | public function admin_footer_scripts_eei18n_js_strings() { |
1707 | 1707 | |
1708 | 1708 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
1709 | - EE_Registry::$i18n_js_strings['confirm_delete'] = __( 'Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso' ); |
|
1710 | - |
|
1711 | - EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' ); |
|
1712 | - EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' ); |
|
1713 | - EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' ); |
|
1714 | - EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' ); |
|
1715 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1716 | - EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' ); |
|
1717 | - EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' ); |
|
1718 | - EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' ); |
|
1719 | - EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' ); |
|
1720 | - EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' ); |
|
1721 | - EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' ); |
|
1722 | - EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' ); |
|
1723 | - EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' ); |
|
1724 | - EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' ); |
|
1725 | - EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' ); |
|
1726 | - EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' ); |
|
1727 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1728 | - EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' ); |
|
1729 | - EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' ); |
|
1730 | - EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' ); |
|
1731 | - EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' ); |
|
1732 | - EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' ); |
|
1733 | - EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' ); |
|
1734 | - EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' ); |
|
1735 | - |
|
1736 | - EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' ); |
|
1737 | - EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' ); |
|
1738 | - EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' ); |
|
1739 | - EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' ); |
|
1740 | - EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' ); |
|
1741 | - EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' ); |
|
1742 | - EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' ); |
|
1743 | - EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' ); |
|
1744 | - EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' ); |
|
1745 | - EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' ); |
|
1746 | - EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' ); |
|
1747 | - EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' ); |
|
1748 | - EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' ); |
|
1749 | - EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' ); |
|
1709 | + EE_Registry::$i18n_js_strings['confirm_delete'] = __('Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso'); |
|
1710 | + |
|
1711 | + EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso'); |
|
1712 | + EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso'); |
|
1713 | + EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso'); |
|
1714 | + EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso'); |
|
1715 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1716 | + EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso'); |
|
1717 | + EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso'); |
|
1718 | + EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso'); |
|
1719 | + EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso'); |
|
1720 | + EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso'); |
|
1721 | + EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso'); |
|
1722 | + EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso'); |
|
1723 | + EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso'); |
|
1724 | + EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso'); |
|
1725 | + EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso'); |
|
1726 | + EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso'); |
|
1727 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1728 | + EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso'); |
|
1729 | + EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso'); |
|
1730 | + EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso'); |
|
1731 | + EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso'); |
|
1732 | + EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso'); |
|
1733 | + EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso'); |
|
1734 | + EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso'); |
|
1735 | + |
|
1736 | + EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso'); |
|
1737 | + EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso'); |
|
1738 | + EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso'); |
|
1739 | + EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso'); |
|
1740 | + EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso'); |
|
1741 | + EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso'); |
|
1742 | + EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso'); |
|
1743 | + EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso'); |
|
1744 | + EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso'); |
|
1745 | + EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso'); |
|
1746 | + EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso'); |
|
1747 | + EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso'); |
|
1748 | + EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso'); |
|
1749 | + EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso'); |
|
1750 | 1750 | |
1751 | 1751 | //setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance |
1752 | 1752 | //admin page when in maintenance mode and ee_admin_js is not loaded then. This works everywhere else because |
1753 | 1753 | //espresso_core is listed as a dependency of ee_admin_js. |
1754 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1754 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1755 | 1755 | |
1756 | 1756 | } |
1757 | 1757 | |
@@ -1785,23 +1785,23 @@ discard block |
||
1785 | 1785 | protected function _set_list_table() { |
1786 | 1786 | |
1787 | 1787 | //first is this a list_table view? |
1788 | - if ( !isset($this->_route_config['list_table']) ) |
|
1788 | + if ( ! isset($this->_route_config['list_table'])) |
|
1789 | 1789 | return; //not a list_table view so get out. |
1790 | 1790 | |
1791 | 1791 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1792 | 1792 | |
1793 | - if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) { |
|
1793 | + if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) { |
|
1794 | 1794 | //user error msg |
1795 | - $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' ); |
|
1795 | + $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso'); |
|
1796 | 1796 | //developer error msg |
1797 | - $error_msg .= '||' . sprintf( __('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso' ), $this->_req_action, '_set_list_table_views_' . $this->_req_action ); |
|
1798 | - throw new EE_Error( $error_msg ); |
|
1797 | + $error_msg .= '||'.sprintf(__('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso'), $this->_req_action, '_set_list_table_views_'.$this->_req_action); |
|
1798 | + throw new EE_Error($error_msg); |
|
1799 | 1799 | } |
1800 | 1800 | |
1801 | 1801 | //let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally |
1802 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views ); |
|
1803 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views ); |
|
1804 | - $this->_views = apply_filters( 'FHEE_list_table_views', $this->_views ); |
|
1802 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views); |
|
1803 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views); |
|
1804 | + $this->_views = apply_filters('FHEE_list_table_views', $this->_views); |
|
1805 | 1805 | |
1806 | 1806 | $this->_set_list_table_view(); |
1807 | 1807 | $this->_set_list_table_object(); |
@@ -1823,14 +1823,14 @@ discard block |
||
1823 | 1823 | * @return array |
1824 | 1824 | */ |
1825 | 1825 | protected function _set_list_table_view() { |
1826 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1826 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1827 | 1827 | |
1828 | 1828 | |
1829 | 1829 | // looking at active items or dumpster diving ? |
1830 | - if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) { |
|
1831 | - $this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all'; |
|
1830 | + if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) { |
|
1831 | + $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all'; |
|
1832 | 1832 | } else { |
1833 | - $this->_view = sanitize_key( $this->_req_data['status'] ); |
|
1833 | + $this->_view = sanitize_key($this->_req_data['status']); |
|
1834 | 1834 | } |
1835 | 1835 | } |
1836 | 1836 | |
@@ -1843,8 +1843,8 @@ discard block |
||
1843 | 1843 | * @throws \EE_Error |
1844 | 1844 | */ |
1845 | 1845 | protected function _set_list_table_object() { |
1846 | - if ( isset( $this->_route_config['list_table'] ) ) { |
|
1847 | - if ( ! class_exists( $this->_route_config['list_table'] ) ) { |
|
1846 | + if (isset($this->_route_config['list_table'])) { |
|
1847 | + if ( ! class_exists($this->_route_config['list_table'])) { |
|
1848 | 1848 | throw new EE_Error( |
1849 | 1849 | sprintf( |
1850 | 1850 | __( |
@@ -1852,12 +1852,12 @@ discard block |
||
1852 | 1852 | 'event_espresso' |
1853 | 1853 | ), |
1854 | 1854 | $this->_route_config['list_table'], |
1855 | - get_class( $this ) |
|
1855 | + get_class($this) |
|
1856 | 1856 | ) |
1857 | 1857 | ); |
1858 | 1858 | } |
1859 | 1859 | $list_table = $this->_route_config['list_table']; |
1860 | - $this->_list_table_object = new $list_table( $this ); |
|
1860 | + $this->_list_table_object = new $list_table($this); |
|
1861 | 1861 | } |
1862 | 1862 | } |
1863 | 1863 | |
@@ -1874,27 +1874,27 @@ discard block |
||
1874 | 1874 | * |
1875 | 1875 | * @return array |
1876 | 1876 | */ |
1877 | - public function get_list_table_view_RLs( $extra_query_args = array() ) { |
|
1877 | + public function get_list_table_view_RLs($extra_query_args = array()) { |
|
1878 | 1878 | |
1879 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1879 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1880 | 1880 | |
1881 | - if ( empty( $this->_views )) { |
|
1881 | + if (empty($this->_views)) { |
|
1882 | 1882 | $this->_views = array(); |
1883 | 1883 | } |
1884 | 1884 | |
1885 | 1885 | // cycle thru views |
1886 | - foreach ( $this->_views as $key => $view ) { |
|
1886 | + foreach ($this->_views as $key => $view) { |
|
1887 | 1887 | $query_args = array(); |
1888 | 1888 | // check for current view |
1889 | - $this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1889 | + $this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1890 | 1890 | $query_args['action'] = $this->_req_action; |
1891 | - $query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
1891 | + $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
1892 | 1892 | $query_args['status'] = $view['slug']; |
1893 | 1893 | //merge any other arguments sent in. |
1894 | - if ( isset( $extra_query_args[$view['slug']] ) ) { |
|
1895 | - $query_args = array_merge( $query_args, $extra_query_args[$view['slug']] ); |
|
1894 | + if (isset($extra_query_args[$view['slug']])) { |
|
1895 | + $query_args = array_merge($query_args, $extra_query_args[$view['slug']]); |
|
1896 | 1896 | } |
1897 | - $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1897 | + $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1898 | 1898 | } |
1899 | 1899 | |
1900 | 1900 | return $this->_views; |
@@ -1911,15 +1911,15 @@ discard block |
||
1911 | 1911 | * @param int $max_entries total number of rows in the table |
1912 | 1912 | * @return string |
1913 | 1913 | */ |
1914 | - protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
|
1914 | + protected function _entries_per_page_dropdown($max_entries = FALSE) { |
|
1915 | 1915 | |
1916 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1917 | - $values = array( 10, 25, 50, 100 ); |
|
1918 | - $per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10; |
|
1916 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1917 | + $values = array(10, 25, 50, 100); |
|
1918 | + $per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10; |
|
1919 | 1919 | |
1920 | - if ( $max_entries ) { |
|
1920 | + if ($max_entries) { |
|
1921 | 1921 | $values[] = $max_entries; |
1922 | - sort( $values ); |
|
1922 | + sort($values); |
|
1923 | 1923 | } |
1924 | 1924 | |
1925 | 1925 | $entries_per_page_dropdown = ' |
@@ -1928,15 +1928,15 @@ discard block |
||
1928 | 1928 | Show |
1929 | 1929 | <select id="entries-per-page-slct" name="entries-per-page-slct">'; |
1930 | 1930 | |
1931 | - foreach ( $values as $value ) { |
|
1932 | - if ( $value < $max_entries ) { |
|
1933 | - $selected = $value == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1931 | + foreach ($values as $value) { |
|
1932 | + if ($value < $max_entries) { |
|
1933 | + $selected = $value == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1934 | 1934 | $entries_per_page_dropdown .= ' |
1935 | 1935 | <option value="'.$value.'"'.$selected.'>'.$value.' </option>'; |
1936 | 1936 | } |
1937 | 1937 | } |
1938 | 1938 | |
1939 | - $selected = $max_entries == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1939 | + $selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1940 | 1940 | $entries_per_page_dropdown .= ' |
1941 | 1941 | <option value="'.$max_entries.'"'.$selected.'>All </option>'; |
1942 | 1942 | |
@@ -1959,8 +1959,8 @@ discard block |
||
1959 | 1959 | * @return void |
1960 | 1960 | */ |
1961 | 1961 | public function _set_search_attributes() { |
1962 | - $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
|
1963 | - $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
|
1962 | + $this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label); |
|
1963 | + $this->_template_args['search']['callback'] = 'search_'.$this->page_slug; |
|
1964 | 1964 | } |
1965 | 1965 | |
1966 | 1966 | /*** END LIST TABLE METHODS **/ |
@@ -1979,10 +1979,10 @@ discard block |
||
1979 | 1979 | * @return void |
1980 | 1980 | */ |
1981 | 1981 | private function _add_registered_meta_boxes() { |
1982 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1982 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1983 | 1983 | |
1984 | 1984 | //we only add meta boxes if the page_route calls for it |
1985 | - if ( is_array( $this->_route_config ) && isset( $this->_route_config['metaboxes'] ) |
|
1985 | + if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) |
|
1986 | 1986 | && is_array( |
1987 | 1987 | $this->_route_config['metaboxes'] |
1988 | 1988 | ) |
@@ -1990,27 +1990,27 @@ discard block |
||
1990 | 1990 | // this simply loops through the callbacks provided |
1991 | 1991 | // and checks if there is a corresponding callback registered by the child |
1992 | 1992 | // if there is then we go ahead and process the metabox loader. |
1993 | - foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) { |
|
1993 | + foreach ($this->_route_config['metaboxes'] as $metabox_callback) { |
|
1994 | 1994 | // first check for Closures |
1995 | - if ( $metabox_callback instanceof Closure ) { |
|
1995 | + if ($metabox_callback instanceof Closure) { |
|
1996 | 1996 | $result = $metabox_callback(); |
1997 | - } else if ( is_array( $metabox_callback ) && isset( $metabox_callback[0], $metabox_callback[1] ) ) { |
|
1998 | - $result = call_user_func( array( $metabox_callback[0], $metabox_callback[1] ) ); |
|
1997 | + } else if (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) { |
|
1998 | + $result = call_user_func(array($metabox_callback[0], $metabox_callback[1])); |
|
1999 | 1999 | } else { |
2000 | - $result = call_user_func( array( $this, &$metabox_callback ) ); |
|
2000 | + $result = call_user_func(array($this, &$metabox_callback)); |
|
2001 | 2001 | } |
2002 | - if ( $result === FALSE ) { |
|
2002 | + if ($result === FALSE) { |
|
2003 | 2003 | // user error msg |
2004 | - $error_msg = __( 'An error occurred. The requested metabox could not be found.', 'event_espresso' ); |
|
2004 | + $error_msg = __('An error occurred. The requested metabox could not be found.', 'event_espresso'); |
|
2005 | 2005 | // developer error msg |
2006 | - $error_msg .= '||' . sprintf( |
|
2006 | + $error_msg .= '||'.sprintf( |
|
2007 | 2007 | __( |
2008 | 2008 | 'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', |
2009 | 2009 | 'event_espresso' |
2010 | 2010 | ), |
2011 | 2011 | $metabox_callback |
2012 | 2012 | ); |
2013 | - throw new EE_Error( $error_msg ); |
|
2013 | + throw new EE_Error($error_msg); |
|
2014 | 2014 | } |
2015 | 2015 | } |
2016 | 2016 | } |
@@ -2029,19 +2029,19 @@ discard block |
||
2029 | 2029 | private function _add_screen_columns() { |
2030 | 2030 | if ( |
2031 | 2031 | is_array($this->_route_config) |
2032 | - && isset( $this->_route_config['columns'] ) |
|
2032 | + && isset($this->_route_config['columns']) |
|
2033 | 2033 | && is_array($this->_route_config['columns']) |
2034 | - && count( $this->_route_config['columns'] ) === 2 |
|
2034 | + && count($this->_route_config['columns']) === 2 |
|
2035 | 2035 | ) { |
2036 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2036 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1])); |
|
2037 | 2037 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
2038 | 2038 | $screen_id = $this->_current_screen->id; |
2039 | 2039 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
2040 | - $total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2041 | - $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns; |
|
2040 | + $total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2041 | + $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns; |
|
2042 | 2042 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2043 | 2043 | $this->_template_args['screen'] = $this->_current_screen; |
2044 | - $this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php'; |
|
2044 | + $this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php'; |
|
2045 | 2045 | |
2046 | 2046 | //finally if we don't have has_metaboxes set in the route config let's make sure it IS set other wise the necessary hidden fields for this won't be loaded. |
2047 | 2047 | $this->_route_config['has_metaboxes'] = TRUE; |
@@ -2058,11 +2058,11 @@ discard block |
||
2058 | 2058 | */ |
2059 | 2059 | |
2060 | 2060 | private function _espresso_news_post_box() { |
2061 | - $news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) ); |
|
2062 | - add_meta_box( 'espresso_news_post_box', $news_box_title, array( |
|
2061 | + $news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso')); |
|
2062 | + add_meta_box('espresso_news_post_box', $news_box_title, array( |
|
2063 | 2063 | $this, |
2064 | 2064 | 'espresso_news_post_box' |
2065 | - ), $this->_wp_page_slug, 'side' ); |
|
2065 | + ), $this->_wp_page_slug, 'side'); |
|
2066 | 2066 | } |
2067 | 2067 | |
2068 | 2068 | |
@@ -2070,14 +2070,14 @@ discard block |
||
2070 | 2070 | * Code for setting up espresso ratings request metabox. |
2071 | 2071 | */ |
2072 | 2072 | protected function _espresso_ratings_request() { |
2073 | - if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) { |
|
2073 | + if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) { |
|
2074 | 2074 | return ''; |
2075 | 2075 | } |
2076 | - $ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') ); |
|
2077 | - add_meta_box( 'espresso_ratings_request', $ratings_box_title, array( |
|
2076 | + $ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso')); |
|
2077 | + add_meta_box('espresso_ratings_request', $ratings_box_title, array( |
|
2078 | 2078 | $this, |
2079 | 2079 | 'espresso_ratings_request' |
2080 | - ), $this->_wp_page_slug, 'side' ); |
|
2080 | + ), $this->_wp_page_slug, 'side'); |
|
2081 | 2081 | } |
2082 | 2082 | |
2083 | 2083 | |
@@ -2085,34 +2085,34 @@ discard block |
||
2085 | 2085 | * Code for setting up espresso ratings request metabox content. |
2086 | 2086 | */ |
2087 | 2087 | public function espresso_ratings_request() { |
2088 | - $template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php'; |
|
2089 | - EEH_Template::display_template( $template_path, array() ); |
|
2088 | + $template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php'; |
|
2089 | + EEH_Template::display_template($template_path, array()); |
|
2090 | 2090 | } |
2091 | 2091 | |
2092 | 2092 | |
2093 | 2093 | |
2094 | 2094 | |
2095 | - public static function cached_rss_display( $rss_id, $url ) { |
|
2096 | - $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>'; |
|
2097 | - $doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
2098 | - $pre = '<div class="espresso-rss-display">' . "\n\t"; |
|
2099 | - $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>'; |
|
2100 | - $post = '</div>' . "\n"; |
|
2095 | + public static function cached_rss_display($rss_id, $url) { |
|
2096 | + $loading = '<p class="widget-loading hide-if-no-js">'.__('Loading…').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>'; |
|
2097 | + $doing_ajax = (defined('DOING_AJAX') && DOING_AJAX); |
|
2098 | + $pre = '<div class="espresso-rss-display">'."\n\t"; |
|
2099 | + $pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>'; |
|
2100 | + $post = '</div>'."\n"; |
|
2101 | 2101 | |
2102 | - $cache_key = 'ee_rss_' . md5( $rss_id ); |
|
2103 | - if ( FALSE != ( $output = get_transient( $cache_key ) ) ) { |
|
2104 | - echo $pre . $output . $post; |
|
2102 | + $cache_key = 'ee_rss_'.md5($rss_id); |
|
2103 | + if (FALSE != ($output = get_transient($cache_key))) { |
|
2104 | + echo $pre.$output.$post; |
|
2105 | 2105 | return TRUE; |
2106 | 2106 | } |
2107 | 2107 | |
2108 | - if ( ! $doing_ajax ) { |
|
2109 | - echo $pre . $loading . $post; |
|
2108 | + if ( ! $doing_ajax) { |
|
2109 | + echo $pre.$loading.$post; |
|
2110 | 2110 | return FALSE; |
2111 | 2111 | } |
2112 | 2112 | |
2113 | 2113 | ob_start(); |
2114 | - wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) ); |
|
2115 | - set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); |
|
2114 | + wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5)); |
|
2115 | + set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS); |
|
2116 | 2116 | return TRUE; |
2117 | 2117 | |
2118 | 2118 | } |
@@ -2124,13 +2124,13 @@ discard block |
||
2124 | 2124 | <div id="espresso_news_post_box_content" class="infolinks"> |
2125 | 2125 | <?php |
2126 | 2126 | // Get RSS Feed(s) |
2127 | - $feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' ); |
|
2127 | + $feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/'); |
|
2128 | 2128 | $url = urlencode($feed_url); |
2129 | - self::cached_rss_display( 'espresso_news_post_box_content', $url ); |
|
2129 | + self::cached_rss_display('espresso_news_post_box_content', $url); |
|
2130 | 2130 | |
2131 | 2131 | ?> |
2132 | 2132 | </div> |
2133 | - <?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2133 | + <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2134 | 2134 | </div> |
2135 | 2135 | <?php |
2136 | 2136 | } |
@@ -2151,32 +2151,32 @@ discard block |
||
2151 | 2151 | |
2152 | 2152 | protected function _espresso_sponsors_post_box() { |
2153 | 2153 | |
2154 | - $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
|
2155 | - if ( $show_sponsors ) |
|
2156 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2154 | + $show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE); |
|
2155 | + if ($show_sponsors) |
|
2156 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2157 | 2157 | } |
2158 | 2158 | |
2159 | 2159 | |
2160 | 2160 | public function espresso_sponsors_post_box() { |
2161 | - $templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2162 | - EEH_Template::display_template( $templatepath ); |
|
2161 | + $templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2162 | + EEH_Template::display_template($templatepath); |
|
2163 | 2163 | } |
2164 | 2164 | |
2165 | 2165 | |
2166 | 2166 | |
2167 | 2167 | private function _publish_post_box() { |
2168 | - $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview'; |
|
2168 | + $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview'; |
|
2169 | 2169 | |
2170 | 2170 | //if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array then we'll use that for the metabox label. Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes) |
2171 | - if ( !empty( $this->_labels['publishbox'] ) ) { |
|
2172 | - $box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2171 | + if ( ! empty($this->_labels['publishbox'])) { |
|
2172 | + $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2173 | 2173 | } else { |
2174 | 2174 | $box_label = __('Publish', 'event_espresso'); |
2175 | 2175 | } |
2176 | 2176 | |
2177 | - $box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this ); |
|
2177 | + $box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this); |
|
2178 | 2178 | |
2179 | - add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' ); |
|
2179 | + add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high'); |
|
2180 | 2180 | |
2181 | 2181 | } |
2182 | 2182 | |
@@ -2184,9 +2184,9 @@ discard block |
||
2184 | 2184 | |
2185 | 2185 | public function editor_overview() { |
2186 | 2186 | //if we have extra content set let's add it in if not make sure its empty |
2187 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2188 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php'; |
|
2189 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2187 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2188 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php'; |
|
2189 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2190 | 2190 | } |
2191 | 2191 | |
2192 | 2192 | |
@@ -2202,8 +2202,8 @@ discard block |
||
2202 | 2202 | * @see $this->_set_publish_post_box_vars for param details |
2203 | 2203 | * @since 4.6.0 |
2204 | 2204 | */ |
2205 | - public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) { |
|
2206 | - $this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns ); |
|
2205 | + public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) { |
|
2206 | + $this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns); |
|
2207 | 2207 | } |
2208 | 2208 | |
2209 | 2209 | |
@@ -2231,17 +2231,17 @@ discard block |
||
2231 | 2231 | $both_btns = true |
2232 | 2232 | ) { |
2233 | 2233 | // if Save & Close, use a custom redirect URL or default to the main page? |
2234 | - $save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2234 | + $save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2235 | 2235 | // create the Save & Close and Save buttons |
2236 | - $this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL ); |
|
2236 | + $this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL); |
|
2237 | 2237 | //if we have extra content set let's add it in if not make sure its empty |
2238 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2238 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2239 | 2239 | |
2240 | 2240 | |
2241 | - if ( $delete && ! empty( $id ) ) { |
|
2241 | + if ($delete && ! empty($id)) { |
|
2242 | 2242 | //make sure we have a default if just true is sent. |
2243 | 2243 | $delete = ! empty($delete) ? $delete : 'delete'; |
2244 | - $delete_link_args = array( $name => $id ); |
|
2244 | + $delete_link_args = array($name => $id); |
|
2245 | 2245 | $delete = $this->get_action_link_or_button( |
2246 | 2246 | $delete, |
2247 | 2247 | $delete, |
@@ -2252,8 +2252,8 @@ discard block |
||
2252 | 2252 | ); |
2253 | 2253 | } |
2254 | 2254 | |
2255 | - $this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : ''; |
|
2256 | - if ( ! empty( $name ) && ! empty( $id ) ) { |
|
2255 | + $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : ''; |
|
2256 | + if ( ! empty($name) && ! empty($id)) { |
|
2257 | 2257 | $hidden_field_arr[$name] = array( |
2258 | 2258 | 'type' => 'hidden', |
2259 | 2259 | 'value' => $id |
@@ -2263,7 +2263,7 @@ discard block |
||
2263 | 2263 | $hf = ''; |
2264 | 2264 | } |
2265 | 2265 | // add hidden field |
2266 | - $this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf; |
|
2266 | + $this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf; |
|
2267 | 2267 | |
2268 | 2268 | } |
2269 | 2269 | |
@@ -2280,8 +2280,8 @@ discard block |
||
2280 | 2280 | <noscript> |
2281 | 2281 | <div id="no-js-message" class="error"> |
2282 | 2282 | <p style="font-size:1.3em;"> |
2283 | - <span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span> |
|
2284 | - <?php _e( 'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso' ); ?> |
|
2283 | + <span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span> |
|
2284 | + <?php _e('Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso'); ?> |
|
2285 | 2285 | </p> |
2286 | 2286 | </div> |
2287 | 2287 | </noscript> |
@@ -2301,7 +2301,7 @@ discard block |
||
2301 | 2301 | * @return string |
2302 | 2302 | */ |
2303 | 2303 | private function _display_espresso_notices() { |
2304 | - $notices = $this->_get_transient( TRUE ); |
|
2304 | + $notices = $this->_get_transient(TRUE); |
|
2305 | 2305 | echo stripslashes($notices); |
2306 | 2306 | } |
2307 | 2307 | |
@@ -2353,11 +2353,11 @@ discard block |
||
2353 | 2353 | * @param string $priority give this metabox a priority (using accepted priorities for wp meta boxes) |
2354 | 2354 | * @param boolean $create_func default is true. Basically we can say we don't WANT to have the runtime function created but just set our own callback for wp's add_meta_box. |
2355 | 2355 | */ |
2356 | - public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) { |
|
2357 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback ); |
|
2356 | + public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) { |
|
2357 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $callback); |
|
2358 | 2358 | |
2359 | 2359 | //if we have empty callback args and we want to automatically create the metabox callback then we need to make sure the callback args are generated. |
2360 | - if ( empty( $callback_args ) && $create_func ) { |
|
2360 | + if (empty($callback_args) && $create_func) { |
|
2361 | 2361 | $callback_args = array( |
2362 | 2362 | 'template_path' => $this->_template_path, |
2363 | 2363 | 'template_args' => $this->_template_args, |
@@ -2367,7 +2367,7 @@ discard block |
||
2367 | 2367 | //if $create_func is true (default) then we automatically create the function for displaying the actual meta box. If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish) |
2368 | 2368 | $call_back_func = $create_func ? create_function('$post, $metabox', 'do_action( "AHEE_log", __FILE__, __FUNCTION__, ""); echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );') : $callback; |
2369 | 2369 | |
2370 | - add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args ); |
|
2370 | + add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args); |
|
2371 | 2371 | } |
2372 | 2372 | |
2373 | 2373 | |
@@ -2380,7 +2380,7 @@ discard block |
||
2380 | 2380 | */ |
2381 | 2381 | public function display_admin_page_with_metabox_columns() { |
2382 | 2382 | $this->_template_args['post_body_content'] = $this->_template_args['admin_page_content']; |
2383 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE); |
|
2383 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE); |
|
2384 | 2384 | |
2385 | 2385 | //the final wrapper |
2386 | 2386 | $this->admin_page_wrapper(); |
@@ -2423,7 +2423,7 @@ discard block |
||
2423 | 2423 | * @return void |
2424 | 2424 | */ |
2425 | 2425 | public function display_about_admin_page() { |
2426 | - $this->_display_admin_page( FALSE, TRUE ); |
|
2426 | + $this->_display_admin_page(FALSE, TRUE); |
|
2427 | 2427 | } |
2428 | 2428 | |
2429 | 2429 | |
@@ -2439,10 +2439,10 @@ discard block |
||
2439 | 2439 | * @return void |
2440 | 2440 | */ |
2441 | 2441 | private function _display_admin_page($sidebar = false, $about = FALSE) { |
2442 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2442 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2443 | 2443 | |
2444 | 2444 | //custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages. |
2445 | - do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' ); |
|
2445 | + do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes'); |
|
2446 | 2446 | |
2447 | 2447 | // set current wp page slug - looks like: event-espresso_page_event_categories |
2448 | 2448 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
@@ -2452,19 +2452,19 @@ discard block |
||
2452 | 2452 | : 'espresso-default-admin'; |
2453 | 2453 | |
2454 | 2454 | $template_path = $sidebar |
2455 | - ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' |
|
2456 | - : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2455 | + ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' |
|
2456 | + : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php'; |
|
2457 | 2457 | |
2458 | - if ( defined('DOING_AJAX' ) && DOING_AJAX ){ |
|
2459 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2458 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
2459 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2460 | 2460 | } |
2461 | 2461 | |
2462 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2462 | + $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2463 | 2463 | |
2464 | - $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
|
2464 | + $this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : ''; |
|
2465 | 2465 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
2466 | 2466 | $this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''; |
2467 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2467 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2468 | 2468 | |
2469 | 2469 | |
2470 | 2470 | // the final template wrapper |
@@ -2482,7 +2482,7 @@ discard block |
||
2482 | 2482 | * @return void |
2483 | 2483 | * @throws \EE_Error |
2484 | 2484 | */ |
2485 | - public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) { |
|
2485 | + public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) { |
|
2486 | 2486 | //let's generate a default preview action button if there isn't one already present. |
2487 | 2487 | $this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso'); |
2488 | 2488 | $buy_now_url = add_query_arg( |
@@ -2495,7 +2495,7 @@ discard block |
||
2495 | 2495 | ), |
2496 | 2496 | 'http://eventespresso.com/pricing/' |
2497 | 2497 | ); |
2498 | - $this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] ) |
|
2498 | + $this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button']) |
|
2499 | 2499 | ? $this->get_action_link_or_button( |
2500 | 2500 | '', |
2501 | 2501 | 'buy_now', |
@@ -2505,13 +2505,13 @@ discard block |
||
2505 | 2505 | true |
2506 | 2506 | ) |
2507 | 2507 | : $this->_template_args['preview_action_button']; |
2508 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php'; |
|
2508 | + $template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php'; |
|
2509 | 2509 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
2510 | 2510 | $template_path, |
2511 | 2511 | $this->_template_args, |
2512 | 2512 | true |
2513 | 2513 | ); |
2514 | - $this->_display_admin_page( $display_sidebar ); |
|
2514 | + $this->_display_admin_page($display_sidebar); |
|
2515 | 2515 | } |
2516 | 2516 | |
2517 | 2517 | |
@@ -2545,49 +2545,49 @@ discard block |
||
2545 | 2545 | * @param boolean $sidebar whether to display with sidebar or not. |
2546 | 2546 | * @return void |
2547 | 2547 | */ |
2548 | - private function _display_admin_list_table_page( $sidebar = false ) { |
|
2548 | + private function _display_admin_list_table_page($sidebar = false) { |
|
2549 | 2549 | //setup search attributes |
2550 | 2550 | $this->_set_search_attributes(); |
2551 | 2551 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2552 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php'; |
|
2552 | + $template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php'; |
|
2553 | 2553 | |
2554 | - $this->_template_args['table_url'] = defined( 'DOING_AJAX') |
|
2555 | - ? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url ) |
|
2556 | - : add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url); |
|
2554 | + $this->_template_args['table_url'] = defined('DOING_AJAX') |
|
2555 | + ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) |
|
2556 | + : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url); |
|
2557 | 2557 | $this->_template_args['list_table'] = $this->_list_table_object; |
2558 | 2558 | $this->_template_args['current_route'] = $this->_req_action; |
2559 | - $this->_template_args['list_table_class'] = get_class( $this->_list_table_object ); |
|
2559 | + $this->_template_args['list_table_class'] = get_class($this->_list_table_object); |
|
2560 | 2560 | |
2561 | 2561 | $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback(); |
2562 | - if( ! empty( $ajax_sorting_callback )) { |
|
2562 | + if ( ! empty($ajax_sorting_callback)) { |
|
2563 | 2563 | $sortable_list_table_form_fields = wp_nonce_field( |
2564 | - $ajax_sorting_callback . '_nonce', |
|
2565 | - $ajax_sorting_callback . '_nonce', |
|
2564 | + $ajax_sorting_callback.'_nonce', |
|
2565 | + $ajax_sorting_callback.'_nonce', |
|
2566 | 2566 | FALSE, |
2567 | 2567 | FALSE |
2568 | 2568 | ); |
2569 | 2569 | // $reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce'; |
2570 | 2570 | // $sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE ); |
2571 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />'; |
|
2572 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />'; |
|
2571 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />'; |
|
2572 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />'; |
|
2573 | 2573 | } else { |
2574 | 2574 | $sortable_list_table_form_fields = ''; |
2575 | 2575 | } |
2576 | 2576 | |
2577 | 2577 | $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields; |
2578 | - $hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2579 | - $nonce_ref = $this->_req_action . '_nonce'; |
|
2580 | - $hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">'; |
|
2578 | + $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2579 | + $nonce_ref = $this->_req_action.'_nonce'; |
|
2580 | + $hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">'; |
|
2581 | 2581 | $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields; |
2582 | 2582 | |
2583 | 2583 | //display message about search results? |
2584 | 2584 | $this->_template_args['before_list_table'] .= apply_filters( |
2585 | 2585 | 'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', |
2586 | - ! empty( $this->_req_data['s'] ) |
|
2587 | - ? '<p class="ee-search-results">' . sprintf( |
|
2588 | - __( 'Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso' ), |
|
2589 | - trim( $this->_req_data['s'], '%' ) |
|
2590 | - ) . '</p>' |
|
2586 | + ! empty($this->_req_data['s']) |
|
2587 | + ? '<p class="ee-search-results">'.sprintf( |
|
2588 | + __('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), |
|
2589 | + trim($this->_req_data['s'], '%') |
|
2590 | + ).'</p>' |
|
2591 | 2591 | : '', |
2592 | 2592 | $this->page_slug, |
2593 | 2593 | $this->_req_data, |
@@ -2599,7 +2599,7 @@ discard block |
||
2599 | 2599 | true |
2600 | 2600 | ); |
2601 | 2601 | // the final template wrapper |
2602 | - if ( $sidebar ) |
|
2602 | + if ($sidebar) |
|
2603 | 2603 | $this->display_admin_page_with_sidebar(); |
2604 | 2604 | else |
2605 | 2605 | $this->display_admin_page_with_no_sidebar(); |
@@ -2622,9 +2622,9 @@ discard block |
||
2622 | 2622 | * @param array $items see above for format of array |
2623 | 2623 | * @return string html string of legend |
2624 | 2624 | */ |
2625 | - protected function _display_legend( $items ) { |
|
2626 | - $this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this ); |
|
2627 | - $legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php'; |
|
2625 | + protected function _display_legend($items) { |
|
2626 | + $this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this); |
|
2627 | + $legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php'; |
|
2628 | 2628 | return EEH_Template::display_template($legend_template, $this->_template_args, TRUE); |
2629 | 2629 | } |
2630 | 2630 | |
@@ -2649,33 +2649,33 @@ discard block |
||
2649 | 2649 | * |
2650 | 2650 | * @return void |
2651 | 2651 | */ |
2652 | - protected function _return_json( $sticky_notices = false ) { |
|
2652 | + protected function _return_json($sticky_notices = false) { |
|
2653 | 2653 | |
2654 | 2654 | //make sure any EE_Error notices have been handled. |
2655 | - $this->_process_notices( array(), true, $sticky_notices ); |
|
2655 | + $this->_process_notices(array(), true, $sticky_notices); |
|
2656 | 2656 | |
2657 | 2657 | |
2658 | - $data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array(); |
|
2658 | + $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array(); |
|
2659 | 2659 | unset($this->_template_args['data']); |
2660 | 2660 | $json = array( |
2661 | - 'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false, |
|
2662 | - 'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false, |
|
2663 | - 'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false, |
|
2664 | - 'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false, |
|
2661 | + 'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false, |
|
2662 | + 'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false, |
|
2663 | + 'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false, |
|
2664 | + 'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false, |
|
2665 | 2665 | 'notices' => EE_Error::get_notices(), |
2666 | - 'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '', |
|
2667 | - 'data' => array_merge( $data, array('template_args' => $this->_template_args ) ), |
|
2666 | + 'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '', |
|
2667 | + 'data' => array_merge($data, array('template_args' => $this->_template_args)), |
|
2668 | 2668 | 'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package. |
2669 | 2669 | ); |
2670 | 2670 | |
2671 | 2671 | |
2672 | 2672 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2673 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2673 | + if (NULL === error_get_last() || ! headers_sent()) |
|
2674 | 2674 | header('Content-Type: application/json; charset=UTF-8'); |
2675 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2676 | - echo wp_json_encode( $json ); |
|
2675 | + if (function_exists('wp_json_encode')) { |
|
2676 | + echo wp_json_encode($json); |
|
2677 | 2677 | } else { |
2678 | - echo json_encode( $json ); |
|
2678 | + echo json_encode($json); |
|
2679 | 2679 | } |
2680 | 2680 | exit(); |
2681 | 2681 | } |
@@ -2689,11 +2689,11 @@ discard block |
||
2689 | 2689 | * @throws EE_Error |
2690 | 2690 | */ |
2691 | 2691 | public function return_json() { |
2692 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2692 | + if (defined('DOING_AJAX') && DOING_AJAX) |
|
2693 | 2693 | $this->_return_json(); |
2694 | 2694 | |
2695 | 2695 | else { |
2696 | - throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
|
2696 | + throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__)); |
|
2697 | 2697 | } |
2698 | 2698 | } |
2699 | 2699 | |
@@ -2706,7 +2706,7 @@ discard block |
||
2706 | 2706 | * |
2707 | 2707 | * @access public |
2708 | 2708 | */ |
2709 | - public function set_hook_object( EE_Admin_Hooks $hook_obj ) { |
|
2709 | + public function set_hook_object(EE_Admin_Hooks $hook_obj) { |
|
2710 | 2710 | $this->_hook_obj = $hook_obj; |
2711 | 2711 | } |
2712 | 2712 | |
@@ -2722,33 +2722,33 @@ discard block |
||
2722 | 2722 | */ |
2723 | 2723 | public function admin_page_wrapper($about = FALSE) { |
2724 | 2724 | |
2725 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2725 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2726 | 2726 | |
2727 | 2727 | $this->_nav_tabs = $this->_get_main_nav_tabs(); |
2728 | 2728 | |
2729 | 2729 | $this->_template_args['nav_tabs'] = $this->_nav_tabs; |
2730 | 2730 | $this->_template_args['admin_page_title'] = $this->_admin_page_title; |
2731 | 2731 | |
2732 | - $this->_template_args['before_admin_page_content'] = apply_filters( 'FHEE_before_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['before_admin_page_content'] ) ? $this->_template_args['before_admin_page_content'] : ''); |
|
2733 | - $this->_template_args['after_admin_page_content'] = apply_filters( 'FHEE_after_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['after_admin_page_content'] ) ? $this->_template_args['after_admin_page_content'] : ''); |
|
2732 | + $this->_template_args['before_admin_page_content'] = apply_filters('FHEE_before_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''); |
|
2733 | + $this->_template_args['after_admin_page_content'] = apply_filters('FHEE_after_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''); |
|
2734 | 2734 | |
2735 | 2735 | $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content(); |
2736 | 2736 | |
2737 | 2737 | |
2738 | 2738 | |
2739 | 2739 | // load settings page wrapper template |
2740 | - $template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php'; |
|
2740 | + $template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php'; |
|
2741 | 2741 | |
2742 | 2742 | //about page? |
2743 | - $template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path; |
|
2743 | + $template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path; |
|
2744 | 2744 | |
2745 | 2745 | |
2746 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2747 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2746 | + if (defined('DOING_AJAX')) { |
|
2747 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2748 | 2748 | |
2749 | 2749 | $this->_return_json(); |
2750 | 2750 | } else { |
2751 | - EEH_Template::display_template( $template_path, $this->_template_args ); |
|
2751 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
2752 | 2752 | } |
2753 | 2753 | |
2754 | 2754 | } |
@@ -2774,7 +2774,7 @@ discard block |
||
2774 | 2774 | * @param $b |
2775 | 2775 | * @return int |
2776 | 2776 | */ |
2777 | - private function _sort_nav_tabs( $a, $b ) { |
|
2777 | + private function _sort_nav_tabs($a, $b) { |
|
2778 | 2778 | if ($a['order'] == $b['order']) { |
2779 | 2779 | return 0; |
2780 | 2780 | } |
@@ -2794,7 +2794,7 @@ discard block |
||
2794 | 2794 | * @uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php) |
2795 | 2795 | * @uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php) |
2796 | 2796 | */ |
2797 | - protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) { |
|
2797 | + protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) { |
|
2798 | 2798 | $content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars); |
2799 | 2799 | return $content; |
2800 | 2800 | } |
@@ -2816,25 +2816,25 @@ discard block |
||
2816 | 2816 | * @param array $actions if included allows us to set the actions that each button will carry out (i.e. via the "name" value in the button). We can also use this to just dump default actions by submitting some other value. |
2817 | 2817 | * @param bool|string|null $referrer if false then we just do the default action on save and close. Other wise it will use the $referrer string. IF null, then we don't do ANYTHING on save and close (normal form handling). |
2818 | 2818 | */ |
2819 | - protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) { |
|
2819 | + protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) { |
|
2820 | 2820 | //make sure $text and $actions are in an array |
2821 | 2821 | $text = (array) $text; |
2822 | 2822 | $actions = (array) $actions; |
2823 | 2823 | $referrer_url = empty($referrer) ? '' : $referrer; |
2824 | - $referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $_SERVER['REQUEST_URI'] .'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $referrer .'" />'; |
|
2824 | + $referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$_SERVER['REQUEST_URI'].'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$referrer.'" />'; |
|
2825 | 2825 | |
2826 | - $button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') ); |
|
2827 | - $default_names = array( 'save', 'save_and_close' ); |
|
2826 | + $button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso')); |
|
2827 | + $default_names = array('save', 'save_and_close'); |
|
2828 | 2828 | |
2829 | 2829 | //add in a hidden index for the current page (so save and close redirects properly) |
2830 | 2830 | $this->_template_args['save_buttons'] = $referrer_url; |
2831 | 2831 | |
2832 | - foreach ( $button_text as $key => $button ) { |
|
2832 | + foreach ($button_text as $key => $button) { |
|
2833 | 2833 | $ref = $default_names[$key]; |
2834 | - $id = $this->_current_view . '_' . $ref; |
|
2835 | - $name = !empty($actions) ? $actions[$key] : $ref; |
|
2836 | - $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
|
2837 | - if ( !$both ) break; |
|
2834 | + $id = $this->_current_view.'_'.$ref; |
|
2835 | + $name = ! empty($actions) ? $actions[$key] : $ref; |
|
2836 | + $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />'; |
|
2837 | + if ( ! $both) break; |
|
2838 | 2838 | } |
2839 | 2839 | |
2840 | 2840 | } |
@@ -2849,8 +2849,8 @@ discard block |
||
2849 | 2849 | * @param string $route |
2850 | 2850 | * @param array $additional_hidden_fields |
2851 | 2851 | */ |
2852 | - public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2853 | - $this->_set_add_edit_form_tags( $route, $additional_hidden_fields ); |
|
2852 | + public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2853 | + $this->_set_add_edit_form_tags($route, $additional_hidden_fields); |
|
2854 | 2854 | } |
2855 | 2855 | |
2856 | 2856 | |
@@ -2863,30 +2863,30 @@ discard block |
||
2863 | 2863 | * @param array $additional_hidden_fields any additional hidden fields required in the form header |
2864 | 2864 | * @return void |
2865 | 2865 | */ |
2866 | - protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2866 | + protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2867 | 2867 | |
2868 | - if ( empty( $route )) { |
|
2868 | + if (empty($route)) { |
|
2869 | 2869 | $user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso'); |
2870 | - $dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ ); |
|
2871 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2870 | + $dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__); |
|
2871 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
2872 | 2872 | } |
2873 | 2873 | // open form |
2874 | - $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >'; |
|
2874 | + $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >'; |
|
2875 | 2875 | // add nonce |
2876 | - $nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE ); |
|
2876 | + $nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE); |
|
2877 | 2877 | // $nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE ); |
2878 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce; |
|
2878 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce; |
|
2879 | 2879 | // add REQUIRED form action |
2880 | 2880 | $hidden_fields = array( |
2881 | - 'action' => array( 'type' => 'hidden', 'value' => $route ), |
|
2881 | + 'action' => array('type' => 'hidden', 'value' => $route), |
|
2882 | 2882 | ); |
2883 | 2883 | // merge arrays |
2884 | - $hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields; |
|
2884 | + $hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields; |
|
2885 | 2885 | // generate form fields |
2886 | - $form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' ); |
|
2886 | + $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array'); |
|
2887 | 2887 | // add fields to form |
2888 | - foreach ( (array)$form_fields as $field_name => $form_field ) { |
|
2889 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field']; |
|
2888 | + foreach ((array) $form_fields as $field_name => $form_field) { |
|
2889 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field']; |
|
2890 | 2890 | } |
2891 | 2891 | |
2892 | 2892 | // close form |
@@ -2903,8 +2903,8 @@ discard block |
||
2903 | 2903 | * @see EE_Admin_Page::_redirect_after_action() for params. |
2904 | 2904 | * @since 4.5.0 |
2905 | 2905 | */ |
2906 | - public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2907 | - $this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite ); |
|
2906 | + public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2907 | + $this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite); |
|
2908 | 2908 | } |
2909 | 2909 | |
2910 | 2910 | |
@@ -2920,38 +2920,38 @@ discard block |
||
2920 | 2920 | * @access protected |
2921 | 2921 | * @return void |
2922 | 2922 | */ |
2923 | - protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2923 | + protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2924 | 2924 | |
2925 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2925 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2926 | 2926 | |
2927 | 2927 | //class name for actions/filters. |
2928 | 2928 | $classname = get_class($this); |
2929 | 2929 | |
2930 | 2930 | //set redirect url. Note if there is a "page" index in the $query_args then we go with vanilla admin.php route, otherwise we go with whatever is set as the _admin_base_url |
2931 | - $redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2932 | - $notices = EE_Error::get_notices( FALSE ); |
|
2931 | + $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2932 | + $notices = EE_Error::get_notices(FALSE); |
|
2933 | 2933 | |
2934 | 2934 | // overwrite default success messages //BUT ONLY if overwrite not overridden |
2935 | - if ( ! $override_overwrite || ! empty( $notices['errors'] )) { |
|
2935 | + if ( ! $override_overwrite || ! empty($notices['errors'])) { |
|
2936 | 2936 | EE_Error::overwrite_success(); |
2937 | 2937 | } |
2938 | - if ( ! empty( $what ) && ! empty( $action_desc ) ) { |
|
2938 | + if ( ! empty($what) && ! empty($action_desc)) { |
|
2939 | 2939 | // how many records affected ? more than one record ? or just one ? |
2940 | - if ( $success > 1 && empty( $notices[ 'errors' ] ) ) { |
|
2940 | + if ($success > 1 && empty($notices['errors'])) { |
|
2941 | 2941 | // set plural msg |
2942 | 2942 | EE_Error::add_success( |
2943 | 2943 | sprintf( |
2944 | - __( 'The "%s" have been successfully %s.', 'event_espresso' ), |
|
2944 | + __('The "%s" have been successfully %s.', 'event_espresso'), |
|
2945 | 2945 | $what, |
2946 | 2946 | $action_desc |
2947 | 2947 | ), |
2948 | 2948 | __FILE__, __FUNCTION__, __LINE__ |
2949 | 2949 | ); |
2950 | - } else if ( $success == 1 && empty( $notices[ 'errors' ] ) ) { |
|
2950 | + } else if ($success == 1 && empty($notices['errors'])) { |
|
2951 | 2951 | // set singular msg |
2952 | 2952 | EE_Error::add_success( |
2953 | 2953 | sprintf( |
2954 | - __( 'The "%s" has been successfully %s.', 'event_espresso' ), |
|
2954 | + __('The "%s" has been successfully %s.', 'event_espresso'), |
|
2955 | 2955 | $what, |
2956 | 2956 | $action_desc |
2957 | 2957 | ), |
@@ -2960,7 +2960,7 @@ discard block |
||
2960 | 2960 | } |
2961 | 2961 | } |
2962 | 2962 | // check that $query_args isn't something crazy |
2963 | - if ( ! is_array( $query_args )) { |
|
2963 | + if ( ! is_array($query_args)) { |
|
2964 | 2964 | $query_args = array(); |
2965 | 2965 | } |
2966 | 2966 | |
@@ -2973,36 +2973,36 @@ discard block |
||
2973 | 2973 | * @param array $query_args The original query_args array coming into the |
2974 | 2974 | * method. |
2975 | 2975 | */ |
2976 | - do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args ); |
|
2976 | + do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args); |
|
2977 | 2977 | |
2978 | 2978 | //calculate where we're going (if we have a "save and close" button pushed) |
2979 | - if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) { |
|
2979 | + if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) { |
|
2980 | 2980 | // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce |
2981 | - $parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] ); |
|
2981 | + $parsed_url = parse_url($this->_req_data['save_and_close_referrer']); |
|
2982 | 2982 | // regenerate query args array from referrer URL |
2983 | - parse_str( $parsed_url['query'], $query_args ); |
|
2983 | + parse_str($parsed_url['query'], $query_args); |
|
2984 | 2984 | // correct page and action will be in the query args now |
2985 | - $redirect_url = admin_url( 'admin.php' ); |
|
2985 | + $redirect_url = admin_url('admin.php'); |
|
2986 | 2986 | } |
2987 | 2987 | |
2988 | 2988 | //merge any default query_args set in _default_route_query_args property |
2989 | - if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) { |
|
2989 | + if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) { |
|
2990 | 2990 | $args_to_merge = array(); |
2991 | - foreach ( $this->_default_route_query_args as $query_param => $query_value ) { |
|
2991 | + foreach ($this->_default_route_query_args as $query_param => $query_value) { |
|
2992 | 2992 | //is there a wp_referer array in our _default_route_query_args property? |
2993 | - if ( $query_param == 'wp_referer' ) { |
|
2993 | + if ($query_param == 'wp_referer') { |
|
2994 | 2994 | $query_value = (array) $query_value; |
2995 | - foreach ( $query_value as $reference => $value ) { |
|
2996 | - if ( strpos( $reference, 'nonce' ) !== false ) { |
|
2995 | + foreach ($query_value as $reference => $value) { |
|
2996 | + if (strpos($reference, 'nonce') !== false) { |
|
2997 | 2997 | continue; |
2998 | 2998 | } |
2999 | 2999 | |
3000 | 3000 | //finally we will override any arguments in the referer with |
3001 | 3001 | //what might be set on the _default_route_query_args array. |
3002 | - if ( isset( $this->_default_route_query_args[$reference] ) ) { |
|
3003 | - $args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] ); |
|
3002 | + if (isset($this->_default_route_query_args[$reference])) { |
|
3003 | + $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]); |
|
3004 | 3004 | } else { |
3005 | - $args_to_merge[$reference] = urlencode( $value ); |
|
3005 | + $args_to_merge[$reference] = urlencode($value); |
|
3006 | 3006 | } |
3007 | 3007 | } |
3008 | 3008 | continue; |
@@ -3013,7 +3013,7 @@ discard block |
||
3013 | 3013 | |
3014 | 3014 | //now let's merge these arguments but override with what was specifically sent in to the |
3015 | 3015 | //redirect. |
3016 | - $query_args = array_merge( $args_to_merge, $query_args ); |
|
3016 | + $query_args = array_merge($args_to_merge, $query_args); |
|
3017 | 3017 | } |
3018 | 3018 | |
3019 | 3019 | $this->_process_notices($query_args); |
@@ -3022,19 +3022,19 @@ discard block |
||
3022 | 3022 | // generate redirect url |
3023 | 3023 | |
3024 | 3024 | // if redirecting to anything other than the main page, add a nonce |
3025 | - if ( isset( $query_args['action'] )) { |
|
3025 | + if (isset($query_args['action'])) { |
|
3026 | 3026 | // manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars |
3027 | - $query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
3027 | + $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
3028 | 3028 | } |
3029 | 3029 | |
3030 | 3030 | //we're adding some hooks and filters in here for processing any things just before redirects (example: an admin page has done an insert or update and we want to run something after that). |
3031 | - do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args ); |
|
3031 | + do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args); |
|
3032 | 3032 | |
3033 | - $redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args ); |
|
3033 | + $redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args); |
|
3034 | 3034 | |
3035 | 3035 | |
3036 | 3036 | // check if we're doing ajax. If we are then lets just return the results and js can handle how it wants. |
3037 | - if ( defined('DOING_AJAX' ) ) { |
|
3037 | + if (defined('DOING_AJAX')) { |
|
3038 | 3038 | $default_data = array( |
3039 | 3039 | 'close' => TRUE, |
3040 | 3040 | 'redirect_url' => $redirect_url, |
@@ -3043,11 +3043,11 @@ discard block |
||
3043 | 3043 | ); |
3044 | 3044 | |
3045 | 3045 | $this->_template_args['success'] = $success; |
3046 | - $this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data; |
|
3046 | + $this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data; |
|
3047 | 3047 | $this->_return_json(); |
3048 | 3048 | } |
3049 | 3049 | |
3050 | - wp_safe_redirect( $redirect_url ); |
|
3050 | + wp_safe_redirect($redirect_url); |
|
3051 | 3051 | exit(); |
3052 | 3052 | } |
3053 | 3053 | |
@@ -3063,30 +3063,30 @@ discard block |
||
3063 | 3063 | * @param bool $sticky_notices This is used to flag that regardless of whether this is doing_ajax or not, we still save a transient for the notice. |
3064 | 3064 | * @return void |
3065 | 3065 | */ |
3066 | - protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) { |
|
3066 | + protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) { |
|
3067 | 3067 | |
3068 | 3068 | //first let's set individual error properties if doing_ajax and the properties aren't already set. |
3069 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
3070 | - $notices = EE_Error::get_notices( false ); |
|
3071 | - if ( empty( $this->_template_args['success'] ) ) { |
|
3072 | - $this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false; |
|
3069 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
3070 | + $notices = EE_Error::get_notices(false); |
|
3071 | + if (empty($this->_template_args['success'])) { |
|
3072 | + $this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false; |
|
3073 | 3073 | } |
3074 | 3074 | |
3075 | - if ( empty( $this->_template_args['errors'] ) ) { |
|
3076 | - $this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false; |
|
3075 | + if (empty($this->_template_args['errors'])) { |
|
3076 | + $this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false; |
|
3077 | 3077 | } |
3078 | 3078 | |
3079 | - if ( empty( $this->_template_args['attention'] ) ) { |
|
3080 | - $this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false; |
|
3079 | + if (empty($this->_template_args['attention'])) { |
|
3080 | + $this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false; |
|
3081 | 3081 | } |
3082 | 3082 | } |
3083 | 3083 | |
3084 | 3084 | $this->_template_args['notices'] = EE_Error::get_notices(); |
3085 | 3085 | |
3086 | 3086 | //IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true) |
3087 | - if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) { |
|
3088 | - $route = isset( $query_args['action'] ) ? $query_args['action'] : 'default'; |
|
3089 | - $this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify ); |
|
3087 | + if ( ! defined('DOING_AJAX') || $sticky_notices) { |
|
3088 | + $route = isset($query_args['action']) ? $query_args['action'] : 'default'; |
|
3089 | + $this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify); |
|
3090 | 3090 | } |
3091 | 3091 | } |
3092 | 3092 | |
@@ -3116,7 +3116,7 @@ discard block |
||
3116 | 3116 | $exclude_nonce = false |
3117 | 3117 | ) { |
3118 | 3118 | //first let's validate the action (if $base_url is FALSE otherwise validation will happen further along) |
3119 | - if ( empty( $base_url ) && ! isset( $this->_page_routes[ $action ] ) ) { |
|
3119 | + if (empty($base_url) && ! isset($this->_page_routes[$action])) { |
|
3120 | 3120 | throw new EE_Error( |
3121 | 3121 | sprintf( |
3122 | 3122 | __( |
@@ -3127,7 +3127,7 @@ discard block |
||
3127 | 3127 | ) |
3128 | 3128 | ); |
3129 | 3129 | } |
3130 | - if ( ! isset( $this->_labels['buttons'][ $type ] ) ) { |
|
3130 | + if ( ! isset($this->_labels['buttons'][$type])) { |
|
3131 | 3131 | throw new EE_Error( |
3132 | 3132 | sprintf( |
3133 | 3133 | __( |
@@ -3139,8 +3139,8 @@ discard block |
||
3139 | 3139 | ); |
3140 | 3140 | } |
3141 | 3141 | //finally check user access for this button. |
3142 | - $has_access = $this->check_user_access( $action, true ); |
|
3143 | - if ( ! $has_access ) { |
|
3142 | + $has_access = $this->check_user_access($action, true); |
|
3143 | + if ( ! $has_access) { |
|
3144 | 3144 | return ''; |
3145 | 3145 | } |
3146 | 3146 | $_base_url = ! $base_url ? $this->_admin_base_url : $base_url; |
@@ -3148,11 +3148,11 @@ discard block |
||
3148 | 3148 | 'action' => $action |
3149 | 3149 | ); |
3150 | 3150 | //merge extra_request args but make sure our original action takes precedence and doesn't get overwritten. |
3151 | - if ( ! empty( $extra_request ) ) { |
|
3152 | - $query_args = array_merge( $extra_request, $query_args ); |
|
3151 | + if ( ! empty($extra_request)) { |
|
3152 | + $query_args = array_merge($extra_request, $query_args); |
|
3153 | 3153 | } |
3154 | - $url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce ); |
|
3155 | - return EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][ $type ], $class ); |
|
3154 | + $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce); |
|
3155 | + return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class); |
|
3156 | 3156 | } |
3157 | 3157 | |
3158 | 3158 | |
@@ -3167,11 +3167,11 @@ discard block |
||
3167 | 3167 | $args = array( |
3168 | 3168 | 'label' => $this->_admin_page_title, |
3169 | 3169 | 'default' => 10, |
3170 | - 'option' => $this->_current_page . '_' . $this->_current_view . '_per_page' |
|
3170 | + 'option' => $this->_current_page.'_'.$this->_current_view.'_per_page' |
|
3171 | 3171 | ); |
3172 | 3172 | //ONLY add the screen option if the user has access to it. |
3173 | - if ( $this->check_user_access( $this->_current_view, true ) ) { |
|
3174 | - add_screen_option( $option, $args ); |
|
3173 | + if ($this->check_user_access($this->_current_view, true)) { |
|
3174 | + add_screen_option($option, $args); |
|
3175 | 3175 | } |
3176 | 3176 | } |
3177 | 3177 | |
@@ -3187,36 +3187,36 @@ discard block |
||
3187 | 3187 | * @return void |
3188 | 3188 | */ |
3189 | 3189 | private function _set_per_page_screen_options() { |
3190 | - if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
|
3191 | - check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
|
3190 | + if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) { |
|
3191 | + check_admin_referer('screen-options-nonce', 'screenoptionnonce'); |
|
3192 | 3192 | |
3193 | - if ( !$user = wp_get_current_user() ) |
|
3193 | + if ( ! $user = wp_get_current_user()) |
|
3194 | 3194 | return; |
3195 | 3195 | $option = $_POST['wp_screen_options']['option']; |
3196 | 3196 | $value = $_POST['wp_screen_options']['value']; |
3197 | 3197 | |
3198 | - if ( $option != sanitize_key( $option ) ) |
|
3198 | + if ($option != sanitize_key($option)) |
|
3199 | 3199 | return; |
3200 | 3200 | |
3201 | 3201 | $map_option = $option; |
3202 | 3202 | |
3203 | 3203 | $option = str_replace('-', '_', $option); |
3204 | 3204 | |
3205 | - switch ( $map_option ) { |
|
3206 | - case $this->_current_page . '_' . $this->_current_view . '_per_page': |
|
3205 | + switch ($map_option) { |
|
3206 | + case $this->_current_page.'_'.$this->_current_view.'_per_page': |
|
3207 | 3207 | $value = (int) $value; |
3208 | - if ( $value < 1 || $value > 999 ) |
|
3208 | + if ($value < 1 || $value > 999) |
|
3209 | 3209 | return; |
3210 | 3210 | break; |
3211 | 3211 | default: |
3212 | - $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
|
3213 | - if ( false === $value ) |
|
3212 | + $value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value); |
|
3213 | + if (false === $value) |
|
3214 | 3214 | return; |
3215 | 3215 | break; |
3216 | 3216 | } |
3217 | 3217 | |
3218 | 3218 | update_user_meta($user->ID, $option, $value); |
3219 | - wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); |
|
3219 | + wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer())); |
|
3220 | 3220 | exit; |
3221 | 3221 | } |
3222 | 3222 | } |
@@ -3227,8 +3227,8 @@ discard block |
||
3227 | 3227 | * This just allows for setting the $_template_args property if it needs to be set outside the object |
3228 | 3228 | * @param array $data array that will be assigned to template args. |
3229 | 3229 | */ |
3230 | - public function set_template_args( $data ) { |
|
3231 | - $this->_template_args = array_merge( $this->_template_args, (array) $data ); |
|
3230 | + public function set_template_args($data) { |
|
3231 | + $this->_template_args = array_merge($this->_template_args, (array) $data); |
|
3232 | 3232 | } |
3233 | 3233 | |
3234 | 3234 | |
@@ -3244,26 +3244,26 @@ discard block |
||
3244 | 3244 | * @param bool $skip_route_verify Used to indicate we want to skip route verification. This is usually ONLY used when we are adding a transient before page_routes have been defined. |
3245 | 3245 | * @return void |
3246 | 3246 | */ |
3247 | - protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
|
3247 | + protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) { |
|
3248 | 3248 | $user_id = get_current_user_id(); |
3249 | 3249 | |
3250 | - if ( !$skip_route_verify ) |
|
3250 | + if ( ! $skip_route_verify) |
|
3251 | 3251 | $this->_verify_route($route); |
3252 | 3252 | |
3253 | 3253 | |
3254 | 3254 | //now let's set the string for what kind of transient we're setting |
3255 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3256 | - $data = $notices ? array( 'notices' => $data ) : $data; |
|
3255 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3256 | + $data = $notices ? array('notices' => $data) : $data; |
|
3257 | 3257 | //is there already a transient for this route? If there is then let's ADD to that transient |
3258 | - $existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3259 | - if ( $existing ) { |
|
3260 | - $data = array_merge( (array) $data, (array) $existing ); |
|
3258 | + $existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3259 | + if ($existing) { |
|
3260 | + $data = array_merge((array) $data, (array) $existing); |
|
3261 | 3261 | } |
3262 | 3262 | |
3263 | - if ( is_multisite() && is_network_admin() ) { |
|
3264 | - set_site_transient( $transient, $data, 8 ); |
|
3263 | + if (is_multisite() && is_network_admin()) { |
|
3264 | + set_site_transient($transient, $data, 8); |
|
3265 | 3265 | } else { |
3266 | - set_transient( $transient, $data, 8 ); |
|
3266 | + set_transient($transient, $data, 8); |
|
3267 | 3267 | } |
3268 | 3268 | } |
3269 | 3269 | |
@@ -3275,18 +3275,18 @@ discard block |
||
3275 | 3275 | * @param bool $notices true we get notices transient. False we just return normal route transient |
3276 | 3276 | * @return mixed data |
3277 | 3277 | */ |
3278 | - protected function _get_transient( $notices = FALSE, $route = FALSE ) { |
|
3278 | + protected function _get_transient($notices = FALSE, $route = FALSE) { |
|
3279 | 3279 | $user_id = get_current_user_id(); |
3280 | - $route = !$route ? $this->_req_action : $route; |
|
3281 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3282 | - $data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3280 | + $route = ! $route ? $this->_req_action : $route; |
|
3281 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3282 | + $data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3283 | 3283 | //delete transient after retrieval (just in case it hasn't expired); |
3284 | - if ( is_multisite() && is_network_admin() ) { |
|
3285 | - delete_site_transient( $transient ); |
|
3284 | + if (is_multisite() && is_network_admin()) { |
|
3285 | + delete_site_transient($transient); |
|
3286 | 3286 | } else { |
3287 | - delete_transient( $transient ); |
|
3287 | + delete_transient($transient); |
|
3288 | 3288 | } |
3289 | - return $notices && isset( $data['notices'] ) ? $data['notices'] : $data; |
|
3289 | + return $notices && isset($data['notices']) ? $data['notices'] : $data; |
|
3290 | 3290 | } |
3291 | 3291 | |
3292 | 3292 | |
@@ -3303,12 +3303,12 @@ discard block |
||
3303 | 3303 | |
3304 | 3304 | //retrieve all existing transients |
3305 | 3305 | $query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'"; |
3306 | - if ( $results = $wpdb->get_results( $query ) ) { |
|
3307 | - foreach ( $results as $result ) { |
|
3308 | - $transient = str_replace( '_transient_', '', $result->option_name ); |
|
3309 | - get_transient( $transient ); |
|
3310 | - if ( is_multisite() && is_network_admin() ) { |
|
3311 | - get_site_transient( $transient ); |
|
3306 | + if ($results = $wpdb->get_results($query)) { |
|
3307 | + foreach ($results as $result) { |
|
3308 | + $transient = str_replace('_transient_', '', $result->option_name); |
|
3309 | + get_transient($transient); |
|
3310 | + if (is_multisite() && is_network_admin()) { |
|
3311 | + get_site_transient($transient); |
|
3312 | 3312 | } |
3313 | 3313 | } |
3314 | 3314 | } |
@@ -3458,23 +3458,23 @@ discard block |
||
3458 | 3458 | * @param string $line line no where error occurred |
3459 | 3459 | * @return boolean |
3460 | 3460 | */ |
3461 | - protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) { |
|
3461 | + protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') { |
|
3462 | 3462 | |
3463 | 3463 | //remove any options that are NOT going to be saved with the config settings. |
3464 | - if ( isset( $config->core->ee_ueip_optin ) ) { |
|
3464 | + if (isset($config->core->ee_ueip_optin)) { |
|
3465 | 3465 | $config->core->ee_ueip_has_notified = TRUE; |
3466 | 3466 | // TODO: remove the following two lines and make sure values are migrated from 3.1 |
3467 | - update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3468 | - update_option( 'ee_ueip_has_notified', TRUE ); |
|
3467 | + update_option('ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3468 | + update_option('ee_ueip_has_notified', TRUE); |
|
3469 | 3469 | } |
3470 | 3470 | // and save it (note we're also doing the network save here) |
3471 | - $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE; |
|
3472 | - $config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
3473 | - if ( $config_saved && $net_saved ) { |
|
3474 | - EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab )); |
|
3471 | + $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE; |
|
3472 | + $config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
3473 | + if ($config_saved && $net_saved) { |
|
3474 | + EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab)); |
|
3475 | 3475 | return TRUE; |
3476 | 3476 | } else { |
3477 | - EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line ); |
|
3477 | + EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line); |
|
3478 | 3478 | return FALSE; |
3479 | 3479 | } |
3480 | 3480 | } |
@@ -3487,7 +3487,7 @@ discard block |
||
3487 | 3487 | * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument. |
3488 | 3488 | * @return array |
3489 | 3489 | */ |
3490 | - public function get_yes_no_values(){ |
|
3490 | + public function get_yes_no_values() { |
|
3491 | 3491 | return $this->_yes_no_values; |
3492 | 3492 | } |
3493 | 3493 | |
@@ -3509,8 +3509,8 @@ discard block |
||
3509 | 3509 | * |
3510 | 3510 | * @return string |
3511 | 3511 | */ |
3512 | - protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) { |
|
3513 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3512 | + protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') { |
|
3513 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3514 | 3514 | } |
3515 | 3515 | |
3516 | 3516 | |
@@ -3524,8 +3524,8 @@ discard block |
||
3524 | 3524 | * |
3525 | 3525 | * @return string |
3526 | 3526 | */ |
3527 | - protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) { |
|
3528 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3527 | + protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') { |
|
3528 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3529 | 3529 | } |
3530 | 3530 | |
3531 | 3531 | |
@@ -3544,8 +3544,8 @@ discard block |
||
3544 | 3544 | * @return bool success/fail |
3545 | 3545 | */ |
3546 | 3546 | protected function _process_resend_registration() { |
3547 | - $this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data ); |
|
3548 | - do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data ); |
|
3547 | + $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data); |
|
3548 | + do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data); |
|
3549 | 3549 | return $this->_template_args['success']; |
3550 | 3550 | } |
3551 | 3551 | |
@@ -3558,11 +3558,11 @@ discard block |
||
3558 | 3558 | * @param \EE_Payment $payment |
3559 | 3559 | * @return bool success/fail |
3560 | 3560 | */ |
3561 | - protected function _process_payment_notification( EE_Payment $payment ) { |
|
3562 | - add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' ); |
|
3563 | - do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment ); |
|
3564 | - $this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment ); |
|
3565 | - return $this->_template_args[ 'success' ]; |
|
3561 | + protected function _process_payment_notification(EE_Payment $payment) { |
|
3562 | + add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true'); |
|
3563 | + do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment); |
|
3564 | + $this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment); |
|
3565 | + return $this->_template_args['success']; |
|
3566 | 3566 | } |
3567 | 3567 | |
3568 | 3568 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -160,8 +162,9 @@ discard block |
||
160 | 162 | */ |
161 | 163 | public function __construct( $routing = TRUE ) { |
162 | 164 | |
163 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
164 | - $this->_is_caf = TRUE; |
|
165 | + if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) { |
|
166 | + $this->_is_caf = TRUE; |
|
167 | + } |
|
165 | 168 | |
166 | 169 | $this->_yes_no_values = array( |
167 | 170 | array('id' => TRUE, 'text' => __('Yes', 'event_espresso')), |
@@ -192,8 +195,9 @@ discard block |
||
192 | 195 | $this->_do_other_page_hooks(); |
193 | 196 | |
194 | 197 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
195 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
196 | - $this->_before_page_setup(); |
|
198 | + if ( method_exists( $this, '_before_page_setup' ) ) { |
|
199 | + $this->_before_page_setup(); |
|
200 | + } |
|
197 | 201 | |
198 | 202 | //set up page dependencies |
199 | 203 | $this->_page_setup(); |
@@ -500,7 +504,9 @@ discard block |
||
500 | 504 | global $ee_menu_slugs; |
501 | 505 | $ee_menu_slugs = (array) $ee_menu_slugs; |
502 | 506 | |
503 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
507 | + if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) { |
|
508 | + return FALSE; |
|
509 | + } |
|
504 | 510 | |
505 | 511 | |
506 | 512 | // becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first |
@@ -535,12 +541,14 @@ discard block |
||
535 | 541 | } |
536 | 542 | |
537 | 543 | //for caffeinated and other extended functionality. If there is a _extend_page_config method then let's run that to modify the all the various page configuration arrays |
538 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
539 | - $this->_extend_page_config(); |
|
544 | + if ( method_exists( $this, '_extend_page_config' ) ) { |
|
545 | + $this->_extend_page_config(); |
|
546 | + } |
|
540 | 547 | |
541 | 548 | //for CPT and other extended functionality. If there is an _extend_page_config_for_cpt then let's run that to modify all the various page configuration arrays. |
542 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
543 | - $this->_extend_page_config_for_cpt(); |
|
549 | + if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) { |
|
550 | + $this->_extend_page_config_for_cpt(); |
|
551 | + } |
|
544 | 552 | |
545 | 553 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
546 | 554 | $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
@@ -656,8 +664,9 @@ discard block |
||
656 | 664 | //add screen options - global, page child class, and view specific |
657 | 665 | $this->_add_global_screen_options(); |
658 | 666 | $this->_add_screen_options(); |
659 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
660 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
667 | + if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) { |
|
668 | + call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
669 | + } |
|
661 | 670 | |
662 | 671 | |
663 | 672 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -668,28 +677,32 @@ discard block |
||
668 | 677 | //add feature_pointers - global, page child class, and view specific |
669 | 678 | $this->_add_feature_pointers(); |
670 | 679 | $this->_add_global_feature_pointers(); |
671 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
672 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
680 | + if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) { |
|
681 | + call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
682 | + } |
|
673 | 683 | |
674 | 684 | //enqueue scripts/styles - global, page class, and view specific |
675 | 685 | add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
676 | 686 | add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
677 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
678 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
687 | + if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) { |
|
688 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
689 | + } |
|
679 | 690 | |
680 | 691 | add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
681 | 692 | |
682 | 693 | //admin_print_footer_scripts - global, page child class, and view specific. NOTE, despite the name, whenever possible, scripts should NOT be loaded using this. In most cases that's doing_it_wrong(). But adding hidden container elements etc. is a good use case. Notice the late priority we're giving these |
683 | 694 | add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
684 | 695 | add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
685 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
686 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
696 | + if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) { |
|
697 | + add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
698 | + } |
|
687 | 699 | |
688 | 700 | //admin footer scripts |
689 | 701 | add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
690 | 702 | add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
691 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
692 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
703 | + if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) { |
|
704 | + add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
705 | + } |
|
693 | 706 | |
694 | 707 | |
695 | 708 | do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
@@ -762,7 +775,9 @@ discard block |
||
762 | 775 | protected function _verify_routes() { |
763 | 776 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
764 | 777 | |
765 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
778 | + if ( !$this->_current_page && !defined( 'DOING_AJAX')) { |
|
779 | + return FALSE; |
|
780 | + } |
|
766 | 781 | |
767 | 782 | $this->_route = FALSE; |
768 | 783 | $func = FALSE; |
@@ -872,8 +887,9 @@ discard block |
||
872 | 887 | * @return void |
873 | 888 | */ |
874 | 889 | protected function _route_admin_request() { |
875 | - if ( ! $this->_is_UI_request ) |
|
876 | - $this->_verify_routes(); |
|
890 | + if ( ! $this->_is_UI_request ) { |
|
891 | + $this->_verify_routes(); |
|
892 | + } |
|
877 | 893 | |
878 | 894 | $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
879 | 895 | |
@@ -883,8 +899,9 @@ discard block |
||
883 | 899 | $this->_verify_nonce( $nonce, $this->_req_nonce ); |
884 | 900 | } |
885 | 901 | //set the nav_tabs array but ONLY if this is UI_request |
886 | - if ( $this->_is_UI_request ) |
|
887 | - $this->_set_nav_tabs(); |
|
902 | + if ( $this->_is_UI_request ) { |
|
903 | + $this->_set_nav_tabs(); |
|
904 | + } |
|
888 | 905 | |
889 | 906 | // grab callback function |
890 | 907 | $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
@@ -921,8 +938,9 @@ discard block |
||
921 | 938 | } |
922 | 939 | |
923 | 940 | |
924 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
925 | - throw new EE_Error( $error_msg ); |
|
941 | + if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) { |
|
942 | + throw new EE_Error( $error_msg ); |
|
943 | + } |
|
926 | 944 | } |
927 | 945 | |
928 | 946 | //if we've routed and this route has a no headers route AND a sent_headers_route, then we need to reset the routing properties to the new route. |
@@ -1049,8 +1067,9 @@ discard block |
||
1049 | 1067 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1050 | 1068 | foreach ( $this->_help_tour['tours'] as $tour ) { |
1051 | 1069 | //if this is the end tour then we don't need to setup a button |
1052 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1053 | - continue; |
|
1070 | + if ( $tour instanceof EE_Help_Tour_final_stop ) { |
|
1071 | + continue; |
|
1072 | + } |
|
1054 | 1073 | $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
1055 | 1074 | } |
1056 | 1075 | $tour_buttons .= implode('<br />', $tb); |
@@ -1060,8 +1079,9 @@ discard block |
||
1060 | 1079 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1061 | 1080 | if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
1062 | 1081 | //check that the callback given is valid |
1063 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1064 | - throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) ); |
|
1082 | + if ( !method_exists($this, $config['help_sidebar'] ) ) { |
|
1083 | + throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) ); |
|
1084 | + } |
|
1065 | 1085 | |
1066 | 1086 | $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
1067 | 1087 | |
@@ -1085,18 +1105,23 @@ discard block |
||
1085 | 1105 | }/**/ |
1086 | 1106 | |
1087 | 1107 | |
1088 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1108 | + if ( !isset( $config['help_tabs'] ) ) { |
|
1109 | + return; |
|
1110 | + } |
|
1111 | + //no help tabs for this route |
|
1089 | 1112 | |
1090 | 1113 | foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
1091 | 1114 | //we're here so there ARE help tabs! |
1092 | 1115 | |
1093 | 1116 | //make sure we've got what we need |
1094 | - if ( !isset( $cfg['title'] ) ) |
|
1095 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1117 | + if ( !isset( $cfg['title'] ) ) { |
|
1118 | + throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1119 | + } |
|
1096 | 1120 | |
1097 | 1121 | |
1098 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1099 | - throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') ); |
|
1122 | + if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) { |
|
1123 | + throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') ); |
|
1124 | + } |
|
1100 | 1125 | |
1101 | 1126 | |
1102 | 1127 | |
@@ -1159,14 +1184,16 @@ discard block |
||
1159 | 1184 | $this->_help_tour = array(); |
1160 | 1185 | |
1161 | 1186 | //exit early if help tours are turned off globally |
1162 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1163 | - return; |
|
1187 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) { |
|
1188 | + return; |
|
1189 | + } |
|
1164 | 1190 | |
1165 | 1191 | //loop through _page_config to find any help_tour defined |
1166 | 1192 | foreach ( $this->_page_config as $route => $config ) { |
1167 | 1193 | //we're only going to set things up for this route |
1168 | - if ( $route !== $this->_req_action ) |
|
1169 | - continue; |
|
1194 | + if ( $route !== $this->_req_action ) { |
|
1195 | + continue; |
|
1196 | + } |
|
1170 | 1197 | |
1171 | 1198 | if ( isset( $config['help_tour'] ) ) { |
1172 | 1199 | |
@@ -1201,8 +1228,9 @@ discard block |
||
1201 | 1228 | } |
1202 | 1229 | } |
1203 | 1230 | |
1204 | - if ( !empty( $tours ) ) |
|
1205 | - $this->_help_tour['tours'] = $tours; |
|
1231 | + if ( !empty( $tours ) ) { |
|
1232 | + $this->_help_tour['tours'] = $tours; |
|
1233 | + } |
|
1206 | 1234 | |
1207 | 1235 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
1208 | 1236 | } |
@@ -1242,15 +1270,21 @@ discard block |
||
1242 | 1270 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1243 | 1271 | $i = 0; |
1244 | 1272 | foreach ( $this->_page_config as $slug => $config ) { |
1245 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1246 | - continue; //no nav tab for this config |
|
1273 | + if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) { |
|
1274 | + continue; |
|
1275 | + } |
|
1276 | + //no nav tab for this config |
|
1247 | 1277 | |
1248 | 1278 | //check for persistent flag |
1249 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1250 | - continue; //nav tab is only to appear when route requested. |
|
1279 | + if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) { |
|
1280 | + continue; |
|
1281 | + } |
|
1282 | + //nav tab is only to appear when route requested. |
|
1251 | 1283 | |
1252 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1253 | - continue; //no nav tab becasue current user does not have access. |
|
1284 | + if ( ! $this->check_user_access( $slug, TRUE ) ) { |
|
1285 | + continue; |
|
1286 | + } |
|
1287 | + //no nav tab becasue current user does not have access. |
|
1254 | 1288 | |
1255 | 1289 | $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
1256 | 1290 | $this->_nav_tabs[$slug] = array( |
@@ -1486,10 +1520,11 @@ discard block |
||
1486 | 1520 | $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
1487 | 1521 | } |
1488 | 1522 | |
1489 | - if ( $display ) |
|
1490 | - echo $content; |
|
1491 | - else |
|
1492 | - return $content; |
|
1523 | + if ( $display ) { |
|
1524 | + echo $content; |
|
1525 | + } else { |
|
1526 | + return $content; |
|
1527 | + } |
|
1493 | 1528 | } |
1494 | 1529 | |
1495 | 1530 | |
@@ -1506,8 +1541,9 @@ discard block |
||
1506 | 1541 | $method_name = '_help_popup_content_' . $this->_req_action; |
1507 | 1542 | |
1508 | 1543 | //if method doesn't exist let's get out. |
1509 | - if ( !method_exists( $this, $method_name ) ) |
|
1510 | - return array(); |
|
1544 | + if ( !method_exists( $this, $method_name ) ) { |
|
1545 | + return array(); |
|
1546 | + } |
|
1511 | 1547 | |
1512 | 1548 | //k we're good to go let's retrieve the help array |
1513 | 1549 | $help_array = call_user_func( array( $this, $method_name ) ); |
@@ -1538,7 +1574,9 @@ discard block |
||
1538 | 1574 | */ |
1539 | 1575 | protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
1540 | 1576 | |
1541 | - if ( defined('DOING_AJAX') ) return; |
|
1577 | + if ( defined('DOING_AJAX') ) { |
|
1578 | + return; |
|
1579 | + } |
|
1542 | 1580 | |
1543 | 1581 | //let's check and see if there is any content set for this popup. If there isn't then we'll include a default title and content so that developers know something needs to be corrected |
1544 | 1582 | $help_array = $this->_get_help_content(); |
@@ -1556,10 +1594,11 @@ discard block |
||
1556 | 1594 | $content = '<a class="ee-dialog" href="?height='. $dimensions[0] . '&width=' . $dimensions[1] . '&inlineId=' . $trigger_id . '" target="_blank"><span class="question ee-help-popup-question"></span></a>'; |
1557 | 1595 | $content = $content . $help_content; |
1558 | 1596 | |
1559 | - if ( $display ) |
|
1560 | - echo $content; |
|
1561 | - else |
|
1562 | - return $content; |
|
1597 | + if ( $display ) { |
|
1598 | + echo $content; |
|
1599 | + } else { |
|
1600 | + return $content; |
|
1601 | + } |
|
1563 | 1602 | } |
1564 | 1603 | |
1565 | 1604 | |
@@ -1785,8 +1824,10 @@ discard block |
||
1785 | 1824 | protected function _set_list_table() { |
1786 | 1825 | |
1787 | 1826 | //first is this a list_table view? |
1788 | - if ( !isset($this->_route_config['list_table']) ) |
|
1789 | - return; //not a list_table view so get out. |
|
1827 | + if ( !isset($this->_route_config['list_table']) ) { |
|
1828 | + return; |
|
1829 | + } |
|
1830 | + //not a list_table view so get out. |
|
1790 | 1831 | |
1791 | 1832 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1792 | 1833 | |
@@ -2152,8 +2193,9 @@ discard block |
||
2152 | 2193 | protected function _espresso_sponsors_post_box() { |
2153 | 2194 | |
2154 | 2195 | $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
2155 | - if ( $show_sponsors ) |
|
2156 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2196 | + if ( $show_sponsors ) { |
|
2197 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2198 | + } |
|
2157 | 2199 | } |
2158 | 2200 | |
2159 | 2201 | |
@@ -2599,10 +2641,11 @@ discard block |
||
2599 | 2641 | true |
2600 | 2642 | ); |
2601 | 2643 | // the final template wrapper |
2602 | - if ( $sidebar ) |
|
2603 | - $this->display_admin_page_with_sidebar(); |
|
2604 | - else |
|
2605 | - $this->display_admin_page_with_no_sidebar(); |
|
2644 | + if ( $sidebar ) { |
|
2645 | + $this->display_admin_page_with_sidebar(); |
|
2646 | + } else { |
|
2647 | + $this->display_admin_page_with_no_sidebar(); |
|
2648 | + } |
|
2606 | 2649 | } |
2607 | 2650 | |
2608 | 2651 | |
@@ -2670,8 +2713,9 @@ discard block |
||
2670 | 2713 | |
2671 | 2714 | |
2672 | 2715 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2673 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2674 | - header('Content-Type: application/json; charset=UTF-8'); |
|
2716 | + if ( NULL === error_get_last() || ! headers_sent() ) { |
|
2717 | + header('Content-Type: application/json; charset=UTF-8'); |
|
2718 | + } |
|
2675 | 2719 | if( function_exists( 'wp_json_encode' ) ) { |
2676 | 2720 | echo wp_json_encode( $json ); |
2677 | 2721 | } else { |
@@ -2689,10 +2733,9 @@ discard block |
||
2689 | 2733 | * @throws EE_Error |
2690 | 2734 | */ |
2691 | 2735 | public function return_json() { |
2692 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2693 | - $this->_return_json(); |
|
2694 | - |
|
2695 | - else { |
|
2736 | + if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
2737 | + $this->_return_json(); |
|
2738 | + } else { |
|
2696 | 2739 | throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
2697 | 2740 | } |
2698 | 2741 | } |
@@ -2834,7 +2877,9 @@ discard block |
||
2834 | 2877 | $id = $this->_current_view . '_' . $ref; |
2835 | 2878 | $name = !empty($actions) ? $actions[$key] : $ref; |
2836 | 2879 | $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
2837 | - if ( !$both ) break; |
|
2880 | + if ( !$both ) { |
|
2881 | + break; |
|
2882 | + } |
|
2838 | 2883 | } |
2839 | 2884 | |
2840 | 2885 | } |
@@ -3190,13 +3235,15 @@ discard block |
||
3190 | 3235 | if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
3191 | 3236 | check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
3192 | 3237 | |
3193 | - if ( !$user = wp_get_current_user() ) |
|
3194 | - return; |
|
3238 | + if ( !$user = wp_get_current_user() ) { |
|
3239 | + return; |
|
3240 | + } |
|
3195 | 3241 | $option = $_POST['wp_screen_options']['option']; |
3196 | 3242 | $value = $_POST['wp_screen_options']['value']; |
3197 | 3243 | |
3198 | - if ( $option != sanitize_key( $option ) ) |
|
3199 | - return; |
|
3244 | + if ( $option != sanitize_key( $option ) ) { |
|
3245 | + return; |
|
3246 | + } |
|
3200 | 3247 | |
3201 | 3248 | $map_option = $option; |
3202 | 3249 | |
@@ -3205,13 +3252,15 @@ discard block |
||
3205 | 3252 | switch ( $map_option ) { |
3206 | 3253 | case $this->_current_page . '_' . $this->_current_view . '_per_page': |
3207 | 3254 | $value = (int) $value; |
3208 | - if ( $value < 1 || $value > 999 ) |
|
3209 | - return; |
|
3255 | + if ( $value < 1 || $value > 999 ) { |
|
3256 | + return; |
|
3257 | + } |
|
3210 | 3258 | break; |
3211 | 3259 | default: |
3212 | 3260 | $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
3213 | - if ( false === $value ) |
|
3214 | - return; |
|
3261 | + if ( false === $value ) { |
|
3262 | + return; |
|
3263 | + } |
|
3215 | 3264 | break; |
3216 | 3265 | } |
3217 | 3266 | |
@@ -3247,8 +3296,9 @@ discard block |
||
3247 | 3296 | protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
3248 | 3297 | $user_id = get_current_user_id(); |
3249 | 3298 | |
3250 | - if ( !$skip_route_verify ) |
|
3251 | - $this->_verify_route($route); |
|
3299 | + if ( !$skip_route_verify ) { |
|
3300 | + $this->_verify_route($route); |
|
3301 | + } |
|
3252 | 3302 | |
3253 | 3303 | |
3254 | 3304 | //now let's set the string for what kind of transient we're setting |
@@ -2193,7 +2193,7 @@ discard block |
||
2193 | 2193 | $table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
2194 | 2194 | // get country code from organization settings or use default |
2195 | 2195 | $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
2196 | - && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2196 | + && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2197 | 2197 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2198 | 2198 | : ''; |
2199 | 2199 | // but override if requested |
@@ -2907,8 +2907,8 @@ discard block |
||
2907 | 2907 | */ |
2908 | 2908 | public function max_input_vars_limit_check( $input_count = 0 ) { |
2909 | 2909 | if ( ! empty( $this->php->max_input_vars ) |
2910 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2911 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2910 | + && ( $input_count >= $this->php->max_input_vars ) |
|
2911 | + && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2912 | 2912 | ) { |
2913 | 2913 | return sprintf( |
2914 | 2914 | __( |
@@ -2952,22 +2952,22 @@ discard block |
||
2952 | 2952 | class EE_Tax_Config extends EE_Config_Base |
2953 | 2953 | { |
2954 | 2954 | |
2955 | - /* |
|
2955 | + /* |
|
2956 | 2956 | * flag to indicate whether or not to display ticket prices with the taxes included |
2957 | 2957 | * |
2958 | 2958 | * @var boolean $prices_displayed_including_taxes |
2959 | 2959 | */ |
2960 | - public $prices_displayed_including_taxes; |
|
2960 | + public $prices_displayed_including_taxes; |
|
2961 | 2961 | |
2962 | 2962 | |
2963 | 2963 | |
2964 | - /** |
|
2965 | - * class constructor |
|
2966 | - */ |
|
2967 | - public function __construct() |
|
2968 | - { |
|
2969 | - $this->prices_displayed_including_taxes = true; |
|
2970 | - } |
|
2964 | + /** |
|
2965 | + * class constructor |
|
2966 | + */ |
|
2967 | + public function __construct() |
|
2968 | + { |
|
2969 | + $this->prices_displayed_including_taxes = true; |
|
2970 | + } |
|
2971 | 2971 | } |
2972 | 2972 | |
2973 | 2973 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public static function instance() { |
130 | 130 | // check if class object is instantiated, and instantiated properly |
131 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
131 | + if ( ! self::$_instance instanceof EE_Config) { |
|
132 | 132 | self::$_instance = new self(); |
133 | 133 | } |
134 | 134 | return self::$_instance; |
@@ -148,20 +148,20 @@ discard block |
||
148 | 148 | * site was put into maintenance mode) |
149 | 149 | * @return EE_Config |
150 | 150 | */ |
151 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
152 | - if ( $hard_reset ) { |
|
151 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
152 | + if ($hard_reset) { |
|
153 | 153 | self::$_instance->_addon_option_names = array(); |
154 | 154 | self::$_instance->_initialize_config(); |
155 | 155 | self::$_instance->update_espresso_config(); |
156 | 156 | } |
157 | - if ( self::$_instance instanceof EE_Config ) { |
|
157 | + if (self::$_instance instanceof EE_Config) { |
|
158 | 158 | self::$_instance->update_addon_option_names(); |
159 | 159 | } |
160 | 160 | self::$_instance = null; |
161 | 161 | //we don't need to reset the static properties imo because those should |
162 | 162 | //only change when a module is added or removed. Currently we don't |
163 | 163 | //support removing a module during a request when it previously existed |
164 | - if ( $reinstantiate ) { |
|
164 | + if ($reinstantiate) { |
|
165 | 165 | return self::instance(); |
166 | 166 | } else { |
167 | 167 | return null; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @access private |
177 | 177 | */ |
178 | 178 | private function __construct() { |
179 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
179 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
180 | 180 | // setup empty config classes |
181 | 181 | $this->_initialize_config(); |
182 | 182 | // load existing EE site settings |
@@ -186,17 +186,17 @@ discard block |
||
186 | 186 | // register shortcodes and modules |
187 | 187 | add_action( |
188 | 188 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
189 | - array( $this, 'register_shortcodes_and_modules' ), |
|
189 | + array($this, 'register_shortcodes_and_modules'), |
|
190 | 190 | 999 |
191 | 191 | ); |
192 | 192 | // initialize shortcodes and modules |
193 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
193 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
194 | 194 | // register widgets |
195 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
195 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
196 | 196 | // shutdown |
197 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
197 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
198 | 198 | // construct__end hook |
199 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
199 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
200 | 200 | // hardcoded hack |
201 | 201 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
202 | 202 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @return string current theme set. |
210 | 210 | */ |
211 | 211 | public static function get_current_theme() { |
212 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
212 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
213 | 213 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
214 | 214 | } |
215 | 215 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | private function _initialize_config() { |
225 | 225 | EE_Config::trim_log(); |
226 | 226 | //set defaults |
227 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
227 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
228 | 228 | $this->addons = new stdClass(); |
229 | 229 | // set _module_route_map |
230 | 230 | EE_Config::$_module_route_map = array(); |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | */ |
245 | 245 | private function _load_core_config() { |
246 | 246 | // load_core_config__start hook |
247 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
247 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
248 | 248 | $espresso_config = $this->get_espresso_config(); |
249 | - foreach ( $espresso_config as $config => $settings ) { |
|
249 | + foreach ($espresso_config as $config => $settings) { |
|
250 | 250 | // load_core_config__start hook |
251 | 251 | $settings = apply_filters( |
252 | 252 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -254,22 +254,22 @@ discard block |
||
254 | 254 | $config, |
255 | 255 | $this |
256 | 256 | ); |
257 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
258 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
257 | + if (is_object($settings) && property_exists($this, $config)) { |
|
258 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
259 | 259 | //call configs populate method to ensure any defaults are set for empty values. |
260 | - if ( method_exists( $settings, 'populate' ) ) { |
|
260 | + if (method_exists($settings, 'populate')) { |
|
261 | 261 | $this->{$config}->populate(); |
262 | 262 | } |
263 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
263 | + if (method_exists($settings, 'do_hooks')) { |
|
264 | 264 | $this->{$config}->do_hooks(); |
265 | 265 | } |
266 | 266 | } |
267 | 267 | } |
268 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
268 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
269 | 269 | $this->update_espresso_config(); |
270 | 270 | } |
271 | 271 | // load_core_config__end hook |
272 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
272 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | |
@@ -284,23 +284,23 @@ discard block |
||
284 | 284 | $this->core = $this->core instanceof EE_Core_Config |
285 | 285 | ? $this->core |
286 | 286 | : new EE_Core_Config(); |
287 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
287 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
288 | 288 | $this->organization = $this->organization instanceof EE_Organization_Config |
289 | 289 | ? $this->organization |
290 | 290 | : new EE_Organization_Config(); |
291 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
291 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
292 | 292 | $this->currency = $this->currency instanceof EE_Currency_Config |
293 | 293 | ? $this->currency |
294 | 294 | : new EE_Currency_Config(); |
295 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
295 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
296 | 296 | $this->registration = $this->registration instanceof EE_Registration_Config |
297 | 297 | ? $this->registration |
298 | 298 | : new EE_Registration_Config(); |
299 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
299 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
300 | 300 | $this->admin = $this->admin instanceof EE_Admin_Config |
301 | 301 | ? $this->admin |
302 | 302 | : new EE_Admin_Config(); |
303 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
303 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
304 | 304 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
305 | 305 | ? $this->template_settings |
306 | 306 | : new EE_Template_Config(); |
@@ -311,19 +311,19 @@ discard block |
||
311 | 311 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
312 | 312 | ? $this->map_settings |
313 | 313 | : new EE_Map_Config(); |
314 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
314 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
315 | 315 | $this->environment = $this->environment instanceof EE_Environment_Config |
316 | 316 | ? $this->environment |
317 | 317 | : new EE_Environment_Config(); |
318 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
318 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
319 | 319 | $this->tax_settings = $this->tax_settings instanceof EE_Tax_Config |
320 | 320 | ? $this->tax_settings |
321 | 321 | : new EE_Tax_Config(); |
322 | - $this->tax_settings = apply_filters( 'FHEE__EE_Config___initialize_config__tax_settings', $this->tax_settings ); |
|
322 | + $this->tax_settings = apply_filters('FHEE__EE_Config___initialize_config__tax_settings', $this->tax_settings); |
|
323 | 323 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
324 | 324 | ? $this->gateway |
325 | 325 | : new EE_Gateway_Config(); |
326 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
326 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | // grab espresso configuration |
339 | 339 | return apply_filters( |
340 | 340 | 'FHEE__EE_Config__get_espresso_config__CFG', |
341 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
341 | + get_option(EE_Config::OPTION_NAME, array()) |
|
342 | 342 | ); |
343 | 343 | } |
344 | 344 | |
@@ -352,12 +352,12 @@ discard block |
||
352 | 352 | * @param $old_value |
353 | 353 | * @param $value |
354 | 354 | */ |
355 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
355 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
356 | 356 | // make sure we're checking the ee config |
357 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
357 | + if ($option === EE_Config::OPTION_NAME) { |
|
358 | 358 | // run a loose comparison of the old value against the new value for type and properties, |
359 | 359 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
360 | - if ( $value != $old_value ) { |
|
360 | + if ($value != $old_value) { |
|
361 | 361 | // if they are NOT the same, then remove the hook, |
362 | 362 | // which means the subsequent update results will be based solely on the update query results |
363 | 363 | // the reason we do this is because, as stated above, |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | // the string it sees in the db looks the same as the new one it has been passed!!! |
373 | 373 | // This results in the query returning an "affected rows" value of ZERO, |
374 | 374 | // which gets returned immediately by WP update_option and looks like an error. |
375 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
375 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | } |
@@ -386,11 +386,11 @@ discard block |
||
386 | 386 | */ |
387 | 387 | protected function _reset_espresso_addon_config() { |
388 | 388 | $this->_addon_option_names = array(); |
389 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
390 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
391 | - $config_class = get_class( $addon_config_obj ); |
|
392 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
393 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
389 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
390 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
391 | + $config_class = get_class($addon_config_obj); |
|
392 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
393 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
394 | 394 | } |
395 | 395 | $this->addons->{$addon_name} = null; |
396 | 396 | } |
@@ -406,22 +406,22 @@ discard block |
||
406 | 406 | * @param bool $add_error |
407 | 407 | * @return bool |
408 | 408 | */ |
409 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
409 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
410 | 410 | // don't allow config updates during WP heartbeats |
411 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
411 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
412 | 412 | return false; |
413 | 413 | } |
414 | 414 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
415 | 415 | //$clone = clone( self::$_instance ); |
416 | 416 | //self::$_instance = NULL; |
417 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
417 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
418 | 418 | $this->_reset_espresso_addon_config(); |
419 | 419 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
420 | 420 | // but BEFORE the actual update occurs |
421 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
421 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
422 | 422 | // now update "ee_config" |
423 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
424 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
423 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
424 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
425 | 425 | // if not saved... check if the hook we just added still exists; |
426 | 426 | // if it does, it means one of two things: |
427 | 427 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -432,17 +432,17 @@ discard block |
||
432 | 432 | // but just means no update occurred, so don't display an error to the user. |
433 | 433 | // BUT... if update_option returns FALSE, AND the hook is missing, |
434 | 434 | // then it means that something truly went wrong |
435 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
435 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
436 | 436 | // remove our action since we don't want it in the system anymore |
437 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
438 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
437 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
438 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
439 | 439 | //self::$_instance = $clone; |
440 | 440 | //unset( $clone ); |
441 | 441 | // if config remains the same or was updated successfully |
442 | - if ( $saved ) { |
|
443 | - if ( $add_success ) { |
|
442 | + if ($saved) { |
|
443 | + if ($add_success) { |
|
444 | 444 | EE_Error::add_success( |
445 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
445 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
446 | 446 | __FILE__, |
447 | 447 | __FUNCTION__, |
448 | 448 | __LINE__ |
@@ -450,9 +450,9 @@ discard block |
||
450 | 450 | } |
451 | 451 | return true; |
452 | 452 | } else { |
453 | - if ( $add_error ) { |
|
453 | + if ($add_error) { |
|
454 | 454 | EE_Error::add_error( |
455 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
455 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
456 | 456 | __FILE__, |
457 | 457 | __FUNCTION__, |
458 | 458 | __LINE__ |
@@ -481,16 +481,16 @@ discard block |
||
481 | 481 | $name = '', |
482 | 482 | $config_class = '', |
483 | 483 | $config_obj = null, |
484 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
484 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
485 | 485 | $display_errors = true |
486 | 486 | ) { |
487 | 487 | try { |
488 | - foreach ( $tests_to_run as $test ) { |
|
489 | - switch ( $test ) { |
|
488 | + foreach ($tests_to_run as $test) { |
|
489 | + switch ($test) { |
|
490 | 490 | // TEST #1 : check that section was set |
491 | 491 | case 1 : |
492 | - if ( empty( $section ) ) { |
|
493 | - if ( $display_errors ) { |
|
492 | + if (empty($section)) { |
|
493 | + if ($display_errors) { |
|
494 | 494 | throw new EE_Error( |
495 | 495 | sprintf( |
496 | 496 | __( |
@@ -506,11 +506,11 @@ discard block |
||
506 | 506 | break; |
507 | 507 | // TEST #2 : check that settings section exists |
508 | 508 | case 2 : |
509 | - if ( ! isset( $this->{$section} ) ) { |
|
510 | - if ( $display_errors ) { |
|
509 | + if ( ! isset($this->{$section} )) { |
|
510 | + if ($display_errors) { |
|
511 | 511 | throw new EE_Error( |
512 | 512 | sprintf( |
513 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
513 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
514 | 514 | $section |
515 | 515 | ) |
516 | 516 | ); |
@@ -521,9 +521,9 @@ discard block |
||
521 | 521 | // TEST #3 : check that section is the proper format |
522 | 522 | case 3 : |
523 | 523 | if ( |
524 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
524 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
525 | 525 | ) { |
526 | - if ( $display_errors ) { |
|
526 | + if ($display_errors) { |
|
527 | 527 | throw new EE_Error( |
528 | 528 | sprintf( |
529 | 529 | __( |
@@ -539,8 +539,8 @@ discard block |
||
539 | 539 | break; |
540 | 540 | // TEST #4 : check that config section name has been set |
541 | 541 | case 4 : |
542 | - if ( empty( $name ) ) { |
|
543 | - if ( $display_errors ) { |
|
542 | + if (empty($name)) { |
|
543 | + if ($display_errors) { |
|
544 | 544 | throw new EE_Error( |
545 | 545 | __( |
546 | 546 | 'No name has been provided for the specific configuration section.', |
@@ -553,8 +553,8 @@ discard block |
||
553 | 553 | break; |
554 | 554 | // TEST #5 : check that a config class name has been set |
555 | 555 | case 5 : |
556 | - if ( empty( $config_class ) ) { |
|
557 | - if ( $display_errors ) { |
|
556 | + if (empty($config_class)) { |
|
557 | + if ($display_errors) { |
|
558 | 558 | throw new EE_Error( |
559 | 559 | __( |
560 | 560 | 'No class name has been provided for the specific configuration section.', |
@@ -567,8 +567,8 @@ discard block |
||
567 | 567 | break; |
568 | 568 | // TEST #6 : verify config class is accessible |
569 | 569 | case 6 : |
570 | - if ( ! class_exists( $config_class ) ) { |
|
571 | - if ( $display_errors ) { |
|
570 | + if ( ! class_exists($config_class)) { |
|
571 | + if ($display_errors) { |
|
572 | 572 | throw new EE_Error( |
573 | 573 | sprintf( |
574 | 574 | __( |
@@ -584,11 +584,11 @@ discard block |
||
584 | 584 | break; |
585 | 585 | // TEST #7 : check that config has even been set |
586 | 586 | case 7 : |
587 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
588 | - if ( $display_errors ) { |
|
587 | + if ( ! isset($this->{$section}->{$name} )) { |
|
588 | + if ($display_errors) { |
|
589 | 589 | throw new EE_Error( |
590 | 590 | sprintf( |
591 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
591 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
592 | 592 | $section, |
593 | 593 | $name |
594 | 594 | ) |
@@ -597,13 +597,13 @@ discard block |
||
597 | 597 | return false; |
598 | 598 | } else { |
599 | 599 | // and make sure it's not serialized |
600 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
600 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
601 | 601 | } |
602 | 602 | break; |
603 | 603 | // TEST #8 : check that config is the requested type |
604 | 604 | case 8 : |
605 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
606 | - if ( $display_errors ) { |
|
605 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
606 | + if ($display_errors) { |
|
607 | 607 | throw new EE_Error( |
608 | 608 | sprintf( |
609 | 609 | __( |
@@ -621,12 +621,12 @@ discard block |
||
621 | 621 | break; |
622 | 622 | // TEST #9 : verify config object |
623 | 623 | case 9 : |
624 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
625 | - if ( $display_errors ) { |
|
624 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
625 | + if ($display_errors) { |
|
626 | 626 | throw new EE_Error( |
627 | 627 | sprintf( |
628 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
629 | - print_r( $config_obj, true ) |
|
628 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
629 | + print_r($config_obj, true) |
|
630 | 630 | ) |
631 | 631 | ); |
632 | 632 | } |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | break; |
636 | 636 | } |
637 | 637 | } |
638 | - } catch ( EE_Error $e ) { |
|
638 | + } catch (EE_Error $e) { |
|
639 | 639 | $e->get_error(); |
640 | 640 | } |
641 | 641 | // you have successfully run the gauntlet |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | * @param string $name |
653 | 653 | * @return string |
654 | 654 | */ |
655 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
656 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
655 | + private function _generate_config_option_name($section = '', $name = '') { |
|
656 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | |
@@ -667,10 +667,10 @@ discard block |
||
667 | 667 | * @param string $name |
668 | 668 | * @return string |
669 | 669 | */ |
670 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
671 | - return ! empty( $config_class ) |
|
670 | + private function _set_config_class($config_class = '', $name = '') { |
|
671 | + return ! empty($config_class) |
|
672 | 672 | ? $config_class |
673 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
673 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | |
@@ -685,36 +685,36 @@ discard block |
||
685 | 685 | * @param EE_Config_Base $config_obj |
686 | 686 | * @return EE_Config_Base |
687 | 687 | */ |
688 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
688 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
689 | 689 | // ensure config class is set to something |
690 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
690 | + $config_class = $this->_set_config_class($config_class, $name); |
|
691 | 691 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
692 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
692 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
693 | 693 | return null; |
694 | 694 | } |
695 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
695 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
696 | 696 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
697 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
698 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
697 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
698 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
699 | 699 | $this->update_addon_option_names(); |
700 | 700 | } |
701 | 701 | // verify the incoming config object but suppress errors |
702 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
702 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
703 | 703 | $config_obj = new $config_class(); |
704 | 704 | } |
705 | - if ( get_option( $config_option_name ) ) { |
|
706 | - EE_Config::log( $config_option_name ); |
|
707 | - update_option( $config_option_name, $config_obj ); |
|
705 | + if (get_option($config_option_name)) { |
|
706 | + EE_Config::log($config_option_name); |
|
707 | + update_option($config_option_name, $config_obj); |
|
708 | 708 | $this->{$section}->{$name} = $config_obj; |
709 | 709 | return $this->{$section}->{$name}; |
710 | 710 | } else { |
711 | 711 | // create a wp-option for this config |
712 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
713 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
712 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
713 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
714 | 714 | return $this->{$section}->{$name}; |
715 | 715 | } else { |
716 | 716 | EE_Error::add_error( |
717 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
717 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
718 | 718 | __FILE__, |
719 | 719 | __FUNCTION__, |
720 | 720 | __LINE__ |
@@ -737,46 +737,46 @@ discard block |
||
737 | 737 | * @param bool $throw_errors |
738 | 738 | * @return bool |
739 | 739 | */ |
740 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
740 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
741 | 741 | // don't allow config updates during WP heartbeats |
742 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
742 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
743 | 743 | return false; |
744 | 744 | } |
745 | - $config_obj = maybe_unserialize( $config_obj ); |
|
745 | + $config_obj = maybe_unserialize($config_obj); |
|
746 | 746 | // get class name of the incoming object |
747 | - $config_class = get_class( $config_obj ); |
|
747 | + $config_class = get_class($config_obj); |
|
748 | 748 | // run tests 1-5 and 9 to verify config |
749 | 749 | if ( ! $this->_verify_config_params( |
750 | 750 | $section, |
751 | 751 | $name, |
752 | 752 | $config_class, |
753 | 753 | $config_obj, |
754 | - array( 1, 2, 3, 4, 7, 9 ) |
|
754 | + array(1, 2, 3, 4, 7, 9) |
|
755 | 755 | ) |
756 | 756 | ) { |
757 | 757 | return false; |
758 | 758 | } |
759 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
759 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
760 | 760 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
761 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
761 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
762 | 762 | // save new config to db |
763 | - if( $this->set_config( $section, $name, $config_class, $config_obj ) ) { |
|
763 | + if ($this->set_config($section, $name, $config_class, $config_obj)) { |
|
764 | 764 | return true; |
765 | 765 | } |
766 | 766 | } else { |
767 | 767 | // first check if the record already exists |
768 | - $existing_config = get_option( $config_option_name ); |
|
769 | - $config_obj = serialize( $config_obj ); |
|
768 | + $existing_config = get_option($config_option_name); |
|
769 | + $config_obj = serialize($config_obj); |
|
770 | 770 | // just return if db record is already up to date (NOT type safe comparison) |
771 | - if ( $existing_config == $config_obj ) { |
|
771 | + if ($existing_config == $config_obj) { |
|
772 | 772 | $this->{$section}->{$name} = $config_obj; |
773 | 773 | return true; |
774 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
775 | - EE_Config::log( $config_option_name ); |
|
774 | + } else if (update_option($config_option_name, $config_obj)) { |
|
775 | + EE_Config::log($config_option_name); |
|
776 | 776 | // update wp-option for this config class |
777 | 777 | $this->{$section}->{$name} = $config_obj; |
778 | 778 | return true; |
779 | - } elseif ( $throw_errors ) { |
|
779 | + } elseif ($throw_errors) { |
|
780 | 780 | EE_Error::add_error( |
781 | 781 | sprintf( |
782 | 782 | __( |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | 'event_espresso' |
785 | 785 | ), |
786 | 786 | $config_class, |
787 | - 'EE_Config->' . $section . '->' . $name |
|
787 | + 'EE_Config->'.$section.'->'.$name |
|
788 | 788 | ), |
789 | 789 | __FILE__, |
790 | 790 | __FUNCTION__, |
@@ -806,34 +806,34 @@ discard block |
||
806 | 806 | * @param string $config_class |
807 | 807 | * @return mixed EE_Config_Base | NULL |
808 | 808 | */ |
809 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
809 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
810 | 810 | // ensure config class is set to something |
811 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
811 | + $config_class = $this->_set_config_class($config_class, $name); |
|
812 | 812 | // run tests 1-4, 6 and 7 to verify that all params have been set |
813 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
813 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
814 | 814 | return null; |
815 | 815 | } |
816 | 816 | // now test if the requested config object exists, but suppress errors |
817 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
817 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
818 | 818 | // config already exists, so pass it back |
819 | 819 | return $this->{$section}->{$name}; |
820 | 820 | } |
821 | 821 | // load config option from db if it exists |
822 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
822 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
823 | 823 | // verify the newly retrieved config object, but suppress errors |
824 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
824 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
825 | 825 | // config is good, so set it and pass it back |
826 | 826 | $this->{$section}->{$name} = $config_obj; |
827 | 827 | return $this->{$section}->{$name}; |
828 | 828 | } |
829 | 829 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
830 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
830 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
831 | 831 | // verify the newly created config object |
832 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
832 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
833 | 833 | return $this->{$section}->{$name}; |
834 | 834 | } else { |
835 | 835 | EE_Error::add_error( |
836 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
836 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
837 | 837 | __FILE__, |
838 | 838 | __FUNCTION__, |
839 | 839 | __LINE__ |
@@ -851,11 +851,11 @@ discard block |
||
851 | 851 | * @param string $config_option_name |
852 | 852 | * @return mixed EE_Config_Base | FALSE |
853 | 853 | */ |
854 | - public function get_config_option( $config_option_name = '' ) { |
|
854 | + public function get_config_option($config_option_name = '') { |
|
855 | 855 | // retrieve the wp-option for this config class. |
856 | - $config_option = maybe_unserialize( get_option( $config_option_name, array() ) ); |
|
857 | - if ( empty( $config_option ) ) { |
|
858 | - EE_Config::log( $config_option_name . '-NOT-FOUND' ); |
|
856 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
857 | + if (empty($config_option)) { |
|
858 | + EE_Config::log($config_option_name.'-NOT-FOUND'); |
|
859 | 859 | } |
860 | 860 | return $config_option; |
861 | 861 | } |
@@ -867,17 +867,17 @@ discard block |
||
867 | 867 | * |
868 | 868 | * @param string $config_option_name |
869 | 869 | */ |
870 | - public static function log( $config_option_name = '' ) { |
|
871 | - if ( ! empty( $config_option_name ) ) { |
|
872 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
870 | + public static function log($config_option_name = '') { |
|
871 | + if ( ! empty($config_option_name)) { |
|
872 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
873 | 873 | //copy incoming $_REQUEST and sanitize it so we can save it |
874 | 874 | $_request = $_REQUEST; |
875 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
876 | - $config_log[ (string) microtime( true ) ] = array( |
|
875 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
876 | + $config_log[(string) microtime(true)] = array( |
|
877 | 877 | 'config_name' => $config_option_name, |
878 | 878 | 'request' => $_request, |
879 | 879 | ); |
880 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
880 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
881 | 881 | } |
882 | 882 | } |
883 | 883 | |
@@ -888,12 +888,12 @@ discard block |
||
888 | 888 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
889 | 889 | */ |
890 | 890 | public static function trim_log() { |
891 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
892 | - $log_length = count( $config_log ); |
|
893 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
894 | - ksort( $config_log ); |
|
895 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
896 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
891 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
892 | + $log_length = count($config_log); |
|
893 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
894 | + ksort($config_log); |
|
895 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
896 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
897 | 897 | } |
898 | 898 | } |
899 | 899 | |
@@ -908,14 +908,14 @@ discard block |
||
908 | 908 | * @return string |
909 | 909 | */ |
910 | 910 | public static function get_page_for_posts() { |
911 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
912 | - if ( ! $page_for_posts ) { |
|
911 | + $page_for_posts = get_option('page_for_posts'); |
|
912 | + if ( ! $page_for_posts) { |
|
913 | 913 | return 'posts'; |
914 | 914 | } |
915 | 915 | /** @type WPDB $wpdb */ |
916 | 916 | global $wpdb; |
917 | 917 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
918 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
918 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | |
@@ -971,17 +971,17 @@ discard block |
||
971 | 971 | ) |
972 | 972 | ) { |
973 | 973 | // grab list of installed widgets |
974 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
974 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
975 | 975 | // filter list of modules to register |
976 | 976 | $widgets_to_register = apply_filters( |
977 | 977 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
978 | 978 | $widgets_to_register |
979 | 979 | ); |
980 | - if ( ! empty( $widgets_to_register ) ) { |
|
980 | + if ( ! empty($widgets_to_register)) { |
|
981 | 981 | // cycle thru widget folders |
982 | - foreach ( $widgets_to_register as $widget_path ) { |
|
982 | + foreach ($widgets_to_register as $widget_path) { |
|
983 | 983 | // add to list of installed widget modules |
984 | - EE_Config::register_ee_widget( $widget_path ); |
|
984 | + EE_Config::register_ee_widget($widget_path); |
|
985 | 985 | } |
986 | 986 | } |
987 | 987 | // filter list of installed modules |
@@ -1001,57 +1001,57 @@ discard block |
||
1001 | 1001 | * @param string $widget_path - full path up to and including widget folder |
1002 | 1002 | * @return void |
1003 | 1003 | */ |
1004 | - public static function register_ee_widget( $widget_path = null ) { |
|
1005 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
1004 | + public static function register_ee_widget($widget_path = null) { |
|
1005 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
1006 | 1006 | $widget_ext = '.widget.php'; |
1007 | 1007 | // make all separators match |
1008 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
1008 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
1009 | 1009 | // does the file path INCLUDE the actual file name as part of the path ? |
1010 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
1010 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
1011 | 1011 | // grab and shortcode file name from directory name and break apart at dots |
1012 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
1012 | + $file_name = explode('.', basename($widget_path)); |
|
1013 | 1013 | // take first segment from file name pieces and remove class prefix if it exists |
1014 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
1014 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1015 | 1015 | // sanitize shortcode directory name |
1016 | - $widget = sanitize_key( $widget ); |
|
1016 | + $widget = sanitize_key($widget); |
|
1017 | 1017 | // now we need to rebuild the shortcode path |
1018 | - $widget_path = explode( DS, $widget_path ); |
|
1018 | + $widget_path = explode(DS, $widget_path); |
|
1019 | 1019 | // remove last segment |
1020 | - array_pop( $widget_path ); |
|
1020 | + array_pop($widget_path); |
|
1021 | 1021 | // glue it back together |
1022 | - $widget_path = implode( DS, $widget_path ); |
|
1022 | + $widget_path = implode(DS, $widget_path); |
|
1023 | 1023 | } else { |
1024 | 1024 | // grab and sanitize widget directory name |
1025 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1025 | + $widget = sanitize_key(basename($widget_path)); |
|
1026 | 1026 | } |
1027 | 1027 | // create classname from widget directory name |
1028 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1028 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1029 | 1029 | // add class prefix |
1030 | - $widget_class = 'EEW_' . $widget; |
|
1030 | + $widget_class = 'EEW_'.$widget; |
|
1031 | 1031 | // does the widget exist ? |
1032 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1032 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1033 | 1033 | $msg = sprintf( |
1034 | 1034 | __( |
1035 | 1035 | 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', |
1036 | 1036 | 'event_espresso' |
1037 | 1037 | ), |
1038 | 1038 | $widget_class, |
1039 | - $widget_path . DS . $widget_class . $widget_ext |
|
1039 | + $widget_path.DS.$widget_class.$widget_ext |
|
1040 | 1040 | ); |
1041 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1041 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1042 | 1042 | return; |
1043 | 1043 | } |
1044 | 1044 | // load the widget class file |
1045 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1045 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1046 | 1046 | // verify that class exists |
1047 | - if ( ! class_exists( $widget_class ) ) { |
|
1048 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1049 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1047 | + if ( ! class_exists($widget_class)) { |
|
1048 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1049 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1050 | 1050 | return; |
1051 | 1051 | } |
1052 | - register_widget( $widget_class ); |
|
1052 | + register_widget($widget_class); |
|
1053 | 1053 | // add to array of registered widgets |
1054 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1054 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | |
@@ -1064,17 +1064,17 @@ discard block |
||
1064 | 1064 | */ |
1065 | 1065 | private function _register_shortcodes() { |
1066 | 1066 | // grab list of installed shortcodes |
1067 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1067 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1068 | 1068 | // filter list of modules to register |
1069 | 1069 | $shortcodes_to_register = apply_filters( |
1070 | 1070 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1071 | 1071 | $shortcodes_to_register |
1072 | 1072 | ); |
1073 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1073 | + if ( ! empty($shortcodes_to_register)) { |
|
1074 | 1074 | // cycle thru shortcode folders |
1075 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1075 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1076 | 1076 | // add to list of installed shortcode modules |
1077 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1077 | + EE_Config::register_shortcode($shortcode_path); |
|
1078 | 1078 | } |
1079 | 1079 | } |
1080 | 1080 | // filter list of installed modules |
@@ -1093,64 +1093,64 @@ discard block |
||
1093 | 1093 | * @param string $shortcode_path - full path up to and including shortcode folder |
1094 | 1094 | * @return bool |
1095 | 1095 | */ |
1096 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1097 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1096 | + public static function register_shortcode($shortcode_path = null) { |
|
1097 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1098 | 1098 | $shortcode_ext = '.shortcode.php'; |
1099 | 1099 | // make all separators match |
1100 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1100 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1101 | 1101 | // does the file path INCLUDE the actual file name as part of the path ? |
1102 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1102 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1103 | 1103 | // grab shortcode file name from directory name and break apart at dots |
1104 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1104 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1105 | 1105 | // take first segment from file name pieces and remove class prefix if it exists |
1106 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1107 | - ? substr( $shortcode_file[0], 4 ) |
|
1106 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1107 | + ? substr($shortcode_file[0], 4) |
|
1108 | 1108 | : $shortcode_file[0]; |
1109 | 1109 | // sanitize shortcode directory name |
1110 | - $shortcode = sanitize_key( $shortcode ); |
|
1110 | + $shortcode = sanitize_key($shortcode); |
|
1111 | 1111 | // now we need to rebuild the shortcode path |
1112 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1112 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1113 | 1113 | // remove last segment |
1114 | - array_pop( $shortcode_path ); |
|
1114 | + array_pop($shortcode_path); |
|
1115 | 1115 | // glue it back together |
1116 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1116 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1117 | 1117 | } else { |
1118 | 1118 | // we need to generate the filename based off of the folder name |
1119 | 1119 | // grab and sanitize shortcode directory name |
1120 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1121 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1120 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1121 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1122 | 1122 | } |
1123 | 1123 | // create classname from shortcode directory or file name |
1124 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1124 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1125 | 1125 | // add class prefix |
1126 | - $shortcode_class = 'EES_' . $shortcode; |
|
1126 | + $shortcode_class = 'EES_'.$shortcode; |
|
1127 | 1127 | // does the shortcode exist ? |
1128 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1128 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1129 | 1129 | $msg = sprintf( |
1130 | 1130 | __( |
1131 | 1131 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1132 | 1132 | 'event_espresso' |
1133 | 1133 | ), |
1134 | 1134 | $shortcode_class, |
1135 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1135 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1136 | 1136 | ); |
1137 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1137 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1138 | 1138 | return false; |
1139 | 1139 | } |
1140 | 1140 | // load the shortcode class file |
1141 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1141 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1142 | 1142 | // verify that class exists |
1143 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1143 | + if ( ! class_exists($shortcode_class)) { |
|
1144 | 1144 | $msg = sprintf( |
1145 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1145 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1146 | 1146 | $shortcode_class |
1147 | 1147 | ); |
1148 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1148 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1149 | 1149 | return false; |
1150 | 1150 | } |
1151 | - $shortcode = strtoupper( $shortcode ); |
|
1151 | + $shortcode = strtoupper($shortcode); |
|
1152 | 1152 | // add to array of registered shortcodes |
1153 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1153 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1154 | 1154 | return true; |
1155 | 1155 | } |
1156 | 1156 | |
@@ -1164,22 +1164,22 @@ discard block |
||
1164 | 1164 | */ |
1165 | 1165 | private function _register_modules() { |
1166 | 1166 | // grab list of installed modules |
1167 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1167 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1168 | 1168 | // filter list of modules to register |
1169 | 1169 | $modules_to_register = apply_filters( |
1170 | 1170 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1171 | 1171 | $modules_to_register |
1172 | 1172 | ); |
1173 | - if ( ! empty( $modules_to_register ) ) { |
|
1173 | + if ( ! empty($modules_to_register)) { |
|
1174 | 1174 | // loop through folders |
1175 | - foreach ( $modules_to_register as $module_path ) { |
|
1175 | + foreach ($modules_to_register as $module_path) { |
|
1176 | 1176 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1177 | 1177 | if ( |
1178 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1179 | - && $module_path !== EE_MODULES . 'gateways' |
|
1178 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1179 | + && $module_path !== EE_MODULES.'gateways' |
|
1180 | 1180 | ) { |
1181 | 1181 | // add to list of installed modules |
1182 | - EE_Config::register_module( $module_path ); |
|
1182 | + EE_Config::register_module($module_path); |
|
1183 | 1183 | } |
1184 | 1184 | } |
1185 | 1185 | } |
@@ -1199,39 +1199,39 @@ discard block |
||
1199 | 1199 | * @param string $module_path - full path up to and including module folder |
1200 | 1200 | * @return bool |
1201 | 1201 | */ |
1202 | - public static function register_module( $module_path = null ) { |
|
1203 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1202 | + public static function register_module($module_path = null) { |
|
1203 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1204 | 1204 | $module_ext = '.module.php'; |
1205 | 1205 | // make all separators match |
1206 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1206 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1207 | 1207 | // does the file path INCLUDE the actual file name as part of the path ? |
1208 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1208 | + if (strpos($module_path, $module_ext) !== false) { |
|
1209 | 1209 | // grab and shortcode file name from directory name and break apart at dots |
1210 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1210 | + $module_file = explode('.', basename($module_path)); |
|
1211 | 1211 | // now we need to rebuild the shortcode path |
1212 | - $module_path = explode( DS, $module_path ); |
|
1212 | + $module_path = explode(DS, $module_path); |
|
1213 | 1213 | // remove last segment |
1214 | - array_pop( $module_path ); |
|
1214 | + array_pop($module_path); |
|
1215 | 1215 | // glue it back together |
1216 | - $module_path = implode( DS, $module_path ) . DS; |
|
1216 | + $module_path = implode(DS, $module_path).DS; |
|
1217 | 1217 | // take first segment from file name pieces and sanitize it |
1218 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1218 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1219 | 1219 | // ensure class prefix is added |
1220 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1220 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1221 | 1221 | } else { |
1222 | 1222 | // we need to generate the filename based off of the folder name |
1223 | 1223 | // grab and sanitize module name |
1224 | - $module = strtolower( basename( $module_path ) ); |
|
1225 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1224 | + $module = strtolower(basename($module_path)); |
|
1225 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1226 | 1226 | // like trailingslashit() |
1227 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1227 | + $module_path = rtrim($module_path, DS).DS; |
|
1228 | 1228 | // create classname from module directory name |
1229 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1229 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1230 | 1230 | // add class prefix |
1231 | - $module_class = 'EED_' . $module; |
|
1231 | + $module_class = 'EED_'.$module; |
|
1232 | 1232 | } |
1233 | 1233 | // does the module exist ? |
1234 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1234 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1235 | 1235 | $msg = sprintf( |
1236 | 1236 | __( |
1237 | 1237 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1239,19 +1239,19 @@ discard block |
||
1239 | 1239 | ), |
1240 | 1240 | $module |
1241 | 1241 | ); |
1242 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1242 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1243 | 1243 | return false; |
1244 | 1244 | } |
1245 | 1245 | // load the module class file |
1246 | - require_once( $module_path . $module_class . $module_ext ); |
|
1246 | + require_once($module_path.$module_class.$module_ext); |
|
1247 | 1247 | // verify that class exists |
1248 | - if ( ! class_exists( $module_class ) ) { |
|
1249 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1250 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1248 | + if ( ! class_exists($module_class)) { |
|
1249 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1250 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1251 | 1251 | return false; |
1252 | 1252 | } |
1253 | 1253 | // add to array of registered modules |
1254 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1254 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1255 | 1255 | do_action( |
1256 | 1256 | 'AHEE__EE_Config__register_module__complete', |
1257 | 1257 | $module_class, |
@@ -1271,26 +1271,26 @@ discard block |
||
1271 | 1271 | */ |
1272 | 1272 | private function _initialize_shortcodes() { |
1273 | 1273 | // cycle thru shortcode folders |
1274 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1274 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1275 | 1275 | // add class prefix |
1276 | - $shortcode_class = 'EES_' . $shortcode; |
|
1276 | + $shortcode_class = 'EES_'.$shortcode; |
|
1277 | 1277 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1278 | 1278 | // which set hooks ? |
1279 | - if ( is_admin() ) { |
|
1279 | + if (is_admin()) { |
|
1280 | 1280 | // fire immediately |
1281 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1281 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1282 | 1282 | } else { |
1283 | 1283 | // delay until other systems are online |
1284 | 1284 | add_action( |
1285 | 1285 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1286 | - array( $shortcode_class, 'set_hooks' ) |
|
1286 | + array($shortcode_class, 'set_hooks') |
|
1287 | 1287 | ); |
1288 | 1288 | // convert classname to UPPERCASE and create WP shortcode. |
1289 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1289 | + $shortcode_tag = strtoupper($shortcode); |
|
1290 | 1290 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1291 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1291 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1292 | 1292 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1293 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1293 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1294 | 1294 | } |
1295 | 1295 | } |
1296 | 1296 | } |
@@ -1307,17 +1307,17 @@ discard block |
||
1307 | 1307 | */ |
1308 | 1308 | private function _initialize_modules() { |
1309 | 1309 | // cycle thru shortcode folders |
1310 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1310 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1311 | 1311 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1312 | 1312 | // which set hooks ? |
1313 | - if ( is_admin() ) { |
|
1313 | + if (is_admin()) { |
|
1314 | 1314 | // fire immediately |
1315 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1315 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1316 | 1316 | } else { |
1317 | 1317 | // delay until other systems are online |
1318 | 1318 | add_action( |
1319 | 1319 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1320 | - array( $module_class, 'set_hooks' ) |
|
1320 | + array($module_class, 'set_hooks') |
|
1321 | 1321 | ); |
1322 | 1322 | } |
1323 | 1323 | } |
@@ -1335,29 +1335,29 @@ discard block |
||
1335 | 1335 | * @param string $key - url param key indicating a route is being called |
1336 | 1336 | * @return bool |
1337 | 1337 | */ |
1338 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1339 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1340 | - $module = str_replace( 'EED_', '', $module ); |
|
1341 | - $module_class = 'EED_' . $module; |
|
1342 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1343 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1344 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1338 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1339 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1340 | + $module = str_replace('EED_', '', $module); |
|
1341 | + $module_class = 'EED_'.$module; |
|
1342 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1343 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1344 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1345 | 1345 | return false; |
1346 | 1346 | } |
1347 | - if ( empty( $route ) ) { |
|
1348 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1349 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1347 | + if (empty($route)) { |
|
1348 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1349 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1350 | 1350 | return false; |
1351 | 1351 | } |
1352 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1352 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1353 | 1353 | $msg = sprintf( |
1354 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1354 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1355 | 1355 | $route |
1356 | 1356 | ); |
1357 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1357 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1358 | 1358 | return false; |
1359 | 1359 | } |
1360 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1360 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1361 | 1361 | return true; |
1362 | 1362 | } |
1363 | 1363 | |
@@ -1371,11 +1371,11 @@ discard block |
||
1371 | 1371 | * @param string $key - url param key indicating a route is being called |
1372 | 1372 | * @return string |
1373 | 1373 | */ |
1374 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1375 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1376 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1377 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1378 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1374 | + public static function get_route($route = null, $key = 'ee') { |
|
1375 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1376 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1377 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1378 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1379 | 1379 | } |
1380 | 1380 | return null; |
1381 | 1381 | } |
@@ -1405,49 +1405,49 @@ discard block |
||
1405 | 1405 | * @param string $key - url param key indicating a route is being called |
1406 | 1406 | * @return bool |
1407 | 1407 | */ |
1408 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1409 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1410 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1408 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1409 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1410 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1411 | 1411 | $msg = sprintf( |
1412 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1412 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1413 | 1413 | $route |
1414 | 1414 | ); |
1415 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1415 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1416 | 1416 | return false; |
1417 | 1417 | } |
1418 | - if ( empty( $forward ) ) { |
|
1419 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1420 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1418 | + if (empty($forward)) { |
|
1419 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1420 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1421 | 1421 | return false; |
1422 | 1422 | } |
1423 | - if ( is_array( $forward ) ) { |
|
1424 | - if ( ! isset( $forward[1] ) ) { |
|
1423 | + if (is_array($forward)) { |
|
1424 | + if ( ! isset($forward[1])) { |
|
1425 | 1425 | $msg = sprintf( |
1426 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1426 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1427 | 1427 | $route |
1428 | 1428 | ); |
1429 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1429 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1430 | 1430 | return false; |
1431 | 1431 | } |
1432 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1432 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1433 | 1433 | $msg = sprintf( |
1434 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1434 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1435 | 1435 | $forward[1], |
1436 | 1436 | $route |
1437 | 1437 | ); |
1438 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1438 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1439 | 1439 | return false; |
1440 | 1440 | } |
1441 | - } else if ( ! function_exists( $forward ) ) { |
|
1441 | + } else if ( ! function_exists($forward)) { |
|
1442 | 1442 | $msg = sprintf( |
1443 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1443 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1444 | 1444 | $forward, |
1445 | 1445 | $route |
1446 | 1446 | ); |
1447 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1447 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1448 | 1448 | return false; |
1449 | 1449 | } |
1450 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1450 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1451 | 1451 | return true; |
1452 | 1452 | } |
1453 | 1453 | |
@@ -1463,12 +1463,12 @@ discard block |
||
1463 | 1463 | * @param string $key - url param key indicating a route is being called |
1464 | 1464 | * @return string |
1465 | 1465 | */ |
1466 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1467 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1468 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1466 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1467 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1468 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1469 | 1469 | return apply_filters( |
1470 | 1470 | 'FHEE__EE_Config__get_forward', |
1471 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1471 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1472 | 1472 | $route, |
1473 | 1473 | $status |
1474 | 1474 | ); |
@@ -1490,17 +1490,17 @@ discard block |
||
1490 | 1490 | * @param string $key - url param key indicating a route is being called |
1491 | 1491 | * @return bool |
1492 | 1492 | */ |
1493 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1494 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1495 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1493 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1494 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1495 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1496 | 1496 | $msg = sprintf( |
1497 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1497 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1498 | 1498 | $route |
1499 | 1499 | ); |
1500 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1500 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1501 | 1501 | return false; |
1502 | 1502 | } |
1503 | - if ( ! is_readable( $view ) ) { |
|
1503 | + if ( ! is_readable($view)) { |
|
1504 | 1504 | $msg = sprintf( |
1505 | 1505 | __( |
1506 | 1506 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1508,10 +1508,10 @@ discard block |
||
1508 | 1508 | ), |
1509 | 1509 | $view |
1510 | 1510 | ); |
1511 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1511 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1512 | 1512 | return false; |
1513 | 1513 | } |
1514 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1514 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1515 | 1515 | return true; |
1516 | 1516 | } |
1517 | 1517 | |
@@ -1527,12 +1527,12 @@ discard block |
||
1527 | 1527 | * @param string $key - url param key indicating a route is being called |
1528 | 1528 | * @return string |
1529 | 1529 | */ |
1530 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1531 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1532 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1530 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1531 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1532 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1533 | 1533 | return apply_filters( |
1534 | 1534 | 'FHEE__EE_Config__get_view', |
1535 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1535 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1536 | 1536 | $route, |
1537 | 1537 | $status |
1538 | 1538 | ); |
@@ -1543,7 +1543,7 @@ discard block |
||
1543 | 1543 | |
1544 | 1544 | |
1545 | 1545 | public function update_addon_option_names() { |
1546 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1546 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1547 | 1547 | } |
1548 | 1548 | |
1549 | 1549 | |
@@ -1571,22 +1571,22 @@ discard block |
||
1571 | 1571 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1572 | 1572 | * @throws \EE_Error |
1573 | 1573 | */ |
1574 | - public function get_pretty( $property ) { |
|
1575 | - if ( ! property_exists( $this, $property ) ) { |
|
1574 | + public function get_pretty($property) { |
|
1575 | + if ( ! property_exists($this, $property)) { |
|
1576 | 1576 | throw new EE_Error( |
1577 | 1577 | sprintf( |
1578 | 1578 | __( |
1579 | 1579 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1580 | 1580 | 'event_espresso' |
1581 | 1581 | ), |
1582 | - get_class( $this ), |
|
1582 | + get_class($this), |
|
1583 | 1583 | $property |
1584 | 1584 | ) |
1585 | 1585 | ); |
1586 | 1586 | } |
1587 | 1587 | //just handling escaping of strings for now. |
1588 | - if ( is_string( $this->{$property} ) ) { |
|
1589 | - return stripslashes( $this->{$property} ); |
|
1588 | + if (is_string($this->{$property} )) { |
|
1589 | + return stripslashes($this->{$property} ); |
|
1590 | 1590 | } |
1591 | 1591 | return $this->{$property}; |
1592 | 1592 | } |
@@ -1595,17 +1595,17 @@ discard block |
||
1595 | 1595 | |
1596 | 1596 | public function populate() { |
1597 | 1597 | //grab defaults via a new instance of this class. |
1598 | - $class_name = get_class( $this ); |
|
1598 | + $class_name = get_class($this); |
|
1599 | 1599 | $defaults = new $class_name; |
1600 | 1600 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1601 | 1601 | //default from our $defaults object. |
1602 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1603 | - if ( $this->{$property} === null ) { |
|
1602 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1603 | + if ($this->{$property} === null) { |
|
1604 | 1604 | $this->{$property} = $value; |
1605 | 1605 | } |
1606 | 1606 | } |
1607 | 1607 | //cleanup |
1608 | - unset( $defaults ); |
|
1608 | + unset($defaults); |
|
1609 | 1609 | } |
1610 | 1610 | |
1611 | 1611 | |
@@ -1621,7 +1621,7 @@ discard block |
||
1621 | 1621 | * @param $a |
1622 | 1622 | * @return bool |
1623 | 1623 | */ |
1624 | - public function __isset( $a ) { |
|
1624 | + public function __isset($a) { |
|
1625 | 1625 | return false; |
1626 | 1626 | } |
1627 | 1627 | |
@@ -1633,7 +1633,7 @@ discard block |
||
1633 | 1633 | * @param $a |
1634 | 1634 | * @return bool |
1635 | 1635 | */ |
1636 | - public function __unset( $a ) { |
|
1636 | + public function __unset($a) { |
|
1637 | 1637 | return false; |
1638 | 1638 | } |
1639 | 1639 | |
@@ -1743,7 +1743,7 @@ discard block |
||
1743 | 1743 | $this->current_blog_id = get_current_blog_id(); |
1744 | 1744 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1745 | 1745 | $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
1746 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1746 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1747 | 1747 | $this->post_shortcodes = array(); |
1748 | 1748 | $this->module_route_map = array(); |
1749 | 1749 | $this->module_forward_map = array(); |
@@ -1759,9 +1759,9 @@ discard block |
||
1759 | 1759 | $this->thank_you_page_url = ''; |
1760 | 1760 | $this->cancel_page_url = ''; |
1761 | 1761 | //cpt slugs |
1762 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1762 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1763 | 1763 | //ueip constant check |
1764 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1764 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1765 | 1765 | $this->ee_ueip_optin = false; |
1766 | 1766 | $this->ee_ueip_has_notified = true; |
1767 | 1767 | } |
@@ -1804,11 +1804,11 @@ discard block |
||
1804 | 1804 | * @return string |
1805 | 1805 | */ |
1806 | 1806 | public function reg_page_url() { |
1807 | - if ( ! $this->reg_page_url ) { |
|
1807 | + if ( ! $this->reg_page_url) { |
|
1808 | 1808 | $this->reg_page_url = add_query_arg( |
1809 | - array( 'uts' => time() ), |
|
1810 | - get_permalink( $this->reg_page_id ) |
|
1811 | - ) . '#checkout'; |
|
1809 | + array('uts' => time()), |
|
1810 | + get_permalink($this->reg_page_id) |
|
1811 | + ).'#checkout'; |
|
1812 | 1812 | } |
1813 | 1813 | return $this->reg_page_url; |
1814 | 1814 | } |
@@ -1823,12 +1823,12 @@ discard block |
||
1823 | 1823 | * @access public |
1824 | 1824 | * @return string |
1825 | 1825 | */ |
1826 | - public function txn_page_url( $query_args = array() ) { |
|
1827 | - if ( ! $this->txn_page_url ) { |
|
1828 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1826 | + public function txn_page_url($query_args = array()) { |
|
1827 | + if ( ! $this->txn_page_url) { |
|
1828 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1829 | 1829 | } |
1830 | - if ( $query_args ) { |
|
1831 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1830 | + if ($query_args) { |
|
1831 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1832 | 1832 | } else { |
1833 | 1833 | return $this->txn_page_url; |
1834 | 1834 | } |
@@ -1844,12 +1844,12 @@ discard block |
||
1844 | 1844 | * @access public |
1845 | 1845 | * @return string |
1846 | 1846 | */ |
1847 | - public function thank_you_page_url( $query_args = array() ) { |
|
1848 | - if ( ! $this->thank_you_page_url ) { |
|
1849 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1847 | + public function thank_you_page_url($query_args = array()) { |
|
1848 | + if ( ! $this->thank_you_page_url) { |
|
1849 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1850 | 1850 | } |
1851 | - if ( $query_args ) { |
|
1852 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1851 | + if ($query_args) { |
|
1852 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1853 | 1853 | } else { |
1854 | 1854 | return $this->thank_you_page_url; |
1855 | 1855 | } |
@@ -1864,8 +1864,8 @@ discard block |
||
1864 | 1864 | * @return string |
1865 | 1865 | */ |
1866 | 1866 | public function cancel_page_url() { |
1867 | - if ( ! $this->cancel_page_url ) { |
|
1868 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1867 | + if ( ! $this->cancel_page_url) { |
|
1868 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1869 | 1869 | } |
1870 | 1870 | return $this->cancel_page_url; |
1871 | 1871 | } |
@@ -1894,22 +1894,22 @@ discard block |
||
1894 | 1894 | */ |
1895 | 1895 | protected function _get_main_ee_ueip_optin() { |
1896 | 1896 | //if this is the main site then we can just bypass our direct query. |
1897 | - if ( is_main_site() ) { |
|
1898 | - return get_option( 'ee_ueip_optin', false ); |
|
1897 | + if (is_main_site()) { |
|
1898 | + return get_option('ee_ueip_optin', false); |
|
1899 | 1899 | } |
1900 | 1900 | |
1901 | 1901 | //is this already cached for this request? If so use it. |
1902 | - if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) { |
|
1902 | + if ( ! empty(EE_Core_Config::$ee_ueip_option)) { |
|
1903 | 1903 | return EE_Core_Config::$ee_ueip_option; |
1904 | 1904 | } |
1905 | 1905 | |
1906 | 1906 | global $wpdb; |
1907 | 1907 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1908 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1908 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1909 | 1909 | $option = 'ee_ueip_optin'; |
1910 | 1910 | |
1911 | 1911 | //set correct table for query |
1912 | - $table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options'; |
|
1912 | + $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options'; |
|
1913 | 1913 | |
1914 | 1914 | |
1915 | 1915 | //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
@@ -1917,20 +1917,20 @@ discard block |
||
1917 | 1917 | //re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
1918 | 1918 | //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
1919 | 1919 | //for the purpose of caching. |
1920 | - $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
|
1921 | - if ( false !== $pre ) { |
|
1920 | + $pre = apply_filters('pre_option_'.$option, false, $option); |
|
1921 | + if (false !== $pre) { |
|
1922 | 1922 | EE_Core_Config::$ee_ueip_option = $pre; |
1923 | 1923 | return EE_Core_Config::$ee_ueip_option; |
1924 | 1924 | } |
1925 | 1925 | |
1926 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) ); |
|
1927 | - if ( is_object( $row ) ) { |
|
1926 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option)); |
|
1927 | + if (is_object($row)) { |
|
1928 | 1928 | $value = $row->option_value; |
1929 | 1929 | } else { //option does not exist so use default. |
1930 | - return apply_filters( 'default_option_' . $option, false, $option ); |
|
1930 | + return apply_filters('default_option_'.$option, false, $option); |
|
1931 | 1931 | } |
1932 | 1932 | |
1933 | - EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option ); |
|
1933 | + EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option); |
|
1934 | 1934 | return EE_Core_Config::$ee_ueip_option; |
1935 | 1935 | } |
1936 | 1936 | |
@@ -1946,7 +1946,7 @@ discard block |
||
1946 | 1946 | //reset all url properties |
1947 | 1947 | $this->_reset_urls(); |
1948 | 1948 | //return what to save to db |
1949 | - return array_keys( get_object_vars( $this ) ); |
|
1949 | + return array_keys(get_object_vars($this)); |
|
1950 | 1950 | } |
1951 | 1951 | |
1952 | 1952 | } |
@@ -2093,14 +2093,14 @@ discard block |
||
2093 | 2093 | */ |
2094 | 2094 | public function __construct() { |
2095 | 2095 | // set default organization settings |
2096 | - $this->name = get_bloginfo( 'name' ); |
|
2096 | + $this->name = get_bloginfo('name'); |
|
2097 | 2097 | $this->address_1 = '123 Onna Road'; |
2098 | 2098 | $this->address_2 = 'PO Box 123'; |
2099 | 2099 | $this->city = 'Inna City'; |
2100 | 2100 | $this->STA_ID = 4; |
2101 | 2101 | $this->CNT_ISO = 'US'; |
2102 | 2102 | $this->zip = '12345'; |
2103 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2103 | + $this->email = get_bloginfo('admin_email'); |
|
2104 | 2104 | $this->phone = ''; |
2105 | 2105 | $this->vat = '123456789'; |
2106 | 2106 | $this->logo_url = ''; |
@@ -2188,46 +2188,46 @@ discard block |
||
2188 | 2188 | * @param string $CNT_ISO |
2189 | 2189 | * @throws \EE_Error |
2190 | 2190 | */ |
2191 | - public function __construct( $CNT_ISO = '' ) { |
|
2191 | + public function __construct($CNT_ISO = '') { |
|
2192 | 2192 | /** @var \EventEspresso\core\services\database\TableAnalysis $table_analysis */ |
2193 | - $table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
|
2193 | + $table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
|
2194 | 2194 | // get country code from organization settings or use default |
2195 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2195 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2196 | 2196 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
2197 | 2197 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2198 | 2198 | : ''; |
2199 | 2199 | // but override if requested |
2200 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2200 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2201 | 2201 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
2202 | 2202 | if ( |
2203 | - ! empty( $CNT_ISO ) |
|
2203 | + ! empty($CNT_ISO) |
|
2204 | 2204 | && EE_Maintenance_Mode::instance()->models_can_query() |
2205 | - && $table_analysis->tableExists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2205 | + && $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table()) |
|
2206 | 2206 | ) { |
2207 | 2207 | // retrieve the country settings from the db, just in case they have been customized |
2208 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2209 | - if ( $country instanceof EE_Country ) { |
|
2210 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2211 | - $this->name = $country->currency_name_single(); // Dollar |
|
2212 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2213 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2214 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2215 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2216 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2217 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2208 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2209 | + if ($country instanceof EE_Country) { |
|
2210 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2211 | + $this->name = $country->currency_name_single(); // Dollar |
|
2212 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2213 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2214 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2215 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2216 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2217 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2218 | 2218 | } |
2219 | 2219 | } |
2220 | 2220 | // fallback to hardcoded defaults, in case the above failed |
2221 | - if ( empty( $this->code ) ) { |
|
2221 | + if (empty($this->code)) { |
|
2222 | 2222 | // set default currency settings |
2223 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2224 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2225 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2226 | - $this->sign = '$'; // currency sign: $ |
|
2227 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2228 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2229 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2230 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2223 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2224 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2225 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2226 | + $this->sign = '$'; // currency sign: $ |
|
2227 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2228 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2229 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2230 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2231 | 2231 | } |
2232 | 2232 | } |
2233 | 2233 | } |
@@ -2389,7 +2389,7 @@ discard block |
||
2389 | 2389 | * @since 4.8.8.rc.019 |
2390 | 2390 | */ |
2391 | 2391 | public function do_hooks() { |
2392 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2392 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2393 | 2393 | } |
2394 | 2394 | |
2395 | 2395 | |
@@ -2398,7 +2398,7 @@ discard block |
||
2398 | 2398 | * @return void |
2399 | 2399 | */ |
2400 | 2400 | public function set_default_reg_status_on_EEM_Event() { |
2401 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2401 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2402 | 2402 | } |
2403 | 2403 | |
2404 | 2404 | |
@@ -2502,10 +2502,10 @@ discard block |
||
2502 | 2502 | * @param bool $reset |
2503 | 2503 | * @return string |
2504 | 2504 | */ |
2505 | - public function log_file_name( $reset = false ) { |
|
2506 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2507 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2508 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2505 | + public function log_file_name($reset = false) { |
|
2506 | + if (empty($this->log_file_name) || $reset) { |
|
2507 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2508 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2509 | 2509 | } |
2510 | 2510 | return $this->log_file_name; |
2511 | 2511 | } |
@@ -2516,10 +2516,10 @@ discard block |
||
2516 | 2516 | * @param bool $reset |
2517 | 2517 | * @return string |
2518 | 2518 | */ |
2519 | - public function debug_file_name( $reset = false ) { |
|
2520 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2521 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2522 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2519 | + public function debug_file_name($reset = false) { |
|
2520 | + if (empty($this->debug_file_name) || $reset) { |
|
2521 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2522 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2523 | 2523 | } |
2524 | 2524 | return $this->debug_file_name; |
2525 | 2525 | } |
@@ -2530,7 +2530,7 @@ discard block |
||
2530 | 2530 | * @return string |
2531 | 2531 | */ |
2532 | 2532 | public function affiliate_id() { |
2533 | - return ! empty( $this->affiliate_id ) ? $this->affiliate_id : 'default'; |
|
2533 | + return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default'; |
|
2534 | 2534 | } |
2535 | 2535 | |
2536 | 2536 | |
@@ -2710,21 +2710,21 @@ discard block |
||
2710 | 2710 | $this->use_google_maps = true; |
2711 | 2711 | $this->google_map_api_key = ''; |
2712 | 2712 | // for event details pages (reg page) |
2713 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2714 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2715 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2716 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2717 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2718 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2719 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2713 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2714 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2715 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2716 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2717 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2718 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2719 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2720 | 2720 | // for event list pages |
2721 | - $this->event_list_map_width = 300; // ee_map_width |
|
2722 | - $this->event_list_map_height = 185; // ee_map_height |
|
2723 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2724 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2725 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2726 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2727 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2721 | + $this->event_list_map_width = 300; // ee_map_width |
|
2722 | + $this->event_list_map_height = 185; // ee_map_height |
|
2723 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2724 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2725 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2726 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2727 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2728 | 2728 | } |
2729 | 2729 | |
2730 | 2730 | } |
@@ -2886,7 +2886,7 @@ discard block |
||
2886 | 2886 | * @return void |
2887 | 2887 | */ |
2888 | 2888 | protected function _set_php_values() { |
2889 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2889 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2890 | 2890 | $this->php->version = phpversion(); |
2891 | 2891 | } |
2892 | 2892 | |
@@ -2905,10 +2905,10 @@ discard block |
||
2905 | 2905 | * @type string $msg Any message to be displayed. |
2906 | 2906 | * } |
2907 | 2907 | */ |
2908 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2909 | - if ( ! empty( $this->php->max_input_vars ) |
|
2910 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2911 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2908 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2909 | + if ( ! empty($this->php->max_input_vars) |
|
2910 | + && ($input_count >= $this->php->max_input_vars) |
|
2911 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2912 | 2912 | ) { |
2913 | 2913 | return sprintf( |
2914 | 2914 | __( |
@@ -3004,7 +3004,7 @@ discard block |
||
3004 | 3004 | */ |
3005 | 3005 | public function __construct() { |
3006 | 3006 | $this->payment_settings = array(); |
3007 | - $this->active_gateways = array( 'Invoice' => false ); |
|
3007 | + $this->active_gateways = array('Invoice' => false); |
|
3008 | 3008 | } |
3009 | 3009 | } |
3010 | 3010 |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_Default_Line_Item_Display_Strategy |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since $VID:$ |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_Default_Line_Item_Display_Strategy |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since $VID:$ |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class EE_Default_Line_Item_Display_Strategy implements EEI_Line_Item_Display { |
16 | 16 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | // quantity td |
165 | 165 | $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
166 | 166 | $tax_rate = $line_item->is_taxable() |
167 | - && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
167 | + && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
168 | 168 | ? 1 + ( $this->_tax_rate / 100 ) |
169 | 169 | : 1; |
170 | 170 | // price td |
@@ -57,29 +57,29 @@ discard block |
||
57 | 57 | * @param array $options |
58 | 58 | * @return mixed |
59 | 59 | */ |
60 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
|
60 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) { |
|
61 | 61 | |
62 | 62 | $html = ''; |
63 | 63 | // set some default options and merge with incoming |
64 | 64 | $default_options = array( |
65 | - 'show_desc' => TRUE, // TRUE FALSE |
|
65 | + 'show_desc' => TRUE, // TRUE FALSE |
|
66 | 66 | 'odd' => FALSE |
67 | 67 | ); |
68 | - $options = array_merge( $default_options, (array)$options ); |
|
68 | + $options = array_merge($default_options, (array) $options); |
|
69 | 69 | |
70 | - switch( $line_item->type() ) { |
|
70 | + switch ($line_item->type()) { |
|
71 | 71 | |
72 | 72 | case EEM_Line_Item::type_line_item: |
73 | 73 | // item row |
74 | - $html .= $this->_item_row( $line_item, $options ); |
|
74 | + $html .= $this->_item_row($line_item, $options); |
|
75 | 75 | // got any kids? |
76 | - foreach ( $line_item->children() as $child_line_item ) { |
|
77 | - $this->display_line_item( $child_line_item, $options ); |
|
76 | + foreach ($line_item->children() as $child_line_item) { |
|
77 | + $this->display_line_item($child_line_item, $options); |
|
78 | 78 | } |
79 | 79 | break; |
80 | 80 | |
81 | 81 | case EEM_Line_Item::type_sub_line_item: |
82 | - $html .= $this->_sub_item_row( $line_item, $options ); |
|
82 | + $html .= $this->_sub_item_row($line_item, $options); |
|
83 | 83 | break; |
84 | 84 | |
85 | 85 | case EEM_Line_Item::type_sub_total: |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | break; |
91 | 91 | |
92 | 92 | case EEM_Line_Item::type_tax_sub_total: |
93 | - foreach ( $line_item->children() as $child_line_item ) { |
|
94 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax ) { |
|
93 | + foreach ($line_item->children() as $child_line_item) { |
|
94 | + if ($child_line_item->type() == EEM_Line_Item::type_tax) { |
|
95 | 95 | // recursively feed children back into this method |
96 | - $this->display_line_item( $child_line_item, $options ); |
|
96 | + $this->display_line_item($child_line_item, $options); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | break; |
@@ -101,20 +101,20 @@ discard block |
||
101 | 101 | case EEM_Line_Item::type_total: |
102 | 102 | // get all child line items |
103 | 103 | $children = $line_item->children(); |
104 | - if ( $options[ 'set_tax_rate' ] === true ) { |
|
104 | + if ($options['set_tax_rate'] === true) { |
|
105 | 105 | // loop thru tax child line items just to determine tax rate |
106 | - foreach ( $children as $child_line_item ) { |
|
107 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) { |
|
106 | + foreach ($children as $child_line_item) { |
|
107 | + if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) { |
|
108 | 108 | // recursively feed children back into this method |
109 | - $this->display_line_item( $child_line_item, $options ); |
|
109 | + $this->display_line_item($child_line_item, $options); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } else { |
113 | 113 | // now loop thru all non-tax child line items |
114 | - foreach ( $children as $child_line_item ) { |
|
115 | - if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) { |
|
114 | + foreach ($children as $child_line_item) { |
|
115 | + if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) { |
|
116 | 116 | // recursively feed children back into this method |
117 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
117 | + $html .= $this->display_line_item($child_line_item, $options); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | } |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | * @param array $options |
135 | 135 | * @return mixed |
136 | 136 | */ |
137 | - private function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
137 | + private function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
138 | 138 | // start of row |
139 | 139 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
140 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
140 | + $html = EEH_HTML::tr('', '', $row_class); |
|
141 | 141 | // name && desc |
142 | 142 | $name_and_desc = apply_filters( |
143 | 143 | 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__name', |
@@ -146,33 +146,33 @@ discard block |
||
146 | 146 | ); |
147 | 147 | $name_and_desc .= apply_filters( |
148 | 148 | 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__desc', |
149 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
149 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
150 | 150 | $line_item, |
151 | 151 | $options |
152 | 152 | ); |
153 | - if ( $line_item->is_taxable() ) { |
|
153 | + if ($line_item->is_taxable()) { |
|
154 | 154 | $ticket_price_includes_taxes = EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
155 | - ? __( '* price includes taxes', 'event_espresso' ) |
|
156 | - : __( '* price does not include taxes', 'event_espresso' ); |
|
155 | + ? __('* price includes taxes', 'event_espresso') |
|
156 | + : __('* price does not include taxes', 'event_espresso'); |
|
157 | 157 | $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' |
158 | 158 | . $ticket_price_includes_taxes |
159 | 159 | . '</span>'; |
160 | 160 | } |
161 | 161 | |
162 | 162 | // name td |
163 | - $html .= EEH_HTML::td( $name_and_desc, '', 'item_l' ); |
|
163 | + $html .= EEH_HTML::td($name_and_desc, '', 'item_l'); |
|
164 | 164 | // quantity td |
165 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
165 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
166 | 166 | $tax_rate = $line_item->is_taxable() |
167 | 167 | && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
168 | - ? 1 + ( $this->_tax_rate / 100 ) |
|
168 | + ? 1 + ($this->_tax_rate / 100) |
|
169 | 169 | : 1; |
170 | 170 | // price td |
171 | - $unit_price = EEH_Template::format_currency( $line_item->unit_price() * $tax_rate, false, false ); |
|
172 | - $html .= EEH_HTML::td( $unit_price, '', 'item_c jst-rght' ); |
|
171 | + $unit_price = EEH_Template::format_currency($line_item->unit_price() * $tax_rate, false, false); |
|
172 | + $html .= EEH_HTML::td($unit_price, '', 'item_c jst-rght'); |
|
173 | 173 | // total td |
174 | - $total = EEH_Template::format_currency( $line_item->unit_price() * $line_item->quantity() * $tax_rate, false, false ); |
|
175 | - $html .= EEH_HTML::td( $total, '', 'item_r jst-rght' ); |
|
174 | + $total = EEH_Template::format_currency($line_item->unit_price() * $line_item->quantity() * $tax_rate, false, false); |
|
175 | + $html .= EEH_HTML::td($total, '', 'item_r jst-rght'); |
|
176 | 176 | // end of row |
177 | 177 | $html .= EEH_HTML::trx(); |
178 | 178 | |
@@ -188,22 +188,22 @@ discard block |
||
188 | 188 | * @param array $options |
189 | 189 | * @return mixed |
190 | 190 | */ |
191 | - private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
|
191 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array()) { |
|
192 | 192 | // start of row |
193 | - $html = EEH_HTML::tr( '', 'item sub-item-row' ); |
|
193 | + $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
194 | 194 | // name && desc |
195 | 195 | $name_and_desc = $line_item->name(); |
196 | - $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
196 | + $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''; |
|
197 | 197 | // name td |
198 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
198 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
199 | 199 | // discount/surcharge td |
200 | - if ( $line_item->is_percent() ) { |
|
201 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c' ); |
|
200 | + if ($line_item->is_percent()) { |
|
201 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c'); |
|
202 | 202 | } else { |
203 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
203 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
204 | 204 | } |
205 | 205 | // total td |
206 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'item_r jst-rght' ); |
|
206 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
207 | 207 | // end of row |
208 | 208 | $html .= EEH_HTML::trx(); |
209 | 209 | return $html; |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | |
79 | 79 | /** |
80 | 80 | * an array for storing request actions and their corresponding methods |
81 | - * @access private |
|
82 | - * @return void |
|
83 | - */ |
|
81 | + * @access private |
|
82 | + * @return void |
|
83 | + */ |
|
84 | 84 | protected function _set_page_routes() { |
85 | 85 | $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
86 | 86 | $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
@@ -185,16 +185,16 @@ discard block |
||
185 | 185 | 'capability' => 'ee_delete_default_price_type', |
186 | 186 | 'obj_id' => $prt_id |
187 | 187 | ), |
188 | - 'tax_settings' => array( |
|
189 | - 'func' => '_tax_settings', |
|
190 | - 'capability' => 'manage_options' |
|
191 | - ), |
|
192 | - 'update_tax_settings' => array( |
|
193 | - 'func' => '_update_tax_settings', |
|
194 | - 'capability' => 'manage_options', |
|
195 | - 'noheader' => true |
|
196 | - ), |
|
197 | - ); |
|
188 | + 'tax_settings' => array( |
|
189 | + 'func' => '_tax_settings', |
|
190 | + 'capability' => 'manage_options' |
|
191 | + ), |
|
192 | + 'update_tax_settings' => array( |
|
193 | + 'func' => '_update_tax_settings', |
|
194 | + 'capability' => 'manage_options', |
|
195 | + 'noheader' => true |
|
196 | + ), |
|
197 | + ); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | 'order' => 10 |
210 | 210 | ), |
211 | 211 | 'list_table' => 'Prices_List_Table', |
212 | - 'help_tabs' => array( |
|
212 | + 'help_tabs' => array( |
|
213 | 213 | 'pricing_default_pricing_help_tab' => array( |
214 | 214 | 'title' => __('Default Pricing', 'event_espresso'), |
215 | 215 | 'filename' => 'pricing_default_pricing' |
@@ -232,13 +232,13 @@ discard block |
||
232 | 232 | 'order' => 20, |
233 | 233 | 'persistent' => FALSE |
234 | 234 | ), |
235 | - 'help_tabs' => array( |
|
235 | + 'help_tabs' => array( |
|
236 | 236 | 'add_new_default_price_help_tab' => array( |
237 | 237 | 'title' => __('Add New Default Price', 'event_espresso'), |
238 | 238 | 'filename' => 'pricing_add_new_default_price' |
239 | 239 | ) |
240 | 240 | ), |
241 | - 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
|
241 | + 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
|
242 | 242 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
243 | 243 | 'require_nonce' => FALSE |
244 | 244 | ), |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | 'persistent' => FALSE |
251 | 251 | ), |
252 | 252 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
253 | - 'help_tabs' => array( |
|
253 | + 'help_tabs' => array( |
|
254 | 254 | 'edit_default_price_help_tab' => array( |
255 | 255 | 'title' => __('Edit Default Price', 'event_espresso'), |
256 | 256 | 'filename' => 'pricing_edit_default_price' |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | 'order' => 30 |
266 | 266 | ), |
267 | 267 | 'list_table' => 'Price_Types_List_Table', |
268 | - 'help_tabs' => array( |
|
268 | + 'help_tabs' => array( |
|
269 | 269 | 'pricing_price_types_help_tab' => array( |
270 | 270 | 'title' => __('Price Types', 'event_espresso'), |
271 | 271 | 'filename' => 'pricing_price_types' |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | 'order' => 40, |
290 | 290 | 'persistent' => FALSE |
291 | 291 | ), |
292 | - 'help_tabs' => array( |
|
292 | + 'help_tabs' => array( |
|
293 | 293 | 'add_new_price_type_help_tab' => array( |
294 | 294 | 'title' => __('Add New Price Type', 'event_espresso'), |
295 | 295 | 'filename' => 'pricing_add_new_price_type' |
296 | 296 | ) |
297 | 297 | ), |
298 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
298 | + 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
299 | 299 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
300 | 300 | 'require_nonce' => FALSE |
301 | 301 | ), |
@@ -305,36 +305,36 @@ discard block |
||
305 | 305 | 'order' => 40, |
306 | 306 | 'persistent' => FALSE |
307 | 307 | ), |
308 | - 'help_tabs' => array( |
|
308 | + 'help_tabs' => array( |
|
309 | 309 | 'edit_price_type_help_tab' => array( |
310 | 310 | 'title' => __('Edit Price Type', 'event_espresso'), |
311 | 311 | 'filename' => 'pricing_edit_price_type' |
312 | 312 | ) |
313 | 313 | ), |
314 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
314 | + 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
315 | 315 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
316 | 316 | |
317 | 317 | 'require_nonce' => FALSE |
318 | 318 | ), |
319 | - 'tax_settings' => array( |
|
320 | - 'nav' => array( |
|
321 | - 'label' => esc_html__('Tax Settings', 'event_espresso'), |
|
322 | - 'order' => 40 |
|
323 | - ), |
|
324 | - 'labels' => array( |
|
325 | - 'publishbox' => esc_html__('Update Tax Settings', 'event_espresso') |
|
326 | - ), |
|
327 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
328 | - // 'help_tabs' => array( |
|
329 | - // 'registration_form_reg_form_settings_help_tab' => array( |
|
330 | - // 'title' => esc_html__('Registration Form Settings', 'event_espresso'), |
|
331 | - // 'filename' => 'registration_form_reg_form_settings' |
|
332 | - // ), |
|
333 | - // ), |
|
334 | - // 'help_tour' => array('Registration_Form_Settings_Help_Tour'), |
|
335 | - 'require_nonce' => true |
|
336 | - ) |
|
337 | - ); |
|
319 | + 'tax_settings' => array( |
|
320 | + 'nav' => array( |
|
321 | + 'label' => esc_html__('Tax Settings', 'event_espresso'), |
|
322 | + 'order' => 40 |
|
323 | + ), |
|
324 | + 'labels' => array( |
|
325 | + 'publishbox' => esc_html__('Update Tax Settings', 'event_espresso') |
|
326 | + ), |
|
327 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
328 | + // 'help_tabs' => array( |
|
329 | + // 'registration_form_reg_form_settings_help_tab' => array( |
|
330 | + // 'title' => esc_html__('Registration Form Settings', 'event_espresso'), |
|
331 | + // 'filename' => 'registration_form_reg_form_settings' |
|
332 | + // ), |
|
333 | + // ), |
|
334 | + // 'help_tour' => array('Registration_Form_Settings_Help_Tour'), |
|
335 | + 'require_nonce' => true |
|
336 | + ) |
|
337 | + ); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | |
@@ -460,16 +460,16 @@ discard block |
||
460 | 460 | |
461 | 461 | /** |
462 | 462 | * generates HTML for main Prices Admin page |
463 | - * @access protected |
|
464 | - * @return void |
|
465 | - */ |
|
463 | + * @access protected |
|
464 | + * @return void |
|
465 | + */ |
|
466 | 466 | protected function _price_overview_list_table() { |
467 | 467 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
468 | - 'add_new_price', |
|
469 | - 'add', |
|
470 | - array(), |
|
471 | - 'add-new-h2' |
|
472 | - ); |
|
468 | + 'add_new_price', |
|
469 | + 'add', |
|
470 | + array(), |
|
471 | + 'add-new-h2' |
|
472 | + ); |
|
473 | 473 | $this->admin_page_title .= $this->_learn_more_about_pricing_link(); |
474 | 474 | $this->_search_btn_label = __('Default Prices', 'event_espresso'); |
475 | 475 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -481,13 +481,13 @@ discard block |
||
481 | 481 | |
482 | 482 | |
483 | 483 | /** |
484 | - * retrieve data for Prices List table |
|
485 | - * @access public |
|
486 | - * @param int $per_page how many prices displayed per page |
|
487 | - * @param boolean $count return the count or objects |
|
488 | - * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
489 | - * @return mixed (int|array) int = count || array of price objects |
|
490 | - */ |
|
484 | + * retrieve data for Prices List table |
|
485 | + * @access public |
|
486 | + * @param int $per_page how many prices displayed per page |
|
487 | + * @param boolean $count return the count or objects |
|
488 | + * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
489 | + * @return mixed (int|array) int = count || array of price objects |
|
490 | + */ |
|
491 | 491 | public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
492 | 492 | |
493 | 493 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -557,9 +557,9 @@ discard block |
||
557 | 557 | |
558 | 558 | /** |
559 | 559 | * _price_details |
560 | - * @access protected |
|
561 | - * @return void |
|
562 | - */ |
|
560 | + * @access protected |
|
561 | + * @return void |
|
562 | + */ |
|
563 | 563 | protected function _edit_price_details() { |
564 | 564 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
565 | 565 | // grab price ID |
@@ -628,9 +628,9 @@ discard block |
||
628 | 628 | |
629 | 629 | /** |
630 | 630 | * declare price details page metaboxes |
631 | - * @access protected |
|
632 | - * @return void |
|
633 | - */ |
|
631 | + * @access protected |
|
632 | + * @return void |
|
633 | + */ |
|
634 | 634 | protected function _price_details_meta_boxes() { |
635 | 635 | add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
636 | 636 | } |
@@ -642,9 +642,9 @@ discard block |
||
642 | 642 | |
643 | 643 | /** |
644 | 644 | * _edit_price_details_meta_box |
645 | - * @access public |
|
646 | - * @return void |
|
647 | - */ |
|
645 | + * @access public |
|
646 | + * @return void |
|
647 | + */ |
|
648 | 648 | public function _edit_price_details_meta_box() { |
649 | 649 | echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
650 | 650 | } |
@@ -655,9 +655,9 @@ discard block |
||
655 | 655 | |
656 | 656 | /** |
657 | 657 | * set_price_column_values |
658 | - * @access protected |
|
659 | - * @return array |
|
660 | - */ |
|
658 | + * @access protected |
|
659 | + * @return array |
|
660 | + */ |
|
661 | 661 | protected function set_price_column_values() { |
662 | 662 | |
663 | 663 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -684,10 +684,10 @@ discard block |
||
684 | 684 | |
685 | 685 | /** |
686 | 686 | * insert_or_update_price |
687 | - * @param boolean $insert - whether to insert or update |
|
688 | - * @access protected |
|
689 | - * @return void |
|
690 | - */ |
|
687 | + * @param boolean $insert - whether to insert or update |
|
688 | + * @access protected |
|
689 | + * @return void |
|
690 | + */ |
|
691 | 691 | protected function _insert_or_update_price( $insert = FALSE ) { |
692 | 692 | |
693 | 693 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -760,10 +760,10 @@ discard block |
||
760 | 760 | |
761 | 761 | /** |
762 | 762 | * _trash_or_restore_price |
763 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
764 | - * @access protected |
|
765 | - * @return void |
|
766 | - */ |
|
763 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
764 | + * @access protected |
|
765 | + * @return void |
|
766 | + */ |
|
767 | 767 | protected function _trash_or_restore_price( $trash = TRUE ) { |
768 | 768 | |
769 | 769 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -843,9 +843,9 @@ discard block |
||
843 | 843 | |
844 | 844 | /** |
845 | 845 | * _delete_price |
846 | - * @access protected |
|
847 | - * @return void |
|
848 | - */ |
|
846 | + * @access protected |
|
847 | + * @return void |
|
848 | + */ |
|
849 | 849 | protected function _delete_price() { |
850 | 850 | |
851 | 851 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -922,16 +922,16 @@ discard block |
||
922 | 922 | |
923 | 923 | /** |
924 | 924 | * generates HTML for main Prices Admin page |
925 | - * @access protected |
|
926 | - * @return void |
|
927 | - */ |
|
925 | + * @access protected |
|
926 | + * @return void |
|
927 | + */ |
|
928 | 928 | protected function _price_types_overview_list_table() { |
929 | 929 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
930 | - 'add_new_price_type', |
|
931 | - 'add_type', |
|
932 | - array(), |
|
933 | - 'add-new-h2' |
|
934 | - ); |
|
930 | + 'add_new_price_type', |
|
931 | + 'add_type', |
|
932 | + array(), |
|
933 | + 'add-new-h2' |
|
934 | + ); |
|
935 | 935 | $this->admin_page_title .= $this->_learn_more_about_pricing_link(); |
936 | 936 | $this->_search_btn_label = __('Price Types', 'event_espresso'); |
937 | 937 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -943,13 +943,13 @@ discard block |
||
943 | 943 | |
944 | 944 | |
945 | 945 | /** |
946 | - * retrieve data for Price Types List table |
|
947 | - * @access public |
|
948 | - * @param int $per_page how many prices displayed per page |
|
949 | - * @param boolean $count return the count or objects |
|
950 | - * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
951 | - * @return mixed (int|array) int = count || array of price objects |
|
952 | - */ |
|
946 | + * retrieve data for Price Types List table |
|
947 | + * @access public |
|
948 | + * @param int $per_page how many prices displayed per page |
|
949 | + * @param boolean $count return the count or objects |
|
950 | + * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
951 | + * @return mixed (int|array) int = count || array of price objects |
|
952 | + */ |
|
953 | 953 | public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
954 | 954 | |
955 | 955 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1004,9 +1004,9 @@ discard block |
||
1004 | 1004 | |
1005 | 1005 | /** |
1006 | 1006 | * _edit_price_type_details |
1007 | - * @access protected |
|
1008 | - * @return void |
|
1009 | - */ |
|
1007 | + * @access protected |
|
1008 | + * @return void |
|
1009 | + */ |
|
1010 | 1010 | protected function _edit_price_type_details() { |
1011 | 1011 | |
1012 | 1012 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1070,9 +1070,9 @@ discard block |
||
1070 | 1070 | |
1071 | 1071 | /** |
1072 | 1072 | * declare price type details page metaboxes |
1073 | - * @access protected |
|
1074 | - * @return void |
|
1075 | - */ |
|
1073 | + * @access protected |
|
1074 | + * @return void |
|
1075 | + */ |
|
1076 | 1076 | protected function _price_type_details_meta_boxes() { |
1077 | 1077 | add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
1078 | 1078 | } |
@@ -1083,9 +1083,9 @@ discard block |
||
1083 | 1083 | |
1084 | 1084 | /** |
1085 | 1085 | * _edit_price_type_details_meta_box |
1086 | - * @access public |
|
1087 | - * @return void |
|
1088 | - */ |
|
1086 | + * @access public |
|
1087 | + * @return void |
|
1088 | + */ |
|
1089 | 1089 | public function _edit_price_type_details_meta_box() { |
1090 | 1090 | echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
1091 | 1091 | } |
@@ -1095,9 +1095,9 @@ discard block |
||
1095 | 1095 | |
1096 | 1096 | /** |
1097 | 1097 | * set_price_type_column_values |
1098 | - * @access protected |
|
1099 | - * @return void |
|
1100 | - */ |
|
1098 | + * @access protected |
|
1099 | + * @return void |
|
1100 | + */ |
|
1101 | 1101 | protected function set_price_type_column_values() { |
1102 | 1102 | |
1103 | 1103 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1145,10 +1145,10 @@ discard block |
||
1145 | 1145 | |
1146 | 1146 | /** |
1147 | 1147 | * _insert_or_update_price_type |
1148 | - * @param boolean $new_price_type - whether to insert or update |
|
1149 | - * @access protected |
|
1150 | - * @return void |
|
1151 | - */ |
|
1148 | + * @param boolean $new_price_type - whether to insert or update |
|
1149 | + * @access protected |
|
1150 | + * @return void |
|
1151 | + */ |
|
1152 | 1152 | protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
1153 | 1153 | |
1154 | 1154 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1189,10 +1189,10 @@ discard block |
||
1189 | 1189 | |
1190 | 1190 | /** |
1191 | 1191 | * _trash_or_restore_price_type |
1192 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
1193 | - * @access protected |
|
1194 | - * @return void |
|
1195 | - */ |
|
1192 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
1193 | + * @access protected |
|
1194 | + * @return void |
|
1195 | + */ |
|
1196 | 1196 | protected function _trash_or_restore_price_type( $trash = TRUE ) { |
1197 | 1197 | |
1198 | 1198 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1246,9 +1246,9 @@ discard block |
||
1246 | 1246 | |
1247 | 1247 | /** |
1248 | 1248 | * _delete_price_type |
1249 | - * @access protected |
|
1250 | - * @return void |
|
1251 | - */ |
|
1249 | + * @access protected |
|
1250 | + * @return void |
|
1251 | + */ |
|
1252 | 1252 | protected function _delete_price_type() { |
1253 | 1253 | |
1254 | 1254 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1285,76 +1285,76 @@ discard block |
||
1285 | 1285 | |
1286 | 1286 | /** |
1287 | 1287 | * _learn_more_about_pricing_link |
1288 | - * @access protected |
|
1289 | - * @return string |
|
1290 | - */ |
|
1288 | + * @access protected |
|
1289 | + * @return string |
|
1290 | + */ |
|
1291 | 1291 | protected function _learn_more_about_pricing_link() { |
1292 | 1292 | return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | |
1296 | 1296 | |
1297 | - protected function _tax_settings() { |
|
1298 | - $this->_set_add_edit_form_tags('update_tax_settings'); |
|
1299 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
1300 | - $this->_template_args['admin_page_content'] = $this->tax_settings_form()->get_html(); |
|
1301 | - $this->display_admin_page_with_sidebar(); |
|
1302 | - } |
|
1303 | - |
|
1304 | - |
|
1305 | - |
|
1306 | - /** |
|
1307 | - * @return \EE_Form_Section_Proper |
|
1308 | - * @throws \EE_Error |
|
1309 | - */ |
|
1310 | - protected function tax_settings_form() { |
|
1311 | - return new EE_Form_Section_Proper( |
|
1312 | - array( |
|
1313 | - 'name' => 'tax_settings_form', |
|
1314 | - 'html_id' => 'tax_settings_form', |
|
1315 | - 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
|
1316 | - 'subsections' => apply_filters( |
|
1317 | - 'FHEE__Pricing_Admin_Page__tax_settings_form__form_subsections', |
|
1318 | - array( |
|
1319 | - 'tax_settings' => new EE_Form_Section_Proper( |
|
1320 | - array( |
|
1321 | - 'name' => 'tax_settings_tbl', |
|
1322 | - 'html_id' => 'tax_settings_tbl', |
|
1323 | - 'html_class' => 'form-table', |
|
1324 | - 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
1325 | - 'subsections' => array( |
|
1326 | - 'prices_displayed_including_taxes' => new EE_Yes_No_Input( |
|
1327 | - array( |
|
1328 | - 'html_label_text' => __( |
|
1329 | - "Show Prices With Taxes Included?", |
|
1330 | - 'event_espresso' |
|
1331 | - ), |
|
1332 | - 'html_help_text' => __( |
|
1333 | - 'Indicates whether or not to display prices with the taxes included', |
|
1334 | - 'event_espresso' |
|
1335 | - ), |
|
1336 | - 'default' => isset( |
|
1337 | - EE_Registry::instance() |
|
1338 | - ->CFG |
|
1339 | - ->tax_settings |
|
1340 | - ->prices_displayed_including_taxes |
|
1341 | - ) |
|
1342 | - ? EE_Registry::instance() |
|
1343 | - ->CFG |
|
1344 | - ->tax_settings |
|
1345 | - ->prices_displayed_including_taxes |
|
1346 | - : true, |
|
1347 | - 'display_html_label_text' => false |
|
1348 | - ) |
|
1349 | - ), |
|
1350 | - ) |
|
1351 | - ) |
|
1352 | - ) |
|
1353 | - ) |
|
1354 | - ) |
|
1355 | - ) |
|
1356 | - ); |
|
1357 | - } |
|
1297 | + protected function _tax_settings() { |
|
1298 | + $this->_set_add_edit_form_tags('update_tax_settings'); |
|
1299 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
1300 | + $this->_template_args['admin_page_content'] = $this->tax_settings_form()->get_html(); |
|
1301 | + $this->display_admin_page_with_sidebar(); |
|
1302 | + } |
|
1303 | + |
|
1304 | + |
|
1305 | + |
|
1306 | + /** |
|
1307 | + * @return \EE_Form_Section_Proper |
|
1308 | + * @throws \EE_Error |
|
1309 | + */ |
|
1310 | + protected function tax_settings_form() { |
|
1311 | + return new EE_Form_Section_Proper( |
|
1312 | + array( |
|
1313 | + 'name' => 'tax_settings_form', |
|
1314 | + 'html_id' => 'tax_settings_form', |
|
1315 | + 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
|
1316 | + 'subsections' => apply_filters( |
|
1317 | + 'FHEE__Pricing_Admin_Page__tax_settings_form__form_subsections', |
|
1318 | + array( |
|
1319 | + 'tax_settings' => new EE_Form_Section_Proper( |
|
1320 | + array( |
|
1321 | + 'name' => 'tax_settings_tbl', |
|
1322 | + 'html_id' => 'tax_settings_tbl', |
|
1323 | + 'html_class' => 'form-table', |
|
1324 | + 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
1325 | + 'subsections' => array( |
|
1326 | + 'prices_displayed_including_taxes' => new EE_Yes_No_Input( |
|
1327 | + array( |
|
1328 | + 'html_label_text' => __( |
|
1329 | + "Show Prices With Taxes Included?", |
|
1330 | + 'event_espresso' |
|
1331 | + ), |
|
1332 | + 'html_help_text' => __( |
|
1333 | + 'Indicates whether or not to display prices with the taxes included', |
|
1334 | + 'event_espresso' |
|
1335 | + ), |
|
1336 | + 'default' => isset( |
|
1337 | + EE_Registry::instance() |
|
1338 | + ->CFG |
|
1339 | + ->tax_settings |
|
1340 | + ->prices_displayed_including_taxes |
|
1341 | + ) |
|
1342 | + ? EE_Registry::instance() |
|
1343 | + ->CFG |
|
1344 | + ->tax_settings |
|
1345 | + ->prices_displayed_including_taxes |
|
1346 | + : true, |
|
1347 | + 'display_html_label_text' => false |
|
1348 | + ) |
|
1349 | + ), |
|
1350 | + ) |
|
1351 | + ) |
|
1352 | + ) |
|
1353 | + ) |
|
1354 | + ) |
|
1355 | + ) |
|
1356 | + ); |
|
1357 | + } |
|
1358 | 1358 | |
1359 | 1359 | |
1360 | 1360 |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * @param bool $routing |
32 | 32 | * @return Pricing_Admin_Page |
33 | 33 | */ |
34 | - public function __construct( $routing = TRUE ) { |
|
35 | - parent::__construct( $routing ); |
|
34 | + public function __construct($routing = TRUE) { |
|
35 | + parent::__construct($routing); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _ajax_hooks() { |
52 | - add_action('wp_ajax_espresso_update_prices_order', array( $this, 'update_price_order' )); |
|
52 | + add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | protected function _set_page_routes() { |
85 | - $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | - $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
|
85 | + $prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID']) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | + $prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID']) ? $this->_req_data['PRT_ID'] : 0; |
|
87 | 87 | $this->_page_routes = array( |
88 | 88 | 'default' => array( |
89 | 89 | 'func' => '_price_overview_list_table', |
@@ -91,38 +91,38 @@ discard block |
||
91 | 91 | ), |
92 | 92 | 'add_new_price' => array( |
93 | 93 | 'func' => '_edit_price_details', |
94 | - 'args' => array( 'new_price' => TRUE ), |
|
94 | + 'args' => array('new_price' => TRUE), |
|
95 | 95 | 'capability' => 'ee_edit_default_prices' |
96 | 96 | ), |
97 | 97 | 'edit_price' => array( |
98 | 98 | 'func' => '_edit_price_details', |
99 | - 'args' => array( 'new_price' => FALSE ), |
|
99 | + 'args' => array('new_price' => FALSE), |
|
100 | 100 | 'capability' => 'ee_edit_default_price', |
101 | 101 | 'obj_id' => $prc_id |
102 | 102 | ), |
103 | 103 | 'insert_price' => array( |
104 | 104 | 'func' => '_insert_or_update_price', |
105 | - 'args' => array( 'new_price' => TRUE ), |
|
105 | + 'args' => array('new_price' => TRUE), |
|
106 | 106 | 'noheader' => TRUE, |
107 | 107 | 'capability' => 'ee_edit_default_prices', |
108 | 108 | ), |
109 | 109 | 'update_price' => array( |
110 | 110 | 'func' => '_insert_or_update_price', |
111 | - 'args' => array( 'new_price' => FALSE ), |
|
111 | + 'args' => array('new_price' => FALSE), |
|
112 | 112 | 'noheader' => TRUE, |
113 | 113 | 'capability' => 'ee_edit_default_price', |
114 | 114 | 'obj_id' => $prc_id |
115 | 115 | ), |
116 | 116 | 'trash_price' => array( |
117 | 117 | 'func' => '_trash_or_restore_price', |
118 | - 'args' => array( 'trash' => TRUE ), |
|
118 | + 'args' => array('trash' => TRUE), |
|
119 | 119 | 'noheader' => TRUE, |
120 | 120 | 'capability' => 'ee_delete_default_price', |
121 | 121 | 'obj_id' => $prc_id |
122 | 122 | ), |
123 | 123 | 'restore_price' => array( |
124 | 124 | 'func' => '_trash_or_restore_price', |
125 | - 'args' => array( 'trash' => FALSE ), |
|
125 | + 'args' => array('trash' => FALSE), |
|
126 | 126 | 'noheader' => TRUE, |
127 | 127 | 'capability' => 'ee_delete_default_price', |
128 | 128 | 'obj_id' => $prc_id |
@@ -154,27 +154,27 @@ discard block |
||
154 | 154 | ), |
155 | 155 | 'insert_price_type' => array( |
156 | 156 | 'func' => '_insert_or_update_price_type', |
157 | - 'args' => array( 'new_price_type' => TRUE ), |
|
157 | + 'args' => array('new_price_type' => TRUE), |
|
158 | 158 | 'noheader' => TRUE, |
159 | 159 | 'capability' => 'ee_edit_default_price_types' |
160 | 160 | ), |
161 | 161 | 'update_price_type' => array( |
162 | 162 | 'func' => '_insert_or_update_price_type', |
163 | - 'args' => array( 'new_price_type' => FALSE ), |
|
163 | + 'args' => array('new_price_type' => FALSE), |
|
164 | 164 | 'noheader' => TRUE, |
165 | 165 | 'capability' => 'ee_edit_default_price_type', |
166 | 166 | 'obj_id' => $prt_id |
167 | 167 | ), |
168 | 168 | 'trash_price_type' => array( |
169 | 169 | 'func' => '_trash_or_restore_price_type', |
170 | - 'args' => array( 'trash' => TRUE ), |
|
170 | + 'args' => array('trash' => TRUE), |
|
171 | 171 | 'noheader' => TRUE, |
172 | 172 | 'capability' => 'ee_delete_default_price_type', |
173 | 173 | 'obj_id' => $prt_id |
174 | 174 | ), |
175 | 175 | 'restore_price_type' => array( |
176 | 176 | 'func' => '_trash_or_restore_price_type', |
177 | - 'args' => array( 'trash' => FALSE ), |
|
177 | + 'args' => array('trash' => FALSE), |
|
178 | 178 | 'noheader' => TRUE, |
179 | 179 | 'capability' => 'ee_delete_default_price_type', |
180 | 180 | 'obj_id' => $prt_id |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | 'filename' => 'pricing_default_pricing_views_bulk_actions_search' |
224 | 224 | ) |
225 | 225 | ), |
226 | - 'help_tour' => array( 'Pricing_Default_Prices_Help_Tour'), |
|
226 | + 'help_tour' => array('Pricing_Default_Prices_Help_Tour'), |
|
227 | 227 | 'require_nonce' => FALSE |
228 | 228 | ), |
229 | 229 | 'add_new_price' => array( |
@@ -239,24 +239,24 @@ discard block |
||
239 | 239 | ) |
240 | 240 | ), |
241 | 241 | 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
242 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
242 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
243 | 243 | 'require_nonce' => FALSE |
244 | 244 | ), |
245 | 245 | 'edit_price' => array( |
246 | 246 | 'nav' => array( |
247 | 247 | 'label' => __('Edit Default Price', 'event_espresso'), |
248 | 248 | 'order' => 20, |
249 | - 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
249 | + 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
250 | 250 | 'persistent' => FALSE |
251 | 251 | ), |
252 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
252 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
253 | 253 | 'help_tabs' => array( |
254 | 254 | 'edit_default_price_help_tab' => array( |
255 | 255 | 'title' => __('Edit Default Price', 'event_espresso'), |
256 | 256 | 'filename' => 'pricing_edit_default_price' |
257 | 257 | ) |
258 | 258 | ), |
259 | - 'help_tour' => array( 'Pricing_Edit_Default_Price_Help_Tour' ), |
|
259 | + 'help_tour' => array('Pricing_Edit_Default_Price_Help_Tour'), |
|
260 | 260 | 'require_nonce' => FALSE |
261 | 261 | ), |
262 | 262 | 'price_types' => array( |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | 'filename' => 'pricing_price_types_views_bulk_actions_search' |
280 | 280 | ), |
281 | 281 | ), |
282 | - 'help_tour' => array( 'Pricing_Price_Types_Default_Help_Tour' ), |
|
282 | + 'help_tour' => array('Pricing_Price_Types_Default_Help_Tour'), |
|
283 | 283 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
284 | 284 | 'require_nonce' => FALSE |
285 | 285 | ), |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | 'filename' => 'pricing_add_new_price_type' |
296 | 296 | ) |
297 | 297 | ), |
298 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
299 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
298 | + 'help_tour' => array('Pricing_Add_New_Price_Type_Help_Tour'), |
|
299 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
300 | 300 | 'require_nonce' => FALSE |
301 | 301 | ), |
302 | 302 | 'edit_price_type' => array( |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | 'filename' => 'pricing_edit_price_type' |
312 | 312 | ) |
313 | 313 | ), |
314 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
315 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
314 | + 'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'), |
|
315 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
316 | 316 | |
317 | 317 | 'require_nonce' => FALSE |
318 | 318 | ), |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | public function load_scripts_styles() { |
368 | 368 | //styles |
369 | 369 | wp_enqueue_style('espresso-ui-theme'); |
370 | - wp_register_style( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
370 | + wp_register_style('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
371 | 371 | wp_enqueue_style('espresso_PRICING'); |
372 | 372 | |
373 | 373 | //scripts |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | //wp_enqueue_script('jquery-ui-dialog'); |
378 | 378 | //wp_enqueue_script('jquery-ui-draggable'); |
379 | 379 | //wp_enqueue_script('jquery-ui-datepicker'); |
380 | - wp_register_script( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
381 | - wp_enqueue_script( 'espresso_PRICING' ); |
|
380 | + wp_register_script('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
381 | + wp_enqueue_script('espresso_PRICING'); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | |
388 | 388 | public function load_scripts_styles_default() { |
389 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
389 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | ) |
415 | 415 | ); |
416 | 416 | |
417 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price' ) ) { |
|
417 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
418 | 418 | $this->_views['trashed'] = array( |
419 | 419 | 'slug' => 'trashed', |
420 | 420 | 'label' => __('Trash', 'event_espresso'), |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | ) |
445 | 445 | ); |
446 | 446 | |
447 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) { |
|
447 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) { |
|
448 | 448 | $this->_views['trashed'] = array( |
449 | 449 | 'slug' => 'trashed', |
450 | 450 | 'label' => __('Trash', 'event_espresso'), |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * @return void |
465 | 465 | */ |
466 | 466 | protected function _price_overview_list_table() { |
467 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
467 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
468 | 468 | 'add_new_price', |
469 | 469 | 'add', |
470 | 470 | array(), |
@@ -488,18 +488,18 @@ discard block |
||
488 | 488 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
489 | 489 | * @return mixed (int|array) int = count || array of price objects |
490 | 490 | */ |
491 | - public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
491 | + public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
492 | 492 | |
493 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
493 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
494 | 494 | // start with an empty array |
495 | 495 | $event_pricing = array(); |
496 | 496 | |
497 | - require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' ); |
|
498 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
497 | + require_once(PRICING_ADMIN.'Prices_List_Table.class.php'); |
|
498 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
499 | 499 | //$PRC = EEM_Price::instance(); |
500 | 500 | |
501 | 501 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
502 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
502 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
503 | 503 | |
504 | 504 | switch ($this->_req_data['orderby']) { |
505 | 505 | case 'name': |
@@ -512,27 +512,27 @@ discard block |
||
512 | 512 | $orderby = array('PRC_amount'=>$order); |
513 | 513 | break; |
514 | 514 | default: |
515 | - $orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
515 | + $orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
516 | 516 | } |
517 | 517 | |
518 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
519 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
518 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
519 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
520 | 520 | |
521 | 521 | $_where = array( |
522 | 522 | 'PRC_is_default' => 1, |
523 | 523 | 'PRC_deleted' => $trashed |
524 | 524 | ); |
525 | 525 | |
526 | - $offset = ($current_page-1)*$per_page; |
|
527 | - $limit = array( $offset, $per_page ); |
|
526 | + $offset = ($current_page - 1) * $per_page; |
|
527 | + $limit = array($offset, $per_page); |
|
528 | 528 | |
529 | - if ( isset( $this->_req_data['s'] ) ) { |
|
530 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
529 | + if (isset($this->_req_data['s'])) { |
|
530 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
531 | 531 | $_where['OR'] = array( |
532 | - 'PRC_name' => array('LIKE',$sstr ), |
|
533 | - 'PRC_desc' => array('LIKE',$sstr ), |
|
534 | - 'PRC_amount' => array( 'LIKE',$sstr ), |
|
535 | - 'Price_Type.PRT_name' => array( 'LIKE', $sstr ) |
|
532 | + 'PRC_name' => array('LIKE', $sstr), |
|
533 | + 'PRC_desc' => array('LIKE', $sstr), |
|
534 | + 'PRC_amount' => array('LIKE', $sstr), |
|
535 | + 'Price_Type.PRT_name' => array('LIKE', $sstr) |
|
536 | 536 | ); |
537 | 537 | } |
538 | 538 | |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | 'group_by'=>'PRC_ID' |
544 | 544 | ); |
545 | 545 | |
546 | - if($count){ |
|
547 | - return $trashed ? EEM_Price::instance()->count( array( $_where ) ) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
548 | - }else{ |
|
546 | + if ($count) { |
|
547 | + return $trashed ? EEM_Price::instance()->count(array($_where)) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
548 | + } else { |
|
549 | 549 | return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params); |
550 | 550 | } |
551 | 551 | } |
@@ -561,49 +561,49 @@ discard block |
||
561 | 561 | * @return void |
562 | 562 | */ |
563 | 563 | protected function _edit_price_details() { |
564 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
564 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
565 | 565 | // grab price ID |
566 | - $PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
566 | + $PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
567 | 567 | // change page title based on request action |
568 | - switch( $this->_req_action ) { |
|
568 | + switch ($this->_req_action) { |
|
569 | 569 | case 'add_new_price' : |
570 | - $this->_admin_page_title = esc_html__( 'Add New Price', 'event_espresso' ); |
|
570 | + $this->_admin_page_title = esc_html__('Add New Price', 'event_espresso'); |
|
571 | 571 | break; |
572 | 572 | case 'edit_price' : |
573 | - $this->_admin_page_title = esc_html__( 'Edit Price', 'event_espresso' ); |
|
573 | + $this->_admin_page_title = esc_html__('Edit Price', 'event_espresso'); |
|
574 | 574 | break; |
575 | 575 | default : |
576 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
576 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
577 | 577 | } |
578 | 578 | // add PRC_ID to title if editing |
579 | - $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title; |
|
579 | + $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title; |
|
580 | 580 | |
581 | 581 | // get prices |
582 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
582 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
583 | 583 | $PRC = EEM_Price::instance(); |
584 | 584 | |
585 | - if ( $PRC_ID ) { |
|
586 | - $price = $PRC->get_one_by_ID( $PRC_ID ); |
|
585 | + if ($PRC_ID) { |
|
586 | + $price = $PRC->get_one_by_ID($PRC_ID); |
|
587 | 587 | $additional_hidden_fields = array( |
588 | - 'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID ) |
|
588 | + 'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID) |
|
589 | 589 | ); |
590 | - $this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields ); |
|
590 | + $this->_set_add_edit_form_tags('update_price', $additional_hidden_fields); |
|
591 | 591 | } else { |
592 | 592 | $price = $PRC->get_new_price(); |
593 | - $this->_set_add_edit_form_tags( 'insert_price' ); |
|
593 | + $this->_set_add_edit_form_tags('insert_price'); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | $this->_template_args['PRC_ID'] = $PRC_ID; |
597 | 597 | $this->_template_args['price'] = $price; |
598 | 598 | |
599 | 599 | // get price types |
600 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
600 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
601 | 601 | $PRT = EEM_Price_Type::instance(); |
602 | - $price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) ); |
|
602 | + $price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1)))); |
|
603 | 603 | $price_type_names = array(); |
604 | 604 | if (empty($price_types)) { |
605 | - $msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' ); |
|
606 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
605 | + $msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso'); |
|
606 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
607 | 607 | exit(); |
608 | 608 | } else { |
609 | 609 | foreach ($price_types as $type) { |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | $this->_template_args['price_types'] = $price_type_names; |
617 | 617 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
618 | 618 | |
619 | - $this->_set_publish_post_box_vars( 'id', $PRC_ID ); |
|
619 | + $this->_set_publish_post_box_vars('id', $PRC_ID); |
|
620 | 620 | // the details template wrapper |
621 | 621 | $this->display_admin_page_with_sidebar(); |
622 | 622 | } |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @return void |
633 | 633 | */ |
634 | 634 | protected function _price_details_meta_boxes() { |
635 | - add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
635 | + add_meta_box('edit-price-details-mbox', __('Default Price Details', 'event_espresso'), array($this, '_edit_price_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | * @return void |
647 | 647 | */ |
648 | 648 | public function _edit_price_details_meta_box() { |
649 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
649 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | */ |
661 | 661 | protected function set_price_column_values() { |
662 | 662 | |
663 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
663 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
664 | 664 | |
665 | 665 | $set_column_values = array( |
666 | 666 | 'PRT_ID' => absint($this->_req_data['PRT_ID']), |
@@ -688,12 +688,12 @@ discard block |
||
688 | 688 | * @access protected |
689 | 689 | * @return void |
690 | 690 | */ |
691 | - protected function _insert_or_update_price( $insert = FALSE ) { |
|
691 | + protected function _insert_or_update_price($insert = FALSE) { |
|
692 | 692 | |
693 | 693 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
694 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
694 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
695 | 695 | |
696 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
696 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
697 | 697 | $PRC = EEM_Price::instance(); |
698 | 698 | |
699 | 699 | // why be so pessimistic ??? : ( |
@@ -701,14 +701,14 @@ discard block |
||
701 | 701 | |
702 | 702 | $set_column_values = $this->set_price_column_values(); |
703 | 703 | // is this a new Price ? |
704 | - if ( $insert ) { |
|
704 | + if ($insert) { |
|
705 | 705 | // run the insert |
706 | - if ( $PRC_ID = $PRC->insert( $set_column_values )) { |
|
706 | + if ($PRC_ID = $PRC->insert($set_column_values)) { |
|
707 | 707 | //make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type |
708 | 708 | $PR = EEM_price::instance()->get_one_by_ID($PRC_ID); |
709 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
709 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
710 | 710 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
711 | - $ticket->_add_relation_to( $PR, 'Price' ); |
|
711 | + $ticket->_add_relation_to($PR, 'Price'); |
|
712 | 712 | $ticket->save(); |
713 | 713 | } |
714 | 714 | $success = 1; |
@@ -718,29 +718,29 @@ discard block |
||
718 | 718 | } |
719 | 719 | $action_desc = 'created'; |
720 | 720 | } else { |
721 | - $PRC_ID = absint( $this->_req_data['PRC_ID'] ); |
|
721 | + $PRC_ID = absint($this->_req_data['PRC_ID']); |
|
722 | 722 | // run the update |
723 | - $where_cols_n_values = array( 'PRC_ID' => $PRC_ID ); |
|
724 | - if ( $PRC->update( $set_column_values, array($where_cols_n_values))) { |
|
723 | + $where_cols_n_values = array('PRC_ID' => $PRC_ID); |
|
724 | + if ($PRC->update($set_column_values, array($where_cols_n_values))) { |
|
725 | 725 | $success = 1; |
726 | 726 | } |
727 | 727 | |
728 | 728 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
729 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
729 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
730 | 730 | |
731 | 731 | //if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated. |
732 | - if ( $PRC_ID === 1 ) { |
|
732 | + if ($PRC_ID === 1) { |
|
733 | 733 | $ticket = $PR->get_first_related('Ticket'); |
734 | - if ( $ticket ) { |
|
735 | - $ticket->set('TKT_price', $PR->get('PRC_amount') ); |
|
736 | - $ticket->set('TKT_name', $PR->get('PRC_name') ); |
|
734 | + if ($ticket) { |
|
735 | + $ticket->set('TKT_price', $PR->get('PRC_amount')); |
|
736 | + $ticket->set('TKT_name', $PR->get('PRC_name')); |
|
737 | 737 | $ticket->set('TKT_description', $PR->get('PRC_desc')); |
738 | 738 | $ticket->save(); |
739 | 739 | } |
740 | 740 | } else { |
741 | 741 | //we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type. |
742 | 742 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
743 | - $ticket->_add_relation_to( $PRC_ID, 'Price' ); |
|
743 | + $ticket->_add_relation_to($PRC_ID, 'Price'); |
|
744 | 744 | $ticket->save(); |
745 | 745 | } |
746 | 746 | } |
@@ -748,9 +748,9 @@ discard block |
||
748 | 748 | $action_desc = 'updated'; |
749 | 749 | } |
750 | 750 | |
751 | - $query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID ); |
|
751 | + $query_args = array('action' => 'edit_price', 'id' => $PRC_ID); |
|
752 | 752 | |
753 | - $this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args ); |
|
753 | + $this->_redirect_after_action($success, 'Prices', $action_desc, $query_args); |
|
754 | 754 | |
755 | 755 | } |
756 | 756 | |
@@ -764,12 +764,12 @@ discard block |
||
764 | 764 | * @access protected |
765 | 765 | * @return void |
766 | 766 | */ |
767 | - protected function _trash_or_restore_price( $trash = TRUE ) { |
|
767 | + protected function _trash_or_restore_price($trash = TRUE) { |
|
768 | 768 | |
769 | 769 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
770 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
770 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
771 | 771 | |
772 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
772 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
773 | 773 | $PRC = EEM_Price::instance(); |
774 | 774 | |
775 | 775 | $success = 1; |
@@ -778,18 +778,18 @@ discard block |
||
778 | 778 | //get base ticket for updating |
779 | 779 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
780 | 780 | //Checkboxes |
781 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
781 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
782 | 782 | // if array has more than one element than success message should be plural |
783 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
783 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
784 | 784 | // cycle thru checkboxes |
785 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
786 | - if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) { |
|
785 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
786 | + if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) { |
|
787 | 787 | $success = 0; |
788 | 788 | } else { |
789 | 789 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
790 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
790 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
791 | 791 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
792 | - if ( $PRC_deleted ) { |
|
792 | + if ($PRC_deleted) { |
|
793 | 793 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
794 | 794 | } else { |
795 | 795 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -801,14 +801,14 @@ discard block |
||
801 | 801 | |
802 | 802 | } else { |
803 | 803 | // grab single id and delete |
804 | - $PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
805 | - if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) { |
|
804 | + $PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
805 | + if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) { |
|
806 | 806 | $success = 0; |
807 | 807 | } else { |
808 | 808 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
809 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
809 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
810 | 810 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
811 | - if ( $PRC_deleted ) { |
|
811 | + if ($PRC_deleted) { |
|
812 | 812 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
813 | 813 | } else { |
814 | 814 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -822,17 +822,17 @@ discard block |
||
822 | 822 | 'action' => 'default' |
823 | 823 | ); |
824 | 824 | |
825 | - if ( $success ) { |
|
826 | - if ( $trash ) { |
|
825 | + if ($success) { |
|
826 | + if ($trash) { |
|
827 | 827 | $msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso'); |
828 | 828 | } else { |
829 | 829 | $msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso'); |
830 | 830 | } |
831 | 831 | |
832 | - EE_Error::add_success( $msg ); |
|
832 | + EE_Error::add_success($msg); |
|
833 | 833 | } |
834 | 834 | |
835 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
835 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
836 | 836 | |
837 | 837 | } |
838 | 838 | |
@@ -849,19 +849,19 @@ discard block |
||
849 | 849 | protected function _delete_price() { |
850 | 850 | |
851 | 851 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
852 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
852 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
853 | 853 | |
854 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
854 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
855 | 855 | $PRC = EEM_Price::instance(); |
856 | 856 | |
857 | 857 | $success = 1; |
858 | 858 | //Checkboxes |
859 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
859 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
860 | 860 | // if array has more than one element than success message should be plural |
861 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
861 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
862 | 862 | // cycle thru bulk action checkboxes |
863 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
864 | - if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
863 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
864 | + if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
865 | 865 | $success = 0; |
866 | 866 | } |
867 | 867 | } |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | |
876 | 876 | } |
877 | 877 | |
878 | - $this->_redirect_after_action( $success, 'Prices', 'deleted', array() ); |
|
878 | + $this->_redirect_after_action($success, 'Prices', 'deleted', array()); |
|
879 | 879 | |
880 | 880 | } |
881 | 881 | |
@@ -883,16 +883,16 @@ discard block |
||
883 | 883 | |
884 | 884 | |
885 | 885 | public function update_price_order() { |
886 | - $success = __( 'Price order was updated successfully.', 'event_espresso' ); |
|
886 | + $success = __('Price order was updated successfully.', 'event_espresso'); |
|
887 | 887 | |
888 | 888 | // grab our row IDs |
889 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE; |
|
889 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE; |
|
890 | 890 | |
891 | - if ( is_array( $row_ids )) { |
|
892 | - for ( $i = 0; $i < count( $row_ids ); $i++ ) { |
|
891 | + if (is_array($row_ids)) { |
|
892 | + for ($i = 0; $i < count($row_ids); $i++) { |
|
893 | 893 | //Update the prices when re-ordering |
894 | 894 | $id = absint($row_ids[$i]); |
895 | - if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) { |
|
895 | + if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) { |
|
896 | 896 | $success = FALSE; |
897 | 897 | } |
898 | 898 | } |
@@ -900,9 +900,9 @@ discard block |
||
900 | 900 | $success = FALSE; |
901 | 901 | } |
902 | 902 | |
903 | - $errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE; |
|
903 | + $errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE; |
|
904 | 904 | |
905 | - echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors )); |
|
905 | + echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors)); |
|
906 | 906 | die(); |
907 | 907 | } |
908 | 908 | |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | * @return void |
927 | 927 | */ |
928 | 928 | protected function _price_types_overview_list_table() { |
929 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
929 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
930 | 930 | 'add_new_price_type', |
931 | 931 | 'add_type', |
932 | 932 | array(), |
@@ -950,46 +950,46 @@ discard block |
||
950 | 950 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
951 | 951 | * @return mixed (int|array) int = count || array of price objects |
952 | 952 | */ |
953 | - public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
953 | + public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
954 | 954 | |
955 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
955 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
956 | 956 | // start with an empty array |
957 | 957 | |
958 | - require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' ); |
|
959 | - require_once( EE_MODELS . 'EEM_Price_Type.model.php' ); |
|
958 | + require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php'); |
|
959 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
960 | 960 | |
961 | 961 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
962 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
962 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
963 | 963 | switch ($this->_req_data['orderby']) { |
964 | 964 | case 'name': |
965 | - $orderby = array( 'PRT_name' => $order); |
|
965 | + $orderby = array('PRT_name' => $order); |
|
966 | 966 | break; |
967 | 967 | default: |
968 | - $orderby = array( 'PRT_order' => $order); |
|
968 | + $orderby = array('PRT_order' => $order); |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | |
972 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
973 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
972 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
973 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
974 | 974 | |
975 | - $offset = ($current_page-1)*$per_page; |
|
976 | - $limit = array( $offset, $per_page ); |
|
975 | + $offset = ($current_page - 1) * $per_page; |
|
976 | + $limit = array($offset, $per_page); |
|
977 | 977 | |
978 | - $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) ); |
|
978 | + $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1)); |
|
979 | 979 | |
980 | - if ( isset( $this->_req_data['s'] ) ) { |
|
981 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
980 | + if (isset($this->_req_data['s'])) { |
|
981 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
982 | 982 | $_where['OR'] = array( |
983 | - 'PRT_name' => array( 'LIKE', $sstr ) |
|
983 | + 'PRT_name' => array('LIKE', $sstr) |
|
984 | 984 | ); |
985 | 985 | } |
986 | 986 | $query_params = array( |
987 | 987 | $_where, |
988 | 988 | 'order_by'=>$orderby, |
989 | 989 | 'limit'=>$limit); |
990 | - if($count){ |
|
990 | + if ($count) { |
|
991 | 991 | return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params); |
992 | - }else{ |
|
992 | + } else { |
|
993 | 993 | return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params); |
994 | 994 | } |
995 | 995 | |
@@ -1009,34 +1009,34 @@ discard block |
||
1009 | 1009 | */ |
1010 | 1010 | protected function _edit_price_type_details() { |
1011 | 1011 | |
1012 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1012 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1013 | 1013 | |
1014 | 1014 | |
1015 | 1015 | // grab price type ID |
1016 | - $PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
1016 | + $PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
1017 | 1017 | // change page title based on request action |
1018 | - switch( $this->_req_action ) { |
|
1018 | + switch ($this->_req_action) { |
|
1019 | 1019 | case 'add_new_price_type' : |
1020 | - $this->_admin_page_title = esc_html__( 'Add New Price Type', 'event_espresso' ); |
|
1020 | + $this->_admin_page_title = esc_html__('Add New Price Type', 'event_espresso'); |
|
1021 | 1021 | break; |
1022 | 1022 | case 'edit_price_type' : |
1023 | - $this->_admin_page_title = esc_html__( 'Edit Price Type', 'event_espresso' ); |
|
1023 | + $this->_admin_page_title = esc_html__('Edit Price Type', 'event_espresso'); |
|
1024 | 1024 | break; |
1025 | 1025 | default : |
1026 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
1026 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
1027 | 1027 | } |
1028 | 1028 | // add PRT_ID to title if editing |
1029 | - $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title; |
|
1029 | + $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title; |
|
1030 | 1030 | |
1031 | 1031 | // require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
1032 | 1032 | |
1033 | - if ( $PRT_ID ) { |
|
1034 | - $price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID ); |
|
1035 | - $additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID )); |
|
1036 | - $this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields ); |
|
1033 | + if ($PRT_ID) { |
|
1034 | + $price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID); |
|
1035 | + $additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID)); |
|
1036 | + $this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields); |
|
1037 | 1037 | } else { |
1038 | 1038 | $price_type = EEM_Price_Type::instance()->get_new_price_type(); |
1039 | - $this->_set_add_edit_form_tags( 'insert_price_type' ); |
|
1039 | + $this->_set_add_edit_form_tags('insert_price_type'); |
|
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | $this->_template_args['PRT_ID'] = $PRT_ID; |
@@ -1045,19 +1045,19 @@ discard block |
||
1045 | 1045 | |
1046 | 1046 | $base_types = EEM_Price_Type::instance()->get_base_types(); |
1047 | 1047 | $select_values = array(); |
1048 | - foreach ( $base_types as $ref => $text ) { |
|
1049 | - if ( $ref == EEM_Price_Type::base_type_base_price ) { |
|
1048 | + foreach ($base_types as $ref => $text) { |
|
1049 | + if ($ref == EEM_Price_Type::base_type_base_price) { |
|
1050 | 1050 | //do not allow creation of base_type_base_prices because that's a system only base type. |
1051 | 1051 | continue; |
1052 | 1052 | } |
1053 | - $values[] = array( 'id' => $ref, 'text' => $text ); |
|
1053 | + $values[] = array('id' => $ref, 'text' => $text); |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | |
1057 | 1057 | $this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"'); |
1058 | 1058 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
1059 | - $redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url ); |
|
1060 | - $this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL ); |
|
1059 | + $redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url); |
|
1060 | + $this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL); |
|
1061 | 1061 | // the details template wrapper |
1062 | 1062 | $this->display_admin_page_with_sidebar(); |
1063 | 1063 | |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | * @return void |
1075 | 1075 | */ |
1076 | 1076 | protected function _price_type_details_meta_boxes() { |
1077 | - add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1077 | + add_meta_box('edit-price-details-mbox', __('Price Type Details', 'event_espresso'), array($this, '_edit_price_type_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | * @return void |
1088 | 1088 | */ |
1089 | 1089 | public function _edit_price_type_details_meta_box() { |
1090 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
1090 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
1091 | 1091 | } |
1092 | 1092 | |
1093 | 1093 | |
@@ -1100,9 +1100,9 @@ discard block |
||
1100 | 1100 | */ |
1101 | 1101 | protected function set_price_type_column_values() { |
1102 | 1102 | |
1103 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1103 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1104 | 1104 | |
1105 | - $base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1105 | + $base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1106 | 1106 | |
1107 | 1107 | switch ($base_type) { |
1108 | 1108 | |
@@ -1149,12 +1149,12 @@ discard block |
||
1149 | 1149 | * @access protected |
1150 | 1150 | * @return void |
1151 | 1151 | */ |
1152 | - protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
|
1152 | + protected function _insert_or_update_price_type($new_price_type = FALSE) { |
|
1153 | 1153 | |
1154 | 1154 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1155 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1155 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1156 | 1156 | |
1157 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1157 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1158 | 1158 | $PRT = EEM_Price_Type::instance(); |
1159 | 1159 | |
1160 | 1160 | // why be so pessimistic ??? : ( |
@@ -1162,24 +1162,24 @@ discard block |
||
1162 | 1162 | |
1163 | 1163 | $set_column_values = $this->set_price_type_column_values(); |
1164 | 1164 | // is this a new Price ? |
1165 | - if ( $new_price_type ) { |
|
1165 | + if ($new_price_type) { |
|
1166 | 1166 | // run the insert |
1167 | - if ( $PRT_ID = $PRT->insert( $set_column_values )) { |
|
1167 | + if ($PRT_ID = $PRT->insert($set_column_values)) { |
|
1168 | 1168 | $success = 1; |
1169 | 1169 | } |
1170 | 1170 | $action_desc = 'created'; |
1171 | 1171 | } else { |
1172 | 1172 | $PRT_ID = absint($this->_req_data['PRT_ID']); |
1173 | 1173 | // run the update |
1174 | - $where_cols_n_values = array('PRT_ID' => $PRT_ID ); |
|
1175 | - if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) { |
|
1174 | + $where_cols_n_values = array('PRT_ID' => $PRT_ID); |
|
1175 | + if ($PRT->update($set_column_values, array($where_cols_n_values))) { |
|
1176 | 1176 | $success = 1; |
1177 | 1177 | } |
1178 | 1178 | $action_desc = 'updated'; |
1179 | 1179 | } |
1180 | 1180 | |
1181 | - $query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID ); |
|
1182 | - $this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args ); |
|
1181 | + $query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID); |
|
1182 | + $this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args); |
|
1183 | 1183 | |
1184 | 1184 | } |
1185 | 1185 | |
@@ -1193,49 +1193,49 @@ discard block |
||
1193 | 1193 | * @access protected |
1194 | 1194 | * @return void |
1195 | 1195 | */ |
1196 | - protected function _trash_or_restore_price_type( $trash = TRUE ) { |
|
1196 | + protected function _trash_or_restore_price_type($trash = TRUE) { |
|
1197 | 1197 | |
1198 | 1198 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1199 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1199 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1200 | 1200 | |
1201 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1201 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1202 | 1202 | $PRT = EEM_Price_Type::instance(); |
1203 | 1203 | |
1204 | 1204 | $success = 1; |
1205 | 1205 | $PRT_deleted = $trash ? TRUE : FALSE; |
1206 | 1206 | //Checkboxes |
1207 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1207 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1208 | 1208 | // if array has more than one element than success message should be plural |
1209 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1210 | - $what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type'; |
|
1209 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1210 | + $what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type'; |
|
1211 | 1211 | // cycle thru checkboxes |
1212 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1213 | - if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) { |
|
1212 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1213 | + if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1214 | 1214 | $success = 0; |
1215 | 1215 | } |
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | } else { |
1219 | 1219 | // grab single id and delete |
1220 | - $PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
1221 | - if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) { |
|
1220 | + $PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
1221 | + if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1222 | 1222 | $success = 0; |
1223 | 1223 | } |
1224 | 1224 | $what = 'Price Type'; |
1225 | 1225 | |
1226 | 1226 | } |
1227 | 1227 | |
1228 | - $query_args = array( 'action' => 'price_types' ); |
|
1229 | - if ( $success ) { |
|
1230 | - if ( $trash ) { |
|
1228 | + $query_args = array('action' => 'price_types'); |
|
1229 | + if ($success) { |
|
1230 | + if ($trash) { |
|
1231 | 1231 | $msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso'); |
1232 | 1232 | } else { |
1233 | 1233 | $msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso'); |
1234 | 1234 | } |
1235 | - EE_Error::add_success( $msg ); |
|
1235 | + EE_Error::add_success($msg); |
|
1236 | 1236 | } |
1237 | 1237 | |
1238 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
1238 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
1239 | 1239 | |
1240 | 1240 | } |
1241 | 1241 | |
@@ -1252,19 +1252,19 @@ discard block |
||
1252 | 1252 | protected function _delete_price_type() { |
1253 | 1253 | |
1254 | 1254 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1255 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1255 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1256 | 1256 | |
1257 | 1257 | $PRT = EEM_Price_Type::instance(); |
1258 | 1258 | |
1259 | 1259 | $success = 1; |
1260 | 1260 | //Checkboxes |
1261 | - if (!empty($this->_req_data['checkbox'])) { |
|
1261 | + if ( ! empty($this->_req_data['checkbox'])) { |
|
1262 | 1262 | // if array has more than one element than success message should be plural |
1263 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1263 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1264 | 1264 | $what = $PRT->item_name($success); |
1265 | 1265 | // cycle thru bulk action checkboxes |
1266 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1267 | - if (!$PRT->delete_permanently_by_ID($PRT_ID) ) { |
|
1266 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1267 | + if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) { |
|
1268 | 1268 | $success = 0; |
1269 | 1269 | } |
1270 | 1270 | } |
@@ -1272,8 +1272,8 @@ discard block |
||
1272 | 1272 | } |
1273 | 1273 | |
1274 | 1274 | |
1275 | - $query_args = array( 'action'=> 'price_types' ); |
|
1276 | - $this->_redirect_after_action( $success, $what, 'deleted', $query_args ); |
|
1275 | + $query_args = array('action'=> 'price_types'); |
|
1276 | + $this->_redirect_after_action($success, $what, 'deleted', $query_args); |
|
1277 | 1277 | |
1278 | 1278 | } |
1279 | 1279 | |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | * @return string |
1290 | 1290 | */ |
1291 | 1291 | protected function _learn_more_about_pricing_link() { |
1292 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
|
1292 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>'; |
|
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | |
@@ -1365,17 +1365,17 @@ discard block |
||
1365 | 1365 | * @return void |
1366 | 1366 | */ |
1367 | 1367 | public function _update_tax_settings() { |
1368 | - if ( ! isset( EE_Registry::instance()->CFG->tax_settings ) ) { |
|
1368 | + if ( ! isset(EE_Registry::instance()->CFG->tax_settings)) { |
|
1369 | 1369 | EE_Registry::instance()->CFG->tax_settings = new EE_Tax_Config(); |
1370 | 1370 | } |
1371 | 1371 | try { |
1372 | 1372 | $tax_form = $this->tax_settings_form(); |
1373 | 1373 | //check for form submission |
1374 | - if ( $tax_form->was_submitted() ) { |
|
1374 | + if ($tax_form->was_submitted()) { |
|
1375 | 1375 | //capture form data |
1376 | 1376 | $tax_form->receive_form_submission(); |
1377 | 1377 | //validate form data |
1378 | - if ( $tax_form->is_valid() ) { |
|
1378 | + if ($tax_form->is_valid()) { |
|
1379 | 1379 | //grab validated data from form |
1380 | 1380 | $valid_data = $tax_form->valid_data(); |
1381 | 1381 | //set data on config |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | ->prices_displayed_including_taxes |
1386 | 1386 | = $valid_data['tax_settings']['prices_displayed_including_taxes']; |
1387 | 1387 | } else { |
1388 | - if ( $tax_form->submission_error_message() !== '' ) { |
|
1388 | + if ($tax_form->submission_error_message() !== '') { |
|
1389 | 1389 | EE_Error::add_error( |
1390 | 1390 | $tax_form->submission_error_message(), |
1391 | 1391 | __FILE__, |
@@ -1395,8 +1395,8 @@ discard block |
||
1395 | 1395 | } |
1396 | 1396 | } |
1397 | 1397 | } |
1398 | - } catch ( EE_Error $e ) { |
|
1399 | - EE_Error::add_error( $e->get_error(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1398 | + } catch (EE_Error $e) { |
|
1399 | + EE_Error::add_error($e->get_error(), __FILE__, __FUNCTION__, __LINE__); |
|
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | $what = 'Tax Settings'; |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | __FUNCTION__, |
1408 | 1408 | __LINE__ |
1409 | 1409 | ); |
1410 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'tax_settings' ) ); |
|
1410 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'tax_settings')); |
|
1411 | 1411 | } |
1412 | 1412 | |
1413 | 1413 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | |
3 | 3 | /** |
4 | 4 | * This class is used for generating EE_Message objects with given info. |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return EE_Messages_Queue The new queue for holding generated EE_Message objects. |
118 | 118 | */ |
119 | - public function generate( $save = true ) { |
|
119 | + public function generate($save = true) { |
|
120 | 120 | //iterate through the messages in the queue, generate, and add to new queue. |
121 | 121 | $this->_generation_queue->get_message_repository()->rewind(); |
122 | - while ( $this->_generation_queue->get_message_repository()->valid() ) { |
|
122 | + while ($this->_generation_queue->get_message_repository()->valid()) { |
|
123 | 123 | //reset "current" properties |
124 | 124 | $this->_reset_current_properties(); |
125 | 125 | |
@@ -133,18 +133,18 @@ discard block |
||
133 | 133 | $this->_generation_queue->get_message_repository()->next(); |
134 | 134 | $next_msg = $this->_generation_queue->get_message_repository()->current(); |
135 | 135 | //restore pointer to current item |
136 | - $this->_generation_queue->get_message_repository()->set_current( $msg ); |
|
136 | + $this->_generation_queue->get_message_repository()->set_current($msg); |
|
137 | 137 | |
138 | 138 | //skip and delete if the current $msg is NOT incomplete (queued for generation) |
139 | - if ( $msg->STS_ID() !== EEM_Message::status_incomplete ) { |
|
139 | + if ($msg->STS_ID() !== EEM_Message::status_incomplete) { |
|
140 | 140 | //we keep this item in the db just remove from the repo. |
141 | - $this->_generation_queue->get_message_repository()->remove( $msg ); |
|
141 | + $this->_generation_queue->get_message_repository()->remove($msg); |
|
142 | 142 | //next item |
143 | - $this->_generation_queue->get_message_repository()->set_current( $next_msg ); |
|
143 | + $this->_generation_queue->get_message_repository()->set_current($next_msg); |
|
144 | 144 | continue; |
145 | 145 | } |
146 | 146 | |
147 | - if ( $this->_verify() ) { |
|
147 | + if ($this->_verify()) { |
|
148 | 148 | //let's get generating! |
149 | 149 | $this->_generate(); |
150 | 150 | } |
@@ -154,32 +154,32 @@ discard block |
||
154 | 154 | $msg->STS_ID() === EEM_Message::status_debug_only |
155 | 155 | && ! EEM_Message::debug() |
156 | 156 | ) { |
157 | - do_action( 'AHEE__EE_Messages_Generator__generate__before_debug_delete', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler ); |
|
157 | + do_action('AHEE__EE_Messages_Generator__generate__before_debug_delete', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler); |
|
158 | 158 | $this->_generation_queue->get_message_repository()->delete(); |
159 | - $this->_generation_queue->get_message_repository()->set_current( $next_msg ); |
|
159 | + $this->_generation_queue->get_message_repository()->set_current($next_msg); |
|
160 | 160 | continue; |
161 | 161 | } |
162 | 162 | |
163 | 163 | //if there are error messages then let's set the status and the error message. |
164 | - if ( $this->_error_msg ) { |
|
164 | + if ($this->_error_msg) { |
|
165 | 165 | //if the status is already debug only, then let's leave it at that. |
166 | - if ( $msg->STS_ID() !== EEM_Message::status_debug_only ) { |
|
167 | - $msg->set_STS_ID( EEM_Message::status_failed ); |
|
166 | + if ($msg->STS_ID() !== EEM_Message::status_debug_only) { |
|
167 | + $msg->set_STS_ID(EEM_Message::status_failed); |
|
168 | 168 | } |
169 | - do_action( 'AHEE__EE_Messages_Generator__generate__processing_failed_message', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler ); |
|
169 | + do_action('AHEE__EE_Messages_Generator__generate__processing_failed_message', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler); |
|
170 | 170 | $msg->set_error_message( |
171 | - __( 'Message failed to generate for the following reasons: ' ) |
|
171 | + __('Message failed to generate for the following reasons: ') |
|
172 | 172 | . "\n" |
173 | - . implode( "\n", $this->_error_msg ) |
|
173 | + . implode("\n", $this->_error_msg) |
|
174 | 174 | ); |
175 | - $msg->set_modified( time() ); |
|
175 | + $msg->set_modified(time()); |
|
176 | 176 | } else { |
177 | - do_action( 'AHEE__EE_Messages_Generator__generate__before_successful_generated_message_delete', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler ); |
|
177 | + do_action('AHEE__EE_Messages_Generator__generate__before_successful_generated_message_delete', $msg, $this->_error_msg, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler); |
|
178 | 178 | //remove from db |
179 | 179 | $this->_generation_queue->get_message_repository()->delete(); |
180 | 180 | } |
181 | 181 | //next item |
182 | - $this->_generation_queue->get_message_repository()->set_current( $next_msg ); |
|
182 | + $this->_generation_queue->get_message_repository()->set_current($next_msg); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | //generation queue is ALWAYS saved to record any errors in the generation process. |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * so a EE_Extra_Meta entry could be created and attached to the EE_Message. In those cases the save flag is |
193 | 193 | * irrelevant. |
194 | 194 | */ |
195 | - if ( $save ) { |
|
195 | + if ($save) { |
|
196 | 196 | $this->_ready_queue->save(); |
197 | 197 | } |
198 | 198 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | protected function _reset_current_properties() { |
211 | 211 | $this->_verified = false; |
212 | 212 | //make sure any _data value in the current message type is reset |
213 | - if ( $this->_current_message_type instanceof EE_message_type ) { |
|
213 | + if ($this->_current_message_type instanceof EE_message_type) { |
|
214 | 214 | $this->_current_message_type->reset_data(); |
215 | 215 | } |
216 | 216 | $this->_current_messenger = $this->_current_message_type = $this->_current_data_handler = null; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | protected function _generate() { |
231 | 231 | //double check verification has run and that everything is ready to work with (saves us having to validate everything again). |
232 | - if ( ! $this->_verified ) { |
|
232 | + if ( ! $this->_verified) { |
|
233 | 233 | return false; //get out because we don't have a valid setup to work with. |
234 | 234 | } |
235 | 235 | |
@@ -239,35 +239,35 @@ discard block |
||
239 | 239 | $this->_current_data_handler, |
240 | 240 | $this->_generation_queue->get_message_repository()->current()->context() |
241 | 241 | ); |
242 | - } catch ( EE_Error $e ) { |
|
242 | + } catch (EE_Error $e) { |
|
243 | 243 | $this->_error_msg[] = $e->getMessage(); |
244 | 244 | return false; |
245 | 245 | } |
246 | 246 | |
247 | 247 | |
248 | 248 | //if no addressees then get out because there is nothing to generation (possible bad data). |
249 | - if ( ! $this->_valid_addressees( $addressees ) ) { |
|
250 | - do_action( 'AHEE__EE_Messages_Generator___generate__invalid_addressees', $this->_generation_queue->get_message_repository()->current(), $addressees, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler ); |
|
251 | - $this->_generation_queue->get_message_repository()->current()->set_STS_ID( EEM_Message::status_debug_only ); |
|
252 | - $this->_error_msg[] = __( 'This is not a critical error but an informational notice. Unable to generate messages EE_Messages_Addressee objects. There were no attendees prepared by the data handler. |
|
253 | - Sometimes this is because messages only get generated for certain registration statuses. For example, the ticket notice message type only goes to approved registrations.', 'event_espresso' ); |
|
249 | + if ( ! $this->_valid_addressees($addressees)) { |
|
250 | + do_action('AHEE__EE_Messages_Generator___generate__invalid_addressees', $this->_generation_queue->get_message_repository()->current(), $addressees, $this->_current_messenger, $this->_current_message_type, $this->_current_data_handler); |
|
251 | + $this->_generation_queue->get_message_repository()->current()->set_STS_ID(EEM_Message::status_debug_only); |
|
252 | + $this->_error_msg[] = __('This is not a critical error but an informational notice. Unable to generate messages EE_Messages_Addressee objects. There were no attendees prepared by the data handler. |
|
253 | + Sometimes this is because messages only get generated for certain registration statuses. For example, the ticket notice message type only goes to approved registrations.', 'event_espresso'); |
|
254 | 254 | return false; |
255 | 255 | } |
256 | 256 | |
257 | 257 | $message_template_group = $this->_get_message_template_group(); |
258 | 258 | |
259 | 259 | //in the unlikely event there is no EE_Message_Template_Group available, get out! |
260 | - if ( ! $message_template_group instanceof EE_Message_Template_Group ) { |
|
261 | - $this->_error_msg[] = __( 'Unable to get the Message Templates for the Message being generated. No message template group accessible.', 'event_espresso' ); |
|
260 | + if ( ! $message_template_group instanceof EE_Message_Template_Group) { |
|
261 | + $this->_error_msg[] = __('Unable to get the Message Templates for the Message being generated. No message template group accessible.', 'event_espresso'); |
|
262 | 262 | return false; |
263 | 263 | } |
264 | 264 | |
265 | 265 | //get formatted templates for using to parse and setup EE_Message objects. |
266 | - $templates = $this->_get_templates( $message_template_group ); |
|
266 | + $templates = $this->_get_templates($message_template_group); |
|
267 | 267 | |
268 | 268 | |
269 | 269 | //setup new EE_Message objects (and add to _ready_queue) |
270 | - return $this->_assemble_messages( $addressees, $templates, $message_template_group ); |
|
270 | + return $this->_assemble_messages($addressees, $templates, $message_template_group); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | |
@@ -285,18 +285,18 @@ discard block |
||
285 | 285 | //so let's use that. |
286 | 286 | $GRP_ID = $this->_generation_queue->get_message_repository()->current()->GRP_ID(); |
287 | 287 | |
288 | - if ( $GRP_ID ) { |
|
288 | + if ($GRP_ID) { |
|
289 | 289 | //attempt to retrieve from repo first |
290 | - $GRP = $this->_template_collection->get_by_ID( $GRP_ID ); |
|
291 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
292 | - return $GRP; //got it! |
|
290 | + $GRP = $this->_template_collection->get_by_ID($GRP_ID); |
|
291 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
292 | + return $GRP; //got it! |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | //nope don't have it yet. Get from DB then add to repo if its not here, then that means the current GRP_ID |
296 | 296 | //is not valid, so we'll continue on in the code assuming there's NO GRP_ID. |
297 | - $GRP = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
298 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
299 | - $this->_template_collection->add( $GRP ); |
|
297 | + $GRP = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
298 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
299 | + $this->_template_collection->add($GRP); |
|
300 | 300 | return $GRP; |
301 | 301 | } |
302 | 302 | } |
@@ -315,41 +315,41 @@ discard block |
||
315 | 315 | //in vanilla EE we're assuming there's only one event. |
316 | 316 | //However, if there are multiple events then we'll just use the default templates instead of different |
317 | 317 | // templates per event (which could create problems). |
318 | - if ( count( $this->_current_data_handler->events ) === 1 ) { |
|
319 | - foreach ( $this->_current_data_handler->events as $event ) { |
|
318 | + if (count($this->_current_data_handler->events) === 1) { |
|
319 | + foreach ($this->_current_data_handler->events as $event) { |
|
320 | 320 | $EVT_ID = $event['ID']; |
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
324 | 324 | //before going any further, let's see if its in the queue |
325 | - $GRP = $this->_template_collection->get_by_key( $this->_template_collection->get_key( $this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID ) ); |
|
325 | + $GRP = $this->_template_collection->get_by_key($this->_template_collection->get_key($this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID)); |
|
326 | 326 | |
327 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
327 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
328 | 328 | return $GRP; |
329 | 329 | } |
330 | 330 | |
331 | 331 | //nope still no GRP? |
332 | 332 | //first we get the global template in case it has an override set. |
333 | - $global_template_qa = array_merge( array( 'MTP_is_global' => true ), $template_qa ); |
|
334 | - $global_GRP = EEM_Message_Template_Group::instance()->get_one( array( $global_template_qa ) ); |
|
333 | + $global_template_qa = array_merge(array('MTP_is_global' => true), $template_qa); |
|
334 | + $global_GRP = EEM_Message_Template_Group::instance()->get_one(array($global_template_qa)); |
|
335 | 335 | |
336 | 336 | //if this is an override, then we just return it. |
337 | - if ( $global_GRP instanceof EE_Message_Template_Group && $global_GRP->get( 'MTP_is_override' ) ) { |
|
338 | - $this->_template_collection->add( $global_GRP, $EVT_ID ); |
|
337 | + if ($global_GRP instanceof EE_Message_Template_Group && $global_GRP->get('MTP_is_override')) { |
|
338 | + $this->_template_collection->add($global_GRP, $EVT_ID); |
|
339 | 339 | return $global_GRP; |
340 | 340 | } |
341 | 341 | |
342 | 342 | //STILL here? Okay that means we want to see if there is event specific group and if there is we return it, |
343 | 343 | //otherwise we return the global group we retrieved. |
344 | - if ( $EVT_ID ) { |
|
344 | + if ($EVT_ID) { |
|
345 | 345 | $template_qa['Event.EVT_ID'] = $EVT_ID; |
346 | 346 | } |
347 | 347 | |
348 | - $GRP = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) ); |
|
348 | + $GRP = EEM_Message_Template_Group::instance()->get_one(array($template_qa)); |
|
349 | 349 | $GRP = $GRP instanceof EE_Message_Template_Group ? $GRP : $global_GRP; |
350 | 350 | |
351 | - if ( $GRP instanceof EE_Message_Template_Group ) { |
|
352 | - $this->_template_collection->add( $GRP, $EVT_ID ); |
|
351 | + if ($GRP instanceof EE_Message_Template_Group) { |
|
352 | + $this->_template_collection->add($GRP, $EVT_ID); |
|
353 | 353 | return $GRP; |
354 | 354 | } |
355 | 355 | |
@@ -373,15 +373,15 @@ discard block |
||
373 | 373 | * ) |
374 | 374 | * ) |
375 | 375 | */ |
376 | - protected function _get_templates( EE_Message_Template_Group $message_template_group ) { |
|
376 | + protected function _get_templates(EE_Message_Template_Group $message_template_group) { |
|
377 | 377 | $templates = array(); |
378 | 378 | $context_templates = $message_template_group->context_templates(); |
379 | - foreach ( $context_templates as $context => $template_fields ) { |
|
380 | - foreach ( $template_fields as $template_field => $template_obj ) { |
|
381 | - if ( ! $template_obj instanceof EE_Message_Template ) { |
|
379 | + foreach ($context_templates as $context => $template_fields) { |
|
380 | + foreach ($template_fields as $template_field => $template_obj) { |
|
381 | + if ( ! $template_obj instanceof EE_Message_Template) { |
|
382 | 382 | continue; |
383 | 383 | } |
384 | - $templates[ $template_field ][ $context ] = $template_obj->get( 'MTP_content' ); |
|
384 | + $templates[$template_field][$context] = $template_obj->get('MTP_content'); |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | return $templates; |
@@ -403,21 +403,21 @@ discard block |
||
403 | 403 | * get added to the queue with EEM_Message::status_idle, unsuccessfully generated messages will get added |
404 | 404 | * to the queue as EEM_Message::status_failed. Very rarely should "false" be returned from this method. |
405 | 405 | */ |
406 | - protected function _assemble_messages( $addressees, $templates, EE_Message_Template_Group $message_template_group ) { |
|
406 | + protected function _assemble_messages($addressees, $templates, EE_Message_Template_Group $message_template_group) { |
|
407 | 407 | |
408 | 408 | //if templates are empty then get out because we can't generate anything. |
409 | - if ( ! $templates ) { |
|
410 | - $this->_error_msg[] = __( 'Unable to assemble messages because there are no templates retrieved for generating the messages with', 'event_espresso' ); |
|
409 | + if ( ! $templates) { |
|
410 | + $this->_error_msg[] = __('Unable to assemble messages because there are no templates retrieved for generating the messages with', 'event_espresso'); |
|
411 | 411 | return false; |
412 | 412 | } |
413 | 413 | |
414 | 414 | //We use this as the counter for generated messages because don't forget we may be executing this inside of a |
415 | 415 | //generation_queue. So _ready_queue may have generated EE_Message objects already. |
416 | 416 | $generated_count = 0; |
417 | - foreach ( $addressees as $context => $recipients ) { |
|
418 | - foreach ( $recipients as $recipient ) { |
|
419 | - $message = $this->_setup_message_object( $context, $recipient, $templates, $message_template_group ); |
|
420 | - if ( $message instanceof EE_Message ) { |
|
417 | + foreach ($addressees as $context => $recipients) { |
|
418 | + foreach ($recipients as $recipient) { |
|
419 | + $message = $this->_setup_message_object($context, $recipient, $templates, $message_template_group); |
|
420 | + if ($message instanceof EE_Message) { |
|
421 | 421 | $this->_ready_queue->add( |
422 | 422 | $message, |
423 | 423 | array(), |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | } |
429 | 429 | |
430 | 430 | //if the current MSG being generated is for a test send then we'll only use ONE message in the generation. |
431 | - if ( $this->_generation_queue->get_message_repository()->is_test_send() ) { |
|
431 | + if ($this->_generation_queue->get_message_repository()->is_test_send()) { |
|
432 | 432 | break 2; |
433 | 433 | } |
434 | 434 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | ) { |
458 | 458 | //stuff we already know |
459 | 459 | $transaction_id = $recipient->txn instanceof EE_Transaction ? $recipient->txn->ID() : 0; |
460 | - $transaction_id = empty( $transaction_id ) && $this->_current_data_handler->txn instanceof EE_Transaction |
|
460 | + $transaction_id = empty($transaction_id) && $this->_current_data_handler->txn instanceof EE_Transaction |
|
461 | 461 | ? $this->_current_data_handler->txn->ID() |
462 | 462 | : $transaction_id; |
463 | 463 | $message_fields = array( |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | |
471 | 471 | //recipient id and type should be on the EE_Messages_Addressee object but if this is empty, let's try to grab the |
472 | 472 | //info from the att_obj found in the EE_Messages_Addressee object. |
473 | - if ( empty( $recipient->recipient_id ) || empty( $recipient->recipient_type ) ) { |
|
473 | + if (empty($recipient->recipient_id) || empty($recipient->recipient_type)) { |
|
474 | 474 | $message_fields['MSG_recipient_ID'] = $recipient->att_obj instanceof EE_Attendee |
475 | 475 | ? $recipient->att_obj->ID() |
476 | 476 | : 0; |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | $message_fields['MSG_recipient_ID'] = $recipient->recipient_id; |
480 | 480 | $message_fields['MSG_recipient_type'] = $recipient->recipient_type; |
481 | 481 | } |
482 | - $message = EE_Message_Factory::create( $message_fields ); |
|
482 | + $message = EE_Message_Factory::create($message_fields); |
|
483 | 483 | |
484 | 484 | //grab valid shortcodes for shortcode parser |
485 | 485 | $mt_shortcodes = $this->_current_message_type->get_valid_shortcodes(); |
@@ -487,43 +487,43 @@ discard block |
||
487 | 487 | |
488 | 488 | //if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because that means this |
489 | 489 | //context is turned off) EXCEPT if we're previewing |
490 | - if ( empty( $templates['to'][ $context ] ) |
|
490 | + if (empty($templates['to'][$context]) |
|
491 | 491 | && ! $this->_generation_queue->get_message_repository()->is_preview() |
492 | - && ! $this->_current_messenger->allow_empty_to_field() ) { |
|
492 | + && ! $this->_current_messenger->allow_empty_to_field()) { |
|
493 | 493 | //we silently exit here and do NOT record a fail because the message is "turned off" by having no "to" field. |
494 | 494 | return false; |
495 | 495 | } |
496 | 496 | $error_msg = array(); |
497 | - foreach ( $templates as $field => $field_context ) { |
|
497 | + foreach ($templates as $field => $field_context) { |
|
498 | 498 | $error_msg = array(); |
499 | 499 | //let's setup the valid shortcodes for the incoming context. |
500 | - $valid_shortcodes = $mt_shortcodes[ $context ]; |
|
500 | + $valid_shortcodes = $mt_shortcodes[$context]; |
|
501 | 501 | //merge in valid shortcodes for the field. |
502 | - $shortcodes = isset($m_shortcodes[ $field ]) ? $m_shortcodes[ $field ] : $valid_shortcodes; |
|
503 | - if ( isset( $templates[ $field ][ $context ] ) ) { |
|
502 | + $shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes; |
|
503 | + if (isset($templates[$field][$context])) { |
|
504 | 504 | //prefix field. |
505 | - $column_name = 'MSG_' . $field; |
|
505 | + $column_name = 'MSG_'.$field; |
|
506 | 506 | try { |
507 | 507 | $content = $this->_shortcode_parser->parse_message_template( |
508 | - $templates[ $field ][ $context ], |
|
508 | + $templates[$field][$context], |
|
509 | 509 | $recipient, |
510 | 510 | $shortcodes, |
511 | 511 | $this->_current_message_type, |
512 | 512 | $this->_current_messenger, |
513 | 513 | $message ); |
514 | - $message->set_field_or_extra_meta( $column_name, $content ); |
|
515 | - } catch ( EE_Error $e ) { |
|
516 | - $error_msg[] = sprintf( __( 'There was a problem generating the content for the field %s: %s', 'event_espresso' ), $field, $e->getMessage() ); |
|
517 | - $message->set_STS_ID( EEM_Message::status_failed ); |
|
514 | + $message->set_field_or_extra_meta($column_name, $content); |
|
515 | + } catch (EE_Error $e) { |
|
516 | + $error_msg[] = sprintf(__('There was a problem generating the content for the field %s: %s', 'event_espresso'), $field, $e->getMessage()); |
|
517 | + $message->set_STS_ID(EEM_Message::status_failed); |
|
518 | 518 | } |
519 | 519 | } |
520 | 520 | } |
521 | 521 | |
522 | - if ( $message->STS_ID() === EEM_Message::status_failed ) { |
|
523 | - $error_msg = __( 'There were problems generating this message:', 'event_espresso' ) . "\n" . implode( "\n", $error_msg ); |
|
524 | - $message->set_error_message( $error_msg ); |
|
522 | + if ($message->STS_ID() === EEM_Message::status_failed) { |
|
523 | + $error_msg = __('There were problems generating this message:', 'event_espresso')."\n".implode("\n", $error_msg); |
|
524 | + $message->set_error_message($error_msg); |
|
525 | 525 | } else { |
526 | - $message->set_STS_ID( EEM_Message::status_idle ); |
|
526 | + $message->set_STS_ID(EEM_Message::status_idle); |
|
527 | 527 | } |
528 | 528 | return $message; |
529 | 529 | } |
@@ -557,14 +557,14 @@ discard block |
||
557 | 557 | * @param array $addressees Keys correspond to contexts for the message type and values are EE_Messages_Addressee[] |
558 | 558 | * @return bool |
559 | 559 | */ |
560 | - protected function _valid_addressees( $addressees ) { |
|
561 | - if ( ! $addressees || ! is_array( $addressees ) ) { |
|
560 | + protected function _valid_addressees($addressees) { |
|
561 | + if ( ! $addressees || ! is_array($addressees)) { |
|
562 | 562 | return false; |
563 | 563 | } |
564 | 564 | |
565 | - foreach ( $addressees as $addressee_array ) { |
|
566 | - foreach ( $addressee_array as $addressee ) { |
|
567 | - if ( ! $addressee instanceof EE_Messages_Addressee ) { |
|
565 | + foreach ($addressees as $addressee_array) { |
|
566 | + foreach ($addressee_array as $addressee) { |
|
567 | + if ( ! $addressee instanceof EE_Messages_Addressee) { |
|
568 | 568 | return false; |
569 | 569 | } |
570 | 570 | } |
@@ -585,19 +585,19 @@ discard block |
||
585 | 585 | protected function _validate_messenger_and_message_type() { |
586 | 586 | |
587 | 587 | //first are there any existing error messages? If so then return. |
588 | - if ( $this->_error_msg ) { |
|
588 | + if ($this->_error_msg) { |
|
589 | 589 | return false; |
590 | 590 | } |
591 | 591 | /** @type EE_Message $message */ |
592 | 592 | $message = $this->_generation_queue->get_message_repository()->current(); |
593 | 593 | try { |
594 | - $this->_current_messenger = $message->valid_messenger( true ) ? $message->messenger_object() : null; |
|
595 | - } catch ( Exception $e ) { |
|
594 | + $this->_current_messenger = $message->valid_messenger(true) ? $message->messenger_object() : null; |
|
595 | + } catch (Exception $e) { |
|
596 | 596 | $this->_error_msg[] = $e->getMessage(); |
597 | 597 | } |
598 | 598 | try { |
599 | - $this->_current_message_type = $message->valid_message_type( true ) ? $message->message_type_object() : null; |
|
600 | - } catch ( Exception $e ) { |
|
599 | + $this->_current_message_type = $message->valid_message_type(true) ? $message->message_type_object() : null; |
|
600 | + } catch (Exception $e) { |
|
601 | 601 | $this->_error_msg[] = $e->getMessage(); |
602 | 602 | } |
603 | 603 | |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | ! $this->_generation_queue->get_message_repository()->is_preview() |
610 | 610 | && $this->_generation_queue->get_message_repository()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' ) |
611 | 611 | ) { |
612 | - $this->_error_msg[] = __( 'There is no generation data for this message. Unable to generate.' ); |
|
612 | + $this->_error_msg[] = __('There is no generation data for this message. Unable to generate.'); |
|
613 | 613 | } |
614 | 614 | |
615 | - return empty( $this->_error_msg ); |
|
615 | + return empty($this->_error_msg); |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | |
630 | 630 | //First, are there any existing error messages? If so, return because if there were errors elsewhere this can't |
631 | 631 | //be used anyways. |
632 | - if ( $this->_error_msg ) { |
|
632 | + if ($this->_error_msg) { |
|
633 | 633 | return false; |
634 | 634 | } |
635 | 635 | |
@@ -638,29 +638,29 @@ discard block |
||
638 | 638 | /** @type EE_Messages_incoming_data $data_handler_class_name - well not really... just the class name actually */ |
639 | 639 | $data_handler_class_name = $this->_generation_queue->get_message_repository()->get_data_handler() |
640 | 640 | ? $this->_generation_queue->get_message_repository()->get_data_handler() |
641 | - : 'EE_Messages_' . $this->_current_message_type->get_data_handler( $generation_data ) . '_incoming_data'; |
|
641 | + : 'EE_Messages_'.$this->_current_message_type->get_data_handler($generation_data).'_incoming_data'; |
|
642 | 642 | |
643 | 643 | //If this EE_Message is for a preview, then let's switch out to the preview data handler. |
644 | - if ( $this->_generation_queue->get_message_repository()->is_preview() ) { |
|
645 | - $data_handler_class_name = 'EE_Messages_Preview_incoming_data'; |
|
644 | + if ($this->_generation_queue->get_message_repository()->is_preview()) { |
|
645 | + $data_handler_class_name = 'EE_Messages_Preview_incoming_data'; |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | //First get the class name for the data handler (and also verifies it exists. |
649 | - if ( ! class_exists( $data_handler_class_name ) ) { |
|
649 | + if ( ! class_exists($data_handler_class_name)) { |
|
650 | 650 | $this->_error_msg[] = sprintf( |
651 | - __( 'The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes. Looking for %s.', 'event_espresso' ), |
|
651 | + __('The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes. Looking for %s.', 'event_espresso'), |
|
652 | 652 | $data_handler_class_name |
653 | 653 | ); |
654 | 654 | return false; |
655 | 655 | } |
656 | 656 | |
657 | 657 | //convert generation_data for data_handler_instantiation. |
658 | - $generation_data = $data_handler_class_name::convert_data_from_persistent_storage( $generation_data ); |
|
658 | + $generation_data = $data_handler_class_name::convert_data_from_persistent_storage($generation_data); |
|
659 | 659 | |
660 | 660 | //note, this may set error messages as well. |
661 | - $this->_set_data_handler( $generation_data, $data_handler_class_name ); |
|
661 | + $this->_set_data_handler($generation_data, $data_handler_class_name); |
|
662 | 662 | |
663 | - return empty( $this->_error_msg ); |
|
663 | + return empty($this->_error_msg); |
|
664 | 664 | } |
665 | 665 | |
666 | 666 | |
@@ -677,16 +677,16 @@ discard block |
||
677 | 677 | * |
678 | 678 | * @return void. |
679 | 679 | */ |
680 | - protected function _set_data_handler( $generating_data, $data_handler_class_name ) { |
|
680 | + protected function _set_data_handler($generating_data, $data_handler_class_name) { |
|
681 | 681 | //valid classname for the data handler. Now let's setup the key for the data handler repository to see if there |
682 | 682 | //is already a ready data handler in the repository. |
683 | - $this->_current_data_handler = $this->_data_handler_collection->get_by_key( $this->_data_handler_collection->get_key( $data_handler_class_name, $generating_data ) ); |
|
684 | - if ( ! $this->_current_data_handler instanceof EE_Messages_incoming_data ) { |
|
683 | + $this->_current_data_handler = $this->_data_handler_collection->get_by_key($this->_data_handler_collection->get_key($data_handler_class_name, $generating_data)); |
|
684 | + if ( ! $this->_current_data_handler instanceof EE_Messages_incoming_data) { |
|
685 | 685 | //no saved data_handler in the repo so let's set one up and add it to the repo. |
686 | 686 | try { |
687 | - $this->_current_data_handler = new $data_handler_class_name( $generating_data ); |
|
688 | - $this->_data_handler_collection->add( $this->_current_data_handler, $generating_data ); |
|
689 | - } catch( EE_Error $e ) { |
|
687 | + $this->_current_data_handler = new $data_handler_class_name($generating_data); |
|
688 | + $this->_data_handler_collection->add($this->_current_data_handler, $generating_data); |
|
689 | + } catch (EE_Error $e) { |
|
690 | 690 | $this->_error_msg[] = $e->get_error(); |
691 | 691 | } |
692 | 692 | } |
@@ -706,13 +706,13 @@ discard block |
||
706 | 706 | * @param bool $preview Indicate whether this is being used for a preview or not. |
707 | 707 | * @return mixed Prepped data for persisting to the queue. false is returned if unable to prep data. |
708 | 708 | */ |
709 | - protected function _prepare_data_for_queue( EE_Message_To_Generate $message_to_generate, $preview ) { |
|
709 | + protected function _prepare_data_for_queue(EE_Message_To_Generate $message_to_generate, $preview) { |
|
710 | 710 | /** @type EE_Messages_incoming_data $data_handler - well not really... just the class name actually */ |
711 | - $data_handler = $message_to_generate->get_data_handler_class_name( $preview ); |
|
712 | - if ( ! $message_to_generate->valid() ) { |
|
711 | + $data_handler = $message_to_generate->get_data_handler_class_name($preview); |
|
712 | + if ( ! $message_to_generate->valid()) { |
|
713 | 713 | return false; //unable to get the data because the info in the EE_Message_To_Generate class is invalid. |
714 | 714 | } |
715 | - return $data_handler::convert_data_for_persistent_storage( $message_to_generate->data() ); |
|
715 | + return $data_handler::convert_data_for_persistent_storage($message_to_generate->data()); |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | |
@@ -725,26 +725,26 @@ discard block |
||
725 | 725 | * @param EE_Message_To_Generate $message_to_generate |
726 | 726 | * @param bool $test_send Whether this is just a test send or not. Typically used for previews. |
727 | 727 | */ |
728 | - public function create_and_add_message_to_queue( EE_Message_To_Generate $message_to_generate, $test_send = false ) { |
|
728 | + public function create_and_add_message_to_queue(EE_Message_To_Generate $message_to_generate, $test_send = false) { |
|
729 | 729 | //prep data |
730 | - $data = $this->_prepare_data_for_queue( $message_to_generate, $message_to_generate->preview() ); |
|
730 | + $data = $this->_prepare_data_for_queue($message_to_generate, $message_to_generate->preview()); |
|
731 | 731 | |
732 | 732 | $message = $message_to_generate->get_EE_Message(); |
733 | 733 | |
734 | 734 | //is there a GRP_ID in the request? |
735 | - if ( $GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID' ) ) { |
|
736 | - $message->set_GRP_ID( $GRP_ID ); |
|
735 | + if ($GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID')) { |
|
736 | + $message->set_GRP_ID($GRP_ID); |
|
737 | 737 | } |
738 | 738 | |
739 | - if ( $data === false ) { |
|
740 | - $message->set_STS_ID( EEM_Message::status_failed ); |
|
741 | - $message->set_error_message( __( 'Unable to prepare data for persistence to the database.', 'event_espresso' ) ); |
|
739 | + if ($data === false) { |
|
740 | + $message->set_STS_ID(EEM_Message::status_failed); |
|
741 | + $message->set_error_message(__('Unable to prepare data for persistence to the database.', 'event_espresso')); |
|
742 | 742 | } else { |
743 | 743 | //make sure that the data handler is cached on the message as well |
744 | 744 | $data['data_handler_class_name'] = $message_to_generate->get_data_handler_class_name(); |
745 | 745 | } |
746 | 746 | |
747 | - $this->_generation_queue->add( $message, $data, $message_to_generate->preview(), $test_send ); |
|
747 | + $this->_generation_queue->add($message, $data, $message_to_generate->preview(), $test_send); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * EEH_Activation Helper |
4 | 4 | * |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * @return \EventEspresso\core\services\database\TableAnalysis |
55 | 55 | */ |
56 | 56 | public static function getTableAnalysis() { |
57 | - if ( ! self::$table_analysis instanceof \EventEspresso\core\services\database\TableAnalysis ) { |
|
58 | - self::$table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
|
57 | + if ( ! self::$table_analysis instanceof \EventEspresso\core\services\database\TableAnalysis) { |
|
58 | + self::$table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
|
59 | 59 | } |
60 | 60 | return self::$table_analysis; |
61 | 61 | } |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @return \EventEspresso\core\services\database\TableManager |
67 | 67 | */ |
68 | 68 | public static function getTableManager() { |
69 | - if ( ! self::$table_manager instanceof \EventEspresso\core\services\database\TableManager ) { |
|
70 | - self::$table_manager = EE_Registry::instance()->create( 'TableManager', array(), true ); |
|
69 | + if ( ! self::$table_manager instanceof \EventEspresso\core\services\database\TableManager) { |
|
70 | + self::$table_manager = EE_Registry::instance()->create('TableManager', array(), true); |
|
71 | 71 | } |
72 | 72 | return self::$table_manager; |
73 | 73 | } |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @param $table_name |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - public static function ensure_table_name_has_prefix( $table_name ) { |
|
86 | - return \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( $table_name ); |
|
85 | + public static function ensure_table_name_has_prefix($table_name) { |
|
86 | + return \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix($table_name); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @return boolean success, whether the database and folders are setup properly |
112 | 112 | * @throws \EE_Error |
113 | 113 | */ |
114 | - public static function initialize_db_and_folders(){ |
|
114 | + public static function initialize_db_and_folders() { |
|
115 | 115 | $good_filesystem = EEH_Activation::create_upload_directories(); |
116 | 116 | $good_db = EEH_Activation::create_database_tables(); |
117 | 117 | return $good_filesystem && $good_db; |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @throws \EE_Error |
129 | 129 | */ |
130 | - public static function initialize_db_content(){ |
|
130 | + public static function initialize_db_content() { |
|
131 | 131 | //let's avoid doing all this logic repeatedly, especially when addons are requesting it |
132 | - if( EEH_Activation::$_initialized_db_content_already_in_this_request ) { |
|
132 | + if (EEH_Activation::$_initialized_db_content_already_in_this_request) { |
|
133 | 133 | return; |
134 | 134 | } |
135 | 135 | EEH_Activation::$_initialized_db_content_already_in_this_request = true; |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | EEH_Activation::remove_cron_tasks(); |
147 | 147 | EEH_Activation::create_cron_tasks(); |
148 | 148 | // remove all TXN locks since that is being done via extra meta now |
149 | - delete_option( 'ee_locked_transactions' ); |
|
149 | + delete_option('ee_locked_transactions'); |
|
150 | 150 | //also, check for CAF default db content |
151 | - do_action( 'AHEE__EEH_Activation__initialize_db_content' ); |
|
151 | + do_action('AHEE__EEH_Activation__initialize_db_content'); |
|
152 | 152 | //also: EEM_Gateways::load_all_gateways() outputs a lot of success messages |
153 | 153 | //which users really won't care about on initial activation |
154 | 154 | EE_Error::overwrite_success(); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * @return array |
169 | 169 | * @throws \EE_Error |
170 | 170 | */ |
171 | - public static function get_cron_tasks( $which_to_include ) { |
|
171 | + public static function get_cron_tasks($which_to_include) { |
|
172 | 172 | $cron_tasks = apply_filters( |
173 | 173 | 'FHEE__EEH_Activation__get_cron_tasks', |
174 | 174 | array( |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | 'AHEE__EE_Cron_Tasks__update_transaction_with_payment' => EEH_Activation::cron_task_no_longer_in_use, //there may have been a bug which prevented from these cron tasks from getting unscheduled, so we might want to remove these for a few updates |
178 | 178 | ) |
179 | 179 | ); |
180 | - if ( $which_to_include === 'old' ) { |
|
180 | + if ($which_to_include === 'old') { |
|
181 | 181 | $cron_tasks = array_filter( |
182 | 182 | $cron_tasks, |
183 | - function ( $value ) { |
|
183 | + function($value) { |
|
184 | 184 | return $value === EEH_Activation::cron_task_no_longer_in_use; |
185 | 185 | } |
186 | 186 | ); |
187 | - } elseif ( $which_to_include === 'current' ) { |
|
188 | - $cron_tasks = array_filter( $cron_tasks ); |
|
189 | - } elseif ( WP_DEBUG && $which_to_include !== 'all' ) { |
|
187 | + } elseif ($which_to_include === 'current') { |
|
188 | + $cron_tasks = array_filter($cron_tasks); |
|
189 | + } elseif (WP_DEBUG && $which_to_include !== 'all') { |
|
190 | 190 | throw new EE_Error( |
191 | 191 | sprintf( |
192 | 192 | __( |
@@ -209,9 +209,9 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public static function create_cron_tasks() { |
211 | 211 | |
212 | - foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) { |
|
213 | - if( ! wp_next_scheduled( $hook_name ) ) { |
|
214 | - wp_schedule_event( time(), $frequency, $hook_name ); |
|
212 | + foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) { |
|
213 | + if ( ! wp_next_scheduled($hook_name)) { |
|
214 | + wp_schedule_event(time(), $frequency, $hook_name); |
|
215 | 215 | } |
216 | 216 | } |
217 | 217 | |
@@ -225,10 +225,10 @@ discard block |
||
225 | 225 | * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones |
226 | 226 | * @throws \EE_Error |
227 | 227 | */ |
228 | - public static function remove_cron_tasks( $remove_all = true ) { |
|
228 | + public static function remove_cron_tasks($remove_all = true) { |
|
229 | 229 | $cron_tasks_to_remove = $remove_all ? 'all' : 'old'; |
230 | 230 | $crons = _get_cron_array(); |
231 | - $crons = is_array( $crons ) ? $crons : array(); |
|
231 | + $crons = is_array($crons) ? $crons : array(); |
|
232 | 232 | /* reminder of what $crons look like: |
233 | 233 | * Top-level keys are timestamps, and their values are arrays. |
234 | 234 | * The 2nd level arrays have keys with each of the cron task hook names to run at that time |
@@ -246,23 +246,23 @@ discard block |
||
246 | 246 | * ... |
247 | 247 | * ... |
248 | 248 | */ |
249 | - $ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks( $cron_tasks_to_remove ); |
|
250 | - foreach ( $crons as $timestamp => $hooks_to_fire_at_time ) { |
|
251 | - if ( is_array( $hooks_to_fire_at_time ) ) { |
|
252 | - foreach ( $hooks_to_fire_at_time as $hook_name => $hook_actions ) { |
|
253 | - if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
254 | - && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
249 | + $ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks($cron_tasks_to_remove); |
|
250 | + foreach ($crons as $timestamp => $hooks_to_fire_at_time) { |
|
251 | + if (is_array($hooks_to_fire_at_time)) { |
|
252 | + foreach ($hooks_to_fire_at_time as $hook_name => $hook_actions) { |
|
253 | + if (isset($ee_cron_tasks_to_remove[$hook_name]) |
|
254 | + && is_array($ee_cron_tasks_to_remove[$hook_name]) |
|
255 | 255 | ) { |
256 | - unset( $crons[ $timestamp ][ $hook_name ] ); |
|
256 | + unset($crons[$timestamp][$hook_name]); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | //also take care of any empty cron timestamps. |
260 | - if ( empty( $hooks_to_fire_at_time ) ) { |
|
261 | - unset( $crons[ $timestamp ] ); |
|
260 | + if (empty($hooks_to_fire_at_time)) { |
|
261 | + unset($crons[$timestamp]); |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | } |
265 | - _set_cron_array( $crons ); |
|
265 | + _set_cron_array($crons); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public static function CPT_initialization() { |
279 | 279 | // register Custom Post Types |
280 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
280 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
281 | 281 | flush_rewrite_rules(); |
282 | 282 | } |
283 | 283 | |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | * @return void |
296 | 296 | */ |
297 | 297 | public static function reset_and_update_config() { |
298 | - do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) ); |
|
299 | - add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 ); |
|
298 | + do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config')); |
|
299 | + add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3); |
|
300 | 300 | //EE_Config::reset(); |
301 | 301 | } |
302 | 302 | |
@@ -309,28 +309,28 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public static function load_calendar_config() { |
311 | 311 | // grab array of all plugin folders and loop thru it |
312 | - $plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR ); |
|
313 | - if ( empty( $plugins ) ) { |
|
312 | + $plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR); |
|
313 | + if (empty($plugins)) { |
|
314 | 314 | return; |
315 | 315 | } |
316 | - foreach ( $plugins as $plugin_path ) { |
|
316 | + foreach ($plugins as $plugin_path) { |
|
317 | 317 | // grab plugin folder name from path |
318 | - $plugin = basename( $plugin_path ); |
|
318 | + $plugin = basename($plugin_path); |
|
319 | 319 | // drill down to Espresso plugins |
320 | 320 | // then to calendar related plugins |
321 | 321 | if ( |
322 | - strpos( $plugin, 'espresso' ) !== FALSE |
|
323 | - || strpos( $plugin, 'Espresso' ) !== FALSE |
|
324 | - || strpos( $plugin, 'ee4' ) !== FALSE |
|
325 | - || strpos( $plugin, 'EE4' ) !== FALSE |
|
326 | - || strpos( $plugin, 'calendar' ) !== false |
|
322 | + strpos($plugin, 'espresso') !== FALSE |
|
323 | + || strpos($plugin, 'Espresso') !== FALSE |
|
324 | + || strpos($plugin, 'ee4') !== FALSE |
|
325 | + || strpos($plugin, 'EE4') !== FALSE |
|
326 | + || strpos($plugin, 'calendar') !== false |
|
327 | 327 | ) { |
328 | 328 | // this is what we are looking for |
329 | - $calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php'; |
|
329 | + $calendar_config = $plugin_path.DS.'EE_Calendar_Config.php'; |
|
330 | 330 | // does it exist in this folder ? |
331 | - if ( is_readable( $calendar_config )) { |
|
331 | + if (is_readable($calendar_config)) { |
|
332 | 332 | // YEAH! let's load it |
333 | - require_once( $calendar_config ); |
|
333 | + require_once($calendar_config); |
|
334 | 334 | } |
335 | 335 | } |
336 | 336 | } |
@@ -346,21 +346,21 @@ discard block |
||
346 | 346 | * @param \EE_Config $EE_Config |
347 | 347 | * @return \stdClass |
348 | 348 | */ |
349 | - public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) { |
|
350 | - $convert_from_array = array( 'addons' ); |
|
349 | + public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) { |
|
350 | + $convert_from_array = array('addons'); |
|
351 | 351 | // in case old settings were saved as an array |
352 | - if ( is_array( $settings ) && in_array( $config, $convert_from_array )) { |
|
352 | + if (is_array($settings) && in_array($config, $convert_from_array)) { |
|
353 | 353 | // convert existing settings to an object |
354 | 354 | $config_array = $settings; |
355 | 355 | $settings = new stdClass(); |
356 | - foreach ( $config_array as $key => $value ){ |
|
357 | - if ( $key === 'calendar' && class_exists( 'EE_Calendar_Config' )) { |
|
358 | - $EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value ); |
|
356 | + foreach ($config_array as $key => $value) { |
|
357 | + if ($key === 'calendar' && class_exists('EE_Calendar_Config')) { |
|
358 | + $EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value); |
|
359 | 359 | } else { |
360 | 360 | $settings->{$key} = $value; |
361 | 361 | } |
362 | 362 | } |
363 | - add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' ); |
|
363 | + add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true'); |
|
364 | 364 | } |
365 | 365 | return $settings; |
366 | 366 | } |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | */ |
377 | 377 | public static function deactivate_event_espresso() { |
378 | 378 | // check permissions |
379 | - if ( current_user_can( 'activate_plugins' )) { |
|
380 | - deactivate_plugins( EE_PLUGIN_BASENAME, TRUE ); |
|
379 | + if (current_user_can('activate_plugins')) { |
|
380 | + deactivate_plugins(EE_PLUGIN_BASENAME, TRUE); |
|
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
@@ -399,25 +399,25 @@ discard block |
||
399 | 399 | $critical_pages = array( |
400 | 400 | array( |
401 | 401 | 'id' =>'reg_page_id', |
402 | - 'name' => __( 'Registration Checkout', 'event_espresso' ), |
|
402 | + 'name' => __('Registration Checkout', 'event_espresso'), |
|
403 | 403 | 'post' => NULL, |
404 | 404 | 'code' => 'ESPRESSO_CHECKOUT' |
405 | 405 | ), |
406 | 406 | array( |
407 | 407 | 'id' => 'txn_page_id', |
408 | - 'name' => __( 'Transactions', 'event_espresso' ), |
|
408 | + 'name' => __('Transactions', 'event_espresso'), |
|
409 | 409 | 'post' => NULL, |
410 | 410 | 'code' => 'ESPRESSO_TXN_PAGE' |
411 | 411 | ), |
412 | 412 | array( |
413 | 413 | 'id' => 'thank_you_page_id', |
414 | - 'name' => __( 'Thank You', 'event_espresso' ), |
|
414 | + 'name' => __('Thank You', 'event_espresso'), |
|
415 | 415 | 'post' => NULL, |
416 | 416 | 'code' => 'ESPRESSO_THANK_YOU' |
417 | 417 | ), |
418 | 418 | array( |
419 | 419 | 'id' => 'cancel_page_id', |
420 | - 'name' => __( 'Registration Cancelled', 'event_espresso' ), |
|
420 | + 'name' => __('Registration Cancelled', 'event_espresso'), |
|
421 | 421 | 'post' => NULL, |
422 | 422 | 'code' => 'ESPRESSO_CANCELLED' |
423 | 423 | ), |
@@ -425,62 +425,62 @@ discard block |
||
425 | 425 | |
426 | 426 | $EE_Core_Config = EE_Registry::instance()->CFG->core; |
427 | 427 | |
428 | - foreach ( $critical_pages as $critical_page ) { |
|
428 | + foreach ($critical_pages as $critical_page) { |
|
429 | 429 | // is critical page ID set in config ? |
430 | - if ( $EE_Core_Config->{$critical_page[ 'id' ]} !== FALSE ) { |
|
430 | + if ($EE_Core_Config->{$critical_page['id']} !== FALSE) { |
|
431 | 431 | // attempt to find post by ID |
432 | - $critical_page['post'] = get_post( $EE_Core_Config->{$critical_page[ 'id' ]} ); |
|
432 | + $critical_page['post'] = get_post($EE_Core_Config->{$critical_page['id']} ); |
|
433 | 433 | } |
434 | 434 | // no dice? |
435 | - if ( $critical_page['post'] === null ) { |
|
435 | + if ($critical_page['post'] === null) { |
|
436 | 436 | // attempt to find post by title |
437 | - $critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] ); |
|
437 | + $critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']); |
|
438 | 438 | // still nothing? |
439 | - if ( $critical_page['post'] === null ) { |
|
440 | - $critical_page = EEH_Activation::create_critical_page( $critical_page ); |
|
439 | + if ($critical_page['post'] === null) { |
|
440 | + $critical_page = EEH_Activation::create_critical_page($critical_page); |
|
441 | 441 | // REALLY? Still nothing ??!?!? |
442 | - if ( $critical_page['post'] === null ) { |
|
443 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
444 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
442 | + if ($critical_page['post'] === null) { |
|
443 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
444 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
445 | 445 | break; |
446 | 446 | } |
447 | 447 | } |
448 | 448 | } |
449 | 449 | // track post_shortcodes |
450 | - if ( $critical_page['post'] ) { |
|
451 | - EEH_Activation::_track_critical_page_post_shortcodes( $critical_page ); |
|
450 | + if ($critical_page['post']) { |
|
451 | + EEH_Activation::_track_critical_page_post_shortcodes($critical_page); |
|
452 | 452 | } |
453 | 453 | // check that Post ID matches critical page ID in config |
454 | 454 | if ( |
455 | - isset( $critical_page['post']->ID ) |
|
456 | - && $critical_page['post']->ID !== $EE_Core_Config->{$critical_page[ 'id' ]} |
|
455 | + isset($critical_page['post']->ID) |
|
456 | + && $critical_page['post']->ID !== $EE_Core_Config->{$critical_page['id']} |
|
457 | 457 | ) { |
458 | 458 | //update Config with post ID |
459 | - $EE_Core_Config->{$critical_page[ 'id' ]} = $critical_page['post']->ID; |
|
460 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) { |
|
461 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
462 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
459 | + $EE_Core_Config->{$critical_page['id']} = $critical_page['post']->ID; |
|
460 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
461 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
462 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
463 | 463 | } |
464 | 464 | } |
465 | 465 | |
466 | 466 | $critical_page_problem = |
467 | - ! isset( $critical_page['post']->post_status ) |
|
467 | + ! isset($critical_page['post']->post_status) |
|
468 | 468 | || $critical_page['post']->post_status !== 'publish' |
469 | - || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE |
|
469 | + || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE |
|
470 | 470 | ? TRUE |
471 | 471 | : $critical_page_problem; |
472 | 472 | |
473 | 473 | } |
474 | 474 | |
475 | - if ( $critical_page_problem ) { |
|
475 | + if ($critical_page_problem) { |
|
476 | 476 | $msg = sprintf( |
477 | - __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ), |
|
478 | - '<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>' |
|
477 | + __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'), |
|
478 | + '<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>' |
|
479 | 479 | ); |
480 | - EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg ); |
|
480 | + EE_Error::add_persistent_admin_notice('critical_page_problem', $msg); |
|
481 | 481 | } |
482 | - if ( EE_Error::has_notices() ) { |
|
483 | - EE_Error::get_notices( FALSE, TRUE, TRUE ); |
|
482 | + if (EE_Error::has_notices()) { |
|
483 | + EE_Error::get_notices(FALSE, TRUE, TRUE); |
|
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
@@ -492,13 +492,13 @@ discard block |
||
492 | 492 | * parameter to the shortcode |
493 | 493 | * @return WP_Post or NULl |
494 | 494 | */ |
495 | - public static function get_page_by_ee_shortcode($ee_shortcode){ |
|
495 | + public static function get_page_by_ee_shortcode($ee_shortcode) { |
|
496 | 496 | global $wpdb; |
497 | 497 | $shortcode_and_opening_bracket = '['.$ee_shortcode; |
498 | 498 | $post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1"); |
499 | - if($post_id){ |
|
499 | + if ($post_id) { |
|
500 | 500 | return get_post($post_id); |
501 | - }else{ |
|
501 | + } else { |
|
502 | 502 | return NULL; |
503 | 503 | } |
504 | 504 | |
@@ -515,32 +515,32 @@ discard block |
||
515 | 515 | * @param array $critical_page |
516 | 516 | * @return array |
517 | 517 | */ |
518 | - public static function create_critical_page( $critical_page ) { |
|
518 | + public static function create_critical_page($critical_page) { |
|
519 | 519 | |
520 | 520 | $post_args = array( |
521 | 521 | 'post_title' => $critical_page['name'], |
522 | 522 | 'post_status' => 'publish', |
523 | 523 | 'post_type' => 'page', |
524 | 524 | 'comment_status' => 'closed', |
525 | - 'post_content' => '[' . $critical_page['code'] . ']' |
|
525 | + 'post_content' => '['.$critical_page['code'].']' |
|
526 | 526 | ); |
527 | 527 | |
528 | - $post_id = wp_insert_post( $post_args ); |
|
529 | - if ( ! $post_id ) { |
|
528 | + $post_id = wp_insert_post($post_args); |
|
529 | + if ( ! $post_id) { |
|
530 | 530 | $msg = sprintf( |
531 | - __( 'The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso' ), |
|
531 | + __('The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso'), |
|
532 | 532 | $critical_page['name'] |
533 | 533 | ); |
534 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
534 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
535 | 535 | return $critical_page; |
536 | 536 | } |
537 | 537 | // get newly created post's details |
538 | - if ( ! $critical_page['post'] = get_post( $post_id )) { |
|
538 | + if ( ! $critical_page['post'] = get_post($post_id)) { |
|
539 | 539 | $msg = sprintf( |
540 | - __( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ), |
|
540 | + __('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'), |
|
541 | 541 | $critical_page['name'] |
542 | 542 | ); |
543 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
543 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | return $critical_page; |
@@ -559,35 +559,35 @@ discard block |
||
559 | 559 | * @param array $critical_page |
560 | 560 | * @return void |
561 | 561 | */ |
562 | - private static function _track_critical_page_post_shortcodes( $critical_page = array() ) { |
|
562 | + private static function _track_critical_page_post_shortcodes($critical_page = array()) { |
|
563 | 563 | // check the goods |
564 | - if ( ! $critical_page['post'] instanceof WP_Post ) { |
|
564 | + if ( ! $critical_page['post'] instanceof WP_Post) { |
|
565 | 565 | $msg = sprintf( |
566 | - __( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ), |
|
566 | + __('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'), |
|
567 | 567 | $critical_page['name'] |
568 | 568 | ); |
569 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
569 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
570 | 570 | return; |
571 | 571 | } |
572 | 572 | $EE_Core_Config = EE_Registry::instance()->CFG->core; |
573 | 573 | // map shortcode to post |
574 | - $EE_Core_Config->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID; |
|
574 | + $EE_Core_Config->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID; |
|
575 | 575 | // and make sure it's NOT added to the WP "Posts Page" |
576 | 576 | // name of the WP Posts Page |
577 | 577 | $posts_page = EE_Config::get_page_for_posts(); |
578 | - if ( isset( $EE_Core_Config->post_shortcodes[ $posts_page ] )) { |
|
579 | - unset( $EE_Core_Config->post_shortcodes[ $posts_page ][ $critical_page['code'] ] ); |
|
578 | + if (isset($EE_Core_Config->post_shortcodes[$posts_page])) { |
|
579 | + unset($EE_Core_Config->post_shortcodes[$posts_page][$critical_page['code']]); |
|
580 | 580 | } |
581 | - if ( $posts_page !== 'posts' && isset( $EE_Core_Config->post_shortcodes['posts'] )) { |
|
582 | - unset( $EE_Core_Config->post_shortcodes['posts'][ $critical_page['code'] ] ); |
|
581 | + if ($posts_page !== 'posts' && isset($EE_Core_Config->post_shortcodes['posts'])) { |
|
582 | + unset($EE_Core_Config->post_shortcodes['posts'][$critical_page['code']]); |
|
583 | 583 | } |
584 | 584 | // update post_shortcode CFG |
585 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) { |
|
585 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
586 | 586 | $msg = sprintf( |
587 | - __( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ), |
|
587 | + __('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'), |
|
588 | 588 | $critical_page['name'] |
589 | 589 | ); |
590 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
590 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
591 | 591 | } |
592 | 592 | } |
593 | 593 | |
@@ -605,24 +605,24 @@ discard block |
||
605 | 605 | public static function get_default_creator_id() { |
606 | 606 | global $wpdb; |
607 | 607 | |
608 | - if ( ! empty( self::$_default_creator_id ) ) { |
|
608 | + if ( ! empty(self::$_default_creator_id)) { |
|
609 | 609 | return self::$_default_creator_id; |
610 | 610 | }/**/ |
611 | 611 | |
612 | - $role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' ); |
|
612 | + $role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator'); |
|
613 | 613 | |
614 | 614 | //let's allow pre_filtering for early exits by alternative methods for getting id. We check for truthy result and if so then exit early. |
615 | - $pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check ); |
|
616 | - if ( $pre_filtered_id !== false ) { |
|
615 | + $pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check); |
|
616 | + if ($pre_filtered_id !== false) { |
|
617 | 617 | return (int) $pre_filtered_id; |
618 | 618 | } |
619 | 619 | |
620 | - $capabilities_key = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'capabilities' ); |
|
621 | - $query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' ); |
|
622 | - $user_id = $wpdb->get_var( $query ); |
|
623 | - $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id ); |
|
624 | - if ( $user_id && (int)$user_id ) { |
|
625 | - self::$_default_creator_id = (int)$user_id; |
|
620 | + $capabilities_key = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix('capabilities'); |
|
621 | + $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%'); |
|
622 | + $user_id = $wpdb->get_var($query); |
|
623 | + $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id); |
|
624 | + if ($user_id && (int) $user_id) { |
|
625 | + self::$_default_creator_id = (int) $user_id; |
|
626 | 626 | return self::$_default_creator_id; |
627 | 627 | } else { |
628 | 628 | return NULL; |
@@ -651,28 +651,28 @@ discard block |
||
651 | 651 | * @return void |
652 | 652 | * @throws EE_Error if there are database errors |
653 | 653 | */ |
654 | - public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) { |
|
655 | - if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){ |
|
654 | + public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) { |
|
655 | + if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) { |
|
656 | 656 | return; |
657 | 657 | } |
658 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
659 | - if ( ! function_exists( 'dbDelta' )) { |
|
660 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
658 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
659 | + if ( ! function_exists('dbDelta')) { |
|
660 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
661 | 661 | } |
662 | 662 | $tableAnalysis = \EEH_Activation::getTableAnalysis(); |
663 | - $wp_table_name = $tableAnalysis->ensureTableNameHasPrefix( $table_name ); |
|
663 | + $wp_table_name = $tableAnalysis->ensureTableNameHasPrefix($table_name); |
|
664 | 664 | // do we need to first delete an existing version of this table ? |
665 | - if ( $drop_pre_existing_table && $tableAnalysis->tableExists( $wp_table_name ) ){ |
|
665 | + if ($drop_pre_existing_table && $tableAnalysis->tableExists($wp_table_name)) { |
|
666 | 666 | // ok, delete the table... but ONLY if it's empty |
667 | - $deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name ); |
|
667 | + $deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name); |
|
668 | 668 | // table is NOT empty, are you SURE you want to delete this table ??? |
669 | - if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){ |
|
670 | - \EEH_Activation::getTableManager()->dropTable( $wp_table_name ); |
|
671 | - } else if ( ! $deleted_safely ) { |
|
669 | + if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) { |
|
670 | + \EEH_Activation::getTableManager()->dropTable($wp_table_name); |
|
671 | + } else if ( ! $deleted_safely) { |
|
672 | 672 | // so we should be more cautious rather than just dropping tables so easily |
673 | 673 | EE_Error::add_persistent_admin_notice( |
674 | - 'bad_table_' . $wp_table_name . '_detected', |
|
675 | - sprintf( __( 'Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ), |
|
674 | + 'bad_table_'.$wp_table_name.'_detected', |
|
675 | + sprintf(__('Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'), |
|
676 | 676 | $wp_table_name, |
677 | 677 | "<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>", |
678 | 678 | '<b>wp-config.php</b>', |
@@ -680,8 +680,8 @@ discard block |
||
680 | 680 | TRUE ); |
681 | 681 | } |
682 | 682 | } |
683 | - $engine = str_replace( 'ENGINE=', '', $engine ); |
|
684 | - \EEH_Activation::getTableManager()->createTable( $table_name, $sql, $engine ); |
|
683 | + $engine = str_replace('ENGINE=', '', $engine); |
|
684 | + \EEH_Activation::getTableManager()->createTable($table_name, $sql, $engine); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | |
@@ -699,8 +699,8 @@ discard block |
||
699 | 699 | * 'VARCHAR(10)' |
700 | 700 | * @return bool|int |
701 | 701 | */ |
702 | - public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){ |
|
703 | - return \EEH_Activation::getTableManager()->addColumn( $table_name, $column_name, $column_info ); |
|
702 | + public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') { |
|
703 | + return \EEH_Activation::getTableManager()->addColumn($table_name, $column_name, $column_info); |
|
704 | 704 | } |
705 | 705 | |
706 | 706 | |
@@ -716,8 +716,8 @@ discard block |
||
716 | 716 | * @param string $table_name, without prefixed $wpdb->prefix |
717 | 717 | * @return array of database column names |
718 | 718 | */ |
719 | - public static function get_fields_on_table( $table_name = NULL ) { |
|
720 | - return \EEH_Activation::getTableManager()->getTableColumns( $table_name ); |
|
719 | + public static function get_fields_on_table($table_name = NULL) { |
|
720 | + return \EEH_Activation::getTableManager()->getTableColumns($table_name); |
|
721 | 721 | } |
722 | 722 | |
723 | 723 | |
@@ -731,8 +731,8 @@ discard block |
||
731 | 731 | * @param string $table_name |
732 | 732 | * @return bool |
733 | 733 | */ |
734 | - public static function db_table_is_empty( $table_name ) { |
|
735 | - return \EEH_Activation::getTableAnalysis()->tableIsEmpty( $table_name ); |
|
734 | + public static function db_table_is_empty($table_name) { |
|
735 | + return \EEH_Activation::getTableAnalysis()->tableIsEmpty($table_name); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | |
@@ -745,9 +745,9 @@ discard block |
||
745 | 745 | * @param string $table_name |
746 | 746 | * @return bool | int |
747 | 747 | */ |
748 | - public static function delete_db_table_if_empty( $table_name ) { |
|
749 | - if ( \EEH_Activation::getTableAnalysis()->tableIsEmpty( $table_name ) ) { |
|
750 | - return \EEH_Activation::getTableManager()->dropTable( $table_name ); |
|
748 | + public static function delete_db_table_if_empty($table_name) { |
|
749 | + if (\EEH_Activation::getTableAnalysis()->tableIsEmpty($table_name)) { |
|
750 | + return \EEH_Activation::getTableManager()->dropTable($table_name); |
|
751 | 751 | } |
752 | 752 | return false; |
753 | 753 | } |
@@ -763,8 +763,8 @@ discard block |
||
763 | 763 | * @param string $table_name |
764 | 764 | * @return bool | int |
765 | 765 | */ |
766 | - public static function delete_unused_db_table( $table_name ) { |
|
767 | - return \EEH_Activation::getTableManager()->dropTable( $table_name ); |
|
766 | + public static function delete_unused_db_table($table_name) { |
|
767 | + return \EEH_Activation::getTableManager()->dropTable($table_name); |
|
768 | 768 | } |
769 | 769 | |
770 | 770 | |
@@ -779,8 +779,8 @@ discard block |
||
779 | 779 | * @param string $index_name |
780 | 780 | * @return bool | int |
781 | 781 | */ |
782 | - public static function drop_index( $table_name, $index_name ) { |
|
783 | - return \EEH_Activation::getTableManager()->dropIndex( $table_name, $index_name ); |
|
782 | + public static function drop_index($table_name, $index_name) { |
|
783 | + return \EEH_Activation::getTableManager()->dropIndex($table_name, $index_name); |
|
784 | 784 | } |
785 | 785 | |
786 | 786 | |
@@ -794,27 +794,27 @@ discard block |
||
794 | 794 | * @return boolean success (whether database is setup properly or not) |
795 | 795 | */ |
796 | 796 | public static function create_database_tables() { |
797 | - EE_Registry::instance()->load_core( 'Data_Migration_Manager' ); |
|
797 | + EE_Registry::instance()->load_core('Data_Migration_Manager'); |
|
798 | 798 | //find the migration script that sets the database to be compatible with the code |
799 | 799 | $dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms(); |
800 | - if( $dms_name ){ |
|
801 | - $current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name ); |
|
802 | - $current_data_migration_script->set_migrating( false ); |
|
800 | + if ($dms_name) { |
|
801 | + $current_data_migration_script = EE_Registry::instance()->load_dms($dms_name); |
|
802 | + $current_data_migration_script->set_migrating(false); |
|
803 | 803 | $current_data_migration_script->schema_changes_before_migration(); |
804 | 804 | $current_data_migration_script->schema_changes_after_migration(); |
805 | - if( $current_data_migration_script->get_errors() ){ |
|
806 | - if( WP_DEBUG ){ |
|
807 | - foreach( $current_data_migration_script->get_errors() as $error ){ |
|
808 | - EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ ); |
|
805 | + if ($current_data_migration_script->get_errors()) { |
|
806 | + if (WP_DEBUG) { |
|
807 | + foreach ($current_data_migration_script->get_errors() as $error) { |
|
808 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
809 | 809 | } |
810 | - }else{ |
|
811 | - EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) ); |
|
810 | + } else { |
|
811 | + EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso')); |
|
812 | 812 | } |
813 | 813 | return false; |
814 | 814 | } |
815 | 815 | EE_Data_Migration_Manager::instance()->update_current_database_state_to(); |
816 | - }else{ |
|
817 | - EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
816 | + } else { |
|
817 | + EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
818 | 818 | return false; |
819 | 819 | } |
820 | 820 | return true; |
@@ -834,27 +834,27 @@ discard block |
||
834 | 834 | public static function initialize_system_questions() { |
835 | 835 | // QUESTION GROUPS |
836 | 836 | global $wpdb; |
837 | - $table_name = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'esp_question_group' ); |
|
837 | + $table_name = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix('esp_question_group'); |
|
838 | 838 | $SQL = "SELECT QSG_system FROM $table_name WHERE QSG_system != 0"; |
839 | 839 | // what we have |
840 | - $question_groups = $wpdb->get_col( $SQL ); |
|
840 | + $question_groups = $wpdb->get_col($SQL); |
|
841 | 841 | // check the response |
842 | - $question_groups = is_array( $question_groups ) ? $question_groups : array(); |
|
842 | + $question_groups = is_array($question_groups) ? $question_groups : array(); |
|
843 | 843 | // what we should have |
844 | - $QSG_systems = array( 1, 2 ); |
|
844 | + $QSG_systems = array(1, 2); |
|
845 | 845 | // loop thru what we should have and compare to what we have |
846 | - foreach ( $QSG_systems as $QSG_system ) { |
|
846 | + foreach ($QSG_systems as $QSG_system) { |
|
847 | 847 | // reset values array |
848 | 848 | $QSG_values = array(); |
849 | 849 | // if we don't have what we should have (but use $QST_system as as string because that's what we got from the db) |
850 | - if ( ! in_array( "$QSG_system", $question_groups )) { |
|
850 | + if ( ! in_array("$QSG_system", $question_groups)) { |
|
851 | 851 | // add it |
852 | - switch ( $QSG_system ) { |
|
852 | + switch ($QSG_system) { |
|
853 | 853 | |
854 | 854 | case 1: |
855 | 855 | $QSG_values = array( |
856 | - 'QSG_name' => __( 'Personal Information', 'event_espresso' ), |
|
857 | - 'QSG_identifier' => 'personal-information-' . time(), |
|
856 | + 'QSG_name' => __('Personal Information', 'event_espresso'), |
|
857 | + 'QSG_identifier' => 'personal-information-'.time(), |
|
858 | 858 | 'QSG_desc' => '', |
859 | 859 | 'QSG_order' => 1, |
860 | 860 | 'QSG_show_group_name' => 1, |
@@ -866,8 +866,8 @@ discard block |
||
866 | 866 | |
867 | 867 | case 2: |
868 | 868 | $QSG_values = array( |
869 | - 'QSG_name' => __( 'Address Information','event_espresso' ), |
|
870 | - 'QSG_identifier' => 'address-information-' . time(), |
|
869 | + 'QSG_name' => __('Address Information', 'event_espresso'), |
|
870 | + 'QSG_identifier' => 'address-information-'.time(), |
|
871 | 871 | 'QSG_desc' => '', |
872 | 872 | 'QSG_order' => 2, |
873 | 873 | 'QSG_show_group_name' => 1, |
@@ -879,14 +879,14 @@ discard block |
||
879 | 879 | |
880 | 880 | } |
881 | 881 | // make sure we have some values before inserting them |
882 | - if ( ! empty( $QSG_values )) { |
|
882 | + if ( ! empty($QSG_values)) { |
|
883 | 883 | // insert system question |
884 | 884 | $wpdb->insert( |
885 | 885 | $table_name, |
886 | 886 | $QSG_values, |
887 | - array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' ) |
|
887 | + array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d') |
|
888 | 888 | ); |
889 | - $QSG_IDs[ $QSG_system ] = $wpdb->insert_id; |
|
889 | + $QSG_IDs[$QSG_system] = $wpdb->insert_id; |
|
890 | 890 | } |
891 | 891 | } |
892 | 892 | } |
@@ -895,10 +895,10 @@ discard block |
||
895 | 895 | |
896 | 896 | // QUESTIONS |
897 | 897 | global $wpdb; |
898 | - $table_name = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'esp_question' ); |
|
898 | + $table_name = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix('esp_question'); |
|
899 | 899 | $SQL = "SELECT QST_system FROM $table_name WHERE QST_system != ''"; |
900 | 900 | // what we have |
901 | - $questions = $wpdb->get_col( $SQL ); |
|
901 | + $questions = $wpdb->get_col($SQL); |
|
902 | 902 | // what we should have |
903 | 903 | $QST_systems = array( |
904 | 904 | 'fname', |
@@ -915,25 +915,25 @@ discard block |
||
915 | 915 | $order_for_group_1 = 1; |
916 | 916 | $order_for_group_2 = 1; |
917 | 917 | // loop thru what we should have and compare to what we have |
918 | - foreach ( $QST_systems as $QST_system ) { |
|
918 | + foreach ($QST_systems as $QST_system) { |
|
919 | 919 | // reset values array |
920 | 920 | $QST_values = array(); |
921 | 921 | // if we don't have what we should have |
922 | - if ( ! in_array( $QST_system, $questions )) { |
|
922 | + if ( ! in_array($QST_system, $questions)) { |
|
923 | 923 | // add it |
924 | - switch ( $QST_system ) { |
|
924 | + switch ($QST_system) { |
|
925 | 925 | |
926 | 926 | case 'fname': |
927 | 927 | $QST_values = array( |
928 | - 'QST_display_text' => __( 'First Name', 'event_espresso' ), |
|
929 | - 'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ), |
|
928 | + 'QST_display_text' => __('First Name', 'event_espresso'), |
|
929 | + 'QST_admin_label' => __('First Name - System Question', 'event_espresso'), |
|
930 | 930 | 'QST_system' => 'fname', |
931 | 931 | 'QST_type' => 'TEXT', |
932 | 932 | 'QST_required' => 1, |
933 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
933 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
934 | 934 | 'QST_order' => 1, |
935 | 935 | 'QST_admin_only' => 0, |
936 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
936 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
937 | 937 | 'QST_wp_user' => self::get_default_creator_id(), |
938 | 938 | 'QST_deleted' => 0 |
939 | 939 | ); |
@@ -941,15 +941,15 @@ discard block |
||
941 | 941 | |
942 | 942 | case 'lname': |
943 | 943 | $QST_values = array( |
944 | - 'QST_display_text' => __( 'Last Name', 'event_espresso' ), |
|
945 | - 'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ), |
|
944 | + 'QST_display_text' => __('Last Name', 'event_espresso'), |
|
945 | + 'QST_admin_label' => __('Last Name - System Question', 'event_espresso'), |
|
946 | 946 | 'QST_system' => 'lname', |
947 | 947 | 'QST_type' => 'TEXT', |
948 | 948 | 'QST_required' => 1, |
949 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
949 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
950 | 950 | 'QST_order' => 2, |
951 | 951 | 'QST_admin_only' => 0, |
952 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
952 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
953 | 953 | 'QST_wp_user' => self::get_default_creator_id(), |
954 | 954 | 'QST_deleted' => 0 |
955 | 955 | ); |
@@ -957,15 +957,15 @@ discard block |
||
957 | 957 | |
958 | 958 | case 'email': |
959 | 959 | $QST_values = array( |
960 | - 'QST_display_text' => __( 'Email Address', 'event_espresso' ), |
|
961 | - 'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ), |
|
960 | + 'QST_display_text' => __('Email Address', 'event_espresso'), |
|
961 | + 'QST_admin_label' => __('Email Address - System Question', 'event_espresso'), |
|
962 | 962 | 'QST_system' => 'email', |
963 | 963 | 'QST_type' => 'EMAIL', |
964 | 964 | 'QST_required' => 1, |
965 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
965 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
966 | 966 | 'QST_order' => 3, |
967 | 967 | 'QST_admin_only' => 0, |
968 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
968 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
969 | 969 | 'QST_wp_user' => self::get_default_creator_id(), |
970 | 970 | 'QST_deleted' => 0 |
971 | 971 | ); |
@@ -973,15 +973,15 @@ discard block |
||
973 | 973 | |
974 | 974 | case 'address': |
975 | 975 | $QST_values = array( |
976 | - 'QST_display_text' => __( 'Address', 'event_espresso' ), |
|
977 | - 'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ), |
|
976 | + 'QST_display_text' => __('Address', 'event_espresso'), |
|
977 | + 'QST_admin_label' => __('Address - System Question', 'event_espresso'), |
|
978 | 978 | 'QST_system' => 'address', |
979 | 979 | 'QST_type' => 'TEXT', |
980 | 980 | 'QST_required' => 0, |
981 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
981 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
982 | 982 | 'QST_order' => 4, |
983 | 983 | 'QST_admin_only' => 0, |
984 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
984 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
985 | 985 | 'QST_wp_user' => self::get_default_creator_id(), |
986 | 986 | 'QST_deleted' => 0 |
987 | 987 | ); |
@@ -989,15 +989,15 @@ discard block |
||
989 | 989 | |
990 | 990 | case 'address2': |
991 | 991 | $QST_values = array( |
992 | - 'QST_display_text' => __( 'Address2', 'event_espresso' ), |
|
993 | - 'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ), |
|
992 | + 'QST_display_text' => __('Address2', 'event_espresso'), |
|
993 | + 'QST_admin_label' => __('Address2 - System Question', 'event_espresso'), |
|
994 | 994 | 'QST_system' => 'address2', |
995 | 995 | 'QST_type' => 'TEXT', |
996 | 996 | 'QST_required' => 0, |
997 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
997 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
998 | 998 | 'QST_order' => 5, |
999 | 999 | 'QST_admin_only' => 0, |
1000 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1000 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1001 | 1001 | 'QST_wp_user' => self::get_default_creator_id(), |
1002 | 1002 | 'QST_deleted' => 0 |
1003 | 1003 | ); |
@@ -1005,27 +1005,27 @@ discard block |
||
1005 | 1005 | |
1006 | 1006 | case 'city': |
1007 | 1007 | $QST_values = array( |
1008 | - 'QST_display_text' => __( 'City', 'event_espresso' ), |
|
1009 | - 'QST_admin_label' => __( 'City - System Question', 'event_espresso' ), |
|
1008 | + 'QST_display_text' => __('City', 'event_espresso'), |
|
1009 | + 'QST_admin_label' => __('City - System Question', 'event_espresso'), |
|
1010 | 1010 | 'QST_system' => 'city', |
1011 | 1011 | 'QST_type' => 'TEXT', |
1012 | 1012 | 'QST_required' => 0, |
1013 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1013 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1014 | 1014 | 'QST_order' => 6, |
1015 | 1015 | 'QST_admin_only' => 0, |
1016 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1016 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1017 | 1017 | 'QST_wp_user' => self::get_default_creator_id(), |
1018 | 1018 | 'QST_deleted' => 0 |
1019 | 1019 | ); |
1020 | 1020 | break; |
1021 | 1021 | case 'country' : |
1022 | 1022 | $QST_values = array( |
1023 | - 'QST_display_text' => __( 'Country', 'event_espresso' ), |
|
1024 | - 'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ), |
|
1023 | + 'QST_display_text' => __('Country', 'event_espresso'), |
|
1024 | + 'QST_admin_label' => __('Country - System Question', 'event_espresso'), |
|
1025 | 1025 | 'QST_system' => 'country', |
1026 | 1026 | 'QST_type' => 'COUNTRY', |
1027 | 1027 | 'QST_required' => 0, |
1028 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1028 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1029 | 1029 | 'QST_order' => 7, |
1030 | 1030 | 'QST_admin_only' => 0, |
1031 | 1031 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1035,12 +1035,12 @@ discard block |
||
1035 | 1035 | |
1036 | 1036 | case 'state': |
1037 | 1037 | $QST_values = array( |
1038 | - 'QST_display_text' => __( 'State/Province', 'event_espresso' ), |
|
1039 | - 'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ), |
|
1038 | + 'QST_display_text' => __('State/Province', 'event_espresso'), |
|
1039 | + 'QST_admin_label' => __('State/Province - System Question', 'event_espresso'), |
|
1040 | 1040 | 'QST_system' => 'state', |
1041 | 1041 | 'QST_type' => 'STATE', |
1042 | 1042 | 'QST_required' => 0, |
1043 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1043 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1044 | 1044 | 'QST_order' => 8, |
1045 | 1045 | 'QST_admin_only' => 0, |
1046 | 1046 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1050,15 +1050,15 @@ discard block |
||
1050 | 1050 | |
1051 | 1051 | case 'zip': |
1052 | 1052 | $QST_values = array( |
1053 | - 'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ), |
|
1054 | - 'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ), |
|
1053 | + 'QST_display_text' => __('Zip/Postal Code', 'event_espresso'), |
|
1054 | + 'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'), |
|
1055 | 1055 | 'QST_system' => 'zip', |
1056 | 1056 | 'QST_type' => 'TEXT', |
1057 | 1057 | 'QST_required' => 0, |
1058 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1058 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1059 | 1059 | 'QST_order' => 9, |
1060 | 1060 | 'QST_admin_only' => 0, |
1061 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1061 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1062 | 1062 | 'QST_wp_user' => self::get_default_creator_id(), |
1063 | 1063 | 'QST_deleted' => 0 |
1064 | 1064 | ); |
@@ -1066,49 +1066,49 @@ discard block |
||
1066 | 1066 | |
1067 | 1067 | case 'phone': |
1068 | 1068 | $QST_values = array( |
1069 | - 'QST_display_text' => __( 'Phone Number', 'event_espresso' ), |
|
1070 | - 'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ), |
|
1069 | + 'QST_display_text' => __('Phone Number', 'event_espresso'), |
|
1070 | + 'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'), |
|
1071 | 1071 | 'QST_system' => 'phone', |
1072 | 1072 | 'QST_type' => 'TEXT', |
1073 | 1073 | 'QST_required' => 0, |
1074 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1074 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1075 | 1075 | 'QST_order' => 10, |
1076 | 1076 | 'QST_admin_only' => 0, |
1077 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1077 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1078 | 1078 | 'QST_wp_user' => self::get_default_creator_id(), |
1079 | 1079 | 'QST_deleted' => 0 |
1080 | 1080 | ); |
1081 | 1081 | break; |
1082 | 1082 | |
1083 | 1083 | } |
1084 | - if ( ! empty( $QST_values )) { |
|
1084 | + if ( ! empty($QST_values)) { |
|
1085 | 1085 | // insert system question |
1086 | 1086 | $wpdb->insert( |
1087 | 1087 | $table_name, |
1088 | 1088 | $QST_values, |
1089 | - array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' ) |
|
1089 | + array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d') |
|
1090 | 1090 | ); |
1091 | 1091 | $QST_ID = $wpdb->insert_id; |
1092 | 1092 | |
1093 | 1093 | // QUESTION GROUP QUESTIONS |
1094 | - if( in_array( $QST_system, array( 'fname', 'lname', 'email' ) ) ) { |
|
1094 | + if (in_array($QST_system, array('fname', 'lname', 'email'))) { |
|
1095 | 1095 | $system_question_we_want = EEM_Question_Group::system_personal; |
1096 | 1096 | } else { |
1097 | 1097 | $system_question_we_want = EEM_Question_Group::system_address; |
1098 | 1098 | } |
1099 | - if( isset( $QSG_IDs[ $system_question_we_want ] ) ) { |
|
1100 | - $QSG_ID = $QSG_IDs[ $system_question_we_want ]; |
|
1099 | + if (isset($QSG_IDs[$system_question_we_want])) { |
|
1100 | + $QSG_ID = $QSG_IDs[$system_question_we_want]; |
|
1101 | 1101 | } else { |
1102 | - $id_col = EEM_Question_Group::instance()->get_col( array( array( 'QSG_system' => $system_question_we_want ) ) ); |
|
1103 | - if( is_array( $id_col ) ) { |
|
1104 | - $QSG_ID = reset( $id_col ); |
|
1102 | + $id_col = EEM_Question_Group::instance()->get_col(array(array('QSG_system' => $system_question_we_want))); |
|
1103 | + if (is_array($id_col)) { |
|
1104 | + $QSG_ID = reset($id_col); |
|
1105 | 1105 | } else { |
1106 | 1106 | //ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method |
1107 | 1107 | EE_Log::instance()->log( |
1108 | 1108 | __FILE__, |
1109 | 1109 | __FUNCTION__, |
1110 | 1110 | sprintf( |
1111 | - __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1111 | + __('Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1112 | 1112 | $QST_ID ), |
1113 | 1113 | 'error' ); |
1114 | 1114 | continue; |
@@ -1117,12 +1117,12 @@ discard block |
||
1117 | 1117 | |
1118 | 1118 | // add system questions to groups |
1119 | 1119 | $wpdb->insert( |
1120 | - \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'esp_question_group_question' ), |
|
1121 | - array( 'QSG_ID' => $QSG_ID, |
|
1120 | + \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix('esp_question_group_question'), |
|
1121 | + array('QSG_ID' => $QSG_ID, |
|
1122 | 1122 | 'QST_ID' => $QST_ID, |
1123 | - 'QGQ_order' => ( $QSG_ID === 1 ) ? $order_for_group_1++ : $order_for_group_2++ |
|
1123 | + 'QGQ_order' => ($QSG_ID === 1) ? $order_for_group_1++ : $order_for_group_2++ |
|
1124 | 1124 | ), |
1125 | - array( '%d', '%d', '%d' ) |
|
1125 | + array('%d', '%d', '%d') |
|
1126 | 1126 | ); |
1127 | 1127 | } |
1128 | 1128 | } |
@@ -1138,11 +1138,11 @@ discard block |
||
1138 | 1138 | * |
1139 | 1139 | * @throws \EE_Error |
1140 | 1140 | */ |
1141 | - public static function insert_default_payment_methods(){ |
|
1142 | - if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){ |
|
1143 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
1144 | - EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
1145 | - }else{ |
|
1141 | + public static function insert_default_payment_methods() { |
|
1142 | + if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) { |
|
1143 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
1144 | + EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
1145 | + } else { |
|
1146 | 1146 | EEM_Payment_Method::instance()->verify_button_urls(); |
1147 | 1147 | } |
1148 | 1148 | } |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | |
1159 | 1159 | global $wpdb; |
1160 | 1160 | |
1161 | - if ( \EEH_Activation::getTableAnalysis()->tableExists( EEM_Status::instance()->table() ) ) { |
|
1161 | + if (\EEH_Activation::getTableAnalysis()->tableExists(EEM_Status::instance()->table())) { |
|
1162 | 1162 | |
1163 | 1163 | $table_name = EEM_Status::instance()->table(); |
1164 | 1164 | |
@@ -1234,33 +1234,33 @@ discard block |
||
1234 | 1234 | $folders = array( |
1235 | 1235 | EVENT_ESPRESSO_TEMPLATE_DIR, |
1236 | 1236 | EVENT_ESPRESSO_GATEWAY_DIR, |
1237 | - EVENT_ESPRESSO_UPLOAD_DIR . 'logs/', |
|
1238 | - EVENT_ESPRESSO_UPLOAD_DIR . 'css/', |
|
1239 | - EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/' |
|
1237 | + EVENT_ESPRESSO_UPLOAD_DIR.'logs/', |
|
1238 | + EVENT_ESPRESSO_UPLOAD_DIR.'css/', |
|
1239 | + EVENT_ESPRESSO_UPLOAD_DIR.'tickets/' |
|
1240 | 1240 | ); |
1241 | - foreach ( $folders as $folder ) { |
|
1241 | + foreach ($folders as $folder) { |
|
1242 | 1242 | try { |
1243 | - EEH_File::ensure_folder_exists_and_is_writable( $folder ); |
|
1244 | - @ chmod( $folder, 0755 ); |
|
1245 | - } catch( EE_Error $e ){ |
|
1243 | + EEH_File::ensure_folder_exists_and_is_writable($folder); |
|
1244 | + @ chmod($folder, 0755); |
|
1245 | + } catch (EE_Error $e) { |
|
1246 | 1246 | EE_Error::add_error( |
1247 | 1247 | sprintf( |
1248 | - __( 'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ), |
|
1248 | + __('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'), |
|
1249 | 1249 | $folder, |
1250 | - '<br />' . $e->getMessage() |
|
1250 | + '<br />'.$e->getMessage() |
|
1251 | 1251 | ), |
1252 | 1252 | __FILE__, __FUNCTION__, __LINE__ |
1253 | 1253 | ); |
1254 | 1254 | //indicate we'll need to fix this later |
1255 | - update_option( EEH_Activation::upload_directories_incomplete_option_name, true ); |
|
1255 | + update_option(EEH_Activation::upload_directories_incomplete_option_name, true); |
|
1256 | 1256 | return FALSE; |
1257 | 1257 | } |
1258 | 1258 | } |
1259 | 1259 | //just add the .htaccess file to the logs directory to begin with. Even if logging |
1260 | 1260 | //is disabled, there might be activation errors recorded in there |
1261 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs/' ); |
|
1261 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs/'); |
|
1262 | 1262 | //remember EE's folders are all good |
1263 | - delete_option( EEH_Activation::upload_directories_incomplete_option_name ); |
|
1263 | + delete_option(EEH_Activation::upload_directories_incomplete_option_name); |
|
1264 | 1264 | return TRUE; |
1265 | 1265 | } |
1266 | 1266 | |
@@ -1273,7 +1273,7 @@ discard block |
||
1273 | 1273 | * @return boolean |
1274 | 1274 | */ |
1275 | 1275 | public static function upload_directories_incomplete() { |
1276 | - return get_option( EEH_Activation::upload_directories_incomplete_option_name, false ); |
|
1276 | + return get_option(EEH_Activation::upload_directories_incomplete_option_name, false); |
|
1277 | 1277 | } |
1278 | 1278 | |
1279 | 1279 | |
@@ -1290,7 +1290,7 @@ discard block |
||
1290 | 1290 | */ |
1291 | 1291 | public static function generate_default_message_templates() { |
1292 | 1292 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
1293 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
1293 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
1294 | 1294 | /* |
1295 | 1295 | * This first method is taking care of ensuring any default messengers |
1296 | 1296 | * that should be made active and have templates generated are done. |
@@ -1326,22 +1326,22 @@ discard block |
||
1326 | 1326 | $active_messengers = $message_resource_manager->active_messengers(); |
1327 | 1327 | $installed_message_types = $message_resource_manager->installed_message_types(); |
1328 | 1328 | $templates_created = false; |
1329 | - foreach ( $active_messengers as $active_messenger ) { |
|
1329 | + foreach ($active_messengers as $active_messenger) { |
|
1330 | 1330 | $default_message_type_names_for_messenger = $active_messenger->get_default_message_types(); |
1331 | 1331 | $default_message_type_names_to_activate = array(); |
1332 | 1332 | // looping through each default message type reported by the messenger |
1333 | 1333 | // and setup the actual message types to activate. |
1334 | - foreach ( $default_message_type_names_for_messenger as $default_message_type_name_for_messenger ) { |
|
1334 | + foreach ($default_message_type_names_for_messenger as $default_message_type_name_for_messenger) { |
|
1335 | 1335 | // if already active or has already been activated before we skip |
1336 | 1336 | // (otherwise we might reactivate something user's intentionally deactivated.) |
1337 | 1337 | // we also skip if the message type is not installed. |
1338 | 1338 | if ( |
1339 | - $message_resource_manager->has_message_type_been_activated_for_messenger( $default_message_type_name_for_messenger, $active_messenger->name ) |
|
1339 | + $message_resource_manager->has_message_type_been_activated_for_messenger($default_message_type_name_for_messenger, $active_messenger->name) |
|
1340 | 1340 | || $message_resource_manager->is_message_type_active_for_messenger( |
1341 | 1341 | $active_messenger->name, |
1342 | 1342 | $default_message_type_name_for_messenger |
1343 | 1343 | ) |
1344 | - || ! isset( $installed_message_types[ $default_message_type_name_for_messenger ] ) |
|
1344 | + || ! isset($installed_message_types[$default_message_type_name_for_messenger]) |
|
1345 | 1345 | ) { |
1346 | 1346 | continue; |
1347 | 1347 | } |
@@ -1354,7 +1354,7 @@ discard block |
||
1354 | 1354 | false |
1355 | 1355 | ); |
1356 | 1356 | //activate the templates for these message types |
1357 | - if ( ! empty( $default_message_type_names_to_activate ) ) { |
|
1357 | + if ( ! empty($default_message_type_names_to_activate)) { |
|
1358 | 1358 | $templates_created = EEH_MSG_Template::generate_new_templates( |
1359 | 1359 | $active_messenger->name, |
1360 | 1360 | $default_message_type_names_for_messenger, |
@@ -1381,18 +1381,18 @@ discard block |
||
1381 | 1381 | EE_Message_Resource_Manager $message_resource_manager |
1382 | 1382 | ) { |
1383 | 1383 | /** @type EE_messenger[] $messengers_to_generate */ |
1384 | - $messengers_to_generate = self::_get_default_messengers_to_generate_on_activation( $message_resource_manager ); |
|
1384 | + $messengers_to_generate = self::_get_default_messengers_to_generate_on_activation($message_resource_manager); |
|
1385 | 1385 | $installed_message_types = $message_resource_manager->installed_message_types(); |
1386 | 1386 | $templates_generated = false; |
1387 | - foreach ( $messengers_to_generate as $messenger_to_generate ) { |
|
1387 | + foreach ($messengers_to_generate as $messenger_to_generate) { |
|
1388 | 1388 | $default_message_type_names_for_messenger = $messenger_to_generate->get_default_message_types(); |
1389 | 1389 | //verify the default message types match an installed message type. |
1390 | - foreach ( $default_message_type_names_for_messenger as $key => $name ) { |
|
1390 | + foreach ($default_message_type_names_for_messenger as $key => $name) { |
|
1391 | 1391 | if ( |
1392 | - ! isset( $installed_message_types[ $name ] ) |
|
1393 | - || $message_resource_manager->has_message_type_been_activated_for_messenger( $name, $messenger_to_generate->name ) |
|
1392 | + ! isset($installed_message_types[$name]) |
|
1393 | + || $message_resource_manager->has_message_type_been_activated_for_messenger($name, $messenger_to_generate->name) |
|
1394 | 1394 | ) { |
1395 | - unset( $default_message_type_names_for_messenger[ $key ] ); |
|
1395 | + unset($default_message_type_names_for_messenger[$key]); |
|
1396 | 1396 | } |
1397 | 1397 | } |
1398 | 1398 | // in previous iterations, the active_messengers option in the db |
@@ -1406,7 +1406,7 @@ discard block |
||
1406 | 1406 | false |
1407 | 1407 | ); |
1408 | 1408 | //create any templates needing created (or will reactivate templates already generated as necessary). |
1409 | - if ( ! empty( $default_message_type_names_for_messenger ) ) { |
|
1409 | + if ( ! empty($default_message_type_names_for_messenger)) { |
|
1410 | 1410 | $templates_generated = EEH_MSG_Template::generate_new_templates( |
1411 | 1411 | $messenger_to_generate->name, |
1412 | 1412 | $default_message_type_names_for_messenger, |
@@ -1438,18 +1438,18 @@ discard block |
||
1438 | 1438 | $has_activated = $message_resource_manager->get_has_activated_messengers_option(); |
1439 | 1439 | |
1440 | 1440 | $messengers_to_generate = array(); |
1441 | - foreach ( $installed_messengers as $installed_messenger ) { |
|
1441 | + foreach ($installed_messengers as $installed_messenger) { |
|
1442 | 1442 | //if installed messenger is a messenger that should be activated on install |
1443 | 1443 | //and is not already active |
1444 | 1444 | //and has never been activated |
1445 | 1445 | if ( |
1446 | 1446 | ! $installed_messenger->activate_on_install |
1447 | - || isset( $active_messengers[ $installed_messenger->name ] ) |
|
1448 | - || isset( $has_activated[ $installed_messenger->name ] ) |
|
1447 | + || isset($active_messengers[$installed_messenger->name]) |
|
1448 | + || isset($has_activated[$installed_messenger->name]) |
|
1449 | 1449 | ) { |
1450 | 1450 | continue; |
1451 | 1451 | } |
1452 | - $messengers_to_generate[ $installed_messenger->name ] = $installed_messenger; |
|
1452 | + $messengers_to_generate[$installed_messenger->name] = $installed_messenger; |
|
1453 | 1453 | } |
1454 | 1454 | return $messengers_to_generate; |
1455 | 1455 | } |
@@ -1474,9 +1474,9 @@ discard block |
||
1474 | 1474 | */ |
1475 | 1475 | public static function validate_messages_system() { |
1476 | 1476 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
1477 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
1477 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
1478 | 1478 | $message_resource_manager->validate_active_message_types_are_installed(); |
1479 | - do_action( 'AHEE__EEH_Activation__validate_messages_system' ); |
|
1479 | + do_action('AHEE__EEH_Activation__validate_messages_system'); |
|
1480 | 1480 | } |
1481 | 1481 | |
1482 | 1482 | |
@@ -1489,12 +1489,12 @@ discard block |
||
1489 | 1489 | * @static |
1490 | 1490 | * @return void |
1491 | 1491 | */ |
1492 | - public static function create_no_ticket_prices_array(){ |
|
1492 | + public static function create_no_ticket_prices_array() { |
|
1493 | 1493 | // this creates an array for tracking events that have no active ticket prices created |
1494 | 1494 | // this allows us to warn admins of the situation so that it can be corrected |
1495 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE ); |
|
1496 | - if ( ! $espresso_no_ticket_prices ) { |
|
1497 | - add_option( 'ee_no_ticket_prices', array(), '', FALSE ); |
|
1495 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE); |
|
1496 | + if ( ! $espresso_no_ticket_prices) { |
|
1497 | + add_option('ee_no_ticket_prices', array(), '', FALSE); |
|
1498 | 1498 | } |
1499 | 1499 | } |
1500 | 1500 | |
@@ -1519,24 +1519,24 @@ discard block |
||
1519 | 1519 | * @global wpdb $wpdb |
1520 | 1520 | * @throws \EE_Error |
1521 | 1521 | */ |
1522 | - public static function delete_all_espresso_cpt_data(){ |
|
1522 | + public static function delete_all_espresso_cpt_data() { |
|
1523 | 1523 | global $wpdb; |
1524 | 1524 | //get all the CPT post_types |
1525 | 1525 | $ee_post_types = array(); |
1526 | - foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){ |
|
1527 | - if ( method_exists( $model_name, 'instance' )) { |
|
1528 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1529 | - if ( $model_obj instanceof EEM_CPT_Base ) { |
|
1530 | - $ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type()); |
|
1526 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1527 | + if (method_exists($model_name, 'instance')) { |
|
1528 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1529 | + if ($model_obj instanceof EEM_CPT_Base) { |
|
1530 | + $ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type()); |
|
1531 | 1531 | } |
1532 | 1532 | } |
1533 | 1533 | } |
1534 | 1534 | //get all our CPTs |
1535 | - $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")"; |
|
1535 | + $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")"; |
|
1536 | 1536 | $cpt_ids = $wpdb->get_col($query); |
1537 | 1537 | //delete each post meta and term relations too |
1538 | - foreach($cpt_ids as $post_id){ |
|
1539 | - wp_delete_post($post_id,true); |
|
1538 | + foreach ($cpt_ids as $post_id) { |
|
1539 | + wp_delete_post($post_id, true); |
|
1540 | 1540 | } |
1541 | 1541 | } |
1542 | 1542 | |
@@ -1548,12 +1548,12 @@ discard block |
||
1548 | 1548 | public static function drop_espresso_tables() { |
1549 | 1549 | $tables = array(); |
1550 | 1550 | // load registry |
1551 | - foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){ |
|
1552 | - if ( method_exists( $model_name, 'instance' )) { |
|
1553 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1554 | - if ( $model_obj instanceof EEM_Base ) { |
|
1555 | - foreach ( $model_obj->get_tables() as $table ) { |
|
1556 | - if ( strpos( $table->get_table_name(), 'esp_' ) |
|
1551 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1552 | + if (method_exists($model_name, 'instance')) { |
|
1553 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1554 | + if ($model_obj instanceof EEM_Base) { |
|
1555 | + foreach ($model_obj->get_tables() as $table) { |
|
1556 | + if (strpos($table->get_table_name(), 'esp_') |
|
1557 | 1557 | && |
1558 | 1558 | ( |
1559 | 1559 | is_main_site()//main site? nuke them all |
@@ -1576,10 +1576,10 @@ discard block |
||
1576 | 1576 | 'esp_promotion_rule', |
1577 | 1577 | 'esp_rule' |
1578 | 1578 | ); |
1579 | - foreach( $tables_without_models as $table ){ |
|
1579 | + foreach ($tables_without_models as $table) { |
|
1580 | 1580 | $tables[] = $table; |
1581 | 1581 | } |
1582 | - return \EEH_Activation::getTableManager()->dropTables( $tables ); |
|
1582 | + return \EEH_Activation::getTableManager()->dropTables($tables); |
|
1583 | 1583 | } |
1584 | 1584 | |
1585 | 1585 | /** |
@@ -1591,8 +1591,8 @@ discard block |
||
1591 | 1591 | * @param array $table_names |
1592 | 1592 | * @return array of table names which we deleted |
1593 | 1593 | */ |
1594 | - public static function drop_tables( $table_names ) { |
|
1595 | - return \EEH_Activation::getTableManager()->dropTables( $table_names ); |
|
1594 | + public static function drop_tables($table_names) { |
|
1595 | + return \EEH_Activation::getTableManager()->dropTables($table_names); |
|
1596 | 1596 | } |
1597 | 1597 | /** |
1598 | 1598 | * plugin_uninstall |
@@ -1602,7 +1602,7 @@ discard block |
||
1602 | 1602 | * @param bool $remove_all |
1603 | 1603 | * @return void |
1604 | 1604 | */ |
1605 | - public static function delete_all_espresso_tables_and_data( $remove_all = true ) { |
|
1605 | + public static function delete_all_espresso_tables_and_data($remove_all = true) { |
|
1606 | 1606 | global $wpdb; |
1607 | 1607 | self::drop_espresso_tables(); |
1608 | 1608 | |
@@ -1640,50 +1640,50 @@ discard block |
||
1640 | 1640 | 'ee_job_parameters_' => false, |
1641 | 1641 | 'ee_upload_directories_incomplete' => true, |
1642 | 1642 | ); |
1643 | - if( is_main_site() ) { |
|
1644 | - $wp_options_to_delete[ 'ee_network_config' ] = true; |
|
1643 | + if (is_main_site()) { |
|
1644 | + $wp_options_to_delete['ee_network_config'] = true; |
|
1645 | 1645 | } |
1646 | 1646 | |
1647 | 1647 | $undeleted_options = array(); |
1648 | - foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) { |
|
1648 | + foreach ($wp_options_to_delete as $option_name => $no_wildcard) { |
|
1649 | 1649 | |
1650 | - if( $no_wildcard ){ |
|
1651 | - if( ! delete_option( $option_name ) ){ |
|
1650 | + if ($no_wildcard) { |
|
1651 | + if ( ! delete_option($option_name)) { |
|
1652 | 1652 | $undeleted_options[] = $option_name; |
1653 | 1653 | } |
1654 | - }else{ |
|
1655 | - $option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" ); |
|
1656 | - foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){ |
|
1657 | - if( ! delete_option( $option_name_from_wildcard ) ){ |
|
1654 | + } else { |
|
1655 | + $option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'"); |
|
1656 | + foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) { |
|
1657 | + if ( ! delete_option($option_name_from_wildcard)) { |
|
1658 | 1658 | $undeleted_options[] = $option_name_from_wildcard; |
1659 | 1659 | } |
1660 | 1660 | } |
1661 | 1661 | } |
1662 | 1662 | } |
1663 | 1663 | //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
1664 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1664 | + remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10); |
|
1665 | 1665 | |
1666 | - if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
|
1666 | + if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) { |
|
1667 | 1667 | $db_update_sans_ee4 = array(); |
1668 | - foreach($espresso_db_update as $version => $times_activated){ |
|
1669 | - if( (string)$version[0] === '3'){//if its NON EE4 |
|
1668 | + foreach ($espresso_db_update as $version => $times_activated) { |
|
1669 | + if ((string) $version[0] === '3') {//if its NON EE4 |
|
1670 | 1670 | $db_update_sans_ee4[$version] = $times_activated; |
1671 | 1671 | } |
1672 | 1672 | } |
1673 | - update_option( 'espresso_db_update', $db_update_sans_ee4 ); |
|
1673 | + update_option('espresso_db_update', $db_update_sans_ee4); |
|
1674 | 1674 | } |
1675 | 1675 | |
1676 | 1676 | $errors = ''; |
1677 | - if ( ! empty( $undeleted_options )) { |
|
1677 | + if ( ! empty($undeleted_options)) { |
|
1678 | 1678 | $errors .= sprintf( |
1679 | - __( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ), |
|
1679 | + __('The following wp-options could not be deleted: %s%s', 'event_espresso'), |
|
1680 | 1680 | '<br/>', |
1681 | - implode( ',<br/>', $undeleted_options ) |
|
1681 | + implode(',<br/>', $undeleted_options) |
|
1682 | 1682 | ); |
1683 | 1683 | |
1684 | 1684 | } |
1685 | - if ( ! empty( $errors ) ) { |
|
1686 | - EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
1685 | + if ( ! empty($errors)) { |
|
1686 | + EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__); |
|
1687 | 1687 | } |
1688 | 1688 | } |
1689 | 1689 | |
@@ -1693,10 +1693,10 @@ discard block |
||
1693 | 1693 | */ |
1694 | 1694 | public static function last_wpdb_error_code() { |
1695 | 1695 | global $wpdb; |
1696 | - if( $wpdb->use_mysqli ) { |
|
1697 | - return mysqli_errno( $wpdb->dbh ); |
|
1696 | + if ($wpdb->use_mysqli) { |
|
1697 | + return mysqli_errno($wpdb->dbh); |
|
1698 | 1698 | } else { |
1699 | - return mysql_errno( $wpdb->dbh ); |
|
1699 | + return mysql_errno($wpdb->dbh); |
|
1700 | 1700 | } |
1701 | 1701 | } |
1702 | 1702 | |
@@ -1707,14 +1707,14 @@ discard block |
||
1707 | 1707 | * @param string $table_name with or without $wpdb->prefix |
1708 | 1708 | * @return boolean |
1709 | 1709 | */ |
1710 | - public static function table_exists( $table_name ){ |
|
1711 | - return \EEH_Activation::getTableAnalysis()->tableExists( $table_name ); |
|
1710 | + public static function table_exists($table_name) { |
|
1711 | + return \EEH_Activation::getTableAnalysis()->tableExists($table_name); |
|
1712 | 1712 | } |
1713 | 1713 | |
1714 | 1714 | /** |
1715 | 1715 | * Resets the cache on EEH_Activation |
1716 | 1716 | */ |
1717 | - public static function reset(){ |
|
1717 | + public static function reset() { |
|
1718 | 1718 | self::$_default_creator_id = NULL; |
1719 | 1719 | self::$_initialized_db_content_already_in_this_request = false; |
1720 | 1720 | } |