@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_JSON_Response |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_JSON_Response |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_SPCO_JSON_Response { |
15 | 15 | |
16 | 16 | /** |
@@ -21,26 +21,26 @@ |
||
21 | 21 | * |
22 | 22 | * |
23 | 23 | */ |
24 | -if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
24 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
25 | 25 | exit('No direct script access allowed'); |
26 | 26 | } |
27 | 27 | |
28 | -class EEM_Extra_Join extends EEM_Base{ |
|
28 | +class EEM_Extra_Join extends EEM_Base { |
|
29 | 29 | // private instance of the Extra Join object |
30 | 30 | protected static $_instance = NULL; |
31 | 31 | |
32 | 32 | public function __construct($timezone = NULL) { |
33 | - $models_this_can_join = array_keys( EE_Registry::instance()->non_abstract_db_models ); |
|
33 | + $models_this_can_join = array_keys(EE_Registry::instance()->non_abstract_db_models); |
|
34 | 34 | $this->_tables = array( |
35 | - 'Extra_Join' => new EE_Primary_Table( 'esp_extra_join', 'EXJ_ID' ), |
|
35 | + 'Extra_Join' => new EE_Primary_Table('esp_extra_join', 'EXJ_ID'), |
|
36 | 36 | ); |
37 | 37 | $this->_fields = array( |
38 | 38 | 'Extra_Join' => array( |
39 | - 'EXJ_ID' => new EE_Primary_Key_Int_Field( 'EXJ_ID', __( 'Extra Join ID', 'event_espresso' ) ), |
|
40 | - 'EXJ_first_model_ID' => new EE_Foreign_Key_String_Field( 'EXJ_first_model_ID', __( 'First Model ID', 'event_espresso' ), true, 0, $models_this_can_join ), |
|
41 | - 'EXJ_first_model_name' => new EE_Any_Foreign_Model_Name_Field( 'EXJ_first_model_name', __( 'First Model Name', 'event_espresso'), true, '', $models_this_can_join ), |
|
42 | - 'EXJ_second_model_ID' => new EE_Foreign_Key_String_Field( 'EXJ_second_model_ID', __( 'Second Model ID', 'event_espresso' ), true, 0, $models_this_can_join ), |
|
43 | - 'EXJ_second_model_name' => new EE_Any_Foreign_Model_Name_Field( 'EXJ_second_model_name', __( 'Second Model Name', 'event_espresso'), true, '', $models_this_can_join ), |
|
39 | + 'EXJ_ID' => new EE_Primary_Key_Int_Field('EXJ_ID', __('Extra Join ID', 'event_espresso')), |
|
40 | + 'EXJ_first_model_ID' => new EE_Foreign_Key_String_Field('EXJ_first_model_ID', __('First Model ID', 'event_espresso'), true, 0, $models_this_can_join), |
|
41 | + 'EXJ_first_model_name' => new EE_Any_Foreign_Model_Name_Field('EXJ_first_model_name', __('First Model Name', 'event_espresso'), true, '', $models_this_can_join), |
|
42 | + 'EXJ_second_model_ID' => new EE_Foreign_Key_String_Field('EXJ_second_model_ID', __('Second Model ID', 'event_espresso'), true, 0, $models_this_can_join), |
|
43 | + 'EXJ_second_model_name' => new EE_Any_Foreign_Model_Name_Field('EXJ_second_model_name', __('Second Model Name', 'event_espresso'), true, '', $models_this_can_join), |
|
44 | 44 | |
45 | 45 | ) |
46 | 46 | ); |
@@ -1,21 +1,21 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EEH_HTML |
|
5 | - * |
|
3 | + * |
|
4 | + * Class EEH_HTML |
|
5 | + * |
|
6 | 6 | * Sometimes when writing PHP you need to generate some standard HTML, |
7 | 7 | * but either not enough to warrant creating a template file, |
8 | 8 | * or the amount of PHP conditionals and/or loops peppered throughout the HTML |
9 | 9 | * just make it really ugly and difficult to read. |
10 | 10 | * This class simply adds a bunch of methods for generating basic HTML tags. |
11 | 11 | * Most of the methods have the same name as the HTML tag they generate, and most have the same set of parameters. |
12 | - * |
|
13 | - * @package Event Espresso |
|
14 | - * @subpackage core |
|
15 | - * @author Brent Christensen |
|
16 | - * |
|
17 | - * |
|
18 | - */ |
|
12 | + * |
|
13 | + * @package Event Espresso |
|
14 | + * @subpackage core |
|
15 | + * @author Brent Christensen |
|
16 | + * |
|
17 | + * |
|
18 | + */ |
|
19 | 19 | |
20 | 20 | class EEH_HTML { |
21 | 21 |
@@ -12,8 +12,7 @@ |
||
12 | 12 | * DTO for passing data to a UpdateRegistrationAndTransactionAfterChangeCommandHandler |
13 | 13 | * |
14 | 14 | * @package Event Espresso |
15 | - |
|
16 | -*@author Brent Christensen |
|
15 | + *@author Brent Christensen |
|
17 | 16 | * |
18 | 17 | */ |
19 | 18 | class UpdateRegistrationAndTransactionAfterChangeCommand extends SingleRegistrationCommand |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * |
13 | 13 | */ |
14 | 14 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
15 | - exit('No direct script access allowed'); |
|
15 | + exit('No direct script access allowed'); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | |
@@ -20,54 +20,54 @@ discard block |
||
20 | 20 | class RestException extends \EE_Error |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @var array |
|
25 | - */ |
|
26 | - protected $wp_error_data = array(); |
|
23 | + /** |
|
24 | + * @var array |
|
25 | + */ |
|
26 | + protected $wp_error_data = array(); |
|
27 | 27 | |
28 | - protected $wp_error_code = ''; |
|
28 | + protected $wp_error_code = ''; |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
32 | - public function __construct($string_code, $message, $wp_error_data = array(), $previous = null) |
|
33 | - { |
|
34 | - if (is_array($wp_error_data) |
|
35 | - && isset($wp_error_data['status']) |
|
36 | - ) { |
|
37 | - $http_status_number = $wp_error_data['status']; |
|
38 | - } else { |
|
39 | - $http_status_number = 500; |
|
40 | - } |
|
41 | - parent::__construct( |
|
42 | - $message, |
|
43 | - $http_status_number, |
|
44 | - $previous |
|
45 | - ); |
|
46 | - $this->wp_error_data = $wp_error_data; |
|
47 | - $this->wp_error_code = $string_code; |
|
48 | - } |
|
32 | + public function __construct($string_code, $message, $wp_error_data = array(), $previous = null) |
|
33 | + { |
|
34 | + if (is_array($wp_error_data) |
|
35 | + && isset($wp_error_data['status']) |
|
36 | + ) { |
|
37 | + $http_status_number = $wp_error_data['status']; |
|
38 | + } else { |
|
39 | + $http_status_number = 500; |
|
40 | + } |
|
41 | + parent::__construct( |
|
42 | + $message, |
|
43 | + $http_status_number, |
|
44 | + $previous |
|
45 | + ); |
|
46 | + $this->wp_error_data = $wp_error_data; |
|
47 | + $this->wp_error_code = $string_code; |
|
48 | + } |
|
49 | 49 | |
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * Array of data that may have been set during the constructor, intended for WP_Error's data |
|
54 | - * |
|
55 | - * @return array |
|
56 | - */ |
|
57 | - public function getData() |
|
58 | - { |
|
59 | - return $this->wp_error_data; |
|
60 | - } |
|
52 | + /** |
|
53 | + * Array of data that may have been set during the constructor, intended for WP_Error's data |
|
54 | + * |
|
55 | + * @return array |
|
56 | + */ |
|
57 | + public function getData() |
|
58 | + { |
|
59 | + return $this->wp_error_data; |
|
60 | + } |
|
61 | 61 | |
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * Gets the error string |
|
66 | - * |
|
67 | - * @return string |
|
68 | - */ |
|
69 | - public function getStringCode() |
|
70 | - { |
|
71 | - return $this->wp_error_code; |
|
72 | - } |
|
64 | + /** |
|
65 | + * Gets the error string |
|
66 | + * |
|
67 | + * @return string |
|
68 | + */ |
|
69 | + public function getStringCode() |
|
70 | + { |
|
71 | + return $this->wp_error_code; |
|
72 | + } |
|
73 | 73 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * @author Mike Nelson |
12 | 12 | * |
13 | 13 | */ |
14 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
14 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
15 | 15 | exit('No direct script access allowed'); |
16 | 16 | } |
17 | 17 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | */ |
19 | 19 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
20 | - exit('No direct script access allowed'); |
|
20 | + exit('No direct script access allowed'); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -25,62 +25,62 @@ discard block |
||
25 | 25 | class Registration extends Calculations_Base |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * Calculates the checkin status for each datetime this registration has access to |
|
30 | - * |
|
31 | - * @param array $wpdb_row |
|
32 | - * @param \WP_REST_Request $request |
|
33 | - * @param Base $controller |
|
34 | - * @return array |
|
35 | - * @throws \EE_Error |
|
36 | - */ |
|
37 | - public static function datetimeCheckinStati($wpdb_row, $request, $controller) |
|
38 | - { |
|
39 | - if (is_array($wpdb_row) && isset($wpdb_row['Registration.REG_ID'])) { |
|
40 | - $reg = EEM_Registration::instance()->get_one_by_ID($wpdb_row['Registration.REG_ID']); |
|
41 | - } else { |
|
42 | - $reg = null; |
|
43 | - } |
|
44 | - if (! $reg instanceof EE_Registration |
|
45 | - ) { |
|
46 | - throw new \EE_Error( |
|
47 | - sprintf( |
|
48 | - __( |
|
49 | - // @codingStandardsIgnoreStart |
|
50 | - 'Cannot calculate datetime_checkin_stati because the registration with ID %1$s (from database row %2$s) was not found', |
|
51 | - // @codingStandardsIgnoreEnd |
|
52 | - 'event_espresso' |
|
53 | - ), |
|
54 | - $wpdb_row['Registration.REG_ID'], |
|
55 | - print_r($wpdb_row, true) |
|
56 | - ) |
|
57 | - ); |
|
58 | - } |
|
59 | - $datetime_ids = EEM_Datetime::instance()->get_col( |
|
60 | - array( |
|
61 | - array( |
|
62 | - 'Ticket.TKT_ID' => $reg->ticket_ID(), |
|
63 | - ), |
|
64 | - 'default_where_conditions' => \EEM_Base::default_where_conditions_minimum_all |
|
65 | - ) |
|
66 | - ); |
|
67 | - $checkin_stati = array(); |
|
68 | - foreach ($datetime_ids as $datetime_id) { |
|
69 | - $status = $reg->check_in_status_for_datetime($datetime_id); |
|
70 | - switch ($status) { |
|
71 | - case EE_Checkin::status_checked_out: |
|
72 | - $status_pretty = 'OUT'; |
|
73 | - break; |
|
74 | - case EE_Checkin::status_checked_in: |
|
75 | - $status_pretty = 'IN'; |
|
76 | - break; |
|
77 | - case EE_Checkin::status_checked_never: |
|
78 | - default: |
|
79 | - $status_pretty = 'NEVER'; |
|
80 | - break; |
|
81 | - } |
|
82 | - $checkin_stati[$datetime_id] = $status_pretty; |
|
83 | - } |
|
84 | - return $checkin_stati; |
|
85 | - } |
|
28 | + /** |
|
29 | + * Calculates the checkin status for each datetime this registration has access to |
|
30 | + * |
|
31 | + * @param array $wpdb_row |
|
32 | + * @param \WP_REST_Request $request |
|
33 | + * @param Base $controller |
|
34 | + * @return array |
|
35 | + * @throws \EE_Error |
|
36 | + */ |
|
37 | + public static function datetimeCheckinStati($wpdb_row, $request, $controller) |
|
38 | + { |
|
39 | + if (is_array($wpdb_row) && isset($wpdb_row['Registration.REG_ID'])) { |
|
40 | + $reg = EEM_Registration::instance()->get_one_by_ID($wpdb_row['Registration.REG_ID']); |
|
41 | + } else { |
|
42 | + $reg = null; |
|
43 | + } |
|
44 | + if (! $reg instanceof EE_Registration |
|
45 | + ) { |
|
46 | + throw new \EE_Error( |
|
47 | + sprintf( |
|
48 | + __( |
|
49 | + // @codingStandardsIgnoreStart |
|
50 | + 'Cannot calculate datetime_checkin_stati because the registration with ID %1$s (from database row %2$s) was not found', |
|
51 | + // @codingStandardsIgnoreEnd |
|
52 | + 'event_espresso' |
|
53 | + ), |
|
54 | + $wpdb_row['Registration.REG_ID'], |
|
55 | + print_r($wpdb_row, true) |
|
56 | + ) |
|
57 | + ); |
|
58 | + } |
|
59 | + $datetime_ids = EEM_Datetime::instance()->get_col( |
|
60 | + array( |
|
61 | + array( |
|
62 | + 'Ticket.TKT_ID' => $reg->ticket_ID(), |
|
63 | + ), |
|
64 | + 'default_where_conditions' => \EEM_Base::default_where_conditions_minimum_all |
|
65 | + ) |
|
66 | + ); |
|
67 | + $checkin_stati = array(); |
|
68 | + foreach ($datetime_ids as $datetime_id) { |
|
69 | + $status = $reg->check_in_status_for_datetime($datetime_id); |
|
70 | + switch ($status) { |
|
71 | + case EE_Checkin::status_checked_out: |
|
72 | + $status_pretty = 'OUT'; |
|
73 | + break; |
|
74 | + case EE_Checkin::status_checked_in: |
|
75 | + $status_pretty = 'IN'; |
|
76 | + break; |
|
77 | + case EE_Checkin::status_checked_never: |
|
78 | + default: |
|
79 | + $status_pretty = 'NEVER'; |
|
80 | + break; |
|
81 | + } |
|
82 | + $checkin_stati[$datetime_id] = $status_pretty; |
|
83 | + } |
|
84 | + return $checkin_stati; |
|
85 | + } |
|
86 | 86 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @author Mike Nelson |
17 | 17 | * |
18 | 18 | */ |
19 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
19 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
20 | 20 | exit('No direct script access allowed'); |
21 | 21 | } |
22 | 22 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } else { |
42 | 42 | $reg = null; |
43 | 43 | } |
44 | - if (! $reg instanceof EE_Registration |
|
44 | + if ( ! $reg instanceof EE_Registration |
|
45 | 45 | ) { |
46 | 46 | throw new \EE_Error( |
47 | 47 | sprintf( |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * |
15 | 15 | */ |
16 | 16 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
17 | - exit('No direct script access allowed'); |
|
17 | + exit('No direct script access allowed'); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | |
@@ -22,41 +22,41 @@ discard block |
||
22 | 22 | class Base |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * @param $required_permission |
|
27 | - * @param $attempted_calculation |
|
28 | - * @throws \EventEspresso\core\libraries\rest_api\RestException |
|
29 | - */ |
|
30 | - protected static function verifyCurrentUserCan($required_permission, $attempted_calculation) |
|
31 | - { |
|
32 | - if (! current_user_can($required_permission)) { |
|
33 | - throw new RestException( |
|
34 | - 'permission_denied', |
|
35 | - sprintf( |
|
36 | - __( |
|
37 | - // @codingStandardsIgnoreStart |
|
38 | - 'Permission denied, you cannot calculate %1$s on %2$s because you do not have the capability "%3$s"', |
|
39 | - // @codingStandardsIgnoreEnd |
|
40 | - 'event_espresso' |
|
41 | - ), |
|
42 | - $attempted_calculation, |
|
43 | - EEH_Inflector::pluralize_and_lower(self::getResourceName()), |
|
44 | - $required_permission |
|
45 | - ) |
|
46 | - ); |
|
47 | - } |
|
48 | - } |
|
49 | - |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * Gets the name of the resource of the called class |
|
54 | - * |
|
55 | - * @return string |
|
56 | - */ |
|
57 | - public static function getResourceName() |
|
58 | - { |
|
59 | - $classname = get_called_class(); |
|
60 | - return substr($classname, strrpos($classname, '\\') + 1); |
|
61 | - } |
|
25 | + /** |
|
26 | + * @param $required_permission |
|
27 | + * @param $attempted_calculation |
|
28 | + * @throws \EventEspresso\core\libraries\rest_api\RestException |
|
29 | + */ |
|
30 | + protected static function verifyCurrentUserCan($required_permission, $attempted_calculation) |
|
31 | + { |
|
32 | + if (! current_user_can($required_permission)) { |
|
33 | + throw new RestException( |
|
34 | + 'permission_denied', |
|
35 | + sprintf( |
|
36 | + __( |
|
37 | + // @codingStandardsIgnoreStart |
|
38 | + 'Permission denied, you cannot calculate %1$s on %2$s because you do not have the capability "%3$s"', |
|
39 | + // @codingStandardsIgnoreEnd |
|
40 | + 'event_espresso' |
|
41 | + ), |
|
42 | + $attempted_calculation, |
|
43 | + EEH_Inflector::pluralize_and_lower(self::getResourceName()), |
|
44 | + $required_permission |
|
45 | + ) |
|
46 | + ); |
|
47 | + } |
|
48 | + } |
|
49 | + |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * Gets the name of the resource of the called class |
|
54 | + * |
|
55 | + * @return string |
|
56 | + */ |
|
57 | + public static function getResourceName() |
|
58 | + { |
|
59 | + $classname = get_called_class(); |
|
60 | + return substr($classname, strrpos($classname, '\\') + 1); |
|
61 | + } |
|
62 | 62 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @author Mike Nelson |
14 | 14 | * |
15 | 15 | */ |
16 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
16 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
17 | 17 | exit('No direct script access allowed'); |
18 | 18 | } |
19 | 19 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | protected static function verifyCurrentUserCan($required_permission, $attempted_calculation) |
31 | 31 | { |
32 | - if (! current_user_can($required_permission)) { |
|
32 | + if ( ! current_user_can($required_permission)) { |
|
33 | 33 | throw new RestException( |
34 | 34 | 'permission_denied', |
35 | 35 | sprintf( |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | */ |
19 | 19 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
20 | - exit('No direct script access allowed'); |
|
20 | + exit('No direct script access allowed'); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -25,144 +25,144 @@ discard block |
||
25 | 25 | class Datetime extends Calculations_Base |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * Calculates the total spaces available on the datetime, taking into account |
|
30 | - * ticket limits too. |
|
31 | - * |
|
32 | - * @see EE_Datetime::spaces_remaining( true ) |
|
33 | - * @param array $wpdb_row |
|
34 | - * @param \WP_REST_Request $request |
|
35 | - * @param Controller_Base $controller |
|
36 | - * @return int |
|
37 | - * @throws \EE_Error |
|
38 | - */ |
|
39 | - public static function spacesRemainingConsideringTickets($wpdb_row, $request, $controller) |
|
40 | - { |
|
41 | - if (is_array($wpdb_row) && isset($wpdb_row['Datetime.DTT_ID'])) { |
|
42 | - $dtt_obj = EEM_Datetime::instance()->get_one_by_ID($wpdb_row['Datetime.DTT_ID']); |
|
43 | - } else { |
|
44 | - $dtt_obj = null; |
|
45 | - } |
|
46 | - if ($dtt_obj instanceof EE_Datetime) { |
|
47 | - return $dtt_obj->spaces_remaining(true); |
|
48 | - } else { |
|
49 | - throw new \EE_Error( |
|
50 | - sprintf( |
|
51 | - __( |
|
52 | - // @codingStandardsIgnoreStart |
|
53 | - 'Cannot calculate spaces_remaining_considering_tickets because the datetime with ID %1$s (from database row %2$s) was not found', |
|
54 | - // @codingStandardsIgnoreEnd |
|
55 | - 'event_espresso' |
|
56 | - ), |
|
57 | - $wpdb_row['Datetime.DTT_ID'], |
|
58 | - print_r($wpdb_row, true) |
|
59 | - ) |
|
60 | - ); |
|
61 | - } |
|
62 | - } |
|
28 | + /** |
|
29 | + * Calculates the total spaces available on the datetime, taking into account |
|
30 | + * ticket limits too. |
|
31 | + * |
|
32 | + * @see EE_Datetime::spaces_remaining( true ) |
|
33 | + * @param array $wpdb_row |
|
34 | + * @param \WP_REST_Request $request |
|
35 | + * @param Controller_Base $controller |
|
36 | + * @return int |
|
37 | + * @throws \EE_Error |
|
38 | + */ |
|
39 | + public static function spacesRemainingConsideringTickets($wpdb_row, $request, $controller) |
|
40 | + { |
|
41 | + if (is_array($wpdb_row) && isset($wpdb_row['Datetime.DTT_ID'])) { |
|
42 | + $dtt_obj = EEM_Datetime::instance()->get_one_by_ID($wpdb_row['Datetime.DTT_ID']); |
|
43 | + } else { |
|
44 | + $dtt_obj = null; |
|
45 | + } |
|
46 | + if ($dtt_obj instanceof EE_Datetime) { |
|
47 | + return $dtt_obj->spaces_remaining(true); |
|
48 | + } else { |
|
49 | + throw new \EE_Error( |
|
50 | + sprintf( |
|
51 | + __( |
|
52 | + // @codingStandardsIgnoreStart |
|
53 | + 'Cannot calculate spaces_remaining_considering_tickets because the datetime with ID %1$s (from database row %2$s) was not found', |
|
54 | + // @codingStandardsIgnoreEnd |
|
55 | + 'event_espresso' |
|
56 | + ), |
|
57 | + $wpdb_row['Datetime.DTT_ID'], |
|
58 | + print_r($wpdb_row, true) |
|
59 | + ) |
|
60 | + ); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | - /** |
|
67 | - * Counts registrations who have checked into this datetime |
|
68 | - * |
|
69 | - * @param array $wpdb_row |
|
70 | - * @param \WP_REST_Request $request |
|
71 | - * @param Controller_Base $controller |
|
72 | - * @return int |
|
73 | - * @throws \EE_Error |
|
74 | - * @throws \EventEspresso\core\libraries\rest_api\RestException |
|
75 | - */ |
|
76 | - public static function registrationsCheckedInCount($wpdb_row, $request, $controller) |
|
77 | - { |
|
78 | - if (! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
79 | - throw new \EE_Error( |
|
80 | - sprintf( |
|
81 | - __( |
|
82 | - // @codingStandardsIgnoreStart |
|
83 | - 'Cannot calculate registrations_checked_in_count because the database row %1$s does not have an entry for "Datetime.DTT_ID"', |
|
84 | - // @codingStandardsIgnoreEnd |
|
85 | - 'event_espresso' |
|
86 | - ), |
|
87 | - print_r($wpdb_row, true) |
|
88 | - ) |
|
89 | - ); |
|
90 | - } |
|
91 | - self::verifyCurrentUserCan('ee_read_checkins', 'registrations_checked_in_count'); |
|
92 | - return EEM_Registration::instance() |
|
93 | - ->count_registrations_checked_into_datetime($wpdb_row['Datetime.DTT_ID'], true); |
|
94 | - } |
|
66 | + /** |
|
67 | + * Counts registrations who have checked into this datetime |
|
68 | + * |
|
69 | + * @param array $wpdb_row |
|
70 | + * @param \WP_REST_Request $request |
|
71 | + * @param Controller_Base $controller |
|
72 | + * @return int |
|
73 | + * @throws \EE_Error |
|
74 | + * @throws \EventEspresso\core\libraries\rest_api\RestException |
|
75 | + */ |
|
76 | + public static function registrationsCheckedInCount($wpdb_row, $request, $controller) |
|
77 | + { |
|
78 | + if (! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
79 | + throw new \EE_Error( |
|
80 | + sprintf( |
|
81 | + __( |
|
82 | + // @codingStandardsIgnoreStart |
|
83 | + 'Cannot calculate registrations_checked_in_count because the database row %1$s does not have an entry for "Datetime.DTT_ID"', |
|
84 | + // @codingStandardsIgnoreEnd |
|
85 | + 'event_espresso' |
|
86 | + ), |
|
87 | + print_r($wpdb_row, true) |
|
88 | + ) |
|
89 | + ); |
|
90 | + } |
|
91 | + self::verifyCurrentUserCan('ee_read_checkins', 'registrations_checked_in_count'); |
|
92 | + return EEM_Registration::instance() |
|
93 | + ->count_registrations_checked_into_datetime($wpdb_row['Datetime.DTT_ID'], true); |
|
94 | + } |
|
95 | 95 | |
96 | 96 | |
97 | 97 | |
98 | - /** |
|
99 | - * Counts registrations who have checked out of this datetime |
|
100 | - * |
|
101 | - * @param array $wpdb_row |
|
102 | - * @param \WP_REST_Request $request |
|
103 | - * @param Controller_Base $controller |
|
104 | - * @return int |
|
105 | - * @throws \EE_Error |
|
106 | - * @throws \EventEspresso\core\libraries\rest_api\RestException |
|
107 | - */ |
|
108 | - public static function registrationsCheckedOutCount($wpdb_row, $request, $controller) |
|
109 | - { |
|
110 | - if (! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
111 | - throw new \EE_Error( |
|
112 | - sprintf( |
|
113 | - __( |
|
114 | - // @codingStandardsIgnoreStart |
|
115 | - 'Cannot calculate registrations_checked_out_count because the database row %1$s does not have an entry for "Datetime.DTT_ID"', |
|
116 | - // @codingStandardsIgnoreEnd |
|
117 | - 'event_espresso' |
|
118 | - ), |
|
119 | - print_r($wpdb_row, true) |
|
120 | - ) |
|
121 | - ); |
|
122 | - } |
|
123 | - self::verifyCurrentUserCan('ee_read_checkins', 'registrations_checked_out_count'); |
|
124 | - return EEM_Registration::instance() |
|
125 | - ->count_registrations_checked_into_datetime($wpdb_row['Datetime.DTT_ID'], false); |
|
126 | - } |
|
98 | + /** |
|
99 | + * Counts registrations who have checked out of this datetime |
|
100 | + * |
|
101 | + * @param array $wpdb_row |
|
102 | + * @param \WP_REST_Request $request |
|
103 | + * @param Controller_Base $controller |
|
104 | + * @return int |
|
105 | + * @throws \EE_Error |
|
106 | + * @throws \EventEspresso\core\libraries\rest_api\RestException |
|
107 | + */ |
|
108 | + public static function registrationsCheckedOutCount($wpdb_row, $request, $controller) |
|
109 | + { |
|
110 | + if (! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
111 | + throw new \EE_Error( |
|
112 | + sprintf( |
|
113 | + __( |
|
114 | + // @codingStandardsIgnoreStart |
|
115 | + 'Cannot calculate registrations_checked_out_count because the database row %1$s does not have an entry for "Datetime.DTT_ID"', |
|
116 | + // @codingStandardsIgnoreEnd |
|
117 | + 'event_espresso' |
|
118 | + ), |
|
119 | + print_r($wpdb_row, true) |
|
120 | + ) |
|
121 | + ); |
|
122 | + } |
|
123 | + self::verifyCurrentUserCan('ee_read_checkins', 'registrations_checked_out_count'); |
|
124 | + return EEM_Registration::instance() |
|
125 | + ->count_registrations_checked_into_datetime($wpdb_row['Datetime.DTT_ID'], false); |
|
126 | + } |
|
127 | 127 | |
128 | 128 | |
129 | 129 | |
130 | - /** |
|
131 | - * Counts the number of pending-payment registrations for this event (regardless |
|
132 | - * of how many datetimes each registrations' ticket purchase is for) |
|
133 | - * |
|
134 | - * @param array $wpdb_row |
|
135 | - * @param \WP_REST_Request $request |
|
136 | - * @param Controller_Base $controller |
|
137 | - * @return int |
|
138 | - * @throws \EE_Error |
|
139 | - * @throws \EventEspresso\core\libraries\rest_api\RestException |
|
140 | - */ |
|
141 | - public static function spotsTakenPendingPayment($wpdb_row, $request, $controller) |
|
142 | - { |
|
143 | - if (! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
144 | - throw new \EE_Error( |
|
145 | - sprintf( |
|
146 | - __( |
|
147 | - // @codingStandardsIgnoreStart |
|
148 | - 'Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Datetime.DTT_ID"', |
|
149 | - // @codingStandardsIgnoreEnd |
|
150 | - 'event_espresso' |
|
151 | - ), |
|
152 | - print_r($wpdb_row, true) |
|
153 | - ) |
|
154 | - ); |
|
155 | - } |
|
156 | - self::verifyCurrentUserCan('ee_read_registrations', 'spots_taken_pending_payment'); |
|
157 | - return EEM_Registration::instance()->count( |
|
158 | - array( |
|
159 | - array( |
|
160 | - 'Ticket.Datetime.DTT_ID' => $wpdb_row['Datetime.DTT_ID'], |
|
161 | - 'STS_ID' => EEM_Registration::status_id_pending_payment, |
|
162 | - ), |
|
163 | - ), |
|
164 | - 'REG_ID', |
|
165 | - true |
|
166 | - ); |
|
167 | - } |
|
130 | + /** |
|
131 | + * Counts the number of pending-payment registrations for this event (regardless |
|
132 | + * of how many datetimes each registrations' ticket purchase is for) |
|
133 | + * |
|
134 | + * @param array $wpdb_row |
|
135 | + * @param \WP_REST_Request $request |
|
136 | + * @param Controller_Base $controller |
|
137 | + * @return int |
|
138 | + * @throws \EE_Error |
|
139 | + * @throws \EventEspresso\core\libraries\rest_api\RestException |
|
140 | + */ |
|
141 | + public static function spotsTakenPendingPayment($wpdb_row, $request, $controller) |
|
142 | + { |
|
143 | + if (! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
144 | + throw new \EE_Error( |
|
145 | + sprintf( |
|
146 | + __( |
|
147 | + // @codingStandardsIgnoreStart |
|
148 | + 'Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Datetime.DTT_ID"', |
|
149 | + // @codingStandardsIgnoreEnd |
|
150 | + 'event_espresso' |
|
151 | + ), |
|
152 | + print_r($wpdb_row, true) |
|
153 | + ) |
|
154 | + ); |
|
155 | + } |
|
156 | + self::verifyCurrentUserCan('ee_read_registrations', 'spots_taken_pending_payment'); |
|
157 | + return EEM_Registration::instance()->count( |
|
158 | + array( |
|
159 | + array( |
|
160 | + 'Ticket.Datetime.DTT_ID' => $wpdb_row['Datetime.DTT_ID'], |
|
161 | + 'STS_ID' => EEM_Registration::status_id_pending_payment, |
|
162 | + ), |
|
163 | + ), |
|
164 | + 'REG_ID', |
|
165 | + true |
|
166 | + ); |
|
167 | + } |
|
168 | 168 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @author Mike Nelson |
17 | 17 | * |
18 | 18 | */ |
19 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
19 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
20 | 20 | exit('No direct script access allowed'); |
21 | 21 | } |
22 | 22 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public static function registrationsCheckedInCount($wpdb_row, $request, $controller) |
77 | 77 | { |
78 | - if (! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
78 | + if ( ! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
79 | 79 | throw new \EE_Error( |
80 | 80 | sprintf( |
81 | 81 | __( |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public static function registrationsCheckedOutCount($wpdb_row, $request, $controller) |
109 | 109 | { |
110 | - if (! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
110 | + if ( ! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
111 | 111 | throw new \EE_Error( |
112 | 112 | sprintf( |
113 | 113 | __( |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public static function spotsTakenPendingPayment($wpdb_row, $request, $controller) |
142 | 142 | { |
143 | - if (! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
143 | + if ( ! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) { |
|
144 | 144 | throw new \EE_Error( |
145 | 145 | sprintf( |
146 | 146 | __( |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * |
20 | 20 | */ |
21 | 21 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
22 | - exit('No direct script access allowed'); |
|
22 | + exit('No direct script access allowed'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
@@ -27,404 +27,404 @@ discard block |
||
27 | 27 | class Event extends Calculations_Base |
28 | 28 | { |
29 | 29 | |
30 | - /** |
|
31 | - * Calculates the total spaces on the event (not subtracting sales, but taking |
|
32 | - * sales into account; so this is the optimum sales that CAN still be achieved) |
|
33 | - * See EE_Event::total_available_spaces( true ); |
|
34 | - * |
|
35 | - * @param array $wpdb_row |
|
36 | - * @param \WP_REST_Request $request |
|
37 | - * @param Base $controller |
|
38 | - * @return int |
|
39 | - * @throws EE_Error |
|
40 | - */ |
|
41 | - public static function optimumSalesAtStart($wpdb_row, $request, $controller) |
|
42 | - { |
|
43 | - $event_obj = null; |
|
44 | - if (Event::wpdbRowHasEventId($wpdb_row)) { |
|
45 | - $event_obj = EEM_Event::instance()->get_one_by_ID($wpdb_row['Event_CPT.ID']); |
|
46 | - } |
|
47 | - if ($event_obj instanceof EE_Event) { |
|
48 | - return $event_obj->total_available_spaces(); |
|
49 | - } |
|
50 | - throw new EE_Error( |
|
51 | - sprintf( |
|
52 | - __( |
|
53 | - // @codingStandardsIgnoreStart |
|
54 | - 'Cannot calculate optimum_sales_at_start because the event with ID %1$s (from database row %2$s) was not found', |
|
55 | - // @codingStandardsIgnoreEnd |
|
56 | - 'event_espresso' |
|
57 | - ), |
|
58 | - $wpdb_row['Event_CPT.ID'], |
|
59 | - print_r($wpdb_row, true) |
|
60 | - ) |
|
61 | - ); |
|
62 | - } |
|
63 | - |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * Calculates the total spaces on the event (ignoring all sales; so this is the optimum |
|
68 | - * sales that COULD have been achieved) |
|
69 | - * See EE_Event::total_available_spaces( true ); |
|
70 | - * |
|
71 | - * @param array $wpdb_row |
|
72 | - * @param \WP_REST_Request $request |
|
73 | - * @param Base $controller |
|
74 | - * @return int |
|
75 | - * @throws EE_Error |
|
76 | - */ |
|
77 | - public static function optimumSalesNow($wpdb_row, $request, $controller) |
|
78 | - { |
|
79 | - $event_obj = null; |
|
80 | - if (Event::wpdbRowHasEventId($wpdb_row)) { |
|
81 | - $event_obj = EEM_Event::instance()->get_one_by_ID($wpdb_row['Event_CPT.ID']); |
|
82 | - } |
|
83 | - if ($event_obj instanceof EE_Event) { |
|
84 | - return $event_obj->total_available_spaces(true); |
|
85 | - } |
|
86 | - throw new EE_Error( |
|
87 | - sprintf( |
|
88 | - __( |
|
89 | - // @codingStandardsIgnoreStart |
|
90 | - 'Cannot calculate optimum_sales_now because the event with ID %1$s (from database row %2$s) was not found', |
|
91 | - // @codingStandardsIgnoreEnd |
|
92 | - 'event_espresso' |
|
93 | - ), |
|
94 | - $wpdb_row['Event_CPT.ID'], |
|
95 | - print_r($wpdb_row, true) |
|
96 | - ) |
|
97 | - ); |
|
98 | - } |
|
99 | - |
|
100 | - |
|
101 | - |
|
102 | - /** |
|
103 | - * Like optimum_sales_now, but minus total sales so far. |
|
104 | - * See EE_Event::spaces_remaining_for_sale( true ); |
|
105 | - * |
|
106 | - * @param array $wpdb_row |
|
107 | - * @param \WP_REST_Request $request |
|
108 | - * @param Base $controller |
|
109 | - * @return int |
|
110 | - * @throws EE_Error |
|
111 | - */ |
|
112 | - public static function spacesRemaining($wpdb_row, $request, $controller) |
|
113 | - { |
|
114 | - $event_obj = null; |
|
115 | - if (Event::wpdbRowHasEventId($wpdb_row)) { |
|
116 | - $event_obj = EEM_Event::instance()->get_one_by_ID($wpdb_row['Event_CPT.ID']); |
|
117 | - } |
|
118 | - if ($event_obj instanceof EE_Event) { |
|
119 | - return $event_obj->spaces_remaining_for_sale(); |
|
120 | - } |
|
121 | - throw new EE_Error( |
|
122 | - sprintf( |
|
123 | - __( |
|
124 | - // @codingStandardsIgnoreStart |
|
125 | - 'Cannot calculate spaces_remaining because the event with ID %1$s (from database row %2$s) was not found', |
|
126 | - // @codingStandardsIgnoreEnd |
|
127 | - 'event_espresso' |
|
128 | - ), |
|
129 | - $wpdb_row['Event_CPT.ID'], |
|
130 | - print_r($wpdb_row, true) |
|
131 | - ) |
|
132 | - ); |
|
133 | - } |
|
134 | - |
|
135 | - |
|
136 | - |
|
137 | - /** |
|
138 | - * Counts the number of approved registrations for this event (regardless |
|
139 | - * of how many datetimes each registrations' ticket purchase is for) |
|
140 | - * |
|
141 | - * @param array $wpdb_row |
|
142 | - * @param \WP_REST_Request $request |
|
143 | - * @param Base $controller |
|
144 | - * @return int |
|
145 | - * @throws EE_Error |
|
146 | - */ |
|
147 | - public static function spotsTaken($wpdb_row, $request, $controller) |
|
148 | - { |
|
149 | - if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
150 | - throw new EE_Error( |
|
151 | - sprintf( |
|
152 | - __( |
|
153 | - // @codingStandardsIgnoreStart |
|
154 | - 'Cannot calculate spots_taken because the database row %1$s does not have a valid entry for "Event_CPT.ID"', |
|
155 | - // @codingStandardsIgnoreEnd |
|
156 | - 'event_espresso' |
|
157 | - ), |
|
158 | - print_r($wpdb_row, true) |
|
159 | - ) |
|
160 | - ); |
|
161 | - } |
|
162 | - return EEM_Registration::instance()->count( |
|
163 | - array( |
|
164 | - array( |
|
165 | - 'EVT_ID' => $wpdb_row['Event_CPT.ID'], |
|
166 | - 'STS_ID' => EEM_Registration::status_id_approved, |
|
167 | - ), |
|
168 | - ), |
|
169 | - 'REG_ID', |
|
170 | - true |
|
171 | - ); |
|
172 | - } |
|
173 | - |
|
174 | - |
|
175 | - |
|
176 | - /** |
|
177 | - * Counts the number of pending-payment registrations for this event (regardless |
|
178 | - * of how many datetimes each registrations' ticket purchase is for) |
|
179 | - * |
|
180 | - * @param array $wpdb_row |
|
181 | - * @param \WP_REST_Request $request |
|
182 | - * @param Base $controller |
|
183 | - * @return int |
|
184 | - * @throws EE_Error |
|
185 | - * @throws RestException |
|
186 | - */ |
|
187 | - public static function spotsTakenPendingPayment($wpdb_row, $request, $controller) |
|
188 | - { |
|
189 | - if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
190 | - throw new EE_Error( |
|
191 | - sprintf( |
|
192 | - __( |
|
193 | - // @codingStandardsIgnoreStart |
|
194 | - 'Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Event_CPT.ID"', |
|
195 | - // @codingStandardsIgnoreEnd |
|
196 | - 'event_espresso' |
|
197 | - ), |
|
198 | - print_r($wpdb_row, true) |
|
199 | - ) |
|
200 | - ); |
|
201 | - } |
|
202 | - self::verifyCurrentUserCan('ee_read_registrations', 'spots_taken_pending_payment'); |
|
203 | - return EEM_Registration::instance()->count( |
|
204 | - array( |
|
205 | - array( |
|
206 | - 'EVT_ID' => $wpdb_row['Event_CPT.ID'], |
|
207 | - 'STS_ID' => EEM_Registration::status_id_pending_payment, |
|
208 | - ), |
|
209 | - ), |
|
210 | - 'REG_ID', |
|
211 | - true |
|
212 | - ); |
|
213 | - } |
|
214 | - |
|
215 | - |
|
216 | - |
|
217 | - /** |
|
218 | - * Counts all the registrations who have checked into one of this events' datetimes |
|
219 | - * See EE_Event::total_available_spaces( false ); |
|
220 | - * |
|
221 | - * @param array $wpdb_row |
|
222 | - * @param \WP_REST_Request $request |
|
223 | - * @param Base $controller |
|
224 | - * @return int|null if permission denied |
|
225 | - * @throws EE_Error |
|
226 | - * @throws RestException |
|
227 | - */ |
|
228 | - public static function registrationsCheckedInCount($wpdb_row, $request, $controller) |
|
229 | - { |
|
230 | - if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
231 | - throw new EE_Error( |
|
232 | - sprintf( |
|
233 | - __( |
|
234 | - // @codingStandardsIgnoreStart |
|
235 | - 'Cannot calculate registrations_checked_in_count because the database row %1$s does not have an entry for "Event_CPT.ID"', |
|
236 | - // @codingStandardsIgnoreEnd |
|
237 | - 'event_espresso' |
|
238 | - ), |
|
239 | - print_r($wpdb_row, true) |
|
240 | - ) |
|
241 | - ); |
|
242 | - } |
|
243 | - self::verifyCurrentUserCan('ee_read_checkins', 'registrations_checked_in_count'); |
|
244 | - return EEM_Registration::instance()->count_registrations_checked_into_event($wpdb_row['Event_CPT.ID'], true); |
|
245 | - } |
|
246 | - |
|
247 | - |
|
248 | - |
|
249 | - /** |
|
250 | - * Counts all the registrations who have checked out of one of this events' datetimes |
|
251 | - * See EE_Event::total_available_spaces( false ); |
|
252 | - * |
|
253 | - * @param array $wpdb_row |
|
254 | - * @param \WP_REST_Request $request |
|
255 | - * @param Base $controller |
|
256 | - * @return int |
|
257 | - * @throws EE_Error |
|
258 | - * @throws RestException |
|
259 | - */ |
|
260 | - public static function registrationsCheckedOutCount($wpdb_row, $request, $controller) |
|
261 | - { |
|
262 | - if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
263 | - throw new EE_Error( |
|
264 | - sprintf( |
|
265 | - __( |
|
266 | - // @codingStandardsIgnoreStart |
|
267 | - 'Cannot calculate registrations_checked_out_count because the database row %1$s does not have an entry for "Event_CPT.ID"', |
|
268 | - // @codingStandardsIgnoreEnd |
|
269 | - 'event_espresso' |
|
270 | - ), |
|
271 | - print_r($wpdb_row, true) |
|
272 | - ) |
|
273 | - ); |
|
274 | - } |
|
275 | - self::verifyCurrentUserCan('ee_read_checkins', 'registrations_checked_out_count'); |
|
276 | - return EEM_Registration::instance()->count_registrations_checked_into_event($wpdb_row['Event_CPT.ID'], false); |
|
277 | - } |
|
278 | - |
|
279 | - |
|
280 | - |
|
281 | - /** |
|
282 | - * Gets the thumbnail image |
|
283 | - * |
|
284 | - * @param array $wpdb_row |
|
285 | - * @param \WP_REST_Request $request |
|
286 | - * @param Base $controller |
|
287 | - * @return array |
|
288 | - * @throws EE_Error |
|
289 | - */ |
|
290 | - public static function imageThumbnail($wpdb_row, $request, $controller) |
|
291 | - { |
|
292 | - return self::calculateImageData($wpdb_row, 'thumbnail'); |
|
293 | - } |
|
294 | - |
|
295 | - |
|
296 | - |
|
297 | - /** |
|
298 | - * Gets the medium image |
|
299 | - * |
|
300 | - * @param array $wpdb_row |
|
301 | - * @param \WP_REST_Request $request |
|
302 | - * @param Base $controller |
|
303 | - * @return array |
|
304 | - * @throws EE_Error |
|
305 | - */ |
|
306 | - public static function imageMedium($wpdb_row, $request, $controller) |
|
307 | - { |
|
308 | - return self::calculateImageData($wpdb_row, 'medium'); |
|
309 | - } |
|
310 | - |
|
311 | - |
|
312 | - |
|
313 | - /** |
|
314 | - * Gets the medium-large image |
|
315 | - * |
|
316 | - * @param array $wpdb_row |
|
317 | - * @param \WP_REST_Request $request |
|
318 | - * @param Base $controller |
|
319 | - * @return array |
|
320 | - * @throws EE_Error |
|
321 | - */ |
|
322 | - public static function imageMediumLarge($wpdb_row, $request, $controller) |
|
323 | - { |
|
324 | - return self::calculateImageData($wpdb_row, 'medium_large'); |
|
325 | - } |
|
326 | - |
|
327 | - |
|
328 | - |
|
329 | - /** |
|
330 | - * Gets the large image |
|
331 | - * |
|
332 | - * @param array $wpdb_row |
|
333 | - * @param \WP_REST_Request $request |
|
334 | - * @param Base $controller |
|
335 | - * @return array |
|
336 | - * @throws EE_Error |
|
337 | - */ |
|
338 | - public static function imageLarge($wpdb_row, $request, $controller) |
|
339 | - { |
|
340 | - return self::calculateImageData($wpdb_row, 'large'); |
|
341 | - } |
|
342 | - |
|
343 | - |
|
344 | - |
|
345 | - /** |
|
346 | - * Gets the post-thumbnail image |
|
347 | - * |
|
348 | - * @param array $wpdb_row |
|
349 | - * @param \WP_REST_Request $request |
|
350 | - * @param Base $controller |
|
351 | - * @return array |
|
352 | - * @throws EE_Error |
|
353 | - */ |
|
354 | - public static function imagePostThumbnail($wpdb_row, $request, $controller) |
|
355 | - { |
|
356 | - return self::calculateImageData($wpdb_row, 'post-thumbnail'); |
|
357 | - } |
|
358 | - |
|
359 | - |
|
360 | - |
|
361 | - /** |
|
362 | - * Gets the full size image |
|
363 | - * |
|
364 | - * @param array $wpdb_row |
|
365 | - * @param \WP_REST_Request $request |
|
366 | - * @param Base $controller |
|
367 | - * @return array |
|
368 | - * @throws EE_Error |
|
369 | - */ |
|
370 | - public static function imageFull($wpdb_row, $request, $controller) |
|
371 | - { |
|
372 | - return self::calculateImageData($wpdb_row, 'full'); |
|
373 | - } |
|
374 | - |
|
375 | - |
|
376 | - |
|
377 | - /** |
|
378 | - * Gets image specs and formats them for the display in the API, |
|
379 | - * according to the image size requested |
|
380 | - * |
|
381 | - * @param array $wpdb_row |
|
382 | - * @param string $image_size one of these: thumbnail, medium, medium_large, large, post-thumbnail, full |
|
383 | - * @return array|false if no such image exists. If array it will have keys 'url', 'width', 'height' and 'original' |
|
384 | - * @throws EE_Error |
|
385 | - */ |
|
386 | - protected static function calculateImageData($wpdb_row, $image_size) |
|
387 | - { |
|
388 | - if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
389 | - throw new EE_Error( |
|
390 | - sprintf( |
|
391 | - __( |
|
392 | - // @codingStandardsIgnoreStart |
|
393 | - 'Cannot calculate image because the database row %1$s does not have an entry for "Event_CPT.ID"', |
|
394 | - // @codingStandardsIgnoreEnd |
|
395 | - 'event_espresso' |
|
396 | - ), |
|
397 | - print_r($wpdb_row, true) |
|
398 | - ) |
|
399 | - ); |
|
400 | - } |
|
401 | - $EVT_ID = $wpdb_row['Event_CPT.ID']; |
|
402 | - $attachment_id = get_post_thumbnail_id($EVT_ID); |
|
403 | - $data = wp_get_attachment_image_src($attachment_id, $image_size); |
|
404 | - if (! $data) { |
|
405 | - return null; |
|
406 | - } |
|
407 | - $generated = true; |
|
408 | - if (isset($data[3])) { |
|
409 | - $generated = $data[3]; |
|
410 | - } |
|
411 | - return array( |
|
412 | - 'url' => $data[0], |
|
413 | - 'width' => $data[1], |
|
414 | - 'height' => $data[2], |
|
415 | - 'generated' => $generated, |
|
416 | - ); |
|
417 | - } |
|
418 | - |
|
419 | - |
|
420 | - |
|
421 | - /** |
|
422 | - * Returns true if the array of data contains 'Event_CPT.ID'. False otherwise |
|
423 | - * @param array $wpdb_row |
|
424 | - * @return bool |
|
425 | - */ |
|
426 | - protected static function wpdbRowHasEventId($wpdb_row) |
|
427 | - { |
|
428 | - return (is_array($wpdb_row) && isset($wpdb_row['Event_CPT.ID']) && absint($wpdb_row['Event_CPT.ID'])); |
|
429 | - } |
|
30 | + /** |
|
31 | + * Calculates the total spaces on the event (not subtracting sales, but taking |
|
32 | + * sales into account; so this is the optimum sales that CAN still be achieved) |
|
33 | + * See EE_Event::total_available_spaces( true ); |
|
34 | + * |
|
35 | + * @param array $wpdb_row |
|
36 | + * @param \WP_REST_Request $request |
|
37 | + * @param Base $controller |
|
38 | + * @return int |
|
39 | + * @throws EE_Error |
|
40 | + */ |
|
41 | + public static function optimumSalesAtStart($wpdb_row, $request, $controller) |
|
42 | + { |
|
43 | + $event_obj = null; |
|
44 | + if (Event::wpdbRowHasEventId($wpdb_row)) { |
|
45 | + $event_obj = EEM_Event::instance()->get_one_by_ID($wpdb_row['Event_CPT.ID']); |
|
46 | + } |
|
47 | + if ($event_obj instanceof EE_Event) { |
|
48 | + return $event_obj->total_available_spaces(); |
|
49 | + } |
|
50 | + throw new EE_Error( |
|
51 | + sprintf( |
|
52 | + __( |
|
53 | + // @codingStandardsIgnoreStart |
|
54 | + 'Cannot calculate optimum_sales_at_start because the event with ID %1$s (from database row %2$s) was not found', |
|
55 | + // @codingStandardsIgnoreEnd |
|
56 | + 'event_espresso' |
|
57 | + ), |
|
58 | + $wpdb_row['Event_CPT.ID'], |
|
59 | + print_r($wpdb_row, true) |
|
60 | + ) |
|
61 | + ); |
|
62 | + } |
|
63 | + |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * Calculates the total spaces on the event (ignoring all sales; so this is the optimum |
|
68 | + * sales that COULD have been achieved) |
|
69 | + * See EE_Event::total_available_spaces( true ); |
|
70 | + * |
|
71 | + * @param array $wpdb_row |
|
72 | + * @param \WP_REST_Request $request |
|
73 | + * @param Base $controller |
|
74 | + * @return int |
|
75 | + * @throws EE_Error |
|
76 | + */ |
|
77 | + public static function optimumSalesNow($wpdb_row, $request, $controller) |
|
78 | + { |
|
79 | + $event_obj = null; |
|
80 | + if (Event::wpdbRowHasEventId($wpdb_row)) { |
|
81 | + $event_obj = EEM_Event::instance()->get_one_by_ID($wpdb_row['Event_CPT.ID']); |
|
82 | + } |
|
83 | + if ($event_obj instanceof EE_Event) { |
|
84 | + return $event_obj->total_available_spaces(true); |
|
85 | + } |
|
86 | + throw new EE_Error( |
|
87 | + sprintf( |
|
88 | + __( |
|
89 | + // @codingStandardsIgnoreStart |
|
90 | + 'Cannot calculate optimum_sales_now because the event with ID %1$s (from database row %2$s) was not found', |
|
91 | + // @codingStandardsIgnoreEnd |
|
92 | + 'event_espresso' |
|
93 | + ), |
|
94 | + $wpdb_row['Event_CPT.ID'], |
|
95 | + print_r($wpdb_row, true) |
|
96 | + ) |
|
97 | + ); |
|
98 | + } |
|
99 | + |
|
100 | + |
|
101 | + |
|
102 | + /** |
|
103 | + * Like optimum_sales_now, but minus total sales so far. |
|
104 | + * See EE_Event::spaces_remaining_for_sale( true ); |
|
105 | + * |
|
106 | + * @param array $wpdb_row |
|
107 | + * @param \WP_REST_Request $request |
|
108 | + * @param Base $controller |
|
109 | + * @return int |
|
110 | + * @throws EE_Error |
|
111 | + */ |
|
112 | + public static function spacesRemaining($wpdb_row, $request, $controller) |
|
113 | + { |
|
114 | + $event_obj = null; |
|
115 | + if (Event::wpdbRowHasEventId($wpdb_row)) { |
|
116 | + $event_obj = EEM_Event::instance()->get_one_by_ID($wpdb_row['Event_CPT.ID']); |
|
117 | + } |
|
118 | + if ($event_obj instanceof EE_Event) { |
|
119 | + return $event_obj->spaces_remaining_for_sale(); |
|
120 | + } |
|
121 | + throw new EE_Error( |
|
122 | + sprintf( |
|
123 | + __( |
|
124 | + // @codingStandardsIgnoreStart |
|
125 | + 'Cannot calculate spaces_remaining because the event with ID %1$s (from database row %2$s) was not found', |
|
126 | + // @codingStandardsIgnoreEnd |
|
127 | + 'event_espresso' |
|
128 | + ), |
|
129 | + $wpdb_row['Event_CPT.ID'], |
|
130 | + print_r($wpdb_row, true) |
|
131 | + ) |
|
132 | + ); |
|
133 | + } |
|
134 | + |
|
135 | + |
|
136 | + |
|
137 | + /** |
|
138 | + * Counts the number of approved registrations for this event (regardless |
|
139 | + * of how many datetimes each registrations' ticket purchase is for) |
|
140 | + * |
|
141 | + * @param array $wpdb_row |
|
142 | + * @param \WP_REST_Request $request |
|
143 | + * @param Base $controller |
|
144 | + * @return int |
|
145 | + * @throws EE_Error |
|
146 | + */ |
|
147 | + public static function spotsTaken($wpdb_row, $request, $controller) |
|
148 | + { |
|
149 | + if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
150 | + throw new EE_Error( |
|
151 | + sprintf( |
|
152 | + __( |
|
153 | + // @codingStandardsIgnoreStart |
|
154 | + 'Cannot calculate spots_taken because the database row %1$s does not have a valid entry for "Event_CPT.ID"', |
|
155 | + // @codingStandardsIgnoreEnd |
|
156 | + 'event_espresso' |
|
157 | + ), |
|
158 | + print_r($wpdb_row, true) |
|
159 | + ) |
|
160 | + ); |
|
161 | + } |
|
162 | + return EEM_Registration::instance()->count( |
|
163 | + array( |
|
164 | + array( |
|
165 | + 'EVT_ID' => $wpdb_row['Event_CPT.ID'], |
|
166 | + 'STS_ID' => EEM_Registration::status_id_approved, |
|
167 | + ), |
|
168 | + ), |
|
169 | + 'REG_ID', |
|
170 | + true |
|
171 | + ); |
|
172 | + } |
|
173 | + |
|
174 | + |
|
175 | + |
|
176 | + /** |
|
177 | + * Counts the number of pending-payment registrations for this event (regardless |
|
178 | + * of how many datetimes each registrations' ticket purchase is for) |
|
179 | + * |
|
180 | + * @param array $wpdb_row |
|
181 | + * @param \WP_REST_Request $request |
|
182 | + * @param Base $controller |
|
183 | + * @return int |
|
184 | + * @throws EE_Error |
|
185 | + * @throws RestException |
|
186 | + */ |
|
187 | + public static function spotsTakenPendingPayment($wpdb_row, $request, $controller) |
|
188 | + { |
|
189 | + if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
190 | + throw new EE_Error( |
|
191 | + sprintf( |
|
192 | + __( |
|
193 | + // @codingStandardsIgnoreStart |
|
194 | + 'Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Event_CPT.ID"', |
|
195 | + // @codingStandardsIgnoreEnd |
|
196 | + 'event_espresso' |
|
197 | + ), |
|
198 | + print_r($wpdb_row, true) |
|
199 | + ) |
|
200 | + ); |
|
201 | + } |
|
202 | + self::verifyCurrentUserCan('ee_read_registrations', 'spots_taken_pending_payment'); |
|
203 | + return EEM_Registration::instance()->count( |
|
204 | + array( |
|
205 | + array( |
|
206 | + 'EVT_ID' => $wpdb_row['Event_CPT.ID'], |
|
207 | + 'STS_ID' => EEM_Registration::status_id_pending_payment, |
|
208 | + ), |
|
209 | + ), |
|
210 | + 'REG_ID', |
|
211 | + true |
|
212 | + ); |
|
213 | + } |
|
214 | + |
|
215 | + |
|
216 | + |
|
217 | + /** |
|
218 | + * Counts all the registrations who have checked into one of this events' datetimes |
|
219 | + * See EE_Event::total_available_spaces( false ); |
|
220 | + * |
|
221 | + * @param array $wpdb_row |
|
222 | + * @param \WP_REST_Request $request |
|
223 | + * @param Base $controller |
|
224 | + * @return int|null if permission denied |
|
225 | + * @throws EE_Error |
|
226 | + * @throws RestException |
|
227 | + */ |
|
228 | + public static function registrationsCheckedInCount($wpdb_row, $request, $controller) |
|
229 | + { |
|
230 | + if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
231 | + throw new EE_Error( |
|
232 | + sprintf( |
|
233 | + __( |
|
234 | + // @codingStandardsIgnoreStart |
|
235 | + 'Cannot calculate registrations_checked_in_count because the database row %1$s does not have an entry for "Event_CPT.ID"', |
|
236 | + // @codingStandardsIgnoreEnd |
|
237 | + 'event_espresso' |
|
238 | + ), |
|
239 | + print_r($wpdb_row, true) |
|
240 | + ) |
|
241 | + ); |
|
242 | + } |
|
243 | + self::verifyCurrentUserCan('ee_read_checkins', 'registrations_checked_in_count'); |
|
244 | + return EEM_Registration::instance()->count_registrations_checked_into_event($wpdb_row['Event_CPT.ID'], true); |
|
245 | + } |
|
246 | + |
|
247 | + |
|
248 | + |
|
249 | + /** |
|
250 | + * Counts all the registrations who have checked out of one of this events' datetimes |
|
251 | + * See EE_Event::total_available_spaces( false ); |
|
252 | + * |
|
253 | + * @param array $wpdb_row |
|
254 | + * @param \WP_REST_Request $request |
|
255 | + * @param Base $controller |
|
256 | + * @return int |
|
257 | + * @throws EE_Error |
|
258 | + * @throws RestException |
|
259 | + */ |
|
260 | + public static function registrationsCheckedOutCount($wpdb_row, $request, $controller) |
|
261 | + { |
|
262 | + if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
263 | + throw new EE_Error( |
|
264 | + sprintf( |
|
265 | + __( |
|
266 | + // @codingStandardsIgnoreStart |
|
267 | + 'Cannot calculate registrations_checked_out_count because the database row %1$s does not have an entry for "Event_CPT.ID"', |
|
268 | + // @codingStandardsIgnoreEnd |
|
269 | + 'event_espresso' |
|
270 | + ), |
|
271 | + print_r($wpdb_row, true) |
|
272 | + ) |
|
273 | + ); |
|
274 | + } |
|
275 | + self::verifyCurrentUserCan('ee_read_checkins', 'registrations_checked_out_count'); |
|
276 | + return EEM_Registration::instance()->count_registrations_checked_into_event($wpdb_row['Event_CPT.ID'], false); |
|
277 | + } |
|
278 | + |
|
279 | + |
|
280 | + |
|
281 | + /** |
|
282 | + * Gets the thumbnail image |
|
283 | + * |
|
284 | + * @param array $wpdb_row |
|
285 | + * @param \WP_REST_Request $request |
|
286 | + * @param Base $controller |
|
287 | + * @return array |
|
288 | + * @throws EE_Error |
|
289 | + */ |
|
290 | + public static function imageThumbnail($wpdb_row, $request, $controller) |
|
291 | + { |
|
292 | + return self::calculateImageData($wpdb_row, 'thumbnail'); |
|
293 | + } |
|
294 | + |
|
295 | + |
|
296 | + |
|
297 | + /** |
|
298 | + * Gets the medium image |
|
299 | + * |
|
300 | + * @param array $wpdb_row |
|
301 | + * @param \WP_REST_Request $request |
|
302 | + * @param Base $controller |
|
303 | + * @return array |
|
304 | + * @throws EE_Error |
|
305 | + */ |
|
306 | + public static function imageMedium($wpdb_row, $request, $controller) |
|
307 | + { |
|
308 | + return self::calculateImageData($wpdb_row, 'medium'); |
|
309 | + } |
|
310 | + |
|
311 | + |
|
312 | + |
|
313 | + /** |
|
314 | + * Gets the medium-large image |
|
315 | + * |
|
316 | + * @param array $wpdb_row |
|
317 | + * @param \WP_REST_Request $request |
|
318 | + * @param Base $controller |
|
319 | + * @return array |
|
320 | + * @throws EE_Error |
|
321 | + */ |
|
322 | + public static function imageMediumLarge($wpdb_row, $request, $controller) |
|
323 | + { |
|
324 | + return self::calculateImageData($wpdb_row, 'medium_large'); |
|
325 | + } |
|
326 | + |
|
327 | + |
|
328 | + |
|
329 | + /** |
|
330 | + * Gets the large image |
|
331 | + * |
|
332 | + * @param array $wpdb_row |
|
333 | + * @param \WP_REST_Request $request |
|
334 | + * @param Base $controller |
|
335 | + * @return array |
|
336 | + * @throws EE_Error |
|
337 | + */ |
|
338 | + public static function imageLarge($wpdb_row, $request, $controller) |
|
339 | + { |
|
340 | + return self::calculateImageData($wpdb_row, 'large'); |
|
341 | + } |
|
342 | + |
|
343 | + |
|
344 | + |
|
345 | + /** |
|
346 | + * Gets the post-thumbnail image |
|
347 | + * |
|
348 | + * @param array $wpdb_row |
|
349 | + * @param \WP_REST_Request $request |
|
350 | + * @param Base $controller |
|
351 | + * @return array |
|
352 | + * @throws EE_Error |
|
353 | + */ |
|
354 | + public static function imagePostThumbnail($wpdb_row, $request, $controller) |
|
355 | + { |
|
356 | + return self::calculateImageData($wpdb_row, 'post-thumbnail'); |
|
357 | + } |
|
358 | + |
|
359 | + |
|
360 | + |
|
361 | + /** |
|
362 | + * Gets the full size image |
|
363 | + * |
|
364 | + * @param array $wpdb_row |
|
365 | + * @param \WP_REST_Request $request |
|
366 | + * @param Base $controller |
|
367 | + * @return array |
|
368 | + * @throws EE_Error |
|
369 | + */ |
|
370 | + public static function imageFull($wpdb_row, $request, $controller) |
|
371 | + { |
|
372 | + return self::calculateImageData($wpdb_row, 'full'); |
|
373 | + } |
|
374 | + |
|
375 | + |
|
376 | + |
|
377 | + /** |
|
378 | + * Gets image specs and formats them for the display in the API, |
|
379 | + * according to the image size requested |
|
380 | + * |
|
381 | + * @param array $wpdb_row |
|
382 | + * @param string $image_size one of these: thumbnail, medium, medium_large, large, post-thumbnail, full |
|
383 | + * @return array|false if no such image exists. If array it will have keys 'url', 'width', 'height' and 'original' |
|
384 | + * @throws EE_Error |
|
385 | + */ |
|
386 | + protected static function calculateImageData($wpdb_row, $image_size) |
|
387 | + { |
|
388 | + if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
389 | + throw new EE_Error( |
|
390 | + sprintf( |
|
391 | + __( |
|
392 | + // @codingStandardsIgnoreStart |
|
393 | + 'Cannot calculate image because the database row %1$s does not have an entry for "Event_CPT.ID"', |
|
394 | + // @codingStandardsIgnoreEnd |
|
395 | + 'event_espresso' |
|
396 | + ), |
|
397 | + print_r($wpdb_row, true) |
|
398 | + ) |
|
399 | + ); |
|
400 | + } |
|
401 | + $EVT_ID = $wpdb_row['Event_CPT.ID']; |
|
402 | + $attachment_id = get_post_thumbnail_id($EVT_ID); |
|
403 | + $data = wp_get_attachment_image_src($attachment_id, $image_size); |
|
404 | + if (! $data) { |
|
405 | + return null; |
|
406 | + } |
|
407 | + $generated = true; |
|
408 | + if (isset($data[3])) { |
|
409 | + $generated = $data[3]; |
|
410 | + } |
|
411 | + return array( |
|
412 | + 'url' => $data[0], |
|
413 | + 'width' => $data[1], |
|
414 | + 'height' => $data[2], |
|
415 | + 'generated' => $generated, |
|
416 | + ); |
|
417 | + } |
|
418 | + |
|
419 | + |
|
420 | + |
|
421 | + /** |
|
422 | + * Returns true if the array of data contains 'Event_CPT.ID'. False otherwise |
|
423 | + * @param array $wpdb_row |
|
424 | + * @return bool |
|
425 | + */ |
|
426 | + protected static function wpdbRowHasEventId($wpdb_row) |
|
427 | + { |
|
428 | + return (is_array($wpdb_row) && isset($wpdb_row['Event_CPT.ID']) && absint($wpdb_row['Event_CPT.ID'])); |
|
429 | + } |
|
430 | 430 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @author Mike Nelson |
19 | 19 | * |
20 | 20 | */ |
21 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
21 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
22 | 22 | exit('No direct script access allowed'); |
23 | 23 | } |
24 | 24 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public static function spotsTaken($wpdb_row, $request, $controller) |
148 | 148 | { |
149 | - if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
149 | + if ( ! Event::wpdbRowHasEventId($wpdb_row)) { |
|
150 | 150 | throw new EE_Error( |
151 | 151 | sprintf( |
152 | 152 | __( |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public static function spotsTakenPendingPayment($wpdb_row, $request, $controller) |
188 | 188 | { |
189 | - if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
189 | + if ( ! Event::wpdbRowHasEventId($wpdb_row)) { |
|
190 | 190 | throw new EE_Error( |
191 | 191 | sprintf( |
192 | 192 | __( |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public static function registrationsCheckedInCount($wpdb_row, $request, $controller) |
229 | 229 | { |
230 | - if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
230 | + if ( ! Event::wpdbRowHasEventId($wpdb_row)) { |
|
231 | 231 | throw new EE_Error( |
232 | 232 | sprintf( |
233 | 233 | __( |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public static function registrationsCheckedOutCount($wpdb_row, $request, $controller) |
261 | 261 | { |
262 | - if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
262 | + if ( ! Event::wpdbRowHasEventId($wpdb_row)) { |
|
263 | 263 | throw new EE_Error( |
264 | 264 | sprintf( |
265 | 265 | __( |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | */ |
386 | 386 | protected static function calculateImageData($wpdb_row, $image_size) |
387 | 387 | { |
388 | - if (! Event::wpdbRowHasEventId($wpdb_row)) { |
|
388 | + if ( ! Event::wpdbRowHasEventId($wpdb_row)) { |
|
389 | 389 | throw new EE_Error( |
390 | 390 | sprintf( |
391 | 391 | __( |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $EVT_ID = $wpdb_row['Event_CPT.ID']; |
402 | 402 | $attachment_id = get_post_thumbnail_id($EVT_ID); |
403 | 403 | $data = wp_get_attachment_image_src($attachment_id, $image_size); |
404 | - if (! $data) { |
|
404 | + if ( ! $data) { |
|
405 | 405 | return null; |
406 | 406 | } |
407 | 407 | $generated = true; |