@@ -10,30 +10,30 @@ |
||
10 | 10 | * @ version 4+ |
11 | 11 | */ |
12 | 12 | |
13 | -if ( have_posts() ) : ?> |
|
13 | +if (have_posts()) : ?> |
|
14 | 14 | |
15 | 15 | <header class="page-header"> |
16 | 16 | <h1 class="page-title"> |
17 | - <?php echo __( 'Event Venues', 'event_espresso' ); ?> |
|
17 | + <?php echo __('Event Venues', 'event_espresso'); ?> |
|
18 | 18 | </h1> |
19 | 19 | </header><!-- .page-header --> |
20 | 20 | |
21 | 21 | <?php |
22 | 22 | // allow other stuff |
23 | - do_action( 'AHEE__archive_espresso_venues_template__before_loop' ); |
|
23 | + do_action('AHEE__archive_espresso_venues_template__before_loop'); |
|
24 | 24 | // Start the Loop. |
25 | - while ( have_posts() ) : the_post(); |
|
25 | + while (have_posts()) : the_post(); |
|
26 | 26 | // Include the post TYPE-specific template for the content. |
27 | - espresso_get_template_part( 'content', 'espresso_venues' ); |
|
27 | + espresso_get_template_part('content', 'espresso_venues'); |
|
28 | 28 | endwhile; |
29 | 29 | // Previous/next page navigation. |
30 | 30 | espresso_pagination(); |
31 | 31 | // allow moar other stuff |
32 | - do_action( 'AHEE__archive_espresso_venues_template__after_loop' ); |
|
32 | + do_action('AHEE__archive_espresso_venues_template__after_loop'); |
|
33 | 33 | |
34 | 34 | |
35 | 35 | else : |
36 | 36 | // If no content, include the "No posts found" template. |
37 | - espresso_get_template_part( 'content', 'none' ); |
|
37 | + espresso_get_template_part('content', 'none'); |
|
38 | 38 | |
39 | 39 | endif; |
@@ -32,8 +32,10 @@ |
||
32 | 32 | do_action( 'AHEE__archive_espresso_venues_template__after_loop' ); |
33 | 33 | |
34 | 34 | |
35 | -else : |
|
35 | +else { |
|
36 | + : |
|
36 | 37 | // If no content, include the "No posts found" template. |
37 | 38 | espresso_get_template_part( 'content', 'none' ); |
39 | +} |
|
38 | 40 | |
39 | 41 | endif; |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | <div id="espresso-venue-details-dv" class="" > |
19 | 19 | <?php |
20 | 20 | // Start the Loop. |
21 | - while ( have_posts() ) : the_post(); |
|
21 | + while (have_posts()) : the_post(); |
|
22 | 22 | // Include the post TYPE-specific template for the content. |
23 | - espresso_get_template_part( 'content', 'espresso_venues' ); |
|
23 | + espresso_get_template_part('content', 'espresso_venues'); |
|
24 | 24 | // If comments are open or we have at least one comment, load up the comment template. |
25 | - if ( comments_open() || get_comments_number() ) { |
|
25 | + if (comments_open() || get_comments_number()) { |
|
26 | 26 | comments_template(); |
27 | 27 | } |
28 | 28 | endwhile; |
@@ -34,6 +34,6 @@ discard block |
||
34 | 34 | </div><!-- #primary --> |
35 | 35 | |
36 | 36 | <?php |
37 | -get_sidebar( 'content' ); |
|
37 | +get_sidebar('content'); |
|
38 | 38 | get_sidebar(); |
39 | 39 | get_footer(); |
40 | 40 | \ No newline at end of file |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @param WP $WP |
52 | 52 | * @return void |
53 | 53 | */ |
54 | - public function run( WP $WP ) { |
|
54 | + public function run(WP $WP) { |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -61,28 +61,28 @@ discard block |
||
61 | 61 | * @param array $attributes |
62 | 62 | * @return string |
63 | 63 | */ |
64 | - public function process_shortcode( $attributes = array() ) { |
|
65 | - EE_Registry::instance()->load_core( 'Session' ); |
|
66 | - $transaction = EE_Registry::instance()->SSN->get_session_data( 'transaction' ); |
|
67 | - if ( $transaction instanceof EE_Transaction ) { |
|
68 | - do_action( 'AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', $transaction ); |
|
64 | + public function process_shortcode($attributes = array()) { |
|
65 | + EE_Registry::instance()->load_core('Session'); |
|
66 | + $transaction = EE_Registry::instance()->SSN->get_session_data('transaction'); |
|
67 | + if ($transaction instanceof EE_Transaction) { |
|
68 | + do_action('AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', $transaction); |
|
69 | 69 | $registrations = $transaction->registrations(); |
70 | - foreach( $registrations as $registration ) { |
|
71 | - if ( $registration instanceof EE_Registration ) { |
|
72 | - do_action( 'AHEE__EES_Espresso_Cancelled__process_shortcode__registration', $registration ); |
|
70 | + foreach ($registrations as $registration) { |
|
71 | + if ($registration instanceof EE_Registration) { |
|
72 | + do_action('AHEE__EES_Espresso_Cancelled__process_shortcode__registration', $registration); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | } |
76 | - do_action( 'AHEE__EES_Espresso_Cancelled__process_shortcode__clear_session' ); |
|
76 | + do_action('AHEE__EES_Espresso_Cancelled__process_shortcode__clear_session'); |
|
77 | 77 | // remove all unwanted records from the db |
78 | - if ( EE_Registry::instance()->CART instanceof EE_Cart ) { |
|
78 | + if (EE_Registry::instance()->CART instanceof EE_Cart) { |
|
79 | 79 | EE_Registry::instance()->CART->delete_cart(); |
80 | 80 | } |
81 | 81 | EE_Registry::instance()->SSN->reset_cart(); |
82 | 82 | EE_Registry::instance()->SSN->reset_checkout(); |
83 | 83 | EE_Registry::instance()->SSN->reset_transaction(); |
84 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
85 | - return sprintf( __( '%sAll unsaved registration information entered during this session has been deleted.%s', 'event_espresso' ) , '<p class="ee-registrations-cancelled-pg ee-attention">', '</p>' ); |
|
84 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
85 | + return sprintf(__('%sAll unsaved registration information entered during this session has been deleted.%s', 'event_espresso'), '<p class="ee-registrations-cancelled-pg ee-attention">', '</p>'); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | } |
@@ -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,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 Attendees shortcode class |
4 | 6 | * |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param WP $WP |
20 | 20 | * @return void |
21 | 21 | */ |
22 | - public function run( WP $WP ) {} |
|
22 | + public function run(WP $WP) {} |
|
23 | 23 | |
24 | 24 | |
25 | 25 | /** |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | * @param array $attributes |
70 | 70 | * @return string |
71 | 71 | */ |
72 | - public function process_shortcode( $attributes = array() ) { |
|
72 | + public function process_shortcode($attributes = array()) { |
|
73 | 73 | |
74 | 74 | //load helpers |
75 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
76 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
75 | + EE_Registry::instance()->load_helper('Event_View'); |
|
76 | + EE_Registry::instance()->load_helper('Template'); |
|
77 | 77 | |
78 | 78 | // merge in any attributes passed via fallback shortcode processor |
79 | - $attributes = array_merge( (array) $attributes, (array) $this->_attributes ); |
|
79 | + $attributes = array_merge((array) $attributes, (array) $this->_attributes); |
|
80 | 80 | |
81 | 81 | //set default attributes |
82 | 82 | $default_shortcode_attributes = array( |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | ); |
89 | 89 | |
90 | 90 | // allow the defaults to be filtered |
91 | - $default_shortcode_attributes = apply_filters( 'EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts', $default_shortcode_attributes ); |
|
91 | + $default_shortcode_attributes = apply_filters('EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts', $default_shortcode_attributes); |
|
92 | 92 | // grab attributes and merge with defaults, then extract |
93 | - $attributes = array_merge( $default_shortcode_attributes, $attributes ); |
|
93 | + $attributes = array_merge($default_shortcode_attributes, $attributes); |
|
94 | 94 | |
95 | 95 | $template_args = array( |
96 | 96 | 'contacts' => array(), |
@@ -106,31 +106,31 @@ discard block |
||
106 | 106 | $error = false; |
107 | 107 | |
108 | 108 | //what event? |
109 | - if ( empty( $attributes['event_id'] ) && empty( $attributes['datetime_id'] ) && empty( $attributes['ticket_id'] ) ) { |
|
109 | + if (empty($attributes['event_id']) && empty($attributes['datetime_id']) && empty($attributes['ticket_id'])) { |
|
110 | 110 | //seems like is_espresso_event_single() isn't working as expected. So using alternate method. |
111 | - if ( is_single() && is_espresso_event() ) { |
|
111 | + if (is_single() && is_espresso_event()) { |
|
112 | 112 | $event = EEH_Event_View::get_event(); |
113 | - if ( $event instanceof EE_Event ) { |
|
113 | + if ($event instanceof EE_Event) { |
|
114 | 114 | $template_args['event'] = $event; |
115 | 115 | $query[0]['Registration.EVT_ID'] = $event->ID(); |
116 | 116 | } |
117 | 117 | } else { |
118 | 118 | //try getting the earliest active event if none then get the |
119 | - $events = EEM_Event::instance()->get_active_events( array( 'limit' => 1, |
|
120 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
121 | - ) ); |
|
122 | - $events = empty( $events ) ? EEM_Event::instance()->get_upcoming_events( array( 'limit' => 1, |
|
123 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
124 | - ) ) : $events; |
|
125 | - $event = reset( $events ); |
|
126 | - if ( $event instanceof EE_Event ) { |
|
119 | + $events = EEM_Event::instance()->get_active_events(array('limit' => 1, |
|
120 | + 'order_by' => array('Datetime.DTT_EVT_start' => 'ASC') |
|
121 | + )); |
|
122 | + $events = empty($events) ? EEM_Event::instance()->get_upcoming_events(array('limit' => 1, |
|
123 | + 'order_by' => array('Datetime.DTT_EVT_start' => 'ASC') |
|
124 | + )) : $events; |
|
125 | + $event = reset($events); |
|
126 | + if ($event instanceof EE_Event) { |
|
127 | 127 | $query[0]['Registration.EVT_ID'] = $event->ID(); |
128 | 128 | $template_args['event'] = $event; |
129 | 129 | } |
130 | 130 | } |
131 | - } elseif ( ! empty( $attributes['event_id'] ) ) { |
|
132 | - $event = EEM_Event::instance()->get_one_by_ID( $attributes['event_id'] ); |
|
133 | - if ( $event instanceof EE_Event ) { |
|
131 | + } elseif ( ! empty($attributes['event_id'])) { |
|
132 | + $event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']); |
|
133 | + if ($event instanceof EE_Event) { |
|
134 | 134 | $query[0]['Registration.EVT_ID'] = $attributes['event_id']; |
135 | 135 | $template_args['event'] = $event; |
136 | 136 | } else { |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | //datetime? |
142 | - if ( ! empty( $attributes['datetime_id'] ) && empty( $attributes['event_id'] ) ) { |
|
143 | - $datetime = EEM_Datetime::instance()->get_one_by_ID( $attributes['datetime_id'] ); |
|
144 | - if ( $datetime instanceof EE_Datetime ) { |
|
142 | + if ( ! empty($attributes['datetime_id']) && empty($attributes['event_id'])) { |
|
143 | + $datetime = EEM_Datetime::instance()->get_one_by_ID($attributes['datetime_id']); |
|
144 | + if ($datetime instanceof EE_Datetime) { |
|
145 | 145 | $query[0]['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetime_id']; |
146 | 146 | $query['default_where_conditions'] = 'this_model_only'; |
147 | 147 | $template_args['datetime'] = $datetime; |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | //ticket?just |
155 | - if ( ! empty( $attributes['ticket_id'] ) && empty( $attributes['event_id'] ) && empty( $attributes['datetime_id'] ) ) { |
|
156 | - $ticket = EEM_Ticket::instance()->get_one_by_ID( $attributes['ticket_id'] ); |
|
157 | - if ( $ticket instanceof EE_Ticket ) { |
|
155 | + if ( ! empty($attributes['ticket_id']) && empty($attributes['event_id']) && empty($attributes['datetime_id'])) { |
|
156 | + $ticket = EEM_Ticket::instance()->get_one_by_ID($attributes['ticket_id']); |
|
157 | + if ($ticket instanceof EE_Ticket) { |
|
158 | 158 | $query[0]['Registration.TKT_ID'] = $attributes['ticket_id']; |
159 | 159 | $template_args['ticket'] = $ticket; |
160 | 160 | $template_args['event'] = $ticket->first_datetime() instanceof EE_Datetime ? $ticket->first_datetime()->event() : null; |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | |
166 | 166 | //status |
167 | 167 | $reg_status_array = EEM_Registration::reg_status_array(); |
168 | - if ( $attributes['status'] != 'all' && isset( $reg_status_array[$attributes['status']] ) ) { |
|
168 | + if ($attributes['status'] != 'all' && isset($reg_status_array[$attributes['status']])) { |
|
169 | 169 | $query[0]['Registration.STS_ID'] = $attributes['status']; |
170 | 170 | } |
171 | - $query['group_by'] = array( 'ATT_ID' ); |
|
172 | - $query['order_by'] = apply_filters( 'FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array( 'ATT_lname' => 'ASC', 'ATT_fname' => 'ASC' ) ); |
|
171 | + $query['group_by'] = array('ATT_ID'); |
|
172 | + $query['order_by'] = apply_filters('FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array('ATT_lname' => 'ASC', 'ATT_fname' => 'ASC')); |
|
173 | 173 | |
174 | 174 | //if we have NO query where conditions, then there was an invalid parameter or the shortcode was used incorrectly |
175 | 175 | //so when WP_DEBUG is set and true, we'll show a message, otherwise we'll just return an empty string. |
176 | - if ( ( ! isset( $query[0] ) || ! is_array( $query[0] ) ) || $error ) { |
|
177 | - if ( WP_DEBUG ) { |
|
178 | - return '<div class="important-notice ee-attention">' . __( 'The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly. Please double check the arguments you used for any typos. In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso' ) . '</div>'; |
|
176 | + if (( ! isset($query[0]) || ! is_array($query[0])) || $error) { |
|
177 | + if (WP_DEBUG) { |
|
178 | + return '<div class="important-notice ee-attention">'.__('The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly. Please double check the arguments you used for any typos. In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso').'</div>'; |
|
179 | 179 | } else { |
180 | 180 | return ''; |
181 | 181 | } |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | |
184 | 184 | |
185 | 185 | //get contacts! |
186 | - $template_args['contacts'] = EEM_Attendee::instance()->get_all( $query ); |
|
186 | + $template_args['contacts'] = EEM_Attendee::instance()->get_all($query); |
|
187 | 187 | |
188 | 188 | |
189 | 189 | //all set let's load up the template and return. |
190 | - return EEH_Template::locate_template( 'loop-espresso_event_attendees.php', $template_args, true, true ); |
|
190 | + return EEH_Template::locate_template('loop-espresso_event_attendees.php', $template_args, true, true); |
|
191 | 191 | |
192 | 192 | } |
193 | 193 |
@@ -113,10 +113,10 @@ |
||
113 | 113 | } else { |
114 | 114 | //try getting the earliest active event if none then get the |
115 | 115 | $events = EEM_Event::instance()->get_active_events( array( 'limit' => 1, |
116 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
116 | + 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
117 | 117 | ) ); |
118 | 118 | $events = empty( $events ) ? EEM_Event::instance()->get_upcoming_events( array( 'limit' => 1, |
119 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
119 | + 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
120 | 120 | ) ) : $events; |
121 | 121 | $event = reset( $events ); |
122 | 122 | if ( $event instanceof EE_Event ) { |
@@ -1,30 +1,30 @@ discard block |
||
1 | 1 | <h2 class="section-heading display-box-heading"> |
2 | 2 | <?php _e('Payment Overview', 'event_espresso'); ?> |
3 | 3 | </h2> |
4 | -<?php do_action( 'AHEE__thank_you_page_payment_details_template__after_heading' ); ?> |
|
4 | +<?php do_action('AHEE__thank_you_page_payment_details_template__after_heading'); ?> |
|
5 | 5 | |
6 | 6 | <div id="espresso-thank-you-page-payment-details-dv"> |
7 | -<?php if ( ! empty( $payments )){ ?> |
|
7 | +<?php if ( ! empty($payments)) { ?> |
|
8 | 8 | <table class="ee-table"> |
9 | 9 | <thead> |
10 | 10 | <tr> |
11 | 11 | <th width="35%" class="jst-left"> |
12 | - <?php _e('Payment Date','event_espresso')?> |
|
12 | + <?php _e('Payment Date', 'event_espresso')?> |
|
13 | 13 | </th> |
14 | 14 | <th width="17.5%" class="jst-left"> |
15 | - <?php _e('Type','event_espresso');?> |
|
15 | + <?php _e('Type', 'event_espresso'); ?> |
|
16 | 16 | </th> |
17 | 17 | <th width="17.5%" class="jst-rght"> |
18 | - <?php _e('Amount','event_espresso');?> |
|
18 | + <?php _e('Amount', 'event_espresso'); ?> |
|
19 | 19 | </th> |
20 | 20 | <th width="30%" class="jst-rght"> |
21 | - <?php _e('Status','event_espresso');?> |
|
21 | + <?php _e('Status', 'event_espresso'); ?> |
|
22 | 22 | </th> |
23 | 23 | </tr> |
24 | 24 | </thead> |
25 | 25 | <tbody> |
26 | 26 | <?php |
27 | - foreach ( $payments as $payment ) { |
|
27 | + foreach ($payments as $payment) { |
|
28 | 28 | echo $payment; |
29 | 29 | } |
30 | 30 | ?> |
@@ -33,38 +33,38 @@ discard block |
||
33 | 33 | <?php |
34 | 34 | } else { |
35 | 35 | |
36 | - if ( $transaction->total() ){ |
|
36 | + if ($transaction->total()) { |
|
37 | 37 | |
38 | 38 | echo apply_filters( |
39 | 39 | 'FHEE__payment_overview_template__no_payments_made', |
40 | - sprintf ( |
|
41 | - __('%sNo payments towards this transaction have been received.%s', 'event_espresso' ), |
|
40 | + sprintf( |
|
41 | + __('%sNo payments towards this transaction have been received.%s', 'event_espresso'), |
|
42 | 42 | '<p class="important-notice">', |
43 | 43 | '</p>' |
44 | 44 | ) |
45 | 45 | ); |
46 | - do_action( 'AHEE__thank_you_page_payment_details_template__no_payments_made', $transaction ); |
|
46 | + do_action('AHEE__thank_you_page_payment_details_template__no_payments_made', $transaction); |
|
47 | 47 | |
48 | 48 | } else { |
49 | 49 | |
50 | 50 | echo apply_filters( |
51 | 51 | 'FHEE__payment_overview_template__no_payment_required', |
52 | - sprintf ( |
|
53 | - __('%sNo payment is required for this transaction.%s', 'event_espresso' ), |
|
52 | + sprintf( |
|
53 | + __('%sNo payment is required for this transaction.%s', 'event_espresso'), |
|
54 | 54 | '<p>', |
55 | 55 | '</p>' |
56 | 56 | ) |
57 | 57 | ); |
58 | - do_action( 'AHEE__thank_you_page_payment_details_template__no_payment_required' ); |
|
58 | + do_action('AHEE__thank_you_page_payment_details_template__no_payment_required'); |
|
59 | 59 | |
60 | 60 | } |
61 | 61 | |
62 | 62 | } |
63 | 63 | echo $gateway_content; |
64 | - do_action( 'AHEE__thank_you_page_payment_details_template__after_gateway_content', $gateway_content ); |
|
64 | + do_action('AHEE__thank_you_page_payment_details_template__after_gateway_content', $gateway_content); |
|
65 | 65 | |
66 | 66 | ?> |
67 | 67 | |
68 | 68 | <br/> |
69 | - <?php do_action( 'AHEE__thank_you_page_payment_details_template__after_payment_details' ); ?> |
|
69 | + <?php do_action('AHEE__thank_you_page_payment_details_template__after_payment_details'); ?> |
|
70 | 70 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <h3><?php _e('Transaction Details', 'event_espresso'); ?></h3> |
2 | -<?php do_action( 'AHEE__thank_you_page_transaction_details_template__after_heading' ); ?> |
|
2 | +<?php do_action('AHEE__thank_you_page_transaction_details_template__after_heading'); ?> |
|
3 | 3 | |
4 | 4 | <div id="espresso-thank-you-page-transaction-details-dv"> |
5 | 5 | <table class='ee-table'> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | <label><?php _e('Total Cost: ', 'event_espresso'); ?></label> |
10 | 10 | </td> |
11 | 11 | <td> |
12 | - <?php echo EEH_Template::format_currency( $transaction->total() ); ?> |
|
12 | + <?php echo EEH_Template::format_currency($transaction->total()); ?> |
|
13 | 13 | </td> |
14 | 14 | </tr> |
15 | 15 | <tr> |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | <label><?php _e('Amount Owing: ', 'event_espresso'); ?></label> |
18 | 18 | </td> |
19 | 19 | <td class="<?php echo ($transaction->paid() == $transaction->total()) ? 'ee-transaction-paid' : 'ee-transaction-unpaid' ?>"> |
20 | - <?php echo EEH_Template::format_currency( $transaction->remaining() ); ?> |
|
20 | + <?php echo EEH_Template::format_currency($transaction->remaining()); ?> |
|
21 | 21 | </td> |
22 | 22 | </tr> |
23 | 23 | <tr> |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | <label><?php _e('Transaction Status: ', 'event_espresso'); ?></label> |
26 | 26 | </td> |
27 | 27 | <td> |
28 | - <?php $transaction->e_pretty_status( TRUE ); |
|
29 | - if ( $show_try_pay_again_link && ! $transaction->is_completed() ) { ?> |
|
28 | + <?php $transaction->e_pretty_status(TRUE); |
|
29 | + if ($show_try_pay_again_link && ! $transaction->is_completed()) { ?> |
|
30 | 30 | <span class="small-text"><a href='<?php echo $SPCO_payment_options_url?>'><?php _e('View Payment Options', 'event_espresso'); ?></a></span> |
31 | 31 | <?php } ?> |
32 | 32 | </td> |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | <?php echo $primary_registrant_name; ?> |
40 | 40 | </td> |
41 | 41 | </tr> |
42 | - <?php do_action( 'AHEE__thank_you_page_transaction_details_template__after_transaction_table_row', $transaction ); ?> |
|
42 | + <?php do_action('AHEE__thank_you_page_transaction_details_template__after_transaction_table_row', $transaction); ?> |
|
43 | 43 | </tbody> |
44 | 44 | </table> |
45 | 45 | |
46 | -<?php if ( $show_try_pay_again_link && ! $transaction->is_completed() ) { ?> |
|
46 | +<?php if ($show_try_pay_again_link && ! $transaction->is_completed()) { ?> |
|
47 | 47 | <p class="small-text jst-rght"> |
48 | 48 | <a href='<?php echo $SPCO_payment_options_url?>'><?php _e("Click here to view Payment Options", 'event_espresso'); ?></a> |
49 | 49 | </p> |
@@ -52,6 +52,6 @@ discard block |
||
52 | 52 | |
53 | 53 | <?php }?> |
54 | 54 | |
55 | - <?php do_action( 'AHEE__thank_you_page_transaction_details_template__after_transaction_details' ); ?> |
|
55 | + <?php do_action('AHEE__thank_you_page_transaction_details_template__after_transaction_details'); ?> |
|
56 | 56 | |
57 | 57 | </div> |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | <?php _e('Show on all Pages:', 'event_espresso'); ?> |
193 | 193 | </label> |
194 | 194 | <?php |
195 | - echo EEH_Form_Fields::select( |
|
196 | - __('Show on all Pages:', 'event_espresso'), |
|
197 | - $instance['show_everywhere'], |
|
198 | - $yes_no_values, |
|
199 | - $this->get_field_name('show_everywhere'), |
|
200 | - $this->get_field_id('show_everywhere') |
|
201 | - ); |
|
202 | - ?> |
|
195 | + echo EEH_Form_Fields::select( |
|
196 | + __('Show on all Pages:', 'event_espresso'), |
|
197 | + $instance['show_everywhere'], |
|
198 | + $yes_no_values, |
|
199 | + $this->get_field_name('show_everywhere'), |
|
200 | + $this->get_field_id('show_everywhere') |
|
201 | + ); |
|
202 | + ?> |
|
203 | 203 | </p> |
204 | 204 | <p> |
205 | 205 | <label for="<?php echo $this->get_field_id('date_limit'); ?>"> |
@@ -282,13 +282,13 @@ discard block |
||
282 | 282 | extract($args); |
283 | 283 | |
284 | 284 | // add function to make the title a link |
285 | - add_filter('widget_title', array($this, 'make_the_title_a_link'), 15); |
|
285 | + add_filter('widget_title', array($this, 'make_the_title_a_link'), 15); |
|
286 | 286 | |
287 | 287 | // filter the title |
288 | 288 | $title = apply_filters('widget_title', $instance['title']); |
289 | 289 | |
290 | 290 | // remove the function from the filter, so it does not affect other widgets |
291 | - remove_filter('widget_title', array($this, 'make_the_title_a_link'), 15); |
|
291 | + remove_filter('widget_title', array($this, 'make_the_title_a_link'), 15); |
|
292 | 292 | |
293 | 293 | // Before widget (defined by themes). |
294 | 294 | echo $before_widget; |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | * @return string |
386 | 386 | */ |
387 | 387 | public function make_the_title_a_link($title) { |
388 | - return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
388 | + return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | } |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | function __construct() { |
31 | 31 | parent::__construct( |
32 | 32 | 'ee-upcoming-events-widget', |
33 | - __( 'Event Espresso Upcoming Events', 'event_espresso' ), |
|
34 | - array( 'description' => __( 'A widget to display your upcoming events.', 'event_espresso' )), |
|
33 | + __('Event Espresso Upcoming Events', 'event_espresso'), |
|
34 | + array('description' => __('A widget to display your upcoming events.', 'event_espresso')), |
|
35 | 35 | array( |
36 | 36 | 'width' => 300, |
37 | 37 | 'height' => 350, |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | * @param array $instance Previously saved values from database. |
50 | 50 | * @return string|void |
51 | 51 | */ |
52 | - public function form( $instance ) { |
|
52 | + public function form($instance) { |
|
53 | 53 | |
54 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
55 | - EE_Registry::instance()->load_class( 'Question_Option', array(), FALSE, FALSE, TRUE ); |
|
54 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
55 | + EE_Registry::instance()->load_class('Question_Option', array(), FALSE, FALSE, TRUE); |
|
56 | 56 | // Set up some default widget settings. |
57 | 57 | $defaults = array( |
58 | 58 | 'title' => __('Upcoming Events', 'event_espresso'), |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | 'image_size' => 'medium' |
68 | 68 | ); |
69 | 69 | |
70 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
70 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
71 | 71 | // don't add HTML labels for EE_Form_Fields generated inputs |
72 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); |
|
72 | + add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
73 | 73 | $yes_no_values = array( |
74 | - EE_Question_Option::new_instance( array( 'QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), |
|
75 | - EE_Question_Option::new_instance( array( 'QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))) |
|
74 | + EE_Question_Option::new_instance(array('QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), |
|
75 | + EE_Question_Option::new_instance(array('QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))) |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | ?> |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | <label for="<?php echo $this->get_field_id('title'); ?>"> |
84 | 84 | <?php _e('Title:', 'event_espresso'); ?> |
85 | 85 | </label> |
86 | - <input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" type="text" /> |
|
86 | + <input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" type="text" /> |
|
87 | 87 | </p> |
88 | 88 | <p> |
89 | 89 | <label for="<?php echo $this->get_field_id('category_name'); ?>"> |
@@ -92,16 +92,16 @@ discard block |
||
92 | 92 | <?php |
93 | 93 | $event_categories = array(); |
94 | 94 | /** @type EEM_Term $EEM_Term */ |
95 | - $EEM_Term = EE_Registry::instance()->load_model( 'Term' ); |
|
96 | - $categories = $EEM_Term->get_all_ee_categories( TRUE ); |
|
97 | - if ( $categories ) { |
|
98 | - foreach ( $categories as $category ) { |
|
99 | - if ( $category instanceof EE_Term ) { |
|
100 | - $event_categories[] = EE_Question_Option::new_instance( array( 'QSO_value' => $category->get( 'slug' ), 'QSO_desc' => $category->get( 'name' ))); |
|
95 | + $EEM_Term = EE_Registry::instance()->load_model('Term'); |
|
96 | + $categories = $EEM_Term->get_all_ee_categories(TRUE); |
|
97 | + if ($categories) { |
|
98 | + foreach ($categories as $category) { |
|
99 | + if ($category instanceof EE_Term) { |
|
100 | + $event_categories[] = EE_Question_Option::new_instance(array('QSO_value' => $category->get('slug'), 'QSO_desc' => $category->get('name'))); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
104 | - array_unshift( $event_categories, EE_Question_Option::new_instance( array( 'QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso')))); |
|
104 | + array_unshift($event_categories, EE_Question_Option::new_instance(array('QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso')))); |
|
105 | 105 | echo EEH_Form_Fields::select( |
106 | 106 | __('Event Category:', 'event_espresso'), |
107 | 107 | $instance['category_name'], |
@@ -138,16 +138,16 @@ discard block |
||
138 | 138 | <?php |
139 | 139 | $image_sizes = array(); |
140 | 140 | $sizes = get_intermediate_image_sizes(); |
141 | - if ( $sizes ) { |
|
141 | + if ($sizes) { |
|
142 | 142 | // loop thru images and create option objects out of them |
143 | - foreach ( $sizes as $image_size ) { |
|
144 | - $image_size = trim( $image_size ); |
|
143 | + foreach ($sizes as $image_size) { |
|
144 | + $image_size = trim($image_size); |
|
145 | 145 | // no big images plz |
146 | - if ( ! in_array( $image_size, array( 'large', 'post-thumbnail' ))) { |
|
147 | - $image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => $image_size, 'QSO_desc' => $image_size )); |
|
146 | + if ( ! in_array($image_size, array('large', 'post-thumbnail'))) { |
|
147 | + $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => $image_size, 'QSO_desc' => $image_size)); |
|
148 | 148 | } |
149 | 149 | } |
150 | - $image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso') )); |
|
150 | + $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso'))); |
|
151 | 151 | } |
152 | 152 | echo EEH_Form_Fields::select( |
153 | 153 | __('Image Size:', 'event_espresso'), |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | <label for="<?php echo $this->get_field_id('date_limit'); ?>"> |
206 | 206 | <?php _e('Number of Dates to Display:', 'event_espresso'); ?> |
207 | 207 | </label> |
208 | - <input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr( $instance['date_limit'] ); ?>" size="3" type="text" /> |
|
208 | + <input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr($instance['date_limit']); ?>" size="3" type="text" /> |
|
209 | 209 | </p> |
210 | 210 | <p> |
211 | 211 | <label for="<?php echo $this->get_field_id('date_range'); ?>"> |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return array Updated safe values to be saved. |
239 | 239 | */ |
240 | - public function update( $new_instance, $old_instance ) { |
|
240 | + public function update($new_instance, $old_instance) { |
|
241 | 241 | $instance = $old_instance; |
242 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
242 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
243 | 243 | $instance['category_name'] = $new_instance['category_name']; |
244 | 244 | $instance['show_expired'] = $new_instance['show_expired']; |
245 | 245 | $instance['limit'] = $new_instance['limit']; |
@@ -262,20 +262,20 @@ discard block |
||
262 | 262 | * @param array $args Widget arguments. |
263 | 263 | * @param array $instance Saved values from database. |
264 | 264 | */ |
265 | - public function widget( $args, $instance ) { |
|
265 | + public function widget($args, $instance) { |
|
266 | 266 | |
267 | 267 | global $post; |
268 | 268 | // make sure there is some kinda post object |
269 | - if ( $post instanceof WP_Post ) { |
|
269 | + if ($post instanceof WP_Post) { |
|
270 | 270 | $before_widget = ''; |
271 | 271 | $before_title = ''; |
272 | 272 | $after_title = ''; |
273 | 273 | $after_widget = ''; |
274 | 274 | // but NOT an events archives page, cuz that would be like two event lists on the same page |
275 | - $show_everywhere = isset( $instance['show_everywhere'] ) ? (bool) absint( $instance['show_everywhere'] ) : TRUE; |
|
276 | - if ( $show_everywhere || ! ( $post->post_type == 'espresso_events' && is_archive() )) { |
|
275 | + $show_everywhere = isset($instance['show_everywhere']) ? (bool) absint($instance['show_everywhere']) : TRUE; |
|
276 | + if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) { |
|
277 | 277 | // let's use some of the event helper functions' |
278 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
278 | + EE_Registry::instance()->load_helper('Event_View'); |
|
279 | 279 | // make separate vars out of attributes |
280 | 280 | |
281 | 281 | |
@@ -293,76 +293,76 @@ discard block |
||
293 | 293 | // Before widget (defined by themes). |
294 | 294 | echo $before_widget; |
295 | 295 | // Display the widget title if one was input (before and after defined by themes). |
296 | - if ( ! empty( $title )) { |
|
297 | - echo $before_title . $title . $after_title; |
|
296 | + if ( ! empty($title)) { |
|
297 | + echo $before_title.$title.$after_title; |
|
298 | 298 | } |
299 | 299 | // grab widget settings |
300 | - $category = isset( $instance['category_name'] ) && ! empty( $instance['category_name'] ) ? $instance['category_name'] : FALSE; |
|
301 | - $show_expired = isset( $instance['show_expired'] ) ? (bool) absint( $instance['show_expired'] ) : FALSE; |
|
302 | - $image_size = isset( $instance['image_size'] ) && ! empty( $instance['image_size'] ) ? $instance['image_size'] : 'medium'; |
|
303 | - $show_desc = isset( $instance['show_desc'] ) ? (bool) absint( $instance['show_desc'] ) : TRUE; |
|
304 | - $show_dates = isset( $instance['show_dates'] ) ? (bool) absint( $instance['show_dates'] ) : TRUE; |
|
305 | - $date_limit = isset( $instance['date_limit'] ) && ! empty( $instance['date_limit'] ) ? $instance['date_limit'] : NULL; |
|
306 | - $date_range = isset( $instance['date_range'] ) && ! empty( $instance['date_range'] ) ? $instance['date_range'] : FALSE; |
|
300 | + $category = isset($instance['category_name']) && ! empty($instance['category_name']) ? $instance['category_name'] : FALSE; |
|
301 | + $show_expired = isset($instance['show_expired']) ? (bool) absint($instance['show_expired']) : FALSE; |
|
302 | + $image_size = isset($instance['image_size']) && ! empty($instance['image_size']) ? $instance['image_size'] : 'medium'; |
|
303 | + $show_desc = isset($instance['show_desc']) ? (bool) absint($instance['show_desc']) : TRUE; |
|
304 | + $show_dates = isset($instance['show_dates']) ? (bool) absint($instance['show_dates']) : TRUE; |
|
305 | + $date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) ? $instance['date_limit'] : NULL; |
|
306 | + $date_range = isset($instance['date_range']) && ! empty($instance['date_range']) ? $instance['date_range'] : FALSE; |
|
307 | 307 | // start to build our where clause |
308 | 308 | $where = array( |
309 | 309 | // 'Datetime.DTT_is_primary' => 1, |
310 | 310 | 'status' => 'publish' |
311 | 311 | ); |
312 | 312 | // add category |
313 | - if ( $category ) { |
|
313 | + if ($category) { |
|
314 | 314 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
315 | 315 | $where['Term_Taxonomy.Term.slug'] = $category; |
316 | 316 | } |
317 | 317 | // if NOT expired then we want events that start today or in the future |
318 | - if ( ! $show_expired ) { |
|
319 | - $where['Datetime.DTT_EVT_end'] = array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ); |
|
318 | + if ( ! $show_expired) { |
|
319 | + $where['Datetime.DTT_EVT_end'] = array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')); |
|
320 | 320 | } |
321 | 321 | // run the query |
322 | - $events = EE_Registry::instance()->load_model( 'Event' )->get_all( array( |
|
322 | + $events = EE_Registry::instance()->load_model('Event')->get_all(array( |
|
323 | 323 | $where, |
324 | - 'limit' => $instance['limit'] > 0 ? '0,' . $instance['limit'] : '0,10', |
|
324 | + 'limit' => $instance['limit'] > 0 ? '0,'.$instance['limit'] : '0,10', |
|
325 | 325 | 'order_by' => 'Datetime.DTT_EVT_start', |
326 | 326 | 'order' => 'ASC', |
327 | 327 | 'group_by' => 'EVT_ID' |
328 | 328 | )); |
329 | 329 | |
330 | - if ( ! empty( $events )) { |
|
330 | + if ( ! empty($events)) { |
|
331 | 331 | echo '<ul class="ee-upcoming-events-widget-ul">'; |
332 | - foreach ( $events as $event ) { |
|
333 | - if ( $event instanceof EE_Event && ( !is_single() || $post->ID != $event->ID() ) ) { |
|
332 | + foreach ($events as $event) { |
|
333 | + if ($event instanceof EE_Event && ( ! is_single() || $post->ID != $event->ID())) { |
|
334 | 334 | //printr( $event, '$event <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
335 | - echo '<li id="ee-upcoming-events-widget-li-' . $event->ID() . '" class="ee-upcoming-events-widget-li">'; |
|
335 | + echo '<li id="ee-upcoming-events-widget-li-'.$event->ID().'" class="ee-upcoming-events-widget-li">'; |
|
336 | 336 | // how big is the event name ? |
337 | - $name_length = strlen( $event->name() ); |
|
338 | - switch( $name_length ) { |
|
337 | + $name_length = strlen($event->name()); |
|
338 | + switch ($name_length) { |
|
339 | 339 | case $name_length > 70 : |
340 | - $len_class = ' three-line'; |
|
340 | + $len_class = ' three-line'; |
|
341 | 341 | break; |
342 | 342 | case $name_length > 35 : |
343 | - $len_class = ' two-line'; |
|
343 | + $len_class = ' two-line'; |
|
344 | 344 | break; |
345 | 345 | default : |
346 | - $len_class = ' one-line'; |
|
346 | + $len_class = ' one-line'; |
|
347 | 347 | } |
348 | - echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a' . $len_class . '" href="' . get_permalink( $event->ID() ) . '">' . $event->name() . '</a></h5>'; |
|
349 | - if ( has_post_thumbnail( $event->ID() ) && $image_size != 'none' ) { |
|
350 | - echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="' . get_permalink( $event->ID() ) . '">' . get_the_post_thumbnail( $event->ID(), $image_size ) . '</a></div>'; |
|
348 | + echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a'.$len_class.'" href="'.get_permalink($event->ID()).'">'.$event->name().'</a></h5>'; |
|
349 | + if (has_post_thumbnail($event->ID()) && $image_size != 'none') { |
|
350 | + echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="'.get_permalink($event->ID()).'">'.get_the_post_thumbnail($event->ID(), $image_size).'</a></div>'; |
|
351 | 351 | } |
352 | - $desc = $event->short_description( 25 ); |
|
353 | - if ( $show_dates ) { |
|
354 | - $date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', get_option( 'date_format' )); |
|
355 | - $time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', get_option( 'time_format' )); |
|
356 | - $single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', get_option( 'date_format' )); |
|
357 | - $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' )); |
|
358 | - if ( $date_range == TRUE ) { |
|
359 | - echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() ); |
|
360 | - }else{ |
|
361 | - echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit ); |
|
352 | + $desc = $event->short_description(25); |
|
353 | + if ($show_dates) { |
|
354 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', get_option('date_format')); |
|
355 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', get_option('time_format')); |
|
356 | + $single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', get_option('date_format')); |
|
357 | + $single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', get_option('time_format')); |
|
358 | + if ($date_range == TRUE) { |
|
359 | + echo espresso_event_date_range($date_format, $time_format, $single_date_format, $single_time_format, $event->ID()); |
|
360 | + } else { |
|
361 | + echo espresso_list_of_event_dates($event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit); |
|
362 | 362 | } |
363 | 363 | } |
364 | - if ( $show_desc && $desc ) { |
|
365 | - echo '<p style="margin-top: .5em">' . $desc . '</p>'; |
|
364 | + if ($show_desc && $desc) { |
|
365 | + echo '<p style="margin-top: .5em">'.$desc.'</p>'; |
|
366 | 366 | } |
367 | 367 | echo '</li>'; |
368 | 368 | } |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | * @return string |
386 | 386 | */ |
387 | 387 | public function make_the_title_a_link($title) { |
388 | - return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
388 | + return '<a href="'.EEH_Event_View::event_archive_url().'">'.$title.'</a>'; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | } |
@@ -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 | * |
@@ -357,7 +359,7 @@ discard block |
||
357 | 359 | $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' )); |
358 | 360 | if ( $date_range == TRUE ) { |
359 | 361 | echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() ); |
360 | - }else{ |
|
362 | + } else{ |
|
361 | 363 | echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit ); |
362 | 364 | } |
363 | 365 | } |
@@ -647,6 +647,7 @@ |
||
647 | 647 | * @access public |
648 | 648 | * @static |
649 | 649 | * @param string $table_name, without prefixed $wpdb->prefix |
650 | + * @param string $table_name |
|
650 | 651 | * @return array of database column names |
651 | 652 | */ |
652 | 653 | public static function get_fields_on_table( $table_name = NULL ) { |
@@ -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 | * |
@@ -140,15 +142,15 @@ discard block |
||
140 | 142 | ); |
141 | 143 | if( $which_to_include === 'all' ) { |
142 | 144 | //leave as-is |
143 | - }elseif( $which_to_include === 'old' ) { |
|
145 | + } elseif( $which_to_include === 'old' ) { |
|
144 | 146 | $cron_tasks = array_filter( $cron_tasks, function ( $value ) { |
145 | 147 | return $value === EEH_Activation::cron_task_no_longer_in_use; |
146 | 148 | }); |
147 | - }elseif( $which_to_include === 'current' ) { |
|
149 | + } elseif( $which_to_include === 'current' ) { |
|
148 | 150 | $cron_tasks = array_filter( $cron_tasks ); |
149 | - }elseif( WP_DEBUG ) { |
|
151 | + } elseif( WP_DEBUG ) { |
|
150 | 152 | throw new EE_Error( sprintf( __( 'Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso' ), $which_to_include ) ); |
151 | - }else{ |
|
153 | + } else{ |
|
152 | 154 | //leave as-is |
153 | 155 | } |
154 | 156 | return $cron_tasks; |
@@ -401,7 +403,7 @@ discard block |
||
401 | 403 | $post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1"); |
402 | 404 | if($post_id){ |
403 | 405 | return get_post($post_id); |
404 | - }else{ |
|
406 | + } else{ |
|
405 | 407 | return NULL; |
406 | 408 | } |
407 | 409 | |
@@ -772,13 +774,13 @@ discard block |
||
772 | 774 | foreach( $current_data_migration_script->get_errors() as $error ){ |
773 | 775 | EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ ); |
774 | 776 | } |
775 | - }else{ |
|
777 | + } else{ |
|
776 | 778 | EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) ); |
777 | 779 | } |
778 | 780 | return false; |
779 | 781 | } |
780 | 782 | EE_Data_Migration_Manager::instance()->update_current_database_state_to(); |
781 | - }else{ |
|
783 | + } else{ |
|
782 | 784 | EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
783 | 785 | return false; |
784 | 786 | } |
@@ -1070,7 +1072,7 @@ discard block |
||
1070 | 1072 | if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){ |
1071 | 1073 | EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
1072 | 1074 | EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
1073 | - }else{ |
|
1075 | + } else{ |
|
1074 | 1076 | EEM_Payment_Method::instance()->verify_button_urls(); |
1075 | 1077 | } |
1076 | 1078 | } |
@@ -1226,7 +1228,9 @@ discard block |
||
1226 | 1228 | //do an initial loop to determine if we need to continue |
1227 | 1229 | $def_ms = array(); |
1228 | 1230 | foreach ( $default_messengers as $msgr ) { |
1229 | - if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue; |
|
1231 | + if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) { |
|
1232 | + continue; |
|
1233 | + } |
|
1230 | 1234 | $def_ms[] = $msgr; |
1231 | 1235 | } |
1232 | 1236 | |
@@ -1555,7 +1559,7 @@ discard block |
||
1555 | 1559 | if( ! delete_option( $option_name ) ){ |
1556 | 1560 | $undeleted_options[] = $option_name; |
1557 | 1561 | } |
1558 | - }else{ |
|
1562 | + } else{ |
|
1559 | 1563 | $option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" ); |
1560 | 1564 | foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){ |
1561 | 1565 | if( ! delete_option( $option_name_from_wildcard ) ){ |
@@ -1619,7 +1623,7 @@ discard block |
||
1619 | 1623 | $EZSQL_ERROR = $ezsql_error_cache; |
1620 | 1624 | if( empty( $new_error ) ){ |
1621 | 1625 | return TRUE; |
1622 | - }else{ |
|
1626 | + } else{ |
|
1623 | 1627 | return FALSE; |
1624 | 1628 | } |
1625 | 1629 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | if ( is_array( $hooks_to_fire_at_time ) ) { |
207 | 207 | foreach ( $hooks_to_fire_at_time as $hook_name => $hook_actions ) { |
208 | 208 | if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] ) |
209 | - && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
209 | + && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
210 | 210 | ) { |
211 | 211 | unset( $crons[ $timestamp ][ $hook_name ] ); |
212 | 212 | } |
@@ -1120,14 +1120,14 @@ discard block |
||
1120 | 1120 | $QSG_ID = reset( $id_col ); |
1121 | 1121 | } else { |
1122 | 1122 | //ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method |
1123 | - EE_Log::instance()->log( |
|
1124 | - __FILE__, |
|
1125 | - __FUNCTION__, |
|
1126 | - sprintf( |
|
1127 | - __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1128 | - $QST_ID ), |
|
1129 | - 'error' ); |
|
1130 | - continue; |
|
1123 | + EE_Log::instance()->log( |
|
1124 | + __FILE__, |
|
1125 | + __FUNCTION__, |
|
1126 | + sprintf( |
|
1127 | + __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1128 | + $QST_ID ), |
|
1129 | + 'error' ); |
|
1130 | + continue; |
|
1131 | 1131 | } |
1132 | 1132 | } |
1133 | 1133 | |
@@ -1657,8 +1657,8 @@ discard block |
||
1657 | 1657 | } |
1658 | 1658 | } |
1659 | 1659 | } |
1660 | - //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
|
1661 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1660 | + //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
|
1661 | + remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1662 | 1662 | |
1663 | 1663 | if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
1664 | 1664 | $db_update_sans_ee4 = array(); |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | * @param $table_name |
58 | 58 | * @return string |
59 | 59 | */ |
60 | - public static function ensure_table_name_has_prefix( $table_name ) { |
|
60 | + public static function ensure_table_name_has_prefix($table_name) { |
|
61 | 61 | global $wpdb; |
62 | - return strpos( $table_name, $wpdb->prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name; |
|
62 | + return strpos($table_name, $wpdb->prefix) === 0 ? $table_name : $wpdb->prefix.$table_name; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * be called on plugin activation and reactivation |
86 | 86 | * @return boolean success, whether the database and folders are setup properly |
87 | 87 | */ |
88 | - public static function initialize_db_and_folders(){ |
|
88 | + public static function initialize_db_and_folders() { |
|
89 | 89 | $good_filesystem = EEH_Activation::create_upload_directories(); |
90 | 90 | $good_db = EEH_Activation::create_database_tables(); |
91 | 91 | return $good_filesystem && $good_db; |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | * upon activation of a new plugin, reactivation, and at the end |
100 | 100 | * of running migration scripts |
101 | 101 | */ |
102 | - public static function initialize_db_content(){ |
|
102 | + public static function initialize_db_content() { |
|
103 | 103 | //let's avoid doing all this logic repeatedly, especially when addons are requesting it |
104 | - if( EEH_Activation::$_initialized_db_content_already_in_this_request ) { |
|
104 | + if (EEH_Activation::$_initialized_db_content_already_in_this_request) { |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | EEH_Activation::$_initialized_db_content_already_in_this_request = true; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | EEH_Activation::remove_cron_tasks(); |
119 | 119 | EEH_Activation::create_cron_tasks(); |
120 | 120 | //also, check for CAF default db content |
121 | - do_action( 'AHEE__EEH_Activation__initialize_db_content' ); |
|
121 | + do_action('AHEE__EEH_Activation__initialize_db_content'); |
|
122 | 122 | //also: EEM_Gateways::load_all_gateways() outputs a lot of success messages |
123 | 123 | //which users really won't care about on initial activation |
124 | 124 | EE_Error::overwrite_success(); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @return array |
138 | 138 | * @throws \EE_Error |
139 | 139 | */ |
140 | - public static function get_cron_tasks( $which_to_include ) { |
|
140 | + public static function get_cron_tasks($which_to_include) { |
|
141 | 141 | $cron_tasks = apply_filters( |
142 | 142 | 'FHEE__EEH_Activation__get_cron_tasks', |
143 | 143 | array( |
@@ -146,17 +146,17 @@ discard block |
||
146 | 146 | 'AHEE__EE_Cron_Tasks__update_transaction_with_payment' => EEH_Activation::cron_task_no_longer_in_use, //there may have been a bug which prevented from these cron tasks from getting unscheduled, so we might want to remove these for a few updates |
147 | 147 | ) |
148 | 148 | ); |
149 | - if( $which_to_include === 'all' ) { |
|
149 | + if ($which_to_include === 'all') { |
|
150 | 150 | //leave as-is |
151 | - }elseif( $which_to_include === 'old' ) { |
|
152 | - $cron_tasks = array_filter( $cron_tasks, function ( $value ) { |
|
151 | + }elseif ($which_to_include === 'old') { |
|
152 | + $cron_tasks = array_filter($cron_tasks, function($value) { |
|
153 | 153 | return $value === EEH_Activation::cron_task_no_longer_in_use; |
154 | 154 | }); |
155 | - }elseif( $which_to_include === 'current' ) { |
|
156 | - $cron_tasks = array_filter( $cron_tasks ); |
|
157 | - }elseif( WP_DEBUG ) { |
|
158 | - throw new EE_Error( sprintf( __( 'Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso' ), $which_to_include ) ); |
|
159 | - }else{ |
|
155 | + }elseif ($which_to_include === 'current') { |
|
156 | + $cron_tasks = array_filter($cron_tasks); |
|
157 | + }elseif (WP_DEBUG) { |
|
158 | + throw new EE_Error(sprintf(__('Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso'), $which_to_include)); |
|
159 | + } else { |
|
160 | 160 | //leave as-is |
161 | 161 | } |
162 | 162 | return $cron_tasks; |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public static function create_cron_tasks() { |
169 | 169 | |
170 | - foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) { |
|
171 | - if( ! wp_next_scheduled( $hook_name ) ) { |
|
172 | - wp_schedule_event( time(), $frequency, $hook_name ); |
|
170 | + foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) { |
|
171 | + if ( ! wp_next_scheduled($hook_name)) { |
|
172 | + wp_schedule_event(time(), $frequency, $hook_name); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | * Remove the currently-existing and now-removed cron tasks. |
180 | 180 | * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones |
181 | 181 | */ |
182 | - public static function remove_cron_tasks( $remove_all = true ) { |
|
182 | + public static function remove_cron_tasks($remove_all = true) { |
|
183 | 183 | $cron_tasks_to_remove = $remove_all ? 'all' : 'old'; |
184 | 184 | $crons = _get_cron_array(); |
185 | - $crons = is_array( $crons ) ? $crons : array(); |
|
185 | + $crons = is_array($crons) ? $crons : array(); |
|
186 | 186 | /* reminder of what $crons look like: |
187 | 187 | * Top-level keys are timestamps, and their values are arrays. |
188 | 188 | * The 2nd level arrays have keys with each of the cron task hook names to run at that time |
@@ -200,23 +200,23 @@ discard block |
||
200 | 200 | * ... |
201 | 201 | * ... |
202 | 202 | */ |
203 | - $ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks( $cron_tasks_to_remove ); |
|
204 | - foreach ( $crons as $timestamp => $hooks_to_fire_at_time ) { |
|
205 | - if ( is_array( $hooks_to_fire_at_time ) ) { |
|
206 | - foreach ( $hooks_to_fire_at_time as $hook_name => $hook_actions ) { |
|
207 | - if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
208 | - && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
203 | + $ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks($cron_tasks_to_remove); |
|
204 | + foreach ($crons as $timestamp => $hooks_to_fire_at_time) { |
|
205 | + if (is_array($hooks_to_fire_at_time)) { |
|
206 | + foreach ($hooks_to_fire_at_time as $hook_name => $hook_actions) { |
|
207 | + if (isset($ee_cron_tasks_to_remove[$hook_name]) |
|
208 | + && is_array($ee_cron_tasks_to_remove[$hook_name]) |
|
209 | 209 | ) { |
210 | - unset( $crons[ $timestamp ][ $hook_name ] ); |
|
210 | + unset($crons[$timestamp][$hook_name]); |
|
211 | 211 | } |
212 | 212 | } |
213 | 213 | //also take care of any empty cron timestamps. |
214 | - if ( empty( $hooks_to_fire_at_time ) ) { |
|
215 | - unset( $crons[ $timestamp ] ); |
|
214 | + if (empty($hooks_to_fire_at_time)) { |
|
215 | + unset($crons[$timestamp]); |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 | } |
219 | - _set_cron_array( $crons ); |
|
219 | + _set_cron_array($crons); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public static function CPT_initialization() { |
233 | 233 | // register Custom Post Types |
234 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
234 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
235 | 235 | flush_rewrite_rules(); |
236 | 236 | } |
237 | 237 | |
@@ -249,8 +249,8 @@ discard block |
||
249 | 249 | * @return void |
250 | 250 | */ |
251 | 251 | public static function reset_and_update_config() { |
252 | - do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) ); |
|
253 | - add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 ); |
|
252 | + do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config')); |
|
253 | + add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3); |
|
254 | 254 | //EE_Config::reset(); |
255 | 255 | } |
256 | 256 | |
@@ -263,23 +263,23 @@ discard block |
||
263 | 263 | */ |
264 | 264 | public static function load_calendar_config() { |
265 | 265 | // grab array of all plugin folders and loop thru it |
266 | - $plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR ); |
|
267 | - if ( empty( $plugins ) ) { |
|
266 | + $plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR); |
|
267 | + if (empty($plugins)) { |
|
268 | 268 | return; |
269 | 269 | } |
270 | - foreach ( $plugins as $plugin_path ) { |
|
270 | + foreach ($plugins as $plugin_path) { |
|
271 | 271 | // grab plugin folder name from path |
272 | - $plugin = basename( $plugin_path ); |
|
272 | + $plugin = basename($plugin_path); |
|
273 | 273 | // drill down to Espresso plugins |
274 | - if ( strpos( $plugin, 'espresso' ) !== FALSE || strpos( $plugin, 'Espresso' ) !== FALSE || strpos( $plugin, 'ee4' ) !== FALSE || strpos( $plugin, 'EE4' ) !== FALSE ) { |
|
274 | + if (strpos($plugin, 'espresso') !== FALSE || strpos($plugin, 'Espresso') !== FALSE || strpos($plugin, 'ee4') !== FALSE || strpos($plugin, 'EE4') !== FALSE) { |
|
275 | 275 | // then to calendar related plugins |
276 | - if ( strpos( $plugin, 'calendar' ) !== FALSE ) { |
|
276 | + if (strpos($plugin, 'calendar') !== FALSE) { |
|
277 | 277 | // this is what we are looking for |
278 | - $calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php'; |
|
278 | + $calendar_config = $plugin_path.DS.'EE_Calendar_Config.php'; |
|
279 | 279 | // does it exist in this folder ? |
280 | - if ( is_readable( $calendar_config )) { |
|
280 | + if (is_readable($calendar_config)) { |
|
281 | 281 | // YEAH! let's load it |
282 | - require_once( $calendar_config ); |
|
282 | + require_once($calendar_config); |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | } |
@@ -296,21 +296,21 @@ discard block |
||
296 | 296 | * @param \EE_Config $EE_Config |
297 | 297 | * @return \stdClass |
298 | 298 | */ |
299 | - public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) { |
|
300 | - $convert_from_array = array( 'addons' ); |
|
299 | + public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) { |
|
300 | + $convert_from_array = array('addons'); |
|
301 | 301 | // in case old settings were saved as an array |
302 | - if ( is_array( $settings ) && in_array( $config, $convert_from_array )) { |
|
302 | + if (is_array($settings) && in_array($config, $convert_from_array)) { |
|
303 | 303 | // convert existing settings to an object |
304 | 304 | $config_array = $settings; |
305 | 305 | $settings = new stdClass(); |
306 | - foreach ( $config_array as $key => $value ){ |
|
307 | - if ( $key == 'calendar' && class_exists( 'EE_Calendar_Config' )) { |
|
308 | - $EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value ); |
|
306 | + foreach ($config_array as $key => $value) { |
|
307 | + if ($key == 'calendar' && class_exists('EE_Calendar_Config')) { |
|
308 | + $EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value); |
|
309 | 309 | } else { |
310 | 310 | $settings->{$key} = $value; |
311 | 311 | } |
312 | 312 | } |
313 | - add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' ); |
|
313 | + add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true'); |
|
314 | 314 | } |
315 | 315 | return $settings; |
316 | 316 | } |
@@ -326,8 +326,8 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public static function deactivate_event_espresso() { |
328 | 328 | // check permissions |
329 | - if ( current_user_can( 'activate_plugins' )) { |
|
330 | - deactivate_plugins( EE_PLUGIN_BASENAME, TRUE ); |
|
329 | + if (current_user_can('activate_plugins')) { |
|
330 | + deactivate_plugins(EE_PLUGIN_BASENAME, TRUE); |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
@@ -349,25 +349,25 @@ discard block |
||
349 | 349 | $critical_pages = array( |
350 | 350 | array( |
351 | 351 | 'id' =>'reg_page_id', |
352 | - 'name' => __( 'Registration Checkout', 'event_espresso' ), |
|
352 | + 'name' => __('Registration Checkout', 'event_espresso'), |
|
353 | 353 | 'post' => NULL, |
354 | 354 | 'code' => 'ESPRESSO_CHECKOUT' |
355 | 355 | ), |
356 | 356 | array( |
357 | 357 | 'id' => 'txn_page_id', |
358 | - 'name' => __( 'Transactions', 'event_espresso' ), |
|
358 | + 'name' => __('Transactions', 'event_espresso'), |
|
359 | 359 | 'post' => NULL, |
360 | 360 | 'code' => 'ESPRESSO_TXN_PAGE' |
361 | 361 | ), |
362 | 362 | array( |
363 | 363 | 'id' => 'thank_you_page_id', |
364 | - 'name' => __( 'Thank You', 'event_espresso' ), |
|
364 | + 'name' => __('Thank You', 'event_espresso'), |
|
365 | 365 | 'post' => NULL, |
366 | 366 | 'code' => 'ESPRESSO_THANK_YOU' |
367 | 367 | ), |
368 | 368 | array( |
369 | 369 | 'id' => 'cancel_page_id', |
370 | - 'name' => __( 'Registration Cancelled', 'event_espresso' ), |
|
370 | + 'name' => __('Registration Cancelled', 'event_espresso'), |
|
371 | 371 | 'post' => NULL, |
372 | 372 | 'code' => 'ESPRESSO_CANCELLED' |
373 | 373 | ), |
@@ -375,62 +375,62 @@ discard block |
||
375 | 375 | |
376 | 376 | $EE_Core_Config = EE_Registry::instance()->CFG->core; |
377 | 377 | |
378 | - foreach ( $critical_pages as $critical_page ) { |
|
378 | + foreach ($critical_pages as $critical_page) { |
|
379 | 379 | // is critical page ID set in config ? |
380 | - if ( $EE_Core_Config->{$critical_page[ 'id' ]} !== FALSE ) { |
|
380 | + if ($EE_Core_Config->{$critical_page['id']} !== FALSE) { |
|
381 | 381 | // attempt to find post by ID |
382 | - $critical_page['post'] = get_post( $EE_Core_Config->{$critical_page[ 'id' ]} ); |
|
382 | + $critical_page['post'] = get_post($EE_Core_Config->{$critical_page['id']} ); |
|
383 | 383 | } |
384 | 384 | // no dice? |
385 | - if ( $critical_page['post'] == NULL ) { |
|
385 | + if ($critical_page['post'] == NULL) { |
|
386 | 386 | // attempt to find post by title |
387 | - $critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] ); |
|
387 | + $critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']); |
|
388 | 388 | // still nothing? |
389 | - if ( $critical_page['post'] == NULL ) { |
|
390 | - $critical_page = EEH_Activation::create_critical_page( $critical_page ); |
|
389 | + if ($critical_page['post'] == NULL) { |
|
390 | + $critical_page = EEH_Activation::create_critical_page($critical_page); |
|
391 | 391 | // REALLY? Still nothing ??!?!? |
392 | - if ( $critical_page['post'] == NULL ) { |
|
393 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
394 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
392 | + if ($critical_page['post'] == NULL) { |
|
393 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
394 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
395 | 395 | break; |
396 | 396 | } |
397 | 397 | } |
398 | 398 | } |
399 | 399 | // track post_shortcodes |
400 | - if ( $critical_page['post'] ) { |
|
401 | - EEH_Activation::_track_critical_page_post_shortcodes( $critical_page ); |
|
400 | + if ($critical_page['post']) { |
|
401 | + EEH_Activation::_track_critical_page_post_shortcodes($critical_page); |
|
402 | 402 | } |
403 | 403 | // check that Post ID matches critical page ID in config |
404 | 404 | if ( |
405 | - isset( $critical_page['post']->ID ) |
|
406 | - && $critical_page['post']->ID != $EE_Core_Config->{$critical_page[ 'id' ]} |
|
405 | + isset($critical_page['post']->ID) |
|
406 | + && $critical_page['post']->ID != $EE_Core_Config->{$critical_page['id']} |
|
407 | 407 | ) { |
408 | 408 | //update Config with post ID |
409 | - $EE_Core_Config->{$critical_page[ 'id' ]} = $critical_page['post']->ID; |
|
410 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) { |
|
411 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
412 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
409 | + $EE_Core_Config->{$critical_page['id']} = $critical_page['post']->ID; |
|
410 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
411 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
412 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
416 | 416 | $critical_page_problem = |
417 | - ! isset( $critical_page['post']->post_status ) |
|
417 | + ! isset($critical_page['post']->post_status) |
|
418 | 418 | || $critical_page['post']->post_status != 'publish' |
419 | - || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE |
|
419 | + || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE |
|
420 | 420 | ? TRUE |
421 | 421 | : $critical_page_problem; |
422 | 422 | |
423 | 423 | } |
424 | 424 | |
425 | - if ( $critical_page_problem ) { |
|
425 | + if ($critical_page_problem) { |
|
426 | 426 | $msg = sprintf( |
427 | - __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ), |
|
428 | - '<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>' |
|
427 | + __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'), |
|
428 | + '<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>' |
|
429 | 429 | ); |
430 | - EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg ); |
|
430 | + EE_Error::add_persistent_admin_notice('critical_page_problem', $msg); |
|
431 | 431 | } |
432 | - if ( EE_Error::has_notices() ) { |
|
433 | - EE_Error::get_notices( FALSE, TRUE, TRUE ); |
|
432 | + if (EE_Error::has_notices()) { |
|
433 | + EE_Error::get_notices(FALSE, TRUE, TRUE); |
|
434 | 434 | } |
435 | 435 | } |
436 | 436 | |
@@ -442,13 +442,13 @@ discard block |
||
442 | 442 | * parameter to the shortcode |
443 | 443 | * @return WP_Post or NULl |
444 | 444 | */ |
445 | - public static function get_page_by_ee_shortcode($ee_shortcode){ |
|
445 | + public static function get_page_by_ee_shortcode($ee_shortcode) { |
|
446 | 446 | global $wpdb; |
447 | 447 | $shortcode_and_opening_bracket = '['.$ee_shortcode; |
448 | 448 | $post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1"); |
449 | - if($post_id){ |
|
449 | + if ($post_id) { |
|
450 | 450 | return get_post($post_id); |
451 | - }else{ |
|
451 | + } else { |
|
452 | 452 | return NULL; |
453 | 453 | } |
454 | 454 | |
@@ -465,32 +465,32 @@ discard block |
||
465 | 465 | * @param array $critical_page |
466 | 466 | * @return array |
467 | 467 | */ |
468 | - public static function create_critical_page( $critical_page ) { |
|
468 | + public static function create_critical_page($critical_page) { |
|
469 | 469 | |
470 | 470 | $post_args = array( |
471 | 471 | 'post_title' => $critical_page['name'], |
472 | 472 | 'post_status' => 'publish', |
473 | 473 | 'post_type' => 'page', |
474 | 474 | 'comment_status' => 'closed', |
475 | - 'post_content' => '[' . $critical_page['code'] . ']' |
|
475 | + 'post_content' => '['.$critical_page['code'].']' |
|
476 | 476 | ); |
477 | 477 | |
478 | - $post_id = wp_insert_post( $post_args ); |
|
479 | - if ( ! $post_id ) { |
|
478 | + $post_id = wp_insert_post($post_args); |
|
479 | + if ( ! $post_id) { |
|
480 | 480 | $msg = sprintf( |
481 | - __( 'The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso' ), |
|
481 | + __('The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso'), |
|
482 | 482 | $critical_page['name'] |
483 | 483 | ); |
484 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
484 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
485 | 485 | return $critical_page; |
486 | 486 | } |
487 | 487 | // get newly created post's details |
488 | - if ( ! $critical_page['post'] = get_post( $post_id )) { |
|
488 | + if ( ! $critical_page['post'] = get_post($post_id)) { |
|
489 | 489 | $msg = sprintf( |
490 | - __( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ), |
|
490 | + __('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'), |
|
491 | 491 | $critical_page['name'] |
492 | 492 | ); |
493 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
493 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | return $critical_page; |
@@ -509,35 +509,35 @@ discard block |
||
509 | 509 | * @param array $critical_page |
510 | 510 | * @return void |
511 | 511 | */ |
512 | - private static function _track_critical_page_post_shortcodes( $critical_page = array() ) { |
|
512 | + private static function _track_critical_page_post_shortcodes($critical_page = array()) { |
|
513 | 513 | // check the goods |
514 | - if ( ! $critical_page['post'] instanceof WP_Post ) { |
|
514 | + if ( ! $critical_page['post'] instanceof WP_Post) { |
|
515 | 515 | $msg = sprintf( |
516 | - __( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ), |
|
516 | + __('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'), |
|
517 | 517 | $critical_page['name'] |
518 | 518 | ); |
519 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
519 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
520 | 520 | return; |
521 | 521 | } |
522 | 522 | $EE_Core_Config = EE_Registry::instance()->CFG->core; |
523 | 523 | // map shortcode to post |
524 | - $EE_Core_Config->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID; |
|
524 | + $EE_Core_Config->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID; |
|
525 | 525 | // and make sure it's NOT added to the WP "Posts Page" |
526 | 526 | // name of the WP Posts Page |
527 | 527 | $posts_page = EE_Registry::instance()->CFG->get_page_for_posts(); |
528 | - if ( isset( $EE_Core_Config->post_shortcodes[ $posts_page ] )) { |
|
529 | - unset( $EE_Core_Config->post_shortcodes[ $posts_page ][ $critical_page['code'] ] ); |
|
528 | + if (isset($EE_Core_Config->post_shortcodes[$posts_page])) { |
|
529 | + unset($EE_Core_Config->post_shortcodes[$posts_page][$critical_page['code']]); |
|
530 | 530 | } |
531 | - if ( $posts_page != 'posts' && isset( $EE_Core_Config->post_shortcodes['posts'] )) { |
|
532 | - unset( $EE_Core_Config->post_shortcodes['posts'][ $critical_page['code'] ] ); |
|
531 | + if ($posts_page != 'posts' && isset($EE_Core_Config->post_shortcodes['posts'])) { |
|
532 | + unset($EE_Core_Config->post_shortcodes['posts'][$critical_page['code']]); |
|
533 | 533 | } |
534 | 534 | // update post_shortcode CFG |
535 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) { |
|
535 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
536 | 536 | $msg = sprintf( |
537 | - __( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ), |
|
537 | + __('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'), |
|
538 | 538 | $critical_page['name'] |
539 | 539 | ); |
540 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
540 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
541 | 541 | } |
542 | 542 | } |
543 | 543 | |
@@ -555,24 +555,24 @@ discard block |
||
555 | 555 | public static function get_default_creator_id() { |
556 | 556 | global $wpdb; |
557 | 557 | |
558 | - if ( ! empty( self::$_default_creator_id ) ) { |
|
558 | + if ( ! empty(self::$_default_creator_id)) { |
|
559 | 559 | return self::$_default_creator_id; |
560 | 560 | }/**/ |
561 | 561 | |
562 | - $role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' ); |
|
562 | + $role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator'); |
|
563 | 563 | |
564 | 564 | //let's allow pre_filtering for early exits by alternative methods for getting id. We check for truthy result and if so then exit early. |
565 | - $pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check ); |
|
566 | - if ( $pre_filtered_id !== false ) { |
|
565 | + $pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check); |
|
566 | + if ($pre_filtered_id !== false) { |
|
567 | 567 | return (int) $pre_filtered_id; |
568 | 568 | } |
569 | 569 | |
570 | - $capabilities_key = EEH_Activation::ensure_table_name_has_prefix( 'capabilities' ); |
|
571 | - $query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' ); |
|
572 | - $user_id = $wpdb->get_var( $query ); |
|
573 | - $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id ); |
|
574 | - if ( $user_id && intval( $user_id ) ) { |
|
575 | - self::$_default_creator_id = intval( $user_id ); |
|
570 | + $capabilities_key = EEH_Activation::ensure_table_name_has_prefix('capabilities'); |
|
571 | + $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%'); |
|
572 | + $user_id = $wpdb->get_var($query); |
|
573 | + $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id); |
|
574 | + if ($user_id && intval($user_id)) { |
|
575 | + self::$_default_creator_id = intval($user_id); |
|
576 | 576 | return self::$_default_creator_id; |
577 | 577 | } else { |
578 | 578 | return NULL; |
@@ -599,29 +599,29 @@ discard block |
||
599 | 599 | * @return void |
600 | 600 | * @throws EE_Error if there are database errors |
601 | 601 | */ |
602 | - public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) { |
|
603 | - if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){ |
|
602 | + public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) { |
|
603 | + if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) { |
|
604 | 604 | return; |
605 | 605 | } |
606 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
607 | - if ( ! function_exists( 'dbDelta' )) { |
|
608 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
606 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
607 | + if ( ! function_exists('dbDelta')) { |
|
608 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
609 | 609 | } |
610 | 610 | /** @var WPDB $wpdb */ |
611 | 611 | global $wpdb; |
612 | - $wp_table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
612 | + $wp_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
613 | 613 | // do we need to first delete an existing version of this table ? |
614 | - if ( $drop_pre_existing_table && EEH_Activation::table_exists( $wp_table_name ) ){ |
|
614 | + if ($drop_pre_existing_table && EEH_Activation::table_exists($wp_table_name)) { |
|
615 | 615 | // ok, delete the table... but ONLY if it's empty |
616 | - $deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name ); |
|
616 | + $deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name); |
|
617 | 617 | // table is NOT empty, are you SURE you want to delete this table ??? |
618 | - if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){ |
|
619 | - EEH_Activation::delete_unused_db_table( $wp_table_name ); |
|
620 | - } else if ( ! $deleted_safely ) { |
|
618 | + if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) { |
|
619 | + EEH_Activation::delete_unused_db_table($wp_table_name); |
|
620 | + } else if ( ! $deleted_safely) { |
|
621 | 621 | // so we should be more cautious rather than just dropping tables so easily |
622 | 622 | EE_Error::add_persistent_admin_notice( |
623 | - 'bad_table_' . $wp_table_name . '_detected', |
|
624 | - sprintf( __( 'Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ), |
|
623 | + 'bad_table_'.$wp_table_name.'_detected', |
|
624 | + sprintf(__('Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'), |
|
625 | 625 | $wp_table_name, |
626 | 626 | "<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>", |
627 | 627 | '<b>wp-config.php</b>', |
@@ -630,25 +630,25 @@ discard block |
||
630 | 630 | } |
631 | 631 | } |
632 | 632 | // does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns ) |
633 | - if ( preg_match( '((((.*?))(,\s))+)', $sql, $valid_column_data ) ) { |
|
633 | + if (preg_match('((((.*?))(,\s))+)', $sql, $valid_column_data)) { |
|
634 | 634 | $SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; |
635 | 635 | //get $wpdb to echo errors, but buffer them. This way at least WE know an error |
636 | 636 | //happened. And then we can choose to tell the end user |
637 | - $old_show_errors_policy = $wpdb->show_errors( TRUE ); |
|
638 | - $old_error_suppression_policy = $wpdb->suppress_errors( FALSE ); |
|
637 | + $old_show_errors_policy = $wpdb->show_errors(TRUE); |
|
638 | + $old_error_suppression_policy = $wpdb->suppress_errors(FALSE); |
|
639 | 639 | ob_start(); |
640 | - dbDelta( $SQL ); |
|
640 | + dbDelta($SQL); |
|
641 | 641 | $output = ob_get_contents(); |
642 | 642 | ob_end_clean(); |
643 | - $wpdb->show_errors( $old_show_errors_policy ); |
|
644 | - $wpdb->suppress_errors( $old_error_suppression_policy ); |
|
645 | - if( ! empty( $output ) ){ |
|
646 | - throw new EE_Error( $output ); |
|
643 | + $wpdb->show_errors($old_show_errors_policy); |
|
644 | + $wpdb->suppress_errors($old_error_suppression_policy); |
|
645 | + if ( ! empty($output)) { |
|
646 | + throw new EE_Error($output); |
|
647 | 647 | } |
648 | 648 | } else { |
649 | 649 | throw new EE_Error( |
650 | 650 | sprintf( |
651 | - __( 'The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso' ), |
|
651 | + __('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso'), |
|
652 | 652 | '<br />', |
653 | 653 | $sql |
654 | 654 | ) |
@@ -670,15 +670,15 @@ discard block |
||
670 | 670 | * @param string $column_info if your SQL were 'ALTER TABLE table_name ADD price VARCHAR(10)', this would be 'VARCHAR(10)' |
671 | 671 | * @return bool|int |
672 | 672 | */ |
673 | - public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){ |
|
674 | - if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){ |
|
673 | + public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') { |
|
674 | + if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) { |
|
675 | 675 | return FALSE; |
676 | 676 | } |
677 | 677 | global $wpdb; |
678 | - $full_table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
678 | + $full_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
679 | 679 | $fields = self::get_fields_on_table($table_name); |
680 | - if (!in_array($column_name, $fields)){ |
|
681 | - $alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
680 | + if ( ! in_array($column_name, $fields)) { |
|
681 | + $alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
682 | 682 | //echo "alter query:$alter_query"; |
683 | 683 | return $wpdb->query($alter_query); |
684 | 684 | } |
@@ -697,15 +697,15 @@ discard block |
||
697 | 697 | * @param string $table_name, without prefixed $wpdb->prefix |
698 | 698 | * @return array of database column names |
699 | 699 | */ |
700 | - public static function get_fields_on_table( $table_name = NULL ) { |
|
700 | + public static function get_fields_on_table($table_name = NULL) { |
|
701 | 701 | global $wpdb; |
702 | - $table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
703 | - if ( ! empty( $table_name )) { |
|
702 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
703 | + if ( ! empty($table_name)) { |
|
704 | 704 | $columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name "); |
705 | 705 | if ($columns !== FALSE) { |
706 | 706 | $field_array = array(); |
707 | - foreach($columns as $column ){ |
|
708 | - $field_array[] = $column->Field;; |
|
707 | + foreach ($columns as $column) { |
|
708 | + $field_array[] = $column->Field; ; |
|
709 | 709 | } |
710 | 710 | return $field_array; |
711 | 711 | } |
@@ -723,12 +723,12 @@ discard block |
||
723 | 723 | * @param string $table_name |
724 | 724 | * @return bool |
725 | 725 | */ |
726 | - public static function db_table_is_empty( $table_name ) { |
|
726 | + public static function db_table_is_empty($table_name) { |
|
727 | 727 | global $wpdb; |
728 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
729 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
730 | - $count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" ); |
|
731 | - return absint( $count ) === 0 ? true : false; |
|
728 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
729 | + if (EEH_Activation::table_exists($table_name)) { |
|
730 | + $count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name"); |
|
731 | + return absint($count) === 0 ? true : false; |
|
732 | 732 | } |
733 | 733 | return false; |
734 | 734 | } |
@@ -743,9 +743,9 @@ discard block |
||
743 | 743 | * @param string $table_name |
744 | 744 | * @return bool | int |
745 | 745 | */ |
746 | - public static function delete_db_table_if_empty( $table_name ) { |
|
747 | - if ( EEH_Activation::db_table_is_empty( $table_name ) ) { |
|
748 | - return EEH_Activation::delete_unused_db_table( $table_name ); |
|
746 | + public static function delete_db_table_if_empty($table_name) { |
|
747 | + if (EEH_Activation::db_table_is_empty($table_name)) { |
|
748 | + return EEH_Activation::delete_unused_db_table($table_name); |
|
749 | 749 | } |
750 | 750 | return false; |
751 | 751 | } |
@@ -760,11 +760,11 @@ discard block |
||
760 | 760 | * @param string $table_name |
761 | 761 | * @return bool | int |
762 | 762 | */ |
763 | - public static function delete_unused_db_table( $table_name ) { |
|
763 | + public static function delete_unused_db_table($table_name) { |
|
764 | 764 | global $wpdb; |
765 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
766 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
767 | - return $wpdb->query( "DROP TABLE IF EXISTS $table_name" ); |
|
765 | + if (EEH_Activation::table_exists($table_name)) { |
|
766 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
767 | + return $wpdb->query("DROP TABLE IF EXISTS $table_name"); |
|
768 | 768 | } |
769 | 769 | return false; |
770 | 770 | } |
@@ -780,18 +780,18 @@ discard block |
||
780 | 780 | * @param string $index_name |
781 | 781 | * @return bool | int |
782 | 782 | */ |
783 | - public static function drop_index( $table_name, $index_name ) { |
|
784 | - if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){ |
|
783 | + public static function drop_index($table_name, $index_name) { |
|
784 | + if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) { |
|
785 | 785 | return FALSE; |
786 | 786 | } |
787 | 787 | global $wpdb; |
788 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
788 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
789 | 789 | $index_exists_query = "SHOW INDEX FROM $table_name WHERE Key_name = '$index_name'"; |
790 | 790 | if ( |
791 | - $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) == $table_name |
|
792 | - && $wpdb->get_var( $index_exists_query ) == $table_name //using get_var with the $index_exists_query returns the table's name |
|
791 | + $wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name |
|
792 | + && $wpdb->get_var($index_exists_query) == $table_name //using get_var with the $index_exists_query returns the table's name |
|
793 | 793 | ) { |
794 | - return $wpdb->query( "ALTER TABLE $table_name DROP INDEX $index_name" ); |
|
794 | + return $wpdb->query("ALTER TABLE $table_name DROP INDEX $index_name"); |
|
795 | 795 | } |
796 | 796 | return TRUE; |
797 | 797 | } |
@@ -807,27 +807,27 @@ discard block |
||
807 | 807 | * @return boolean success (whether database is setup properly or not) |
808 | 808 | */ |
809 | 809 | public static function create_database_tables() { |
810 | - EE_Registry::instance()->load_core( 'Data_Migration_Manager' ); |
|
810 | + EE_Registry::instance()->load_core('Data_Migration_Manager'); |
|
811 | 811 | //find the migration script that sets the database to be compatible with the code |
812 | 812 | $dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms(); |
813 | - if( $dms_name ){ |
|
814 | - $current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name ); |
|
815 | - $current_data_migration_script->set_migrating( false ); |
|
813 | + if ($dms_name) { |
|
814 | + $current_data_migration_script = EE_Registry::instance()->load_dms($dms_name); |
|
815 | + $current_data_migration_script->set_migrating(false); |
|
816 | 816 | $current_data_migration_script->schema_changes_before_migration(); |
817 | 817 | $current_data_migration_script->schema_changes_after_migration(); |
818 | - if( $current_data_migration_script->get_errors() ){ |
|
819 | - if( WP_DEBUG ){ |
|
820 | - foreach( $current_data_migration_script->get_errors() as $error ){ |
|
821 | - EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ ); |
|
818 | + if ($current_data_migration_script->get_errors()) { |
|
819 | + if (WP_DEBUG) { |
|
820 | + foreach ($current_data_migration_script->get_errors() as $error) { |
|
821 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
822 | 822 | } |
823 | - }else{ |
|
824 | - EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) ); |
|
823 | + } else { |
|
824 | + EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso')); |
|
825 | 825 | } |
826 | 826 | return false; |
827 | 827 | } |
828 | 828 | EE_Data_Migration_Manager::instance()->update_current_database_state_to(); |
829 | - }else{ |
|
830 | - EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
829 | + } else { |
|
830 | + EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
831 | 831 | return false; |
832 | 832 | } |
833 | 833 | return true; |
@@ -847,27 +847,27 @@ discard block |
||
847 | 847 | public static function initialize_system_questions() { |
848 | 848 | // QUESTION GROUPS |
849 | 849 | global $wpdb; |
850 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group' ); |
|
850 | + $table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question_group'); |
|
851 | 851 | $SQL = "SELECT QSG_system FROM $table_name WHERE QSG_system != 0"; |
852 | 852 | // what we have |
853 | - $question_groups = $wpdb->get_col( $SQL ); |
|
853 | + $question_groups = $wpdb->get_col($SQL); |
|
854 | 854 | // check the response |
855 | - $question_groups = is_array( $question_groups ) ? $question_groups : array(); |
|
855 | + $question_groups = is_array($question_groups) ? $question_groups : array(); |
|
856 | 856 | // what we should have |
857 | - $QSG_systems = array( 1, 2 ); |
|
857 | + $QSG_systems = array(1, 2); |
|
858 | 858 | // loop thru what we should have and compare to what we have |
859 | - foreach ( $QSG_systems as $QSG_system ) { |
|
859 | + foreach ($QSG_systems as $QSG_system) { |
|
860 | 860 | // reset values array |
861 | 861 | $QSG_values = array(); |
862 | 862 | // if we don't have what we should have (but use $QST_system as as string because that's what we got from the db) |
863 | - if ( ! in_array( "$QSG_system", $question_groups )) { |
|
863 | + if ( ! in_array("$QSG_system", $question_groups)) { |
|
864 | 864 | // add it |
865 | - switch ( $QSG_system ) { |
|
865 | + switch ($QSG_system) { |
|
866 | 866 | |
867 | 867 | case 1: |
868 | 868 | $QSG_values = array( |
869 | - 'QSG_name' => __( 'Personal Information', 'event_espresso' ), |
|
870 | - 'QSG_identifier' => 'personal-information-' . time(), |
|
869 | + 'QSG_name' => __('Personal Information', 'event_espresso'), |
|
870 | + 'QSG_identifier' => 'personal-information-'.time(), |
|
871 | 871 | 'QSG_desc' => '', |
872 | 872 | 'QSG_order' => 1, |
873 | 873 | 'QSG_show_group_name' => 1, |
@@ -879,8 +879,8 @@ discard block |
||
879 | 879 | |
880 | 880 | case 2: |
881 | 881 | $QSG_values = array( |
882 | - 'QSG_name' => __( 'Address Information','event_espresso' ), |
|
883 | - 'QSG_identifier' => 'address-information-' . time(), |
|
882 | + 'QSG_name' => __('Address Information', 'event_espresso'), |
|
883 | + 'QSG_identifier' => 'address-information-'.time(), |
|
884 | 884 | 'QSG_desc' => '', |
885 | 885 | 'QSG_order' => 2, |
886 | 886 | 'QSG_show_group_name' => 1, |
@@ -892,14 +892,14 @@ discard block |
||
892 | 892 | |
893 | 893 | } |
894 | 894 | // make sure we have some values before inserting them |
895 | - if ( ! empty( $QSG_values )) { |
|
895 | + if ( ! empty($QSG_values)) { |
|
896 | 896 | // insert system question |
897 | 897 | $wpdb->insert( |
898 | 898 | $table_name, |
899 | 899 | $QSG_values, |
900 | - array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' ) |
|
900 | + array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d') |
|
901 | 901 | ); |
902 | - $QSG_IDs[ $QSG_system ] = $wpdb->insert_id; |
|
902 | + $QSG_IDs[$QSG_system] = $wpdb->insert_id; |
|
903 | 903 | } |
904 | 904 | } |
905 | 905 | } |
@@ -908,10 +908,10 @@ discard block |
||
908 | 908 | |
909 | 909 | // QUESTIONS |
910 | 910 | global $wpdb; |
911 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question' ); |
|
911 | + $table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question'); |
|
912 | 912 | $SQL = "SELECT QST_system FROM $table_name WHERE QST_system != ''"; |
913 | 913 | // what we have |
914 | - $questions = $wpdb->get_col( $SQL ); |
|
914 | + $questions = $wpdb->get_col($SQL); |
|
915 | 915 | // what we should have |
916 | 916 | $QST_systems = array( |
917 | 917 | 'fname', |
@@ -928,25 +928,25 @@ discard block |
||
928 | 928 | $order_for_group_1 = 1; |
929 | 929 | $order_for_group_2 = 1; |
930 | 930 | // loop thru what we should have and compare to what we have |
931 | - foreach ( $QST_systems as $QST_system ) { |
|
931 | + foreach ($QST_systems as $QST_system) { |
|
932 | 932 | // reset values array |
933 | 933 | $QST_values = array(); |
934 | 934 | // if we don't have what we should have |
935 | - if ( ! in_array( $QST_system, $questions )) { |
|
935 | + if ( ! in_array($QST_system, $questions)) { |
|
936 | 936 | // add it |
937 | - switch ( $QST_system ) { |
|
937 | + switch ($QST_system) { |
|
938 | 938 | |
939 | 939 | case 'fname': |
940 | 940 | $QST_values = array( |
941 | - 'QST_display_text' => __( 'First Name', 'event_espresso' ), |
|
942 | - 'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ), |
|
941 | + 'QST_display_text' => __('First Name', 'event_espresso'), |
|
942 | + 'QST_admin_label' => __('First Name - System Question', 'event_espresso'), |
|
943 | 943 | 'QST_system' => 'fname', |
944 | 944 | 'QST_type' => 'TEXT', |
945 | 945 | 'QST_required' => 1, |
946 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
946 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
947 | 947 | 'QST_order' => 1, |
948 | 948 | 'QST_admin_only' => 0, |
949 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
949 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
950 | 950 | 'QST_wp_user' => self::get_default_creator_id(), |
951 | 951 | 'QST_deleted' => 0 |
952 | 952 | ); |
@@ -954,15 +954,15 @@ discard block |
||
954 | 954 | |
955 | 955 | case 'lname': |
956 | 956 | $QST_values = array( |
957 | - 'QST_display_text' => __( 'Last Name', 'event_espresso' ), |
|
958 | - 'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ), |
|
957 | + 'QST_display_text' => __('Last Name', 'event_espresso'), |
|
958 | + 'QST_admin_label' => __('Last Name - System Question', 'event_espresso'), |
|
959 | 959 | 'QST_system' => 'lname', |
960 | 960 | 'QST_type' => 'TEXT', |
961 | 961 | 'QST_required' => 1, |
962 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
962 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
963 | 963 | 'QST_order' => 2, |
964 | 964 | 'QST_admin_only' => 0, |
965 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
965 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
966 | 966 | 'QST_wp_user' => self::get_default_creator_id(), |
967 | 967 | 'QST_deleted' => 0 |
968 | 968 | ); |
@@ -970,15 +970,15 @@ discard block |
||
970 | 970 | |
971 | 971 | case 'email': |
972 | 972 | $QST_values = array( |
973 | - 'QST_display_text' => __( 'Email Address', 'event_espresso' ), |
|
974 | - 'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ), |
|
973 | + 'QST_display_text' => __('Email Address', 'event_espresso'), |
|
974 | + 'QST_admin_label' => __('Email Address - System Question', 'event_espresso'), |
|
975 | 975 | 'QST_system' => 'email', |
976 | 976 | 'QST_type' => 'TEXT', |
977 | 977 | 'QST_required' => 1, |
978 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
978 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
979 | 979 | 'QST_order' => 3, |
980 | 980 | 'QST_admin_only' => 0, |
981 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
981 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
982 | 982 | 'QST_wp_user' => self::get_default_creator_id(), |
983 | 983 | 'QST_deleted' => 0 |
984 | 984 | ); |
@@ -986,15 +986,15 @@ discard block |
||
986 | 986 | |
987 | 987 | case 'address': |
988 | 988 | $QST_values = array( |
989 | - 'QST_display_text' => __( 'Address', 'event_espresso' ), |
|
990 | - 'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ), |
|
989 | + 'QST_display_text' => __('Address', 'event_espresso'), |
|
990 | + 'QST_admin_label' => __('Address - System Question', 'event_espresso'), |
|
991 | 991 | 'QST_system' => 'address', |
992 | 992 | 'QST_type' => 'TEXT', |
993 | 993 | 'QST_required' => 0, |
994 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
994 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
995 | 995 | 'QST_order' => 4, |
996 | 996 | 'QST_admin_only' => 0, |
997 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
997 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
998 | 998 | 'QST_wp_user' => self::get_default_creator_id(), |
999 | 999 | 'QST_deleted' => 0 |
1000 | 1000 | ); |
@@ -1002,15 +1002,15 @@ discard block |
||
1002 | 1002 | |
1003 | 1003 | case 'address2': |
1004 | 1004 | $QST_values = array( |
1005 | - 'QST_display_text' => __( 'Address2', 'event_espresso' ), |
|
1006 | - 'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ), |
|
1005 | + 'QST_display_text' => __('Address2', 'event_espresso'), |
|
1006 | + 'QST_admin_label' => __('Address2 - System Question', 'event_espresso'), |
|
1007 | 1007 | 'QST_system' => 'address2', |
1008 | 1008 | 'QST_type' => 'TEXT', |
1009 | 1009 | 'QST_required' => 0, |
1010 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1010 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1011 | 1011 | 'QST_order' => 5, |
1012 | 1012 | 'QST_admin_only' => 0, |
1013 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1013 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1014 | 1014 | 'QST_wp_user' => self::get_default_creator_id(), |
1015 | 1015 | 'QST_deleted' => 0 |
1016 | 1016 | ); |
@@ -1018,15 +1018,15 @@ discard block |
||
1018 | 1018 | |
1019 | 1019 | case 'city': |
1020 | 1020 | $QST_values = array( |
1021 | - 'QST_display_text' => __( 'City', 'event_espresso' ), |
|
1022 | - 'QST_admin_label' => __( 'City - System Question', 'event_espresso' ), |
|
1021 | + 'QST_display_text' => __('City', 'event_espresso'), |
|
1022 | + 'QST_admin_label' => __('City - System Question', 'event_espresso'), |
|
1023 | 1023 | 'QST_system' => 'city', |
1024 | 1024 | 'QST_type' => 'TEXT', |
1025 | 1025 | 'QST_required' => 0, |
1026 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1026 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1027 | 1027 | 'QST_order' => 6, |
1028 | 1028 | 'QST_admin_only' => 0, |
1029 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1029 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1030 | 1030 | 'QST_wp_user' => self::get_default_creator_id(), |
1031 | 1031 | 'QST_deleted' => 0 |
1032 | 1032 | ); |
@@ -1034,12 +1034,12 @@ discard block |
||
1034 | 1034 | |
1035 | 1035 | case 'state': |
1036 | 1036 | $QST_values = array( |
1037 | - 'QST_display_text' => __( 'State/Province', 'event_espresso' ), |
|
1038 | - 'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ), |
|
1037 | + 'QST_display_text' => __('State/Province', 'event_espresso'), |
|
1038 | + 'QST_admin_label' => __('State/Province - System Question', 'event_espresso'), |
|
1039 | 1039 | 'QST_system' => 'state', |
1040 | 1040 | 'QST_type' => 'STATE', |
1041 | 1041 | 'QST_required' => 0, |
1042 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1042 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1043 | 1043 | 'QST_order' => 7, |
1044 | 1044 | 'QST_admin_only' => 0, |
1045 | 1045 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1049,12 +1049,12 @@ discard block |
||
1049 | 1049 | |
1050 | 1050 | case 'country' : |
1051 | 1051 | $QST_values = array( |
1052 | - 'QST_display_text' => __( 'Country', 'event_espresso' ), |
|
1053 | - 'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ), |
|
1052 | + 'QST_display_text' => __('Country', 'event_espresso'), |
|
1053 | + 'QST_admin_label' => __('Country - System Question', 'event_espresso'), |
|
1054 | 1054 | 'QST_system' => 'country', |
1055 | 1055 | 'QST_type' => 'COUNTRY', |
1056 | 1056 | 'QST_required' => 0, |
1057 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1057 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1058 | 1058 | 'QST_order' => 8, |
1059 | 1059 | 'QST_admin_only' => 0, |
1060 | 1060 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1064,15 +1064,15 @@ discard block |
||
1064 | 1064 | |
1065 | 1065 | case 'zip': |
1066 | 1066 | $QST_values = array( |
1067 | - 'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ), |
|
1068 | - 'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ), |
|
1067 | + 'QST_display_text' => __('Zip/Postal Code', 'event_espresso'), |
|
1068 | + 'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'), |
|
1069 | 1069 | 'QST_system' => 'zip', |
1070 | 1070 | 'QST_type' => 'TEXT', |
1071 | 1071 | 'QST_required' => 0, |
1072 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1072 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1073 | 1073 | 'QST_order' => 9, |
1074 | 1074 | 'QST_admin_only' => 0, |
1075 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1075 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1076 | 1076 | 'QST_wp_user' => self::get_default_creator_id(), |
1077 | 1077 | 'QST_deleted' => 0 |
1078 | 1078 | ); |
@@ -1080,49 +1080,49 @@ discard block |
||
1080 | 1080 | |
1081 | 1081 | case 'phone': |
1082 | 1082 | $QST_values = array( |
1083 | - 'QST_display_text' => __( 'Phone Number', 'event_espresso' ), |
|
1084 | - 'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ), |
|
1083 | + 'QST_display_text' => __('Phone Number', 'event_espresso'), |
|
1084 | + 'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'), |
|
1085 | 1085 | 'QST_system' => 'phone', |
1086 | 1086 | 'QST_type' => 'TEXT', |
1087 | 1087 | 'QST_required' => 0, |
1088 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1088 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1089 | 1089 | 'QST_order' => 10, |
1090 | 1090 | 'QST_admin_only' => 0, |
1091 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1091 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1092 | 1092 | 'QST_wp_user' => self::get_default_creator_id(), |
1093 | 1093 | 'QST_deleted' => 0 |
1094 | 1094 | ); |
1095 | 1095 | break; |
1096 | 1096 | |
1097 | 1097 | } |
1098 | - if ( ! empty( $QST_values )) { |
|
1098 | + if ( ! empty($QST_values)) { |
|
1099 | 1099 | // insert system question |
1100 | 1100 | $wpdb->insert( |
1101 | 1101 | $table_name, |
1102 | 1102 | $QST_values, |
1103 | - array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' ) |
|
1103 | + array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d') |
|
1104 | 1104 | ); |
1105 | 1105 | $QST_ID = $wpdb->insert_id; |
1106 | 1106 | |
1107 | 1107 | // QUESTION GROUP QUESTIONS |
1108 | - if( in_array( $QST_system, array( 'fname', 'lname', 'email' ) ) ) { |
|
1108 | + if (in_array($QST_system, array('fname', 'lname', 'email'))) { |
|
1109 | 1109 | $system_question_we_want = EEM_Question_Group::system_personal; |
1110 | 1110 | } else { |
1111 | 1111 | $system_question_we_want = EEM_Question_Group::system_address; |
1112 | 1112 | } |
1113 | - if( isset( $QSG_IDs[ $system_question_we_want ] ) ) { |
|
1114 | - $QSG_ID = $QSG_IDs[ $system_question_we_want ]; |
|
1113 | + if (isset($QSG_IDs[$system_question_we_want])) { |
|
1114 | + $QSG_ID = $QSG_IDs[$system_question_we_want]; |
|
1115 | 1115 | } else { |
1116 | - $id_col = EEM_Question_Group::instance()->get_col( array( array( 'QSG_system' => $system_question_we_want ) ) ); |
|
1117 | - if( is_array( $id_col ) ) { |
|
1118 | - $QSG_ID = reset( $id_col ); |
|
1116 | + $id_col = EEM_Question_Group::instance()->get_col(array(array('QSG_system' => $system_question_we_want))); |
|
1117 | + if (is_array($id_col)) { |
|
1118 | + $QSG_ID = reset($id_col); |
|
1119 | 1119 | } else { |
1120 | 1120 | //ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method |
1121 | 1121 | EE_Log::instance()->log( |
1122 | 1122 | __FILE__, |
1123 | 1123 | __FUNCTION__, |
1124 | 1124 | sprintf( |
1125 | - __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1125 | + __('Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1126 | 1126 | $QST_ID ), |
1127 | 1127 | 'error' ); |
1128 | 1128 | continue; |
@@ -1131,9 +1131,9 @@ discard block |
||
1131 | 1131 | |
1132 | 1132 | // add system questions to groups |
1133 | 1133 | $wpdb->insert( |
1134 | - EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group_question' ), |
|
1135 | - array( 'QSG_ID' => $QSG_ID , 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID==1)? $order_for_group_1++ : $order_for_group_2++ ), |
|
1136 | - array( '%d', '%d','%d' ) |
|
1134 | + EEH_Activation::ensure_table_name_has_prefix('esp_question_group_question'), |
|
1135 | + array('QSG_ID' => $QSG_ID, 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID == 1) ? $order_for_group_1++ : $order_for_group_2++), |
|
1136 | + array('%d', '%d', '%d') |
|
1137 | 1137 | ); |
1138 | 1138 | } |
1139 | 1139 | } |
@@ -1145,11 +1145,11 @@ discard block |
||
1145 | 1145 | * Makes sure the default payment method (Invoice) is active. |
1146 | 1146 | * This used to be done automatically as part of constructing the old gateways config |
1147 | 1147 | */ |
1148 | - public static function insert_default_payment_methods(){ |
|
1149 | - if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){ |
|
1150 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
1151 | - EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
1152 | - }else{ |
|
1148 | + public static function insert_default_payment_methods() { |
|
1149 | + if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) { |
|
1150 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
1151 | + EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
1152 | + } else { |
|
1153 | 1153 | EEM_Payment_Method::instance()->verify_button_urls(); |
1154 | 1154 | } |
1155 | 1155 | } |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | |
1166 | 1166 | global $wpdb; |
1167 | 1167 | |
1168 | - if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) { |
|
1168 | + if (EEH_Activation::table_exists(EEM_Status::instance()->table())) { |
|
1169 | 1169 | |
1170 | 1170 | $table_name = EEM_Status::instance()->table(); |
1171 | 1171 | |
@@ -1231,38 +1231,38 @@ discard block |
||
1231 | 1231 | * @return boolean success of verifying upload directories exist |
1232 | 1232 | */ |
1233 | 1233 | public static function create_upload_directories() { |
1234 | - EE_Registry::instance()->load_helper( 'File' ); |
|
1234 | + EE_Registry::instance()->load_helper('File'); |
|
1235 | 1235 | // Create the required folders |
1236 | 1236 | $folders = array( |
1237 | 1237 | EVENT_ESPRESSO_TEMPLATE_DIR, |
1238 | 1238 | EVENT_ESPRESSO_GATEWAY_DIR, |
1239 | - EVENT_ESPRESSO_UPLOAD_DIR . 'logs/', |
|
1240 | - EVENT_ESPRESSO_UPLOAD_DIR . 'css/', |
|
1241 | - EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/' |
|
1239 | + EVENT_ESPRESSO_UPLOAD_DIR.'logs/', |
|
1240 | + EVENT_ESPRESSO_UPLOAD_DIR.'css/', |
|
1241 | + EVENT_ESPRESSO_UPLOAD_DIR.'tickets/' |
|
1242 | 1242 | ); |
1243 | - foreach ( $folders as $folder ) { |
|
1243 | + foreach ($folders as $folder) { |
|
1244 | 1244 | try { |
1245 | - EEH_File::ensure_folder_exists_and_is_writable( $folder ); |
|
1246 | - @ chmod( $folder, 0755 ); |
|
1247 | - } catch( EE_Error $e ){ |
|
1245 | + EEH_File::ensure_folder_exists_and_is_writable($folder); |
|
1246 | + @ chmod($folder, 0755); |
|
1247 | + } catch (EE_Error $e) { |
|
1248 | 1248 | EE_Error::add_error( |
1249 | 1249 | sprintf( |
1250 | - __( 'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ), |
|
1250 | + __('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'), |
|
1251 | 1251 | $folder, |
1252 | - '<br />' . $e->getMessage() |
|
1252 | + '<br />'.$e->getMessage() |
|
1253 | 1253 | ), |
1254 | 1254 | __FILE__, __FUNCTION__, __LINE__ |
1255 | 1255 | ); |
1256 | 1256 | //indicate we'll need to fix this later |
1257 | - update_option( EEH_Activation::upload_directories_incomplete_option_name, true ); |
|
1257 | + update_option(EEH_Activation::upload_directories_incomplete_option_name, true); |
|
1258 | 1258 | return FALSE; |
1259 | 1259 | } |
1260 | 1260 | } |
1261 | 1261 | //just add the .htaccess file to the logs directory to begin with. Even if logging |
1262 | 1262 | //is disabled, there might be activation errors recorded in there |
1263 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs/' ); |
|
1263 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs/'); |
|
1264 | 1264 | //remember EE's folders are all good |
1265 | - delete_option( EEH_Activation::upload_directories_incomplete_option_name ); |
|
1265 | + delete_option(EEH_Activation::upload_directories_incomplete_option_name); |
|
1266 | 1266 | return TRUE; |
1267 | 1267 | } |
1268 | 1268 | |
@@ -1275,7 +1275,7 @@ discard block |
||
1275 | 1275 | * @return boolean |
1276 | 1276 | */ |
1277 | 1277 | public static function upload_directories_incomplete() { |
1278 | - return get_option( EEH_Activation::upload_directories_incomplete_option_name, false ); |
|
1278 | + return get_option(EEH_Activation::upload_directories_incomplete_option_name, false); |
|
1279 | 1279 | } |
1280 | 1280 | |
1281 | 1281 | |
@@ -1294,16 +1294,16 @@ discard block |
||
1294 | 1294 | $installed_messengers = $default_messengers = array(); |
1295 | 1295 | |
1296 | 1296 | //include our helper |
1297 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1297 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1298 | 1298 | |
1299 | 1299 | //get all installed messenger objects |
1300 | 1300 | $installed = EEH_MSG_Template::get_installed_message_objects(); |
1301 | 1301 | |
1302 | 1302 | //let's setup the $installed messengers in an array AND the messengers that are set to be activated on install. |
1303 | - foreach ( $installed['messengers'] as $msgr ) { |
|
1304 | - if ( $msgr instanceof EE_messenger ) { |
|
1303 | + foreach ($installed['messengers'] as $msgr) { |
|
1304 | + if ($msgr instanceof EE_messenger) { |
|
1305 | 1305 | $installed_messengers[$msgr->name] = $msgr; |
1306 | - if ( $msgr->activate_on_install ) { |
|
1306 | + if ($msgr->activate_on_install) { |
|
1307 | 1307 | $default_messengers[] = $msgr->name; |
1308 | 1308 | } |
1309 | 1309 | } |
@@ -1313,36 +1313,36 @@ discard block |
||
1313 | 1313 | $active_messengers = EEH_MSG_Template::get_active_messengers_in_db(); |
1314 | 1314 | |
1315 | 1315 | //things that have already been activated before |
1316 | - $has_activated = get_option( 'ee_has_activated_messenger' ); |
|
1316 | + $has_activated = get_option('ee_has_activated_messenger'); |
|
1317 | 1317 | |
1318 | 1318 | //do an initial loop to determine if we need to continue |
1319 | 1319 | $def_ms = array(); |
1320 | - foreach ( $default_messengers as $msgr ) { |
|
1321 | - if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue; |
|
1320 | + foreach ($default_messengers as $msgr) { |
|
1321 | + if (isset($active_messengers[$msgr]) || isset($has_activated[$msgr])) continue; |
|
1322 | 1322 | $def_ms[] = $msgr; |
1323 | 1323 | } |
1324 | 1324 | |
1325 | 1325 | //setup the $installed_mts in an array |
1326 | - foreach ( $installed['message_types'] as $imt ) { |
|
1327 | - if ( $imt instanceof EE_message_type ) { |
|
1326 | + foreach ($installed['message_types'] as $imt) { |
|
1327 | + if ($imt instanceof EE_message_type) { |
|
1328 | 1328 | $installed_mts[$imt->name] = $imt; |
1329 | 1329 | } |
1330 | 1330 | } |
1331 | 1331 | |
1332 | 1332 | //loop through default array for default messengers (if present) |
1333 | - if ( ! empty( $def_ms ) ) { |
|
1334 | - foreach ( $def_ms as $messenger ) { |
|
1333 | + if ( ! empty($def_ms)) { |
|
1334 | + foreach ($def_ms as $messenger) { |
|
1335 | 1335 | //all is good so let's setup the default stuff. We need to use the given messenger object (if exists) to get the default message type for the messenger. |
1336 | - if ( ! isset( $installed_messengers[$messenger] )) { |
|
1336 | + if ( ! isset($installed_messengers[$messenger])) { |
|
1337 | 1337 | continue; |
1338 | 1338 | } |
1339 | 1339 | /** @var EE_messenger[] $installed_messengers */ |
1340 | 1340 | $default_mts = $installed_messengers[$messenger]->get_default_message_types(); |
1341 | 1341 | $active_messengers[$messenger]['obj'] = $installed_messengers[$messenger]; |
1342 | - foreach ( $default_mts as $index => $mt ) { |
|
1342 | + foreach ($default_mts as $index => $mt) { |
|
1343 | 1343 | //is there an installed_mt matching the default string? If not then nothing to do here. |
1344 | - if ( ! isset( $installed_mts[$mt] ) ) { |
|
1345 | - unset( $default_mts[$index] ); |
|
1344 | + if ( ! isset($installed_mts[$mt])) { |
|
1345 | + unset($default_mts[$index]); |
|
1346 | 1346 | continue; |
1347 | 1347 | } |
1348 | 1348 | |
@@ -1351,41 +1351,41 @@ discard block |
||
1351 | 1351 | /** @var EE_message_type[] $installed_mts */ |
1352 | 1352 | $settings_fields = $installed_mts[$mt]->get_admin_settings_fields(); |
1353 | 1353 | $settings = array(); |
1354 | - if ( is_array( $settings_fields ) ) { |
|
1355 | - foreach ( $settings_fields as $field => $values ) { |
|
1356 | - if ( isset( $values['default'] ) ) { |
|
1354 | + if (is_array($settings_fields)) { |
|
1355 | + foreach ($settings_fields as $field => $values) { |
|
1356 | + if (isset($values['default'])) { |
|
1357 | 1357 | $settings[$field] = $values['default']; |
1358 | 1358 | } |
1359 | 1359 | } |
1360 | 1360 | } |
1361 | 1361 | |
1362 | - $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings; |
|
1362 | + $active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings; |
|
1363 | 1363 | $has_activated[$messenger][] = $mt; |
1364 | 1364 | } |
1365 | 1365 | |
1366 | 1366 | //setup any initial settings for the messenger |
1367 | 1367 | $msgr_settings = $installed_messengers[$messenger]->get_admin_settings_fields(); |
1368 | 1368 | |
1369 | - if ( !empty( $msgr_settings ) ) { |
|
1370 | - foreach ( $msgr_settings as $field => $value ) { |
|
1369 | + if ( ! empty($msgr_settings)) { |
|
1370 | + foreach ($msgr_settings as $field => $value) { |
|
1371 | 1371 | $active_messengers[$messenger]['settings'][$field] = $value; |
1372 | 1372 | } |
1373 | 1373 | } |
1374 | 1374 | |
1375 | 1375 | //now let's save the settings for this messenger! Must do now because the validator checks the db for active messengers to validate. |
1376 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
1376 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
1377 | 1377 | |
1378 | 1378 | //let's generate all the templates but only if the messenger has default_mts (otherwise its just activated). |
1379 | - if ( !empty( $default_mts ) ) { |
|
1380 | - $success = EEH_MSG_Template::generate_new_templates( $messenger, $default_mts, '', TRUE ); |
|
1379 | + if ( ! empty($default_mts)) { |
|
1380 | + $success = EEH_MSG_Template::generate_new_templates($messenger, $default_mts, '', TRUE); |
|
1381 | 1381 | } |
1382 | 1382 | } |
1383 | 1383 | } //end check for empty( $def_ms ) |
1384 | 1384 | |
1385 | 1385 | //still need to see if there are any message types to activate for active messengers |
1386 | - foreach ( $active_messengers as $messenger => $settings ) { |
|
1386 | + foreach ($active_messengers as $messenger => $settings) { |
|
1387 | 1387 | $msg_obj = $settings['obj']; |
1388 | - if ( ! $msg_obj instanceof EE_messenger ) { |
|
1388 | + if ( ! $msg_obj instanceof EE_messenger) { |
|
1389 | 1389 | continue; |
1390 | 1390 | } |
1391 | 1391 | |
@@ -1393,45 +1393,45 @@ discard block |
||
1393 | 1393 | $new_default_mts = array(); |
1394 | 1394 | |
1395 | 1395 | //loop through each default mt reported by the messenger and make sure its set in its active db entry. |
1396 | - foreach( $all_default_mts as $index => $mt ) { |
|
1396 | + foreach ($all_default_mts as $index => $mt) { |
|
1397 | 1397 | //already active? already has generated templates? || has already been activated before (we dont' want to reactivate things users intentionally deactivated). |
1398 | - if ( ( isset( $has_activated[$messenger] ) && in_array($mt, $has_activated[$messenger]) ) || isset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) || EEH_MSG_Template::already_generated( $messenger, $mt, 0, FALSE ) ) { |
|
1398 | + if ((isset($has_activated[$messenger]) && in_array($mt, $has_activated[$messenger])) || isset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) || EEH_MSG_Template::already_generated($messenger, $mt, 0, FALSE)) { |
|
1399 | 1399 | continue; |
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | //is there an installed_mt matching the default string? If not then nothing to do here. |
1403 | - if ( ! isset( $installed_mts[$mt] ) ) { |
|
1404 | - unset( $all_default_mts[$mt] ); |
|
1403 | + if ( ! isset($installed_mts[$mt])) { |
|
1404 | + unset($all_default_mts[$mt]); |
|
1405 | 1405 | continue; |
1406 | 1406 | } |
1407 | 1407 | |
1408 | 1408 | $settings_fields = $installed_mts[$mt]->get_admin_settings_fields(); |
1409 | 1409 | $settings = array(); |
1410 | - if ( is_array( $settings_fields ) ) { |
|
1411 | - foreach ( $settings_fields as $field => $values ) { |
|
1412 | - if ( isset( $values['default'] ) ) { |
|
1410 | + if (is_array($settings_fields)) { |
|
1411 | + foreach ($settings_fields as $field => $values) { |
|
1412 | + if (isset($values['default'])) { |
|
1413 | 1413 | $settings[$field] = $values['default']; |
1414 | 1414 | } |
1415 | 1415 | } |
1416 | 1416 | } |
1417 | 1417 | |
1418 | - $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings; |
|
1418 | + $active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings; |
|
1419 | 1419 | $new_default_mts[] = $mt; |
1420 | 1420 | $has_activated[$messenger][] = $mt; |
1421 | 1421 | } |
1422 | 1422 | |
1423 | 1423 | |
1424 | - if ( ! empty( $new_default_mts ) ) { |
|
1425 | - $success = EEH_MSG_Template::generate_new_templates( $messenger, $new_default_mts, '', TRUE ); |
|
1424 | + if ( ! empty($new_default_mts)) { |
|
1425 | + $success = EEH_MSG_Template::generate_new_templates($messenger, $new_default_mts, '', TRUE); |
|
1426 | 1426 | } |
1427 | 1427 | |
1428 | 1428 | } |
1429 | 1429 | |
1430 | 1430 | //now let's save the settings for this messenger! |
1431 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
1431 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
1432 | 1432 | |
1433 | 1433 | //update $has_activated record |
1434 | - update_option( 'ee_has_activated_messenger', $has_activated ); |
|
1434 | + update_option('ee_has_activated_messenger', $has_activated); |
|
1435 | 1435 | |
1436 | 1436 | //that's it! |
1437 | 1437 | return $success; |
@@ -1451,47 +1451,47 @@ discard block |
||
1451 | 1451 | */ |
1452 | 1452 | public static function validate_messages_system() { |
1453 | 1453 | //include our helper |
1454 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1454 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1455 | 1455 | |
1456 | 1456 | //get active and installed messengers/message types. |
1457 | 1457 | $active_messengers = EEH_MSG_Template::get_active_messengers_in_db(); |
1458 | 1458 | $installed = EEH_MSG_Template::get_installed_message_objects(); |
1459 | 1459 | $installed_messengers = $installed_mts = array(); |
1460 | 1460 | //set up the arrays so they can be handled easier. |
1461 | - foreach( $installed['messengers'] as $im ) { |
|
1462 | - if ( $im instanceof EE_messenger ) { |
|
1461 | + foreach ($installed['messengers'] as $im) { |
|
1462 | + if ($im instanceof EE_messenger) { |
|
1463 | 1463 | $installed_messengers[$im->name] = $im; |
1464 | 1464 | } |
1465 | 1465 | } |
1466 | - foreach( $installed['message_types'] as $imt ) { |
|
1467 | - if ( $imt instanceof EE_message_type ) { |
|
1466 | + foreach ($installed['message_types'] as $imt) { |
|
1467 | + if ($imt instanceof EE_message_type) { |
|
1468 | 1468 | $installed_mts[$imt->name] = $imt; |
1469 | 1469 | } |
1470 | 1470 | } |
1471 | 1471 | |
1472 | 1472 | //now let's loop through the active array and validate |
1473 | - foreach( $active_messengers as $messenger => $active_details ) { |
|
1473 | + foreach ($active_messengers as $messenger => $active_details) { |
|
1474 | 1474 | //first let's see if this messenger is installed. |
1475 | - if ( ! isset( $installed_messengers[$messenger] ) ) { |
|
1475 | + if ( ! isset($installed_messengers[$messenger])) { |
|
1476 | 1476 | //not set so let's just remove from actives and make sure templates are inactive. |
1477 | - unset( $active_messengers[$messenger] ); |
|
1478 | - EEH_MSG_Template::update_to_inactive( $messenger ); |
|
1477 | + unset($active_messengers[$messenger]); |
|
1478 | + EEH_MSG_Template::update_to_inactive($messenger); |
|
1479 | 1479 | continue; |
1480 | 1480 | } |
1481 | 1481 | |
1482 | 1482 | //messenger is active, so let's just make sure that any active message types not installed are deactivated. |
1483 | - $mts = ! empty( $active_details['settings'][$messenger . '-message_types'] ) ? $active_details['settings'][$messenger . '-message_types'] : array(); |
|
1484 | - foreach ( $mts as $mt_name => $mt ) { |
|
1485 | - if ( ! isset( $installed_mts[$mt_name] ) ) { |
|
1486 | - unset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt_name] ); |
|
1487 | - EEH_MSG_Template::update_to_inactive( $messenger, $mt_name ); |
|
1483 | + $mts = ! empty($active_details['settings'][$messenger.'-message_types']) ? $active_details['settings'][$messenger.'-message_types'] : array(); |
|
1484 | + foreach ($mts as $mt_name => $mt) { |
|
1485 | + if ( ! isset($installed_mts[$mt_name])) { |
|
1486 | + unset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt_name]); |
|
1487 | + EEH_MSG_Template::update_to_inactive($messenger, $mt_name); |
|
1488 | 1488 | } |
1489 | 1489 | } |
1490 | 1490 | } |
1491 | 1491 | |
1492 | 1492 | //all done! let's update the active_messengers. |
1493 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
1494 | - do_action( 'AHEE__EEH_Activation__validate_messages_system' ); |
|
1493 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
1494 | + do_action('AHEE__EEH_Activation__validate_messages_system'); |
|
1495 | 1495 | return; |
1496 | 1496 | } |
1497 | 1497 | |
@@ -1505,12 +1505,12 @@ discard block |
||
1505 | 1505 | * @static |
1506 | 1506 | * @return void |
1507 | 1507 | */ |
1508 | - public static function create_no_ticket_prices_array(){ |
|
1508 | + public static function create_no_ticket_prices_array() { |
|
1509 | 1509 | // this creates an array for tracking events that have no active ticket prices created |
1510 | 1510 | // this allows us to warn admins of the situation so that it can be corrected |
1511 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE ); |
|
1512 | - if ( ! $espresso_no_ticket_prices ) { |
|
1513 | - add_option( 'ee_no_ticket_prices', array(), '', FALSE ); |
|
1511 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE); |
|
1512 | + if ( ! $espresso_no_ticket_prices) { |
|
1513 | + add_option('ee_no_ticket_prices', array(), '', FALSE); |
|
1514 | 1514 | } |
1515 | 1515 | } |
1516 | 1516 | |
@@ -1532,24 +1532,24 @@ discard block |
||
1532 | 1532 | * Finds all our EE4 custom post types, and deletes them and their associated data (like post meta or term relations)/ |
1533 | 1533 | * @global wpdb $wpdb |
1534 | 1534 | */ |
1535 | - public static function delete_all_espresso_cpt_data(){ |
|
1535 | + public static function delete_all_espresso_cpt_data() { |
|
1536 | 1536 | global $wpdb; |
1537 | 1537 | //get all the CPT post_types |
1538 | 1538 | $ee_post_types = array(); |
1539 | - foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){ |
|
1540 | - if ( method_exists( $model_name, 'instance' )) { |
|
1541 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1542 | - if ( $model_obj instanceof EEM_CPT_Base ) { |
|
1543 | - $ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type()); |
|
1539 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1540 | + if (method_exists($model_name, 'instance')) { |
|
1541 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1542 | + if ($model_obj instanceof EEM_CPT_Base) { |
|
1543 | + $ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type()); |
|
1544 | 1544 | } |
1545 | 1545 | } |
1546 | 1546 | } |
1547 | 1547 | //get all our CPTs |
1548 | - $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")"; |
|
1548 | + $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")"; |
|
1549 | 1549 | $cpt_ids = $wpdb->get_col($query); |
1550 | 1550 | //delete each post meta and term relations too |
1551 | - foreach($cpt_ids as $post_id){ |
|
1552 | - wp_delete_post($post_id,true); |
|
1551 | + foreach ($cpt_ids as $post_id) { |
|
1552 | + wp_delete_post($post_id, true); |
|
1553 | 1553 | } |
1554 | 1554 | } |
1555 | 1555 | |
@@ -1563,18 +1563,18 @@ discard block |
||
1563 | 1563 | * @param bool $remove_all |
1564 | 1564 | * @return void |
1565 | 1565 | */ |
1566 | - public static function delete_all_espresso_tables_and_data( $remove_all = true ) { |
|
1566 | + public static function delete_all_espresso_tables_and_data($remove_all = true) { |
|
1567 | 1567 | global $wpdb; |
1568 | 1568 | $undeleted_tables = array(); |
1569 | 1569 | |
1570 | 1570 | // load registry |
1571 | - foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){ |
|
1572 | - if ( method_exists( $model_name, 'instance' )) { |
|
1573 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1574 | - if ( $model_obj instanceof EEM_Base ) { |
|
1575 | - foreach ( $model_obj->get_tables() as $table ) { |
|
1576 | - if ( strpos( $table->get_table_name(), 'esp_' )) { |
|
1577 | - switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) { |
|
1571 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1572 | + if (method_exists($model_name, 'instance')) { |
|
1573 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1574 | + if ($model_obj instanceof EEM_Base) { |
|
1575 | + foreach ($model_obj->get_tables() as $table) { |
|
1576 | + if (strpos($table->get_table_name(), 'esp_')) { |
|
1577 | + switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) { |
|
1578 | 1578 | case false : |
1579 | 1579 | $undeleted_tables[] = $table->get_table_name(); |
1580 | 1580 | break; |
@@ -1599,8 +1599,8 @@ discard block |
||
1599 | 1599 | 'esp_promotion_rule', |
1600 | 1600 | 'esp_rule' |
1601 | 1601 | ); |
1602 | - foreach( $tables_without_models as $table ){ |
|
1603 | - EEH_Activation::delete_db_table_if_empty( $table ); |
|
1602 | + foreach ($tables_without_models as $table) { |
|
1603 | + EEH_Activation::delete_db_table_if_empty($table); |
|
1604 | 1604 | } |
1605 | 1605 | |
1606 | 1606 | |
@@ -1638,58 +1638,58 @@ discard block |
||
1638 | 1638 | 'ee_job_parameters_' => false, |
1639 | 1639 | 'ee_upload_directories_incomplete' => true, |
1640 | 1640 | ); |
1641 | - if( is_main_site() ) { |
|
1642 | - $wp_options_to_delete[ 'ee_network_config' ] = true; |
|
1641 | + if (is_main_site()) { |
|
1642 | + $wp_options_to_delete['ee_network_config'] = true; |
|
1643 | 1643 | } |
1644 | 1644 | |
1645 | 1645 | $undeleted_options = array(); |
1646 | - foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) { |
|
1646 | + foreach ($wp_options_to_delete as $option_name => $no_wildcard) { |
|
1647 | 1647 | |
1648 | - if( $no_wildcard ){ |
|
1649 | - if( ! delete_option( $option_name ) ){ |
|
1648 | + if ($no_wildcard) { |
|
1649 | + if ( ! delete_option($option_name)) { |
|
1650 | 1650 | $undeleted_options[] = $option_name; |
1651 | 1651 | } |
1652 | - }else{ |
|
1653 | - $option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" ); |
|
1654 | - foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){ |
|
1655 | - if( ! delete_option( $option_name_from_wildcard ) ){ |
|
1652 | + } else { |
|
1653 | + $option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'"); |
|
1654 | + foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) { |
|
1655 | + if ( ! delete_option($option_name_from_wildcard)) { |
|
1656 | 1656 | $undeleted_options[] = $option_name_from_wildcard; |
1657 | 1657 | } |
1658 | 1658 | } |
1659 | 1659 | } |
1660 | 1660 | } |
1661 | 1661 | //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
1662 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1662 | + remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10); |
|
1663 | 1663 | |
1664 | - if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
|
1664 | + if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) { |
|
1665 | 1665 | $db_update_sans_ee4 = array(); |
1666 | - foreach($espresso_db_update as $version => $times_activated){ |
|
1667 | - if( $version[0] =='3'){//if its NON EE4 |
|
1666 | + foreach ($espresso_db_update as $version => $times_activated) { |
|
1667 | + if ($version[0] == '3') {//if its NON EE4 |
|
1668 | 1668 | $db_update_sans_ee4[$version] = $times_activated; |
1669 | 1669 | } |
1670 | 1670 | } |
1671 | - update_option( 'espresso_db_update', $db_update_sans_ee4 ); |
|
1671 | + update_option('espresso_db_update', $db_update_sans_ee4); |
|
1672 | 1672 | } |
1673 | 1673 | |
1674 | 1674 | $errors = ''; |
1675 | - if ( ! empty( $undeleted_tables )) { |
|
1675 | + if ( ! empty($undeleted_tables)) { |
|
1676 | 1676 | $errors .= sprintf( |
1677 | - __( 'The following tables could not be deleted: %s%s', 'event_espresso' ), |
|
1677 | + __('The following tables could not be deleted: %s%s', 'event_espresso'), |
|
1678 | 1678 | '<br/>', |
1679 | - implode( ',<br/>', $undeleted_tables ) |
|
1679 | + implode(',<br/>', $undeleted_tables) |
|
1680 | 1680 | ); |
1681 | 1681 | } |
1682 | - if ( ! empty( $undeleted_options )) { |
|
1683 | - $errors .= ! empty( $undeleted_tables ) ? '<br/>' : ''; |
|
1682 | + if ( ! empty($undeleted_options)) { |
|
1683 | + $errors .= ! empty($undeleted_tables) ? '<br/>' : ''; |
|
1684 | 1684 | $errors .= sprintf( |
1685 | - __( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ), |
|
1685 | + __('The following wp-options could not be deleted: %s%s', 'event_espresso'), |
|
1686 | 1686 | '<br/>', |
1687 | - implode( ',<br/>', $undeleted_options ) |
|
1687 | + implode(',<br/>', $undeleted_options) |
|
1688 | 1688 | ); |
1689 | 1689 | |
1690 | 1690 | } |
1691 | - if ( $errors != '' ) { |
|
1692 | - EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
1691 | + if ($errors != '') { |
|
1692 | + EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__); |
|
1693 | 1693 | } |
1694 | 1694 | } |
1695 | 1695 | |
@@ -1699,23 +1699,23 @@ discard block |
||
1699 | 1699 | * @param string $table_name with or without $wpdb->prefix |
1700 | 1700 | * @return boolean |
1701 | 1701 | */ |
1702 | - public static function table_exists( $table_name ){ |
|
1702 | + public static function table_exists($table_name) { |
|
1703 | 1703 | global $wpdb, $EZSQL_ERROR; |
1704 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
1704 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
1705 | 1705 | //ignore if this causes an sql error |
1706 | 1706 | $old_error = $wpdb->last_error; |
1707 | 1707 | $old_suppress_errors = $wpdb->suppress_errors(); |
1708 | - $old_show_errors_value = $wpdb->show_errors( FALSE ); |
|
1708 | + $old_show_errors_value = $wpdb->show_errors(FALSE); |
|
1709 | 1709 | $ezsql_error_cache = $EZSQL_ERROR; |
1710 | - $wpdb->get_results( "SELECT * from $table_name LIMIT 1"); |
|
1711 | - $wpdb->show_errors( $old_show_errors_value ); |
|
1712 | - $wpdb->suppress_errors( $old_suppress_errors ); |
|
1710 | + $wpdb->get_results("SELECT * from $table_name LIMIT 1"); |
|
1711 | + $wpdb->show_errors($old_show_errors_value); |
|
1712 | + $wpdb->suppress_errors($old_suppress_errors); |
|
1713 | 1713 | $new_error = $wpdb->last_error; |
1714 | 1714 | $wpdb->last_error = $old_error; |
1715 | 1715 | $EZSQL_ERROR = $ezsql_error_cache; |
1716 | - if( empty( $new_error ) ){ |
|
1716 | + if (empty($new_error)) { |
|
1717 | 1717 | return TRUE; |
1718 | - }else{ |
|
1718 | + } else { |
|
1719 | 1719 | return FALSE; |
1720 | 1720 | } |
1721 | 1721 | } |
@@ -1723,7 +1723,7 @@ discard block |
||
1723 | 1723 | /** |
1724 | 1724 | * Resets the cache on EEH_Activation |
1725 | 1725 | */ |
1726 | - public static function reset(){ |
|
1726 | + public static function reset() { |
|
1727 | 1727 | self::$_default_creator_id = NULL; |
1728 | 1728 | self::$_initialized_db_content_already_in_this_request = false; |
1729 | 1729 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 0 => array( |
34 | 34 | 'content_id' => 'attendee-column-tip', |
35 | 35 | 'target' => '.column-attendees .dashicons-groups', |
36 | - 'content' => sprintf( __('%s Registrations', 'event_espresso'), EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') ), |
|
36 | + 'content' => sprintf(__('%s Registrations', 'event_espresso'), EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')), |
|
37 | 37 | 'options' => array( |
38 | 38 | 'position' => array( |
39 | 39 | 'my' => 'bottom left', |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param EE_Datetime constant $status What status is set (by class) |
125 | 125 | * @return string The status legend with the related status highlighted |
126 | 126 | */ |
127 | - private function _event_status_legend( $status ) { |
|
127 | + private function _event_status_legend($status) { |
|
128 | 128 | |
129 | 129 | $status_array = array( |
130 | 130 | 'active_status' => EE_Datetime::active, |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | 'inactive_status' => EE_Datetime::inactive |
137 | 137 | ); |
138 | 138 | |
139 | - return EEH_Template::status_legend( $status_array, $status ); |
|
139 | + return EEH_Template::status_legend($status_array, $status); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | } |
143 | 143 | \ No newline at end of file |