@@ -125,14 +125,14 @@ |
||
125 | 125 | public function get_attendee_property_answer_value( EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE ){ |
126 | 126 | $field_name = NULL; |
127 | 127 | $value = NULL; |
128 | - //backward compat: we still want to find the question's ID |
|
129 | - if( is_numeric( $question_system_id ) ) { |
|
130 | - //find this question's QST_system value |
|
131 | - $question_id = $question_system_id; |
|
132 | - $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' ); |
|
133 | - } else { |
|
134 | - $question_id = intval( EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ) ); |
|
135 | - } |
|
128 | + //backward compat: we still want to find the question's ID |
|
129 | + if( is_numeric( $question_system_id ) ) { |
|
130 | + //find this question's QST_system value |
|
131 | + $question_id = $question_system_id; |
|
132 | + $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' ); |
|
133 | + } else { |
|
134 | + $question_id = intval( EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ) ); |
|
135 | + } |
|
136 | 136 | //only bother checking if the registration has an attendee |
137 | 137 | if( $registration->attendee() instanceof EE_Attendee ) { |
138 | 138 | $field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question( $question_system_id ); |
@@ -51,18 +51,18 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * constructor |
53 | 53 | */ |
54 | - protected function __construct( $timezone = NULL ){ |
|
55 | - $this->singular_item = __('Answer','event_espresso'); |
|
56 | - $this->plural_item = __('Answers','event_espresso'); |
|
54 | + protected function __construct($timezone = NULL) { |
|
55 | + $this->singular_item = __('Answer', 'event_espresso'); |
|
56 | + $this->plural_item = __('Answers', 'event_espresso'); |
|
57 | 57 | $this->_tables = array( |
58 | 58 | 'Answer'=> new EE_Primary_Table('esp_answer', 'ANS_ID') |
59 | 59 | ); |
60 | 60 | $this->_fields = array( |
61 | 61 | 'Answer'=>array( |
62 | - 'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID','event_espresso')), |
|
63 | - 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID','event_espresso'), false, 0, 'Registration'), |
|
64 | - 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'), |
|
65 | - 'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value','event_espresso'), false, '') |
|
62 | + 'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID', 'event_espresso')), |
|
63 | + 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'), |
|
64 | + 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'), |
|
65 | + 'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value', 'event_espresso'), false, '') |
|
66 | 66 | )); |
67 | 67 | $this->_model_relations = array( |
68 | 68 | 'Registration'=>new EE_Belongs_To_Relation(), |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | ); |
71 | 71 | $this->_model_chain_to_wp_user = 'Registration.Event'; |
72 | 72 | $this->_caps_slug = 'registrations'; |
73 | - parent::__construct( $timezone ); |
|
73 | + parent::__construct($timezone); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -83,19 +83,19 @@ discard block |
||
83 | 83 | * @param boolean $pretty_answer whether to call 'pretty_value' or just 'value' |
84 | 84 | * @return string |
85 | 85 | */ |
86 | - public function get_answer_value_to_question( EE_Registration $registration, $question_id = NULL,$pretty_answer = FALSE ){ |
|
87 | - $value = $this->get_attendee_property_answer_value( $registration, $question_id, $pretty_answer ); |
|
88 | - if ( $value === NULL ){ |
|
89 | - $answer_obj = $this->get_registration_question_answer_object( $registration, $question_id, $pretty_answer ); |
|
90 | - if( $answer_obj instanceof EE_Answer ){ |
|
91 | - if($pretty_answer){ |
|
86 | + public function get_answer_value_to_question(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) { |
|
87 | + $value = $this->get_attendee_property_answer_value($registration, $question_id, $pretty_answer); |
|
88 | + if ($value === NULL) { |
|
89 | + $answer_obj = $this->get_registration_question_answer_object($registration, $question_id, $pretty_answer); |
|
90 | + if ($answer_obj instanceof EE_Answer) { |
|
91 | + if ($pretty_answer) { |
|
92 | 92 | $value = $answer_obj->pretty_value(); |
93 | - }else{ |
|
93 | + } else { |
|
94 | 94 | $value = $answer_obj->value(); |
95 | 95 | } |
96 | 96 | } |
97 | 97 | } |
98 | - return apply_filters( 'FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id ); |
|
98 | + return apply_filters('FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | * @param int $question_id |
107 | 107 | * @return EE_Answer |
108 | 108 | */ |
109 | - public function get_registration_question_answer_object( EE_Registration $registration, $question_id = NULL){ |
|
110 | - $answer_obj = $this->get_one( array( array( 'QST_ID'=>$question_id, 'REG_ID'=>$registration->ID() ))); |
|
111 | - return apply_filters( 'FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id ); |
|
109 | + public function get_registration_question_answer_object(EE_Registration $registration, $question_id = NULL) { |
|
110 | + $answer_obj = $this->get_one(array(array('QST_ID'=>$question_id, 'REG_ID'=>$registration->ID()))); |
|
111 | + return apply_filters('FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -122,39 +122,39 @@ discard block |
||
122 | 122 | * @return string|null (if the registration has no attendee, or the question_system_id is not a QST_ID or QST_system for |
123 | 123 | * a question corresponding to an attendee field, returns null) |
124 | 124 | */ |
125 | - public function get_attendee_property_answer_value( EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE ){ |
|
125 | + public function get_attendee_property_answer_value(EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE) { |
|
126 | 126 | $field_name = NULL; |
127 | 127 | $value = NULL; |
128 | 128 | //backward compat: we still want to find the question's ID |
129 | - if( is_numeric( $question_system_id ) ) { |
|
129 | + if (is_numeric($question_system_id)) { |
|
130 | 130 | //find this question's QST_system value |
131 | 131 | $question_id = $question_system_id; |
132 | - $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' ); |
|
132 | + $question_system_id = EEM_Question::instance()->get_var(array(array('QST_ID' => $question_system_id)), 'QST_system'); |
|
133 | 133 | } else { |
134 | - $question_id = intval( EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ) ); |
|
134 | + $question_id = intval(EEM_Question::instance()->get_var(array(array('QST_system' => $question_system_id)), 'QST_ID')); |
|
135 | 135 | } |
136 | 136 | //only bother checking if the registration has an attendee |
137 | - if( $registration->attendee() instanceof EE_Attendee ) { |
|
138 | - $field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question( $question_system_id ); |
|
139 | - if( $field_name ) { |
|
140 | - if( $pretty_answer ) { |
|
141 | - if( $field_name == 'STA_ID' ) { |
|
137 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
138 | + $field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question($question_system_id); |
|
139 | + if ($field_name) { |
|
140 | + if ($pretty_answer) { |
|
141 | + if ($field_name == 'STA_ID') { |
|
142 | 142 | $state = $registration->attendee()->state_obj(); |
143 | - $value = $state instanceof EE_State ? $state->name() : sprintf( __('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID() ); |
|
144 | - } else if($field_name == 'CNT_ISO') { |
|
143 | + $value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID()); |
|
144 | + } else if ($field_name == 'CNT_ISO') { |
|
145 | 145 | $country = $registration->attendee()->country_obj(); |
146 | - $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID()); |
|
146 | + $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"), $registration->attendee()->country_ID()); |
|
147 | 147 | } else { |
148 | - $value = $registration->attendee()->get_pretty( $field_name ); |
|
148 | + $value = $registration->attendee()->get_pretty($field_name); |
|
149 | 149 | } |
150 | 150 | //if field name is blank, leave the value as null too |
151 | - }else{ |
|
152 | - $value = $registration->attendee()->get( $field_name ); |
|
151 | + } else { |
|
152 | + $value = $registration->attendee()->get($field_name); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | //if no field was found, leave value blank |
156 | 156 | } |
157 | - return apply_filters( 'FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id, $question_system_id ); |
|
157 | + return apply_filters('FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id, $question_system_id); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 |
@@ -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 | * |
@@ -90,7 +92,7 @@ discard block |
||
90 | 92 | if( $answer_obj instanceof EE_Answer ){ |
91 | 93 | if($pretty_answer){ |
92 | 94 | $value = $answer_obj->pretty_value(); |
93 | - }else{ |
|
95 | + } else{ |
|
94 | 96 | $value = $answer_obj->value(); |
95 | 97 | } |
96 | 98 | } |
@@ -148,7 +150,7 @@ discard block |
||
148 | 150 | $value = $registration->attendee()->get_pretty( $field_name ); |
149 | 151 | } |
150 | 152 | //if field name is blank, leave the value as null too |
151 | - }else{ |
|
153 | + } else{ |
|
152 | 154 | $value = $registration->attendee()->get( $field_name ); |
153 | 155 | } |
154 | 156 | } |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | |
76 | 76 | |
77 | 77 | /** |
78 | - * create new blank datetime |
|
79 | - * |
|
80 | - * @access public |
|
81 | - * @return EE_Datetime[] array on success, FALSE on fail |
|
82 | - */ |
|
78 | + * create new blank datetime |
|
79 | + * |
|
80 | + * @access public |
|
81 | + * @return EE_Datetime[] array on success, FALSE on fail |
|
82 | + */ |
|
83 | 83 | public function create_new_blank_datetime() { |
84 | 84 | $blank_datetime = EE_Datetime::new_instance( |
85 | 85 | array( |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | |
101 | 101 | |
102 | 102 | /** |
103 | - * get event start date from db |
|
104 | - * |
|
105 | - * @access public |
|
106 | - * @param int $EVT_ID |
|
107 | - * @return EE_Datetime[] array on success, FALSE on fail |
|
108 | - */ |
|
103 | + * get event start date from db |
|
104 | + * |
|
105 | + * @access public |
|
106 | + * @param int $EVT_ID |
|
107 | + * @return EE_Datetime[] array on success, FALSE on fail |
|
108 | + */ |
|
109 | 109 | public function get_all_event_dates( $EVT_ID = 0 ) { |
110 | 110 | if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0 |
111 | 111 | return $this->create_new_blank_datetime(); |
@@ -250,14 +250,14 @@ discard block |
||
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
253 | - * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered |
|
254 | - * only by start date |
|
255 | - * @param int $TKT_ID |
|
256 | - * @param boolean $include_expired |
|
257 | - * @param boolean $include_deleted |
|
258 | - * @param int $limit |
|
259 | - * @return EE_Datetime[] |
|
260 | - */ |
|
253 | + * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered |
|
254 | + * only by start date |
|
255 | + * @param int $TKT_ID |
|
256 | + * @param boolean $include_expired |
|
257 | + * @param boolean $include_deleted |
|
258 | + * @param int $limit |
|
259 | + * @return EE_Datetime[] |
|
260 | + */ |
|
261 | 261 | public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){ |
262 | 262 | //sanitize TKT_ID |
263 | 263 | $TKT_ID = intval( $TKT_ID ); |
@@ -443,7 +443,7 @@ |
||
443 | 443 | /** |
444 | 444 | * This returns an array of counts of datetimes in the database for each Datetime status that can be queried. |
445 | 445 | * |
446 | - * @param array $stati_to_include If included you can restrict the statuses we return counts for by including the stati |
|
446 | + * @param string[] $stati_to_include If included you can restrict the statuses we return counts for by including the stati |
|
447 | 447 | * you want counts for as values in the array. An empty array returns counts for all valid |
448 | 448 | * stati. |
449 | 449 | * @param array $query_params If included can be used to refine the conditions for returning the count (i.e. only for |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once ( EE_CLASSES . 'EE_Datetime.class.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once (EE_CLASSES.'EE_Datetime.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Datetime extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -35,27 +35,27 @@ discard block |
||
35 | 35 | * @access private |
36 | 36 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
37 | 37 | */ |
38 | - protected function __construct( $timezone ) { |
|
39 | - $this->singular_item = __('Datetime','event_espresso'); |
|
40 | - $this->plural_item = __('Datetimes','event_espresso'); |
|
38 | + protected function __construct($timezone) { |
|
39 | + $this->singular_item = __('Datetime', 'event_espresso'); |
|
40 | + $this->plural_item = __('Datetimes', 'event_espresso'); |
|
41 | 41 | |
42 | 42 | $this->_tables = array( |
43 | 43 | 'Datetime'=> new EE_Primary_Table('esp_datetime', 'DTT_ID') |
44 | 44 | ); |
45 | 45 | $this->_fields = array( |
46 | 46 | 'Datetime'=>array( |
47 | - 'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID','event_espresso')), |
|
48 | - 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'), |
|
47 | + 'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')), |
|
48 | + 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
49 | 49 | 'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''), |
50 | 50 | 'DTT_description' => new EE_Post_Content_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''), |
51 | - 'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event','event_espresso'), false, time(), $timezone ), |
|
52 | - 'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event','event_espresso'), false, time(), $timezone ), |
|
53 | - 'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time','event_espresso'), true, EE_INF), |
|
54 | - 'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0 ), |
|
55 | - 'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false,false), |
|
51 | + 'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, time(), $timezone), |
|
52 | + 'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, time(), $timezone), |
|
53 | + 'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, EE_INF), |
|
54 | + 'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0), |
|
55 | + 'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false), |
|
56 | 56 | 'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0), |
57 | - 'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0 ), |
|
58 | - 'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ), |
|
57 | + 'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0), |
|
58 | + 'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false), |
|
59 | 59 | )); |
60 | 60 | $this->_model_relations = array( |
61 | 61 | 'Ticket'=>new EE_HABTM_Relation('Datetime_Ticket'), |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | ); |
65 | 65 | $this->_model_chain_to_wp_user = 'Event'; |
66 | 66 | //this model is generally available for reading |
67 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' ); |
|
68 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' ); |
|
69 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' ); |
|
70 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit ); |
|
71 | - parent::__construct( $timezone ); |
|
67 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event'); |
|
68 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event'); |
|
69 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event'); |
|
70 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit); |
|
71 | + parent::__construct($timezone); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -83,16 +83,16 @@ discard block |
||
83 | 83 | public function create_new_blank_datetime() { |
84 | 84 | $blank_datetime = EE_Datetime::new_instance( |
85 | 85 | array( |
86 | - 'DTT_EVT_start' => $this->current_time_for_query( 'DTT_EVT_start', true ) + (60 * 60 * 24 * 30), |
|
87 | - 'DTT_EVT_end' => $this->current_time_for_query( 'DTT_EVT_end', true ) + (60 * 60 * 24 * 30), |
|
86 | + 'DTT_EVT_start' => $this->current_time_for_query('DTT_EVT_start', true) + (60 * 60 * 24 * 30), |
|
87 | + 'DTT_EVT_end' => $this->current_time_for_query('DTT_EVT_end', true) + (60 * 60 * 24 * 30), |
|
88 | 88 | 'DTT_order' => 1, |
89 | 89 | 'DTT_reg_limit' => EE_INF |
90 | 90 | ), |
91 | 91 | $this->_timezone |
92 | 92 | ); |
93 | - $blank_datetime->set_start_time( $this->convert_datetime_for_query( 'DTT_EVT_start', '8am', 'ga', $this->_timezone ) ); |
|
94 | - $blank_datetime->set_end_time( $this->convert_datetime_for_query( 'DTT_EVT_end', '5pm', 'ga', $this->_timezone ) ); |
|
95 | - return array( $blank_datetime ); |
|
93 | + $blank_datetime->set_start_time($this->convert_datetime_for_query('DTT_EVT_start', '8am', 'ga', $this->_timezone)); |
|
94 | + $blank_datetime->set_end_time($this->convert_datetime_for_query('DTT_EVT_end', '5pm', 'ga', $this->_timezone)); |
|
95 | + return array($blank_datetime); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | * @param int $EVT_ID |
107 | 107 | * @return EE_Datetime[] array on success, FALSE on fail |
108 | 108 | */ |
109 | - public function get_all_event_dates( $EVT_ID = 0 ) { |
|
110 | - if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0 |
|
109 | + public function get_all_event_dates($EVT_ID = 0) { |
|
110 | + if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0 |
|
111 | 111 | return $this->create_new_blank_datetime(); |
112 | 112 | } |
113 | - $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID); |
|
113 | + $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID); |
|
114 | 114 | |
115 | - if ( empty( $results ) ) { |
|
115 | + if (empty($results)) { |
|
116 | 116 | return $this->create_new_blank_datetime(); |
117 | 117 | } |
118 | 118 | |
@@ -133,26 +133,26 @@ discard block |
||
133 | 133 | * the given number |
134 | 134 | * @return EE_Datetime[] |
135 | 135 | */ |
136 | - public function get_datetimes_for_event_ordered_by_DTT_order( $EVT_ID, $include_expired = TRUE, $include_deleted= TRUE, $limit = NULL ) { |
|
136 | + public function get_datetimes_for_event_ordered_by_DTT_order($EVT_ID, $include_expired = TRUE, $include_deleted = TRUE, $limit = NULL) { |
|
137 | 137 | |
138 | 138 | //sanitize EVT_ID |
139 | - $EVT_ID = intval( $EVT_ID ); |
|
139 | + $EVT_ID = intval($EVT_ID); |
|
140 | 140 | |
141 | 141 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
142 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
143 | - $where_params = array( 'Event.EVT_ID' => $EVT_ID ); |
|
142 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
143 | + $where_params = array('Event.EVT_ID' => $EVT_ID); |
|
144 | 144 | |
145 | - $query_params = ! empty( $limit ) ? array( $where_params, 'limit' => $limit, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ) : array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ); |
|
145 | + $query_params = ! empty($limit) ? array($where_params, 'limit' => $limit, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none') : array($where_params, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none'); |
|
146 | 146 | |
147 | - if( ! $include_expired){ |
|
148 | - $query_params[0]['DTT_EVT_end'] = array( '>=', current_time( 'mysql', TRUE ) ); |
|
147 | + if ( ! $include_expired) { |
|
148 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
149 | 149 | } |
150 | - if( $include_deleted){ |
|
151 | - $query_params[0]['DTT_deleted'] = array( 'IN', array( TRUE, FALSE )); |
|
150 | + if ($include_deleted) { |
|
151 | + $query_params[0]['DTT_deleted'] = array('IN', array(TRUE, FALSE)); |
|
152 | 152 | } |
153 | 153 | |
154 | - $result = $this->get_all( $query_params ); |
|
155 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
154 | + $result = $this->get_all($query_params); |
|
155 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
156 | 156 | return $result; |
157 | 157 | } |
158 | 158 | |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * @param int $limit |
168 | 168 | * @return EE_Datetime[] |
169 | 169 | */ |
170 | - public function get_datetimes_for_event_ordered_by_importance( $EVT_ID = 0, $limit = NULL){ |
|
171 | - return $this->get_all( array(array('Event.EVT_ID'=>$EVT_ID), |
|
170 | + public function get_datetimes_for_event_ordered_by_importance($EVT_ID = 0, $limit = NULL) { |
|
171 | + return $this->get_all(array(array('Event.EVT_ID'=>$EVT_ID), |
|
172 | 172 | 'limit'=>$limit, |
173 | 173 | 'order_by'=>array('DTT_EVT_start'=>'ASC'), |
174 | 174 | 'default_where_conditions' => 'none')); |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | * @param boolean $include_deleted |
184 | 184 | * @return EE_Datetime |
185 | 185 | */ |
186 | - public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false,$include_deleted = false){ |
|
187 | - $results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1); |
|
188 | - if($results){ |
|
186 | + public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false) { |
|
187 | + $results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1); |
|
188 | + if ($results) { |
|
189 | 189 | return array_shift($results); |
190 | - }else{ |
|
190 | + } else { |
|
191 | 191 | return NULL; |
192 | 192 | } |
193 | 193 | } |
@@ -201,16 +201,16 @@ discard block |
||
201 | 201 | * @param bool $try_to_exclude_deleted |
202 | 202 | * @return \EE_Datetime |
203 | 203 | */ |
204 | - public function get_primary_datetime_for_event($EVT_ID,$try_to_exclude_expired = true, $try_to_exclude_deleted = true){ |
|
205 | - if($try_to_exclude_expired){ |
|
206 | - $non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false,false); |
|
207 | - if($non_expired){ |
|
204 | + public function get_primary_datetime_for_event($EVT_ID, $try_to_exclude_expired = true, $try_to_exclude_deleted = true) { |
|
205 | + if ($try_to_exclude_expired) { |
|
206 | + $non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false); |
|
207 | + if ($non_expired) { |
|
208 | 208 | return $non_expired; |
209 | 209 | } |
210 | 210 | } |
211 | - if($try_to_exclude_deleted){ |
|
211 | + if ($try_to_exclude_deleted) { |
|
212 | 212 | $expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true); |
213 | - if($expired_even){ |
|
213 | + if ($expired_even) { |
|
214 | 214 | return $expired_even; |
215 | 215 | } |
216 | 216 | } |
@@ -229,23 +229,23 @@ discard block |
||
229 | 229 | * @param int $limit |
230 | 230 | * @return EE_Datetime[] |
231 | 231 | */ |
232 | - public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){ |
|
232 | + public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
233 | 233 | //sanitize EVT_ID |
234 | - $EVT_ID = intval( $EVT_ID ); |
|
234 | + $EVT_ID = intval($EVT_ID); |
|
235 | 235 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
236 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
237 | - $query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
238 | - if( ! $include_expired){ |
|
239 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
236 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
237 | + $query_params = array(array('Event.EVT_ID'=>$EVT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
238 | + if ( ! $include_expired) { |
|
239 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
240 | 240 | } |
241 | - if( $include_deleted){ |
|
242 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
241 | + if ($include_deleted) { |
|
242 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
243 | 243 | } |
244 | - if($limit){ |
|
244 | + if ($limit) { |
|
245 | 245 | $query_params['limit'] = $limit; |
246 | 246 | } |
247 | - $result = $this->get_all( $query_params ); |
|
248 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
247 | + $result = $this->get_all($query_params); |
|
248 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
249 | 249 | return $result; |
250 | 250 | } |
251 | 251 | |
@@ -258,23 +258,23 @@ discard block |
||
258 | 258 | * @param int $limit |
259 | 259 | * @return EE_Datetime[] |
260 | 260 | */ |
261 | - public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){ |
|
261 | + public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
262 | 262 | //sanitize TKT_ID |
263 | - $TKT_ID = intval( $TKT_ID ); |
|
263 | + $TKT_ID = intval($TKT_ID); |
|
264 | 264 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
265 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
266 | - $query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
267 | - if( ! $include_expired){ |
|
268 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
265 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
266 | + $query_params = array(array('Ticket.TKT_ID'=>$TKT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
267 | + if ( ! $include_expired) { |
|
268 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
269 | 269 | } |
270 | - if( $include_deleted){ |
|
271 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
270 | + if ($include_deleted) { |
|
271 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
272 | 272 | } |
273 | - if($limit){ |
|
273 | + if ($limit) { |
|
274 | 274 | $query_params['limit'] = $limit; |
275 | 275 | } |
276 | - $result = $this->get_all( $query_params ); |
|
277 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
276 | + $result = $this->get_all($query_params); |
|
277 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
278 | 278 | return $result; |
279 | 279 | } |
280 | 280 | |
@@ -290,24 +290,24 @@ discard block |
||
290 | 290 | * that number |
291 | 291 | * @return EE_Datetime[] |
292 | 292 | */ |
293 | - public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) { |
|
293 | + public function get_datetimes_for_ticket_ordered_by_DTT_order($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
294 | 294 | //sanitize id. |
295 | - $TKT_ID = intval( $TKT_ID ); |
|
295 | + $TKT_ID = intval($TKT_ID); |
|
296 | 296 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
297 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
298 | - $where_params = array( 'Ticket.TKT_ID' => $TKT_ID ); |
|
299 | - $query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) ); |
|
300 | - if( ! $include_expired){ |
|
301 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
297 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
298 | + $where_params = array('Ticket.TKT_ID' => $TKT_ID); |
|
299 | + $query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC')); |
|
300 | + if ( ! $include_expired) { |
|
301 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
302 | 302 | } |
303 | - if( $include_deleted){ |
|
304 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
303 | + if ($include_deleted) { |
|
304 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
305 | 305 | } |
306 | - if($limit){ |
|
306 | + if ($limit) { |
|
307 | 307 | $query_params['limit'] = $limit; |
308 | 308 | } |
309 | - $result = $this->get_all( $query_params ); |
|
310 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
309 | + $result = $this->get_all($query_params); |
|
310 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
311 | 311 | return $result; |
312 | 312 | } |
313 | 313 | |
@@ -318,11 +318,11 @@ discard block |
||
318 | 318 | * @param int $EVT_ID |
319 | 319 | * @return EE_Datetime |
320 | 320 | */ |
321 | - public function get_most_important_datetime_for_event($EVT_ID){ |
|
321 | + public function get_most_important_datetime_for_event($EVT_ID) { |
|
322 | 322 | $results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1); |
323 | - if($results){ |
|
323 | + if ($results) { |
|
324 | 324 | return array_shift($results); |
325 | - }else{ |
|
325 | + } else { |
|
326 | 326 | return null; |
327 | 327 | } |
328 | 328 | } |
@@ -341,77 +341,77 @@ discard block |
||
341 | 341 | * - inactive = Events that are either not published. |
342 | 342 | * @return wpdb results array |
343 | 343 | */ |
344 | - public function get_dtt_months_and_years( $where_params, $evt_active_status = '' ) { |
|
345 | - $current_time_for_DTT_EVT_start = $this->current_time_for_query( 'DTT_EVT_start' ); |
|
346 | - $current_time_for_DTT_EVT_end = $this->current_time_for_query( 'DTT_EVT_end' ); |
|
344 | + public function get_dtt_months_and_years($where_params, $evt_active_status = '') { |
|
345 | + $current_time_for_DTT_EVT_start = $this->current_time_for_query('DTT_EVT_start'); |
|
346 | + $current_time_for_DTT_EVT_end = $this->current_time_for_query('DTT_EVT_end'); |
|
347 | 347 | |
348 | - switch ( $evt_active_status ) { |
|
348 | + switch ($evt_active_status) { |
|
349 | 349 | case 'upcoming' : |
350 | 350 | $where_params['Event.status'] = 'publish'; |
351 | 351 | //if there are already query_params matching DTT_EVT_start then we need to modify that to add them. |
352 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
352 | + if (isset($where_params['DTT_EVT_start'])) { |
|
353 | 353 | $where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start']; |
354 | 354 | } |
355 | - $where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start ); |
|
355 | + $where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start); |
|
356 | 356 | break; |
357 | 357 | |
358 | 358 | case 'expired' : |
359 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
359 | + if (isset($where_params['Event.status'])) unset($where_params['Event.status']); |
|
360 | 360 | //get events to exclude |
361 | - $exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $current_time_for_DTT_EVT_end ) ) ); |
|
361 | + $exclude_query[0] = array_merge($where_params, array('DTT_EVT_end' => array('>', $current_time_for_DTT_EVT_end))); |
|
362 | 362 | //first get all events that have datetimes where its not expired. |
363 | - $event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Datetime.EVT_ID' ); |
|
364 | - $event_ids = array_keys( $event_ids ); |
|
363 | + $event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Datetime.EVT_ID'); |
|
364 | + $event_ids = array_keys($event_ids); |
|
365 | 365 | |
366 | - if ( isset( $where_params['DTT_EVT_end'] ) ) { |
|
366 | + if (isset($where_params['DTT_EVT_end'])) { |
|
367 | 367 | $where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
368 | 368 | } |
369 | - $where_params['DTT_EVT_end'] = array( '<', $current_time_for_DTT_EVT_end ); |
|
370 | - $where_params['Event.EVT_ID'] = array( 'NOT IN', $event_ids ); |
|
369 | + $where_params['DTT_EVT_end'] = array('<', $current_time_for_DTT_EVT_end); |
|
370 | + $where_params['Event.EVT_ID'] = array('NOT IN', $event_ids); |
|
371 | 371 | break; |
372 | 372 | |
373 | 373 | case 'active' : |
374 | 374 | $where_params['Event.status'] = 'publish'; |
375 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
375 | + if (isset($where_params['DTT_EVT_start'])) { |
|
376 | 376 | $where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start']; |
377 | 377 | } |
378 | - if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) { |
|
378 | + if (isset($where_params['Datetime.DTT_EVT_end'])) { |
|
379 | 379 | $where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end']; |
380 | 380 | } |
381 | - $where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start ); |
|
382 | - $where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end ); |
|
381 | + $where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start); |
|
382 | + $where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end); |
|
383 | 383 | break; |
384 | 384 | |
385 | 385 | case 'inactive' : |
386 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
387 | - if ( isset( $where_params['OR'] ) ) { |
|
386 | + if (isset($where_params['Event.status'])) unset($where_params['Event.status']); |
|
387 | + if (isset($where_params['OR'])) { |
|
388 | 388 | $where_params['AND']['OR'] = $where_params['OR']; |
389 | 389 | } |
390 | - if ( isset( $where_params['DTT_EVT_end'] ) ) { |
|
390 | + if (isset($where_params['DTT_EVT_end'])) { |
|
391 | 391 | $where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
392 | - unset( $where_params['DTT_EVT_end'] ); |
|
392 | + unset($where_params['DTT_EVT_end']); |
|
393 | 393 | } |
394 | 394 | |
395 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
395 | + if (isset($where_params['DTT_EVT_start'])) { |
|
396 | 396 | $where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start']; |
397 | - unset( $where_params['DTT_EVT_start'] ); |
|
397 | + unset($where_params['DTT_EVT_start']); |
|
398 | 398 | } |
399 | - $where_params['AND']['Event.status'] = array( '!=', 'publish' ); |
|
399 | + $where_params['AND']['Event.status'] = array('!=', 'publish'); |
|
400 | 400 | break; |
401 | 401 | } |
402 | 402 | |
403 | 403 | $query_params[0] = $where_params; |
404 | 404 | $query_params['group_by'] = array('dtt_year', 'dtt_month'); |
405 | - $query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' ); |
|
405 | + $query_params['order_by'] = array('DTT_EVT_start' => 'DESC'); |
|
406 | 406 | |
407 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'DTT_EVT_start' ); |
|
407 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'DTT_EVT_start'); |
|
408 | 408 | |
409 | 409 | $columns_to_select = array( |
410 | - 'dtt_year' => array('YEAR(' . $query_interval . ')', '%s'), |
|
411 | - 'dtt_month' => array('MONTHNAME(' . $query_interval . ')', '%s'), |
|
412 | - 'dtt_month_num' => array('MONTH(' . $query_interval .')', '%s') |
|
410 | + 'dtt_year' => array('YEAR('.$query_interval.')', '%s'), |
|
411 | + 'dtt_month' => array('MONTHNAME('.$query_interval.')', '%s'), |
|
412 | + 'dtt_month_num' => array('MONTH('.$query_interval.')', '%s') |
|
413 | 413 | ); |
414 | - return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select ); |
|
414 | + return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | * for the tickets for each datetime) |
420 | 420 | * @param EE_Datetime[] $datetimes |
421 | 421 | */ |
422 | - public function update_sold($datetimes){ |
|
423 | - foreach($datetimes as $datetime){ |
|
422 | + public function update_sold($datetimes) { |
|
423 | + foreach ($datetimes as $datetime) { |
|
424 | 424 | $datetime->update_sold(); |
425 | 425 | } |
426 | 426 | } |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | * @param array $query_params |
436 | 436 | * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF, IF there are NO tickets attached to datetime then FALSE is returned. |
437 | 437 | */ |
438 | - public function sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params = array() ) { |
|
439 | - $datetime = $this->get_one_by_ID( $DTT_ID ); |
|
440 | - if ( $datetime instanceof EE_Datetime ) { |
|
441 | - return $datetime->tickets_remaining( $query_params ); |
|
438 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) { |
|
439 | + $datetime = $this->get_one_by_ID($DTT_ID); |
|
440 | + if ($datetime instanceof EE_Datetime) { |
|
441 | + return $datetime->tickets_remaining($query_params); |
|
442 | 442 | } |
443 | 443 | return 0; |
444 | 444 | } |
@@ -460,36 +460,36 @@ discard block |
||
460 | 460 | * EE_Datetime::upcoming |
461 | 461 | * EE_Datetime::expired |
462 | 462 | */ |
463 | - public function get_datetime_counts_by_status( $stati_to_include = array(), $query_params = array() ) { |
|
463 | + public function get_datetime_counts_by_status($stati_to_include = array(), $query_params = array()) { |
|
464 | 464 | //only accept where conditions for this query. |
465 | - $_where = isset( $query_params[0] ) ? $query_params[0] : array(); |
|
465 | + $_where = isset($query_params[0]) ? $query_params[0] : array(); |
|
466 | 466 | $status_query_args = array( |
467 | 467 | EE_Datetime::active => array_merge( |
468 | 468 | $_where, |
469 | - array( 'DTT_EVT_start' => array( '<', time() ), 'DTT_EVT_end' => array( '>', time() ) ) |
|
469 | + array('DTT_EVT_start' => array('<', time()), 'DTT_EVT_end' => array('>', time())) |
|
470 | 470 | ), |
471 | 471 | EE_Datetime::upcoming => array_merge( |
472 | 472 | $_where, |
473 | - array( 'DTT_EVT_start' => array( '>', time() ) ) |
|
473 | + array('DTT_EVT_start' => array('>', time())) |
|
474 | 474 | ), |
475 | 475 | EE_Datetime::expired => array_merge( |
476 | 476 | $_where, |
477 | - array( 'DTT_EVT_end' => array('<', time() ) ) |
|
477 | + array('DTT_EVT_end' => array('<', time())) |
|
478 | 478 | ) |
479 | 479 | ); |
480 | 480 | |
481 | - if ( ! empty( $stati_to_include ) ) { |
|
482 | - foreach( array_keys( $status_query_args ) as $status ) { |
|
483 | - if ( ! in_array( $status, $stati_to_include ) ) { |
|
484 | - unset( $status_query_args[$status] ); |
|
481 | + if ( ! empty($stati_to_include)) { |
|
482 | + foreach (array_keys($status_query_args) as $status) { |
|
483 | + if ( ! in_array($status, $stati_to_include)) { |
|
484 | + unset($status_query_args[$status]); |
|
485 | 485 | } |
486 | 486 | } |
487 | 487 | } |
488 | 488 | |
489 | 489 | //loop through and query counts for each stati. |
490 | 490 | $status_query_results = array(); |
491 | - foreach( $status_query_args as $status => $status_where_conditions ) { |
|
492 | - $status_query_results[ $status ] = EEM_Datetime::count( array( $status_where_conditions ), 'DTT_ID', true ); |
|
491 | + foreach ($status_query_args as $status => $status_where_conditions) { |
|
492 | + $status_query_results[$status] = EEM_Datetime::count(array($status_where_conditions), 'DTT_ID', true); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | return $status_query_results; |
@@ -503,9 +503,9 @@ discard block |
||
503 | 503 | * @param array $query_params |
504 | 504 | * @return int |
505 | 505 | */ |
506 | - public function get_datetime_count_for_status( $status = EE_Datetime::active, $query_params = array() ) { |
|
507 | - $count = $this->get_datetime_counts_by_status( array( $status ), $query_params ); |
|
508 | - return ! empty( $count[$status] ) ? $count[$status] : 0; |
|
506 | + public function get_datetime_count_for_status($status = EE_Datetime::active, $query_params = array()) { |
|
507 | + $count = $this->get_datetime_counts_by_status(array($status), $query_params); |
|
508 | + return ! empty($count[$status]) ? $count[$status] : 0; |
|
509 | 509 | } |
510 | 510 | |
511 | 511 |
@@ -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 | * |
@@ -187,7 +189,7 @@ discard block |
||
187 | 189 | $results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1); |
188 | 190 | if($results){ |
189 | 191 | return array_shift($results); |
190 | - }else{ |
|
192 | + } else{ |
|
191 | 193 | return NULL; |
192 | 194 | } |
193 | 195 | } |
@@ -322,7 +324,7 @@ discard block |
||
322 | 324 | $results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1); |
323 | 325 | if($results){ |
324 | 326 | return array_shift($results); |
325 | - }else{ |
|
327 | + } else{ |
|
326 | 328 | return null; |
327 | 329 | } |
328 | 330 | } |
@@ -356,7 +358,9 @@ discard block |
||
356 | 358 | break; |
357 | 359 | |
358 | 360 | case 'expired' : |
359 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
361 | + if ( isset( $where_params['Event.status'] ) ) { |
|
362 | + unset( $where_params['Event.status'] ); |
|
363 | + } |
|
360 | 364 | //get events to exclude |
361 | 365 | $exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $current_time_for_DTT_EVT_end ) ) ); |
362 | 366 | //first get all events that have datetimes where its not expired. |
@@ -383,7 +387,9 @@ discard block |
||
383 | 387 | break; |
384 | 388 | |
385 | 389 | case 'inactive' : |
386 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
390 | + if ( isset( $where_params['Event.status'] ) ) { |
|
391 | + unset( $where_params['Event.status'] ); |
|
392 | + } |
|
387 | 393 | if ( isset( $where_params['OR'] ) ) { |
388 | 394 | $where_params['AND']['OR'] = $where_params['OR']; |
389 | 395 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
25 | 25 | |
26 | 26 | class EEM_Term_Taxonomy extends EEM_Base { |
27 | 27 | |
@@ -29,67 +29,67 @@ discard block |
||
29 | 29 | protected static $_instance = NULL; |
30 | 30 | |
31 | 31 | |
32 | - protected function __construct( $timezone = NULL ) { |
|
33 | - $this->singular_item = __('Term Taxonomy','event_espresso'); |
|
34 | - $this->plural_item = __('Term Taxonomy','event_espresso'); |
|
32 | + protected function __construct($timezone = NULL) { |
|
33 | + $this->singular_item = __('Term Taxonomy', 'event_espresso'); |
|
34 | + $this->plural_item = __('Term Taxonomy', 'event_espresso'); |
|
35 | 35 | $this->_tables = array( |
36 | 36 | 'Term_Taxonomy'=> new EE_Primary_Table('term_taxonomy', 'term_taxonomy_id') |
37 | 37 | ); |
38 | 38 | $this->_fields = array( |
39 | 39 | 'Term_Taxonomy'=>array( |
40 | - 'term_taxonomy_id'=> new EE_Primary_Key_Int_Field('term_taxonomy_id', __('Term-Taxonomy ID','event_espresso')), |
|
41 | - 'term_id'=>new EE_Foreign_Key_Int_Field('term_id', __("Term Id", "event_espresso"), false, 0, 'Term'), //EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'), |
|
42 | - 'taxonomy'=>new EE_Plain_Text_Field('taxonomy', __('Taxonomy Name','event_espresso'), false, 'category'), |
|
43 | - 'description'=>new EE_Post_Content_Field('description', __("Description of Term", "event_espresso"), false,''), |
|
44 | - 'parent'=>new EE_Integer_Field('parent', __("Parent Term ID", "event_espresso"), false,0), |
|
40 | + 'term_taxonomy_id'=> new EE_Primary_Key_Int_Field('term_taxonomy_id', __('Term-Taxonomy ID', 'event_espresso')), |
|
41 | + 'term_id'=>new EE_Foreign_Key_Int_Field('term_id', __("Term Id", "event_espresso"), false, 0, 'Term'), //EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'), |
|
42 | + 'taxonomy'=>new EE_Plain_Text_Field('taxonomy', __('Taxonomy Name', 'event_espresso'), false, 'category'), |
|
43 | + 'description'=>new EE_Post_Content_Field('description', __("Description of Term", "event_espresso"), false, ''), |
|
44 | + 'parent'=>new EE_Integer_Field('parent', __("Parent Term ID", "event_espresso"), false, 0), |
|
45 | 45 | 'term_count'=> new EE_Integer_Field('count', __("Count of Objects attached", 'event_espresso'), false, 0) |
46 | 46 | )); |
47 | 47 | $this->_model_relations = array( |
48 | 48 | 'Term_Relationship'=>new EE_Has_Many_Relation(), |
49 | 49 | 'Term'=>new EE_Belongs_To_Relation(), |
50 | 50 | ); |
51 | - $cpt_models = array_keys( EE_Registry::instance()->cpt_models() ); |
|
52 | - foreach( $cpt_models as $model_name ) { |
|
53 | - $this->_model_relations[ $model_name ] = new EE_HABTM_Relation( 'Term_Relationship' ); |
|
51 | + $cpt_models = array_keys(EE_Registry::instance()->cpt_models()); |
|
52 | + foreach ($cpt_models as $model_name) { |
|
53 | + $this->_model_relations[$model_name] = new EE_HABTM_Relation('Term_Relationship'); |
|
54 | 54 | } |
55 | 55 | $this->_indexes = array( |
56 | - 'term_id_taxonomy'=>new EE_Unique_Index(array('term_id','taxonomy')) |
|
56 | + 'term_id_taxonomy'=>new EE_Unique_Index(array('term_id', 'taxonomy')) |
|
57 | 57 | ); |
58 | 58 | $path_to_tax_model = ''; |
59 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
60 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected( $path_to_tax_model ); |
|
61 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false; |
|
62 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false; |
|
59 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
60 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Taxonomy_Protected($path_to_tax_model); |
|
61 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = false; |
|
62 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = false; |
|
63 | 63 | |
64 | 64 | //add cap restrictions for editing relating to the "ee_edit_*" |
65 | - $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions( |
|
65 | + $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_category'] = new EE_Default_Where_Conditions( |
|
66 | 66 | array( |
67 | - $path_to_tax_model . 'taxonomy*ee_edit_event_category' => array( '!=', 'espresso_event_categories' ) |
|
67 | + $path_to_tax_model.'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories') |
|
68 | 68 | )); |
69 | - $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions( |
|
69 | + $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_venue_category'] = new EE_Default_Where_Conditions( |
|
70 | 70 | array( |
71 | - $path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array( '!=', 'espresso_venue_categories' ) |
|
71 | + $path_to_tax_model.'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories') |
|
72 | 72 | )); |
73 | - $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions( |
|
73 | + $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_type'] = new EE_Default_Where_Conditions( |
|
74 | 74 | array( |
75 | - $path_to_tax_model . 'taxonomy*ee_edit_event_type' => array( '!=', 'espresso_event_type' ) |
|
75 | + $path_to_tax_model.'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type') |
|
76 | 76 | )); |
77 | 77 | |
78 | 78 | //add cap restrictions for deleting relating to the "ee_deleting_*" |
79 | - $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions( |
|
79 | + $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_category'] = new EE_Default_Where_Conditions( |
|
80 | 80 | array( |
81 | - $path_to_tax_model . 'taxonomy*ee_delete_event_category' => array( '!=', 'espresso_event_categories' ) |
|
81 | + $path_to_tax_model.'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories') |
|
82 | 82 | )); |
83 | - $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions( |
|
83 | + $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_venue_category'] = new EE_Default_Where_Conditions( |
|
84 | 84 | array( |
85 | - $path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array( '!=', 'espresso_venue_categories' ) |
|
85 | + $path_to_tax_model.'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories') |
|
86 | 86 | )); |
87 | - $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions( |
|
87 | + $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_type'] = new EE_Default_Where_Conditions( |
|
88 | 88 | array( |
89 | - $path_to_tax_model . 'taxonomy*ee_delete_event_type' => array( '!=', 'espresso_event_type' ) |
|
89 | + $path_to_tax_model.'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type') |
|
90 | 90 | )); |
91 | 91 | |
92 | - parent::__construct( $timezone ); |
|
92 | + parent::__construct($timezone); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' ); |
|
2 | +require_once(EE_MODELS.'fields/EE_Text_Field_Base.php'); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * Class EE_Enum_Text_Field |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @param mixed $default_value |
24 | 24 | * @param array $allowed_enum_values keys are values to be used in the DB, values are how they should be displayed |
25 | 25 | */ |
26 | - function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values){ |
|
26 | + function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values) { |
|
27 | 27 | $this->_allowed_enum_values = $allowed_enum_values; |
28 | 28 | parent::__construct($table_column, $nice_name, $nullable, $default_value); |
29 | 29 | } |
@@ -37,24 +37,24 @@ discard block |
||
37 | 37 | * @return string |
38 | 38 | * @throws EE_Error |
39 | 39 | */ |
40 | - function prepare_for_set( $value_inputted_for_field_on_model_object ) { |
|
41 | - if( |
|
40 | + function prepare_for_set($value_inputted_for_field_on_model_object) { |
|
41 | + if ( |
|
42 | 42 | $value_inputted_for_field_on_model_object !== null |
43 | - && ! array_key_exists( $value_inputted_for_field_on_model_object, $this->_allowed_enum_values ) |
|
44 | - ){ |
|
45 | - if( defined( 'WP_DEBUG' ) && WP_DEBUG ){ |
|
43 | + && ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values) |
|
44 | + ) { |
|
45 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
46 | 46 | $msg = sprintf( |
47 | - __('System is assigning incompatible value "%1$s" to field "%2$s"','event_espresso'), |
|
47 | + __('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'), |
|
48 | 48 | $value_inputted_for_field_on_model_object, |
49 | 49 | $this->_name |
50 | 50 | ); |
51 | 51 | $msg2 = sprintf( |
52 | - __('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"','event_espresso'), |
|
52 | + __('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"', 'event_espresso'), |
|
53 | 53 | $this->_name, |
54 | - implode( ", ", array_keys( $this->_allowed_enum_values ) ), |
|
54 | + implode(", ", array_keys($this->_allowed_enum_values)), |
|
55 | 55 | $value_inputted_for_field_on_model_object |
56 | 56 | ); |
57 | - EE_Error::add_error( "$msg||$msg2", __FILE__, __FUNCTION__, __LINE__ ); |
|
57 | + EE_Error::add_error("$msg||$msg2", __FILE__, __FUNCTION__, __LINE__); |
|
58 | 58 | } |
59 | 59 | return $this->get_default_value(); |
60 | 60 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * with the exception of a particular attribute |
27 | 27 | * @return object of the same class as what was called on |
28 | 28 | */ |
29 | - public function duplicate( $options = array() ); |
|
29 | + public function duplicate($options = array()); |
|
30 | 30 | |
31 | 31 | |
32 | 32 |
@@ -7,13 +7,13 @@ |
||
7 | 7 | <!-- Facebook sharing information tags --> |
8 | 8 | <meta property="og:title" content="<?php echo $subject; ?>" /> |
9 | 9 | <title><?php echo $subject; ?></title> |
10 | - <?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_head', $message_type, $subject, $from, $main_body ); ?> |
|
10 | + <?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_head', $message_type, $subject, $from, $main_body); ?> |
|
11 | 11 | </head> |
12 | -<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_header', $message_type, $subject, $from, $main_body ); ?> |
|
12 | +<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_header', $message_type, $subject, $from, $main_body); ?> |
|
13 | 13 | <body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"> |
14 | -<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_before_main_body', $message_type, $subject, $from, $main_body ); ?> |
|
14 | +<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_before_main_body', $message_type, $subject, $from, $main_body); ?> |
|
15 | 15 | <?php echo $main_body; ?> |
16 | -<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_after_main_body', $message_type, $subject, $from, $main_body ); ?> |
|
16 | +<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_after_main_body', $message_type, $subject, $from, $main_body); ?> |
|
17 | 17 | </body> |
18 | -<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_footer', $message_type, $subject, $from, $main_body ); ?> |
|
18 | +<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_footer', $message_type, $subject, $from, $main_body); ?> |
|
19 | 19 | </html> |
20 | 20 | \ No newline at end of file |
@@ -27,21 +27,21 @@ |
||
27 | 27 | <!-- Primary Style Sheet --> |
28 | 28 | <link rel="stylesheet" type="text/css" href="<?php echo $main_css; ?>" /> |
29 | 29 | <!-- Make sure the buttons don't print --> |
30 | - <?php if ( isset( $extra_css )) : ?> |
|
30 | + <?php if (isset($extra_css)) : ?> |
|
31 | 31 | <!-- Additional Style Sheet --> |
32 | 32 | <link rel="stylesheet" type="text/css" href="<?php echo $extra_css; ?>" /> |
33 | 33 | <?php endif; ?> |
34 | 34 | <style type="text/css"> |
35 | 35 | @media print{ .noPrint{ display:none !important;height:0!important; width:0!important; margin:0!important; padding:0!important; }} |
36 | 36 | </style> |
37 | - <?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_head', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
37 | + <?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_head', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
38 | 38 | </head> |
39 | - <?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_header', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
39 | + <?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_header', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
40 | 40 | <body> |
41 | - <?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_before_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
41 | + <?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_before_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
42 | 42 | <?php echo $main_body; ?> |
43 | - <?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_after_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
43 | + <?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_after_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
44 | 44 | </body> |
45 | - <?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_footer', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
45 | + <?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_footer', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
46 | 46 | <?php wp_footer(); ?> |
47 | 47 | </html> |
48 | 48 | \ No newline at end of file |
@@ -1345,7 +1345,7 @@ |
||
1345 | 1345 | * This just returns whatever is set as the _event object property |
1346 | 1346 | * |
1347 | 1347 | * //todo this will become obsolete once the models are in place |
1348 | - * @return object |
|
1348 | + * @return EE_CPT_Base |
|
1349 | 1349 | */ |
1350 | 1350 | public function get_event_object() { |
1351 | 1351 | return $this->_cpt_model_obj; |
@@ -606,9 +606,9 @@ |
||
606 | 606 | // first check if event is active. |
607 | 607 | if ( |
608 | 608 | $orig_status === EEM_Event::cancelled |
609 | - || $orig_status === EEM_Event::postponed |
|
610 | - || $event->is_expired() |
|
611 | - || $event->is_inactive() |
|
609 | + || $orig_status === EEM_Event::postponed |
|
610 | + || $event->is_expired() |
|
611 | + || $event->is_inactive() |
|
612 | 612 | ) { |
613 | 613 | return; |
614 | 614 | } |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -1484,10 +1485,11 @@ discard block |
||
1484 | 1485 | //get the earliest datetime (if present); |
1485 | 1486 | $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
1486 | 1487 | |
1487 | - if ( !empty( $earliest_dtt ) ) |
|
1488 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1489 | - else |
|
1490 | - $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1488 | + if ( !empty( $earliest_dtt ) ) { |
|
1489 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1490 | + } else { |
|
1491 | + $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1492 | + } |
|
1491 | 1493 | } |
1492 | 1494 | |
1493 | 1495 | $template_args = array_merge( $template_args, $price_args ); |
@@ -1725,8 +1727,9 @@ discard block |
||
1725 | 1727 | } |
1726 | 1728 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1727 | 1729 | |
1728 | - if ( $redirect_after ) |
|
1729 | - $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1730 | + if ( $redirect_after ) { |
|
1731 | + $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1732 | + } |
|
1730 | 1733 | } |
1731 | 1734 | |
1732 | 1735 | /** |
@@ -1853,8 +1856,9 @@ discard block |
||
1853 | 1856 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1854 | 1857 | } |
1855 | 1858 | |
1856 | - if ( $redirect_after ) |
|
1857 | - $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
|
1859 | + if ( $redirect_after ) { |
|
1860 | + $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
|
1861 | + } |
|
1858 | 1862 | } |
1859 | 1863 | |
1860 | 1864 | /** |
@@ -2091,8 +2095,10 @@ discard block |
||
2091 | 2095 | * @return void |
2092 | 2096 | */ |
2093 | 2097 | private function _set_category_object() { |
2094 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
2095 | - return; //already have the category object so get out. |
|
2098 | + if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) { |
|
2099 | + return; |
|
2100 | + } |
|
2101 | + //already have the category object so get out. |
|
2096 | 2102 | |
2097 | 2103 | //set default category object |
2098 | 2104 | $this->_set_empty_category_object(); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->_cpt_edit_routes = array( |
67 | 67 | 'espresso_events' => 'edit' |
68 | 68 | ); |
69 | - add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) ); |
|
69 | + add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit')); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | protected function _ajax_hooks() { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | 'edit' => __('Update Event', 'event_espresso'), |
93 | 93 | 'add_category' => __('Save New Category', 'event_espresso'), |
94 | 94 | 'edit_category' => __('Update Category', 'event_espresso'), |
95 | - 'template_settings' => __( 'Update Settings', 'event_espresso' ) |
|
95 | + 'template_settings' => __('Update Settings', 'event_espresso') |
|
96 | 96 | ) |
97 | 97 | ); |
98 | 98 | } |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | //load field generator helper |
103 | 103 | |
104 | 104 | //is there a evt_id in the request? |
105 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0; |
|
106 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
105 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0; |
|
106 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
107 | 107 | |
108 | 108 | |
109 | 109 | $this->_page_routes = array( |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | 'help_tour' => array( |
318 | 318 | 'Event_Editor_Help_Tour' |
319 | 319 | ), |
320 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
320 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
321 | 321 | 'require_nonce' => FALSE |
322 | 322 | ), |
323 | 323 | 'edit' => array( |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | /*'help_tour' => array( |
374 | 374 | 'Event_Edit_Help_Tour' |
375 | 375 | ),*/ |
376 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
376 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
377 | 377 | 'require_nonce' => FALSE |
378 | 378 | ), |
379 | 379 | 'default_event_settings' => array( |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | 'filename' => 'events_default_settings_status' |
396 | 396 | ) |
397 | 397 | ), |
398 | - 'help_tour' => array( 'Event_Default_Settings_Help_Tour'), |
|
398 | + 'help_tour' => array('Event_Default_Settings_Help_Tour'), |
|
399 | 399 | 'require_nonce' => FALSE |
400 | 400 | ), |
401 | 401 | //template settings |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | 'filename' => 'general_settings_templates' |
412 | 412 | ) |
413 | 413 | ), |
414 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
414 | + 'help_tour' => array('Templates_Help_Tour'), |
|
415 | 415 | 'require_nonce' => FALSE |
416 | 416 | ), |
417 | 417 | //event category stuff |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | 'label' => __('Edit Category', 'event_espresso'), |
436 | 436 | 'order' => 15, |
437 | 437 | 'persistent' => FALSE, |
438 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
438 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
439 | 439 | ), |
440 | 440 | 'help_tabs' => array( |
441 | 441 | 'edit_category_help_tab' => array( |
@@ -505,14 +505,14 @@ discard block |
||
505 | 505 | |
506 | 506 | public function load_scripts_styles() { |
507 | 507 | |
508 | - wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
509 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
508 | + wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
509 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
510 | 510 | wp_enqueue_style('events-admin-css'); |
511 | 511 | wp_enqueue_style('ee-cat-admin'); |
512 | 512 | //todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details |
513 | 513 | //registers for all views |
514 | 514 | //scripts |
515 | - wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE); |
|
515 | + wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | /** |
@@ -530,11 +530,11 @@ discard block |
||
530 | 530 | public function load_scripts_styles_edit() { |
531 | 531 | //styles |
532 | 532 | wp_enqueue_style('espresso-ui-theme'); |
533 | - wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
533 | + wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
534 | 534 | wp_enqueue_style('event-editor-css'); |
535 | 535 | |
536 | 536 | //scripts |
537 | - wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION ); |
|
537 | + wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION); |
|
538 | 538 | wp_enqueue_script('event-datetime-metabox'); |
539 | 539 | |
540 | 540 | } |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | |
570 | 570 | |
571 | 571 | public function admin_init() { |
572 | - EE_Registry::$i18n_js_strings[ 'image_confirm' ] = __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' ); |
|
572 | + EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'); |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | |
@@ -590,12 +590,12 @@ discard block |
||
590 | 590 | */ |
591 | 591 | public function verify_event_edit($event = NULL) { |
592 | 592 | // no event? |
593 | - if ( empty( $event )) { |
|
593 | + if (empty($event)) { |
|
594 | 594 | // set event |
595 | 595 | $event = $this->_cpt_model_obj; |
596 | 596 | } |
597 | 597 | // STILL no event? |
598 | - if ( empty ( $event )) { |
|
598 | + if (empty ($event)) { |
|
599 | 599 | return; |
600 | 600 | } |
601 | 601 | $orig_status = $event->status(); |
@@ -609,27 +609,27 @@ discard block |
||
609 | 609 | return; |
610 | 610 | } |
611 | 611 | //made it here so it IS active... next check that any of the tickets are sold. |
612 | - if ( $event->is_sold_out( true ) ) { |
|
613 | - if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) { |
|
612 | + if ($event->is_sold_out(true)) { |
|
613 | + if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) { |
|
614 | 614 | EE_Error::add_attention( |
615 | 615 | sprintf( |
616 | - __( 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You can change the status back to something else before updating if you wish.', 'event_espresso' ), |
|
617 | - EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' ) |
|
616 | + __('Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You can change the status back to something else before updating if you wish.', 'event_espresso'), |
|
617 | + EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence') |
|
618 | 618 | ) |
619 | 619 | ); |
620 | 620 | } |
621 | 621 | return; |
622 | - } else if ( $orig_status === EEM_Event::sold_out ) { |
|
622 | + } else if ($orig_status === EEM_Event::sold_out) { |
|
623 | 623 | EE_Error::add_attention( |
624 | 624 | sprintf( |
625 | - __( 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets. However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.', |
|
626 | - 'event_espresso' ), |
|
627 | - EEH_Template::pretty_status( $event->status(), false, 'sentence' ) |
|
625 | + __('Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets. However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.', |
|
626 | + 'event_espresso'), |
|
627 | + EEH_Template::pretty_status($event->status(), false, 'sentence') |
|
628 | 628 | ) |
629 | 629 | ); |
630 | 630 | } |
631 | 631 | //now we need to determine if the event has any tickets on sale. If not then we dont' show the error |
632 | - if ( ! $event->tickets_on_sale() ) { |
|
632 | + if ( ! $event->tickets_on_sale()) { |
|
633 | 633 | return; |
634 | 634 | } |
635 | 635 | //made it here so show warning |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | */ |
649 | 649 | protected function _edit_event_warning() { |
650 | 650 | // we don't want to add warnings during these requests |
651 | - if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) { |
|
651 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') { |
|
652 | 652 | return; |
653 | 653 | } |
654 | 654 | EE_Error::add_attention( |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | ), |
680 | 680 | ); |
681 | 681 | |
682 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
682 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
683 | 683 | $this->_views['trash'] = array( |
684 | 684 | 'slug' => 'trash', |
685 | 685 | 'label' => __('Trash', 'event_espresso'), |
@@ -709,39 +709,39 @@ discard block |
||
709 | 709 | 'desc' => __('View Registrations for Event', 'event_espresso') |
710 | 710 | ) |
711 | 711 | ); |
712 | - $items = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items ); |
|
712 | + $items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items); |
|
713 | 713 | $statuses = array( |
714 | 714 | 'sold_out_status' => array( |
715 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out, |
|
716 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' ) |
|
715 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out, |
|
716 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence') |
|
717 | 717 | ), |
718 | 718 | 'active_status' => array( |
719 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active, |
|
720 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' ) |
|
719 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active, |
|
720 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence') |
|
721 | 721 | ), |
722 | 722 | 'upcoming_status' => array( |
723 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming, |
|
724 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' ) |
|
723 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming, |
|
724 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence') |
|
725 | 725 | ), |
726 | 726 | 'postponed_status' => array( |
727 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed, |
|
728 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' ) |
|
727 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed, |
|
728 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence') |
|
729 | 729 | ), |
730 | 730 | 'cancelled_status' => array( |
731 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled, |
|
732 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' ) |
|
731 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled, |
|
732 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence') |
|
733 | 733 | ), |
734 | 734 | 'expired_status' => array( |
735 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired, |
|
736 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' ) |
|
735 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired, |
|
736 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence') |
|
737 | 737 | ), |
738 | 738 | 'inactive_status' => array( |
739 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive, |
|
740 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' ) |
|
739 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive, |
|
740 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence') |
|
741 | 741 | ) |
742 | 742 | ); |
743 | - $statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses ); |
|
744 | - return array_merge( $items, $statuses ); |
|
743 | + $statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses); |
|
744 | + return array_merge($items, $statuses); |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | |
@@ -753,8 +753,8 @@ discard block |
||
753 | 753 | * @return EEM_Event |
754 | 754 | */ |
755 | 755 | private function _event_model() { |
756 | - if ( ! $this->_event_model instanceof EEM_Event ) { |
|
757 | - $this->_event_model = EE_Registry::instance()->load_model( 'Event' ); |
|
756 | + if ( ! $this->_event_model instanceof EEM_Event) { |
|
757 | + $this->_event_model = EE_Registry::instance()->load_model('Event'); |
|
758 | 758 | } |
759 | 759 | return $this->_event_model; |
760 | 760 | } |
@@ -773,12 +773,12 @@ discard block |
||
773 | 773 | * @param string $new_slug what the slug is |
774 | 774 | * @return string The new html string for the permalink area |
775 | 775 | */ |
776 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
776 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
777 | 777 | //make sure this is only when editing |
778 | - if ( !empty( $id ) ) { |
|
779 | - $post = get_post( $id ); |
|
780 | - $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> '; |
|
781 | - $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' . $post->ID . ']">'; |
|
778 | + if ( ! empty($id)) { |
|
779 | + $post = get_post($id); |
|
780 | + $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> '; |
|
781 | + $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='.$post->ID.']">'; |
|
782 | 782 | } |
783 | 783 | return $return; |
784 | 784 | } |
@@ -794,8 +794,8 @@ discard block |
||
794 | 794 | * @return string html for generated table |
795 | 795 | */ |
796 | 796 | protected function _events_overview_list_table() { |
797 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
798 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) . |
|
797 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
798 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button'). |
|
799 | 799 | $this->_display_legend($this->_event_legend_items()); |
800 | 800 | $this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
801 | 801 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -813,51 +813,51 @@ discard block |
||
813 | 813 | |
814 | 814 | |
815 | 815 | |
816 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
816 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
817 | 817 | |
818 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) { |
|
818 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') { |
|
819 | 819 | //getout we're not processing an event save. |
820 | 820 | return; |
821 | 821 | } |
822 | 822 | |
823 | 823 | $event_values = array( |
824 | - 'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0, |
|
825 | - 'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0, |
|
824 | + 'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0, |
|
825 | + 'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0, |
|
826 | 826 | 'EVT_additional_limit' => min( |
827 | - apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ), |
|
828 | - !empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ), |
|
829 | - 'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID, |
|
830 | - 'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0, |
|
831 | - 'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0, |
|
832 | - 'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL, |
|
833 | - 'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL, |
|
834 | - 'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL |
|
827 | + apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255), |
|
828 | + ! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ), |
|
829 | + 'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID, |
|
830 | + 'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0, |
|
831 | + 'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0, |
|
832 | + 'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL, |
|
833 | + 'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL, |
|
834 | + 'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL |
|
835 | 835 | ); |
836 | 836 | |
837 | 837 | //update event |
838 | - $success = $this->_event_model()->update_by_ID( $event_values, $post_id ); |
|
838 | + $success = $this->_event_model()->update_by_ID($event_values, $post_id); |
|
839 | 839 | |
840 | 840 | |
841 | 841 | //get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
842 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
843 | - $event = $this->_event_model()->get_one( array($get_one_where) ); |
|
842 | + $get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
843 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
844 | 844 | |
845 | 845 | |
846 | 846 | //the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons. |
847 | - $event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) ); |
|
847 | + $event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update'))); |
|
848 | 848 | |
849 | 849 | $att_success = TRUE; |
850 | 850 | |
851 | - foreach ( $event_update_callbacks as $e_callback ) { |
|
852 | - $_succ = call_user_func_array( $e_callback, array( $event, $this->_req_data ) ); |
|
853 | - $att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
851 | + foreach ($event_update_callbacks as $e_callback) { |
|
852 | + $_succ = call_user_func_array($e_callback, array($event, $this->_req_data)); |
|
853 | + $att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
854 | 854 | } |
855 | 855 | |
856 | 856 | //any errors? |
857 | - if ( $success && FALSE === $att_success ) { |
|
858 | - EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
859 | - } else if ( $success === FALSE ) { |
|
860 | - EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
857 | + if ($success && FALSE === $att_success) { |
|
858 | + EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
859 | + } else if ($success === FALSE) { |
|
860 | + EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
861 | 861 | } |
862 | 862 | } |
863 | 863 | |
@@ -867,14 +867,14 @@ discard block |
||
867 | 867 | /** |
868 | 868 | * @see parent::restore_item() |
869 | 869 | */ |
870 | - protected function _restore_cpt_item( $post_id, $revision_id ) { |
|
870 | + protected function _restore_cpt_item($post_id, $revision_id) { |
|
871 | 871 | //copy existing event meta to new post |
872 | 872 | $post_evt = $this->_event_model()->get_one_by_ID($post_id); |
873 | - if ( $post_evt instanceof EE_Event ) { |
|
873 | + if ($post_evt instanceof EE_Event) { |
|
874 | 874 | //meta revision restore |
875 | - $post_evt->restore_revision( $revision_id ); |
|
875 | + $post_evt->restore_revision($revision_id); |
|
876 | 876 | //related objs restore |
877 | - $post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) ); |
|
877 | + $post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price')); |
|
878 | 878 | } |
879 | 879 | } |
880 | 880 | |
@@ -887,52 +887,52 @@ discard block |
||
887 | 887 | * @param array $data The request data from the form |
888 | 888 | * @return bool Success or fail. |
889 | 889 | */ |
890 | - protected function _default_venue_update( $evtobj, $data ) { |
|
891 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
890 | + protected function _default_venue_update($evtobj, $data) { |
|
891 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
892 | 892 | $venue_model = EE_Registry::instance()->load_model('Venue'); |
893 | 893 | $rows_affected = NULL; |
894 | - $venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL; |
|
894 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL; |
|
895 | 895 | |
896 | 896 | // very important. If we don't have a venue name... |
897 | 897 | // then we'll get out because not necessary to create empty venue |
898 | - if ( empty( $data['venue_title'] ) ) { |
|
898 | + if (empty($data['venue_title'])) { |
|
899 | 899 | return false; |
900 | 900 | } |
901 | 901 | |
902 | 902 | $venue_array = array( |
903 | 903 | 'VNU_wp_user' => $evtobj->get('EVT_wp_user'), |
904 | - 'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL, |
|
905 | - 'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL, |
|
906 | - 'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL, |
|
907 | - 'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL, |
|
908 | - 'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL, |
|
909 | - 'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL, |
|
910 | - 'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL, |
|
911 | - 'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL, |
|
912 | - 'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL, |
|
913 | - 'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL, |
|
914 | - 'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL, |
|
915 | - 'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL, |
|
916 | - 'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL, |
|
917 | - 'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL, |
|
918 | - 'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL, |
|
919 | - 'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0, |
|
904 | + 'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL, |
|
905 | + 'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL, |
|
906 | + 'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL, |
|
907 | + 'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL, |
|
908 | + 'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL, |
|
909 | + 'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL, |
|
910 | + 'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL, |
|
911 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL, |
|
912 | + 'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL, |
|
913 | + 'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL, |
|
914 | + 'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL, |
|
915 | + 'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL, |
|
916 | + 'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL, |
|
917 | + 'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL, |
|
918 | + 'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL, |
|
919 | + 'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0, |
|
920 | 920 | 'status' => 'publish' |
921 | 921 | ); |
922 | 922 | |
923 | 923 | |
924 | 924 | //if we've got the venue_id then we're just updating the existing venue so let's do that and then get out. |
925 | - if ( !empty( $venue_id ) ) { |
|
926 | - $update_where = array( $venue_model->primary_key_name() => $venue_id ); |
|
927 | - $rows_affected = $venue_model->update( $venue_array, array( $update_where ) ); |
|
925 | + if ( ! empty($venue_id)) { |
|
926 | + $update_where = array($venue_model->primary_key_name() => $venue_id); |
|
927 | + $rows_affected = $venue_model->update($venue_array, array($update_where)); |
|
928 | 928 | //we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present. |
929 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
929 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
930 | 930 | return $rows_affected > 0 ? TRUE : FALSE; |
931 | 931 | } else { |
932 | 932 | //we insert the venue |
933 | - $venue_id = $venue_model->insert( $venue_array ); |
|
934 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
935 | - return !empty( $venue_id ) ? TRUE : FALSE; |
|
933 | + $venue_id = $venue_model->insert($venue_array); |
|
934 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
935 | + return ! empty($venue_id) ? TRUE : FALSE; |
|
936 | 936 | } |
937 | 937 | //when we have the ancestor come in it's already been handled by the revision save. |
938 | 938 | } |
@@ -946,54 +946,54 @@ discard block |
||
946 | 946 | * @param array $data The request data from the form |
947 | 947 | * @return bool success or fail |
948 | 948 | */ |
949 | - protected function _default_tickets_update( EE_Event $evtobj, $data ) { |
|
949 | + protected function _default_tickets_update(EE_Event $evtobj, $data) { |
|
950 | 950 | $success = true; |
951 | 951 | $saved_dtt = null; |
952 | 952 | $saved_tickets = array(); |
953 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
953 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
954 | 954 | |
955 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
955 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
956 | 956 | //trim all values to ensure any excess whitespace is removed. |
957 | - $dtt = array_map( 'trim', $dtt ); |
|
958 | - $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
957 | + $dtt = array_map('trim', $dtt); |
|
958 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
959 | 959 | $datetime_values = array( |
960 | - 'DTT_ID' => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL, |
|
960 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL, |
|
961 | 961 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
962 | 962 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
963 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'], |
|
963 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
964 | 964 | 'DTT_order' => $row, |
965 | 965 | ); |
966 | 966 | |
967 | 967 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
968 | 968 | |
969 | - if ( !empty( $dtt['DTT_ID'] ) ) { |
|
970 | - $DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] ); |
|
971 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
972 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
973 | - foreach ( $datetime_values as $field => $value ) { |
|
974 | - $DTM->set( $field, $value ); |
|
969 | + if ( ! empty($dtt['DTT_ID'])) { |
|
970 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']); |
|
971 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
972 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
973 | + foreach ($datetime_values as $field => $value) { |
|
974 | + $DTM->set($field, $value); |
|
975 | 975 | } |
976 | 976 | |
977 | 977 | //make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. We need to do this so we dont' TRASH the parent DTT. |
978 | 978 | $saved_dtts[$DTM->ID()] = $DTM; |
979 | 979 | } else { |
980 | - $DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE ); |
|
981 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
982 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
983 | - $DTM->set_timezone( $evtobj->get_timezone() ); |
|
984 | - foreach ( $datetime_values as $field => $value ) { |
|
985 | - $DTM->set( $field, $value ); |
|
980 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE); |
|
981 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
982 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
983 | + $DTM->set_timezone($evtobj->get_timezone()); |
|
984 | + foreach ($datetime_values as $field => $value) { |
|
985 | + $DTM->set($field, $value); |
|
986 | 986 | } |
987 | 987 | } |
988 | 988 | $DTM->save(); |
989 | 989 | |
990 | - $DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' ); |
|
990 | + $DTT = $evtobj->_add_relation_to($DTM, 'Datetime'); |
|
991 | 991 | |
992 | 992 | //load DTT helper |
993 | 993 | |
994 | 994 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
995 | - if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) { |
|
996 | - $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') ); |
|
995 | + if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) { |
|
996 | + $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start')); |
|
997 | 997 | $DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days'); |
998 | 998 | $DTT->save(); |
999 | 999 | } |
@@ -1001,45 +1001,45 @@ discard block |
||
1001 | 1001 | //now we got to make sure we add the new DTT_ID to the $saved_dtts array because it is possible there was a new one created for the autosave. |
1002 | 1002 | $saved_dtt = $DTT; |
1003 | 1003 | |
1004 | - $success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
1004 | + $success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
1005 | 1005 | } |
1006 | 1006 | |
1007 | 1007 | //no dtts get deleted so we don't do any of that logic here. |
1008 | 1008 | //update tickets next |
1009 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array(); |
|
1010 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
1011 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
1009 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
1010 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
1011 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
1012 | 1012 | $update_prices = false; |
1013 | - $ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
1013 | + $ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
1014 | 1014 | |
1015 | 1015 | // trim inputs to ensure any excess whitespace is removed. |
1016 | - $tkt = array_map( 'trim', $tkt ); |
|
1016 | + $tkt = array_map('trim', $tkt); |
|
1017 | 1017 | |
1018 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
1018 | + if (empty($tkt['TKT_start_date'])) { |
|
1019 | 1019 | //let's use now in the set timezone. |
1020 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
1021 | - $tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] ); |
|
1020 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
1021 | + $tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]); |
|
1022 | 1022 | } |
1023 | 1023 | |
1024 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
1024 | + if (empty($tkt['TKT_end_date'])) { |
|
1025 | 1025 | //use the start date of the first datetime |
1026 | 1026 | $dtt = $evtobj->first_datetime(); |
1027 | - $tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] ); |
|
1027 | + $tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]); |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | $TKT_values = array( |
1031 | - 'TKT_ID' => !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL, |
|
1032 | - 'TTM_ID' => !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
1033 | - 'TKT_name' => !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
1034 | - 'TKT_description' => !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '', |
|
1031 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL, |
|
1032 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
1033 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
1034 | + 'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '', |
|
1035 | 1035 | 'TKT_start_date' => $tkt['TKT_start_date'], |
1036 | 1036 | 'TKT_end_date' => $tkt['TKT_end_date'], |
1037 | - 'TKT_qty' => ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1038 | - 'TKT_uses' => ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ], |
|
1039 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
1040 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'], |
|
1037 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1038 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
1039 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
1040 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
1041 | 1041 | 'TKT_row' => $row, |
1042 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row, |
|
1042 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row, |
|
1043 | 1043 | 'TKT_price' => $ticket_price |
1044 | 1044 | ); |
1045 | 1045 | |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | |
1048 | 1048 | |
1049 | 1049 | //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
1050 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
1050 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
1051 | 1051 | $TKT_values['TKT_ID'] = 0; |
1052 | 1052 | $TKT_values['TKT_is_default'] = 0; |
1053 | 1053 | $TKT_values['TKT_price'] = $ticket_price; |
@@ -1058,58 +1058,58 @@ discard block |
||
1058 | 1058 | //we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified. |
1059 | 1059 | //keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
1060 | 1060 | |
1061 | - if ( !empty( $tkt['TKT_ID'] ) ) { |
|
1062 | - $TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] ); |
|
1063 | - if ( $TKT instanceof EE_Ticket ) { |
|
1064 | - $ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false; |
|
1061 | + if ( ! empty($tkt['TKT_ID'])) { |
|
1062 | + $TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']); |
|
1063 | + if ($TKT instanceof EE_Ticket) { |
|
1064 | + $ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false; |
|
1065 | 1065 | //let's just check the total price for the existing ticket and determine if it matches the new total price. if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket. |
1066 | - $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false; |
|
1067 | - $TKT->set_date_format( $incoming_date_formats[ 0 ] ); |
|
1068 | - $TKT->set_time_format( $incoming_date_formats[ 1 ] ); |
|
1066 | + $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false; |
|
1067 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1068 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1069 | 1069 | //set new values |
1070 | - foreach ( $TKT_values as $field => $value ) { |
|
1071 | - if ( $field == 'TKT_qty' ) { |
|
1072 | - $TKT->set_qty( $value ); |
|
1070 | + foreach ($TKT_values as $field => $value) { |
|
1071 | + if ($field == 'TKT_qty') { |
|
1072 | + $TKT->set_qty($value); |
|
1073 | 1073 | } else { |
1074 | - $TKT->set( $field, $value ); |
|
1074 | + $TKT->set($field, $value); |
|
1075 | 1075 | } |
1076 | 1076 | } |
1077 | 1077 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
1078 | - if ( $create_new_TKT ) { |
|
1078 | + if ($create_new_TKT) { |
|
1079 | 1079 | //archive the old ticket first |
1080 | - $TKT->set( 'TKT_deleted', 1 ); |
|
1080 | + $TKT->set('TKT_deleted', 1); |
|
1081 | 1081 | $TKT->save(); |
1082 | 1082 | //make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine. |
1083 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
1083 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
1084 | 1084 | //create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it. |
1085 | 1085 | $TKT = clone $TKT; |
1086 | - $TKT->set( 'TKT_ID', 0 ); |
|
1087 | - $TKT->set( 'TKT_deleted', 0 ); |
|
1088 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1089 | - $TKT->set( 'TKT_sold', 0 ); |
|
1086 | + $TKT->set('TKT_ID', 0); |
|
1087 | + $TKT->set('TKT_deleted', 0); |
|
1088 | + $TKT->set('TKT_price', $ticket_price); |
|
1089 | + $TKT->set('TKT_sold', 0); |
|
1090 | 1090 | //now we need to make sure that $new prices are created as well and attached to new ticket. |
1091 | 1091 | $update_prices = true; |
1092 | 1092 | } |
1093 | 1093 | //make sure price is set if it hasn't been already |
1094 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1094 | + $TKT->set('TKT_price', $ticket_price); |
|
1095 | 1095 | } |
1096 | 1096 | |
1097 | 1097 | } else { |
1098 | 1098 | //no TKT_id so a new TKT |
1099 | 1099 | $TKT_values['TKT_price'] = $ticket_price; |
1100 | - $TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE ); |
|
1101 | - if ( $TKT instanceof EE_Ticket ) { |
|
1100 | + $TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE); |
|
1101 | + if ($TKT instanceof EE_Ticket) { |
|
1102 | 1102 | //need to reset values to properly account for the date formats |
1103 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1104 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1105 | - $TKT->set_timezone( $evtobj->get_timezone() ); |
|
1103 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1104 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1105 | + $TKT->set_timezone($evtobj->get_timezone()); |
|
1106 | 1106 | |
1107 | 1107 | //set new values |
1108 | - foreach ( $TKT_values as $field => $value ) { |
|
1109 | - if ( $field == 'TKT_qty' ) { |
|
1110 | - $TKT->set_qty( $value ); |
|
1108 | + foreach ($TKT_values as $field => $value) { |
|
1109 | + if ($field == 'TKT_qty') { |
|
1110 | + $TKT->set_qty($value); |
|
1111 | 1111 | } else { |
1112 | - $TKT->set( $field, $value ); |
|
1112 | + $TKT->set($field, $value); |
|
1113 | 1113 | } |
1114 | 1114 | } |
1115 | 1115 | |
@@ -1117,31 +1117,31 @@ discard block |
||
1117 | 1117 | } |
1118 | 1118 | } |
1119 | 1119 | // cap ticket qty by datetime reg limits |
1120 | - $TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) ); |
|
1120 | + $TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit'))); |
|
1121 | 1121 | //update ticket. |
1122 | 1122 | $TKT->save(); |
1123 | 1123 | |
1124 | 1124 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
1125 | - if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) { |
|
1126 | - $TKT->set('TKT_end_date', $TKT->get('TKT_start_date') ); |
|
1125 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
1126 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
1127 | 1127 | $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
1128 | 1128 | $TKT->save(); |
1129 | 1129 | } |
1130 | 1130 | |
1131 | 1131 | //initially let's add the ticket to the dtt |
1132 | - $saved_dtt->_add_relation_to( $TKT, 'Ticket' ); |
|
1132 | + $saved_dtt->_add_relation_to($TKT, 'Ticket'); |
|
1133 | 1133 | |
1134 | 1134 | $saved_tickets[$TKT->ID()] = $TKT; |
1135 | 1135 | |
1136 | 1136 | //add prices to ticket |
1137 | - $this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices ); |
|
1137 | + $this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices); |
|
1138 | 1138 | } |
1139 | 1139 | //however now we need to handle permanently deleting tickets via the ui. Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold. However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db. |
1140 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1141 | - $tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) ); |
|
1140 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1141 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
1142 | 1142 | |
1143 | - foreach ( $tickets_removed as $id ) { |
|
1144 | - $id = absint( $id ); |
|
1143 | + foreach ($tickets_removed as $id) { |
|
1144 | + $id = absint($id); |
|
1145 | 1145 | |
1146 | 1146 | //get the ticket for this id |
1147 | 1147 | $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
@@ -1149,7 +1149,7 @@ discard block |
||
1149 | 1149 | //need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold) |
1150 | 1150 | $dtts = $tkt_to_remove->get_many_related('Datetime'); |
1151 | 1151 | |
1152 | - foreach( $dtts as $dtt ) { |
|
1152 | + foreach ($dtts as $dtt) { |
|
1153 | 1153 | $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
1154 | 1154 | } |
1155 | 1155 | |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | //finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships) |
1161 | 1161 | $tkt_to_remove->delete_permanently(); |
1162 | 1162 | } |
1163 | - return array( $saved_dtt, $saved_tickets ); |
|
1163 | + return array($saved_dtt, $saved_tickets); |
|
1164 | 1164 | } |
1165 | 1165 | |
1166 | 1166 | |
@@ -1175,31 +1175,31 @@ discard block |
||
1175 | 1175 | * @param bool $new_prices Whether attach existing incoming prices or create new ones. |
1176 | 1176 | * @return void |
1177 | 1177 | */ |
1178 | - private function _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) { |
|
1179 | - foreach ( $prices as $row => $prc ) { |
|
1178 | + private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) { |
|
1179 | + foreach ($prices as $row => $prc) { |
|
1180 | 1180 | $PRC_values = array( |
1181 | - 'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL, |
|
1182 | - 'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL, |
|
1183 | - 'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
1184 | - 'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
1185 | - 'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
1181 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL, |
|
1182 | + 'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL, |
|
1183 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
1184 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
1185 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
1186 | 1186 | 'PRC_is_default' => 0, //make sure prices are NOT set as default from this context |
1187 | 1187 | 'PRC_order' => $row |
1188 | 1188 | ); |
1189 | 1189 | |
1190 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
1190 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
1191 | 1191 | $PRC_values['PRC_ID'] = 0; |
1192 | - $PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE); |
|
1192 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE); |
|
1193 | 1193 | } else { |
1194 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
1194 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
1195 | 1195 | //update this price with new values |
1196 | - foreach ( $PRC_values as $field => $newprc ) { |
|
1197 | - $PRC->set( $field, $newprc ); |
|
1196 | + foreach ($PRC_values as $field => $newprc) { |
|
1197 | + $PRC->set($field, $newprc); |
|
1198 | 1198 | } |
1199 | 1199 | $PRC->save(); |
1200 | 1200 | } |
1201 | 1201 | |
1202 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
1202 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
1203 | 1203 | } |
1204 | 1204 | } |
1205 | 1205 | |
@@ -1237,9 +1237,9 @@ discard block |
||
1237 | 1237 | //load formatter helper |
1238 | 1238 | |
1239 | 1239 | //args for getting related registrations |
1240 | - $approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) ); |
|
1241 | - $not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) ); |
|
1242 | - $pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) ); |
|
1240 | + $approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved)); |
|
1241 | + $not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved)); |
|
1242 | + $pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment)); |
|
1243 | 1243 | |
1244 | 1244 | |
1245 | 1245 | // publish box |
@@ -1268,9 +1268,9 @@ discard block |
||
1268 | 1268 | ), |
1269 | 1269 | REG_ADMIN_URL |
1270 | 1270 | ), |
1271 | - 'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ), |
|
1272 | - 'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ), |
|
1273 | - 'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ), |
|
1271 | + 'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args), |
|
1272 | + 'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args), |
|
1273 | + 'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args), |
|
1274 | 1274 | 'misc_pub_section_class' => apply_filters( |
1275 | 1275 | 'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class', |
1276 | 1276 | 'misc-pub-section' |
@@ -1289,9 +1289,9 @@ discard block |
||
1289 | 1289 | 'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add', |
1290 | 1290 | $this->_cpt_model_obj |
1291 | 1291 | ); |
1292 | - $publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean(); |
|
1292 | + $publish_box_extra_args['event_editor_overview_add'] = ob_get_clean(); |
|
1293 | 1293 | // load template |
1294 | - EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args ); |
|
1294 | + EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args); |
|
1295 | 1295 | } |
1296 | 1296 | |
1297 | 1297 | |
@@ -1323,16 +1323,16 @@ discard block |
||
1323 | 1323 | $this->verify_cpt_object(); |
1324 | 1324 | add_meta_box( |
1325 | 1325 | 'espresso_event_editor_tickets', |
1326 | - __( 'Event Datetime & Ticket', 'event_espresso' ), |
|
1327 | - array( $this, 'ticket_metabox' ), |
|
1326 | + __('Event Datetime & Ticket', 'event_espresso'), |
|
1327 | + array($this, 'ticket_metabox'), |
|
1328 | 1328 | $this->page_slug, |
1329 | 1329 | 'normal', |
1330 | 1330 | 'high' |
1331 | 1331 | ); |
1332 | 1332 | add_meta_box( |
1333 | 1333 | 'espresso_event_editor_event_options', |
1334 | - __( 'Event Registration Options', 'event_espresso' ), |
|
1335 | - array( $this, 'registration_options_meta_box' ), |
|
1334 | + __('Event Registration Options', 'event_espresso'), |
|
1335 | + array($this, 'registration_options_meta_box'), |
|
1336 | 1336 | $this->page_slug, |
1337 | 1337 | 'side', |
1338 | 1338 | 'default' |
@@ -1362,36 +1362,36 @@ discard block |
||
1362 | 1362 | 'disabled' => '' |
1363 | 1363 | ); |
1364 | 1364 | |
1365 | - $event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL; |
|
1365 | + $event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL; |
|
1366 | 1366 | |
1367 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1367 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1368 | 1368 | |
1369 | 1369 | /** |
1370 | 1370 | * 1. Start with retrieving Datetimes |
1371 | 1371 | * 2. Fore each datetime get related tickets |
1372 | 1372 | * 3. For each ticket get related prices |
1373 | 1373 | */ |
1374 | - $times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id ); |
|
1374 | + $times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id); |
|
1375 | 1375 | /** @type EE_Datetime $first_datetime */ |
1376 | - $first_datetime = reset( $times ); |
|
1376 | + $first_datetime = reset($times); |
|
1377 | 1377 | //do we get related tickets? |
1378 | - if ( $first_datetime instanceof EE_Datetime |
|
1379 | - && $first_datetime->ID() !== 0 ) { |
|
1378 | + if ($first_datetime instanceof EE_Datetime |
|
1379 | + && $first_datetime->ID() !== 0) { |
|
1380 | 1380 | $existing_datetime_ids[] = $first_datetime->get('DTT_ID'); |
1381 | 1381 | $template_args['time'] = $first_datetime; |
1382 | 1382 | $related_tickets = $first_datetime->tickets( |
1383 | 1383 | array( |
1384 | - array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), |
|
1384 | + array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), |
|
1385 | 1385 | 'default_where_conditions' => 'none' |
1386 | 1386 | ) |
1387 | 1387 | ); |
1388 | 1388 | |
1389 | - if ( !empty($related_tickets) ) { |
|
1389 | + if ( ! empty($related_tickets)) { |
|
1390 | 1390 | $template_args['total_ticket_rows'] = count($related_tickets); |
1391 | 1391 | $row = 0; |
1392 | - foreach ( $related_tickets as $ticket ) { |
|
1392 | + foreach ($related_tickets as $ticket) { |
|
1393 | 1393 | $existing_ticket_ids[] = $ticket->get('TKT_ID'); |
1394 | - $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row ); |
|
1394 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row); |
|
1395 | 1395 | |
1396 | 1396 | $row++; |
1397 | 1397 | } |
@@ -1399,13 +1399,13 @@ discard block |
||
1399 | 1399 | $template_args['total_ticket_rows'] = 1; |
1400 | 1400 | /** @type EE_Ticket $ticket */ |
1401 | 1401 | $ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object(); |
1402 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket ); |
|
1402 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket); |
|
1403 | 1403 | } |
1404 | 1404 | } else { |
1405 | 1405 | $template_args['time'] = $times[0]; |
1406 | 1406 | /** @type EE_Ticket $ticket */ |
1407 | 1407 | $ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
1408 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] ); |
|
1408 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]); |
|
1409 | 1409 | // NOTE: we're just sending the first default row |
1410 | 1410 | // (decaf can't manage default tickets so this should be sufficient); |
1411 | 1411 | } |
@@ -1414,8 +1414,8 @@ discard block |
||
1414 | 1414 | $template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info'); |
1415 | 1415 | $template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
1416 | 1416 | $template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
1417 | - $template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE ); |
|
1418 | - $template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' ); |
|
1417 | + $template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE); |
|
1418 | + $template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'); |
|
1419 | 1419 | EEH_Template::display_template($template, $template_args); |
1420 | 1420 | } |
1421 | 1421 | |
@@ -1430,21 +1430,21 @@ discard block |
||
1430 | 1430 | * @param int $row |
1431 | 1431 | * @return string generated html for the ticket row. |
1432 | 1432 | */ |
1433 | - private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) { |
|
1433 | + private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) { |
|
1434 | 1434 | $template_args = array( |
1435 | - 'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(), |
|
1436 | - 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '', |
|
1435 | + 'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(), |
|
1436 | + 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '', |
|
1437 | 1437 | 'ticketrow' => $skeleton ? 'TICKETNUM' : $row, |
1438 | 1438 | 'TKT_ID' => $ticket->get('TKT_ID'), |
1439 | 1439 | 'TKT_name' => $ticket->get('TKT_name'), |
1440 | 1440 | 'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'), |
1441 | 1441 | 'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'), |
1442 | 1442 | 'TKT_is_default' => $ticket->get('TKT_is_default'), |
1443 | - 'TKT_qty' => $ticket->get_pretty('TKT_qty','input'), |
|
1443 | + 'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'), |
|
1444 | 1444 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1445 | 1445 | 'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'), |
1446 | - 'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
|
1447 | - 'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled' |
|
1446 | + 'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
|
1447 | + 'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled' |
|
1448 | 1448 | ); |
1449 | 1449 | |
1450 | 1450 | $price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object(); |
@@ -1460,23 +1460,23 @@ discard block |
||
1460 | 1460 | |
1461 | 1461 | //make sure we have default start and end dates if skeleton |
1462 | 1462 | //handle rows that should NOT be empty |
1463 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1463 | + if (empty($template_args['TKT_start_date'])) { |
|
1464 | 1464 | //if empty then the start date will be now. |
1465 | 1465 | $template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp')); |
1466 | 1466 | } |
1467 | 1467 | |
1468 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1468 | + if (empty($template_args['TKT_end_date'])) { |
|
1469 | 1469 | //get the earliest datetime (if present); |
1470 | - $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
|
1470 | + $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL; |
|
1471 | 1471 | |
1472 | - if ( !empty( $earliest_dtt ) ) |
|
1472 | + if ( ! empty($earliest_dtt)) |
|
1473 | 1473 | $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
1474 | 1474 | else |
1475 | - $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1475 | + $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y"))); |
|
1476 | 1476 | } |
1477 | 1477 | |
1478 | - $template_args = array_merge( $template_args, $price_args ); |
|
1479 | - $template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket); |
|
1478 | + $template_args = array_merge($template_args, $price_args); |
|
1479 | + $template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket); |
|
1480 | 1480 | return EEH_Template::display_template($template, $template_args, TRUE); |
1481 | 1481 | } |
1482 | 1482 | |
@@ -1505,8 +1505,8 @@ discard block |
||
1505 | 1505 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
1506 | 1506 | $template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description()); |
1507 | 1507 | $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false); |
1508 | - $template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values ); |
|
1509 | - $templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php'; |
|
1508 | + $template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values); |
|
1509 | + $templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php'; |
|
1510 | 1510 | EEH_Template::display_template($templatepath, $template_args); |
1511 | 1511 | } |
1512 | 1512 | |
@@ -1534,21 +1534,21 @@ discard block |
||
1534 | 1534 | $EEME = $this->_event_model(); |
1535 | 1535 | |
1536 | 1536 | $offset = ($current_page - 1) * $per_page; |
1537 | - $limit = $count ? NULL : $offset . ',' . $per_page; |
|
1537 | + $limit = $count ? NULL : $offset.','.$per_page; |
|
1538 | 1538 | $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID'; |
1539 | 1539 | $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC"; |
1540 | 1540 | |
1541 | 1541 | if (isset($this->_req_data['month_range'])) { |
1542 | 1542 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
1543 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1544 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
1543 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1544 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1545 | 1545 | } |
1546 | 1546 | |
1547 | 1547 | $where = array(); |
1548 | 1548 | |
1549 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
1549 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
1550 | 1550 | //determine what post_status our condition will have for the query. |
1551 | - switch ( $status ) { |
|
1551 | + switch ($status) { |
|
1552 | 1552 | case 'month' : |
1553 | 1553 | case 'today' : |
1554 | 1554 | case NULL : |
@@ -1556,7 +1556,7 @@ discard block |
||
1556 | 1556 | break; |
1557 | 1557 | |
1558 | 1558 | case 'draft' : |
1559 | - $where['status'] = array( 'IN', array('draft', 'auto-draft') ); |
|
1559 | + $where['status'] = array('IN', array('draft', 'auto-draft')); |
|
1560 | 1560 | break; |
1561 | 1561 | |
1562 | 1562 | default : |
@@ -1564,43 +1564,43 @@ discard block |
||
1564 | 1564 | } |
1565 | 1565 | |
1566 | 1566 | //categories? |
1567 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
1567 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
1568 | 1568 | |
1569 | - if ( !empty ( $category ) ) { |
|
1569 | + if ( ! empty ($category)) { |
|
1570 | 1570 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
1571 | 1571 | $where['Term_Taxonomy.term_id'] = $category; |
1572 | 1572 | } |
1573 | 1573 | |
1574 | 1574 | //date where conditions |
1575 | - $start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' ); |
|
1575 | + $start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start'); |
|
1576 | 1576 | if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') { |
1577 | - $DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) ); |
|
1578 | - $start = $DateTime->format( implode( ' ', $start_formats ) ); |
|
1579 | - $end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) ); |
|
1580 | - $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) ); |
|
1577 | + $DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone())); |
|
1578 | + $start = $DateTime->format(implode(' ', $start_formats)); |
|
1579 | + $end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1580 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1581 | 1581 | } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') { |
1582 | - $DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1583 | - $start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) ); |
|
1584 | - $end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1585 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1586 | - } else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) { |
|
1587 | - $now = date( 'Y-m-01' ); |
|
1588 | - $DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1589 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1590 | - $end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1591 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1582 | + $DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1583 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1584 | + $end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1585 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1586 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') { |
|
1587 | + $now = date('Y-m-01'); |
|
1588 | + $DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1589 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1590 | + $end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1591 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1592 | 1592 | } |
1593 | 1593 | |
1594 | 1594 | |
1595 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1596 | - $where['EVT_wp_user'] = get_current_user_id(); |
|
1595 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1596 | + $where['EVT_wp_user'] = get_current_user_id(); |
|
1597 | 1597 | } else { |
1598 | - if ( ! isset( $where['status'] ) ) { |
|
1599 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) { |
|
1598 | + if ( ! isset($where['status'])) { |
|
1599 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
1600 | 1600 | $where['OR'] = array( |
1601 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1601 | + 'status*restrict_private' => array('!=', 'private'), |
|
1602 | 1602 | 'AND' => array( |
1603 | - 'status*inclusive' => array( '=', 'private' ), |
|
1603 | + 'status*inclusive' => array('=', 'private'), |
|
1604 | 1604 | 'EVT_wp_user' => get_current_user_id() |
1605 | 1605 | ) |
1606 | 1606 | ); |
@@ -1608,16 +1608,16 @@ discard block |
||
1608 | 1608 | } |
1609 | 1609 | } |
1610 | 1610 | |
1611 | - if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
|
1612 | - if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1611 | + if (isset($this->_req_data['EVT_wp_user'])) { |
|
1612 | + if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1613 | 1613 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1614 | 1614 | } |
1615 | 1615 | } |
1616 | 1616 | |
1617 | 1617 | |
1618 | 1618 | //search query handling |
1619 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1620 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1619 | + if (isset($this->_req_data['s'])) { |
|
1620 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1621 | 1621 | $where['OR'] = array( |
1622 | 1622 | 'EVT_name' => array('LIKE', $search_string), |
1623 | 1623 | 'EVT_desc' => array('LIKE', $search_string), |
@@ -1626,32 +1626,32 @@ discard block |
||
1626 | 1626 | } |
1627 | 1627 | |
1628 | 1628 | |
1629 | - $where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data ); |
|
1630 | - $query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data ); |
|
1629 | + $where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data); |
|
1630 | + $query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data); |
|
1631 | 1631 | |
1632 | 1632 | |
1633 | 1633 | //let's first check if we have special requests coming in. |
1634 | - if ( isset( $this->_req_data['active_status'] ) ) { |
|
1635 | - switch ( $this->_req_data['active_status'] ) { |
|
1634 | + if (isset($this->_req_data['active_status'])) { |
|
1635 | + switch ($this->_req_data['active_status']) { |
|
1636 | 1636 | case 'upcoming' : |
1637 | - return $EEME->get_upcoming_events( $query_params, $count ); |
|
1637 | + return $EEME->get_upcoming_events($query_params, $count); |
|
1638 | 1638 | break; |
1639 | 1639 | |
1640 | 1640 | case 'expired' : |
1641 | - return $EEME->get_expired_events( $query_params, $count ); |
|
1641 | + return $EEME->get_expired_events($query_params, $count); |
|
1642 | 1642 | break; |
1643 | 1643 | |
1644 | 1644 | case 'active' : |
1645 | - return $EEME->get_active_events( $query_params, $count ); |
|
1645 | + return $EEME->get_active_events($query_params, $count); |
|
1646 | 1646 | break; |
1647 | 1647 | |
1648 | 1648 | case 'inactive' : |
1649 | - return $EEME->get_inactive_events( $query_params, $count ); |
|
1649 | + return $EEME->get_inactive_events($query_params, $count); |
|
1650 | 1650 | break; |
1651 | 1651 | } |
1652 | 1652 | } |
1653 | 1653 | |
1654 | - $events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params ); |
|
1654 | + $events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params); |
|
1655 | 1655 | |
1656 | 1656 | return $events; |
1657 | 1657 | } |
@@ -1660,23 +1660,23 @@ discard block |
||
1660 | 1660 | |
1661 | 1661 | |
1662 | 1662 | //handling for WordPress CPT actions (trash, restore, delete) |
1663 | - public function trash_cpt_item( $post_id ) { |
|
1663 | + public function trash_cpt_item($post_id) { |
|
1664 | 1664 | $this->_req_data['EVT_ID'] = $post_id; |
1665 | - $this->_trash_or_restore_event( 'trash', FALSE ); |
|
1665 | + $this->_trash_or_restore_event('trash', FALSE); |
|
1666 | 1666 | } |
1667 | 1667 | |
1668 | 1668 | |
1669 | 1669 | |
1670 | 1670 | |
1671 | - public function restore_cpt_item( $post_id ) { |
|
1671 | + public function restore_cpt_item($post_id) { |
|
1672 | 1672 | $this->_req_data['EVT_ID'] = $post_id; |
1673 | - $this->_trash_or_restore_event( 'draft', FALSE ); |
|
1673 | + $this->_trash_or_restore_event('draft', FALSE); |
|
1674 | 1674 | } |
1675 | 1675 | |
1676 | 1676 | |
1677 | - public function delete_cpt_item( $post_id ) { |
|
1677 | + public function delete_cpt_item($post_id) { |
|
1678 | 1678 | $this->_req_data['EVT_ID'] = $post_id; |
1679 | - $this->_delete_event( FALSE ); |
|
1679 | + $this->_delete_event(FALSE); |
|
1680 | 1680 | } |
1681 | 1681 | |
1682 | 1682 | |
@@ -1688,7 +1688,7 @@ discard block |
||
1688 | 1688 | * @param string $event_status |
1689 | 1689 | * @return void |
1690 | 1690 | */ |
1691 | - protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) { |
|
1691 | + protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) { |
|
1692 | 1692 | //determine the event id and set to array. |
1693 | 1693 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE; |
1694 | 1694 | // loop thru events |
@@ -1696,7 +1696,7 @@ discard block |
||
1696 | 1696 | // clean status |
1697 | 1697 | $event_status = sanitize_key($event_status); |
1698 | 1698 | // grab status |
1699 | - if (!empty($event_status)) { |
|
1699 | + if ( ! empty($event_status)) { |
|
1700 | 1700 | $success = $this->_change_event_status($EVT_ID, $event_status); |
1701 | 1701 | } else { |
1702 | 1702 | $success = FALSE; |
@@ -1710,7 +1710,7 @@ discard block |
||
1710 | 1710 | } |
1711 | 1711 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1712 | 1712 | |
1713 | - if ( $redirect_after ) |
|
1713 | + if ($redirect_after) |
|
1714 | 1714 | $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
1715 | 1715 | } |
1716 | 1716 | |
@@ -1725,7 +1725,7 @@ discard block |
||
1725 | 1725 | // clean status |
1726 | 1726 | $event_status = sanitize_key($event_status); |
1727 | 1727 | // grab status |
1728 | - if (!empty($event_status)) { |
|
1728 | + if ( ! empty($event_status)) { |
|
1729 | 1729 | $success = TRUE; |
1730 | 1730 | //determine the event id and set to array. |
1731 | 1731 | $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
@@ -1760,15 +1760,15 @@ discard block |
||
1760 | 1760 | * @param string $event_status |
1761 | 1761 | * @return bool |
1762 | 1762 | */ |
1763 | - private function _change_event_status( $EVT_ID = 0, $event_status = '') { |
|
1763 | + private function _change_event_status($EVT_ID = 0, $event_status = '') { |
|
1764 | 1764 | // grab event id |
1765 | - if (!$EVT_ID) { |
|
1765 | + if ( ! $EVT_ID) { |
|
1766 | 1766 | $msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso'); |
1767 | 1767 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1768 | 1768 | return FALSE; |
1769 | 1769 | } |
1770 | 1770 | |
1771 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1771 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1772 | 1772 | |
1773 | 1773 | // clean status |
1774 | 1774 | $event_status = sanitize_key($event_status); |
@@ -1794,7 +1794,7 @@ discard block |
||
1794 | 1794 | $hook = FALSE; |
1795 | 1795 | } |
1796 | 1796 | //use class to change status |
1797 | - $this->_cpt_model_obj->set_status( $event_status ); |
|
1797 | + $this->_cpt_model_obj->set_status($event_status); |
|
1798 | 1798 | $success = $this->_cpt_model_obj->save(); |
1799 | 1799 | |
1800 | 1800 | if ($success === FALSE) { |
@@ -1816,15 +1816,15 @@ discard block |
||
1816 | 1816 | * @access protected |
1817 | 1817 | * @param bool $redirect_after |
1818 | 1818 | */ |
1819 | - protected function _delete_event( $redirect_after = TRUE ) { |
|
1819 | + protected function _delete_event($redirect_after = TRUE) { |
|
1820 | 1820 | //determine the event id and set to array. |
1821 | 1821 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL; |
1822 | - $EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID; |
|
1822 | + $EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID; |
|
1823 | 1823 | |
1824 | 1824 | |
1825 | 1825 | // loop thru events |
1826 | 1826 | if ($EVT_ID) { |
1827 | - $success = $this->_permanently_delete_event( $EVT_ID ); |
|
1827 | + $success = $this->_permanently_delete_event($EVT_ID); |
|
1828 | 1828 | // get list of events with no prices |
1829 | 1829 | $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
1830 | 1830 | // remove this event from the list of events with no prices |
@@ -1838,7 +1838,7 @@ discard block |
||
1838 | 1838 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1839 | 1839 | } |
1840 | 1840 | |
1841 | - if ( $redirect_after ) |
|
1841 | + if ($redirect_after) |
|
1842 | 1842 | $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
1843 | 1843 | } |
1844 | 1844 | |
@@ -1856,12 +1856,12 @@ discard block |
||
1856 | 1856 | $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
1857 | 1857 | // loop thru events |
1858 | 1858 | foreach ($EVT_IDs as $EVT_ID) { |
1859 | - $EVT_ID = absint( $EVT_ID ); |
|
1860 | - if ( $EVT_ID ) { |
|
1861 | - $results = $this->_permanently_delete_event( $EVT_ID ); |
|
1859 | + $EVT_ID = absint($EVT_ID); |
|
1860 | + if ($EVT_ID) { |
|
1861 | + $results = $this->_permanently_delete_event($EVT_ID); |
|
1862 | 1862 | $success = $results !== FALSE ? $success : FALSE; |
1863 | 1863 | // remove this event from the list of events with no prices |
1864 | - unset( $espresso_no_ticket_prices[ $EVT_ID ] ); |
|
1864 | + unset($espresso_no_ticket_prices[$EVT_ID]); |
|
1865 | 1865 | } else { |
1866 | 1866 | $success = FALSE; |
1867 | 1867 | $msg = __('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso'); |
@@ -1881,9 +1881,9 @@ discard block |
||
1881 | 1881 | * @param int $EVT_ID |
1882 | 1882 | * @return bool |
1883 | 1883 | */ |
1884 | - private function _permanently_delete_event( $EVT_ID = 0 ) { |
|
1884 | + private function _permanently_delete_event($EVT_ID = 0) { |
|
1885 | 1885 | // grab event id |
1886 | - if ( ! $EVT_ID ) { |
|
1886 | + if ( ! $EVT_ID) { |
|
1887 | 1887 | $msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso'); |
1888 | 1888 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1889 | 1889 | return FALSE; |
@@ -1892,19 +1892,19 @@ discard block |
||
1892 | 1892 | ! $this->_cpt_model_obj instanceof EE_Event |
1893 | 1893 | || $this->_cpt_model_obj->ID() !== $EVT_ID |
1894 | 1894 | ) { |
1895 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1895 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1896 | 1896 | } |
1897 | 1897 | |
1898 | - if ( ! $this->_cpt_model_obj instanceof EE_Event ) { |
|
1898 | + if ( ! $this->_cpt_model_obj instanceof EE_Event) { |
|
1899 | 1899 | return false; |
1900 | 1900 | } |
1901 | 1901 | |
1902 | 1902 | //need to delete related tickets and prices first. |
1903 | 1903 | $datetimes = $this->_cpt_model_obj->get_many_related('Datetime'); |
1904 | - foreach ( $datetimes as $datetime ) { |
|
1904 | + foreach ($datetimes as $datetime) { |
|
1905 | 1905 | $this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime'); |
1906 | 1906 | $tickets = $datetime->get_many_related('Ticket'); |
1907 | - foreach ( $tickets as $ticket ) { |
|
1907 | + foreach ($tickets as $ticket) { |
|
1908 | 1908 | $ticket->_remove_relation_to($datetime, 'Datetime'); |
1909 | 1909 | $ticket->delete_related_permanently('Price'); |
1910 | 1910 | $ticket->delete_permanently(); |
@@ -1914,14 +1914,14 @@ discard block |
||
1914 | 1914 | |
1915 | 1915 | //what about related venues or terms? |
1916 | 1916 | $venues = $this->_cpt_model_obj->get_many_related('Venue'); |
1917 | - foreach ( $venues as $venue ) { |
|
1917 | + foreach ($venues as $venue) { |
|
1918 | 1918 | $this->_cpt_model_obj->_remove_relation_to($venue, 'Venue'); |
1919 | 1919 | } |
1920 | 1920 | |
1921 | 1921 | //any attached question groups? |
1922 | 1922 | $question_groups = $this->_cpt_model_obj->get_many_related('Question_Group'); |
1923 | - if ( !empty( $question_groups ) ) { |
|
1924 | - foreach ( $question_groups as $question_group ) { |
|
1923 | + if ( ! empty($question_groups)) { |
|
1924 | + foreach ($question_groups as $question_group) { |
|
1925 | 1925 | $this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group'); |
1926 | 1926 | } |
1927 | 1927 | } |
@@ -1930,12 +1930,12 @@ discard block |
||
1930 | 1930 | |
1931 | 1931 | |
1932 | 1932 | //Message Template Groups |
1933 | - $this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' ); |
|
1933 | + $this->_cpt_model_obj->_remove_relations('Message_Template_Group'); |
|
1934 | 1934 | |
1935 | 1935 | /** @type EE_Term_Taxonomy[] $term_taxonomies */ |
1936 | 1936 | $term_taxonomies = $this->_cpt_model_obj->term_taxonomies(); |
1937 | 1937 | |
1938 | - foreach ( $term_taxonomies as $term_taxonomy ) { |
|
1938 | + foreach ($term_taxonomies as $term_taxonomy) { |
|
1939 | 1939 | $this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy); |
1940 | 1940 | } |
1941 | 1941 | |
@@ -1949,7 +1949,7 @@ discard block |
||
1949 | 1949 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1950 | 1950 | return FALSE; |
1951 | 1951 | } |
1952 | - do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID ); |
|
1952 | + do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID); |
|
1953 | 1953 | return TRUE; |
1954 | 1954 | } |
1955 | 1955 | |
@@ -1966,7 +1966,7 @@ discard block |
||
1966 | 1966 | */ |
1967 | 1967 | public function total_events() { |
1968 | 1968 | |
1969 | - $count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
1969 | + $count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true); |
|
1970 | 1970 | return $count; |
1971 | 1971 | } |
1972 | 1972 | |
@@ -1981,10 +1981,10 @@ discard block |
||
1981 | 1981 | */ |
1982 | 1982 | public function total_events_draft() { |
1983 | 1983 | $where = array( |
1984 | - 'status' => array( 'IN', array('draft', 'auto-draft' ) ) |
|
1984 | + 'status' => array('IN', array('draft', 'auto-draft')) |
|
1985 | 1985 | ); |
1986 | 1986 | |
1987 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
1987 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
1988 | 1988 | return $count; |
1989 | 1989 | } |
1990 | 1990 | |
@@ -2003,7 +2003,7 @@ discard block |
||
2003 | 2003 | 'status' => 'trash' |
2004 | 2004 | ); |
2005 | 2005 | |
2006 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2006 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2007 | 2007 | return $count; |
2008 | 2008 | } |
2009 | 2009 | |
@@ -2031,11 +2031,11 @@ discard block |
||
2031 | 2031 | // translated |
2032 | 2032 | TRUE |
2033 | 2033 | ); |
2034 | - $this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment; |
|
2034 | + $this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment; |
|
2035 | 2035 | |
2036 | 2036 | $this->_set_add_edit_form_tags('update_default_event_settings'); |
2037 | 2037 | $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
2038 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE); |
|
2038 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE); |
|
2039 | 2039 | $this->display_admin_page_with_sidebar(); |
2040 | 2040 | } |
2041 | 2041 | |
@@ -2061,9 +2061,9 @@ discard block |
||
2061 | 2061 | |
2062 | 2062 | protected function _template_settings() { |
2063 | 2063 | $this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso'); |
2064 | - $this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />'; |
|
2065 | - $this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>'; |
|
2066 | - $this->display_admin_caf_preview_page( 'template_settings_tab' ); |
|
2064 | + $this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />'; |
|
2065 | + $this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>'; |
|
2066 | + $this->display_admin_caf_preview_page('template_settings_tab'); |
|
2067 | 2067 | } |
2068 | 2068 | |
2069 | 2069 | |
@@ -2076,22 +2076,22 @@ discard block |
||
2076 | 2076 | * @return void |
2077 | 2077 | */ |
2078 | 2078 | private function _set_category_object() { |
2079 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
2079 | + if (isset($this->_category->id) && ! empty($this->_category->id)) |
|
2080 | 2080 | return; //already have the category object so get out. |
2081 | 2081 | |
2082 | 2082 | //set default category object |
2083 | 2083 | $this->_set_empty_category_object(); |
2084 | 2084 | |
2085 | 2085 | //only set if we've got an id |
2086 | - if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) { |
|
2086 | + if ( ! isset($this->_req_data['EVT_CAT_ID'])) { |
|
2087 | 2087 | return; |
2088 | 2088 | } |
2089 | 2089 | |
2090 | 2090 | $category_id = absint($this->_req_data['EVT_CAT_ID']); |
2091 | 2091 | |
2092 | - $term = get_term( $category_id, 'espresso_event_categories' ); |
|
2092 | + $term = get_term($category_id, 'espresso_event_categories'); |
|
2093 | 2093 | |
2094 | - if ( !empty( $term ) ) { |
|
2094 | + if ( ! empty($term)) { |
|
2095 | 2095 | $this->_category->category_name = $term->name; |
2096 | 2096 | $this->_category->category_identifier = $term->slug; |
2097 | 2097 | $this->_category->category_desc = $term->description; |
@@ -2105,13 +2105,13 @@ discard block |
||
2105 | 2105 | |
2106 | 2106 | private function _set_empty_category_object() { |
2107 | 2107 | $this->_category = new stdClass(); |
2108 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
2108 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
2109 | 2109 | $this->_category->id = $this->_category->parent = 0; |
2110 | 2110 | } |
2111 | 2111 | |
2112 | 2112 | |
2113 | 2113 | protected function _category_list_table() { |
2114 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2114 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2115 | 2115 | $this->_search_btn_label = __('Categories', 'event_espresso'); |
2116 | 2116 | $this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2'); |
2117 | 2117 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -2127,14 +2127,14 @@ discard block |
||
2127 | 2127 | $this->_set_add_edit_form_tags($route); |
2128 | 2128 | |
2129 | 2129 | $this->_set_category_object(); |
2130 | - $id = !empty($this->_category->id) ? $this->_category->id : ''; |
|
2130 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
2131 | 2131 | |
2132 | 2132 | $delete_action = 'delete_category'; |
2133 | 2133 | |
2134 | 2134 | //custom redirect |
2135 | - $redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url ); |
|
2135 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
2136 | 2136 | |
2137 | - $this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect ); |
|
2137 | + $this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect); |
|
2138 | 2138 | |
2139 | 2139 | //take care of contents |
2140 | 2140 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
@@ -2148,25 +2148,25 @@ discard block |
||
2148 | 2148 | 'type' => 'wp_editor', |
2149 | 2149 | 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
2150 | 2150 | 'class' => 'my_editor_custom', |
2151 | - 'wpeditor_args' => array('media_buttons' => FALSE ) |
|
2151 | + 'wpeditor_args' => array('media_buttons' => FALSE) |
|
2152 | 2152 | ); |
2153 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
2153 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
2154 | 2154 | |
2155 | - $all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) ); |
|
2155 | + $all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id))); |
|
2156 | 2156 | |
2157 | 2157 | //setup category select for term parents. |
2158 | 2158 | $category_select_values[] = array( |
2159 | 2159 | 'text' => __('No Parent', 'event_espresso'), |
2160 | 2160 | 'id' => 0 |
2161 | 2161 | ); |
2162 | - foreach ( $all_terms as $term ) { |
|
2162 | + foreach ($all_terms as $term) { |
|
2163 | 2163 | $category_select_values[] = array( |
2164 | 2164 | 'text' => $term->name, |
2165 | 2165 | 'id' => $term->term_id |
2166 | 2166 | ); |
2167 | 2167 | } |
2168 | 2168 | |
2169 | - $category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent ); |
|
2169 | + $category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent); |
|
2170 | 2170 | |
2171 | 2171 | $template_args = array( |
2172 | 2172 | 'category' => $this->_category, |
@@ -2176,15 +2176,15 @@ discard block |
||
2176 | 2176 | 'disable' => '', |
2177 | 2177 | 'disabled_message' => FALSE |
2178 | 2178 | ); |
2179 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
2180 | - return EEH_Template::display_template($template, $template_args, TRUE ); |
|
2179 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
2180 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
2181 | 2181 | } |
2182 | 2182 | |
2183 | 2183 | |
2184 | 2184 | protected function _delete_categories() { |
2185 | - $cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
2185 | + $cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
2186 | 2186 | |
2187 | - foreach ( $cat_ids as $cat_id ) { |
|
2187 | + foreach ($cat_ids as $cat_id) { |
|
2188 | 2188 | $this->_delete_category($cat_id); |
2189 | 2189 | } |
2190 | 2190 | |
@@ -2192,7 +2192,7 @@ discard block |
||
2192 | 2192 | $query_args = array( |
2193 | 2193 | 'action' => 'category_list' |
2194 | 2194 | ); |
2195 | - $this->_redirect_after_action(0,'','',$query_args); |
|
2195 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
2196 | 2196 | |
2197 | 2197 | } |
2198 | 2198 | |
@@ -2202,61 +2202,61 @@ discard block |
||
2202 | 2202 | |
2203 | 2203 | protected function _delete_category($cat_id) { |
2204 | 2204 | global $wpdb; |
2205 | - $cat_id = absint( $cat_id ); |
|
2206 | - wp_delete_term( $cat_id, 'espresso_event_categories' ); |
|
2205 | + $cat_id = absint($cat_id); |
|
2206 | + wp_delete_term($cat_id, 'espresso_event_categories'); |
|
2207 | 2207 | } |
2208 | 2208 | |
2209 | 2209 | |
2210 | 2210 | |
2211 | 2211 | protected function _insert_or_update_category($new_category) { |
2212 | 2212 | |
2213 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE ); |
|
2213 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE); |
|
2214 | 2214 | $success = 0; //we already have a success message so lets not send another. |
2215 | 2215 | |
2216 | - if ( $cat_id ) { |
|
2216 | + if ($cat_id) { |
|
2217 | 2217 | $query_args = array( |
2218 | 2218 | 'action' => 'edit_category', |
2219 | 2219 | 'EVT_CAT_ID' => $cat_id |
2220 | 2220 | ); |
2221 | 2221 | } else { |
2222 | - $query_args = array( 'action' => 'add_category' ); |
|
2222 | + $query_args = array('action' => 'add_category'); |
|
2223 | 2223 | } |
2224 | - $this->_redirect_after_action( $success, '','', $query_args, TRUE ); |
|
2224 | + $this->_redirect_after_action($success, '', '', $query_args, TRUE); |
|
2225 | 2225 | |
2226 | 2226 | } |
2227 | 2227 | |
2228 | 2228 | |
2229 | 2229 | |
2230 | - private function _insert_category( $update = FALSE ) { |
|
2230 | + private function _insert_category($update = FALSE) { |
|
2231 | 2231 | $cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : ''; |
2232 | - $category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
2233 | - $category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
2234 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
2232 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
2233 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
2234 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
2235 | 2235 | |
2236 | - if ( empty( $category_name ) ) { |
|
2237 | - $msg = __( 'You must add a name for the category.', 'event_espresso' ); |
|
2238 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2236 | + if (empty($category_name)) { |
|
2237 | + $msg = __('You must add a name for the category.', 'event_espresso'); |
|
2238 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2239 | 2239 | return false; |
2240 | 2240 | } |
2241 | 2241 | |
2242 | - $term_args=array( |
|
2242 | + $term_args = array( |
|
2243 | 2243 | 'name'=>$category_name, |
2244 | 2244 | 'description'=>$category_desc, |
2245 | 2245 | 'parent'=>$category_parent |
2246 | 2246 | ); |
2247 | 2247 | //was the category_identifier input disabled? |
2248 | - if(isset($this->_req_data['category_identifier'])){ |
|
2248 | + if (isset($this->_req_data['category_identifier'])) { |
|
2249 | 2249 | $term_args['slug'] = $this->_req_data['category_identifier']; |
2250 | 2250 | } |
2251 | - $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args ); |
|
2251 | + $insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args); |
|
2252 | 2252 | |
2253 | - if ( !is_array( $insert_ids ) ) { |
|
2254 | - $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
2255 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2253 | + if ( ! is_array($insert_ids)) { |
|
2254 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
2255 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2256 | 2256 | } else { |
2257 | 2257 | $cat_id = $insert_ids['term_id']; |
2258 | - $msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name ); |
|
2259 | - EE_Error::add_success( $msg ); |
|
2258 | + $msg = sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name); |
|
2259 | + EE_Error::add_success($msg); |
|
2260 | 2260 | } |
2261 | 2261 | |
2262 | 2262 | return $cat_id; |
@@ -2265,32 +2265,32 @@ discard block |
||
2265 | 2265 | |
2266 | 2266 | |
2267 | 2267 | |
2268 | - public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
2268 | + public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) { |
|
2269 | 2269 | global $wpdb; |
2270 | 2270 | |
2271 | 2271 | //testing term stuff |
2272 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2273 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
2274 | - $limit = ($current_page-1)*$per_page; |
|
2272 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2273 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
2274 | + $limit = ($current_page - 1) * $per_page; |
|
2275 | 2275 | |
2276 | - $where = array( 'taxonomy' => 'espresso_event_categories' ); |
|
2276 | + $where = array('taxonomy' => 'espresso_event_categories'); |
|
2277 | 2277 | |
2278 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2279 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2278 | + if (isset($this->_req_data['s'])) { |
|
2279 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2280 | 2280 | $where['OR'] = array( |
2281 | - 'Term.name' => array( 'LIKE', $sstr), |
|
2282 | - 'description' => array( 'LIKE', $sstr ) |
|
2281 | + 'Term.name' => array('LIKE', $sstr), |
|
2282 | + 'description' => array('LIKE', $sstr) |
|
2283 | 2283 | ); |
2284 | 2284 | } |
2285 | 2285 | |
2286 | 2286 | $query_params = array( |
2287 | - $where , |
|
2288 | - 'order_by' => array( $orderby => $order ), |
|
2289 | - 'limit' => $limit . ',' . $per_page, |
|
2287 | + $where, |
|
2288 | + 'order_by' => array($orderby => $order), |
|
2289 | + 'limit' => $limit.','.$per_page, |
|
2290 | 2290 | 'force_join' => array('Term') |
2291 | 2291 | ); |
2292 | 2292 | |
2293 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
2293 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
2294 | 2294 | |
2295 | 2295 | return $categories; |
2296 | 2296 | } |
@@ -116,7 +116,7 @@ |
||
116 | 116 | * @access public |
117 | 117 | * @param EE_Template_Config $CFG |
118 | 118 | * @param array $REQ |
119 | - * @return EE_Event_Single_Config |
|
119 | + * @return EE_Template_Config |
|
120 | 120 | */ |
121 | 121 | public static function update_template_settings( $CFG, $REQ ) { |
122 | 122 | $display_order_tickets = isset( $CFG->EED_Event_Single->display_order_tickets ) ? $CFG->EED_Event_Single->display_order_tickets : 100; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Event_Single_Caff |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -50,34 +50,34 @@ discard block |
||
50 | 50 | * @return void |
51 | 51 | */ |
52 | 52 | public static function set_hooks_admin() { |
53 | - define( 'EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS ); |
|
54 | - define( 'EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
53 | + define('EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS); |
|
54 | + define('EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
55 | 55 | add_action( |
56 | 56 | 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__template_settings', |
57 | - array( 'EED_Event_Single_Caff', 'load_scripts_styles' ), |
|
57 | + array('EED_Event_Single_Caff', 'load_scripts_styles'), |
|
58 | 58 | 10 |
59 | 59 | ); |
60 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Event_Single_Caff', 'template_settings_form' ), 10 ); |
|
61 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Event_Single_Caff', 'update_template_settings' ), 10, 2 ); |
|
60 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Event_Single_Caff', 'template_settings_form'), 10); |
|
61 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Event_Single_Caff', 'update_template_settings'), 10, 2); |
|
62 | 62 | // AJAX |
63 | - add_action( 'wp_ajax_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) ); |
|
64 | - add_action( 'wp_ajax_nopriv_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) ); |
|
63 | + add_action('wp_ajax_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order')); |
|
64 | + add_action('wp_ajax_nopriv_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order')); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | |
70 | 70 | public static function load_scripts_styles() { |
71 | - add_action( 'admin_enqueue_scripts', array( 'EED_Event_Single_Caff', 'enqueue_scripts_styles' ), 10 ); |
|
71 | + add_action('admin_enqueue_scripts', array('EED_Event_Single_Caff', 'enqueue_scripts_styles'), 10); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | 75 | |
76 | 76 | public static function enqueue_scripts_styles() { |
77 | - wp_register_style( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION ); |
|
78 | - wp_enqueue_style( 'eed-event-single-sortable' ); |
|
79 | - wp_register_script( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.js', array( 'jquery-ui-sortable' ), EVENT_ESPRESSO_VERSION, true ); |
|
80 | - wp_enqueue_script( 'eed-event-single-sortable' ); |
|
77 | + wp_register_style('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION); |
|
78 | + wp_enqueue_style('eed-event-single-sortable'); |
|
79 | + wp_register_script('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true); |
|
80 | + wp_enqueue_script('eed-event-single-sortable'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -91,21 +91,21 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public static function template_settings_form() { |
93 | 93 | $config = EE_Registry::instance()->CFG->template_settings; |
94 | - $config = isset( $config->EED_Event_Single ) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config(); |
|
95 | - $config->use_sortable_display_order = isset( $config->use_sortable_display_order ) ? $config->use_sortable_display_order : false; |
|
96 | - $config = apply_filters( 'FHEE__EED_Event_Single__template_settings_form__event_list_config', $config ); |
|
94 | + $config = isset($config->EED_Event_Single) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config(); |
|
95 | + $config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false; |
|
96 | + $config = apply_filters('FHEE__EED_Event_Single__template_settings_form__event_list_config', $config); |
|
97 | 97 | |
98 | 98 | $event_single_order_array = array(); |
99 | - $event_single_order_array[ $config->display_order_tickets ] = 'tickets'; |
|
100 | - $event_single_order_array[ $config->display_order_datetimes ] = 'datetimes'; |
|
101 | - $event_single_order_array[ $config->display_order_event ] = 'event'; |
|
102 | - $event_single_order_array[ $config->display_order_venue ] = 'venue'; |
|
99 | + $event_single_order_array[$config->display_order_tickets] = 'tickets'; |
|
100 | + $event_single_order_array[$config->display_order_datetimes] = 'datetimes'; |
|
101 | + $event_single_order_array[$config->display_order_event] = 'event'; |
|
102 | + $event_single_order_array[$config->display_order_venue] = 'venue'; |
|
103 | 103 | // get template parts |
104 | - $template_parts = EED_Event_Single::instance()->initialize_template_parts( $config ); |
|
104 | + $template_parts = EED_Event_Single::instance()->initialize_template_parts($config); |
|
105 | 105 | // convert to array so that we can add more properties |
106 | - $config = get_object_vars( $config ); |
|
107 | - $config[ 'event_single_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-single-sortable-js', '', 'single-sortable-li single-sortable-js' ); |
|
108 | - EEH_Template::display_template( EVENT_SINGLE_CAFF_TEMPLATES_PATH . 'admin-event-single-settings.template.php', $config ); |
|
106 | + $config = get_object_vars($config); |
|
107 | + $config['event_single_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-single-sortable-js', '', 'single-sortable-li single-sortable-js'); |
|
108 | + EEH_Template::display_template(EVENT_SINGLE_CAFF_TEMPLATES_PATH.'admin-event-single-settings.template.php', $config); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -118,20 +118,20 @@ discard block |
||
118 | 118 | * @param array $REQ |
119 | 119 | * @return EE_Event_Single_Config |
120 | 120 | */ |
121 | - public static function update_template_settings( $CFG, $REQ ) { |
|
122 | - $display_order_tickets = isset( $CFG->EED_Event_Single->display_order_tickets ) ? $CFG->EED_Event_Single->display_order_tickets : 100; |
|
123 | - $display_order_datetimes = isset( $CFG->EED_Event_Single->display_order_datetimes ) ? $CFG->EED_Event_Single->display_order_datetimes : 110; |
|
124 | - $display_order_event = isset( $CFG->EED_Event_Single->display_order_event ) ? $CFG->EED_Event_Single->display_order_event : 120; |
|
125 | - $display_order_venue = isset( $CFG->EED_Event_Single->display_order_venue ) ? $CFG->EED_Event_Single->display_order_venue : 130; |
|
121 | + public static function update_template_settings($CFG, $REQ) { |
|
122 | + $display_order_tickets = isset($CFG->EED_Event_Single->display_order_tickets) ? $CFG->EED_Event_Single->display_order_tickets : 100; |
|
123 | + $display_order_datetimes = isset($CFG->EED_Event_Single->display_order_datetimes) ? $CFG->EED_Event_Single->display_order_datetimes : 110; |
|
124 | + $display_order_event = isset($CFG->EED_Event_Single->display_order_event) ? $CFG->EED_Event_Single->display_order_event : 120; |
|
125 | + $display_order_venue = isset($CFG->EED_Event_Single->display_order_venue) ? $CFG->EED_Event_Single->display_order_venue : 130; |
|
126 | 126 | $CFG->EED_Event_Single = new EE_Event_Single_Config(); |
127 | - $CFG->EED_Event_Single->display_status_banner_single = !empty( $REQ['display_status_banner_single'] ) && $REQ['display_status_banner_single'] ? TRUE : FALSE; |
|
128 | - $CFG->EED_Event_Single->display_venue = ! empty( $REQ['display_venue'] ) && $REQ['display_venue'] ? TRUE : FALSE; |
|
129 | - $CFG->EED_Event_Single->use_sortable_display_order = ! empty( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) ? absint( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) : 0; |
|
127 | + $CFG->EED_Event_Single->display_status_banner_single = ! empty($REQ['display_status_banner_single']) && $REQ['display_status_banner_single'] ? TRUE : FALSE; |
|
128 | + $CFG->EED_Event_Single->display_venue = ! empty($REQ['display_venue']) && $REQ['display_venue'] ? TRUE : FALSE; |
|
129 | + $CFG->EED_Event_Single->use_sortable_display_order = ! empty($REQ['EED_Events_Single_use_sortable_display_order']) ? absint($REQ['EED_Events_Single_use_sortable_display_order']) : 0; |
|
130 | 130 | $CFG->EED_Event_Single->display_order_tickets = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_tickets : 100; |
131 | 131 | $CFG->EED_Event_Single->display_order_datetimes = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_datetimes : 110; |
132 | 132 | $CFG->EED_Event_Single->display_order_event = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_event : 120; |
133 | 133 | $CFG->EED_Event_Single->display_order_venue = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_venue : 130; |
134 | - do_action( 'AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ ); |
|
134 | + do_action('AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ); |
|
135 | 135 | return $CFG; |
136 | 136 | } |
137 | 137 | |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public static function update_event_single_order() { |
147 | 147 | $config_saved = false; |
148 | - $template_parts = sanitize_text_field( $_POST[ 'elements' ] ); |
|
149 | - if ( ! empty( $template_parts ) ) { |
|
150 | - $template_parts = explode( ',', trim( $template_parts, ',' ) ); |
|
151 | - foreach ( $template_parts as $key => $template_part ) { |
|
148 | + $template_parts = sanitize_text_field($_POST['elements']); |
|
149 | + if ( ! empty($template_parts)) { |
|
150 | + $template_parts = explode(',', trim($template_parts, ',')); |
|
151 | + foreach ($template_parts as $key => $template_part) { |
|
152 | 152 | $template_part = "display_order_$template_part"; |
153 | - $priority = ( $key * 10 ) + 100; |
|
153 | + $priority = ($key * 10) + 100; |
|
154 | 154 | EE_Registry::instance()->CFG->template_settings->EED_Event_Single->{$template_part} = $priority; |
155 | - do_action( "AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority ); |
|
155 | + do_action("AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority); |
|
156 | 156 | } |
157 | - $config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false ); |
|
157 | + $config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false); |
|
158 | 158 | } |
159 | - if ( $config_saved ) { |
|
160 | - EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) ); |
|
159 | + if ($config_saved) { |
|
160 | + EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso')); |
|
161 | 161 | } else { |
162 | - EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
162 | + EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
163 | 163 | } |
164 | - echo wp_json_encode( EE_Error::get_notices( false )); |
|
164 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
165 | 165 | exit(); |
166 | 166 | } |
167 | 167 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param WP $WP |
175 | 175 | * @return void |
176 | 176 | */ |
177 | - public function run( $WP ) { |
|
177 | + public function run($WP) { |
|
178 | 178 | } |
179 | 179 | |
180 | 180 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |