@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | <td valign="top" class="use-ven-manager"> |
4 | 4 | <label><?php _e('Select from Venue Manager List', 'event_espresso'); ?></label> |
5 | 5 | <?php echo $venue_selector; ?> |
6 | - <?php foreach ( $venues as $venue ) : |
|
6 | + <?php foreach ($venues as $venue) : |
|
7 | 7 | $selected = $evt_venue_id == $venue->ID() ? '' : ' style="display:none;"'; |
8 | - $edit_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'edit', 'post' => $venue->ID() ), EE_VENUES_ADMIN_URL ); |
|
9 | - $state_name = is_object( $venue->state_obj() ) ? $venue->state_obj()->name() : NULL; |
|
10 | - $country_name = is_object( $venue->country_obj() ) ? $venue->country_obj()->name() : NULL; |
|
8 | + $edit_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $venue->ID()), EE_VENUES_ADMIN_URL); |
|
9 | + $state_name = is_object($venue->state_obj()) ? $venue->state_obj()->name() : NULL; |
|
10 | + $country_name = is_object($venue->country_obj()) ? $venue->country_obj()->name() : NULL; |
|
11 | 11 | ?> |
12 | 12 | <fieldset id="eebox_<?php echo $venue->ID(); ?>" class="eebox"<?php echo $selected; ?>> |
13 | 13 | <ul class="address-view"> |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | <span><?php _e('State:', 'event_espresso'); ?></span> <?php echo $state_name; ?><br /> |
19 | 19 | <span><?php _e('Country:', 'event_espresso'); ?></span> <?php echo $country_name; ?><br /> |
20 | 20 | <span><?php _e('Venue ID:', 'event_espresso'); ?></span> <?php echo $venue->ID(); ?><br /></p> |
21 | - <!-- <?php printf( __('This venue\'s shortcode: %s[ESPRESSO_VENUE id="%d"]%s', 'event_espresso'), '<strong class="highlight">', $venue->ID(), '</strong>' ); ?><br /> --> |
|
21 | + <!-- <?php printf(__('This venue\'s shortcode: %s[ESPRESSO_VENUE id="%d"]%s', 'event_espresso'), '<strong class="highlight">', $venue->ID(), '</strong>'); ?><br /> --> |
|
22 | 22 | <a href="<?php echo $edit_url; ?>" target="_blank"><?php _e('Edit this Venue', 'event_espresso'); ?></a> |
23 | 23 | </li> |
24 | 24 | </ul> |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | <tr> |
3 | 3 | <td valign="top"> |
4 | 4 | <fieldset> |
5 | - <?php if( isset( EE_Registry::instance()->CFG->map_settings ) && isset( EE_Registry::instance()->CFG->map_settings->use_google_maps ) && EE_Registry::instance()->CFG->map_settings->use_google_maps ) { ?> |
|
5 | + <?php if (isset(EE_Registry::instance()->CFG->map_settings) && isset(EE_Registry::instance()->CFG->map_settings->use_google_maps) && EE_Registry::instance()->CFG->map_settings->use_google_maps) { ?> |
|
6 | 6 | <p> |
7 | 7 | <label for="enable_for_gmap"> |
8 | 8 | <?php _e('Display Google Map for this venue? ', 'event_espresso') ?> |
@@ -14,11 +14,11 @@ discard block |
||
14 | 14 | <input type="text" name="vnu_google_map_link" value="<?php echo $vnu_google_map_link; ?>" class="all-options" /> |
15 | 15 | </p> --> |
16 | 16 | <?php } ?> |
17 | - <?php if( ! isset( EE_Registry::instance()->CFG->map_settings ) || ! isset( EE_Registry::instance()->CFG->map_settings->use_google_maps ) || ! EE_Registry::instance()->CFG->map_settings->use_google_maps ) { ?> |
|
17 | + <?php if ( ! isset(EE_Registry::instance()->CFG->map_settings) || ! isset(EE_Registry::instance()->CFG->map_settings->use_google_maps) || ! EE_Registry::instance()->CFG->map_settings->use_google_maps) { ?> |
|
18 | 18 | <p class="ee-notice"> |
19 | 19 | <?php |
20 | 20 | echo sprintf( |
21 | - __('To display a Google Map for event venues, go to %sEvent Espresso General Settings%sGoogle Maps%s, and set "Activate Google Maps" to "Yes"', 'event_espresso' ), |
|
21 | + __('To display a Google Map for event venues, go to %sEvent Espresso General Settings%sGoogle Maps%s, and set "Activate Google Maps" to "Yes"', 'event_espresso'), |
|
22 | 22 | '<b>', |
23 | 23 | '</b> » <b>', |
24 | 24 | '</b>' |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | 'quantity'=>$line_item->quantity() |
49 | 49 | ); |
50 | 50 | } |
51 | - }else{//its a partial payment |
|
51 | + } else{//its a partial payment |
|
52 | 52 | $tax_total = 0; |
53 | 53 | //partial payment, so just add 1 item |
54 | 54 | $items[] = array( |
@@ -113,19 +113,19 @@ discard block |
||
113 | 113 | foreach($response_body_as_array as $problem_parameter => $problems){ |
114 | 114 | $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems)); |
115 | 115 | } |
116 | - }else{ |
|
116 | + } else{ |
|
117 | 117 | $problems_string = $response['body']; |
118 | 118 | } |
119 | 119 | if( ! $problems_string ) { |
120 | 120 | //no message to show? wack |
121 | 121 | if( isset( $response[ 'headers' ][ 'status' ] ) ){ |
122 | 122 | $problems_string = $response[ 'headers' ][ 'status' ]; |
123 | - }else{ |
|
123 | + } else{ |
|
124 | 124 | $problems_string = __( 'No response from Mijireh', 'event_espresso' ); |
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
128 | - }else{ |
|
128 | + } else{ |
|
129 | 129 | $problems_string = implode( ",", $response->get_error_messages() ); |
130 | 130 | } |
131 | 131 | |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | $prepared_data[ $key ] = $this->_prepare_for_mijireh( $datum ); |
157 | 157 | } |
158 | 158 | return $prepared_data; |
159 | - }elseif(is_string( $data ) ){ |
|
159 | + } elseif(is_string( $data ) ){ |
|
160 | 160 | return str_replace( '%', 'percent', $data ); |
161 | - }else{ |
|
161 | + } else{ |
|
162 | 162 | return $data; |
163 | 163 | } |
164 | 164 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | } |
104 | 104 | $order = apply_filters( 'FHEE__EEG_Mijireh__set_redirection_info__order_arguments', $order, $payment, $primary_registrant ); |
105 | 105 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, serialize(get_object_vars($this)) ); |
106 | - $order = $this->_get_unsupported_character_remover()->formatArray($order); |
|
106 | + $order = $this->_get_unsupported_character_remover()->formatArray($order); |
|
107 | 107 | |
108 | 108 | $args = array( |
109 | 109 | 'headers' => array( |
@@ -113,45 +113,45 @@ discard block |
||
113 | 113 | 'body'=> wp_json_encode($order) |
114 | 114 | ); |
115 | 115 | $response = wp_remote_post( $this->_mijireh_api_orders_url, $args ); |
116 | - $problems_string = false; |
|
116 | + $problems_string = false; |
|
117 | 117 | $this->log(array('get checkout url request_args' => $args, 'response' => $response ), $payment); |
118 | 118 | if( ! $response instanceof WP_Error ){ |
119 | 119 | $response_body = json_decode($response['body']); |
120 | 120 | if($response_body && isset($response_body->checkout_url)){ |
121 | - $payment->set_redirect_url($response_body->checkout_url); |
|
122 | - $payment->set_txn_id_chq_nmbr($response_body->order_number); |
|
123 | - $payment->set_details($response['body']); |
|
121 | + $payment->set_redirect_url($response_body->checkout_url); |
|
122 | + $payment->set_txn_id_chq_nmbr($response_body->order_number); |
|
123 | + $payment->set_details($response['body']); |
|
124 | 124 | } else { |
125 | - if( is_array( $response_body ) || is_object( $response_body)){ |
|
126 | - $response_body_as_array = (array)$response_body; |
|
127 | - foreach($response_body_as_array as $problem_parameter => $problems){ |
|
128 | - $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems)); |
|
129 | - } |
|
130 | - }else{ |
|
131 | - $problems_string = $response['body']; |
|
132 | - } |
|
133 | - if( ! $problems_string ) { |
|
134 | - //no message to show? wack |
|
135 | - if( isset( $response[ 'headers' ][ 'status' ] ) ){ |
|
136 | - $problems_string = $response[ 'headers' ][ 'status' ]; |
|
137 | - }else{ |
|
138 | - $problems_string = __( 'No response from Mijireh', 'event_espresso' ); |
|
139 | - } |
|
140 | - } |
|
141 | - } |
|
125 | + if( is_array( $response_body ) || is_object( $response_body)){ |
|
126 | + $response_body_as_array = (array)$response_body; |
|
127 | + foreach($response_body_as_array as $problem_parameter => $problems){ |
|
128 | + $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems)); |
|
129 | + } |
|
130 | + }else{ |
|
131 | + $problems_string = $response['body']; |
|
132 | + } |
|
133 | + if( ! $problems_string ) { |
|
134 | + //no message to show? wack |
|
135 | + if( isset( $response[ 'headers' ][ 'status' ] ) ){ |
|
136 | + $problems_string = $response[ 'headers' ][ 'status' ]; |
|
137 | + }else{ |
|
138 | + $problems_string = __( 'No response from Mijireh', 'event_espresso' ); |
|
139 | + } |
|
140 | + } |
|
141 | + } |
|
142 | 142 | }else{ |
143 | - $problems_string = implode( ",", $response->get_error_messages() ); |
|
143 | + $problems_string = implode( ",", $response->get_error_messages() ); |
|
144 | 144 | } |
145 | 145 | |
146 | - if( $problems_string ) { |
|
147 | - $payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) ); |
|
148 | - $payment->set_details( $response ); |
|
149 | - $payment->set_redirect_url( null ); |
|
150 | - //even though the payment's status is failed at this point anyways, |
|
151 | - //let's be explicit about it. The fact that the redirect url is null |
|
152 | - //should be enough to client code that they can't redirect the user |
|
153 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
154 | - } |
|
146 | + if( $problems_string ) { |
|
147 | + $payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) ); |
|
148 | + $payment->set_details( $response ); |
|
149 | + $payment->set_redirect_url( null ); |
|
150 | + //even though the payment's status is failed at this point anyways, |
|
151 | + //let's be explicit about it. The fact that the redirect url is null |
|
152 | + //should be enough to client code that they can't redirect the user |
|
153 | + $payment->set_status( $this->_pay_model->failed_status() ); |
|
154 | + } |
|
155 | 155 | return $payment; |
156 | 156 | } |
157 | 157 | |
@@ -188,70 +188,70 @@ discard block |
||
188 | 188 | * @param array $update_info unused. We just use the $transaction |
189 | 189 | * @param EEI_Transaction $transaction |
190 | 190 | * @return \EEI_Payment |
191 | - * @throws EE_Error |
|
191 | + * @throws EE_Error |
|
192 | 192 | */ |
193 | 193 | public function handle_payment_update($update_info, $transaction) { |
194 | - foreach( $transaction->pending_payments() as $payment){ |
|
195 | - $payment = $this->check_payment_in_mijireh($payment); |
|
196 | - if( $payment->status() === $this->_pay_model->approved_status()){ |
|
197 | - return $payment; |
|
198 | - } |
|
199 | - } |
|
200 | - $payment = $transaction instanceof EEI_Transaction ? $transaction->last_payment() : NULL; |
|
194 | + foreach( $transaction->pending_payments() as $payment){ |
|
195 | + $payment = $this->check_payment_in_mijireh($payment); |
|
196 | + if( $payment->status() === $this->_pay_model->approved_status()){ |
|
197 | + return $payment; |
|
198 | + } |
|
199 | + } |
|
200 | + $payment = $transaction instanceof EEI_Transaction ? $transaction->last_payment() : NULL; |
|
201 | 201 | |
202 | - if ( ! $payment instanceof EEI_Payment ){ |
|
203 | - throw new EE_Error( sprintf( __( "Could not find Mijireh payment for transaction %s", 'event_espresso' ), $transaction->ID() ) ); |
|
204 | - } |
|
205 | - return $payment; |
|
202 | + if ( ! $payment instanceof EEI_Payment ){ |
|
203 | + throw new EE_Error( sprintf( __( "Could not find Mijireh payment for transaction %s", 'event_espresso' ), $transaction->ID() ) ); |
|
204 | + } |
|
205 | + return $payment; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
209 | 209 | |
210 | - /** |
|
211 | - * Checks the payment's status in Mijireh for this specific payment |
|
212 | - * @param \EEI_Payment $payment |
|
213 | - * @return \EEI_Payment |
|
214 | - */ |
|
210 | + /** |
|
211 | + * Checks the payment's status in Mijireh for this specific payment |
|
212 | + * @param \EEI_Payment $payment |
|
213 | + * @return \EEI_Payment |
|
214 | + */ |
|
215 | 215 | public function check_payment_in_mijireh( EEI_Payment $payment ){ |
216 | - $request_args = array( |
|
217 | - 'headers' => array( |
|
218 | - 'Authorization' => 'Basic ' . base64_encode( $this->_access_key . ':' ), |
|
219 | - 'Accept'=>'application/json' |
|
220 | - ) |
|
221 | - ); |
|
216 | + $request_args = array( |
|
217 | + 'headers' => array( |
|
218 | + 'Authorization' => 'Basic ' . base64_encode( $this->_access_key . ':' ), |
|
219 | + 'Accept'=>'application/json' |
|
220 | + ) |
|
221 | + ); |
|
222 | 222 | |
223 | - $response = wp_remote_get( |
|
224 | - $this->_mijireh_api_orders_url . '/' . $payment->txn_id_chq_nmbr(), |
|
225 | - $request_args |
|
226 | - ); |
|
223 | + $response = wp_remote_get( |
|
224 | + $this->_mijireh_api_orders_url . '/' . $payment->txn_id_chq_nmbr(), |
|
225 | + $request_args |
|
226 | + ); |
|
227 | 227 | |
228 | - $this->log( |
|
229 | - array( 'get payment status request_args' => $request_args, 'response' => $response ), |
|
230 | - $payment |
|
231 | - ); |
|
232 | - // validate response |
|
233 | - $response_body = isset( $response[ 'body' ] ) ? json_decode( $response[ 'body' ] ) : ''; |
|
234 | - if( $response && $response_body ){ |
|
235 | - switch( $response_body->status ){ |
|
236 | - case 'paid': |
|
237 | - $payment->set_status($this->_pay_model->approved_status()); |
|
238 | - break; |
|
239 | - case 'pending': |
|
240 | - $payment->set_status($this->_pay_model->pending_status()); |
|
241 | - break; |
|
242 | - default: |
|
243 | - $payment->set_status($this->_pay_model->declined_status()); |
|
244 | - } |
|
228 | + $this->log( |
|
229 | + array( 'get payment status request_args' => $request_args, 'response' => $response ), |
|
230 | + $payment |
|
231 | + ); |
|
232 | + // validate response |
|
233 | + $response_body = isset( $response[ 'body' ] ) ? json_decode( $response[ 'body' ] ) : ''; |
|
234 | + if( $response && $response_body ){ |
|
235 | + switch( $response_body->status ){ |
|
236 | + case 'paid': |
|
237 | + $payment->set_status($this->_pay_model->approved_status()); |
|
238 | + break; |
|
239 | + case 'pending': |
|
240 | + $payment->set_status($this->_pay_model->pending_status()); |
|
241 | + break; |
|
242 | + default: |
|
243 | + $payment->set_status($this->_pay_model->declined_status()); |
|
244 | + } |
|
245 | 245 | |
246 | - } else { |
|
247 | - $payment->set_gateway_response( __( 'Response from Mijireh could not be understood.', 'event_espresso' ) ); |
|
248 | - $payment->set_details( $response ); |
|
249 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
250 | - } |
|
251 | - // the following is ONLY for testing the Mijireh IPN and should NEVER be uncommented for real usage |
|
246 | + } else { |
|
247 | + $payment->set_gateway_response( __( 'Response from Mijireh could not be understood.', 'event_espresso' ) ); |
|
248 | + $payment->set_details( $response ); |
|
249 | + $payment->set_status( $this->_pay_model->failed_status() ); |
|
250 | + } |
|
251 | + // the following is ONLY for testing the Mijireh IPN and should NEVER be uncommented for real usage |
|
252 | 252 | // $payment->set_status( $this->_pay_model->pending_status() ); |
253 | - return $payment; |
|
254 | - } |
|
253 | + return $payment; |
|
254 | + } |
|
255 | 255 | |
256 | 256 | } |
257 | 257 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @author Mike Nelson |
9 | 9 | * |
10 | 10 | */ |
11 | -class EEG_Mijireh extends EE_Offsite_Gateway{ |
|
11 | +class EEG_Mijireh extends EE_Offsite_Gateway { |
|
12 | 12 | |
13 | 13 | protected $_access_key; |
14 | 14 | |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | $primary_attendee = $primary_registrant->attendee(); |
38 | 38 | $items = array(); |
39 | 39 | //if we're are charging for the full amount, show the normal line items |
40 | - if( $this->_can_easily_itemize_transaction_for( $payment )){ |
|
40 | + if ($this->_can_easily_itemize_transaction_for($payment)) { |
|
41 | 41 | $total_line_item = $transaction->total_line_item(); |
42 | 42 | $tax_total = $total_line_item->get_total_tax(); |
43 | - foreach($total_line_item->get_items() as $line_item){ |
|
43 | + foreach ($total_line_item->get_items() as $line_item) { |
|
44 | 44 | $items[] = array( |
45 | 45 | 'name'=>apply_filters( |
46 | 46 | 'FHEE__EEG_Mijireh__set_redirection_info__full_amount_line_item_name', |
47 | - $this->_format_line_item_name( $line_item, $payment ), |
|
47 | + $this->_format_line_item_name($line_item, $payment), |
|
48 | 48 | $line_item, |
49 | 49 | $payment, |
50 | 50 | $primary_registrant |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | 'quantity'=>$line_item->quantity() |
55 | 55 | ); |
56 | 56 | } |
57 | - }else{//its a partial payment |
|
57 | + } else {//its a partial payment |
|
58 | 58 | $tax_total = 0; |
59 | 59 | //partial payment, so just add 1 item |
60 | 60 | $items[] = array( |
61 | 61 | 'name'=> apply_filters( |
62 | 62 | 'FHEE__EEG_Mijireh__set_redirection_info__partial_amount_line_item_name', |
63 | - $this->_format_partial_payment_line_item_name( $payment ), |
|
63 | + $this->_format_partial_payment_line_item_name($payment), |
|
64 | 64 | $payment, |
65 | 65 | $primary_registrant |
66 | 66 | ), |
@@ -72,18 +72,18 @@ discard block |
||
72 | 72 | $order = array( |
73 | 73 | 'total'=>$this->format_currency($payment->amount()), |
74 | 74 | 'return_url'=>$return_url, |
75 | - 'items'=>$this->_prepare_for_mijireh( $items ), |
|
75 | + 'items'=>$this->_prepare_for_mijireh($items), |
|
76 | 76 | 'email'=>$primary_attendee->email(), |
77 | 77 | 'first_name'=>$primary_attendee->fname(), |
78 | 78 | 'last_name'=>$primary_attendee->lname(), |
79 | 79 | 'tax'=>$this->format_currency($tax_total), |
80 | 80 | 'partner_id'=>'ee'); |
81 | 81 | //setup address? |
82 | - if( $primary_attendee->address() && |
|
83 | - $primary_attendee->city() && |
|
84 | - $primary_attendee->state_ID() && |
|
85 | - $primary_attendee->country_ID() && |
|
86 | - $primary_attendee->zip() ){ |
|
82 | + if ($primary_attendee->address() && |
|
83 | + $primary_attendee->city() && |
|
84 | + $primary_attendee->state_ID() && |
|
85 | + $primary_attendee->country_ID() && |
|
86 | + $primary_attendee->zip()) { |
|
87 | 87 | $shipping_address = array( |
88 | 88 | 'first_name'=>$primary_attendee->fname(), |
89 | 89 | 'last_name'=>$primary_attendee->lname(), |
@@ -93,64 +93,64 @@ discard block |
||
93 | 93 | 'zip_code' => $primary_attendee->zip(), |
94 | 94 | 'country' => $primary_attendee->country_ID() |
95 | 95 | ); |
96 | - if( $primary_attendee->address2() ){ |
|
97 | - $shipping_address[ 'apt_suite' ] = $primary_attendee->address2(); |
|
96 | + if ($primary_attendee->address2()) { |
|
97 | + $shipping_address['apt_suite'] = $primary_attendee->address2(); |
|
98 | 98 | } |
99 | - if( $primary_attendee->phone() ){ |
|
100 | - $shipping_address[ 'phone' ] = $primary_attendee->phone(); |
|
99 | + if ($primary_attendee->phone()) { |
|
100 | + $shipping_address['phone'] = $primary_attendee->phone(); |
|
101 | 101 | } |
102 | - $order[ 'shipping_address' ] = $shipping_address; |
|
102 | + $order['shipping_address'] = $shipping_address; |
|
103 | 103 | } |
104 | - $order = apply_filters( 'FHEE__EEG_Mijireh__set_redirection_info__order_arguments', $order, $payment, $primary_registrant ); |
|
105 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, serialize(get_object_vars($this)) ); |
|
104 | + $order = apply_filters('FHEE__EEG_Mijireh__set_redirection_info__order_arguments', $order, $payment, $primary_registrant); |
|
105 | + do_action('AHEE_log', __FILE__, __FUNCTION__, serialize(get_object_vars($this))); |
|
106 | 106 | $order = $this->_get_unsupported_character_remover()->formatArray($order); |
107 | 107 | |
108 | 108 | $args = array( |
109 | 109 | 'headers' => array( |
110 | - 'Authorization' => 'Basic ' . base64_encode( $this->_access_key . ':' ), |
|
110 | + 'Authorization' => 'Basic '.base64_encode($this->_access_key.':'), |
|
111 | 111 | 'Accept'=>'application/json' |
112 | 112 | ), |
113 | 113 | 'body'=> wp_json_encode($order) |
114 | 114 | ); |
115 | - $response = wp_remote_post( $this->_mijireh_api_orders_url, $args ); |
|
115 | + $response = wp_remote_post($this->_mijireh_api_orders_url, $args); |
|
116 | 116 | $problems_string = false; |
117 | - $this->log(array('get checkout url request_args' => $args, 'response' => $response ), $payment); |
|
118 | - if( ! $response instanceof WP_Error ){ |
|
117 | + $this->log(array('get checkout url request_args' => $args, 'response' => $response), $payment); |
|
118 | + if ( ! $response instanceof WP_Error) { |
|
119 | 119 | $response_body = json_decode($response['body']); |
120 | - if($response_body && isset($response_body->checkout_url)){ |
|
120 | + if ($response_body && isset($response_body->checkout_url)) { |
|
121 | 121 | $payment->set_redirect_url($response_body->checkout_url); |
122 | 122 | $payment->set_txn_id_chq_nmbr($response_body->order_number); |
123 | 123 | $payment->set_details($response['body']); |
124 | 124 | } else { |
125 | - if( is_array( $response_body ) || is_object( $response_body)){ |
|
126 | - $response_body_as_array = (array)$response_body; |
|
127 | - foreach($response_body_as_array as $problem_parameter => $problems){ |
|
128 | - $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems)); |
|
125 | + if (is_array($response_body) || is_object($response_body)) { |
|
126 | + $response_body_as_array = (array) $response_body; |
|
127 | + foreach ($response_body_as_array as $problem_parameter => $problems) { |
|
128 | + $problems_string .= sprintf(__('\nProblems with %s: %s', 'event_espresso'), $problem_parameter, implode(", ", $problems)); |
|
129 | 129 | } |
130 | - }else{ |
|
130 | + } else { |
|
131 | 131 | $problems_string = $response['body']; |
132 | 132 | } |
133 | - if( ! $problems_string ) { |
|
133 | + if ( ! $problems_string) { |
|
134 | 134 | //no message to show? wack |
135 | - if( isset( $response[ 'headers' ][ 'status' ] ) ){ |
|
136 | - $problems_string = $response[ 'headers' ][ 'status' ]; |
|
137 | - }else{ |
|
138 | - $problems_string = __( 'No response from Mijireh', 'event_espresso' ); |
|
135 | + if (isset($response['headers']['status'])) { |
|
136 | + $problems_string = $response['headers']['status']; |
|
137 | + } else { |
|
138 | + $problems_string = __('No response from Mijireh', 'event_espresso'); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | } |
142 | - }else{ |
|
143 | - $problems_string = implode( ",", $response->get_error_messages() ); |
|
142 | + } else { |
|
143 | + $problems_string = implode(",", $response->get_error_messages()); |
|
144 | 144 | } |
145 | 145 | |
146 | - if( $problems_string ) { |
|
147 | - $payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) ); |
|
148 | - $payment->set_details( $response ); |
|
149 | - $payment->set_redirect_url( null ); |
|
146 | + if ($problems_string) { |
|
147 | + $payment->set_gateway_response(sprintf(__('Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string)); |
|
148 | + $payment->set_details($response); |
|
149 | + $payment->set_redirect_url(null); |
|
150 | 150 | //even though the payment's status is failed at this point anyways, |
151 | 151 | //let's be explicit about it. The fact that the redirect url is null |
152 | 152 | //should be enough to client code that they can't redirect the user |
153 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
153 | + $payment->set_status($this->_pay_model->failed_status()); |
|
154 | 154 | } |
155 | 155 | return $payment; |
156 | 156 | } |
@@ -163,16 +163,16 @@ discard block |
||
163 | 163 | * @param mixed $data |
164 | 164 | * @return mixed same type as $data |
165 | 165 | */ |
166 | - private function _prepare_for_mijireh( $data ){ |
|
167 | - if( is_array( $data ) ){ |
|
166 | + private function _prepare_for_mijireh($data) { |
|
167 | + if (is_array($data)) { |
|
168 | 168 | $prepared_data = array(); |
169 | - foreach($data as $key => $datum ){ |
|
170 | - $prepared_data[ $key ] = $this->_prepare_for_mijireh( $datum ); |
|
169 | + foreach ($data as $key => $datum) { |
|
170 | + $prepared_data[$key] = $this->_prepare_for_mijireh($datum); |
|
171 | 171 | } |
172 | 172 | return $prepared_data; |
173 | - }elseif(is_string( $data ) ){ |
|
174 | - return str_replace( '%', 'percent', $data ); |
|
175 | - }else{ |
|
173 | + }elseif (is_string($data)) { |
|
174 | + return str_replace('%', 'percent', $data); |
|
175 | + } else { |
|
176 | 176 | return $data; |
177 | 177 | } |
178 | 178 | } |
@@ -191,16 +191,16 @@ discard block |
||
191 | 191 | * @throws EE_Error |
192 | 192 | */ |
193 | 193 | public function handle_payment_update($update_info, $transaction) { |
194 | - foreach( $transaction->pending_payments() as $payment){ |
|
194 | + foreach ($transaction->pending_payments() as $payment) { |
|
195 | 195 | $payment = $this->check_payment_in_mijireh($payment); |
196 | - if( $payment->status() === $this->_pay_model->approved_status()){ |
|
196 | + if ($payment->status() === $this->_pay_model->approved_status()) { |
|
197 | 197 | return $payment; |
198 | 198 | } |
199 | 199 | } |
200 | 200 | $payment = $transaction instanceof EEI_Transaction ? $transaction->last_payment() : NULL; |
201 | 201 | |
202 | - if ( ! $payment instanceof EEI_Payment ){ |
|
203 | - throw new EE_Error( sprintf( __( "Could not find Mijireh payment for transaction %s", 'event_espresso' ), $transaction->ID() ) ); |
|
202 | + if ( ! $payment instanceof EEI_Payment) { |
|
203 | + throw new EE_Error(sprintf(__("Could not find Mijireh payment for transaction %s", 'event_espresso'), $transaction->ID())); |
|
204 | 204 | } |
205 | 205 | return $payment; |
206 | 206 | } |
@@ -212,27 +212,27 @@ discard block |
||
212 | 212 | * @param \EEI_Payment $payment |
213 | 213 | * @return \EEI_Payment |
214 | 214 | */ |
215 | - public function check_payment_in_mijireh( EEI_Payment $payment ){ |
|
215 | + public function check_payment_in_mijireh(EEI_Payment $payment) { |
|
216 | 216 | $request_args = array( |
217 | 217 | 'headers' => array( |
218 | - 'Authorization' => 'Basic ' . base64_encode( $this->_access_key . ':' ), |
|
218 | + 'Authorization' => 'Basic '.base64_encode($this->_access_key.':'), |
|
219 | 219 | 'Accept'=>'application/json' |
220 | 220 | ) |
221 | 221 | ); |
222 | 222 | |
223 | 223 | $response = wp_remote_get( |
224 | - $this->_mijireh_api_orders_url . '/' . $payment->txn_id_chq_nmbr(), |
|
224 | + $this->_mijireh_api_orders_url.'/'.$payment->txn_id_chq_nmbr(), |
|
225 | 225 | $request_args |
226 | 226 | ); |
227 | 227 | |
228 | 228 | $this->log( |
229 | - array( 'get payment status request_args' => $request_args, 'response' => $response ), |
|
229 | + array('get payment status request_args' => $request_args, 'response' => $response), |
|
230 | 230 | $payment |
231 | 231 | ); |
232 | 232 | // validate response |
233 | - $response_body = isset( $response[ 'body' ] ) ? json_decode( $response[ 'body' ] ) : ''; |
|
234 | - if( $response && $response_body ){ |
|
235 | - switch( $response_body->status ){ |
|
233 | + $response_body = isset($response['body']) ? json_decode($response['body']) : ''; |
|
234 | + if ($response && $response_body) { |
|
235 | + switch ($response_body->status) { |
|
236 | 236 | case 'paid': |
237 | 237 | $payment->set_status($this->_pay_model->approved_status()); |
238 | 238 | break; |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | } |
245 | 245 | |
246 | 246 | } else { |
247 | - $payment->set_gateway_response( __( 'Response from Mijireh could not be understood.', 'event_espresso' ) ); |
|
248 | - $payment->set_details( $response ); |
|
249 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
247 | + $payment->set_gateway_response(__('Response from Mijireh could not be understood.', 'event_espresso')); |
|
248 | + $payment->set_details($response); |
|
249 | + $payment->set_status($this->_pay_model->failed_status()); |
|
250 | 250 | } |
251 | 251 | // the following is ONLY for testing the Mijireh IPN and should NEVER be uncommented for real usage |
252 | 252 | // $payment->set_status( $this->_pay_model->pending_status() ); |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php if (!defined('EVENT_ESPRESSO_VERSION')) |
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | /** |
4 | - * mijireh_settings_after_form |
|
5 | - * |
|
6 | - * @package Event Espresso |
|
7 | - * @subpackage |
|
8 | - * @author Mike Nelson |
|
9 | - */ |
|
4 | + * mijireh_settings_after_form |
|
5 | + * |
|
6 | + * @package Event Espresso |
|
7 | + * @subpackage |
|
8 | + * @author Mike Nelson |
|
9 | + */ |
|
10 | 10 | do_action('AHEE__EE_Mijireh__settings_end'); |
11 | 11 | ?><br/><?php |
12 | 12 | // End of file mijireh_settings_after_form.template.php |
13 | 13 | \ No newline at end of file |
@@ -1,4 +1,4 @@ |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | /** |
4 | 4 | * mijireh_settings_after_form |
@@ -1,5 +1,6 @@ |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) |
|
1 | +<?php if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | 2 | exit('No direct script access allowed'); |
3 | +} |
|
3 | 4 | /** |
4 | 5 | * mijireh_settings_after_form |
5 | 6 | * |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * @param array $props_n_values |
31 | 31 | * @return EE_Post_Meta|mixed |
32 | 32 | */ |
33 | - public static function new_instance( $props_n_values = array() ) { |
|
34 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
35 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
33 | + public static function new_instance($props_n_values = array()) { |
|
34 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
35 | + return $has_object ? $has_object : new self($props_n_values); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * @param array $props_n_values |
42 | 42 | * @return EE_Post_Meta |
43 | 43 | */ |
44 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
45 | - return new self( $props_n_values, TRUE ); |
|
44 | + public static function new_instance_from_db($props_n_values = array()) { |
|
45 | + return new self($props_n_values, TRUE); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @return int |
53 | 53 | */ |
54 | 54 | function meta_id() { |
55 | - return $this->get( 'meta_id' ); |
|
55 | + return $this->get('meta_id'); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | * @param int $meta_id |
63 | 63 | * @return boolean |
64 | 64 | */ |
65 | - function set_meta_id( $meta_id) { |
|
66 | - return $this->set( 'meta_id', $meta_id); |
|
65 | + function set_meta_id($meta_id) { |
|
66 | + return $this->set('meta_id', $meta_id); |
|
67 | 67 | } |
68 | 68 | /** |
69 | 69 | * Gets post_id |
70 | 70 | * @return int |
71 | 71 | */ |
72 | 72 | function post_id() { |
73 | - return $this->get( 'post_id' ); |
|
73 | + return $this->get('post_id'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | * @param int $post_id |
81 | 81 | * @return boolean |
82 | 82 | */ |
83 | - function set_post_id( $post_id) { |
|
84 | - return $this->set( 'post_id', $post_id); |
|
83 | + function set_post_id($post_id) { |
|
84 | + return $this->set('post_id', $post_id); |
|
85 | 85 | } |
86 | 86 | /** |
87 | 87 | * Gets meta_key |
88 | 88 | * @return string |
89 | 89 | */ |
90 | 90 | function meta_key() { |
91 | - return $this->get( 'meta_key' ); |
|
91 | + return $this->get('meta_key'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -98,15 +98,15 @@ discard block |
||
98 | 98 | * @param string $meta_key |
99 | 99 | * @return boolean |
100 | 100 | */ |
101 | - function set_meta_key( $meta_key) { |
|
102 | - return $this->set( 'meta_key', $meta_key); |
|
101 | + function set_meta_key($meta_key) { |
|
102 | + return $this->set('meta_key', $meta_key); |
|
103 | 103 | } |
104 | 104 | /** |
105 | 105 | * Gets meta_value |
106 | 106 | * @return mixed |
107 | 107 | */ |
108 | 108 | function meta_value() { |
109 | - return $this->get( 'meta_value' ); |
|
109 | + return $this->get('meta_value'); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * @param mixed $meta_value |
117 | 117 | * @return boolean |
118 | 118 | */ |
119 | - function set_meta_value( $meta_value) { |
|
120 | - return $this->set( 'meta_value', $meta_value); |
|
119 | + function set_meta_value($meta_value) { |
|
120 | + return $this->set('meta_value', $meta_value); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * Sets meta_id |
62 | 62 | * @param int $meta_id |
63 | - * @return boolean |
|
63 | + * @return boolean|null |
|
64 | 64 | */ |
65 | 65 | function set_meta_id( $meta_id) { |
66 | 66 | return $this->set( 'meta_id', $meta_id); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * Sets post_id |
80 | 80 | * @param int $post_id |
81 | - * @return boolean |
|
81 | + * @return boolean|null |
|
82 | 82 | */ |
83 | 83 | function set_post_id( $post_id) { |
84 | 84 | return $this->set( 'post_id', $post_id); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | /** |
97 | 97 | * Sets meta_key |
98 | 98 | * @param string $meta_key |
99 | - * @return boolean |
|
99 | + * @return boolean|null |
|
100 | 100 | */ |
101 | 101 | function set_meta_key( $meta_key) { |
102 | 102 | return $this->set( 'meta_key', $meta_key); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * Sets meta_value |
116 | 116 | * @param mixed $meta_value |
117 | - * @return boolean |
|
117 | + * @return boolean|null |
|
118 | 118 | */ |
119 | 119 | function set_meta_value( $meta_value) { |
120 | 120 | return $this->set( 'meta_value', $meta_value); |
@@ -125,14 +125,14 @@ |
||
125 | 125 | public function get_attendee_property_answer_value( EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE ){ |
126 | 126 | $field_name = NULL; |
127 | 127 | $value = NULL; |
128 | - //backward compat: we still want to find the question's ID |
|
129 | - if( is_numeric( $question_system_id ) ) { |
|
130 | - //find this question's QST_system value |
|
131 | - $question_id = $question_system_id; |
|
132 | - $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' ); |
|
133 | - } else { |
|
134 | - $question_id = intval( EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ) ); |
|
135 | - } |
|
128 | + //backward compat: we still want to find the question's ID |
|
129 | + if( is_numeric( $question_system_id ) ) { |
|
130 | + //find this question's QST_system value |
|
131 | + $question_id = $question_system_id; |
|
132 | + $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' ); |
|
133 | + } else { |
|
134 | + $question_id = intval( EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ) ); |
|
135 | + } |
|
136 | 136 | //only bother checking if the registration has an attendee |
137 | 137 | if( $registration->attendee() instanceof EE_Attendee ) { |
138 | 138 | $field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question( $question_system_id ); |
@@ -51,18 +51,18 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * constructor |
53 | 53 | */ |
54 | - protected function __construct( $timezone = NULL ){ |
|
55 | - $this->singular_item = __('Answer','event_espresso'); |
|
56 | - $this->plural_item = __('Answers','event_espresso'); |
|
54 | + protected function __construct($timezone = NULL) { |
|
55 | + $this->singular_item = __('Answer', 'event_espresso'); |
|
56 | + $this->plural_item = __('Answers', 'event_espresso'); |
|
57 | 57 | $this->_tables = array( |
58 | 58 | 'Answer'=> new EE_Primary_Table('esp_answer', 'ANS_ID') |
59 | 59 | ); |
60 | 60 | $this->_fields = array( |
61 | 61 | 'Answer'=>array( |
62 | - 'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID','event_espresso')), |
|
63 | - 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID','event_espresso'), false, 0, 'Registration'), |
|
64 | - 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'), |
|
65 | - 'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value','event_espresso'), false, '') |
|
62 | + 'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID', 'event_espresso')), |
|
63 | + 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'), |
|
64 | + 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'), |
|
65 | + 'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value', 'event_espresso'), false, '') |
|
66 | 66 | )); |
67 | 67 | $this->_model_relations = array( |
68 | 68 | 'Registration'=>new EE_Belongs_To_Relation(), |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | ); |
71 | 71 | $this->_model_chain_to_wp_user = 'Registration.Event'; |
72 | 72 | $this->_caps_slug = 'registrations'; |
73 | - parent::__construct( $timezone ); |
|
73 | + parent::__construct($timezone); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -83,19 +83,19 @@ discard block |
||
83 | 83 | * @param boolean $pretty_answer whether to call 'pretty_value' or just 'value' |
84 | 84 | * @return string |
85 | 85 | */ |
86 | - public function get_answer_value_to_question( EE_Registration $registration, $question_id = NULL,$pretty_answer = FALSE ){ |
|
87 | - $value = $this->get_attendee_property_answer_value( $registration, $question_id, $pretty_answer ); |
|
88 | - if ( $value === NULL ){ |
|
89 | - $answer_obj = $this->get_registration_question_answer_object( $registration, $question_id, $pretty_answer ); |
|
90 | - if( $answer_obj instanceof EE_Answer ){ |
|
91 | - if($pretty_answer){ |
|
86 | + public function get_answer_value_to_question(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) { |
|
87 | + $value = $this->get_attendee_property_answer_value($registration, $question_id, $pretty_answer); |
|
88 | + if ($value === NULL) { |
|
89 | + $answer_obj = $this->get_registration_question_answer_object($registration, $question_id, $pretty_answer); |
|
90 | + if ($answer_obj instanceof EE_Answer) { |
|
91 | + if ($pretty_answer) { |
|
92 | 92 | $value = $answer_obj->pretty_value(); |
93 | - }else{ |
|
93 | + } else { |
|
94 | 94 | $value = $answer_obj->value(); |
95 | 95 | } |
96 | 96 | } |
97 | 97 | } |
98 | - return apply_filters( 'FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id ); |
|
98 | + return apply_filters('FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | * @param int $question_id |
107 | 107 | * @return EE_Answer |
108 | 108 | */ |
109 | - public function get_registration_question_answer_object( EE_Registration $registration, $question_id = NULL){ |
|
110 | - $answer_obj = $this->get_one( array( array( 'QST_ID'=>$question_id, 'REG_ID'=>$registration->ID() ))); |
|
111 | - return apply_filters( 'FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id ); |
|
109 | + public function get_registration_question_answer_object(EE_Registration $registration, $question_id = NULL) { |
|
110 | + $answer_obj = $this->get_one(array(array('QST_ID'=>$question_id, 'REG_ID'=>$registration->ID()))); |
|
111 | + return apply_filters('FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -122,39 +122,39 @@ discard block |
||
122 | 122 | * @return string|null (if the registration has no attendee, or the question_system_id is not a QST_ID or QST_system for |
123 | 123 | * a question corresponding to an attendee field, returns null) |
124 | 124 | */ |
125 | - public function get_attendee_property_answer_value( EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE ){ |
|
125 | + public function get_attendee_property_answer_value(EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE) { |
|
126 | 126 | $field_name = NULL; |
127 | 127 | $value = NULL; |
128 | 128 | //backward compat: we still want to find the question's ID |
129 | - if( is_numeric( $question_system_id ) ) { |
|
129 | + if (is_numeric($question_system_id)) { |
|
130 | 130 | //find this question's QST_system value |
131 | 131 | $question_id = $question_system_id; |
132 | - $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' ); |
|
132 | + $question_system_id = EEM_Question::instance()->get_var(array(array('QST_ID' => $question_system_id)), 'QST_system'); |
|
133 | 133 | } else { |
134 | - $question_id = intval( EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ) ); |
|
134 | + $question_id = intval(EEM_Question::instance()->get_var(array(array('QST_system' => $question_system_id)), 'QST_ID')); |
|
135 | 135 | } |
136 | 136 | //only bother checking if the registration has an attendee |
137 | - if( $registration->attendee() instanceof EE_Attendee ) { |
|
138 | - $field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question( $question_system_id ); |
|
139 | - if( $field_name ) { |
|
140 | - if( $pretty_answer ) { |
|
141 | - if( $field_name == 'STA_ID' ) { |
|
137 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
138 | + $field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question($question_system_id); |
|
139 | + if ($field_name) { |
|
140 | + if ($pretty_answer) { |
|
141 | + if ($field_name == 'STA_ID') { |
|
142 | 142 | $state = $registration->attendee()->state_obj(); |
143 | - $value = $state instanceof EE_State ? $state->name() : sprintf( __('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID() ); |
|
144 | - } else if($field_name == 'CNT_ISO') { |
|
143 | + $value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID()); |
|
144 | + } else if ($field_name == 'CNT_ISO') { |
|
145 | 145 | $country = $registration->attendee()->country_obj(); |
146 | - $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID()); |
|
146 | + $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"), $registration->attendee()->country_ID()); |
|
147 | 147 | } else { |
148 | - $value = $registration->attendee()->get_pretty( $field_name ); |
|
148 | + $value = $registration->attendee()->get_pretty($field_name); |
|
149 | 149 | } |
150 | 150 | //if field name is blank, leave the value as null too |
151 | - }else{ |
|
152 | - $value = $registration->attendee()->get( $field_name ); |
|
151 | + } else { |
|
152 | + $value = $registration->attendee()->get($field_name); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | //if no field was found, leave value blank |
156 | 156 | } |
157 | - return apply_filters( 'FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id, $question_system_id ); |
|
157 | + return apply_filters('FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id, $question_system_id); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 |
@@ -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 | * |
@@ -90,7 +92,7 @@ discard block |
||
90 | 92 | if( $answer_obj instanceof EE_Answer ){ |
91 | 93 | if($pretty_answer){ |
92 | 94 | $value = $answer_obj->pretty_value(); |
93 | - }else{ |
|
95 | + } else{ |
|
94 | 96 | $value = $answer_obj->value(); |
95 | 97 | } |
96 | 98 | } |
@@ -148,7 +150,7 @@ discard block |
||
148 | 150 | $value = $registration->attendee()->get_pretty( $field_name ); |
149 | 151 | } |
150 | 152 | //if field name is blank, leave the value as null too |
151 | - }else{ |
|
153 | + } else{ |
|
152 | 154 | $value = $registration->attendee()->get( $field_name ); |
153 | 155 | } |
154 | 156 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * with the exception of a particular attribute |
27 | 27 | * @return object of the same class as what was called on |
28 | 28 | */ |
29 | - public function duplicate( $options = array() ); |
|
29 | + public function duplicate($options = array()); |
|
30 | 30 | |
31 | 31 | |
32 | 32 |
@@ -7,13 +7,13 @@ |
||
7 | 7 | <!-- Facebook sharing information tags --> |
8 | 8 | <meta property="og:title" content="<?php echo $subject; ?>" /> |
9 | 9 | <title><?php echo $subject; ?></title> |
10 | - <?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_head', $message_type, $subject, $from, $main_body ); ?> |
|
10 | + <?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_head', $message_type, $subject, $from, $main_body); ?> |
|
11 | 11 | </head> |
12 | -<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_header', $message_type, $subject, $from, $main_body ); ?> |
|
12 | +<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_header', $message_type, $subject, $from, $main_body); ?> |
|
13 | 13 | <body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"> |
14 | -<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_before_main_body', $message_type, $subject, $from, $main_body ); ?> |
|
14 | +<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_before_main_body', $message_type, $subject, $from, $main_body); ?> |
|
15 | 15 | <?php echo $main_body; ?> |
16 | -<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_after_main_body', $message_type, $subject, $from, $main_body ); ?> |
|
16 | +<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_after_main_body', $message_type, $subject, $from, $main_body); ?> |
|
17 | 17 | </body> |
18 | -<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_footer', $message_type, $subject, $from, $main_body ); ?> |
|
18 | +<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_footer', $message_type, $subject, $from, $main_body); ?> |
|
19 | 19 | </html> |
20 | 20 | \ No newline at end of file |
@@ -27,21 +27,21 @@ |
||
27 | 27 | <!-- Primary Style Sheet --> |
28 | 28 | <link rel="stylesheet" type="text/css" href="<?php echo $main_css; ?>" /> |
29 | 29 | <!-- Make sure the buttons don't print --> |
30 | - <?php if ( isset( $extra_css )) : ?> |
|
30 | + <?php if (isset($extra_css)) : ?> |
|
31 | 31 | <!-- Additional Style Sheet --> |
32 | 32 | <link rel="stylesheet" type="text/css" href="<?php echo $extra_css; ?>" /> |
33 | 33 | <?php endif; ?> |
34 | 34 | <style type="text/css"> |
35 | 35 | @media print{ .noPrint{ display:none !important;height:0!important; width:0!important; margin:0!important; padding:0!important; }} |
36 | 36 | </style> |
37 | - <?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_head', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
37 | + <?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_head', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
38 | 38 | </head> |
39 | - <?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_header', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
39 | + <?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_header', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
40 | 40 | <body> |
41 | - <?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_before_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
41 | + <?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_before_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
42 | 42 | <?php echo $main_body; ?> |
43 | - <?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_after_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
43 | + <?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_after_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
44 | 44 | </body> |
45 | - <?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_footer', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
45 | + <?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_footer', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
46 | 46 | <?php wp_footer(); ?> |
47 | 47 | </html> |
48 | 48 | \ No newline at end of file |