@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | * @return EED_Ticket_Selector |
58 | 58 | */ |
59 | 59 | public static function instance() { |
60 | - return parent::get_instance( __CLASS__ ); |
|
60 | + return parent::get_instance(__CLASS__); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | |
65 | - protected function set_config(){ |
|
66 | - $this->set_config_section( 'template_settings' ); |
|
67 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
68 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
65 | + protected function set_config() { |
|
66 | + $this->set_config_section('template_settings'); |
|
67 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
68 | + $this->set_config_name('EED_Ticket_Selector'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public static function set_hooks() { |
82 | 82 | // routing |
83 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
84 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
85 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
83 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
84 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
85 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
86 | 86 | //add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 ); |
87 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
87 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
88 | 88 | //add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 ); |
89 | 89 | //add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 ); |
90 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
90 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | * @return void |
100 | 100 | */ |
101 | 101 | public static function set_hooks_admin() { |
102 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
102 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
103 | 103 | //add button for iframe code to event editor. |
104 | - add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 ); |
|
105 | - add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 ); |
|
104 | + add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4); |
|
105 | + add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | * @return void |
115 | 115 | */ |
116 | 116 | public static function set_definitions() { |
117 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
118 | - define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
117 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
118 | + define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
119 | 119 | |
120 | 120 | //if config is not set, initialize |
121 | 121 | //If config is not set, set it. |
122 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) { |
|
122 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) { |
|
123 | 123 | EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
124 | 124 | } |
125 | - EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' ); |
|
125 | + EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso'); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param object $WP |
134 | 134 | * @return void |
135 | 135 | */ |
136 | - public function run( $WP ) {} |
|
136 | + public function run($WP) {} |
|
137 | 137 | |
138 | 138 | |
139 | 139 | /** |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | public function ticket_selector_iframe() { |
146 | 146 | self::$_in_iframe = true; |
147 | 147 | /** @type EEM_Event $EEM_Event */ |
148 | - $EEM_Event = EE_Registry::instance()->load_model( 'Event' ); |
|
148 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
149 | 149 | $event = $EEM_Event->get_one_by_ID( |
150 | - EE_Registry::instance()->REQ->get( 'event', 0 ) |
|
150 | + EE_Registry::instance()->REQ->get('event', 0) |
|
151 | 151 | ); |
152 | - EE_Registry::instance()->REQ->set_espresso_page( true ); |
|
153 | - $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event ); |
|
152 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
153 | + $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event); |
|
154 | 154 | $template_args['css'] = apply_filters( |
155 | 155 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
156 | 156 | array( |
157 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
158 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
159 | - includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ), |
|
160 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
157 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION, |
|
158 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION, |
|
159 | + includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']), |
|
160 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
161 | 161 | ) |
162 | 162 | ); |
163 | - EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true; |
|
164 | - EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' ); |
|
163 | + EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true; |
|
164 | + EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso'); |
|
165 | 165 | $template_args['eei18n'] = apply_filters( |
166 | 166 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings', |
167 | 167 | EE_Registry::localize_i18n_js_strings() |
@@ -169,19 +169,19 @@ discard block |
||
169 | 169 | $template_args['js'] = apply_filters( |
170 | 170 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
171 | 171 | array( |
172 | - includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ), |
|
173 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION, |
|
174 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION |
|
172 | + includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']), |
|
173 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION, |
|
174 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION |
|
175 | 175 | ) |
176 | 176 | ); |
177 | 177 | EE_Registry::instance()->load_helper('Template'); |
178 | - $template_args[ 'notices' ] = EEH_Template::display_template( |
|
179 | - EE_TEMPLATES . 'espresso-ajax-notices.template.php', |
|
178 | + $template_args['notices'] = EEH_Template::display_template( |
|
179 | + EE_TEMPLATES.'espresso-ajax-notices.template.php', |
|
180 | 180 | array(), |
181 | 181 | true |
182 | 182 | ); |
183 | 183 | EEH_Template::display_template( |
184 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php', |
|
184 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php', |
|
185 | 185 | $template_args |
186 | 186 | ); |
187 | 187 | exit; |
@@ -200,23 +200,23 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return string The new html string for the permalink area. |
202 | 202 | */ |
203 | - public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) { |
|
203 | + public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) { |
|
204 | 204 | //make sure this is ONLY when editing and the event id has been set. |
205 | - if ( ! empty( $id ) ) { |
|
206 | - $post = get_post( $id ); |
|
205 | + if ( ! empty($id)) { |
|
206 | + $post = get_post($id); |
|
207 | 207 | |
208 | 208 | //if NOT event then let's get out. |
209 | - if ( $post->post_type !== 'espresso_events' ) { |
|
209 | + if ($post->post_type !== 'espresso_events') { |
|
210 | 210 | return $permalink_string; |
211 | 211 | } |
212 | 212 | |
213 | - $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
|
213 | + $ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url()); |
|
214 | 214 | |
215 | - $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' . __('Embed', 'event_espresso') . '</a> '; |
|
215 | + $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">'.__('Embed', 'event_espresso').'</a> '; |
|
216 | 216 | $permalink_string .= ' |
217 | 217 | <div id="js-ts-iframe" style="display:none"> |
218 | 218 | <div style="width:100%; height: 500px;"> |
219 | - <iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe> |
|
219 | + <iframe src="' . $ticket_selector_url.'" width="100%" height="100%"></iframe> |
|
220 | 220 | </div> |
221 | 221 | </div>'; |
222 | 222 | } |
@@ -235,22 +235,22 @@ discard block |
||
235 | 235 | * @param mixed $event |
236 | 236 | * @return bool |
237 | 237 | */ |
238 | - protected static function set_event( $event = null ) { |
|
239 | - if( $event === null ) { |
|
238 | + protected static function set_event($event = null) { |
|
239 | + if ($event === null) { |
|
240 | 240 | global $post; |
241 | 241 | $event = $post; |
242 | 242 | } |
243 | - if ( $event instanceof EE_Event ) { |
|
243 | + if ($event instanceof EE_Event) { |
|
244 | 244 | self::$_event = $event; |
245 | - } else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) { |
|
245 | + } else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) { |
|
246 | 246 | self::$_event = $event->EE_Event; |
247 | - } else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) { |
|
248 | - $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event ); |
|
247 | + } else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') { |
|
248 | + $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event); |
|
249 | 249 | self::$_event = $event->EE_Event; |
250 | 250 | } else { |
251 | - $user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' ); |
|
252 | - $dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' ); |
|
253 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
251 | + $user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso'); |
|
252 | + $dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso'); |
|
253 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
254 | 254 | return false; |
255 | 255 | } |
256 | 256 | return true; |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * @param bool $view_details |
270 | 270 | * @return string |
271 | 271 | */ |
272 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
272 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
273 | 273 | // reset filter for displaying submit button |
274 | - remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
274 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
275 | 275 | // poke and prod incoming event till it tells us what it is |
276 | - if ( ! EED_Ticket_Selector::set_event( $event )) { |
|
276 | + if ( ! EED_Ticket_Selector::set_event($event)) { |
|
277 | 277 | return false; |
278 | 278 | } |
279 | 279 | $event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | && ( |
285 | 285 | ! self::$_event->display_ticket_selector() |
286 | 286 | || $view_details |
287 | - || post_password_required( $event_post ) |
|
287 | + || post_password_required($event_post) |
|
288 | 288 | || ( |
289 | 289 | $_event_active_status != EE_Datetime::active |
290 | 290 | && $_event_active_status != EE_Datetime::upcoming |
@@ -302,70 +302,70 @@ discard block |
||
302 | 302 | $template_args = array(); |
303 | 303 | $template_args['event_status'] = $_event_active_status; |
304 | 304 | |
305 | - $template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) ); |
|
306 | - $template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) ); |
|
305 | + $template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format')); |
|
306 | + $template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format')); |
|
307 | 307 | |
308 | 308 | $template_args['EVT_ID'] = self::$_event->ID(); |
309 | 309 | $template_args['event'] = self::$_event; |
310 | 310 | |
311 | 311 | // is the event expired ? |
312 | 312 | $template_args['event_is_expired'] = self::$_event->is_expired(); |
313 | - if ( $template_args['event_is_expired'] ) { |
|
314 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>'; |
|
313 | + if ($template_args['event_is_expired']) { |
|
314 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>'; |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | $ticket_query_args = array( |
318 | - array( 'Datetime.EVT_ID' => self::$_event->ID() ), |
|
319 | - 'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' ) |
|
318 | + array('Datetime.EVT_ID' => self::$_event->ID()), |
|
319 | + 'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC') |
|
320 | 320 | ); |
321 | 321 | |
322 | - if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) { |
|
322 | + if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) { |
|
323 | 323 | //use the correct applicable time query depending on what version of core is being run. |
324 | - $current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp'); |
|
325 | - $ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time ); |
|
324 | + $current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp'); |
|
325 | + $ticket_query_args[0]['TKT_end_date'] = array('>', $current_time); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | // get all tickets for this event ordered by the datetime |
329 | - $template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args ); |
|
329 | + $template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args); |
|
330 | 330 | |
331 | - if ( count( $template_args['tickets'] ) < 1 ) { |
|
332 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>'; |
|
331 | + if (count($template_args['tickets']) < 1) { |
|
332 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>'; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | // filter the maximum qty that can appear in the Ticket Selector qty dropdowns |
336 | - $template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit() ); |
|
337 | - if ( $template_args['max_atndz'] < 1 ) { |
|
338 | - $sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' ); |
|
339 | - if ( current_user_can( 'edit_post', self::$_event->ID() )) { |
|
340 | - $sales_closed_msg .= sprintf( |
|
341 | - __( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ), |
|
336 | + $template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit()); |
|
337 | + if ($template_args['max_atndz'] < 1) { |
|
338 | + $sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso'); |
|
339 | + if (current_user_can('edit_post', self::$_event->ID())) { |
|
340 | + $sales_closed_msg .= sprintf( |
|
341 | + __('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'), |
|
342 | 342 | '<div class="ee-attention" style="text-align: left;"><b>', |
343 | 343 | '</b><br />', |
344 | - $link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">', |
|
344 | + $link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">', |
|
345 | 345 | '</a></span></div>' |
346 | 346 | ); |
347 | 347 | } |
348 | - return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>'; |
|
348 | + return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>'; |
|
349 | 349 | } |
350 | 350 | |
351 | - $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php'; |
|
352 | - $templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event ); |
|
351 | + $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php'; |
|
352 | + $templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event); |
|
353 | 353 | |
354 | 354 | // redirecting to another site for registration ?? |
355 | 355 | $external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE; |
356 | 356 | // set up the form (but not for the admin) |
357 | - $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : ''; |
|
357 | + $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : ''; |
|
358 | 358 | // if not redirecting to another site for registration |
359 | - if ( ! $external_url ) { |
|
360 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
361 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
359 | + if ( ! $external_url) { |
|
360 | + EE_Registry::instance()->load_helper('Template'); |
|
361 | + EE_Registry::instance()->load_helper('URL'); |
|
362 | 362 | // then display the ticket selector |
363 | - $ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args ); |
|
363 | + $ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args); |
|
364 | 364 | } else { |
365 | 365 | // if not we still need to trigger the display of the submit button |
366 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
366 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
367 | 367 | //display notice to admin that registration is external |
368 | - $ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' ); |
|
368 | + $ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso'); |
|
369 | 369 | } |
370 | 370 | // submit button and form close tag |
371 | 371 | $ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : ''; |
@@ -385,27 +385,27 @@ discard block |
||
385 | 385 | * @param string $external_url |
386 | 386 | * @return string |
387 | 387 | */ |
388 | - public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) { |
|
388 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') { |
|
389 | 389 | // if redirecting, we don't need any anything else |
390 | - if ( $external_url ) { |
|
391 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
392 | - $html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">'; |
|
393 | - $query_args = EEH_URL::get_query_string( $external_url ); |
|
394 | - foreach ( $query_args as $query_arg => $value ) { |
|
395 | - $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; |
|
390 | + if ($external_url) { |
|
391 | + EE_Registry::instance()->load_helper('URL'); |
|
392 | + $html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">'; |
|
393 | + $query_args = EEH_URL::get_query_string($external_url); |
|
394 | + foreach ($query_args as $query_arg => $value) { |
|
395 | + $html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">'; |
|
396 | 396 | } |
397 | 397 | return $html; |
398 | 398 | } |
399 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
400 | - $checkout_url = EEH_Event_View::event_link_url( $ID ); |
|
401 | - if ( ! $checkout_url ) { |
|
402 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
399 | + EE_Registry::instance()->load_helper('Event_View'); |
|
400 | + $checkout_url = EEH_Event_View::event_link_url($ID); |
|
401 | + if ( ! $checkout_url) { |
|
402 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
403 | 403 | } |
404 | 404 | $extra_params = self::$_in_iframe ? ' target="_blank"' : ''; |
405 | - $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>'; |
|
406 | - $html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE ); |
|
405 | + $html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>'; |
|
406 | + $html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE); |
|
407 | 407 | $html .= '<input type="hidden" name="ee" value="process_ticket_selections">'; |
408 | - $html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event ); |
|
408 | + $html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event); |
|
409 | 409 | return $html; |
410 | 410 | } |
411 | 411 | |
@@ -420,21 +420,21 @@ discard block |
||
420 | 420 | * @return string |
421 | 421 | */ |
422 | 422 | public static function display_ticket_selector_submit() { |
423 | - if ( ! is_admin() ) { |
|
424 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) { |
|
423 | + if ( ! is_admin()) { |
|
424 | + if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) { |
|
425 | 425 | $btn_text = apply_filters( |
426 | 426 | 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', |
427 | - __('Register Now', 'event_espresso' ), |
|
427 | + __('Register Now', 'event_espresso'), |
|
428 | 428 | self::$_event |
429 | 429 | ); |
430 | - $html = '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn"'; |
|
430 | + $html = '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn"'; |
|
431 | 431 | $html .= ' class="ticket-selector-submit-btn ticket-selector-submit-ajax"'; |
432 | - $html .= ' type="submit" value="' . $btn_text . '" />'; |
|
433 | - $html .= apply_filters( 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event ); |
|
432 | + $html .= ' type="submit" value="'.$btn_text.'" />'; |
|
433 | + $html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event); |
|
434 | 434 | $html .= '<div class="clear"><br/></div></form>'; |
435 | 435 | return $html; |
436 | - } else if ( is_archive() ) { |
|
437 | - return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn(); |
|
436 | + } else if (is_archive()) { |
|
437 | + return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn(); |
|
438 | 438 | } |
439 | 439 | } |
440 | 440 | return ''; |
@@ -466,13 +466,13 @@ discard block |
||
466 | 466 | * @return string |
467 | 467 | */ |
468 | 468 | public static function display_view_details_btn() { |
469 | - if ( ! self::$_event->get_permalink() ) { |
|
470 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
469 | + if ( ! self::$_event->get_permalink()) { |
|
470 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
471 | 471 | } |
472 | - $view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">'; |
|
473 | - $btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event ); |
|
474 | - $view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />'; |
|
475 | - $view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event ); |
|
472 | + $view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">'; |
|
473 | + $btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event); |
|
474 | + $view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />'; |
|
475 | + $view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event); |
|
476 | 476 | $view_details_btn .= '<div class="clear"><br/></div>'; |
477 | 477 | $view_details_btn .= '</form>'; |
478 | 478 | return $view_details_btn; |
@@ -491,11 +491,11 @@ discard block |
||
491 | 491 | * @return array or FALSE |
492 | 492 | */ |
493 | 493 | public function process_ticket_selections() { |
494 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
494 | + do_action('EED_Ticket_Selector__process_ticket_selections__before'); |
|
495 | 495 | // check nonce |
496 | - if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) { |
|
496 | + if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) { |
|
497 | 497 | EE_Error::add_error( |
498 | - sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
498 | + sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
499 | 499 | __FILE__, __FUNCTION__, __LINE__ |
500 | 500 | ); |
501 | 501 | return FALSE; |
@@ -509,16 +509,16 @@ discard block |
||
509 | 509 | |
510 | 510 | //we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart. |
511 | 511 | // When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc. |
512 | - EE_Registry::instance()->load_core( 'Session' ); |
|
512 | + EE_Registry::instance()->load_core('Session'); |
|
513 | 513 | // unless otherwise requested, clear the session |
514 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) { |
|
515 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
514 | + if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) { |
|
515 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
516 | 516 | } |
517 | 517 | //d( EE_Registry::instance()->SSN ); |
518 | 518 | |
519 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
519 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
520 | 520 | // do we have an event id? |
521 | - if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) { |
|
521 | + if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) { |
|
522 | 522 | // validate/sanitize data |
523 | 523 | $valid = self::_validate_post_data(); |
524 | 524 | |
@@ -528,43 +528,43 @@ discard block |
||
528 | 528 | //EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ ); |
529 | 529 | |
530 | 530 | //check total tickets ordered vs max number of attendees that can register |
531 | - if ( $valid['total_tickets'] > $valid['max_atndz'] ) { |
|
531 | + if ($valid['total_tickets'] > $valid['max_atndz']) { |
|
532 | 532 | |
533 | 533 | // ordering too many tickets !!! |
534 | 534 | $singular = 'You have attempted to purchase %s ticket.'; |
535 | 535 | $plural = 'You have attempted to purchase %s tickets.'; |
536 | - $limit_error_1 = sprintf( _n( $singular, $plural, $valid['total_tickets'], 'event_espresso' ), $valid['total_tickets'], $valid['total_tickets'] ); |
|
536 | + $limit_error_1 = sprintf(_n($singular, $plural, $valid['total_tickets'], 'event_espresso'), $valid['total_tickets'], $valid['total_tickets']); |
|
537 | 537 | // dev only message |
538 | 538 | $singular = 'The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.'; |
539 | 539 | $plural = 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.'; |
540 | - $limit_error_2 = sprintf( _n( $singular, $plural, $valid['max_atndz'], 'event_espresso' ), $valid['max_atndz'], $valid['max_atndz'] ); |
|
541 | - EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ ); |
|
540 | + $limit_error_2 = sprintf(_n($singular, $plural, $valid['max_atndz'], 'event_espresso'), $valid['max_atndz'], $valid['max_atndz']); |
|
541 | + EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__); |
|
542 | 542 | } else { |
543 | 543 | |
544 | 544 | // all data appears to be valid |
545 | 545 | $tckts_slctd = FALSE; |
546 | 546 | $success = TRUE; |
547 | 547 | // load cart |
548 | - EE_Registry::instance()->load_core( 'Cart' ); |
|
548 | + EE_Registry::instance()->load_core('Cart'); |
|
549 | 549 | |
550 | 550 | // cycle thru the number of data rows sent from the event listing |
551 | - for ( $x = 0; $x < $valid['rows']; $x++ ) { |
|
551 | + for ($x = 0; $x < $valid['rows']; $x++) { |
|
552 | 552 | // does this row actually contain a ticket quantity? |
553 | - if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) { |
|
553 | + if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) { |
|
554 | 554 | // YES we have a ticket quantity |
555 | 555 | $tckts_slctd = TRUE; |
556 | 556 | // d( $valid['ticket_obj'][$x] ); |
557 | - if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) { |
|
557 | + if ($valid['ticket_obj'][$x] instanceof EE_Ticket) { |
|
558 | 558 | // then add ticket to cart |
559 | - $ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] ); |
|
559 | + $ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]); |
|
560 | 560 | $success = ! $ticket_added ? FALSE : $success; |
561 | - if ( EE_Error::has_error() ) { |
|
561 | + if (EE_Error::has_error()) { |
|
562 | 562 | break; |
563 | 563 | } |
564 | 564 | } else { |
565 | 565 | // nothing added to cart retrieved |
566 | 566 | EE_Error::add_error( |
567 | - sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
567 | + sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
568 | 568 | __FILE__, __FUNCTION__, __LINE__ |
569 | 569 | ); |
570 | 570 | } |
@@ -573,45 +573,45 @@ discard block |
||
573 | 573 | //d( EE_Registry::instance()->CART ); |
574 | 574 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE |
575 | 575 | |
576 | - if ( $tckts_slctd ) { |
|
577 | - if ( $success ) { |
|
578 | - do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this ); |
|
576 | + if ($tckts_slctd) { |
|
577 | + if ($success) { |
|
578 | + do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this); |
|
579 | 579 | EE_Registry::instance()->CART->recalculate_all_cart_totals(); |
580 | - EE_Registry::instance()->CART->save_cart( FALSE ); |
|
580 | + EE_Registry::instance()->CART->save_cart(FALSE); |
|
581 | 581 | EE_Registry::instance()->SSN->update(); |
582 | 582 | //d( EE_Registry::instance()->CART ); |
583 | 583 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE |
584 | 584 | // just return TRUE for registrations being made from admin |
585 | - if ( is_admin() ) { |
|
585 | + if (is_admin()) { |
|
586 | 586 | return TRUE; |
587 | 587 | } |
588 | - wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() )); |
|
588 | + wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url())); |
|
589 | 589 | exit(); |
590 | 590 | |
591 | 591 | } else { |
592 | - if ( ! EE_Error::has_error() ) { |
|
592 | + if ( ! EE_Error::has_error()) { |
|
593 | 593 | // nothing added to cart |
594 | - EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
594 | + EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
595 | 595 | } |
596 | 596 | } |
597 | 597 | |
598 | 598 | } else { |
599 | 599 | // no ticket quantities were selected |
600 | - EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
600 | + EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
601 | 601 | } |
602 | 602 | } |
603 | 603 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT |
604 | 604 | // at this point, just return if registration is being made from admin |
605 | - if ( is_admin() ) { |
|
605 | + if (is_admin()) { |
|
606 | 606 | return FALSE; |
607 | 607 | } |
608 | - if ( $valid['return_url'] ) { |
|
609 | - EE_Error::get_notices( FALSE, TRUE ); |
|
610 | - wp_safe_redirect( $valid['return_url'] ); |
|
608 | + if ($valid['return_url']) { |
|
609 | + EE_Error::get_notices(FALSE, TRUE); |
|
610 | + wp_safe_redirect($valid['return_url']); |
|
611 | 611 | exit(); |
612 | - } elseif ( isset( $event_to_add['id'] )) { |
|
613 | - EE_Error::get_notices( FALSE, TRUE ); |
|
614 | - wp_safe_redirect( get_permalink( $event_to_add['id'] )); |
|
612 | + } elseif (isset($event_to_add['id'])) { |
|
613 | + EE_Error::get_notices(FALSE, TRUE); |
|
614 | + wp_safe_redirect(get_permalink($event_to_add['id'])); |
|
615 | 615 | exit(); |
616 | 616 | } else { |
617 | 617 | echo EE_Error::get_notices(); |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | } else { |
621 | 621 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
622 | 622 | EE_Error::add_error( |
623 | - sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
623 | + sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
624 | 624 | __FILE__, __FUNCTION__, __LINE__ |
625 | 625 | ); |
626 | 626 | } |
@@ -638,18 +638,18 @@ discard block |
||
638 | 638 | * @return array or FALSE |
639 | 639 | */ |
640 | 640 | private static function _validate_post_data() { |
641 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
641 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
642 | 642 | |
643 | 643 | // start with an empty array() |
644 | 644 | $valid_data = array(); |
645 | 645 | // d( $_POST ); |
646 | 646 | //if event id is valid |
647 | - $id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' )); |
|
648 | - if ( $id ) { |
|
647 | + $id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id')); |
|
648 | + if ($id) { |
|
649 | 649 | // grab valid id |
650 | 650 | $valid_data['id'] = $id; |
651 | 651 | // grab and sanitize return-url |
652 | - $valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id )); |
|
652 | + $valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id)); |
|
653 | 653 | // array of other form names |
654 | 654 | $inputs_to_clean = array( |
655 | 655 | 'event_id' => 'tkt-slctr-event-id', |
@@ -662,22 +662,22 @@ discard block |
||
662 | 662 | // let's track the total number of tickets ordered.' |
663 | 663 | $valid_data['total_tickets'] = 0; |
664 | 664 | // cycle through $inputs_to_clean array |
665 | - foreach ( $inputs_to_clean as $what => $input_to_clean ) { |
|
665 | + foreach ($inputs_to_clean as $what => $input_to_clean) { |
|
666 | 666 | // check for POST data |
667 | - if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) { |
|
667 | + if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) { |
|
668 | 668 | // grab value |
669 | - $input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id ); |
|
669 | + $input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id); |
|
670 | 670 | switch ($what) { |
671 | 671 | |
672 | 672 | // integers |
673 | 673 | case 'event_id': |
674 | - $valid_data[$what] = absint( $input_value ); |
|
674 | + $valid_data[$what] = absint($input_value); |
|
675 | 675 | // get event via the event id we put in the form |
676 | - $valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] ); |
|
676 | + $valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']); |
|
677 | 677 | break; |
678 | 678 | case 'rows': |
679 | 679 | case 'max_atndz': |
680 | - $valid_data[$what] = absint( $input_value ); |
|
680 | + $valid_data[$what] = absint($input_value); |
|
681 | 681 | break; |
682 | 682 | |
683 | 683 | // arrays of integers |
@@ -685,27 +685,27 @@ discard block |
||
685 | 685 | // d( $input_value ); |
686 | 686 | $row_qty = $input_value; |
687 | 687 | // if qty is coming from a radio button input, then we need to assemble an array of rows |
688 | - if( ! is_array( $row_qty )) { |
|
688 | + if ( ! is_array($row_qty)) { |
|
689 | 689 | // get number of rows |
690 | - $rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1; |
|
690 | + $rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1; |
|
691 | 691 | // d( $rows ); |
692 | 692 | // explode ints by the dash |
693 | - $row_qty = explode( '-', $row_qty ); |
|
694 | - $row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1; |
|
695 | - $qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0; |
|
696 | - $row_qty = array( $row => $qty ); |
|
693 | + $row_qty = explode('-', $row_qty); |
|
694 | + $row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1; |
|
695 | + $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0; |
|
696 | + $row_qty = array($row => $qty); |
|
697 | 697 | // d( $row_qty ); |
698 | - for( $x = 1; $x <= $rows; $x++ ) { |
|
699 | - if ( ! isset( $row_qty[$x] )) { |
|
698 | + for ($x = 1; $x <= $rows; $x++) { |
|
699 | + if ( ! isset($row_qty[$x])) { |
|
700 | 700 | $row_qty[$x] = 0; |
701 | 701 | } |
702 | 702 | } |
703 | 703 | } |
704 | - ksort( $row_qty ); |
|
704 | + ksort($row_qty); |
|
705 | 705 | // d( $row_qty ); |
706 | 706 | // cycle thru values |
707 | - foreach ( $row_qty as $qty ) { |
|
708 | - $qty = absint( $qty ); |
|
707 | + foreach ($row_qty as $qty) { |
|
708 | + $qty = absint($qty); |
|
709 | 709 | // sanitize as integers |
710 | 710 | $valid_data[$what][] = $qty; |
711 | 711 | $valid_data['total_tickets'] += $qty; |
@@ -716,19 +716,19 @@ discard block |
||
716 | 716 | case 'ticket_id': |
717 | 717 | $value_array = array(); |
718 | 718 | // cycle thru values |
719 | - foreach ( $input_value as $key=>$value ) { |
|
719 | + foreach ($input_value as $key=>$value) { |
|
720 | 720 | // allow only numbers, letters, spaces, commas and dashes |
721 | - $value_array[ $key ] = wp_strip_all_tags( $value ); |
|
721 | + $value_array[$key] = wp_strip_all_tags($value); |
|
722 | 722 | // get ticket via the ticket id we put in the form |
723 | - $ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value ); |
|
724 | - $valid_data['ticket_obj'][ $key ] = $ticket_obj; |
|
723 | + $ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value); |
|
724 | + $valid_data['ticket_obj'][$key] = $ticket_obj; |
|
725 | 725 | } |
726 | - $valid_data[ $what ] = $value_array; |
|
726 | + $valid_data[$what] = $value_array; |
|
727 | 727 | break; |
728 | 728 | |
729 | 729 | case 'return_url' : |
730 | 730 | // grab and sanitize return-url |
731 | - $valid_data[$what] = esc_url_raw( $input_value ); |
|
731 | + $valid_data[$what] = esc_url_raw($input_value); |
|
732 | 732 | break; |
733 | 733 | |
734 | 734 | } // end switch $what |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | } // end foreach $inputs_to_clean |
737 | 737 | |
738 | 738 | } else { |
739 | - EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
739 | + EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
740 | 740 | return FALSE; |
741 | 741 | } |
742 | 742 | |
@@ -754,28 +754,28 @@ discard block |
||
754 | 754 | * @param int $qty |
755 | 755 | * @return TRUE on success, FALSE on fail |
756 | 756 | */ |
757 | - private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
|
758 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
757 | + private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) { |
|
758 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
759 | 759 | // get the number of spaces left for this datetime ticket |
760 | - $available_spaces = self::_ticket_datetime_availability( $ticket ); |
|
760 | + $available_spaces = self::_ticket_datetime_availability($ticket); |
|
761 | 761 | // compare available spaces against the number of tickets being purchased |
762 | - if ( $available_spaces >= $qty ) { |
|
762 | + if ($available_spaces >= $qty) { |
|
763 | 763 | // allow addons to prevent a ticket from being added to cart |
764 | - if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) { |
|
764 | + if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) { |
|
765 | 765 | return false; |
766 | 766 | } |
767 | 767 | // add event to cart |
768 | - if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) { |
|
769 | - self::_recalculate_ticket_datetime_availability( $ticket, $qty ); |
|
768 | + if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) { |
|
769 | + self::_recalculate_ticket_datetime_availability($ticket, $qty); |
|
770 | 770 | return true; |
771 | 771 | } else { |
772 | 772 | return false; |
773 | 773 | } |
774 | 774 | } else { |
775 | 775 | // tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets |
776 | - $available_spaces = self::_ticket_datetime_availability( $ticket, true ); |
|
776 | + $available_spaces = self::_ticket_datetime_availability($ticket, true); |
|
777 | 777 | // greedy greedy greedy eh? |
778 | - if ( $available_spaces > 0 ) { |
|
778 | + if ($available_spaces > 0) { |
|
779 | 779 | // add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces |
780 | 780 | EE_Error::add_error( |
781 | 781 | sprintf( |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | __FILE__, __FUNCTION__, __LINE__ |
792 | 792 | ); |
793 | 793 | } else { |
794 | - EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
794 | + EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
795 | 795 | } |
796 | 796 | return false; |
797 | 797 | } |
@@ -809,22 +809,22 @@ discard block |
||
809 | 809 | * @param bool $get_original_ticket_spaces |
810 | 810 | * @return int |
811 | 811 | */ |
812 | - private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) { |
|
812 | + private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) { |
|
813 | 813 | // if the $_available_spaces array has not been set up yet... |
814 | - if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
815 | - self::_set_initial_ticket_datetime_availability( $ticket ); |
|
814 | + if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
815 | + self::_set_initial_ticket_datetime_availability($ticket); |
|
816 | 816 | } |
817 | 817 | $available_spaces = $ticket->qty() - $ticket->sold(); |
818 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
818 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
819 | 819 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
820 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
820 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
821 | 821 | // if we want the original datetime availability BEFORE we started subtracting tickets ? |
822 | - if ( $get_original_ticket_spaces ) { |
|
822 | + if ($get_original_ticket_spaces) { |
|
823 | 823 | // then grab the available spaces from the "tickets" array and compare with the above to get the lowest number |
824 | - $available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] ); |
|
824 | + $available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]); |
|
825 | 825 | } else { |
826 | 826 | // we want the updated ticket availability as stored in the "datetimes" array |
827 | - $available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] ); |
|
827 | + $available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]); |
|
828 | 828 | } |
829 | 829 | } |
830 | 830 | } |
@@ -840,23 +840,23 @@ discard block |
||
840 | 840 | * @param EE_Ticket $ticket |
841 | 841 | * @return int |
842 | 842 | */ |
843 | - private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) { |
|
843 | + private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) { |
|
844 | 844 | // first, get all of the datetimes that are available to this ticket |
845 | 845 | $datetimes = $ticket->get_many_related( |
846 | 846 | 'Datetime', |
847 | - array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' )) |
|
847 | + array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC')) |
|
848 | 848 | ); |
849 | - if ( ! empty( $datetimes )) { |
|
849 | + if ( ! empty($datetimes)) { |
|
850 | 850 | // now loop thru all of the datetimes |
851 | - foreach ( $datetimes as $datetime ) { |
|
852 | - if ( $datetime instanceof EE_Datetime ) { |
|
851 | + foreach ($datetimes as $datetime) { |
|
852 | + if ($datetime instanceof EE_Datetime) { |
|
853 | 853 | // the number of spaces available for the datetime without considering individual ticket quantities |
854 | 854 | $spaces_remaining = $datetime->spaces_remaining(); |
855 | 855 | // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key |
856 | - self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining ); |
|
856 | + self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining); |
|
857 | 857 | // if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number, |
858 | 858 | // else just take the datetime spaces remaining, and assign to the datetimes array |
859 | - self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining; |
|
859 | + self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining; |
|
860 | 860 | } |
861 | 861 | } |
862 | 862 | } |
@@ -872,12 +872,12 @@ discard block |
||
872 | 872 | * @param int $qty |
873 | 873 | * @return int |
874 | 874 | */ |
875 | - private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) { |
|
876 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
875 | + private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) { |
|
876 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
877 | 877 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
878 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
878 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
879 | 879 | // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
880 | - self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty; |
|
880 | + self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty; |
|
881 | 881 | } |
882 | 882 | } |
883 | 883 | } |
@@ -894,8 +894,8 @@ discard block |
||
894 | 894 | */ |
895 | 895 | public static function load_tckt_slctr_assets() { |
896 | 896 | // add some style |
897 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
898 | - wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'); |
|
897 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
898 | + wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'); |
|
899 | 899 | wp_enqueue_style('ticket_selector'); |
900 | 900 | // make it dance |
901 | 901 | // wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE); |
@@ -909,9 +909,9 @@ discard block |
||
909 | 909 | |
910 | 910 | public static function load_tckt_slctr_assets_admin() { |
911 | 911 | //iframe button js on admin event editor page |
912 | - if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) { |
|
913 | - wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true ); |
|
914 | - wp_enqueue_script( 'ticket_selector_embed' ); |
|
912 | + if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') { |
|
913 | + wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
914 | + wp_enqueue_script('ticket_selector_embed'); |
|
915 | 915 | } |
916 | 916 | } |
917 | 917 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param WP $WP |
20 | 20 | * @return void |
21 | 21 | */ |
22 | - public function run( WP $WP ) {} |
|
22 | + public function run(WP $WP) {} |
|
23 | 23 | |
24 | 24 | |
25 | 25 | /** |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | * @param array $attributes |
70 | 70 | * @return string |
71 | 71 | */ |
72 | - public function process_shortcode( $attributes = array() ) { |
|
72 | + public function process_shortcode($attributes = array()) { |
|
73 | 73 | |
74 | 74 | //load helpers |
75 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
76 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
75 | + EE_Registry::instance()->load_helper('Event_View'); |
|
76 | + EE_Registry::instance()->load_helper('Template'); |
|
77 | 77 | |
78 | 78 | // merge in any attributes passed via fallback shortcode processor |
79 | - $attributes = array_merge( (array) $attributes, (array) $this->_attributes ); |
|
79 | + $attributes = array_merge((array) $attributes, (array) $this->_attributes); |
|
80 | 80 | |
81 | 81 | //set default attributes |
82 | 82 | $default_shortcode_attributes = array( |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | ); |
89 | 89 | |
90 | 90 | // allow the defaults to be filtered |
91 | - $default_shortcode_attributes = apply_filters( 'EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts', $default_shortcode_attributes ); |
|
91 | + $default_shortcode_attributes = apply_filters('EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts', $default_shortcode_attributes); |
|
92 | 92 | // grab attributes and merge with defaults, then extract |
93 | - $attributes = array_merge( $default_shortcode_attributes, $attributes ); |
|
93 | + $attributes = array_merge($default_shortcode_attributes, $attributes); |
|
94 | 94 | |
95 | 95 | $template_args = array( |
96 | 96 | 'contacts' => array(), |
@@ -106,31 +106,31 @@ discard block |
||
106 | 106 | $error = false; |
107 | 107 | |
108 | 108 | //what event? |
109 | - if ( empty( $attributes['event_id'] ) && empty( $attributes['datetime_id'] ) && empty( $attributes['ticket_id'] ) ) { |
|
109 | + if (empty($attributes['event_id']) && empty($attributes['datetime_id']) && empty($attributes['ticket_id'])) { |
|
110 | 110 | //seems like is_espresso_event_single() isn't working as expected. So using alternate method. |
111 | - if ( is_single() && is_espresso_event() ) { |
|
111 | + if (is_single() && is_espresso_event()) { |
|
112 | 112 | $event = EEH_Event_View::get_event(); |
113 | - if ( $event instanceof EE_Event ) { |
|
113 | + if ($event instanceof EE_Event) { |
|
114 | 114 | $template_args['event'] = $event; |
115 | 115 | $query[0]['Registration.EVT_ID'] = $event->ID(); |
116 | 116 | } |
117 | 117 | } else { |
118 | 118 | //try getting the earliest active event if none then get the |
119 | - $events = EEM_Event::instance()->get_active_events( array( 'limit' => 1, |
|
120 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
121 | - ) ); |
|
122 | - $events = empty( $events ) ? EEM_Event::instance()->get_upcoming_events( array( 'limit' => 1, |
|
123 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
124 | - ) ) : $events; |
|
125 | - $event = reset( $events ); |
|
126 | - if ( $event instanceof EE_Event ) { |
|
119 | + $events = EEM_Event::instance()->get_active_events(array('limit' => 1, |
|
120 | + 'order_by' => array('Datetime.DTT_EVT_start' => 'ASC') |
|
121 | + )); |
|
122 | + $events = empty($events) ? EEM_Event::instance()->get_upcoming_events(array('limit' => 1, |
|
123 | + 'order_by' => array('Datetime.DTT_EVT_start' => 'ASC') |
|
124 | + )) : $events; |
|
125 | + $event = reset($events); |
|
126 | + if ($event instanceof EE_Event) { |
|
127 | 127 | $query[0]['Registration.EVT_ID'] = $event->ID(); |
128 | 128 | $template_args['event'] = $event; |
129 | 129 | } |
130 | 130 | } |
131 | - } elseif ( ! empty( $attributes['event_id'] ) ) { |
|
132 | - $event = EEM_Event::instance()->get_one_by_ID( $attributes['event_id'] ); |
|
133 | - if ( $event instanceof EE_Event ) { |
|
131 | + } elseif ( ! empty($attributes['event_id'])) { |
|
132 | + $event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']); |
|
133 | + if ($event instanceof EE_Event) { |
|
134 | 134 | $query[0]['Registration.EVT_ID'] = $attributes['event_id']; |
135 | 135 | $template_args['event'] = $event; |
136 | 136 | } else { |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | //datetime? |
142 | - if ( ! empty( $attributes['datetime_id'] ) && empty( $attributes['event_id'] ) ) { |
|
143 | - $datetime = EEM_Datetime::instance()->get_one_by_ID( $attributes['datetime_id'] ); |
|
144 | - if ( $datetime instanceof EE_Datetime ) { |
|
142 | + if ( ! empty($attributes['datetime_id']) && empty($attributes['event_id'])) { |
|
143 | + $datetime = EEM_Datetime::instance()->get_one_by_ID($attributes['datetime_id']); |
|
144 | + if ($datetime instanceof EE_Datetime) { |
|
145 | 145 | $query[0]['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetime_id']; |
146 | 146 | $query['default_where_conditions'] = 'this_model_only'; |
147 | 147 | $template_args['datetime'] = $datetime; |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | //ticket?just |
155 | - if ( ! empty( $attributes['ticket_id'] ) && empty( $attributes['event_id'] ) && empty( $attributes['datetime_id'] ) ) { |
|
156 | - $ticket = EEM_Ticket::instance()->get_one_by_ID( $attributes['ticket_id'] ); |
|
157 | - if ( $ticket instanceof EE_Ticket ) { |
|
155 | + if ( ! empty($attributes['ticket_id']) && empty($attributes['event_id']) && empty($attributes['datetime_id'])) { |
|
156 | + $ticket = EEM_Ticket::instance()->get_one_by_ID($attributes['ticket_id']); |
|
157 | + if ($ticket instanceof EE_Ticket) { |
|
158 | 158 | $query[0]['Registration.TKT_ID'] = $attributes['ticket_id']; |
159 | 159 | $template_args['ticket'] = $ticket; |
160 | 160 | $template_args['event'] = $ticket->first_datetime() instanceof EE_Datetime ? $ticket->first_datetime()->event() : null; |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | |
166 | 166 | //status |
167 | 167 | $reg_status_array = EEM_Registration::reg_status_array(); |
168 | - if ( $attributes['status'] != 'all' && isset( $reg_status_array[$attributes['status']] ) ) { |
|
168 | + if ($attributes['status'] != 'all' && isset($reg_status_array[$attributes['status']])) { |
|
169 | 169 | $query[0]['Registration.STS_ID'] = $attributes['status']; |
170 | 170 | } |
171 | - $query['group_by'] = array( 'ATT_ID' ); |
|
172 | - $query['order_by'] = apply_filters( 'FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array( 'ATT_lname' => 'ASC', 'ATT_fname' => 'ASC' ) ); |
|
171 | + $query['group_by'] = array('ATT_ID'); |
|
172 | + $query['order_by'] = apply_filters('FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array('ATT_lname' => 'ASC', 'ATT_fname' => 'ASC')); |
|
173 | 173 | |
174 | 174 | //if we have NO query where conditions, then there was an invalid parameter or the shortcode was used incorrectly |
175 | 175 | //so when WP_DEBUG is set and true, we'll show a message, otherwise we'll just return an empty string. |
176 | - if ( ( ! isset( $query[0] ) || ! is_array( $query[0] ) ) || $error ) { |
|
177 | - if ( WP_DEBUG ) { |
|
178 | - return '<div class="important-notice ee-attention">' . __( 'The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly. Please double check the arguments you used for any typos. In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso' ) . '</div>'; |
|
176 | + if (( ! isset($query[0]) || ! is_array($query[0])) || $error) { |
|
177 | + if (WP_DEBUG) { |
|
178 | + return '<div class="important-notice ee-attention">'.__('The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly. Please double check the arguments you used for any typos. In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso').'</div>'; |
|
179 | 179 | } else { |
180 | 180 | return ''; |
181 | 181 | } |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | |
184 | 184 | |
185 | 185 | //get contacts! |
186 | - $template_args['contacts'] = EEM_Attendee::instance()->get_all( $query ); |
|
186 | + $template_args['contacts'] = EEM_Attendee::instance()->get_all($query); |
|
187 | 187 | |
188 | 188 | |
189 | 189 | //all set let's load up the template and return. |
190 | - return EEH_Template::locate_template( 'loop-espresso_event_attendees.php', $template_args, true, true ); |
|
190 | + return EEH_Template::locate_template('loop-espresso_event_attendees.php', $template_args, true, true); |
|
191 | 191 | |
192 | 192 | } |
193 | 193 |
@@ -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 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -46,22 +46,22 @@ discard block |
||
46 | 46 | * @return string the assembled html string containing the tabbed content for display. |
47 | 47 | * @throws \EE_Error |
48 | 48 | */ |
49 | - public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE ) { |
|
49 | + public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE) { |
|
50 | 50 | |
51 | 51 | //first check if $tabs_names is not empty then the count must match the count of $tabs_content otherwise we've got a problem houston |
52 | - if ( !empty( $tabs_names) && ( count( (array) $tabs_names) != count( (array) $tabs_content) ) ) { |
|
53 | - throw new EE_Error( __('The count for $tabs_names and $tabs_content does not match.', 'event_espresso') ); |
|
52 | + if ( ! empty($tabs_names) && (count((array) $tabs_names) != count((array) $tabs_content))) { |
|
53 | + throw new EE_Error(__('The count for $tabs_names and $tabs_content does not match.', 'event_espresso')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | //make sure we've got incoming data setup properly |
57 | - $tabs = !empty( $tabs_names ) ? (array) $tabs_names : array_keys( (array) $tabs_contents ); |
|
58 | - $tabs_content = !empty( $tabs_names ) ? array_combine( (array) $tabs_names, (array) $tabs_content ) : $tabs_contents; |
|
57 | + $tabs = ! empty($tabs_names) ? (array) $tabs_names : array_keys((array) $tabs_contents); |
|
58 | + $tabs_content = ! empty($tabs_names) ? array_combine((array) $tabs_names, (array) $tabs_content) : $tabs_contents; |
|
59 | 59 | |
60 | - $all_tabs = '<h2 class="nav-tab-wrapper">' . "\n"; |
|
60 | + $all_tabs = '<h2 class="nav-tab-wrapper">'."\n"; |
|
61 | 61 | $all_tabs_content = ''; |
62 | 62 | |
63 | 63 | $index = 0; |
64 | - foreach ( $tabs as $tab ) { |
|
64 | + foreach ($tabs as $tab) { |
|
65 | 65 | $active = $index === 0 ? true : false; |
66 | 66 | $all_tabs .= self::tab($tab, $active); |
67 | 67 | $all_tabs_content .= self::tab_content($tab, $tabs_content[$tab], $active); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $tab_container_class = $small_tabs ? 'ee-nav-tabs ee-nav-tabs-small' : 'ee-nav-tabs'; |
80 | 80 | |
81 | - return '<div class="'. $tab_container_class . '">' . "\n\t" . $all_tabs . $all_tabs_content . "\n" . '</div>'; |
|
81 | + return '<div class="'.$tab_container_class.'">'."\n\t".$all_tabs.$all_tabs_content."\n".'</div>'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | * @throws \EE_Error |
103 | 103 | */ |
104 | 104 | public static function display_admin_nav_tabs($nav_tabs = array()) { |
105 | - if ( empty($nav_tabs) ) |
|
106 | - throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) ); |
|
105 | + if (empty($nav_tabs)) |
|
106 | + throw new EE_Error(__('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso')); |
|
107 | 107 | |
108 | - $all_tabs = '<h2 class="nav-tab-wrapper">' . "\n"; |
|
109 | - foreach ( $nav_tabs as $slug => $tab ) { |
|
108 | + $all_tabs = '<h2 class="nav-tab-wrapper">'."\n"; |
|
109 | + foreach ($nav_tabs as $slug => $tab) { |
|
110 | 110 | $all_tabs .= self::tab($slug, false, $tab['link_text'], $tab['url'], $tab['css_class']); |
111 | 111 | } |
112 | 112 | $all_tabs .= '</h2>'; |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | * @param bool|string $css If string given then the generated tab will include that as the class. |
123 | 123 | * @return string html for tab |
124 | 124 | */ |
125 | - private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE ) { |
|
125 | + private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE) { |
|
126 | 126 | $name = str_replace(' ', '-', $name); |
127 | 127 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
128 | - $class = $css ? $class . ' ' . $css : $class; |
|
129 | - $nice_name = $nice_name ? $nice_name : ucwords( preg_replace('/(-|_)/', ' ', $name) ); |
|
130 | - $url = $url ? $url : '#' . $name; |
|
131 | - $tab = '<a class="' . $class . '" rel="ee-tab-' . $name . '" href="' . $url . '">' . $nice_name . '</a>' . "\n\t"; |
|
128 | + $class = $css ? $class.' '.$css : $class; |
|
129 | + $nice_name = $nice_name ? $nice_name : ucwords(preg_replace('/(-|_)/', ' ', $name)); |
|
130 | + $url = $url ? $url : '#'.$name; |
|
131 | + $tab = '<a class="'.$class.'" rel="ee-tab-'.$name.'" href="'.$url.'">'.$nice_name.'</a>'."\n\t"; |
|
132 | 132 | return $tab; |
133 | 133 | } |
134 | 134 | |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | */ |
145 | 145 | private static function tab_content($name, $tab_content, $active = false) { |
146 | 146 | $class = $active ? 'nav-tab-content' : 'nav-tab-content hidden'; |
147 | - $name = str_replace( ' ', '-', $name); |
|
148 | - $content = "\t" . '<div class="'. $class . '" id="ee-tab-' . $name . '">' . "\n"; |
|
149 | - $content .= "\t" . $tab_content . "\n"; |
|
147 | + $name = str_replace(' ', '-', $name); |
|
148 | + $content = "\t".'<div class="'.$class.'" id="ee-tab-'.$name.'">'."\n"; |
|
149 | + $content .= "\t".$tab_content."\n"; |
|
150 | 150 | $content .= '<div style="clear:both"></div></div>'; |
151 | 151 | return $content; |
152 | 152 | } |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | * @param string $default You can include a string for the item that will receive the "item_display" class for the js. |
173 | 173 | * @return string a html snippet of of all the formatted link elements. |
174 | 174 | */ |
175 | - public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) { |
|
176 | - $item_array = apply_filters( 'FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class ); |
|
177 | - if ( !is_array($item_array) || empty( $item_array ) ) |
|
175 | + public static function tab_text_links($item_array, $container_class = '', $sep = '|', $default = '') { |
|
176 | + $item_array = apply_filters('FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class); |
|
177 | + if ( ! is_array($item_array) || empty($item_array)) |
|
178 | 178 | return false; //get out we don't have even the basic thing we need! |
179 | 179 | |
180 | 180 | |
@@ -185,15 +185,15 @@ discard block |
||
185 | 185 | 'title' => esc_attr__('Link for Item', 'event_espresso'), |
186 | 186 | 'slug' => 'item_slug' |
187 | 187 | ); |
188 | - $container_class = !empty($container_class) ? 'ee-text-links ' . $container_class : 'ee-text-links'; |
|
189 | - $list = '<ul class="' . $container_class . '">'; |
|
188 | + $container_class = ! empty($container_class) ? 'ee-text-links '.$container_class : 'ee-text-links'; |
|
189 | + $list = '<ul class="'.$container_class.'">'; |
|
190 | 190 | |
191 | 191 | $ci = 1; |
192 | - foreach ( $item_array as $item ) { |
|
193 | - $item = wp_parse_args( $item, $defaults ); |
|
194 | - $item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class']; |
|
192 | + foreach ($item_array as $item) { |
|
193 | + $item = wp_parse_args($item, $defaults); |
|
194 | + $item['class'] = ! empty($default) && $default == $item['slug'] ? 'item_display '.$item['class'] : $item['class']; |
|
195 | 195 | $list .= self::_text_link_item($item); |
196 | - if ( !empty($sep) && $ci != count($item_array) ) |
|
196 | + if ( ! empty($sep) && $ci != count($item_array)) |
|
197 | 197 | $list .= self::_text_link_item($sep); |
198 | 198 | $ci++; |
199 | 199 | } |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | |
205 | 205 | |
206 | 206 | |
207 | - private static function _text_link_item( $item ) { |
|
207 | + private static function _text_link_item($item) { |
|
208 | 208 | //if this isn't an array then we're doing a separator |
209 | - if ( !is_array( $item ) ) { |
|
209 | + if ( ! is_array($item)) { |
|
210 | 210 | $label = $item; |
211 | 211 | $class = 'ee-text-link-sep'; |
212 | 212 | $href = ''; |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | extract($item); |
216 | 216 | } |
217 | 217 | |
218 | - $class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li ' . $class . '"' : 'class="ee-text-link-sep"'; |
|
218 | + $class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li '.$class.'"' : 'class="ee-text-link-sep"'; |
|
219 | 219 | |
220 | - $content = '<li ' . $class . '>'; |
|
221 | - $content .= !empty($href) ? '<a class="ee-text-link" href="#' . $href . '" title="' . $title . '">' : ''; |
|
220 | + $content = '<li '.$class.'>'; |
|
221 | + $content .= ! empty($href) ? '<a class="ee-text-link" href="#'.$href.'" title="'.$title.'">' : ''; |
|
222 | 222 | $content .= $label; |
223 | - $content .= !empty($href) ? '</a>' : ''; |
|
223 | + $content .= ! empty($href) ? '</a>' : ''; |
|
224 | 224 | $content .= '</li>'; |
225 | 225 | return $content; |
226 | 226 | } |
@@ -715,7 +715,7 @@ |
||
715 | 715 | } |
716 | 716 | } |
717 | 717 | } |
718 | - } |
|
718 | + } |
|
719 | 719 | /** |
720 | 720 | * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
721 | 721 | * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | //(all other times it gets resurrected from a wordpress option) |
14 | 14 | $stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*'); |
15 | 15 | $class_to_filepath = array(); |
16 | -foreach($stages as $filepath){ |
|
16 | +foreach ($stages as $filepath) { |
|
17 | 17 | $matches = array(); |
18 | - preg_match('~4_8_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
18 | + preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
19 | 19 | $class_to_filepath[$matches[1]] = $filepath; |
20 | 20 | } |
21 | 21 | //give addons a chance to autoload their stages too |
22 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages',$class_to_filepath); |
|
22 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
|
23 | 23 | EEH_Autoloader::register_autoloader($class_to_filepath); |
24 | 24 | |
25 | 25 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @since 4.6.0 |
36 | 36 | * |
37 | 37 | */ |
38 | -class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base{ |
|
38 | +class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base { |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * return EE_DMS_Core_4_8_0 |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function can_migrate_from_version($version_array) { |
64 | 64 | $version_string = $version_array['Core']; |
65 | - if( $version_string <= '4.8.0' && $version_string >= '4.7.0' ){ |
|
65 | + if ($version_string <= '4.8.0' && $version_string >= '4.7.0') { |
|
66 | 66 | // echo "$version_string can be migrated from"; |
67 | 67 | return true; |
68 | - }elseif( ! $version_string ){ |
|
68 | + }elseif ( ! $version_string) { |
|
69 | 69 | // echo "no version string provided: $version_string"; |
70 | 70 | //no version string provided... this must be pre 4.3 |
71 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | - }else{ |
|
71 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | + } else { |
|
73 | 73 | // echo "$version_string doesnt apply"; |
74 | 74 | return false; |
75 | 75 | } |
@@ -90,19 +90,19 @@ discard block |
||
90 | 90 | * @return bool |
91 | 91 | */ |
92 | 92 | public function schema_changes_before_migration() { |
93 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
94 | - $now_in_mysql = current_time( 'mysql', true ); |
|
93 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
94 | + $now_in_mysql = current_time('mysql', true); |
|
95 | 95 | |
96 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
97 | - $table_name='esp_answer'; |
|
98 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
96 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
97 | + $table_name = 'esp_answer'; |
|
98 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
99 | 99 | REG_ID INT UNSIGNED NOT NULL, |
100 | 100 | QST_ID INT UNSIGNED NOT NULL, |
101 | 101 | ANS_value TEXT NOT NULL, |
102 | 102 | PRIMARY KEY (ANS_ID), |
103 | 103 | KEY REG_ID (REG_ID), |
104 | 104 | KEY QST_ID (QST_ID)"; |
105 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
105 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
106 | 106 | |
107 | 107 | $table_name = 'esp_attendee_meta'; |
108 | 108 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | CNT_is_EU TINYINT(1) DEFAULT '0', |
143 | 143 | CNT_active TINYINT(1) DEFAULT '0', |
144 | 144 | PRIMARY KEY (CNT_ISO)"; |
145 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
145 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
146 | 146 | |
147 | 147 | $table_name = 'esp_currency'; |
148 | 148 | $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
153 | 153 | CUR_active TINYINT(1) DEFAULT '0', |
154 | 154 | PRIMARY KEY (CUR_code)"; |
155 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
155 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
156 | 156 | |
157 | 157 | |
158 | 158 | $table_name = 'esp_currency_payment_method'; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | KEY EVT_ID (EVT_ID), |
183 | 183 | KEY DTT_is_primary (DTT_is_primary)"; |
184 | 184 | |
185 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
185 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
186 | 186 | |
187 | 187 | $table_name = 'esp_event_meta'; |
188 | 188 | $sql = " |
@@ -201,41 +201,41 @@ discard block |
||
201 | 201 | EVT_donations TINYINT(1) NULL, |
202 | 202 | PRIMARY KEY (EVTM_ID), |
203 | 203 | KEY EVT_ID (EVT_ID)"; |
204 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
204 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
205 | 205 | |
206 | 206 | |
207 | 207 | |
208 | - $table_name='esp_event_question_group'; |
|
209 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
208 | + $table_name = 'esp_event_question_group'; |
|
209 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
210 | 210 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
211 | 211 | QSG_ID INT UNSIGNED NOT NULL, |
212 | 212 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
213 | 213 | PRIMARY KEY (EQG_ID), |
214 | 214 | KEY EVT_ID (EVT_ID), |
215 | 215 | KEY QSG_ID (QSG_ID)"; |
216 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
216 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
217 | 217 | |
218 | 218 | |
219 | 219 | |
220 | - $table_name='esp_event_venue'; |
|
221 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
220 | + $table_name = 'esp_event_venue'; |
|
221 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
222 | 222 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
223 | 223 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
224 | 224 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
225 | 225 | PRIMARY KEY (EVV_ID)"; |
226 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
226 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
227 | 227 | |
228 | 228 | |
229 | 229 | |
230 | - $table_name='esp_extra_meta'; |
|
231 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
230 | + $table_name = 'esp_extra_meta'; |
|
231 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
232 | 232 | OBJ_ID INT(11) DEFAULT NULL, |
233 | 233 | EXM_type VARCHAR(45) DEFAULT NULL, |
234 | 234 | EXM_key VARCHAR(45) DEFAULT NULL, |
235 | 235 | EXM_value TEXT, |
236 | 236 | PRIMARY KEY (EXM_ID), |
237 | 237 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
238 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
238 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
239 | 239 | |
240 | 240 | $table_name = 'esp_extra_join'; |
241 | 241 | $sql = "EXJ_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
249 | 249 | $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
250 | 250 | |
251 | - $table_name='esp_line_item'; |
|
252 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
251 | + $table_name = 'esp_line_item'; |
|
252 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
253 | 253 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
254 | 254 | TXN_ID INT(11) DEFAULT NULL, |
255 | 255 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | PRIMARY KEY (LIN_ID), |
269 | 269 | KEY LIN_code (LIN_code(191)), |
270 | 270 | KEY TXN_ID (TXN_ID)"; |
271 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
271 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
272 | 272 | |
273 | 273 | $table_name = 'esp_log'; |
274 | 274 | $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
308 | 308 | PRIMARY KEY (GRP_ID), |
309 | 309 | KEY MTP_user_id (MTP_user_id)"; |
310 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
310 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
311 | 311 | |
312 | 312 | $table_name = 'esp_event_message_template'; |
313 | 313 | $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | PRIMARY KEY (EMT_ID), |
317 | 317 | KEY EVT_ID (EVT_ID), |
318 | 318 | KEY GRP_ID (GRP_ID)"; |
319 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
319 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
320 | 320 | |
321 | 321 | |
322 | 322 | $table_name = 'esp_payment'; |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | PRIMARY KEY (TTM_ID)"; |
390 | 390 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
391 | 391 | |
392 | - $table_name='esp_question'; |
|
393 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
392 | + $table_name = 'esp_question'; |
|
393 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
394 | 394 | QST_display_text TEXT NOT NULL, |
395 | 395 | QST_admin_label VARCHAR(255) NOT NULL, |
396 | 396 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -404,22 +404,22 @@ discard block |
||
404 | 404 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
405 | 405 | PRIMARY KEY (QST_ID), |
406 | 406 | KEY QST_order (QST_order)'; |
407 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
407 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
408 | 408 | |
409 | - $table_name='esp_question_group_question'; |
|
410 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
409 | + $table_name = 'esp_question_group_question'; |
|
410 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
411 | 411 | QSG_ID INT UNSIGNED NOT NULL, |
412 | 412 | QST_ID INT UNSIGNED NOT NULL, |
413 | 413 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
414 | 414 | PRIMARY KEY (QGQ_ID), |
415 | 415 | KEY QST_ID (QST_ID), |
416 | 416 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
417 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
417 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
418 | 418 | |
419 | 419 | |
420 | 420 | |
421 | - $table_name='esp_question_option'; |
|
422 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
421 | + $table_name = 'esp_question_option'; |
|
422 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
423 | 423 | QSO_value VARCHAR(255) NOT NULL, |
424 | 424 | QSO_desc TEXT NOT NULL, |
425 | 425 | QST_ID INT UNSIGNED NOT NULL, |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | PRIMARY KEY (QSO_ID), |
430 | 430 | KEY QST_ID (QST_ID), |
431 | 431 | KEY QSO_order (QSO_order)"; |
432 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
432 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
433 | 433 | |
434 | 434 | |
435 | 435 | |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | |
476 | 476 | |
477 | 477 | |
478 | - $table_name='esp_checkin'; |
|
479 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
478 | + $table_name = 'esp_checkin'; |
|
479 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
480 | 480 | REG_ID INT(10) UNSIGNED NOT NULL, |
481 | 481 | DTT_ID INT(10) UNSIGNED NOT NULL, |
482 | 482 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
572 | 572 | PRIMARY KEY (PRC_ID), |
573 | 573 | KEY PRT_ID (PRT_ID)"; |
574 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
574 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
575 | 575 | |
576 | 576 | $table_name = "esp_price_type"; |
577 | 577 | $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
610 | 610 | PRIMARY KEY (TKT_ID), |
611 | 611 | KEY TKT_start_date (TKT_start_date)"; |
612 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
612 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
613 | 613 | |
614 | 614 | $table_name = 'esp_question_group'; |
615 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
615 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
616 | 616 | QSG_name VARCHAR(255) NOT NULL, |
617 | 617 | QSG_identifier VARCHAR(100) NOT NULL, |
618 | 618 | QSG_desc TEXT NULL, |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | PRIMARY KEY (QSG_ID), |
626 | 626 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
627 | 627 | KEY QSG_order (QSG_order)'; |
628 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
628 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
629 | 629 | |
630 | 630 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
631 | 631 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | return $script_4_7_defaults->schema_changes_after_migration(); |
662 | 662 | } |
663 | 663 | |
664 | - public function migration_page_hooks(){ |
|
664 | + public function migration_page_hooks() { |
|
665 | 665 | |
666 | 666 | } |
667 | 667 | |
@@ -675,19 +675,19 @@ discard block |
||
675 | 675 | //CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
676 | 676 | //('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
677 | 677 | $newer_countries = array( |
678 | - array( 'AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0 ), |
|
679 | - array( 'BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
680 | - array( 'CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0 ), |
|
681 | - array( 'GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0 ), |
|
682 | - array( 'IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
683 | - array( 'JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
684 | - array( 'MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
685 | - array( 'MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0 ), |
|
686 | - array( 'RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0 ), |
|
687 | - array( 'SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0 ), |
|
688 | - array( 'SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0 ), |
|
689 | - array( 'XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0 ), |
|
690 | - array( 'YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0 ), |
|
678 | + array('AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
679 | + array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
680 | + array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
681 | + array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
682 | + array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
683 | + array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
684 | + array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
685 | + array('MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
686 | + array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0), |
|
687 | + array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
688 | + array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
689 | + array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0), |
|
690 | + array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
691 | 691 | ); |
692 | 692 | global $wpdb; |
693 | 693 | $country_table = $wpdb->prefix."esp_country"; |
@@ -706,14 +706,14 @@ discard block |
||
706 | 706 | "CNT_is_EU" => '%d', |
707 | 707 | "CNT_active" => '%d', |
708 | 708 | ); |
709 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $country_table . "'") == $country_table ) { |
|
710 | - foreach( $newer_countries as $country ) { |
|
711 | - $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1" ; |
|
709 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$country_table."'") == $country_table) { |
|
710 | + foreach ($newer_countries as $country) { |
|
711 | + $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
712 | 712 | $countries = $wpdb->get_var($SQL); |
713 | - if ( ! $countries ) { |
|
713 | + if ( ! $countries) { |
|
714 | 714 | |
715 | - $wpdb->insert( $country_table, |
|
716 | - array_combine( array_keys( $country_format), $country ), |
|
715 | + $wpdb->insert($country_table, |
|
716 | + array_combine(array_keys($country_format), $country), |
|
717 | 717 | $country_format |
718 | 718 | ); |
719 | 719 | } |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
732 | 732 | //( 'EUR', 'Euro', 'Euros', '€', 2,1), |
733 | 733 | $newer_currencies = array( |
734 | - array( 'RSD', 'Dinar', 'Dinars', '', 3, 1 ), |
|
734 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
735 | 735 | ); |
736 | 736 | global $wpdb; |
737 | 737 | $currency_table = $wpdb->prefix."esp_currency"; |
@@ -743,14 +743,14 @@ discard block |
||
743 | 743 | "CUR_dec_plc" => '%d', |
744 | 744 | "CUR_active" => '%d', |
745 | 745 | ); |
746 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $currency_table . "'") == $currency_table ) { |
|
747 | - foreach( $newer_currencies as $currency ) { |
|
748 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1" ; |
|
746 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$currency_table."'") == $currency_table) { |
|
747 | + foreach ($newer_currencies as $currency) { |
|
748 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
749 | 749 | $countries = $wpdb->get_var($SQL); |
750 | - if ( ! $countries ) { |
|
750 | + if ( ! $countries) { |
|
751 | 751 | |
752 | - $wpdb->insert( $currency_table, |
|
753 | - array_combine( array_keys( $currency_format), $currency ), |
|
752 | + $wpdb->insert($currency_table, |
|
753 | + array_combine(array_keys($currency_format), $currency), |
|
754 | 754 | $currency_format |
755 | 755 | ); |
756 | 756 | } |
@@ -762,9 +762,9 @@ discard block |
||
762 | 762 | * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
763 | 763 | * we should be able to stop doing this in 4.9 |
764 | 764 | */ |
765 | - public function fix_non_default_taxes(){ |
|
765 | + public function fix_non_default_taxes() { |
|
766 | 766 | global $wpdb; |
767 | - $query = $wpdb->prepare( "UPDATE |
|
767 | + $query = $wpdb->prepare("UPDATE |
|
768 | 768 | {$wpdb->prefix}esp_price p INNER JOIN |
769 | 769 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
770 | 770 | SET |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | WHERE |
773 | 773 | p.PRC_is_default = 0 AND |
774 | 774 | pt.PBT_ID = %d |
775 | - ", EEM_Price_Type::base_type_tax ); |
|
776 | - $wpdb->query( $query ); |
|
775 | + ", EEM_Price_Type::base_type_tax); |
|
776 | + $wpdb->query($query); |
|
777 | 777 | } |
778 | 778 | } |
@@ -1,29 +1,29 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Ticketing Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Event Espresso |
|
9 | - * @ copyright (c) 2008-2014 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version $VID:$ |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Ticketing Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Event Espresso |
|
9 | + * @ copyright (c) 2008-2014 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version $VID:$ |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + */ |
|
16 | 16 | /** |
17 | - * Class EE_Register_Payment_Method |
|
18 | - * |
|
19 | - * EEI_Plugin_API class for registering payment methods for use with EE core. |
|
20 | - * Receives an array of module details and takes care of adding all of the necessary hooks and filters to integrate with EE core |
|
21 | - * |
|
22 | - * @package Event Espresso |
|
23 | - * @subpackage plugin api |
|
24 | - * @since 4.5.0 |
|
25 | - * @author Mike Nelson |
|
26 | - */ |
|
17 | + * Class EE_Register_Payment_Method |
|
18 | + * |
|
19 | + * EEI_Plugin_API class for registering payment methods for use with EE core. |
|
20 | + * Receives an array of module details and takes care of adding all of the necessary hooks and filters to integrate with EE core |
|
21 | + * |
|
22 | + * @package Event Espresso |
|
23 | + * @subpackage plugin api |
|
24 | + * @since 4.5.0 |
|
25 | + * @author Mike Nelson |
|
26 | + */ |
|
27 | 27 | class EE_Register_Payment_Method implements EEI_Plugin_API { |
28 | 28 | |
29 | 29 | /** |
@@ -5,42 +5,42 @@ |
||
5 | 5 | <table class="admin-primary-mbox-tbl"> |
6 | 6 | <thead> |
7 | 7 | <tr> |
8 | - <th class="jst-left"><?php esc_html_e( 'Event Name', 'event_espresso' );?></th> |
|
9 | - <th class="jst-left"><?php esc_html_e( 'REG ID', 'event_espresso' );?></th> |
|
10 | - <th class="jst-left"><?php esc_html_e( 'TXN ID', 'event_espresso' );?></th> |
|
11 | - <th class="jst-left"><?php esc_html_e( 'Reg Code', 'event_espresso' );?></th> |
|
12 | - <th class="jst-rght"><?php esc_html_e( 'Ticket Price', 'event_espresso' );?></th> |
|
8 | + <th class="jst-left"><?php esc_html_e('Event Name', 'event_espresso'); ?></th> |
|
9 | + <th class="jst-left"><?php esc_html_e('REG ID', 'event_espresso'); ?></th> |
|
10 | + <th class="jst-left"><?php esc_html_e('TXN ID', 'event_espresso'); ?></th> |
|
11 | + <th class="jst-left"><?php esc_html_e('Reg Code', 'event_espresso'); ?></th> |
|
12 | + <th class="jst-rght"><?php esc_html_e('Ticket Price', 'event_espresso'); ?></th> |
|
13 | 13 | </tr> |
14 | 14 | </thead> |
15 | 15 | <tbody> |
16 | - <?php foreach( $registrations as $registration ) : ?> |
|
16 | + <?php foreach ($registrations as $registration) : ?> |
|
17 | 17 | <tr> |
18 | 18 | <td class="jst-left"> |
19 | 19 | <?php |
20 | - $event_url = add_query_arg( array( 'action' => 'edit', 'post' => $registration->event_ID() ), admin_url( 'admin.php?page=espresso_events' )); |
|
21 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $registration->event_ID() ) ? '<a href="'. $event_url .'" title="'. esc_attr__( 'Edit Event', 'event_espresso' ) .'">' . $registration->event_name() . '</a>' : $registration->event_name(); |
|
20 | + $event_url = add_query_arg(array('action' => 'edit', 'post' => $registration->event_ID()), admin_url('admin.php?page=espresso_events')); |
|
21 | + echo EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $registration->event_ID()) ? '<a href="'.$event_url.'" title="'.esc_attr__('Edit Event', 'event_espresso').'">'.$registration->event_name().'</a>' : $registration->event_name(); |
|
22 | 22 | ?> |
23 | 23 | </td> |
24 | 24 | <td class="jst-left"> |
25 | 25 | <?php |
26 | - $reg_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
|
27 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? ' |
|
28 | - <a href="'.$reg_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . |
|
29 | - esc_html__( 'View Registration', 'event_espresso' ) . |
|
26 | + $reg_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL); |
|
27 | + echo EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? ' |
|
28 | + <a href="'.$reg_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'. |
|
29 | + esc_html__('View Registration', 'event_espresso'). |
|
30 | 30 | '</a>' : $registration->ID(); |
31 | 31 | ?> |
32 | 32 | </td> |
33 | 33 | <td class="jst-left"> |
34 | 34 | <?php |
35 | - $txn_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID() ), TXN_ADMIN_URL ); |
|
36 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? ' |
|
37 | - <a href="'.$txn_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '">' . |
|
38 | - sprintf( esc_html__('View Transaction %d', 'event_espresso'), $registration->transaction_ID() ) . |
|
35 | + $txn_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID()), TXN_ADMIN_URL); |
|
36 | + echo EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? ' |
|
37 | + <a href="'.$txn_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'">'. |
|
38 | + sprintf(esc_html__('View Transaction %d', 'event_espresso'), $registration->transaction_ID()). |
|
39 | 39 | '</a>' : $registration->transaction_ID(); |
40 | 40 | ?> |
41 | 41 | </td> |
42 | - <td class="jst-left"><?php echo $registration->reg_code();?></td> |
|
43 | - <td class="jst-rght"><?php echo EEH_Template::format_currency( $registration->final_price() );?></td> |
|
42 | + <td class="jst-left"><?php echo $registration->reg_code(); ?></td> |
|
43 | + <td class="jst-rght"><?php echo EEH_Template::format_currency($registration->final_price()); ?></td> |
|
44 | 44 | </tr> |
45 | 45 | <?php endforeach; ?> |
46 | 46 | </tbody> |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return string |
141 | 141 | */ |
142 | 142 | function column_TXN_ID( EE_Transaction $item ){ |
143 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
143 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
144 | 144 | $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
145 | 145 | |
146 | 146 | //txn timestamp |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | * @param \EE_Transaction $item |
276 | 276 | * @return string|void |
277 | 277 | */ |
278 | - function column_event_name( EE_Transaction $item ){ |
|
279 | - $actions = array(); |
|
278 | + function column_event_name( EE_Transaction $item ){ |
|
279 | + $actions = array(); |
|
280 | 280 | $event = $item->primary_registration()->get_first_related('Event'); |
281 | 281 | if ( !empty( $event ) ) { |
282 | 282 | $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
@@ -300,21 +300,21 @@ discard block |
||
300 | 300 | * @param \EE_Transaction $item |
301 | 301 | * @return string |
302 | 302 | */ |
303 | - function column_actions( EE_Transaction $item ){ |
|
303 | + function column_actions( EE_Transaction $item ){ |
|
304 | 304 | |
305 | - $registration = $item->primary_registration(); |
|
306 | - $attendee = $registration->attendee(); |
|
305 | + $registration = $item->primary_registration(); |
|
306 | + $attendee = $registration->attendee(); |
|
307 | 307 | EE_Registry::instance()->load_helper( 'MSG_Template' ); |
308 | 308 | |
309 | - //Build row actions |
|
309 | + //Build row actions |
|
310 | 310 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
311 | 311 | $dl_invoice_lnk_url = $registration->invoice_url(); |
312 | 312 | $dl_receipt_lnk_url = $registration->receipt_url(); |
313 | 313 | $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
314 | 314 | $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
315 | - $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
316 | - 'TXN_ID' => $item->ID() |
|
317 | - )); |
|
315 | + $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
316 | + 'TXN_ID' => $item->ID() |
|
317 | + )); |
|
318 | 318 | |
319 | 319 | //Build row actions |
320 | 320 | $view_lnk = ' |
@@ -349,8 +349,8 @@ discard block |
||
349 | 349 | $dl_receipt_lnk = ''; |
350 | 350 | } |
351 | 351 | |
352 | - //only show payment reminder link if the message type is active. |
|
353 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
352 | + //only show payment reminder link if the message type is active. |
|
353 | + if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
354 | 354 | $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? ' |
355 | 355 | <li> |
356 | 356 | <a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text"> |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
379 | - } |
|
379 | + } |
|
380 | 380 | |
381 | 381 | |
382 | 382 | } |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @param \EE_Admin_Page $admin_page |
34 | 34 | * @return EE_Admin_Transactions_List_Table |
35 | 35 | */ |
36 | - function __construct( EE_Admin_Page $admin_page ){ |
|
37 | - parent::__construct( $admin_page ); |
|
36 | + function __construct(EE_Admin_Page $admin_page) { |
|
37 | + parent::__construct($admin_page); |
|
38 | 38 | $this->_status = $this->_admin_page->get_transaction_status_array(); |
39 | 39 | |
40 | 40 | } |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | |
45 | 45 | |
46 | 46 | protected function _setup_data() { |
47 | - $this->_data = $this->_admin_page->get_transactions( $this->_per_page ); |
|
48 | - $status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all'; |
|
49 | - $this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status ); |
|
47 | + $this->_data = $this->_admin_page->get_transactions($this->_per_page); |
|
48 | + $status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all'; |
|
49 | + $this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -65,20 +65,20 @@ discard block |
||
65 | 65 | ); |
66 | 66 | |
67 | 67 | $this->_columns = array( |
68 | - 'TXN_ID' => __( 'ID', 'event_espresso' ), |
|
69 | - 'TXN_timestamp' => __( 'Transaction Date', 'event_espresso' ), |
|
70 | - 'TXN_total' => __( 'Total', 'event_espresso' ), |
|
71 | - 'TXN_paid' => __( 'Paid', 'event_espresso' ), |
|
72 | - 'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ), |
|
73 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
74 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
68 | + 'TXN_ID' => __('ID', 'event_espresso'), |
|
69 | + 'TXN_timestamp' => __('Transaction Date', 'event_espresso'), |
|
70 | + 'TXN_total' => __('Total', 'event_espresso'), |
|
71 | + 'TXN_paid' => __('Paid', 'event_espresso'), |
|
72 | + 'ATT_fname' => __('Primary Registrant', 'event_espresso'), |
|
73 | + 'event_name' => __('Event', 'event_espresso'), |
|
74 | + 'actions' => __('Actions', 'event_espresso') |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | $this->_sortable_columns = array( |
78 | - 'TXN_ID' => array( 'TXN_ID' => FALSE ), |
|
79 | - 'event_name' => array( 'event_name'=> FALSE ), |
|
80 | - 'ATT_fname' => array( 'ATT_fname'=> FALSE ), |
|
81 | - 'TXN_timestamp' => array( 'TXN_timestamp'=> TRUE ) //true means its already sorted |
|
78 | + 'TXN_ID' => array('TXN_ID' => FALSE), |
|
79 | + 'event_name' => array('event_name'=> FALSE), |
|
80 | + 'ATT_fname' => array('ATT_fname'=> FALSE), |
|
81 | + 'TXN_timestamp' => array('TXN_timestamp'=> TRUE) //true means its already sorted |
|
82 | 82 | ); |
83 | 83 | |
84 | 84 | $this->_primary_column = 'TXN_ID'; |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | |
89 | 89 | |
90 | 90 | |
91 | - protected function _get_row_class( $item ) { |
|
92 | - $class = parent::_get_row_class( $item ); |
|
91 | + protected function _get_row_class($item) { |
|
92 | + $class = parent::_get_row_class($item); |
|
93 | 93 | //add status class |
94 | - $class .= ' ee-status-strip txn-status-' . $item->status_ID(); |
|
95 | - if ( $this->_has_checkbox_column ) { |
|
94 | + $class .= ' ee-status-strip txn-status-'.$item->status_ID(); |
|
95 | + if ($this->_has_checkbox_column) { |
|
96 | 96 | $class .= ' has-checkbox-column'; |
97 | 97 | } |
98 | 98 | return $class; |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | */ |
110 | 110 | protected function _get_table_filters() { |
111 | 111 | $filters = array(); |
112 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
113 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
112 | + $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year')); |
|
113 | + $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y'); |
|
114 | 114 | ob_start(); |
115 | 115 | ?> |
116 | 116 | <label for="txn-filter-start-date">Display Transactions from </label> |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | |
129 | 129 | |
130 | 130 | protected function _add_view_counts() { |
131 | - $this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' ); |
|
132 | - $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' ); |
|
133 | - $this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' ); |
|
131 | + $this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all'); |
|
132 | + $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned'); |
|
133 | + $this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed'); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -139,29 +139,29 @@ discard block |
||
139 | 139 | * @param \EE_Transaction $item |
140 | 140 | * @return string |
141 | 141 | */ |
142 | - function column_TXN_ID( EE_Transaction $item ){ |
|
143 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
144 | - $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
|
142 | + function column_TXN_ID(EE_Transaction $item) { |
|
143 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
144 | + $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>'; |
|
145 | 145 | |
146 | 146 | //txn timestamp |
147 | - $content .= ' <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp( $item ) . '</span>'; |
|
147 | + $content .= ' <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>'; |
|
148 | 148 | return $content; |
149 | 149 | } |
150 | 150 | |
151 | 151 | |
152 | 152 | |
153 | - protected function _get_txn_timestamp( EE_Transaction $item ) { |
|
153 | + protected function _get_txn_timestamp(EE_Transaction $item) { |
|
154 | 154 | //txn timestamp |
155 | 155 | // is TXN less than 2 hours old ? |
156 | 156 | if ( |
157 | - ( ( time() - EE_Registry::instance()->SSN->lifespan() ) |
|
158 | - < $item->datetime( false, true ) |
|
157 | + ((time() - EE_Registry::instance()->SSN->lifespan()) |
|
158 | + < $item->datetime(false, true) |
|
159 | 159 | ) |
160 | - && ( $item->failed() || $item->is_abandoned() ) |
|
160 | + && ($item->failed() || $item->is_abandoned()) |
|
161 | 161 | ) { |
162 | - $timestamp = __( 'TXN in progress...', 'event_espresso' ); |
|
162 | + $timestamp = __('TXN in progress...', 'event_espresso'); |
|
163 | 163 | } else { |
164 | - $timestamp = $item->get_i18n_datetime( 'TXN_timestamp' ); |
|
164 | + $timestamp = $item->get_i18n_datetime('TXN_timestamp'); |
|
165 | 165 | } |
166 | 166 | return $timestamp; |
167 | 167 | } |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param \EE_Transaction $item |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - function column_cb($item ){ |
|
177 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
176 | + function column_cb($item) { |
|
177 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | * @param \EE_Transaction $item |
186 | 186 | * @return string |
187 | 187 | */ |
188 | - function column_TXN_timestamp( EE_Transaction $item ){ |
|
189 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
190 | - $txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $this->_get_txn_timestamp( $item ) . '</a>'; |
|
188 | + function column_TXN_timestamp(EE_Transaction $item) { |
|
189 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
190 | + $txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>'; |
|
191 | 191 | //status |
192 | - $txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
192 | + $txn_date .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
193 | 193 | return $txn_date; |
194 | 194 | } |
195 | 195 | |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | * @param \EE_Transaction $item |
200 | 200 | * @return string |
201 | 201 | */ |
202 | - function column_TXN_total( EE_Transaction $item ){ |
|
203 | - if ( $item->get('TXN_total') > 0 ) { |
|
204 | - return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>'; |
|
202 | + function column_TXN_total(EE_Transaction $item) { |
|
203 | + if ($item->get('TXN_total') > 0) { |
|
204 | + return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>'; |
|
205 | 205 | } else { |
206 | - return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
206 | + return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>'; |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -213,19 +213,19 @@ discard block |
||
213 | 213 | * @param \EE_Transaction $item |
214 | 214 | * @return mixed|string |
215 | 215 | */ |
216 | - function column_TXN_paid( EE_Transaction $item ){ |
|
216 | + function column_TXN_paid(EE_Transaction $item) { |
|
217 | 217 | $transaction_total = $item->get('TXN_total'); |
218 | 218 | $transaction_paid = $item->get('TXN_paid'); |
219 | 219 | |
220 | - if (( $transaction_total > 0 ) && ( $transaction_paid >= $transaction_total )) { |
|
220 | + if (($transaction_total > 0) && ($transaction_paid >= $transaction_total)) { |
|
221 | 221 | // paid in full |
222 | 222 | $span_class = 'txn-overview-full-payment-spn'; |
223 | 223 | |
224 | - } elseif (( $transaction_total > 0 ) && ( $transaction_paid > 0 )) { |
|
224 | + } elseif (($transaction_total > 0) && ($transaction_paid > 0)) { |
|
225 | 225 | // monies owing |
226 | 226 | $span_class = 'txn-overview-part-payment-spn'; |
227 | 227 | |
228 | - } elseif (( $transaction_total > 0 ) && ( $transaction_paid == 0 )) { |
|
228 | + } elseif (($transaction_total > 0) && ($transaction_paid == 0)) { |
|
229 | 229 | // no payments made |
230 | 230 | $span_class = 'txn-overview-no-payment-spn'; |
231 | 231 | |
@@ -235,11 +235,11 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | $payment_method = $item->payment_method(); |
238 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
238 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
239 | 239 | |
240 | - $content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>'; |
|
241 | - if ( $transaction_paid > 0 ) { |
|
242 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
240 | + $content = '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>'; |
|
241 | + if ($transaction_paid > 0) { |
|
242 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
243 | 243 | } |
244 | 244 | return $content; |
245 | 245 | } |
@@ -250,13 +250,13 @@ discard block |
||
250 | 250 | * @param \EE_Transaction $item |
251 | 251 | * @return string|void |
252 | 252 | */ |
253 | - function column_ATT_fname( EE_Transaction $item ){ |
|
253 | + function column_ATT_fname(EE_Transaction $item) { |
|
254 | 254 | $primary_reg = $item->primary_registration(); |
255 | 255 | $attendee = $primary_reg->get_first_related('Attendee'); |
256 | - if ( $attendee instanceof EE_Attendee ) { |
|
257 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL ); |
|
258 | - $content = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name(); |
|
259 | - $content .= '<br>' . $attendee->email(); |
|
256 | + if ($attendee instanceof EE_Attendee) { |
|
257 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL); |
|
258 | + $content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name(); |
|
259 | + $content .= '<br>'.$attendee->email(); |
|
260 | 260 | return $content; |
261 | 261 | } |
262 | 262 | return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | * @param \EE_Transaction $item |
269 | 269 | * @return string|void |
270 | 270 | */ |
271 | - function column_ATT_email( EE_Transaction $item ){ |
|
271 | + function column_ATT_email(EE_Transaction $item) { |
|
272 | 272 | $attendee = $item->primary_registration()->get_first_related('Attendee'); |
273 | - if ( !empty( $attendee ) ) |
|
274 | - return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>'; |
|
273 | + if ( ! empty($attendee)) |
|
274 | + return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>'; |
|
275 | 275 | else |
276 | 276 | return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
277 | 277 | ; |
@@ -283,20 +283,20 @@ discard block |
||
283 | 283 | * @param \EE_Transaction $item |
284 | 284 | * @return string|void |
285 | 285 | */ |
286 | - function column_event_name( EE_Transaction $item ){ |
|
286 | + function column_event_name(EE_Transaction $item) { |
|
287 | 287 | $actions = array(); |
288 | 288 | $event = $item->primary_registration()->get_first_related('Event'); |
289 | - if ( !empty( $event ) ) { |
|
290 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
|
289 | + if ( ! empty($event)) { |
|
290 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL); |
|
291 | 291 | $event_name = $event->get('EVT_name'); |
292 | 292 | |
293 | 293 | //filter this view by transactions for this event |
294 | - $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) ); |
|
295 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) { |
|
296 | - $actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>'; |
|
294 | + $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID())); |
|
295 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) { |
|
296 | + $actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>'; |
|
297 | 297 | } |
298 | 298 | |
299 | - return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) ); |
|
299 | + return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions)); |
|
300 | 300 | } else { |
301 | 301 | return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso'); |
302 | 302 | } |
@@ -308,36 +308,36 @@ discard block |
||
308 | 308 | * @param \EE_Transaction $item |
309 | 309 | * @return string |
310 | 310 | */ |
311 | - function column_actions( EE_Transaction $item ){ |
|
311 | + function column_actions(EE_Transaction $item) { |
|
312 | 312 | |
313 | 313 | $registration = $item->primary_registration(); |
314 | 314 | $attendee = $registration->attendee(); |
315 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
315 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
316 | 316 | |
317 | 317 | //Build row actions |
318 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
318 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
319 | 319 | $dl_invoice_lnk_url = $registration->invoice_url(); |
320 | 320 | $dl_receipt_lnk_url = $registration->receipt_url(); |
321 | - $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
|
322 | - $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
323 | - $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
321 | + $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL); |
|
322 | + $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
323 | + $related_messages_link = EEH_MSG_Template::get_message_action_link('see_notifications_for', null, array( |
|
324 | 324 | 'TXN_ID' => $item->ID() |
325 | 325 | )); |
326 | 326 | |
327 | 327 | //Build row actions |
328 | 328 | $view_lnk = ' |
329 | 329 | <li> |
330 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text"> |
|
330 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text"> |
|
331 | 331 | <span class="dashicons dashicons-cart"></span> |
332 | 332 | </a> |
333 | 333 | </li>'; |
334 | 334 | |
335 | 335 | |
336 | 336 | //only show invoice link if message type is active. |
337 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
337 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) { |
|
338 | 338 | $dl_invoice_lnk = ' |
339 | 339 | <li> |
340 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
340 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
341 | 341 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
342 | 342 | </a> |
343 | 343 | </li>'; |
@@ -346,10 +346,10 @@ discard block |
||
346 | 346 | } |
347 | 347 | |
348 | 348 | //only show receipt link if message type is active. |
349 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) { |
|
349 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) { |
|
350 | 350 | $dl_receipt_lnk = ' |
351 | 351 | <li> |
352 | - <a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
352 | + <a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
353 | 353 | <span class="dashicons dashicons-media-default ee-icon-size-18"></span> |
354 | 354 | </a> |
355 | 355 | </li>'; |
@@ -358,10 +358,10 @@ discard block |
||
358 | 358 | } |
359 | 359 | |
360 | 360 | //only show payment reminder link if the message type is active. |
361 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
362 | - $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? ' |
|
361 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
362 | + $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder') ? ' |
|
363 | 363 | <li> |
364 | - <a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text"> |
|
364 | + <a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text"> |
|
365 | 365 | <span class="dashicons dashicons-email-alt"></span> |
366 | 366 | </a> |
367 | 367 | </li>' : ''; |
@@ -370,20 +370,20 @@ discard block |
||
370 | 370 | $send_pay_lnk = ''; |
371 | 371 | } |
372 | 372 | |
373 | - $view_reg_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? ' |
|
373 | + $view_reg_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? ' |
|
374 | 374 | <li> |
375 | - <a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
375 | + <a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
376 | 376 | <span class="dashicons dashicons-clipboard"></span> |
377 | 377 | </a> |
378 | 378 | </li>' : ''; |
379 | 379 | |
380 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) { |
|
381 | - $view_related_messages_lnk = '<li>' . $related_messages_link . '</li>'; |
|
380 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_messages', 'view_filtered_messages')) { |
|
381 | + $view_related_messages_lnk = '<li>'.$related_messages_link.'</li>'; |
|
382 | 382 | } else { |
383 | 383 | $view_related_messages_lnk = ''; |
384 | 384 | } |
385 | 385 | |
386 | - return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
|
386 | + return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk.$view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul'); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 |
@@ -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 | * |
@@ -220,8 +222,9 @@ discard block |
||
220 | 222 | */ |
221 | 223 | public function remove_pages_from_nav_menu( $post_type ) { |
222 | 224 | //if this isn't the "pages" post type let's get out |
223 | - if ( $post_type->name !== 'page' ) |
|
224 | - return $post_type; |
|
225 | + if ( $post_type->name !== 'page' ) { |
|
226 | + return $post_type; |
|
227 | + } |
|
225 | 228 | |
226 | 229 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
227 | 230 | |
@@ -296,8 +299,9 @@ discard block |
||
296 | 299 | * @return string the (maybe) modified link |
297 | 300 | */ |
298 | 301 | public function modify_edit_post_link( $link, $id, $context ) { |
299 | - if ( ! $post = get_post( $id ) ) |
|
300 | - return $link; |
|
302 | + if ( ! $post = get_post( $id ) ) { |
|
303 | + return $link; |
|
304 | + } |
|
301 | 305 | |
302 | 306 | if ( $post->post_type == 'espresso_attendees' ) { |
303 | 307 | $query_args = array( |
@@ -337,7 +341,10 @@ discard block |
||
337 | 341 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
338 | 342 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
339 | 343 | <li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>> |
340 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
344 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) { |
|
345 | + echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); |
|
346 | +} |
|
347 | +?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
341 | 348 | <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
342 | 349 | </a> |
343 | 350 | </li> |
@@ -870,8 +877,9 @@ discard block |
||
870 | 877 | */ |
871 | 878 | public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
872 | 879 | EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
873 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) |
|
874 | - $config['page_path'] = $page_path; |
|
880 | + if ( class_exists( 'EE_Register_Admin_Page' ) ) { |
|
881 | + $config['page_path'] = $page_path; |
|
882 | + } |
|
875 | 883 | EE_Register_Admin_Page::register( $page_basename, $config ); |
876 | 884 | } |
877 | 885 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public static function instance() { |
49 | 49 | // check if class object is instantiated |
50 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
50 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
51 | 51 | self::$_instance = new self(); |
52 | 52 | } |
53 | 53 | return self::$_instance; |
@@ -62,25 +62,25 @@ discard block |
||
62 | 62 | // define global EE_Admin constants |
63 | 63 | $this->_define_all_constants(); |
64 | 64 | // set autoloaders for our admin page classes based on included path information |
65 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
65 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
66 | 66 | // admin hooks |
67 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
67 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
68 | 68 | // load EE_Request_Handler early |
69 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
70 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
71 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 ); |
|
72 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 ); |
|
73 | - add_action( 'admin_init', array( $this, 'admin_init' ), 100 ); |
|
74 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 ); |
|
75 | - add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
76 | - add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
77 | - add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 ); |
|
78 | - add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' )); |
|
69 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
70 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
71 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2); |
|
72 | + add_action('wp_loaded', array($this, 'wp_loaded'), 100); |
|
73 | + add_action('admin_init', array($this, 'admin_init'), 100); |
|
74 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20); |
|
75 | + add_action('admin_notices', array($this, 'display_admin_notices'), 10); |
|
76 | + add_action('network_admin_notices', array($this, 'display_admin_notices'), 10); |
|
77 | + add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2); |
|
78 | + add_filter('admin_footer_text', array($this, 'espresso_admin_footer')); |
|
79 | 79 | |
80 | 80 | //reset Environment config (we only do this on admin page loads); |
81 | 81 | EE_Registry::instance()->CFG->environment->recheck_values(); |
82 | 82 | |
83 | - do_action( 'AHEE__EE_Admin__loaded' ); |
|
83 | + do_action('AHEE__EE_Admin__loaded'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | private function _define_all_constants() { |
98 | - define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' ); |
|
99 | - define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' ); |
|
100 | - define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS ); |
|
101 | - define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' ); |
|
102 | - define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' )); |
|
103 | - define( 'JQPLOT_URL', EE_GLOBAL_ASSETS_URL . 'scripts/jqplot/' ); |
|
98 | + define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/'); |
|
99 | + define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/'); |
|
100 | + define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS); |
|
101 | + define('WP_ADMIN_PATH', ABSPATH.'wp-admin/'); |
|
102 | + define('WP_AJAX_URL', admin_url('admin-ajax.php')); |
|
103 | + define('JQPLOT_URL', EE_GLOBAL_ASSETS_URL.'scripts/jqplot/'); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -113,23 +113,23 @@ discard block |
||
113 | 113 | * @param string $plugin |
114 | 114 | * @return array |
115 | 115 | */ |
116 | - public function filter_plugin_actions( $links, $plugin ) { |
|
116 | + public function filter_plugin_actions($links, $plugin) { |
|
117 | 117 | // set $main_file in stone |
118 | 118 | static $main_file; |
119 | 119 | // if $main_file is not set yet |
120 | - if ( ! $main_file ) { |
|
121 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
120 | + if ( ! $main_file) { |
|
121 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
122 | 122 | } |
123 | - if ( $plugin == $main_file ) { |
|
123 | + if ($plugin == $main_file) { |
|
124 | 124 | // compare current plugin to this one |
125 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
126 | - $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>'; |
|
127 | - array_unshift( $links, $maintenance_link ); |
|
125 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
126 | + $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>'; |
|
127 | + array_unshift($links, $maintenance_link); |
|
128 | 128 | } else { |
129 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
130 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
129 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
130 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
131 | 131 | // add before other links |
132 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
132 | + array_unshift($links, $org_settings_link, $events_link); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | return $links; |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | * @return void |
145 | 145 | */ |
146 | 146 | public function get_request() { |
147 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
148 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
147 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
148 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | * @param array $admin_page_folder_names |
158 | 158 | * @return array |
159 | 159 | */ |
160 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
160 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
161 | 161 | return array( |
162 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
163 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
164 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
162 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
163 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
164 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
165 | 165 | ); |
166 | 166 | } |
167 | 167 | |
@@ -176,36 +176,36 @@ discard block |
||
176 | 176 | public function init() { |
177 | 177 | |
178 | 178 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
179 | - if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
179 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
180 | 180 | //ok so we want to enable the entire admin |
181 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
182 | - add_action( 'save_post', array( 'EE_Admin', 'parse_post_content_on_save' ), 100, 2 ); |
|
183 | - add_action( 'update_option', array( $this, 'reset_page_for_posts_on_change' ), 100, 3 ); |
|
184 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
185 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
186 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
181 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
182 | + add_action('save_post', array('EE_Admin', 'parse_post_content_on_save'), 100, 2); |
|
183 | + add_action('update_option', array($this, 'reset_page_for_posts_on_change'), 100, 3); |
|
184 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
185 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
186 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
187 | 187 | //at a glance dashboard widget |
188 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items'), 10 ); |
|
188 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
189 | 189 | //filter for get_edit_post_link used on comments for custom post types |
190 | - add_filter('get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 3 ); |
|
190 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
194 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
194 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
195 | 195 | try { |
196 | 196 | //this loads the controller for the admin pages which will setup routing etc |
197 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
198 | - } catch ( EE_Error $e ) { |
|
197 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
198 | + } catch (EE_Error $e) { |
|
199 | 199 | $e->get_error(); |
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | 203 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
204 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
205 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
204 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
205 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
206 | 206 | |
207 | 207 | //exclude EE critical pages from all nav menus and wp_list_pages |
208 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
208 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | * @param object $post_type WP post type object |
219 | 219 | * @return object WP post type object |
220 | 220 | */ |
221 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
221 | + public function remove_pages_from_nav_menu($post_type) { |
|
222 | 222 | //if this isn't the "pages" post type let's get out |
223 | - if ( $post_type->name !== 'page' ) |
|
223 | + if ($post_type->name !== 'page') |
|
224 | 224 | return $post_type; |
225 | 225 | |
226 | 226 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -240,28 +240,28 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function enable_hidden_ee_nav_menu_metaboxes() { |
242 | 242 | global $wp_meta_boxes, $pagenow; |
243 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
243 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') { |
|
244 | 244 | return; |
245 | 245 | } |
246 | 246 | $user = wp_get_current_user(); |
247 | 247 | //has this been done yet? |
248 | - if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) { |
|
248 | + if (get_user_option('ee_nav_menu_initialized', $user->ID)) { |
|
249 | 249 | return; |
250 | 250 | } |
251 | 251 | |
252 | - $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID ); |
|
253 | - $initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) ); |
|
252 | + $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID); |
|
253 | + $initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page')); |
|
254 | 254 | |
255 | - if ( is_array( $hidden_meta_boxes ) ) { |
|
256 | - foreach ( $hidden_meta_boxes as $key => $meta_box_id ) { |
|
257 | - if ( in_array( $meta_box_id, $initial_meta_boxes ) ) { |
|
258 | - unset( $hidden_meta_boxes[ $key ] ); |
|
255 | + if (is_array($hidden_meta_boxes)) { |
|
256 | + foreach ($hidden_meta_boxes as $key => $meta_box_id) { |
|
257 | + if (in_array($meta_box_id, $initial_meta_boxes)) { |
|
258 | + unset($hidden_meta_boxes[$key]); |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
264 | - update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true ); |
|
263 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
264 | + update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @return void |
281 | 281 | */ |
282 | 282 | public function register_custom_nav_menu_boxes() { |
283 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
283 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
@@ -297,17 +297,17 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @return string the (maybe) modified link |
299 | 299 | */ |
300 | - public function modify_edit_post_link( $link, $id, $context ) { |
|
301 | - if ( ! $post = get_post( $id ) ) |
|
300 | + public function modify_edit_post_link($link, $id, $context) { |
|
301 | + if ( ! $post = get_post($id)) |
|
302 | 302 | return $link; |
303 | 303 | |
304 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
304 | + if ($post->post_type == 'espresso_attendees') { |
|
305 | 305 | $query_args = array( |
306 | 306 | 'action' => 'edit_attendee', |
307 | 307 | 'post' => $id |
308 | 308 | ); |
309 | 309 | EE_Registry::instance()->load_helper('URL'); |
310 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
310 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
311 | 311 | } |
312 | 312 | return $link; |
313 | 313 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | global $nav_menu_selected_id; |
320 | 320 | |
321 | 321 | $db_fields = false; |
322 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
322 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
323 | 323 | $current_tab = 'event-archives'; |
324 | 324 | |
325 | 325 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -338,9 +338,9 @@ discard block |
||
338 | 338 | ?> |
339 | 339 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
340 | 340 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
341 | - <li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>> |
|
342 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
343 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
341 | + <li <?php echo ('event-archives' == $current_tab ? ' class="tabs"' : ''); ?>> |
|
342 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
343 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
344 | 344 | </a> |
345 | 345 | </li> |
346 | 346 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -358,13 +358,13 @@ discard block |
||
358 | 358 | <?php */ ?> |
359 | 359 | |
360 | 360 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
361 | - echo ( 'event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
361 | + echo ('event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
362 | 362 | ?>"> |
363 | 363 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
364 | 364 | <?php |
365 | 365 | $pages = $this->_get_extra_nav_menu_pages_items(); |
366 | 366 | $args['walker'] = $walker; |
367 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
367 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
368 | 368 | ?> |
369 | 369 | </ul> |
370 | 370 | </div><!-- /.tabs-panel --> |
@@ -372,18 +372,18 @@ discard block |
||
372 | 372 | <p class="button-controls"> |
373 | 373 | <span class="list-controls"> |
374 | 374 | <a href="<?php |
375 | - echo esc_url( add_query_arg( |
|
375 | + echo esc_url(add_query_arg( |
|
376 | 376 | array( |
377 | 377 | 'extra-nav-menu-pages-tab' => 'event-archives', |
378 | 378 | 'selectall' => 1, |
379 | 379 | ), |
380 | - remove_query_arg( $removed_args ) |
|
380 | + remove_query_arg($removed_args) |
|
381 | 381 | )); |
382 | 382 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
383 | 383 | </span> |
384 | 384 | |
385 | 385 | <span class="add-to-menu"> |
386 | - <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" /> |
|
386 | + <input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" /> |
|
387 | 387 | <span class="spinner"></span> |
388 | 388 | </span> |
389 | 389 | </p> |
@@ -404,10 +404,10 @@ discard block |
||
404 | 404 | private function _get_extra_nav_menu_pages_items() { |
405 | 405 | $menuitems[] = array( |
406 | 406 | 'title' => __('Event List', 'event_espresso'), |
407 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
407 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
408 | 408 | 'description' => __('Archive page for all events.', 'event_espresso') |
409 | 409 | ); |
410 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
410 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @param $menuitem |
420 | 420 | * @return stdClass |
421 | 421 | */ |
422 | - private function _setup_extra_nav_menu_pages_items( $menuitem ) { |
|
422 | + private function _setup_extra_nav_menu_pages_items($menuitem) { |
|
423 | 423 | $menu_item = new stdClass(); |
424 | 424 | $keys = array( |
425 | 425 | 'ID' => 0, |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | 'xfn' => '' |
440 | 440 | ); |
441 | 441 | |
442 | - foreach ( $keys as $key => $value) { |
|
442 | + foreach ($keys as $key => $value) { |
|
443 | 443 | $menu_item->$key = isset($menuitem[$key]) ? $menuitem[$key] : $value; |
444 | 444 | } |
445 | 445 | return $menu_item; |
@@ -479,10 +479,10 @@ discard block |
||
479 | 479 | * - check if doing post processing of one of EE CPTs |
480 | 480 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
481 | 481 | */ |
482 | - if ( isset( $_POST['action'] ) && $_POST['action'] == 'editpost' ) { |
|
483 | - if ( isset( $_POST['post_type'] ) ) { |
|
484 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
485 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
482 | + if (isset($_POST['action']) && $_POST['action'] == 'editpost') { |
|
483 | + if (isset($_POST['post_type'])) { |
|
484 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
485 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
486 | 486 | } |
487 | 487 | } |
488 | 488 | |
@@ -492,8 +492,8 @@ discard block |
||
492 | 492 | * 'options-reading.php' core WordPress admin settings page. This is for user-proofing. |
493 | 493 | */ |
494 | 494 | global $pagenow; |
495 | - if ( $pagenow == 'options-reading.php' ) { |
|
496 | - add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) ); |
|
495 | + if ($pagenow == 'options-reading.php') { |
|
496 | + add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages')); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | } |
@@ -505,25 +505,25 @@ discard block |
||
505 | 505 | * @param string $output Current output. |
506 | 506 | * @return string |
507 | 507 | */ |
508 | - public function modify_dropdown_pages( $output ) { |
|
508 | + public function modify_dropdown_pages($output) { |
|
509 | 509 | //get critical pages |
510 | 510 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
511 | 511 | |
512 | 512 | //split current output by line break for easier parsing. |
513 | - $split_output = explode( "\n", $output ); |
|
513 | + $split_output = explode("\n", $output); |
|
514 | 514 | |
515 | 515 | //loop through to remove any critical pages from the array. |
516 | - foreach ( $critical_pages as $page_id ) { |
|
517 | - $needle = 'value="' . $page_id . '"'; |
|
518 | - foreach( $split_output as $key => $haystack ) { |
|
519 | - if( strpos( $haystack, $needle ) !== false ) { |
|
520 | - unset( $split_output[$key] ); |
|
516 | + foreach ($critical_pages as $page_id) { |
|
517 | + $needle = 'value="'.$page_id.'"'; |
|
518 | + foreach ($split_output as $key => $haystack) { |
|
519 | + if (strpos($haystack, $needle) !== false) { |
|
520 | + unset($split_output[$key]); |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | } |
524 | 524 | |
525 | 525 | //replace output with the new contents |
526 | - $output = implode( "\n", $split_output ); |
|
526 | + $output = implode("\n", $split_output); |
|
527 | 527 | |
528 | 528 | return $output; |
529 | 529 | } |
@@ -539,37 +539,37 @@ discard block |
||
539 | 539 | public function enqueue_admin_scripts() { |
540 | 540 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
541 | 541 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
542 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
542 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
543 | 543 | // register cookie script for future dependencies |
544 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
544 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
545 | 545 | // jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
546 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
546 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
547 | 547 | // register jQuery Validate |
548 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
548 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
549 | 549 | } |
550 | 550 | //joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' ); |
551 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
551 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
552 | 552 | //joyride style |
553 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
554 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
555 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
553 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
554 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
555 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
556 | 556 | //joyride JS |
557 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
557 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
558 | 558 | // wanna go for a joyride? |
559 | 559 | wp_enqueue_style('ee-joyride-css'); |
560 | 560 | wp_enqueue_script('jquery-joyride'); |
561 | 561 | } |
562 | 562 | //qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' ); |
563 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
563 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
564 | 564 | EE_Registry::instance()->load_helper('Qtip_Loader'); |
565 | 565 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
566 | 566 | } |
567 | 567 | //accounting.js library |
568 | 568 | // @link http://josscrowcroft.github.io/accounting.js/ |
569 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
570 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
571 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
572 | - wp_enqueue_script( 'ee-accounting' ); |
|
569 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
570 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
571 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
572 | + wp_enqueue_script('ee-accounting'); |
|
573 | 573 | // array of settings to get converted to JSON array via wp_localize_script |
574 | 574 | $currency_config = array( |
575 | 575 | 'currency' => array( |
@@ -616,11 +616,11 @@ discard block |
||
616 | 616 | public function get_persistent_admin_notices() { |
617 | 617 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
618 | 618 | $args = array( |
619 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
620 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
619 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
620 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
621 | 621 | ); |
622 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
623 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
622 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
623 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | |
@@ -641,26 +641,26 @@ discard block |
||
641 | 641 | * @param $elements |
642 | 642 | * @return array |
643 | 643 | */ |
644 | - public function dashboard_glance_items( $elements ) { |
|
644 | + public function dashboard_glance_items($elements) { |
|
645 | 645 | $events = EEM_Event::instance()->count(); |
646 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
647 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
646 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
647 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
648 | 648 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
649 | 649 | $registrations = EEM_Registration::instance()->count( |
650 | 650 | array( |
651 | 651 | array( |
652 | - 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) |
|
652 | + 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete) |
|
653 | 653 | ) |
654 | 654 | ) |
655 | 655 | ); |
656 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
657 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
656 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
657 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
658 | 658 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
659 | 659 | |
660 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
660 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
661 | 661 | |
662 | - foreach ( $items as $type => $item_properties ) { |
|
663 | - $elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] ); |
|
662 | + foreach ($items as $type => $item_properties) { |
|
663 | + $elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']); |
|
664 | 664 | } |
665 | 665 | return $elements; |
666 | 666 | } |
@@ -679,63 +679,63 @@ discard block |
||
679 | 679 | * @param $post |
680 | 680 | * @return void |
681 | 681 | */ |
682 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
682 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
683 | 683 | // default post types |
684 | - $post_types = array( 'post' => 0, 'page' => 1 ); |
|
684 | + $post_types = array('post' => 0, 'page' => 1); |
|
685 | 685 | // add CPTs |
686 | 686 | $CPTs = EE_Register_CPTs::get_CPTs(); |
687 | - $post_types = array_merge( $post_types, $CPTs ); |
|
687 | + $post_types = array_merge($post_types, $CPTs); |
|
688 | 688 | // for default or CPT posts... |
689 | - if ( isset( $post_types[ $post->post_type ] )) { |
|
689 | + if (isset($post_types[$post->post_type])) { |
|
690 | 690 | // post on frontpage ? |
691 | 691 | $page_for_posts = EE_Config::get_page_for_posts(); |
692 | 692 | $maybe_remove_from_posts = array(); |
693 | 693 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
694 | 694 | $critical_shortcodes = EE_Registry::instance()->CFG->core->get_critical_pages_shortcodes_array(); |
695 | 695 | // array of shortcodes indexed by post name |
696 | - EE_Registry::instance()->CFG->core->post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
696 | + EE_Registry::instance()->CFG->core->post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
697 | 697 | // whether to proceed with update, if an entry already exists for this post, then we want to update |
698 | - $update_post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] ) ? true : false; |
|
698 | + $update_post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name]) ? true : false; |
|
699 | 699 | // empty both arrays |
700 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] = array(); |
|
700 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name] = array(); |
|
701 | 701 | // check that posts page is already being tracked |
702 | - if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] ) ) { |
|
702 | + if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) { |
|
703 | 703 | // if not, then ensure that it is properly added |
704 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] = array(); |
|
704 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts] = array(); |
|
705 | 705 | } |
706 | 706 | // loop thru shortcodes |
707 | - foreach ( EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) { |
|
707 | + foreach (EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) { |
|
708 | 708 | // convert to UPPERCASE to get actual shortcode |
709 | - $EES_Shortcode = strtoupper( $EES_Shortcode ); |
|
709 | + $EES_Shortcode = strtoupper($EES_Shortcode); |
|
710 | 710 | // is the shortcode in the post_content ? |
711 | - if ( strpos( $post->post_content, $EES_Shortcode ) !== FALSE ) { |
|
711 | + if (strpos($post->post_content, $EES_Shortcode) !== FALSE) { |
|
712 | 712 | // map shortcode to post names and post IDs |
713 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID; |
|
713 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID; |
|
714 | 714 | // if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE |
715 | - if ( ! in_array( $EES_Shortcode, $critical_shortcodes )) { |
|
715 | + if ( ! in_array($EES_Shortcode, $critical_shortcodes)) { |
|
716 | 716 | // add shortcode to "Posts page" tracking |
717 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = $post_ID; |
|
717 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = $post_ID; |
|
718 | 718 | } |
719 | 719 | $update_post_shortcodes = TRUE; |
720 | - unset( $maybe_remove_from_posts[ $EES_Shortcode ] ); |
|
720 | + unset($maybe_remove_from_posts[$EES_Shortcode]); |
|
721 | 721 | } else { |
722 | - $maybe_remove_from_posts[ $EES_Shortcode ] = $post_ID; |
|
722 | + $maybe_remove_from_posts[$EES_Shortcode] = $post_ID; |
|
723 | 723 | } |
724 | 724 | } |
725 | - if ( $update_post_shortcodes ) { |
|
725 | + if ($update_post_shortcodes) { |
|
726 | 726 | // remove shortcodes from $maybe_remove_from_posts that are still being used |
727 | - foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes ) { |
|
728 | - if ( $post_name == $page_for_posts ) { |
|
727 | + foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes) { |
|
728 | + if ($post_name == $page_for_posts) { |
|
729 | 729 | continue; |
730 | 730 | } |
731 | 731 | // compute difference between active post_shortcodes array and $maybe_remove_from_posts array |
732 | - $maybe_remove_from_posts = array_diff_key( $maybe_remove_from_posts, $shortcodes ); |
|
732 | + $maybe_remove_from_posts = array_diff_key($maybe_remove_from_posts, $shortcodes); |
|
733 | 733 | } |
734 | 734 | // now unset unused shortcodes from the $page_for_posts post_shortcodes |
735 | - foreach ( $maybe_remove_from_posts as $shortcode => $post_ID ) { |
|
736 | - unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode ] ); |
|
735 | + foreach ($maybe_remove_from_posts as $shortcode => $post_ID) { |
|
736 | + unset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode]); |
|
737 | 737 | } |
738 | - EE_Registry::instance()->CFG->update_post_shortcodes( $page_for_posts ); |
|
738 | + EE_Registry::instance()->CFG->update_post_shortcodes($page_for_posts); |
|
739 | 739 | } |
740 | 740 | } |
741 | 741 | } |
@@ -753,32 +753,32 @@ discard block |
||
753 | 753 | * @throws EE_Error |
754 | 754 | * @return string |
755 | 755 | */ |
756 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
757 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
756 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
757 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
758 | 758 | // check for date_format or time_format |
759 | - switch ( $option ) { |
|
759 | + switch ($option) { |
|
760 | 760 | case 'date_format' : |
761 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
761 | + $date_time_format = $value.' '.get_option('time_format'); |
|
762 | 762 | break; |
763 | 763 | case 'time_format' : |
764 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
764 | + $date_time_format = get_option('date_format').' '.$value; |
|
765 | 765 | break; |
766 | 766 | default : |
767 | 767 | $date_time_format = FALSE; |
768 | 768 | } |
769 | 769 | // do we have a date_time format to check ? |
770 | - if ( $date_time_format ) { |
|
771 | - $error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format ); |
|
770 | + if ($date_time_format) { |
|
771 | + $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format); |
|
772 | 772 | |
773 | - if ( is_array( $error_msg ) ) { |
|
774 | - $msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format ) . '</p><p><ul>'; |
|
773 | + if (is_array($error_msg)) { |
|
774 | + $msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>'; |
|
775 | 775 | |
776 | 776 | |
777 | - foreach ( $error_msg as $error ) { |
|
778 | - $msg .= '<li>' . $error . '</li>'; |
|
777 | + foreach ($error_msg as $error) { |
|
778 | + $msg .= '<li>'.$error.'</li>'; |
|
779 | 779 | } |
780 | 780 | |
781 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
781 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
782 | 782 | |
783 | 783 | // trigger WP settings error |
784 | 784 | add_settings_error( |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | ); |
789 | 789 | |
790 | 790 | // set format to something valid |
791 | - switch ( $option ) { |
|
791 | + switch ($option) { |
|
792 | 792 | case 'date_format' : |
793 | 793 | $value = 'F j, Y'; |
794 | 794 | break; |
@@ -814,14 +814,14 @@ discard block |
||
814 | 814 | * @param $value |
815 | 815 | * @return void |
816 | 816 | */ |
817 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
818 | - if ( $option == 'page_for_posts' ) { |
|
817 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
818 | + if ($option == 'page_for_posts') { |
|
819 | 819 | global $wpdb; |
820 | - $SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
821 | - $old_page_for_posts = $old_value ? $wpdb->get_var( $wpdb->prepare( $SQL, $old_value )) : 'posts'; |
|
822 | - $new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value )) : 'posts'; |
|
823 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $new_page_for_posts ] = EE_Registry::instance()->CFG->core->post_shortcodes[ $old_page_for_posts ]; |
|
824 | - EE_Registry::instance()->CFG->update_post_shortcodes( $new_page_for_posts ); |
|
820 | + $SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
821 | + $old_page_for_posts = $old_value ? $wpdb->get_var($wpdb->prepare($SQL, $old_value)) : 'posts'; |
|
822 | + $new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts'; |
|
823 | + EE_Registry::instance()->CFG->core->post_shortcodes[$new_page_for_posts] = EE_Registry::instance()->CFG->core->post_shortcodes[$old_page_for_posts]; |
|
824 | + EE_Registry::instance()->CFG->update_post_shortcodes($new_page_for_posts); |
|
825 | 825 | } |
826 | 826 | } |
827 | 827 | |
@@ -834,8 +834,8 @@ discard block |
||
834 | 834 | * @param $content |
835 | 835 | * @return string |
836 | 836 | */ |
837 | - public function its_eSpresso( $content ) { |
|
838 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
837 | + public function its_eSpresso($content) { |
|
838 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | |
@@ -848,9 +848,9 @@ discard block |
||
848 | 848 | */ |
849 | 849 | public function espresso_admin_footer() { |
850 | 850 | return sprintf( |
851 | - __( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ), |
|
851 | + __('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'), |
|
852 | 852 | '<a href="http://eventespresso.com/" title="', |
853 | - '">' . EVENT_ESPRESSO_POWERED_BY . '</a>' |
|
853 | + '">'.EVENT_ESPRESSO_POWERED_BY.'</a>' |
|
854 | 854 | ); |
855 | 855 | } |
856 | 856 | |
@@ -870,11 +870,11 @@ discard block |
||
870 | 870 | * @param array $config |
871 | 871 | * @return void |
872 | 872 | */ |
873 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
874 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
|
875 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) |
|
873 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
874 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3'); |
|
875 | + if (class_exists('EE_Register_Admin_Page')) |
|
876 | 876 | $config['page_path'] = $page_path; |
877 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
877 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
878 | 878 | } |
879 | 879 | |
880 | 880 |