@@ -204,7 +204,7 @@ |
||
204 | 204 | * |
205 | 205 | * @access private |
206 | 206 | * @param string $sort |
207 | - * @return array |
|
207 | + * @return string |
|
208 | 208 | */ |
209 | 209 | private static function _sort( $sort = 'ASC' ) { |
210 | 210 | $sort = EE_Registry::instance()->REQ->is_set( 'event_query_sort' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_sort' ) ) : $sort; |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public static function add_query_filters() { |
87 | 87 | //add query filters |
88 | - add_action( 'pre_get_posts', array( 'EEH_Event_Query', 'filter_query_parts' ), 10, 1 ); |
|
88 | + add_action('pre_get_posts', array('EEH_Event_Query', 'filter_query_parts'), 10, 1); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * @param \WP_Query $WP_Query |
98 | 98 | * @return bool |
99 | 99 | */ |
100 | - public static function apply_query_filters( WP_Query $WP_Query ) { |
|
101 | - return ( isset( $WP_Query->query, $WP_Query->query['post_type'] ) && $WP_Query->query['post_type'] == 'espresso_events' ) || apply_filters( 'FHEE__EEH_Event_Query__apply_query_filters', false ) ? true : false; |
|
100 | + public static function apply_query_filters(WP_Query $WP_Query) { |
|
101 | + return (isset($WP_Query->query, $WP_Query->query['post_type']) && $WP_Query->query['post_type'] == 'espresso_events') || apply_filters('FHEE__EEH_Event_Query__apply_query_filters', false) ? true : false; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -108,15 +108,15 @@ discard block |
||
108 | 108 | * @access public |
109 | 109 | * @param \WP_Query $WP_Query |
110 | 110 | */ |
111 | - public static function filter_query_parts( WP_Query $WP_Query ) { |
|
111 | + public static function filter_query_parts(WP_Query $WP_Query) { |
|
112 | 112 | //ONLY add our filters if this isn't the main wp_query, because if this is the main wp_query we already have our cpt strategies take care of adding things in. |
113 | - if ( $WP_Query instanceof WP_Query && ! $WP_Query->is_main_query() ) { |
|
113 | + if ($WP_Query instanceof WP_Query && ! $WP_Query->is_main_query()) { |
|
114 | 114 | // build event list query |
115 | - add_filter( 'posts_fields', array( 'EEH_Event_Query', 'posts_fields' ), 10, 2 ); |
|
116 | - add_filter( 'posts_join', array( 'EEH_Event_Query', 'posts_join' ), 10, 2 ); |
|
117 | - add_filter( 'posts_where', array( 'EEH_Event_Query', 'posts_where' ), 10, 2 ); |
|
118 | - add_filter( 'posts_orderby', array( 'EEH_Event_Query', 'posts_orderby' ), 10, 2 ); |
|
119 | - add_filter( 'posts_clauses_request', array( 'EEH_Event_Query', 'posts_clauses' ), 10, 2 ); |
|
115 | + add_filter('posts_fields', array('EEH_Event_Query', 'posts_fields'), 10, 2); |
|
116 | + add_filter('posts_join', array('EEH_Event_Query', 'posts_join'), 10, 2); |
|
117 | + add_filter('posts_where', array('EEH_Event_Query', 'posts_where'), 10, 2); |
|
118 | + add_filter('posts_orderby', array('EEH_Event_Query', 'posts_orderby'), 10, 2); |
|
119 | + add_filter('posts_clauses_request', array('EEH_Event_Query', 'posts_clauses'), 10, 2); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -131,13 +131,13 @@ discard block |
||
131 | 131 | * @param string $orderby |
132 | 132 | * @param string $sort |
133 | 133 | */ |
134 | - public static function set_query_params( $month = '', $category = '', $show_expired = FALSE, $orderby = 'start_date', $sort = 'ASC' ) { |
|
134 | + public static function set_query_params($month = '', $category = '', $show_expired = FALSE, $orderby = 'start_date', $sort = 'ASC') { |
|
135 | 135 | self::$_query_params = array(); |
136 | - EEH_Event_Query::$_event_query_month = EEH_Event_Query::_display_month( $month ); |
|
137 | - EEH_Event_Query::$_event_query_category = EEH_Event_Query::_event_category_slug( $category ); |
|
138 | - EEH_Event_Query::$_event_query_show_expired = EEH_Event_Query::_show_expired( $show_expired ); |
|
139 | - EEH_Event_Query::$_event_query_orderby = EEH_Event_Query::_orderby( $orderby ); |
|
140 | - EEH_Event_Query::$_event_query_sort = EEH_Event_Query::_sort( $sort ); |
|
136 | + EEH_Event_Query::$_event_query_month = EEH_Event_Query::_display_month($month); |
|
137 | + EEH_Event_Query::$_event_query_category = EEH_Event_Query::_event_category_slug($category); |
|
138 | + EEH_Event_Query::$_event_query_show_expired = EEH_Event_Query::_show_expired($show_expired); |
|
139 | + EEH_Event_Query::$_event_query_orderby = EEH_Event_Query::_orderby($orderby); |
|
140 | + EEH_Event_Query::$_event_query_sort = EEH_Event_Query::_sort($sort); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | * @param string $month |
150 | 150 | * @return string |
151 | 151 | */ |
152 | - private static function _display_month( $month = '' ) { |
|
153 | - return EE_Registry::instance()->REQ->is_set( 'event_query_month' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_month' ) ) : $month; |
|
152 | + private static function _display_month($month = '') { |
|
153 | + return EE_Registry::instance()->REQ->is_set('event_query_month') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_month')) : $month; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | * @param string $category |
163 | 163 | * @return string |
164 | 164 | */ |
165 | - private static function _event_category_slug( $category = '' ) { |
|
166 | - return EE_Registry::instance()->REQ->is_set( 'event_query_category' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_category' ) ) : $category; |
|
165 | + private static function _event_category_slug($category = '') { |
|
166 | + return EE_Registry::instance()->REQ->is_set('event_query_category') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_category')) : $category; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | * @param bool $show_expired |
176 | 176 | * @return boolean |
177 | 177 | */ |
178 | - private static function _show_expired( $show_expired = FALSE ) { |
|
178 | + private static function _show_expired($show_expired = FALSE) { |
|
179 | 179 | // override default expired option if set via filter |
180 | - $_event_query_show_expired =EE_Registry::instance()->REQ->is_set( 'event_query_show_expired' ) ? EE_Registry::instance()->REQ->get( 'event_query_show_expired' ) : $show_expired; |
|
181 | - return filter_var( $_event_query_show_expired, FILTER_VALIDATE_BOOLEAN ); |
|
180 | + $_event_query_show_expired = EE_Registry::instance()->REQ->is_set('event_query_show_expired') ? EE_Registry::instance()->REQ->get('event_query_show_expired') : $show_expired; |
|
181 | + return filter_var($_event_query_show_expired, FILTER_VALIDATE_BOOLEAN); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -190,10 +190,10 @@ discard block |
||
190 | 190 | * @param string $orderby |
191 | 191 | * @return array |
192 | 192 | */ |
193 | - private static function _orderby( $orderby = 'start_date' ) { |
|
194 | - $event_query_orderby = EE_Registry::instance()->REQ->is_set( 'event_query_orderby' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_orderby' ) ) : $orderby; |
|
195 | - $event_query_orderby = is_array( $event_query_orderby ) ? $event_query_orderby : explode( ',', $event_query_orderby ); |
|
196 | - $event_query_orderby = array_map( 'trim', $event_query_orderby ); |
|
193 | + private static function _orderby($orderby = 'start_date') { |
|
194 | + $event_query_orderby = EE_Registry::instance()->REQ->is_set('event_query_orderby') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_orderby')) : $orderby; |
|
195 | + $event_query_orderby = is_array($event_query_orderby) ? $event_query_orderby : explode(',', $event_query_orderby); |
|
196 | + $event_query_orderby = array_map('trim', $event_query_orderby); |
|
197 | 197 | return $event_query_orderby; |
198 | 198 | } |
199 | 199 | |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | * @param string $sort |
207 | 207 | * @return array |
208 | 208 | */ |
209 | - private static function _sort( $sort = 'ASC' ) { |
|
210 | - $sort = EE_Registry::instance()->REQ->is_set( 'event_query_sort' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_sort' ) ) : $sort; |
|
211 | - return in_array( $sort, array( 'ASC', 'asc', 'DESC', 'desc' )) ? strtoupper( $sort ) : 'ASC'; |
|
209 | + private static function _sort($sort = 'ASC') { |
|
210 | + $sort = EE_Registry::instance()->REQ->is_set('event_query_sort') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_sort')) : $sort; |
|
211 | + return in_array($sort, array('ASC', 'asc', 'DESC', 'desc')) ? strtoupper($sort) : 'ASC'; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
@@ -221,10 +221,10 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return array array of clauses |
223 | 223 | */ |
224 | - public static function posts_clauses( $clauses, WP_Query $wp_query ) { |
|
225 | - if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) { |
|
224 | + public static function posts_clauses($clauses, WP_Query $wp_query) { |
|
225 | + if (EEH_Event_Query::apply_query_filters($wp_query)) { |
|
226 | 226 | global $wpdb; |
227 | - $clauses['groupby'] = $wpdb->posts . '.ID '; |
|
227 | + $clauses['groupby'] = $wpdb->posts.'.ID '; |
|
228 | 228 | } |
229 | 229 | return $clauses; |
230 | 230 | } |
@@ -239,10 +239,10 @@ discard block |
||
239 | 239 | * @param WP_Query $wp_query |
240 | 240 | * @return string |
241 | 241 | */ |
242 | - public static function posts_fields( $SQL, WP_Query $wp_query ) { |
|
243 | - if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) { |
|
242 | + public static function posts_fields($SQL, WP_Query $wp_query) { |
|
243 | + if (EEH_Event_Query::apply_query_filters($wp_query)) { |
|
244 | 244 | // adds something like ", wp_esp_datetime.* " to WP Query SELECT statement |
245 | - $SQL .= EEH_Event_Query::posts_fields_sql_for_orderby( EEH_Event_Query::$_event_query_orderby ); |
|
245 | + $SQL .= EEH_Event_Query::posts_fields_sql_for_orderby(EEH_Event_Query::$_event_query_orderby); |
|
246 | 246 | } |
247 | 247 | return $SQL; |
248 | 248 | } |
@@ -257,29 +257,29 @@ discard block |
||
257 | 257 | * @internal param bool|string $mixed $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet |
258 | 258 | * @return string |
259 | 259 | */ |
260 | - public static function posts_fields_sql_for_orderby( $orderby_params = array() ) { |
|
261 | - $SQL = ', MIN( ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start ) as event_start_date ' ; |
|
262 | - foreach( (array)$orderby_params as $orderby ) { |
|
263 | - switch ( $orderby ) { |
|
260 | + public static function posts_fields_sql_for_orderby($orderby_params = array()) { |
|
261 | + $SQL = ', MIN( '.EEM_Datetime::instance()->table().'.DTT_EVT_start ) as event_start_date '; |
|
262 | + foreach ((array) $orderby_params as $orderby) { |
|
263 | + switch ($orderby) { |
|
264 | 264 | |
265 | 265 | case 'ticket_start' : |
266 | - $SQL .= ', ' . EEM_Ticket::instance()->table() . '.TKT_start_date' ; |
|
266 | + $SQL .= ', '.EEM_Ticket::instance()->table().'.TKT_start_date'; |
|
267 | 267 | break; |
268 | 268 | |
269 | 269 | case 'ticket_end' : |
270 | - $SQL .= ', ' . EEM_Ticket::instance()->table() . '.TKT_end_date' ; |
|
270 | + $SQL .= ', '.EEM_Ticket::instance()->table().'.TKT_end_date'; |
|
271 | 271 | break; |
272 | 272 | |
273 | 273 | case 'venue_title' : |
274 | - $SQL .= ', Venue.post_title AS venue_title' ; |
|
274 | + $SQL .= ', Venue.post_title AS venue_title'; |
|
275 | 275 | break; |
276 | 276 | |
277 | 277 | case 'city' : |
278 | - $SQL .= ', ' . EEM_Venue::instance()->second_table() . '.VNU_city' ; |
|
278 | + $SQL .= ', '.EEM_Venue::instance()->second_table().'.VNU_city'; |
|
279 | 279 | break; |
280 | 280 | |
281 | 281 | case 'state' : |
282 | - $SQL .= ', ' . EEM_State::instance()->table() . '.STA_name' ; |
|
282 | + $SQL .= ', '.EEM_State::instance()->table().'.STA_name'; |
|
283 | 283 | break; |
284 | 284 | |
285 | 285 | } |
@@ -297,12 +297,12 @@ discard block |
||
297 | 297 | * @param WP_Query $wp_query |
298 | 298 | * @return string |
299 | 299 | */ |
300 | - public static function posts_join( $SQL = '', WP_Query $wp_query ) { |
|
301 | - if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) { |
|
300 | + public static function posts_join($SQL = '', WP_Query $wp_query) { |
|
301 | + if (EEH_Event_Query::apply_query_filters($wp_query)) { |
|
302 | 302 | // Category |
303 | - $SQL = EEH_Event_Query::posts_join_sql_for_show_expired( $SQL, EEH_Event_Query::$_event_query_show_expired ); |
|
304 | - $SQL = EEH_Event_Query::posts_join_sql_for_terms( $SQL, EEH_Event_Query::$_event_query_category ); |
|
305 | - $SQL = EEH_Event_Query::posts_join_for_orderby( $SQL, EEH_Event_Query::$_event_query_orderby ); |
|
303 | + $SQL = EEH_Event_Query::posts_join_sql_for_show_expired($SQL, EEH_Event_Query::$_event_query_show_expired); |
|
304 | + $SQL = EEH_Event_Query::posts_join_sql_for_terms($SQL, EEH_Event_Query::$_event_query_category); |
|
305 | + $SQL = EEH_Event_Query::posts_join_for_orderby($SQL, EEH_Event_Query::$_event_query_orderby); |
|
306 | 306 | } |
307 | 307 | return $SQL; |
308 | 308 | } |
@@ -317,11 +317,11 @@ discard block |
||
317 | 317 | * @param boolean $show_expired if TRUE, then displayed past events |
318 | 318 | * @return string |
319 | 319 | */ |
320 | - public static function posts_join_sql_for_show_expired( $SQL = '', $show_expired = FALSE ) { |
|
321 | - if ( ! $show_expired ) { |
|
322 | - $join = EEM_Event::instance()->table() . '.ID = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name(); |
|
323 | - if ( strpos( $SQL, $join ) === FALSE ) { |
|
324 | - $SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . $join . ' ) '; |
|
320 | + public static function posts_join_sql_for_show_expired($SQL = '', $show_expired = FALSE) { |
|
321 | + if ( ! $show_expired) { |
|
322 | + $join = EEM_Event::instance()->table().'.ID = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name(); |
|
323 | + if (strpos($SQL, $join) === FALSE) { |
|
324 | + $SQL .= ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.$join.' ) '; |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | return $SQL; |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | * @param string $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet |
338 | 338 | * @return string |
339 | 339 | */ |
340 | - public static function posts_join_sql_for_terms( $SQL = '', $join_terms = '' ) { |
|
341 | - if ( ! empty( $join_terms ) ) { |
|
340 | + public static function posts_join_sql_for_terms($SQL = '', $join_terms = '') { |
|
341 | + if ( ! empty($join_terms)) { |
|
342 | 342 | global $wpdb; |
343 | 343 | $SQL .= " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)"; |
344 | 344 | $SQL .= " LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)"; |
@@ -358,25 +358,25 @@ discard block |
||
358 | 358 | * @param array $orderby_params |
359 | 359 | * @return string |
360 | 360 | */ |
361 | - public static function posts_join_for_orderby( $SQL = '', $orderby_params = array() ) { |
|
362 | - foreach ( (array)$orderby_params as $orderby ) { |
|
363 | - switch ( $orderby ) { |
|
361 | + public static function posts_join_for_orderby($SQL = '', $orderby_params = array()) { |
|
362 | + foreach ((array) $orderby_params as $orderby) { |
|
363 | + switch ($orderby) { |
|
364 | 364 | case 'ticket_start' : |
365 | 365 | case 'ticket_end' : |
366 | - $SQL .= EEH_Event_Query::_posts_join_for_datetime( $SQL, EEM_Datetime_Ticket::instance()->table() . '.' . EEM_Datetime::instance()->primary_key_name() ); |
|
367 | - $SQL .= ' LEFT JOIN ' . EEM_Ticket::instance()->table() . ' ON (' . EEM_Datetime_Ticket::instance()->table() . '.' . EEM_Ticket::instance()->primary_key_name() . ' = ' . EEM_Ticket::instance()->table() . '.' . EEM_Ticket::instance()->primary_key_name() . ' )'; |
|
366 | + $SQL .= EEH_Event_Query::_posts_join_for_datetime($SQL, EEM_Datetime_Ticket::instance()->table().'.'.EEM_Datetime::instance()->primary_key_name()); |
|
367 | + $SQL .= ' LEFT JOIN '.EEM_Ticket::instance()->table().' ON ('.EEM_Datetime_Ticket::instance()->table().'.'.EEM_Ticket::instance()->primary_key_name().' = '.EEM_Ticket::instance()->table().'.'.EEM_Ticket::instance()->primary_key_name().' )'; |
|
368 | 368 | break; |
369 | 369 | case 'venue_title' : |
370 | 370 | case 'city' : |
371 | - $SQL .= EEH_Event_Query::_posts_join_for_event_venue( $SQL ); |
|
371 | + $SQL .= EEH_Event_Query::_posts_join_for_event_venue($SQL); |
|
372 | 372 | break; |
373 | 373 | case 'state' : |
374 | - $SQL .= EEH_Event_Query::_posts_join_for_event_venue( $SQL ); |
|
375 | - $SQL .= EEH_Event_Query::_posts_join_for_venue_state( $SQL ); |
|
374 | + $SQL .= EEH_Event_Query::_posts_join_for_event_venue($SQL); |
|
375 | + $SQL .= EEH_Event_Query::_posts_join_for_venue_state($SQL); |
|
376 | 376 | break; |
377 | 377 | case 'start_date' : |
378 | 378 | default : |
379 | - $SQL .= EEH_Event_Query::_posts_join_for_datetime( $SQL, EEM_Event::instance()->table() . '.ID' ); |
|
379 | + $SQL .= EEH_Event_Query::_posts_join_for_datetime($SQL, EEM_Event::instance()->table().'.ID'); |
|
380 | 380 | break; |
381 | 381 | |
382 | 382 | } |
@@ -394,11 +394,11 @@ discard block |
||
394 | 394 | * @param string $join |
395 | 395 | * @return string |
396 | 396 | */ |
397 | - protected static function _posts_join_for_datetime( $SQL = '', $join = '' ) { |
|
398 | - if ( ! empty( $join )) { |
|
399 | - $join .= ' = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name(); |
|
400 | - if ( strpos( $SQL, $join ) === FALSE ) { |
|
401 | - return ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . $join . ' )'; |
|
397 | + protected static function _posts_join_for_datetime($SQL = '', $join = '') { |
|
398 | + if ( ! empty($join)) { |
|
399 | + $join .= ' = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name(); |
|
400 | + if (strpos($SQL, $join) === FALSE) { |
|
401 | + return ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.$join.' )'; |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | return ''; |
@@ -413,13 +413,13 @@ discard block |
||
413 | 413 | * @param string $SQL |
414 | 414 | * @return string |
415 | 415 | */ |
416 | - protected static function _posts_join_for_event_venue( $SQL = '' ) { |
|
416 | + protected static function _posts_join_for_event_venue($SQL = '') { |
|
417 | 417 | // Event Venue table name |
418 | 418 | $event_venue_table = EEM_Event_Venue::instance()->table(); |
419 | 419 | // generate conditions for: Event <=> Event Venue JOIN clause |
420 | - $event_to_event_venue_join = EEM_Event::instance()->table() . '.ID = ' . $event_venue_table . '.' . EEM_Event::instance()->primary_key_name(); |
|
420 | + $event_to_event_venue_join = EEM_Event::instance()->table().'.ID = '.$event_venue_table.'.'.EEM_Event::instance()->primary_key_name(); |
|
421 | 421 | // don't add joins if they have already been added |
422 | - if ( strpos( $SQL, $event_to_event_venue_join ) === FALSE ) { |
|
422 | + if (strpos($SQL, $event_to_event_venue_join) === FALSE) { |
|
423 | 423 | // Venue table name |
424 | 424 | $venue_table = EEM_Venue::instance()->table(); |
425 | 425 | // Venue table pk |
@@ -432,10 +432,10 @@ discard block |
||
432 | 432 | $venue_SQL .= " LEFT JOIN $venue_table as Venue ON ( $event_venue_table.$venue_table_pk = Venue.ID )"; |
433 | 433 | // generate JOIN clause for: Venue <=> Venue Meta |
434 | 434 | $venue_SQL .= " LEFT JOIN $venue_meta_table ON ( Venue.ID = $venue_meta_table.$venue_table_pk )"; |
435 | - unset( $event_venue_table, $event_to_event_venue_join, $venue_table, $venue_table_pk, $venue_meta_table ); |
|
435 | + unset($event_venue_table, $event_to_event_venue_join, $venue_table, $venue_table_pk, $venue_meta_table); |
|
436 | 436 | return $venue_SQL; |
437 | 437 | } |
438 | - unset( $event_venue_table, $event_to_event_venue_join ); |
|
438 | + unset($event_venue_table, $event_to_event_venue_join); |
|
439 | 439 | return ''; |
440 | 440 | } |
441 | 441 | |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | * @param string $SQL |
449 | 449 | * @return string |
450 | 450 | */ |
451 | - protected static function _posts_join_for_venue_state( $SQL = '' ) { |
|
451 | + protected static function _posts_join_for_venue_state($SQL = '') { |
|
452 | 452 | // Venue Meta table name |
453 | 453 | $venue_meta_table = EEM_Venue::instance()->second_table(); |
454 | 454 | // State table name |
@@ -456,16 +456,16 @@ discard block |
||
456 | 456 | // State table pk |
457 | 457 | $state_table_pk = EEM_State::instance()->primary_key_name(); |
458 | 458 | // verify vars |
459 | - if ( $venue_meta_table && $state_table && $state_table_pk ) { |
|
459 | + if ($venue_meta_table && $state_table && $state_table_pk) { |
|
460 | 460 | // like: wp_esp_venue_meta.STA_ID = wp_esp_state.STA_ID |
461 | 461 | $join = "$venue_meta_table.$state_table_pk = $state_table.$state_table_pk"; |
462 | 462 | // don't add join if it has already been added |
463 | - if ( strpos( $SQL, $join ) === FALSE ) { |
|
464 | - unset( $state_table_pk, $venue_meta_table, $venue_table_pk ); |
|
463 | + if (strpos($SQL, $join) === FALSE) { |
|
464 | + unset($state_table_pk, $venue_meta_table, $venue_table_pk); |
|
465 | 465 | return " LEFT JOIN $state_table ON ( $join )"; |
466 | 466 | } |
467 | 467 | } |
468 | - unset( $join, $state_table, $state_table_pk, $venue_meta_table, $venue_table_pk ); |
|
468 | + unset($join, $state_table, $state_table_pk, $venue_meta_table, $venue_table_pk); |
|
469 | 469 | return ''; |
470 | 470 | } |
471 | 471 | |
@@ -479,14 +479,14 @@ discard block |
||
479 | 479 | * @param WP_Query $wp_query |
480 | 480 | * @return string |
481 | 481 | */ |
482 | - public static function posts_where( $SQL = '', WP_Query $wp_query ) { |
|
483 | - if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) { |
|
482 | + public static function posts_where($SQL = '', WP_Query $wp_query) { |
|
483 | + if (EEH_Event_Query::apply_query_filters($wp_query)) { |
|
484 | 484 | // Show Expired ? |
485 | - $SQL .= EEH_Event_Query::posts_where_sql_for_show_expired( EEH_Event_Query::$_event_query_show_expired ); |
|
485 | + $SQL .= EEH_Event_Query::posts_where_sql_for_show_expired(EEH_Event_Query::$_event_query_show_expired); |
|
486 | 486 | // Category |
487 | - $SQL .= EEH_Event_Query::posts_where_sql_for_event_category_slug( EEH_Event_Query::$_event_query_category ); |
|
487 | + $SQL .= EEH_Event_Query::posts_where_sql_for_event_category_slug(EEH_Event_Query::$_event_query_category); |
|
488 | 488 | // Start Date |
489 | - $SQL .= EEH_Event_Query::posts_where_sql_for_event_list_month( EEH_Event_Query::$_event_query_month ); |
|
489 | + $SQL .= EEH_Event_Query::posts_where_sql_for_event_list_month(EEH_Event_Query::$_event_query_month); |
|
490 | 490 | } |
491 | 491 | return $SQL; |
492 | 492 | } |
@@ -500,8 +500,8 @@ discard block |
||
500 | 500 | * @param boolean $show_expired if TRUE, then displayed past events |
501 | 501 | * @return string |
502 | 502 | */ |
503 | - public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) { |
|
504 | - return ! $show_expired ? ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . current_time( 'mysql', TRUE ) . '" ' : ''; |
|
503 | + public static function posts_where_sql_for_show_expired($show_expired = FALSE) { |
|
504 | + return ! $show_expired ? ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end > "'.current_time('mysql', TRUE).'" ' : ''; |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | |
@@ -513,9 +513,9 @@ discard block |
||
513 | 513 | * @param boolean $event_category_slug |
514 | 514 | * @return string |
515 | 515 | */ |
516 | - public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) { |
|
516 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) { |
|
517 | 517 | global $wpdb; |
518 | - return ! empty( $event_category_slug ) ? ' AND ' . $wpdb->terms . '.slug = "' . $event_category_slug . '" ' : ''; |
|
518 | + return ! empty($event_category_slug) ? ' AND '.$wpdb->terms.'.slug = "'.$event_category_slug.'" ' : ''; |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -527,13 +527,13 @@ discard block |
||
527 | 527 | * @param boolean $month |
528 | 528 | * @return string |
529 | 529 | */ |
530 | - public static function posts_where_sql_for_event_list_month( $month = NULL ) { |
|
530 | + public static function posts_where_sql_for_event_list_month($month = NULL) { |
|
531 | 531 | $SQL = ''; |
532 | - if ( ! empty( $month ) ) { |
|
532 | + if ( ! empty($month)) { |
|
533 | 533 | // event start date is LESS than the end of the month ( so nothing that doesn't start until next month ) |
534 | - $SQL = ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start <= "' . gmdate( 'Y-m-t 23:59:59', strtotime( $month ) ) . '"'; |
|
534 | + $SQL = ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_start <= "'.gmdate('Y-m-t 23:59:59', strtotime($month)).'"'; |
|
535 | 535 | // event end date is GREATER than the start of the month ( so nothing that ended before this month ) |
536 | - $SQL .= ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end >= "' . gmdate( 'Y-m-01 0:0:00', strtotime( $month ) ) . '" '; |
|
536 | + $SQL .= ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end >= "'.gmdate('Y-m-01 0:0:00', strtotime($month)).'" '; |
|
537 | 537 | } |
538 | 538 | return $SQL; |
539 | 539 | } |
@@ -548,9 +548,9 @@ discard block |
||
548 | 548 | * @param WP_Query $wp_query |
549 | 549 | * @return string |
550 | 550 | */ |
551 | - public static function posts_orderby( $SQL = '', WP_Query $wp_query ) { |
|
552 | - if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) { |
|
553 | - $SQL = EEH_Event_Query::posts_orderby_sql( EEH_Event_Query::$_event_query_orderby, EEH_Event_Query::$_event_query_sort ); |
|
551 | + public static function posts_orderby($SQL = '', WP_Query $wp_query) { |
|
552 | + if (EEH_Event_Query::apply_query_filters($wp_query)) { |
|
553 | + $SQL = EEH_Event_Query::posts_orderby_sql(EEH_Event_Query::$_event_query_orderby, EEH_Event_Query::$_event_query_sort); |
|
554 | 554 | } |
555 | 555 | return $SQL; |
556 | 556 | } |
@@ -581,63 +581,63 @@ discard block |
||
581 | 581 | * @param string $sort |
582 | 582 | * @return string |
583 | 583 | */ |
584 | - public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
|
584 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') { |
|
585 | 585 | global $wpdb; |
586 | 586 | $SQL = ''; |
587 | 587 | $counter = 0; |
588 | 588 | //make sure 'orderby' is set in query params |
589 | - if ( ! isset( self::$_query_params['orderby'] )) { |
|
589 | + if ( ! isset(self::$_query_params['orderby'])) { |
|
590 | 590 | self::$_query_params['orderby'] = array(); |
591 | 591 | } |
592 | 592 | // loop thru $orderby_params (type cast as array) |
593 | - foreach ( (array)$orderby_params as $orderby ) { |
|
593 | + foreach ((array) $orderby_params as $orderby) { |
|
594 | 594 | // check if we have already added this param |
595 | - if ( isset( self::$_query_params['orderby'][ $orderby ] )) { |
|
595 | + if (isset(self::$_query_params['orderby'][$orderby])) { |
|
596 | 596 | // if so then remove from the $orderby_params so that the count() method below is accurate |
597 | - unset( $orderby_params[ $orderby ] ); |
|
597 | + unset($orderby_params[$orderby]); |
|
598 | 598 | // then bump ahead to the next param |
599 | 599 | continue; |
600 | 600 | } |
601 | 601 | // this will ad a comma depending on whether this is the first or last param |
602 | - $glue = $counter == 0 || $counter == count( $orderby_params ) ? ' ' : ', '; |
|
602 | + $glue = $counter == 0 || $counter == count($orderby_params) ? ' ' : ', '; |
|
603 | 603 | // ok what's we dealing with? |
604 | - switch ( $orderby ) { |
|
604 | + switch ($orderby) { |
|
605 | 605 | case 'id' : |
606 | 606 | case 'ID' : |
607 | - $SQL .= $glue . $wpdb->posts . '.ID ' . $sort; |
|
607 | + $SQL .= $glue.$wpdb->posts.'.ID '.$sort; |
|
608 | 608 | break; |
609 | 609 | case 'end_date' : |
610 | - $SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_end ' . $sort; |
|
610 | + $SQL .= $glue.EEM_Datetime::instance()->table().'.DTT_EVT_end '.$sort; |
|
611 | 611 | break; |
612 | 612 | case 'event_name' : |
613 | - $SQL .= $glue . $wpdb->posts . '.post_title ' . $sort; |
|
613 | + $SQL .= $glue.$wpdb->posts.'.post_title '.$sort; |
|
614 | 614 | break; |
615 | 615 | case 'category_slug' : |
616 | - $SQL .= $glue . $wpdb->terms . '.slug ' . $sort; |
|
616 | + $SQL .= $glue.$wpdb->terms.'.slug '.$sort; |
|
617 | 617 | break; |
618 | 618 | case 'ticket_start' : |
619 | - $SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_start_date ' . $sort; |
|
619 | + $SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_start_date '.$sort; |
|
620 | 620 | break; |
621 | 621 | case 'ticket_end' : |
622 | - $SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_end_date ' . $sort; |
|
622 | + $SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_end_date '.$sort; |
|
623 | 623 | break; |
624 | 624 | case 'venue_title' : |
625 | - $SQL .= $glue . 'venue_title ' . $sort; |
|
625 | + $SQL .= $glue.'venue_title '.$sort; |
|
626 | 626 | break; |
627 | 627 | case 'city' : |
628 | - $SQL .= $glue . EEM_Venue::instance()->second_table() . '.VNU_city ' . $sort; |
|
628 | + $SQL .= $glue.EEM_Venue::instance()->second_table().'.VNU_city '.$sort; |
|
629 | 629 | break; |
630 | 630 | case 'state' : |
631 | - $SQL .= $glue . EEM_State::instance()->table() . '.STA_name ' . $sort; |
|
631 | + $SQL .= $glue.EEM_State::instance()->table().'.STA_name '.$sort; |
|
632 | 632 | break; |
633 | 633 | case 'start_date' : |
634 | 634 | default : |
635 | - $SQL .= $glue . ' event_start_date ' . $sort; |
|
635 | + $SQL .= $glue.' event_start_date '.$sort; |
|
636 | 636 | break; |
637 | 637 | } |
638 | 638 | // add to array of orderby params that have been added |
639 | - self::$_query_params['orderby'][ $orderby ] = TRUE; |
|
640 | - $counter ++; |
|
639 | + self::$_query_params['orderby'][$orderby] = TRUE; |
|
640 | + $counter++; |
|
641 | 641 | } |
642 | 642 | return $SQL; |
643 | 643 | } |
@@ -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 | * |
@@ -574,7 +576,7 @@ discard block |
||
574 | 576 | if($item->transaction()){ |
575 | 577 | $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
576 | 578 | return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
577 | - }else{ |
|
579 | + } else{ |
|
578 | 580 | return __("None", "event_espresso"); |
579 | 581 | } |
580 | 582 | } |
@@ -332,12 +332,12 @@ discard block |
||
332 | 332 | * @param \EE_Registration $item |
333 | 333 | * @return string |
334 | 334 | */ |
335 | - function column_cb($item){ |
|
335 | + function column_cb($item){ |
|
336 | 336 | /** checkbox/lock **/ |
337 | 337 | $transaction = $item->get_first_related( 'Transaction' ); |
338 | 338 | $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
339 | 339 | return $payment_count > 0 ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) . '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ); |
340 | - } |
|
340 | + } |
|
341 | 341 | |
342 | 342 | |
343 | 343 | |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | function column__REG_date(EE_Registration $item){ |
373 | 373 | $this->_set_related_details($item); |
374 | - //Build row actions |
|
374 | + //Build row actions |
|
375 | 375 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
376 | 376 | $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
377 | 377 | $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | } else { |
424 | 424 | return __( 'There is no ticket on this registration', 'event_espresso' ); |
425 | 425 | } |
426 | - } |
|
426 | + } |
|
427 | 427 | |
428 | 428 | |
429 | 429 | |
@@ -445,14 +445,14 @@ discard block |
||
445 | 445 | $t = $item->get_first_related('Transaction'); |
446 | 446 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
447 | 447 | |
448 | - //append group count to name |
|
449 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
448 | + //append group count to name |
|
449 | + $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
450 | 450 | |
451 | - //append reg_code |
|
452 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
451 | + //append reg_code |
|
452 | + $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
453 | 453 | |
454 | - //reg status text for accessibility |
|
455 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
454 | + //reg status text for accessibility |
|
455 | + $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
456 | 456 | |
457 | 457 | //trash/restore/delete actions |
458 | 458 | $actions = array(); |
@@ -57,20 +57,20 @@ discard block |
||
57 | 57 | * @param \EE_Admin_Page $admin_page |
58 | 58 | * @return EE_Registrations_List_Table |
59 | 59 | */ |
60 | - function __construct( $admin_page ){ |
|
60 | + function __construct($admin_page) { |
|
61 | 61 | |
62 | - if ( ! empty( $_GET['event_id'] ) ) { |
|
62 | + if ( ! empty($_GET['event_id'])) { |
|
63 | 63 | $extra_query_args = array(); |
64 | - foreach ( $admin_page->get_views() as $key => $view_details ) { |
|
65 | - $extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] ); |
|
64 | + foreach ($admin_page->get_views() as $key => $view_details) { |
|
65 | + $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']); |
|
66 | 66 | } |
67 | - $this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args ); |
|
67 | + $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | parent::__construct($admin_page); |
71 | 71 | $this->_status = $this->_admin_page->get_registration_status_array(); |
72 | 72 | |
73 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
73 | + EE_Registry::instance()->load_helper('Template'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | * @return void |
82 | 82 | */ |
83 | 83 | protected function _setup_data() { |
84 | - $this->_data = $this->_admin_page->get_registrations( $this->_per_page ); |
|
85 | - $this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE ); |
|
84 | + $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
85 | + $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -101,45 +101,45 @@ discard block |
||
101 | 101 | ); |
102 | 102 | |
103 | 103 | |
104 | - if ( isset( $_GET['event_id'] )) { |
|
104 | + if (isset($_GET['event_id'])) { |
|
105 | 105 | $this->_columns = array( |
106 | 106 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
107 | - '_REG_ID' => __( 'ID', 'event_espresso' ), |
|
108 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
107 | + '_REG_ID' => __('ID', 'event_espresso'), |
|
108 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
109 | 109 | 'ATT_email' => __('Email', 'event_espresso'), |
110 | - '_REG_date' => __( 'Reg Date', 'event_espresso' ), |
|
111 | - 'PRC_amount' => __( 'TKT Price', 'event_espresso' ), |
|
112 | - '_REG_final_price' => __( 'Final Price', 'event_espresso' ), |
|
113 | - 'TXN_total' => __( 'Total Txn', 'event_espresso' ), |
|
110 | + '_REG_date' => __('Reg Date', 'event_espresso'), |
|
111 | + 'PRC_amount' => __('TKT Price', 'event_espresso'), |
|
112 | + '_REG_final_price' => __('Final Price', 'event_espresso'), |
|
113 | + 'TXN_total' => __('Total Txn', 'event_espresso'), |
|
114 | 114 | 'TXN_paid' => __('Paid', 'event_espresso'), |
115 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
115 | + 'actions' => __('Actions', 'event_espresso') |
|
116 | 116 | ); |
117 | 117 | $this->_bottom_buttons = array( |
118 | 118 | 'report'=> array( |
119 | 119 | 'route' => 'registrations_report', |
120 | 120 | 'extra_request' => |
121 | 121 | array( |
122 | - 'EVT_ID'=> isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null, |
|
123 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) |
|
122 | + 'EVT_ID'=> isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
123 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
124 | 124 | ), |
125 | 125 | ); |
126 | 126 | } else { |
127 | 127 | $this->_columns = array( |
128 | 128 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
129 | - '_REG_ID' => __( 'ID', 'event_espresso' ), |
|
130 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
131 | - '_REG_date' => __( 'TXN Date', 'event_espresso' ), |
|
132 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
133 | - 'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ), |
|
134 | - '_REG_final_price' => __( 'Price', 'event_espresso' ), |
|
135 | - '_REG_paid' => __( 'Paid', 'event_espresso' ), |
|
136 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
129 | + '_REG_ID' => __('ID', 'event_espresso'), |
|
130 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
131 | + '_REG_date' => __('TXN Date', 'event_espresso'), |
|
132 | + 'event_name' => __('Event', 'event_espresso'), |
|
133 | + 'DTT_EVT_start' => __('Event Date', 'event_espresso'), |
|
134 | + '_REG_final_price' => __('Price', 'event_espresso'), |
|
135 | + '_REG_paid' => __('Paid', 'event_espresso'), |
|
136 | + 'actions' => __('Actions', 'event_espresso') |
|
137 | 137 | ); |
138 | 138 | $this->_bottom_buttons = array( |
139 | 139 | 'report_all'=> array( |
140 | 140 | 'route' => 'registrations_report', |
141 | 141 | 'extra_request' => array( |
142 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) |
|
142 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
143 | 143 | ), |
144 | 144 | ); |
145 | 145 | } |
@@ -147,11 +147,11 @@ discard block |
||
147 | 147 | $this->_primary_column = '_REG_ID'; |
148 | 148 | |
149 | 149 | $this->_sortable_columns = array( |
150 | - '_REG_date' => array( '_REG_date' => TRUE ), //true means its already sorted |
|
151 | - 'ATT_fname' => array( 'ATT_fname' => FALSE ), |
|
152 | - 'event_name' => array( 'event_name' => FALSE ), |
|
153 | - 'DTT_EVT_start' => array( 'DTT_EVT_start' => FALSE ), |
|
154 | - '_REG_ID' => array( '_REG_ID' => FALSE ), |
|
150 | + '_REG_date' => array('_REG_date' => TRUE), //true means its already sorted |
|
151 | + 'ATT_fname' => array('ATT_fname' => FALSE), |
|
152 | + 'event_name' => array('event_name' => FALSE), |
|
153 | + 'DTT_EVT_start' => array('DTT_EVT_start' => FALSE), |
|
154 | + '_REG_ID' => array('_REG_ID' => FALSE), |
|
155 | 155 | ); |
156 | 156 | |
157 | 157 | $this->_hidden_columns = array(); |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | |
161 | 161 | |
162 | 162 | |
163 | - protected function _get_row_class( $item ) { |
|
164 | - $class = parent::_get_row_class( $item ); |
|
163 | + protected function _get_row_class($item) { |
|
164 | + $class = parent::_get_row_class($item); |
|
165 | 165 | //add status class |
166 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
167 | - if ( $this->_has_checkbox_column ) { |
|
166 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
167 | + if ($this->_has_checkbox_column) { |
|
168 | 168 | $class .= ' has-checkbox-column'; |
169 | 169 | } |
170 | 170 | return $class; |
@@ -177,15 +177,15 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @param EE_Registration $registration |
179 | 179 | */ |
180 | - protected function _set_related_details( EE_Registration $registration ) { |
|
180 | + protected function _set_related_details(EE_Registration $registration) { |
|
181 | 181 | |
182 | - $transaction = $registration->get_first_related( 'Transaction' ); |
|
182 | + $transaction = $registration->get_first_related('Transaction'); |
|
183 | 183 | $status = $transaction instanceof EE_Transaction ? $transaction->status_ID() : EEM_Transaction::failed_status_code; |
184 | 184 | $this->_transaction_details = array( |
185 | 185 | 'transaction' => $transaction, |
186 | 186 | 'status' => $status, |
187 | 187 | 'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0, |
188 | - 'title_attr' => sprintf( __('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) ) |
|
188 | + 'title_attr' => sprintf(__('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence')) |
|
189 | 189 | ); |
190 | 190 | |
191 | 191 | $event = $registration->event(); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | 'event' => $event, |
195 | 195 | 'status' => $status, |
196 | 196 | 'id' => $event instanceof EE_Event ? $event->ID() : 0, |
197 | - 'title_attr' => sprintf( __('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) ) |
|
197 | + 'title_attr' => sprintf(__('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence')) |
|
198 | 198 | ); |
199 | 199 | } |
200 | 200 | |
@@ -209,26 +209,26 @@ discard block |
||
209 | 209 | $filters = array(); |
210 | 210 | |
211 | 211 | //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods. |
212 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
212 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
213 | 213 | |
214 | - $cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : ''; |
|
215 | - $cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
216 | - $reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : ''; |
|
214 | + $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
215 | + $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
216 | + $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : ''; |
|
217 | 217 | |
218 | - $filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category ); |
|
219 | - $filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category ); |
|
218 | + $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
219 | + $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
220 | 220 | |
221 | 221 | $status = array(); |
222 | - $status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') ); |
|
223 | - foreach ( $this->_status as $key => $value ) { |
|
224 | - $status[] = array( 'id' => $key, 'text' => $value ); |
|
222 | + $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso')); |
|
223 | + foreach ($this->_status as $key => $value) { |
|
224 | + $status[] = array('id' => $key, 'text' => $value); |
|
225 | 225 | } |
226 | - if ( $this->_view != 'incomplete' ) { |
|
227 | - $filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset( $this->_req_data['_reg_status'] ) ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] )) : '' ); |
|
226 | + if ($this->_view != 'incomplete') { |
|
227 | + $filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) : ''); |
|
228 | 228 | } |
229 | 229 | |
230 | - if ( isset( $this->_req_data['event_id'] ) ) { |
|
231 | - $filters[] = EEH_Form_Fields::hidden_input( 'event_id', $this->_req_data['event_id'], 'reg_event_id' ); |
|
230 | + if (isset($this->_req_data['event_id'])) { |
|
231 | + $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | return $filters; |
@@ -245,9 +245,9 @@ discard block |
||
245 | 245 | $this->_views['all']['count'] = $this->_total_registrations(); |
246 | 246 | $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
247 | 247 | $this->_views['today']['count'] = $this->_total_registrations_today(); |
248 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) { |
|
249 | - $this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' ); |
|
250 | - $this->_views['trash']['count'] = $this->_total_registrations( 'trash' ); |
|
248 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) { |
|
249 | + $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
250 | + $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
@@ -259,23 +259,23 @@ discard block |
||
259 | 259 | * @param string $view |
260 | 260 | * @return int |
261 | 261 | */ |
262 | - protected function _total_registrations( $view = '' ){ |
|
262 | + protected function _total_registrations($view = '') { |
|
263 | 263 | $_where = array(); |
264 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
265 | - if( $EVT_ID ) { |
|
264 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
265 | + if ($EVT_ID) { |
|
266 | 266 | $_where['EVT_ID'] = $EVT_ID; |
267 | 267 | } |
268 | - switch ( $view ) { |
|
268 | + switch ($view) { |
|
269 | 269 | case 'trash' : |
270 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
270 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
271 | 271 | break; |
272 | 272 | case 'incomplete' : |
273 | 273 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
274 | 274 | break; |
275 | 275 | default : |
276 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
276 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
277 | 277 | } |
278 | - return EEM_Registration::instance()->count( array( $_where )); |
|
278 | + return EEM_Registration::instance()->count(array($_where)); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | |
@@ -285,24 +285,24 @@ discard block |
||
285 | 285 | * @access protected |
286 | 286 | * @return int |
287 | 287 | */ |
288 | - protected function _total_registrations_this_month(){ |
|
289 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
290 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
288 | + protected function _total_registrations_this_month() { |
|
289 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
290 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
291 | 291 | $this_year_r = date('Y', current_time('timestamp')); |
292 | 292 | $time_start = ' 00:00:00'; |
293 | 293 | $time_end = ' 23:59:59'; |
294 | 294 | $this_month_r = date('m', current_time('timestamp')); |
295 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
295 | + $days_this_month = date('t', current_time('timestamp')); |
|
296 | 296 | //setup date query. |
297 | - $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ); |
|
298 | - $end_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ); |
|
299 | - $_where['REG_date']= array('BETWEEN', |
|
297 | + $beginning_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'); |
|
298 | + $end_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s'); |
|
299 | + $_where['REG_date'] = array('BETWEEN', |
|
300 | 300 | array( |
301 | 301 | $beginning_string, |
302 | 302 | $end_string |
303 | 303 | )); |
304 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
305 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
304 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
305 | + return EEM_Registration::instance()->count(array($_where)); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | |
@@ -312,20 +312,20 @@ discard block |
||
312 | 312 | * @access protected |
313 | 313 | * @return int |
314 | 314 | */ |
315 | - protected function _total_registrations_today(){ |
|
315 | + protected function _total_registrations_today() { |
|
316 | 316 | |
317 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
318 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
317 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
318 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
319 | 319 | $current_date = date('Y-m-d', current_time('timestamp')); |
320 | 320 | $time_start = ' 00:00:00'; |
321 | 321 | $time_end = ' 23:59:59'; |
322 | - $_where['REG_date']= array('BETWEEN', |
|
322 | + $_where['REG_date'] = array('BETWEEN', |
|
323 | 323 | array( |
324 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ), |
|
325 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' ) |
|
324 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'), |
|
325 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s') |
|
326 | 326 | )); |
327 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
328 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
327 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
328 | + return EEM_Registration::instance()->count(array($_where)); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | * @param \EE_Registration $item |
338 | 338 | * @return string |
339 | 339 | */ |
340 | - function column_cb($item){ |
|
340 | + function column_cb($item) { |
|
341 | 341 | /** checkbox/lock **/ |
342 | - $transaction = $item->get_first_related( 'Transaction' ); |
|
343 | - $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
|
344 | - return $payment_count > 0 ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) . '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ); |
|
342 | + $transaction = $item->get_first_related('Transaction'); |
|
343 | + $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0; |
|
344 | + return $payment_count > 0 ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()).'<span class="ee-lock-icon"></span>' : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
@@ -353,14 +353,14 @@ discard block |
||
353 | 353 | * @param \EE_Registration $item |
354 | 354 | * @return string |
355 | 355 | */ |
356 | - function column__REG_ID(EE_Registration $item){ |
|
356 | + function column__REG_ID(EE_Registration $item) { |
|
357 | 357 | $attendee = $item->attendee(); |
358 | 358 | $content = $item->ID(); |
359 | 359 | $content .= '<div class="show-on-mobile-view-only">'; |
360 | 360 | $content .= '<br>'; |
361 | 361 | $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
362 | - $content .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
363 | - $content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
362 | + $content .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
363 | + $content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
364 | 364 | $content .= '</div>'; |
365 | 365 | return $content; |
366 | 366 | } |
@@ -374,12 +374,12 @@ discard block |
||
374 | 374 | * @param \EE_Registration $item |
375 | 375 | * @return string |
376 | 376 | */ |
377 | - function column__REG_date(EE_Registration $item){ |
|
377 | + function column__REG_date(EE_Registration $item) { |
|
378 | 378 | $this->_set_related_details($item); |
379 | 379 | //Build row actions |
380 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
381 | - $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
|
382 | - $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
|
380 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL); |
|
381 | + $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date'); |
|
382 | + $view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>'; |
|
383 | 383 | return $view_link; |
384 | 384 | } |
385 | 385 | |
@@ -392,18 +392,18 @@ discard block |
||
392 | 392 | * @param \EE_Registration $item |
393 | 393 | * @return string |
394 | 394 | */ |
395 | - function column_event_name(EE_Registration $item){ |
|
396 | - $this->_set_related_details( $item ); |
|
395 | + function column_event_name(EE_Registration $item) { |
|
396 | + $this->_set_related_details($item); |
|
397 | 397 | // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
398 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$item->event_ID() ), EVENTS_ADMIN_URL ); |
|
398 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$item->event_ID()), EVENTS_ADMIN_URL); |
|
399 | 399 | $event_name = $item->event_name(); |
400 | 400 | $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); |
401 | - $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID() ) ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr( $this->_event_details['title_attr'] ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ) ; |
|
401 | + $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID()) ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'); |
|
402 | 402 | |
403 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'event_id'=>$item->event_ID() ), REG_ADMIN_URL ); |
|
404 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Filter this list to only show registrations for %s', 'event_espresso' ), $event_name ) .'">' . __( 'View Registrations', 'event_espresso' ) . '</a>'; |
|
403 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id'=>$item->event_ID()), REG_ADMIN_URL); |
|
404 | + $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name).'">'.__('View Registrations', 'event_espresso').'</a>'; |
|
405 | 405 | |
406 | - return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) ); |
|
406 | + return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | |
@@ -415,18 +415,18 @@ discard block |
||
415 | 415 | * @param \EE_Registration $item |
416 | 416 | * @return string |
417 | 417 | */ |
418 | - function column_DTT_EVT_start(EE_Registration $item){ |
|
418 | + function column_DTT_EVT_start(EE_Registration $item) { |
|
419 | 419 | $datetime_strings = array(); |
420 | - $ticket = $item->ticket( TRUE ); |
|
421 | - if ( $ticket instanceof EE_Ticket ) { |
|
420 | + $ticket = $item->ticket(TRUE); |
|
421 | + if ($ticket instanceof EE_Ticket) { |
|
422 | 422 | $remove_defaults = array('default_where_conditions' => 'none'); |
423 | 423 | $datetimes = $ticket->datetimes($remove_defaults); |
424 | - foreach($datetimes as $datetime){ |
|
425 | - $datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
424 | + foreach ($datetimes as $datetime) { |
|
425 | + $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
426 | 426 | } |
427 | - return implode("<br />",$datetime_strings); |
|
427 | + return implode("<br />", $datetime_strings); |
|
428 | 428 | } else { |
429 | - return __( 'There is no ticket on this registration', 'event_espresso' ); |
|
429 | + return __('There is no ticket on this registration', 'event_espresso'); |
|
430 | 430 | } |
431 | 431 | } |
432 | 432 | |
@@ -439,45 +439,45 @@ discard block |
||
439 | 439 | * @param \EE_Registration $item |
440 | 440 | * @return string |
441 | 441 | */ |
442 | - function column_ATT_fname(EE_Registration $item){ |
|
442 | + function column_ATT_fname(EE_Registration $item) { |
|
443 | 443 | $attendee = $item->attendee(); |
444 | 444 | |
445 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
445 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
446 | 446 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
447 | - $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' : $attendee_name; |
|
447 | + $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' : $attendee_name; |
|
448 | 448 | $link .= $item->count() == 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : ''; |
449 | 449 | |
450 | 450 | $t = $item->get_first_related('Transaction'); |
451 | 451 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
452 | 452 | |
453 | 453 | //append group count to name |
454 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
454 | + $link .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
455 | 455 | |
456 | 456 | //append reg_code |
457 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
457 | + $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
458 | 458 | |
459 | 459 | //reg status text for accessibility |
460 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
460 | + $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
461 | 461 | |
462 | 462 | //trash/restore/delete actions |
463 | 463 | $actions = array(); |
464 | - if ( $this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) { |
|
465 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
466 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>'; |
|
467 | - } elseif ( $this->_view == 'trash' ) { |
|
464 | + if ($this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) { |
|
465 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
466 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
467 | + } elseif ($this->_view == 'trash') { |
|
468 | 468 | // restore registration link |
469 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) { |
|
470 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
471 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
469 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) { |
|
470 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
471 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
472 | 472 | } |
473 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) { |
|
474 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
473 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) { |
|
474 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
475 | 475 | |
476 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
476 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>'; |
|
477 | 477 | } |
478 | 478 | } |
479 | 479 | |
480 | - return sprintf('%1$s %2$s', $link, $this->row_actions($actions) ); |
|
480 | + return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | * @param \EE_Registration $item |
490 | 490 | * @return string |
491 | 491 | */ |
492 | - function column_ATT_email( EE_Registration $item ) { |
|
492 | + function column_ATT_email(EE_Registration $item) { |
|
493 | 493 | $attendee = $item->get_first_related('Attendee'); |
494 | 494 | return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email(); |
495 | 495 | } |
@@ -503,8 +503,8 @@ discard block |
||
503 | 503 | * @param \EE_Registration $item |
504 | 504 | * @return string |
505 | 505 | */ |
506 | - function column__REG_count(EE_Registration $item){ |
|
507 | - return sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size()); |
|
506 | + function column__REG_count(EE_Registration $item) { |
|
507 | + return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -516,16 +516,16 @@ discard block |
||
516 | 516 | * @param \EE_Registration $item |
517 | 517 | * @return string |
518 | 518 | */ |
519 | - function column_PRC_amount(EE_Registration $item){ |
|
519 | + function column_PRC_amount(EE_Registration $item) { |
|
520 | 520 | $ticket = $item->ticket(); |
521 | 521 | |
522 | - $content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : ''; |
|
522 | + $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : ''; |
|
523 | 523 | |
524 | - if ( $item->final_price() > 0 ) { |
|
525 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
524 | + if ($item->final_price() > 0) { |
|
525 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
526 | 526 | } else { |
527 | 527 | // free event |
528 | - $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
528 | + $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>'; |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | return $content; |
@@ -541,11 +541,11 @@ discard block |
||
541 | 541 | * @param \EE_Registration $item |
542 | 542 | * @return string |
543 | 543 | */ |
544 | - function column__REG_final_price(EE_Registration $item){ |
|
544 | + function column__REG_final_price(EE_Registration $item) { |
|
545 | 545 | $ticket = $item->ticket(); |
546 | - $content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />'; |
|
546 | + $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />'; |
|
547 | 547 | |
548 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
548 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
549 | 549 | return $content; |
550 | 550 | |
551 | 551 | } |
@@ -559,13 +559,13 @@ discard block |
||
559 | 559 | * @param \EE_Registration $item |
560 | 560 | * @return string |
561 | 561 | */ |
562 | - function column__REG_paid(EE_Registration $item){ |
|
562 | + function column__REG_paid(EE_Registration $item) { |
|
563 | 563 | $payment_method = $item->payment_method(); |
564 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
564 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
565 | 565 | |
566 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
567 | - if ( $item->paid() > 0 ) { |
|
568 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
566 | + $content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>'; |
|
567 | + if ($item->paid() > 0) { |
|
568 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
569 | 569 | } |
570 | 570 | return $content; |
571 | 571 | } |
@@ -579,11 +579,11 @@ discard block |
||
579 | 579 | * @param \EE_Registration $item |
580 | 580 | * @return string |
581 | 581 | */ |
582 | - function column_TXN_total(EE_Registration $item){ |
|
583 | - if($item->transaction()){ |
|
584 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
585 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
586 | - }else{ |
|
582 | + function column_TXN_total(EE_Registration $item) { |
|
583 | + if ($item->transaction()) { |
|
584 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
585 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>'; |
|
586 | + } else { |
|
587 | 587 | return __("None", "event_espresso"); |
588 | 588 | } |
589 | 589 | } |
@@ -597,15 +597,15 @@ discard block |
||
597 | 597 | * @param \EE_Registration $item |
598 | 598 | * @return string |
599 | 599 | */ |
600 | - function column_TXN_paid(EE_Registration $item){ |
|
600 | + function column_TXN_paid(EE_Registration $item) { |
|
601 | 601 | |
602 | - if ( $item->count() == 1 ) { |
|
602 | + if ($item->count() == 1) { |
|
603 | 603 | $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance(); |
604 | - if ( $transaction->paid() >= $transaction->total() ) { |
|
604 | + if ($transaction->paid() >= $transaction->total()) { |
|
605 | 605 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
606 | 606 | } else { |
607 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
608 | - return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
607 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
608 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
609 | 609 | } |
610 | 610 | } |
611 | 611 | |
@@ -626,44 +626,44 @@ discard block |
||
626 | 626 | EE_Registry::instance()->load_helper('MSG_Template'); |
627 | 627 | $attendee = $item->attendee(); |
628 | 628 | $ticket = $item->ticket(); |
629 | - $this->_set_related_details( $item ); |
|
629 | + $this->_set_related_details($item); |
|
630 | 630 | |
631 | 631 | //Build row actions |
632 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
633 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL ); |
|
632 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
633 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL); |
|
634 | 634 | |
635 | 635 | // page=attendees&event_admin_reports=resend_email®istration_id=43653465634&event_id=2&form_action=resend_email |
636 | 636 | //$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID ); |
637 | - $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true ); |
|
637 | + $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true); |
|
638 | 638 | |
639 | 639 | |
640 | 640 | //Build row actions |
641 | - $view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? ' |
|
641 | + $view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? ' |
|
642 | 642 | <li> |
643 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
643 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
644 | 644 | <div class="dashicons dashicons-clipboard"></div> |
645 | 645 | </a> |
646 | 646 | </li>' : ''; |
647 | 647 | |
648 | - $edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) && $attendee instanceof EE_Attendee ?' |
|
648 | + $edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? ' |
|
649 | 649 | <li> |
650 | - <a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text"> |
|
650 | + <a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text"> |
|
651 | 651 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div> |
652 | 652 | </a> |
653 | 653 | </li>' : ''; |
654 | 654 | |
655 | - $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? ' |
|
655 | + $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? ' |
|
656 | 656 | <li> |
657 | - <a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
657 | + <a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text"> |
|
658 | 658 | <div class="dashicons dashicons-email-alt"></div> |
659 | 659 | </a> |
660 | 660 | </li>' : ''; |
661 | 661 | |
662 | 662 | // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb |
663 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
664 | - $view_txn_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? ' |
|
663 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL); |
|
664 | + $view_txn_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? ' |
|
665 | 665 | <li> |
666 | - <a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_txn_lnk_url.'" title="' . $this->_transaction_details['title_attr'] . '" class="tiny-text"> |
|
666 | + <a class="ee-status-color-' . $this->_transaction_details['status'].'" href="'.$view_txn_lnk_url.'" title="'.$this->_transaction_details['title_attr'].'" class="tiny-text"> |
|
667 | 667 | <div class="dashicons dashicons-cart"></div> |
668 | 668 | </a> |
669 | 669 | </li>' : ''; |
@@ -671,10 +671,10 @@ discard block |
||
671 | 671 | //invoice link |
672 | 672 | $dl_invoice_lnk_url = $item->invoice_url(); |
673 | 673 | //only show invoice link if message type is active. |
674 | - if ( $item->is_primary_registrant() && $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
674 | + if ($item->is_primary_registrant() && $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) { |
|
675 | 675 | $dl_invoice_lnk = ' |
676 | 676 | <li> |
677 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
677 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
678 | 678 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
679 | 679 | </a> |
680 | 680 | </li>'; |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | $dl_invoice_lnk = ''; |
683 | 683 | } |
684 | 684 | |
685 | - return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk, $item, 'ul', 'reg-overview-actions-ul' ); |
|
685 | + return $this->_action_string($view_lnk.$edit_lnk.$resend_reg_lnk.$view_txn_lnk.$dl_invoice_lnk, $item, 'ul', 'reg-overview-actions-ul'); |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | } |
@@ -214,7 +214,7 @@ |
||
214 | 214 | /** |
215 | 215 | * _get_table_filters |
216 | 216 | * @access protected |
217 | - * @return array |
|
217 | + * @return string[] |
|
218 | 218 | */ |
219 | 219 | protected function _get_table_filters() { |
220 | 220 | $filters = array(); |
@@ -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 | * |
4 | 6 | * EED_Ticket_Selector_Caff |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @return EED_Ticket_Selector_Caff |
17 | 17 | */ |
18 | 18 | public static function instance() { |
19 | - return parent::get_instance( __CLASS__ ); |
|
19 | + return parent::get_instance(__CLASS__); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -37,24 +37,24 @@ discard block |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public static function set_hooks_admin() { |
40 | - define( 'TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
41 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Ticket_Selector_Caff', 'template_settings_form' ), 10 ); |
|
42 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Ticket_Selector_Caff', 'update_template_settings' ), 10, 2 ); |
|
40 | + define('TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
41 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Ticket_Selector_Caff', 'template_settings_form'), 10); |
|
42 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Ticket_Selector_Caff', 'update_template_settings'), 10, 2); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
46 | 46 | //just required because of abstract declaration |
47 | - public function run( $WP ) { |
|
47 | + public function run($WP) { |
|
48 | 48 | $this->set_config(); |
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | - protected function set_config(){ |
|
55 | - $this->set_config_section( 'template_settings' ); |
|
56 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
57 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
54 | + protected function set_config() { |
|
55 | + $this->set_config_section('template_settings'); |
|
56 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
57 | + $this->set_config_name('EED_Ticket_Selector'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | 'FHEE__EED_Ticket_Selector_Caff___ticket_selector_settings_form__form_subsections', |
90 | 90 | array( |
91 | 91 | 'appearance_settings_hdr' => new EE_Form_Section_HTML( |
92 | - EEH_HTML::br(2) . |
|
93 | - EEH_HTML::h2( __( 'Ticket Selector Template Settings', 'event_espresso' )) |
|
92 | + EEH_HTML::br(2). |
|
93 | + EEH_HTML::h2(__('Ticket Selector Template Settings', 'event_espresso')) |
|
94 | 94 | ), |
95 | 95 | 'appearance_settings' => EED_Ticket_Selector_Caff::_ticket_selector_appearance_settings() |
96 | 96 | ) |
@@ -114,25 +114,25 @@ discard block |
||
114 | 114 | 'FHEE__EED_Ticket_Selector_Caff___ticket_selector_appearance_settings__form_subsections', array( |
115 | 115 | 'show_ticket_details' => new EE_Yes_No_Input( |
116 | 116 | array( |
117 | - 'html_label_text' => __('Show Ticket Details?', 'event_espresso' ), |
|
118 | - 'html_help_text' => __( 'This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'), |
|
119 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true, |
|
117 | + 'html_label_text' => __('Show Ticket Details?', 'event_espresso'), |
|
118 | + 'html_help_text' => __('This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'), |
|
119 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true, |
|
120 | 120 | 'display_html_label_text' => false |
121 | 121 | ) |
122 | 122 | ), |
123 | 123 | 'show_ticket_sale_columns' => new EE_Yes_No_Input( |
124 | 124 | array( |
125 | - 'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso' ), |
|
126 | - 'html_help_text' => __( 'This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'), |
|
127 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true, |
|
125 | + 'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso'), |
|
126 | + 'html_help_text' => __('This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'), |
|
127 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true, |
|
128 | 128 | 'display_html_label_text' => false |
129 | 129 | ) |
130 | 130 | ), |
131 | 131 | 'show_expired_tickets' => new EE_Yes_No_Input( |
132 | 132 | array( |
133 | - 'html_label_text' => __( 'Show Expired Tickets?', 'event_espresso' ), |
|
134 | - 'html_help_text' => __( 'Indicate whether to show expired tickets in the ticket selector', 'event_espresso' ), |
|
135 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true, |
|
133 | + 'html_label_text' => __('Show Expired Tickets?', 'event_espresso'), |
|
134 | + 'html_help_text' => __('Indicate whether to show expired tickets in the ticket selector', 'event_espresso'), |
|
135 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true, |
|
136 | 136 | 'display_html_label_text' => false |
137 | 137 | ) |
138 | 138 | ) |
@@ -155,21 +155,21 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return void |
157 | 157 | */ |
158 | - public static function update_template_settings( EE_Template_Config $CFG, $REQ ) { |
|
159 | - if ( ! isset( $CFG->EED_Ticket_Selector ) ) { |
|
158 | + public static function update_template_settings(EE_Template_Config $CFG, $REQ) { |
|
159 | + if ( ! isset($CFG->EED_Ticket_Selector)) { |
|
160 | 160 | $CFG->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
161 | 161 | } |
162 | 162 | try { |
163 | 163 | $ticket_selector_form = EED_Ticket_Selector_Caff::_ticket_selector_settings_form(); |
164 | 164 | |
165 | 165 | //check for form submission |
166 | - if ( $ticket_selector_form->was_submitted() ) { |
|
166 | + if ($ticket_selector_form->was_submitted()) { |
|
167 | 167 | |
168 | 168 | //capture form data |
169 | 169 | $ticket_selector_form->receive_form_submission(); |
170 | 170 | |
171 | 171 | //validate form data |
172 | - if ( $ticket_selector_form->is_valid() ) { |
|
172 | + if ($ticket_selector_form->is_valid()) { |
|
173 | 173 | |
174 | 174 | //grab validated data from form |
175 | 175 | $valid_data = $ticket_selector_form->valid_data(); |
@@ -179,13 +179,13 @@ discard block |
||
179 | 179 | $CFG->EED_Ticket_Selector->show_ticket_details = $valid_data['appearance_settings']['show_ticket_details']; |
180 | 180 | $CFG->EED_Ticket_Selector->show_expired_tickets = $valid_data['appearance_settings']['show_expired_tickets']; |
181 | 181 | } else { |
182 | - if ( $ticket_selector_form->submission_error_message() != '' ) { |
|
183 | - EE_Error::add_error( $ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
182 | + if ($ticket_selector_form->submission_error_message() != '') { |
|
183 | + EE_Error::add_error($ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | 187 | } |
188 | - } catch( EE_Error $e ) { |
|
188 | + } catch (EE_Error $e) { |
|
189 | 189 | $e->get_error(); |
190 | 190 | } |
191 | 191 |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Aim extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Aim extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | require_once($this->file_folder().'EEG_Aim.gateway.php'); |
38 | 38 | $this->_gateway = new EEG_AIM(); |
39 | 39 | $this->_pretty_name = __("Authorize.net AIM", 'event_espresso'); |
40 | - $this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' ); |
|
40 | + $this->_default_description = __('Please provide the following billing information.', 'event_espresso'); |
|
41 | 41 | $this->_requires_https = true; |
42 | 42 | parent::__construct($pm_instance); |
43 | 43 | } |
@@ -47,60 +47,60 @@ discard block |
||
47 | 47 | * @param \EE_Transaction $transaction |
48 | 48 | * @return EE_Billing_Info_Form |
49 | 49 | */ |
50 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
51 | - $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance,array( |
|
50 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
51 | + $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance, array( |
|
52 | 52 | 'name'=>'AIM_Form', |
53 | 53 | 'subsections'=>array( |
54 | 54 | 'credit_card'=>new EE_Credit_Card_Input(array( |
55 | 55 | 'required'=>true, |
56 | - 'html_label_text' => __( 'Card Number', 'event_espresso' ) |
|
56 | + 'html_label_text' => __('Card Number', 'event_espresso') |
|
57 | 57 | )), |
58 | 58 | 'exp_month'=>new EE_Credit_Card_Month_Input(true, array( |
59 | 59 | 'required'=>true, |
60 | - 'html_label_text' => __( 'Expiry Month', 'event_espresso' ) |
|
60 | + 'html_label_text' => __('Expiry Month', 'event_espresso') |
|
61 | 61 | )), |
62 | - 'exp_year'=>new EE_Credit_Card_Year_Input( array( |
|
62 | + 'exp_year'=>new EE_Credit_Card_Year_Input(array( |
|
63 | 63 | 'required'=>true, |
64 | - 'html_label_text' => __( 'Expiry Year', 'event_espresso' ) |
|
64 | + 'html_label_text' => __('Expiry Year', 'event_espresso') |
|
65 | 65 | )), |
66 | - 'cvv'=>new EE_CVV_Input( array( |
|
66 | + 'cvv'=>new EE_CVV_Input(array( |
|
67 | 67 | 'required'=>true, |
68 | - 'html_label_text' => __( 'CVV', 'event_espresso' ) ) ), |
|
68 | + 'html_label_text' => __('CVV', 'event_espresso') )), |
|
69 | 69 | ) |
70 | 70 | )); |
71 | - $billing_form->add_subsections( array( |
|
72 | - 'company' => new EE_Text_Input( array( |
|
71 | + $billing_form->add_subsections(array( |
|
72 | + 'company' => new EE_Text_Input(array( |
|
73 | 73 | 'html_label_text' => __('Company', 'event_espresso') |
74 | 74 | )) |
75 | - ), 'email', false ); |
|
75 | + ), 'email', false); |
|
76 | 76 | $billing_form->add_subsections( |
77 | 77 | array( |
78 | - 'fax' => new EE_Text_Input( array( |
|
78 | + 'fax' => new EE_Text_Input(array( |
|
79 | 79 | 'html_label_text' => __('Fax', 'event_espresso') |
80 | 80 | )) |
81 | 81 | ), |
82 | 82 | 'phone', |
83 | 83 | false ); |
84 | 84 | $settings_form = $this->settings_form(); |
85 | - if( $settings_form->get_input( 'excluded_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
86 | - $billing_form->exclude( $settings_form->get_input( 'excluded_billing_inputs' )->normalized_value() ); |
|
85 | + if ($settings_form->get_input('excluded_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
86 | + $billing_form->exclude($settings_form->get_input('excluded_billing_inputs')->normalized_value()); |
|
87 | 87 | } |
88 | - if( $settings_form->get_input( 'required_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
88 | + if ($settings_form->get_input('required_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
89 | 89 | $required_inputs = array_merge( |
90 | 90 | array( |
91 | 91 | 'credit_card', |
92 | 92 | 'exp_month', |
93 | 93 | 'exp_year' ), |
94 | - $settings_form->get_input( 'required_billing_inputs' )->normalized_value() ); |
|
95 | - foreach( $billing_form->inputs() as $input_name => $input ) { |
|
96 | - if( in_array( $input_name, $required_inputs ) ) { |
|
97 | - $input->set_required( true ); |
|
94 | + $settings_form->get_input('required_billing_inputs')->normalized_value() ); |
|
95 | + foreach ($billing_form->inputs() as $input_name => $input) { |
|
96 | + if (in_array($input_name, $required_inputs)) { |
|
97 | + $input->set_required(true); |
|
98 | 98 | } else { |
99 | - $input->set_required( false ); |
|
99 | + $input->set_required(false); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | - return $this->apply_billing_form_debug_settings( $billing_form ); |
|
103 | + return $this->apply_billing_form_debug_settings($billing_form); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -112,19 +112,19 @@ discard block |
||
112 | 112 | * @param \EE_Billing_Info_Form $billing_form |
113 | 113 | * @return \EE_Billing_Info_Form |
114 | 114 | */ |
115 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
116 | - if ( $this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta( 'test_transactions', TRUE, FALSE )) { |
|
117 | - $billing_form->get_input( 'credit_card' )->set_default( '4007000000027' ); |
|
118 | - $billing_form->get_input( 'exp_year' )->set_default( '2020' ); |
|
119 | - if( $billing_form->get_subsection( 'cvv' ) instanceof EE_Form_Input_Base ) { |
|
120 | - $billing_form->get_input( 'cvv' )->set_default(( '123' )); |
|
115 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
116 | + if ($this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta('test_transactions', TRUE, FALSE)) { |
|
117 | + $billing_form->get_input('credit_card')->set_default('4007000000027'); |
|
118 | + $billing_form->get_input('exp_year')->set_default('2020'); |
|
119 | + if ($billing_form->get_subsection('cvv') instanceof EE_Form_Input_Base) { |
|
120 | + $billing_form->get_input('cvv')->set_default(('123')); |
|
121 | 121 | } |
122 | 122 | $billing_form->add_subsections( |
123 | - array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ), |
|
123 | + array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()), |
|
124 | 124 | 'credit_card' |
125 | 125 | ); |
126 | 126 | $billing_form->add_subsections( |
127 | - array( 'debug_content' => new EE_Form_Section_HTML_From_Template( dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php' )), |
|
127 | + array('debug_content' => new EE_Form_Section_HTML_From_Template(dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php')), |
|
128 | 128 | 'first_name' |
129 | 129 | ); |
130 | 130 | } |
@@ -144,17 +144,17 @@ discard block |
||
144 | 144 | 'extra_meta_inputs'=>array( |
145 | 145 | 'login_id'=>new EE_Text_Input( |
146 | 146 | array( |
147 | - 'html_label_text'=> sprintf( __("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link() ), |
|
147 | + 'html_label_text'=> sprintf(__("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link()), |
|
148 | 148 | 'required' => true ) |
149 | 149 | ), |
150 | 150 | 'transaction_key'=>new EE_Text_Input( |
151 | 151 | array( |
152 | - 'html_label_text'=> sprintf( __("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link() ), |
|
152 | + 'html_label_text'=> sprintf(__("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link()), |
|
153 | 153 | 'required' => true ) |
154 | 154 | ), |
155 | 155 | 'test_transactions'=>new EE_Yes_No_Input( |
156 | 156 | array( |
157 | - 'html_label_text'=> sprintf( __("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
157 | + 'html_label_text'=> sprintf(__("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link()), |
|
158 | 158 | 'html_help_text'=> __("Send test transactions, even to live server", 'event_espresso'), |
159 | 159 | 'default' => false, |
160 | 160 | 'required' => true |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | 'excluded_billing_inputs' => new EE_Checkbox_Multi_Input( |
164 | 164 | $billing_input_names, |
165 | 165 | array( |
166 | - 'html_label_text' => sprintf( __("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
166 | + 'html_label_text' => sprintf(__("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
167 | 167 | 'default' => array( |
168 | 168 | 'company', |
169 | 169 | 'fax', |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | 'required_billing_inputs' => new EE_Checkbox_Multi_Input( |
173 | 173 | $billing_input_names, |
174 | 174 | array( |
175 | - 'html_label_text' => sprintf( __("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
175 | + 'html_label_text' => sprintf(__("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
176 | 176 | 'default' => array_diff( |
177 | - array_keys( $billing_input_names ), |
|
178 | - array( 'address2', 'phone', 'company', 'fax' ) |
|
177 | + array_keys($billing_input_names), |
|
178 | + array('address2', 'phone', 'company', 'fax') |
|
179 | 179 | ), |
180 | 180 | 'html_help_text' => __('Note: if fields are excluded they cannot be required.', 'event_espresso') |
181 | 181 | )), |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function billing_input_names() { |
193 | 193 | return array( |
194 | - 'first_name' => __( 'First Name', 'event_espresso' ), |
|
194 | + 'first_name' => __('First Name', 'event_espresso'), |
|
195 | 195 | 'last_name' => __('Last Name', 'event_espresso'), |
196 | - 'email' => __( 'Email', 'event_espresso' ), |
|
197 | - 'company' => __( 'Company', 'event_espresso' ), |
|
196 | + 'email' => __('Email', 'event_espresso'), |
|
197 | + 'company' => __('Company', 'event_espresso'), |
|
198 | 198 | 'address' => __('Address', 'event_espresso'), |
199 | 199 | 'address2' => __('Address2', 'event_espresso'), |
200 | 200 | 'city' => __('City', 'event_espresso'), |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | 'country' => __('Country', 'event_espresso'), |
203 | 203 | 'zip' => __('Zip', 'event_espresso'), |
204 | 204 | 'phone' => __('Phone', 'event_espresso'), |
205 | - 'fax' => __( 'Fax', 'event_espresso' ), |
|
205 | + 'fax' => __('Fax', 'event_espresso'), |
|
206 | 206 | 'cvv' => __('CVV', 'event_espresso') |
207 | 207 | ); |
208 | 208 | } |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | * @param type $billing_form |
214 | 214 | * @return array |
215 | 215 | */ |
216 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
216 | + protected function _get_billing_values_from_form($billing_form) { |
|
217 | 217 | $all_billing_values_empty = array(); |
218 | - foreach( array_keys( $this->billing_input_names() ) as $input_name ) { |
|
219 | - $all_billing_values_empty[ $input_name ] = ''; |
|
218 | + foreach (array_keys($this->billing_input_names()) as $input_name) { |
|
219 | + $all_billing_values_empty[$input_name] = ''; |
|
220 | 220 | } |
221 | 221 | return array_merge( |
222 | 222 | $all_billing_values_empty, |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @see EE_PMT_Base::help_tabs_config() |
232 | 232 | * @return array |
233 | 233 | */ |
234 | - public function help_tabs_config(){ |
|
234 | + public function help_tabs_config() { |
|
235 | 235 | return array( |
236 | 236 | $this->get_help_tab_name() => array( |
237 | 237 | 'title' => __('Authorize.net AIM Settings', 'event_espresso'), |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -160,7 +162,7 @@ discard block |
||
160 | 162 | //support removing a module during a request when it previously existed |
161 | 163 | if( $reinstantiate ){ |
162 | 164 | return self::instance(); |
163 | - }else{ |
|
165 | + } else{ |
|
164 | 166 | return NULL; |
165 | 167 | } |
166 | 168 | } |
@@ -1492,7 +1494,7 @@ discard block |
||
1492 | 1494 | } |
1493 | 1495 | if($query_args){ |
1494 | 1496 | return add_query_arg($query_args,$this->txn_page_url); |
1495 | - }else{ |
|
1497 | + } else{ |
|
1496 | 1498 | return $this->txn_page_url; |
1497 | 1499 | } |
1498 | 1500 | } |
@@ -1509,7 +1511,7 @@ discard block |
||
1509 | 1511 | } |
1510 | 1512 | if($query_args){ |
1511 | 1513 | return add_query_arg($query_args,$this->thank_you_page_url); |
1512 | - }else{ |
|
1514 | + } else{ |
|
1513 | 1515 | return $this->thank_you_page_url; |
1514 | 1516 | } |
1515 | 1517 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public static function instance() { |
130 | 130 | // check if class object is instantiated, and instantiated properly |
131 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
131 | + if ( ! self::$_instance instanceof EE_Config) { |
|
132 | 132 | self::$_instance = new self(); |
133 | 133 | } |
134 | 134 | return self::$_instance; |
@@ -145,22 +145,22 @@ discard block |
||
145 | 145 | * not be ready to instantiate EE_Config currently (eg if the site was put into maintenance mode) |
146 | 146 | * @return EE_Config |
147 | 147 | */ |
148 | - public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE ){ |
|
149 | - if ( $hard_reset ) { |
|
148 | + public static function reset($hard_reset = FALSE, $reinstantiate = TRUE) { |
|
149 | + if ($hard_reset) { |
|
150 | 150 | self::$_instance->_config_option_names = array(); |
151 | 151 | self::$_instance->_initialize_config(); |
152 | 152 | self::$_instance->update_espresso_config(); |
153 | 153 | } |
154 | - if( self::$_instance instanceof EE_Config ){ |
|
154 | + if (self::$_instance instanceof EE_Config) { |
|
155 | 155 | self::$_instance->shutdown(); |
156 | 156 | } |
157 | 157 | self::$_instance = NULL; |
158 | 158 | //we don't need to reset the static properties imo because those should |
159 | 159 | //only change when a module is added or removed. Currently we don't |
160 | 160 | //support removing a module during a request when it previously existed |
161 | - if( $reinstantiate ){ |
|
161 | + if ($reinstantiate) { |
|
162 | 162 | return self::instance(); |
163 | - }else{ |
|
163 | + } else { |
|
164 | 164 | return NULL; |
165 | 165 | } |
166 | 166 | } |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | * @return \EE_Config |
175 | 175 | */ |
176 | 176 | private function __construct() { |
177 | - do_action( 'AHEE__EE_Config__construct__begin',$this ); |
|
178 | - $this->_config_option_names = get_option( 'ee_config_option_names', array() ); |
|
177 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
178 | + $this->_config_option_names = get_option('ee_config_option_names', array()); |
|
179 | 179 | // setup empty config classes |
180 | 180 | $this->_initialize_config(); |
181 | 181 | // load existing EE site settings |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | // confirm everything loaded correctly and set filtered defaults if not |
184 | 184 | $this->_verify_config(); |
185 | 185 | // register shortcodes and modules |
186 | - add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 ); |
|
186 | + add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999); |
|
187 | 187 | // initialize shortcodes and modules |
188 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' )); |
|
188 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
189 | 189 | // register widgets |
190 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
190 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
191 | 191 | // shutdown |
192 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
192 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
193 | 193 | // construct__end hook |
194 | - do_action( 'AHEE__EE_Config__construct__end',$this ); |
|
194 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
195 | 195 | // hardcoded hack |
196 | 196 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
197 | 197 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @return string current theme set. |
205 | 205 | */ |
206 | 206 | public static function get_current_theme() { |
207 | - return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
207 | + return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -238,27 +238,27 @@ discard block |
||
238 | 238 | */ |
239 | 239 | private function _load_core_config() { |
240 | 240 | // load_core_config__start hook |
241 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
241 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
242 | 242 | $espresso_config = $this->get_espresso_config(); |
243 | - foreach ( $espresso_config as $config => $settings ) { |
|
243 | + foreach ($espresso_config as $config => $settings) { |
|
244 | 244 | // load_core_config__start hook |
245 | - $settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this ); |
|
246 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
247 | - $this->$config = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
245 | + $settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this); |
|
246 | + if (is_object($settings) && property_exists($this, $config)) { |
|
247 | + $this->$config = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
248 | 248 | //call configs populate method to ensure any defaults are set for empty values. |
249 | - if ( method_exists( $settings, 'populate' ) ) { |
|
249 | + if (method_exists($settings, 'populate')) { |
|
250 | 250 | $this->$config->populate(); |
251 | 251 | } |
252 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
252 | + if (method_exists($settings, 'do_hooks')) { |
|
253 | 253 | $this->$config->do_hooks(); |
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
257 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) { |
|
257 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) { |
|
258 | 258 | $this->update_espresso_config(); |
259 | 259 | } |
260 | 260 | // load_core_config__end hook |
261 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
261 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -272,40 +272,40 @@ discard block |
||
272 | 272 | protected function _verify_config() { |
273 | 273 | |
274 | 274 | $this->core = $this->core instanceof EE_Core_Config |
275 | - ? $this->core : new EE_Core_Config(); |
|
276 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
275 | + ? $this->core : new EE_Core_Config(); |
|
276 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
277 | 277 | |
278 | 278 | $this->organization = $this->organization instanceof EE_Organization_Config |
279 | - ? $this->organization : new EE_Organization_Config(); |
|
280 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
279 | + ? $this->organization : new EE_Organization_Config(); |
|
280 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
281 | 281 | |
282 | 282 | $this->currency = $this->currency instanceof EE_Currency_Config |
283 | 283 | ? $this->currency : new EE_Currency_Config(); |
284 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
284 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
285 | 285 | |
286 | 286 | $this->registration = $this->registration instanceof EE_Registration_Config |
287 | 287 | ? $this->registration : new EE_Registration_Config(); |
288 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
288 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
289 | 289 | |
290 | 290 | $this->admin = $this->admin instanceof EE_Admin_Config |
291 | 291 | ? $this->admin : new EE_Admin_Config(); |
292 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
292 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
293 | 293 | |
294 | 294 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
295 | 295 | ? $this->template_settings : new EE_Template_Config(); |
296 | - $this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings ); |
|
296 | + $this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings); |
|
297 | 297 | |
298 | 298 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
299 | 299 | ? $this->map_settings : new EE_Map_Config(); |
300 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
300 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
301 | 301 | |
302 | 302 | $this->environment = $this->environment instanceof EE_Environment_Config |
303 | 303 | ? $this->environment : new EE_Environment_Config(); |
304 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
304 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
305 | 305 | |
306 | 306 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
307 | 307 | ? $this->gateway : new EE_Gateway_Config(); |
308 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
308 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
309 | 309 | |
310 | 310 | } |
311 | 311 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function get_espresso_config() { |
321 | 321 | // grab espresso configuration |
322 | - return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() )); |
|
322 | + return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array())); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -332,12 +332,12 @@ discard block |
||
332 | 332 | * @param $old_value |
333 | 333 | * @param $value |
334 | 334 | */ |
335 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
335 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
336 | 336 | // make sure we're checking the ee config |
337 | - if ( $option == 'ee_config' ) { |
|
337 | + if ($option == 'ee_config') { |
|
338 | 338 | // run a loose comparison of the old value against the new value for type and properties, |
339 | 339 | // but NOT exact instance like WP update_option does |
340 | - if ( $value != $old_value ) { |
|
340 | + if ($value != $old_value) { |
|
341 | 341 | // if they are NOT the same, then remove the hook, |
342 | 342 | // which means the subsequent update results will be based solely on the update query results |
343 | 343 | // the reason we do this is because, as stated above, |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | // the string it sees in the db looks the same as the new one it has been passed!!! |
353 | 353 | // This results in the query returning an "affected rows" value of ZERO, |
354 | 354 | // which gets returned immediately by WP update_option and looks like an error. |
355 | - remove_action( 'update_option', array( $this, 'check_config_updated' )); |
|
355 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | } |
@@ -367,11 +367,11 @@ discard block |
||
367 | 367 | */ |
368 | 368 | protected function _reset_espresso_addon_config() { |
369 | 369 | $this->_config_option_names = array(); |
370 | - foreach( $this->addons as $addon_name => $addon_config_obj ) { |
|
371 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
372 | - $config_class = get_class( $addon_config_obj ); |
|
373 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
374 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE ); |
|
370 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
371 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
372 | + $config_class = get_class($addon_config_obj); |
|
373 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
374 | + $this->update_config('addons', $addon_name, $addon_config_obj, FALSE); |
|
375 | 375 | } |
376 | 376 | $this->addons->$addon_name = NULL; |
377 | 377 | } |
@@ -387,17 +387,17 @@ discard block |
||
387 | 387 | * @param bool $add_error |
388 | 388 | * @return bool |
389 | 389 | */ |
390 | - public function update_espresso_config( $add_success = FALSE, $add_error = TRUE ) { |
|
390 | + public function update_espresso_config($add_success = FALSE, $add_error = TRUE) { |
|
391 | 391 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
392 | 392 | //$clone = clone( self::$_instance ); |
393 | 393 | //self::$_instance = NULL; |
394 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this ); |
|
394 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
395 | 395 | $this->_reset_espresso_addon_config(); |
396 | 396 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
397 | 397 | // but BEFORE the actual update occurs |
398 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
398 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
399 | 399 | // now update "ee_config" |
400 | - $saved = update_option( 'ee_config', $this ); |
|
400 | + $saved = update_option('ee_config', $this); |
|
401 | 401 | // if not saved... check if the hook we just added still exists; |
402 | 402 | // if it does, it means one of two things: |
403 | 403 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -408,25 +408,25 @@ discard block |
||
408 | 408 | // but just means no update occurred, so don't display an error to the user. |
409 | 409 | // BUT... if update_option returns FALSE, AND the hook is missing, |
410 | 410 | // then it means that something truly went wrong |
411 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved; |
|
411 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
412 | 412 | // remove our action since we don't want it in the system anymore |
413 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
414 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
413 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
414 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
415 | 415 | //self::$_instance = $clone; |
416 | 416 | //unset( $clone ); |
417 | 417 | // if config remains the same or was updated successfully |
418 | - if ( $saved ) { |
|
419 | - if ( $add_success ) { |
|
418 | + if ($saved) { |
|
419 | + if ($add_success) { |
|
420 | 420 | EE_Error::add_success( |
421 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
421 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
422 | 422 | __FILE__, __FUNCTION__, __LINE__ |
423 | 423 | ); |
424 | 424 | } |
425 | 425 | return TRUE; |
426 | 426 | } else { |
427 | - if ( $add_error ) { |
|
427 | + if ($add_error) { |
|
428 | 428 | EE_Error::add_error( |
429 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
429 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
430 | 430 | __FILE__, __FUNCTION__, __LINE__ |
431 | 431 | ); |
432 | 432 | } |
@@ -452,20 +452,20 @@ discard block |
||
452 | 452 | $name = '', |
453 | 453 | $config_class = '', |
454 | 454 | $config_obj = NULL, |
455 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
455 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
456 | 456 | $display_errors = TRUE |
457 | 457 | ) { |
458 | 458 | try { |
459 | - foreach ( $tests_to_run as $test ) { |
|
460 | - switch ( $test ) { |
|
459 | + foreach ($tests_to_run as $test) { |
|
460 | + switch ($test) { |
|
461 | 461 | |
462 | 462 | // TEST #1 : check that section was set |
463 | 463 | case 1 : |
464 | - if ( empty( $section ) ) { |
|
465 | - if ( $display_errors ) { |
|
464 | + if (empty($section)) { |
|
465 | + if ($display_errors) { |
|
466 | 466 | throw new EE_Error( |
467 | 467 | sprintf( |
468 | - __( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ), |
|
468 | + __('No configuration section has been provided while attempting to save "%s".', 'event_espresso'), |
|
469 | 469 | $config_class |
470 | 470 | ) |
471 | 471 | ); |
@@ -476,11 +476,11 @@ discard block |
||
476 | 476 | |
477 | 477 | // TEST #2 : check that settings section exists |
478 | 478 | case 2 : |
479 | - if ( ! isset( $this->{$section} ) ) { |
|
480 | - if ( $display_errors ) { |
|
479 | + if ( ! isset($this->{$section} )) { |
|
480 | + if ($display_errors) { |
|
481 | 481 | throw new EE_Error( |
482 | - sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
483 | - $section ) |
|
482 | + sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'), |
|
483 | + $section) |
|
484 | 484 | ); |
485 | 485 | } |
486 | 486 | return false; |
@@ -490,12 +490,12 @@ discard block |
||
490 | 490 | // TEST #3 : check that section is the proper format |
491 | 491 | case 3 : |
492 | 492 | if ( |
493 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
493 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
494 | 494 | ) { |
495 | - if ( $display_errors ) { |
|
495 | + if ($display_errors) { |
|
496 | 496 | throw new EE_Error( |
497 | 497 | sprintf( |
498 | - __( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ), |
|
498 | + __('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'), |
|
499 | 499 | $section |
500 | 500 | ) |
501 | 501 | ); |
@@ -506,10 +506,10 @@ discard block |
||
506 | 506 | |
507 | 507 | // TEST #4 : check that config section name has been set |
508 | 508 | case 4 : |
509 | - if ( empty( $name ) ) { |
|
510 | - if ( $display_errors ) { |
|
509 | + if (empty($name)) { |
|
510 | + if ($display_errors) { |
|
511 | 511 | throw new EE_Error( |
512 | - __( 'No name has been provided for the specific configuration section.', 'event_espresso' ) |
|
512 | + __('No name has been provided for the specific configuration section.', 'event_espresso') |
|
513 | 513 | ); |
514 | 514 | } |
515 | 515 | return false; |
@@ -518,10 +518,10 @@ discard block |
||
518 | 518 | |
519 | 519 | // TEST #5 : check that a config class name has been set |
520 | 520 | case 5 : |
521 | - if ( empty( $config_class ) ) { |
|
522 | - if ( $display_errors ) { |
|
521 | + if (empty($config_class)) { |
|
522 | + if ($display_errors) { |
|
523 | 523 | throw new EE_Error( |
524 | - __( 'No class name has been provided for the specific configuration section.', 'event_espresso' ) |
|
524 | + __('No class name has been provided for the specific configuration section.', 'event_espresso') |
|
525 | 525 | ); |
526 | 526 | } |
527 | 527 | return false; |
@@ -530,11 +530,11 @@ discard block |
||
530 | 530 | |
531 | 531 | // TEST #6 : verify config class is accessible |
532 | 532 | case 6 : |
533 | - if ( ! class_exists( $config_class ) ) { |
|
534 | - if ( $display_errors ) { |
|
533 | + if ( ! class_exists($config_class)) { |
|
534 | + if ($display_errors) { |
|
535 | 535 | throw new EE_Error( |
536 | 536 | sprintf( |
537 | - __( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ), |
|
537 | + __('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'), |
|
538 | 538 | $config_class |
539 | 539 | ) |
540 | 540 | ); |
@@ -545,11 +545,11 @@ discard block |
||
545 | 545 | |
546 | 546 | // TEST #7 : check that config has even been set |
547 | 547 | case 7 : |
548 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
549 | - if ( $display_errors ) { |
|
548 | + if ( ! isset($this->{$section}->{$name} )) { |
|
549 | + if ($display_errors) { |
|
550 | 550 | throw new EE_Error( |
551 | 551 | sprintf( |
552 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
552 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
553 | 553 | $section, |
554 | 554 | $name |
555 | 555 | ) |
@@ -558,17 +558,17 @@ discard block |
||
558 | 558 | return false; |
559 | 559 | } else { |
560 | 560 | // and make sure it's not serialized |
561 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
561 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
562 | 562 | } |
563 | 563 | break; |
564 | 564 | |
565 | 565 | // TEST #8 : check that config is the requested type |
566 | 566 | case 8 : |
567 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
568 | - if ( $display_errors ) { |
|
567 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
568 | + if ($display_errors) { |
|
569 | 569 | throw new EE_Error( |
570 | 570 | sprintf( |
571 | - __( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ), |
|
571 | + __('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'), |
|
572 | 572 | $section, |
573 | 573 | $name, |
574 | 574 | $config_class |
@@ -581,12 +581,12 @@ discard block |
||
581 | 581 | |
582 | 582 | // TEST #9 : verify config object |
583 | 583 | case 9 : |
584 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
585 | - if ( $display_errors ) { |
|
584 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
585 | + if ($display_errors) { |
|
586 | 586 | throw new EE_Error( |
587 | 587 | sprintf( |
588 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
589 | - print_r( $config_obj, true ) |
|
588 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
589 | + print_r($config_obj, true) |
|
590 | 590 | ) |
591 | 591 | ); |
592 | 592 | } |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | } |
598 | 598 | } |
599 | 599 | |
600 | - } catch( EE_Error $e ) { |
|
600 | + } catch (EE_Error $e) { |
|
601 | 601 | $e->get_error(); |
602 | 602 | } |
603 | 603 | // you have successfully run the gauntlet |
@@ -614,8 +614,8 @@ discard block |
||
614 | 614 | * @param string $name |
615 | 615 | * @return string |
616 | 616 | */ |
617 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
618 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
617 | + private function _generate_config_option_name($section = '', $name = '') { |
|
618 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | |
@@ -629,10 +629,10 @@ discard block |
||
629 | 629 | * @param string $name |
630 | 630 | * @return string |
631 | 631 | */ |
632 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
633 | - return ! empty( $config_class ) |
|
632 | + private function _set_config_class($config_class = '', $name = '') { |
|
633 | + return ! empty($config_class) |
|
634 | 634 | ? $config_class |
635 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
635 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -646,34 +646,34 @@ discard block |
||
646 | 646 | * @param EE_Config_Base $config_obj |
647 | 647 | * @return EE_Config_Base |
648 | 648 | */ |
649 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
649 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
650 | 650 | // ensure config class is set to something |
651 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
651 | + $config_class = $this->_set_config_class($config_class, $name); |
|
652 | 652 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
653 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) { |
|
653 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
654 | 654 | return null; |
655 | 655 | } |
656 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
656 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
657 | 657 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
658 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
659 | - $this->_config_option_names[ $config_option_name ] = $config_class; |
|
658 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
659 | + $this->_config_option_names[$config_option_name] = $config_class; |
|
660 | 660 | } |
661 | 661 | // verify the incoming config object but suppress errors |
662 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) { |
|
662 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
663 | 663 | $config_obj = new $config_class(); |
664 | 664 | } |
665 | - if ( get_option( $config_option_name ) ) { |
|
666 | - update_option( $config_option_name, $config_obj ); |
|
665 | + if (get_option($config_option_name)) { |
|
666 | + update_option($config_option_name, $config_obj); |
|
667 | 667 | $this->{$section}->{$name} = $config_obj; |
668 | 668 | return $this->{$section}->{$name}; |
669 | 669 | } else { |
670 | 670 | // create a wp-option for this config |
671 | - if ( add_option( $config_option_name, $config_obj, '', 'no' )) { |
|
672 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
671 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
672 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
673 | 673 | return $this->{$section}->{$name}; |
674 | 674 | } else { |
675 | 675 | EE_Error::add_error( |
676 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
676 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
677 | 677 | __FILE__, __FUNCTION__, __LINE__ |
678 | 678 | ); |
679 | 679 | return null; |
@@ -694,37 +694,37 @@ discard block |
||
694 | 694 | * @param bool $throw_errors |
695 | 695 | * @return bool |
696 | 696 | */ |
697 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
698 | - $config_obj = maybe_unserialize( $config_obj ); |
|
697 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
698 | + $config_obj = maybe_unserialize($config_obj); |
|
699 | 699 | // get class name of the incoming object |
700 | - $config_class = get_class( $config_obj ); |
|
700 | + $config_class = get_class($config_obj); |
|
701 | 701 | // run tests 1-5 and 9 to verify config |
702 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) { |
|
702 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) { |
|
703 | 703 | return false; |
704 | 704 | } |
705 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
705 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
706 | 706 | // check if config object has been added to db by seeing if config option name is in $this->_config_option_names array |
707 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
707 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
708 | 708 | // save new config to db |
709 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
709 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
710 | 710 | } else { |
711 | 711 | // first check if the record already exists |
712 | - $existing_config = get_option( $config_option_name ); |
|
713 | - $config_obj = serialize( $config_obj ); |
|
712 | + $existing_config = get_option($config_option_name); |
|
713 | + $config_obj = serialize($config_obj); |
|
714 | 714 | // just return if db record is already up to date |
715 | - if ( $existing_config == $config_obj ) { |
|
715 | + if ($existing_config == $config_obj) { |
|
716 | 716 | $this->{$section}->{$name} = $config_obj; |
717 | 717 | return true; |
718 | - } else if ( update_option( $config_option_name, $config_obj )) { |
|
718 | + } else if (update_option($config_option_name, $config_obj)) { |
|
719 | 719 | // update wp-option for this config class |
720 | 720 | $this->{$section}->{$name} = $config_obj; |
721 | 721 | return true; |
722 | - } elseif ( $throw_errors ) { |
|
722 | + } elseif ($throw_errors) { |
|
723 | 723 | EE_Error::add_error( |
724 | 724 | sprintf( |
725 | - __( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ), |
|
725 | + __('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'), |
|
726 | 726 | $config_class, |
727 | - 'EE_Config->' . $section . '->' . $name |
|
727 | + 'EE_Config->'.$section.'->'.$name |
|
728 | 728 | ), |
729 | 729 | __FILE__, __FUNCTION__, __LINE__ |
730 | 730 | ); |
@@ -744,34 +744,34 @@ discard block |
||
744 | 744 | * @param string $config_class |
745 | 745 | * @return mixed EE_Config_Base | NULL |
746 | 746 | */ |
747 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
747 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
748 | 748 | // ensure config class is set to something |
749 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
749 | + $config_class = $this->_set_config_class($config_class, $name); |
|
750 | 750 | // run tests 1-4, 6 and 7 to verify that all params have been set |
751 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) { |
|
751 | + if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) { |
|
752 | 752 | return NULL; |
753 | 753 | } |
754 | 754 | // now test if the requested config object exists, but suppress errors |
755 | - if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) { |
|
755 | + if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) { |
|
756 | 756 | // config already exists, so pass it back |
757 | 757 | return $this->{$section}->{$name}; |
758 | 758 | } |
759 | 759 | // load config option from db if it exists |
760 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name )); |
|
760 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
761 | 761 | // verify the newly retrieved config object, but suppress errors |
762 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) { |
|
762 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) { |
|
763 | 763 | // config is good, so set it and pass it back |
764 | 764 | $this->{$section}->{$name} = $config_obj; |
765 | 765 | return $this->{$section}->{$name}; |
766 | 766 | } |
767 | 767 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
768 | - $config_obj =$this->set_config( $section, $name, $config_class ); |
|
768 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
769 | 769 | // verify the newly created config object |
770 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) { |
|
770 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
771 | 771 | return $this->{$section}->{$name}; |
772 | 772 | } else { |
773 | 773 | EE_Error::add_error( |
774 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
774 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
775 | 775 | __FILE__, __FUNCTION__, __LINE__ |
776 | 776 | ); |
777 | 777 | } |
@@ -786,9 +786,9 @@ discard block |
||
786 | 786 | * @param string $config_option_name |
787 | 787 | * @return mixed EE_Config_Base | FALSE |
788 | 788 | */ |
789 | - public function get_config_option( $config_option_name = '' ) { |
|
789 | + public function get_config_option($config_option_name = '') { |
|
790 | 790 | // retrieve the wp-option for this config class. |
791 | - return maybe_unserialize( get_option( $config_option_name )); |
|
791 | + return maybe_unserialize(get_option($config_option_name)); |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | |
@@ -801,45 +801,45 @@ discard block |
||
801 | 801 | * @param $page_for_posts |
802 | 802 | * @return void |
803 | 803 | */ |
804 | - public function update_post_shortcodes( $page_for_posts = '' ) { |
|
804 | + public function update_post_shortcodes($page_for_posts = '') { |
|
805 | 805 | // make sure page_for_posts is set |
806 | - $page_for_posts = ! empty( $page_for_posts ) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
806 | + $page_for_posts = ! empty($page_for_posts) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
807 | 807 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
808 | 808 | $critical_shortcodes = $this->core->get_critical_pages_shortcodes_array(); |
809 | 809 | // allow others to mess stuff up :D |
810 | - do_action( 'AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts ); |
|
810 | + do_action('AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts); |
|
811 | 811 | // verify that post_shortcodes is set |
812 | - $this->core->post_shortcodes = isset( $this->core->post_shortcodes ) && is_array( $this->core->post_shortcodes ) ? $this->core->post_shortcodes : array(); |
|
812 | + $this->core->post_shortcodes = isset($this->core->post_shortcodes) && is_array($this->core->post_shortcodes) ? $this->core->post_shortcodes : array(); |
|
813 | 813 | // cycle thru post_shortcodes |
814 | - foreach( $this->core->post_shortcodes as $post_name => $shortcodes ){ |
|
814 | + foreach ($this->core->post_shortcodes as $post_name => $shortcodes) { |
|
815 | 815 | // are there any shortcodes to track ? |
816 | - if ( ! empty( $shortcodes )) { |
|
816 | + if ( ! empty($shortcodes)) { |
|
817 | 817 | // loop thru list of tracked shortcodes |
818 | - foreach( $shortcodes as $shortcode => $post_id ) { |
|
818 | + foreach ($shortcodes as $shortcode => $post_id) { |
|
819 | 819 | // if shortcode is for a critical page, BUT this is NOT the corresponding critical page for that shortcode |
820 | - if ( isset( $critical_shortcodes[ $post_id ] ) && $post_name == $page_for_posts ) { |
|
820 | + if (isset($critical_shortcodes[$post_id]) && $post_name == $page_for_posts) { |
|
821 | 821 | // then remove this shortcode, because we don't want critical page shortcodes like ESPRESSO_TXN_PAGE running on the "Posts Page" (blog) |
822 | - unset( $this->core->post_shortcodes[ $post_name ][ $shortcode ] ); |
|
822 | + unset($this->core->post_shortcodes[$post_name][$shortcode]); |
|
823 | 823 | } |
824 | 824 | // skip the posts page, because we want all shortcodes registered for it |
825 | - if ( $post_name == $page_for_posts ) { |
|
825 | + if ($post_name == $page_for_posts) { |
|
826 | 826 | continue; |
827 | 827 | } |
828 | 828 | // make sure post still exists |
829 | - $post = get_post( $post_id ); |
|
830 | - if ( $post ) { |
|
829 | + $post = get_post($post_id); |
|
830 | + if ($post) { |
|
831 | 831 | // check that the post name matches what we have saved |
832 | - if ( $post->post_name == $post_name ) { |
|
832 | + if ($post->post_name == $post_name) { |
|
833 | 833 | // if so, then break before hitting the unset below |
834 | 834 | continue; |
835 | 835 | } |
836 | 836 | } |
837 | 837 | // we don't like missing posts around here >:( |
838 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
838 | + unset($this->core->post_shortcodes[$post_name]); |
|
839 | 839 | } |
840 | 840 | } else { |
841 | 841 | // you got no shortcodes to keep track of ! |
842 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
842 | + unset($this->core->post_shortcodes[$post_name]); |
|
843 | 843 | } |
844 | 844 | } |
845 | 845 | //only show errors |
@@ -858,14 +858,14 @@ discard block |
||
858 | 858 | * @return string |
859 | 859 | */ |
860 | 860 | public static function get_page_for_posts() { |
861 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
862 | - if ( ! $page_for_posts ) { |
|
861 | + $page_for_posts = get_option('page_for_posts'); |
|
862 | + if ( ! $page_for_posts) { |
|
863 | 863 | return 'posts'; |
864 | 864 | } |
865 | 865 | /** @type WPDB $wpdb */ |
866 | 866 | global $wpdb; |
867 | 867 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
868 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts )); |
|
868 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | |
@@ -881,11 +881,11 @@ discard block |
||
881 | 881 | * @return void |
882 | 882 | */ |
883 | 883 | public function register_shortcodes_and_modules() { |
884 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
884 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
885 | 885 | return; |
886 | 886 | } |
887 | 887 | // allow shortcodes to register with WP and to set hooks for the rest of the system |
888 | - EE_Registry::instance()->shortcodes =$this->_register_shortcodes(); |
|
888 | + EE_Registry::instance()->shortcodes = $this->_register_shortcodes(); |
|
889 | 889 | // allow modules to set hooks for the rest of the system |
890 | 890 | EE_Registry::instance()->modules = $this->_register_modules(); |
891 | 891 | } |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | * @return void |
900 | 900 | */ |
901 | 901 | public function initialize_shortcodes_and_modules() { |
902 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
902 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
903 | 903 | return; |
904 | 904 | } |
905 | 905 | // allow shortcodes to set hooks for the rest of the system |
@@ -918,26 +918,26 @@ discard block |
||
918 | 918 | * @return void |
919 | 919 | */ |
920 | 920 | public function widgets_init() { |
921 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
921 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
922 | 922 | return; |
923 | 923 | } |
924 | 924 | //only init widgets on admin pages when not in complete maintenance, and |
925 | 925 | //on frontend when not in any maintenance mode |
926 | - if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level() ) { |
|
926 | + if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) { |
|
927 | 927 | // grab list of installed widgets |
928 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
928 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
929 | 929 | // filter list of modules to register |
930 | - $widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register ); |
|
930 | + $widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register); |
|
931 | 931 | |
932 | - if ( ! empty( $widgets_to_register ) ) { |
|
932 | + if ( ! empty($widgets_to_register)) { |
|
933 | 933 | // cycle thru widget folders |
934 | - foreach ( $widgets_to_register as $widget_path ) { |
|
934 | + foreach ($widgets_to_register as $widget_path) { |
|
935 | 935 | // add to list of installed widget modules |
936 | - EE_Config::register_ee_widget( $widget_path ); |
|
936 | + EE_Config::register_ee_widget($widget_path); |
|
937 | 937 | } |
938 | 938 | } |
939 | 939 | // filter list of installed modules |
940 | - EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets ); |
|
940 | + EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets); |
|
941 | 941 | } |
942 | 942 | } |
943 | 943 | |
@@ -950,54 +950,54 @@ discard block |
||
950 | 950 | * @param string $widget_path - full path up to and including widget folder |
951 | 951 | * @return void |
952 | 952 | */ |
953 | - public static function register_ee_widget( $widget_path = NULL ) { |
|
954 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
953 | + public static function register_ee_widget($widget_path = NULL) { |
|
954 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
955 | 955 | $widget_ext = '.widget.php'; |
956 | 956 | // make all separators match |
957 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
957 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
958 | 958 | // does the file path INCLUDE the actual file name as part of the path ? |
959 | - if ( strpos( $widget_path, $widget_ext ) !== FALSE ) { |
|
959 | + if (strpos($widget_path, $widget_ext) !== FALSE) { |
|
960 | 960 | // grab and shortcode file name from directory name and break apart at dots |
961 | - $file_name = explode( '.', basename( $widget_path )); |
|
961 | + $file_name = explode('.', basename($widget_path)); |
|
962 | 962 | // take first segment from file name pieces and remove class prefix if it exists |
963 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
963 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
964 | 964 | // sanitize shortcode directory name |
965 | - $widget = sanitize_key( $widget ); |
|
965 | + $widget = sanitize_key($widget); |
|
966 | 966 | // now we need to rebuild the shortcode path |
967 | - $widget_path = explode( DS, $widget_path ); |
|
967 | + $widget_path = explode(DS, $widget_path); |
|
968 | 968 | // remove last segment |
969 | - array_pop( $widget_path ); |
|
969 | + array_pop($widget_path); |
|
970 | 970 | // glue it back together |
971 | - $widget_path = implode( DS, $widget_path ); |
|
971 | + $widget_path = implode(DS, $widget_path); |
|
972 | 972 | } else { |
973 | 973 | // grab and sanitize widget directory name |
974 | - $widget = sanitize_key( basename( $widget_path )); |
|
974 | + $widget = sanitize_key(basename($widget_path)); |
|
975 | 975 | } |
976 | 976 | // create classname from widget directory name |
977 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ))); |
|
977 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
978 | 978 | // add class prefix |
979 | - $widget_class = 'EEW_' . $widget; |
|
979 | + $widget_class = 'EEW_'.$widget; |
|
980 | 980 | // does the widget exist ? |
981 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) { |
|
981 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
982 | 982 | $msg = sprintf( |
983 | - __( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ), |
|
983 | + __('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'), |
|
984 | 984 | $widget_class, |
985 | - $widget_path . DS . $widget_class . $widget_ext |
|
985 | + $widget_path.DS.$widget_class.$widget_ext |
|
986 | 986 | ); |
987 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
987 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
988 | 988 | return; |
989 | 989 | } |
990 | 990 | // load the widget class file |
991 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
991 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
992 | 992 | // verify that class exists |
993 | - if ( ! class_exists( $widget_class )) { |
|
994 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
995 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
993 | + if ( ! class_exists($widget_class)) { |
|
994 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
995 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
996 | 996 | return; |
997 | 997 | } |
998 | - register_widget( $widget_class ); |
|
998 | + register_widget($widget_class); |
|
999 | 999 | // add to array of registered widgets |
1000 | - EE_Registry::instance()->widgets->$widget_class = $widget_path . DS . $widget_class . $widget_ext; |
|
1000 | + EE_Registry::instance()->widgets->$widget_class = $widget_path.DS.$widget_class.$widget_ext; |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | |
@@ -1010,18 +1010,18 @@ discard block |
||
1010 | 1010 | */ |
1011 | 1011 | private function _register_shortcodes() { |
1012 | 1012 | // grab list of installed shortcodes |
1013 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1013 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1014 | 1014 | // filter list of modules to register |
1015 | - $shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register ); |
|
1016 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1015 | + $shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register); |
|
1016 | + if ( ! empty($shortcodes_to_register)) { |
|
1017 | 1017 | // cycle thru shortcode folders |
1018 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1018 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1019 | 1019 | // add to list of installed shortcode modules |
1020 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1020 | + EE_Config::register_shortcode($shortcode_path); |
|
1021 | 1021 | } |
1022 | 1022 | } |
1023 | 1023 | // filter list of installed modules |
1024 | - return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes ); |
|
1024 | + return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes); |
|
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | |
@@ -1033,56 +1033,56 @@ discard block |
||
1033 | 1033 | * @param string $shortcode_path - full path up to and including shortcode folder |
1034 | 1034 | * @return bool |
1035 | 1035 | */ |
1036 | - public static function register_shortcode( $shortcode_path = NULL ) { |
|
1037 | - do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path ); |
|
1036 | + public static function register_shortcode($shortcode_path = NULL) { |
|
1037 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1038 | 1038 | $shortcode_ext = '.shortcode.php'; |
1039 | 1039 | // make all separators match |
1040 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1040 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1041 | 1041 | // does the file path INCLUDE the actual file name as part of the path ? |
1042 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) { |
|
1042 | + if (strpos($shortcode_path, $shortcode_ext) !== FALSE) { |
|
1043 | 1043 | // grab shortcode file name from directory name and break apart at dots |
1044 | - $shortcode_file = explode( '.', basename( $shortcode_path )); |
|
1044 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1045 | 1045 | // take first segment from file name pieces and remove class prefix if it exists |
1046 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0]; |
|
1046 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0]; |
|
1047 | 1047 | // sanitize shortcode directory name |
1048 | - $shortcode = sanitize_key( $shortcode ); |
|
1048 | + $shortcode = sanitize_key($shortcode); |
|
1049 | 1049 | // now we need to rebuild the shortcode path |
1050 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1050 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1051 | 1051 | // remove last segment |
1052 | - array_pop( $shortcode_path ); |
|
1052 | + array_pop($shortcode_path); |
|
1053 | 1053 | // glue it back together |
1054 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1054 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1055 | 1055 | } else { |
1056 | 1056 | // we need to generate the filename based off of the folder name |
1057 | 1057 | // grab and sanitize shortcode directory name |
1058 | - $shortcode = sanitize_key( basename( $shortcode_path )); |
|
1059 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1058 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1059 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1060 | 1060 | } |
1061 | 1061 | // create classname from shortcode directory or file name |
1062 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ))); |
|
1062 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1063 | 1063 | // add class prefix |
1064 | - $shortcode_class = 'EES_' . $shortcode; |
|
1064 | + $shortcode_class = 'EES_'.$shortcode; |
|
1065 | 1065 | // does the shortcode exist ? |
1066 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) { |
|
1066 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1067 | 1067 | $msg = sprintf( |
1068 | - __( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ), |
|
1068 | + __('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'), |
|
1069 | 1069 | $shortcode_class, |
1070 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1070 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1071 | 1071 | ); |
1072 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1072 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1073 | 1073 | return FALSE; |
1074 | 1074 | } |
1075 | 1075 | // load the shortcode class file |
1076 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1076 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1077 | 1077 | // verify that class exists |
1078 | - if ( ! class_exists( $shortcode_class )) { |
|
1079 | - $msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class ); |
|
1080 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1078 | + if ( ! class_exists($shortcode_class)) { |
|
1079 | + $msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class); |
|
1080 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1081 | 1081 | return FALSE; |
1082 | 1082 | } |
1083 | - $shortcode = strtoupper( $shortcode ); |
|
1083 | + $shortcode = strtoupper($shortcode); |
|
1084 | 1084 | // add to array of registered shortcodes |
1085 | - EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1085 | + EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1086 | 1086 | return TRUE; |
1087 | 1087 | } |
1088 | 1088 | |
@@ -1097,23 +1097,23 @@ discard block |
||
1097 | 1097 | */ |
1098 | 1098 | private function _register_modules() { |
1099 | 1099 | // grab list of installed modules |
1100 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1100 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1101 | 1101 | // filter list of modules to register |
1102 | - $modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register ); |
|
1102 | + $modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register); |
|
1103 | 1103 | |
1104 | 1104 | |
1105 | - if ( ! empty( $modules_to_register ) ) { |
|
1105 | + if ( ! empty($modules_to_register)) { |
|
1106 | 1106 | // loop through folders |
1107 | - foreach ( $modules_to_register as $module_path ) { |
|
1107 | + foreach ($modules_to_register as $module_path) { |
|
1108 | 1108 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1109 | - if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) { |
|
1109 | + if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') { |
|
1110 | 1110 | // add to list of installed modules |
1111 | - EE_Config::register_module( $module_path ); |
|
1111 | + EE_Config::register_module($module_path); |
|
1112 | 1112 | } |
1113 | 1113 | } |
1114 | 1114 | } |
1115 | 1115 | // filter list of installed modules |
1116 | - return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules ); |
|
1116 | + return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules); |
|
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | |
@@ -1126,54 +1126,54 @@ discard block |
||
1126 | 1126 | * @param string $module_path - full path up to and including module folder |
1127 | 1127 | * @return bool |
1128 | 1128 | */ |
1129 | - public static function register_module( $module_path = NULL ) { |
|
1130 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1129 | + public static function register_module($module_path = NULL) { |
|
1130 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1131 | 1131 | $module_ext = '.module.php'; |
1132 | 1132 | // make all separators match |
1133 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1133 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1134 | 1134 | // does the file path INCLUDE the actual file name as part of the path ? |
1135 | - if ( strpos( $module_path, $module_ext ) !== FALSE ) { |
|
1135 | + if (strpos($module_path, $module_ext) !== FALSE) { |
|
1136 | 1136 | // grab and shortcode file name from directory name and break apart at dots |
1137 | - $module_file = explode( '.', basename( $module_path )); |
|
1137 | + $module_file = explode('.', basename($module_path)); |
|
1138 | 1138 | // now we need to rebuild the shortcode path |
1139 | - $module_path = explode( DS, $module_path ); |
|
1139 | + $module_path = explode(DS, $module_path); |
|
1140 | 1140 | // remove last segment |
1141 | - array_pop( $module_path ); |
|
1141 | + array_pop($module_path); |
|
1142 | 1142 | // glue it back together |
1143 | - $module_path = implode( DS, $module_path ) . DS; |
|
1143 | + $module_path = implode(DS, $module_path).DS; |
|
1144 | 1144 | // take first segment from file name pieces and sanitize it |
1145 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1145 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1146 | 1146 | // ensure class prefix is added |
1147 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1147 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1148 | 1148 | } else { |
1149 | 1149 | // we need to generate the filename based off of the folder name |
1150 | 1150 | // grab and sanitize module name |
1151 | - $module = strtolower( basename( $module_path )); |
|
1152 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module); |
|
1151 | + $module = strtolower(basename($module_path)); |
|
1152 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1153 | 1153 | // like trailingslashit() |
1154 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1154 | + $module_path = rtrim($module_path, DS).DS; |
|
1155 | 1155 | // create classname from module directory name |
1156 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ))); |
|
1156 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1157 | 1157 | // add class prefix |
1158 | - $module_class = 'EED_' . $module; |
|
1158 | + $module_class = 'EED_'.$module; |
|
1159 | 1159 | } |
1160 | 1160 | // does the module exist ? |
1161 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) { |
|
1162 | - $msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
1163 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1161 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1162 | + $msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
1163 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1164 | 1164 | return FALSE; |
1165 | 1165 | } |
1166 | 1166 | // load the module class file |
1167 | - require_once( $module_path . $module_class . $module_ext ); |
|
1167 | + require_once($module_path.$module_class.$module_ext); |
|
1168 | 1168 | // verify that class exists |
1169 | - if ( ! class_exists( $module_class )) { |
|
1170 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1171 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1169 | + if ( ! class_exists($module_class)) { |
|
1170 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1171 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1172 | 1172 | return FALSE; |
1173 | 1173 | } |
1174 | 1174 | // add to array of registered modules |
1175 | - EE_Registry::instance()->modules->$module_class = $module_path . $module_class . $module_ext; |
|
1176 | - do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class ); |
|
1175 | + EE_Registry::instance()->modules->$module_class = $module_path.$module_class.$module_ext; |
|
1176 | + do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class); |
|
1177 | 1177 | return TRUE; |
1178 | 1178 | } |
1179 | 1179 | |
@@ -1187,23 +1187,23 @@ discard block |
||
1187 | 1187 | */ |
1188 | 1188 | private function _initialize_shortcodes() { |
1189 | 1189 | // cycle thru shortcode folders |
1190 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1190 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1191 | 1191 | // add class prefix |
1192 | - $shortcode_class = 'EES_' . $shortcode; |
|
1192 | + $shortcode_class = 'EES_'.$shortcode; |
|
1193 | 1193 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1194 | 1194 | // which set hooks ? |
1195 | - if ( is_admin() ) { |
|
1195 | + if (is_admin()) { |
|
1196 | 1196 | // fire immediately |
1197 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' )); |
|
1197 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1198 | 1198 | } else { |
1199 | 1199 | // delay until other systems are online |
1200 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' )); |
|
1200 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks')); |
|
1201 | 1201 | // convert classname to UPPERCASE and create WP shortcode. |
1202 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1202 | + $shortcode_tag = strtoupper($shortcode); |
|
1203 | 1203 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1204 | - if ( ! shortcode_exists( $shortcode_tag )) { |
|
1204 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1205 | 1205 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1206 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' )); |
|
1206 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1207 | 1207 | } |
1208 | 1208 | } |
1209 | 1209 | } |
@@ -1220,15 +1220,15 @@ discard block |
||
1220 | 1220 | */ |
1221 | 1221 | private function _initialize_modules() { |
1222 | 1222 | // cycle thru shortcode folders |
1223 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1223 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1224 | 1224 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1225 | 1225 | // which set hooks ? |
1226 | - if ( is_admin() ) { |
|
1226 | + if (is_admin()) { |
|
1227 | 1227 | // fire immediately |
1228 | - call_user_func( array( $module_class, 'set_hooks_admin' )); |
|
1228 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1229 | 1229 | } else { |
1230 | 1230 | // delay until other systems are online |
1231 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' )); |
|
1231 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks')); |
|
1232 | 1232 | } |
1233 | 1233 | } |
1234 | 1234 | } |
@@ -1246,26 +1246,26 @@ discard block |
||
1246 | 1246 | * @param string $key - url param key indicating a route is being called |
1247 | 1247 | * @return bool |
1248 | 1248 | */ |
1249 | - public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) { |
|
1250 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1251 | - $module = str_replace( 'EED_', '', $module ); |
|
1252 | - $module_class = 'EED_' . $module; |
|
1253 | - if ( ! isset( EE_Registry::instance()->modules->$module_class )) { |
|
1254 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1255 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1249 | + public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') { |
|
1250 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1251 | + $module = str_replace('EED_', '', $module); |
|
1252 | + $module_class = 'EED_'.$module; |
|
1253 | + if ( ! isset(EE_Registry::instance()->modules->$module_class)) { |
|
1254 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1255 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1256 | 1256 | return FALSE; |
1257 | 1257 | } |
1258 | - if ( empty( $route )) { |
|
1259 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1260 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1258 | + if (empty($route)) { |
|
1259 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1260 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1261 | 1261 | return FALSE; |
1262 | 1262 | } |
1263 | - if ( ! method_exists ( 'EED_' . $module, $method_name )) { |
|
1264 | - $msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route ); |
|
1265 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1263 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1264 | + $msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route); |
|
1265 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1266 | 1266 | return FALSE; |
1267 | 1267 | } |
1268 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1268 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1269 | 1269 | return TRUE; |
1270 | 1270 | } |
1271 | 1271 | |
@@ -1279,11 +1279,11 @@ discard block |
||
1279 | 1279 | * @param string $key - url param key indicating a route is being called |
1280 | 1280 | * @return string |
1281 | 1281 | */ |
1282 | - public static function get_route( $route = NULL, $key = 'ee' ) { |
|
1283 | - do_action( 'AHEE__EE_Config__get_route__begin',$route ); |
|
1284 | - $route = apply_filters( 'FHEE__EE_Config__get_route',$route ); |
|
1285 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) { |
|
1286 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1282 | + public static function get_route($route = NULL, $key = 'ee') { |
|
1283 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1284 | + $route = apply_filters('FHEE__EE_Config__get_route', $route); |
|
1285 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1286 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1287 | 1287 | } |
1288 | 1288 | return NULL; |
1289 | 1289 | } |
@@ -1312,35 +1312,35 @@ discard block |
||
1312 | 1312 | * @param string $key - url param key indicating a route is being called |
1313 | 1313 | * @return bool |
1314 | 1314 | */ |
1315 | - public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) { |
|
1316 | - do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward ); |
|
1317 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1318 | - $msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route ); |
|
1319 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1315 | + public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') { |
|
1316 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1317 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1318 | + $msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route); |
|
1319 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1320 | 1320 | return FALSE; |
1321 | 1321 | } |
1322 | - if ( empty( $forward )) { |
|
1323 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1324 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1322 | + if (empty($forward)) { |
|
1323 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1324 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1325 | 1325 | return FALSE; |
1326 | 1326 | } |
1327 | - if ( is_array( $forward )) { |
|
1328 | - if ( ! isset( $forward[1] )) { |
|
1329 | - $msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route ); |
|
1330 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1327 | + if (is_array($forward)) { |
|
1328 | + if ( ! isset($forward[1])) { |
|
1329 | + $msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route); |
|
1330 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1331 | 1331 | return FALSE; |
1332 | 1332 | } |
1333 | - if ( ! method_exists( $forward[0], $forward[1] )) { |
|
1334 | - $msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route ); |
|
1335 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1333 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1334 | + $msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route); |
|
1335 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1336 | 1336 | return FALSE; |
1337 | 1337 | } |
1338 | - } else if ( ! function_exists( $forward )) { |
|
1339 | - $msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route ); |
|
1340 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1338 | + } else if ( ! function_exists($forward)) { |
|
1339 | + $msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route); |
|
1340 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1341 | 1341 | return FALSE; |
1342 | 1342 | } |
1343 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1343 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1344 | 1344 | return TRUE; |
1345 | 1345 | } |
1346 | 1346 | |
@@ -1355,10 +1355,10 @@ discard block |
||
1355 | 1355 | * @param string $key - url param key indicating a route is being called |
1356 | 1356 | * @return string |
1357 | 1357 | */ |
1358 | - public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1359 | - do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status ); |
|
1360 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) { |
|
1361 | - return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1358 | + public static function get_forward($route = NULL, $status = 0, $key = 'ee') { |
|
1359 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1360 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1361 | + return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status); |
|
1362 | 1362 | } |
1363 | 1363 | return NULL; |
1364 | 1364 | } |
@@ -1375,19 +1375,19 @@ discard block |
||
1375 | 1375 | * @param string $key - url param key indicating a route is being called |
1376 | 1376 | * @return bool |
1377 | 1377 | */ |
1378 | - public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) { |
|
1379 | - do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view ); |
|
1380 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1381 | - $msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route ); |
|
1382 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1378 | + public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') { |
|
1379 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1380 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1381 | + $msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route); |
|
1382 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1383 | 1383 | return FALSE; |
1384 | 1384 | } |
1385 | - if ( ! is_readable( $view )) { |
|
1386 | - $msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view ); |
|
1387 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1385 | + if ( ! is_readable($view)) { |
|
1386 | + $msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view); |
|
1387 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1388 | 1388 | return FALSE; |
1389 | 1389 | } |
1390 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1390 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1391 | 1391 | return TRUE; |
1392 | 1392 | } |
1393 | 1393 | |
@@ -1404,10 +1404,10 @@ discard block |
||
1404 | 1404 | * @param string $key - url param key indicating a route is being called |
1405 | 1405 | * @return string |
1406 | 1406 | */ |
1407 | - public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1408 | - do_action( 'AHEE__EE_Config__get_view__begin',$route,$status ); |
|
1409 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) { |
|
1410 | - return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1407 | + public static function get_view($route = NULL, $status = 0, $key = 'ee') { |
|
1408 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1409 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1410 | + return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status); |
|
1411 | 1411 | } |
1412 | 1412 | return NULL; |
1413 | 1413 | } |
@@ -1415,7 +1415,7 @@ discard block |
||
1415 | 1415 | |
1416 | 1416 | |
1417 | 1417 | public function shutdown() { |
1418 | - update_option( 'ee_config_option_names', $this->_config_option_names ); |
|
1418 | + update_option('ee_config_option_names', $this->_config_option_names); |
|
1419 | 1419 | } |
1420 | 1420 | |
1421 | 1421 | |
@@ -1431,7 +1431,7 @@ discard block |
||
1431 | 1431 | * magic functions in use, except we'll allow them to magically set and get stuff... |
1432 | 1432 | * basically, they should just be well-defined stdClasses |
1433 | 1433 | */ |
1434 | -class EE_Config_Base{ |
|
1434 | +class EE_Config_Base { |
|
1435 | 1435 | |
1436 | 1436 | /** |
1437 | 1437 | * Utility function for escaping the value of a property and returning. |
@@ -1440,13 +1440,13 @@ discard block |
||
1440 | 1440 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1441 | 1441 | * @throws \EE_Error |
1442 | 1442 | */ |
1443 | - public function get_pretty( $property ) { |
|
1444 | - if ( ! property_exists( $this, $property ) ) { |
|
1445 | - throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) ); |
|
1443 | + public function get_pretty($property) { |
|
1444 | + if ( ! property_exists($this, $property)) { |
|
1445 | + throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property)); |
|
1446 | 1446 | } |
1447 | 1447 | //just handling escaping of strings for now. |
1448 | - if ( is_string( $this->$property ) ) { |
|
1449 | - return stripslashes( $this->$property ); |
|
1448 | + if (is_string($this->$property)) { |
|
1449 | + return stripslashes($this->$property); |
|
1450 | 1450 | } |
1451 | 1451 | return $this->$property; |
1452 | 1452 | } |
@@ -1455,19 +1455,19 @@ discard block |
||
1455 | 1455 | |
1456 | 1456 | public function populate() { |
1457 | 1457 | //grab defaults via a new instance of this class. |
1458 | - $class_name = get_class( $this ); |
|
1458 | + $class_name = get_class($this); |
|
1459 | 1459 | $defaults = new $class_name; |
1460 | 1460 | |
1461 | 1461 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1462 | 1462 | //default from our $defaults object. |
1463 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1464 | - if ( is_null( $this->$property ) ) { |
|
1463 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1464 | + if (is_null($this->$property)) { |
|
1465 | 1465 | $this->$property = $value; |
1466 | 1466 | } |
1467 | 1467 | } |
1468 | 1468 | |
1469 | 1469 | //cleanup |
1470 | - unset( $defaults ); |
|
1470 | + unset($defaults); |
|
1471 | 1471 | } |
1472 | 1472 | |
1473 | 1473 | |
@@ -1559,12 +1559,12 @@ discard block |
||
1559 | 1559 | */ |
1560 | 1560 | public function __construct() { |
1561 | 1561 | $current_network_main_site = is_multisite() ? get_current_site() : NULL; |
1562 | - $current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1562 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1563 | 1563 | // set default organization settings |
1564 | 1564 | $this->current_blog_id = get_current_blog_id(); |
1565 | 1565 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1566 | - $this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE ); |
|
1567 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE; |
|
1566 | + $this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE); |
|
1567 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE; |
|
1568 | 1568 | $this->post_shortcodes = array(); |
1569 | 1569 | $this->module_route_map = array(); |
1570 | 1570 | $this->module_forward_map = array(); |
@@ -1583,7 +1583,7 @@ discard block |
||
1583 | 1583 | $this->event_cpt_slug = __('events', 'event_espresso'); |
1584 | 1584 | |
1585 | 1585 | //ueip constant check |
1586 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1586 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1587 | 1587 | $this->ee_ueip_optin = FALSE; |
1588 | 1588 | $this->ee_ueip_has_notified = TRUE; |
1589 | 1589 | } |
@@ -1623,8 +1623,8 @@ discard block |
||
1623 | 1623 | * @return string |
1624 | 1624 | */ |
1625 | 1625 | public function reg_page_url() { |
1626 | - if ( ! $this->reg_page_url ) { |
|
1627 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
1626 | + if ( ! $this->reg_page_url) { |
|
1627 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
1628 | 1628 | } |
1629 | 1629 | return $this->reg_page_url; |
1630 | 1630 | } |
@@ -1637,12 +1637,12 @@ discard block |
||
1637 | 1637 | * @return string |
1638 | 1638 | */ |
1639 | 1639 | public function txn_page_url($query_args = array()) { |
1640 | - if ( ! $this->txn_page_url ) { |
|
1641 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1640 | + if ( ! $this->txn_page_url) { |
|
1641 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1642 | 1642 | } |
1643 | - if($query_args){ |
|
1644 | - return add_query_arg($query_args,$this->txn_page_url); |
|
1645 | - }else{ |
|
1643 | + if ($query_args) { |
|
1644 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1645 | + } else { |
|
1646 | 1646 | return $this->txn_page_url; |
1647 | 1647 | } |
1648 | 1648 | } |
@@ -1654,12 +1654,12 @@ discard block |
||
1654 | 1654 | * @return string |
1655 | 1655 | */ |
1656 | 1656 | public function thank_you_page_url($query_args = array()) { |
1657 | - if ( ! $this->thank_you_page_url ) { |
|
1658 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1657 | + if ( ! $this->thank_you_page_url) { |
|
1658 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1659 | 1659 | } |
1660 | - if($query_args){ |
|
1661 | - return add_query_arg($query_args,$this->thank_you_page_url); |
|
1662 | - }else{ |
|
1660 | + if ($query_args) { |
|
1661 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1662 | + } else { |
|
1663 | 1663 | return $this->thank_you_page_url; |
1664 | 1664 | } |
1665 | 1665 | } |
@@ -1670,8 +1670,8 @@ discard block |
||
1670 | 1670 | * @return string |
1671 | 1671 | */ |
1672 | 1672 | public function cancel_page_url() { |
1673 | - if ( ! $this->cancel_page_url ) { |
|
1674 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1673 | + if ( ! $this->cancel_page_url) { |
|
1674 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1675 | 1675 | } |
1676 | 1676 | return $this->cancel_page_url; |
1677 | 1677 | } |
@@ -1699,7 +1699,7 @@ discard block |
||
1699 | 1699 | //reset all url properties |
1700 | 1700 | $this->_reset_urls(); |
1701 | 1701 | //return what to save to db |
1702 | - return array_keys( get_object_vars( $this ) ); |
|
1702 | + return array_keys(get_object_vars($this)); |
|
1703 | 1703 | } |
1704 | 1704 | |
1705 | 1705 | } |
@@ -1931,39 +1931,39 @@ discard block |
||
1931 | 1931 | * @param null $CNT_ISO |
1932 | 1932 | * @return \EE_Currency_Config |
1933 | 1933 | */ |
1934 | - public function __construct( $CNT_ISO = NULL ) { |
|
1934 | + public function __construct($CNT_ISO = NULL) { |
|
1935 | 1935 | |
1936 | 1936 | // get country code from organization settings or use default |
1937 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1937 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1938 | 1938 | // but override if requested |
1939 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
1940 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
1939 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
1940 | + EE_Registry::instance()->load_helper('Activation'); |
|
1941 | 1941 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
1942 | - if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) { |
|
1942 | + if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) { |
|
1943 | 1943 | // retrieve the country settings from the db, just in case they have been customized |
1944 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
1945 | - if ( $country instanceof EE_Country ) { |
|
1946 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1947 | - $this->name = $country->currency_name_single(); // Dollar |
|
1948 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
1949 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
1950 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1951 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1952 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1953 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1944 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
1945 | + if ($country instanceof EE_Country) { |
|
1946 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1947 | + $this->name = $country->currency_name_single(); // Dollar |
|
1948 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
1949 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
1950 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1951 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1952 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1953 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1954 | 1954 | } |
1955 | 1955 | } |
1956 | 1956 | // fallback to hardcoded defaults, in case the above failed |
1957 | - if ( empty( $this->code )) { |
|
1957 | + if (empty($this->code)) { |
|
1958 | 1958 | // set default currency settings |
1959 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1960 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
1961 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
1962 | - $this->sign = '$'; // currency sign: $ |
|
1963 | - $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1964 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1965 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1966 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1959 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1960 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
1961 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
1962 | + $this->sign = '$'; // currency sign: $ |
|
1963 | + $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1964 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1965 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1966 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1967 | 1967 | } |
1968 | 1968 | } |
1969 | 1969 | } |
@@ -2103,7 +2103,7 @@ discard block |
||
2103 | 2103 | * @since 4.8.8.rc.019 |
2104 | 2104 | */ |
2105 | 2105 | public function do_hooks() { |
2106 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' )); |
|
2106 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2107 | 2107 | } |
2108 | 2108 | |
2109 | 2109 | |
@@ -2111,7 +2111,7 @@ discard block |
||
2111 | 2111 | * @return void |
2112 | 2112 | */ |
2113 | 2113 | public function set_default_reg_status_on_EEM_Event() { |
2114 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2114 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2115 | 2115 | } |
2116 | 2116 | |
2117 | 2117 | |
@@ -2216,10 +2216,10 @@ discard block |
||
2216 | 2216 | * @param bool $reset |
2217 | 2217 | * @return string |
2218 | 2218 | */ |
2219 | - public function log_file_name( $reset = FALSE ) { |
|
2220 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2221 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2222 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2219 | + public function log_file_name($reset = FALSE) { |
|
2220 | + if (empty($this->log_file_name) || $reset) { |
|
2221 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt'; |
|
2222 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2223 | 2223 | } |
2224 | 2224 | return $this->log_file_name; |
2225 | 2225 | } |
@@ -2231,10 +2231,10 @@ discard block |
||
2231 | 2231 | * @param bool $reset |
2232 | 2232 | * @return string |
2233 | 2233 | */ |
2234 | - public function debug_file_name( $reset = FALSE ) { |
|
2235 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2236 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2237 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2234 | + public function debug_file_name($reset = FALSE) { |
|
2235 | + if (empty($this->debug_file_name) || $reset) { |
|
2236 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt'; |
|
2237 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2238 | 2238 | } |
2239 | 2239 | return $this->debug_file_name; |
2240 | 2240 | } |
@@ -2407,21 +2407,21 @@ discard block |
||
2407 | 2407 | // set default map settings |
2408 | 2408 | $this->use_google_maps = TRUE; |
2409 | 2409 | // for event details pages (reg page) |
2410 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2411 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2412 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2413 | - $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2414 | - $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2415 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2416 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2410 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2411 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2412 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2413 | + $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2414 | + $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2415 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2416 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2417 | 2417 | // for event list pages |
2418 | - $this->event_list_map_width = 300; // ee_map_width |
|
2419 | - $this->event_list_map_height = 185; // ee_map_height |
|
2420 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2421 | - $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2422 | - $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2423 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2424 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2418 | + $this->event_list_map_width = 300; // ee_map_width |
|
2419 | + $this->event_list_map_height = 185; // ee_map_height |
|
2420 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2421 | + $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2422 | + $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2423 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2424 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2425 | 2425 | } |
2426 | 2426 | |
2427 | 2427 | } |
@@ -2432,7 +2432,7 @@ discard block |
||
2432 | 2432 | /** |
2433 | 2433 | * stores Events_Archive settings |
2434 | 2434 | */ |
2435 | -class EE_Events_Archive_Config extends EE_Config_Base{ |
|
2435 | +class EE_Events_Archive_Config extends EE_Config_Base { |
|
2436 | 2436 | |
2437 | 2437 | public $display_status_banner; |
2438 | 2438 | public $display_description; |
@@ -2451,7 +2451,7 @@ discard block |
||
2451 | 2451 | /** |
2452 | 2452 | * class constructor |
2453 | 2453 | */ |
2454 | - public function __construct(){ |
|
2454 | + public function __construct() { |
|
2455 | 2455 | $this->display_status_banner = 0; |
2456 | 2456 | $this->display_description = 1; |
2457 | 2457 | $this->display_ticket_selector = 0; |
@@ -2471,7 +2471,7 @@ discard block |
||
2471 | 2471 | /** |
2472 | 2472 | * Stores Event_Single_Config settings |
2473 | 2473 | */ |
2474 | -class EE_Event_Single_Config extends EE_Config_Base{ |
|
2474 | +class EE_Event_Single_Config extends EE_Config_Base { |
|
2475 | 2475 | |
2476 | 2476 | public $display_status_banner_single; |
2477 | 2477 | public $display_venue; |
@@ -2500,7 +2500,7 @@ discard block |
||
2500 | 2500 | /** |
2501 | 2501 | * Stores Ticket_Selector_Config settings |
2502 | 2502 | */ |
2503 | -class EE_Ticket_Selector_Config extends EE_Config_Base{ |
|
2503 | +class EE_Ticket_Selector_Config extends EE_Config_Base { |
|
2504 | 2504 | public $show_ticket_sale_columns; |
2505 | 2505 | public $show_ticket_details; |
2506 | 2506 | public $show_expired_tickets; |
@@ -2554,7 +2554,7 @@ discard block |
||
2554 | 2554 | * @return void |
2555 | 2555 | */ |
2556 | 2556 | protected function _set_php_values() { |
2557 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2557 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2558 | 2558 | $this->php->version = phpversion(); |
2559 | 2559 | } |
2560 | 2560 | |
@@ -2573,8 +2573,8 @@ discard block |
||
2573 | 2573 | * @type string $msg Any message to be displayed. |
2574 | 2574 | * } |
2575 | 2575 | */ |
2576 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2577 | - if ( ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) { |
|
2576 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2577 | + if (($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) { |
|
2578 | 2578 | return __('The number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.', 'event_espresso'); |
2579 | 2579 | } else { |
2580 | 2580 | return ''; |
@@ -2610,7 +2610,7 @@ discard block |
||
2610 | 2610 | * stores payment gateway info |
2611 | 2611 | * @deprecated |
2612 | 2612 | */ |
2613 | -class EE_Gateway_Config extends EE_Config_Base{ |
|
2613 | +class EE_Gateway_Config extends EE_Config_Base { |
|
2614 | 2614 | |
2615 | 2615 | /** |
2616 | 2616 | * Array with keys that are payment gateways slugs, and values are arrays |
@@ -2632,9 +2632,9 @@ discard block |
||
2632 | 2632 | * class constructor |
2633 | 2633 | * @deprecated |
2634 | 2634 | */ |
2635 | - public function __construct(){ |
|
2635 | + public function __construct() { |
|
2636 | 2636 | $this->payment_settings = array(); |
2637 | - $this->active_gateways = array( 'Invoice' => FALSE ); |
|
2637 | + $this->active_gateways = array('Invoice' => FALSE); |
|
2638 | 2638 | } |
2639 | 2639 | } |
2640 | 2640 |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | public $map_settings = null; |
90 | 90 | |
91 | 91 | /** |
92 | - * |
|
93 | - * @deprecated |
|
94 | - * @var EE_Gateway_Config |
|
95 | - */ |
|
92 | + * |
|
93 | + * @deprecated |
|
94 | + * @var EE_Gateway_Config |
|
95 | + */ |
|
96 | 96 | public $gateway = null; |
97 | 97 | |
98 | 98 | /** |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | |
686 | 686 | /** |
687 | 687 | * update_config |
688 | - * Important: the config object must ALREADY be set, otherwise this will produce an error. |
|
688 | + * Important: the config object must ALREADY be set, otherwise this will produce an error. |
|
689 | 689 | * |
690 | 690 | * @access public |
691 | 691 | * @param string $section |
@@ -1712,51 +1712,51 @@ discard block |
||
1712 | 1712 | class EE_Organization_Config extends EE_Config_Base { |
1713 | 1713 | |
1714 | 1714 | /** |
1715 | - * @var string $name |
|
1716 | - * eg EE4.1 |
|
1717 | - */ |
|
1715 | + * @var string $name |
|
1716 | + * eg EE4.1 |
|
1717 | + */ |
|
1718 | 1718 | public $name; |
1719 | 1719 | |
1720 | 1720 | /** |
1721 | - * @var string $address_1 |
|
1722 | - * eg 123 Onna Road |
|
1723 | - */ |
|
1721 | + * @var string $address_1 |
|
1722 | + * eg 123 Onna Road |
|
1723 | + */ |
|
1724 | 1724 | public $address_1; |
1725 | 1725 | |
1726 | 1726 | /** |
1727 | - * @var string $address_2 |
|
1728 | - * eg PO Box 123 |
|
1729 | - */ |
|
1727 | + * @var string $address_2 |
|
1728 | + * eg PO Box 123 |
|
1729 | + */ |
|
1730 | 1730 | public $address_2; |
1731 | 1731 | |
1732 | 1732 | /** |
1733 | - * @var string $city |
|
1734 | - * eg Inna City |
|
1735 | - */ |
|
1733 | + * @var string $city |
|
1734 | + * eg Inna City |
|
1735 | + */ |
|
1736 | 1736 | public $city; |
1737 | 1737 | |
1738 | 1738 | /** |
1739 | - * @var int $STA_ID |
|
1740 | - * eg 4 |
|
1741 | - */ |
|
1739 | + * @var int $STA_ID |
|
1740 | + * eg 4 |
|
1741 | + */ |
|
1742 | 1742 | public $STA_ID; |
1743 | 1743 | |
1744 | 1744 | /** |
1745 | - * @var string $CNT_ISO |
|
1746 | - * eg US |
|
1747 | - */ |
|
1745 | + * @var string $CNT_ISO |
|
1746 | + * eg US |
|
1747 | + */ |
|
1748 | 1748 | public $CNT_ISO; |
1749 | 1749 | |
1750 | 1750 | /** |
1751 | - * @var string $zip |
|
1752 | - * eg 12345 or V1A 2B3 |
|
1753 | - */ |
|
1751 | + * @var string $zip |
|
1752 | + * eg 12345 or V1A 2B3 |
|
1753 | + */ |
|
1754 | 1754 | public $zip; |
1755 | 1755 | |
1756 | 1756 | /** |
1757 | - * @var string $email |
|
1758 | - * eg [email protected] |
|
1759 | - */ |
|
1757 | + * @var string $email |
|
1758 | + * eg [email protected] |
|
1759 | + */ |
|
1760 | 1760 | public $email; |
1761 | 1761 | |
1762 | 1762 | |
@@ -1775,9 +1775,9 @@ discard block |
||
1775 | 1775 | public $vat; |
1776 | 1776 | |
1777 | 1777 | /** |
1778 | - * @var string $logo_url |
|
1779 | - * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
1780 | - */ |
|
1778 | + * @var string $logo_url |
|
1779 | + * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
1780 | + */ |
|
1781 | 1781 | public $logo_url; |
1782 | 1782 | |
1783 | 1783 | |
@@ -1871,55 +1871,55 @@ discard block |
||
1871 | 1871 | class EE_Currency_Config extends EE_Config_Base { |
1872 | 1872 | |
1873 | 1873 | /** |
1874 | - * @var string $code |
|
1875 | - * eg 'US' |
|
1876 | - */ |
|
1874 | + * @var string $code |
|
1875 | + * eg 'US' |
|
1876 | + */ |
|
1877 | 1877 | public $code; |
1878 | 1878 | |
1879 | 1879 | /** |
1880 | - * @var string $name |
|
1881 | - * eg 'Dollar' |
|
1882 | - */ |
|
1880 | + * @var string $name |
|
1881 | + * eg 'Dollar' |
|
1882 | + */ |
|
1883 | 1883 | public $name; |
1884 | 1884 | |
1885 | 1885 | /** |
1886 | - * plural name |
|
1887 | - * @var string $plural |
|
1888 | - * eg 'Dollars' |
|
1889 | - */ |
|
1886 | + * plural name |
|
1887 | + * @var string $plural |
|
1888 | + * eg 'Dollars' |
|
1889 | + */ |
|
1890 | 1890 | public $plural; |
1891 | 1891 | |
1892 | 1892 | /** |
1893 | - * currency sign |
|
1894 | - * @var string $sign |
|
1895 | - * eg '$' |
|
1896 | - */ |
|
1893 | + * currency sign |
|
1894 | + * @var string $sign |
|
1895 | + * eg '$' |
|
1896 | + */ |
|
1897 | 1897 | public $sign; |
1898 | 1898 | |
1899 | 1899 | /** |
1900 | - * Whether the currency sign should come before the number or not |
|
1901 | - * @var boolean $sign_b4 |
|
1902 | - */ |
|
1900 | + * Whether the currency sign should come before the number or not |
|
1901 | + * @var boolean $sign_b4 |
|
1902 | + */ |
|
1903 | 1903 | public $sign_b4; |
1904 | 1904 | |
1905 | 1905 | /** |
1906 | - * How many digits should come after the decimal place |
|
1907 | - * @var int $dec_plc |
|
1908 | - */ |
|
1906 | + * How many digits should come after the decimal place |
|
1907 | + * @var int $dec_plc |
|
1908 | + */ |
|
1909 | 1909 | public $dec_plc; |
1910 | 1910 | |
1911 | 1911 | /** |
1912 | - * Symbol to use for decimal mark |
|
1913 | - * @var string $dec_mrk |
|
1914 | - * eg '.' |
|
1915 | - */ |
|
1912 | + * Symbol to use for decimal mark |
|
1913 | + * @var string $dec_mrk |
|
1914 | + * eg '.' |
|
1915 | + */ |
|
1916 | 1916 | public $dec_mrk; |
1917 | 1917 | |
1918 | 1918 | /** |
1919 | - * Symbol to use for thousands |
|
1920 | - * @var string $thsnds |
|
1921 | - * eg ',' |
|
1922 | - */ |
|
1919 | + * Symbol to use for thousands |
|
1920 | + * @var string $thsnds |
|
1921 | + * eg ',' |
|
1922 | + */ |
|
1923 | 1923 | public $thsnds; |
1924 | 1924 | |
1925 | 1925 | |
@@ -1987,13 +1987,13 @@ discard block |
||
1987 | 1987 | * whether or not to show alternate payment options during the reg process if payment status is pending |
1988 | 1988 | * @var boolean $show_pending_payment_options |
1989 | 1989 | */ |
1990 | - public $show_pending_payment_options; |
|
1990 | + public $show_pending_payment_options; |
|
1991 | 1991 | |
1992 | 1992 | /** |
1993 | 1993 | * Whether to skip the registration confirmation page |
1994 | 1994 | * @var boolean $skip_reg_confirmation |
1995 | 1995 | */ |
1996 | - public $skip_reg_confirmation; |
|
1996 | + public $skip_reg_confirmation; |
|
1997 | 1997 | |
1998 | 1998 | /** |
1999 | 1999 | * an array of SPCO reg steps where: |
@@ -2004,64 +2004,64 @@ discard block |
||
2004 | 2004 | * "slug" => the URL param used to trigger the reg step |
2005 | 2005 | * @var array $reg_steps |
2006 | 2006 | */ |
2007 | - public $reg_steps; |
|
2007 | + public $reg_steps; |
|
2008 | 2008 | |
2009 | 2009 | /** |
2010 | 2010 | * Whether registration confirmation should be the last page of SPCO |
2011 | 2011 | * @var boolean $reg_confirmation_last |
2012 | 2012 | */ |
2013 | - public $reg_confirmation_last; |
|
2013 | + public $reg_confirmation_last; |
|
2014 | 2014 | |
2015 | 2015 | /** |
2016 | 2016 | * Whether or not to enable the EE Bot Trap |
2017 | 2017 | * @var boolean $use_bot_trap |
2018 | 2018 | */ |
2019 | - public $use_bot_trap; |
|
2019 | + public $use_bot_trap; |
|
2020 | 2020 | |
2021 | 2021 | /** |
2022 | 2022 | * Whether or not to encrypt some data sent by the EE Bot Trap |
2023 | 2023 | * @var boolean $use_encryption |
2024 | 2024 | */ |
2025 | - public $use_encryption; |
|
2025 | + public $use_encryption; |
|
2026 | 2026 | |
2027 | 2027 | /** |
2028 | 2028 | * Whether or not to use ReCaptcha |
2029 | 2029 | * @var boolean $use_captcha |
2030 | 2030 | */ |
2031 | - public $use_captcha; |
|
2031 | + public $use_captcha; |
|
2032 | 2032 | |
2033 | 2033 | /** |
2034 | 2034 | * ReCaptcha Theme |
2035 | 2035 | * @var string $recaptcha_theme |
2036 | 2036 | * options: 'dark ', 'light' |
2037 | 2037 | */ |
2038 | - public $recaptcha_theme; |
|
2038 | + public $recaptcha_theme; |
|
2039 | 2039 | |
2040 | 2040 | /** |
2041 | 2041 | * ReCaptcha Type |
2042 | 2042 | * @var string $recaptcha_type |
2043 | 2043 | * options: 'audio', 'image' |
2044 | 2044 | */ |
2045 | - public $recaptcha_type; |
|
2045 | + public $recaptcha_type; |
|
2046 | 2046 | |
2047 | 2047 | /** |
2048 | 2048 | * ReCaptcha language |
2049 | 2049 | * @var string $recaptcha_language |
2050 | 2050 | * eg 'en' |
2051 | 2051 | */ |
2052 | - public $recaptcha_language; |
|
2052 | + public $recaptcha_language; |
|
2053 | 2053 | |
2054 | 2054 | /** |
2055 | 2055 | * ReCaptcha public key |
2056 | 2056 | * @var string $recaptcha_publickey |
2057 | 2057 | */ |
2058 | - public $recaptcha_publickey; |
|
2058 | + public $recaptcha_publickey; |
|
2059 | 2059 | |
2060 | 2060 | /** |
2061 | 2061 | * ReCaptcha private key |
2062 | 2062 | * @var string $recaptcha_privatekey |
2063 | 2063 | */ |
2064 | - public $recaptcha_privatekey; |
|
2064 | + public $recaptcha_privatekey; |
|
2065 | 2065 | |
2066 | 2066 | /** |
2067 | 2067 | * ReCaptcha width |
@@ -2127,58 +2127,58 @@ discard block |
||
2127 | 2127 | class EE_Admin_Config extends EE_Config_Base { |
2128 | 2128 | |
2129 | 2129 | /** |
2130 | - * @var boolean $use_personnel_manager |
|
2131 | - */ |
|
2130 | + * @var boolean $use_personnel_manager |
|
2131 | + */ |
|
2132 | 2132 | public $use_personnel_manager; |
2133 | 2133 | |
2134 | 2134 | /** |
2135 | - * @var boolean $use_dashboard_widget |
|
2136 | - */ |
|
2135 | + * @var boolean $use_dashboard_widget |
|
2136 | + */ |
|
2137 | 2137 | public $use_dashboard_widget; |
2138 | 2138 | |
2139 | 2139 | /** |
2140 | - * @var int $events_in_dashboard |
|
2141 | - */ |
|
2140 | + * @var int $events_in_dashboard |
|
2141 | + */ |
|
2142 | 2142 | public $events_in_dashboard; |
2143 | 2143 | |
2144 | 2144 | /** |
2145 | - * @var boolean $use_event_timezones |
|
2146 | - */ |
|
2145 | + * @var boolean $use_event_timezones |
|
2146 | + */ |
|
2147 | 2147 | public $use_event_timezones; |
2148 | 2148 | |
2149 | 2149 | /** |
2150 | - * @var boolean $use_full_logging |
|
2151 | - */ |
|
2150 | + * @var boolean $use_full_logging |
|
2151 | + */ |
|
2152 | 2152 | public $use_full_logging; |
2153 | 2153 | |
2154 | 2154 | /** |
2155 | - * @var string $log_file_name |
|
2156 | - */ |
|
2155 | + * @var string $log_file_name |
|
2156 | + */ |
|
2157 | 2157 | public $log_file_name; |
2158 | 2158 | |
2159 | 2159 | /** |
2160 | - * @var string $debug_file_name |
|
2161 | - */ |
|
2160 | + * @var string $debug_file_name |
|
2161 | + */ |
|
2162 | 2162 | public $debug_file_name; |
2163 | 2163 | |
2164 | 2164 | /** |
2165 | - * @var boolean $use_remote_logging |
|
2166 | - */ |
|
2165 | + * @var boolean $use_remote_logging |
|
2166 | + */ |
|
2167 | 2167 | public $use_remote_logging; |
2168 | 2168 | |
2169 | 2169 | /** |
2170 | - * @var string $remote_logging_url |
|
2171 | - */ |
|
2170 | + * @var string $remote_logging_url |
|
2171 | + */ |
|
2172 | 2172 | public $remote_logging_url; |
2173 | 2173 | |
2174 | 2174 | /** |
2175 | - * @var boolean $show_reg_footer |
|
2176 | - */ |
|
2175 | + * @var boolean $show_reg_footer |
|
2176 | + */ |
|
2177 | 2177 | public $show_reg_footer; |
2178 | 2178 | |
2179 | 2179 | /** |
2180 | - * @var string $affiliate_id |
|
2181 | - */ |
|
2180 | + * @var string $affiliate_id |
|
2181 | + */ |
|
2182 | 2182 | public $affiliate_id; |
2183 | 2183 | |
2184 | 2184 | |
@@ -2252,43 +2252,43 @@ discard block |
||
2252 | 2252 | class EE_Template_Config extends EE_Config_Base { |
2253 | 2253 | |
2254 | 2254 | /** |
2255 | - * @var boolean $enable_default_style |
|
2256 | - */ |
|
2255 | + * @var boolean $enable_default_style |
|
2256 | + */ |
|
2257 | 2257 | public $enable_default_style; |
2258 | 2258 | |
2259 | 2259 | /** |
2260 | - * @var string $custom_style_sheet |
|
2261 | - */ |
|
2260 | + * @var string $custom_style_sheet |
|
2261 | + */ |
|
2262 | 2262 | public $custom_style_sheet; |
2263 | 2263 | |
2264 | 2264 | /** |
2265 | - * @var boolean $display_address_in_regform |
|
2266 | - */ |
|
2265 | + * @var boolean $display_address_in_regform |
|
2266 | + */ |
|
2267 | 2267 | public $display_address_in_regform; |
2268 | 2268 | |
2269 | 2269 | /** |
2270 | - * @var int $display_description_on_multi_reg_page |
|
2271 | - */ |
|
2270 | + * @var int $display_description_on_multi_reg_page |
|
2271 | + */ |
|
2272 | 2272 | public $display_description_on_multi_reg_page; |
2273 | 2273 | |
2274 | 2274 | /** |
2275 | - * @var boolean $use_custom_templates |
|
2276 | - */ |
|
2275 | + * @var boolean $use_custom_templates |
|
2276 | + */ |
|
2277 | 2277 | public $use_custom_templates; |
2278 | 2278 | |
2279 | 2279 | /** |
2280 | - * @var string $current_espresso_theme |
|
2281 | - */ |
|
2280 | + * @var string $current_espresso_theme |
|
2281 | + */ |
|
2282 | 2282 | public $current_espresso_theme; |
2283 | 2283 | |
2284 | 2284 | /** |
2285 | - * @var EE_Event_Single_Config $EED_Event_Single |
|
2286 | - */ |
|
2285 | + * @var EE_Event_Single_Config $EED_Event_Single |
|
2286 | + */ |
|
2287 | 2287 | public $EED_Event_Single; |
2288 | 2288 | |
2289 | 2289 | /** |
2290 | - * @var EE_Events_Archive_Config $EED_Events_Archive |
|
2291 | - */ |
|
2290 | + * @var EE_Events_Archive_Config $EED_Events_Archive |
|
2291 | + */ |
|
2292 | 2292 | public $EED_Events_Archive; |
2293 | 2293 | |
2294 | 2294 | |
@@ -2321,78 +2321,78 @@ discard block |
||
2321 | 2321 | class EE_Map_Config extends EE_Config_Base { |
2322 | 2322 | |
2323 | 2323 | /** |
2324 | - * @var boolean $use_google_maps |
|
2325 | - */ |
|
2324 | + * @var boolean $use_google_maps |
|
2325 | + */ |
|
2326 | 2326 | public $use_google_maps; |
2327 | 2327 | |
2328 | 2328 | /** |
2329 | - * @var int $event_details_map_width |
|
2330 | - */ |
|
2329 | + * @var int $event_details_map_width |
|
2330 | + */ |
|
2331 | 2331 | public $event_details_map_width; |
2332 | 2332 | |
2333 | 2333 | /** |
2334 | - * @var int $event_details_map_height |
|
2335 | - */ |
|
2334 | + * @var int $event_details_map_height |
|
2335 | + */ |
|
2336 | 2336 | public $event_details_map_height; |
2337 | 2337 | |
2338 | 2338 | /** |
2339 | - * @var int $event_details_map_zoom |
|
2340 | - */ |
|
2339 | + * @var int $event_details_map_zoom |
|
2340 | + */ |
|
2341 | 2341 | public $event_details_map_zoom; |
2342 | 2342 | |
2343 | 2343 | /** |
2344 | - * @var boolean $event_details_display_nav |
|
2345 | - */ |
|
2344 | + * @var boolean $event_details_display_nav |
|
2345 | + */ |
|
2346 | 2346 | public $event_details_display_nav; |
2347 | 2347 | |
2348 | 2348 | /** |
2349 | - * @var boolean $event_details_nav_size |
|
2350 | - */ |
|
2349 | + * @var boolean $event_details_nav_size |
|
2350 | + */ |
|
2351 | 2351 | public $event_details_nav_size; |
2352 | 2352 | |
2353 | 2353 | /** |
2354 | - * @var string $event_details_control_type |
|
2355 | - */ |
|
2354 | + * @var string $event_details_control_type |
|
2355 | + */ |
|
2356 | 2356 | public $event_details_control_type; |
2357 | 2357 | |
2358 | 2358 | /** |
2359 | - * @var string $event_details_map_align |
|
2360 | - */ |
|
2359 | + * @var string $event_details_map_align |
|
2360 | + */ |
|
2361 | 2361 | public $event_details_map_align; |
2362 | 2362 | |
2363 | 2363 | /** |
2364 | - * @var int $event_list_map_width |
|
2365 | - */ |
|
2364 | + * @var int $event_list_map_width |
|
2365 | + */ |
|
2366 | 2366 | public $event_list_map_width; |
2367 | 2367 | |
2368 | 2368 | /** |
2369 | - * @var int $event_list_map_height |
|
2370 | - */ |
|
2369 | + * @var int $event_list_map_height |
|
2370 | + */ |
|
2371 | 2371 | public $event_list_map_height; |
2372 | 2372 | |
2373 | 2373 | /** |
2374 | - * @var int $event_list_map_zoom |
|
2375 | - */ |
|
2374 | + * @var int $event_list_map_zoom |
|
2375 | + */ |
|
2376 | 2376 | public $event_list_map_zoom; |
2377 | 2377 | |
2378 | 2378 | /** |
2379 | - * @var boolean $event_list_display_nav |
|
2380 | - */ |
|
2379 | + * @var boolean $event_list_display_nav |
|
2380 | + */ |
|
2381 | 2381 | public $event_list_display_nav; |
2382 | 2382 | |
2383 | 2383 | /** |
2384 | - * @var boolean $event_list_nav_size |
|
2385 | - */ |
|
2384 | + * @var boolean $event_list_nav_size |
|
2385 | + */ |
|
2386 | 2386 | public $event_list_nav_size; |
2387 | 2387 | |
2388 | 2388 | /** |
2389 | - * @var string $event_list_control_type |
|
2390 | - */ |
|
2389 | + * @var string $event_list_control_type |
|
2390 | + */ |
|
2391 | 2391 | public $event_list_control_type; |
2392 | 2392 | |
2393 | 2393 | /** |
2394 | - * @var string $event_list_map_align |
|
2395 | - */ |
|
2394 | + * @var string $event_list_map_align |
|
2395 | + */ |
|
2396 | 2396 | public $event_list_map_align; |
2397 | 2397 | |
2398 | 2398 |
@@ -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 | // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE ); |
3 | 5 | if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) { |
4 | 6 | set_error_handler( array( 'EE_Error', 'error_handler' )); |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE ); |
3 | -if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) { |
|
4 | - set_error_handler( array( 'EE_Error', 'error_handler' )); |
|
5 | - register_shutdown_function( array( 'EE_Error', 'fatal_error_handler' )); |
|
3 | +if (defined('WP_DEBUG') && WP_DEBUG === TRUE && defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS === TRUE) { |
|
4 | + set_error_handler(array('EE_Error', 'error_handler')); |
|
5 | + register_shutdown_function(array('EE_Error', 'fatal_error_handler')); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @access private |
65 | 65 | * @var boolean |
66 | 66 | */ |
67 | - private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE ); |
|
67 | + private static $_espresso_notices = array('success' => FALSE, 'errors' => FALSE, 'attention' => FALSE); |
|
68 | 68 | |
69 | 69 | |
70 | 70 | |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | * @access public |
76 | 76 | * @echo string |
77 | 77 | */ |
78 | - function __construct( $message, $code = 0, Exception $previous = NULL ) { |
|
79 | - if ( version_compare( phpversion(), '5.3.0', '<' )) { |
|
80 | - parent::__construct( $message, $code ); |
|
78 | + function __construct($message, $code = 0, Exception $previous = NULL) { |
|
79 | + if (version_compare(phpversion(), '5.3.0', '<')) { |
|
80 | + parent::__construct($message, $code); |
|
81 | 81 | } else { |
82 | - parent::__construct( $message, $code, $previous ); |
|
82 | + parent::__construct($message, $code, $previous); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | * @param $line |
95 | 95 | * @return void |
96 | 96 | */ |
97 | - public static function error_handler( $code, $message, $file, $line ) { |
|
98 | - $type = EE_Error::error_type( $code ); |
|
97 | + public static function error_handler($code, $message, $file, $line) { |
|
98 | + $type = EE_Error::error_type($code); |
|
99 | 99 | $site = site_url(); |
100 | - switch ( $site ) { |
|
100 | + switch ($site) { |
|
101 | 101 | case 'http://ee4.eventespresso.com/' : |
102 | 102 | case 'http://ee4decaf.eventespresso.com/' : |
103 | 103 | case 'http://ee4hf.eventespresso.com/' : |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | $to = '[email protected]'; |
111 | 111 | break; |
112 | 112 | default : |
113 | - $to = get_option( 'admin_email' ); |
|
113 | + $to = get_option('admin_email'); |
|
114 | 114 | } |
115 | - $subject = $type . ' ' . $message . ' in ' . EVENT_ESPRESSO_VERSION . ' on ' . site_url(); |
|
116 | - $msg = EE_Error::_format_error( $type, $message, $file, $line ); |
|
117 | - if ( function_exists( 'wp_mail' )) { |
|
118 | - add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' )); |
|
119 | - wp_mail( $to, $subject, $msg ); |
|
115 | + $subject = $type.' '.$message.' in '.EVENT_ESPRESSO_VERSION.' on '.site_url(); |
|
116 | + $msg = EE_Error::_format_error($type, $message, $file, $line); |
|
117 | + if (function_exists('wp_mail')) { |
|
118 | + add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type')); |
|
119 | + wp_mail($to, $subject, $msg); |
|
120 | 120 | } |
121 | 121 | echo '<div id="message" class="espresso-notices error"><p>'; |
122 | - echo $type . ': ' . $message . '<br />' . $file . ' line ' . $line; |
|
122 | + echo $type.': '.$message.'<br />'.$file.' line '.$line; |
|
123 | 123 | echo '<br /></p></div>'; |
124 | 124 | } |
125 | 125 | |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * @param $code |
133 | 133 | * @return string |
134 | 134 | */ |
135 | - public static function error_type( $code ) { |
|
136 | - switch( $code ) { |
|
135 | + public static function error_type($code) { |
|
136 | + switch ($code) { |
|
137 | 137 | case E_ERROR: // 1 // |
138 | 138 | return 'E_ERROR'; |
139 | 139 | case E_WARNING: // 2 // |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public static function fatal_error_handler() { |
181 | 181 | $last_error = error_get_last(); |
182 | - if ( $last_error['type'] === E_ERROR ) { |
|
183 | - EE_Error::error_handler( E_ERROR, $last_error['message'], $last_error['file'], $last_error['line'] ); |
|
182 | + if ($last_error['type'] === E_ERROR) { |
|
183 | + EE_Error::error_handler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param $line |
196 | 196 | * @return string |
197 | 197 | */ |
198 | - private static function _format_error( $code, $message, $file, $line ) { |
|
198 | + private static function _format_error($code, $message, $file, $line) { |
|
199 | 199 | $html = "<table cellpadding='5'><thead bgcolor='#f8f8f8'><th>Item</th><th align='left'>Details</th></thead><tbody>"; |
200 | 200 | $html .= "<tr valign='top'><td><b>Code</b></td><td>$code</td></tr>"; |
201 | 201 | $html .= "<tr valign='top'><td><b>Error</b></td><td>$message</td></tr>"; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param $content_type |
214 | 214 | * @return string |
215 | 215 | */ |
216 | - public static function set_content_type( $content_type ) { |
|
216 | + public static function set_content_type($content_type) { |
|
217 | 217 | return 'text/html'; |
218 | 218 | } |
219 | 219 | |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function get_error() { |
229 | 229 | |
230 | - if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){ |
|
230 | + if (apply_filters('FHEE__EE_Error__get_error__show_normal_exceptions', FALSE)) { |
|
231 | 231 | throw $this; |
232 | 232 | } |
233 | 233 | // get separate user and developer messages if they exist |
234 | - $msg = explode( '||', $this->getMessage() ); |
|
234 | + $msg = explode('||', $this->getMessage()); |
|
235 | 235 | $user_msg = $msg[0]; |
236 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
236 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
237 | 237 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
238 | 238 | |
239 | 239 | // add details to _all_exceptions array |
240 | 240 | $x_time = time(); |
241 | - self::$_all_exceptions[ $x_time ]['name'] = get_class( $this ); |
|
242 | - self::$_all_exceptions[ $x_time ]['file'] = $this->getFile(); |
|
243 | - self::$_all_exceptions[ $x_time ]['line'] = $this->getLine(); |
|
244 | - self::$_all_exceptions[ $x_time ]['msg'] = $msg; |
|
245 | - self::$_all_exceptions[ $x_time ]['code'] = $this->getCode(); |
|
246 | - self::$_all_exceptions[ $x_time ]['trace'] = $this->getTrace(); |
|
247 | - self::$_all_exceptions[ $x_time ]['string'] = $this->getTraceAsString(); |
|
241 | + self::$_all_exceptions[$x_time]['name'] = get_class($this); |
|
242 | + self::$_all_exceptions[$x_time]['file'] = $this->getFile(); |
|
243 | + self::$_all_exceptions[$x_time]['line'] = $this->getLine(); |
|
244 | + self::$_all_exceptions[$x_time]['msg'] = $msg; |
|
245 | + self::$_all_exceptions[$x_time]['code'] = $this->getCode(); |
|
246 | + self::$_all_exceptions[$x_time]['trace'] = $this->getTrace(); |
|
247 | + self::$_all_exceptions[$x_time]['string'] = $this->getTraceAsString(); |
|
248 | 248 | self::$_error_count++; |
249 | 249 | |
250 | 250 | //add_action( 'shutdown', array( $this, 'display_errors' )); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @access public |
260 | 260 | * @return boolean |
261 | 261 | */ |
262 | - public static function has_error(){ |
|
262 | + public static function has_error() { |
|
263 | 263 | return self::$_error_count ? TRUE : FALSE; |
264 | 264 | } |
265 | 265 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @access public |
271 | 271 | * @echo string |
272 | 272 | */ |
273 | - public function display_errors(){ |
|
273 | + public function display_errors() { |
|
274 | 274 | |
275 | 275 | $trace_details = ''; |
276 | 276 | |
@@ -331,18 +331,18 @@ discard block |
||
331 | 331 | </style> |
332 | 332 | <div id="ee-error-message" class="error">'; |
333 | 333 | |
334 | - if ( ! WP_DEBUG ) { |
|
334 | + if ( ! WP_DEBUG) { |
|
335 | 335 | $output .= ' |
336 | 336 | <p>'; |
337 | 337 | } |
338 | 338 | |
339 | 339 | // cycle thru errors |
340 | - foreach ( self::$_all_exceptions as $time => $ex ) { |
|
340 | + foreach (self::$_all_exceptions as $time => $ex) { |
|
341 | 341 | |
342 | 342 | // process trace info |
343 | - if ( empty( $ex['trace'] )) { |
|
343 | + if (empty($ex['trace'])) { |
|
344 | 344 | |
345 | - $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' ); |
|
345 | + $trace_details .= __('Sorry, but no trace information was available for this exception.', 'event_espresso'); |
|
346 | 346 | |
347 | 347 | } else { |
348 | 348 | |
@@ -357,50 +357,50 @@ discard block |
||
357 | 357 | <th scope="col" align="left">Method( arguments )</th> |
358 | 358 | </tr>'; |
359 | 359 | |
360 | - $last_on_stack = count( $ex['trace'] ) - 1; |
|
360 | + $last_on_stack = count($ex['trace']) - 1; |
|
361 | 361 | // reverse array so that stack is in proper chronological order |
362 | - $sorted_trace = array_reverse( $ex['trace'] ); |
|
362 | + $sorted_trace = array_reverse($ex['trace']); |
|
363 | 363 | |
364 | - foreach ( $sorted_trace as $nmbr => $trace ) { |
|
364 | + foreach ($sorted_trace as $nmbr => $trace) { |
|
365 | 365 | |
366 | - $file = isset( $trace['file'] ) ? $trace['file'] : '' ; |
|
367 | - $class = isset( $trace['class'] ) ? $trace['class'] : ''; |
|
368 | - $type = isset( $trace['type'] ) ? $trace['type'] : ''; |
|
369 | - $function = isset( $trace['function'] ) ? $trace['function'] : ''; |
|
370 | - $args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : ''; |
|
371 | - $line = isset( $trace['line'] ) ? $trace['line'] : ''; |
|
366 | + $file = isset($trace['file']) ? $trace['file'] : ''; |
|
367 | + $class = isset($trace['class']) ? $trace['class'] : ''; |
|
368 | + $type = isset($trace['type']) ? $trace['type'] : ''; |
|
369 | + $function = isset($trace['function']) ? $trace['function'] : ''; |
|
370 | + $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : ''; |
|
371 | + $line = isset($trace['line']) ? $trace['line'] : ''; |
|
372 | 372 | $zebra = $nmbr % 2 ? ' odd' : ''; |
373 | 373 | |
374 | - if ( empty( $file ) && ! empty( $class )) { |
|
375 | - $a = new ReflectionClass( $class ); |
|
374 | + if (empty($file) && ! empty($class)) { |
|
375 | + $a = new ReflectionClass($class); |
|
376 | 376 | $file = $a->getFileName(); |
377 | - if ( empty( $line ) && ! empty( $function )) { |
|
378 | - $b = new ReflectionMethod( $class, $function ); |
|
377 | + if (empty($line) && ! empty($function)) { |
|
378 | + $b = new ReflectionMethod($class, $function); |
|
379 | 379 | $line = $b->getStartLine(); |
380 | 380 | } |
381 | 381 | } |
382 | 382 | |
383 | - if ( $nmbr == $last_on_stack ) { |
|
383 | + if ($nmbr == $last_on_stack) { |
|
384 | 384 | $file = $ex['file'] != '' ? $ex['file'] : $file; |
385 | 385 | $line = $ex['line'] != '' ? $ex['line'] : $line; |
386 | - $error_code = self::generate_error_code ( $file, $trace['function'], $line ); |
|
386 | + $error_code = self::generate_error_code($file, $trace['function'], $line); |
|
387 | 387 | } |
388 | 388 | |
389 | - $nmbr_dsply = ! empty( $nmbr ) ? $nmbr : ' '; |
|
390 | - $line_dsply = ! empty( $line ) ? $line : ' '; |
|
391 | - $file_dsply = ! empty( $file ) ? $file : ' '; |
|
392 | - $class_dsply = ! empty( $class ) ? $class : ' '; |
|
393 | - $type_dsply = ! empty( $type ) ? $type : ' '; |
|
394 | - $function_dsply = ! empty( $function ) ? $function : ' '; |
|
395 | - $args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : ''; |
|
389 | + $nmbr_dsply = ! empty($nmbr) ? $nmbr : ' '; |
|
390 | + $line_dsply = ! empty($line) ? $line : ' '; |
|
391 | + $file_dsply = ! empty($file) ? $file : ' '; |
|
392 | + $class_dsply = ! empty($class) ? $class : ' '; |
|
393 | + $type_dsply = ! empty($type) ? $type : ' '; |
|
394 | + $function_dsply = ! empty($function) ? $function : ' '; |
|
395 | + $args_dsply = ! empty($args) ? '( '.$args.' )' : ''; |
|
396 | 396 | |
397 | 397 | $trace_details .= ' |
398 | 398 | <tr> |
399 | - <td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td> |
|
400 | - <td align="right" class="' . $zebra . '">' . $line_dsply . '</td> |
|
401 | - <td align="left" class="' . $zebra . '">' . $file_dsply . '</td> |
|
402 | - <td align="left" class="' . $zebra . '">' . $class_dsply . '</td> |
|
403 | - <td align="left" class="' . $zebra . '">' . $type_dsply . $function_dsply . $args_dsply . '</td> |
|
399 | + <td align="right" class="' . $zebra.'">'.$nmbr_dsply.'</td> |
|
400 | + <td align="right" class="' . $zebra.'">'.$line_dsply.'</td> |
|
401 | + <td align="left" class="' . $zebra.'">'.$file_dsply.'</td> |
|
402 | + <td align="left" class="' . $zebra.'">'.$class_dsply.'</td> |
|
403 | + <td align="left" class="' . $zebra.'">'.$type_dsply.$function_dsply.$args_dsply.'</td> |
|
404 | 404 | </tr>'; |
405 | 405 | |
406 | 406 | |
@@ -415,9 +415,9 @@ discard block |
||
415 | 415 | $ex['code'] = $ex['code'] ? $ex['code'] : $error_code; |
416 | 416 | |
417 | 417 | // add generic non-identifying messages for non-privileged uesrs |
418 | - if ( ! WP_DEBUG ) { |
|
418 | + if ( ! WP_DEBUG) { |
|
419 | 419 | |
420 | - $output .= '<span class="ee-error-user-msg-spn">' . trim( $ex['msg'] ) . '</span> <sup>' . $ex['code'] . '</sup><br />'; |
|
420 | + $output .= '<span class="ee-error-user-msg-spn">'.trim($ex['msg']).'</span> <sup>'.$ex['code'].'</sup><br />'; |
|
421 | 421 | |
422 | 422 | } else { |
423 | 423 | |
@@ -425,24 +425,24 @@ discard block |
||
425 | 425 | $output .= ' |
426 | 426 | <div class="ee-error-dev-msg-dv"> |
427 | 427 | <p class="ee-error-dev-msg-pg"> |
428 | - <strong class="ee-error-dev-msg-str">An ' . $ex['name'] . ' exception was thrown!</strong> <span>code: ' . $ex['code'] . '</span><br /> |
|
429 | - <span class="big-text">"' . trim( $ex['msg'] ) . '"</span><br/> |
|
430 | - <a id="display-ee-error-trace-' . self::$_error_count . $time . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-' . self::$_error_count . $time . '"> |
|
431 | - ' . __( 'click to view backtrace and class/method details', 'event_espresso' ) . ' |
|
428 | + <strong class="ee-error-dev-msg-str">An ' . $ex['name'].' exception was thrown!</strong> <span>code: '.$ex['code'].'</span><br /> |
|
429 | + <span class="big-text">"' . trim($ex['msg']).'"</span><br/> |
|
430 | + <a id="display-ee-error-trace-' . self::$_error_count.$time.'" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-'.self::$_error_count.$time.'"> |
|
431 | + ' . __('click to view backtrace and class/method details', 'event_espresso').' |
|
432 | 432 | </a><br /> |
433 | 433 | <span class="small-text lt-grey-text">'.$ex['file'].' ( line no: '.$ex['line'].' )</span> |
434 | 434 | </p> |
435 | - <div id="ee-error-trace-' . self::$_error_count . $time . '-dv" class="ee-error-trace-dv" style="display: none;"> |
|
435 | + <div id="ee-error-trace-' . self::$_error_count.$time.'-dv" class="ee-error-trace-dv" style="display: none;"> |
|
436 | 436 | ' . $trace_details; |
437 | 437 | |
438 | - if ( ! empty( $class )) { |
|
438 | + if ( ! empty($class)) { |
|
439 | 439 | $output .= ' |
440 | 440 | <div style="padding:3px; margin:0 0 1em; border:1px solid #666; background:#fff; border-radius:3px;"> |
441 | 441 | <div style="padding:1em 2em; border:1px solid #666; background:#f9f9f9;"> |
442 | 442 | <h3>Class Details</h3>'; |
443 | - $a = new ReflectionClass( $class ); |
|
443 | + $a = new ReflectionClass($class); |
|
444 | 444 | $output .= ' |
445 | - <pre>' . $a . '</pre> |
|
445 | + <pre>' . $a.'</pre> |
|
446 | 446 | </div> |
447 | 447 | </div>'; |
448 | 448 | } |
@@ -454,14 +454,14 @@ discard block |
||
454 | 454 | |
455 | 455 | } |
456 | 456 | |
457 | - $this->write_to_error_log( $time, $ex ); |
|
457 | + $this->write_to_error_log($time, $ex); |
|
458 | 458 | |
459 | 459 | } |
460 | 460 | |
461 | 461 | // remove last linebreak |
462 | - $output = substr( $output, 0, ( count( $output ) - 7 )); |
|
462 | + $output = substr($output, 0, (count($output) - 7)); |
|
463 | 463 | |
464 | - if ( ! WP_DEBUG ) { |
|
464 | + if ( ! WP_DEBUG) { |
|
465 | 465 | $output .= ' |
466 | 466 | </p>'; |
467 | 467 | } |
@@ -469,10 +469,10 @@ discard block |
||
469 | 469 | $output .= ' |
470 | 470 | </div>'; |
471 | 471 | |
472 | - $output .= self::_print_scripts( TRUE ); |
|
472 | + $output .= self::_print_scripts(TRUE); |
|
473 | 473 | |
474 | - if ( defined( 'DOING_AJAX' )) { |
|
475 | - echo json_encode( array( 'error' => $output )); |
|
474 | + if (defined('DOING_AJAX')) { |
|
475 | + echo json_encode(array('error' => $output)); |
|
476 | 476 | exit(); |
477 | 477 | } |
478 | 478 | |
@@ -492,29 +492,29 @@ discard block |
||
492 | 492 | * @ param array $arguments |
493 | 493 | * @ return string |
494 | 494 | */ |
495 | - private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) { |
|
495 | + private function _convert_args_to_string($arguments = array(), $array = FALSE) { |
|
496 | 496 | |
497 | 497 | $arg_string = ''; |
498 | - if ( ! empty( $arguments )) { |
|
498 | + if ( ! empty($arguments)) { |
|
499 | 499 | |
500 | 500 | $args = array(); |
501 | 501 | |
502 | - foreach ( $arguments as $arg ) { |
|
502 | + foreach ($arguments as $arg) { |
|
503 | 503 | |
504 | - if ( ! empty( $arg )) { |
|
504 | + if ( ! empty($arg)) { |
|
505 | 505 | |
506 | - if ( is_string( $arg )) { |
|
507 | - $args[] = " '" . $arg . "'"; |
|
508 | - } elseif ( is_array( $arg )) { |
|
509 | - $args[] = 'ARRAY(' . $this->_convert_args_to_string( $arg, TRUE ); |
|
510 | - } elseif ( is_null( $arg )) { |
|
506 | + if (is_string($arg)) { |
|
507 | + $args[] = " '".$arg."'"; |
|
508 | + } elseif (is_array($arg)) { |
|
509 | + $args[] = 'ARRAY('.$this->_convert_args_to_string($arg, TRUE); |
|
510 | + } elseif (is_null($arg)) { |
|
511 | 511 | $args[] = ' NULL'; |
512 | - } elseif ( is_bool( $arg )) { |
|
513 | - $args[] = ( $arg ) ? ' TRUE' : ' FALSE'; |
|
514 | - } elseif ( is_object( $arg )) { |
|
515 | - $args[] = ' OBJECT ' . get_class( $arg ); |
|
516 | - } elseif ( is_resource( $arg )) { |
|
517 | - $args[] = get_resource_type( $arg ); |
|
512 | + } elseif (is_bool($arg)) { |
|
513 | + $args[] = ($arg) ? ' TRUE' : ' FALSE'; |
|
514 | + } elseif (is_object($arg)) { |
|
515 | + $args[] = ' OBJECT '.get_class($arg); |
|
516 | + } elseif (is_resource($arg)) { |
|
517 | + $args[] = get_resource_type($arg); |
|
518 | 518 | } else { |
519 | 519 | $args[] = $arg; |
520 | 520 | } |
@@ -522,9 +522,9 @@ discard block |
||
522 | 522 | } |
523 | 523 | |
524 | 524 | } |
525 | - $arg_string = implode( ', ', $args ); |
|
525 | + $arg_string = implode(', ', $args); |
|
526 | 526 | } |
527 | - if ( $array ) { |
|
527 | + if ($array) { |
|
528 | 528 | $arg_string .= ' )'; |
529 | 529 | } |
530 | 530 | return $arg_string; |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | * @param string $line the line number where the error occurred - just use __LINE__ |
545 | 545 | * @return void |
546 | 546 | */ |
547 | - public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
548 | - self::_add_notice ( 'errors', $msg, $file, $func, $line ); |
|
547 | + public static function add_error($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
548 | + self::_add_notice('errors', $msg, $file, $func, $line); |
|
549 | 549 | self::$_error_count++; |
550 | 550 | } |
551 | 551 | |
@@ -563,8 +563,8 @@ discard block |
||
563 | 563 | * @param string $line the line number where the error occurred - just use __LINE__ |
564 | 564 | * @return void |
565 | 565 | */ |
566 | - public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
567 | - self::_add_notice ( 'success', $msg, $file, $func, $line ); |
|
566 | + public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
567 | + self::_add_notice('success', $msg, $file, $func, $line); |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | |
@@ -581,8 +581,8 @@ discard block |
||
581 | 581 | * @param string $line the line number where the error occurred - just use __LINE__ |
582 | 582 | * @return void |
583 | 583 | */ |
584 | - public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
585 | - self::_add_notice ( 'attention', $msg, $file, $func, $line ); |
|
584 | + public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
585 | + self::_add_notice('attention', $msg, $file, $func, $line); |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | |
@@ -600,12 +600,12 @@ discard block |
||
600 | 600 | * @param string $line the line number where the error occurred - just use __LINE__ |
601 | 601 | * @return void |
602 | 602 | */ |
603 | - private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
604 | - if ( empty( $msg )) { |
|
603 | + private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
604 | + if (empty($msg)) { |
|
605 | 605 | EE_Error::doing_it_wrong( |
606 | - 'EE_Error::add_' . $type . '()', |
|
606 | + 'EE_Error::add_'.$type.'()', |
|
607 | 607 | sprintf( |
608 | - __( 'Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso' ), |
|
608 | + __('Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso'), |
|
609 | 609 | $type, |
610 | 610 | $file, |
611 | 611 | $line |
@@ -613,27 +613,27 @@ discard block |
||
613 | 613 | EVENT_ESPRESSO_VERSION |
614 | 614 | ); |
615 | 615 | } |
616 | - if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) { |
|
616 | + if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) { |
|
617 | 617 | EE_Error::doing_it_wrong( |
618 | 618 | 'EE_Error::add_error()', |
619 | - __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso' ), |
|
619 | + __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso'), |
|
620 | 620 | EVENT_ESPRESSO_VERSION |
621 | 621 | ); |
622 | 622 | } |
623 | 623 | // get separate user and developer messages if they exist |
624 | - $msg = explode( '||', $msg ); |
|
624 | + $msg = explode('||', $msg); |
|
625 | 625 | $user_msg = $msg[0]; |
626 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
626 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
627 | 627 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
628 | 628 | // add notice if message exists |
629 | - if ( ! empty( $msg )) { |
|
629 | + if ( ! empty($msg)) { |
|
630 | 630 | // get error code, but only on error |
631 | - if ( WP_DEBUG && $type == 'errors' ) { |
|
632 | - $msg .= '<br/><span class="tiny-text">' . EE_Error::generate_error_code( $file, $func, $line ) . '</span>'; |
|
631 | + if (WP_DEBUG && $type == 'errors') { |
|
632 | + $msg .= '<br/><span class="tiny-text">'.EE_Error::generate_error_code($file, $func, $line).'</span>'; |
|
633 | 633 | } |
634 | 634 | // add notice |
635 | - self::$_espresso_notices[ $type ][] = $msg; |
|
636 | - add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 ); |
|
635 | + self::$_espresso_notices[$type][] = $msg; |
|
636 | + add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | } |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | * @access private |
688 | 688 | * @return void |
689 | 689 | */ |
690 | - public static function reset_notices(){ |
|
690 | + public static function reset_notices() { |
|
691 | 691 | self::$_espresso_notices['success'] = FALSE; |
692 | 692 | self::$_espresso_notices['attention'] = FALSE; |
693 | 693 | self::$_espresso_notices['errors'] = FALSE; |
@@ -700,14 +700,14 @@ discard block |
||
700 | 700 | * @access public |
701 | 701 | * @return int |
702 | 702 | */ |
703 | - public static function has_notices(){ |
|
703 | + public static function has_notices() { |
|
704 | 704 | $has_notices = 0; |
705 | 705 | // check for success messages |
706 | - $has_notices = self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] ) ? 3 : $has_notices; |
|
706 | + $has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices; |
|
707 | 707 | // check for attention messages |
708 | - $has_notices = self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ? 2 : $has_notices; |
|
708 | + $has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices; |
|
709 | 709 | // check for error messages |
710 | - $has_notices = self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ? 1 : $has_notices; |
|
710 | + $has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices; |
|
711 | 711 | return $has_notices; |
712 | 712 | } |
713 | 713 | |
@@ -722,8 +722,8 @@ discard block |
||
722 | 722 | * @param boolean $remove_empty whether or not to unset empty messages |
723 | 723 | * @return array |
724 | 724 | */ |
725 | - public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) { |
|
726 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
725 | + public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) { |
|
726 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
727 | 727 | |
728 | 728 | $success_messages = ''; |
729 | 729 | $attention_messages = ''; |
@@ -733,44 +733,44 @@ discard block |
||
733 | 733 | // EEH_Debug_Tools::printr( self::$_espresso_notices, 'espresso_notices <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
734 | 734 | |
735 | 735 | // either save notices to the db |
736 | - if ( $save_to_transient ) { |
|
737 | - update_option( 'ee_notices', self::$_espresso_notices ); |
|
736 | + if ($save_to_transient) { |
|
737 | + update_option('ee_notices', self::$_espresso_notices); |
|
738 | 738 | return; |
739 | 739 | } |
740 | 740 | // grab any notices that have been previously saved |
741 | - if ( $notices = get_option( 'ee_notices', FALSE )) { |
|
742 | - foreach ( $notices as $type => $notice ) { |
|
743 | - if ( is_array( $notice ) && ! empty( $notice )) { |
|
741 | + if ($notices = get_option('ee_notices', FALSE)) { |
|
742 | + foreach ($notices as $type => $notice) { |
|
743 | + if (is_array($notice) && ! empty($notice)) { |
|
744 | 744 | // make sure that existsing notice type is an array |
745 | - self::$_espresso_notices[ $type ] = is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array(); |
|
745 | + self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array(); |
|
746 | 746 | // merge stored notices with any newly created ones |
747 | - self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice ); |
|
747 | + self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice); |
|
748 | 748 | $print_scripts = TRUE; |
749 | 749 | } |
750 | 750 | } |
751 | 751 | // now clear any stored notices |
752 | - update_option( 'ee_notices', FALSE ); |
|
752 | + update_option('ee_notices', FALSE); |
|
753 | 753 | } |
754 | 754 | |
755 | 755 | // check for success messages |
756 | - if ( self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] )) { |
|
756 | + if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) { |
|
757 | 757 | // combine messages |
758 | - $success_messages .= implode( self::$_espresso_notices['success'], '<br />' ); |
|
758 | + $success_messages .= implode(self::$_espresso_notices['success'], '<br />'); |
|
759 | 759 | $print_scripts = TRUE; |
760 | 760 | } |
761 | 761 | |
762 | 762 | // check for attention messages |
763 | - if ( self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ) { |
|
763 | + if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) { |
|
764 | 764 | // combine messages |
765 | - $attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' ); |
|
765 | + $attention_messages .= implode(self::$_espresso_notices['attention'], '<br />'); |
|
766 | 766 | $print_scripts = TRUE; |
767 | 767 | } |
768 | 768 | |
769 | 769 | // check for error messages |
770 | - if ( self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ) { |
|
771 | - $error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' ); |
|
770 | + if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) { |
|
771 | + $error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso'); |
|
772 | 772 | // combine messages |
773 | - $error_messages .= implode( self::$_espresso_notices['errors'], '<br />' ); |
|
773 | + $error_messages .= implode(self::$_espresso_notices['errors'], '<br />'); |
|
774 | 774 | $print_scripts = TRUE; |
775 | 775 | } |
776 | 776 | |
@@ -784,21 +784,21 @@ discard block |
||
784 | 784 | $css_id = is_admin() ? 'message' : 'espresso-notices-success'; |
785 | 785 | $css_class = is_admin() ? 'updated fade' : 'success fade-away'; |
786 | 786 | //showMessage( $success_messages ); |
787 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>'; |
|
787 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>'; |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | if ($attention_messages != '') { |
791 | 791 | $css_id = is_admin() ? 'message' : 'espresso-notices-attention'; |
792 | 792 | $css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away'; |
793 | 793 | //showMessage( $error_messages, TRUE ); |
794 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>'; |
|
794 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>'; |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | if ($error_messages != '') { |
798 | 798 | $css_id = is_admin() ? 'message' : 'espresso-notices-error'; |
799 | 799 | $css_class = is_admin() ? 'error' : 'error fade-away'; |
800 | 800 | //showMessage( $error_messages, TRUE ); |
801 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>'; |
|
801 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>'; |
|
802 | 802 | } |
803 | 803 | |
804 | 804 | $notices .= '</div>'; |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | 'errors' => $error_messages |
812 | 812 | ); |
813 | 813 | |
814 | - if ( $remove_empty ) { |
|
814 | + if ($remove_empty) { |
|
815 | 815 | // remove empty notices |
816 | 816 | foreach ($notices as $type => $notice) { |
817 | 817 | if (empty($notice)) { |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | } |
822 | 822 | } |
823 | 823 | |
824 | - if ( $print_scripts ) { |
|
824 | + if ($print_scripts) { |
|
825 | 825 | self::_print_scripts(); |
826 | 826 | } |
827 | 827 | |
@@ -841,17 +841,17 @@ discard block |
||
841 | 841 | * @param bool $force_update allows one to enforce the reappearance of a persistent message. |
842 | 842 | * @return void |
843 | 843 | */ |
844 | - public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) { |
|
845 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
846 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
844 | + public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) { |
|
845 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
846 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
847 | 847 | //maybe initialize persistent_admin_notices |
848 | - if ( empty( $persistent_admin_notices )) { |
|
849 | - add_option( 'ee_pers_admin_notices', array(), '', 'no' ); |
|
848 | + if (empty($persistent_admin_notices)) { |
|
849 | + add_option('ee_pers_admin_notices', array(), '', 'no'); |
|
850 | 850 | } |
851 | - $pan_name = sanitize_key( $pan_name ); |
|
852 | - if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) { |
|
853 | - $persistent_admin_notices[ $pan_name ] = $pan_message; |
|
854 | - update_option( 'ee_pers_admin_notices', $persistent_admin_notices ); |
|
851 | + $pan_name = sanitize_key($pan_name); |
|
852 | + if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) { |
|
853 | + $persistent_admin_notices[$pan_name] = $pan_message; |
|
854 | + update_option('ee_pers_admin_notices', $persistent_admin_notices); |
|
855 | 855 | } |
856 | 856 | } |
857 | 857 | } |
@@ -867,34 +867,34 @@ discard block |
||
867 | 867 | * @param bool $return_immediately |
868 | 868 | * @return void |
869 | 869 | */ |
870 | - public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) { |
|
871 | - $pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name; |
|
872 | - if ( ! empty( $pan_name )) { |
|
873 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
870 | + public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) { |
|
871 | + $pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name; |
|
872 | + if ( ! empty($pan_name)) { |
|
873 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
874 | 874 | // check if notice we wish to dismiss is actually in the $persistent_admin_notices array |
875 | - if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) { |
|
875 | + if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) { |
|
876 | 876 | // completely delete nag notice, or just NULL message so that it can NOT be added again ? |
877 | - if ( $purge ) { |
|
878 | - unset( $persistent_admin_notices[ $pan_name ] ); |
|
877 | + if ($purge) { |
|
878 | + unset($persistent_admin_notices[$pan_name]); |
|
879 | 879 | } else { |
880 | - $persistent_admin_notices[ $pan_name ] = NULL; |
|
880 | + $persistent_admin_notices[$pan_name] = NULL; |
|
881 | 881 | } |
882 | - if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) { |
|
883 | - EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
882 | + if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) { |
|
883 | + EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__); |
|
884 | 884 | } |
885 | 885 | } |
886 | 886 | } |
887 | - if ( $return_immediately ) { |
|
887 | + if ($return_immediately) { |
|
888 | 888 | return; |
889 | - } else if ( EE_Registry::instance()->REQ->ajax ) { |
|
889 | + } else if (EE_Registry::instance()->REQ->ajax) { |
|
890 | 890 | // grab any notices and concatenate into string |
891 | - echo json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE )))); |
|
891 | + echo json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE)))); |
|
892 | 892 | exit(); |
893 | 893 | } else { |
894 | 894 | // save errors to a transient to be displayed on next request (after redirect) |
895 | - EE_Error::get_notices( FALSE, TRUE ); |
|
896 | - $return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : ''; |
|
897 | - wp_safe_redirect( urldecode( $return_url )); |
|
895 | + EE_Error::get_notices(FALSE, TRUE); |
|
896 | + $return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : ''; |
|
897 | + wp_safe_redirect(urldecode($return_url)); |
|
898 | 898 | } |
899 | 899 | } |
900 | 900 | |
@@ -909,20 +909,20 @@ discard block |
||
909 | 909 | * @param string $return_url URL to go back to aftger nag notice is dismissed |
910 | 910 | * @return string |
911 | 911 | */ |
912 | - public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) { |
|
913 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
912 | + public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') { |
|
913 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
914 | 914 | $args = array( |
915 | 915 | 'nag_notice' => $pan_name, |
916 | - 'return_url' => urlencode( $return_url ), |
|
916 | + 'return_url' => urlencode($return_url), |
|
917 | 917 | 'ajax_url' => WP_AJAX_URL, |
918 | - 'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' ) |
|
918 | + 'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso') |
|
919 | 919 | ); |
920 | - wp_localize_script( 'espresso_core', 'ee_dismiss', $args ); |
|
920 | + wp_localize_script('espresso_core', 'ee_dismiss', $args); |
|
921 | 921 | return ' |
922 | - <div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
923 | - <p>' . $pan_message . '</p> |
|
924 | - <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '"> |
|
925 | - <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .' |
|
922 | + <div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
923 | + <p>' . $pan_message.'</p> |
|
924 | + <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'"> |
|
925 | + <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').' |
|
926 | 926 | </a> |
927 | 927 | <div style="clear:both;"></div> |
928 | 928 | </div>'; |
@@ -938,17 +938,17 @@ discard block |
||
938 | 938 | * @param string $return_url |
939 | 939 | * @return array |
940 | 940 | */ |
941 | - public static function get_persistent_admin_notices( $return_url = '' ) { |
|
941 | + public static function get_persistent_admin_notices($return_url = '') { |
|
942 | 942 | $notices = ''; |
943 | 943 | // check for persistent admin notices |
944 | - if ( $persistent_admin_notices = get_option( 'ee_pers_admin_notices', FALSE )) { |
|
944 | + if ($persistent_admin_notices = get_option('ee_pers_admin_notices', FALSE)) { |
|
945 | 945 | // load scripts |
946 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
947 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
948 | - wp_enqueue_script( 'ee_error_js' ); |
|
946 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
947 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
948 | + wp_enqueue_script('ee_error_js'); |
|
949 | 949 | // and display notices |
950 | - foreach( $persistent_admin_notices as $pan_name => $pan_message ) { |
|
951 | - $notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url ); |
|
950 | + foreach ($persistent_admin_notices as $pan_name => $pan_message) { |
|
951 | + $notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url); |
|
952 | 952 | } |
953 | 953 | } |
954 | 954 | return $notices; |
@@ -963,26 +963,26 @@ discard block |
||
963 | 963 | * @param bool $force_print |
964 | 964 | * @return void |
965 | 965 | */ |
966 | - private static function _print_scripts( $force_print = FALSE ) { |
|
967 | - if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) { |
|
968 | - if ( wp_script_is( 'ee_error_js', 'enqueued' )) { |
|
966 | + private static function _print_scripts($force_print = FALSE) { |
|
967 | + if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) { |
|
968 | + if (wp_script_is('ee_error_js', 'enqueued')) { |
|
969 | 969 | return; |
970 | - } else if ( wp_script_is( 'ee_error_js', 'registered' )) { |
|
971 | - add_filter( 'FHEE_load_css', '__return_true' ); |
|
972 | - add_filter( 'FHEE_load_js', '__return_true' ); |
|
973 | - wp_enqueue_script( 'ee_error_js' ); |
|
974 | - wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG )); |
|
970 | + } else if (wp_script_is('ee_error_js', 'registered')) { |
|
971 | + add_filter('FHEE_load_css', '__return_true'); |
|
972 | + add_filter('FHEE_load_js', '__return_true'); |
|
973 | + wp_enqueue_script('ee_error_js'); |
|
974 | + wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG)); |
|
975 | 975 | } |
976 | 976 | } else { |
977 | 977 | return ' |
978 | 978 | <script> |
979 | 979 | /* <![CDATA[ */ |
980 | -var ee_settings = {"wp_debug":"' . WP_DEBUG . '"}; |
|
980 | +var ee_settings = {"wp_debug":"' . WP_DEBUG.'"}; |
|
981 | 981 | /* ]]> */ |
982 | 982 | </script> |
983 | -<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script> |
|
984 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
985 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
983 | +<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script> |
|
984 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
985 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
986 | 986 | '; |
987 | 987 | |
988 | 988 | } |
@@ -1016,11 +1016,11 @@ discard block |
||
1016 | 1016 | * @ param string $line |
1017 | 1017 | * @ return string |
1018 | 1018 | */ |
1019 | - public static function generate_error_code ( $file = '', $func = '', $line = '' ) { |
|
1020 | - $file = explode( '.', basename( $file )); |
|
1021 | - $error_code = ! empty( $file[0] ) ? $file[0] : ''; |
|
1022 | - $error_code .= ! empty( $func ) ? ' - ' . $func : ''; |
|
1023 | - $error_code .= ! empty( $line ) ? ' - ' . $line : ''; |
|
1019 | + public static function generate_error_code($file = '', $func = '', $line = '') { |
|
1020 | + $file = explode('.', basename($file)); |
|
1021 | + $error_code = ! empty($file[0]) ? $file[0] : ''; |
|
1022 | + $error_code .= ! empty($func) ? ' - '.$func : ''; |
|
1023 | + $error_code .= ! empty($line) ? ' - '.$line : ''; |
|
1024 | 1024 | return $error_code; |
1025 | 1025 | } |
1026 | 1026 | |
@@ -1036,37 +1036,37 @@ discard block |
||
1036 | 1036 | * @ param object $ex |
1037 | 1037 | * @ return void |
1038 | 1038 | */ |
1039 | - public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) { |
|
1039 | + public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) { |
|
1040 | 1040 | |
1041 | - if ( ! $ex ) { |
|
1041 | + if ( ! $ex) { |
|
1042 | 1042 | return; |
1043 | 1043 | } |
1044 | 1044 | |
1045 | - if ( ! $time ) { |
|
1045 | + if ( ! $time) { |
|
1046 | 1046 | $time = time(); |
1047 | 1047 | } |
1048 | 1048 | |
1049 | - $exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
1050 | - $exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . '] Exception Details' . PHP_EOL; |
|
1051 | - $exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL; |
|
1052 | - $exception_log .= 'Code: '. $ex['code'] . PHP_EOL; |
|
1053 | - $exception_log .= 'File: '. $ex['file'] . PHP_EOL; |
|
1054 | - $exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL; |
|
1055 | - $exception_log .= 'Stack trace: ' . PHP_EOL; |
|
1056 | - $exception_log .= $ex['string'] . PHP_EOL; |
|
1057 | - $exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
1058 | - |
|
1059 | - EE_Registry::instance()->load_helper( 'File' ); |
|
1049 | + $exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
1050 | + $exception_log .= '['.date('Y-m-d H:i:s', $time).'] Exception Details'.PHP_EOL; |
|
1051 | + $exception_log .= 'Message: '.$ex['msg'].PHP_EOL; |
|
1052 | + $exception_log .= 'Code: '.$ex['code'].PHP_EOL; |
|
1053 | + $exception_log .= 'File: '.$ex['file'].PHP_EOL; |
|
1054 | + $exception_log .= 'Line No: '.$ex['line'].PHP_EOL; |
|
1055 | + $exception_log .= 'Stack trace: '.PHP_EOL; |
|
1056 | + $exception_log .= $ex['string'].PHP_EOL; |
|
1057 | + $exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
1058 | + |
|
1059 | + EE_Registry::instance()->load_helper('File'); |
|
1060 | 1060 | try { |
1061 | - EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ); |
|
1062 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' ); |
|
1063 | - if ( ! $clear ) { |
|
1061 | + EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file); |
|
1062 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs'); |
|
1063 | + if ( ! $clear) { |
|
1064 | 1064 | //get existing log file and append new log info |
1065 | - $exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log; |
|
1065 | + $exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log; |
|
1066 | 1066 | } |
1067 | - EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log ); |
|
1068 | - } catch( EE_Error $e ){ |
|
1069 | - EE_Error::add_error( sprintf( __( 'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() )); |
|
1067 | + EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log); |
|
1068 | + } catch (EE_Error $e) { |
|
1069 | + EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage())); |
|
1070 | 1070 | return; |
1071 | 1071 | } |
1072 | 1072 | |
@@ -1090,10 +1090,10 @@ discard block |
||
1090 | 1090 | * @param int $error_type |
1091 | 1091 | * @return void |
1092 | 1092 | */ |
1093 | - public static function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) { |
|
1094 | - if ( defined('WP_DEBUG') && WP_DEBUG ) { |
|
1093 | + public static function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) { |
|
1094 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
1095 | 1095 | EE_Registry::instance()->load_helper('Debug_Tools'); |
1096 | - EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version, $error_type ); |
|
1096 | + EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version, $error_type); |
|
1097 | 1097 | } |
1098 | 1098 | } |
1099 | 1099 | |
@@ -1113,13 +1113,13 @@ discard block |
||
1113 | 1113 | */ |
1114 | 1114 | function espresso_error_enqueue_scripts() { |
1115 | 1115 | // js for error handling |
1116 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
1117 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
1116 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE); |
|
1117 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE); |
|
1118 | 1118 | } |
1119 | -if ( is_admin() ) { |
|
1120 | - add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
1119 | +if (is_admin()) { |
|
1120 | + add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
1121 | 1121 | } else { |
1122 | - add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
1122 | + add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
1123 | 1123 | } |
1124 | 1124 | |
1125 | 1125 |
@@ -18,52 +18,52 @@ discard block |
||
18 | 18 | |
19 | 19 | |
20 | 20 | /** |
21 | - * name of the file to log exceptions to |
|
22 | - * @access private |
|
23 | - * @var string |
|
24 | - */ |
|
21 | + * name of the file to log exceptions to |
|
22 | + * @access private |
|
23 | + * @var string |
|
24 | + */ |
|
25 | 25 | private static $_exception_log_file = 'espresso_error_log.txt'; |
26 | 26 | |
27 | 27 | /** |
28 | - * the exception |
|
29 | - * @access private |
|
30 | - * @var object |
|
31 | - */ |
|
28 | + * the exception |
|
29 | + * @access private |
|
30 | + * @var object |
|
31 | + */ |
|
32 | 32 | private $_exception; |
33 | 33 | |
34 | 34 | /** |
35 | - * stores details for all exception |
|
36 | - * @access private |
|
37 | - * @var array |
|
38 | - */ |
|
35 | + * stores details for all exception |
|
36 | + * @access private |
|
37 | + * @var array |
|
38 | + */ |
|
39 | 39 | private static $_all_exceptions = array(); |
40 | 40 | |
41 | 41 | /** |
42 | - * tracks number of errors |
|
43 | - * @access private |
|
44 | - * @var int |
|
45 | - */ |
|
42 | + * tracks number of errors |
|
43 | + * @access private |
|
44 | + * @var int |
|
45 | + */ |
|
46 | 46 | private static $_error_count = 0; |
47 | 47 | |
48 | 48 | /** |
49 | - * has JS been loaded ? |
|
50 | - * @access private |
|
51 | - * @var boolean |
|
52 | - */ |
|
49 | + * has JS been loaded ? |
|
50 | + * @access private |
|
51 | + * @var boolean |
|
52 | + */ |
|
53 | 53 | private static $_js_loaded = FALSE; |
54 | 54 | |
55 | 55 | /** |
56 | - * has shutdown action been added ? |
|
57 | - * @access private |
|
58 | - * @var boolean |
|
59 | - */ |
|
56 | + * has shutdown action been added ? |
|
57 | + * @access private |
|
58 | + * @var boolean |
|
59 | + */ |
|
60 | 60 | private static $_action_added = FALSE; |
61 | 61 | |
62 | 62 | /** |
63 | - * has shutdown action been added ? |
|
64 | - * @access private |
|
65 | - * @var boolean |
|
66 | - */ |
|
63 | + * has shutdown action been added ? |
|
64 | + * @access private |
|
65 | + * @var boolean |
|
66 | + */ |
|
67 | 67 | private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE ); |
68 | 68 | |
69 | 69 | |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | |
72 | 72 | |
73 | 73 | /** |
74 | - * @override default exception handling |
|
75 | - * @access public |
|
76 | - * @echo string |
|
77 | - */ |
|
74 | + * @override default exception handling |
|
75 | + * @access public |
|
76 | + * @echo string |
|
77 | + */ |
|
78 | 78 | function __construct( $message, $code = 0, Exception $previous = NULL ) { |
79 | 79 | if ( version_compare( phpversion(), '5.3.0', '<' )) { |
80 | 80 | parent::__construct( $message, $code ); |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | |
174 | 174 | |
175 | 175 | /** |
176 | - * fatal_error_handler |
|
177 | - * @access public |
|
178 | - * @return void |
|
179 | - */ |
|
176 | + * fatal_error_handler |
|
177 | + * @access public |
|
178 | + * @return void |
|
179 | + */ |
|
180 | 180 | public static function fatal_error_handler() { |
181 | 181 | $last_error = error_get_last(); |
182 | 182 | if ( $last_error['type'] === E_ERROR ) { |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | |
222 | 222 | |
223 | 223 | /** |
224 | - * _add_actions |
|
225 | - * @access public |
|
226 | - * @return void |
|
227 | - */ |
|
228 | - public function get_error() { |
|
224 | + * _add_actions |
|
225 | + * @access public |
|
226 | + * @return void |
|
227 | + */ |
|
228 | + public function get_error() { |
|
229 | 229 | |
230 | 230 | if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){ |
231 | 231 | throw $this; |
@@ -255,22 +255,22 @@ discard block |
||
255 | 255 | |
256 | 256 | |
257 | 257 | /** |
258 | - * has_error |
|
259 | - * @access public |
|
260 | - * @return boolean |
|
261 | - */ |
|
262 | - public static function has_error(){ |
|
258 | + * has_error |
|
259 | + * @access public |
|
260 | + * @return boolean |
|
261 | + */ |
|
262 | + public static function has_error(){ |
|
263 | 263 | return self::$_error_count ? TRUE : FALSE; |
264 | 264 | } |
265 | 265 | |
266 | 266 | |
267 | 267 | |
268 | 268 | /** |
269 | - * display_errors |
|
270 | - * @access public |
|
271 | - * @echo string |
|
272 | - */ |
|
273 | - public function display_errors(){ |
|
269 | + * display_errors |
|
270 | + * @access public |
|
271 | + * @echo string |
|
272 | + */ |
|
273 | + public function display_errors(){ |
|
274 | 274 | |
275 | 275 | $trace_details = ''; |
276 | 276 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | // process trace info |
343 | 343 | if ( empty( $ex['trace'] )) { |
344 | 344 | |
345 | - $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' ); |
|
345 | + $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' ); |
|
346 | 346 | |
347 | 347 | } else { |
348 | 348 | |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $function_dsply = ! empty( $function ) ? $function : ' '; |
395 | 395 | $args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : ''; |
396 | 396 | |
397 | - $trace_details .= ' |
|
397 | + $trace_details .= ' |
|
398 | 398 | <tr> |
399 | 399 | <td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td> |
400 | 400 | <td align="right" class="' . $zebra . '">' . $line_dsply . '</td> |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | |
407 | 407 | } |
408 | 408 | |
409 | - $trace_details .= ' |
|
409 | + $trace_details .= ' |
|
410 | 410 | </table> |
411 | 411 | </div>'; |
412 | 412 | |
@@ -486,12 +486,12 @@ discard block |
||
486 | 486 | |
487 | 487 | |
488 | 488 | /** |
489 | - * generate string from exception trace args |
|
490 | - * |
|
491 | - * @access private |
|
492 | - * @ param array $arguments |
|
493 | - * @ return string |
|
494 | - */ |
|
489 | + * generate string from exception trace args |
|
490 | + * |
|
491 | + * @access private |
|
492 | + * @ param array $arguments |
|
493 | + * @ return string |
|
494 | + */ |
|
495 | 495 | private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) { |
496 | 496 | |
497 | 497 | $arg_string = ''; |
@@ -535,15 +535,15 @@ discard block |
||
535 | 535 | |
536 | 536 | |
537 | 537 | /** |
538 | - * add error message |
|
539 | - * |
|
540 | - * @access public |
|
541 | - * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
542 | - * @param string $file the file that the error occurred in - just use __FILE__ |
|
543 | - * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
544 | - * @param string $line the line number where the error occurred - just use __LINE__ |
|
545 | - * @return void |
|
546 | - */ |
|
538 | + * add error message |
|
539 | + * |
|
540 | + * @access public |
|
541 | + * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
542 | + * @param string $file the file that the error occurred in - just use __FILE__ |
|
543 | + * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
544 | + * @param string $line the line number where the error occurred - just use __LINE__ |
|
545 | + * @return void |
|
546 | + */ |
|
547 | 547 | public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
548 | 548 | self::_add_notice ( 'errors', $msg, $file, $func, $line ); |
549 | 549 | self::$_error_count++; |
@@ -554,15 +554,15 @@ discard block |
||
554 | 554 | |
555 | 555 | |
556 | 556 | /** |
557 | - * add success message |
|
558 | - * |
|
559 | - * @access public |
|
560 | - * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
561 | - * @param string $file the file that the error occurred in - just use __FILE__ |
|
562 | - * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
563 | - * @param string $line the line number where the error occurred - just use __LINE__ |
|
564 | - * @return void |
|
565 | - */ |
|
557 | + * add success message |
|
558 | + * |
|
559 | + * @access public |
|
560 | + * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
561 | + * @param string $file the file that the error occurred in - just use __FILE__ |
|
562 | + * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
563 | + * @param string $line the line number where the error occurred - just use __LINE__ |
|
564 | + * @return void |
|
565 | + */ |
|
566 | 566 | public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
567 | 567 | self::_add_notice ( 'success', $msg, $file, $func, $line ); |
568 | 568 | } |
@@ -572,15 +572,15 @@ discard block |
||
572 | 572 | |
573 | 573 | |
574 | 574 | /** |
575 | - * add attention message |
|
576 | - * |
|
577 | - * @access public |
|
578 | - * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
579 | - * @param string $file the file that the error occurred in - just use __FILE__ |
|
580 | - * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
581 | - * @param string $line the line number where the error occurred - just use __LINE__ |
|
582 | - * @return void |
|
583 | - */ |
|
575 | + * add attention message |
|
576 | + * |
|
577 | + * @access public |
|
578 | + * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
579 | + * @param string $file the file that the error occurred in - just use __FILE__ |
|
580 | + * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
581 | + * @param string $line the line number where the error occurred - just use __LINE__ |
|
582 | + * @return void |
|
583 | + */ |
|
584 | 584 | public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
585 | 585 | self::_add_notice ( 'attention', $msg, $file, $func, $line ); |
586 | 586 | } |
@@ -590,16 +590,16 @@ discard block |
||
590 | 590 | |
591 | 591 | |
592 | 592 | /** |
593 | - * add success message |
|
594 | - * |
|
595 | - * @access public |
|
596 | - * @param string $type whether the message is for a success or error notification |
|
597 | - * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
598 | - * @param string $file the file that the error occurred in - just use __FILE__ |
|
599 | - * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
600 | - * @param string $line the line number where the error occurred - just use __LINE__ |
|
601 | - * @return void |
|
602 | - */ |
|
593 | + * add success message |
|
594 | + * |
|
595 | + * @access public |
|
596 | + * @param string $type whether the message is for a success or error notification |
|
597 | + * @param string $msg the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev |
|
598 | + * @param string $file the file that the error occurred in - just use __FILE__ |
|
599 | + * @param string $func the function/method that the error occurred in - just use __FUNCTION__ |
|
600 | + * @param string $line the line number where the error occurred - just use __LINE__ |
|
601 | + * @return void |
|
602 | + */ |
|
603 | 603 | private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
604 | 604 | if ( empty( $msg )) { |
605 | 605 | EE_Error::doing_it_wrong( |
@@ -643,11 +643,11 @@ discard block |
||
643 | 643 | |
644 | 644 | |
645 | 645 | /** |
646 | - * in some case it may be necessary to overwrite the existing success messages |
|
647 | - * |
|
648 | - * @access public |
|
649 | - * @return void |
|
650 | - */ |
|
646 | + * in some case it may be necessary to overwrite the existing success messages |
|
647 | + * |
|
648 | + * @access public |
|
649 | + * @return void |
|
650 | + */ |
|
651 | 651 | public static function overwrite_success() { |
652 | 652 | self::$_espresso_notices['success'] = FALSE; |
653 | 653 | } |
@@ -657,11 +657,11 @@ discard block |
||
657 | 657 | |
658 | 658 | |
659 | 659 | /** |
660 | - * in some case it may be necessary to overwrite the existing attention messages |
|
661 | - * |
|
662 | - * @access public |
|
663 | - * @return void |
|
664 | - */ |
|
660 | + * in some case it may be necessary to overwrite the existing attention messages |
|
661 | + * |
|
662 | + * @access public |
|
663 | + * @return void |
|
664 | + */ |
|
665 | 665 | public static function overwrite_attention() { |
666 | 666 | self::$_espresso_notices['attention'] = FALSE; |
667 | 667 | } |
@@ -671,11 +671,11 @@ discard block |
||
671 | 671 | |
672 | 672 | |
673 | 673 | /** |
674 | - * in some case it may be necessary to overwrite the existing error messages |
|
675 | - * |
|
676 | - * @access public |
|
677 | - * @return void |
|
678 | - */ |
|
674 | + * in some case it may be necessary to overwrite the existing error messages |
|
675 | + * |
|
676 | + * @access public |
|
677 | + * @return void |
|
678 | + */ |
|
679 | 679 | public static function overwrite_errors() { |
680 | 680 | self::$_espresso_notices['errors'] = FALSE; |
681 | 681 | } |
@@ -683,24 +683,24 @@ discard block |
||
683 | 683 | |
684 | 684 | |
685 | 685 | /** |
686 | - * reset_notices |
|
687 | - * @access private |
|
688 | - * @return void |
|
689 | - */ |
|
686 | + * reset_notices |
|
687 | + * @access private |
|
688 | + * @return void |
|
689 | + */ |
|
690 | 690 | public static function reset_notices(){ |
691 | - self::$_espresso_notices['success'] = FALSE; |
|
692 | - self::$_espresso_notices['attention'] = FALSE; |
|
693 | - self::$_espresso_notices['errors'] = FALSE; |
|
694 | - } |
|
691 | + self::$_espresso_notices['success'] = FALSE; |
|
692 | + self::$_espresso_notices['attention'] = FALSE; |
|
693 | + self::$_espresso_notices['errors'] = FALSE; |
|
694 | + } |
|
695 | 695 | |
696 | 696 | |
697 | 697 | |
698 | 698 | /** |
699 | - * has_errors |
|
700 | - * @access public |
|
701 | - * @return int |
|
702 | - */ |
|
703 | - public static function has_notices(){ |
|
699 | + * has_errors |
|
700 | + * @access public |
|
701 | + * @return int |
|
702 | + */ |
|
703 | + public static function has_notices(){ |
|
704 | 704 | $has_notices = 0; |
705 | 705 | // check for success messages |
706 | 706 | $has_notices = self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] ) ? 3 : $has_notices; |
@@ -714,14 +714,14 @@ discard block |
||
714 | 714 | |
715 | 715 | |
716 | 716 | /** |
717 | - * compile all error or success messages into one string |
|
718 | - * |
|
719 | - * @access public |
|
720 | - * @param boolean $format_output whether or not to format the messages for display in the WP admin |
|
721 | - * @param boolean $save_to_transient whether or not to save notices to the db for retrieval on next request - ONLY do this just before redirecting |
|
722 | - * @param boolean $remove_empty whether or not to unset empty messages |
|
723 | - * @return array |
|
724 | - */ |
|
717 | + * compile all error or success messages into one string |
|
718 | + * |
|
719 | + * @access public |
|
720 | + * @param boolean $format_output whether or not to format the messages for display in the WP admin |
|
721 | + * @param boolean $save_to_transient whether or not to save notices to the db for retrieval on next request - ONLY do this just before redirecting |
|
722 | + * @param boolean $remove_empty whether or not to unset empty messages |
|
723 | + * @return array |
|
724 | + */ |
|
725 | 725 | public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) { |
726 | 726 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
727 | 727 | |
@@ -833,14 +833,14 @@ discard block |
||
833 | 833 | |
834 | 834 | |
835 | 835 | /** |
836 | - * add_persistent_admin_notice |
|
837 | - * |
|
838 | - * @access public |
|
839 | - * @param string $pan_name the name, or key of the Persistent Admin Notice to be stored |
|
840 | - * @param string $pan_message the message to be stored persistently until dismissed |
|
841 | - * @param bool $force_update allows one to enforce the reappearance of a persistent message. |
|
842 | - * @return void |
|
843 | - */ |
|
836 | + * add_persistent_admin_notice |
|
837 | + * |
|
838 | + * @access public |
|
839 | + * @param string $pan_name the name, or key of the Persistent Admin Notice to be stored |
|
840 | + * @param string $pan_message the message to be stored persistently until dismissed |
|
841 | + * @param bool $force_update allows one to enforce the reappearance of a persistent message. |
|
842 | + * @return void |
|
843 | + */ |
|
844 | 844 | public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) { |
845 | 845 | if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
846 | 846 | $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
@@ -904,9 +904,9 @@ discard block |
||
904 | 904 | * display_persistent_admin_notices |
905 | 905 | * |
906 | 906 | * @access public |
907 | - * @param string $pan_name the name, or key of the Persistent Admin Notice to be stored |
|
908 | - * @param string $pan_name the message to be stored persistently until dismissed |
|
909 | - * @param string $return_url URL to go back to aftger nag notice is dismissed |
|
907 | + * @param string $pan_name the name, or key of the Persistent Admin Notice to be stored |
|
908 | + * @param string $pan_name the message to be stored persistently until dismissed |
|
909 | + * @param string $return_url URL to go back to aftger nag notice is dismissed |
|
910 | 910 | * @return string |
911 | 911 | */ |
912 | 912 | public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) { |
@@ -995,11 +995,11 @@ discard block |
||
995 | 995 | |
996 | 996 | |
997 | 997 | /** |
998 | - * enqueue_error_scripts |
|
999 | - * |
|
1000 | - * @access public |
|
1001 | - * @return void |
|
1002 | - */ |
|
998 | + * enqueue_error_scripts |
|
999 | + * |
|
1000 | + * @access public |
|
1001 | + * @return void |
|
1002 | + */ |
|
1003 | 1003 | public static function enqueue_error_scripts() { |
1004 | 1004 | self::_print_scripts(); |
1005 | 1005 | } |
@@ -1007,15 +1007,15 @@ discard block |
||
1007 | 1007 | |
1008 | 1008 | |
1009 | 1009 | /** |
1010 | - * create error code from filepath, function name, |
|
1011 | - * and line number where exception or error was thrown |
|
1012 | - * |
|
1013 | - * @access public |
|
1014 | - * @ param string $file |
|
1015 | - * @ param string $func |
|
1016 | - * @ param string $line |
|
1017 | - * @ return string |
|
1018 | - */ |
|
1010 | + * create error code from filepath, function name, |
|
1011 | + * and line number where exception or error was thrown |
|
1012 | + * |
|
1013 | + * @access public |
|
1014 | + * @ param string $file |
|
1015 | + * @ param string $func |
|
1016 | + * @ param string $line |
|
1017 | + * @ return string |
|
1018 | + */ |
|
1019 | 1019 | public static function generate_error_code ( $file = '', $func = '', $line = '' ) { |
1020 | 1020 | $file = explode( '.', basename( $file )); |
1021 | 1021 | $error_code = ! empty( $file[0] ) ? $file[0] : ''; |
@@ -1029,13 +1029,13 @@ discard block |
||
1029 | 1029 | |
1030 | 1030 | |
1031 | 1031 | /** |
1032 | - * write exception details to log file |
|
1033 | - * |
|
1034 | - * @access public |
|
1035 | - * @ param timestamp $time |
|
1036 | - * @ param object $ex |
|
1037 | - * @ return void |
|
1038 | - */ |
|
1032 | + * write exception details to log file |
|
1033 | + * |
|
1034 | + * @access public |
|
1035 | + * @ param timestamp $time |
|
1036 | + * @ param object $ex |
|
1037 | + * @ return void |
|
1038 | + */ |
|
1039 | 1039 | public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) { |
1040 | 1040 | |
1041 | 1041 | if ( ! $ex ) { |
@@ -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 | * |
4 | 6 | * Class EE_Log |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | 2 | /** |
3 | 3 | * |
4 | 4 | * Class EE_Log |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @return EE_Log |
63 | 63 | */ |
64 | 64 | public static function instance() { |
65 | - if ( ! self::$_instance instanceof EE_Log ) { |
|
65 | + if ( ! self::$_instance instanceof EE_Log) { |
|
66 | 66 | self::$_instance = new self(); |
67 | 67 | } |
68 | 68 | return self::$_instance; |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | */ |
75 | 75 | private function __construct() { |
76 | 76 | |
77 | - if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging ) { |
|
77 | + if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | |
81 | - $this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS; |
|
81 | + $this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS; |
|
82 | 82 | $this->_log_file = EE_Registry::instance()->CFG->admin->log_file_name(); |
83 | 83 | $this->_log = ''; |
84 | 84 | $this->_debug_file = EE_Registry::instance()->CFG->admin->debug_file_name(); |
@@ -86,15 +86,15 @@ discard block |
||
86 | 86 | $this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url; |
87 | 87 | $this->_remote_log = ''; |
88 | 88 | |
89 | - add_action( 'admin_init', array( $this, 'verify_filesystem' ), -10 ); |
|
90 | - add_action( 'AHEE_log', array( $this, 'log' ), 10, 4 ); |
|
91 | - if ( EE_Registry::instance()->CFG->admin->use_full_logging ) { |
|
92 | - add_action( 'shutdown', array( $this, 'write_log' ), 9999 ); |
|
89 | + add_action('admin_init', array($this, 'verify_filesystem'), -10); |
|
90 | + add_action('AHEE_log', array($this, 'log'), 10, 4); |
|
91 | + if (EE_Registry::instance()->CFG->admin->use_full_logging) { |
|
92 | + add_action('shutdown', array($this, 'write_log'), 9999); |
|
93 | 93 | // if WP_DEBUG |
94 | - add_action( 'shutdown', array( $this, 'write_debug' ), 9999 ); |
|
94 | + add_action('shutdown', array($this, 'write_debug'), 9999); |
|
95 | 95 | } |
96 | - if ( EE_Registry::instance()->CFG->admin->use_remote_logging ) { |
|
97 | - add_action( 'shutdown', array( $this, 'send_log' ), 9999 ); |
|
96 | + if (EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
97 | + add_action('shutdown', array($this, 'send_log'), 9999); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | } |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function verify_filesystem() { |
110 | 110 | try { |
111 | - EE_Registry::instance()->load_helper( 'File' ); |
|
112 | - EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_log_file ); |
|
113 | - EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_debug_file ); |
|
114 | - EEH_File::add_htaccess_deny_from_all( $this->_logs_folder ); |
|
115 | - } catch( EE_Error $e ){ |
|
116 | - EE_Error::add_error( sprintf( __( 'Event Espresso logging could not be setup because: %s', 'event_espresso' ), ' ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
111 | + EE_Registry::instance()->load_helper('File'); |
|
112 | + EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_log_file); |
|
113 | + EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_debug_file); |
|
114 | + EEH_File::add_htaccess_deny_from_all($this->_logs_folder); |
|
115 | + } catch (EE_Error $e) { |
|
116 | + EE_Error::add_error(sprintf(__('Event Espresso logging could not be setup because: %s', 'event_espresso'), ' '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
117 | 117 | return; |
118 | 118 | } |
119 | 119 | } |
@@ -130,15 +130,15 @@ discard block |
||
130 | 130 | * @param string $type |
131 | 131 | * @return string |
132 | 132 | */ |
133 | - private function _format_message( $file = '', $function = '', $message = '', $type = '' ) { |
|
134 | - $msg = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
135 | - $msg .= '[' . current_time( 'mysql' ) . '] '; |
|
136 | - $msg .= ! empty( $file ) ? basename( $file ) : ''; |
|
137 | - $msg .= ! empty( $file ) && ! empty( $function ) ? ' -> ' : ''; |
|
138 | - $msg .= ! empty( $function ) ? $function . '()' : ''; |
|
133 | + private function _format_message($file = '', $function = '', $message = '', $type = '') { |
|
134 | + $msg = '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
135 | + $msg .= '['.current_time('mysql').'] '; |
|
136 | + $msg .= ! empty($file) ? basename($file) : ''; |
|
137 | + $msg .= ! empty($file) && ! empty($function) ? ' -> ' : ''; |
|
138 | + $msg .= ! empty($function) ? $function.'()' : ''; |
|
139 | 139 | $msg .= PHP_EOL; |
140 | - $type = ! empty( $type ) ? $type : 'log message'; |
|
141 | - $msg .= ! empty( $message ) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : ''; |
|
140 | + $type = ! empty($type) ? $type : 'log message'; |
|
141 | + $msg .= ! empty($message) ? "\t".'['.$type.'] '.$message.PHP_EOL : ''; |
|
142 | 142 | return $msg; |
143 | 143 | } |
144 | 144 | |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | * @param string $message |
154 | 154 | * @param string $type |
155 | 155 | */ |
156 | - public function log( $file = '', $function = '', $message = '', $type = '' ) { |
|
157 | - $this->_log .= $this->_format_message( $file, $function, $message, $type ); |
|
156 | + public function log($file = '', $function = '', $message = '', $type = '') { |
|
157 | + $this->_log .= $this->_format_message($file, $function, $message, $type); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | public function write_log() { |
167 | 167 | try { |
168 | 168 | //get existing log file and append new log info |
169 | - $this->_log = EEH_File::get_file_contents( $this->_logs_folder . $this->_log_file ) . $this->_log; |
|
170 | - EEH_File::write_to_file( $this->_logs_folder . $this->_log_file, $this->_log, 'Event Espresso Log' ); |
|
171 | - } catch( EE_Error $e ){ |
|
172 | - EE_Error::add_error( sprintf( __( 'Could not write to the Event Espresso log file because: %s', 'event_espresso' ), ' ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
169 | + $this->_log = EEH_File::get_file_contents($this->_logs_folder.$this->_log_file).$this->_log; |
|
170 | + EEH_File::write_to_file($this->_logs_folder.$this->_log_file, $this->_log, 'Event Espresso Log'); |
|
171 | + } catch (EE_Error $e) { |
|
172 | + EE_Error::add_error(sprintf(__('Could not write to the Event Espresso log file because: %s', 'event_espresso'), ' '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
173 | 173 | return; |
174 | 174 | } |
175 | 175 | } |
@@ -182,31 +182,31 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function send_log() { |
184 | 184 | |
185 | - if ( empty( $this->_remote_logging_url )) { |
|
185 | + if (empty($this->_remote_logging_url)) { |
|
186 | 186 | return; |
187 | 187 | } |
188 | 188 | |
189 | - $data = 'domain=' . $_SERVER['HTTP_HOST']; |
|
190 | - $data .= '&ip=' . $_SERVER['SERVER_ADDR']; |
|
191 | - $data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE']; |
|
192 | - $data .= '&time=' . time(); |
|
193 | - $data .= '&remote_log=' . $this->_log; |
|
194 | - $data .= '&request_array=' . json_encode( $_REQUEST ); |
|
189 | + $data = 'domain='.$_SERVER['HTTP_HOST']; |
|
190 | + $data .= '&ip='.$_SERVER['SERVER_ADDR']; |
|
191 | + $data .= '&server_type='.$_SERVER['SERVER_SOFTWARE']; |
|
192 | + $data .= '&time='.time(); |
|
193 | + $data .= '&remote_log='.$this->_log; |
|
194 | + $data .= '&request_array='.json_encode($_REQUEST); |
|
195 | 195 | $data .= '&action=save'; |
196 | 196 | |
197 | - if ( defined( 'EELOGGING_PASS' )) { |
|
198 | - $data .= '&pass=' . EELOGGING_PASS; |
|
197 | + if (defined('EELOGGING_PASS')) { |
|
198 | + $data .= '&pass='.EELOGGING_PASS; |
|
199 | 199 | } |
200 | - if ( defined( 'EELOGGING_KEY' )) { |
|
201 | - $data .= '&key=' . EELOGGING_KEY; |
|
200 | + if (defined('EELOGGING_KEY')) { |
|
201 | + $data .= '&key='.EELOGGING_KEY; |
|
202 | 202 | } |
203 | 203 | |
204 | - $c = curl_init( $this->_remote_logging_url ); |
|
205 | - curl_setopt( $c, CURLOPT_POST, TRUE ); |
|
206 | - curl_setopt( $c, CURLOPT_POSTFIELDS, $data ); |
|
207 | - curl_setopt( $c, CURLOPT_RETURNTRANSFER, TRUE ); |
|
208 | - curl_exec( $c ); |
|
209 | - curl_close( $c ); |
|
204 | + $c = curl_init($this->_remote_logging_url); |
|
205 | + curl_setopt($c, CURLOPT_POST, TRUE); |
|
206 | + curl_setopt($c, CURLOPT_POSTFIELDS, $data); |
|
207 | + curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE); |
|
208 | + curl_exec($c); |
|
209 | + curl_close($c); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
@@ -217,18 +217,18 @@ discard block |
||
217 | 217 | * previous entries are overwritten |
218 | 218 | */ |
219 | 219 | public function write_debug() { |
220 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
220 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
221 | 221 | $this->_debug_log = ''; |
222 | - foreach ( $_GET as $key => $value ) { |
|
223 | - $this->_debug_log .= '$_GET["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL; |
|
222 | + foreach ($_GET as $key => $value) { |
|
223 | + $this->_debug_log .= '$_GET["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL; |
|
224 | 224 | } |
225 | - foreach ( $_POST as $key => $value ) { |
|
226 | - $this->_debug_log .= '$_POST["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL; |
|
225 | + foreach ($_POST as $key => $value) { |
|
226 | + $this->_debug_log .= '$_POST["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL; |
|
227 | 227 | } |
228 | 228 | try { |
229 | - EEH_File::write_to_file( $this->_logs_folder . $this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log' ); |
|
230 | - } catch( EE_Error $e ){ |
|
231 | - EE_Error::add_error( sprintf( __( 'Could not write to the Event Espresso debug log file because: %s', 'event_espresso' ), ' ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
229 | + EEH_File::write_to_file($this->_logs_folder.$this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log'); |
|
230 | + } catch (EE_Error $e) { |
|
231 | + EE_Error::add_error(sprintf(__('Could not write to the Event Espresso debug log file because: %s', 'event_espresso'), ' '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
232 | 232 | return; |
233 | 233 | } |
234 | 234 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * __clone |
241 | 241 | */ |
242 | 242 | public function __clone() { |
243 | - trigger_error( __( 'Clone is not allowed.', 'event_espresso' ), E_USER_ERROR ); |
|
243 | + trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 |
@@ -78,8 +78,8 @@ |
||
78 | 78 | |
79 | 79 | |
80 | 80 | /** |
81 | - * @var EE_CPT_Base |
|
82 | - */ |
|
81 | + * @var EE_CPT_Base |
|
82 | + */ |
|
83 | 83 | protected $_cpt_model_obj = FALSE; |
84 | 84 | |
85 | 85 |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param object $post The post object of the cpt that was saved. |
114 | 114 | * @return void |
115 | 115 | */ |
116 | - abstract protected function _insert_update_cpt_item( $post_id, $post ); |
|
116 | + abstract protected function _insert_update_cpt_item($post_id, $post); |
|
117 | 117 | |
118 | 118 | |
119 | 119 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param string $post_id The ID of the cpt that was trashed |
127 | 127 | * @return void |
128 | 128 | */ |
129 | - abstract public function trash_cpt_item( $post_id ); |
|
129 | + abstract public function trash_cpt_item($post_id); |
|
130 | 130 | |
131 | 131 | |
132 | 132 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param string $post_id theID of the cpt that was untrashed |
138 | 138 | * @return void |
139 | 139 | */ |
140 | - abstract public function restore_cpt_item( $post_id ); |
|
140 | + abstract public function restore_cpt_item($post_id); |
|
141 | 141 | |
142 | 142 | |
143 | 143 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param string $post_id the ID of the cpt that was deleted |
149 | 149 | * @return void |
150 | 150 | */ |
151 | - abstract public function delete_cpt_item( $post_id ); |
|
151 | + abstract public function delete_cpt_item($post_id); |
|
152 | 152 | |
153 | 153 | |
154 | 154 | |
@@ -161,32 +161,32 @@ discard block |
||
161 | 161 | */ |
162 | 162 | protected function _before_page_setup() { |
163 | 163 | |
164 | - $page = isset( $this->_req_data['page'] ) ? $this->_req_data['page'] : $this->page_slug; |
|
164 | + $page = isset($this->_req_data['page']) ? $this->_req_data['page'] : $this->page_slug; |
|
165 | 165 | |
166 | - $this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes ); |
|
166 | + $this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes); |
|
167 | 167 | |
168 | 168 | //let's see if the current route has a value for cpt_object_slug if it does we use that instead of the page |
169 | - $this->_cpt_object = isset($this->_req_data['action']) && isset( $this->_cpt_routes[$this->_req_data['action']] ) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object( $page ); |
|
169 | + $this->_cpt_object = isset($this->_req_data['action']) && isset($this->_cpt_routes[$this->_req_data['action']]) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object($page); |
|
170 | 170 | |
171 | 171 | //tweak pagenow for page loading. |
172 | - if( ! $this->_pagenow_map ) { |
|
172 | + if ( ! $this->_pagenow_map) { |
|
173 | 173 | $this->_pagenow_map = array( |
174 | 174 | 'create_new' => 'post-new.php', |
175 | 175 | 'edit' => 'post.php', |
176 | 176 | 'trash' => 'post.php' |
177 | 177 | ); |
178 | 178 | } |
179 | - add_action( 'current_screen', array( $this, 'modify_pagenow') ); |
|
179 | + add_action('current_screen', array($this, 'modify_pagenow')); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | //TODO the below will need to be reworked to account for the cpt routes that are NOT based off of page but action param. |
183 | 183 | //get current page from autosave |
184 | - $current_page = isset( $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] ) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL; |
|
185 | - $this->_current_page = isset( $this->_req_data['current_page'] ) ? $this->_req_data['current_page'] : $current_page; |
|
184 | + $current_page = isset($this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page']) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL; |
|
185 | + $this->_current_page = isset($this->_req_data['current_page']) ? $this->_req_data['current_page'] : $current_page; |
|
186 | 186 | |
187 | 187 | |
188 | 188 | //autosave... make sure its only for the correct page |
189 | - if ( !empty($this->_current_page ) && $this->_current_page == $this->page_slug ) { |
|
189 | + if ( ! empty($this->_current_page) && $this->_current_page == $this->page_slug) { |
|
190 | 190 | //setup autosave ajax hook |
191 | 191 | //add_action('wp_ajax_ee-autosave', array( $this, 'do_extra_autosave_stuff' ), 10 ); //TODO reactivate when 4.2 autosave is implemented |
192 | 192 | } |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return void |
204 | 204 | */ |
205 | - public function modify_pagenow( $current_screen ) { |
|
205 | + public function modify_pagenow($current_screen) { |
|
206 | 206 | global $pagenow; |
207 | 207 | //possibly reset pagenow. |
208 | - if ( ! empty( $this->_req_data['page'] ) && $this->_req_data['page'] == $this->page_slug && !empty( $this->_req_data['action'] ) && isset( $this->_pagenow_map[$this->_req_data['action'] ] ) ) { |
|
208 | + if ( ! empty($this->_req_data['page']) && $this->_req_data['page'] == $this->page_slug && ! empty($this->_req_data['action']) && isset($this->_pagenow_map[$this->_req_data['action']])) { |
|
209 | 209 | $pagenow = $this->_pagenow_map[$this->_req_data['action']]; |
210 | 210 | } |
211 | 211 | } |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | * @param array $ids an array of ids for containers that hold form inputs we want autosave to pickup. Typically you would send along the id of a metabox container. |
221 | 221 | * @return void |
222 | 222 | */ |
223 | - protected function _register_autosave_containers( $ids ) { |
|
224 | - $this->_autosave_containers = array_merge( $this->_autosave_fields, (array) $ids ); |
|
223 | + protected function _register_autosave_containers($ids) { |
|
224 | + $this->_autosave_containers = array_merge($this->_autosave_fields, (array) $ids); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | |
@@ -236,22 +236,22 @@ discard block |
||
236 | 236 | |
237 | 237 | $containers = array(); |
238 | 238 | |
239 | - if ( empty( $wp_meta_boxes ) ) |
|
239 | + if (empty($wp_meta_boxes)) |
|
240 | 240 | return; |
241 | 241 | |
242 | - $current_metaboxes = isset( $wp_meta_boxes[$this->page_slug] ) ? $wp_meta_boxes[$this->page_slug] : array(); |
|
242 | + $current_metaboxes = isset($wp_meta_boxes[$this->page_slug]) ? $wp_meta_boxes[$this->page_slug] : array(); |
|
243 | 243 | |
244 | - foreach ( $current_metaboxes as $box_context ) { |
|
245 | - foreach ( $box_context as $box_details ) { |
|
246 | - foreach ( $box_details as $box ) { |
|
247 | - if ( is_array( $box['callback'] ) && ( $box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks ) ){ |
|
244 | + foreach ($current_metaboxes as $box_context) { |
|
245 | + foreach ($box_context as $box_details) { |
|
246 | + foreach ($box_details as $box) { |
|
247 | + if (is_array($box['callback']) && ($box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks)) { |
|
248 | 248 | $containers[] = $box['id']; |
249 | 249 | } |
250 | 250 | } |
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
254 | - $this->_autosave_containers = array_merge( $this->_autosave_containers, $containers ); |
|
254 | + $this->_autosave_containers = array_merge($this->_autosave_containers, $containers); |
|
255 | 255 | |
256 | 256 | //add hidden inputs container |
257 | 257 | $this->_autosave_containers[] = 'ee-cpt-hidden-inputs'; |
@@ -268,13 +268,13 @@ discard block |
||
268 | 268 | wp_enqueue_script('cpt-autosave');/**/ //todo re-enable when we start doing autosave again in 4.2 |
269 | 269 | |
270 | 270 | //filter _autosave_containers |
271 | - $containers = apply_filters( 'FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this ); |
|
272 | - $containers = apply_filters( 'FHEE__EE_Admin_Page_CPT__' . get_class($this) . '___load_autosave_scripts_styles__containers', $containers, $this ); |
|
271 | + $containers = apply_filters('FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this); |
|
272 | + $containers = apply_filters('FHEE__EE_Admin_Page_CPT__'.get_class($this).'___load_autosave_scripts_styles__containers', $containers, $this); |
|
273 | 273 | |
274 | - wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers ); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave" |
|
274 | + wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave" |
|
275 | 275 | |
276 | 276 | $unsaved_data_msg = array( |
277 | - 'eventmsg' => sprintf( __("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
277 | + 'eventmsg' => sprintf(__("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
278 | 278 | 'inputChanged' => 0 |
279 | 279 | ); |
280 | 280 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | public function load_page_dependencies() { |
287 | 287 | try { |
288 | 288 | $this->_load_page_dependencies(); |
289 | - } catch ( EE_Error $e ) { |
|
289 | + } catch (EE_Error $e) { |
|
290 | 290 | $e->get_error(); |
291 | 291 | } |
292 | 292 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | protected function _load_page_dependencies() { |
303 | 303 | |
304 | 304 | //we only add stuff if this is a cpt_route! |
305 | - if ( !$this->_cpt_route ) { |
|
305 | + if ( ! $this->_cpt_route) { |
|
306 | 306 | parent::_load_page_dependencies(); |
307 | 307 | return; |
308 | 308 | } |
@@ -312,72 +312,72 @@ discard block |
||
312 | 312 | |
313 | 313 | //the following filters are for setting all the redirects on DEFAULT WP custom post type actions |
314 | 314 | //let's add a hidden input to the post-edit form so we know when we have to trigger our custom redirects! Otherwise the redirects will happen on ALL post saves which wouldn't be good of course! |
315 | - add_action('edit_form_after_title', array( $this, 'cpt_post_form_hidden_input') ); |
|
315 | + add_action('edit_form_after_title', array($this, 'cpt_post_form_hidden_input')); |
|
316 | 316 | |
317 | 317 | //inject our Admin page nav tabs... |
318 | 318 | //let's make sure the nav tabs are set if they aren't already |
319 | 319 | //if ( empty( $this->_nav_tabs ) ) $this->_set_nav_tabs(); |
320 | - add_action('post_edit_form_tag', array( $this, 'inject_nav_tabs' ) ); |
|
320 | + add_action('post_edit_form_tag', array($this, 'inject_nav_tabs')); |
|
321 | 321 | |
322 | 322 | //modify the post_updated messages array |
323 | - add_action('post_updated_messages', array( $this, 'post_update_messages' ), 10 ); |
|
323 | + add_action('post_updated_messages', array($this, 'post_update_messages'), 10); |
|
324 | 324 | |
325 | 325 | //add shortlink button to cpt edit screens. We can do this as a universal thing BECAUSE, cpts use the same format for shortlinks as posts! |
326 | - add_filter( 'pre_get_shortlink', array( $this, 'add_shortlink_button_to_editor' ), 10, 4 ); |
|
326 | + add_filter('pre_get_shortlink', array($this, 'add_shortlink_button_to_editor'), 10, 4); |
|
327 | 327 | |
328 | 328 | //This basically allows us to change the title of the "publish" metabox area on CPT pages by setting a 'publishbox' value in the $_labels property array in the child class. |
329 | - if ( !empty($this->_labels['publishbox'] ) ) { |
|
329 | + if ( ! empty($this->_labels['publishbox'])) { |
|
330 | 330 | |
331 | - $box_label = is_array( $this->_labels['publishbox'] ) && isset( $this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
331 | + $box_label = is_array($this->_labels['publishbox']) && isset($this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
332 | 332 | |
333 | - remove_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
334 | - add_meta_box( 'submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
333 | + remove_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
334 | + add_meta_box('submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | //let's add page_templates metabox if this cpt added support for it. |
338 | - if ( $this->_supports_page_templates($this->_cpt_object->name) ) { |
|
339 | - add_meta_box( 'page_templates', __('Page Template', 'event_espresso' ), array( $this, 'page_template_meta_box' ), $this->_cpt_routes[$this->_req_action], 'side', 'default' ); |
|
338 | + if ($this->_supports_page_templates($this->_cpt_object->name)) { |
|
339 | + add_meta_box('page_templates', __('Page Template', 'event_espresso'), array($this, 'page_template_meta_box'), $this->_cpt_routes[$this->_req_action], 'side', 'default'); |
|
340 | 340 | }/**/ |
341 | 341 | |
342 | 342 | |
343 | 343 | //this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form |
344 | - if ( method_exists( $this, 'extra_permalink_field_buttons' ) ) |
|
345 | - add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 ); |
|
344 | + if (method_exists($this, 'extra_permalink_field_buttons')) |
|
345 | + add_filter('get_sample_permalink_html', array($this, 'extra_permalink_field_buttons'), 10, 4); |
|
346 | 346 | |
347 | 347 | //add preview button |
348 | - add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4 ); |
|
348 | + add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4); |
|
349 | 349 | |
350 | 350 | |
351 | 351 | //insert our own post_stati dropdown |
352 | - add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown' ), 10 ); |
|
352 | + add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown'), 10); |
|
353 | 353 | |
354 | 354 | //This allows adding additional information to the publish post submitbox on the wp post edit form |
355 | - if ( method_exists( $this, 'extra_misc_actions_publish_box' ) ) |
|
356 | - add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 ); |
|
355 | + if (method_exists($this, 'extra_misc_actions_publish_box')) |
|
356 | + add_action('post_submitbox_misc_actions', array($this, 'extra_misc_actions_publish_box'), 10); |
|
357 | 357 | |
358 | 358 | //This allows for adding additional stuff after the title field on the wp post edit form. This is also before the wp_editor for post description field. |
359 | - if ( method_exists( $this, 'edit_form_after_title' ) ) |
|
360 | - add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 ); |
|
359 | + if (method_exists($this, 'edit_form_after_title')) |
|
360 | + add_action('edit_form_after_title', array($this, 'edit_form_after_title'), 10); |
|
361 | 361 | |
362 | 362 | |
363 | 363 | /** |
364 | 364 | * Filtering WP's esc_url to capture urls pointing to core wp routes so they point to our route. |
365 | 365 | */ |
366 | - add_filter( 'clean_url', array( $this, 'switch_core_wp_urls_with_ours' ), 10, 3 ); |
|
366 | + add_filter('clean_url', array($this, 'switch_core_wp_urls_with_ours'), 10, 3); |
|
367 | 367 | |
368 | 368 | |
369 | 369 | parent::_load_page_dependencies(); |
370 | 370 | |
371 | 371 | //notice we are ALSO going to load the pagenow hook set for this route (see _before_page_setup for the reset of the pagenow global ). This is for any plugins that are doing things properly and hooking into the load page hook for core wp cpt routes. |
372 | 372 | global $pagenow; |
373 | - do_action( 'load-' . $pagenow ); |
|
373 | + do_action('load-'.$pagenow); |
|
374 | 374 | |
375 | 375 | $this->modify_current_screen(); |
376 | - add_action( 'admin_enqueue_scripts', array( $this, 'setup_autosave_hooks'), 30 ); |
|
376 | + add_action('admin_enqueue_scripts', array($this, 'setup_autosave_hooks'), 30); |
|
377 | 377 | //we route REALLY early. |
378 | 378 | try { |
379 | 379 | $this->_route_admin_request(); |
380 | - } catch ( EE_Error $e ) { |
|
380 | + } catch (EE_Error $e) { |
|
381 | 381 | $e->get_error(); |
382 | 382 | } |
383 | 383 | } |
@@ -396,21 +396,21 @@ discard block |
||
396 | 396 | * |
397 | 397 | * @return string possibly a new url for our route. |
398 | 398 | */ |
399 | - public function switch_core_wp_urls_with_ours( $good_protocol_url, $original_url, $_context ) { |
|
399 | + public function switch_core_wp_urls_with_ours($good_protocol_url, $original_url, $_context) { |
|
400 | 400 | $routes_to_match = array( |
401 | 401 | 0 => array( |
402 | 402 | 'edit.php?post_type=espresso_attendees', |
403 | 403 | 'admin.php?page=espresso_registrations&action=contact_list' |
404 | 404 | ), |
405 | 405 | 1 => array( |
406 | - 'edit.php?post_type=' . $this->_cpt_object->name, |
|
407 | - 'admin.php?page=' . $this->_cpt_object->name |
|
406 | + 'edit.php?post_type='.$this->_cpt_object->name, |
|
407 | + 'admin.php?page='.$this->_cpt_object->name |
|
408 | 408 | ) |
409 | 409 | ); |
410 | 410 | |
411 | - foreach( $routes_to_match as $route_matches ) { |
|
412 | - if ( strpos( $good_protocol_url, $route_matches[0] ) !== false ) { |
|
413 | - return str_replace( $route_matches[0], $route_matches[1], $good_protocol_url ); |
|
411 | + foreach ($routes_to_match as $route_matches) { |
|
412 | + if (strpos($good_protocol_url, $route_matches[0]) !== false) { |
|
413 | + return str_replace($route_matches[0], $route_matches[1], $good_protocol_url); |
|
414 | 414 | |
415 | 415 | } |
416 | 416 | } |
@@ -426,10 +426,10 @@ discard block |
||
426 | 426 | * @param string $cpt_name The cpt slug we're checking on. |
427 | 427 | * @return bool True supported, false not. |
428 | 428 | */ |
429 | - private function _supports_page_templates( $cpt_name ) { |
|
429 | + private function _supports_page_templates($cpt_name) { |
|
430 | 430 | $cpt_args = EE_Register_CPTs::get_CPTs(); |
431 | - $cpt_args = isset( $cpt_args[$cpt_name] ) ? $cpt_args[$cpt_name]['args'] : array(); |
|
432 | - return ! empty( $cpt_args['page_templates'] ) ? TRUE : FALSE; |
|
431 | + $cpt_args = isset($cpt_args[$cpt_name]) ? $cpt_args[$cpt_name]['args'] : array(); |
|
432 | + return ! empty($cpt_args['page_templates']) ? TRUE : FALSE; |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -444,9 +444,9 @@ discard block |
||
444 | 444 | public function page_template_meta_box() { |
445 | 445 | global $post; |
446 | 446 | $template = ''; |
447 | - if ( count( get_page_templates( $post ) ) != 0 ) { |
|
448 | - $page_template = get_post_meta( $post->ID, '_wp_page_template', TRUE ); |
|
449 | - $template = !empty( $page_template ) ? $page_template : ''; |
|
447 | + if (count(get_page_templates($post)) != 0) { |
|
448 | + $page_template = get_post_meta($post->ID, '_wp_page_template', TRUE); |
|
449 | + $template = ! empty($page_template) ? $page_template : ''; |
|
450 | 450 | } |
451 | 451 | ?> |
452 | 452 | <p><strong><?php _e('Template') ?></strong></p> |
@@ -470,10 +470,10 @@ discard block |
||
470 | 470 | * @param string $new_slug what the slug is |
471 | 471 | * @return string The new html string for the permalink area |
472 | 472 | */ |
473 | - public function preview_button_html( $return, $id, $new_title, $new_slug ) { |
|
474 | - $post = get_post( $id ); |
|
475 | - if ( 'publish' != get_post_status( $post ) ) { |
|
476 | - $return .= '<span_id="view-post-btn"><a href="' . wp_get_shortlink($id, 'post') . '" class="button button-small">' . __('Preview', 'event_espresso') . '</a></span>' . "\n"; |
|
473 | + public function preview_button_html($return, $id, $new_title, $new_slug) { |
|
474 | + $post = get_post($id); |
|
475 | + if ('publish' != get_post_status($post)) { |
|
476 | + $return .= '<span_id="view-post-btn"><a href="'.wp_get_shortlink($id, 'post').'" class="button button-small">'.__('Preview', 'event_espresso').'</a></span>'."\n"; |
|
477 | 477 | } |
478 | 478 | return $return; |
479 | 479 | } |
@@ -493,18 +493,18 @@ discard block |
||
493 | 493 | 'cur_status' => $this->_cpt_model_obj->status(), |
494 | 494 | 'statuses' => $statuses, |
495 | 495 | 'cur_status_label' => $cur_status_label, |
496 | - 'localized_status_save' => sprintf( __('Save %s', 'event_espresso'), $cur_status_label ) |
|
496 | + 'localized_status_save' => sprintf(__('Save %s', 'event_espresso'), $cur_status_label) |
|
497 | 497 | ); |
498 | 498 | |
499 | 499 | //we'll add a trash post status (WP doesn't add one for some reason) |
500 | - if ( $this->_cpt_model_obj->status() == 'trash' ) { |
|
500 | + if ($this->_cpt_model_obj->status() == 'trash') { |
|
501 | 501 | $template_args['cur_status_label'] = __('Trashed', 'event_espresso'); |
502 | 502 | $statuses['trash'] = __('Trashed', 'event_espresso'); |
503 | 503 | $template_args['statuses'] = $statuses; |
504 | 504 | } |
505 | 505 | |
506 | - $template = EE_ADMIN_TEMPLATE . 'status_dropdown.template.php'; |
|
507 | - EEH_Template::display_template( $template, $template_args ); |
|
506 | + $template = EE_ADMIN_TEMPLATE.'status_dropdown.template.php'; |
|
507 | + EEH_Template::display_template($template, $template_args); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -543,22 +543,22 @@ discard block |
||
543 | 543 | public function do_extra_autosave_stuff() { |
544 | 544 | |
545 | 545 | //next let's check for the autosave nonce (we'll use _verify_nonce ) |
546 | - $nonce = isset( $this->_req_data['autosavenonce'] ) ? $this->_req_data['autosavenonce'] : NULL; |
|
547 | - $this->_verify_nonce( $nonce, 'autosave' ); |
|
546 | + $nonce = isset($this->_req_data['autosavenonce']) ? $this->_req_data['autosavenonce'] : NULL; |
|
547 | + $this->_verify_nonce($nonce, 'autosave'); |
|
548 | 548 | |
549 | 549 | |
550 | 550 | //make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it) |
551 | - if ( !defined('DOING_AUTOSAVE') ) define('DOING_AUTOSAVE', true); |
|
551 | + if ( ! defined('DOING_AUTOSAVE')) define('DOING_AUTOSAVE', true); |
|
552 | 552 | |
553 | 553 | //if we made it here then the nonce checked out. Let's run our methods and actions |
554 | - if ( method_exists( $this, '_ee_autosave_' . $this->_current_view ) ) { |
|
555 | - call_user_func( array( $this, '_ee_autosave_' . $this->_current_view ) ); |
|
554 | + if (method_exists($this, '_ee_autosave_'.$this->_current_view)) { |
|
555 | + call_user_func(array($this, '_ee_autosave_'.$this->_current_view)); |
|
556 | 556 | } else { |
557 | 557 | $this->_template_args['success'] = TRUE; |
558 | 558 | } |
559 | 559 | |
560 | - do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this ); |
|
561 | - do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_' . get_class( $this ), $this ); |
|
560 | + do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this); |
|
561 | + do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_'.get_class($this), $this); |
|
562 | 562 | |
563 | 563 | //now let's return json |
564 | 564 | $this->_return_json(); |
@@ -578,18 +578,18 @@ discard block |
||
578 | 578 | protected function _extend_page_config_for_cpt() { |
579 | 579 | |
580 | 580 | //before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug |
581 | - if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) ) |
|
581 | + if ((isset($this->_req_data['page']) && $this->_req_data['page'] != $this->page_slug)) |
|
582 | 582 | return; |
583 | 583 | |
584 | 584 | //set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes |
585 | - if ( !empty( $this->_cpt_object ) ) { |
|
586 | - $this->_page_routes = array_merge( array( |
|
585 | + if ( ! empty($this->_cpt_object)) { |
|
586 | + $this->_page_routes = array_merge(array( |
|
587 | 587 | 'create_new' => '_create_new_cpt_item', |
588 | 588 | 'edit' => '_edit_cpt_item' |
589 | - ), $this->_page_routes ); |
|
589 | + ), $this->_page_routes); |
|
590 | 590 | |
591 | 591 | |
592 | - $this->_page_config = array_merge( array( |
|
592 | + $this->_page_config = array_merge(array( |
|
593 | 593 | 'create_new' => array( |
594 | 594 | 'nav' => array( |
595 | 595 | 'label' => $this->_cpt_object->labels->add_new_item, |
@@ -611,23 +611,23 @@ discard block |
||
611 | 611 | } |
612 | 612 | |
613 | 613 | //load the next section only if this is a matching cpt route as set in the cpt routes array. |
614 | - if ( !isset( $this->_cpt_routes[$this->_req_action] ) ) |
|
614 | + if ( ! isset($this->_cpt_routes[$this->_req_action])) |
|
615 | 615 | return; |
616 | 616 | |
617 | 617 | |
618 | - $this->_cpt_route = isset( $this->_cpt_routes[$this->_req_action] ) ? TRUE : FALSE; |
|
618 | + $this->_cpt_route = isset($this->_cpt_routes[$this->_req_action]) ? TRUE : FALSE; |
|
619 | 619 | //add_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', array( $this, 'modify_current_screen') ); |
620 | 620 | |
621 | 621 | |
622 | - if ( empty( $this->_cpt_object ) ) { |
|
623 | - $msg = sprintf( __('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this: 1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this) ); |
|
624 | - throw new EE_Error( $msg ); |
|
622 | + if (empty($this->_cpt_object)) { |
|
623 | + $msg = sprintf(__('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this: 1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this)); |
|
624 | + throw new EE_Error($msg); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | |
628 | - if ( $this->_cpt_route ) { |
|
629 | - $id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
630 | - $this->_set_model_object( $id ); |
|
628 | + if ($this->_cpt_route) { |
|
629 | + $id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
630 | + $this->_set_model_object($id); |
|
631 | 631 | } |
632 | 632 | |
633 | 633 | } |
@@ -643,17 +643,17 @@ discard block |
||
643 | 643 | * @param int $id The id to retrieve the model object for. If empty we set a default object. |
644 | 644 | * @return void |
645 | 645 | */ |
646 | - protected function _set_model_object( $id = NULL ) { |
|
646 | + protected function _set_model_object($id = NULL) { |
|
647 | 647 | |
648 | - if ( empty( $this->_cpt_model_names ) || ! isset( $this->_cpt_routes[ $this->_req_action ] ) || ( is_object( $this->_cpt_model_obj ) && $this->_cpt_model_obj->ID() == $id )) { |
|
648 | + if (empty($this->_cpt_model_names) || ! isset($this->_cpt_routes[$this->_req_action]) || (is_object($this->_cpt_model_obj) && $this->_cpt_model_obj->ID() == $id)) { |
|
649 | 649 | //get out cuz we either don't have a model name OR the object has already been set and it has the same id as what has been sent. |
650 | 650 | return; |
651 | 651 | } |
652 | 652 | // load CPT object model |
653 | - $model = EE_Registry::instance()->load_model( $this->_cpt_model_names[$this->_req_action] ); |
|
654 | - $this->_cpt_model_obj = ! empty( $id ) ? $model->get_one_by_ID( $id ) : $model->create_default_object(); |
|
653 | + $model = EE_Registry::instance()->load_model($this->_cpt_model_names[$this->_req_action]); |
|
654 | + $this->_cpt_model_obj = ! empty($id) ? $model->get_one_by_ID($id) : $model->create_default_object(); |
|
655 | 655 | //d( $this->_cpt_model_obj ); |
656 | - do_action( 'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object' ); |
|
656 | + do_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object'); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | |
@@ -667,47 +667,47 @@ discard block |
||
667 | 667 | */ |
668 | 668 | public function admin_init_global() { |
669 | 669 | |
670 | - $post = isset( $this->_req_data['post'] ) ? get_post( $this->_req_data['post'] ) : NULL; |
|
670 | + $post = isset($this->_req_data['post']) ? get_post($this->_req_data['post']) : NULL; |
|
671 | 671 | |
672 | 672 | //its possible this is a new save so let's catch that instead |
673 | - $post = isset( $this->_req_data['post_ID'] ) ? get_post( $this->_req_data['post_ID'] ) : $post; |
|
673 | + $post = isset($this->_req_data['post_ID']) ? get_post($this->_req_data['post_ID']) : $post; |
|
674 | 674 | $post_type = $post ? $post->post_type : false; |
675 | 675 | |
676 | 676 | $current_route = isset($this->_req_data['current_route']) ? $this->_req_data['current_route'] : 'shouldneverwork'; |
677 | 677 | |
678 | - $route_to_check = $post_type && isset( $this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : ''; |
|
678 | + $route_to_check = $post_type && isset($this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : ''; |
|
679 | 679 | |
680 | - add_filter( 'get_delete_post_link', array( $this, 'modify_delete_post_link'), 10, 3 ); |
|
681 | - add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link'), 10, 3 ); |
|
680 | + add_filter('get_delete_post_link', array($this, 'modify_delete_post_link'), 10, 3); |
|
681 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3); |
|
682 | 682 | |
683 | 683 | |
684 | - if ( $post_type === $route_to_check ) { |
|
685 | - add_filter('redirect_post_location', array( $this, 'cpt_post_location_redirect'), 10, 2 ); |
|
684 | + if ($post_type === $route_to_check) { |
|
685 | + add_filter('redirect_post_location', array($this, 'cpt_post_location_redirect'), 10, 2); |
|
686 | 686 | //catch trashed wp redirect |
687 | - add_filter('wp_redirect', array( $this, 'cpt_trash_post_location_redirect' ), 10, 2 ); |
|
687 | + add_filter('wp_redirect', array($this, 'cpt_trash_post_location_redirect'), 10, 2); |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | //now let's filter redirect if we're on a revision page and the revision is for an event CPT. |
691 | - $revision = isset( $this->_req_data['revision'] ) ? $this->_req_data['revision'] : NULL; |
|
691 | + $revision = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL; |
|
692 | 692 | |
693 | 693 | /**var_dump($this->_req_data); |
694 | 694 | exit();/**/ |
695 | 695 | |
696 | - if ( !empty( $revision ) ) { |
|
697 | - $action = isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : NULL; |
|
696 | + if ( ! empty($revision)) { |
|
697 | + $action = isset($this->_req_data['action']) ? $this->_req_data['action'] : NULL; |
|
698 | 698 | |
699 | 699 | //doing a restore? |
700 | - if ( !empty( $action ) && $action == 'restore' ) { |
|
700 | + if ( ! empty($action) && $action == 'restore') { |
|
701 | 701 | |
702 | 702 | //get post for revision |
703 | - $rev_post = get_post( $revision ); |
|
704 | - $rev_parent = get_post( $rev_post->post_parent ); |
|
703 | + $rev_post = get_post($revision); |
|
704 | + $rev_parent = get_post($rev_post->post_parent); |
|
705 | 705 | |
706 | 706 | //only do our redirect filter AND our restore revision action if the post_type for the parent is one of our cpts. |
707 | - if ( $rev_parent && $rev_parent->post_type == $this->page_slug ) { |
|
708 | - add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2 ); |
|
707 | + if ($rev_parent && $rev_parent->post_type == $this->page_slug) { |
|
708 | + add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2); |
|
709 | 709 | //restores of revisions |
710 | - add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2 ); |
|
710 | + add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2); |
|
711 | 711 | } |
712 | 712 | } |
713 | 713 | |
@@ -716,15 +716,15 @@ discard block |
||
716 | 716 | //NOTE we ONLY want to run these hooks if we're on the right class for the given post type. Otherwise we could see some really freaky things happen! |
717 | 717 | |
718 | 718 | |
719 | - if ( $post_type && $post_type === $route_to_check ) { |
|
719 | + if ($post_type && $post_type === $route_to_check) { |
|
720 | 720 | //$post_id, $post |
721 | - add_action('save_post', array( $this, 'insert_update'), 10, 2 ); |
|
721 | + add_action('save_post', array($this, 'insert_update'), 10, 2); |
|
722 | 722 | |
723 | 723 | //$post_id |
724 | - add_action('trashed_post', array( $this, 'trash_cpt_item' ), 10 ); |
|
725 | - add_action('trashed_post', array( $this, 'dont_permanently_delete_ee_cpts'), 10 ); |
|
726 | - add_action('untrashed_post', array( $this, 'restore_cpt_item'), 10 ); |
|
727 | - add_action('after_delete_post', array( $this, 'delete_cpt_item'), 10 ); |
|
724 | + add_action('trashed_post', array($this, 'trash_cpt_item'), 10); |
|
725 | + add_action('trashed_post', array($this, 'dont_permanently_delete_ee_cpts'), 10); |
|
726 | + add_action('untrashed_post', array($this, 'restore_cpt_item'), 10); |
|
727 | + add_action('after_delete_post', array($this, 'delete_cpt_item'), 10); |
|
728 | 728 | } |
729 | 729 | |
730 | 730 | } |
@@ -739,15 +739,15 @@ discard block |
||
739 | 739 | * @return void |
740 | 740 | */ |
741 | 741 | public function verify_cpt_object() { |
742 | - $label = !empty( $this->_cpt_object ) ? $this->_cpt_object->labels->singular_name : $this->page_label; |
|
742 | + $label = ! empty($this->_cpt_object) ? $this->_cpt_object->labels->singular_name : $this->page_label; |
|
743 | 743 | // verify event object |
744 | - if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base ) { |
|
745 | - throw new EE_Error( sprintf( __('Something has gone wrong with the page load because we are unable to set up the object for the %1$s. This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso' ), $label ) ); |
|
744 | + if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) { |
|
745 | + throw new EE_Error(sprintf(__('Something has gone wrong with the page load because we are unable to set up the object for the %1$s. This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso'), $label)); |
|
746 | 746 | } |
747 | 747 | //if auto-draft then throw an error |
748 | - if ( $this->_cpt_model_obj->get('status') == 'auto-draft' ) { |
|
748 | + if ($this->_cpt_model_obj->get('status') == 'auto-draft') { |
|
749 | 749 | EE_Error::overwrite_errors(); |
750 | - EE_Error::add_error( sprintf( __('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly. All autodrafts will show up in the "draft" view of your event list table. You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label ), __FILE__, __FUNCTION__, __LINE__ ); |
|
750 | + EE_Error::add_error(sprintf(__('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly. All autodrafts will show up in the "draft" view of your event list table. You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label), __FILE__, __FUNCTION__, __LINE__); |
|
751 | 751 | } |
752 | 752 | } |
753 | 753 | |
@@ -776,22 +776,22 @@ discard block |
||
776 | 776 | public function load_global_scripts_styles() { |
777 | 777 | parent::load_global_scripts_styles(); |
778 | 778 | |
779 | - if ( $this->_cpt_model_obj instanceof EE_CPT_Base ) { |
|
779 | + if ($this->_cpt_model_obj instanceof EE_CPT_Base) { |
|
780 | 780 | //setup custom post status object for localize script but only if we've got a cpt object |
781 | 781 | $statuses = $this->_cpt_model_obj->get_custom_post_statuses(); |
782 | 782 | |
783 | - if ( !empty($statuses) ) { |
|
783 | + if ( ! empty($statuses)) { |
|
784 | 784 | //get ALL statuses! |
785 | 785 | $statuses = $this->_cpt_model_obj->get_all_post_statuses(); |
786 | 786 | //setup object |
787 | 787 | $ee_cpt_statuses = array(); |
788 | - foreach ( $statuses as $status => $label ) { |
|
788 | + foreach ($statuses as $status => $label) { |
|
789 | 789 | $ee_cpt_statuses[$status] = array( |
790 | 790 | 'label' => $label, |
791 | - 'save_label' => sprintf( __('Save as %s', 'event_espresso'), $label ) |
|
791 | + 'save_label' => sprintf(__('Save as %s', 'event_espresso'), $label) |
|
792 | 792 | ); |
793 | 793 | } |
794 | - wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses ); |
|
794 | + wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses); |
|
795 | 795 | } |
796 | 796 | } |
797 | 797 | } |
@@ -805,10 +805,10 @@ discard block |
||
805 | 805 | * @param WP_Post $post Post object from WP |
806 | 806 | * @return void |
807 | 807 | */ |
808 | - public function insert_update( $post_id, $post ) { |
|
808 | + public function insert_update($post_id, $post) { |
|
809 | 809 | |
810 | 810 | //make sure that if this is a revision OR trash action that we don't do any updates! |
811 | - if ( isset( $this->_req_data['action'] ) && ( $this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash' ) ) |
|
811 | + if (isset($this->_req_data['action']) && ($this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash')) |
|
812 | 812 | return; |
813 | 813 | |
814 | 814 | //check for autosave and update our req_data property accordingly. |
@@ -823,19 +823,19 @@ discard block |
||
823 | 823 | }/**/ //TODO reactivate after autosave is implemented in 4.2 |
824 | 824 | |
825 | 825 | //take care of updating any selected page_template IF this cpt supports it. |
826 | - if ( $this->_supports_page_templates($post->post_type ) && !empty( $this->_req_data['page_template'] ) ) { |
|
826 | + if ($this->_supports_page_templates($post->post_type) && ! empty($this->_req_data['page_template'])) { |
|
827 | 827 | $post->page_template = $this->_req_data['page_template']; |
828 | - $page_templates = wp_get_theme()->get_page_templates( $post ); |
|
829 | - if ( 'default' != $this->_req_data['page_template'] && ! isset( $page_templates[ $this->_req_data['page_template'] ] ) ) { |
|
830 | - EE_Error::add_error( __('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
828 | + $page_templates = wp_get_theme()->get_page_templates($post); |
|
829 | + if ('default' != $this->_req_data['page_template'] && ! isset($page_templates[$this->_req_data['page_template']])) { |
|
830 | + EE_Error::add_error(__('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
831 | 831 | } else { |
832 | - update_post_meta( $post_id, '_wp_page_template', $this->_req_data['page_template'] ); |
|
832 | + update_post_meta($post_id, '_wp_page_template', $this->_req_data['page_template']); |
|
833 | 833 | } |
834 | 834 | } |
835 | 835 | |
836 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) |
|
836 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) |
|
837 | 837 | return; //TODO we'll remove this after reimplementing autosave in 4.2 |
838 | - $this->_insert_update_cpt_item( $post_id, $post ); |
|
838 | + $this->_insert_update_cpt_item($post_id, $post); |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | |
@@ -848,8 +848,8 @@ discard block |
||
848 | 848 | * @param int $post_id ID of the post |
849 | 849 | * @return void |
850 | 850 | */ |
851 | - public function dont_permanently_delete_ee_cpts( $post_id ) { |
|
852 | - delete_post_meta( $post_id, '_wp_trash_meta_status' ); |
|
851 | + public function dont_permanently_delete_ee_cpts($post_id) { |
|
852 | + delete_post_meta($post_id, '_wp_trash_meta_status'); |
|
853 | 853 | delete_post_meta($post_id, '_wp_trash_meta_time'); |
854 | 854 | |
855 | 855 | //our cpts may have comments so let's take care of that too |
@@ -868,14 +868,14 @@ discard block |
||
868 | 868 | * @param int $revision_id ID of revision being restored |
869 | 869 | * @return void |
870 | 870 | */ |
871 | - public function restore_revision( $post_id, $revision_id ) { |
|
872 | - $this->_restore_cpt_item( $post_id, $revision_id ); |
|
871 | + public function restore_revision($post_id, $revision_id) { |
|
872 | + $this->_restore_cpt_item($post_id, $revision_id); |
|
873 | 873 | |
874 | 874 | //global action |
875 | - do_action( 'AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id); |
|
875 | + do_action('AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id); |
|
876 | 876 | |
877 | 877 | //class specific action so you can limit hooking into a specific page. |
878 | - do_action( 'AHEE_EE_Admin_Page_CPT_' . get_class($this) . '__restore_revision', $post_id, $revision_id ); |
|
878 | + do_action('AHEE_EE_Admin_Page_CPT_'.get_class($this).'__restore_revision', $post_id, $revision_id); |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | * @param int $revision_id ID of revision for item |
887 | 887 | * @return void |
888 | 888 | */ |
889 | - abstract protected function _restore_cpt_item( $post_id, $revision_id ); |
|
889 | + abstract protected function _restore_cpt_item($post_id, $revision_id); |
|
890 | 890 | |
891 | 891 | |
892 | 892 | |
@@ -905,9 +905,9 @@ discard block |
||
905 | 905 | */ |
906 | 906 | public function modify_current_screen() { |
907 | 907 | //ONLY do this if the current page_route IS a cpt route |
908 | - if ( !$this->_cpt_route ) return; |
|
908 | + if ( ! $this->_cpt_route) return; |
|
909 | 909 | //routing things REALLY early b/c this is a cpt admin page |
910 | - set_current_screen( $this->_cpt_routes[$this->_req_action]); |
|
910 | + set_current_screen($this->_cpt_routes[$this->_req_action]); |
|
911 | 911 | $this->_current_screen = get_current_screen(); |
912 | 912 | $this->_current_screen->base = 'event-espresso'; |
913 | 913 | $this->_add_help_tabs(); //we make sure we add any help tabs back in! |
@@ -928,8 +928,8 @@ discard block |
||
928 | 928 | * @param string $title The new title (or existing if there is no editor_title defined) |
929 | 929 | * @return string |
930 | 930 | */ |
931 | - public function add_custom_editor_default_title( $title ) { |
|
932 | - return isset( $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] ) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title; |
|
931 | + public function add_custom_editor_default_title($title) { |
|
932 | + return isset($this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]]) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title; |
|
933 | 933 | } |
934 | 934 | |
935 | 935 | |
@@ -942,11 +942,11 @@ discard block |
||
942 | 942 | * @param bool $allow_slugs Whether to allow post slugs in the shortlink. |
943 | 943 | * @return string |
944 | 944 | */ |
945 | - public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) { |
|
946 | - if ( !empty( $id ) && '' != get_option('permalink_structure') ) { |
|
947 | - $post = get_post( $id ); |
|
948 | - if ( isset($post->post_type) && $this->page_slug == $post->post_type ) |
|
949 | - $shortlink = home_url('?p=' . $post->ID); |
|
945 | + public function add_shortlink_button_to_editor($shortlink, $id, $context, $allow_slugs) { |
|
946 | + if ( ! empty($id) && '' != get_option('permalink_structure')) { |
|
947 | + $post = get_post($id); |
|
948 | + if (isset($post->post_type) && $this->page_slug == $post->post_type) |
|
949 | + $shortlink = home_url('?p='.$post->ID); |
|
950 | 950 | } |
951 | 951 | return $shortlink; |
952 | 952 | } |
@@ -959,10 +959,10 @@ discard block |
||
959 | 959 | * @return void |
960 | 960 | */ |
961 | 961 | public function route_admin_request() { |
962 | - if ( $this->_cpt_route ) return; |
|
962 | + if ($this->_cpt_route) return; |
|
963 | 963 | try { |
964 | 964 | $this->_route_admin_request(); |
965 | - } catch ( EE_Error $e ) { |
|
965 | + } catch (EE_Error $e) { |
|
966 | 966 | $e->get_error(); |
967 | 967 | } |
968 | 968 | } |
@@ -975,12 +975,12 @@ discard block |
||
975 | 975 | * @return string html |
976 | 976 | */ |
977 | 977 | public function cpt_post_form_hidden_input() { |
978 | - echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="' . $this->_admin_base_url . '" />'; |
|
978 | + echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="'.$this->_admin_base_url.'" />'; |
|
979 | 979 | |
980 | 980 | //we're also going to add the route value and the current page so we can direct autosave parsing correctly |
981 | 981 | echo '<div id="ee-cpt-hidden-inputs">'; |
982 | - echo '<input type="hidden" id="current_route" name="current_route" value="' . $this->_current_view . '" />'; |
|
983 | - echo '<input type="hidden" id="current_page" name="current_page" value="' . $this->page_slug . '" />'; |
|
982 | + echo '<input type="hidden" id="current_route" name="current_route" value="'.$this->_current_view.'" />'; |
|
983 | + echo '<input type="hidden" id="current_page" name="current_page" value="'.$this->page_slug.'" />'; |
|
984 | 984 | echo '</div>'; |
985 | 985 | } |
986 | 986 | |
@@ -993,12 +993,12 @@ discard block |
||
993 | 993 | * @param int $status Status for http header |
994 | 994 | * @return string new (or original) url to redirect to. |
995 | 995 | */ |
996 | - public function revision_redirect( $location, $status ) { |
|
996 | + public function revision_redirect($location, $status) { |
|
997 | 997 | //get revision |
998 | 998 | $rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL; |
999 | 999 | |
1000 | 1000 | //can't do anything without revision so let's get out if not present |
1001 | - if ( empty( $rev_id ) ) |
|
1001 | + if (empty($rev_id)) |
|
1002 | 1002 | return $location; |
1003 | 1003 | |
1004 | 1004 | //get rev_post_data |
@@ -1012,8 +1012,8 @@ discard block |
||
1012 | 1012 | 'message' => 5 |
1013 | 1013 | ); |
1014 | 1014 | |
1015 | - $this->_process_notices( $query_args, TRUE ); |
|
1016 | - return self::add_query_args_and_nonce( $query_args, $admin_url ); |
|
1015 | + $this->_process_notices($query_args, TRUE); |
|
1016 | + return self::add_query_args_and_nonce($query_args, $admin_url); |
|
1017 | 1017 | } |
1018 | 1018 | |
1019 | 1019 | |
@@ -1026,16 +1026,16 @@ discard block |
||
1026 | 1026 | * @param string $context optional, defaults to display. How to write the '&' |
1027 | 1027 | * @return string the link |
1028 | 1028 | */ |
1029 | - public function modify_edit_post_link( $link, $id, $context ) { |
|
1030 | - $post = get_post( $id ); |
|
1031 | - if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) |
|
1029 | + public function modify_edit_post_link($link, $id, $context) { |
|
1030 | + $post = get_post($id); |
|
1031 | + if ( ! isset($this->_req_data['action']) || ! isset($this->_cpt_routes[$this->_req_data['action']]) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']]) |
|
1032 | 1032 | return $link; |
1033 | 1033 | $query_args = array( |
1034 | 1034 | 'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit', |
1035 | 1035 | 'post' => $id |
1036 | 1036 | ); |
1037 | 1037 | |
1038 | - return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1038 | + return self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | |
@@ -1047,12 +1047,12 @@ discard block |
||
1047 | 1047 | * @param bool $force_delete whether this is forcing a hard delete instead of trash |
1048 | 1048 | * @return string new delete link |
1049 | 1049 | */ |
1050 | - public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) { |
|
1050 | + public function modify_delete_post_link($delete_link, $post_id, $force_delete) { |
|
1051 | 1051 | $post = get_post($post_id); |
1052 | - if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) ) |
|
1052 | + if ( ! isset($this->_req_data['action']) || (isset($this->_cpt_routes[$this->_req_data['action']]) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']])) |
|
1053 | 1053 | return $delete_link; |
1054 | 1054 | |
1055 | - return add_query_arg( array('current_route' => 'trash' ), $delete_link ); |
|
1055 | + return add_query_arg(array('current_route' => 'trash'), $delete_link); |
|
1056 | 1056 | } |
1057 | 1057 | |
1058 | 1058 | |
@@ -1063,16 +1063,16 @@ discard block |
||
1063 | 1063 | * @param string $status status |
1064 | 1064 | * @return string url to redirect to |
1065 | 1065 | */ |
1066 | - public function cpt_trash_post_location_redirect( $location, $status ) { |
|
1067 | - if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) ) |
|
1066 | + public function cpt_trash_post_location_redirect($location, $status) { |
|
1067 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] !== 'trash' && empty($this->_req_data['post'])) |
|
1068 | 1068 | return $location; |
1069 | 1069 | |
1070 | - $post = get_post( $this->_req_data['post'] ); |
|
1071 | - $query_args = array( 'action' => 'default' ); |
|
1070 | + $post = get_post($this->_req_data['post']); |
|
1071 | + $query_args = array('action' => 'default'); |
|
1072 | 1072 | $this->_cpt_object = get_post_type_object($post->post_type); |
1073 | - EE_Error::add_success( sprintf( __('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name) ); |
|
1074 | - $this->_process_notices( $query_args, TRUE ); |
|
1075 | - return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1073 | + EE_Error::add_success(sprintf(__('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name)); |
|
1074 | + $this->_process_notices($query_args, TRUE); |
|
1075 | + return self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | * @param string $post_id This is the 'ID' value of the wp_posts table |
1088 | 1088 | * @return string the new location to redirect to |
1089 | 1089 | */ |
1090 | - public function cpt_post_location_redirect( $location, $post_id ) { |
|
1090 | + public function cpt_post_location_redirect($location, $post_id) { |
|
1091 | 1091 | //we DO have a match so let's setup the url |
1092 | 1092 | |
1093 | 1093 | //we have to get the post to determine our route |
@@ -1095,14 +1095,14 @@ discard block |
||
1095 | 1095 | $edit_route = $this->_cpt_edit_routes[$post->post_type]; |
1096 | 1096 | |
1097 | 1097 | //shared query_args |
1098 | - $query_args = array( 'action' => $edit_route, 'post' => $post_id ); |
|
1098 | + $query_args = array('action' => $edit_route, 'post' => $post_id); |
|
1099 | 1099 | $admin_url = $this->_admin_base_url; |
1100 | 1100 | // $append = ''; |
1101 | 1101 | |
1102 | - if ( isset( $this->_req_data['save'] ) || isset( $this->_req_data['publish'] ) ) { |
|
1103 | - $status = get_post_status( $post_id ); |
|
1104 | - if ( isset( $this->_req_data['publish'] ) ) { |
|
1105 | - switch ( $status ) { |
|
1102 | + if (isset($this->_req_data['save']) || isset($this->_req_data['publish'])) { |
|
1103 | + $status = get_post_status($post_id); |
|
1104 | + if (isset($this->_req_data['publish'])) { |
|
1105 | + switch ($status) { |
|
1106 | 1106 | case 'pending': |
1107 | 1107 | $message = 8; |
1108 | 1108 | break; |
@@ -1115,13 +1115,13 @@ discard block |
||
1115 | 1115 | } else { |
1116 | 1116 | $message = 'draft' == $status ? 10 : 1; |
1117 | 1117 | } |
1118 | - } else if ( isset( $this->_req_data['addmeta']) && $this->_req_data['addmeta'] ) { |
|
1118 | + } else if (isset($this->_req_data['addmeta']) && $this->_req_data['addmeta']) { |
|
1119 | 1119 | $message = 2; |
1120 | 1120 | // $append = '#postcustom'; |
1121 | - } else if ( isset( $this->_req_data['deletemeta']) && $this->_req_data['deletemeta'] ) { |
|
1121 | + } else if (isset($this->_req_data['deletemeta']) && $this->_req_data['deletemeta']) { |
|
1122 | 1122 | $message = 3; |
1123 | 1123 | // $append = '#postcustom'; |
1124 | - } elseif ( $this->_req_data['action'] == 'post-quickpress-save-cont' ) { |
|
1124 | + } elseif ($this->_req_data['action'] == 'post-quickpress-save-cont') { |
|
1125 | 1125 | $message = 7; |
1126 | 1126 | } else { |
1127 | 1127 | $message = 4; |
@@ -1129,12 +1129,12 @@ discard block |
||
1129 | 1129 | |
1130 | 1130 | //change the message if the post type is not viewable on the frontend |
1131 | 1131 | $this->_cpt_object = get_post_type_object($post->post_type); |
1132 | - $message = $message === 1 && !$this->_cpt_object->publicly_queryable ? 4 : $message; |
|
1132 | + $message = $message === 1 && ! $this->_cpt_object->publicly_queryable ? 4 : $message; |
|
1133 | 1133 | |
1134 | - $query_args = array_merge( array( 'message' => $message ), $query_args ); |
|
1134 | + $query_args = array_merge(array('message' => $message), $query_args); |
|
1135 | 1135 | |
1136 | - $this->_process_notices( $query_args, TRUE ); |
|
1137 | - return self::add_query_args_and_nonce( $query_args, $admin_url ); |
|
1136 | + $this->_process_notices($query_args, TRUE); |
|
1137 | + return self::add_query_args_and_nonce($query_args, $admin_url); |
|
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | |
@@ -1166,10 +1166,10 @@ discard block |
||
1166 | 1166 | * @param array $messages the original messages array |
1167 | 1167 | * @return array the new messages array |
1168 | 1168 | */ |
1169 | - public function post_update_messages( $messages ) { |
|
1169 | + public function post_update_messages($messages) { |
|
1170 | 1170 | global $post; |
1171 | - $id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
1172 | - $id = empty( $id ) && is_object( $post ) ? $post->ID : NULL; |
|
1171 | + $id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
1172 | + $id = empty($id) && is_object($post) ? $post->ID : NULL; |
|
1173 | 1173 | |
1174 | 1174 | // $post_type = $post ? $post->post_type : false; |
1175 | 1175 | |
@@ -1182,9 +1182,9 @@ discard block |
||
1182 | 1182 | 0 => '', //Unused. Messages start at index 1. |
1183 | 1183 | |
1184 | 1184 | 1 => sprintf( |
1185 | - __( '%1$s updated. %2$sView %1$s%3$s', 'event_espresso'), |
|
1185 | + __('%1$s updated. %2$sView %1$s%3$s', 'event_espresso'), |
|
1186 | 1186 | $this->_cpt_object->labels->singular_name, |
1187 | - '<a href="' . esc_url( get_permalink( $id )) . '">', |
|
1187 | + '<a href="'.esc_url(get_permalink($id)).'">', |
|
1188 | 1188 | '</a>' |
1189 | 1189 | ), |
1190 | 1190 | |
@@ -1192,38 +1192,38 @@ discard block |
||
1192 | 1192 | |
1193 | 1193 | 3 => __('Custom field deleted.'), |
1194 | 1194 | |
1195 | - 4 => sprintf( __( '%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name ), |
|
1195 | + 4 => sprintf(__('%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
1196 | 1196 | |
1197 | - 5 => isset( $_GET['revision'] ) ? sprintf( __('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], FALSE ) ) : FALSE, |
|
1197 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], FALSE)) : FALSE, |
|
1198 | 1198 | |
1199 | 1199 | 6 => sprintf( |
1200 | - __( '%1$s published. %2$sView %1$s%3$s', 'event_espresso'), |
|
1200 | + __('%1$s published. %2$sView %1$s%3$s', 'event_espresso'), |
|
1201 | 1201 | $this->_cpt_object->labels->singular_name, |
1202 | - '<a href="' . esc_url( get_permalink( $id )) . '">', |
|
1202 | + '<a href="'.esc_url(get_permalink($id)).'">', |
|
1203 | 1203 | '</a>' |
1204 | 1204 | ), |
1205 | 1205 | |
1206 | - 7 => sprintf( __( '%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name ), |
|
1206 | + 7 => sprintf(__('%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
1207 | 1207 | |
1208 | 1208 | 8 => sprintf( |
1209 | 1209 | __('%1$s submitted. %2$sPreview %1$s%3$s', 'event_espresso'), |
1210 | 1210 | $this->_cpt_object->labels->singular_name, |
1211 | - '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) . '">', |
|
1211 | + '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))).'">', |
|
1212 | 1212 | '</a>' |
1213 | 1213 | ), |
1214 | 1214 | |
1215 | 1215 | 9 => sprintf( |
1216 | - __( '%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'), |
|
1216 | + __('%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'), |
|
1217 | 1217 | $this->_cpt_object->labels->singular_name, |
1218 | - '<strong>' . date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date )) . '</strong>', |
|
1219 | - '<a target="_blank" href="' . esc_url( get_permalink( $id )), |
|
1218 | + '<strong>'.date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)).'</strong>', |
|
1219 | + '<a target="_blank" href="'.esc_url(get_permalink($id)), |
|
1220 | 1220 | '</a>' |
1221 | 1221 | ), |
1222 | 1222 | |
1223 | 1223 | 10 => sprintf( |
1224 | 1224 | __('%1$s draft updated. %2$s">Preview page%3$s', 'event_espresso'), |
1225 | 1225 | $this->_cpt_object->labels->singular_name, |
1226 | - '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) , |
|
1226 | + '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))), |
|
1227 | 1227 | '</a>' |
1228 | 1228 | ) |
1229 | 1229 | ); |
@@ -1250,24 +1250,24 @@ discard block |
||
1250 | 1250 | $post_type_object = $this->_cpt_object; |
1251 | 1251 | $title = $post_type_object->labels->add_new_item; |
1252 | 1252 | $editing = TRUE; |
1253 | - wp_enqueue_script( 'autosave' ); |
|
1254 | - $post = $post = get_default_post_to_edit( $this->_cpt_routes[$this->_req_action], TRUE ); |
|
1253 | + wp_enqueue_script('autosave'); |
|
1254 | + $post = $post = get_default_post_to_edit($this->_cpt_routes[$this->_req_action], TRUE); |
|
1255 | 1255 | $post_ID = $post->ID; |
1256 | 1256 | $is_IE = $is_IE; |
1257 | 1257 | |
1258 | - add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) ); |
|
1258 | + add_action('admin_print_styles', array($this, 'add_new_admin_page_global')); |
|
1259 | 1259 | |
1260 | 1260 | //modify the default editor title field with default title. |
1261 | - add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 ); |
|
1261 | + add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10); |
|
1262 | 1262 | |
1263 | - include_once WP_ADMIN_PATH . 'edit-form-advanced.php'; |
|
1263 | + include_once WP_ADMIN_PATH.'edit-form-advanced.php'; |
|
1264 | 1264 | } |
1265 | 1265 | |
1266 | 1266 | |
1267 | 1267 | |
1268 | 1268 | |
1269 | 1269 | public function add_new_admin_page_global() { |
1270 | - $admin_page = !empty( $this->_req_data['post'] ) ? 'post-php' : 'post-new-php'; |
|
1270 | + $admin_page = ! empty($this->_req_data['post']) ? 'post-php' : 'post-new-php'; |
|
1271 | 1271 | ?> |
1272 | 1272 | <script type="text/javascript"> |
1273 | 1273 | adminpage = '<?php echo $admin_page; ?>'; |
@@ -1289,16 +1289,16 @@ discard block |
||
1289 | 1289 | */ |
1290 | 1290 | protected function _edit_cpt_item() { |
1291 | 1291 | global $post, $title, $is_IE, $post_type, $post_type_object; |
1292 | - $post_id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
1293 | - $post = !empty( $post_id ) ? get_post( $post_id, OBJECT, 'edit' ) : NULL; |
|
1292 | + $post_id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
1293 | + $post = ! empty($post_id) ? get_post($post_id, OBJECT, 'edit') : NULL; |
|
1294 | 1294 | |
1295 | - if ( empty ( $post ) ) { |
|
1296 | - wp_die( __('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?') ); |
|
1295 | + if (empty ($post)) { |
|
1296 | + wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?')); |
|
1297 | 1297 | } |
1298 | 1298 | |
1299 | - if ( ! empty( $_GET['get-post-lock'] ) ) { |
|
1300 | - wp_set_post_lock( $post_id ); |
|
1301 | - wp_redirect( get_edit_post_link( $post_id, 'url' ) ); |
|
1299 | + if ( ! empty($_GET['get-post-lock'])) { |
|
1300 | + wp_set_post_lock($post_id); |
|
1301 | + wp_redirect(get_edit_post_link($post_id, 'url')); |
|
1302 | 1302 | exit(); |
1303 | 1303 | } |
1304 | 1304 | |
@@ -1310,32 +1310,32 @@ discard block |
||
1310 | 1310 | $post_type_object = $this->_cpt_object; |
1311 | 1311 | $is_IE = $is_IE; |
1312 | 1312 | |
1313 | - if ( ! wp_check_post_lock( $post->ID ) ) { |
|
1314 | - $active_post_lock = wp_set_post_lock( $post->ID ); |
|
1313 | + if ( ! wp_check_post_lock($post->ID)) { |
|
1314 | + $active_post_lock = wp_set_post_lock($post->ID); |
|
1315 | 1315 | //wp_enqueue_script('autosave'); |
1316 | 1316 | } |
1317 | 1317 | |
1318 | 1318 | $title = $this->_cpt_object->labels->edit_item; |
1319 | 1319 | |
1320 | - add_action('admin_footer', '_admin_notice_post_locked' ); |
|
1320 | + add_action('admin_footer', '_admin_notice_post_locked'); |
|
1321 | 1321 | |
1322 | - if ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && !isset( $this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']] ) ) { |
|
1323 | - $create_new_action = apply_filters( 'FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this ); |
|
1322 | + if (isset($this->_cpt_routes[$this->_req_data['action']]) && ! isset($this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']])) { |
|
1323 | + $create_new_action = apply_filters('FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this); |
|
1324 | 1324 | |
1325 | - $post_new_file = EE_Admin_Page::add_query_args_and_nonce( array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php' ); |
|
1325 | + $post_new_file = EE_Admin_Page::add_query_args_and_nonce(array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php'); |
|
1326 | 1326 | } |
1327 | 1327 | |
1328 | - if ( post_type_supports($this->_cpt_routes[$this->_req_action], 'comments') ) { |
|
1328 | + if (post_type_supports($this->_cpt_routes[$this->_req_action], 'comments')) { |
|
1329 | 1329 | wp_enqueue_script('admin-comments'); |
1330 | 1330 | enqueue_comment_hotkeys_js(); |
1331 | 1331 | } |
1332 | 1332 | |
1333 | - add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) ); |
|
1333 | + add_action('admin_print_styles', array($this, 'add_new_admin_page_global')); |
|
1334 | 1334 | |
1335 | 1335 | //modify the default editor title field with default title. |
1336 | - add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 ); |
|
1336 | + add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10); |
|
1337 | 1337 | |
1338 | - include_once WP_ADMIN_PATH . 'edit-form-advanced.php'; |
|
1338 | + include_once WP_ADMIN_PATH.'edit-form-advanced.php'; |
|
1339 | 1339 | |
1340 | 1340 | } |
1341 | 1341 |
@@ -413,7 +413,6 @@ |
||
413 | 413 | /** |
414 | 414 | * toggle_abandoned_transaction_status |
415 | 415 | * upgrades a TXNs status from failed or abandoned to incomplete |
416 | - |
|
417 | 416 | * @access public |
418 | 417 | * @param EE_Transaction $transaction |
419 | 418 | * @return boolean |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Class EE_Transaction_Processor |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | * @param array $registration_query_params |
51 | 51 | *@return EE_Transaction_Processor instance |
52 | 52 | */ |
53 | - public static function instance( $registration_query_params = array() ) { |
|
53 | + public static function instance($registration_query_params = array()) { |
|
54 | 54 | // check if class object is instantiated |
55 | - if ( ! self::$_instance instanceof EE_Transaction_Processor ) { |
|
56 | - self::$_instance = new self( $registration_query_params ); |
|
55 | + if ( ! self::$_instance instanceof EE_Transaction_Processor) { |
|
56 | + self::$_instance = new self($registration_query_params); |
|
57 | 57 | } |
58 | 58 | return self::$_instance; |
59 | 59 | } |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | * @param array $registration_query_params |
65 | 65 | * @return EE_Transaction_Processor |
66 | 66 | */ |
67 | - private function __construct( $registration_query_params = array() ) { |
|
67 | + private function __construct($registration_query_params = array()) { |
|
68 | 68 | // make sure some query params are set for retrieving registrations |
69 | - $this->_set_registration_query_params( $registration_query_params ); |
|
69 | + $this->_set_registration_query_params($registration_query_params); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @access private |
76 | 76 | * @param array $registration_query_params |
77 | 77 | */ |
78 | - private function _set_registration_query_params( $registration_query_params ) { |
|
79 | - $this->_registration_query_params = ! empty( $registration_query_params ) ? $registration_query_params : array( 'order_by' => array( 'REG_count' => 'ASC' )); |
|
78 | + private function _set_registration_query_params($registration_query_params) { |
|
79 | + $this->_registration_query_params = ! empty($registration_query_params) ? $registration_query_params : array('order_by' => array('REG_count' => 'ASC')); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | /** |
94 | 94 | * @param string $old_txn_status |
95 | 95 | */ |
96 | - public function set_old_txn_status( $old_txn_status ) { |
|
96 | + public function set_old_txn_status($old_txn_status) { |
|
97 | 97 | // only set the first time |
98 | - if ( $this->_old_txn_status === null ) { |
|
98 | + if ($this->_old_txn_status === null) { |
|
99 | 99 | $this->_old_txn_status = $old_txn_status; |
100 | 100 | } |
101 | 101 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * @param string $new_txn_status |
116 | 116 | */ |
117 | - public function set_new_txn_status( $new_txn_status ) { |
|
117 | + public function set_new_txn_status($new_txn_status) { |
|
118 | 118 | $this->_new_txn_status = $new_txn_status; |
119 | 119 | } |
120 | 120 | |
@@ -145,17 +145,17 @@ discard block |
||
145 | 145 | * @param bool $check_all |
146 | 146 | * @return boolean | int |
147 | 147 | */ |
148 | - private function _reg_steps_completed( EE_Transaction $transaction, $reg_step_slug = '', $check_all = TRUE ) { |
|
148 | + private function _reg_steps_completed(EE_Transaction $transaction, $reg_step_slug = '', $check_all = TRUE) { |
|
149 | 149 | $reg_steps = $transaction->reg_steps(); |
150 | - if ( ! is_array( $reg_steps ) || empty( $reg_steps )) { |
|
150 | + if ( ! is_array($reg_steps) || empty($reg_steps)) { |
|
151 | 151 | return false; |
152 | 152 | } |
153 | 153 | // loop thru reg steps array) |
154 | - foreach ( $reg_steps as $slug => $reg_step_completed ) { |
|
154 | + foreach ($reg_steps as $slug => $reg_step_completed) { |
|
155 | 155 | // if NOT checking ALL steps (only checking one step) |
156 | - if ( ! $check_all ) { |
|
156 | + if ( ! $check_all) { |
|
157 | 157 | // and this is the one |
158 | - if ( $slug == $reg_step_slug ) { |
|
158 | + if ($slug == $reg_step_slug) { |
|
159 | 159 | return $reg_step_completed; |
160 | 160 | } else { |
161 | 161 | // skip to next reg step in loop |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | } |
164 | 164 | } |
165 | 165 | // if any reg step is NOT completed (ignoring any specific steps), then just leave |
166 | - if ( $reg_step_completed !== true && $slug != $reg_step_slug ) { |
|
166 | + if ($reg_step_completed !== true && $slug != $reg_step_slug) { |
|
167 | 167 | return false; |
168 | - } else if ( $slug == $reg_step_slug ) { |
|
168 | + } else if ($slug == $reg_step_slug) { |
|
169 | 169 | // if we reach this point, then we are testing either: |
170 | 170 | // all_reg_steps_completed_except() or |
171 | 171 | // all_reg_steps_completed_except_final_step(), |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | * @param EE_Transaction $transaction |
191 | 191 | * @return boolean |
192 | 192 | */ |
193 | - public function all_reg_steps_completed( EE_Transaction $transaction ) { |
|
194 | - return $this->_reg_steps_completed( $transaction ); |
|
193 | + public function all_reg_steps_completed(EE_Transaction $transaction) { |
|
194 | + return $this->_reg_steps_completed($transaction); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | * @param string $exception |
209 | 209 | * @return boolean |
210 | 210 | */ |
211 | - public function all_reg_steps_completed_except( EE_Transaction $transaction, $exception = '' ) { |
|
212 | - return $this->_reg_steps_completed( $transaction, $exception ); |
|
211 | + public function all_reg_steps_completed_except(EE_Transaction $transaction, $exception = '') { |
|
212 | + return $this->_reg_steps_completed($transaction, $exception); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | * @param EE_Transaction $transaction |
226 | 226 | * @return boolean |
227 | 227 | */ |
228 | - public function all_reg_steps_completed_except_final_step( EE_Transaction $transaction ) { |
|
229 | - return $this->_reg_steps_completed( $transaction, 'finalize_registration' ); |
|
228 | + public function all_reg_steps_completed_except_final_step(EE_Transaction $transaction) { |
|
229 | + return $this->_reg_steps_completed($transaction, 'finalize_registration'); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | * @param string $reg_step_slug |
244 | 244 | * @return boolean | int |
245 | 245 | */ |
246 | - public function reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
247 | - return $this->_reg_steps_completed( $transaction, $reg_step_slug, FALSE ); |
|
246 | + public function reg_step_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
247 | + return $this->_reg_steps_completed($transaction, $reg_step_slug, FALSE); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -260,8 +260,8 @@ discard block |
||
260 | 260 | * @param EE_Transaction $transaction |
261 | 261 | * @return boolean | int |
262 | 262 | */ |
263 | - public function final_reg_step_completed( EE_Transaction $transaction ) { |
|
264 | - return $this->_reg_steps_completed( $transaction, 'finalize_registration', FALSE ); |
|
263 | + public function final_reg_step_completed(EE_Transaction $transaction) { |
|
264 | + return $this->_reg_steps_completed($transaction, 'finalize_registration', FALSE); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | * @param string $reg_step_slug |
276 | 276 | * @return boolean |
277 | 277 | */ |
278 | - public function set_reg_step_initiated( EE_Transaction $transaction, $reg_step_slug ) { |
|
278 | + public function set_reg_step_initiated(EE_Transaction $transaction, $reg_step_slug) { |
|
279 | 279 | $current_time = time(); |
280 | - return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, $current_time ); |
|
280 | + return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, $current_time); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | * @param string $reg_step_slug |
292 | 292 | * @return boolean |
293 | 293 | */ |
294 | - public function set_reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
295 | - return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, TRUE ); |
|
294 | + public function set_reg_step_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
295 | + return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, TRUE); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | |
@@ -306,8 +306,8 @@ discard block |
||
306 | 306 | * @param string $reg_step_slug |
307 | 307 | * @return boolean |
308 | 308 | */ |
309 | - public function set_reg_step_not_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
310 | - return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, FALSE ); |
|
309 | + public function set_reg_step_not_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
310 | + return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, FALSE); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | |
@@ -323,36 +323,36 @@ discard block |
||
323 | 323 | * @param boolean | int $status |
324 | 324 | * @return boolean |
325 | 325 | */ |
326 | - private function _set_reg_step_completed_status( EE_Transaction $transaction, $reg_step_slug, $status ) { |
|
326 | + private function _set_reg_step_completed_status(EE_Transaction $transaction, $reg_step_slug, $status) { |
|
327 | 327 | // validate status |
328 | - $status = is_bool( $status ) || is_numeric( $status ) ? $status : false; |
|
328 | + $status = is_bool($status) || is_numeric($status) ? $status : false; |
|
329 | 329 | // get reg steps array |
330 | 330 | $txn_reg_steps = $transaction->reg_steps(); |
331 | 331 | // if reg step does NOT exist |
332 | - if ( ! isset( $txn_reg_steps[ $reg_step_slug ] )) { |
|
332 | + if ( ! isset($txn_reg_steps[$reg_step_slug])) { |
|
333 | 333 | return false; |
334 | 334 | } |
335 | 335 | // if we're trying to complete a step that is already completed |
336 | - if ( $txn_reg_steps[ $reg_step_slug ] === true ) { |
|
336 | + if ($txn_reg_steps[$reg_step_slug] === true) { |
|
337 | 337 | return true; |
338 | 338 | } |
339 | 339 | // if we're trying to complete a step that hasn't even started |
340 | - if ( $status === true && $txn_reg_steps[ $reg_step_slug ] === false ) { |
|
340 | + if ($status === true && $txn_reg_steps[$reg_step_slug] === false) { |
|
341 | 341 | return false; |
342 | 342 | } |
343 | 343 | // if current status value matches the incoming value (no change) |
344 | - if ( $txn_reg_steps[ $reg_step_slug ] === $status ) { |
|
344 | + if ($txn_reg_steps[$reg_step_slug] === $status) { |
|
345 | 345 | // this will happen in cases where multiple AJAX requests occur during the same step |
346 | 346 | return true; |
347 | 347 | } |
348 | 348 | // if we're trying to set a start time |
349 | - if ( is_numeric( $status ) && is_numeric( $txn_reg_steps[ $reg_step_slug ] )) { |
|
349 | + if (is_numeric($status) && is_numeric($txn_reg_steps[$reg_step_slug])) { |
|
350 | 350 | // skip the update below, but don't return FALSE so that errors won't be displayed |
351 | 351 | return true; |
352 | 352 | } |
353 | 353 | // update completed status |
354 | - $txn_reg_steps[ $reg_step_slug ] = $status; |
|
355 | - $transaction->set_reg_steps( $txn_reg_steps ); |
|
354 | + $txn_reg_steps[$reg_step_slug] = $status; |
|
355 | + $transaction->set_reg_steps($txn_reg_steps); |
|
356 | 356 | $transaction->save(); |
357 | 357 | // DEBUG LOG |
358 | 358 | //$this->log( |
@@ -378,11 +378,11 @@ discard block |
||
378 | 378 | * @param string $reg_step_slug |
379 | 379 | * @return void |
380 | 380 | */ |
381 | - public function remove_reg_step( EE_Transaction $transaction, $reg_step_slug ) { |
|
381 | + public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug) { |
|
382 | 382 | // get reg steps array |
383 | 383 | $txn_reg_steps = $transaction->reg_steps(); |
384 | - unset( $txn_reg_steps[ $reg_step_slug ] ); |
|
385 | - $transaction->set_reg_steps( $txn_reg_steps ); |
|
384 | + unset($txn_reg_steps[$reg_step_slug]); |
|
385 | + $transaction->set_reg_steps($txn_reg_steps); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -396,14 +396,14 @@ discard block |
||
396 | 396 | * @param EE_Transaction $transaction |
397 | 397 | * @return boolean |
398 | 398 | */ |
399 | - public function toggle_failed_transaction_status( EE_Transaction $transaction ) { |
|
399 | + public function toggle_failed_transaction_status(EE_Transaction $transaction) { |
|
400 | 400 | // set incoming TXN_Status |
401 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
401 | + $this->set_old_txn_status($transaction->status_ID()); |
|
402 | 402 | // if TXN status is still set as "failed"... |
403 | - if ( $transaction->status_ID() == EEM_Transaction::failed_status_code ) { |
|
403 | + if ($transaction->status_ID() == EEM_Transaction::failed_status_code) { |
|
404 | 404 | // set incoming TXN_Status |
405 | - $this->set_new_txn_status( EEM_Transaction::abandoned_status_code ); |
|
406 | - $transaction->set_status( EEM_Transaction::abandoned_status_code ); |
|
405 | + $this->set_new_txn_status(EEM_Transaction::abandoned_status_code); |
|
406 | + $transaction->set_status(EEM_Transaction::abandoned_status_code); |
|
407 | 407 | return TRUE; |
408 | 408 | } |
409 | 409 | return FALSE; |
@@ -419,20 +419,20 @@ discard block |
||
419 | 419 | * @param EE_Transaction $transaction |
420 | 420 | * @return boolean |
421 | 421 | */ |
422 | - public function toggle_abandoned_transaction_status( EE_Transaction $transaction ) { |
|
422 | + public function toggle_abandoned_transaction_status(EE_Transaction $transaction) { |
|
423 | 423 | // set incoming TXN_Status |
424 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
424 | + $this->set_old_txn_status($transaction->status_ID()); |
|
425 | 425 | // if TXN status has not been updated already due to a payment, and is still set as "failed" or "abandoned"... |
426 | - if ( $transaction->status_ID() == EEM_Transaction::failed_status_code || $transaction->status_ID() == EEM_Transaction::abandoned_status_code ) { |
|
427 | - $this->set_new_txn_status( EEM_Transaction::incomplete_status_code ); |
|
426 | + if ($transaction->status_ID() == EEM_Transaction::failed_status_code || $transaction->status_ID() == EEM_Transaction::abandoned_status_code) { |
|
427 | + $this->set_new_txn_status(EEM_Transaction::incomplete_status_code); |
|
428 | 428 | // if a contact record for the primary registrant has been created |
429 | - if ( $transaction->primary_registration() instanceof EE_Registration && $transaction->primary_registration()->attendee() instanceof EE_Attendee ) { |
|
430 | - $transaction->set_status( EEM_Transaction::incomplete_status_code ); |
|
431 | - $this->set_new_txn_status( EEM_Transaction::incomplete_status_code ); |
|
429 | + if ($transaction->primary_registration() instanceof EE_Registration && $transaction->primary_registration()->attendee() instanceof EE_Attendee) { |
|
430 | + $transaction->set_status(EEM_Transaction::incomplete_status_code); |
|
431 | + $this->set_new_txn_status(EEM_Transaction::incomplete_status_code); |
|
432 | 432 | } else { |
433 | 433 | // no contact record? yer abandoned! |
434 | - $transaction->set_status( EEM_Transaction::abandoned_status_code ); |
|
435 | - $this->set_new_txn_status( EEM_Transaction::abandoned_status_code ); |
|
434 | + $transaction->set_status(EEM_Transaction::abandoned_status_code); |
|
435 | + $this->set_new_txn_status(EEM_Transaction::abandoned_status_code); |
|
436 | 436 | } |
437 | 437 | return TRUE; |
438 | 438 | } |
@@ -450,16 +450,16 @@ discard block |
||
450 | 450 | * @param array $registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction |
451 | 451 | * @return boolean |
452 | 452 | */ |
453 | - public function manually_update_registration_statuses( EE_Transaction $transaction, $new_reg_status = '', $registration_query_params = array() ) { |
|
454 | - $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'manually_update_registration_status', $transaction, $registration_query_params, $new_reg_status ); |
|
453 | + public function manually_update_registration_statuses(EE_Transaction $transaction, $new_reg_status = '', $registration_query_params = array()) { |
|
454 | + $status_updates = $this->_call_method_on_registrations_via_Registration_Processor('manually_update_registration_status', $transaction, $registration_query_params, $new_reg_status); |
|
455 | 455 | // send messages |
456 | 456 | /** @type EE_Registration_Processor $registration_processor */ |
457 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
457 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
458 | 458 | $registration_processor->trigger_registration_update_notifications( |
459 | 459 | $transaction->primary_registration(), |
460 | - array( 'manually_updated' => true ) |
|
460 | + array('manually_updated' => true) |
|
461 | 461 | ); |
462 | - do_action( 'AHEE__EE_Transaction_Processor__manually_update_registration_statuses', $transaction, $status_updates ); |
|
462 | + do_action('AHEE__EE_Transaction_Processor__manually_update_registration_statuses', $transaction, $status_updates); |
|
463 | 463 | return $status_updates; |
464 | 464 | } |
465 | 465 | |
@@ -473,9 +473,9 @@ discard block |
||
473 | 473 | * @param array $registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction |
474 | 474 | * @return boolean |
475 | 475 | */ |
476 | - public function toggle_registration_statuses_for_default_approved_events( EE_Transaction $transaction, $registration_query_params = array() ) { |
|
477 | - $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'toggle_registration_status_for_default_approved_events', $transaction, $registration_query_params ); |
|
478 | - do_action( 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', $transaction, $status_updates ); |
|
476 | + public function toggle_registration_statuses_for_default_approved_events(EE_Transaction $transaction, $registration_query_params = array()) { |
|
477 | + $status_updates = $this->_call_method_on_registrations_via_Registration_Processor('toggle_registration_status_for_default_approved_events', $transaction, $registration_query_params); |
|
478 | + do_action('AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', $transaction, $status_updates); |
|
479 | 479 | return $status_updates; |
480 | 480 | } |
481 | 481 | |
@@ -489,9 +489,9 @@ discard block |
||
489 | 489 | * @param array $registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction |
490 | 490 | * @return boolean |
491 | 491 | */ |
492 | - public function toggle_registration_statuses_if_no_monies_owing( EE_Transaction $transaction, $registration_query_params = array() ) { |
|
493 | - $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'toggle_registration_status_if_no_monies_owing', $transaction, $registration_query_params ); |
|
494 | - do_action( 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing', $transaction, $status_updates ); |
|
492 | + public function toggle_registration_statuses_if_no_monies_owing(EE_Transaction $transaction, $registration_query_params = array()) { |
|
493 | + $status_updates = $this->_call_method_on_registrations_via_Registration_Processor('toggle_registration_status_if_no_monies_owing', $transaction, $registration_query_params); |
|
494 | + do_action('AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing', $transaction, $status_updates); |
|
495 | 495 | return $status_updates; |
496 | 496 | } |
497 | 497 | |
@@ -507,17 +507,17 @@ discard block |
||
507 | 507 | * @throws \EE_Error |
508 | 508 | * @return array |
509 | 509 | */ |
510 | - public function update_transaction_and_registrations_after_checkout_or_payment( EE_Transaction $transaction, $payment = NULL, $registration_query_params = array() ) { |
|
510 | + public function update_transaction_and_registrations_after_checkout_or_payment(EE_Transaction $transaction, $payment = NULL, $registration_query_params = array()) { |
|
511 | 511 | // set incoming TXN_Status, and consider it new since old status should have been set |
512 | - $this->set_new_txn_status( $transaction->status_ID() ); |
|
513 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $transaction->status_ID(), '$transaction->status_ID()' ); |
|
512 | + $this->set_new_txn_status($transaction->status_ID()); |
|
513 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $transaction->status_ID(), '$transaction->status_ID()'); |
|
514 | 514 | // make sure some query params are set for retrieving registrations |
515 | - $this->_set_registration_query_params( $registration_query_params ); |
|
515 | + $this->_set_registration_query_params($registration_query_params); |
|
516 | 516 | // get final reg step status |
517 | - $finalized = $this->final_reg_step_completed( $transaction ); |
|
517 | + $finalized = $this->final_reg_step_completed($transaction); |
|
518 | 518 | // if the 'finalize_registration' step has been initiated (has a timestamp) but has not yet been fully completed (TRUE) |
519 | - if ( is_numeric( $finalized ) && $finalized !== true ) { |
|
520 | - $this->set_reg_step_completed( $transaction, 'finalize_registration' ); |
|
519 | + if (is_numeric($finalized) && $finalized !== true) { |
|
520 | + $this->set_reg_step_completed($transaction, 'finalize_registration'); |
|
521 | 521 | $finalized = true; |
522 | 522 | } |
523 | 523 | $transaction->save(); |
@@ -540,13 +540,13 @@ discard block |
||
540 | 540 | |
541 | 541 | // send messages |
542 | 542 | /** @type EE_Registration_Processor $registration_processor */ |
543 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
543 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
544 | 544 | $registration_processor->trigger_registration_update_notifications( |
545 | 545 | $transaction->primary_registration(), |
546 | 546 | $update_params |
547 | 547 | ); |
548 | 548 | |
549 | - do_action( 'AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', $transaction, $update_params ); |
|
549 | + do_action('AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', $transaction, $update_params); |
|
550 | 550 | return $update_params; |
551 | 551 | } |
552 | 552 | |
@@ -564,23 +564,23 @@ discard block |
||
564 | 564 | * @throws \EE_Error |
565 | 565 | * @return boolean |
566 | 566 | */ |
567 | - private function _call_method_on_registrations_via_Registration_Processor( $method_name, EE_Transaction $transaction, $registration_query_params = array(), $additional_param = NULL ) { |
|
567 | + private function _call_method_on_registrations_via_Registration_Processor($method_name, EE_Transaction $transaction, $registration_query_params = array(), $additional_param = NULL) { |
|
568 | 568 | $response = FALSE; |
569 | 569 | /** @type EE_Registration_Processor $registration_processor */ |
570 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
570 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
571 | 571 | // check that method exists |
572 | - if ( ! method_exists( $registration_processor, $method_name )) { |
|
573 | - throw new EE_Error( __( 'Method does not exist.', 'event_espresso' )); |
|
572 | + if ( ! method_exists($registration_processor, $method_name)) { |
|
573 | + throw new EE_Error(__('Method does not exist.', 'event_espresso')); |
|
574 | 574 | } |
575 | 575 | // make sure some query params are set for retrieving registrations |
576 | - $this->_set_registration_query_params( $registration_query_params ); |
|
576 | + $this->_set_registration_query_params($registration_query_params); |
|
577 | 577 | // loop through cached registrations |
578 | - foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) { |
|
579 | - if ( $registration instanceof EE_Registration ) { |
|
580 | - if ( $additional_param ) { |
|
581 | - $response = $registration_processor->$method_name( $registration, $additional_param ) ? TRUE : $response; |
|
578 | + foreach ($transaction->registrations($this->_registration_query_params) as $registration) { |
|
579 | + if ($registration instanceof EE_Registration) { |
|
580 | + if ($additional_param) { |
|
581 | + $response = $registration_processor->$method_name($registration, $additional_param) ? TRUE : $response; |
|
582 | 582 | } else { |
583 | - $response = $registration_processor->$method_name( $registration ) ? TRUE : $response; |
|
583 | + $response = $registration_processor->$method_name($registration) ? TRUE : $response; |
|
584 | 584 | } |
585 | 585 | } |
586 | 586 | } |
@@ -605,46 +605,46 @@ discard block |
||
605 | 605 | public function set_transaction_payment_method_based_on_registration_statuses( |
606 | 606 | EE_Registration $edited_registration |
607 | 607 | ) { |
608 | - if ( $edited_registration instanceof EE_Registration ) { |
|
608 | + if ($edited_registration instanceof EE_Registration) { |
|
609 | 609 | $transaction = $edited_registration->transaction(); |
610 | - if ( $transaction instanceof EE_Transaction ) { |
|
610 | + if ($transaction instanceof EE_Transaction) { |
|
611 | 611 | $all_not_approved = true; |
612 | - foreach ( $transaction->registrations() as $registration ) { |
|
613 | - if ( $registration instanceof EE_Registration ) { |
|
612 | + foreach ($transaction->registrations() as $registration) { |
|
613 | + if ($registration instanceof EE_Registration) { |
|
614 | 614 | // if any REG != "Not Approved" then toggle to false |
615 | 615 | $all_not_approved = $registration->is_not_approved() ? $all_not_approved : false; |
616 | 616 | } |
617 | 617 | } |
618 | 618 | // if ALL Registrations are "Not Approved" |
619 | - if ( $all_not_approved ) { |
|
620 | - $transaction->set_payment_method_ID( null ); |
|
619 | + if ($all_not_approved) { |
|
620 | + $transaction->set_payment_method_ID(null); |
|
621 | 621 | $transaction->save(); |
622 | 622 | } else { |
623 | - $available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( $transaction, EEM_Payment_Method::scope_cart ); |
|
624 | - if ( ! empty( $available_payment_methods ) ) { |
|
623 | + $available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction($transaction, EEM_Payment_Method::scope_cart); |
|
624 | + if ( ! empty($available_payment_methods)) { |
|
625 | 625 | $PMD_ID = 0; |
626 | - foreach ( $available_payment_methods as $available_payment_method ) { |
|
627 | - if ( $available_payment_method instanceof EE_Payment_Method && $available_payment_method->open_by_default() ) { |
|
626 | + foreach ($available_payment_methods as $available_payment_method) { |
|
627 | + if ($available_payment_method instanceof EE_Payment_Method && $available_payment_method->open_by_default()) { |
|
628 | 628 | $PMD_ID = $available_payment_method->ID(); |
629 | 629 | break; |
630 | 630 | } |
631 | 631 | } |
632 | - if ( ! $PMD_ID ) { |
|
633 | - $first_payment_method = reset( $available_payment_methods ); |
|
634 | - if ( $first_payment_method instanceof EE_Payment_Method ) { |
|
632 | + if ( ! $PMD_ID) { |
|
633 | + $first_payment_method = reset($available_payment_methods); |
|
634 | + if ($first_payment_method instanceof EE_Payment_Method) { |
|
635 | 635 | $PMD_ID = $first_payment_method->ID(); |
636 | 636 | } else { |
637 | 637 | EE_Error::add_error( |
638 | - __( 'A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso' ), |
|
638 | + __('A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso'), |
|
639 | 639 | __FILE__, __LINE__, __FUNCTION__ |
640 | 640 | ); |
641 | 641 | } |
642 | 642 | } |
643 | - $transaction->set_payment_method_ID( $PMD_ID ); |
|
643 | + $transaction->set_payment_method_ID($PMD_ID); |
|
644 | 644 | $transaction->save(); |
645 | 645 | } else { |
646 | 646 | EE_Error::add_error( |
647 | - __( 'Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso' ), |
|
647 | + __('Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso'), |
|
648 | 648 | __FILE__, __LINE__, __FUNCTION__ |
649 | 649 | ); |
650 | 650 | } |