@@ -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_Full_HTML_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,71 +341,71 @@ 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 = '' ) { |
|
344 | + public function get_dtt_months_and_years($where_params, $evt_active_status = '') { |
|
345 | 345 | |
346 | - switch ( $evt_active_status ) { |
|
346 | + switch ($evt_active_status) { |
|
347 | 347 | case 'upcoming' : |
348 | 348 | $where_params['Event.status'] = 'publish'; |
349 | 349 | //if there are already query_params matching DTT_EVT_start then we need to modify that to add them. |
350 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
350 | + if (isset($where_params['DTT_EVT_start'])) { |
|
351 | 351 | $where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start']; |
352 | 352 | } |
353 | - $where_params['DTT_EVT_start'] = array('>', $this->current_time_for_query( 'DTT_EVT_start' ) ); |
|
353 | + $where_params['DTT_EVT_start'] = array('>', $this->current_time_for_query('DTT_EVT_start')); |
|
354 | 354 | break; |
355 | 355 | |
356 | 356 | case 'expired' : |
357 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
357 | + if (isset($where_params['Event.status'])) unset($where_params['Event.status']); |
|
358 | 358 | //get events to exclude |
359 | - $exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $this->current_time_for_query( 'DTT_EVT_end' ) ) ) ); |
|
359 | + $exclude_query[0] = array_merge($where_params, array('DTT_EVT_end' => array('>', $this->current_time_for_query('DTT_EVT_end')))); |
|
360 | 360 | //first get all events that have datetimes where its not expired. |
361 | - $event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Datetime.EVT_ID' ); |
|
362 | - $event_ids = array_keys( $event_ids ); |
|
361 | + $event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Datetime.EVT_ID'); |
|
362 | + $event_ids = array_keys($event_ids); |
|
363 | 363 | |
364 | - if ( isset( $where_params['DTT_EVT_end'] ) ) { |
|
364 | + if (isset($where_params['DTT_EVT_end'])) { |
|
365 | 365 | $where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
366 | 366 | } |
367 | - $where_params['DTT_EVT_end'] = array( '<', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ); |
|
368 | - $where_params['Event.EVT_ID'] = array( 'NOT IN', $event_ids ); |
|
367 | + $where_params['DTT_EVT_end'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')); |
|
368 | + $where_params['Event.EVT_ID'] = array('NOT IN', $event_ids); |
|
369 | 369 | break; |
370 | 370 | |
371 | 371 | case 'active' : |
372 | 372 | $where_params['Event.status'] = 'publish'; |
373 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
373 | + if (isset($where_params['DTT_EVT_start'])) { |
|
374 | 374 | $where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start']; |
375 | 375 | } |
376 | - if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) { |
|
376 | + if (isset($where_params['Datetime.DTT_EVT_end'])) { |
|
377 | 377 | $where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end']; |
378 | 378 | } |
379 | - $where_params['DTT_EVT_start'] = array('<', $this->current_time_for_query( 'DTT_EVT_start' ) ); |
|
380 | - $where_params['DTT_EVT_end'] = array('>', $this->current_time_for_query( 'DTT_EVT_end' ) ); |
|
379 | + $where_params['DTT_EVT_start'] = array('<', $this->current_time_for_query('DTT_EVT_start')); |
|
380 | + $where_params['DTT_EVT_end'] = array('>', $this->current_time_for_query('DTT_EVT_end')); |
|
381 | 381 | break; |
382 | 382 | |
383 | 383 | case 'inactive' : |
384 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
385 | - if ( isset( $where_params['OR'] ) ) { |
|
384 | + if (isset($where_params['Event.status'])) unset($where_params['Event.status']); |
|
385 | + if (isset($where_params['OR'])) { |
|
386 | 386 | $where_params['AND']['OR'] = $where_params['OR']; |
387 | 387 | } |
388 | - if ( isset( $where_params['DTT_EVT_end'] ) ) { |
|
388 | + if (isset($where_params['DTT_EVT_end'])) { |
|
389 | 389 | $where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
390 | - unset( $where_params['DTT_EVT_end'] ); |
|
390 | + unset($where_params['DTT_EVT_end']); |
|
391 | 391 | } |
392 | 392 | |
393 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
393 | + if (isset($where_params['DTT_EVT_start'])) { |
|
394 | 394 | $where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start']; |
395 | - unset( $where_params['DTT_EVT_start'] ); |
|
395 | + unset($where_params['DTT_EVT_start']); |
|
396 | 396 | } |
397 | - $where_params['AND']['Event.status'] = array( '!=', 'publish' ); |
|
397 | + $where_params['AND']['Event.status'] = array('!=', 'publish'); |
|
398 | 398 | break; |
399 | 399 | } |
400 | 400 | |
401 | 401 | $query_params[0] = $where_params; |
402 | 402 | $query_params['group_by'] = array('dtt_year', 'dtt_month'); |
403 | - $query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' ); |
|
403 | + $query_params['order_by'] = array('DTT_EVT_start' => 'DESC'); |
|
404 | 404 | $columns_to_select = array( |
405 | 405 | 'dtt_year' => array('YEAR(DTT_EVT_start)', '%s'), |
406 | 406 | 'dtt_month' => array('MONTHNAME(DTT_EVT_start)', '%s') |
407 | 407 | ); |
408 | - return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select ); |
|
408 | + return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | /** |
@@ -413,8 +413,8 @@ discard block |
||
413 | 413 | * for the tickets for each datetime) |
414 | 414 | * @param EE_Datetime[] $datetimes |
415 | 415 | */ |
416 | - public function update_sold($datetimes){ |
|
417 | - foreach($datetimes as $datetime){ |
|
416 | + public function update_sold($datetimes) { |
|
417 | + foreach ($datetimes as $datetime) { |
|
418 | 418 | $datetime->update_sold(); |
419 | 419 | } |
420 | 420 | } |
@@ -429,10 +429,10 @@ discard block |
||
429 | 429 | * @param array $query_params |
430 | 430 | * @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. |
431 | 431 | */ |
432 | - public function sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params = array() ) { |
|
433 | - $datetime = $this->get_one_by_ID( $DTT_ID ); |
|
434 | - if ( $datetime instanceof EE_Datetime ) { |
|
435 | - return $datetime->tickets_remaining( $query_params ); |
|
432 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) { |
|
433 | + $datetime = $this->get_one_by_ID($DTT_ID); |
|
434 | + if ($datetime instanceof EE_Datetime) { |
|
435 | + return $datetime->tickets_remaining($query_params); |
|
436 | 436 | } |
437 | 437 | return 0; |
438 | 438 | } |
@@ -454,36 +454,36 @@ discard block |
||
454 | 454 | * EE_Datetime::upcoming |
455 | 455 | * EE_Datetime::expired |
456 | 456 | */ |
457 | - public function get_datetime_counts_by_status( $stati_to_include = array(), $query_params = array() ) { |
|
457 | + public function get_datetime_counts_by_status($stati_to_include = array(), $query_params = array()) { |
|
458 | 458 | //only accept where conditions for this query. |
459 | - $_where = isset( $query_params[0] ) ? $query_params[0] : array(); |
|
459 | + $_where = isset($query_params[0]) ? $query_params[0] : array(); |
|
460 | 460 | $status_query_args = array( |
461 | 461 | EE_Datetime::active => array_merge( |
462 | 462 | $_where, |
463 | - array( 'DTT_EVT_start' => array( '<', time() ), 'DTT_EVT_end' => array( '>', time() ) ) |
|
463 | + array('DTT_EVT_start' => array('<', time()), 'DTT_EVT_end' => array('>', time())) |
|
464 | 464 | ), |
465 | 465 | EE_Datetime::upcoming => array_merge( |
466 | 466 | $_where, |
467 | - array( 'DTT_EVT_start' => array( '>', time() ) ) |
|
467 | + array('DTT_EVT_start' => array('>', time())) |
|
468 | 468 | ), |
469 | 469 | EE_Datetime::expired => array_merge( |
470 | 470 | $_where, |
471 | - array( 'DTT_EVT_end' => array('<', time() ) ) |
|
471 | + array('DTT_EVT_end' => array('<', time())) |
|
472 | 472 | ) |
473 | 473 | ); |
474 | 474 | |
475 | - if ( ! empty( $stati_to_include ) ) { |
|
476 | - foreach( array_keys( $status_query_args ) as $status ) { |
|
477 | - if ( ! in_array( $status, $stati_to_include ) ) { |
|
478 | - unset( $status_query_args[$status] ); |
|
475 | + if ( ! empty($stati_to_include)) { |
|
476 | + foreach (array_keys($status_query_args) as $status) { |
|
477 | + if ( ! in_array($status, $stati_to_include)) { |
|
478 | + unset($status_query_args[$status]); |
|
479 | 479 | } |
480 | 480 | } |
481 | 481 | } |
482 | 482 | |
483 | 483 | //loop through and query counts for each stati. |
484 | 484 | $status_query_results = array(); |
485 | - foreach( $status_query_args as $status => $status_where_conditions ) { |
|
486 | - $status_query_results[ $status ] = EEM_Datetime::count( array( $status_where_conditions ), 'DTT_ID', true ); |
|
485 | + foreach ($status_query_args as $status => $status_where_conditions) { |
|
486 | + $status_query_results[$status] = EEM_Datetime::count(array($status_where_conditions), 'DTT_ID', true); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | return $status_query_results; |
@@ -497,9 +497,9 @@ discard block |
||
497 | 497 | * @param array $query_params |
498 | 498 | * @return int |
499 | 499 | */ |
500 | - public function get_datetime_count_for_status( $status = EE_Datetime::active, $query_params = array() ) { |
|
501 | - $count = $this->get_datetime_counts_by_status( array( $status ), $query_params ); |
|
502 | - return ! empty( $count[$status] ) ? $count[$status] : 0; |
|
500 | + public function get_datetime_count_for_status($status = EE_Datetime::active, $query_params = array()) { |
|
501 | + $count = $this->get_datetime_counts_by_status(array($status), $query_params); |
|
502 | + return ! empty($count[$status]) ? $count[$status] : 0; |
|
503 | 503 | } |
504 | 504 | |
505 | 505 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | global $post_type, $post; |
3 | 3 | //action for registering metaboxes |
4 | -do_action( 'add_meta_boxes', $post_type, $post ); |
|
4 | +do_action('add_meta_boxes', $post_type, $post); |
|
5 | 5 | ?> |
6 | 6 | <div id="admin-page-header"> |
7 | 7 | <?php echo $admin_page_header; ?> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | <!-- admin-page-header --> |
11 | 11 | <div id="post-body" class="metabox-holder columns-2"> |
12 | 12 | |
13 | - <?php if ( ! empty( $post_body_content )) : ?> |
|
13 | + <?php if ( ! empty($post_body_content)) : ?> |
|
14 | 14 | <div id="post-body-content"> |
15 | 15 | <?php echo $post_body_content; ?> |
16 | 16 | </div> |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | <?php endif; ?> |
19 | 19 | |
20 | 20 | <div id="postbox-container-1" class="postbox-container"> |
21 | - <?php do_meta_boxes( $current_page, 'side', NULL ); ?> |
|
21 | + <?php do_meta_boxes($current_page, 'side', NULL); ?> |
|
22 | 22 | </div> |
23 | 23 | <!-- postbox-container-1 --> |
24 | 24 | |
25 | 25 | <div id="postbox-container-2" class="postbox-container"> |
26 | - <?php do_meta_boxes( $current_page, 'normal', NULL ); ?> |
|
27 | - <?php do_meta_boxes( $current_page, 'advanced', NULL ); ?> |
|
26 | + <?php do_meta_boxes($current_page, 'normal', NULL); ?> |
|
27 | + <?php do_meta_boxes($current_page, 'advanced', NULL); ?> |
|
28 | 28 | </div> |
29 | 29 | <!-- postbox-container-2 --> |
30 | 30 |
@@ -69,104 +69,104 @@ discard block |
||
69 | 69 | * @param array $options |
70 | 70 | * @return mixed |
71 | 71 | */ |
72 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
|
72 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) { |
|
73 | 73 | |
74 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
75 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
74 | + EE_Registry::instance()->load_helper('Template'); |
|
75 | + EE_Registry::instance()->load_helper('HTML'); |
|
76 | 76 | |
77 | 77 | $html = ''; |
78 | 78 | // set some default options and merge with incoming |
79 | 79 | $default_options = array( |
80 | - 'show_desc' => true, // true false |
|
80 | + 'show_desc' => true, // true false |
|
81 | 81 | 'odd' => false |
82 | 82 | ); |
83 | - $options = array_merge( $default_options, (array)$options ); |
|
83 | + $options = array_merge($default_options, (array) $options); |
|
84 | 84 | |
85 | - switch( $line_item->type() ) { |
|
85 | + switch ($line_item->type()) { |
|
86 | 86 | |
87 | 87 | case EEM_Line_Item::type_line_item: |
88 | 88 | $this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes; |
89 | - if ( $line_item->OBJ_type() == 'Ticket' ) { |
|
89 | + if ($line_item->OBJ_type() == 'Ticket') { |
|
90 | 90 | // item row |
91 | - $html .= $this->_ticket_row( $line_item, $options ); |
|
91 | + $html .= $this->_ticket_row($line_item, $options); |
|
92 | 92 | // got any kids? |
93 | - foreach ( $line_item->children() as $child_line_item ) { |
|
94 | - $this->display_line_item( $child_line_item, $options ); |
|
93 | + foreach ($line_item->children() as $child_line_item) { |
|
94 | + $this->display_line_item($child_line_item, $options); |
|
95 | 95 | } |
96 | 96 | } else { |
97 | 97 | // item row |
98 | - $html .= $this->_item_row( $line_item, $options ); |
|
98 | + $html .= $this->_item_row($line_item, $options); |
|
99 | 99 | // got any kids? |
100 | - foreach ( $line_item->children() as $child_line_item ) { |
|
101 | - $this->display_line_item( $child_line_item, $options ); |
|
100 | + foreach ($line_item->children() as $child_line_item) { |
|
101 | + $this->display_line_item($child_line_item, $options); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | break; |
105 | 105 | |
106 | 106 | case EEM_Line_Item::type_sub_line_item: |
107 | - $html .= $this->_sub_item_row( $line_item, $options ); |
|
107 | + $html .= $this->_sub_item_row($line_item, $options); |
|
108 | 108 | break; |
109 | 109 | |
110 | 110 | case EEM_Line_Item::type_sub_total: |
111 | 111 | static $sub_total = 0; |
112 | 112 | $event_sub_total = 0; |
113 | - $text = __( 'Sub-Total', 'event_espresso' ); |
|
114 | - if ( $line_item->OBJ_type() == 'Event' ) { |
|
115 | - $options[ 'event_id' ] = $event_id = $line_item->OBJ_ID(); |
|
116 | - if ( ! isset( $this->_events[ $options[ 'event_id' ] ] ) ) { |
|
117 | - $event = EEM_Event::instance()->get_one_by_ID( $options[ 'event_id' ] ); |
|
118 | - if ( $event instanceof EE_Event ) { |
|
119 | - if ( $event->default_registration_status() == EEM_Registration::status_id_not_approved ) { |
|
113 | + $text = __('Sub-Total', 'event_espresso'); |
|
114 | + if ($line_item->OBJ_type() == 'Event') { |
|
115 | + $options['event_id'] = $event_id = $line_item->OBJ_ID(); |
|
116 | + if ( ! isset($this->_events[$options['event_id']])) { |
|
117 | + $event = EEM_Event::instance()->get_one_by_ID($options['event_id']); |
|
118 | + if ($event instanceof EE_Event) { |
|
119 | + if ($event->default_registration_status() == EEM_Registration::status_id_not_approved) { |
|
120 | 120 | return ''; |
121 | 121 | } |
122 | 122 | } |
123 | - $this->_events[ $options[ 'event_id' ] ] = 0; |
|
124 | - $html .= $this->_event_row( $line_item ); |
|
125 | - $text = __( 'Event Sub-Total', 'event_espresso' ); |
|
123 | + $this->_events[$options['event_id']] = 0; |
|
124 | + $html .= $this->_event_row($line_item); |
|
125 | + $text = __('Event Sub-Total', 'event_espresso'); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | $child_line_items = $line_item->children(); |
129 | 129 | // loop thru children |
130 | - foreach( $child_line_items as $child_line_item ) { |
|
130 | + foreach ($child_line_items as $child_line_item) { |
|
131 | 131 | // recursively feed children back into this method |
132 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
132 | + $html .= $this->display_line_item($child_line_item, $options); |
|
133 | 133 | } |
134 | - $event_sub_total += isset( $options[ 'event_id' ] ) ? $this->_events[ $options[ 'event_id' ] ] : 0; |
|
134 | + $event_sub_total += isset($options['event_id']) ? $this->_events[$options['event_id']] : 0; |
|
135 | 135 | $sub_total += $event_sub_total; |
136 | 136 | if ( |
137 | 137 | ( |
138 | 138 | // event subtotals |
139 | 139 | $line_item->code() != 'pre-tax-subtotal' && |
140 | - count( $child_line_items ) > 1 |
|
140 | + count($child_line_items) > 1 |
|
141 | 141 | ) |
142 | 142 | || |
143 | 143 | ( |
144 | 144 | // pre-tax subtotals |
145 | 145 | $line_item->code() == 'pre-tax-subtotal' && |
146 | - count( $this->_events ) > 1 |
|
146 | + count($this->_events) > 1 |
|
147 | 147 | ) |
148 | 148 | ) { |
149 | 149 | $options['sub_total'] = $line_item->OBJ_type() == 'Event' ? $event_sub_total : $sub_total; |
150 | - $html .= $this->_sub_total_row( $line_item, $text, $options ); |
|
150 | + $html .= $this->_sub_total_row($line_item, $text, $options); |
|
151 | 151 | } |
152 | 152 | break; |
153 | 153 | |
154 | 154 | case EEM_Line_Item::type_tax: |
155 | - if ( $this->_show_taxes ) { |
|
156 | - $this->_taxes_html .= $this->_tax_row( $line_item, $options ); |
|
155 | + if ($this->_show_taxes) { |
|
156 | + $this->_taxes_html .= $this->_tax_row($line_item, $options); |
|
157 | 157 | } |
158 | 158 | break; |
159 | 159 | |
160 | 160 | case EEM_Line_Item::type_tax_sub_total: |
161 | - if ( $this->_show_taxes ) { |
|
161 | + if ($this->_show_taxes) { |
|
162 | 162 | $child_line_items = $line_item->children(); |
163 | 163 | // loop thru children |
164 | - foreach( $child_line_items as $child_line_item ) { |
|
164 | + foreach ($child_line_items as $child_line_item) { |
|
165 | 165 | // recursively feed children back into this method |
166 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
166 | + $html .= $this->display_line_item($child_line_item, $options); |
|
167 | 167 | } |
168 | - if ( count( $child_line_items ) > 1 ) { |
|
169 | - $this->_taxes_html .= $this->_total_tax_row( $line_item, __( 'Tax Total', 'event_espresso' ) ); |
|
168 | + if (count($child_line_items) > 1) { |
|
169 | + $this->_taxes_html .= $this->_total_tax_row($line_item, __('Tax Total', 'event_espresso')); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | break; |
@@ -175,25 +175,25 @@ discard block |
||
175 | 175 | // get all child line items |
176 | 176 | $children = $line_item->children(); |
177 | 177 | // loop thru all non-tax child line items |
178 | - foreach( $children as $child_line_item ) { |
|
179 | - if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) { |
|
178 | + foreach ($children as $child_line_item) { |
|
179 | + if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) { |
|
180 | 180 | // recursively feed children back into this method |
181 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
181 | + $html .= $this->display_line_item($child_line_item, $options); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | 185 | // now loop thru tax child line items |
186 | - foreach( $children as $child_line_item ) { |
|
187 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) { |
|
186 | + foreach ($children as $child_line_item) { |
|
187 | + if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) { |
|
188 | 188 | // recursively feed children back into this method |
189 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
189 | + $html .= $this->display_line_item($child_line_item, $options); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | $html .= $this->_taxes_html; |
193 | - $html .= $this->_total_row( $line_item, __('Total', 'event_espresso') ); |
|
193 | + $html .= $this->_total_row($line_item, __('Total', 'event_espresso')); |
|
194 | 194 | |
195 | 195 | |
196 | - $html .= $this->_payments_and_amount_owing_rows( $line_item, $options ); |
|
196 | + $html .= $this->_payments_and_amount_owing_rows($line_item, $options); |
|
197 | 197 | break; |
198 | 198 | |
199 | 199 | } |
@@ -208,11 +208,11 @@ discard block |
||
208 | 208 | * @param EE_Line_Item $line_item |
209 | 209 | * @return mixed |
210 | 210 | */ |
211 | - private function _event_row( EE_Line_Item $line_item ) { |
|
211 | + private function _event_row(EE_Line_Item $line_item) { |
|
212 | 212 | // start of row |
213 | - $html = EEH_HTML::tr( '', 'event-cart-total-row', 'total_tr odd' ); |
|
213 | + $html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd'); |
|
214 | 214 | // event name td |
215 | - $html .= EEH_HTML::td( EEH_HTML::strong( $line_item->name() ), '', 'event-header', '', ' colspan="4"' ); |
|
215 | + $html .= EEH_HTML::td(EEH_HTML::strong($line_item->name()), '', 'event-header', '', ' colspan="4"'); |
|
216 | 216 | // end of row |
217 | 217 | $html .= EEH_HTML::trx(); |
218 | 218 | return $html; |
@@ -227,10 +227,10 @@ discard block |
||
227 | 227 | * @param array $options |
228 | 228 | * @return mixed |
229 | 229 | */ |
230 | - private function _ticket_row( EE_Line_Item $line_item, $options = array() ) { |
|
230 | + private function _ticket_row(EE_Line_Item $line_item, $options = array()) { |
|
231 | 231 | // start of row |
232 | 232 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
233 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
233 | + $html = EEH_HTML::tr('', '', $row_class); |
|
234 | 234 | // name && desc |
235 | 235 | $name_and_desc = apply_filters( |
236 | 236 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name', |
@@ -239,23 +239,23 @@ discard block |
||
239 | 239 | ); |
240 | 240 | $name_and_desc .= apply_filters( |
241 | 241 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc', |
242 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
242 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
243 | 243 | $line_item, |
244 | 244 | $options |
245 | 245 | ); |
246 | 246 | $name_and_desc .= $line_item->is_taxable() ? ' * ' : ''; |
247 | 247 | // name td |
248 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' ); |
|
248 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' ); |
|
249 | 249 | // price td |
250 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
250 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
251 | 251 | // quantity td |
252 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
252 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
253 | 253 | $this->_total_items += $line_item->quantity(); |
254 | 254 | // determine total for line item |
255 | 255 | $total = $line_item->total(); |
256 | - $this->_events[ $options[ 'event_id' ] ] += $total; |
|
256 | + $this->_events[$options['event_id']] += $total; |
|
257 | 257 | // total td |
258 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '', 'item_r jst-rght' ); |
|
258 | + $html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght'); |
|
259 | 259 | // end of row |
260 | 260 | $html .= EEH_HTML::trx(); |
261 | 261 | return $html; |
@@ -270,41 +270,41 @@ discard block |
||
270 | 270 | * @param array $options |
271 | 271 | * @return mixed |
272 | 272 | */ |
273 | - private function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
273 | + private function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
274 | 274 | // start of row |
275 | 275 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
276 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
277 | - $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type() . ': ' : ''; |
|
276 | + $html = EEH_HTML::tr('', '', $row_class); |
|
277 | + $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type().': ' : ''; |
|
278 | 278 | // name && desc |
279 | 279 | $name_and_desc = apply_filters( |
280 | 280 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name', |
281 | - $obj_name . $line_item->name(), |
|
281 | + $obj_name.$line_item->name(), |
|
282 | 282 | $line_item |
283 | 283 | ); |
284 | 284 | $name_and_desc .= apply_filters( |
285 | 285 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc', |
286 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
286 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
287 | 287 | $line_item, |
288 | 288 | $options |
289 | 289 | ); |
290 | 290 | $name_and_desc .= $line_item->is_taxable() ? ' * ' : ''; |
291 | 291 | // name td |
292 | - $html .= EEH_HTML::td( $name_and_desc, '', 'item_l' ); |
|
292 | + $html .= EEH_HTML::td($name_and_desc, '', 'item_l'); |
|
293 | 293 | // price td |
294 | - if ( $line_item->is_percent() ) { |
|
295 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c jst-rght' ); |
|
294 | + if ($line_item->is_percent()) { |
|
295 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c jst-rght'); |
|
296 | 296 | } else { |
297 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
297 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
298 | 298 | } |
299 | 299 | // quantity td |
300 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
300 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
301 | 301 | //$total = $line_item->total() * $line_item->quantity(); |
302 | 302 | $total = $line_item->total(); |
303 | - if( isset( $options[ 'event_id' ] ) && isset( $this->_events[ $options[ 'event_id' ] ] ) ) { |
|
304 | - $this->_events[ $options[ 'event_id' ] ] += $total; |
|
303 | + if (isset($options['event_id']) && isset($this->_events[$options['event_id']])) { |
|
304 | + $this->_events[$options['event_id']] += $total; |
|
305 | 305 | } |
306 | 306 | // total td |
307 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '', 'item_r jst-rght' ); |
|
307 | + $html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght'); |
|
308 | 308 | // end of row |
309 | 309 | $html .= EEH_HTML::trx(); |
310 | 310 | return $html; |
@@ -319,22 +319,22 @@ discard block |
||
319 | 319 | * @param array $options |
320 | 320 | * @return mixed |
321 | 321 | */ |
322 | - private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
|
322 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array()) { |
|
323 | 323 | // start of row |
324 | - $html = EEH_HTML::tr( '', 'item sub-item-row' ); |
|
324 | + $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
325 | 325 | // name && desc |
326 | 326 | $name_and_desc = $line_item->name(); |
327 | - $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
327 | + $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''; |
|
328 | 328 | // name td |
329 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
329 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
330 | 330 | // discount/surcharge td |
331 | - if ( $line_item->is_percent() ) { |
|
332 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c' ); |
|
331 | + if ($line_item->is_percent()) { |
|
332 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c'); |
|
333 | 333 | } else { |
334 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
334 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
335 | 335 | } |
336 | 336 | // total td |
337 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'item_r jst-rght' ); |
|
337 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
338 | 338 | // end of row |
339 | 339 | $html .= EEH_HTML::trx(); |
340 | 340 | return $html; |
@@ -349,21 +349,21 @@ discard block |
||
349 | 349 | * @param array $options |
350 | 350 | * @return mixed |
351 | 351 | */ |
352 | - private function _tax_row( EE_Line_Item $line_item, $options = array() ) { |
|
352 | + private function _tax_row(EE_Line_Item $line_item, $options = array()) { |
|
353 | 353 | // start of row |
354 | - $html = EEH_HTML::tr( '', 'item sub-item tax-total' ); |
|
354 | + $html = EEH_HTML::tr('', 'item sub-item tax-total'); |
|
355 | 355 | // name && desc |
356 | 356 | $name_and_desc = $line_item->name(); |
357 | - $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' . __( ' * taxable items', 'event_espresso' ) . '</span>'; |
|
358 | - $name_and_desc .= $options[ 'show_desc' ] ? '<br/>' . $line_item->desc() : ''; |
|
357 | + $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'.__(' * taxable items', 'event_espresso').'</span>'; |
|
358 | + $name_and_desc .= $options['show_desc'] ? '<br/>'.$line_item->desc() : ''; |
|
359 | 359 | // name td |
360 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
360 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
361 | 361 | // percent td |
362 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', ' jst-rght', '' ); |
|
362 | + $html .= EEH_HTML::td($line_item->percent().'%', '', ' jst-rght', ''); |
|
363 | 363 | // empty td (price) |
364 | - $html .= EEH_HTML::td( EEH_HTML::nbsp() ); |
|
364 | + $html .= EEH_HTML::td(EEH_HTML::nbsp()); |
|
365 | 365 | // total td |
366 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'item_r jst-rght' ); |
|
366 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
367 | 367 | // end of row |
368 | 368 | $html .= EEH_HTML::trx(); |
369 | 369 | return $html; |
@@ -378,17 +378,17 @@ discard block |
||
378 | 378 | * @param string $text |
379 | 379 | * @return mixed |
380 | 380 | */ |
381 | - private function _total_tax_row( EE_Line_Item $line_item, $text = '' ) { |
|
381 | + private function _total_tax_row(EE_Line_Item $line_item, $text = '') { |
|
382 | 382 | $html = ''; |
383 | - if ( $line_item->total() ) { |
|
383 | + if ($line_item->total()) { |
|
384 | 384 | // start of row |
385 | - $html = EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
385 | + $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
386 | 386 | // total td |
387 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="2"' ); |
|
387 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="2"'); |
|
388 | 388 | // empty td (price) |
389 | - $html .= EEH_HTML::td( EEH_HTML::nbsp() ); |
|
389 | + $html .= EEH_HTML::td(EEH_HTML::nbsp()); |
|
390 | 390 | // total td |
391 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' ); |
|
391 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght'); |
|
392 | 392 | // end of row |
393 | 393 | $html .= EEH_HTML::trx(); |
394 | 394 | } |
@@ -405,15 +405,15 @@ discard block |
||
405 | 405 | * @param array $options |
406 | 406 | * @return mixed |
407 | 407 | */ |
408 | - private function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) { |
|
408 | + private function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) { |
|
409 | 409 | $html = ''; |
410 | - if ( $line_item->total() ) { |
|
410 | + if ($line_item->total()) { |
|
411 | 411 | // start of row |
412 | - $html = EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
412 | + $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
413 | 413 | // total td |
414 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' ); |
|
414 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"'); |
|
415 | 415 | // total td |
416 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $options[ 'sub_total' ], false, false ), '', 'total jst-rght' ); |
|
416 | + $html .= EEH_HTML::td(EEH_Template::format_currency($options['sub_total'], false, false), '', 'total jst-rght'); |
|
417 | 417 | // end of row |
418 | 418 | $html .= EEH_HTML::trx(); |
419 | 419 | } |
@@ -430,13 +430,13 @@ discard block |
||
430 | 430 | * @param string $text |
431 | 431 | * @return mixed |
432 | 432 | */ |
433 | - private function _total_row( EE_Line_Item $line_item, $text = '' ) { |
|
433 | + private function _total_row(EE_Line_Item $line_item, $text = '') { |
|
434 | 434 | // start of row |
435 | - $html = EEH_HTML::tr( '', '', 'spco-grand-total total_tr odd' ); |
|
435 | + $html = EEH_HTML::tr('', '', 'spco-grand-total total_tr odd'); |
|
436 | 436 | // total td |
437 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' ); |
|
437 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"'); |
|
438 | 438 | // total td |
439 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' ); |
|
439 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght'); |
|
440 | 440 | // end of row |
441 | 441 | $html .= EEH_HTML::trx(); |
442 | 442 | return $html; |
@@ -451,30 +451,30 @@ discard block |
||
451 | 451 | * @param array $options |
452 | 452 | * @return mixed |
453 | 453 | */ |
454 | - private function _payments_and_amount_owing_rows( EE_Line_Item $line_item, $options = array() ) { |
|
454 | + private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array()) { |
|
455 | 455 | $html = ''; |
456 | 456 | $owing = $line_item->total(); |
457 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $line_item->TXN_ID() ); |
|
458 | - if ( $transaction instanceof EE_Transaction ) { |
|
457 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID()); |
|
458 | + if ($transaction instanceof EE_Transaction) { |
|
459 | 459 | $registration_payments = array(); |
460 | - $registrations = ! empty( $options['registrations'] ) |
|
461 | - ? $options[ 'registrations' ] |
|
460 | + $registrations = ! empty($options['registrations']) |
|
461 | + ? $options['registrations'] |
|
462 | 462 | : $transaction->registrations(); |
463 | - foreach ( $registrations as $registration ) { |
|
464 | - if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) { |
|
463 | + foreach ($registrations as $registration) { |
|
464 | + if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) { |
|
465 | 465 | $registration_payments = $registration_payments + $registration->registration_payments(); |
466 | 466 | } |
467 | 467 | } |
468 | - if ( ! empty( $registration_payments )) { |
|
469 | - foreach ( $registration_payments as $registration_payment ) { |
|
470 | - if ( $registration_payment instanceof EE_Registration_Payment ) { |
|
468 | + if ( ! empty($registration_payments)) { |
|
469 | + foreach ($registration_payments as $registration_payment) { |
|
470 | + if ($registration_payment instanceof EE_Registration_Payment) { |
|
471 | 471 | $owing = $owing - $registration_payment->amount(); |
472 | 472 | $payment = $registration_payment->payment(); |
473 | - if ( $payment instanceof EE_Payment ) { |
|
473 | + if ($payment instanceof EE_Payment) { |
|
474 | 474 | $payment_desc = sprintf( |
475 | - __( 'Payment%1$s Received: %2$s', 'event_espresso' ), |
|
475 | + __('Payment%1$s Received: %2$s', 'event_espresso'), |
|
476 | 476 | $payment->txn_id_chq_nmbr() != '' |
477 | - ? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> ' |
|
477 | + ? ' <span class="small-text">(#'.$payment->txn_id_chq_nmbr().')</span> ' |
|
478 | 478 | : '', |
479 | 479 | $payment->timestamp() |
480 | 480 | ); |
@@ -482,12 +482,12 @@ discard block |
||
482 | 482 | $payment_desc = ''; |
483 | 483 | } |
484 | 484 | // start of row |
485 | - $html .= EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
485 | + $html .= EEH_HTML::tr('', '', 'total_tr odd'); |
|
486 | 486 | // payment desc |
487 | - $html .= EEH_HTML::td( $payment_desc, '', '', '', ' colspan="3"' ); |
|
487 | + $html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"'); |
|
488 | 488 | // total td |
489 | 489 | $html .= EEH_HTML::td( |
490 | - EEH_Template::format_currency( $registration_payment->amount(), false, false ), |
|
490 | + EEH_Template::format_currency($registration_payment->amount(), false, false), |
|
491 | 491 | '', |
492 | 492 | 'total jst-rght' |
493 | 493 | ); |
@@ -495,17 +495,17 @@ discard block |
||
495 | 495 | $html .= EEH_HTML::trx(); |
496 | 496 | } |
497 | 497 | } |
498 | - if ( $line_item->total() ) { |
|
498 | + if ($line_item->total()) { |
|
499 | 499 | // start of row |
500 | - $html .= EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
500 | + $html .= EEH_HTML::tr('', '', 'total_tr odd'); |
|
501 | 501 | // total td |
502 | 502 | $html .= EEH_HTML::td( |
503 | 503 | __('Amount Owing', 'event_espresso'), |
504 | - '', 'total_currency total jst-rght', '', ' colspan="3"' |
|
504 | + '', 'total_currency total jst-rght', '', ' colspan="3"' |
|
505 | 505 | ); |
506 | 506 | // total td |
507 | 507 | $html .= EEH_HTML::td( |
508 | - EEH_Template::format_currency( $owing, false, false ), '', 'total jst-rght' |
|
508 | + EEH_Template::format_currency($owing, false, false), '', 'total jst-rght' |
|
509 | 509 | ); |
510 | 510 | // end of row |
511 | 511 | $html .= EEH_HTML::trx(); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /** |
68 | 68 | * @param EE_Line_Item $line_item |
69 | 69 | * @param array $options |
70 | - * @return mixed |
|
70 | + * @return string |
|
71 | 71 | */ |
72 | 72 | public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
73 | 73 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * _event_row - basically a Heading row displayed once above each event's ticket rows |
204 | 204 | * |
205 | 205 | * @param EE_Line_Item $line_item |
206 | - * @return mixed |
|
206 | + * @return string |
|
207 | 207 | */ |
208 | 208 | private function _event_row( EE_Line_Item $line_item ) { |
209 | 209 | // start of row |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @param EE_Line_Item $line_item |
224 | 224 | * @param array $options |
225 | - * @return mixed |
|
225 | + * @return string |
|
226 | 226 | */ |
227 | 227 | private function _ticket_row( EE_Line_Item $line_item, $options = array() ) { |
228 | 228 | // start of row |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @param EE_Line_Item $line_item |
267 | 267 | * @param array $options |
268 | - * @return mixed |
|
268 | + * @return string |
|
269 | 269 | */ |
270 | 270 | private function _item_row( EE_Line_Item $line_item, $options = array() ) { |
271 | 271 | // start of row |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * |
315 | 315 | * @param EE_Line_Item $line_item |
316 | 316 | * @param array $options |
317 | - * @return mixed |
|
317 | + * @return string |
|
318 | 318 | */ |
319 | 319 | private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
320 | 320 | // start of row |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | * |
345 | 345 | * @param EE_Line_Item $line_item |
346 | 346 | * @param array $options |
347 | - * @return mixed |
|
347 | + * @return string |
|
348 | 348 | */ |
349 | 349 | private function _tax_row( EE_Line_Item $line_item, $options = array() ) { |
350 | 350 | // start of row |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | * |
374 | 374 | * @param EE_Line_Item $line_item |
375 | 375 | * @param string $text |
376 | - * @return mixed |
|
376 | + * @return string |
|
377 | 377 | */ |
378 | 378 | private function _total_tax_row( EE_Line_Item $line_item, $text = '' ) { |
379 | 379 | $html = ''; |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | * @param EE_Line_Item $line_item |
401 | 401 | * @param string $text |
402 | 402 | * @param array $options |
403 | - * @return mixed |
|
403 | + * @return string |
|
404 | 404 | */ |
405 | 405 | private function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) { |
406 | 406 | $html = ''; |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | * |
426 | 426 | * @param EE_Line_Item $line_item |
427 | 427 | * @param string $text |
428 | - * @return mixed |
|
428 | + * @return string |
|
429 | 429 | */ |
430 | 430 | private function _total_row( EE_Line_Item $line_item, $text = '' ) { |
431 | 431 | // start of row |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | * |
447 | 447 | * @param EE_Line_Item $line_item |
448 | 448 | * @param array $options |
449 | - * @return mixed |
|
449 | + * @return string |
|
450 | 450 | */ |
451 | 451 | private function _payments_and_amount_owing_rows( EE_Line_Item $line_item, $options = array() ) { |
452 | 452 | $html = ''; |
@@ -26,16 +26,16 @@ discard block |
||
26 | 26 | * |
27 | 27 | * ------------------------------------------------------------------------ |
28 | 28 | */ |
29 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
29 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
30 | 30 | |
31 | 31 | class EEM_Extra_Meta extends EEM_Base { |
32 | 32 | |
33 | 33 | // private instance of the Attendee object |
34 | 34 | protected static $_instance = NULL; |
35 | 35 | |
36 | - protected function __construct( $timezone = NULL ) { |
|
37 | - $this->singular_item = __('Extra Meta','event_espresso'); |
|
38 | - $this->plural_item = __('Extra Metas','event_espresso'); |
|
36 | + protected function __construct($timezone = NULL) { |
|
37 | + $this->singular_item = __('Extra Meta', 'event_espresso'); |
|
38 | + $this->plural_item = __('Extra Metas', 'event_espresso'); |
|
39 | 39 | $this->_tables = array( |
40 | 40 | 'Extra_Meta'=> new EE_Primary_Table('esp_extra_meta', 'EXM_ID') |
41 | 41 | ); |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | |
51 | 51 | )); |
52 | 52 | $this->_model_relations = array(); |
53 | - foreach($models_this_can_attach_to as $model){ |
|
53 | + foreach ($models_this_can_attach_to as $model) { |
|
54 | 54 | $this->_model_relations[$model] = new EE_Belongs_To_Any_Relation(); |
55 | 55 | } |
56 | - foreach( $this->cap_contexts_to_cap_action_map() as $cap_context => $action ) { |
|
57 | - $this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( 'EXM_key', 'EXM_value' ); |
|
56 | + foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) { |
|
57 | + $this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta('EXM_key', 'EXM_value'); |
|
58 | 58 | } |
59 | - parent::__construct( $timezone ); |
|
59 | + parent::__construct($timezone); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 |
@@ -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 | * |
@@ -31,20 +31,20 @@ discard block |
||
31 | 31 | * |
32 | 32 | * ------------------------------------------------------------------------ |
33 | 33 | */ |
34 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
34 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
35 | 35 | |
36 | 36 | class EEM_Post_Meta extends EEM_Base { |
37 | 37 | |
38 | 38 | // private instance of the EE_Post_Meta object |
39 | 39 | protected static $_instance = NULL; |
40 | 40 | |
41 | - protected function __construct( $timezone = NULL ) { |
|
42 | - $this->singular_item = __('Post Meta','event_espresso'); |
|
43 | - $this->plural_item = __('Post Metas','event_espresso'); |
|
41 | + protected function __construct($timezone = NULL) { |
|
42 | + $this->singular_item = __('Post Meta', 'event_espresso'); |
|
43 | + $this->plural_item = __('Post Metas', 'event_espresso'); |
|
44 | 44 | $this->_tables = array( |
45 | 45 | 'Post_Meta'=> new EE_Primary_Table('postmeta', 'meta_id') |
46 | 46 | ); |
47 | - $models_this_can_attach_to = array_keys( EE_Registry::instance()->cpt_models() ); |
|
47 | + $models_this_can_attach_to = array_keys(EE_Registry::instance()->cpt_models()); |
|
48 | 48 | $this->_fields = array( |
49 | 49 | 'Post_Meta'=>array( |
50 | 50 | 'meta_id'=>new EE_Primary_Key_Int_Field('meta_id', __("Meta ID", "event_espresso")), |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | 'meta_value'=>new EE_Maybe_Serialized_Text_Field('meta_value', __("Meta Value", "event_espresso"), true) |
54 | 54 | )); |
55 | 55 | $this->_model_relations = array(); |
56 | - foreach($models_this_can_attach_to as $model){ |
|
56 | + foreach ($models_this_can_attach_to as $model) { |
|
57 | 57 | $this->_model_relations[$model] = new EE_Belongs_To_Relation(); |
58 | 58 | } |
59 | - foreach( $this->cap_contexts_to_cap_action_map() as $cap_context => $action ) { |
|
60 | - $this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( 'meta_key', 'meta_value' ); |
|
59 | + foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) { |
|
60 | + $this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta('meta_key', 'meta_value'); |
|
61 | 61 | } |
62 | - parent::__construct( $timezone ); |
|
62 | + parent::__construct($timezone); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 |
@@ -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,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 | /** |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @author Mike Nelson |
15 | 15 | * |
16 | 16 | */ |
17 | -class EE_Restriction_Generator_Meta extends EE_Restriction_Generator_Base{ |
|
17 | +class EE_Restriction_Generator_Meta extends EE_Restriction_Generator_Base { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param string $key_field_name |
34 | 34 | * @param string $value_field_name |
35 | 35 | */ |
36 | - public function __construct( $key_field_name, $value_field_name ) { |
|
36 | + public function __construct($key_field_name, $value_field_name) { |
|
37 | 37 | $this->_key_field_name = $key_field_name; |
38 | 38 | $this->_value_field_name = $value_field_name; |
39 | 39 | } |
@@ -45,21 +45,21 @@ discard block |
||
45 | 45 | * @throws EE_Error |
46 | 46 | */ |
47 | 47 | protected function _generate_restrictions() { |
48 | - $whitelisted_meta_keys = apply_filters( 'FHEE__EE_Restriction_Generator_Meta___generate_restrictions__whitelisted_meta_keys', array() ); |
|
49 | - $blacklisted_meta_keys = apply_filters( 'FHEE__EE_Restriction_Generator_Meta___generate_restrictions__blacklisted_meta_keys', array() ); |
|
48 | + $whitelisted_meta_keys = apply_filters('FHEE__EE_Restriction_Generator_Meta___generate_restrictions__whitelisted_meta_keys', array()); |
|
49 | + $blacklisted_meta_keys = apply_filters('FHEE__EE_Restriction_Generator_Meta___generate_restrictions__blacklisted_meta_keys', array()); |
|
50 | 50 | $conditions = array( |
51 | - $this->_key_field_name => array( 'NOT_LIKE', "\\\\_%" ),//each slash is escaped because we are using double quotes, and |
|
51 | + $this->_key_field_name => array('NOT_LIKE', "\\\\_%"), //each slash is escaped because we are using double quotes, and |
|
52 | 52 | //stripslashes will be called on this because the models assume this is from user input |
53 | - $this->_value_field_name => array( 'NOT_REGEXP', '^[aOs]:[\d]:.*$') |
|
53 | + $this->_value_field_name => array('NOT_REGEXP', '^[aOs]:[\d]:.*$') |
|
54 | 54 | ); |
55 | - if( ! empty( $blacklisted_meta_keys ) ) { |
|
56 | - $conditions[ $this->_key_field_name . '*blacklisted' ] = array( 'NOT_IN', $blacklisted_meta_keys ); |
|
55 | + if ( ! empty($blacklisted_meta_keys)) { |
|
56 | + $conditions[$this->_key_field_name.'*blacklisted'] = array('NOT_IN', $blacklisted_meta_keys); |
|
57 | 57 | } |
58 | - if( ! empty( $whitelisted_meta_keys ) ) { |
|
58 | + if ( ! empty($whitelisted_meta_keys)) { |
|
59 | 59 | $conditions = array( |
60 | 60 | 'OR*whitelisted-or-normal' => array( |
61 | 61 | 'AND' => $conditions, |
62 | - $this->_key_field_name . '*whitelisted' => array( 'IN', $whitelisted_meta_keys ) |
|
62 | + $this->_key_field_name.'*whitelisted' => array('IN', $whitelisted_meta_keys) |
|
63 | 63 | ) |
64 | 64 | ); |
65 | 65 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | //only allow access to non-protected metas if they're an admin |
68 | 68 | EE_Restriction_Generator_Base::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions(), |
69 | 69 | //don't allow access to protected metas to anyone. If they want that, don't apply caps to the query |
70 | - 'apply-to-all-queries-using-caps' => new EE_Default_Where_Conditions( $conditions ), |
|
70 | + 'apply-to-all-queries-using-caps' => new EE_Default_Where_Conditions($conditions), |
|
71 | 71 | ); |
72 | 72 | } |
73 | 73 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | <?php _e('Adjust the settings for the PayPal Standard payment gateway.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | 5 | <p> |
6 | -<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Paypal Standard.', 'event_espresso' ), "<a href='https://www.paypal.com/multicurrency' target='_blank'>","</a>" ); ?> |
|
6 | +<?php printf(__('See %1$shere%2$s for list of currencies supported by Paypal Standard.', 'event_espresso'), "<a href='https://www.paypal.com/multicurrency' target='_blank'>", "</a>"); ?> |
|
7 | 7 | </p> |
8 | 8 | <h3><?php _e('PayPal Standard Settings', 'event_espresso'); ?></h3> |
9 | 9 | <ul> |
@@ -21,18 +21,18 @@ discard block |
||
21 | 21 | </li> |
22 | 22 | <li> |
23 | 23 | <strong><?php _e('PayPal Calculates Taxes', 'event_espresso'); ?></strong><br /> |
24 | -<?php printf( __('If set to "Yes", we will indicate to PayPal that it should calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>' ); ?><br/> |
|
25 | -<?php _e( 'Note: It may confuse users if Event Espresso initially calculates taxes on the order, and then they go to PayPal and it calculates taxes differently. So it is recommended that if PayPal is calculating taxes, that you do not set any taxes in Event Espresso.', 'event_espresso' );?> |
|
24 | +<?php printf(__('If set to "Yes", we will indicate to PayPal that it should calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>'); ?><br/> |
|
25 | +<?php _e('Note: It may confuse users if Event Espresso initially calculates taxes on the order, and then they go to PayPal and it calculates taxes differently. So it is recommended that if PayPal is calculating taxes, that you do not set any taxes in Event Espresso.', 'event_espresso'); ?> |
|
26 | 26 | </li> |
27 | 27 | <li> |
28 | 28 | <strong><?php _e('PayPal Calculates Shipping', 'event_espresso'); ?></strong><br /> |
29 | 29 | <?php _e('Similar to the "PayPal Calculates Taxes" setting, if this is set to "Yes", we will indicate to PayPal that it should calculate the shipping on each payment (if there are multiple payments for a single transaction, PayPal is permitted to add shipping charges to each payment.)', 'event_espresso'); ?><br/> |
30 | -<?php _e( 'Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso' );?> |
|
30 | +<?php _e('Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso'); ?> |
|
31 | 31 | <li> |
32 | -<strong><?php _e( 'Notes Regarding Paypal Taxes and Shipping', 'event_espresso' );?></strong><br/> |
|
33 | -<?php _e( 'If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso' );?><br/> |
|
34 | -<?php _e( 'However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso' );?><br/> |
|
35 | -<?php _e( 'Also Note: In order for PayPal to properly calculate taxes and shipping, they need to receive the entire order at the same time. So if a user goes to make a payment using PayPal, and their order somehow already has a payment on it, PayPal CANNOT calculate taxes or shipping on that order.', 'event_espresso' );?> |
|
32 | +<strong><?php _e('Notes Regarding Paypal Taxes and Shipping', 'event_espresso'); ?></strong><br/> |
|
33 | +<?php _e('If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso'); ?><br/> |
|
34 | +<?php _e('However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso'); ?><br/> |
|
35 | +<?php _e('Also Note: In order for PayPal to properly calculate taxes and shipping, they need to receive the entire order at the same time. So if a user goes to make a payment using PayPal, and their order somehow already has a payment on it, PayPal CANNOT calculate taxes or shipping on that order.', 'event_espresso'); ?> |
|
36 | 36 | </li> |
37 | 37 | <li> |
38 | 38 | <strong><?php _e('Shipping Address Options', 'event_espresso'); ?></strong><br /> |
@@ -129,7 +129,7 @@ |
||
129 | 129 | * |
130 | 130 | * @param string $route |
131 | 131 | * @param string $regex |
132 | - * @param array $match_keys EXCLUDING matching the entire regex |
|
132 | + * @param string[] $match_keys EXCLUDING matching the entire regex |
|
133 | 133 | * @return array where $match_keys are the keys (the first value of $match_keys |
134 | 134 | * becomes the first key of the return value, etc. Eg passing in $match_keys of |
135 | 135 | * array( 'model', 'id' ), will, if the regex is successful, will return |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\libraries\rest_api\controllers; |
3 | 3 | |
4 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | protected $_requested_version; |
37 | 37 | |
38 | 38 | public function __construct() { |
39 | - $this->_debug_mode = defined( 'EE_REST_API_DEBUG_MODE' ) ? EE_REST_API_DEBUG_MODE : false; |
|
39 | + $this->_debug_mode = defined('EE_REST_API_DEBUG_MODE') ? EE_REST_API_DEBUG_MODE : false; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * Sets the version the user requested |
45 | 45 | * @param string $version eg '4.8' |
46 | 46 | */ |
47 | - public function set_requested_version( $version ) { |
|
47 | + public function set_requested_version($version) { |
|
48 | 48 | $this->_requested_version = $version; |
49 | 49 | } |
50 | 50 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * @param string $key |
54 | 54 | * @param string|array $info |
55 | 55 | */ |
56 | - protected function _set_debug_info( $key, $info ){ |
|
57 | - $this->_debug_info[ $key ] = $info; |
|
56 | + protected function _set_debug_info($key, $info) { |
|
57 | + $this->_debug_info[$key] = $info; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -69,52 +69,52 @@ discard block |
||
69 | 69 | * @param array|\WP_Error|\Exception $response |
70 | 70 | * @return \WP_REST_Response |
71 | 71 | */ |
72 | - public function send_response( $response ) { |
|
73 | - if( $response instanceof \Exception ) { |
|
74 | - $response = new \WP_Error( $response->getCode(), $response->getMessage() ); |
|
72 | + public function send_response($response) { |
|
73 | + if ($response instanceof \Exception) { |
|
74 | + $response = new \WP_Error($response->getCode(), $response->getMessage()); |
|
75 | 75 | } |
76 | - if( $response instanceof \WP_Error ) { |
|
76 | + if ($response instanceof \WP_Error) { |
|
77 | 77 | //we want to send a "normal"-looking WP error response, but we also |
78 | 78 | //want to add headers. It doesn't seem WP API 1.2 supports this. |
79 | 79 | //I'd like to use WP_JSON_Server::error_to_response() but its protected |
80 | 80 | //so here's most of it copy-and-pasted :P |
81 | 81 | $error_data = $response->get_error_data(); |
82 | - if ( is_array( $error_data ) && isset( $error_data['status'] ) ) { |
|
82 | + if (is_array($error_data) && isset($error_data['status'])) { |
|
83 | 83 | $status = $error_data['status']; |
84 | 84 | } else { |
85 | 85 | $status = 500; |
86 | 86 | } |
87 | 87 | |
88 | 88 | $errors = array(); |
89 | - foreach ( (array) $response->errors as $code => $messages ) { |
|
90 | - foreach ( (array) $messages as $message ) { |
|
89 | + foreach ((array) $response->errors as $code => $messages) { |
|
90 | + foreach ((array) $messages as $message) { |
|
91 | 91 | $errors[] = array( |
92 | 92 | 'code' => $code, |
93 | 93 | 'message' => $message, |
94 | - 'data' => $response->get_error_data( $code ) |
|
94 | + 'data' => $response->get_error_data($code) |
|
95 | 95 | ); |
96 | 96 | } |
97 | 97 | } |
98 | - $data = isset( $errors[0] ) ? $errors[0] : array(); |
|
99 | - if ( count( $errors ) > 1 ) { |
|
98 | + $data = isset($errors[0]) ? $errors[0] : array(); |
|
99 | + if (count($errors) > 1) { |
|
100 | 100 | // Remove the primary error. |
101 | - array_shift( $errors ); |
|
101 | + array_shift($errors); |
|
102 | 102 | $data['additional_errors'] = $errors; |
103 | 103 | } |
104 | - $rest_response = new \WP_REST_Response( $data, $status ); |
|
105 | - }else{ |
|
106 | - $rest_response = new \WP_REST_Response( $response, 200 ); |
|
104 | + $rest_response = new \WP_REST_Response($data, $status); |
|
105 | + } else { |
|
106 | + $rest_response = new \WP_REST_Response($response, 200); |
|
107 | 107 | } |
108 | 108 | $headers = array(); |
109 | - if( $this->_debug_mode && is_array( $this->_debug_info ) ) { |
|
110 | - foreach( $this->_debug_info as $debug_key => $debug_info ) { |
|
111 | - if( is_array( $debug_info ) ) { |
|
112 | - $debug_info = json_encode( $debug_info ); |
|
109 | + if ($this->_debug_mode && is_array($this->_debug_info)) { |
|
110 | + foreach ($this->_debug_info as $debug_key => $debug_info) { |
|
111 | + if (is_array($debug_info)) { |
|
112 | + $debug_info = json_encode($debug_info); |
|
113 | 113 | } |
114 | - $headers[ 'X-EE4-Debug-' . ucwords( $debug_key ) ] = $debug_info; |
|
114 | + $headers['X-EE4-Debug-'.ucwords($debug_key)] = $debug_info; |
|
115 | 115 | } |
116 | 116 | } |
117 | - $rest_response->set_headers( $headers ); |
|
117 | + $rest_response->set_headers($headers); |
|
118 | 118 | return $rest_response; |
119 | 119 | } |
120 | 120 | |
@@ -136,23 +136,23 @@ discard block |
||
136 | 136 | * array( 'model' => 'foo', 'id' => 'bar' ) |
137 | 137 | * @throws \EE_Error if it couldn't be parsed |
138 | 138 | */ |
139 | - public function parse_route( $route, $regex, $match_keys ) { |
|
139 | + public function parse_route($route, $regex, $match_keys) { |
|
140 | 140 | $indexed_matches = array(); |
141 | - $success = preg_match( $regex, $route, $matches ); |
|
142 | - if( |
|
143 | - is_array( $matches ) ) { |
|
141 | + $success = preg_match($regex, $route, $matches); |
|
142 | + if ( |
|
143 | + is_array($matches) ) { |
|
144 | 144 | //skip the overall regex match. Who cares |
145 | - for( $i = 1; $i <= count( $match_keys ); $i++ ) { |
|
146 | - if( ! isset( $matches[ $i ] ) ) { |
|
145 | + for ($i = 1; $i <= count($match_keys); $i++) { |
|
146 | + if ( ! isset($matches[$i])) { |
|
147 | 147 | $success = false; |
148 | 148 | } else { |
149 | - $indexed_matches[ $match_keys[ $i - 1 ] ] = $matches[ $i ]; |
|
149 | + $indexed_matches[$match_keys[$i - 1]] = $matches[$i]; |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | } |
153 | - if( ! $success ) { |
|
153 | + if ( ! $success) { |
|
154 | 154 | throw new \EE_Error( |
155 | - __( 'We could not parse the URL. Please contact Event Espresso Support', 'event_espresso' ), |
|
155 | + __('We could not parse the URL. Please contact Event Espresso Support', 'event_espresso'), |
|
156 | 156 | 'endpoint_parsing_error' |
157 | 157 | ); |
158 | 158 | } |
@@ -102,7 +102,7 @@ |
||
102 | 102 | $data['additional_errors'] = $errors; |
103 | 103 | } |
104 | 104 | $rest_response = new \WP_REST_Response( $data, $status ); |
105 | - }else{ |
|
105 | + } else{ |
|
106 | 106 | $rest_response = new \WP_REST_Response( $response, 200 ); |
107 | 107 | } |
108 | 108 | $headers = array(); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\libraries\rest_api; |
3 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
4 | - exit( 'No direct script access allowed' ); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | /** |
@@ -21,16 +21,16 @@ discard block |
||
21 | 21 | * @param string $model_context one of the return values from EEM_Base::valid_cap_contexts() |
22 | 22 | * @return boolean |
23 | 23 | */ |
24 | - public static function current_user_has_partial_access_to( $model, $model_context = \EEM_Base::caps_read ) { |
|
25 | - if( apply_filters( 'FHEE__Capabilities__current_user_has_partial_access_to__override_begin', false, $model, $model ) ) { |
|
24 | + public static function current_user_has_partial_access_to($model, $model_context = \EEM_Base::caps_read) { |
|
25 | + if (apply_filters('FHEE__Capabilities__current_user_has_partial_access_to__override_begin', false, $model, $model)) { |
|
26 | 26 | return true; |
27 | 27 | } |
28 | - foreach( $model->caps_missing( $model_context ) as $capability_name => $restriction_obj ) { |
|
29 | - if( $restriction_obj instanceof \EE_Return_None_Where_Conditions ){ |
|
28 | + foreach ($model->caps_missing($model_context) as $capability_name => $restriction_obj) { |
|
29 | + if ($restriction_obj instanceof \EE_Return_None_Where_Conditions) { |
|
30 | 30 | return false; |
31 | 31 | } |
32 | 32 | } |
33 | - if( apply_filters( 'FHEE__Capabilities__current_user_has_partial_access_to__override_end', false, $model, $model ) ) { |
|
33 | + if (apply_filters('FHEE__Capabilities__current_user_has_partial_access_to__override_end', false, $model, $model)) { |
|
34 | 34 | return false; |
35 | 35 | } |
36 | 36 | return true; |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | * @param string $request_type one of the constants on WP_JSON_Server |
44 | 44 | * @return array |
45 | 45 | */ |
46 | - public static function get_missing_permissions( $model, $request_type = \EEM_Base::caps_read ) { |
|
47 | - return $model->caps_missing( $request_type ); |
|
46 | + public static function get_missing_permissions($model, $request_type = \EEM_Base::caps_read) { |
|
47 | + return $model->caps_missing($request_type); |
|
48 | 48 | } |
49 | 49 | /** |
50 | 50 | * Gets a string of all the capabilities the current user is missing that affected |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * @param string $model_context one of the return values from EEM_Base::valid_cap_contexts() |
55 | 55 | * @return string |
56 | 56 | */ |
57 | - public static function get_missing_permissions_string( $model, $model_context = \EEM_Base::caps_read ) { |
|
58 | - return implode(',', array_keys( self::get_missing_permissions( $model, $model_context ) ) ); |
|
57 | + public static function get_missing_permissions_string($model, $model_context = \EEM_Base::caps_read) { |
|
58 | + return implode(',', array_keys(self::get_missing_permissions($model, $model_context))); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -66,25 +66,25 @@ discard block |
||
66 | 66 | * @param Model_Version_Info $model_version_info |
67 | 67 | * @return array ready for converting into json |
68 | 68 | */ |
69 | - public static function filter_out_inaccessible_entity_fields( $entity, $model, $request_type, $model_version_info ) { |
|
69 | + public static function filter_out_inaccessible_entity_fields($entity, $model, $request_type, $model_version_info) { |
|
70 | 70 | //we only care to do this for frontend reads and when the user can't edit the item |
71 | - if( $request_type !== \EEM_Base::caps_read || |
|
72 | - $model->exists( array( |
|
73 | - array( $model->primary_key_name() => $entity[ $model->primary_key_name() ] ), |
|
71 | + if ($request_type !== \EEM_Base::caps_read || |
|
72 | + $model->exists(array( |
|
73 | + array($model->primary_key_name() => $entity[$model->primary_key_name()]), |
|
74 | 74 | 'default_where_conditions' => 'none', |
75 | - 'caps' => \EEM_Base::caps_edit ) ) ) { |
|
75 | + 'caps' => \EEM_Base::caps_edit ))) { |
|
76 | 76 | return $entity; |
77 | 77 | } |
78 | - foreach( $model->field_settings() as $field_name => $field_obj ){ |
|
79 | - if( $model_version_info->field_has_rendered_format( $field_obj ) |
|
80 | - && isset( $entity[ $field_name ][ 'raw' ] ) |
|
78 | + foreach ($model->field_settings() as $field_name => $field_obj) { |
|
79 | + if ($model_version_info->field_has_rendered_format($field_obj) |
|
80 | + && isset($entity[$field_name]['raw']) |
|
81 | 81 | ) { |
82 | - unset( $entity[ $field_name ][ 'raw' ] ); |
|
82 | + unset($entity[$field_name]['raw']); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | //theoretically we may want to filter out specific fields for specific models |
86 | 86 | |
87 | - return apply_filters( 'FHEE__Capabilities__filter_out_inaccessible_entity_fields', $entity, $model, $request_type ); |
|
87 | + return apply_filters('FHEE__Capabilities__filter_out_inaccessible_entity_fields', $entity, $model, $request_type); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 |