@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | /** |
34 | 34 | * This property is used to hold an array of EE_default_term objects assigned to a custom post type when the post for that post type is published with no terms set for the taxonomy. |
35 | - * |
|
35 | + * |
|
36 | 36 | * @var array of EE_Default_Term objects |
37 | 37 | */ |
38 | 38 | protected $_default_terms = array(); |
@@ -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 | * |
@@ -53,8 +55,9 @@ discard block |
||
53 | 55 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
54 | 56 | |
55 | 57 | //wp have no MONTH_IN_SECONDS constant. So we approximate our own assuming all months are 4 weeks long. |
56 | - if ( !defined('MONTH_IN_SECONDS' ) ) |
|
57 | - define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 ); |
|
58 | + if ( !defined('MONTH_IN_SECONDS' ) ) { |
|
59 | + define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 ); |
|
60 | + } |
|
58 | 61 | |
59 | 62 | if(EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance){ |
60 | 63 | $this->_uxip_hooks(); |
@@ -101,42 +104,51 @@ discard block |
||
101 | 104 | |
102 | 105 | //what is the current active theme? |
103 | 106 | $active_theme = get_option('uxip_ee_active_theme'); |
104 | - if ( !empty( $active_theme ) ) |
|
105 | - $extra_stats[$site_pre . 'active_theme'] = $active_theme; |
|
107 | + if ( !empty( $active_theme ) ) { |
|
108 | + $extra_stats[$site_pre . 'active_theme'] = $active_theme; |
|
109 | + } |
|
106 | 110 | |
107 | 111 | //event info regarding an all event count and all "active" event count |
108 | 112 | $all_events_count = get_option('uxip_ee4_all_events_count'); |
109 | - if ( !empty( $all_events_count ) ) |
|
110 | - $extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count; |
|
113 | + if ( !empty( $all_events_count ) ) { |
|
114 | + $extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count; |
|
115 | + } |
|
111 | 116 | $active_events_count = get_option('uxip_ee4_active_events_count'); |
112 | - if ( !empty( $active_events_count ) ) |
|
113 | - $extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count; |
|
117 | + if ( !empty( $active_events_count ) ) { |
|
118 | + $extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count; |
|
119 | + } |
|
114 | 120 | |
115 | 121 | //datetime stuff |
116 | 122 | $dtt_count = get_option('uxip_ee_all_dtts_count'); |
117 | - if ( !empty( $dtt_count ) ) |
|
118 | - $extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count; |
|
123 | + if ( !empty( $dtt_count ) ) { |
|
124 | + $extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count; |
|
125 | + } |
|
119 | 126 | |
120 | 127 | $dtt_sold = get_option('uxip_ee_dtt_sold'); |
121 | - if ( !empty( $dtt_sold ) ) |
|
122 | - $extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold; |
|
128 | + if ( !empty( $dtt_sold ) ) { |
|
129 | + $extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold; |
|
130 | + } |
|
123 | 131 | |
124 | 132 | //ticket stuff |
125 | 133 | $all_tkt_count = get_option('uxip_ee_all_tkt_count'); |
126 | - if ( !empty( $all_tkt_count ) ) |
|
127 | - $extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count; |
|
134 | + if ( !empty( $all_tkt_count ) ) { |
|
135 | + $extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count; |
|
136 | + } |
|
128 | 137 | |
129 | 138 | $free_tkt_count = get_option('uxip_ee_free_tkt_count'); |
130 | - if ( !empty( $free_tkt_count ) ) |
|
131 | - $extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count; |
|
139 | + if ( !empty( $free_tkt_count ) ) { |
|
140 | + $extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count; |
|
141 | + } |
|
132 | 142 | |
133 | 143 | $paid_tkt_count = get_option('uxip_ee_paid_tkt_count'); |
134 | - if ( !empty( $paid_tkt_count ) ) |
|
135 | - $extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count; |
|
144 | + if ( !empty( $paid_tkt_count ) ) { |
|
145 | + $extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count; |
|
146 | + } |
|
136 | 147 | |
137 | 148 | $tkt_sold = get_option('uxip_ee_tkt_sold' ); |
138 | - if ( !empty($tkt_sold) ) |
|
139 | - $extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold; |
|
149 | + if ( !empty($tkt_sold) ) { |
|
150 | + $extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold; |
|
151 | + } |
|
140 | 152 | |
141 | 153 | //phpversion checking |
142 | 154 | $extra_stats['phpversion'] = function_exists('phpversion') ? phpversion() : 'unknown'; |
@@ -209,7 +221,9 @@ discard block |
||
209 | 221 | |
210 | 222 | function espresso_data_collection_optin_notice() { |
211 | 223 | $ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified; |
212 | - if ( $ueip_has_notified ) return; |
|
224 | + if ( $ueip_has_notified ) { |
|
225 | + return; |
|
226 | + } |
|
213 | 227 | $settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') ); |
214 | 228 | $settings_url = $settings_url . '#UXIP_settings'; |
215 | 229 | ?> |
@@ -249,7 +263,9 @@ discard block |
||
249 | 263 | function espresso_data_optin_ajax_handler() { |
250 | 264 | |
251 | 265 | //verify nonce |
252 | - if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) exit(); |
|
266 | + if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) { |
|
267 | + exit(); |
|
268 | + } |
|
253 | 269 | |
254 | 270 | //made it here so let's save the selection |
255 | 271 | $ueip_optin = isset( $_POST['selection'] ) ? $_POST['selection'] : 'no'; |
@@ -279,13 +295,15 @@ discard block |
||
279 | 295 | $current = get_site_transient( 'update_plugins' ); |
280 | 296 | |
281 | 297 | foreach ( (array) $plugins as $plugin_file => $plugin_data ) { |
282 | - if ( isset( $current->response['plugin_file'] ) ) |
|
283 | - $update = true; |
|
298 | + if ( isset( $current->response['plugin_file'] ) ) { |
|
299 | + $update = true; |
|
300 | + } |
|
284 | 301 | } |
285 | 302 | |
286 | 303 | //it's possible that there is an update but an invalid site-license-key is in use |
287 | - if ( get_site_option('pue_json_error_' . $basename ) ) |
|
288 | - $update = true; |
|
304 | + if ( get_site_option('pue_json_error_' . $basename ) ) { |
|
305 | + $update = true; |
|
306 | + } |
|
289 | 307 | |
290 | 308 | return $update; |
291 | 309 | } |
@@ -329,46 +347,54 @@ discard block |
||
329 | 347 | $DTT = EE_Registry::instance()->load_model('Datetime'); |
330 | 348 | $TKT = EE_Registry::instance()->load_model('Ticket'); |
331 | 349 | $count = $EVT->count(); |
332 | - if ( $count > 0 ) |
|
333 | - update_option('uxip_ee4_all_events_count', $count); |
|
350 | + if ( $count > 0 ) { |
|
351 | + update_option('uxip_ee4_all_events_count', $count); |
|
352 | + } |
|
334 | 353 | |
335 | 354 | //next let's just get the number of ACTIVE events |
336 | 355 | $count_active = $EVT->get_active_events(array(), TRUE); |
337 | - if ( $count_active > 0 ) |
|
338 | - update_option('uxip_ee4_active_events_count', $count_active); |
|
356 | + if ( $count_active > 0 ) { |
|
357 | + update_option('uxip_ee4_active_events_count', $count_active); |
|
358 | + } |
|
339 | 359 | |
340 | 360 | //datetimes! |
341 | 361 | $dtt_count = $DTT->count(); |
342 | - if ( $dtt_count > 0 ) |
|
343 | - update_option( 'uxip_ee_all_dtts_count', $dtt_count ); |
|
362 | + if ( $dtt_count > 0 ) { |
|
363 | + update_option( 'uxip_ee_all_dtts_count', $dtt_count ); |
|
364 | + } |
|
344 | 365 | |
345 | 366 | |
346 | 367 | //dttsold |
347 | 368 | $dtt_sold = $DTT->sum(array(), 'DTT_sold'); |
348 | - if ( $dtt_sold > 0 ) |
|
349 | - update_option( 'uxip_ee_dtt_sold', $dtt_sold ); |
|
369 | + if ( $dtt_sold > 0 ) { |
|
370 | + update_option( 'uxip_ee_dtt_sold', $dtt_sold ); |
|
371 | + } |
|
350 | 372 | |
351 | 373 | //allticketcount |
352 | 374 | $all_tkt_count = $TKT->count(); |
353 | - if ( $all_tkt_count > 0 ) |
|
354 | - update_option( 'uxip_ee_all_tkt_count', $all_tkt_count ); |
|
375 | + if ( $all_tkt_count > 0 ) { |
|
376 | + update_option( 'uxip_ee_all_tkt_count', $all_tkt_count ); |
|
377 | + } |
|
355 | 378 | |
356 | 379 | //freetktcount |
357 | 380 | $_where = array( 'TKT_price' => 0 ); |
358 | 381 | $free_tkt_count = $TKT->count(array($_where)); |
359 | - if ( $free_tkt_count > 0 ) |
|
360 | - update_option( 'uxip_ee_free_tkt_count', $free_tkt_count ); |
|
382 | + if ( $free_tkt_count > 0 ) { |
|
383 | + update_option( 'uxip_ee_free_tkt_count', $free_tkt_count ); |
|
384 | + } |
|
361 | 385 | |
362 | 386 | //paidtktcount |
363 | 387 | $_where = array( 'TKT_price' => array('>', 0) ); |
364 | 388 | $paid_tkt_count = $TKT->count( array( $_where ) ); |
365 | - if ( $paid_tkt_count > 0 ) |
|
366 | - update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count ); |
|
389 | + if ( $paid_tkt_count > 0 ) { |
|
390 | + update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count ); |
|
391 | + } |
|
367 | 392 | |
368 | 393 | //tktsold |
369 | 394 | $tkt_sold = $TKT->sum( array(), 'TKT_sold' ); |
370 | - if( $tkt_sold > 0 ) |
|
371 | - update_option( 'uxip_ee_tkt_sold', $tkt_sold ); |
|
395 | + if( $tkt_sold > 0 ) { |
|
396 | + update_option( 'uxip_ee_tkt_sold', $tkt_sold ); |
|
397 | + } |
|
372 | 398 | |
373 | 399 | |
374 | 400 | set_transient( 'ee4_event_info_check', 1, WEEK_IN_SECONDS * 2 ); |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | public function __construct() { |
50 | 50 | // throw new EE_Error('error'); |
51 | 51 | |
52 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
52 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
53 | 53 | |
54 | 54 | //wp have no MONTH_IN_SECONDS constant. So we approximate our own assuming all months are 4 weeks long. |
55 | - if ( !defined('MONTH_IN_SECONDS' ) ) |
|
56 | - define( 'MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4 ); |
|
55 | + if ( ! defined('MONTH_IN_SECONDS')) |
|
56 | + define('MONTH_IN_SECONDS', WEEK_IN_SECONDS * 4); |
|
57 | 57 | |
58 | - if(EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance){ |
|
58 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
59 | 59 | $this->_uxip_hooks(); |
60 | 60 | } |
61 | 61 | |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | $ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified; |
65 | 65 | |
66 | 66 | //has optin been selected for data collection? |
67 | - $espresso_data_optin = !empty($ueip_optin) ? $ueip_optin : NULL; |
|
67 | + $espresso_data_optin = ! empty($ueip_optin) ? $ueip_optin : NULL; |
|
68 | 68 | |
69 | - if ( empty($ueip_has_notified) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_mode::level_2_complete_maintenance ) { |
|
70 | - add_action('admin_notices', array( $this, 'espresso_data_collection_optin_notice' ), 10 ); |
|
71 | - add_action('admin_enqueue_scripts', array( $this, 'espresso_data_collection_enqueue_scripts' ), 10 ); |
|
72 | - add_action('wp_ajax_espresso_data_optin', array( $this, 'espresso_data_optin_ajax_handler' ), 10 ); |
|
69 | + if (empty($ueip_has_notified) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_mode::level_2_complete_maintenance) { |
|
70 | + add_action('admin_notices', array($this, 'espresso_data_collection_optin_notice'), 10); |
|
71 | + add_action('admin_enqueue_scripts', array($this, 'espresso_data_collection_enqueue_scripts'), 10); |
|
72 | + add_action('wp_ajax_espresso_data_optin', array($this, 'espresso_data_optin_ajax_handler'), 10); |
|
73 | 73 | update_option('ee_ueip_optin', 'yes'); |
74 | 74 | $espresso_data_optin = 'yes'; |
75 | 75 | } |
@@ -78,80 +78,80 @@ discard block |
||
78 | 78 | $extra_stats = array(); |
79 | 79 | |
80 | 80 | //only collect extra stats if the plugin user has opted in. |
81 | - if ( !empty($espresso_data_optin) && $espresso_data_optin == 'yes' ) { |
|
81 | + if ( ! empty($espresso_data_optin) && $espresso_data_optin == 'yes') { |
|
82 | 82 | //let's only setup extra data if transient has expired |
83 | - if ( false === ( $transient = get_transient('ee_extra_data') ) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
83 | + if (false === ($transient = get_transient('ee_extra_data')) && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
84 | 84 | |
85 | 85 | $current_site = is_multisite() ? get_current_site() : NULL; |
86 | - $site_pre = ! is_main_site() && ! empty($current_site) ? trim( preg_replace('/\b\w\S\w\b/', '', $current_site->domain ), '.' ) . '_' : ''; |
|
86 | + $site_pre = ! is_main_site() && ! empty($current_site) ? trim(preg_replace('/\b\w\S\w\b/', '', $current_site->domain), '.').'_' : ''; |
|
87 | 87 | |
88 | 88 | |
89 | 89 | //active gateways |
90 | 90 | $active_gateways = get_option('event_espresso_active_gateways'); |
91 | - if ( !empty($active_gateways ) ) { |
|
92 | - foreach ( (array) $active_gateways as $gateway => $ignore ) { |
|
93 | - $extra_stats[$site_pre . $gateway . '_gateway_active'] = 1; |
|
91 | + if ( ! empty($active_gateways)) { |
|
92 | + foreach ((array) $active_gateways as $gateway => $ignore) { |
|
93 | + $extra_stats[$site_pre.$gateway.'_gateway_active'] = 1; |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | - if ( is_multisite() && is_main_site() ) { |
|
97 | + if (is_multisite() && is_main_site()) { |
|
98 | 98 | $extra_stats['is_multisite'] = true; |
99 | 99 | } |
100 | 100 | |
101 | 101 | //what is the current active theme? |
102 | 102 | $active_theme = get_option('uxip_ee_active_theme'); |
103 | - if ( !empty( $active_theme ) ) |
|
104 | - $extra_stats[$site_pre . 'active_theme'] = $active_theme; |
|
103 | + if ( ! empty($active_theme)) |
|
104 | + $extra_stats[$site_pre.'active_theme'] = $active_theme; |
|
105 | 105 | |
106 | 106 | //event info regarding an all event count and all "active" event count |
107 | 107 | $all_events_count = get_option('uxip_ee4_all_events_count'); |
108 | - if ( !empty( $all_events_count ) ) |
|
109 | - $extra_stats[$site_pre . 'ee4_all_events_count'] = $all_events_count; |
|
108 | + if ( ! empty($all_events_count)) |
|
109 | + $extra_stats[$site_pre.'ee4_all_events_count'] = $all_events_count; |
|
110 | 110 | $active_events_count = get_option('uxip_ee4_active_events_count'); |
111 | - if ( !empty( $active_events_count ) ) |
|
112 | - $extra_stats[$site_pre . 'ee4_active_events_count'] = $active_events_count; |
|
111 | + if ( ! empty($active_events_count)) |
|
112 | + $extra_stats[$site_pre.'ee4_active_events_count'] = $active_events_count; |
|
113 | 113 | |
114 | 114 | //datetime stuff |
115 | 115 | $dtt_count = get_option('uxip_ee_all_dtts_count'); |
116 | - if ( !empty( $dtt_count ) ) |
|
117 | - $extra_stats[$site_pre . 'all_dtts_count'] = $dtt_count; |
|
116 | + if ( ! empty($dtt_count)) |
|
117 | + $extra_stats[$site_pre.'all_dtts_count'] = $dtt_count; |
|
118 | 118 | |
119 | 119 | $dtt_sold = get_option('uxip_ee_dtt_sold'); |
120 | - if ( !empty( $dtt_sold ) ) |
|
121 | - $extra_stats[$site_pre . 'dtt_sold'] = $dtt_sold; |
|
120 | + if ( ! empty($dtt_sold)) |
|
121 | + $extra_stats[$site_pre.'dtt_sold'] = $dtt_sold; |
|
122 | 122 | |
123 | 123 | //ticket stuff |
124 | 124 | $all_tkt_count = get_option('uxip_ee_all_tkt_count'); |
125 | - if ( !empty( $all_tkt_count ) ) |
|
126 | - $extra_stats[$site_pre . 'all_tkt_count'] = $all_tkt_count; |
|
125 | + if ( ! empty($all_tkt_count)) |
|
126 | + $extra_stats[$site_pre.'all_tkt_count'] = $all_tkt_count; |
|
127 | 127 | |
128 | 128 | $free_tkt_count = get_option('uxip_ee_free_tkt_count'); |
129 | - if ( !empty( $free_tkt_count ) ) |
|
130 | - $extra_stats[$site_pre . 'free_tkt_count'] = $free_tkt_count; |
|
129 | + if ( ! empty($free_tkt_count)) |
|
130 | + $extra_stats[$site_pre.'free_tkt_count'] = $free_tkt_count; |
|
131 | 131 | |
132 | 132 | $paid_tkt_count = get_option('uxip_ee_paid_tkt_count'); |
133 | - if ( !empty( $paid_tkt_count ) ) |
|
134 | - $extra_stats[$site_pre . 'paid_tkt_count'] = $paid_tkt_count; |
|
133 | + if ( ! empty($paid_tkt_count)) |
|
134 | + $extra_stats[$site_pre.'paid_tkt_count'] = $paid_tkt_count; |
|
135 | 135 | |
136 | - $tkt_sold = get_option('uxip_ee_tkt_sold' ); |
|
137 | - if ( !empty($tkt_sold) ) |
|
138 | - $extra_stats[$site_pre . 'tkt_sold'] = $tkt_sold; |
|
136 | + $tkt_sold = get_option('uxip_ee_tkt_sold'); |
|
137 | + if ( ! empty($tkt_sold)) |
|
138 | + $extra_stats[$site_pre.'tkt_sold'] = $tkt_sold; |
|
139 | 139 | |
140 | 140 | //phpversion checking |
141 | 141 | $extra_stats['phpversion'] = function_exists('phpversion') ? phpversion() : 'unknown'; |
142 | 142 | |
143 | 143 | //set transient |
144 | - set_transient( 'ee_extra_data', $extra_stats, WEEK_IN_SECONDS ); |
|
144 | + set_transient('ee_extra_data', $extra_stats, WEEK_IN_SECONDS); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | 148 | |
149 | 149 | |
150 | 150 | // PUE Auto Upgrades stuff |
151 | - if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { //include the file |
|
152 | - require_once(EE_THIRD_PARTY . 'pue/pue-client.php' ); |
|
151 | + if (is_readable(EE_THIRD_PARTY.'pue/pue-client.php')) { //include the file |
|
152 | + require_once(EE_THIRD_PARTY.'pue/pue-client.php'); |
|
153 | 153 | |
154 | - $api_key = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->site_license_key : ''; |
|
154 | + $api_key = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->site_license_key : ''; |
|
155 | 155 | $host_server_url = 'http://eventespresso.com'; //this needs to be the host server where plugin update engine is installed. Note, if you leave this blank then it is assumed the WordPress repo will be used and we'll just check there. |
156 | 156 | |
157 | 157 | //Note: PUE uses a simple preg_match to determine what type is currently installed based on version number. So it's important that you use a key for the version type that is unique and not found in another key. |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | //$plugin_slug['prerelease']['b'] = 'some-pre-release-slug'; |
164 | 164 | //..WOULD work! |
165 | 165 | $plugin_slug = array( |
166 | - 'free' => array( 'decaf' => 'event-espresso-core-decaf' ), |
|
167 | - 'premium' => array( 'p' => 'event-espresso-core-reg' ), |
|
168 | - 'prerelease' => array( 'beta' => 'event-espresso-core-pr' ) |
|
166 | + 'free' => array('decaf' => 'event-espresso-core-decaf'), |
|
167 | + 'premium' => array('p' => 'event-espresso-core-reg'), |
|
168 | + 'prerelease' => array('beta' => 'event-espresso-core-pr') |
|
169 | 169 | ); |
170 | 170 | |
171 | 171 | |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | * The purpose of this function is to display information about Event Espresso data collection and a optin selection for extra data collecting by users. |
193 | 193 | * @return string html. |
194 | 194 | */ |
195 | - public static function espresso_data_collection_optin_text( $extra = TRUE ) { |
|
196 | - if ( ! $extra ) { |
|
197 | - echo '<h2 class="ee-admin-settings-hdr" '. (!$extra ? 'id="UXIP_settings"' : '').'>'.__('User eXperience Improvement Program (UXIP)', 'event_espresso').EEH_Template::get_help_tab_link('organization_logo_info').'</h2>'; |
|
198 | - echo sprintf( __('%sPlease help us make Event Espresso better and vote for your favorite features.%s The %sUser eXperience Improvement Program (UXIP)%s, has been created so when you use Event Espresso you are voting for the features and settings that are important to you. The UXIP helps us understand how you use our products and services, track problems and in what context. If you opt-out of the UXIP you essentially elect for us to disregard how you use Event Espresso as we build new features and make changes. Participation in the program is completely voluntary but it is enabled by default. The end results of the UXIP are software improvements to better meet your needs. The data we collect will never be sold, traded, or misused in any way. %sPlease see our %sPrivacy Policy%s for more information.', 'event_espresso'), '<p><em>', '</em></p>','<a href="http://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">','</a>','<br><br>','<a href="http://eventespresso.com/about/privacy-policy/" target="_blank">','</a>' ); |
|
195 | + public static function espresso_data_collection_optin_text($extra = TRUE) { |
|
196 | + if ( ! $extra) { |
|
197 | + echo '<h2 class="ee-admin-settings-hdr" '.( ! $extra ? 'id="UXIP_settings"' : '').'>'.__('User eXperience Improvement Program (UXIP)', 'event_espresso').EEH_Template::get_help_tab_link('organization_logo_info').'</h2>'; |
|
198 | + echo sprintf(__('%sPlease help us make Event Espresso better and vote for your favorite features.%s The %sUser eXperience Improvement Program (UXIP)%s, has been created so when you use Event Espresso you are voting for the features and settings that are important to you. The UXIP helps us understand how you use our products and services, track problems and in what context. If you opt-out of the UXIP you essentially elect for us to disregard how you use Event Espresso as we build new features and make changes. Participation in the program is completely voluntary but it is enabled by default. The end results of the UXIP are software improvements to better meet your needs. The data we collect will never be sold, traded, or misused in any way. %sPlease see our %sPrivacy Policy%s for more information.', 'event_espresso'), '<p><em>', '</em></p>', '<a href="http://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">', '</a>', '<br><br>', '<a href="http://eventespresso.com/about/privacy-policy/" target="_blank">', '</a>'); |
|
199 | 199 | } else { |
200 | - $settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') ); |
|
200 | + $settings_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default'), admin_url('admin.php?page=espresso_general_settings')); |
|
201 | 201 | $settings_url .= '#UXIP_settings'; |
202 | - echo sprintf( __( 'The Event Espresso UXIP feature is active on your site. For %smore info%s and to opt-out %sclick here%s.', 'event_espresso' ), '<a href="http://eventespresso.com/about/user-experience-improvement-program-uxip/" traget="_blank">', '</a>', '<a href="' . $settings_url . '" target="_blank">', '</a>' ); |
|
202 | + echo sprintf(__('The Event Espresso UXIP feature is active on your site. For %smore info%s and to opt-out %sclick here%s.', 'event_espresso'), '<a href="http://eventespresso.com/about/user-experience-improvement-program-uxip/" traget="_blank">', '</a>', '<a href="'.$settings_url.'" target="_blank">', '</a>'); |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | |
209 | 209 | function espresso_data_collection_optin_notice() { |
210 | 210 | $ueip_has_notified = EE_Registry::instance()->CFG->core->ee_ueip_has_notified; |
211 | - if ( $ueip_has_notified ) return; |
|
212 | - $settings_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default'), admin_url( 'admin.php?page=espresso_general_settings') ); |
|
213 | - $settings_url = $settings_url . '#UXIP_settings'; |
|
211 | + if ($ueip_has_notified) return; |
|
212 | + $settings_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default'), admin_url('admin.php?page=espresso_general_settings')); |
|
213 | + $settings_url = $settings_url.'#UXIP_settings'; |
|
214 | 214 | ?> |
215 | 215 | <div class="updated data-collect-optin" id="espresso-data-collect-optin-container"> |
216 | 216 | <div id="data-collect-optin-options-container"> |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | * @return void |
233 | 233 | */ |
234 | 234 | function espresso_data_collection_enqueue_scripts() { |
235 | - wp_register_script( 'ee-data-optin-js', EE_GLOBAL_ASSETS_URL . 'scripts/ee-data-optin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
236 | - wp_register_style( 'ee-data-optin-css', EE_GLOBAL_ASSETS_URL . 'css/ee-data-optin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
235 | + wp_register_script('ee-data-optin-js', EE_GLOBAL_ASSETS_URL.'scripts/ee-data-optin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
236 | + wp_register_style('ee-data-optin-css', EE_GLOBAL_ASSETS_URL.'css/ee-data-optin.css', array(), EVENT_ESPRESSO_VERSION); |
|
237 | 237 | |
238 | 238 | wp_enqueue_script('ee-data-optin-js'); |
239 | 239 | wp_enqueue_style('ee-data-optin-css'); |
@@ -248,14 +248,14 @@ discard block |
||
248 | 248 | function espresso_data_optin_ajax_handler() { |
249 | 249 | |
250 | 250 | //verify nonce |
251 | - if ( isset($_POST['nonce']) && !wp_verify_nonce($_POST['nonce'], 'ee-data-optin') ) exit(); |
|
251 | + if (isset($_POST['nonce']) && ! wp_verify_nonce($_POST['nonce'], 'ee-data-optin')) exit(); |
|
252 | 252 | |
253 | 253 | //made it here so let's save the selection |
254 | - $ueip_optin = isset( $_POST['selection'] ) ? $_POST['selection'] : 'no'; |
|
254 | + $ueip_optin = isset($_POST['selection']) ? $_POST['selection'] : 'no'; |
|
255 | 255 | |
256 | 256 | //update_option('ee_ueip_optin', $ueip_optin); |
257 | 257 | EE_Registry::instance()->CFG->core->ee_ueip_has_notified = 1; |
258 | - EE_Registry::instance()->CFG->update_espresso_config( FALSE, FALSE ); |
|
258 | + EE_Registry::instance()->CFG->update_espresso_config(FALSE, FALSE); |
|
259 | 259 | exit(); |
260 | 260 | } |
261 | 261 | |
@@ -268,22 +268,22 @@ discard block |
||
268 | 268 | */ |
269 | 269 | public static function is_update_available($basename = '') { |
270 | 270 | |
271 | - $basename = ! empty( $basename ) ? $basename : EE_PLUGIN_BASENAME; |
|
271 | + $basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME; |
|
272 | 272 | |
273 | 273 | $update = false; |
274 | 274 | |
275 | - $folder = DS . dirname($basename); // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
|
275 | + $folder = DS.dirname($basename); // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
|
276 | 276 | |
277 | 277 | $plugins = get_plugins($folder); |
278 | - $current = get_site_transient( 'update_plugins' ); |
|
278 | + $current = get_site_transient('update_plugins'); |
|
279 | 279 | |
280 | - foreach ( (array) $plugins as $plugin_file => $plugin_data ) { |
|
281 | - if ( isset( $current->response['plugin_file'] ) ) |
|
280 | + foreach ((array) $plugins as $plugin_file => $plugin_data) { |
|
281 | + if (isset($current->response['plugin_file'])) |
|
282 | 282 | $update = true; |
283 | 283 | } |
284 | 284 | |
285 | 285 | //it's possible that there is an update but an invalid site-license-key is in use |
286 | - if ( get_site_option('pue_json_error_' . $basename ) ) |
|
286 | + if (get_site_option('pue_json_error_'.$basename)) |
|
287 | 287 | $update = true; |
288 | 288 | |
289 | 289 | return $update; |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | * @return void |
302 | 302 | */ |
303 | 303 | public function _uxip_hooks() { |
304 | - if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
305 | - add_action('admin_init', array( $this, 'track_active_theme' ) ); |
|
306 | - add_action('admin_init', array( $this, 'track_event_info' ) ); |
|
304 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
305 | + add_action('admin_init', array($this, 'track_active_theme')); |
|
306 | + add_action('admin_init', array($this, 'track_event_info')); |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
@@ -312,65 +312,65 @@ discard block |
||
312 | 312 | |
313 | 313 | public function track_active_theme() { |
314 | 314 | //we only check this once a month. |
315 | - if ( false === ( $transient = get_transient( 'ee_active_theme_check' ) ) ) { |
|
315 | + if (false === ($transient = get_transient('ee_active_theme_check'))) { |
|
316 | 316 | $theme = wp_get_theme(); |
317 | - update_option('uxip_ee_active_theme', $theme->get('Name') ); |
|
318 | - set_transient('ee_active_theme_check', 1, MONTH_IN_SECONDS ); |
|
317 | + update_option('uxip_ee_active_theme', $theme->get('Name')); |
|
318 | + set_transient('ee_active_theme_check', 1, MONTH_IN_SECONDS); |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
322 | 322 | |
323 | 323 | public function track_event_info() { |
324 | 324 | //we only check this once every couple weeks. |
325 | - if ( false === ( $transient = get_transient( 'ee4_event_info_check') ) ) { |
|
325 | + if (false === ($transient = get_transient('ee4_event_info_check'))) { |
|
326 | 326 | //first let's get the number for ALL events |
327 | 327 | $EVT = EE_Registry::instance()->load_model('Event'); |
328 | 328 | $DTT = EE_Registry::instance()->load_model('Datetime'); |
329 | 329 | $TKT = EE_Registry::instance()->load_model('Ticket'); |
330 | 330 | $count = $EVT->count(); |
331 | - if ( $count > 0 ) |
|
331 | + if ($count > 0) |
|
332 | 332 | update_option('uxip_ee4_all_events_count', $count); |
333 | 333 | |
334 | 334 | //next let's just get the number of ACTIVE events |
335 | 335 | $count_active = $EVT->get_active_events(array(), TRUE); |
336 | - if ( $count_active > 0 ) |
|
336 | + if ($count_active > 0) |
|
337 | 337 | update_option('uxip_ee4_active_events_count', $count_active); |
338 | 338 | |
339 | 339 | //datetimes! |
340 | 340 | $dtt_count = $DTT->count(); |
341 | - if ( $dtt_count > 0 ) |
|
342 | - update_option( 'uxip_ee_all_dtts_count', $dtt_count ); |
|
341 | + if ($dtt_count > 0) |
|
342 | + update_option('uxip_ee_all_dtts_count', $dtt_count); |
|
343 | 343 | |
344 | 344 | |
345 | 345 | //dttsold |
346 | 346 | $dtt_sold = $DTT->sum(array(), 'DTT_sold'); |
347 | - if ( $dtt_sold > 0 ) |
|
348 | - update_option( 'uxip_ee_dtt_sold', $dtt_sold ); |
|
347 | + if ($dtt_sold > 0) |
|
348 | + update_option('uxip_ee_dtt_sold', $dtt_sold); |
|
349 | 349 | |
350 | 350 | //allticketcount |
351 | 351 | $all_tkt_count = $TKT->count(); |
352 | - if ( $all_tkt_count > 0 ) |
|
353 | - update_option( 'uxip_ee_all_tkt_count', $all_tkt_count ); |
|
352 | + if ($all_tkt_count > 0) |
|
353 | + update_option('uxip_ee_all_tkt_count', $all_tkt_count); |
|
354 | 354 | |
355 | 355 | //freetktcount |
356 | - $_where = array( 'TKT_price' => 0 ); |
|
356 | + $_where = array('TKT_price' => 0); |
|
357 | 357 | $free_tkt_count = $TKT->count(array($_where)); |
358 | - if ( $free_tkt_count > 0 ) |
|
359 | - update_option( 'uxip_ee_free_tkt_count', $free_tkt_count ); |
|
358 | + if ($free_tkt_count > 0) |
|
359 | + update_option('uxip_ee_free_tkt_count', $free_tkt_count); |
|
360 | 360 | |
361 | 361 | //paidtktcount |
362 | - $_where = array( 'TKT_price' => array('>', 0) ); |
|
363 | - $paid_tkt_count = $TKT->count( array( $_where ) ); |
|
364 | - if ( $paid_tkt_count > 0 ) |
|
365 | - update_option( 'uxip_ee_paid_tkt_count', $paid_tkt_count ); |
|
362 | + $_where = array('TKT_price' => array('>', 0)); |
|
363 | + $paid_tkt_count = $TKT->count(array($_where)); |
|
364 | + if ($paid_tkt_count > 0) |
|
365 | + update_option('uxip_ee_paid_tkt_count', $paid_tkt_count); |
|
366 | 366 | |
367 | 367 | //tktsold |
368 | - $tkt_sold = $TKT->sum( array(), 'TKT_sold' ); |
|
369 | - if( $tkt_sold > 0 ) |
|
370 | - update_option( 'uxip_ee_tkt_sold', $tkt_sold ); |
|
368 | + $tkt_sold = $TKT->sum(array(), 'TKT_sold'); |
|
369 | + if ($tkt_sold > 0) |
|
370 | + update_option('uxip_ee_tkt_sold', $tkt_sold); |
|
371 | 371 | |
372 | 372 | |
373 | - set_transient( 'ee4_event_info_check', 1, WEEK_IN_SECONDS * 2 ); |
|
373 | + set_transient('ee4_event_info_check', 1, WEEK_IN_SECONDS * 2); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | */ |
14 | 14 | class EE_Payment_Processor extends EE_Processor_Base { |
15 | 15 | /** |
16 | - * @var EE_Payment_Processor $_instance |
|
16 | + * @var EE_Payment_Processor $_instance |
|
17 | 17 | * @access private |
18 | - */ |
|
18 | + */ |
|
19 | 19 | private static $_instance = NULL; |
20 | 20 | |
21 | 21 | |
@@ -48,9 +48,8 @@ discard block |
||
48 | 48 | |
49 | 49 | |
50 | 50 | /** |
51 | - |
|
52 | 51 | * Using the selected gateway, processes the payment for that transaction, and updates the transaction appropriately. |
53 | - * Saves the payment that is generated |
|
52 | + * Saves the payment that is generated |
|
54 | 53 | * |
55 | 54 | * @param EE_Payment_Method $payment_method |
56 | 55 | * @param EE_Transaction $transaction |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | EE_Processor_Base::set_IPN( $separate_IPN_request ); |
149 | 149 | if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){ |
150 | 150 | $obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) ); |
151 | - }elseif( $payment_method instanceof EE_Payment ){ |
|
151 | + } elseif( $payment_method instanceof EE_Payment ){ |
|
152 | 152 | $obj_for_log = $payment_method; |
153 | - }elseif( $transaction instanceof EE_Transaction ){ |
|
153 | + } elseif( $transaction instanceof EE_Transaction ){ |
|
154 | 154 | $obj_for_log = $transaction; |
155 | - }else{ |
|
155 | + } else{ |
|
156 | 156 | $obj_for_log = null; |
157 | 157 | } |
158 | 158 | $log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | __FILE__, __FUNCTION__, __LINE__ |
181 | 181 | ); |
182 | 182 | } |
183 | - }else{ |
|
183 | + } else{ |
|
184 | 184 | //that's actually pretty ok. The IPN just wasn't able |
185 | 185 | //to identify which transaction or payment method this was for |
186 | 186 | // give all active payment methods a chance to claim it |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | $payment->save(); |
202 | 202 | // update the TXN |
203 | 203 | $this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request ); |
204 | - }else{ |
|
204 | + } else{ |
|
205 | 205 | //we couldn't find the payment for this IPN... let's try and log at least SOMETHING |
206 | 206 | if($payment_method){ |
207 | 207 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method); |
208 | - }elseif($transaction){ |
|
208 | + } elseif($transaction){ |
|
209 | 209 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction); |
210 | 210 | } |
211 | 211 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | foreach( $request_data as $key => $value ) { |
237 | 237 | $return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value ); |
238 | 238 | } |
239 | - }else{ |
|
239 | + } else{ |
|
240 | 240 | $return_data = preg_replace('/[^[:print:]]/', '', $request_data); |
241 | 241 | } |
242 | 242 | return $return_data; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * EE_Payment_Processor |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public static function instance() { |
29 | 29 | // check if class object is instantiated |
30 | - if ( ! self::$_instance instanceof EE_Payment_Processor ) { |
|
30 | + if ( ! self::$_instance instanceof EE_Payment_Processor) { |
|
31 | 31 | self::$_instance = new self(); |
32 | 32 | } |
33 | 33 | return self::$_instance; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | *@return EE_Payment_Processor |
43 | 43 | */ |
44 | 44 | private function __construct() { |
45 | - do_action( 'AHEE__EE_Payment_Processor__construct' ); |
|
45 | + do_action('AHEE__EE_Payment_Processor__construct'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -64,42 +64,42 @@ discard block |
||
64 | 64 | * @param string $cancel_url URL to return to if off-site payments are cancelled |
65 | 65 | * @return EE_Payment |
66 | 66 | */ |
67 | - public function process_payment( EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE, $cancel_url = '' ) { |
|
68 | - if( $amount < 0 ) { |
|
67 | + public function process_payment(EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE, $cancel_url = '') { |
|
68 | + if ($amount < 0) { |
|
69 | 69 | throw new EE_Error( |
70 | 70 | sprintf( |
71 | - __( 'Attempting to make a payment for a negative amount of %1$d for transaction %2$d. That should be a refund', 'event_espresso' ), |
|
71 | + __('Attempting to make a payment for a negative amount of %1$d for transaction %2$d. That should be a refund', 'event_espresso'), |
|
72 | 72 | $amount, |
73 | 73 | $transaction->ID() ) ); |
74 | 74 | } |
75 | 75 | // verify payment method |
76 | - $payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE ); |
|
76 | + $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE); |
|
77 | 77 | // verify transaction |
78 | - EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
79 | - $transaction->set_payment_method_ID( $payment_method->ID() ); |
|
78 | + EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
79 | + $transaction->set_payment_method_ID($payment_method->ID()); |
|
80 | 80 | // verify payment method type |
81 | - if ( $payment_method->type_obj() instanceof EE_PMT_Base ){ |
|
81 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
82 | 82 | $payment = $payment_method->type_obj()->process_payment( |
83 | 83 | $transaction, |
84 | - min( $amount, $transaction->remaining() ),//make sure we don't overcharge |
|
84 | + min($amount, $transaction->remaining()), //make sure we don't overcharge |
|
85 | 85 | $billing_form, |
86 | 86 | $return_url, |
87 | - add_query_arg( array( 'ee_cancel_payment' => true ), $cancel_url ), |
|
87 | + add_query_arg(array('ee_cancel_payment' => true), $cancel_url), |
|
88 | 88 | $method, |
89 | 89 | $by_admin |
90 | 90 | ); |
91 | 91 | // check if payment method uses an off-site gateway |
92 | - if ( $payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite ) { |
|
92 | + if ($payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite) { |
|
93 | 93 | // don't process payments for off-site gateways yet because no payment has occurred yet |
94 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn ); |
|
94 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn); |
|
95 | 95 | } |
96 | 96 | return $payment; |
97 | 97 | } else { |
98 | 98 | EE_Error::add_error( |
99 | 99 | sprintf( |
100 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
100 | + __('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
101 | 101 | '<br/>', |
102 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
102 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
103 | 103 | ), __FILE__, __FUNCTION__, __LINE__ |
104 | 104 | ); |
105 | 105 | return NULL; |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | * @throws EE_Error |
116 | 116 | * @return string |
117 | 117 | */ |
118 | - public function get_ipn_url_for_payment_method( $transaction, $payment_method ){ |
|
118 | + public function get_ipn_url_for_payment_method($transaction, $payment_method) { |
|
119 | 119 | /** @type EE_Transaction $transaction */ |
120 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
120 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
121 | 121 | $primary_reg = $transaction->primary_registration(); |
122 | - if( ! $primary_reg instanceof EE_Registration ){ |
|
123 | - throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"),$transaction->ID())); |
|
122 | + if ( ! $primary_reg instanceof EE_Registration) { |
|
123 | + throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"), $transaction->ID())); |
|
124 | 124 | } |
125 | - $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true); |
|
125 | + $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true); |
|
126 | 126 | $url = add_query_arg( |
127 | 127 | array( |
128 | 128 | 'e_reg_url_link'=>$primary_reg->reg_url_link(), |
@@ -149,81 +149,81 @@ discard block |
||
149 | 149 | * @throws Exception |
150 | 150 | * @return EE_Payment |
151 | 151 | */ |
152 | - public function process_ipn( $_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true ){ |
|
153 | - $_req_data = $this->_remove_unusable_characters( $_req_data ); |
|
154 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
155 | - EE_Processor_Base::set_IPN( $separate_IPN_request ); |
|
156 | - if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){ |
|
157 | - $obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) ); |
|
158 | - }elseif( $payment_method instanceof EE_Payment ){ |
|
152 | + public function process_ipn($_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true) { |
|
153 | + $_req_data = $this->_remove_unusable_characters($_req_data); |
|
154 | + EE_Registry::instance()->load_model('Change_Log'); |
|
155 | + EE_Processor_Base::set_IPN($separate_IPN_request); |
|
156 | + if ($transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method) { |
|
157 | + $obj_for_log = EEM_Payment::instance()->get_one(array(array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()), 'order_by' => array('PAY_timestamp' => 'desc'))); |
|
158 | + }elseif ($payment_method instanceof EE_Payment) { |
|
159 | 159 | $obj_for_log = $payment_method; |
160 | - }elseif( $transaction instanceof EE_Transaction ){ |
|
160 | + }elseif ($transaction instanceof EE_Transaction) { |
|
161 | 161 | $obj_for_log = $transaction; |
162 | - }else{ |
|
162 | + } else { |
|
163 | 163 | $obj_for_log = null; |
164 | 164 | } |
165 | 165 | $log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log); |
166 | - try{ |
|
166 | + try { |
|
167 | 167 | /** |
168 | 168 | * @var EE_Payment $payment |
169 | 169 | */ |
170 | 170 | $payment = NULL; |
171 | - if($transaction && $payment_method){ |
|
171 | + if ($transaction && $payment_method) { |
|
172 | 172 | /** @type EE_Transaction $transaction */ |
173 | 173 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
174 | 174 | /** @type EE_Payment_Method $payment_method */ |
175 | 175 | $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method); |
176 | - if ( $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
177 | - $payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction ); |
|
176 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
177 | + $payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction); |
|
178 | 178 | $log->set_object($payment); |
179 | 179 | } else { |
180 | 180 | // not a payment |
181 | 181 | EE_Error::add_error( |
182 | 182 | sprintf( |
183 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ), |
|
183 | + __('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'), |
|
184 | 184 | '<br/>', |
185 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
185 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
186 | 186 | ), |
187 | 187 | __FILE__, __FUNCTION__, __LINE__ |
188 | 188 | ); |
189 | 189 | } |
190 | - }else{ |
|
190 | + } else { |
|
191 | 191 | //that's actually pretty ok. The IPN just wasn't able |
192 | 192 | //to identify which transaction or payment method this was for |
193 | 193 | // give all active payment methods a chance to claim it |
194 | 194 | $active_pms = EEM_Payment_Method::instance()->get_all_active(); |
195 | - foreach( $active_pms as $payment_method ){ |
|
196 | - try{ |
|
197 | - $payment = $payment_method->type_obj()->handle_unclaimed_ipn( $_req_data ); |
|
195 | + foreach ($active_pms as $payment_method) { |
|
196 | + try { |
|
197 | + $payment = $payment_method->type_obj()->handle_unclaimed_ipn($_req_data); |
|
198 | 198 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment); |
199 | 199 | break; |
200 | - } catch( EE_Error $e ) { |
|
200 | + } catch (EE_Error $e) { |
|
201 | 201 | //that's fine- it apparently couldn't handle the IPN |
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
205 | 205 | } |
206 | 206 | // EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method); |
207 | - if( $payment instanceof EE_Payment){ |
|
207 | + if ($payment instanceof EE_Payment) { |
|
208 | 208 | $payment->save(); |
209 | 209 | // update the TXN |
210 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request ); |
|
211 | - }else{ |
|
210 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request); |
|
211 | + } else { |
|
212 | 212 | //we couldn't find the payment for this IPN... let's try and log at least SOMETHING |
213 | - if($payment_method){ |
|
213 | + if ($payment_method) { |
|
214 | 214 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method); |
215 | - }elseif($transaction){ |
|
215 | + }elseif ($transaction) { |
|
216 | 216 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction); |
217 | 217 | } |
218 | 218 | } |
219 | 219 | return $payment; |
220 | 220 | |
221 | - } catch( EE_Error $e ) { |
|
221 | + } catch (EE_Error $e) { |
|
222 | 222 | do_action( |
223 | 223 | 'AHEE__log', __FILE__, __FUNCTION__, sprintf( |
224 | - __( 'Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso' ), |
|
225 | - print_r( $transaction, TRUE ), |
|
226 | - print_r( $_req_data, TRUE ), |
|
224 | + __('Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso'), |
|
225 | + print_r($transaction, TRUE), |
|
226 | + print_r($_req_data, TRUE), |
|
227 | 227 | $e->getMessage() |
228 | 228 | ) |
229 | 229 | ); |
@@ -237,14 +237,14 @@ discard block |
||
237 | 237 | * @param array $request_data |
238 | 238 | * @return array|string |
239 | 239 | */ |
240 | - protected function _remove_unusable_characters( $request_data ) { |
|
241 | - if( is_array( $request_data ) ) { |
|
240 | + protected function _remove_unusable_characters($request_data) { |
|
241 | + if (is_array($request_data)) { |
|
242 | 242 | $return_data = array(); |
243 | - foreach( $request_data as $key => $value ) { |
|
244 | - $return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value ); |
|
243 | + foreach ($request_data as $key => $value) { |
|
244 | + $return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value); |
|
245 | 245 | } |
246 | - }else{ |
|
247 | - $return_data = preg_replace('/[^[:print:]]/', '', $request_data); |
|
246 | + } else { |
|
247 | + $return_data = preg_replace('/[^[:print:]]/', '', $request_data); |
|
248 | 248 | } |
249 | 249 | return $return_data; |
250 | 250 | } |
@@ -266,13 +266,13 @@ discard block |
||
266 | 266 | * @return EE_Payment |
267 | 267 | * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO, to call handle_ipn() for offsite gateways that don't receive separate IPNs |
268 | 268 | */ |
269 | - public function finalize_payment_for( $transaction, $update_txn = TRUE ){ |
|
269 | + public function finalize_payment_for($transaction, $update_txn = TRUE) { |
|
270 | 270 | /** @var $transaction EE_Transaction */ |
271 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
271 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
272 | 272 | $last_payment_method = $transaction->payment_method(); |
273 | - if ( $last_payment_method instanceof EE_Payment_Method ) { |
|
274 | - $payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction ); |
|
275 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn ); |
|
273 | + if ($last_payment_method instanceof EE_Payment_Method) { |
|
274 | + $payment = $last_payment_method->type_obj()->finalize_payment_for($transaction); |
|
275 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn); |
|
276 | 276 | return $payment; |
277 | 277 | } else { |
278 | 278 | return NULL; |
@@ -289,10 +289,10 @@ discard block |
||
289 | 289 | * @internal param float $amount |
290 | 290 | * @return EE_Payment |
291 | 291 | */ |
292 | - public function process_refund( EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array() ){ |
|
293 | - if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds() ) { |
|
294 | - $payment_method->type_obj()->process_refund( $payment_to_refund, $refund_info ); |
|
295 | - $this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund ); |
|
292 | + public function process_refund(EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array()) { |
|
293 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) { |
|
294 | + $payment_method->type_obj()->process_refund($payment_to_refund, $refund_info); |
|
295 | + $this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund); |
|
296 | 296 | } |
297 | 297 | return $payment_to_refund; |
298 | 298 | } |
@@ -334,12 +334,12 @@ discard block |
||
334 | 334 | * TXN is locked before updating |
335 | 335 | * @throws \EE_Error |
336 | 336 | */ |
337 | - public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){ |
|
337 | + public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) { |
|
338 | 338 | $do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful'; |
339 | 339 | /** @type EE_Transaction $transaction */ |
340 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
340 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
341 | 341 | // can we freely update the TXN at this moment? |
342 | - if ( $IPN && $transaction->is_locked() ) { |
|
342 | + if ($IPN && $transaction->is_locked()) { |
|
343 | 343 | // don't update the transaction at this exact moment |
344 | 344 | // because the TXN is active in another request |
345 | 345 | EE_Cron_Tasks::schedule_update_transaction_with_payment( |
@@ -349,40 +349,40 @@ discard block |
||
349 | 349 | ); |
350 | 350 | } else { |
351 | 351 | // verify payment and that it has been saved |
352 | - if ( $payment instanceof EE_Payment && $payment->ID() ) { |
|
353 | - if( $payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base ){ |
|
354 | - $payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment ); |
|
352 | + if ($payment instanceof EE_Payment && $payment->ID()) { |
|
353 | + if ($payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base) { |
|
354 | + $payment->payment_method()->type_obj()->update_txn_based_on_payment($payment); |
|
355 | 355 | // update TXN registrations with payment info |
356 | - $this->process_registration_payments( $transaction, $payment ); |
|
356 | + $this->process_registration_payments($transaction, $payment); |
|
357 | 357 | } |
358 | 358 | $do_action = $payment->just_approved() ? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful' : $do_action; |
359 | 359 | } else { |
360 | 360 | // send out notifications |
361 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
361 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
362 | 362 | $do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made'; |
363 | 363 | } |
364 | 364 | // if this is an IPN, then we want to know the initial TXN status prior to updating the TXN |
365 | 365 | // so that we know whether the status has changed and notifications should be triggered |
366 | - if ( $IPN ) { |
|
366 | + if ($IPN) { |
|
367 | 367 | /** @type EE_Transaction_Processor $transaction_processor */ |
368 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
369 | - $transaction_processor->set_old_txn_status( $transaction->status_ID() ); |
|
368 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
369 | + $transaction_processor->set_old_txn_status($transaction->status_ID()); |
|
370 | 370 | } |
371 | - if ( $payment->status() !== EEM_Payment::status_id_failed ) { |
|
371 | + if ($payment->status() !== EEM_Payment::status_id_failed) { |
|
372 | 372 | /** @type EE_Transaction_Payments $transaction_payments */ |
373 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
373 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
374 | 374 | // set new value for total paid |
375 | - $transaction_payments->calculate_total_payments_and_update_status( $transaction ); |
|
375 | + $transaction_payments->calculate_total_payments_and_update_status($transaction); |
|
376 | 376 | // call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ??? |
377 | - if ( $update_txn ) { |
|
378 | - $this->_post_payment_processing( $transaction, $payment, $IPN ); |
|
377 | + if ($update_txn) { |
|
378 | + $this->_post_payment_processing($transaction, $payment, $IPN); |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | // granular hook for others to use. |
382 | - do_action( $do_action, $transaction, $payment ); |
|
383 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action' ); |
|
382 | + do_action($do_action, $transaction, $payment); |
|
383 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action'); |
|
384 | 384 | //global hook for others to use. |
385 | - do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment ); |
|
385 | + do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment); |
|
386 | 386 | } |
387 | 387 | } |
388 | 388 | |
@@ -396,25 +396,25 @@ discard block |
||
396 | 396 | * @param EE_Registration[] $registrations |
397 | 397 | * @throws \EE_Error |
398 | 398 | */ |
399 | - public function process_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $registrations = array() ) { |
|
399 | + public function process_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $registrations = array()) { |
|
400 | 400 | // only process if payment was successful |
401 | - if ( $payment->status() !== EEM_Payment::status_id_approved ) { |
|
401 | + if ($payment->status() !== EEM_Payment::status_id_approved) { |
|
402 | 402 | return; |
403 | 403 | } |
404 | 404 | //EEM_Registration::instance()->show_next_x_db_queries(); |
405 | - if ( empty( $registrations )) { |
|
405 | + if (empty($registrations)) { |
|
406 | 406 | // find registrations with monies owing that can receive a payment |
407 | - $registrations = $transaction->registrations( array( |
|
407 | + $registrations = $transaction->registrations(array( |
|
408 | 408 | array( |
409 | 409 | // only these reg statuses can receive payments |
410 | - 'STS_ID' => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ), |
|
411 | - 'REG_final_price' => array( '!=', 0 ), |
|
412 | - 'REG_final_price*' => array( '!=', 'REG_paid', true ), |
|
410 | + 'STS_ID' => array('IN', EEM_Registration::reg_statuses_that_allow_payment()), |
|
411 | + 'REG_final_price' => array('!=', 0), |
|
412 | + 'REG_final_price*' => array('!=', 'REG_paid', true), |
|
413 | 413 | ) |
414 | - ) ); |
|
414 | + )); |
|
415 | 415 | } |
416 | 416 | // still nothing ??!?? |
417 | - if ( empty( $registrations )) { |
|
417 | + if (empty($registrations)) { |
|
418 | 418 | return; |
419 | 419 | } |
420 | 420 | // todo: break out the following logic into a separate strategy class |
@@ -426,28 +426,28 @@ discard block |
||
426 | 426 | |
427 | 427 | $refund = $payment->is_a_refund(); |
428 | 428 | // how much is available to apply to registrations? |
429 | - $available_payment_amount = abs( $payment->amount() ); |
|
430 | - foreach ( $registrations as $registration ) { |
|
431 | - if ( $registration instanceof EE_Registration ) { |
|
429 | + $available_payment_amount = abs($payment->amount()); |
|
430 | + foreach ($registrations as $registration) { |
|
431 | + if ($registration instanceof EE_Registration) { |
|
432 | 432 | // nothing left? |
433 | - if ( $available_payment_amount <= 0 ) { |
|
433 | + if ($available_payment_amount <= 0) { |
|
434 | 434 | break; |
435 | 435 | } |
436 | - if ( $refund ) { |
|
437 | - $available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount ); |
|
436 | + if ($refund) { |
|
437 | + $available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount); |
|
438 | 438 | } else { |
439 | - $available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount ); |
|
439 | + $available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount); |
|
440 | 440 | } |
441 | 441 | } |
442 | 442 | } |
443 | - if ( $available_payment_amount > 0 && apply_filters( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false ) ) { |
|
443 | + if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) { |
|
444 | 444 | EE_Error::add_attention( |
445 | 445 | sprintf( |
446 | - __( 'A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso' ), |
|
447 | - EEH_Template::format_currency( $available_payment_amount ), |
|
448 | - implode( ', ', array_keys( $registrations ) ), |
|
446 | + __('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'), |
|
447 | + EEH_Template::format_currency($available_payment_amount), |
|
448 | + implode(', ', array_keys($registrations)), |
|
449 | 449 | '<br/>', |
450 | - EEH_Template::format_currency( $payment->amount() ) |
|
450 | + EEH_Template::format_currency($payment->amount()) |
|
451 | 451 | ), |
452 | 452 | __FILE__, __FUNCTION__, __LINE__ |
453 | 453 | ); |
@@ -464,17 +464,17 @@ discard block |
||
464 | 464 | * @param float $available_payment_amount |
465 | 465 | * @return float |
466 | 466 | */ |
467 | - public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) { |
|
467 | + public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) { |
|
468 | 468 | $owing = $registration->final_price() - $registration->paid(); |
469 | - if ( $owing > 0 ) { |
|
469 | + if ($owing > 0) { |
|
470 | 470 | // don't allow payment amount to exceed the available payment amount, OR the amount owing |
471 | - $payment_amount = min( $available_payment_amount, $owing ); |
|
471 | + $payment_amount = min($available_payment_amount, $owing); |
|
472 | 472 | // update $available_payment_amount |
473 | 473 | $available_payment_amount = $available_payment_amount - $payment_amount; |
474 | 474 | //calculate and set new REG_paid |
475 | - $registration->set_paid( $registration->paid() + $payment_amount ); |
|
475 | + $registration->set_paid($registration->paid() + $payment_amount); |
|
476 | 476 | // now save it |
477 | - $this->_apply_registration_payment( $registration, $payment, $payment_amount ); |
|
477 | + $this->_apply_registration_payment($registration, $payment, $payment_amount); |
|
478 | 478 | } |
479 | 479 | return $available_payment_amount; |
480 | 480 | } |
@@ -489,19 +489,19 @@ discard block |
||
489 | 489 | * @param float $payment_amount |
490 | 490 | * @return float |
491 | 491 | */ |
492 | - protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) { |
|
492 | + protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) { |
|
493 | 493 | // find any existing reg payment records for this registration and payment |
494 | 494 | $existing_reg_payment = EEM_Registration_Payment::instance()->get_one( |
495 | - array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) ) |
|
495 | + array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID())) |
|
496 | 496 | ); |
497 | 497 | // if existing registration payment exists |
498 | - if ( $existing_reg_payment instanceof EE_Registration_Payment ) { |
|
498 | + if ($existing_reg_payment instanceof EE_Registration_Payment) { |
|
499 | 499 | // then update that record |
500 | - $existing_reg_payment->set_amount( $payment_amount ); |
|
500 | + $existing_reg_payment->set_amount($payment_amount); |
|
501 | 501 | $existing_reg_payment->save(); |
502 | 502 | } else { |
503 | 503 | // or add new relation between registration and payment and set amount |
504 | - $registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) ); |
|
504 | + $registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount)); |
|
505 | 505 | // make it stick |
506 | 506 | $registration->save(); |
507 | 507 | } |
@@ -517,21 +517,21 @@ discard block |
||
517 | 517 | * @param float $available_refund_amount - IMPORTANT !!! SEND AVAILABLE REFUND AMOUNT AS A POSITIVE NUMBER |
518 | 518 | * @return float |
519 | 519 | */ |
520 | - public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) { |
|
520 | + public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) { |
|
521 | 521 | //EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ ); |
522 | - if ( $registration->paid() > 0 ) { |
|
522 | + if ($registration->paid() > 0) { |
|
523 | 523 | // ensure $available_refund_amount is NOT negative |
524 | - $available_refund_amount = abs( $available_refund_amount ); |
|
524 | + $available_refund_amount = abs($available_refund_amount); |
|
525 | 525 | // don't allow refund amount to exceed the available payment amount, OR the amount paid |
526 | - $refund_amount = min( $available_refund_amount, $registration->paid() ); |
|
526 | + $refund_amount = min($available_refund_amount, $registration->paid()); |
|
527 | 527 | // update $available_payment_amount |
528 | 528 | $available_refund_amount = $available_refund_amount - $refund_amount; |
529 | 529 | //calculate and set new REG_paid |
530 | - $registration->set_paid( $registration->paid() - $refund_amount ); |
|
530 | + $registration->set_paid($registration->paid() - $refund_amount); |
|
531 | 531 | // convert payment amount back to a negative value for storage in the db |
532 | - $refund_amount = abs( $refund_amount ) * -1; |
|
532 | + $refund_amount = abs($refund_amount) * -1; |
|
533 | 533 | // now save it |
534 | - $this->_apply_registration_payment( $registration, $payment, $refund_amount ); |
|
534 | + $this->_apply_registration_payment($registration, $payment, $refund_amount); |
|
535 | 535 | } |
536 | 536 | return $available_refund_amount; |
537 | 537 | } |
@@ -549,12 +549,12 @@ discard block |
||
549 | 549 | * @param EE_Payment $payment |
550 | 550 | * @param bool $IPN |
551 | 551 | */ |
552 | - protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) { |
|
552 | + protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) { |
|
553 | 553 | |
554 | 554 | /** @type EE_Transaction_Processor $transaction_processor */ |
555 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
555 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
556 | 556 | // is the Payment Options Reg Step completed ? |
557 | - $payment_options_step_completed = $transaction_processor->reg_step_completed( $transaction, 'payment_options' ); |
|
557 | + $payment_options_step_completed = $transaction_processor->reg_step_completed($transaction, 'payment_options'); |
|
558 | 558 | // DEBUG LOG |
559 | 559 | //$this->log( |
560 | 560 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -567,14 +567,14 @@ discard block |
||
567 | 567 | // if the Payment Options Reg Step is completed... |
568 | 568 | $revisit = $payment_options_step_completed === true ? true : false; |
569 | 569 | // then this is kinda sorta a revisit with regards to payments at least |
570 | - $transaction_processor->set_revisit( $revisit ); |
|
570 | + $transaction_processor->set_revisit($revisit); |
|
571 | 571 | // if this is an IPN, let's consider the Payment Options Reg Step completed if not already |
572 | 572 | if ( |
573 | 573 | $IPN && |
574 | 574 | $payment_options_step_completed !== true && |
575 | - ( $payment->is_approved() || $payment->is_pending() ) |
|
575 | + ($payment->is_approved() || $payment->is_pending()) |
|
576 | 576 | ) { |
577 | - $payment_options_step_completed = $transaction_processor->set_reg_step_completed( $transaction, 'payment_options' ); |
|
577 | + $payment_options_step_completed = $transaction_processor->set_reg_step_completed($transaction, 'payment_options'); |
|
578 | 578 | } |
579 | 579 | // DEBUG LOG |
580 | 580 | //$this->log( |
@@ -586,11 +586,11 @@ discard block |
||
586 | 586 | // ) |
587 | 587 | //); |
588 | 588 | /** @type EE_Transaction_Payments $transaction_payments */ |
589 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
589 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
590 | 590 | // maybe update status, but don't save transaction just yet |
591 | - $transaction_payments->update_transaction_status_based_on_total_paid( $transaction, false ); |
|
591 | + $transaction_payments->update_transaction_status_based_on_total_paid($transaction, false); |
|
592 | 592 | // check if 'finalize_registration' step has been completed... |
593 | - $finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' ); |
|
593 | + $finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration'); |
|
594 | 594 | // DEBUG LOG |
595 | 595 | //$this->log( |
596 | 596 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -601,9 +601,9 @@ discard block |
||
601 | 601 | // ) |
602 | 602 | //); |
603 | 603 | // if this is an IPN and the final step has not been initiated |
604 | - if ( $IPN && $payment_options_step_completed && $finalized === false ) { |
|
604 | + if ($IPN && $payment_options_step_completed && $finalized === false) { |
|
605 | 605 | // and if it hasn't already been set as being started... |
606 | - $finalized = $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' ); |
|
606 | + $finalized = $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration'); |
|
607 | 607 | // DEBUG LOG |
608 | 608 | //$this->log( |
609 | 609 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -616,13 +616,13 @@ discard block |
||
616 | 616 | } |
617 | 617 | $transaction->save(); |
618 | 618 | // because the above will return false if the final step was not fully completed, we need to check again... |
619 | - if ( $IPN && $finalized !== false ) { |
|
619 | + if ($IPN && $finalized !== false) { |
|
620 | 620 | // and if we are all good to go, then send out notifications |
621 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
621 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
622 | 622 | // DEBUG LOG |
623 | 623 | //$this->log( __CLASS__, __FUNCTION__, __LINE__, $transaction ); |
624 | 624 | //ok, now process the transaction according to the payment |
625 | - $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment ); |
|
625 | + $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment); |
|
626 | 626 | } |
627 | 627 | // DEBUG LOG |
628 | 628 | //$this->log( |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function do_initial_loads() { |
33 | 33 | //we want to use the corresponding admin page object (but not route it!). To do this we just set _routing to false. That way this page object is being loaded on all pages to make sure we hook into admin properly. But note... we are ONLY doing this if the given page is NOT pages we WANT to load ;) |
34 | 34 | //This is important because we have hooks that help redirect custom post type saves |
35 | - if ( !isset( $_REQUEST['page'] ) || ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] != $this->_menu_map->menu_slug ) ) { |
|
35 | + if ( ! isset($_REQUEST['page']) || (isset($_REQUEST['page']) && $_REQUEST['page'] != $this->_menu_map->menu_slug)) { |
|
36 | 36 | $this->_routing = FALSE; |
37 | 37 | $this->_initialize_admin_page(); |
38 | 38 | } else { |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | $this->_initialize_admin_page(); |
41 | 41 | //added for 4.1 to completely disable autosave for our pages. This can be removed once we fully enable autosave functionality |
42 | 42 | remove_filter('wp_print_scripts', 'wp_just_in_time_script_localization'); |
43 | - add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100 ); |
|
43 | + add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100); |
|
44 | 44 | //end removal of autosave functionality. |
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | 48 | public function wp_just_in_time_script_localization() { |
49 | - wp_localize_script( 'autosave', 'autosaveL10n', array( |
|
49 | + wp_localize_script('autosave', 'autosaveL10n', array( |
|
50 | 50 | 'autosaveInterval' => 172800, |
51 | 51 | 'savingText' => __('Saving Draft…'), |
52 | 52 | 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.') |
53 | - ) ); |
|
53 | + )); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | //let's do a scan and see what installed pages we have |
120 | 120 | $this->_get_installed_pages(); |
121 | 121 | //set menus (has to be done on every load - we're not actually loading the page just setting the menus and where they point to). |
122 | - add_action('admin_menu', array( $this, 'set_menus' )); |
|
123 | - add_action( 'network_admin_menu', array( $this, 'set_network_menus' ) ); |
|
122 | + add_action('admin_menu', array($this, 'set_menus')); |
|
123 | + add_action('network_admin_menu', array($this, 'set_network_menus')); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | * @return void |
134 | 134 | */ |
135 | 135 | private function _define_caffeinated_constants() { |
136 | - if ( ! defined( 'EE_CORE_CAF_ADMIN' ) ) { |
|
137 | - define( 'EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH . 'caffeinated/admin/'); |
|
138 | - define( 'EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL . 'caffeinated/admin/'); |
|
139 | - define( 'EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN . 'new/'); |
|
140 | - define( 'EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN . 'extend/'); |
|
141 | - define( 'EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL . 'extend/'); |
|
142 | - define( 'EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN . 'hooks/'); |
|
136 | + if ( ! defined('EE_CORE_CAF_ADMIN')) { |
|
137 | + define('EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH.'caffeinated/admin/'); |
|
138 | + define('EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL.'caffeinated/admin/'); |
|
139 | + define('EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN.'new/'); |
|
140 | + define('EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN.'extend/'); |
|
141 | + define('EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL.'extend/'); |
|
142 | + define('EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN.'hooks/'); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | //set array of EE_Admin_Page_Menu_Group objects |
160 | 160 | $groups = array( |
161 | - 'main' => new EE_Admin_Page_Menu_Group( array( |
|
161 | + 'main' => new EE_Admin_Page_Menu_Group(array( |
|
162 | 162 | 'menu_label' => __('Main', 'event_espresso'), |
163 | 163 | 'show_on_menu' => EE_Admin_Page_Menu_Map::NONE, |
164 | 164 | 'menu_slug' => 'main', |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | 'menu_order' => 0, |
167 | 167 | 'parent_slug' => 'espresso_events', |
168 | 168 | )), |
169 | - 'management' => new EE_Admin_Page_Menu_Group( array( |
|
169 | + 'management' => new EE_Admin_Page_Menu_Group(array( |
|
170 | 170 | 'menu_label' => __('Management', 'event_espresso'), |
171 | 171 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
172 | 172 | 'menu_slug' => 'management', |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | 'menu_order' => 10, |
175 | 175 | 'parent_slug' => 'espresso_events' |
176 | 176 | )), |
177 | - 'settings' => new EE_Admin_Page_Menu_Group( array( |
|
177 | + 'settings' => new EE_Admin_Page_Menu_Group(array( |
|
178 | 178 | 'menu_label' => __('Settings', 'event_espresso'), |
179 | 179 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
180 | 180 | 'menu_slug' => 'settings', |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | 'menu_order' => 30, |
183 | 183 | 'parent_slug' => 'espresso_events' |
184 | 184 | )), |
185 | - 'templates' => new EE_Admin_Page_Menu_Group( array( |
|
185 | + 'templates' => new EE_Admin_Page_Menu_Group(array( |
|
186 | 186 | 'menu_label' => __('Templates', 'event_espresso'), |
187 | 187 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
188 | 188 | 'menu_slug' => 'templates', |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | 'menu_order' => 40, |
191 | 191 | 'parent_slug' => 'espresso_events' |
192 | 192 | )), |
193 | - 'extras' => new EE_Admin_Page_Menu_Group( array( |
|
193 | + 'extras' => new EE_Admin_Page_Menu_Group(array( |
|
194 | 194 | 'menu_label' => __('Extras', 'event_espresso'), |
195 | 195 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN, |
196 | 196 | 'menu_slug' => 'extras', |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | 'parent_slug' => 'espresso_events', |
200 | 200 | 'maintenance_mode_parent' => 'espresso_maintenance_settings' |
201 | 201 | )), |
202 | - 'tools' => new EE_Admin_Page_Menu_Group( array( |
|
202 | + 'tools' => new EE_Admin_Page_Menu_Group(array( |
|
203 | 203 | 'menu_label' => __("Tools", "event_espresso"), |
204 | 204 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
205 | 205 | 'menu_slug' => 'tools', |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | 'menu_order' => 60, |
208 | 208 | 'parent_slug' => 'espresso_events' |
209 | 209 | )), |
210 | - 'addons' => new EE_Admin_Page_Menu_Group( array( |
|
210 | + 'addons' => new EE_Admin_Page_Menu_Group(array( |
|
211 | 211 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN, |
212 | 212 | 'menu_label' => __('Add-ons', 'event_espresso'), |
213 | 213 | 'menu_slug' => 'addons', |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | )) |
218 | 218 | ); |
219 | 219 | |
220 | - $this->_admin_menu_groups = apply_filters( 'FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups ); |
|
220 | + $this->_admin_menu_groups = apply_filters('FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | private function _rearrange_menu_groups() { |
236 | 236 | $groups = array(); |
237 | 237 | //first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects ) |
238 | - usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) ); |
|
239 | - foreach ( $this->_admin_menu_groups as $group ) { |
|
240 | - if ( ! $group instanceof EE_Admin_Page_Menu_Group ) |
|
241 | - throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups. All values in this array are required to be a EE_Admin_Page_Menu_Group object. Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) ); |
|
238 | + usort($this->_admin_menu_groups, array($this, '_sort_menu_maps')); |
|
239 | + foreach ($this->_admin_menu_groups as $group) { |
|
240 | + if ( ! $group instanceof EE_Admin_Page_Menu_Group) |
|
241 | + throw new EE_Error(sprintf(__('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups. All values in this array are required to be a EE_Admin_Page_Menu_Group object. Instead there was: %s', 'event_espresso'), print_r($group, TRUE))); |
|
242 | 242 | $groups[$group->menu_slug] = $group; |
243 | 243 | } |
244 | 244 | return $groups; |
@@ -256,48 +256,48 @@ discard block |
||
256 | 256 | */ |
257 | 257 | private function _get_installed_pages() { |
258 | 258 | $installed_refs = array(); |
259 | - $exclude = array( 'assets', 'templates' ); |
|
259 | + $exclude = array('assets', 'templates'); |
|
260 | 260 | // grab everything in the admin core directory |
261 | - $admin_screens = glob( EE_ADMIN_PAGES . '*', GLOB_ONLYDIR ); |
|
262 | - if ( $admin_screens ) { |
|
263 | - foreach( $admin_screens as $admin_screen ) { |
|
261 | + $admin_screens = glob(EE_ADMIN_PAGES.'*', GLOB_ONLYDIR); |
|
262 | + if ($admin_screens) { |
|
263 | + foreach ($admin_screens as $admin_screen) { |
|
264 | 264 | // files and anything in the exclude array need not apply |
265 | - if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) { |
|
265 | + if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) { |
|
266 | 266 | // these folders represent the different EE admin pages |
267 | - $installed_refs[ basename( $admin_screen ) ] = $admin_screen; |
|
267 | + $installed_refs[basename($admin_screen)] = $admin_screen; |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | } |
271 | 271 | |
272 | - if ( empty( $installed_refs ) ) { |
|
272 | + if (empty($installed_refs)) { |
|
273 | 273 | $error_msg[] = __('There are no EE_Admin pages detected, it looks like EE did not install properly', 'event_espresso'); |
274 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES ); |
|
275 | - throw new EE_Error( implode( '||', $error_msg )); |
|
274 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES); |
|
275 | + throw new EE_Error(implode('||', $error_msg)); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | //this just checks the caffeinated folder and takes care of setting up any caffeinated stuff. |
279 | 279 | $installed_refs = $this->_set_caffeinated($installed_refs); |
280 | 280 | //allow plugins to add in their own pages (note at this point they will need to have an autoloader defined for their class) OR hook into EEH_Autoloader::load_admin_page() to add their path.; |
281 | - $installed_refs = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs ); |
|
282 | - $this->_caffeinated_extends = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends ); |
|
281 | + $installed_refs = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs); |
|
282 | + $this->_caffeinated_extends = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends); |
|
283 | 283 | |
284 | 284 | //loop through admin pages and setup the $_installed_pages array. |
285 | 285 | $hooks_ref = array(); |
286 | - foreach ( $installed_refs as $page => $path ) { |
|
286 | + foreach ($installed_refs as $page => $path) { |
|
287 | 287 | // set autoloaders for our admin page classes based on included path information |
288 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $path ); |
|
288 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($path); |
|
289 | 289 | // build list of installed pages |
290 | - $this->_installed_pages[$page] = $this->_load_admin_page( $page, $path ); |
|
290 | + $this->_installed_pages[$page] = $this->_load_admin_page($page, $path); |
|
291 | 291 | // verify returned object |
292 | - if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) { |
|
293 | - if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map ) { |
|
292 | + if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) { |
|
293 | + if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map) { |
|
294 | 294 | continue; |
295 | 295 | } |
296 | 296 | |
297 | 297 | //skip if in full maintenance mode and maintenance_mode_parent is set |
298 | 298 | $maintenance_mode_parent = $this->_installed_pages[$page]->get_menu_map()->maintenance_mode_parent; |
299 | - if ( empty( $maintenance_mode_parent ) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
300 | - unset( $installed_refs[$page] ); |
|
299 | + if (empty($maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
300 | + unset($installed_refs[$page]); |
|
301 | 301 | continue; |
302 | 302 | } |
303 | 303 | |
@@ -305,45 +305,45 @@ discard block |
||
305 | 305 | //flag for register hooks on extended pages b/c extended pages use the default INIT. |
306 | 306 | $extend = FALSE; |
307 | 307 | //now that we've got the admin_init objects... lets see if there are any caffeinated pages extending the originals. If there are then let's hook into the init admin filter and load our extend instead. |
308 | - if ( isset( $this->_caffeinated_extends[$page] ) ) { |
|
308 | + if (isset($this->_caffeinated_extends[$page])) { |
|
309 | 309 | $this->_current_caf_extend_slug = $page; |
310 | - $path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name(); |
|
311 | - $path_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"] . '";'; |
|
312 | - $page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name(); |
|
313 | - $page_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"] . '";'; |
|
310 | + $path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name(); |
|
311 | + $path_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"].'";'; |
|
312 | + $page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name(); |
|
313 | + $page_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"].'";'; |
|
314 | 314 | |
315 | - $hook_function_path = create_function( '$path_to_file', $path_runtime); |
|
316 | - $hook_function_page = create_function( '$admin_page', $page_runtime ); |
|
315 | + $hook_function_path = create_function('$path_to_file', $path_runtime); |
|
316 | + $hook_function_page = create_function('$admin_page', $page_runtime); |
|
317 | 317 | |
318 | - add_filter( $path_hook, $hook_function_path ); |
|
319 | - add_filter( $page_hook, $hook_function_page ); |
|
318 | + add_filter($path_hook, $hook_function_path); |
|
319 | + add_filter($page_hook, $hook_function_page); |
|
320 | 320 | $extend = TRUE; |
321 | 321 | } |
322 | 322 | //let's do the registered hooks |
323 | - $extended_hooks = $this->_installed_pages[$page]->register_hooks( $extend ); |
|
323 | + $extended_hooks = $this->_installed_pages[$page]->register_hooks($extend); |
|
324 | 324 | $hooks_ref = array_merge($hooks_ref, $extended_hooks); |
325 | 325 | } |
326 | 326 | } |
327 | 327 | |
328 | 328 | //the hooks_ref is all the pages where we have $extended _Hooks files that will extend a class in a different folder. So we want to make sure we load the file for the parent. |
329 | 329 | //first make sure we've got unique values |
330 | - $hooks_ref = array_unique( $hooks_ref ); |
|
330 | + $hooks_ref = array_unique($hooks_ref); |
|
331 | 331 | //now let's loop and require! |
332 | - foreach ( $hooks_ref as $path ) { |
|
333 | - require_once( $path ); |
|
332 | + foreach ($hooks_ref as $path) { |
|
333 | + require_once($path); |
|
334 | 334 | } |
335 | 335 | //make sure we have menu slugs global setup. Used in EE_Admin_Page->page_setup() to ensure we don't do a full class load for an admin page that isn't requested. |
336 | 336 | global $ee_menu_slugs; |
337 | 337 | $ee_menu_slugs = $this->_menu_slugs; |
338 | 338 | |
339 | 339 | //we need to loop again to run any early code |
340 | - foreach ( $installed_refs as $page => $path ) { |
|
341 | - if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) { |
|
340 | + foreach ($installed_refs as $page => $path) { |
|
341 | + if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) { |
|
342 | 342 | $this->_installed_pages[$page]->do_initial_loads(); |
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
346 | - do_action( 'AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages ); |
|
346 | + do_action('AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages); |
|
347 | 347 | |
348 | 348 | } |
349 | 349 | |
@@ -355,9 +355,9 @@ discard block |
||
355 | 355 | * @param string $page_slug |
356 | 356 | * @return EE_Admin_Page |
357 | 357 | */ |
358 | - public function get_admin_page_object( $page_slug = '' ) { |
|
359 | - if ( isset( $this->_installed_pages[ $page_slug ] )) { |
|
360 | - return $this->_installed_pages[ $page_slug ]->loaded_page_object(); |
|
358 | + public function get_admin_page_object($page_slug = '') { |
|
359 | + if (isset($this->_installed_pages[$page_slug])) { |
|
360 | + return $this->_installed_pages[$page_slug]->loaded_page_object(); |
|
361 | 361 | } |
362 | 362 | return NULL; |
363 | 363 | } |
@@ -370,9 +370,9 @@ discard block |
||
370 | 370 | * @param $dir_name |
371 | 371 | * @return string |
372 | 372 | */ |
373 | - private function _get_classname_for_admin_page( $dir_name = '' ) { |
|
374 | - $class_name = str_replace( '_', ' ', strtolower( $dir_name )); |
|
375 | - return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page'; |
|
373 | + private function _get_classname_for_admin_page($dir_name = '') { |
|
374 | + $class_name = str_replace('_', ' ', strtolower($dir_name)); |
|
375 | + return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page'; |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -383,9 +383,9 @@ discard block |
||
383 | 383 | * @param $dir_name |
384 | 384 | * @return string |
385 | 385 | */ |
386 | - private function _get_classname_for_admin_init_page( $dir_name = '' ) { |
|
387 | - $class_name = str_replace( '_', ' ', strtolower( $dir_name )); |
|
388 | - return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page_Init'; |
|
386 | + private function _get_classname_for_admin_init_page($dir_name = '') { |
|
387 | + $class_name = str_replace('_', ' ', strtolower($dir_name)); |
|
388 | + return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page_Init'; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | |
@@ -398,13 +398,13 @@ discard block |
||
398 | 398 | * @throws EE_Error |
399 | 399 | * @return object|bool return page object if valid, bool false if not. |
400 | 400 | */ |
401 | - private function _load_admin_page( $page = '', $path = '' ) { |
|
402 | - $class_name = $this->_get_classname_for_admin_init_page( $page ); |
|
403 | - EE_Registry::instance()->load_file( $path, $class_name, 'core' ); |
|
404 | - if ( ! class_exists( $class_name )) { |
|
405 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin page.', 'event_espresso' ), $page); |
|
406 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no Init class in place for the %s admin page.', 'event_espresso') . '<br />' . __( 'Make sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, $class_name ); |
|
407 | - throw new EE_Error( implode( '||', $error_msg )); |
|
401 | + private function _load_admin_page($page = '', $path = '') { |
|
402 | + $class_name = $this->_get_classname_for_admin_init_page($page); |
|
403 | + EE_Registry::instance()->load_file($path, $class_name, 'core'); |
|
404 | + if ( ! class_exists($class_name)) { |
|
405 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin page.', 'event_espresso'), $page); |
|
406 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no Init class in place for the %s admin page.', 'event_espresso').'<br />'.__('Make sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, $class_name); |
|
407 | + throw new EE_Error(implode('||', $error_msg)); |
|
408 | 408 | } |
409 | 409 | $a = new ReflectionClass($class_name); |
410 | 410 | return $a->newInstance(); |
@@ -423,9 +423,9 @@ discard block |
||
423 | 423 | public function set_menus() { |
424 | 424 | //prep the menu pages (sort, group.) |
425 | 425 | $this->_prep_pages(); |
426 | - foreach( $this->_prepped_menu_maps as $menu_map ) { |
|
427 | - if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) { |
|
428 | - $menu_map->add_menu_page( FALSE ); |
|
426 | + foreach ($this->_prepped_menu_maps as $menu_map) { |
|
427 | + if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) { |
|
428 | + $menu_map->add_menu_page(FALSE); |
|
429 | 429 | } |
430 | 430 | } |
431 | 431 | } |
@@ -438,11 +438,11 @@ discard block |
||
438 | 438 | * |
439 | 439 | * @return void |
440 | 440 | */ |
441 | - public function set_network_menus(){ |
|
441 | + public function set_network_menus() { |
|
442 | 442 | $this->_prep_pages(); |
443 | - foreach( $this->_prepped_menu_maps as $menu_map ) { |
|
444 | - if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) { |
|
445 | - $menu_map->add_menu_page( TRUE ); |
|
443 | + foreach ($this->_prepped_menu_maps as $menu_map) { |
|
444 | + if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) { |
|
445 | + $menu_map->add_menu_page(TRUE); |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | } |
@@ -463,22 +463,22 @@ discard block |
||
463 | 463 | //rearrange _admin_menu_groups to be indexed by group slug. |
464 | 464 | $menu_groups = $this->_rearrange_menu_groups(); |
465 | 465 | |
466 | - foreach( $this->_installed_pages as $page ) { |
|
467 | - if ( $page instanceof EE_Admin_page_Init ) { |
|
466 | + foreach ($this->_installed_pages as $page) { |
|
467 | + if ($page instanceof EE_Admin_page_Init) { |
|
468 | 468 | $page_map = $page->get_menu_map(); |
469 | 469 | //if we've got an array then the menu map is in the old format so let's throw a persistent notice that the admin system isn't setup correctly for this item. |
470 | - if ( is_array( $page_map ) || empty( $page_map ) ) { |
|
471 | - EE_Error::add_persistent_admin_notice( 'menu_map_warning_' . str_replace(' ', '_', $page->label) . '_' . EVENT_ESPRESSO_VERSION, sprintf( __('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core. This means that full functionality for this component is not available. This error message usually appears with an Add-on that is out of date. Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso' ), $page->label ) ); |
|
470 | + if (is_array($page_map) || empty($page_map)) { |
|
471 | + EE_Error::add_persistent_admin_notice('menu_map_warning_'.str_replace(' ', '_', $page->label).'_'.EVENT_ESPRESSO_VERSION, sprintf(__('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core. This means that full functionality for this component is not available. This error message usually appears with an Add-on that is out of date. Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso'), $page->label)); |
|
472 | 472 | continue; |
473 | 473 | } |
474 | 474 | |
475 | 475 | //if page map is NOT a EE_Admin_Page_Menu_Map object then throw error. |
476 | - if ( ! $page_map instanceof EE_Admin_Page_Menu_Map ) { |
|
477 | - throw new EE_Error( sprintf( __('The menu map for %s must be an EE_Admin_Page_Menu_Map object. Instead it is %s. Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map ) ); |
|
476 | + if ( ! $page_map instanceof EE_Admin_Page_Menu_Map) { |
|
477 | + throw new EE_Error(sprintf(__('The menu map for %s must be an EE_Admin_Page_Menu_Map object. Instead it is %s. Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map)); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | //use the maintenance_mode_parent property and maintenance mode status to determine if this page even gets added to array. |
481 | - if ( empty( $page_map->maintenance_mode_parent ) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
481 | + if (empty($page_map->maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
482 | 482 | continue; |
483 | 483 | } |
484 | 484 | |
@@ -487,21 +487,21 @@ discard block |
||
487 | 487 | } |
488 | 488 | } |
489 | 489 | |
490 | - if ( empty( $pages_array )) { |
|
491 | - throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso') ); |
|
490 | + if (empty($pages_array)) { |
|
491 | + throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso')); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | //let's sort the groups, make sure it's a valid group, add header (if to show). |
495 | - foreach ( $pages_array as $group => $menu_maps ) { |
|
495 | + foreach ($pages_array as $group => $menu_maps) { |
|
496 | 496 | //valid_group? |
497 | - if ( ! array_key_exists( $group, $menu_groups ) ) |
|
497 | + if ( ! array_key_exists($group, $menu_groups)) |
|
498 | 498 | continue; |
499 | 499 | |
500 | 500 | //sort pages. |
501 | - usort( $menu_maps, array( $this, '_sort_menu_maps' ) ); |
|
501 | + usort($menu_maps, array($this, '_sort_menu_maps')); |
|
502 | 502 | |
503 | 503 | //prepend header |
504 | - array_unshift( $menu_maps, $menu_groups[$group] ); |
|
504 | + array_unshift($menu_maps, $menu_groups[$group]); |
|
505 | 505 | |
506 | 506 | //reset $pages_array with prepped data |
507 | 507 | $pages_array[$group] = $menu_maps; |
@@ -509,9 +509,9 @@ discard block |
||
509 | 509 | |
510 | 510 | |
511 | 511 | //now let's setup the _prepped_menu_maps property |
512 | - foreach ( $menu_groups as $group => $group_objs ) { |
|
513 | - if ( isset( $pages_array[$group] ) ) |
|
514 | - $this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] ); |
|
512 | + foreach ($menu_groups as $group => $group_objs) { |
|
513 | + if (isset($pages_array[$group])) |
|
514 | + $this->_prepped_menu_maps = array_merge($this->_prepped_menu_maps, $pages_array[$group]); |
|
515 | 515 | }/**/ |
516 | 516 | |
517 | 517 | } |
@@ -531,10 +531,10 @@ discard block |
||
531 | 531 | * @param array $installed_refs the original installed_refs array that may contain our NEW EE_Admin_Pages to be loaded. |
532 | 532 | * @return array |
533 | 533 | */ |
534 | - private function _set_caffeinated( $installed_refs ) { |
|
534 | + private function _set_caffeinated($installed_refs) { |
|
535 | 535 | |
536 | 536 | //first let's check if there IS a caffeinated folder. If there is not then lets get out. |
537 | - if ( ! is_dir( EE_PLUGIN_DIR_PATH . 'caffeinated' . DS . 'admin' ) || ( defined( 'EE_DECAF' ) && EE_DECAF )) { |
|
537 | + if ( ! is_dir(EE_PLUGIN_DIR_PATH.'caffeinated'.DS.'admin') || (defined('EE_DECAF') && EE_DECAF)) { |
|
538 | 538 | return $installed_refs; |
539 | 539 | } |
540 | 540 | |
@@ -543,15 +543,15 @@ discard block |
||
543 | 543 | $exclude = array('tickets'); |
544 | 544 | |
545 | 545 | //okay let's setup an "New" pages first (we'll return installed refs later) |
546 | - $new_admin_screens = glob( EE_CORE_CAF_ADMIN . 'new/*', GLOB_ONLYDIR ); |
|
547 | - if ( $new_admin_screens ) { |
|
548 | - foreach( $new_admin_screens as $admin_screen ) { |
|
546 | + $new_admin_screens = glob(EE_CORE_CAF_ADMIN.'new/*', GLOB_ONLYDIR); |
|
547 | + if ($new_admin_screens) { |
|
548 | + foreach ($new_admin_screens as $admin_screen) { |
|
549 | 549 | // files and anything in the exclude array need not apply |
550 | - if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) { |
|
550 | + if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) { |
|
551 | 551 | // these folders represent the different NEW EE admin pages |
552 | - $installed_refs[ basename( $admin_screen ) ] = $admin_screen; |
|
552 | + $installed_refs[basename($admin_screen)] = $admin_screen; |
|
553 | 553 | // set autoloaders for our admin page classes based on included path information |
554 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $admin_screen ); |
|
554 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($admin_screen); |
|
555 | 555 | // $this->_caf_autoloader[] = array( |
556 | 556 | // 'dir' => 'new', |
557 | 557 | // 'folder' => basename( $admin_screen ) |
@@ -561,18 +561,18 @@ discard block |
||
561 | 561 | } |
562 | 562 | |
563 | 563 | //let's see if there are any EXTENDS to setup in the $_caffeinated_extends array (that will be used later for hooking into the _initialize_admin_age in the related core_init admin page) |
564 | - $extends = glob( EE_CORE_CAF_ADMIN . 'extend/*', GLOB_ONLYDIR ); |
|
565 | - if ( $extends ) { |
|
566 | - foreach( $extends as $extend ) { |
|
567 | - if ( is_dir( $extend ) ) { |
|
568 | - $extend_ref = basename( $extend ); |
|
564 | + $extends = glob(EE_CORE_CAF_ADMIN.'extend/*', GLOB_ONLYDIR); |
|
565 | + if ($extends) { |
|
566 | + foreach ($extends as $extend) { |
|
567 | + if (is_dir($extend)) { |
|
568 | + $extend_ref = basename($extend); |
|
569 | 569 | //now let's make sure there is a file that matches the expected format |
570 | - $filename = str_replace(' ', '_', ucwords( str_replace('_', ' ', $extend_ref ) ) ); |
|
571 | - $filename = 'Extend_' . $filename . '_Admin_Page'; |
|
572 | - $this->_caffeinated_extends[$extend_ref]['path'] = str_replace( array( '\\', '/' ), DS, EE_CORE_CAF_ADMIN . 'extend' . DS . $extend_ref . DS . $filename . '.core.php' ); |
|
570 | + $filename = str_replace(' ', '_', ucwords(str_replace('_', ' ', $extend_ref))); |
|
571 | + $filename = 'Extend_'.$filename.'_Admin_Page'; |
|
572 | + $this->_caffeinated_extends[$extend_ref]['path'] = str_replace(array('\\', '/'), DS, EE_CORE_CAF_ADMIN.'extend'.DS.$extend_ref.DS.$filename.'.core.php'); |
|
573 | 573 | $this->_caffeinated_extends[$extend_ref]['admin_page'] = $filename; |
574 | 574 | // set autoloaders for our admin page classes based on included path information |
575 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $extend ); |
|
575 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($extend); |
|
576 | 576 | // $this->_caf_autoloader[] = array( |
577 | 577 | // 'dir' => 'extend', |
578 | 578 | // 'folder' => $extend_ref |
@@ -583,22 +583,22 @@ discard block |
||
583 | 583 | |
584 | 584 | //let's see if there are any HOOK files and instantiate them if there are (so that hooks are loaded early!). |
585 | 585 | $ee_admin_hooks = array(); |
586 | - $hooks = glob( EE_CORE_CAF_ADMIN . 'hooks/*.class.php' ); |
|
587 | - if ( $hooks ) { |
|
588 | - foreach ( $hooks as $hook ) { |
|
589 | - if ( is_readable( $hook ) ) { |
|
586 | + $hooks = glob(EE_CORE_CAF_ADMIN.'hooks/*.class.php'); |
|
587 | + if ($hooks) { |
|
588 | + foreach ($hooks as $hook) { |
|
589 | + if (is_readable($hook)) { |
|
590 | 590 | require_once $hook; |
591 | - $classname = str_replace( EE_CORE_CAF_ADMIN . 'hooks/', '', $hook ); |
|
591 | + $classname = str_replace(EE_CORE_CAF_ADMIN.'hooks/', '', $hook); |
|
592 | 592 | $classname = str_replace('.class.php', '', $classname); |
593 | - if ( class_exists( $classname ) ) { |
|
594 | - $a = new ReflectionClass( $classname ); |
|
593 | + if (class_exists($classname)) { |
|
594 | + $a = new ReflectionClass($classname); |
|
595 | 595 | $ee_admin_hooks[] = $a->newInstance(); |
596 | 596 | } |
597 | 597 | } |
598 | 598 | } |
599 | 599 | }/**/ |
600 | 600 | |
601 | - $ee_admin_hooks = apply_filters( 'FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks ); |
|
601 | + $ee_admin_hooks = apply_filters('FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks); |
|
602 | 602 | |
603 | 603 | return $installed_refs; |
604 | 604 | |
@@ -655,8 +655,8 @@ discard block |
||
655 | 655 | * @param EE_Admin_Page_Menu_Map $b being compared to |
656 | 656 | * @return int sort order |
657 | 657 | */ |
658 | - private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) { |
|
659 | - if ( $a->menu_order == $b->menu_order ) |
|
658 | + private function _sort_menu_maps(EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b) { |
|
659 | + if ($a->menu_order == $b->menu_order) |
|
660 | 660 | return 0; |
661 | 661 | return ($a->menu_order < $b->menu_order) ? -1 : 1; |
662 | 662 | } |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -237,8 +238,9 @@ discard block |
||
237 | 238 | //first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects ) |
238 | 239 | usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) ); |
239 | 240 | foreach ( $this->_admin_menu_groups as $group ) { |
240 | - if ( ! $group instanceof EE_Admin_Page_Menu_Group ) |
|
241 | - throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups. All values in this array are required to be a EE_Admin_Page_Menu_Group object. Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) ); |
|
241 | + if ( ! $group instanceof EE_Admin_Page_Menu_Group ) { |
|
242 | + throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups. All values in this array are required to be a EE_Admin_Page_Menu_Group object. Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) ); |
|
243 | + } |
|
242 | 244 | $groups[$group->menu_slug] = $group; |
243 | 245 | } |
244 | 246 | return $groups; |
@@ -494,8 +496,9 @@ discard block |
||
494 | 496 | //let's sort the groups, make sure it's a valid group, add header (if to show). |
495 | 497 | foreach ( $pages_array as $group => $menu_maps ) { |
496 | 498 | //valid_group? |
497 | - if ( ! array_key_exists( $group, $menu_groups ) ) |
|
498 | - continue; |
|
499 | + if ( ! array_key_exists( $group, $menu_groups ) ) { |
|
500 | + continue; |
|
501 | + } |
|
499 | 502 | |
500 | 503 | //sort pages. |
501 | 504 | usort( $menu_maps, array( $this, '_sort_menu_maps' ) ); |
@@ -510,8 +513,9 @@ discard block |
||
510 | 513 | |
511 | 514 | //now let's setup the _prepped_menu_maps property |
512 | 515 | foreach ( $menu_groups as $group => $group_objs ) { |
513 | - if ( isset( $pages_array[$group] ) ) |
|
514 | - $this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] ); |
|
516 | + if ( isset( $pages_array[$group] ) ) { |
|
517 | + $this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] ); |
|
518 | + } |
|
515 | 519 | }/**/ |
516 | 520 | |
517 | 521 | } |
@@ -656,8 +660,9 @@ discard block |
||
656 | 660 | * @return int sort order |
657 | 661 | */ |
658 | 662 | private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) { |
659 | - if ( $a->menu_order == $b->menu_order ) |
|
660 | - return 0; |
|
663 | + if ( $a->menu_order == $b->menu_order ) { |
|
664 | + return 0; |
|
665 | + } |
|
661 | 666 | return ($a->menu_order < $b->menu_order) ? -1 : 1; |
662 | 667 | } |
663 | 668 |
@@ -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 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'action' => 'admin_option_settings', |
61 | 61 | 'page' => 'espresso_general_settings' |
62 | 62 | ); |
63 | - return '<p>' . sprintf( __('That\'s it for the tour! At any time you can restart a tour by clicking on this help dropdown and then clicking one of the Tour buttons. There are help tours available on all Event Espresso Admin pages. If you want to turn off help tours for all pages, %sgo here%s. All the best with your events!', 'event_espresso'), '<a href="' . EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php') ) . '">', '</a>' ) . '</p>'; |
|
63 | + return '<p>'.sprintf(__('That\'s it for the tour! At any time you can restart a tour by clicking on this help dropdown and then clicking one of the Tour buttons. There are help tours available on all Event Espresso Admin pages. If you want to turn off help tours for all pages, %sgo here%s. All the best with your events!', 'event_espresso'), '<a href="'.EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php')).'">', '</a>').'</p>'; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | } |
67 | 67 | \ No newline at end of file |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <div class="wrap espresso-admin about-wrap"> |
2 | 2 | |
3 | 3 | <h1><?php echo $admin_page_title; ?></h1> |
4 | - <div class="about-text"><?php echo !empty($admin_page_subtitle) ? $admin_page_subtitle : ''; ?></div> |
|
5 | - <div class="ee-badge"><img class="" src=" <?php echo EE_GLOBAL_ASSETS_URL; ?>images/event-espresso-cup-90x90.png" width="90" height="90" alt="<?php printf( esc_attr__( '%s Logo', 'event_espresso' ), 'Event Espresso' ); ?>"/><br /><?php printf( __('Version %s', 'event_espresso' ), EVENT_ESPRESSO_VERSION ); ?></div> |
|
4 | + <div class="about-text"><?php echo ! empty($admin_page_subtitle) ? $admin_page_subtitle : ''; ?></div> |
|
5 | + <div class="ee-badge"><img class="" src=" <?php echo EE_GLOBAL_ASSETS_URL; ?>images/event-espresso-cup-90x90.png" width="90" height="90" alt="<?php printf(esc_attr__('%s Logo', 'event_espresso'), 'Event Espresso'); ?>"/><br /><?php printf(__('Version %s', 'event_espresso'), EVENT_ESPRESSO_VERSION); ?></div> |
|
6 | 6 | |
7 | 7 | <?php echo $nav_tabs; ?> |
8 | 8 | |
9 | 9 | |
10 | 10 | <?php |
11 | - do_action( 'AHEE__admin_wrapper__template__before_about_admin_page_content' ); |
|
11 | + do_action('AHEE__admin_wrapper__template__before_about_admin_page_content'); |
|
12 | 12 | echo $about_admin_page_content; |
13 | - do_action( 'AHEE__admin_wrapper__template__after_about_admin_page_content' ); |
|
13 | + do_action('AHEE__admin_wrapper__template__after_about_admin_page_content'); |
|
14 | 14 | ?> |
15 | 15 | |
16 | 16 | </div> |
@@ -8,19 +8,19 @@ |
||
8 | 8 | <div class="ee-list-table-legend-container"> |
9 | 9 | <h4><?php _e('Legend', 'event_espresso'); ?></h4> |
10 | 10 | <dl class="alignleft ee-list-table-legend"> |
11 | - <?php foreach ( $items as $item => $details ) : ?> |
|
12 | - <?php if ( $per_col < $count ) : ?> |
|
11 | + <?php foreach ($items as $item => $details) : ?> |
|
12 | + <?php if ($per_col < $count) : ?> |
|
13 | 13 | </dl> |
14 | 14 | <dl class="alignleft ee-list-table-legend"> |
15 | 15 | <?php $count = 1; endif; ?> |
16 | 16 | <dt id="ee-legend-item-<?php echo $item; ?>"> |
17 | - <?php $class = ! empty( $details['class'] ) ? $details['class'] : 'ee-legend-img-container'; ?> |
|
18 | - <?php if ( strpos( $details[ 'class' ], '<span' ) !== false ) { |
|
17 | + <?php $class = ! empty($details['class']) ? $details['class'] : 'ee-legend-img-container'; ?> |
|
18 | + <?php if (strpos($details['class'], '<span') !== false) { |
|
19 | 19 | echo $class; |
20 | 20 | } else { ?> |
21 | 21 | <span class="<?php echo $class; ?>"> |
22 | - <?php if ( ! empty( $details[ 'icon' ] ) ) : ?> |
|
23 | - <img src="<?php echo $details[ 'icon' ]; ?>" class="ee-legend-icon" alt="<?php echo esc_attr( $details[ 'desc' ] ); ?>"/> |
|
22 | + <?php if ( ! empty($details['icon'])) : ?> |
|
23 | + <img src="<?php echo $details['icon']; ?>" class="ee-legend-icon" alt="<?php echo esc_attr($details['desc']); ?>"/> |
|
24 | 24 | <?php endif; ?> |
25 | 25 | </span> |
26 | 26 | <?php } ?> |
@@ -10,13 +10,13 @@ |
||
10 | 10 | |
11 | 11 | <?php |
12 | 12 | //let's loop through the columns |
13 | - for ( $i = 1; $i <= $num_columns; $i++ ) { |
|
14 | - $metaref = ( $i === 1 ) ? 'normal' : 'side'; |
|
15 | - $metaref = ( $i > 2 ) ? 'column'.$i : $metaref; |
|
13 | + for ($i = 1; $i <= $num_columns; $i++) { |
|
14 | + $metaref = ($i === 1) ? 'normal' : 'side'; |
|
15 | + $metaref = ($i > 2) ? 'column'.$i : $metaref; |
|
16 | 16 | ?> |
17 | 17 | |
18 | 18 | <div id='postbox-container-<?php echo $i; ?>' class='postbox-container'> |
19 | - <?php do_meta_boxes( $current_page, $metaref, NULL ); ?> |
|
19 | + <?php do_meta_boxes($current_page, $metaref, NULL); ?> |
|
20 | 20 | </div> |
21 | 21 | <?php }// end column loop ?> |
22 | 22 | </div> <!-- post-body --> |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( $publish_box_extra_content ) : ?> |
|
1 | +<?php if ($publish_box_extra_content) : ?> |
|
2 | 2 | <div id="minor-publishing"> |
3 | 3 | <?php echo $publish_box_extra_content; ?> |
4 | 4 | </div> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | <div id="espresso_major_buttons_wrapper"> |
15 | 15 | |
16 | - <?php if ( $publish_delete_link ) : ?> |
|
16 | + <?php if ($publish_delete_link) : ?> |
|
17 | 17 | <div id="delete-action"> |
18 | 18 | <?php echo $publish_delete_link; ?> |
19 | 19 | </div> |