@@ -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 | * |
@@ -37,33 +37,33 @@ discard block |
||
37 | 37 | * @access protected |
38 | 38 | * @return EEM_Payment_Method |
39 | 39 | */ |
40 | - protected function __construct( $timezone = NULL ) { |
|
41 | - $this->singlular_item = __( 'Payment Method', 'event_espresso' ); |
|
42 | - $this->plural_item = __( 'Payment Methods', 'event_espresso' ); |
|
43 | - $this->_tables = array( 'Payment_Method' => new EE_Primary_Table( 'esp_payment_method', 'PMD_ID' ) ); |
|
40 | + protected function __construct($timezone = NULL) { |
|
41 | + $this->singlular_item = __('Payment Method', 'event_espresso'); |
|
42 | + $this->plural_item = __('Payment Methods', 'event_espresso'); |
|
43 | + $this->_tables = array('Payment_Method' => new EE_Primary_Table('esp_payment_method', 'PMD_ID')); |
|
44 | 44 | $this->_fields = array( |
45 | 45 | 'Payment_Method' => array( |
46 | - 'PMD_ID' => new EE_Primary_Key_Int_Field( 'PMD_ID', __( "ID", 'event_espresso' ) ), |
|
47 | - 'PMD_type' => new EE_Plain_Text_Field( 'PMD_type', __( "Payment Method Type", 'event_espresso' ), FALSE, 'Admin_Only' ), |
|
48 | - 'PMD_name' => new EE_Plain_Text_Field( 'PMD_name', __( "Name", 'event_espresso' ), FALSE ), |
|
49 | - 'PMD_desc' => new EE_Post_Content_Field( 'PMD_desc', __( "Description", 'event_espresso' ), FALSE, '' ), |
|
50 | - 'PMD_admin_name' => new EE_Plain_Text_Field( 'PMD_admin_name', __( "Admin-Only Name", 'event_espresso' ), TRUE ), |
|
51 | - 'PMD_admin_desc' => new EE_Post_Content_Field( 'PMD_admin_desc', __( "Admin-Only Description", 'event_espresso' ), TRUE ), |
|
52 | - 'PMD_slug' => new EE_Slug_Field( 'PMD_slug', __( "Slug", 'event_espresso' ), FALSE ), |
|
53 | - 'PMD_order' => new EE_Integer_Field( 'PMD_order', __( "Order", 'event_espresso' ), FALSE, 0 ), |
|
54 | - 'PMD_debug_mode' => new EE_Boolean_Field( 'PMD_debug_mode', __( "Debug Mode On?", 'event_espresso' ), FALSE, FALSE ), |
|
55 | - 'PMD_wp_user' => new EE_WP_User_Field( 'PMD_wp_user', __( "Payment Method Creator ID", 'event_espresso' ), FALSE ), |
|
56 | - 'PMD_open_by_default' => new EE_Boolean_Field( 'PMD_open_by_default', __( "Open by Default?", 'event_espresso' ), FALSE, FALSE ), 'PMD_button_url' => new EE_Plain_Text_Field( 'PMD_button_url', __( "Button URL", 'event_espresso' ), TRUE, '' ), |
|
57 | - 'PMD_scope' => new EE_Serialized_Text_Field( 'PMD_scope', __( "Usable From?", 'event_espresso' ), FALSE, array() ), //possible values currently are 'CART','ADMIN','API' |
|
46 | + 'PMD_ID' => new EE_Primary_Key_Int_Field('PMD_ID', __("ID", 'event_espresso')), |
|
47 | + 'PMD_type' => new EE_Plain_Text_Field('PMD_type', __("Payment Method Type", 'event_espresso'), FALSE, 'Admin_Only'), |
|
48 | + 'PMD_name' => new EE_Plain_Text_Field('PMD_name', __("Name", 'event_espresso'), FALSE), |
|
49 | + 'PMD_desc' => new EE_Post_Content_Field('PMD_desc', __("Description", 'event_espresso'), FALSE, ''), |
|
50 | + 'PMD_admin_name' => new EE_Plain_Text_Field('PMD_admin_name', __("Admin-Only Name", 'event_espresso'), TRUE), |
|
51 | + 'PMD_admin_desc' => new EE_Post_Content_Field('PMD_admin_desc', __("Admin-Only Description", 'event_espresso'), TRUE), |
|
52 | + 'PMD_slug' => new EE_Slug_Field('PMD_slug', __("Slug", 'event_espresso'), FALSE), |
|
53 | + 'PMD_order' => new EE_Integer_Field('PMD_order', __("Order", 'event_espresso'), FALSE, 0), |
|
54 | + 'PMD_debug_mode' => new EE_Boolean_Field('PMD_debug_mode', __("Debug Mode On?", 'event_espresso'), FALSE, FALSE), |
|
55 | + 'PMD_wp_user' => new EE_WP_User_Field('PMD_wp_user', __("Payment Method Creator ID", 'event_espresso'), FALSE), |
|
56 | + 'PMD_open_by_default' => new EE_Boolean_Field('PMD_open_by_default', __("Open by Default?", 'event_espresso'), FALSE, FALSE), 'PMD_button_url' => new EE_Plain_Text_Field('PMD_button_url', __("Button URL", 'event_espresso'), TRUE, ''), |
|
57 | + 'PMD_scope' => new EE_Serialized_Text_Field('PMD_scope', __("Usable From?", 'event_espresso'), FALSE, array()), //possible values currently are 'CART','ADMIN','API' |
|
58 | 58 | ) ); |
59 | 59 | $this->_model_relations = array( |
60 | 60 | // 'Event'=>new EE_HABTM_Relation('Event_Payment_Method'), |
61 | 61 | 'Payment' => new EE_Has_Many_Relation(), |
62 | - 'Currency' => new EE_HABTM_Relation( 'Currency_Payment_Method' ), |
|
62 | + 'Currency' => new EE_HABTM_Relation('Currency_Payment_Method'), |
|
63 | 63 | 'Transaction' => new EE_Has_Many_Relation(), |
64 | 64 | 'WP_User' => new EE_Belongs_To_Relation(), |
65 | 65 | ); |
66 | - parent::__construct( $timezone ); |
|
66 | + parent::__construct($timezone); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * @param string $slug |
74 | 74 | * @return EE_Payment_Method |
75 | 75 | */ |
76 | - public function get_one_by_slug( $slug ) { |
|
77 | - return $this->get_one( array( array( 'PMD_slug' => $slug ) ) ); |
|
76 | + public function get_one_by_slug($slug) { |
|
77 | + return $this->get_one(array(array('PMD_slug' => $slug))); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | return apply_filters( |
89 | 89 | 'FHEE__EEM_Payment_Method__scopes', |
90 | 90 | array( |
91 | - self::scope_cart => __( "Front-end Registration Page", 'event_espresso' ), |
|
92 | - self::scope_admin => __( "Admin Registration Page (no online processing)", 'event_espresso' ) |
|
91 | + self::scope_cart => __("Front-end Registration Page", 'event_espresso'), |
|
92 | + self::scope_admin => __("Admin Registration Page (no online processing)", 'event_espresso') |
|
93 | 93 | ) |
94 | 94 | ); |
95 | 95 | } |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | * @param string $scope like one of EEM_Payment_Method::instance()->scopes() |
102 | 102 | * @return boolean |
103 | 103 | */ |
104 | - public function is_valid_scope( $scope ) { |
|
104 | + public function is_valid_scope($scope) { |
|
105 | 105 | $scopes = $this->scopes(); |
106 | - if ( isset( $scopes[ $scope ] ) ) { |
|
106 | + if (isset($scopes[$scope])) { |
|
107 | 107 | return TRUE; |
108 | 108 | } else { |
109 | 109 | return FALSE; |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | * @throws EE_Error |
120 | 120 | * @return EE_Payment_Method[] |
121 | 121 | */ |
122 | - public function get_all_active( $scope = NULL, $query_params = array() ) { |
|
123 | - if( ! isset( $query_params[ 'order_by' ] ) && ! isset( $query_params[ 'order' ] ) ) { |
|
124 | - $query_params = array( 'order_by' => array( 'PMD_order' => 'ASC', 'PMD_ID' => 'ASC' ) ); |
|
122 | + public function get_all_active($scope = NULL, $query_params = array()) { |
|
123 | + if ( ! isset($query_params['order_by']) && ! isset($query_params['order'])) { |
|
124 | + $query_params = array('order_by' => array('PMD_order' => 'ASC', 'PMD_ID' => 'ASC')); |
|
125 | 125 | } |
126 | - return $this->get_all( $this->_get_query_params_for_all_active( $scope, $query_params ) ); |
|
126 | + return $this->get_all($this->_get_query_params_for_all_active($scope, $query_params)); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * @param array $query_params |
133 | 133 | * @return int |
134 | 134 | */ |
135 | - public function count_active( $scope = NULL, $query_params = array() ){ |
|
136 | - return $this->count( $this->_get_query_params_for_all_active( $scope, $query_params ) ); |
|
135 | + public function count_active($scope = NULL, $query_params = array()) { |
|
136 | + return $this->count($this->_get_query_params_for_all_active($scope, $query_params)); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -144,21 +144,21 @@ discard block |
||
144 | 144 | * @return array like param of EEM_Base::get_all() |
145 | 145 | * @throws EE_Error |
146 | 146 | */ |
147 | - protected function _get_query_params_for_all_active( $scope = NULL, $query_params = array() ){ |
|
148 | - if ( $scope ) { |
|
149 | - if ( $this->is_valid_scope( $scope ) ) { |
|
150 | - return array_replace_recursive( array( array( 'PMD_scope' => array( 'LIKE', "%$scope%" ) ) ), $query_params ); |
|
147 | + protected function _get_query_params_for_all_active($scope = NULL, $query_params = array()) { |
|
148 | + if ($scope) { |
|
149 | + if ($this->is_valid_scope($scope)) { |
|
150 | + return array_replace_recursive(array(array('PMD_scope' => array('LIKE', "%$scope%"))), $query_params); |
|
151 | 151 | } else { |
152 | - throw new EE_Error( sprintf( __( "'%s' is not a valid scope for a payment method", "event_espresso" ), $scope ) ); |
|
152 | + throw new EE_Error(sprintf(__("'%s' is not a valid scope for a payment method", "event_espresso"), $scope)); |
|
153 | 153 | } |
154 | 154 | } else { |
155 | 155 | $acceptable_scopes = array(); |
156 | 156 | $count = 0; |
157 | - foreach ( $this->scopes() as $scope_name => $desc ) { |
|
157 | + foreach ($this->scopes() as $scope_name => $desc) { |
|
158 | 158 | $count++; |
159 | - $acceptable_scopes[ 'PMD_scope*' . $count ] = array( 'LIKE', '%' . $scope_name . '%' ); |
|
159 | + $acceptable_scopes['PMD_scope*'.$count] = array('LIKE', '%'.$scope_name.'%'); |
|
160 | 160 | } |
161 | - return array_replace_recursive( array( array( 'OR*active_scope' => $acceptable_scopes ) ), $query_params ); |
|
161 | + return array_replace_recursive(array(array('OR*active_scope' => $acceptable_scopes)), $query_params); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | * @return array like param of EEM_Base::get_all() |
171 | 171 | * @throws EE_Error |
172 | 172 | */ |
173 | - public function get_query_params_for_all_active( $scope = NULL, $query_params = array() ) { |
|
174 | - return $this->_get_query_params_for_all_active( $scope, $query_params ); |
|
173 | + public function get_query_params_for_all_active($scope = NULL, $query_params = array()) { |
|
174 | + return $this->_get_query_params_for_all_active($scope, $query_params); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | * @param array $query_params |
182 | 182 | * @return EE_Payment_Method |
183 | 183 | */ |
184 | - public function get_one_active( $scope = NULL, $query_params = array() ) { |
|
185 | - return $this->get_one( $this->_get_query_params_for_all_active( $scope, $query_params ) ); |
|
184 | + public function get_one_active($scope = NULL, $query_params = array()) { |
|
185 | + return $this->get_one($this->_get_query_params_for_all_active($scope, $query_params)); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | * @param string $type |
193 | 193 | * @return EE_Payment_Method |
194 | 194 | */ |
195 | - public function get_one_of_type( $type ) { |
|
196 | - return $this->get_one( array( array( 'PMD_type' => $type ) ) ); |
|
195 | + public function get_one_of_type($type) { |
|
196 | + return $this->get_one(array(array('PMD_type' => $type))); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
@@ -206,22 +206,22 @@ discard block |
||
206 | 206 | * @return EE_Payment_Method |
207 | 207 | * @throws EE_Error |
208 | 208 | */ |
209 | - public function ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db = FALSE ) { |
|
209 | + public function ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db = FALSE) { |
|
210 | 210 | //first: check if it's a slug |
211 | - if( is_string( $base_class_obj_or_id ) ) { |
|
212 | - $obj = $this->get_one_by_slug( $base_class_obj_or_id ); |
|
213 | - if( $obj ) { |
|
211 | + if (is_string($base_class_obj_or_id)) { |
|
212 | + $obj = $this->get_one_by_slug($base_class_obj_or_id); |
|
213 | + if ($obj) { |
|
214 | 214 | return $obj; |
215 | 215 | } |
216 | 216 | } |
217 | 217 | //ok so it wasn't a slug we were passed. try the usual then (ie, it's an object or an ID) |
218 | 218 | try { |
219 | - return parent::ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db ); |
|
219 | + return parent::ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db); |
|
220 | 220 | } |
221 | - catch ( EE_Error $e ) { |
|
221 | + catch (EE_Error $e) { |
|
222 | 222 | //handle it outside the catch |
223 | 223 | } |
224 | - throw new EE_Error( sprintf( __( "'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso" ), $base_class_obj_or_id ) ); |
|
224 | + throw new EE_Error(sprintf(__("'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso"), $base_class_obj_or_id)); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | |
@@ -232,12 +232,12 @@ discard block |
||
232 | 232 | * @param mixed $base_obj_or_id_or_slug |
233 | 233 | * @return int |
234 | 234 | */ |
235 | - function ensure_is_ID( $base_obj_or_id_or_slug ) { |
|
236 | - if ( is_string( $base_obj_or_id_or_slug ) ) { |
|
235 | + function ensure_is_ID($base_obj_or_id_or_slug) { |
|
236 | + if (is_string($base_obj_or_id_or_slug)) { |
|
237 | 237 | //assume it's a slug |
238 | - $base_obj_or_id_or_slug = $this->get_one_by_slug( $base_obj_or_id_or_slug ); |
|
238 | + $base_obj_or_id_or_slug = $this->get_one_by_slug($base_obj_or_id_or_slug); |
|
239 | 239 | } |
240 | - return parent::ensure_is_ID( $base_obj_or_id_or_slug ); |
|
240 | + return parent::ensure_is_ID($base_obj_or_id_or_slug); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
@@ -246,36 +246,36 @@ discard block |
||
246 | 246 | * Verifies the button urls on all the passed payment methods have a valid button url. If not, resets them to their default. |
247 | 247 | * @param EE_Payment_Method[] $payment_methods. If NULL is provided defaults to all payment methods active in the cart |
248 | 248 | */ |
249 | - function verify_button_urls( $payment_methods = NULL ) { |
|
250 | - $payment_methods = is_array( $payment_methods ) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart); |
|
251 | - foreach ( $payment_methods as $payment_method ) { |
|
249 | + function verify_button_urls($payment_methods = NULL) { |
|
250 | + $payment_methods = is_array($payment_methods) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart); |
|
251 | + foreach ($payment_methods as $payment_method) { |
|
252 | 252 | try { |
253 | 253 | $current_button_url = $payment_method->button_url(); |
254 | - $buttons_urls_to_try = apply_filters( 'FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array( |
|
255 | - 'current_ssl' => str_replace( "http://", "https://", $current_button_url ), |
|
256 | - 'current' => str_replace( "https://", "http://", $current_button_url ), |
|
257 | - 'default_ssl' => str_replace( "http://", "https://", $payment_method->type_obj()->default_button_url() ), |
|
258 | - 'default' => str_replace( "https://", "http://", $payment_method->type_obj()->default_button_url() ), |
|
259 | - ) ); |
|
260 | - foreach( $buttons_urls_to_try as $button_url_to_try ) { |
|
261 | - if( |
|
254 | + $buttons_urls_to_try = apply_filters('FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array( |
|
255 | + 'current_ssl' => str_replace("http://", "https://", $current_button_url), |
|
256 | + 'current' => str_replace("https://", "http://", $current_button_url), |
|
257 | + 'default_ssl' => str_replace("http://", "https://", $payment_method->type_obj()->default_button_url()), |
|
258 | + 'default' => str_replace("https://", "http://", $payment_method->type_obj()->default_button_url()), |
|
259 | + )); |
|
260 | + foreach ($buttons_urls_to_try as $button_url_to_try) { |
|
261 | + if ( |
|
262 | 262 | (//this is the current url and it exists, regardless of SSL issues |
263 | 263 | $button_url_to_try == $current_button_url && |
264 | 264 | EEH_URL::remote_file_exists( |
265 | 265 | $button_url_to_try, |
266 | 266 | array( |
267 | 267 | 'sslverify' => false, |
268 | - 'limit_response_size' => 4095,//we don't really care for a full response, but we do want headers at least. Lets just ask for a one block |
|
268 | + 'limit_response_size' => 4095, //we don't really care for a full response, but we do want headers at least. Lets just ask for a one block |
|
269 | 269 | ) ) |
270 | 270 | ) |
271 | 271 | || |
272 | 272 | (//this is NOT the current url and it exists with a working SSL cert |
273 | 273 | $button_url_to_try != $current_button_url && |
274 | - EEH_URL::remote_file_exists( $button_url_to_try ) |
|
274 | + EEH_URL::remote_file_exists($button_url_to_try) |
|
275 | 275 | ) ) { |
276 | - if( $current_button_url != $button_url_to_try ){ |
|
277 | - $payment_method->save( array( 'PMD_button_url' => $button_url_to_try ) ); |
|
278 | - EE_Error::add_attention( sprintf( __( "Payment Method %s's button url was set to %s, because the old image either didnt exist or SSL was recently enabled.", "event_espresso" ), $payment_method->name(), $button_url_to_try ) ); |
|
276 | + if ($current_button_url != $button_url_to_try) { |
|
277 | + $payment_method->save(array('PMD_button_url' => $button_url_to_try)); |
|
278 | + EE_Error::add_attention(sprintf(__("Payment Method %s's button url was set to %s, because the old image either didnt exist or SSL was recently enabled.", "event_espresso"), $payment_method->name(), $button_url_to_try)); |
|
279 | 279 | } |
280 | 280 | //this image exists. So if wasn't set before, now it is; |
281 | 281 | //or if it was already set, we have nothing to do |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | } |
284 | 284 | } |
285 | 285 | } |
286 | - catch ( EE_Error $e ) { |
|
287 | - $payment_method->set_active( FALSE ); |
|
286 | + catch (EE_Error $e) { |
|
287 | + $payment_method->set_active(FALSE); |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 | } |
@@ -298,29 +298,29 @@ discard block |
||
298 | 298 | * @param array $rows |
299 | 299 | * @return EE_Payment_Method[] |
300 | 300 | */ |
301 | - protected function _create_objects( $rows = array() ) { |
|
302 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
303 | - $payment_methods = parent::_create_objects( $rows ); |
|
301 | + protected function _create_objects($rows = array()) { |
|
302 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
303 | + $payment_methods = parent::_create_objects($rows); |
|
304 | 304 | /* @var $payment_methods EE_Payment_Method[] */ |
305 | 305 | $usable_payment_methods = array(); |
306 | - foreach ( $payment_methods as $key => $payment_method ) { |
|
307 | - if ( EE_Payment_Method_Manager::instance()->payment_method_type_exists( $payment_method->type() ) ) { |
|
308 | - $usable_payment_methods[ $key ] = $payment_method; |
|
306 | + foreach ($payment_methods as $key => $payment_method) { |
|
307 | + if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($payment_method->type())) { |
|
308 | + $usable_payment_methods[$key] = $payment_method; |
|
309 | 309 | //some payment methods enqueue their scripts in EE_PMT_*::__construct |
310 | 310 | //which is kinda a no-no (just because it's being constructed doesn't mean we need to enqueue |
311 | 311 | //its scripts). but for backwards-compat we should continue to do that |
312 | 312 | $payment_method->type_obj(); |
313 | - } elseif( $payment_method->active() ) { |
|
313 | + } elseif ($payment_method->active()) { |
|
314 | 314 | //only deactivate and notify the admin if the payment is active somewhere |
315 | 315 | $payment_method->deactivate(); |
316 | 316 | $payment_method->save(); |
317 | 317 | EE_Error::add_persistent_admin_notice( |
318 | - 'auto-deactivated-' . $payment_method->type(), |
|
318 | + 'auto-deactivated-'.$payment_method->type(), |
|
319 | 319 | sprintf( |
320 | - __( 'The payment method %1$s was automatically deactivated because it appears its associated Event Espresso Addon was recently deactivated.%2$sIt can be reactivated on the %3$sPlugins admin page%4$s, then you can reactivate the payment method.', 'event_espresso' ), |
|
320 | + __('The payment method %1$s was automatically deactivated because it appears its associated Event Espresso Addon was recently deactivated.%2$sIt can be reactivated on the %3$sPlugins admin page%4$s, then you can reactivate the payment method.', 'event_espresso'), |
|
321 | 321 | $payment_method->admin_name(), |
322 | 322 | '<br />', |
323 | - '<a href="' . admin_url('plugins.php') . '">', |
|
323 | + '<a href="'.admin_url('plugins.php').'">', |
|
324 | 324 | '</a>' |
325 | 325 | ), |
326 | 326 | true |
@@ -340,16 +340,16 @@ discard block |
||
340 | 340 | * @param string $scope @see EEM_Payment_Method::get_all_for_events |
341 | 341 | * @return EE_Payment_Method[] |
342 | 342 | */ |
343 | - public function get_all_for_transaction( $transaction, $scope ) { |
|
343 | + public function get_all_for_transaction($transaction, $scope) { |
|
344 | 344 | //@todo take relations between events and payment methods into account, once that relation exists |
345 | - if ( $transaction instanceof EE_Transaction ) { |
|
345 | + if ($transaction instanceof EE_Transaction) { |
|
346 | 346 | //@todo take the relation between transaction and currencies into account |
347 | 347 | } |
348 | - $currencies_for_events = array( EE_Config::instance()->currency->code ); |
|
348 | + $currencies_for_events = array(EE_Config::instance()->currency->code); |
|
349 | 349 | //give addons a chance to override what payment methods are chosen based on the transaction |
350 | 350 | return apply_filters( |
351 | 351 | 'FHEE__EEM_Payment_Method__get_all_for_transaction__payment_methods', |
352 | - $this->get_all_active( $scope, array( array( 'Currency.CUR_code' => array( 'IN', $currencies_for_events ) ) ) ), |
|
352 | + $this->get_all_active($scope, array(array('Currency.CUR_code' => array('IN', $currencies_for_events)))), |
|
353 | 353 | $transaction, |
354 | 354 | $scope |
355 | 355 | ); |
@@ -365,16 +365,16 @@ discard block |
||
365 | 365 | * @param EE_Registration|int $registration_or_reg_id Either the EE_Registration object or the id for the registration. |
366 | 366 | * @return EE_Payment|null |
367 | 367 | */ |
368 | - public function get_last_used_for_registration( $registration_or_reg_id ) { |
|
369 | - $registration_id = EEM_Registration::instance()->ensure_is_ID( $registration_or_reg_id ); |
|
368 | + public function get_last_used_for_registration($registration_or_reg_id) { |
|
369 | + $registration_id = EEM_Registration::instance()->ensure_is_ID($registration_or_reg_id); |
|
370 | 370 | |
371 | 371 | $query_params = array( |
372 | 372 | 0 => array( |
373 | 373 | 'Payment.Registration.REG_ID' => $registration_id, |
374 | 374 | ), |
375 | - 'order_by' => array( 'Payment.PAY_ID' => 'DESC' ) |
|
375 | + 'order_by' => array('Payment.PAY_ID' => 'DESC') |
|
376 | 376 | ); |
377 | - return $this->get_one( $query_params ); |
|
377 | + return $this->get_one($query_params); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -42,25 +42,25 @@ discard block |
||
42 | 42 | $this->_shortcodes = array( |
43 | 43 | '[TXN_ID]' => __('The transaction id for the purchase.', 'event_espresso'), |
44 | 44 | '[PAYMENT_URL]' => __('This is a link to make a payment for the event', 'event_espresso'), |
45 | - '[PAYMENT_LINK_IF_NEEDED_*]' => __('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso') . '<ul>' |
|
46 | - . '<li>' . sprintf( __('%class:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
47 | - . '<li>' . sprintf( __('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
48 | - . '<li>' . sprintf( __('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
45 | + '[PAYMENT_LINK_IF_NEEDED_*]' => __('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso').'<ul>' |
|
46 | + . '<li>'.sprintf(__('%class:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
47 | + . '<li>'.sprintf(__('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
48 | + . '<li>'.sprintf(__('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
49 | 49 | . '</ul>', |
50 | - '[PAYMENT_DUE_DATE_*]' => __( 'This is a special dynamic shortcode that allows one to output a payment due date. It will only result in a date shown if there is money owing. Three parameters are available on this shortcode:', 'event_espresso' ) |
|
50 | + '[PAYMENT_DUE_DATE_*]' => __('This is a special dynamic shortcode that allows one to output a payment due date. It will only result in a date shown if there is money owing. Three parameters are available on this shortcode:', 'event_espresso') |
|
51 | 51 | . '<ul>' |
52 | - . '<li>' . sprintf( __( '%sformat:%s This is used to indicate what format the date is in. Default is whatever is set as date formats for your website.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
53 | - . '<li>' . sprintf( __( '%sdays_until_due:%s This is the number of days form the transaction creation date that the payment is due. Defaults to 30.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
54 | - . '<li>' . sprintf( __( '%sprefix_text:%s You can use this to indicate what text will prefix the date string. Defaults to "Payment in full due by:"', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>', |
|
52 | + . '<li>'.sprintf(__('%sformat:%s This is used to indicate what format the date is in. Default is whatever is set as date formats for your website.', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
53 | + . '<li>'.sprintf(__('%sdays_until_due:%s This is the number of days form the transaction creation date that the payment is due. Defaults to 30.', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
54 | + . '<li>'.sprintf(__('%sprefix_text:%s You can use this to indicate what text will prefix the date string. Defaults to "Payment in full due by:"', 'event_espresso'), '<strong>', '</strong>').'</li>', |
|
55 | 55 | '[INVOICE_LINK]' => __('This is a full html link to the invoice', 'event_espresso'), |
56 | 56 | '[INVOICE_URL]' => __('This is just the url for the invoice', 'event_espresso'), |
57 | 57 | '[INVOICE_LOGO_URL]' => __('This returns the url for the logo uploaded via the invoice settings page.', 'event_espresso'), |
58 | 58 | '[INVOICE_LOGO]' => __('This returns the logo uploaded via the invoice settings page wrapped in img_tags and with a "logo screen" classes. The image size is also set in the img tags automatically to match the uploaded logo.', 'event_espresso'), |
59 | 59 | '[INVOICE_PAYEE_NAME]' => __('This will parse to either: the value of the "Company Name" field in the invoice payment method settings; if that is blank, then the value of the Company Name in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'), |
60 | - '[INVOICE_PAYEE_ADDRESS]' => __('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ), |
|
61 | - '[INVOICE_PAYMENT_INSTRUCTIONS]' => __('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso' ), |
|
62 | - '[INVOICE_PAYEE_EMAIL]' => __('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ), |
|
63 | - '[INVOICE_PAYEE_TAX_NUMBER_*]' => __('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number. It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: <code>[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]</code> and that will ouptut: GST: 12345t56. If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso' ), |
|
60 | + '[INVOICE_PAYEE_ADDRESS]' => __('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'), |
|
61 | + '[INVOICE_PAYMENT_INSTRUCTIONS]' => __('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso'), |
|
62 | + '[INVOICE_PAYEE_EMAIL]' => __('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'), |
|
63 | + '[INVOICE_PAYEE_TAX_NUMBER_*]' => __('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number. It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: <code>[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]</code> and that will ouptut: GST: 12345t56. If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso'), |
|
64 | 64 | '[TOTAL_COST]' => __('The total cost for the transaction', 'event_espresso'), |
65 | 65 | '[TXN_STATUS]' => __('The transaction status for the transaction.', 'event_espresso'), |
66 | 66 | '[TXN_STATUS_ID]' => __('The ID representing the transaction status as saved in the db. This tends to be useful for including with css classes for styling certain statuses differently from others.', 'event_espresso'), |
@@ -71,52 +71,52 @@ discard block |
||
71 | 71 | '[TOTAL_OWING]' => __('The total owing on a transaction with no attributes.', 'event_espresso'), |
72 | 72 | '[TXN_SUBTOTAL]' => __('The subtotal for all txn line items.', 'event_espresso'), |
73 | 73 | '[TXN_TAX_SUBTOTAL]' => __('The subtotal for all tax line items.', 'event_espresso'), |
74 | - '[OWING_STATUS_MESSAGE_*]' => __('A dynamic shortcode for adjusting how total oweing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso') . '<p></ul>' . |
|
75 | - '<li><strong>still_owing</strong>:' . __('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount oweing). The default is:', 'event_espresso' ) . sprintf( __( '%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' ) . '</li>' . |
|
76 | - '<li><strong>none_owing</strong>:' . __('If the transaction is paid in full, then you can indicate how this gets displayed. Note, that it defaults to just be the total oweing.', 'event_espresso') . '</li></ul></p>', |
|
74 | + '[OWING_STATUS_MESSAGE_*]' => __('A dynamic shortcode for adjusting how total oweing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso').'<p></ul>'. |
|
75 | + '<li><strong>still_owing</strong>:'.__('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount oweing). The default is:', 'event_espresso').sprintf(__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>').'</li>'. |
|
76 | + '<li><strong>none_owing</strong>:'.__('If the transaction is paid in full, then you can indicate how this gets displayed. Note, that it defaults to just be the total oweing.', 'event_espresso').'</li></ul></p>', |
|
77 | 77 | '[TXN_TOTAL_TICKETS]' => __('The total number of all tickets purchased in a transaction', 'event_espresso'), |
78 | 78 | '[TKT_QTY_PURCHASED]' => __('The total number of all tickets purchased in a transaction. <strong>NOTE: This shortcode is good to use in the "[TICKET_LIST]" field but has been deprecated from all other contexts in favor of the more explicit [TXN_TOTAL_TICKETS] shortcode.</strong>', 'event_espresso'), |
79 | 79 | '[TRANSACTION_ADMIN_URL]' => __('The url to the admin page for this transaction', 'event_espresso'), |
80 | 80 | '[RECEIPT_URL]' => __('This parses to the generated url for retrieving the receipt for the transaction', 'event_espresso'), |
81 | - '[INVOICE_RECEIPT_SWITCHER_URL]' => __( 'This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active then will parse to an empty string.', 'event_espresso'), |
|
82 | - '[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf( __( 'The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso' ), '<code>', '</code>' ) |
|
81 | + '[INVOICE_RECEIPT_SWITCHER_URL]' => __('This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active then will parse to an empty string.', 'event_espresso'), |
|
82 | + '[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf(__('The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso'), '<code>', '</code>') |
|
83 | 83 | ); |
84 | 84 | } |
85 | 85 | |
86 | 86 | |
87 | - protected function _parser( $shortcode ) { |
|
87 | + protected function _parser($shortcode) { |
|
88 | 88 | |
89 | 89 | //attempt to get the transaction. Since this is potentially used in more fields, we may have to look in the _extra_data for the transaction. |
90 | 90 | $transaction = $this->_data->txn instanceof EE_Transaction ? $this->_data->txn : null; |
91 | - $transaction = ! $transaction instanceof EE_Transaction && is_array( $this->_extra_data ) && isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn: $transaction; |
|
91 | + $transaction = ! $transaction instanceof EE_Transaction && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn : $transaction; |
|
92 | 92 | |
93 | 93 | //payment |
94 | 94 | $payment = $this->_data->payment instanceof EE_Payment ? $this->_data->payment : null; |
95 | - $payment = ! $payment instanceof EE_Payment && is_array( $this->_extra_data ) && isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment: $payment; |
|
95 | + $payment = ! $payment instanceof EE_Payment && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment : $payment; |
|
96 | 96 | |
97 | 97 | |
98 | - if ( ! $transaction instanceof EE_Transaction ) |
|
98 | + if ( ! $transaction instanceof EE_Transaction) |
|
99 | 99 | return ''; |
100 | 100 | |
101 | - switch ( $shortcode ) { |
|
101 | + switch ($shortcode) { |
|
102 | 102 | case '[TXN_ID]' : |
103 | 103 | return $transaction->ID(); |
104 | 104 | break; |
105 | 105 | |
106 | 106 | case '[PAYMENT_URL]' : |
107 | 107 | $payment_url = $transaction->payment_overview_url(); |
108 | - return empty( $payment_url ) ? __( 'http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url; |
|
108 | + return empty($payment_url) ? __('http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url; |
|
109 | 109 | break; |
110 | 110 | |
111 | 111 | case '[INVOICE_LINK]' : |
112 | 112 | $invoice_url = $transaction->invoice_url(); |
113 | - $invoice_url = empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url; |
|
114 | - return sprintf( __('%sClick here for Invoice%s', 'event_espresso'), '<a href="' . $invoice_url . '">', '</a>' ); |
|
113 | + $invoice_url = empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url; |
|
114 | + return sprintf(__('%sClick here for Invoice%s', 'event_espresso'), '<a href="'.$invoice_url.'">', '</a>'); |
|
115 | 115 | break; /**/ |
116 | 116 | |
117 | 117 | case '[INVOICE_URL]' : |
118 | 118 | $invoice_url = $transaction->invoice_url(); |
119 | - return empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url; |
|
119 | + return empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url; |
|
120 | 120 | break; |
121 | 121 | |
122 | 122 | case '[INVOICE_LOGO_URL]' : |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | break; |
125 | 125 | |
126 | 126 | case '[INVOICE_LOGO]' : |
127 | - return $this->_get_invoice_logo( TRUE ); |
|
127 | + return $this->_get_invoice_logo(TRUE); |
|
128 | 128 | break; |
129 | 129 | |
130 | 130 | case '[INVOICE_PAYEE_NAME]' : |
@@ -146,18 +146,18 @@ discard block |
||
146 | 146 | |
147 | 147 | case "[TOTAL_COST]" : |
148 | 148 | $total = $transaction->total(); |
149 | - return ! empty($total) ? EEH_Template::format_currency( $total ) : ''; |
|
149 | + return ! empty($total) ? EEH_Template::format_currency($total) : ''; |
|
150 | 150 | break; |
151 | 151 | |
152 | 152 | case "[PAYMENT_STATUS]" : |
153 | 153 | $status = $transaction->pretty_status(); |
154 | - return !empty($status) ? $status : __('Unknown', 'event_espresso'); |
|
154 | + return ! empty($status) ? $status : __('Unknown', 'event_espresso'); |
|
155 | 155 | break; /**/ |
156 | 156 | |
157 | 157 | // note the [payment_status] shortcode is kind of misleading because payment status might be different from txn status so I'm adding this here for clarity. |
158 | 158 | case "[TXN_STATUS]" : |
159 | 159 | $status = $transaction->pretty_status(); |
160 | - return !empty( $status ) ? $status : __('Unknown', 'event_espresso'); |
|
160 | + return ! empty($status) ? $status : __('Unknown', 'event_espresso'); |
|
161 | 161 | break; |
162 | 162 | |
163 | 163 | case "[TXN_STATUS_ID]" : |
@@ -165,21 +165,21 @@ discard block |
||
165 | 165 | break; |
166 | 166 | |
167 | 167 | case "[PAYMENT_GATEWAY]" : |
168 | - return $this->_get_payment_gateway( $transaction ); |
|
168 | + return $this->_get_payment_gateway($transaction); |
|
169 | 169 | break; |
170 | 170 | |
171 | 171 | case "[AMOUNT_PAID]" : |
172 | 172 | $amount = $payment instanceof EE_Payment ? $payment->amount() : 0; |
173 | - return EEH_Template::format_currency( $amount ); |
|
173 | + return EEH_Template::format_currency($amount); |
|
174 | 174 | break; |
175 | 175 | |
176 | 176 | case "[TOTAL_AMOUNT_PAID]" : |
177 | - return EEH_Template::format_currency( $transaction->paid() ); |
|
177 | + return EEH_Template::format_currency($transaction->paid()); |
|
178 | 178 | break; |
179 | 179 | |
180 | 180 | case "[TOTAL_OWING]" : |
181 | 181 | $total_owing = $transaction->remaining(); |
182 | - return EEH_Template::format_currency( $total_owing ); |
|
182 | + return EEH_Template::format_currency($total_owing); |
|
183 | 183 | break; |
184 | 184 | |
185 | 185 | case "[TXN_SUBTOTAL]" : |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | break; |
188 | 188 | |
189 | 189 | case "[TXN_TAX_SUBTOTAL]" : |
190 | - return EEH_Template::format_currency($this->_get_subtotal( TRUE )); |
|
190 | + return EEH_Template::format_currency($this->_get_subtotal(TRUE)); |
|
191 | 191 | break; |
192 | 192 | |
193 | 193 | case "[TKT_QTY_PURCHASED]" : |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | break; |
197 | 197 | |
198 | 198 | case "[TRANSACTION_ADMIN_URL]" : |
199 | - require_once EE_CORE . 'admin/EE_Admin_Page.core.php'; |
|
200 | - $query_args = array( 'page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID() ); |
|
201 | - $url = EE_Admin_Page::add_query_args_and_nonce( $query_args, admin_url('admin.php') ); |
|
199 | + require_once EE_CORE.'admin/EE_Admin_Page.core.php'; |
|
200 | + $query_args = array('page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID()); |
|
201 | + $url = EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php')); |
|
202 | 202 | return $url; |
203 | 203 | break; |
204 | 204 | |
@@ -206,14 +206,14 @@ discard block |
||
206 | 206 | //get primary_registration |
207 | 207 | $reg = $this->_data->primary_reg_obj; |
208 | 208 | |
209 | - if ( ! $reg instanceof EE_Registration ) { |
|
209 | + if ( ! $reg instanceof EE_Registration) { |
|
210 | 210 | return ''; |
211 | 211 | } |
212 | 212 | return $reg->receipt_url(); |
213 | 213 | break; |
214 | 214 | |
215 | 215 | case "[INVOICE_RECEIPT_SWITCHER_URL]" : |
216 | - return $this->_get_invoice_receipt_switcher( FALSE ); |
|
216 | + return $this->_get_invoice_receipt_switcher(FALSE); |
|
217 | 217 | break; |
218 | 218 | |
219 | 219 | case "[INVOICE_RECEIPT_SWITCHER_BUTTON]" : |
@@ -223,20 +223,20 @@ discard block |
||
223 | 223 | |
224 | 224 | } |
225 | 225 | |
226 | - if ( strpos( $shortcode, '[OWING_STATUS_MESSAGE_*' ) !== FALSE ) { |
|
227 | - return $this->_get_custom_total_oweing( $shortcode ); |
|
226 | + if (strpos($shortcode, '[OWING_STATUS_MESSAGE_*') !== FALSE) { |
|
227 | + return $this->_get_custom_total_oweing($shortcode); |
|
228 | 228 | } |
229 | 229 | |
230 | - if ( strpos( $shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*' ) !== FALSE ) { |
|
231 | - return $this->_get_invoice_payee_tax_number( $shortcode ); |
|
230 | + if (strpos($shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*') !== FALSE) { |
|
231 | + return $this->_get_invoice_payee_tax_number($shortcode); |
|
232 | 232 | } |
233 | 233 | |
234 | - if ( strpos( $shortcode, '[PAYMENT_LINK_IF_NEEDED_*' ) !== FALSE ) { |
|
235 | - return $this->_get_payment_link_if_needed( $shortcode ); |
|
234 | + if (strpos($shortcode, '[PAYMENT_LINK_IF_NEEDED_*') !== FALSE) { |
|
235 | + return $this->_get_payment_link_if_needed($shortcode); |
|
236 | 236 | } |
237 | 237 | |
238 | - if ( strpos( $shortcode, '[PAYMENT_DUE_DATE_*' ) !== false ) { |
|
239 | - return $this->_get_payment_due_date( $shortcode, $transaction ); |
|
238 | + if (strpos($shortcode, '[PAYMENT_DUE_DATE_*') !== false) { |
|
239 | + return $this->_get_payment_due_date($shortcode, $transaction); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | return ''; |
@@ -253,19 +253,19 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @return string parsed. |
255 | 255 | */ |
256 | - private function _get_custom_total_oweing( $shortcode ) { |
|
257 | - $valid_shortcodes = array( 'transaction' ); |
|
258 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
256 | + private function _get_custom_total_oweing($shortcode) { |
|
257 | + $valid_shortcodes = array('transaction'); |
|
258 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
259 | 259 | |
260 | 260 | //ensure default is set. |
261 | 261 | $addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
262 | 262 | $total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0; |
263 | 263 | |
264 | - if ( $total_owing > 0 ) { |
|
265 | - $owing_content = ! empty( $attrs['still_owing'] ) ? $attrs['still_owing'] : sprintf( __( '%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' ); |
|
266 | - $owing_content = $this->_shortcode_helper->parse_message_template( $owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message ); |
|
264 | + if ($total_owing > 0) { |
|
265 | + $owing_content = ! empty($attrs['still_owing']) ? $attrs['still_owing'] : sprintf(__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>'); |
|
266 | + $owing_content = $this->_shortcode_helper->parse_message_template($owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message); |
|
267 | 267 | } else { |
268 | - $owing_content = !empty( $attrs['none_owing']) ? $attrs['none_owing'] : ''; |
|
268 | + $owing_content = ! empty($attrs['none_owing']) ? $attrs['none_owing'] : ''; |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | return $owing_content; |
@@ -273,8 +273,8 @@ discard block |
||
273 | 273 | |
274 | 274 | |
275 | 275 | |
276 | - private function _get_payment_gateway( $transaction ) { |
|
277 | - $pm = $this->_get_payment_method( $transaction ); |
|
276 | + private function _get_payment_gateway($transaction) { |
|
277 | + $pm = $this->_get_payment_method($transaction); |
|
278 | 278 | return $pm instanceof EE_Payment_Method ? $pm->name() : ''; |
279 | 279 | } |
280 | 280 | |
@@ -289,37 +289,37 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @return string url or html |
291 | 291 | */ |
292 | - private function _get_invoice_logo( $img_tags = FALSE ) { |
|
292 | + private function _get_invoice_logo($img_tags = FALSE) { |
|
293 | 293 | //try to get the invoice payment method's logo for this transaction image first |
294 | 294 | $pm = $this->_get_payment_method(); |
295 | - if ( $pm instanceof EE_Payment_Method ){ |
|
296 | - $invoice_logo_url = $pm->get_extra_meta( 'pdf_logo_image', TRUE ); |
|
297 | - }else{ |
|
295 | + if ($pm instanceof EE_Payment_Method) { |
|
296 | + $invoice_logo_url = $pm->get_extra_meta('pdf_logo_image', TRUE); |
|
297 | + } else { |
|
298 | 298 | $invoice_logo_url = NULL; |
299 | 299 | } |
300 | - if( empty( $invoice_logo_url ) ){ |
|
300 | + if (empty($invoice_logo_url)) { |
|
301 | 301 | $invoice_logo_url = EE_Registry::instance()->CFG->organization->logo_url; |
302 | 302 | } |
303 | 303 | |
304 | - if ( empty( $invoice_logo_url ) ) { |
|
304 | + if (empty($invoice_logo_url)) { |
|
305 | 305 | return ''; |
306 | 306 | } |
307 | 307 | |
308 | - if ( ! $img_tags ) { |
|
308 | + if ( ! $img_tags) { |
|
309 | 309 | return $invoice_logo_url; |
310 | 310 | } |
311 | 311 | |
312 | 312 | //image tags have been requested. |
313 | - $image_size = getimagesize( $invoice_logo_url ); |
|
313 | + $image_size = getimagesize($invoice_logo_url); |
|
314 | 314 | |
315 | 315 | //if image is wider than 200px, set the wideth to 200 |
316 | - if ( $image_size[0] > 300 ) { |
|
316 | + if ($image_size[0] > 300) { |
|
317 | 317 | $image_width = 300; |
318 | - }else{ |
|
318 | + } else { |
|
319 | 319 | $image_width = $image_size[0]; |
320 | 320 | } |
321 | 321 | |
322 | - return '<img class="logo screen" src="' . $invoice_logo_url . '" width="' . $image_width . '" alt="logo" />'; |
|
322 | + return '<img class="logo screen" src="'.$invoice_logo_url.'" width="'.$image_width.'" alt="logo" />'; |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -336,26 +336,26 @@ discard block |
||
336 | 336 | private function _get_invoice_payee_name() { |
337 | 337 | $payee_name = NULL; |
338 | 338 | $pm = $this->_get_payment_method(); |
339 | - if( $pm instanceof EE_Payment_Method ){ |
|
340 | - $payee_name = $pm->get_extra_meta( 'pdf_payee_name', TRUE ); |
|
339 | + if ($pm instanceof EE_Payment_Method) { |
|
340 | + $payee_name = $pm->get_extra_meta('pdf_payee_name', TRUE); |
|
341 | 341 | } |
342 | - $payee_name = empty( $payee_name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : $payee_name; |
|
342 | + $payee_name = empty($payee_name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : $payee_name; |
|
343 | 343 | return $payee_name; |
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
347 | 347 | * gets the payment method for this transaction. Otherwise gets a default one. |
348 | 348 | */ |
349 | - private function _get_payment_method( $transaction = null ){ |
|
350 | - if( $transaction instanceof EE_Transaction ) { |
|
349 | + private function _get_payment_method($transaction = null) { |
|
350 | + if ($transaction instanceof EE_Transaction) { |
|
351 | 351 | $payment_method = $transaction->payment_method(); |
352 | - if ( empty( $payment_method ) ) { |
|
353 | - return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); |
|
352 | + if (empty($payment_method)) { |
|
353 | + return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); |
|
354 | 354 | } |
355 | 355 | return $payment_method; |
356 | - }else{ |
|
356 | + } else { |
|
357 | 357 | //get the first payment method we can find |
358 | - return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); |
|
358 | + return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | private function _get_invoice_payee_email() { |
373 | 373 | $payee_email = NULL; |
374 | 374 | $pm = $this->_get_payment_method(); |
375 | - if( $pm instanceof EE_Payment_Method ){ |
|
376 | - $payee_email = $pm->get_extra_meta( 'pdf_payee_email', TRUE ); |
|
375 | + if ($pm instanceof EE_Payment_Method) { |
|
376 | + $payee_email = $pm->get_extra_meta('pdf_payee_email', TRUE); |
|
377 | 377 | } |
378 | - $payee_email = empty( $payee_email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : $payee_email; |
|
378 | + $payee_email = empty($payee_email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : $payee_email; |
|
379 | 379 | return $payee_email; |
380 | 380 | } |
381 | 381 | |
@@ -391,24 +391,24 @@ discard block |
||
391 | 391 | * |
392 | 392 | * @return string |
393 | 393 | */ |
394 | - private function _get_invoice_payee_tax_number( $shortcode ) { |
|
394 | + private function _get_invoice_payee_tax_number($shortcode) { |
|
395 | 395 | $payee_tax_number = NULL; |
396 | 396 | $pm = $this->_get_payment_method(); |
397 | - if( $pm instanceof EE_Payment_Method ){ |
|
398 | - $payee_tax_number = $pm->get_extra_meta( 'pdf_payee_tax_number', TRUE ); |
|
397 | + if ($pm instanceof EE_Payment_Method) { |
|
398 | + $payee_tax_number = $pm->get_extra_meta('pdf_payee_tax_number', TRUE); |
|
399 | 399 | } |
400 | - $payee_tax_number = empty( $payee_tax_number ) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number; |
|
400 | + $payee_tax_number = empty($payee_tax_number) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number; |
|
401 | 401 | |
402 | - if ( empty( $payee_tax_number ) ) { |
|
402 | + if (empty($payee_tax_number)) { |
|
403 | 403 | return ''; |
404 | 404 | } |
405 | 405 | |
406 | 406 | //any attributes? |
407 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
407 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
408 | 408 | |
409 | 409 | //prefix? |
410 | - $prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : __( 'VAT/Tax Number: ', 'event_espresso' ); |
|
411 | - return $prefix . $payee_tax_number; |
|
410 | + $prefix = isset($attrs['prefix']) ? $attrs['prefix'] : __('VAT/Tax Number: ', 'event_espresso'); |
|
411 | + return $prefix.$payee_tax_number; |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | |
@@ -425,22 +425,22 @@ discard block |
||
425 | 425 | private function _get_invoice_payee_address() { |
426 | 426 | $payee_address = NULL; |
427 | 427 | $pm = $this->_get_payment_method(); |
428 | - if( $pm instanceof EE_Payment_Method ){ |
|
429 | - $payee_address = $pm->get_extra_meta( 'pdf_payee_address', TRUE ); |
|
428 | + if ($pm instanceof EE_Payment_Method) { |
|
429 | + $payee_address = $pm->get_extra_meta('pdf_payee_address', TRUE); |
|
430 | 430 | } |
431 | - if ( empty( $payee_address ) ) { |
|
431 | + if (empty($payee_address)) { |
|
432 | 432 | $organization = EE_Registry::instance()->CFG->organization; |
433 | - $payee_address = $organization->get_pretty( 'address_1' ) . '<br>'; |
|
434 | - $payee_address .= !empty( $organization->address_2 ) ? $organization->get_pretty( 'address_2' ) . '<br>' : ''; |
|
435 | - $payee_address .= $organization->get_pretty( 'city' ) . '<br>'; |
|
433 | + $payee_address = $organization->get_pretty('address_1').'<br>'; |
|
434 | + $payee_address .= ! empty($organization->address_2) ? $organization->get_pretty('address_2').'<br>' : ''; |
|
435 | + $payee_address .= $organization->get_pretty('city').'<br>'; |
|
436 | 436 | |
437 | 437 | //state |
438 | - $state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $organization->STA_ID ); |
|
439 | - $payee_address .= $state instanceof EE_State ? $state->name() : ''; |
|
438 | + $state = EE_Registry::instance()->load_model('State')->get_one_by_ID($organization->STA_ID); |
|
439 | + $payee_address .= $state instanceof EE_State ? $state->name() : ''; |
|
440 | 440 | |
441 | 441 | //Country |
442 | - $payee_address .= ! empty( $organization->CNT_ISO ) ? ', ' . $organization->CNT_ISO . '<br>' : ''; |
|
443 | - $payee_address .= ! empty( $organization->zip ) ? $organization->zip : ''; |
|
442 | + $payee_address .= ! empty($organization->CNT_ISO) ? ', '.$organization->CNT_ISO.'<br>' : ''; |
|
443 | + $payee_address .= ! empty($organization->zip) ? $organization->zip : ''; |
|
444 | 444 | } |
445 | 445 | return $payee_address; |
446 | 446 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | private function _get_invoice_payment_instructions() { |
459 | 459 | $instructions = NULL; |
460 | 460 | $pm = $this->_get_payment_method(); |
461 | - return ( $pm instanceof EE_Payment_Method ) ? $pm->get_extra_meta( 'pdf_instructions', TRUE) : ''; |
|
461 | + return ($pm instanceof EE_Payment_Method) ? $pm->get_extra_meta('pdf_instructions', TRUE) : ''; |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | |
@@ -472,27 +472,27 @@ discard block |
||
472 | 472 | * |
473 | 473 | * @return string |
474 | 474 | */ |
475 | - protected function _get_invoice_receipt_switcher( $button = TRUE ) { |
|
475 | + protected function _get_invoice_receipt_switcher($button = TRUE) { |
|
476 | 476 | $reg = $this->_data->primary_reg_obj; |
477 | - $message_type = isset( $this->_extra_data['message_type'] ) ? $this->_extra_data['message_type'] : ''; |
|
478 | - if ( ! $reg instanceof EE_Registration || empty( $message_type ) ) { |
|
477 | + $message_type = isset($this->_extra_data['message_type']) ? $this->_extra_data['message_type'] : ''; |
|
478 | + if ( ! $reg instanceof EE_Registration || empty($message_type)) { |
|
479 | 479 | return ''; |
480 | 480 | } |
481 | 481 | |
482 | - $switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type ? true : false; |
|
483 | - $switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? __('View Invoice', 'event_espresso' ) : __( 'Switch to Invoice', 'event_espresso' ); |
|
484 | - $switch_to_label = ! $switch_to_invoice ? __( 'Switch to Receipt', 'event_espresso' ) : $switch_to_label; |
|
482 | + $switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type ? true : false; |
|
483 | + $switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? __('View Invoice', 'event_espresso') : __('Switch to Invoice', 'event_espresso'); |
|
484 | + $switch_to_label = ! $switch_to_invoice ? __('Switch to Receipt', 'event_espresso') : $switch_to_label; |
|
485 | 485 | $switch_to_url = $switch_to_invoice ? $reg->invoice_url() : $reg->receipt_url(); |
486 | 486 | |
487 | - if ( ! $button ) { |
|
487 | + if ( ! $button) { |
|
488 | 488 | return $switch_to_url; |
489 | 489 | } |
490 | 490 | |
491 | - if ( ! empty( $switch_to_url ) ) { |
|
491 | + if ( ! empty($switch_to_url)) { |
|
492 | 492 | |
493 | 493 | return ' |
494 | - <form method="post" action="' . $switch_to_url . '" > |
|
495 | - <input class="print_button" type="submit" value="' . $switch_to_label . '" /> |
|
494 | + <form method="post" action="' . $switch_to_url.'" > |
|
495 | + <input class="print_button" type="submit" value="' . $switch_to_label.'" /> |
|
496 | 496 | </form> |
497 | 497 | '; |
498 | 498 | } |
@@ -512,11 +512,11 @@ discard block |
||
512 | 512 | * |
513 | 513 | * @return string |
514 | 514 | */ |
515 | - private function _get_receipt_url( EE_Transaction $transaction ) { |
|
515 | + private function _get_receipt_url(EE_Transaction $transaction) { |
|
516 | 516 | //get primary_registration |
517 | 517 | $reg = $this->_data->primary_reg_obj; |
518 | 518 | |
519 | - if ( ! $reg instanceof EE_Registration ) { |
|
519 | + if ( ! $reg instanceof EE_Registration) { |
|
520 | 520 | return ''; |
521 | 521 | } |
522 | 522 | |
@@ -532,10 +532,10 @@ discard block |
||
532 | 532 | * |
533 | 533 | * @return int |
534 | 534 | */ |
535 | - private function _get_subtotal( $tax = FALSE ) { |
|
536 | - $grand_total = isset( $this->_data->grand_total_line_item ) ? $this->_data->grand_total_line_item : NULL; |
|
535 | + private function _get_subtotal($tax = FALSE) { |
|
536 | + $grand_total = isset($this->_data->grand_total_line_item) ? $this->_data->grand_total_line_item : NULL; |
|
537 | 537 | |
538 | - if ( ! $grand_total instanceof EE_Line_Item ) { |
|
538 | + if ( ! $grand_total instanceof EE_Line_Item) { |
|
539 | 539 | return 0; |
540 | 540 | } |
541 | 541 | |
@@ -554,26 +554,26 @@ discard block |
||
554 | 554 | * |
555 | 555 | * @return string parsed. |
556 | 556 | */ |
557 | - private function _get_payment_link_if_needed( $shortcode ) { |
|
558 | - $valid_shortcodes = array( 'transaction' ); |
|
559 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
557 | + private function _get_payment_link_if_needed($shortcode) { |
|
558 | + $valid_shortcodes = array('transaction'); |
|
559 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
560 | 560 | |
561 | 561 | //ensure default is set. |
562 | 562 | $addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
563 | 563 | $total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0; |
564 | 564 | |
565 | - if ( $total_owing > 0 ) { |
|
566 | - $class = isset( $attrs['class'] ) ? $attrs['class'] : 'callout'; |
|
567 | - $custom_text = isset( $attrs['custom_text'] ) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.'; |
|
568 | - $container_tag = isset( $attrs['container_tag'] ) ? $attrs['container_tag'] : 'p'; |
|
569 | - $opening_tag = ! empty( $container_tag ) ? '<' . $container_tag : ''; |
|
570 | - $opening_tag .= ! empty( $opening_tag ) && !empty( $class ) ? ' class="' . $class . '"' : $opening_tag; |
|
571 | - $opening_tag .= !empty( $opening_tag ) ? '>' : $opening_tag; |
|
572 | - $closing_tag = ! empty( $container_tag ) ? '</' . $container_tag .'>' : ''; |
|
573 | - $content = $opening_tag . sprintf( $custom_text, '<a href="[PAYMENT_URL]">', '</a>' ) . $closing_tag; |
|
565 | + if ($total_owing > 0) { |
|
566 | + $class = isset($attrs['class']) ? $attrs['class'] : 'callout'; |
|
567 | + $custom_text = isset($attrs['custom_text']) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.'; |
|
568 | + $container_tag = isset($attrs['container_tag']) ? $attrs['container_tag'] : 'p'; |
|
569 | + $opening_tag = ! empty($container_tag) ? '<'.$container_tag : ''; |
|
570 | + $opening_tag .= ! empty($opening_tag) && ! empty($class) ? ' class="'.$class.'"' : $opening_tag; |
|
571 | + $opening_tag .= ! empty($opening_tag) ? '>' : $opening_tag; |
|
572 | + $closing_tag = ! empty($container_tag) ? '</'.$container_tag.'>' : ''; |
|
573 | + $content = $opening_tag.sprintf($custom_text, '<a href="[PAYMENT_URL]">', '</a>').$closing_tag; |
|
574 | 574 | |
575 | 575 | //we need to re run this string through the parser to catch any shortcodes that are in it. |
576 | - $owing_content = $this->_shortcode_helper->parse_message_template( $content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message ); |
|
576 | + $owing_content = $this->_shortcode_helper->parse_message_template($content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message); |
|
577 | 577 | } else { |
578 | 578 | return ''; |
579 | 579 | } |
@@ -593,31 +593,31 @@ discard block |
||
593 | 593 | * @param EE_Transaction $transaction |
594 | 594 | * @return string |
595 | 595 | */ |
596 | - protected function _get_payment_due_date( $shortcode, EE_Transaction $transaction ) { |
|
596 | + protected function _get_payment_due_date($shortcode, EE_Transaction $transaction) { |
|
597 | 597 | //if transaction is paid in full then we can just return an empty string |
598 | - if ( $transaction->remaining() === 0 ) { |
|
598 | + if ($transaction->remaining() === 0) { |
|
599 | 599 | return ''; |
600 | 600 | } |
601 | 601 | |
602 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
603 | - $format = isset( $attrs['format'] ) ? $attrs['format'] : get_option( 'date_format' ); |
|
604 | - $days_until_due = isset( $attrs['days_until_due'] ) ? (int) $attrs['days_until_due'] : 30; |
|
605 | - $prefix_text = isset( $attrs['prefix_text'] ) ? $attrs['prefix_text'] : __( 'Payment in full due by: ', 'event_espresso' ); |
|
606 | - $transaction_created = $transaction->get_DateTime_object( 'TXN_timestamp' ); |
|
602 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
603 | + $format = isset($attrs['format']) ? $attrs['format'] : get_option('date_format'); |
|
604 | + $days_until_due = isset($attrs['days_until_due']) ? (int) $attrs['days_until_due'] : 30; |
|
605 | + $prefix_text = isset($attrs['prefix_text']) ? $attrs['prefix_text'] : __('Payment in full due by: ', 'event_espresso'); |
|
606 | + $transaction_created = $transaction->get_DateTime_object('TXN_timestamp'); |
|
607 | 607 | |
608 | 608 | //setup date due: |
609 | 609 | try { |
610 | - if ( $transaction_created instanceof DateTime ) { |
|
611 | - $date_due = $transaction_created->add( new DateInterval( 'P' . $days_until_due . 'D' ) )->format( $format ); |
|
610 | + if ($transaction_created instanceof DateTime) { |
|
611 | + $date_due = $transaction_created->add(new DateInterval('P'.$days_until_due.'D'))->format($format); |
|
612 | 612 | } else { |
613 | 613 | throw new Exception(); |
614 | 614 | } |
615 | - } catch( Exception $e ) { |
|
615 | + } catch (Exception $e) { |
|
616 | 616 | //format was likely invalid. |
617 | 617 | $date_due = 'Unable to calculate date due, likely the format string is invalid.'; |
618 | 618 | } |
619 | 619 | |
620 | - return $prefix_text . $date_due; |
|
620 | + return $prefix_text.$date_due; |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | } //end EE_Transaction Shortcodes library |
@@ -3,14 +3,14 @@ discard block |
||
3 | 3 | * base class for all strategies which operate on form inputs. Generally, they |
4 | 4 | * all need to know about the form input they are operating on. |
5 | 5 | */ |
6 | -abstract class EE_Form_Input_Strategy_Base{ |
|
6 | +abstract class EE_Form_Input_Strategy_Base { |
|
7 | 7 | /** |
8 | 8 | * Form Input to display |
9 | 9 | * @var EE_Form_Input_Base |
10 | 10 | */ |
11 | 11 | protected $_input; |
12 | 12 | |
13 | - function __construct(){ |
|
13 | + function __construct() { |
|
14 | 14 | |
15 | 15 | } |
16 | 16 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * The form input on which this strategy is to perform |
19 | 19 | * @param EE_Form_Input_Base $form_input |
20 | 20 | */ |
21 | - function _construct_finalize(EE_Form_Input_Base $form_input){ |
|
21 | + function _construct_finalize(EE_Form_Input_Base $form_input) { |
|
22 | 22 | $this->_input = $form_input; |
23 | 23 | } |
24 | 24 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -30,25 +30,25 @@ discard block |
||
30 | 30 | class Extend_Events_Admin_Page extends Events_Admin_Page { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $routing = TRUE ) { |
|
34 | - parent::__construct( $routing ); |
|
35 | - define( 'EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/'); |
|
36 | - define( 'EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/'); |
|
37 | - define( 'EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/'); |
|
33 | + public function __construct($routing = TRUE) { |
|
34 | + parent::__construct($routing); |
|
35 | + define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'events/templates/'); |
|
36 | + define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'events/assets/'); |
|
37 | + define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'events/assets/'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
41 | 41 | protected function _extend_page_config() { |
42 | 42 | |
43 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events'; |
|
43 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'events'; |
|
44 | 44 | $default_espresso_boxes = $this->_default_espresso_metaboxes; |
45 | 45 | |
46 | 46 | //is there a evt_id in the request? |
47 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0; |
|
48 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
47 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0; |
|
48 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
49 | 49 | |
50 | 50 | //tkt_id? |
51 | - $tkt_id = !empty( $this->_req_data['TKT_ID'] ) && ! is_array( $this->_req_data['TKT_ID'] ) ? $this->_req_data['TKT_ID'] : 0; |
|
51 | + $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) ? $this->_req_data['TKT_ID'] : 0; |
|
52 | 52 | |
53 | 53 | $new_page_routes = array( |
54 | 54 | 'duplicate_event' => array( |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | 'capability' => 'ee_delete_default_ticket', |
67 | 67 | 'obj_id' => $tkt_id, |
68 | 68 | 'noheader' => TRUE, |
69 | - 'args' => array( 'trash' => TRUE ) |
|
69 | + 'args' => array('trash' => TRUE) |
|
70 | 70 | ), |
71 | 71 | 'trash_tickets' => array( |
72 | 72 | 'func' => '_trash_or_restore_ticket', |
73 | 73 | 'capability' => 'ee_delete_default_tickets', |
74 | 74 | 'noheader' => TRUE, |
75 | - 'args' => array( 'trash' => TRUE ) |
|
75 | + 'args' => array('trash' => TRUE) |
|
76 | 76 | ), |
77 | 77 | 'restore_ticket' => array( |
78 | 78 | 'func' => '_trash_or_restore_ticket', |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | ) |
133 | 133 | ); |
134 | 134 | |
135 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
135 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | //partial route/config override |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | $this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table'; |
145 | 145 | |
146 | 146 | //add tickets tab but only if there are more than one default ticket! |
147 | - $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array( array('TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ); |
|
148 | - if ( $tkt_count > 1 ) { |
|
147 | + $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE); |
|
148 | + if ($tkt_count > 1) { |
|
149 | 149 | $new_page_config = array( |
150 | 150 | 'ticket_list_table' => array( |
151 | 151 | 'nav' => array( |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | 'label' => __('Templates'), |
165 | 165 | 'order' => 30 |
166 | 166 | ), |
167 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
167 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
168 | 168 | 'help_tabs' => array( |
169 | 169 | 'general_settings_templates_help_tab' => array( |
170 | 170 | 'title' => __('Templates', 'event_espresso'), |
171 | 171 | 'filename' => 'general_settings_templates' |
172 | 172 | ) |
173 | 173 | ), |
174 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
174 | + 'help_tour' => array('Templates_Help_Tour'), |
|
175 | 175 | 'require_nonce' => FALSE |
176 | 176 | ); |
177 | 177 | |
@@ -190,26 +190,26 @@ discard block |
||
190 | 190 | // 'metaboxes' => $default_espresso_boxes, |
191 | 191 | // 'require_nonce' => FALSE |
192 | 192 | // ); |
193 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
193 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
194 | 194 | |
195 | 195 | //add filters and actions |
196 | 196 | //modifying _views |
197 | - add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array( $this, 'add_additional_datetime_button' ), 10, 2 ); |
|
198 | - add_filter('FHEE_event_datetime_metabox_clone_button_template', array( $this, 'add_datetime_clone_button' ), 10, 2 ); |
|
199 | - add_filter('FHEE_event_datetime_metabox_timezones_template', array( $this, 'datetime_timezones_template'), 10, 2 ); |
|
197 | + add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array($this, 'add_additional_datetime_button'), 10, 2); |
|
198 | + add_filter('FHEE_event_datetime_metabox_clone_button_template', array($this, 'add_datetime_clone_button'), 10, 2); |
|
199 | + add_filter('FHEE_event_datetime_metabox_timezones_template', array($this, 'datetime_timezones_template'), 10, 2); |
|
200 | 200 | |
201 | 201 | |
202 | 202 | //filters for event list table |
203 | - add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array( $this, 'list_table_filters'), 10, 2); |
|
204 | - add_filter('FHEE__Events_Admin_List_Table__column_actions__action_links', array( $this, 'extra_list_table_actions'), 10, 2 ); |
|
203 | + add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array($this, 'list_table_filters'), 10, 2); |
|
204 | + add_filter('FHEE__Events_Admin_List_Table__column_actions__action_links', array($this, 'extra_list_table_actions'), 10, 2); |
|
205 | 205 | |
206 | 206 | //legend item |
207 | - add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array( $this, 'additional_legend_items') ); |
|
207 | + add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array($this, 'additional_legend_items')); |
|
208 | 208 | |
209 | - add_action('admin_init', array( $this, 'admin_init') ); |
|
209 | + add_action('admin_init', array($this, 'admin_init')); |
|
210 | 210 | |
211 | 211 | //heartbeat stuff |
212 | - add_filter( 'heartbeat_received', array( $this, 'heartbeat_response' ), 10, 2 ); |
|
212 | + add_filter('heartbeat_received', array($this, 'heartbeat_response'), 10, 2); |
|
213 | 213 | |
214 | 214 | } |
215 | 215 | |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | EE_Registry::$i18n_js_strings = array_merge( |
223 | 223 | EE_Registry::$i18n_js_strings, |
224 | 224 | array( |
225 | - 'image_confirm' => __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' ), |
|
226 | - 'event_starts_on' => __( 'Event Starts on', 'event_espresso' ), |
|
227 | - 'event_ends_on' => __( 'Event Ends on', 'event_espresso' ), |
|
228 | - 'event_datetime_actions' => __( 'Actions', 'event_espresso' ), |
|
229 | - 'event_clone_dt_msg' => __( 'Clone this Event Date and Time', 'event_espresso' ), |
|
230 | - 'remove_event_dt_msg' => __( 'Remove this Event Time', 'event_espresso' ) |
|
225 | + 'image_confirm' => __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'), |
|
226 | + 'event_starts_on' => __('Event Starts on', 'event_espresso'), |
|
227 | + 'event_ends_on' => __('Event Ends on', 'event_espresso'), |
|
228 | + 'event_datetime_actions' => __('Actions', 'event_espresso'), |
|
229 | + 'event_clone_dt_msg' => __('Clone this Event Date and Time', 'event_espresso'), |
|
230 | + 'remove_event_dt_msg' => __('Remove this Event Time', 'event_espresso') |
|
231 | 231 | ) |
232 | 232 | ); |
233 | 233 | } |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @return array possibly appended response. |
244 | 244 | */ |
245 | - public function heartbeat_response( $response, $data ) { |
|
245 | + public function heartbeat_response($response, $data) { |
|
246 | 246 | /** |
247 | 247 | * check whether count of tickets is approaching the potential |
248 | 248 | * limits for the server. |
249 | 249 | */ |
250 | - if ( ! empty( $data['input_count'] ) ) { |
|
250 | + if ( ! empty($data['input_count'])) { |
|
251 | 251 | $response['max_input_vars_check'] = EE_Registry::instance()->CFG->environment->max_input_vars_limit_check($data['input_count']); |
252 | 252 | } |
253 | 253 | |
@@ -262,13 +262,13 @@ discard block |
||
262 | 262 | |
263 | 263 | |
264 | 264 | |
265 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
266 | - $return = parent::extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ); |
|
265 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
266 | + $return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug); |
|
267 | 267 | //make sure this is only when editing |
268 | - if ( !empty( $id ) ) { |
|
269 | - $href = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url ); |
|
268 | + if ( ! empty($id)) { |
|
269 | + $href = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url); |
|
270 | 270 | $title = esc_attr__('Duplicate Event', 'event_espresso'); |
271 | - $return .= '<a href="' . $href . '" title="' . $title . '" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">' . $title . '</button>'; |
|
271 | + $return .= '<a href="'.$href.'" title="'.$title.'" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">'.$title.'</button>'; |
|
272 | 272 | } |
273 | 273 | return $return; |
274 | 274 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | 'label' => __('Trash', 'event_espresso'), |
292 | 292 | 'count' => 0, |
293 | 293 | 'bulk_action' => array( |
294 | - 'restore_tickets' => __('Restore from Trash' , 'event_espresso'), |
|
294 | + 'restore_tickets' => __('Restore from Trash', 'event_espresso'), |
|
295 | 295 | 'delete_tickets' => __('Delete Permanently', 'event_espresso') |
296 | 296 | ) |
297 | 297 | ) |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | |
303 | 303 | public function load_scripts_styles_edit() { |
304 | - wp_register_script( 'ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js', array( 'ee_admin_js', 'heartbeat' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
304 | + wp_register_script('ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL.'event-editor-heartbeat.js', array('ee_admin_js', 'heartbeat'), EVENT_ESPRESSO_VERSION, TRUE); |
|
305 | 305 | |
306 | 306 | /** |
307 | 307 | * load accounting js. |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | |
321 | 321 | |
322 | 322 | |
323 | - public function add_additional_datetime_button( $template, $template_args ) { |
|
324 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php', $template_args, TRUE); |
|
323 | + public function add_additional_datetime_button($template, $template_args) { |
|
324 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_add_additional_time.template.php', $template_args, TRUE); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | |
328 | 328 | |
329 | - public function add_datetime_clone_button( $template, $template_args ) { |
|
330 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php', $template_args, TRUE ); |
|
329 | + public function add_datetime_clone_button($template, $template_args) { |
|
330 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_metabox_clone_button.template.php', $template_args, TRUE); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
334 | 334 | |
335 | - public function datetime_timezones_template( $template, $template_args ) { |
|
336 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php', $template_args, TRUE ); |
|
335 | + public function datetime_timezones_template($template, $template_args) { |
|
336 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_timezones.template.php', $template_args, TRUE); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | protected function _set_list_table_views_default() { |
343 | 343 | parent::_set_list_table_views_default(); |
344 | 344 | $export_label = __('Export Events', 'event_espresso'); |
345 | - if ( EE_Registry::instance()->CAP->current_user_can( 'export', 'espresso_events_export' ) ) { |
|
345 | + if (EE_Registry::instance()->CAP->current_user_can('export', 'espresso_events_export')) { |
|
346 | 346 | // $this->_views['all']['bulk_action']['export_events'] = $export_label; |
347 | 347 | // $this->_views['draft']['bulk_action']['export_events'] = $export_label; |
348 | 348 | |
349 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
349 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
350 | 350 | // $this->_views['trash']['bulk_action']['export_events'] = $export_label; |
351 | 351 | } |
352 | 352 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | ) |
373 | 373 | ); |
374 | 374 | |
375 | - $this->_views = array_merge( $this->_views, $new_views); |
|
375 | + $this->_views = array_merge($this->_views, $new_views); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -386,17 +386,17 @@ discard block |
||
386 | 386 | |
387 | 387 | |
388 | 388 | |
389 | - public function extra_list_table_actions( $actionlinks, $event ) { |
|
390 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports', $event->ID() ) ) { |
|
389 | + public function extra_list_table_actions($actionlinks, $event) { |
|
390 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports', $event->ID())) { |
|
391 | 391 | $reports_query_args = array( |
392 | 392 | 'action' => 'reports', |
393 | 393 | 'EVT_ID' => $event->ID() |
394 | 394 | ); |
395 | - $reports_link = EE_Admin_Page::add_query_args_and_nonce( $reports_query_args, REG_ADMIN_URL ); |
|
396 | - $actionlinks[] = '<a href="' . $reports_link . '" title="' . esc_attr__('View Report', 'event_espresso') . '"><div class="dashicons dashicons-chart-bar"></div></a>' . "\n\t"; |
|
395 | + $reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL); |
|
396 | + $actionlinks[] = '<a href="'.$reports_link.'" title="'.esc_attr__('View Report', 'event_espresso').'"><div class="dashicons dashicons-chart-bar"></div></a>'."\n\t"; |
|
397 | 397 | } |
398 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
399 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
398 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
399 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
400 | 400 | $actionlinks[] = EEH_MSG_Template::get_message_action_link( |
401 | 401 | 'see_notifications_for', |
402 | 402 | null, |
@@ -411,15 +411,15 @@ discard block |
||
411 | 411 | |
412 | 412 | |
413 | 413 | public function additional_legend_items($items) { |
414 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports' ) ) { |
|
414 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports')) { |
|
415 | 415 | $items['reports'] = array( |
416 | 416 | 'class' => 'dashicons dashicons-chart-bar', |
417 | 417 | 'desc' => __('Event Reports', 'event_espresso') |
418 | 418 | ); |
419 | 419 | } |
420 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
421 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
422 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
420 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
421 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
422 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
423 | 423 | $items['view_related_messages'] = array( |
424 | 424 | 'class' => $related_for_icon['css_class'], |
425 | 425 | 'desc' => $related_for_icon['label'], |
@@ -444,17 +444,17 @@ discard block |
||
444 | 444 | */ |
445 | 445 | protected function _duplicate_event() { |
446 | 446 | //first make sure the ID for the event is in the request. If it isnt' then we need to bail and redirect back to overview list table (cause how did we get here?) |
447 | - if ( !isset( $this->_req_data['EVT_ID'] ) ) { |
|
448 | - EE_Error::add_error( __('In order to duplicate an event an Event ID is required. None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
449 | - $this->_redirect_after_action( FALSE, '', '', array(), TRUE ); |
|
447 | + if ( ! isset($this->_req_data['EVT_ID'])) { |
|
448 | + EE_Error::add_error(__('In order to duplicate an event an Event ID is required. None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
449 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
450 | 450 | return; |
451 | 451 | } |
452 | 452 | |
453 | 453 | //k we've got EVT_ID so let's use that to get the event we'll duplicate |
454 | - $orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] ); |
|
454 | + $orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']); |
|
455 | 455 | |
456 | - if ( ! $orig_event instanceof EE_Event ) |
|
457 | - throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID'] ) ); |
|
456 | + if ( ! $orig_event instanceof EE_Event) |
|
457 | + throw new EE_Error(sprintf(__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID'])); |
|
458 | 458 | |
459 | 459 | //k now let's clone the $orig_event before getting relations |
460 | 460 | $new_event = clone $orig_event; |
@@ -467,43 +467,43 @@ discard block |
||
467 | 467 | |
468 | 468 | |
469 | 469 | //reset the ID and modify other details to make it clear this is a dupe |
470 | - $new_event->set( 'EVT_ID', 0 ); |
|
471 | - $new_name = $new_event->name() . ' ' . __('**DUPLICATE**', 'event_espresso'); |
|
472 | - $new_event->set( 'EVT_name', $new_name ); |
|
473 | - $new_event->set( 'EVT_slug', wp_unique_post_slug( sanitize_title( $orig_event->name() ), 0, 'publish', 'espresso_events', 0 ) ); |
|
474 | - $new_event->set( 'status', 'draft' ); |
|
470 | + $new_event->set('EVT_ID', 0); |
|
471 | + $new_name = $new_event->name().' '.__('**DUPLICATE**', 'event_espresso'); |
|
472 | + $new_event->set('EVT_name', $new_name); |
|
473 | + $new_event->set('EVT_slug', wp_unique_post_slug(sanitize_title($orig_event->name()), 0, 'publish', 'espresso_events', 0)); |
|
474 | + $new_event->set('status', 'draft'); |
|
475 | 475 | |
476 | 476 | //duplicate discussion settings |
477 | - $new_event->set( 'comment_status', $orig_event->get('comment_status') ); |
|
478 | - $new_event->set( 'ping_status', $orig_event->get( 'ping_status' ) ); |
|
477 | + $new_event->set('comment_status', $orig_event->get('comment_status')); |
|
478 | + $new_event->set('ping_status', $orig_event->get('ping_status')); |
|
479 | 479 | |
480 | 480 | //save the new event |
481 | 481 | $new_event->save(); |
482 | 482 | |
483 | 483 | //venues |
484 | - foreach( $orig_ven as $ven ) { |
|
485 | - $new_event->_add_relation_to( $ven, 'Venue' ); |
|
484 | + foreach ($orig_ven as $ven) { |
|
485 | + $new_event->_add_relation_to($ven, 'Venue'); |
|
486 | 486 | } |
487 | 487 | $new_event->save(); |
488 | 488 | |
489 | 489 | |
490 | 490 | //now we need to get the question group relations and handle that |
491 | 491 | //first primary question groups |
492 | - $orig_primary_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 1 ) ) ); |
|
493 | - if ( !empty( $orig_primary_qgs ) ) { |
|
494 | - foreach ( $orig_primary_qgs as $id => $obj ) { |
|
495 | - if ( $obj instanceof EE_Question_Group ) { |
|
496 | - $new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 1 ) ); |
|
492 | + $orig_primary_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 1))); |
|
493 | + if ( ! empty($orig_primary_qgs)) { |
|
494 | + foreach ($orig_primary_qgs as $id => $obj) { |
|
495 | + if ($obj instanceof EE_Question_Group) { |
|
496 | + $new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 1)); |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | } |
500 | 500 | |
501 | 501 | //next additional attendee question groups |
502 | - $orig_additional_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 0 ) ) ); |
|
503 | - if ( !empty( $orig_additional_qgs ) ) { |
|
504 | - foreach ( $orig_additional_qgs as $id => $obj ) { |
|
505 | - if ( $obj instanceof EE_Question_Group ) { |
|
506 | - $new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 0 ) ); |
|
502 | + $orig_additional_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0))); |
|
503 | + if ( ! empty($orig_additional_qgs)) { |
|
504 | + foreach ($orig_additional_qgs as $id => $obj) { |
|
505 | + if ($obj instanceof EE_Question_Group) { |
|
506 | + $new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 0)); |
|
507 | 507 | } |
508 | 508 | } |
509 | 509 | } |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | |
515 | 515 | //k now that we have the new event saved we can loop through the datetimes and start adding relations. |
516 | 516 | $cloned_tickets = array(); |
517 | - foreach ( $orig_datetimes as $orig_dtt ) { |
|
517 | + foreach ($orig_datetimes as $orig_dtt) { |
|
518 | 518 | $new_dtt = clone $orig_dtt; |
519 | 519 | $orig_tkts = $orig_dtt->tickets(); |
520 | 520 | |
@@ -522,22 +522,22 @@ discard block |
||
522 | 522 | $new_dtt->set('DTT_ID', 0); |
523 | 523 | $new_dtt->set('DTT_sold', 0); |
524 | 524 | $new_dtt->save(); |
525 | - $new_event->_add_relation_to( $new_dtt, 'Datetime'); |
|
525 | + $new_event->_add_relation_to($new_dtt, 'Datetime'); |
|
526 | 526 | $new_event->save(); |
527 | 527 | |
528 | 528 | //now let's get the ticket relations setup. |
529 | - foreach ( (array) $orig_tkts as $orig_tkt ) { |
|
529 | + foreach ((array) $orig_tkts as $orig_tkt) { |
|
530 | 530 | //it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
531 | - if ( ! $orig_tkt instanceof EE_Ticket ) |
|
531 | + if ( ! $orig_tkt instanceof EE_Ticket) |
|
532 | 532 | continue; |
533 | 533 | |
534 | 534 | //is this ticket archived? If it is then let's skip |
535 | - if ( $orig_tkt->get( 'TKT_deleted' ) ) { |
|
535 | + if ($orig_tkt->get('TKT_deleted')) { |
|
536 | 536 | continue; |
537 | 537 | } |
538 | 538 | |
539 | 539 | //does this original ticket already exist in the clone_tickets cache? If so we'll just use the new ticket from it. |
540 | - if ( isset( $cloned_tickets[$orig_tkt->ID()] ) ) { |
|
540 | + if (isset($cloned_tickets[$orig_tkt->ID()])) { |
|
541 | 541 | $new_tkt = $cloned_tickets[$orig_tkt->ID()]; |
542 | 542 | } else { |
543 | 543 | $new_tkt = clone $orig_tkt; |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | $new_tkt->save(); //make sure new ticket has ID. |
550 | 550 | |
551 | 551 | //price relations on new ticket need to be setup. |
552 | - foreach ( $orig_prices as $orig_price ) { |
|
552 | + foreach ($orig_prices as $orig_price) { |
|
553 | 553 | $new_price = clone $orig_price; |
554 | 554 | $new_price->set('PRC_ID', 0); |
555 | 555 | $new_price->save(); |
@@ -566,39 +566,39 @@ discard block |
||
566 | 566 | } |
567 | 567 | |
568 | 568 | //clone taxonomy information |
569 | - $taxonomies_to_clone_with = apply_filters( 'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array( 'espresso_event_categories', 'espresso_event_type', 'post_tag' ) ); |
|
569 | + $taxonomies_to_clone_with = apply_filters('FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array('espresso_event_categories', 'espresso_event_type', 'post_tag')); |
|
570 | 570 | |
571 | 571 | //get terms for original event (notice) |
572 | - $orig_terms = wp_get_object_terms( $orig_event->ID(), $taxonomies_to_clone_with ); |
|
572 | + $orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with); |
|
573 | 573 | |
574 | 574 | //loop through terms and add them to new event. |
575 | - foreach ( $orig_terms as $term ) { |
|
576 | - wp_set_object_terms( $new_event->ID(), $term->term_id, $term->taxonomy, true ); |
|
575 | + foreach ($orig_terms as $term) { |
|
576 | + wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true); |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | |
580 | - do_action( 'AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event ); |
|
580 | + do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event); |
|
581 | 581 | |
582 | 582 | //now let's redirect to the edit page for this duplicated event if we have a new event id. |
583 | - if ( $new_event->ID() ) { |
|
583 | + if ($new_event->ID()) { |
|
584 | 584 | $redirect_args = array( |
585 | 585 | 'post' => $new_event->ID(), |
586 | 586 | 'action' => 'edit' |
587 | 587 | ); |
588 | - EE_Error::add_success( __('Event successfully duplicated. Please review the details below and make any necessary edits', 'event_espresso') ); |
|
588 | + EE_Error::add_success(__('Event successfully duplicated. Please review the details below and make any necessary edits', 'event_espresso')); |
|
589 | 589 | } else { |
590 | 590 | $redirect_args = array( |
591 | 591 | 'action' => 'default' |
592 | 592 | ); |
593 | - EE_Error::add_error( __('Not able to duplicate event. Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
593 | + EE_Error::add_error(__('Not able to duplicate event. Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
594 | 594 | } |
595 | 595 | |
596 | - $this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE ); |
|
596 | + $this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | |
600 | 600 | |
601 | - protected function _import_page(){ |
|
601 | + protected function _import_page() { |
|
602 | 602 | |
603 | 603 | $title = __('Import', 'event_espresso'); |
604 | 604 | $intro = __('If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ', 'event_espresso'); |
@@ -606,8 +606,8 @@ discard block |
||
606 | 606 | $action = 'import_events'; |
607 | 607 | $type = 'csv'; |
608 | 608 | $this->_template_args['form'] = EE_Import::instance()->upload_form($title, $intro, $form_url, $action, $type); |
609 | - $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'),$this->_admin_base_url); |
|
610 | - $content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php',$this->_template_args,true); |
|
609 | + $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'), $this->_admin_base_url); |
|
610 | + $content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'import_page.template.php', $this->_template_args, true); |
|
611 | 611 | |
612 | 612 | |
613 | 613 | $this->_template_args['admin_page_content'] = $content; |
@@ -620,9 +620,9 @@ discard block |
||
620 | 620 | * @return string html |
621 | 621 | */ |
622 | 622 | protected function _import_events() { |
623 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
623 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
624 | 624 | $success = EE_Import::instance()->import(); |
625 | - $this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'),true); |
|
625 | + $this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'), true); |
|
626 | 626 | |
627 | 627 | } |
628 | 628 | |
@@ -636,23 +636,23 @@ discard block |
||
636 | 636 | * @return file |
637 | 637 | */ |
638 | 638 | protected function _events_export() { |
639 | - if(isset($this->_req_data['EVT_ID'])){ |
|
639 | + if (isset($this->_req_data['EVT_ID'])) { |
|
640 | 640 | $event_ids = $this->_req_data['EVT_ID']; |
641 | - }elseif(isset($this->_req_data['EVT_IDs'])){ |
|
641 | + }elseif (isset($this->_req_data['EVT_IDs'])) { |
|
642 | 642 | $event_ids = $this->_req_data['EVT_IDs']; |
643 | - }else{ |
|
643 | + } else { |
|
644 | 644 | $event_ids = NULL; |
645 | 645 | } |
646 | 646 | //todo: I don't like doing this but it'll do until we modify EE_Export Class. |
647 | 647 | $new_request_args = array( |
648 | 648 | 'export' => 'report', |
649 | 649 | 'action' => 'all_event_data', |
650 | - 'EVT_ID' => $event_ids , |
|
650 | + 'EVT_ID' => $event_ids, |
|
651 | 651 | ); |
652 | 652 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
653 | 653 | |
654 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
655 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
654 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
655 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
656 | 656 | $EE_Export = EE_Export::instance($this->_req_data); |
657 | 657 | $EE_Export->export(); |
658 | 658 | } |
@@ -674,11 +674,11 @@ discard block |
||
674 | 674 | 'category_ids' => $this->_req_data['EVT_CAT_ID'] |
675 | 675 | ); |
676 | 676 | |
677 | - $this->_req_data = array_merge( $this->_req_data, $new_request_args ); |
|
677 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
678 | 678 | |
679 | - if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) { |
|
680 | - require_once( EE_CLASSES . 'EE_Export.class.php'); |
|
681 | - $EE_Export = EE_Export::instance( $this->_req_data ); |
|
679 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
680 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
681 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
682 | 682 | $EE_Export->export(); |
683 | 683 | } |
684 | 684 | |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | /** |
690 | 690 | * Creates a sample CSV file for importing |
691 | 691 | */ |
692 | - protected function _sample_export_file(){ |
|
692 | + protected function _sample_export_file() { |
|
693 | 693 | // require_once(EE_CLASSES . 'EE_Export.class.php'); |
694 | 694 | EE_Export::instance()->export_sample(); |
695 | 695 | } |
@@ -706,10 +706,10 @@ discard block |
||
706 | 706 | * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
707 | 707 | * from General_Settings_Admin_Page to here. |
708 | 708 | */ |
709 | - $this->_template_args = apply_filters( 'FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args ); |
|
710 | - $this->_set_add_edit_form_tags( 'update_template_settings' ); |
|
711 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
712 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php', $this->_template_args, TRUE ); |
|
709 | + $this->_template_args = apply_filters('FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args); |
|
710 | + $this->_set_add_edit_form_tags('update_template_settings'); |
|
711 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
712 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'template_settings.template.php', $this->_template_args, TRUE); |
|
713 | 713 | $this->display_admin_page_with_sidebar(); |
714 | 714 | } |
715 | 715 | |
@@ -721,24 +721,24 @@ discard block |
||
721 | 721 | * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
722 | 722 | * from General_Settings_Admin_Page to here. |
723 | 723 | */ |
724 | - EE_Registry::instance()->CFG->template_settings = apply_filters( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data ); |
|
724 | + EE_Registry::instance()->CFG->template_settings = apply_filters('FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data); |
|
725 | 725 | |
726 | 726 | |
727 | 727 | //update custom post type slugs and detect if we need to flush rewrite rules |
728 | 728 | $old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug; |
729 | - EE_Registry::instance()->CFG->core->event_cpt_slug = empty( $this->_req_data['event_cpt_slug'] ) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes( $this->_req_data['event_cpt_slug'] ); |
|
729 | + EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug']) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes($this->_req_data['event_cpt_slug']); |
|
730 | 730 | |
731 | 731 | |
732 | 732 | $what = 'Template Settings'; |
733 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__ ); |
|
733 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__); |
|
734 | 734 | |
735 | 735 | |
736 | - if ( EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug ) { |
|
737 | - update_option( 'ee_flush_rewrite_rules', true ); |
|
736 | + if (EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug) { |
|
737 | + update_option('ee_flush_rewrite_rules', true); |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | |
741 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'template_settings' ) ); |
|
741 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'template_settings')); |
|
742 | 742 | |
743 | 743 | } |
744 | 744 | |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | |
757 | 757 | $this->verify_cpt_object(); |
758 | 758 | |
759 | - add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array( $this, 'registration_options_meta_box' ), $this->page_slug, 'side', 'core'); |
|
759 | + add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array($this, 'registration_options_meta_box'), $this->page_slug, 'side', 'core'); |
|
760 | 760 | //add_meta_box('espresso_event_types', __('Event Type', 'event_espresso'), array( $this, 'event_type_meta_box' ), $this->page_slug, 'side', 'default' ); //add this back in when the feature is ready. |
761 | 761 | |
762 | 762 | //todo feature in progress |
@@ -780,16 +780,16 @@ discard block |
||
780 | 780 | array('id' => true, 'text' => __('Yes', 'event_espresso')), |
781 | 781 | array('id' => false, 'text' => __('No', 'event_espresso')) |
782 | 782 | ); |
783 | - $default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete ), TRUE); |
|
783 | + $default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete), TRUE); |
|
784 | 784 | $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(FALSE); |
785 | 785 | $template_args['_event'] = $this->_cpt_model_obj; |
786 | 786 | $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit(); |
787 | 787 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
788 | 788 | $template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description()); |
789 | 789 | $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false); |
790 | - $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status() ); |
|
791 | - $template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values ); |
|
792 | - $templatepath = EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php'; |
|
790 | + $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
|
791 | + $template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values); |
|
792 | + $templatepath = EVENTS_CAF_TEMPLATE_PATH.'event_registration_options.template.php'; |
|
793 | 793 | EEH_Template::display_template($templatepath, $template_args); |
794 | 794 | } |
795 | 795 | |
@@ -802,9 +802,9 @@ discard block |
||
802 | 802 | * @param array $box metabox args |
803 | 803 | * @return string metabox contents |
804 | 804 | */ |
805 | - public function event_type_meta_box( $post, $box ) { |
|
806 | - $template_args['radio_list'] = $this->wp_terms_radio($post->ID, array( 'taxonomy' => 'espresso_event_type' ) ); |
|
807 | - $template = EVENTS_CAF_TEMPLATE_PATH . 'event_type_metabox_contents.template.php'; |
|
805 | + public function event_type_meta_box($post, $box) { |
|
806 | + $template_args['radio_list'] = $this->wp_terms_radio($post->ID, array('taxonomy' => 'espresso_event_type')); |
|
807 | + $template = EVENTS_CAF_TEMPLATE_PATH.'event_type_metabox_contents.template.php'; |
|
808 | 808 | EEH_Template::display_template($template, $template_args); |
809 | 809 | } |
810 | 810 | |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | |
815 | 815 | |
816 | 816 | |
817 | - public function wp_terms_radio( $post_id = 0, $args = array() ) { |
|
817 | + public function wp_terms_radio($post_id = 0, $args = array()) { |
|
818 | 818 | $defaults = array( |
819 | 819 | 'descendants_and_self' => 0, |
820 | 820 | 'selected_cats' => false, |
@@ -823,11 +823,11 @@ discard block |
||
823 | 823 | 'taxonomy' => 'category', |
824 | 824 | 'checked_ontop' => true |
825 | 825 | ); |
826 | - $args = apply_filters( 'wp_terms_checklist_args', $args, $post_id ); |
|
826 | + $args = apply_filters('wp_terms_checklist_args', $args, $post_id); |
|
827 | 827 | |
828 | - extract( wp_parse_args($args, $defaults), EXTR_SKIP ); |
|
828 | + extract(wp_parse_args($args, $defaults), EXTR_SKIP); |
|
829 | 829 | |
830 | - if ( empty($walker) || !is_a($walker, 'Walker') ) |
|
830 | + if (empty($walker) || ! is_a($walker, 'Walker')) |
|
831 | 831 | $walker = new Walker_Radio_Checklist; |
832 | 832 | |
833 | 833 | $descendants_and_self = (int) $descendants_and_self; |
@@ -835,37 +835,37 @@ discard block |
||
835 | 835 | $args = array('taxonomy' => $taxonomy); |
836 | 836 | |
837 | 837 | $tax = get_taxonomy($taxonomy); |
838 | - $args['disabled'] = !current_user_can($tax->cap->assign_terms); |
|
838 | + $args['disabled'] = ! current_user_can($tax->cap->assign_terms); |
|
839 | 839 | |
840 | - if ( is_array( $selected_cats ) ) |
|
840 | + if (is_array($selected_cats)) |
|
841 | 841 | $args['selected_cats'] = $selected_cats; |
842 | - elseif ( $post_id ) |
|
842 | + elseif ($post_id) |
|
843 | 843 | $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); |
844 | 844 | else |
845 | 845 | $args['selected_cats'] = array(); |
846 | 846 | |
847 | - if ( is_array( $popular_cats ) ) |
|
847 | + if (is_array($popular_cats)) |
|
848 | 848 | $args['popular_cats'] = $popular_cats; |
849 | 849 | else |
850 | - $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); |
|
850 | + $args['popular_cats'] = get_terms($taxonomy, array('fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false)); |
|
851 | 851 | |
852 | - if ( $descendants_and_self ) { |
|
853 | - $categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) ); |
|
854 | - $self = get_term( $descendants_and_self, $taxonomy ); |
|
855 | - array_unshift( $categories, $self ); |
|
852 | + if ($descendants_and_self) { |
|
853 | + $categories = (array) get_terms($taxonomy, array('child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0)); |
|
854 | + $self = get_term($descendants_and_self, $taxonomy); |
|
855 | + array_unshift($categories, $self); |
|
856 | 856 | } else { |
857 | 857 | $categories = (array) get_terms($taxonomy, array('get' => 'all')); |
858 | 858 | } |
859 | 859 | |
860 | - if ( $checked_ontop ) { |
|
860 | + if ($checked_ontop) { |
|
861 | 861 | // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache) |
862 | 862 | $checked_categories = array(); |
863 | - $keys = array_keys( $categories ); |
|
863 | + $keys = array_keys($categories); |
|
864 | 864 | |
865 | - foreach( $keys as $k ) { |
|
866 | - if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) { |
|
865 | + foreach ($keys as $k) { |
|
866 | + if (in_array($categories[$k]->term_id, $args['selected_cats'])) { |
|
867 | 867 | $checked_categories[] = $categories[$k]; |
868 | - unset( $categories[$k] ); |
|
868 | + unset($categories[$k]); |
|
869 | 869 | } |
870 | 870 | } |
871 | 871 | |
@@ -890,18 +890,18 @@ discard block |
||
890 | 890 | * @param array $list_table_obj the list table object |
891 | 891 | * @return array new filters |
892 | 892 | */ |
893 | - public function list_table_filters( $oldfilters, $list_table_obj ) { |
|
893 | + public function list_table_filters($oldfilters, $list_table_obj) { |
|
894 | 894 | $filters = array(); |
895 | 895 | |
896 | 896 | //first month/year filters |
897 | 897 | $filters[] = $this->espresso_event_months_dropdown(); |
898 | 898 | |
899 | 899 | |
900 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
900 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
901 | 901 | |
902 | 902 | //active status dropdown |
903 | - if ( $status !== 'draft' ) |
|
904 | - $filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' ); |
|
903 | + if ($status !== 'draft') |
|
904 | + $filter[] = $this->active_status_dropdown(isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : ''); |
|
905 | 905 | |
906 | 906 | //category filter |
907 | 907 | $filters[] = $this->category_dropdown(); |
@@ -923,17 +923,17 @@ discard block |
||
923 | 923 | */ |
924 | 924 | public function espresso_event_months_dropdown() { |
925 | 925 | //what we need to do is get all PRIMARY datetimes for all events to filter on. Note we need to include any other filters that are set! |
926 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
926 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
927 | 927 | |
928 | 928 | //categories? |
929 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
929 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
930 | 930 | |
931 | 931 | //active status? |
932 | - $active_status = isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : NULL; |
|
932 | + $active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : NULL; |
|
933 | 933 | |
934 | 934 | $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
935 | 935 | |
936 | - return EEH_Form_Fields::generate_event_months_dropdown( $cur_date, $status, $category, $active_status ); |
|
936 | + return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status); |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | |
@@ -944,12 +944,12 @@ discard block |
||
944 | 944 | * @param string $current_value whatever the ucrrent active status is |
945 | 945 | * @return string html dropdown. |
946 | 946 | */ |
947 | - public function active_status_dropdown( $current_value = '' ) { |
|
947 | + public function active_status_dropdown($current_value = '') { |
|
948 | 948 | $select_name = 'active_status'; |
949 | - $values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso') ); |
|
949 | + $values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso')); |
|
950 | 950 | $id = 'id="espresso-active-status-dropdown-filter"'; |
951 | 951 | $class = 'wide'; |
952 | - echo EEH_Form_Fields::select_input( $select_name, $values, $current_value, $id, $class ); |
|
952 | + echo EEH_Form_Fields::select_input($select_name, $values, $current_value, $id, $class); |
|
953 | 953 | } |
954 | 954 | |
955 | 955 | |
@@ -961,9 +961,9 @@ discard block |
||
961 | 961 | * @return string html |
962 | 962 | */ |
963 | 963 | public function category_dropdown() { |
964 | - $cur_cat = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
964 | + $cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
965 | 965 | |
966 | - return EEH_Form_Fields::generate_event_category_dropdown( $cur_cat ); |
|
966 | + return EEH_Form_Fields::generate_event_category_dropdown($cur_cat); |
|
967 | 967 | } |
968 | 968 | |
969 | 969 | |
@@ -975,14 +975,14 @@ discard block |
||
975 | 975 | * @return int |
976 | 976 | */ |
977 | 977 | public function total_events_today() { |
978 | - $start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 00:00:00', 'Y-m-d H:i:s', 'UTC' ); |
|
979 | - $end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' ); |
|
978 | + $start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 00:00:00', 'Y-m-d H:i:s', 'UTC'); |
|
979 | + $end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 23:59:59', 'Y-m-d H:i:s', 'UTC'); |
|
980 | 980 | |
981 | 981 | $where = array( |
982 | - 'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) ) |
|
982 | + 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)) |
|
983 | 983 | ); |
984 | 984 | |
985 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
985 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
986 | 986 | return $count; |
987 | 987 | } |
988 | 988 | |
@@ -997,14 +997,14 @@ discard block |
||
997 | 997 | $this_year_r = date('Y'); |
998 | 998 | $this_month_r = date('m'); |
999 | 999 | $days_this_month = date('t'); |
1000 | - $start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-01 00:00:00', 'Y-m-d H:i:s', 'UTC' ); |
|
1001 | - $end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' ); |
|
1000 | + $start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-01 00:00:00', 'Y-m-d H:i:s', 'UTC'); |
|
1001 | + $end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' 23:59:59', 'Y-m-d H:i:s', 'UTC'); |
|
1002 | 1002 | |
1003 | 1003 | $where = array( |
1004 | - 'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) ) |
|
1004 | + 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)) |
|
1005 | 1005 | ); |
1006 | 1006 | |
1007 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
1007 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
1008 | 1008 | return $count; |
1009 | 1009 | } |
1010 | 1010 | |
@@ -1021,53 +1021,53 @@ discard block |
||
1021 | 1021 | |
1022 | 1022 | |
1023 | 1023 | |
1024 | - public function get_default_tickets( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
1024 | + public function get_default_tickets($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
1025 | 1025 | |
1026 | - $orderby= empty( $this->_req_data['orderby'] ) ? 'TKT_name' : $this->_req_data['orderby']; |
|
1027 | - $order = empty( $this->_req_data['order'] ) ? 'ASC' : $this->_req_data['order']; |
|
1026 | + $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
1027 | + $order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order']; |
|
1028 | 1028 | |
1029 | - switch ( $orderby ) { |
|
1029 | + switch ($orderby) { |
|
1030 | 1030 | case 'TKT_name' : |
1031 | - $orderby = array( 'TKT_name' => $order ); |
|
1031 | + $orderby = array('TKT_name' => $order); |
|
1032 | 1032 | break; |
1033 | 1033 | |
1034 | 1034 | case 'TKT_price' : |
1035 | - $orderby = array( 'TKT_price' => $order ); |
|
1035 | + $orderby = array('TKT_price' => $order); |
|
1036 | 1036 | break; |
1037 | 1037 | |
1038 | 1038 | case 'TKT_uses' : |
1039 | - $orderby = array( 'TKT_uses' => $order ); |
|
1039 | + $orderby = array('TKT_uses' => $order); |
|
1040 | 1040 | break; |
1041 | 1041 | |
1042 | 1042 | case 'TKT_min' : |
1043 | - $orderby = array( 'TKT_min' => $order ); |
|
1043 | + $orderby = array('TKT_min' => $order); |
|
1044 | 1044 | break; |
1045 | 1045 | |
1046 | 1046 | case 'TKT_max' : |
1047 | - $orderby = array( 'TKT_max' => $order ); |
|
1047 | + $orderby = array('TKT_max' => $order); |
|
1048 | 1048 | break; |
1049 | 1049 | |
1050 | 1050 | case 'TKT_qty' : |
1051 | - $orderby = array( 'TKT_qty' => $order ); |
|
1051 | + $orderby = array('TKT_qty' => $order); |
|
1052 | 1052 | break; |
1053 | 1053 | } |
1054 | 1054 | |
1055 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1056 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1055 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1056 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1057 | 1057 | |
1058 | 1058 | $_where = array( |
1059 | 1059 | 'TKT_is_default' => 1, |
1060 | 1060 | 'TKT_deleted' => $trashed |
1061 | 1061 | ); |
1062 | 1062 | |
1063 | - $offset = ($current_page-1)*$per_page; |
|
1064 | - $limit = array( $offset, $per_page ); |
|
1063 | + $offset = ($current_page - 1) * $per_page; |
|
1064 | + $limit = array($offset, $per_page); |
|
1065 | 1065 | |
1066 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1067 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1066 | + if (isset($this->_req_data['s'])) { |
|
1067 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1068 | 1068 | $_where['OR'] = array( |
1069 | - 'TKT_name' => array('LIKE',$sstr ), |
|
1070 | - 'TKT_description' => array('LIKE',$sstr ) |
|
1069 | + 'TKT_name' => array('LIKE', $sstr), |
|
1070 | + 'TKT_description' => array('LIKE', $sstr) |
|
1071 | 1071 | ); |
1072 | 1072 | } |
1073 | 1073 | |
@@ -1078,9 +1078,9 @@ discard block |
||
1078 | 1078 | 'group_by'=>'TKT_ID' |
1079 | 1079 | ); |
1080 | 1080 | |
1081 | - if($count){ |
|
1081 | + if ($count) { |
|
1082 | 1082 | return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
1083 | - }else{ |
|
1083 | + } else { |
|
1084 | 1084 | return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
1085 | 1085 | } |
1086 | 1086 | |
@@ -1090,35 +1090,35 @@ discard block |
||
1090 | 1090 | |
1091 | 1091 | |
1092 | 1092 | |
1093 | - protected function _trash_or_restore_ticket( $trash = FALSE ) { |
|
1093 | + protected function _trash_or_restore_ticket($trash = FALSE) { |
|
1094 | 1094 | $success = 1; |
1095 | 1095 | |
1096 | 1096 | $TKT = EEM_Ticket::instance(); |
1097 | 1097 | |
1098 | 1098 | //checkboxes? |
1099 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
1099 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1100 | 1100 | //if array has more than one element then success message should be plural |
1101 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1101 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1102 | 1102 | |
1103 | 1103 | //cycle thru the boxes |
1104 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
1105 | - if ( $trash ) { |
|
1106 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1104 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1105 | + if ($trash) { |
|
1106 | + if ( ! $TKT->delete_by_ID($TKT_ID)) |
|
1107 | 1107 | $success = 0; |
1108 | 1108 | } else { |
1109 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1109 | + if ( ! $TKT->restore_by_ID($TKT_ID)) |
|
1110 | 1110 | $success = 0; |
1111 | 1111 | } |
1112 | 1112 | } |
1113 | 1113 | } else { |
1114 | 1114 | //grab single id and trash |
1115 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
1115 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1116 | 1116 | |
1117 | - if ( $trash ) { |
|
1118 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1117 | + if ($trash) { |
|
1118 | + if ( ! $TKT->delete_by_ID($TKT_ID)) |
|
1119 | 1119 | $success = 0; |
1120 | 1120 | } else { |
1121 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1121 | + if ( ! $TKT->restore_by_ID($TKT_ID)) |
|
1122 | 1122 | $success = 0; |
1123 | 1123 | } |
1124 | 1124 | } |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | 'action' => 'ticket_list_table', |
1129 | 1129 | 'status' => $trash ? '' : 'trashed' |
1130 | 1130 | ); |
1131 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
|
1131 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | |
@@ -1141,21 +1141,21 @@ discard block |
||
1141 | 1141 | $TKT = EEM_Ticket::instance(); |
1142 | 1142 | |
1143 | 1143 | //checkboxes? |
1144 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
1144 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1145 | 1145 | //if array has more than one element then success message should be plural |
1146 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1146 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1147 | 1147 | |
1148 | 1148 | //cycle thru the boxes |
1149 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
1149 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1150 | 1150 | //delete |
1151 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
1151 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
1152 | 1152 | $success = 0; |
1153 | 1153 | } |
1154 | 1154 | } |
1155 | 1155 | } else { |
1156 | 1156 | //grab single id and trash |
1157 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
1158 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
1157 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1158 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
1159 | 1159 | $success = 0; |
1160 | 1160 | } |
1161 | 1161 | } |
@@ -1167,16 +1167,16 @@ discard block |
||
1167 | 1167 | ); |
1168 | 1168 | |
1169 | 1169 | //failsafe. If the default ticket count === 1 then we need to redirect to event overview. |
1170 | - if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) |
|
1170 | + if (EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE)) |
|
1171 | 1171 | $query_args = array(); |
1172 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
|
1172 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1173 | 1173 | } |
1174 | 1174 | |
1175 | 1175 | |
1176 | 1176 | |
1177 | 1177 | |
1178 | - protected function _delete_the_ticket( $TKT_ID ) { |
|
1179 | - $tkt = EEM_Ticket::instance()->get_one_by_ID( $TKT_ID ); |
|
1178 | + protected function _delete_the_ticket($TKT_ID) { |
|
1179 | + $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
1180 | 1180 | $tkt->_remove_relations('Datetime'); |
1181 | 1181 | //delete all related prices first |
1182 | 1182 | $tkt->delete_related_permanently('Price'); |
@@ -101,42 +101,42 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return EEM_Message |
103 | 103 | */ |
104 | - protected function __construct( $timezone = null ) { |
|
105 | - $this->singular_item = __('Message','event_espresso'); |
|
106 | - $this->plural_item = __('Messages','event_espresso'); |
|
104 | + protected function __construct($timezone = null) { |
|
105 | + $this->singular_item = __('Message', 'event_espresso'); |
|
106 | + $this->plural_item = __('Messages', 'event_espresso'); |
|
107 | 107 | |
108 | 108 | //used for token generator |
109 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
109 | + EE_Registry::instance()->load_helper('URL'); |
|
110 | 110 | |
111 | 111 | $this->_tables = array( |
112 | - 'Message'=>new EE_Primary_Table('esp_message','MSG_ID') |
|
112 | + 'Message'=>new EE_Primary_Table('esp_message', 'MSG_ID') |
|
113 | 113 | ); |
114 | 114 | |
115 | 115 | $allowed_priority = array( |
116 | - self::priority_high => __( 'high', 'event_espresso' ), |
|
117 | - self::priority_medium => __( 'medium', 'event_espresso' ), |
|
118 | - self::priority_low => __( 'low', 'event_espresso' ) |
|
116 | + self::priority_high => __('high', 'event_espresso'), |
|
117 | + self::priority_medium => __('medium', 'event_espresso'), |
|
118 | + self::priority_low => __('low', 'event_espresso') |
|
119 | 119 | ); |
120 | 120 | |
121 | 121 | $this->_fields = array( |
122 | 122 | 'Message'=>array( |
123 | - 'MSG_ID'=>new EE_Primary_Key_Int_Field('MSG_ID', __('Message ID','event_espresso')), |
|
124 | - 'MSG_token' => new EE_Plain_Text_Field( 'MSG_token', __('Unique Token used to represent this row in publicly viewable contexts (eg. a url).', 'event_espresso' ), false, EEH_URL::generate_unique_token() ), |
|
125 | - 'GRP_ID'=>new EE_Foreign_Key_Int_Field( 'GRP_ID', __('Foreign key to the EEM_Message_Template_Group table.', 'event_espresso' ), true, 0, 'Message_Template_Group' ), |
|
126 | - 'TXN_ID' => new EE_Foreign_Key_Int_Field( 'TXN_ID', __( 'Foreign key to the related EE_Transaction. This is required to give context for regenerating the specific message', 'event_espresso' ), true, 0, 'Transaction' ), |
|
127 | - 'MSG_messenger' => new EE_Plain_Text_Field('MSG_messenger', __( 'Corresponds to the EE_messenger::name used to send this message. This will also be used to attempt any resending of the message.', 'event_espresso' ), false, 'email' ), |
|
128 | - 'MSG_message_type' => new EE_Plain_Text_Field( 'MSG_message_type', __( 'Corresponds to the EE_message_type::name used to generate this message.', 'event_espresso' ), false, 'receipt' ), |
|
129 | - 'MSG_context' => new EE_Plain_Text_Field( 'MSG_context', __( 'Context', 'event_espresso' ), false ), |
|
130 | - 'MSG_recipient_ID' => new EE_Foreign_Key_Int_Field( 'MSG_recipient_ID', __( 'Recipient ID', 'event_espresso' ), true, null, array( 'Registration', 'Attendee', 'WP_User' ) ), |
|
131 | - 'MSG_recipient_type' => new EE_Any_Foreign_Model_Name_Field( 'MSG_recipient_type', __( 'Recipient Type', 'event_espresso' ), true, null, array( 'Registration', 'Attendee', 'WP_User' ) ), |
|
132 | - 'MSG_content' => new EE_Maybe_Serialized_Text_Field( 'MSG_content', __( 'Content', 'event_espresso' ), true, '' ), |
|
133 | - 'MSG_to' => new EE_Maybe_Serialized_Text_Field( 'MSG_to', __( 'Address To', 'event_espresso' ), true ), |
|
134 | - 'MSG_from' => new EE_Maybe_Serialized_Text_Field( 'MSG_from', __( 'Address From', 'event_espresso' ), true ), |
|
135 | - 'MSG_subject' => new EE_Maybe_Serialized_Text_Field( 'MSG_subject', __( 'Subject', 'event_espresso' ), true, '' ), |
|
136 | - 'MSG_priority' => new EE_Enum_Integer_Field( 'MSG_priority', __( 'Priority', 'event_espresso' ), false, self::priority_low, $allowed_priority ), |
|
137 | - 'STS_ID' => new EE_Foreign_Key_String_Field( 'STS_ID', __( 'Status', 'event_espresso' ), false, self::status_incomplete, 'Status' ), |
|
138 | - 'MSG_created' => new EE_Datetime_Field( 'MSG_created', __( 'Created', 'event_espresso' ), false, time() ), |
|
139 | - 'MSG_modified' => new EE_Datetime_Field( 'MSG_modified', __( 'Modified', 'event_espresso' ), true, time() ) |
|
123 | + 'MSG_ID'=>new EE_Primary_Key_Int_Field('MSG_ID', __('Message ID', 'event_espresso')), |
|
124 | + 'MSG_token' => new EE_Plain_Text_Field('MSG_token', __('Unique Token used to represent this row in publicly viewable contexts (eg. a url).', 'event_espresso'), false, EEH_URL::generate_unique_token()), |
|
125 | + 'GRP_ID'=>new EE_Foreign_Key_Int_Field('GRP_ID', __('Foreign key to the EEM_Message_Template_Group table.', 'event_espresso'), true, 0, 'Message_Template_Group'), |
|
126 | + 'TXN_ID' => new EE_Foreign_Key_Int_Field('TXN_ID', __('Foreign key to the related EE_Transaction. This is required to give context for regenerating the specific message', 'event_espresso'), true, 0, 'Transaction'), |
|
127 | + 'MSG_messenger' => new EE_Plain_Text_Field('MSG_messenger', __('Corresponds to the EE_messenger::name used to send this message. This will also be used to attempt any resending of the message.', 'event_espresso'), false, 'email'), |
|
128 | + 'MSG_message_type' => new EE_Plain_Text_Field('MSG_message_type', __('Corresponds to the EE_message_type::name used to generate this message.', 'event_espresso'), false, 'receipt'), |
|
129 | + 'MSG_context' => new EE_Plain_Text_Field('MSG_context', __('Context', 'event_espresso'), false), |
|
130 | + 'MSG_recipient_ID' => new EE_Foreign_Key_Int_Field('MSG_recipient_ID', __('Recipient ID', 'event_espresso'), true, null, array('Registration', 'Attendee', 'WP_User')), |
|
131 | + 'MSG_recipient_type' => new EE_Any_Foreign_Model_Name_Field('MSG_recipient_type', __('Recipient Type', 'event_espresso'), true, null, array('Registration', 'Attendee', 'WP_User')), |
|
132 | + 'MSG_content' => new EE_Maybe_Serialized_Text_Field('MSG_content', __('Content', 'event_espresso'), true, ''), |
|
133 | + 'MSG_to' => new EE_Maybe_Serialized_Text_Field('MSG_to', __('Address To', 'event_espresso'), true), |
|
134 | + 'MSG_from' => new EE_Maybe_Serialized_Text_Field('MSG_from', __('Address From', 'event_espresso'), true), |
|
135 | + 'MSG_subject' => new EE_Maybe_Serialized_Text_Field('MSG_subject', __('Subject', 'event_espresso'), true, ''), |
|
136 | + 'MSG_priority' => new EE_Enum_Integer_Field('MSG_priority', __('Priority', 'event_espresso'), false, self::priority_low, $allowed_priority), |
|
137 | + 'STS_ID' => new EE_Foreign_Key_String_Field('STS_ID', __('Status', 'event_espresso'), false, self::status_incomplete, 'Status'), |
|
138 | + 'MSG_created' => new EE_Datetime_Field('MSG_created', __('Created', 'event_espresso'), false, time()), |
|
139 | + 'MSG_modified' => new EE_Datetime_Field('MSG_modified', __('Modified', 'event_espresso'), true, time()) |
|
140 | 140 | ) |
141 | 141 | ); |
142 | 142 | $this->_model_relations = array( |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | 'Message_Template_Group' => new EE_Belongs_To_Relation(), |
147 | 147 | 'Transaction' => new EE_Belongs_To_Relation() |
148 | 148 | ); |
149 | - parent::__construct( $timezone ); |
|
149 | + parent::__construct($timezone); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | public function create_default_object() { |
158 | 158 | /** @type EE_Message $message */ |
159 | 159 | $message = parent::create_default_object(); |
160 | - if ( $message instanceof EE_Message ) { |
|
161 | - return EE_Message_Factory::set_messenger_and_message_type( $message ); |
|
160 | + if ($message instanceof EE_Message) { |
|
161 | + return EE_Message_Factory::set_messenger_and_message_type($message); |
|
162 | 162 | } |
163 | 163 | return null; |
164 | 164 | } |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | * @param mixed $cols_n_values |
170 | 170 | * @return \EE_Message |
171 | 171 | */ |
172 | - public function instantiate_class_from_array_or_object( $cols_n_values ) { |
|
172 | + public function instantiate_class_from_array_or_object($cols_n_values) { |
|
173 | 173 | /** @type EE_Message $message */ |
174 | - $message = parent::instantiate_class_from_array_or_object( $cols_n_values ); |
|
175 | - if ( $message instanceof EE_Message ) { |
|
176 | - return EE_Message_Factory::set_messenger_and_message_type( $message ); |
|
174 | + $message = parent::instantiate_class_from_array_or_object($cols_n_values); |
|
175 | + if ($message instanceof EE_Message) { |
|
176 | + return EE_Message_Factory::set_messenger_and_message_type($message); |
|
177 | 177 | } |
178 | 178 | return null; |
179 | 179 | } |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | * @param string $message_type the message type slug |
187 | 187 | * @return boolean |
188 | 188 | */ |
189 | - public function message_sent_for_attendee( $attendee, $message_type ) { |
|
190 | - $attendee_ID = EEM_Attendee::instance()->ensure_is_ID( $attendee ); |
|
191 | - return $this->exists( array( array( |
|
189 | + public function message_sent_for_attendee($attendee, $message_type) { |
|
190 | + $attendee_ID = EEM_Attendee::instance()->ensure_is_ID($attendee); |
|
191 | + return $this->exists(array(array( |
|
192 | 192 | 'Attendee.ATT_ID' => $attendee_ID, |
193 | 193 | 'MSG_message_type' => $message_type, |
194 | - 'STS_ID' => array( 'IN', $this->stati_indicating_sent() ) |
|
195 | - ) ) ); |
|
194 | + 'STS_ID' => array('IN', $this->stati_indicating_sent()) |
|
195 | + ))); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -204,13 +204,13 @@ discard block |
||
204 | 204 | * @param string $message_type the message type slug |
205 | 205 | * @return boolean |
206 | 206 | */ |
207 | - public function message_sent_for_registration( $registration, $message_type ) { |
|
208 | - $registrationID = EEM_Registration::instance()->ensure_is_ID( $registration ); |
|
209 | - return $this->exists( array( array( |
|
207 | + public function message_sent_for_registration($registration, $message_type) { |
|
208 | + $registrationID = EEM_Registration::instance()->ensure_is_ID($registration); |
|
209 | + return $this->exists(array(array( |
|
210 | 210 | 'Registration.REG_ID' => $registrationID, |
211 | 211 | 'MSG_message_type' => $message_type, |
212 | - 'STS_ID' => array( 'IN', $this->stati_indicating_sent() ) |
|
213 | - ) ) ); |
|
212 | + 'STS_ID' => array('IN', $this->stati_indicating_sent()) |
|
213 | + ))); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | |
@@ -221,10 +221,10 @@ discard block |
||
221 | 221 | * @param string $token |
222 | 222 | * @return EE_Message |
223 | 223 | */ |
224 | - public function get_one_by_token( $token ) { |
|
225 | - return $this->get_one( array( array( |
|
224 | + public function get_one_by_token($token) { |
|
225 | + return $this->get_one(array(array( |
|
226 | 226 | 'MSG_token' => $token |
227 | - ) ) ); |
|
227 | + ))); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | * Returns stati that indicate the message HAS been sent |
233 | 233 | * @return array of strings for possible stati |
234 | 234 | */ |
235 | - public function stati_indicating_sent(){ |
|
236 | - return apply_filters( 'FHEE__EEM_Message__stati_indicating_sent', array( self::status_sent ) ); |
|
235 | + public function stati_indicating_sent() { |
|
236 | + return apply_filters('FHEE__EEM_Message__stati_indicating_sent', array(self::status_sent)); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @return array of strings for possible stati. |
245 | 245 | */ |
246 | 246 | public function stati_indicating_to_send() { |
247 | - return apply_filters( 'FHEE__EEM_Message__stati_indicating_to_send', array( self::status_idle, self::status_resend ) ); |
|
247 | + return apply_filters('FHEE__EEM_Message__stati_indicating_to_send', array(self::status_idle, self::status_resend)); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -258,10 +258,10 @@ discard block |
||
258 | 258 | self::status_retry, |
259 | 259 | ); |
260 | 260 | //if WP_DEBUG is set, then let's include debug_only fails |
261 | - if ( WP_DEBUG ) { |
|
261 | + if (WP_DEBUG) { |
|
262 | 262 | $failed_stati[] = self::status_debug_only; |
263 | 263 | } |
264 | - return apply_filters( 'FHEE__EEM_Message__stati_indicating_failed_sending', $failed_stati ); |
|
264 | + return apply_filters('FHEE__EEM_Message__stati_indicating_failed_sending', $failed_stati); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
@@ -296,11 +296,11 @@ discard block |
||
296 | 296 | // the value, matches the corresponding EEM_Base child reference. |
297 | 297 | $expected_vars = $this->_expected_vars_for_query_inject(); |
298 | 298 | $query_params[0] = array(); |
299 | - foreach ( $expected_vars as $request_key => $model_name ) { |
|
300 | - $request_value = EE_Registry::instance()->REQ->get( $request_key ); |
|
301 | - if ( $request_value ) { |
|
299 | + foreach ($expected_vars as $request_key => $model_name) { |
|
300 | + $request_value = EE_Registry::instance()->REQ->get($request_key); |
|
301 | + if ($request_value) { |
|
302 | 302 | //special case |
303 | - switch ( $request_key ) { |
|
303 | + switch ($request_key) { |
|
304 | 304 | case '_REG_ID' : |
305 | 305 | $query_params[0]['AND**filter_by']['OR**filter_by_REG_ID'] = array( |
306 | 306 | 'Transaction.Registration.REG_ID' => $request_value, |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | ); |
313 | 313 | break; |
314 | 314 | default : |
315 | - $query_params[0]['AND**filter_by'][ 'OR**filter_by_' . $request_key ][ $model_name . '.' . $request_key ] = $request_value; |
|
315 | + $query_params[0]['AND**filter_by']['OR**filter_by_'.$request_key][$model_name.'.'.$request_key] = $request_value; |
|
316 | 316 | break; |
317 | 317 | } |
318 | 318 | } |
@@ -328,53 +328,53 @@ discard block |
||
328 | 328 | $expected_vars = $this->_expected_vars_for_query_inject(); |
329 | 329 | $pretty_label = ''; |
330 | 330 | $label_parts = array(); |
331 | - foreach ( $expected_vars as $request_key => $model_name ) { |
|
332 | - $model = EE_Registry::instance()->load_model( $model_name ); |
|
333 | - if ( $model_field_value = EE_Registry::instance()->REQ->get( $request_key ) ) { |
|
334 | - switch ( $request_key ) { |
|
331 | + foreach ($expected_vars as $request_key => $model_name) { |
|
332 | + $model = EE_Registry::instance()->load_model($model_name); |
|
333 | + if ($model_field_value = EE_Registry::instance()->REQ->get($request_key)) { |
|
334 | + switch ($request_key) { |
|
335 | 335 | case '_REG_ID' : |
336 | 336 | $label_parts[] = sprintf( |
337 | - esc_html__( 'Registration with the ID: %s', 'event_espresso' ), |
|
337 | + esc_html__('Registration with the ID: %s', 'event_espresso'), |
|
338 | 338 | $model_field_value |
339 | 339 | ); |
340 | 340 | break; |
341 | 341 | case 'ATT_ID' : |
342 | 342 | /** @var EE_Attendee $attendee */ |
343 | - $attendee = $model->get_one_by_ID( $model_field_value ); |
|
343 | + $attendee = $model->get_one_by_ID($model_field_value); |
|
344 | 344 | $label_parts[] = $attendee instanceof EE_Attendee |
345 | - ? sprintf( esc_html__( 'Attendee %s', 'event_espresso' ), $attendee->full_name() ) |
|
346 | - : sprintf( esc_html__( 'Attendee ID: %s', 'event_espresso' ), $model_field_value ); |
|
345 | + ? sprintf(esc_html__('Attendee %s', 'event_espresso'), $attendee->full_name()) |
|
346 | + : sprintf(esc_html__('Attendee ID: %s', 'event_espresso'), $model_field_value); |
|
347 | 347 | break; |
348 | 348 | case 'ID' : |
349 | 349 | /** @var EE_WP_User $wpUser */ |
350 | - $wpUser = $model->get_one_by_ID( $model_field_value ); |
|
350 | + $wpUser = $model->get_one_by_ID($model_field_value); |
|
351 | 351 | $label_parts[] = $wpUser instanceof EE_WP_User |
352 | - ? sprintf( esc_html__( 'WP User: %s', 'event_espresso' ), $wpUser->name() ) |
|
353 | - : sprintf( esc_html__( 'WP User ID: %s', 'event_espresso' ), $model_field_value ); |
|
352 | + ? sprintf(esc_html__('WP User: %s', 'event_espresso'), $wpUser->name()) |
|
353 | + : sprintf(esc_html__('WP User ID: %s', 'event_espresso'), $model_field_value); |
|
354 | 354 | break; |
355 | 355 | case 'TXN_ID' : |
356 | 356 | $label_parts[] = sprintf( |
357 | - esc_html__( 'Transaction with the ID: %s', 'event_espresso' ), |
|
357 | + esc_html__('Transaction with the ID: %s', 'event_espresso'), |
|
358 | 358 | $model_field_value |
359 | 359 | ); |
360 | 360 | break; |
361 | 361 | case 'EVT_ID' : |
362 | 362 | /** @var EE_Event $Event */ |
363 | - $Event = $model->get_one_by_ID( $model_field_value ); |
|
363 | + $Event = $model->get_one_by_ID($model_field_value); |
|
364 | 364 | $label_parts[] = $Event instanceof EE_Event |
365 | - ? sprintf( esc_html__( 'for the Event: %s', 'event_espresso' ), $Event->name() ) |
|
366 | - : sprintf( esc_html__( 'for the Event with ID: %s', 'event_espresso' ), $model_field_value ); |
|
365 | + ? sprintf(esc_html__('for the Event: %s', 'event_espresso'), $Event->name()) |
|
366 | + : sprintf(esc_html__('for the Event with ID: %s', 'event_espresso'), $model_field_value); |
|
367 | 367 | break; |
368 | 368 | } |
369 | 369 | } |
370 | 370 | } |
371 | 371 | |
372 | - if ( $label_parts ) { |
|
372 | + if ($label_parts) { |
|
373 | 373 | |
374 | 374 | //prepend to the last element of $label_parts an "and". |
375 | - if ( count( $label_parts ) > 1 ) { |
|
376 | - $label_parts_index_to_prepend = count( $label_parts ) - 1; |
|
377 | - $label_parts[ $label_parts_index_to_prepend ] = 'and' . $label_parts[ $label_parts_index_to_prepend ]; |
|
375 | + if (count($label_parts) > 1) { |
|
376 | + $label_parts_index_to_prepend = count($label_parts) - 1; |
|
377 | + $label_parts[$label_parts_index_to_prepend] = 'and'.$label_parts[$label_parts_index_to_prepend]; |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | $pretty_label .= sprintf( |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | 'A label for the messages returned in a query that are filtered by items in the query. This could be Transaction, Event, Attendee, Registration, or WP_User.', |
384 | 384 | 'event_espresso' |
385 | 385 | ), |
386 | - implode( ', ', $label_parts ) |
|
386 | + implode(', ', $label_parts) |
|
387 | 387 | ); |
388 | 388 | } |
389 | 389 | return $pretty_label; |
@@ -56,26 +56,26 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Registrations_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
61 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' )); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | + add_action('wp_loaded', array($this, 'wp_loaded')); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | 66 | public function wp_loaded() { |
67 | 67 | // when adding a new registration... |
68 | - if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) { |
|
68 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') { |
|
69 | 69 | EE_System::do_not_cache(); |
70 | 70 | if ( |
71 | - ! isset( $this->_req_data[ 'processing_registration' ] ) |
|
72 | - || absint( $this->_req_data[ 'processing_registration' ] ) !== 1 |
|
71 | + ! isset($this->_req_data['processing_registration']) |
|
72 | + || absint($this->_req_data['processing_registration']) !== 1 |
|
73 | 73 | ) { |
74 | 74 | // and it's NOT the attendee information reg step |
75 | 75 | // force cookie expiration by setting time to last week |
76 | - setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' ); |
|
76 | + setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/'); |
|
77 | 77 | // and update the global |
78 | - $_COOKIE[ 'ee_registration_added' ] = 0; |
|
78 | + $_COOKIE['ee_registration_added'] = 0; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | 'trash' => 'post.php' |
110 | 110 | ); |
111 | 111 | |
112 | - add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); |
|
112 | + add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
|
113 | 113 | //add filters so that the comment urls don't take users to a confusing 404 page |
114 | - add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); |
|
114 | + add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | - public function clear_comment_link( $link, $comment, $args ) { |
|
118 | + public function clear_comment_link($link, $comment, $args) { |
|
119 | 119 | //gotta make sure this only happens on this route |
120 | - $post_type = get_post_type( $comment->comment_post_ID); |
|
121 | - if ( $post_type == 'espresso_attendees' ) |
|
120 | + $post_type = get_post_type($comment->comment_post_ID); |
|
121 | + if ($post_type == 'espresso_attendees') |
|
122 | 122 | return '#commentsdiv'; |
123 | 123 | return $link; |
124 | 124 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | protected function _ajax_hooks() { |
128 | 128 | //todo: all hooks for registrations ajax goes in here |
129 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' )); |
|
129 | + add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | 'add-attendee' => __('Add Contact', 'event_espresso'), |
142 | 142 | 'edit' => __('Edit Contact', 'event_espresso'), |
143 | 143 | 'report'=> __("Event Registrations CSV Report", "event_espresso"), |
144 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ), |
|
145 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ), |
|
144 | + 'report_all' => __('All Registrations CSV Report', 'event_espresso'), |
|
145 | + 'contact_list_report' => __('Contact List Report', 'event_espresso'), |
|
146 | 146 | 'contact_list_export'=> __("Export Data", "event_espresso"), |
147 | 147 | ), |
148 | 148 | 'publishbox' => array( |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | |
171 | 171 | $this->_get_registration_status_array(); |
172 | 172 | |
173 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
173 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
176 | 176 | |
177 | 177 | $this->_page_routes = array( |
178 | 178 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | 'restore_registrations' => array( |
207 | 207 | 'func' => '_trash_or_restore_registrations', |
208 | - 'args' => array( 'trash' => FALSE ), |
|
208 | + 'args' => array('trash' => FALSE), |
|
209 | 209 | 'noheader' => TRUE, |
210 | 210 | 'capability' => 'ee_delete_registrations' |
211 | 211 | ), |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | 'filename' => 'registrations_overview_other' |
439 | 439 | ) |
440 | 440 | ), |
441 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
|
441 | + 'help_tour' => array('Registration_Overview_Help_Tour'), |
|
442 | 442 | 'qtips' => array('Registration_List_Table_Tips'), |
443 | 443 | 'list_table' => 'EE_Registrations_List_Table', |
444 | 444 | 'require_nonce' => FALSE |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | 'nav' => array( |
449 | 449 | 'label' => __('REG Details', 'event_espresso'), |
450 | 450 | 'order' => 15, |
451 | - 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
451 | + 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
452 | 452 | 'persistent' => FALSE |
453 | 453 | ), |
454 | 454 | 'help_tabs' => array( |
@@ -469,8 +469,8 @@ discard block |
||
469 | 469 | 'filename' => 'registrations_details_registrant_details' |
470 | 470 | ) |
471 | 471 | ), |
472 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ), |
|
473 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ), |
|
472 | + 'help_tour' => array('Registration_Details_Help_Tour'), |
|
473 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), |
|
474 | 474 | 'require_nonce' => FALSE |
475 | 475 | ), |
476 | 476 | |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | 'order' => 15, |
495 | 495 | 'persistent' => FALSE |
496 | 496 | ), |
497 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), |
|
497 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), |
|
498 | 498 | 'require_nonce' => FALSE |
499 | 499 | ), |
500 | 500 | |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | 'label' => __('Edit Contact', 'event_espresso'), |
504 | 504 | 'order' => 15, |
505 | 505 | 'persistent' => FALSE, |
506 | - 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
506 | + 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
507 | 507 | ), |
508 | 508 | 'metaboxes' => array('attendee_editor_metaboxes'), |
509 | 509 | 'require_nonce' => FALSE |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | 'filename' => 'registrations_contact_list_other' |
534 | 534 | ) |
535 | 535 | ), |
536 | - 'help_tour' => array( 'Contact_List_Help_Tour' ), |
|
536 | + 'help_tour' => array('Contact_List_Help_Tour'), |
|
537 | 537 | 'metaboxes' => array(), |
538 | 538 | 'require_nonce' => FALSE |
539 | 539 | ), |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | protected function _add_screen_options() {} |
553 | 553 | protected function _add_feature_pointers() {} |
554 | 554 | public function admin_init() { |
555 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' ); |
|
555 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); |
|
556 | 556 | } |
557 | 557 | public function admin_notices() {} |
558 | 558 | public function admin_footer_scripts() {} |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * @return void |
571 | 571 | */ |
572 | 572 | private function _get_registration_status_array() { |
573 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
|
573 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE); |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | |
@@ -593,11 +593,11 @@ discard block |
||
593 | 593 | public function load_scripts_styles() { |
594 | 594 | //style |
595 | 595 | //wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
596 | - wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
596 | + wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
597 | 597 | wp_enqueue_style('espresso_reg'); |
598 | 598 | |
599 | 599 | //script |
600 | - wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
600 | + wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
601 | 601 | wp_enqueue_script('espresso_reg'); |
602 | 602 | } |
603 | 603 | |
@@ -606,9 +606,9 @@ discard block |
||
606 | 606 | public function load_scripts_styles_edit_attendee() { |
607 | 607 | //stuff to only show up on our attendee edit details page. |
608 | 608 | $attendee_details_translations = array( |
609 | - 'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) |
|
609 | + 'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) |
|
610 | 610 | ); |
611 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations ); |
|
611 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
612 | 612 | wp_enqueue_script('jquery-validate'); |
613 | 613 | } |
614 | 614 | |
@@ -617,8 +617,8 @@ discard block |
||
617 | 617 | //styles |
618 | 618 | wp_enqueue_style('espresso-ui-theme'); |
619 | 619 | //scripts |
620 | - $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
621 | - $this->_reg_custom_questions_form->wp_enqueue_scripts( true ); |
|
620 | + $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
621 | + $this->_reg_custom_questions_form->wp_enqueue_scripts(true); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | |
629 | 629 | public function load_scripts_styles_contact_list() { |
630 | 630 | wp_deregister_style('espresso_reg'); |
631 | - wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
631 | + wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
632 | 632 | wp_enqueue_style('espresso_att'); |
633 | 633 | } |
634 | 634 | |
@@ -637,9 +637,9 @@ discard block |
||
637 | 637 | |
638 | 638 | |
639 | 639 | public function load_scripts_styles_new_registration() { |
640 | - wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
640 | + wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
641 | 641 | wp_enqueue_script('ee-spco-for-admin'); |
642 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
642 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
643 | 643 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
644 | 644 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
645 | 645 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | //for notification related bulk actions we need to make sure only active messengers have an option. |
667 | 667 | EED_Messages::set_autoloaders(); |
668 | 668 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
669 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
669 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
670 | 670 | $active_mts = $message_resource_manager->list_of_active_message_types(); |
671 | 671 | //key= bulk_action_slug, value= message type. |
672 | 672 | $match_array = array( |
@@ -679,23 +679,23 @@ discard block |
||
679 | 679 | |
680 | 680 | /** setup reg status bulk actions **/ |
681 | 681 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
682 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
682 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
683 | 683 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
684 | 684 | } |
685 | 685 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
686 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
686 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
687 | 687 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
688 | 688 | } |
689 | 689 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
690 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
690 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
691 | 691 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
692 | 692 | } |
693 | 693 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
694 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
694 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
695 | 695 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
696 | 696 | } |
697 | 697 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
698 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
698 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
699 | 699 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
700 | 700 | } |
701 | 701 | |
@@ -704,29 +704,29 @@ discard block |
||
704 | 704 | 'slug' => 'all', |
705 | 705 | 'label' => __('View All Registrations', 'event_espresso'), |
706 | 706 | 'count' => 0, |
707 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
707 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
708 | 708 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
709 | - ) ) |
|
709 | + )) |
|
710 | 710 | ), |
711 | 711 | 'month' => array( |
712 | 712 | 'slug' => 'month', |
713 | 713 | 'label' => __('This Month', 'event_espresso'), |
714 | 714 | 'count' => 0, |
715 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
715 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
716 | 716 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
717 | 717 | )) |
718 | 718 | ), |
719 | 719 | 'today' => array( |
720 | 720 | 'slug' => 'today', |
721 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
721 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
722 | 722 | 'count' => 0, |
723 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
723 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
724 | 724 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
725 | 725 | )) |
726 | 726 | ) |
727 | 727 | ); |
728 | 728 | |
729 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
729 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
730 | 730 | $this->_views['incomplete'] = array( |
731 | 731 | 'slug' => 'incomplete', |
732 | 732 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | ) |
763 | 763 | ); |
764 | 764 | |
765 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
765 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
766 | 766 | $this->_views['trash'] = array( |
767 | 767 | 'slug' => 'trash', |
768 | 768 | 'label' => __('Trash', 'event_espresso'), |
@@ -801,18 +801,18 @@ discard block |
||
801 | 801 | 'desc' => __('View Transaction Invoice', 'event_espresso') |
802 | 802 | ), |
803 | 803 | ); |
804 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
804 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
805 | 805 | $fc_items['resend_registration'] = array( |
806 | 806 | 'class' => 'dashicons dashicons-email-alt', |
807 | 807 | 'desc' => __('Resend Registration Details', 'event_espresso') |
808 | 808 | ); |
809 | 809 | } else { |
810 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
810 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
811 | 811 | } |
812 | 812 | |
813 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
814 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
815 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
813 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
814 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
815 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
816 | 816 | $fc_items['view_related_messages'] = array( |
817 | 817 | 'class' => $related_for_icon['css_class'], |
818 | 818 | 'desc' => $related_for_icon['label'], |
@@ -822,31 +822,31 @@ discard block |
||
822 | 822 | |
823 | 823 | $sc_items = array( |
824 | 824 | 'approved_status' => array( |
825 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
826 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
825 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
826 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
827 | 827 | ), |
828 | 828 | 'pending_status' => array( |
829 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
830 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
829 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
830 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
831 | 831 | ), |
832 | 832 | 'incomplete_status' => array( |
833 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
834 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
833 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
834 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
835 | 835 | ), |
836 | 836 | 'not_approved' => array( |
837 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
838 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
837 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
838 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
839 | 839 | ), |
840 | 840 | 'declined_status' => array( |
841 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
842 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
841 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
842 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
843 | 843 | ), |
844 | 844 | 'cancelled_status' => array( |
845 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
846 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
845 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
846 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
847 | 847 | ) |
848 | 848 | ); |
849 | - return array_merge( $fc_items, $sc_items ); |
|
849 | + return array_merge($fc_items, $sc_items); |
|
850 | 850 | } |
851 | 851 | |
852 | 852 | |
@@ -859,15 +859,15 @@ discard block |
||
859 | 859 | |
860 | 860 | |
861 | 861 | protected function _registrations_overview_list_table() { |
862 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
863 | - if ( $EVT_ID ) { |
|
864 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) { |
|
865 | - $this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' ); |
|
862 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
863 | + if ($EVT_ID) { |
|
864 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) { |
|
865 | + $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2'); |
|
866 | 866 | } |
867 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
868 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : ''; |
|
867 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
868 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : ''; |
|
869 | 869 | } |
870 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
870 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
871 | 871 | $this->display_admin_list_table_page_with_no_sidebar(); |
872 | 872 | } |
873 | 873 | |
@@ -882,19 +882,19 @@ discard block |
||
882 | 882 | */ |
883 | 883 | private function _set_registration_object() { |
884 | 884 | //get out if we've already set the object |
885 | - if ( is_object( $this->_registration )) { |
|
885 | + if (is_object($this->_registration)) { |
|
886 | 886 | return TRUE; |
887 | 887 | } |
888 | 888 | |
889 | 889 | $REG = EEM_Registration::instance(); |
890 | 890 | |
891 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
891 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
892 | 892 | |
893 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
893 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
894 | 894 | return TRUE; |
895 | 895 | else { |
896 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
897 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
896 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
897 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
898 | 898 | $this->_registration = NULL; |
899 | 899 | return FALSE; |
900 | 900 | } |
@@ -912,24 +912,24 @@ discard block |
||
912 | 912 | * @throws \EE_Error |
913 | 913 | * @return mixed (int|array) int = count || array of registration objects |
914 | 914 | */ |
915 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
916 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
917 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
918 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
919 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
920 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE; |
|
921 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE : FALSE; |
|
915 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
916 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
917 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
918 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
919 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
920 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE; |
|
921 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE : FALSE; |
|
922 | 922 | $start_date = FALSE; |
923 | 923 | $end_date = FALSE; |
924 | 924 | $_where = array(); |
925 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE; |
|
926 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE; |
|
925 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE; |
|
926 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE; |
|
927 | 927 | |
928 | 928 | //set orderby |
929 | 929 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
930 | 930 | |
931 | 931 | |
932 | - switch ( $this->_req_data['orderby'] ) { |
|
932 | + switch ($this->_req_data['orderby']) { |
|
933 | 933 | case '_REG_ID': |
934 | 934 | $orderby = 'REG_ID'; |
935 | 935 | break; |
@@ -949,26 +949,26 @@ discard block |
||
949 | 949 | $orderby = 'REG_date'; |
950 | 950 | } |
951 | 951 | |
952 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
953 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
954 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
952 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
953 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
954 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
955 | 955 | |
956 | 956 | |
957 | - $offset = ($current_page-1)*$per_page; |
|
958 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
957 | + $offset = ($current_page - 1) * $per_page; |
|
958 | + $limit = $count ? NULL : array($offset, $per_page); |
|
959 | 959 | |
960 | - if($EVT_ID){ |
|
961 | - $_where['EVT_ID']=$EVT_ID; |
|
960 | + if ($EVT_ID) { |
|
961 | + $_where['EVT_ID'] = $EVT_ID; |
|
962 | 962 | } |
963 | - if($CAT_ID){ |
|
963 | + if ($CAT_ID) { |
|
964 | 964 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
965 | 965 | } |
966 | - if ( $incomplete ) { |
|
966 | + if ($incomplete) { |
|
967 | 967 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
968 | 968 | } else if ( ! $trash) { |
969 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
969 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
970 | 970 | } |
971 | - if($reg_status){ |
|
971 | + if ($reg_status) { |
|
972 | 972 | $_where['STS_ID'] = $reg_status; |
973 | 973 | } |
974 | 974 | |
@@ -980,105 +980,105 @@ discard block |
||
980 | 980 | $time_start = ' 00:00:00'; |
981 | 981 | $time_end = ' 23:59:59'; |
982 | 982 | |
983 | - if($today_a || $today ){ |
|
983 | + if ($today_a || $today) { |
|
984 | 984 | $curdate = date('Y-m-d', current_time('timestamp')); |
985 | - $_where['REG_date']= array('BETWEEN', |
|
985 | + $_where['REG_date'] = array('BETWEEN', |
|
986 | 986 | array( |
987 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
988 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
987 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
988 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
989 | 989 | )); |
990 | - }elseif($this_month_a || $this_month){ |
|
990 | + }elseif ($this_month_a || $this_month) { |
|
991 | 991 | $this_month_r = date('m', current_time('timestamp')); |
992 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
993 | - $_where['REG_date']= array('BETWEEN', |
|
992 | + $days_this_month = date('t', current_time('timestamp')); |
|
993 | + $_where['REG_date'] = array('BETWEEN', |
|
994 | 994 | array( |
995 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
996 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
|
995 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
996 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s') |
|
997 | 997 | )); |
998 | - }elseif($month_range){ |
|
998 | + }elseif ($month_range) { |
|
999 | 999 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
1000 | - $month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : ''; |
|
1001 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
1002 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
1003 | - $_where['REG_date']= array('BETWEEN', |
|
1004 | - array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
|
1005 | - }elseif($start_date && $end_date){ |
|
1000 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : ''; |
|
1001 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1002 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
1003 | + $_where['REG_date'] = array('BETWEEN', |
|
1004 | + array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s'))); |
|
1005 | + }elseif ($start_date && $end_date) { |
|
1006 | 1006 | throw new EE_Error("not yet supported"); |
1007 | - }elseif($start_date){ |
|
1007 | + }elseif ($start_date) { |
|
1008 | 1008 | throw new EE_Error("not yet supported"); |
1009 | - }elseif($end_date){ |
|
1009 | + }elseif ($end_date) { |
|
1010 | 1010 | throw new EE_Error("not yet supported"); |
1011 | 1011 | } |
1012 | 1012 | |
1013 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
1014 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1013 | + if ( ! empty($this->_req_data['s'])) { |
|
1014 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1015 | 1015 | $_where['OR'] = array( |
1016 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
1017 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
1018 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
1019 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ), |
|
1020 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
1021 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
1022 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
1023 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
1024 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
1025 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
1026 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
1027 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
1028 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
1029 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
1030 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
1031 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
1032 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
1033 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr ) |
|
1016 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1017 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1018 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
1019 | + 'Attendee.ATT_full_name' => array('LIKE', $sstr), |
|
1020 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
1021 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
1022 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
1023 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
1024 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
1025 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
1026 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
1027 | + 'REG_final_price' => array('LIKE', $sstr), |
|
1028 | + 'REG_code' => array('LIKE', $sstr), |
|
1029 | + 'REG_count' => array('LIKE', $sstr), |
|
1030 | + 'REG_group_size' => array('LIKE', $sstr), |
|
1031 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
1032 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
1033 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) |
|
1034 | 1034 | ); |
1035 | 1035 | } |
1036 | 1036 | |
1037 | 1037 | //capability checks |
1038 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
1038 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
1039 | 1039 | $_where['AND'] = array( |
1040 | 1040 | 'Event.EVT_wp_user' => get_current_user_id() |
1041 | 1041 | ); |
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | |
1045 | - if( $count ){ |
|
1046 | - if ( $trash ) { |
|
1047 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
1048 | - } else if ( $incomplete ) { |
|
1049 | - return EEM_Registration::instance()->count( array( $_where )); |
|
1045 | + if ($count) { |
|
1046 | + if ($trash) { |
|
1047 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
1048 | + } else if ($incomplete) { |
|
1049 | + return EEM_Registration::instance()->count(array($_where)); |
|
1050 | 1050 | } else { |
1051 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
1051 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
1052 | 1052 | } |
1053 | 1053 | } else { |
1054 | 1054 | //make sure we remove default where conditions cause all registrations matching query are returned |
1055 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1056 | - if ( $per_page !== -1 ) { |
|
1055 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1056 | + if ($per_page !== -1) { |
|
1057 | 1057 | $query_params['limit'] = $limit; |
1058 | 1058 | } |
1059 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1059 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1060 | 1060 | |
1061 | 1061 | |
1062 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1062 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1063 | 1063 | $first_registration = $registrations[0]; |
1064 | 1064 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1065 | 1065 | $event_name = $first_registration->event_obj()->name(); |
1066 | - $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1066 | + $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1067 | 1067 | // edit event link |
1068 | - if ( $event_name != '' ) { |
|
1069 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1070 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1071 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1068 | + if ($event_name != '') { |
|
1069 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1070 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1071 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1072 | 1072 | } |
1073 | 1073 | |
1074 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1075 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
1074 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1075 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
1076 | 1076 | |
1077 | 1077 | $this->_template_args['before_admin_page_content'] = ' |
1078 | 1078 | <div id="admin-page-header"> |
1079 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1080 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1081 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1079 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1080 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1081 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1082 | 1082 | </div> |
1083 | 1083 | '; |
1084 | 1084 | |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | |
1117 | 1117 | $this->_set_registration_object(); |
1118 | 1118 | |
1119 | - if ( is_object( $this->_registration )) { |
|
1119 | + if (is_object($this->_registration)) { |
|
1120 | 1120 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1121 | 1121 | $this->_session = $transaction->session_data(); |
1122 | 1122 | |
@@ -1124,10 +1124,10 @@ discard block |
||
1124 | 1124 | |
1125 | 1125 | |
1126 | 1126 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1127 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1127 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1128 | 1128 | |
1129 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime( 'REG_date' ); |
|
1130 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1129 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date'); |
|
1130 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1131 | 1131 | |
1132 | 1132 | $this->_template_args['grand_total'] = $transaction->total(); |
1133 | 1133 | |
@@ -1135,19 +1135,19 @@ discard block |
||
1135 | 1135 | // link back to overview |
1136 | 1136 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1137 | 1137 | $this->_template_args['registration'] = $this->_registration; |
1138 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1139 | - $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) ); |
|
1140 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) ); |
|
1138 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1139 | + $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php')); |
|
1140 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php')); |
|
1141 | 1141 | |
1142 | 1142 | //next and previous links |
1143 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1144 | - $this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : ''; |
|
1145 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1146 | - $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : ''; |
|
1143 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1144 | + $this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : ''; |
|
1145 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1146 | + $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : ''; |
|
1147 | 1147 | |
1148 | 1148 | // grab header |
1149 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1150 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1149 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1150 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1151 | 1151 | |
1152 | 1152 | } else { |
1153 | 1153 | |
@@ -1166,17 +1166,17 @@ discard block |
||
1166 | 1166 | |
1167 | 1167 | |
1168 | 1168 | protected function _registration_details_metaboxes() { |
1169 | - do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this ); |
|
1169 | + do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this); |
|
1170 | 1170 | $this->_set_registration_object(); |
1171 | 1171 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1172 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1173 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1174 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1175 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1172 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1173 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1174 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1175 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1176 | 1176 | } |
1177 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1178 | - if ( $this->_registration->group_size() > 1 ) { |
|
1179 | - add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1177 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1178 | + if ($this->_registration->group_size() > 1) { |
|
1179 | + add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1180 | 1180 | } |
1181 | 1181 | } |
1182 | 1182 | |
@@ -1197,23 +1197,23 @@ discard block |
||
1197 | 1197 | |
1198 | 1198 | //let's get an array of all possible buttons that we can just reference |
1199 | 1199 | $status_buttons = $this->_get_reg_status_buttons(); |
1200 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status(); |
|
1201 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID(); |
|
1200 | + $template_args['reg_status_value'] = $this->_registration->pretty_status(); |
|
1201 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID(); |
|
1202 | 1202 | $template_args['attendee'] = $this->_registration->attendee(); |
1203 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php'; |
|
1204 | - if ( $this->_set_registration_object() ) { |
|
1203 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php'; |
|
1204 | + if ($this->_set_registration_object()) { |
|
1205 | 1205 | $current_status = $this->_registration->status_ID(); |
1206 | - unset( $status_buttons[$current_status] ); |
|
1207 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { |
|
1208 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] ); |
|
1206 | + unset($status_buttons[$current_status]); |
|
1207 | + if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { |
|
1208 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]); |
|
1209 | 1209 | } |
1210 | - $template_args['status_buttons'] = implode( "\n", $status_buttons ); |
|
1210 | + $template_args['status_buttons'] = implode("\n", $status_buttons); |
|
1211 | 1211 | } |
1212 | 1212 | $template_args['form_url'] = REG_ADMIN_URL; |
1213 | 1213 | $template_args['REG_ID'] = $this->_registration->ID(); |
1214 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE ); |
|
1214 | + $template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); |
|
1215 | 1215 | |
1216 | - EEH_Template::display_template( $template, $template_args ); |
|
1216 | + EEH_Template::display_template($template, $template_args); |
|
1217 | 1217 | |
1218 | 1218 | } |
1219 | 1219 | |
@@ -1227,11 +1227,11 @@ discard block |
||
1227 | 1227 | private function _get_reg_status_buttons() { |
1228 | 1228 | |
1229 | 1229 | $buttons = array( |
1230 | - EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">', |
|
1231 | - EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">', |
|
1232 | - EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">', |
|
1233 | - EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">', |
|
1234 | - EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">', |
|
1230 | + EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">', |
|
1231 | + EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">', |
|
1232 | + EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">', |
|
1233 | + EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">', |
|
1234 | + EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">', |
|
1235 | 1235 | ); |
1236 | 1236 | return $buttons; |
1237 | 1237 | } |
@@ -1245,13 +1245,13 @@ discard block |
||
1245 | 1245 | * |
1246 | 1246 | * @return array (array with reg_id(s) updated and whether update was successful. |
1247 | 1247 | */ |
1248 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1249 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1248 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1249 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1250 | 1250 | |
1251 | - $success = $this->_set_registration_status( $REG_ID, $status ); |
|
1251 | + $success = $this->_set_registration_status($REG_ID, $status); |
|
1252 | 1252 | |
1253 | 1253 | //notify? |
1254 | - if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
1254 | + if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
1255 | 1255 | $this->_process_resend_registration(); |
1256 | 1256 | } |
1257 | 1257 | |
@@ -1269,19 +1269,19 @@ discard block |
||
1269 | 1269 | * @param bool $status |
1270 | 1270 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1271 | 1271 | */ |
1272 | - protected function _set_registration_status( $REG_ID, $status = false ) { |
|
1272 | + protected function _set_registration_status($REG_ID, $status = false) { |
|
1273 | 1273 | $success = true; |
1274 | 1274 | // set default status if none is passed |
1275 | 1275 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1276 | 1276 | |
1277 | 1277 | //typecast and sanitize reg_id |
1278 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' ); |
|
1278 | + $reg_ids = array_filter((array) $REG_ID, 'absint'); |
|
1279 | 1279 | |
1280 | 1280 | //loop through REG_ID's and change status |
1281 | - foreach ( $reg_ids as $r_id ) { |
|
1282 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id ); |
|
1283 | - if ( $registration instanceof EE_Registration ) { |
|
1284 | - $registration->set_status( $status ); |
|
1281 | + foreach ($reg_ids as $r_id) { |
|
1282 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id); |
|
1283 | + if ($registration instanceof EE_Registration) { |
|
1284 | + $registration->set_status($status); |
|
1285 | 1285 | $result = $registration->save(); |
1286 | 1286 | |
1287 | 1287 | //verifying explicit fails because update *may* just return 0 for 0 rows affected |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | $this->_req_data['_REG_ID'] = $reg_ids; |
1294 | 1294 | |
1295 | 1295 | //return $success and processed registrations |
1296 | - return array( 'REG_ID' => $reg_ids, 'success' => $success ); |
|
1296 | + return array('REG_ID' => $reg_ids, 'success' => $success); |
|
1297 | 1297 | } |
1298 | 1298 | |
1299 | 1299 | |
@@ -1305,37 +1305,37 @@ discard block |
||
1305 | 1305 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1306 | 1306 | * @return void |
1307 | 1307 | */ |
1308 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1308 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1309 | 1309 | |
1310 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false ); |
|
1310 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); |
|
1311 | 1311 | |
1312 | 1312 | |
1313 | - $success = isset( $result['success'] ) && $result['success']; |
|
1313 | + $success = isset($result['success']) && $result['success']; |
|
1314 | 1314 | |
1315 | 1315 | //setup success message |
1316 | - if ( $success ) { |
|
1317 | - $msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1 ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) : sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ; |
|
1318 | - EE_Error::add_success( $msg ); |
|
1316 | + if ($success) { |
|
1317 | + $msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')); |
|
1318 | + EE_Error::add_success($msg); |
|
1319 | 1319 | } else { |
1320 | - EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); |
|
1320 | + EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
1321 | 1321 | } |
1322 | 1322 | |
1323 | - $route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' ); |
|
1323 | + $route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default'); |
|
1324 | 1324 | //unset nonces |
1325 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1326 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1327 | - unset( $this->_req_data[$ref] ); |
|
1325 | + foreach ($this->_req_data as $ref => $value) { |
|
1326 | + if (strpos($ref, 'nonce') !== false) { |
|
1327 | + unset($this->_req_data[$ref]); |
|
1328 | 1328 | continue; |
1329 | 1329 | } |
1330 | 1330 | |
1331 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1331 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1332 | 1332 | $this->_req_data[$ref] = $value; |
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | //merge request vars so that the reloaded list table contains any existing filter query params |
1336 | - $route = array_merge( $this->_req_data, $route ); |
|
1336 | + $route = array_merge($this->_req_data, $route); |
|
1337 | 1337 | |
1338 | - $this->_redirect_after_action( false, '', '', $route, true ); |
|
1338 | + $this->_redirect_after_action(false, '', '', $route, true); |
|
1339 | 1339 | } |
1340 | 1340 | |
1341 | 1341 | |
@@ -1347,29 +1347,29 @@ discard block |
||
1347 | 1347 | protected function _change_reg_status() { |
1348 | 1348 | $this->_req_data['return'] = 'view_registration'; |
1349 | 1349 | //set notify based on whether the send notifications toggle is set or not |
1350 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
|
1351 | - $this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : ''; |
|
1350 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']); |
|
1351 | + $this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : ''; |
|
1352 | 1352 | |
1353 | - switch ( $this->_req_data['_reg_status_id'] ) { |
|
1354 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1355 | - $this->approve_registration( $notify ); |
|
1353 | + switch ($this->_req_data['_reg_status_id']) { |
|
1354 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1355 | + $this->approve_registration($notify); |
|
1356 | 1356 | break; |
1357 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1358 | - $this->pending_registration( $notify ); |
|
1357 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1358 | + $this->pending_registration($notify); |
|
1359 | 1359 | break; |
1360 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1361 | - $this->not_approve_registration( $notify ); |
|
1360 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1361 | + $this->not_approve_registration($notify); |
|
1362 | 1362 | break; |
1363 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1364 | - $this->decline_registration( $notify ); |
|
1363 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1364 | + $this->decline_registration($notify); |
|
1365 | 1365 | break; |
1366 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1367 | - $this->cancel_registration( $notify ); |
|
1366 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1367 | + $this->cancel_registration($notify); |
|
1368 | 1368 | break; |
1369 | 1369 | default : |
1370 | 1370 | $result['success'] = false; |
1371 | - unset( $this->_req_data['return'] ); |
|
1372 | - $this->_reg_status_change_return( '', false ); |
|
1371 | + unset($this->_req_data['return']); |
|
1372 | + $this->_reg_status_change_return('', false); |
|
1373 | 1373 | break; |
1374 | 1374 | } |
1375 | 1375 | } |
@@ -1382,8 +1382,8 @@ discard block |
||
1382 | 1382 | * @param bool $notify whether or not to notify the registrant about their approval. |
1383 | 1383 | * @return void |
1384 | 1384 | */ |
1385 | - protected function approve_registration( $notify = false ) { |
|
1386 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1385 | + protected function approve_registration($notify = false) { |
|
1386 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1387 | 1387 | } |
1388 | 1388 | |
1389 | 1389 | |
@@ -1395,8 +1395,8 @@ discard block |
||
1395 | 1395 | * @param bool $notify whether or not to notify the registrant about their approval. |
1396 | 1396 | * @return void |
1397 | 1397 | */ |
1398 | - protected function decline_registration( $notify = false ) { |
|
1399 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1398 | + protected function decline_registration($notify = false) { |
|
1399 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | |
@@ -1408,8 +1408,8 @@ discard block |
||
1408 | 1408 | * @param bool $notify whether or not to notify the registrant about their approval. |
1409 | 1409 | * @return void |
1410 | 1410 | */ |
1411 | - protected function cancel_registration( $notify = false ) { |
|
1412 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1411 | + protected function cancel_registration($notify = false) { |
|
1412 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1413 | 1413 | } |
1414 | 1414 | |
1415 | 1415 | |
@@ -1422,8 +1422,8 @@ discard block |
||
1422 | 1422 | * @param bool $notify whether or not to notify the registrant about their approval. |
1423 | 1423 | * @return void |
1424 | 1424 | */ |
1425 | - protected function not_approve_registration( $notify = false ) { |
|
1426 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1425 | + protected function not_approve_registration($notify = false) { |
|
1426 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1427 | 1427 | } |
1428 | 1428 | |
1429 | 1429 | |
@@ -1434,8 +1434,8 @@ discard block |
||
1434 | 1434 | * @param bool $notify whether or not to notify the registrant about their approval. |
1435 | 1435 | * @return void |
1436 | 1436 | */ |
1437 | - protected function pending_registration( $notify = false ) { |
|
1438 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1437 | + protected function pending_registration($notify = false) { |
|
1438 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1439 | 1439 | } |
1440 | 1440 | |
1441 | 1441 | |
@@ -1449,75 +1449,75 @@ discard block |
||
1449 | 1449 | public function _reg_details_meta_box() { |
1450 | 1450 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1451 | 1451 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1452 | - EE_Registry::instance()->load_Helper( 'Line_Item' ); |
|
1452 | + EE_Registry::instance()->load_Helper('Line_Item'); |
|
1453 | 1453 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1454 | 1454 | $this->_session = $transaction->session_data(); |
1455 | 1455 | |
1456 | 1456 | $filters = new EE_Line_Item_Filter_Collection(); |
1457 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1458 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
1459 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1457 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1458 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
1459 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1460 | 1460 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1461 | 1461 | |
1462 | 1462 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1463 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' ); |
|
1464 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) ); |
|
1463 | + $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); |
|
1464 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); |
|
1465 | 1465 | |
1466 | 1466 | |
1467 | 1467 | $attendee = $this->_registration->attendee(); |
1468 | 1468 | |
1469 | 1469 | |
1470 | - $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : ''; |
|
1471 | - $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : ''; |
|
1470 | + $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : ''; |
|
1471 | + $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : ''; |
|
1472 | 1472 | |
1473 | 1473 | |
1474 | 1474 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1475 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1475 | + $payment = $transaction->get_first_related('Payment'); |
|
1476 | 1476 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1477 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1477 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1478 | 1478 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1479 | - $reg_status_class = 'status-' . $this->_registration->status_ID(); |
|
1479 | + $reg_status_class = 'status-'.$this->_registration->status_ID(); |
|
1480 | 1480 | $reg_details = array( |
1481 | 1481 | 'payment_method' => $payment_method->name(), |
1482 | 1482 | 'response_msg' => $payment->gateway_response(), |
1483 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1483 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1484 | 1484 | 'registration_session' => $this->_registration->session_ID(), |
1485 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1486 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1485 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1486 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1487 | 1487 | ); |
1488 | 1488 | |
1489 | 1489 | |
1490 | - if ( isset( $reg_details['registration_id'] )) { |
|
1490 | + if (isset($reg_details['registration_id'])) { |
|
1491 | 1491 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1492 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1492 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1493 | 1493 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1494 | 1494 | } |
1495 | 1495 | |
1496 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1496 | + if (isset($reg_details['payment_method'])) { |
|
1497 | 1497 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1498 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1498 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1499 | 1499 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1500 | 1500 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1501 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1501 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1502 | 1502 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1503 | 1503 | } |
1504 | 1504 | |
1505 | 1505 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1506 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1506 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1507 | 1507 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1508 | 1508 | |
1509 | 1509 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1510 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1510 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1511 | 1511 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1512 | 1512 | |
1513 | 1513 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1514 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1514 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1515 | 1515 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1516 | 1516 | |
1517 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL ); |
|
1517 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); |
|
1518 | 1518 | |
1519 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1520 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1519 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1520 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1521 | 1521 | |
1522 | 1522 | } |
1523 | 1523 | |
@@ -1531,14 +1531,14 @@ discard block |
||
1531 | 1531 | */ |
1532 | 1532 | public function _reg_questions_meta_box() { |
1533 | 1533 | //allow someone to override this method entirely |
1534 | - if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
|
1535 | - $form = $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
1536 | - $this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : ''; |
|
1534 | + if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) { |
|
1535 | + $form = $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
1536 | + $this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : ''; |
|
1537 | 1537 | $this->_template_args['reg_questions_form_action'] = 'edit_registration'; |
1538 | 1538 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1539 | 1539 | |
1540 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1541 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1540 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1541 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1542 | 1542 | } |
1543 | 1543 | } |
1544 | 1544 | |
@@ -1552,12 +1552,12 @@ discard block |
||
1552 | 1552 | * @param string $output |
1553 | 1553 | * @return string |
1554 | 1554 | */ |
1555 | - public function form_before_question_group( $output ) { |
|
1555 | + public function form_before_question_group($output) { |
|
1556 | 1556 | EE_Error::doing_it_wrong( |
1557 | - __CLASS__ . '::' . __FUNCTION__, |
|
1558 | - __( 'This method would have been protected but was used on a filter callback' |
|
1557 | + __CLASS__.'::'.__FUNCTION__, |
|
1558 | + __('This method would have been protected but was used on a filter callback' |
|
1559 | 1559 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1560 | - 'event_espresso' ), |
|
1560 | + 'event_espresso'), |
|
1561 | 1561 | '4.8.32.rc.000' |
1562 | 1562 | ); |
1563 | 1563 | return ' |
@@ -1576,20 +1576,20 @@ discard block |
||
1576 | 1576 | * @param string $output |
1577 | 1577 | * @return string |
1578 | 1578 | */ |
1579 | - public function form_after_question_group( $output ) { |
|
1579 | + public function form_after_question_group($output) { |
|
1580 | 1580 | EE_Error::doing_it_wrong( |
1581 | - __CLASS__ . '::' . __FUNCTION__, |
|
1582 | - __( 'This method would have been protected but was used on a filter callback' |
|
1581 | + __CLASS__.'::'.__FUNCTION__, |
|
1582 | + __('This method would have been protected but was used on a filter callback' |
|
1583 | 1583 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1584 | - 'event_espresso' ), |
|
1584 | + 'event_espresso'), |
|
1585 | 1585 | '4.8.32.rc.000' |
1586 | 1586 | ); |
1587 | 1587 | return ' |
1588 | 1588 | <tr class="hide-if-no-js"> |
1589 | 1589 | <th> </th> |
1590 | 1590 | <td class="reg-admin-edit-attendee-question-td"> |
1591 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1592 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1591 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1592 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1593 | 1593 | <div class="dashicons dashicons-edit"></div> |
1594 | 1594 | </a> |
1595 | 1595 | </td> |
@@ -1609,18 +1609,18 @@ discard block |
||
1609 | 1609 | * @param string $label |
1610 | 1610 | * @return string |
1611 | 1611 | */ |
1612 | - public function form_form_field_label_wrap( $label ) { |
|
1612 | + public function form_form_field_label_wrap($label) { |
|
1613 | 1613 | EE_Error::doing_it_wrong( |
1614 | - __CLASS__ . '::' . __FUNCTION__, |
|
1615 | - __( 'This method would have been protected but was used on a filter callback' |
|
1614 | + __CLASS__.'::'.__FUNCTION__, |
|
1615 | + __('This method would have been protected but was used on a filter callback' |
|
1616 | 1616 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1617 | - 'event_espresso' ), |
|
1617 | + 'event_espresso'), |
|
1618 | 1618 | '4.8.32.rc.000' |
1619 | 1619 | ); |
1620 | 1620 | return ' |
1621 | 1621 | <tr> |
1622 | 1622 | <th> |
1623 | - ' . $label . ' |
|
1623 | + ' . $label.' |
|
1624 | 1624 | </th>'; |
1625 | 1625 | } |
1626 | 1626 | |
@@ -1634,17 +1634,17 @@ discard block |
||
1634 | 1634 | * @param string $input |
1635 | 1635 | * @return string |
1636 | 1636 | */ |
1637 | - public function form_form_field_input__wrap( $input ) { |
|
1637 | + public function form_form_field_input__wrap($input) { |
|
1638 | 1638 | EE_Error::doing_it_wrong( |
1639 | - __CLASS__ . '::' . __FUNCTION__, |
|
1640 | - __( 'This method would have been protected but was used on a filter callback' |
|
1639 | + __CLASS__.'::'.__FUNCTION__, |
|
1640 | + __('This method would have been protected but was used on a filter callback' |
|
1641 | 1641 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1642 | - 'event_espresso' ), |
|
1642 | + 'event_espresso'), |
|
1643 | 1643 | '4.8.32.rc.000' |
1644 | 1644 | ); |
1645 | 1645 | return ' |
1646 | 1646 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1647 | - ' . $input . ' |
|
1647 | + ' . $input.' |
|
1648 | 1648 | </td> |
1649 | 1649 | </tr>'; |
1650 | 1650 | } |
@@ -1658,14 +1658,14 @@ discard block |
||
1658 | 1658 | * @return void |
1659 | 1659 | */ |
1660 | 1660 | protected function _update_attendee_registration_form() { |
1661 | - do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this ); |
|
1662 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
1663 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1664 | - $success = $this->_save_reg_custom_questions_form( $REG_ID ); |
|
1665 | - if( $success ) { |
|
1661 | + do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this); |
|
1662 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
1663 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1664 | + $success = $this->_save_reg_custom_questions_form($REG_ID); |
|
1665 | + if ($success) { |
|
1666 | 1666 | $what = __('Registration Form', 'event_espresso'); |
1667 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1668 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1667 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1668 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1669 | 1669 | } |
1670 | 1670 | } |
1671 | 1671 | } |
@@ -1676,11 +1676,11 @@ discard block |
||
1676 | 1676 | * @param int $REG_ID |
1677 | 1677 | * @return EE_Registration_Custom_Questions_Form |
1678 | 1678 | */ |
1679 | - protected function _get_reg_custom_questions_form( $REG_ID ) { |
|
1680 | - if( ! $this->_reg_custom_questions_form ) { |
|
1681 | - require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' ); |
|
1682 | - $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) ); |
|
1683 | - $this->_reg_custom_questions_form->_construct_finalize( null, null ); |
|
1679 | + protected function _get_reg_custom_questions_form($REG_ID) { |
|
1680 | + if ( ! $this->_reg_custom_questions_form) { |
|
1681 | + require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php'); |
|
1682 | + $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID)); |
|
1683 | + $this->_reg_custom_questions_form->_construct_finalize(null, null); |
|
1684 | 1684 | } |
1685 | 1685 | return $this->_reg_custom_questions_form; |
1686 | 1686 | } |
@@ -1693,17 +1693,17 @@ discard block |
||
1693 | 1693 | * @param bool $REG_ID |
1694 | 1694 | * @return bool |
1695 | 1695 | */ |
1696 | - private function _save_reg_custom_questions_form( $REG_ID = FALSE ) { |
|
1696 | + private function _save_reg_custom_questions_form($REG_ID = FALSE) { |
|
1697 | 1697 | |
1698 | 1698 | if ( ! $REG_ID) { |
1699 | - EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1699 | + EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1700 | 1700 | } |
1701 | - $form = $this->_get_reg_custom_questions_form( $REG_ID ); |
|
1702 | - $form->receive_form_submission( $this->_req_data ); |
|
1701 | + $form = $this->_get_reg_custom_questions_form($REG_ID); |
|
1702 | + $form->receive_form_submission($this->_req_data); |
|
1703 | 1703 | $success = false; |
1704 | - if( $form->is_valid() ) { |
|
1705 | - foreach( $form->subforms() as $question_group_id => $question_group_form ) { |
|
1706 | - foreach( $question_group_form->inputs() as $question_id => $input ) { |
|
1704 | + if ($form->is_valid()) { |
|
1705 | + foreach ($form->subforms() as $question_group_id => $question_group_form) { |
|
1706 | + foreach ($question_group_form->inputs() as $question_id => $input) { |
|
1707 | 1707 | $where_conditions = array( |
1708 | 1708 | 'QST_ID' => $question_id, |
1709 | 1709 | 'REG_ID' => $REG_ID |
@@ -1711,19 +1711,19 @@ discard block |
||
1711 | 1711 | $possibly_new_values = array( |
1712 | 1712 | 'ANS_value' => $input->normalized_value() |
1713 | 1713 | ); |
1714 | - $answer = EEM_Answer::instance()->get_one( array( $where_conditions ) ); |
|
1715 | - if( $answer instanceof EE_Answer ) { |
|
1716 | - $success = $answer->save( $possibly_new_values ); |
|
1714 | + $answer = EEM_Answer::instance()->get_one(array($where_conditions)); |
|
1715 | + if ($answer instanceof EE_Answer) { |
|
1716 | + $success = $answer->save($possibly_new_values); |
|
1717 | 1717 | } else { |
1718 | 1718 | //insert it then |
1719 | - $cols_n_vals = array_merge( $where_conditions, $possibly_new_values ); |
|
1720 | - $answer = EE_Answer::new_instance( $cols_n_vals ); |
|
1719 | + $cols_n_vals = array_merge($where_conditions, $possibly_new_values); |
|
1720 | + $answer = EE_Answer::new_instance($cols_n_vals); |
|
1721 | 1721 | $success = $answer->save(); |
1722 | 1722 | } |
1723 | 1723 | } |
1724 | 1724 | } |
1725 | 1725 | } else { |
1726 | - EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1726 | + EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__); |
|
1727 | 1727 | } |
1728 | 1728 | return $success; |
1729 | 1729 | } |
@@ -1741,29 +1741,29 @@ discard block |
||
1741 | 1741 | $registrations = $REG->get_all(array( |
1742 | 1742 | array( |
1743 | 1743 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1744 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1744 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1745 | 1745 | ), |
1746 | 1746 | 'force_join'=>array('Attendee'))); |
1747 | 1747 | |
1748 | 1748 | $this->_template_args['attendees'] = array(); |
1749 | 1749 | $this->_template_args['attendee_notice'] = ''; |
1750 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1751 | - EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1750 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1751 | + EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1752 | 1752 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1753 | 1753 | } else { |
1754 | 1754 | |
1755 | 1755 | $att_nmbr = 1; |
1756 | - foreach ( $registrations as $registration ) { |
|
1756 | + foreach ($registrations as $registration) { |
|
1757 | 1757 | /* @var $registration EE_Registration */ |
1758 | 1758 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1759 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1760 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1761 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1762 | - $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1759 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1760 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1761 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1762 | + $this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1763 | 1763 | |
1764 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1764 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1765 | 1765 | |
1766 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1766 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1767 | 1767 | |
1768 | 1768 | $att_nmbr++; |
1769 | 1769 | } |
@@ -1775,8 +1775,8 @@ discard block |
||
1775 | 1775 | |
1776 | 1776 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
1777 | 1777 | } |
1778 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1779 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1778 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1779 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1780 | 1780 | |
1781 | 1781 | } |
1782 | 1782 | |
@@ -1797,11 +1797,11 @@ discard block |
||
1797 | 1797 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
1798 | 1798 | |
1799 | 1799 | //now let's determine if this is not the primary registration. If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not) |
1800 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
1800 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
1801 | 1801 | $primary_registration = $this->_registration->get_primary_registration(); |
1802 | 1802 | $primary_attendee = $primary_registration->attendee(); |
1803 | 1803 | |
1804 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
1804 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
1805 | 1805 | //in here? This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg. |
1806 | 1806 | $primary_registration = NULL; |
1807 | 1807 | } |
@@ -1810,27 +1810,27 @@ discard block |
||
1810 | 1810 | } |
1811 | 1811 | |
1812 | 1812 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
1813 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
1814 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
1815 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
1813 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
1814 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
1815 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
1816 | 1816 | $this->_template_args['phone'] = $attendee->phone(); |
1817 | 1817 | |
1818 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
1818 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
1819 | 1819 | |
1820 | 1820 | |
1821 | 1821 | //edit link |
1822 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1823 | - $this->_template_args['att_edit_label'] = __('View/Edit Contact' ); |
|
1822 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1823 | + $this->_template_args['att_edit_label'] = __('View/Edit Contact'); |
|
1824 | 1824 | |
1825 | 1825 | //create link |
1826 | - $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): ''; |
|
1826 | + $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : ''; |
|
1827 | 1827 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
1828 | 1828 | |
1829 | 1829 | $this->_template_args['att_check'] = $att_check; |
1830 | 1830 | |
1831 | 1831 | |
1832 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1833 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1832 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1833 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1834 | 1834 | } |
1835 | 1835 | |
1836 | 1836 | |
@@ -1843,7 +1843,7 @@ discard block |
||
1843 | 1843 | * @access protected |
1844 | 1844 | * @return void |
1845 | 1845 | */ |
1846 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
1846 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
1847 | 1847 | $REGM = EEM_Registration::instance(); |
1848 | 1848 | |
1849 | 1849 | $success = 1; |
@@ -1853,26 +1853,26 @@ discard block |
||
1853 | 1853 | $dtts = array(); |
1854 | 1854 | |
1855 | 1855 | //if empty _REG_ID then get out because there's nothing to do |
1856 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
1856 | + if (empty($this->_req_data['_REG_ID'])) { |
|
1857 | 1857 | $msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso'); |
1858 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
1859 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
1858 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
1859 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
1860 | 1860 | } |
1861 | 1861 | |
1862 | 1862 | //Checkboxes |
1863 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1863 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1864 | 1864 | // if array has more than one element than success message should be plural |
1865 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1865 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1866 | 1866 | // cycle thru checkboxes |
1867 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1867 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1868 | 1868 | |
1869 | 1869 | $REG = $REGM->get_one_by_ID($REG_ID); |
1870 | 1870 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
1871 | - if ( $payment_count > 0 ) { |
|
1872 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
1871 | + if ($payment_count > 0) { |
|
1872 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
1873 | 1873 | $error = 1; |
1874 | 1874 | $success = 0; |
1875 | - EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1875 | + EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__); |
|
1876 | 1876 | continue; //can't trash this registration because it has payments. |
1877 | 1877 | } |
1878 | 1878 | $ticket = $REG->get_first_related('Ticket'); |
@@ -1881,7 +1881,7 @@ discard block |
||
1881 | 1881 | $dtts = array_merge($dtts, $dtt); |
1882 | 1882 | |
1883 | 1883 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1884 | - if ( !$updated ) { |
|
1884 | + if ( ! $updated) { |
|
1885 | 1885 | $success = 0; |
1886 | 1886 | } else { |
1887 | 1887 | $success = 2; |
@@ -1896,7 +1896,7 @@ discard block |
||
1896 | 1896 | $tickets[$ticket->ID()] = $ticket; |
1897 | 1897 | $dtts = $ticket->get_many_related('Datetime'); |
1898 | 1898 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1899 | - if ( ! $updated ) { |
|
1899 | + if ( ! $updated) { |
|
1900 | 1900 | $success = 0; |
1901 | 1901 | } |
1902 | 1902 | |
@@ -1906,10 +1906,10 @@ discard block |
||
1906 | 1906 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
1907 | 1907 | EEM_Datetime::instance()->update_sold($dtts); |
1908 | 1908 | |
1909 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1910 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
1909 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1910 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
1911 | 1911 | $overwrite_msgs = $error ? TRUE : FALSE; |
1912 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
1912 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
1913 | 1913 | } |
1914 | 1914 | |
1915 | 1915 | |
@@ -1933,16 +1933,16 @@ discard block |
||
1933 | 1933 | $success = 1; |
1934 | 1934 | |
1935 | 1935 | //Checkboxes |
1936 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1936 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1937 | 1937 | // if array has more than one element than success message should be plural |
1938 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1938 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1939 | 1939 | // cycle thru checkboxes |
1940 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1940 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1941 | 1941 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1942 | - if ( ! $REG instanceof EE_Registration ) |
|
1942 | + if ( ! $REG instanceof EE_Registration) |
|
1943 | 1943 | continue; |
1944 | 1944 | $deleted = $this->_delete_registration($REG); |
1945 | - if ( !$deleted ) { |
|
1945 | + if ( ! $deleted) { |
|
1946 | 1946 | $success = 0; |
1947 | 1947 | } |
1948 | 1948 | } |
@@ -1952,15 +1952,15 @@ discard block |
||
1952 | 1952 | $REG_ID = $this->_req_data['_REG_ID']; |
1953 | 1953 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1954 | 1954 | $deleted = $this->_delete_registration($REG); |
1955 | - if ( ! $deleted ) { |
|
1955 | + if ( ! $deleted) { |
|
1956 | 1956 | $success = 0; |
1957 | 1957 | } |
1958 | 1958 | |
1959 | 1959 | } |
1960 | 1960 | |
1961 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1962 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
1963 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
1961 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1962 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
1963 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
1964 | 1964 | } |
1965 | 1965 | |
1966 | 1966 | |
@@ -1972,31 +1972,31 @@ discard block |
||
1972 | 1972 | * @param EE_Registration $REG registration to be deleted permenantly |
1973 | 1973 | * @return boolean true = successful deletion, false = fail. |
1974 | 1974 | */ |
1975 | - protected function _delete_registration( EE_Registration $REG ) { |
|
1975 | + protected function _delete_registration(EE_Registration $REG) { |
|
1976 | 1976 | //first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed. |
1977 | 1977 | $TXN = $REG->get_first_related('Transaction'); |
1978 | 1978 | $REGS = $TXN->get_many_related('Registration'); |
1979 | 1979 | |
1980 | 1980 | $all_trashed = TRUE; |
1981 | - foreach ( $REGS as $registration ) { |
|
1982 | - if ( ! $registration->get('REG_deleted') ) |
|
1981 | + foreach ($REGS as $registration) { |
|
1982 | + if ( ! $registration->get('REG_deleted')) |
|
1983 | 1983 | $all_trashed = FALSE; |
1984 | 1984 | } |
1985 | 1985 | |
1986 | - if ( ! $all_trashed ) { |
|
1987 | - EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1986 | + if ( ! $all_trashed) { |
|
1987 | + EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1988 | 1988 | return false; |
1989 | 1989 | } |
1990 | 1990 | |
1991 | 1991 | //k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one). |
1992 | - foreach ( $REGS as $registration ) { |
|
1992 | + foreach ($REGS as $registration) { |
|
1993 | 1993 | |
1994 | 1994 | //delete related answers |
1995 | 1995 | $registration->delete_related_permanently('Answer'); |
1996 | 1996 | |
1997 | 1997 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
1998 | 1998 | $attendee = $registration->get_first_related('Attendee'); |
1999 | - if ( $attendee instanceof EE_Attendee ) { |
|
1999 | + if ($attendee instanceof EE_Attendee) { |
|
2000 | 2000 | $registration->_remove_relation_to($attendee, 'Attendee'); |
2001 | 2001 | } |
2002 | 2002 | |
@@ -2006,7 +2006,7 @@ discard block |
||
2006 | 2006 | //now delete permanently the checkins related to this registration. |
2007 | 2007 | $registration->delete_related_permanently('Checkin'); |
2008 | 2008 | |
2009 | - if ( $registration->ID() === $REG->ID() ) |
|
2009 | + if ($registration->ID() === $REG->ID()) |
|
2010 | 2010 | continue; //we don't want to delete permanently the existing registration just yet. |
2011 | 2011 | |
2012 | 2012 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -2039,35 +2039,35 @@ discard block |
||
2039 | 2039 | * @return void |
2040 | 2040 | */ |
2041 | 2041 | public function new_registration() { |
2042 | - if ( ! $this->_set_reg_event() ) { |
|
2043 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
2042 | + if ( ! $this->_set_reg_event()) { |
|
2043 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
2044 | 2044 | } |
2045 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2045 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2046 | 2046 | // gotta start with a clean slate if we're not coming here via ajax |
2047 | 2047 | if ( |
2048 | - ! defined('DOING_AJAX' ) |
|
2049 | - && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) ) |
|
2048 | + ! defined('DOING_AJAX') |
|
2049 | + && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error'])) |
|
2050 | 2050 | ) { |
2051 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2051 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2052 | 2052 | } |
2053 | 2053 | |
2054 | - $this->_template_args['event_name'] = '' ; |
|
2054 | + $this->_template_args['event_name'] = ''; |
|
2055 | 2055 | // event name |
2056 | - if ( $this->_reg_event ) { |
|
2056 | + if ($this->_reg_event) { |
|
2057 | 2057 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2058 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2059 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2060 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2058 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2059 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2060 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2061 | 2061 | } |
2062 | 2062 | |
2063 | 2063 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2064 | 2064 | |
2065 | - if ( defined('DOING_AJAX' ) ) { |
|
2065 | + if (defined('DOING_AJAX')) { |
|
2066 | 2066 | $this->_return_json(); |
2067 | 2067 | } |
2068 | 2068 | // grab header |
2069 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2070 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2069 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2070 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2071 | 2071 | |
2072 | 2072 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2073 | 2073 | // the details template wrapper |
@@ -2084,7 +2084,7 @@ discard block |
||
2084 | 2084 | * @return string html |
2085 | 2085 | */ |
2086 | 2086 | protected function _get_registration_step_content() { |
2087 | - if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) { |
|
2087 | + if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) { |
|
2088 | 2088 | $warning_msg = sprintf( |
2089 | 2089 | __( |
2090 | 2090 | '%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s', |
@@ -2100,7 +2100,7 @@ discard block |
||
2100 | 2100 | '</b>' |
2101 | 2101 | ); |
2102 | 2102 | return ' |
2103 | - <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div> |
|
2103 | + <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div> |
|
2104 | 2104 | <script > |
2105 | 2105 | // WHOAH !!! it appears that someone is using the back button from the Transaction admin page |
2106 | 2106 | // after just adding a new registration... we gotta try to put a stop to that !!! |
@@ -2135,16 +2135,16 @@ discard block |
||
2135 | 2135 | $cart = EE_Registry::instance()->SSN->cart(); |
2136 | 2136 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2137 | 2137 | |
2138 | - switch ( $step ) { |
|
2138 | + switch ($step) { |
|
2139 | 2139 | case 'ticket' : |
2140 | 2140 | $hidden_fields['processing_registration']['value'] = 1; |
2141 | 2141 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2142 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2142 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2143 | 2143 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2144 | 2144 | $template_args['show_notification_toggle'] = FALSE; |
2145 | 2145 | break; |
2146 | 2146 | case 'questions' : |
2147 | - $hidden_fields[ 'processing_registration' ][ 'value' ] = 2; |
|
2147 | + $hidden_fields['processing_registration']['value'] = 2; |
|
2148 | 2148 | $template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso'); |
2149 | 2149 | //in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run. |
2150 | 2150 | $template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin(); |
@@ -2153,10 +2153,10 @@ discard block |
||
2153 | 2153 | break; |
2154 | 2154 | } |
2155 | 2155 | |
2156 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2156 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2157 | 2157 | |
2158 | 2158 | return EEH_Template::display_template( |
2159 | - REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2159 | + REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2160 | 2160 | ); |
2161 | 2161 | } |
2162 | 2162 | |
@@ -2171,11 +2171,11 @@ discard block |
||
2171 | 2171 | * @return boolean |
2172 | 2172 | */ |
2173 | 2173 | private function _set_reg_event() { |
2174 | - if ( is_object( $this->_reg_event )) { |
|
2174 | + if (is_object($this->_reg_event)) { |
|
2175 | 2175 | return TRUE; |
2176 | 2176 | } |
2177 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2178 | - if ( ! $EVT_ID ) { |
|
2177 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2178 | + if ( ! $EVT_ID) { |
|
2179 | 2179 | return FALSE; |
2180 | 2180 | } |
2181 | 2181 | |
@@ -2196,82 +2196,82 @@ discard block |
||
2196 | 2196 | public function process_reg_step() { |
2197 | 2197 | EE_System::do_not_cache(); |
2198 | 2198 | $this->_set_reg_event(); |
2199 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2199 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2200 | 2200 | |
2201 | 2201 | //what step are we on? |
2202 | 2202 | $cart = EE_Registry::instance()->SSN->cart(); |
2203 | 2203 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2204 | 2204 | |
2205 | 2205 | //if doing ajax then we need to verify the nonce |
2206 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2207 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2208 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2206 | + if (defined('DOING_AJAX')) { |
|
2207 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2208 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2209 | 2209 | } |
2210 | 2210 | |
2211 | - switch ( $step ) { |
|
2211 | + switch ($step) { |
|
2212 | 2212 | |
2213 | 2213 | case 'ticket' : |
2214 | 2214 | //process ticket selection |
2215 | 2215 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2216 | - if ( $success ) { |
|
2217 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2216 | + if ($success) { |
|
2217 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2218 | 2218 | } else { |
2219 | 2219 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2220 | 2220 | } |
2221 | - if ( defined('DOING_AJAX') ) { |
|
2221 | + if (defined('DOING_AJAX')) { |
|
2222 | 2222 | $this->new_registration(); //display next step |
2223 | 2223 | } else { |
2224 | 2224 | $query_args['action'] = 'new_registration'; |
2225 | 2225 | $query_args['processing_registration'] = 1; |
2226 | 2226 | $query_args['event_id'] = $this->_reg_event->ID(); |
2227 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2227 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2228 | 2228 | } |
2229 | 2229 | break; |
2230 | 2230 | |
2231 | 2231 | case 'questions' : |
2232 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2233 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2232 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2233 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2234 | 2234 | } |
2235 | 2235 | //process registration |
2236 | 2236 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2237 | - if ( $cart instanceof EE_Cart ) { |
|
2237 | + if ($cart instanceof EE_Cart) { |
|
2238 | 2238 | $grand_total = $cart->get_cart_grand_total(); |
2239 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
2239 | + if ($grand_total instanceof EE_Line_Item) { |
|
2240 | 2240 | $grand_total->save_this_and_descendants_to_txn(); |
2241 | 2241 | } |
2242 | 2242 | } |
2243 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2243 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2244 | 2244 | $query_args = array( |
2245 | 2245 | 'action' => 'new_registration', |
2246 | 2246 | 'processing_registration' => 2, |
2247 | 2247 | 'event_id' => $this->_reg_event->ID() |
2248 | 2248 | ); |
2249 | 2249 | |
2250 | - if ( defined('DOING_AJAX' )) { |
|
2250 | + if (defined('DOING_AJAX')) { |
|
2251 | 2251 | //display registration form again because there are errors (maybe validation?) |
2252 | 2252 | $this->new_registration(); |
2253 | 2253 | return; |
2254 | 2254 | } else { |
2255 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2255 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2256 | 2256 | return; |
2257 | 2257 | } |
2258 | 2258 | } |
2259 | 2259 | /** @type EE_Transaction_Payments $transaction_payments */ |
2260 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2260 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2261 | 2261 | // maybe update status, and make sure to save transaction if not done already |
2262 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2262 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2263 | 2263 | $transaction->save(); |
2264 | 2264 | } |
2265 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2265 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2266 | 2266 | $this->_req_data = array(); |
2267 | 2267 | $query_args = array( |
2268 | 2268 | 'action' => 'redirect_to_txn', |
2269 | 2269 | 'TXN_ID' => $transaction->ID(), |
2270 | 2270 | 'EVT_ID' => $this->_reg_event->ID(), |
2271 | - 'event_name' => urlencode( $this->_reg_event->name() ), |
|
2271 | + 'event_name' => urlencode($this->_reg_event->name()), |
|
2272 | 2272 | 'redirect_from' => 'new_registration' |
2273 | 2273 | ); |
2274 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2274 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2275 | 2275 | break; |
2276 | 2276 | } |
2277 | 2277 | |
@@ -2288,21 +2288,21 @@ discard block |
||
2288 | 2288 | */ |
2289 | 2289 | public function redirect_to_txn() { |
2290 | 2290 | EE_System::do_not_cache(); |
2291 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2291 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2292 | 2292 | $query_args = array( |
2293 | 2293 | 'action' => 'view_transaction', |
2294 | - 'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] ) : 0, |
|
2294 | + 'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0, |
|
2295 | 2295 | 'page' => 'espresso_transactions' |
2296 | 2296 | ); |
2297 | - if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) { |
|
2298 | - $query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ]; |
|
2299 | - $query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] ); |
|
2300 | - $query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ]; |
|
2297 | + if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) { |
|
2298 | + $query_args['EVT_ID'] = $this->_req_data['EVT_ID']; |
|
2299 | + $query_args['event_name'] = urlencode($this->_req_data['event_name']); |
|
2300 | + $query_args['redirect_from'] = $this->_req_data['redirect_from']; |
|
2301 | 2301 | } |
2302 | 2302 | EE_Error::add_success( |
2303 | - __( 'Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso' ) |
|
2303 | + __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') |
|
2304 | 2304 | ); |
2305 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2305 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2306 | 2306 | } |
2307 | 2307 | |
2308 | 2308 | |
@@ -2313,7 +2313,7 @@ discard block |
||
2313 | 2313 | * @return void |
2314 | 2314 | */ |
2315 | 2315 | protected function _attendee_contact_list_table() { |
2316 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2316 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2317 | 2317 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2318 | 2318 | $this->display_admin_list_table_page_with_no_sidebar(); |
2319 | 2319 | } |
@@ -2328,10 +2328,10 @@ discard block |
||
2328 | 2328 | * @access public |
2329 | 2329 | * @return array |
2330 | 2330 | */ |
2331 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2331 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2332 | 2332 | |
2333 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2334 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2333 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2334 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2335 | 2335 | $ATT_MDL = EEM_Attendee::instance(); |
2336 | 2336 | |
2337 | 2337 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2359,47 +2359,47 @@ discard block |
||
2359 | 2359 | $orderby = 'ATT_lname'; |
2360 | 2360 | } |
2361 | 2361 | |
2362 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2362 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2363 | 2363 | |
2364 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2365 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2366 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2364 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2365 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2366 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2367 | 2367 | |
2368 | 2368 | $_where = array(); |
2369 | 2369 | |
2370 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2371 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2370 | + if (isset($this->_req_data['s'])) { |
|
2371 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2372 | 2372 | $_where['OR'] = array( |
2373 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2374 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2375 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2376 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2377 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2378 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2379 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2380 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2381 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2382 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2383 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2384 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2385 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2386 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2387 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2388 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2389 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2373 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2374 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2375 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2376 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2377 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2378 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2379 | + 'ATT_email' => array('LIKE', $sstr), |
|
2380 | + 'ATT_address' => array('LIKE', $sstr), |
|
2381 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2382 | + 'ATT_city' => array('LIKE', $sstr), |
|
2383 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2384 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2385 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2386 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2387 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2388 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2389 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2390 | 2390 | ); |
2391 | 2391 | } |
2392 | 2392 | |
2393 | 2393 | |
2394 | - $offset = ($current_page-1)*$per_page; |
|
2395 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2394 | + $offset = ($current_page - 1) * $per_page; |
|
2395 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2396 | 2396 | |
2397 | - if ( $trash ) { |
|
2398 | - $_where['status'] = array( '!=', 'publish' ); |
|
2399 | - $all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2397 | + if ($trash) { |
|
2398 | + $_where['status'] = array('!=', 'publish'); |
|
2399 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2400 | 2400 | } else { |
2401 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2402 | - $all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) ); |
|
2401 | + $_where['status'] = array('IN', array('publish')); |
|
2402 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2403 | 2403 | } |
2404 | 2404 | |
2405 | 2405 | return $all_attendees; |
@@ -2416,10 +2416,10 @@ discard block |
||
2416 | 2416 | */ |
2417 | 2417 | protected function _resend_registration() { |
2418 | 2418 | $this->_process_resend_registration(); |
2419 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2419 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2420 | 2420 | 'action' => 'default' |
2421 | 2421 | ); |
2422 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2422 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2423 | 2423 | } |
2424 | 2424 | |
2425 | 2425 | |
@@ -2427,26 +2427,26 @@ discard block |
||
2427 | 2427 | |
2428 | 2428 | |
2429 | 2429 | |
2430 | - public function _registrations_report(){ |
|
2431 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2432 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2430 | + public function _registrations_report() { |
|
2431 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2432 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2433 | 2433 | array( |
2434 | 2434 | 'page' => 'espresso_batch', |
2435 | 2435 | 'batch' => 'file', |
2436 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2437 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ), |
|
2438 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2439 | - )) ); |
|
2436 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2437 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'), |
|
2438 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2439 | + ))); |
|
2440 | 2440 | } else { |
2441 | 2441 | $new_request_args = array( |
2442 | 2442 | 'export' => 'report', |
2443 | 2443 | 'action' => 'registrations_report_for_event', |
2444 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2444 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2445 | 2445 | ); |
2446 | 2446 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2447 | 2447 | |
2448 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2449 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2448 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2449 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2450 | 2450 | $EE_Export = EE_Export::instance($this->_req_data); |
2451 | 2451 | $EE_Export->export(); |
2452 | 2452 | } |
@@ -2455,26 +2455,26 @@ discard block |
||
2455 | 2455 | |
2456 | 2456 | |
2457 | 2457 | |
2458 | - public function _contact_list_export(){ |
|
2459 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2460 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2458 | + public function _contact_list_export() { |
|
2459 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2460 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2461 | 2461 | $EE_Export = EE_Export::instance($this->_req_data); |
2462 | 2462 | $EE_Export->export_attendees(); |
2463 | 2463 | } |
2464 | 2464 | } |
2465 | 2465 | |
2466 | - public function _contact_list_report(){ |
|
2467 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2468 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2466 | + public function _contact_list_report() { |
|
2467 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2468 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2469 | 2469 | array( |
2470 | 2470 | 'page' => 'espresso_batch', |
2471 | 2471 | 'batch' => 'file', |
2472 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ), |
|
2473 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2474 | - )) ); |
|
2472 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'), |
|
2473 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2474 | + ))); |
|
2475 | 2475 | } else { |
2476 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2477 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2476 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2477 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2478 | 2478 | $EE_Export = EE_Export::instance($this->_req_data); |
2479 | 2479 | $EE_Export->report_attendees(); |
2480 | 2480 | } |
@@ -2494,73 +2494,73 @@ discard block |
||
2494 | 2494 | * @return void |
2495 | 2495 | */ |
2496 | 2496 | protected function _duplicate_attendee() { |
2497 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2497 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2498 | 2498 | //verify we have necessary info |
2499 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2500 | - EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__ ); |
|
2501 | - $query_args = array( 'action' => $action ); |
|
2499 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2500 | + EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
2501 | + $query_args = array('action' => $action); |
|
2502 | 2502 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2503 | 2503 | } |
2504 | 2504 | |
2505 | 2505 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2506 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2506 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2507 | 2507 | $attendee = $registration->attendee(); |
2508 | 2508 | |
2509 | 2509 | //remove relation of existing attendee on registration |
2510 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2510 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2511 | 2511 | //new attendee |
2512 | 2512 | $new_attendee = clone $attendee; |
2513 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2513 | + $new_attendee->set('ATT_ID', 0); |
|
2514 | 2514 | $new_attendee->save(); |
2515 | 2515 | |
2516 | 2516 | //add new attendee to reg |
2517 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2517 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2518 | 2518 | |
2519 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2519 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2520 | 2520 | |
2521 | 2521 | //redirect to edit page for attendee |
2522 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2522 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2523 | 2523 | |
2524 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2524 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2525 | 2525 | } |
2526 | 2526 | |
2527 | 2527 | |
2528 | 2528 | //related to cpt routes |
2529 | 2529 | protected function _insert_update_cpt_item($post_id, $post) { |
2530 | 2530 | $success = true; |
2531 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2531 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2532 | 2532 | //for attendee updates |
2533 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2533 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2534 | 2534 | //note we should only be UPDATING attendees at this point. |
2535 | 2535 | $updated_fields = array( |
2536 | 2536 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2537 | 2537 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2538 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2538 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2539 | 2539 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2540 | 2540 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2541 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2542 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2543 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2544 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2545 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2546 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2541 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2542 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2543 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2544 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2545 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2546 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2547 | 2547 | ); |
2548 | - foreach ( $updated_fields as $field => $value ) { |
|
2548 | + foreach ($updated_fields as $field => $value) { |
|
2549 | 2549 | $attendee->set($field, $value); |
2550 | 2550 | } |
2551 | 2551 | |
2552 | 2552 | $success = $attendee->save(); |
2553 | 2553 | |
2554 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2555 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2556 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2557 | - throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback ) ); |
|
2554 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2555 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2556 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2557 | + throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback)); |
|
2558 | 2558 | } |
2559 | 2559 | } |
2560 | 2560 | } |
2561 | 2561 | |
2562 | - if ( $success === FALSE ) |
|
2563 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2562 | + if ($success === FALSE) |
|
2563 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2564 | 2564 | |
2565 | 2565 | } |
2566 | 2566 | |
@@ -2580,17 +2580,17 @@ discard block |
||
2580 | 2580 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2581 | 2581 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2582 | 2582 | |
2583 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2584 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2583 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2584 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2585 | 2585 | } |
2586 | 2586 | |
2587 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2587 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2588 | 2588 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2589 | 2589 | } |
2590 | 2590 | |
2591 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2592 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2593 | - add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2591 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2592 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2593 | + add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2594 | 2594 | } |
2595 | 2595 | |
2596 | 2596 | |
@@ -2599,10 +2599,10 @@ discard block |
||
2599 | 2599 | * @param WP_Post $post wp post object |
2600 | 2600 | * @return string attendee contact info ( and form ) |
2601 | 2601 | */ |
2602 | - public function attendee_contact_info( $post ) { |
|
2602 | + public function attendee_contact_info($post) { |
|
2603 | 2603 | //get attendee object ( should already have it ) |
2604 | 2604 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2605 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2605 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2606 | 2606 | EEH_Template::display_template($template, $this->_template_args); |
2607 | 2607 | } |
2608 | 2608 | |
@@ -2618,12 +2618,12 @@ discard block |
||
2618 | 2618 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2619 | 2619 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2620 | 2620 | new EE_Question_Form_Input( |
2621 | - EE_Question::new_instance( array( |
|
2621 | + EE_Question::new_instance(array( |
|
2622 | 2622 | 'QST_ID' => 0, |
2623 | 2623 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2624 | 2624 | 'QST_system' => 'admin-state' |
2625 | 2625 | )), |
2626 | - EE_Answer::new_instance( array( |
|
2626 | + EE_Answer::new_instance(array( |
|
2627 | 2627 | 'ANS_ID' => 0, |
2628 | 2628 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2629 | 2629 | )), |
@@ -2636,12 +2636,12 @@ discard block |
||
2636 | 2636 | )); |
2637 | 2637 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2638 | 2638 | new EE_Question_Form_Input( |
2639 | - EE_Question::new_instance( array( |
|
2639 | + EE_Question::new_instance(array( |
|
2640 | 2640 | 'QST_ID' => 0, |
2641 | 2641 | 'QST_display_text' => __('Country', 'event_espresso'), |
2642 | 2642 | 'QST_system' => 'admin-country' |
2643 | 2643 | )), |
2644 | - EE_Answer::new_instance( array( |
|
2644 | + EE_Answer::new_instance(array( |
|
2645 | 2645 | 'ANS_ID' => 0, |
2646 | 2646 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2647 | 2647 | )), |
@@ -2652,8 +2652,8 @@ discard block |
||
2652 | 2652 | 'append_qstn_id' => FALSE |
2653 | 2653 | ) |
2654 | 2654 | )); |
2655 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2656 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2655 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2656 | + EEH_Template::display_template($template, $this->_template_args); |
|
2657 | 2657 | |
2658 | 2658 | } |
2659 | 2659 | |
@@ -2663,11 +2663,11 @@ discard block |
||
2663 | 2663 | * @access protected |
2664 | 2664 | * @return void |
2665 | 2665 | */ |
2666 | - public function attendee_registrations_meta_box( $post ) { |
|
2666 | + public function attendee_registrations_meta_box($post) { |
|
2667 | 2667 | |
2668 | 2668 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2669 | 2669 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2670 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2670 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2671 | 2671 | EEH_Template::display_template($template, $this->_template_args); |
2672 | 2672 | |
2673 | 2673 | } |
@@ -2681,8 +2681,8 @@ discard block |
||
2681 | 2681 | * @return string html for new form. |
2682 | 2682 | */ |
2683 | 2683 | public function after_title_form_fields($post) { |
2684 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2685 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2684 | + if ($post->post_type == 'espresso_attendees') { |
|
2685 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2686 | 2686 | $template_args['attendee'] = $this->_cpt_model_obj; |
2687 | 2687 | EEH_Template::display_template($template, $template_args); |
2688 | 2688 | } |
@@ -2699,21 +2699,21 @@ discard block |
||
2699 | 2699 | * @access protected |
2700 | 2700 | * @return void |
2701 | 2701 | */ |
2702 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2702 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2703 | 2703 | |
2704 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2704 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2705 | 2705 | |
2706 | 2706 | $ATT_MDL = EEM_Attendee::instance(); |
2707 | 2707 | |
2708 | 2708 | $success = 1; |
2709 | 2709 | //Checkboxes |
2710 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2710 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2711 | 2711 | // if array has more than one element than success message should be plural |
2712 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2712 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2713 | 2713 | // cycle thru checkboxes |
2714 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2715 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2716 | - if ( !$updated ) { |
|
2714 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2715 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2716 | + if ( ! $updated) { |
|
2717 | 2717 | $success = 0; |
2718 | 2718 | } |
2719 | 2719 | } |
@@ -2722,18 +2722,18 @@ discard block |
||
2722 | 2722 | // grab single id and delete |
2723 | 2723 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2724 | 2724 | //get attendee |
2725 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2725 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2726 | 2726 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2727 | 2727 | $updated = $att->save(); |
2728 | - if ( ! $updated ) { |
|
2728 | + if ( ! $updated) { |
|
2729 | 2729 | $success = 0; |
2730 | 2730 | } |
2731 | 2731 | |
2732 | 2732 | } |
2733 | 2733 | |
2734 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2735 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2736 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2734 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2735 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2736 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2737 | 2737 | |
2738 | 2738 | } |
2739 | 2739 |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Transactions_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | protected function _ajax_hooks() { |
83 | - add_action('wp_ajax_espresso_apply_payment', array( $this, 'apply_payments_or_refunds')); |
|
84 | - add_action('wp_ajax_espresso_apply_refund', array( $this, 'apply_payments_or_refunds')); |
|
85 | - add_action('wp_ajax_espresso_delete_payment', array( $this, 'delete_payment')); |
|
83 | + add_action('wp_ajax_espresso_apply_payment', array($this, 'apply_payments_or_refunds')); |
|
84 | + add_action('wp_ajax_espresso_apply_refund', array($this, 'apply_payments_or_refunds')); |
|
85 | + add_action('wp_ajax_espresso_delete_payment', array($this, 'delete_payment')); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | 'buttons' => array( |
98 | 98 | 'add' => __('Add New Transaction', 'event_espresso'), |
99 | 99 | 'edit' => __('Edit Transaction', 'event_espresso'), |
100 | - 'delete' => __('Delete Transaction','event_espresso'), |
|
100 | + 'delete' => __('Delete Transaction', 'event_espresso'), |
|
101 | 101 | ) |
102 | 102 | ); |
103 | 103 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $this->_set_transaction_status_array(); |
115 | 115 | |
116 | - $txn_id = ! empty( $this->_req_data['TXN_ID'] ) && ! is_array( $this->_req_data['TXN_ID'] ) ? $this->_req_data['TXN_ID'] : 0; |
|
116 | + $txn_id = ! empty($this->_req_data['TXN_ID']) && ! is_array($this->_req_data['TXN_ID']) ? $this->_req_data['TXN_ID'] : 0; |
|
117 | 117 | |
118 | 118 | $this->_page_routes = array( |
119 | 119 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | 'filename' => 'transactions_overview_views_filters_search' |
186 | 186 | ), |
187 | 187 | ), |
188 | - 'help_tour' => array( 'Transactions_Overview_Help_Tour' ), |
|
188 | + 'help_tour' => array('Transactions_Overview_Help_Tour'), |
|
189 | 189 | /** |
190 | 190 | * commented out because currently we are not displaying tips for transaction list table status but this |
191 | 191 | * may change in a later iteration so want to keep the code for then. |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | 'nav' => array( |
198 | 198 | 'label' => __('View Transaction', 'event_espresso'), |
199 | 199 | 'order' => 5, |
200 | - 'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
200 | + 'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
201 | 201 | 'persistent' => FALSE |
202 | 202 | ), |
203 | 203 | 'help_tabs' => array( |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | 'filename' => 'transactions_view_transaction_primary_registrant_billing_information' |
219 | 219 | ), |
220 | 220 | ), |
221 | - 'qtips' => array( 'Transaction_Details_Tips' ), |
|
222 | - 'help_tour' => array( 'Transaction_Details_Help_Tour' ), |
|
221 | + 'qtips' => array('Transaction_Details_Tips'), |
|
222 | + 'help_tour' => array('Transaction_Details_Help_Tour'), |
|
223 | 223 | 'metaboxes' => array('_transaction_details_metaboxes'), |
224 | 224 | |
225 | 225 | 'require_nonce' => FALSE |
@@ -237,21 +237,21 @@ discard block |
||
237 | 237 | // IF a registration was JUST added via the admin... |
238 | 238 | if ( |
239 | 239 | isset( |
240 | - $this->_req_data[ 'redirect_from' ], |
|
241 | - $this->_req_data[ 'EVT_ID' ], |
|
242 | - $this->_req_data[ 'event_name' ] |
|
240 | + $this->_req_data['redirect_from'], |
|
241 | + $this->_req_data['EVT_ID'], |
|
242 | + $this->_req_data['event_name'] |
|
243 | 243 | ) |
244 | 244 | ) { |
245 | 245 | // then set a cookie so that we can block any attempts to use |
246 | 246 | // the back button as a way to enter another registration. |
247 | - setcookie( 'ee_registration_added', $this->_req_data[ 'EVT_ID' ], time() + WEEK_IN_SECONDS, '/' ); |
|
247 | + setcookie('ee_registration_added', $this->_req_data['EVT_ID'], time() + WEEK_IN_SECONDS, '/'); |
|
248 | 248 | // and update the global |
249 | - $_COOKIE[ 'ee_registration_added' ] = $this->_req_data[ 'EVT_ID' ]; |
|
249 | + $_COOKIE['ee_registration_added'] = $this->_req_data['EVT_ID']; |
|
250 | 250 | } |
251 | - EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' ); |
|
252 | - EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' ); |
|
253 | - EE_Registry::$i18n_js_strings[ 'txn_status_array' ] = self::$_txn_status; |
|
254 | - EE_Registry::$i18n_js_strings[ 'pay_status_array' ] = self::$_pay_status; |
|
251 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso'); |
|
252 | + EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso'); |
|
253 | + EE_Registry::$i18n_js_strings['txn_status_array'] = self::$_txn_status; |
|
254 | + EE_Registry::$i18n_js_strings['pay_status_array'] = self::$_pay_status; |
|
255 | 255 | } |
256 | 256 | public function admin_notices() {} |
257 | 257 | public function admin_footer_scripts() {} |
@@ -318,14 +318,14 @@ discard block |
||
318 | 318 | */ |
319 | 319 | public function load_scripts_styles() { |
320 | 320 | //enqueue style |
321 | - wp_register_style( 'espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
321 | + wp_register_style('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
322 | 322 | wp_enqueue_style('espresso_txn'); |
323 | 323 | |
324 | 324 | //scripts |
325 | 325 | add_filter('FHEE_load_accounting_js', '__return_true'); |
326 | 326 | |
327 | 327 | //scripts |
328 | - wp_register_script('espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE); |
|
328 | + wp_register_script('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE); |
|
329 | 329 | wp_enqueue_script('espresso_txn'); |
330 | 330 | |
331 | 331 | } |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | * @return void |
366 | 366 | */ |
367 | 367 | protected function _set_list_table_views_default() { |
368 | - $this->_views = array ( |
|
369 | - 'all' => array ( |
|
368 | + $this->_views = array( |
|
369 | + 'all' => array( |
|
370 | 370 | 'slug' => 'all', |
371 | 371 | 'label' => __('View All Transactions', 'event_espresso'), |
372 | 372 | 'count' => 0 |
@@ -394,20 +394,20 @@ discard block |
||
394 | 394 | * @return void |
395 | 395 | */ |
396 | 396 | private function _set_transaction_object() { |
397 | - if ( is_object( $this->_transaction) ) |
|
397 | + if (is_object($this->_transaction)) |
|
398 | 398 | return; //get out we've already set the object |
399 | 399 | |
400 | 400 | $TXN = EEM_Transaction::instance(); |
401 | 401 | |
402 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
402 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
403 | 403 | |
404 | 404 | //get transaction object |
405 | 405 | $this->_transaction = $TXN->get_one_by_ID($TXN_ID); |
406 | - $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
406 | + $this->_session = ! empty($this->_transaction) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
407 | 407 | |
408 | - if ( empty( $this->_transaction ) ) { |
|
409 | - $error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID . __(' could not be retrieved.', 'event_espresso'); |
|
410 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
408 | + if (empty($this->_transaction)) { |
|
409 | + $error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso').$TXN_ID.__(' could not be retrieved.', 'event_espresso'); |
|
410 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | |
@@ -420,12 +420,12 @@ discard block |
||
420 | 420 | * @return array |
421 | 421 | */ |
422 | 422 | protected function _transaction_legend_items() { |
423 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
423 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
424 | 424 | $items = array(); |
425 | 425 | |
426 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
427 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
428 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
426 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
427 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
428 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
429 | 429 | $items['view_related_messages'] = array( |
430 | 430 | 'class' => $related_for_icon['css_class'], |
431 | 431 | 'desc' => $related_for_icon['label'], |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | |
436 | 436 | $items = apply_filters( |
437 | 437 | 'FHEE__Transactions_Admin_Page___transaction_legend_items__items', |
438 | - array_merge( $items, |
|
438 | + array_merge($items, |
|
439 | 439 | array( |
440 | 440 | 'view_details' => array( |
441 | 441 | 'class' => 'dashicons dashicons-cart', |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | ), |
448 | 448 | 'view_receipt' => array( |
449 | 449 | 'class' => 'dashicons dashicons-media-default', |
450 | - 'desc' => __('View Transaction Receipt', 'event_espresso' ) |
|
450 | + 'desc' => __('View Transaction Receipt', 'event_espresso') |
|
451 | 451 | ), |
452 | 452 | 'view_registration' => array( |
453 | 453 | 'class' => 'dashicons dashicons-clipboard', |
@@ -457,8 +457,8 @@ discard block |
||
457 | 457 | ) |
458 | 458 | ); |
459 | 459 | |
460 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) { |
|
461 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
460 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) { |
|
461 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
462 | 462 | $items['send_payment_reminder'] = array( |
463 | 463 | 'class' => 'dashicons dashicons-email-alt', |
464 | 464 | 'desc' => __('Send Payment Reminder', 'event_espresso') |
@@ -479,29 +479,29 @@ discard block |
||
479 | 479 | 'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items', |
480 | 480 | array( |
481 | 481 | 'overpaid' => array( |
482 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code, |
|
483 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' ) |
|
482 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code, |
|
483 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence') |
|
484 | 484 | ), |
485 | 485 | 'complete' => array( |
486 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code, |
|
487 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' ) |
|
486 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code, |
|
487 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence') |
|
488 | 488 | ), |
489 | 489 | 'incomplete' => array( |
490 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code, |
|
491 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' ) |
|
490 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code, |
|
491 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence') |
|
492 | 492 | ), |
493 | 493 | 'abandoned' => array( |
494 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code, |
|
495 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' ) |
|
494 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code, |
|
495 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence') |
|
496 | 496 | ), |
497 | 497 | 'failed' => array( |
498 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code, |
|
499 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' ) |
|
498 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code, |
|
499 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence') |
|
500 | 500 | ) |
501 | 501 | ) |
502 | 502 | ); |
503 | 503 | |
504 | - return array_merge( $items, $more_items); |
|
504 | + return array_merge($items, $more_items); |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | |
@@ -514,9 +514,9 @@ discard block |
||
514 | 514 | */ |
515 | 515 | protected function _transactions_overview_list_table() { |
516 | 516 | $this->_admin_page_title = __('Transactions', 'event_espresso'); |
517 | - $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL; |
|
518 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL ) . '" title="' . esc_attr__('Click to Edit event', 'event_espresso') . '">' . $event->get('EVT_name') . '</a>', '</h3>' ) : ''; |
|
519 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() ); |
|
517 | + $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL; |
|
518 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'" title="'.esc_attr__('Click to Edit event', 'event_espresso').'">'.$event->get('EVT_name').'</a>', '</h3>') : ''; |
|
519 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items()); |
|
520 | 520 | $this->display_admin_list_table_page_with_no_sidebar(); |
521 | 521 | } |
522 | 522 | |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | * @return void |
531 | 531 | */ |
532 | 532 | protected function _transaction_details() { |
533 | - do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction ); |
|
533 | + do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction); |
|
534 | 534 | |
535 | 535 | $this->_set_transaction_status_array(); |
536 | 536 | |
@@ -543,14 +543,14 @@ discard block |
||
543 | 543 | $attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL; |
544 | 544 | |
545 | 545 | $this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID(); |
546 | - $this->_template_args['txn_nmbr']['label'] = __( 'Transaction Number', 'event_espresso' ); |
|
546 | + $this->_template_args['txn_nmbr']['label'] = __('Transaction Number', 'event_espresso'); |
|
547 | 547 | |
548 | 548 | $this->_template_args['txn_datetime']['value'] = $this->_transaction->get_i18n_datetime('TXN_timestamp'); |
549 | - $this->_template_args['txn_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
549 | + $this->_template_args['txn_datetime']['label'] = __('Date', 'event_espresso'); |
|
550 | 550 | |
551 | - $this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ]; |
|
552 | - $this->_template_args['txn_status']['label'] = __( 'Transaction Status', 'event_espresso' ); |
|
553 | - $this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID'); |
|
551 | + $this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')]; |
|
552 | + $this->_template_args['txn_status']['label'] = __('Transaction Status', 'event_espresso'); |
|
553 | + $this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID'); |
|
554 | 554 | |
555 | 555 | $this->_template_args['grand_total'] = $this->_transaction->get('TXN_total'); |
556 | 556 | $this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid'); |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | ) |
564 | 564 | ) { |
565 | 565 | $this->_template_args['send_payment_reminder_button'] = |
566 | - EEH_MSG_Template::is_mt_active( 'payment_reminder' ) |
|
566 | + EEH_MSG_Template::is_mt_active('payment_reminder') |
|
567 | 567 | && $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code |
568 | 568 | && $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code |
569 | 569 | ? EEH_Template::get_button_or_link( |
@@ -585,40 +585,40 @@ discard block |
||
585 | 585 | } |
586 | 586 | |
587 | 587 | $amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid'); |
588 | - $this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE ); |
|
589 | - if ( EE_Registry::instance()->CFG->currency->sign_b4 ) { |
|
590 | - $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due']; |
|
588 | + $this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE); |
|
589 | + if (EE_Registry::instance()->CFG->currency->sign_b4) { |
|
590 | + $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due']; |
|
591 | 591 | } else { |
592 | - $this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign; |
|
592 | + $this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign; |
|
593 | 593 | } |
594 | - $this->_template_args['amount_due_class'] = ''; |
|
594 | + $this->_template_args['amount_due_class'] = ''; |
|
595 | 595 | |
596 | - if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) { |
|
596 | + if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) { |
|
597 | 597 | // paid in full |
598 | - $this->_template_args['amount_due'] = FALSE; |
|
599 | - } elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) { |
|
598 | + $this->_template_args['amount_due'] = FALSE; |
|
599 | + } elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) { |
|
600 | 600 | // overpaid |
601 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
602 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) { |
|
601 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
602 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) { |
|
603 | 603 | // monies owing |
604 | - $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
605 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) { |
|
604 | + $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
605 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) { |
|
606 | 606 | // no payments made yet |
607 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
608 | - } elseif ( $this->_transaction->get('TXN_total') == 0 ) { |
|
607 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
608 | + } elseif ($this->_transaction->get('TXN_total') == 0) { |
|
609 | 609 | // free event |
610 | - $this->_template_args['amount_due'] = FALSE; |
|
610 | + $this->_template_args['amount_due'] = FALSE; |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | $payment_method = $this->_transaction->payment_method(); |
614 | 614 | |
615 | 615 | $this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method |
616 | 616 | ? $payment_method->admin_name() |
617 | - : __( 'Unknown', 'event_espresso' ); |
|
617 | + : __('Unknown', 'event_espresso'); |
|
618 | 618 | |
619 | 619 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
620 | 620 | // link back to overview |
621 | - $this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] ) |
|
621 | + $this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER']) |
|
622 | 622 | ? $_SERVER['HTTP_REFERER'] |
623 | 623 | : TXN_ADMIN_URL; |
624 | 624 | |
@@ -626,13 +626,13 @@ discard block |
||
626 | 626 | // next link |
627 | 627 | $next_txn = $this->_transaction->next( |
628 | 628 | null, |
629 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
629 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
630 | 630 | 'TXN_ID' |
631 | 631 | ); |
632 | 632 | $this->_template_args['next_transaction'] = $next_txn |
633 | 633 | ? $this->_next_link( |
634 | 634 | EE_Admin_Page::add_query_args_and_nonce( |
635 | - array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ), |
|
635 | + array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']), |
|
636 | 636 | TXN_ADMIN_URL |
637 | 637 | ), |
638 | 638 | 'dashicons dashicons-arrow-right ee-icon-size-22' |
@@ -641,13 +641,13 @@ discard block |
||
641 | 641 | // previous link |
642 | 642 | $previous_txn = $this->_transaction->previous( |
643 | 643 | null, |
644 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
644 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
645 | 645 | 'TXN_ID' |
646 | 646 | ); |
647 | 647 | $this->_template_args['previous_transaction'] = $previous_txn |
648 | 648 | ? $this->_previous_link( |
649 | 649 | EE_Admin_Page::add_query_args_and_nonce( |
650 | - array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ), |
|
650 | + array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']), |
|
651 | 651 | TXN_ADMIN_URL |
652 | 652 | ), |
653 | 653 | 'dashicons dashicons-arrow-left ee-icon-size-22' |
@@ -657,16 +657,16 @@ discard block |
||
657 | 657 | // were we just redirected here after adding a new registration ??? |
658 | 658 | if ( |
659 | 659 | isset( |
660 | - $this->_req_data[ 'redirect_from' ], |
|
661 | - $this->_req_data[ 'EVT_ID' ], |
|
662 | - $this->_req_data[ 'event_name' ] |
|
660 | + $this->_req_data['redirect_from'], |
|
661 | + $this->_req_data['EVT_ID'], |
|
662 | + $this->_req_data['event_name'] |
|
663 | 663 | ) |
664 | 664 | ) { |
665 | 665 | if ( |
666 | 666 | EE_Registry::instance()->CAP->current_user_can( |
667 | 667 | 'ee_edit_registrations', |
668 | 668 | 'espresso_registrations_new_registration', |
669 | - $this->_req_data[ 'EVT_ID' ] |
|
669 | + $this->_req_data['EVT_ID'] |
|
670 | 670 | ) |
671 | 671 | ) { |
672 | 672 | $this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button-primary" href="'; |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | 'action' => 'new_registration', |
677 | 677 | 'return' => 'default', |
678 | 678 | 'TXN_ID' => $this->_transaction->ID(), |
679 | - 'event_id' => $this->_req_data[ 'EVT_ID' ], |
|
679 | + 'event_id' => $this->_req_data['EVT_ID'], |
|
680 | 680 | ), |
681 | 681 | REG_ADMIN_URL |
682 | 682 | ); |
@@ -684,17 +684,17 @@ discard block |
||
684 | 684 | |
685 | 685 | $this->_admin_page_title .= sprintf( |
686 | 686 | __('Add Another New Registration to Event: "%1$s" ?'), |
687 | - htmlentities( urldecode( $this->_req_data[ 'event_name' ] ), ENT_QUOTES, 'UTF-8' ) |
|
687 | + htmlentities(urldecode($this->_req_data['event_name']), ENT_QUOTES, 'UTF-8') |
|
688 | 688 | ); |
689 | 689 | $this->_admin_page_title .= '</a>'; |
690 | 690 | } |
691 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
691 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
692 | 692 | } |
693 | 693 | // grab messages at the last second |
694 | 694 | $this->_template_args['notices'] = EE_Error::get_notices(); |
695 | 695 | // path to template |
696 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php'; |
|
697 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
696 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php'; |
|
697 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
698 | 698 | |
699 | 699 | // the details template wrapper |
700 | 700 | $this->display_admin_page_with_sidebar(); |
@@ -713,18 +713,18 @@ discard block |
||
713 | 713 | |
714 | 714 | $this->_set_transaction_object(); |
715 | 715 | |
716 | - add_meta_box( 'edit-txn-details-mbox', __( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' ); |
|
716 | + add_meta_box('edit-txn-details-mbox', __('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high'); |
|
717 | 717 | add_meta_box( |
718 | 718 | 'edit-txn-attendees-mbox', |
719 | - __( 'Attendees Registered in this Transaction', 'event_espresso' ), |
|
720 | - array( $this, 'txn_attendees_meta_box' ), |
|
719 | + __('Attendees Registered in this Transaction', 'event_espresso'), |
|
720 | + array($this, 'txn_attendees_meta_box'), |
|
721 | 721 | $this->_wp_page_slug, |
722 | 722 | 'normal', |
723 | 723 | 'high', |
724 | - array( 'TXN_ID' => $this->_transaction->ID() ) |
|
724 | + array('TXN_ID' => $this->_transaction->ID()) |
|
725 | 725 | ); |
726 | - add_meta_box( 'edit-txn-registrant-mbox', __( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' ); |
|
727 | - add_meta_box( 'edit-txn-billing-info-mbox', __( 'Billing Information', 'event_espresso' ), array( $this, 'txn_billing_info_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' ); |
|
726 | + add_meta_box('edit-txn-registrant-mbox', __('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high'); |
|
727 | + add_meta_box('edit-txn-billing-info-mbox', __('Billing Information', 'event_espresso'), array($this, 'txn_billing_info_side_meta_box'), $this->_wp_page_slug, 'side', 'high'); |
|
728 | 728 | |
729 | 729 | } |
730 | 730 | |
@@ -745,15 +745,15 @@ discard block |
||
745 | 745 | |
746 | 746 | //get line table |
747 | 747 | EEH_Autoloader::register_line_item_display_autoloaders(); |
748 | - $Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' ); |
|
749 | - $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() ); |
|
748 | + $Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy'); |
|
749 | + $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item()); |
|
750 | 750 | $this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code'); |
751 | 751 | |
752 | 752 | // process taxes |
753 | - $taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax ))); |
|
754 | - $this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE; |
|
753 | + $taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax))); |
|
754 | + $this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE; |
|
755 | 755 | |
756 | - $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE ); |
|
756 | + $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE); |
|
757 | 757 | $this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total'); |
758 | 758 | $this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID'); |
759 | 759 | |
@@ -761,63 +761,63 @@ discard block |
||
761 | 761 | |
762 | 762 | // process payment details |
763 | 763 | $payments = $this->_transaction->get_many_related('Payment'); |
764 | - if( ! empty( $payments ) ) { |
|
765 | - $this->_template_args[ 'payments' ] = $payments; |
|
766 | - $this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments ); |
|
764 | + if ( ! empty($payments)) { |
|
765 | + $this->_template_args['payments'] = $payments; |
|
766 | + $this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments); |
|
767 | 767 | } else { |
768 | - $this->_template_args[ 'payments' ] = false; |
|
769 | - $this->_template_args[ 'existing_reg_payments' ] = array(); |
|
768 | + $this->_template_args['payments'] = false; |
|
769 | + $this->_template_args['existing_reg_payments'] = array(); |
|
770 | 770 | } |
771 | 771 | |
772 | - $this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment' ), TXN_ADMIN_URL ); |
|
773 | - $this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL ); |
|
772 | + $this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL); |
|
773 | + $this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL); |
|
774 | 774 | |
775 | - if ( isset( $txn_details['invoice_number'] )) { |
|
775 | + if (isset($txn_details['invoice_number'])) { |
|
776 | 776 | $this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code']; |
777 | - $this->_template_args['txn_details']['invoice_number']['label'] = __( 'Invoice Number', 'event_espresso' ); |
|
777 | + $this->_template_args['txn_details']['invoice_number']['label'] = __('Invoice Number', 'event_espresso'); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | $this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session'); |
781 | - $this->_template_args['txn_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
781 | + $this->_template_args['txn_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
782 | 782 | |
783 | - $this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : ''; |
|
784 | - $this->_template_args['txn_details']['ip_address']['label'] = __( 'Transaction placed from IP', 'event_espresso' ); |
|
783 | + $this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : ''; |
|
784 | + $this->_template_args['txn_details']['ip_address']['label'] = __('Transaction placed from IP', 'event_espresso'); |
|
785 | 785 | |
786 | - $this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : ''; |
|
787 | - $this->_template_args['txn_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
786 | + $this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : ''; |
|
787 | + $this->_template_args['txn_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
788 | 788 | |
789 | 789 | $reg_steps = '<ul>'; |
790 | - foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) { |
|
791 | - if ( $reg_step_status === true ) { |
|
792 | - $reg_steps .= '<li style="color:#70cc50">' . sprintf( __( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
793 | - } else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) { |
|
794 | - $reg_steps .= '<li style="color:#2EA2CC">' . sprintf( |
|
795 | - __( '%1$s : Initiated %2$s', 'event_espresso' ), |
|
796 | - ucwords( str_replace( '_', ' ', $reg_step ) ), |
|
797 | - gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ) |
|
798 | - ) . '</li>'; |
|
790 | + foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) { |
|
791 | + if ($reg_step_status === true) { |
|
792 | + $reg_steps .= '<li style="color:#70cc50">'.sprintf(__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
793 | + } else if (is_numeric($reg_step_status) && $reg_step_status !== false) { |
|
794 | + $reg_steps .= '<li style="color:#2EA2CC">'.sprintf( |
|
795 | + __('%1$s : Initiated %2$s', 'event_espresso'), |
|
796 | + ucwords(str_replace('_', ' ', $reg_step)), |
|
797 | + gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS))) |
|
798 | + ).'</li>'; |
|
799 | 799 | } else { |
800 | - $reg_steps .= '<li style="color:#E76700">' . sprintf( __( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
800 | + $reg_steps .= '<li style="color:#E76700">'.sprintf(__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
801 | 801 | } |
802 | 802 | } |
803 | 803 | $reg_steps .= '</ul>'; |
804 | 804 | $this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps; |
805 | - $this->_template_args['txn_details']['reg_steps']['label'] = __( 'Registration Step Progress', 'event_espresso' ); |
|
805 | + $this->_template_args['txn_details']['reg_steps']['label'] = __('Registration Step Progress', 'event_espresso'); |
|
806 | 806 | |
807 | 807 | |
808 | 808 | $this->_get_registrations_to_apply_payment_to(); |
809 | - $this->_get_payment_methods( $payments ); |
|
809 | + $this->_get_payment_methods($payments); |
|
810 | 810 | $this->_get_payment_status_array(); |
811 | 811 | $this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction. |
812 | 812 | |
813 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction' ), TXN_ADMIN_URL ); |
|
814 | - $this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL ); |
|
815 | - $this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL ); |
|
813 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL); |
|
814 | + $this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL); |
|
815 | + $this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL); |
|
816 | 816 | |
817 | 817 | // 'espresso_delete_payment_nonce' |
818 | 818 | |
819 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
820 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
819 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
820 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
821 | 821 | |
822 | 822 | } |
823 | 823 | |
@@ -832,27 +832,27 @@ discard block |
||
832 | 832 | * @param EE_Payment[] $payments |
833 | 833 | * @return array |
834 | 834 | */ |
835 | - protected function _get_registration_payment_IDs( $payments = array() ) { |
|
835 | + protected function _get_registration_payment_IDs($payments = array()) { |
|
836 | 836 | $existing_reg_payments = array(); |
837 | 837 | // get all reg payments for these payments |
838 | - $reg_payments = EEM_Registration_Payment::instance()->get_all( array( |
|
838 | + $reg_payments = EEM_Registration_Payment::instance()->get_all(array( |
|
839 | 839 | array( |
840 | 840 | 'PAY_ID' => array( |
841 | 841 | 'IN', |
842 | - array_keys( $payments ) |
|
842 | + array_keys($payments) |
|
843 | 843 | ) |
844 | 844 | ) |
845 | - ) ); |
|
846 | - if ( ! empty( $reg_payments ) ) { |
|
847 | - foreach ( $payments as $payment ) { |
|
848 | - if ( ! $payment instanceof EE_Payment ) { |
|
845 | + )); |
|
846 | + if ( ! empty($reg_payments)) { |
|
847 | + foreach ($payments as $payment) { |
|
848 | + if ( ! $payment instanceof EE_Payment) { |
|
849 | 849 | continue; |
850 | - } else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) { |
|
851 | - $existing_reg_payments[ $payment->ID() ] = array(); |
|
850 | + } else if ( ! isset($existing_reg_payments[$payment->ID()])) { |
|
851 | + $existing_reg_payments[$payment->ID()] = array(); |
|
852 | 852 | } |
853 | - foreach ( $reg_payments as $reg_payment ) { |
|
854 | - if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) { |
|
855 | - $existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID(); |
|
853 | + foreach ($reg_payments as $reg_payment) { |
|
854 | + if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) { |
|
855 | + $existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID(); |
|
856 | 856 | } |
857 | 857 | } |
858 | 858 | } |
@@ -889,39 +889,39 @@ discard block |
||
889 | 889 | $registrations_to_apply_payment_to .= '<br /><div class="admin-primary-mbox-tbl-wrap">'; |
890 | 890 | $registrations_to_apply_payment_to .= '<table class="admin-primary-mbox-tbl">'; |
891 | 891 | $registrations_to_apply_payment_to .= '<thead><tr>'; |
892 | - $registrations_to_apply_payment_to .= '<td>' . __( 'ID', 'event_espresso' ) . '</td>'; |
|
893 | - $registrations_to_apply_payment_to .= '<td>' . __( 'Registrant', 'event_espresso' ) . '</td>'; |
|
894 | - $registrations_to_apply_payment_to .= '<td>' . __( 'Ticket', 'event_espresso' ) . '</td>'; |
|
895 | - $registrations_to_apply_payment_to .= '<td>' . __( 'Event', 'event_espresso' ) . '</td>'; |
|
896 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">' . __( 'Paid', 'event_espresso' ) . '</td>'; |
|
897 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">' . __( 'Owing', 'event_espresso' ) . '</td>'; |
|
898 | - $registrations_to_apply_payment_to .= '<td class="jst-cntr">' . __( 'Apply', 'event_espresso' ) . '</td>'; |
|
892 | + $registrations_to_apply_payment_to .= '<td>'.__('ID', 'event_espresso').'</td>'; |
|
893 | + $registrations_to_apply_payment_to .= '<td>'.__('Registrant', 'event_espresso').'</td>'; |
|
894 | + $registrations_to_apply_payment_to .= '<td>'.__('Ticket', 'event_espresso').'</td>'; |
|
895 | + $registrations_to_apply_payment_to .= '<td>'.__('Event', 'event_espresso').'</td>'; |
|
896 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">'.__('Paid', 'event_espresso').'</td>'; |
|
897 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">'.__('Owing', 'event_espresso').'</td>'; |
|
898 | + $registrations_to_apply_payment_to .= '<td class="jst-cntr">'.__('Apply', 'event_espresso').'</td>'; |
|
899 | 899 | $registrations_to_apply_payment_to .= '</tr></thead><tbody>'; |
900 | 900 | // get registrations for TXN |
901 | - $registrations = $this->_transaction->registrations( $query_params ); |
|
902 | - foreach ( $registrations as $registration ) { |
|
903 | - if ( $registration instanceof EE_Registration ) { |
|
901 | + $registrations = $this->_transaction->registrations($query_params); |
|
902 | + foreach ($registrations as $registration) { |
|
903 | + if ($registration instanceof EE_Registration) { |
|
904 | 904 | $owing = $registration->final_price() - $registration->paid(); |
905 | - $taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> ' . __( '+ tax', 'event_espresso' ) . '</span>' : ''; |
|
906 | - $checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments ) ? ' checked="checked"' : ''; |
|
907 | - $registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-' . $registration->ID() . '">'; |
|
905 | + $taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> '.__('+ tax', 'event_espresso').'</span>' : ''; |
|
906 | + $checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments) ? ' checked="checked"' : ''; |
|
907 | + $registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-'.$registration->ID().'">'; |
|
908 | 908 | // add html for checkbox input and label |
909 | - $registrations_to_apply_payment_to .= '<td>' . $registration->ID() . '</td>'; |
|
910 | - $registrations_to_apply_payment_to .= '<td>' . $registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ) . '</td>'; |
|
911 | - $registrations_to_apply_payment_to .= '<td>' . $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable . '</td>'; |
|
912 | - $registrations_to_apply_payment_to .= '<td>' . $registration->event_name() . '</td>'; |
|
913 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">' . $registration->pretty_paid() . '</td>'; |
|
914 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">' . EEH_Template::format_currency( $owing ) . '</td>'; |
|
909 | + $registrations_to_apply_payment_to .= '<td>'.$registration->ID().'</td>'; |
|
910 | + $registrations_to_apply_payment_to .= '<td>'.$registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __('Unknown Attendee', 'event_espresso').'</td>'; |
|
911 | + $registrations_to_apply_payment_to .= '<td>'.$registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable.'</td>'; |
|
912 | + $registrations_to_apply_payment_to .= '<td>'.$registration->event_name().'</td>'; |
|
913 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">'.$registration->pretty_paid().'</td>'; |
|
914 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">'.EEH_Template::format_currency($owing).'</td>'; |
|
915 | 915 | $registrations_to_apply_payment_to .= '<td class="jst-cntr">'; |
916 | 916 | $disabled = $registration->final_price() > 0 ? '' : ' disabled'; |
917 | - $registrations_to_apply_payment_to .= '<input type="checkbox" value="' . $registration->ID() . '" name="txn_admin_payment[registrations]"' . $checked . $disabled . '>'; |
|
917 | + $registrations_to_apply_payment_to .= '<input type="checkbox" value="'.$registration->ID().'" name="txn_admin_payment[registrations]"'.$checked.$disabled.'>'; |
|
918 | 918 | $registrations_to_apply_payment_to .= '</td>'; |
919 | 919 | $registrations_to_apply_payment_to .= '</tr>'; |
920 | 920 | } |
921 | 921 | } |
922 | 922 | $registrations_to_apply_payment_to .= '</tbody></table></div>'; |
923 | - $registrations_to_apply_payment_to .= '<p class="clear description">' . __( 'The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso' ) . '</p></div>'; |
|
924 | - $this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to; |
|
923 | + $registrations_to_apply_payment_to .= '<p class="clear description">'.__('The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso').'</p></div>'; |
|
924 | + $this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to; |
|
925 | 925 | } |
926 | 926 | |
927 | 927 | |
@@ -938,9 +938,9 @@ discard block |
||
938 | 938 | $statuses = EEM_Registration::reg_status_array(array(), TRUE); |
939 | 939 | //let's add a "don't change" option. |
940 | 940 | $status_array['NAN'] = __('Leave the Same', 'event_espresso'); |
941 | - $status_array = array_merge( $status_array, $statuses ); |
|
942 | - $this->_template_args['status_change_select'] = EEH_Form_Fields::select_input( 'txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status' ); |
|
943 | - $this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input( 'delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status' ); |
|
941 | + $status_array = array_merge($status_array, $statuses); |
|
942 | + $this->_template_args['status_change_select'] = EEH_Form_Fields::select_input('txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status'); |
|
943 | + $this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input('delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status'); |
|
944 | 944 | |
945 | 945 | } |
946 | 946 | |
@@ -955,21 +955,21 @@ discard block |
||
955 | 955 | * @param EE_Payment[] to show on this page |
956 | 956 | * @return void |
957 | 957 | */ |
958 | - private function _get_payment_methods( $payments = array() ) { |
|
958 | + private function _get_payment_methods($payments = array()) { |
|
959 | 959 | $payment_methods_of_payments = array(); |
960 | - foreach( $payments as $payment ){ |
|
961 | - if( $payment instanceof EE_Payment ){ |
|
962 | - $payment_methods_of_payments[] = $payment->get( 'PMD_ID' ); |
|
960 | + foreach ($payments as $payment) { |
|
961 | + if ($payment instanceof EE_Payment) { |
|
962 | + $payment_methods_of_payments[] = $payment->get('PMD_ID'); |
|
963 | 963 | } |
964 | 964 | } |
965 | - if( $payment_methods_of_payments ){ |
|
966 | - $query_args = array( array( 'OR*payment_method_for_payment' => array( |
|
967 | - 'PMD_ID' => array( 'IN', $payment_methods_of_payments ), |
|
968 | - 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) ); |
|
969 | - }else{ |
|
970 | - $query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ); |
|
965 | + if ($payment_methods_of_payments) { |
|
966 | + $query_args = array(array('OR*payment_method_for_payment' => array( |
|
967 | + 'PMD_ID' => array('IN', $payment_methods_of_payments), |
|
968 | + 'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') ))); |
|
969 | + } else { |
|
970 | + $query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%'))); |
|
971 | 971 | } |
972 | - $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args ); |
|
972 | + $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args); |
|
973 | 973 | } |
974 | 974 | |
975 | 975 | |
@@ -983,46 +983,46 @@ discard block |
||
983 | 983 | * @param array $metabox |
984 | 984 | * @return void |
985 | 985 | */ |
986 | - public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) { |
|
986 | + public function txn_attendees_meta_box($post, $metabox = array('args' => array())) { |
|
987 | 987 | |
988 | - extract( $metabox['args'] ); |
|
988 | + extract($metabox['args']); |
|
989 | 989 | $this->_template_args['post'] = $post; |
990 | 990 | $this->_template_args['event_attendees'] = array(); |
991 | 991 | // process items in cart |
992 | - $line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) ); |
|
993 | - if ( ! empty( $line_items )) { |
|
994 | - foreach ( $line_items as $item ) { |
|
995 | - if ( $item instanceof EE_Line_Item ) { |
|
996 | - switch( $item->OBJ_type() ) { |
|
992 | + $line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item'))); |
|
993 | + if ( ! empty($line_items)) { |
|
994 | + foreach ($line_items as $item) { |
|
995 | + if ($item instanceof EE_Line_Item) { |
|
996 | + switch ($item->OBJ_type()) { |
|
997 | 997 | |
998 | 998 | case 'Event' : |
999 | 999 | break; |
1000 | 1000 | |
1001 | 1001 | case 'Ticket' : |
1002 | 1002 | $ticket = $item->ticket(); |
1003 | - if ( empty( $ticket )) { |
|
1003 | + if (empty($ticket)) { |
|
1004 | 1004 | continue; //right now we're only handling tickets here. Cause its expected that only tickets will have attendees right? |
1005 | 1005 | } |
1006 | - $ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' )); |
|
1006 | + $ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price')); |
|
1007 | 1007 | $event = $ticket->get_first_related('Registration')->get_first_related('Event'); |
1008 | - $event_name = $event instanceof EE_Event ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') : ''; |
|
1008 | + $event_name = $event instanceof EE_Event ? $event->get('EVT_name').' - '.$item->get('LIN_name') : ''; |
|
1009 | 1009 | |
1010 | - $registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() ))); |
|
1011 | - foreach( $registrations as $registration ) { |
|
1012 | - $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count'); |
|
1013 | - $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1014 | - $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
1010 | + $registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID()))); |
|
1011 | + foreach ($registrations as $registration) { |
|
1012 | + $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count'); |
|
1013 | + $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1014 | + $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
1015 | 1015 | // attendee info |
1016 | 1016 | $attendee = $registration->get_first_related('Attendee'); |
1017 | - if ( $attendee instanceof EE_Attendee ) { |
|
1017 | + if ($attendee instanceof EE_Attendee) { |
|
1018 | 1018 | $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID(); |
1019 | 1019 | $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name(); |
1020 | - $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:' . $attendee->email() . '?subject=' . $event->get('EVT_name') . __(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>'; |
|
1021 | - $this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array() ); |
|
1020 | + $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event->get('EVT_name').__(' Event', 'event_espresso').'">'.$attendee->email().'</a>'; |
|
1021 | + $this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array()); |
|
1022 | 1022 | } else { |
1023 | 1023 | $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = ''; |
1024 | 1024 | $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = ''; |
1025 | - $this->_template_args['event_attendees'][$registration->ID()]['email'] = ''; |
|
1025 | + $this->_template_args['event_attendees'][$registration->ID()]['email'] = ''; |
|
1026 | 1026 | $this->_template_args['event_attendees'][$registration->ID()]['address'] = ''; |
1027 | 1027 | } |
1028 | 1028 | } |
@@ -1032,12 +1032,12 @@ discard block |
||
1032 | 1032 | } |
1033 | 1033 | } |
1034 | 1034 | |
1035 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees' ), TXN_ADMIN_URL ); |
|
1036 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE ); |
|
1035 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL); |
|
1036 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE); |
|
1037 | 1037 | |
1038 | 1038 | } else { |
1039 | 1039 | echo sprintf( |
1040 | - __( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ), |
|
1040 | + __('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'), |
|
1041 | 1041 | '<p class="important-notice">', |
1042 | 1042 | '</p>' |
1043 | 1043 | ); |
@@ -1056,19 +1056,19 @@ discard block |
||
1056 | 1056 | */ |
1057 | 1057 | public function txn_registrant_side_meta_box() { |
1058 | 1058 | $primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null; |
1059 | - if ( ! $primary_att instanceof EE_Attendee ) { |
|
1059 | + if ( ! $primary_att instanceof EE_Attendee) { |
|
1060 | 1060 | $this->_template_args['no_attendee_message'] = __('There is no attached contact for this transaction. The transaction either failed due to an error or was abandoned.', 'event_espresso'); |
1061 | 1061 | $primary_att = EEM_Attendee::instance()->create_default_object(); |
1062 | 1062 | } |
1063 | - $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1063 | + $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1064 | 1064 | $this->_template_args['prime_reg_fname'] = $primary_att->fname(); |
1065 | 1065 | $this->_template_args['prime_reg_lname'] = $primary_att->lname(); |
1066 | - $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1066 | + $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1067 | 1067 | $this->_template_args['prime_reg_phone'] = $primary_att->phone(); |
1068 | - $this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'edit_attendee', 'post' => $primary_att->ID() ), REG_ADMIN_URL ); |
|
1068 | + $this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $primary_att->ID()), REG_ADMIN_URL); |
|
1069 | 1069 | // get formatted address for registrant |
1070 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att ); |
|
1071 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE ); |
|
1070 | + $this->_template_args['formatted_address'] = EEH_Address::format($primary_att); |
|
1071 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE); |
|
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | |
@@ -1084,12 +1084,12 @@ discard block |
||
1084 | 1084 | |
1085 | 1085 | $this->_template_args['billing_form'] = $this->_transaction->billing_info(); |
1086 | 1086 | $this->_template_args['billing_form_url'] = add_query_arg( |
1087 | - array( 'action' => 'edit_transaction', 'process' => 'billing' ), |
|
1087 | + array('action' => 'edit_transaction', 'process' => 'billing'), |
|
1088 | 1088 | TXN_ADMIN_URL |
1089 | 1089 | ); |
1090 | 1090 | |
1091 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1092 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/ |
|
1091 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1092 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/ |
|
1093 | 1093 | } |
1094 | 1094 | |
1095 | 1095 | |
@@ -1102,42 +1102,42 @@ discard block |
||
1102 | 1102 | * @return void |
1103 | 1103 | */ |
1104 | 1104 | public function apply_payments_or_refunds() { |
1105 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1105 | + $json_response_data = array('return_data' => FALSE); |
|
1106 | 1106 | $valid_data = $this->_validate_payment_request_data(); |
1107 | - if ( ! empty( $valid_data ) ) { |
|
1108 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1107 | + if ( ! empty($valid_data)) { |
|
1108 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1109 | 1109 | //save the new payment |
1110 | - $payment = $this->_create_payment_from_request_data( $valid_data ); |
|
1110 | + $payment = $this->_create_payment_from_request_data($valid_data); |
|
1111 | 1111 | // get the TXN for this payment |
1112 | 1112 | $transaction = $payment->transaction(); |
1113 | 1113 | // verify transaction |
1114 | - if ( $transaction instanceof EE_Transaction ) { |
|
1114 | + if ($transaction instanceof EE_Transaction) { |
|
1115 | 1115 | // calculate_total_payments_and_update_status |
1116 | - $this->_process_transaction_payments( $transaction ); |
|
1117 | - $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment ); |
|
1118 | - $this->_remove_existing_registration_payments( $payment, $PAY_ID ); |
|
1116 | + $this->_process_transaction_payments($transaction); |
|
1117 | + $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment); |
|
1118 | + $this->_remove_existing_registration_payments($payment, $PAY_ID); |
|
1119 | 1119 | // apply payment to registrations (if applicable) |
1120 | - if ( ! empty( $REG_IDs ) ) { |
|
1121 | - $this->_update_registration_payments( $transaction, $payment, $REG_IDs ); |
|
1120 | + if ( ! empty($REG_IDs)) { |
|
1121 | + $this->_update_registration_payments($transaction, $payment, $REG_IDs); |
|
1122 | 1122 | $this->_maybe_send_notifications(); |
1123 | 1123 | // now process status changes for the same registrations |
1124 | - $this->_process_registration_status_change( $transaction, $REG_IDs ); |
|
1124 | + $this->_process_registration_status_change($transaction, $REG_IDs); |
|
1125 | 1125 | } |
1126 | - $this->_maybe_send_notifications( $payment ); |
|
1126 | + $this->_maybe_send_notifications($payment); |
|
1127 | 1127 | //prepare to render page |
1128 | - $json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs ); |
|
1129 | - do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment ); |
|
1128 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs); |
|
1129 | + do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment); |
|
1130 | 1130 | } else { |
1131 | 1131 | EE_Error::add_error( |
1132 | - __( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ), |
|
1132 | + __('A valid Transaction for this payment could not be retrieved.', 'event_espresso'), |
|
1133 | 1133 | __FILE__, __FUNCTION__, __LINE__ |
1134 | 1134 | ); |
1135 | 1135 | } |
1136 | 1136 | } else { |
1137 | - EE_Error::add_error( __( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1137 | + EE_Error::add_error(__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1138 | 1138 | } |
1139 | 1139 | |
1140 | - $notices = EE_Error::get_notices( false, false, false ); |
|
1140 | + $notices = EE_Error::get_notices(false, false, false); |
|
1141 | 1141 | $this->_template_args = array( |
1142 | 1142 | 'data' => $json_response_data, |
1143 | 1143 | 'error' => $notices['errors'], |
@@ -1154,30 +1154,30 @@ discard block |
||
1154 | 1154 | * @return array |
1155 | 1155 | */ |
1156 | 1156 | protected function _validate_payment_request_data() { |
1157 | - if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) { |
|
1157 | + if ( ! isset($this->_req_data['txn_admin_payment'])) { |
|
1158 | 1158 | return false; |
1159 | 1159 | } |
1160 | 1160 | $payment_form = $this->_generate_payment_form_section(); |
1161 | 1161 | try { |
1162 | - if ( $payment_form->was_submitted() ) { |
|
1162 | + if ($payment_form->was_submitted()) { |
|
1163 | 1163 | $payment_form->receive_form_submission(); |
1164 | - if ( ! $payment_form->is_valid() ) { |
|
1164 | + if ( ! $payment_form->is_valid()) { |
|
1165 | 1165 | $submission_error_messages = array(); |
1166 | - foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) { |
|
1167 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1166 | + foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) { |
|
1167 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1168 | 1168 | $submission_error_messages[] = sprintf( |
1169 | - _x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ), |
|
1169 | + _x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'), |
|
1170 | 1170 | $validation_error->get_form_section()->html_label_text(), |
1171 | 1171 | $validation_error->getMessage() |
1172 | 1172 | ); |
1173 | 1173 | } |
1174 | 1174 | } |
1175 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1175 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1176 | 1176 | return array(); |
1177 | 1177 | } |
1178 | 1178 | } |
1179 | - } catch ( EE_Error $e ) { |
|
1180 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1179 | + } catch (EE_Error $e) { |
|
1180 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
1181 | 1181 | return array(); |
1182 | 1182 | } |
1183 | 1183 | return $payment_form->valid_data(); |
@@ -1199,63 +1199,63 @@ discard block |
||
1199 | 1199 | array( |
1200 | 1200 | 'default' => 0, |
1201 | 1201 | 'required' => false, |
1202 | - 'html_label_text' => __( 'Payment ID', 'event_espresso' ), |
|
1203 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1202 | + 'html_label_text' => __('Payment ID', 'event_espresso'), |
|
1203 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1204 | 1204 | ) |
1205 | 1205 | ), |
1206 | 1206 | 'TXN_ID' => new EE_Text_Input( |
1207 | 1207 | array( |
1208 | 1208 | 'default' => 0, |
1209 | 1209 | 'required' => true, |
1210 | - 'html_label_text' => __( 'Transaction ID', 'event_espresso' ), |
|
1211 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1210 | + 'html_label_text' => __('Transaction ID', 'event_espresso'), |
|
1211 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1212 | 1212 | ) |
1213 | 1213 | ), |
1214 | 1214 | 'type' => new EE_Text_Input( |
1215 | 1215 | array( |
1216 | 1216 | 'default' => 1, |
1217 | 1217 | 'required' => true, |
1218 | - 'html_label_text' => __( 'Payment or Refund', 'event_espresso' ), |
|
1219 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1218 | + 'html_label_text' => __('Payment or Refund', 'event_espresso'), |
|
1219 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1220 | 1220 | ) |
1221 | 1221 | ), |
1222 | 1222 | 'amount' => new EE_Text_Input( |
1223 | 1223 | array( |
1224 | 1224 | 'default' => 0, |
1225 | 1225 | 'required' => true, |
1226 | - 'html_label_text' => __( 'Payment amount', 'event_espresso' ), |
|
1227 | - 'validation_strategies' => array( new EE_Float_Normalization() ) |
|
1226 | + 'html_label_text' => __('Payment amount', 'event_espresso'), |
|
1227 | + 'validation_strategies' => array(new EE_Float_Normalization()) |
|
1228 | 1228 | ) |
1229 | 1229 | ), |
1230 | 1230 | 'status' => new EE_Text_Input( |
1231 | 1231 | array( |
1232 | 1232 | 'default' => EEM_Payment::status_id_approved, |
1233 | 1233 | 'required' => true, |
1234 | - 'html_label_text' => __( 'Payment status', 'event_espresso' ), |
|
1234 | + 'html_label_text' => __('Payment status', 'event_espresso'), |
|
1235 | 1235 | ) |
1236 | 1236 | ), |
1237 | 1237 | 'PMD_ID' => new EE_Text_Input( |
1238 | 1238 | array( |
1239 | 1239 | 'default' => 2, |
1240 | 1240 | 'required' => true, |
1241 | - 'html_label_text' => __( 'Payment Method', 'event_espresso' ), |
|
1242 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1241 | + 'html_label_text' => __('Payment Method', 'event_espresso'), |
|
1242 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1243 | 1243 | ) |
1244 | 1244 | ), |
1245 | 1245 | 'date' => new EE_Text_Input( |
1246 | 1246 | array( |
1247 | 1247 | 'default' => time(), |
1248 | 1248 | 'required' => true, |
1249 | - 'html_label_text' => __( 'Payment date', 'event_espresso' ), |
|
1249 | + 'html_label_text' => __('Payment date', 'event_espresso'), |
|
1250 | 1250 | ) |
1251 | 1251 | ), |
1252 | 1252 | 'txn_id_chq_nmbr' => new EE_Text_Input( |
1253 | 1253 | array( |
1254 | 1254 | 'default' => '', |
1255 | 1255 | 'required' => false, |
1256 | - 'html_label_text' => __( 'Transaction or Cheque Number', 'event_espresso' ), |
|
1256 | + 'html_label_text' => __('Transaction or Cheque Number', 'event_espresso'), |
|
1257 | 1257 | 'validation_strategies' => array( |
1258 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1258 | + new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100), |
|
1259 | 1259 | ) |
1260 | 1260 | ) |
1261 | 1261 | ), |
@@ -1263,9 +1263,9 @@ discard block |
||
1263 | 1263 | array( |
1264 | 1264 | 'default' => '', |
1265 | 1265 | 'required' => false, |
1266 | - 'html_label_text' => __( 'Purchase Order Number', 'event_espresso' ), |
|
1266 | + 'html_label_text' => __('Purchase Order Number', 'event_espresso'), |
|
1267 | 1267 | 'validation_strategies' => array( |
1268 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1268 | + new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100), |
|
1269 | 1269 | ) |
1270 | 1270 | ) |
1271 | 1271 | ), |
@@ -1273,9 +1273,9 @@ discard block |
||
1273 | 1273 | array( |
1274 | 1274 | 'default' => '', |
1275 | 1275 | 'required' => false, |
1276 | - 'html_label_text' => __( 'Extra Field for Accounting', 'event_espresso' ), |
|
1276 | + 'html_label_text' => __('Extra Field for Accounting', 'event_espresso'), |
|
1277 | 1277 | 'validation_strategies' => array( |
1278 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1278 | + new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100), |
|
1279 | 1279 | ) |
1280 | 1280 | ) |
1281 | 1281 | ), |
@@ -1292,37 +1292,37 @@ discard block |
||
1292 | 1292 | * @param array $valid_data |
1293 | 1293 | * @return EE_Payment |
1294 | 1294 | */ |
1295 | - protected function _create_payment_from_request_data( $valid_data ) { |
|
1296 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1295 | + protected function _create_payment_from_request_data($valid_data) { |
|
1296 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1297 | 1297 | // get payment amount |
1298 | - $amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0; |
|
1298 | + $amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0; |
|
1299 | 1299 | // payments have a type value of 1 and refunds have a type value of -1 |
1300 | 1300 | // so multiplying amount by type will give a positive value for payments, and negative values for refunds |
1301 | - $amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount; |
|
1301 | + $amount = $valid_data['type'] < 0 ? $amount * -1 : $amount; |
|
1302 | 1302 | // for some reason the date string coming in has extra spaces between the date and time. This fixes that. |
1303 | - $date = $valid_data['date'] ? preg_replace( '/\s+/', ' ', $valid_data['date'] ) : date( 'Y-m-d g:i a', current_time( 'timestamp' ) ); |
|
1303 | + $date = $valid_data['date'] ? preg_replace('/\s+/', ' ', $valid_data['date']) : date('Y-m-d g:i a', current_time('timestamp')); |
|
1304 | 1304 | $payment = EE_Payment::new_instance( |
1305 | 1305 | array( |
1306 | - 'TXN_ID' => $valid_data[ 'TXN_ID' ], |
|
1307 | - 'STS_ID' => $valid_data[ 'status' ], |
|
1306 | + 'TXN_ID' => $valid_data['TXN_ID'], |
|
1307 | + 'STS_ID' => $valid_data['status'], |
|
1308 | 1308 | 'PAY_timestamp' => $date, |
1309 | 1309 | 'PAY_source' => EEM_Payment_Method::scope_admin, |
1310 | - 'PMD_ID' => $valid_data[ 'PMD_ID' ], |
|
1310 | + 'PMD_ID' => $valid_data['PMD_ID'], |
|
1311 | 1311 | 'PAY_amount' => $amount, |
1312 | - 'PAY_txn_id_chq_nmbr' => $valid_data[ 'txn_id_chq_nmbr' ], |
|
1313 | - 'PAY_po_number' => $valid_data[ 'po_number' ], |
|
1314 | - 'PAY_extra_accntng' => $valid_data[ 'accounting' ], |
|
1312 | + 'PAY_txn_id_chq_nmbr' => $valid_data['txn_id_chq_nmbr'], |
|
1313 | + 'PAY_po_number' => $valid_data['po_number'], |
|
1314 | + 'PAY_extra_accntng' => $valid_data['accounting'], |
|
1315 | 1315 | 'PAY_details' => $valid_data, |
1316 | 1316 | 'PAY_ID' => $PAY_ID |
1317 | 1317 | ), |
1318 | 1318 | '', |
1319 | - array( 'Y-m-d', 'g:i a' ) |
|
1319 | + array('Y-m-d', 'g:i a') |
|
1320 | 1320 | ); |
1321 | 1321 | |
1322 | - if ( ! $payment->save() ) { |
|
1322 | + if ( ! $payment->save()) { |
|
1323 | 1323 | EE_Error::add_error( |
1324 | 1324 | sprintf( |
1325 | - __( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ), |
|
1325 | + __('Payment %1$d has not been successfully saved to the database.', 'event_espresso'), |
|
1326 | 1326 | $payment->ID() |
1327 | 1327 | ), |
1328 | 1328 | __FILE__, __FUNCTION__, __LINE__ |
@@ -1339,15 +1339,15 @@ discard block |
||
1339 | 1339 | * @param \EE_Transaction $transaction |
1340 | 1340 | * @return array |
1341 | 1341 | */ |
1342 | - protected function _process_transaction_payments( EE_Transaction $transaction ) { |
|
1342 | + protected function _process_transaction_payments(EE_Transaction $transaction) { |
|
1343 | 1343 | /** @type EE_Transaction_Payments $transaction_payments */ |
1344 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1344 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1345 | 1345 | //update the transaction with this payment |
1346 | - if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) { |
|
1347 | - EE_Error::add_success( __( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1346 | + if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) { |
|
1347 | + EE_Error::add_success(__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1348 | 1348 | } else { |
1349 | 1349 | EE_Error::add_error( |
1350 | - __( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' ) |
|
1350 | + __('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso') |
|
1351 | 1351 | , __FILE__, __FUNCTION__, __LINE__ |
1352 | 1352 | ); |
1353 | 1353 | } |
@@ -1363,19 +1363,19 @@ discard block |
||
1363 | 1363 | * @param \EE_Payment $payment |
1364 | 1364 | * @return array |
1365 | 1365 | */ |
1366 | - protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) { |
|
1366 | + protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) { |
|
1367 | 1367 | $REG_IDs = array(); |
1368 | 1368 | // grab array of IDs for specific registrations to apply changes to |
1369 | - if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) { |
|
1370 | - $REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ]; |
|
1369 | + if (isset($this->_req_data['txn_admin_payment']['registrations'])) { |
|
1370 | + $REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations']; |
|
1371 | 1371 | } |
1372 | 1372 | //nothing specified ? then get all reg IDs |
1373 | - if ( empty( $REG_IDs ) ) { |
|
1373 | + if (empty($REG_IDs)) { |
|
1374 | 1374 | $registrations = $payment->transaction()->registrations(); |
1375 | - $REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1375 | + $REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1376 | 1376 | } |
1377 | 1377 | // ensure that REG_IDs are integers and NOT strings |
1378 | - return array_map( 'intval', $REG_IDs ); |
|
1378 | + return array_map('intval', $REG_IDs); |
|
1379 | 1379 | } |
1380 | 1380 | |
1381 | 1381 | |
@@ -1392,7 +1392,7 @@ discard block |
||
1392 | 1392 | /** |
1393 | 1393 | * @param array $existing_reg_payment_REG_IDs |
1394 | 1394 | */ |
1395 | - public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) { |
|
1395 | + public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) { |
|
1396 | 1396 | $this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs; |
1397 | 1397 | } |
1398 | 1398 | |
@@ -1407,13 +1407,13 @@ discard block |
||
1407 | 1407 | * @param \EE_Payment $payment |
1408 | 1408 | * @return array |
1409 | 1409 | */ |
1410 | - protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) { |
|
1411 | - if ( $this->existing_reg_payment_REG_IDs() === null ) { |
|
1410 | + protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) { |
|
1411 | + if ($this->existing_reg_payment_REG_IDs() === null) { |
|
1412 | 1412 | // let's get any existing reg payment records for this payment |
1413 | - $existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' ); |
|
1413 | + $existing_reg_payment_REG_IDs = $payment->get_many_related('Registration'); |
|
1414 | 1414 | // but we only want the REG IDs, so grab the array keys |
1415 | - $existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array(); |
|
1416 | - $this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs ); |
|
1415 | + $existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array(); |
|
1416 | + $this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs); |
|
1417 | 1417 | } |
1418 | 1418 | return $this->existing_reg_payment_REG_IDs(); |
1419 | 1419 | } |
@@ -1432,23 +1432,23 @@ discard block |
||
1432 | 1432 | * @param int $PAY_ID |
1433 | 1433 | * @return bool; |
1434 | 1434 | */ |
1435 | - protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) { |
|
1435 | + protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) { |
|
1436 | 1436 | // newly created payments will have nothing recorded for $PAY_ID |
1437 | - if ( $PAY_ID == 0 ) { |
|
1437 | + if ($PAY_ID == 0) { |
|
1438 | 1438 | return false; |
1439 | 1439 | } |
1440 | - $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1441 | - if ( empty( $existing_reg_payment_REG_IDs )) { |
|
1440 | + $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1441 | + if (empty($existing_reg_payment_REG_IDs)) { |
|
1442 | 1442 | return false; |
1443 | 1443 | } |
1444 | 1444 | /** @type EE_Transaction_Payments $transaction_payments */ |
1445 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1445 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1446 | 1446 | return $transaction_payments->delete_registration_payments_and_update_registrations( |
1447 | 1447 | $payment, |
1448 | 1448 | array( |
1449 | 1449 | array( |
1450 | 1450 | 'PAY_ID' => $payment->ID(), |
1451 | - 'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ), |
|
1451 | + 'REG_ID' => array('IN', $existing_reg_payment_REG_IDs), |
|
1452 | 1452 | ) |
1453 | 1453 | ) |
1454 | 1454 | ); |
@@ -1467,25 +1467,25 @@ discard block |
||
1467 | 1467 | * @param array $REG_IDs |
1468 | 1468 | * @return bool |
1469 | 1469 | */ |
1470 | - protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) { |
|
1470 | + protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) { |
|
1471 | 1471 | // we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments() |
1472 | 1472 | // so let's do that using our set of REG_IDs from the form |
1473 | 1473 | $registration_query_where_params = array( |
1474 | - 'REG_ID' => array( 'IN', $REG_IDs ) |
|
1474 | + 'REG_ID' => array('IN', $REG_IDs) |
|
1475 | 1475 | ); |
1476 | 1476 | // but add in some conditions regarding payment, |
1477 | 1477 | // so that we don't apply payments to registrations that are free or have already been paid for |
1478 | 1478 | // but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative ) |
1479 | - if ( ! $payment->is_a_refund() ) { |
|
1480 | - $registration_query_where_params[ 'REG_final_price' ] = array( '!=', 0 ); |
|
1481 | - $registration_query_where_params[ 'REG_final_price*' ] = array( '!=', 'REG_paid', true ); |
|
1479 | + if ( ! $payment->is_a_refund()) { |
|
1480 | + $registration_query_where_params['REG_final_price'] = array('!=', 0); |
|
1481 | + $registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true); |
|
1482 | 1482 | } |
1483 | 1483 | //EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ ); |
1484 | - $registrations = $transaction->registrations( array( $registration_query_where_params ) ); |
|
1485 | - if ( ! empty( $registrations ) ) { |
|
1484 | + $registrations = $transaction->registrations(array($registration_query_where_params)); |
|
1485 | + if ( ! empty($registrations)) { |
|
1486 | 1486 | /** @type EE_Payment_Processor $payment_processor */ |
1487 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1488 | - $payment_processor->process_registration_payments( $transaction, $payment, $registrations ); |
|
1487 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1488 | + $payment_processor->process_registration_payments($transaction, $payment, $registrations); |
|
1489 | 1489 | } |
1490 | 1490 | } |
1491 | 1491 | |
@@ -1501,22 +1501,22 @@ discard block |
||
1501 | 1501 | * @param array $REG_IDs |
1502 | 1502 | * @return bool |
1503 | 1503 | */ |
1504 | - protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) { |
|
1504 | + protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) { |
|
1505 | 1505 | // first if there is no change in status then we get out. |
1506 | 1506 | if ( |
1507 | - ! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ) |
|
1507 | + ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status']) |
|
1508 | 1508 | || $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN' |
1509 | 1509 | ) { |
1510 | 1510 | //no error message, no change requested, just nothing to do man. |
1511 | 1511 | return FALSE; |
1512 | 1512 | } |
1513 | 1513 | /** @type EE_Transaction_Processor $transaction_processor */ |
1514 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1514 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1515 | 1515 | // made it here dude? Oh WOW. K, let's take care of changing the statuses |
1516 | 1516 | return $transaction_processor->manually_update_registration_statuses( |
1517 | 1517 | $transaction, |
1518 | - sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ), |
|
1519 | - array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) |
|
1518 | + sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']), |
|
1519 | + array(array('REG_ID' => array('IN', $REG_IDs))) |
|
1520 | 1520 | ); |
1521 | 1521 | } |
1522 | 1522 | |
@@ -1531,16 +1531,16 @@ discard block |
||
1531 | 1531 | * @param bool | null $delete_txn_reg_status_change |
1532 | 1532 | * @return array |
1533 | 1533 | */ |
1534 | - protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) { |
|
1534 | + protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) { |
|
1535 | 1535 | // was the payment deleted ? |
1536 | - if ( is_bool( $delete_txn_reg_status_change )) { |
|
1536 | + if (is_bool($delete_txn_reg_status_change)) { |
|
1537 | 1537 | return array( |
1538 | 1538 | 'PAY_ID' => $payment->ID(), |
1539 | 1539 | 'amount' => $payment->amount(), |
1540 | 1540 | 'total_paid' => $payment->transaction()->paid(), |
1541 | 1541 | 'txn_status' => $payment->transaction()->status_ID(), |
1542 | 1542 | 'pay_status' => $payment->STS_ID(), |
1543 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1543 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1544 | 1544 | 'delete_txn_reg_status_change' => $delete_txn_reg_status_change, |
1545 | 1545 | ); |
1546 | 1546 | } else { |
@@ -1552,16 +1552,16 @@ discard block |
||
1552 | 1552 | 'pay_status' => $payment->STS_ID(), |
1553 | 1553 | 'PAY_ID' => $payment->ID(), |
1554 | 1554 | 'STS_ID' => $payment->STS_ID(), |
1555 | - 'status' => self::$_pay_status[ $payment->STS_ID() ], |
|
1556 | - 'date' => $payment->timestamp( 'Y-m-d', 'h:i a' ), |
|
1557 | - 'method' => strtoupper( $payment->source() ), |
|
1555 | + 'status' => self::$_pay_status[$payment->STS_ID()], |
|
1556 | + 'date' => $payment->timestamp('Y-m-d', 'h:i a'), |
|
1557 | + 'method' => strtoupper($payment->source()), |
|
1558 | 1558 | 'PM_ID' => $payment->payment_method() ? $payment->payment_method()->ID() : 1, |
1559 | - 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : __( "Unknown", 'event_espresso' ), |
|
1559 | + 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'), |
|
1560 | 1560 | 'gateway_response' => $payment->gateway_response(), |
1561 | 1561 | 'txn_id_chq_nmbr' => $payment->txn_id_chq_nmbr(), |
1562 | 1562 | 'po_number' => $payment->po_number(), |
1563 | 1563 | 'extra_accntng' => $payment->extra_accntng(), |
1564 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1564 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1565 | 1565 | ); |
1566 | 1566 | } |
1567 | 1567 | } |
@@ -1576,39 +1576,39 @@ discard block |
||
1576 | 1576 | * @return void |
1577 | 1577 | */ |
1578 | 1578 | public function delete_payment() { |
1579 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1580 | - $PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0; |
|
1581 | - if ( $PAY_ID ) { |
|
1582 | - $delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false; |
|
1583 | - $payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID ); |
|
1584 | - if ( $payment instanceof EE_Payment ) { |
|
1585 | - $REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1579 | + $json_response_data = array('return_data' => FALSE); |
|
1580 | + $PAY_ID = isset($this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID']) ? absint($this->_req_data['delete_txn_admin_payment']['PAY_ID']) : 0; |
|
1581 | + if ($PAY_ID) { |
|
1582 | + $delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false; |
|
1583 | + $payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID); |
|
1584 | + if ($payment instanceof EE_Payment) { |
|
1585 | + $REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1586 | 1586 | /** @type EE_Transaction_Payments $transaction_payments */ |
1587 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1588 | - if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) { |
|
1589 | - $json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change ); |
|
1590 | - if ( $delete_txn_reg_status_change ) { |
|
1587 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1588 | + if ($transaction_payments->delete_payment_and_update_transaction($payment)) { |
|
1589 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change); |
|
1590 | + if ($delete_txn_reg_status_change) { |
|
1591 | 1591 | $this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1592 | 1592 | //MAKE sure we also add the delete_txn_req_status_change to the |
1593 | 1593 | //$_REQUEST global because that's how messages will be looking for it. |
1594 | 1594 | $_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1595 | 1595 | $this->_maybe_send_notifications(); |
1596 | - $this->_process_registration_status_change( $payment->transaction(), $REG_IDs ); |
|
1596 | + $this->_process_registration_status_change($payment->transaction(), $REG_IDs); |
|
1597 | 1597 | } |
1598 | 1598 | } |
1599 | 1599 | } else { |
1600 | 1600 | EE_Error::add_error( |
1601 | - __( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ), |
|
1601 | + __('Valid Payment data could not be retrieved from the database.', 'event_espresso'), |
|
1602 | 1602 | __FILE__, __FUNCTION__, __LINE__ |
1603 | 1603 | ); |
1604 | 1604 | } |
1605 | 1605 | } else { |
1606 | 1606 | EE_Error::add_error( |
1607 | - __( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ), |
|
1607 | + __('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'), |
|
1608 | 1608 | __FILE__, __FUNCTION__, __LINE__ |
1609 | 1609 | ); |
1610 | 1610 | } |
1611 | - $notices = EE_Error::get_notices( false, false, false); |
|
1611 | + $notices = EE_Error::get_notices(false, false, false); |
|
1612 | 1612 | $this->_template_args = array( |
1613 | 1613 | 'data' => $json_response_data, |
1614 | 1614 | 'success' => $notices['success'], |
@@ -1628,16 +1628,16 @@ discard block |
||
1628 | 1628 | * @param array $REG_IDs |
1629 | 1629 | * @return array |
1630 | 1630 | */ |
1631 | - protected function _registration_payment_data_array( $REG_IDs ) { |
|
1631 | + protected function _registration_payment_data_array($REG_IDs) { |
|
1632 | 1632 | $registration_payment_data = array(); |
1633 | 1633 | //if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows. |
1634 | - if ( ! empty( $REG_IDs ) ) { |
|
1635 | - $registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) ); |
|
1636 | - foreach ( $registrations as $registration ) { |
|
1637 | - if ( $registration instanceof EE_Registration ) { |
|
1638 | - $registration_payment_data[ $registration->ID() ] = array( |
|
1634 | + if ( ! empty($REG_IDs)) { |
|
1635 | + $registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs)))); |
|
1636 | + foreach ($registrations as $registration) { |
|
1637 | + if ($registration instanceof EE_Registration) { |
|
1638 | + $registration_payment_data[$registration->ID()] = array( |
|
1639 | 1639 | 'paid' => $registration->pretty_paid(), |
1640 | - 'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ), |
|
1640 | + 'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()), |
|
1641 | 1641 | ); |
1642 | 1642 | } |
1643 | 1643 | } |
@@ -1657,30 +1657,30 @@ discard block |
||
1657 | 1657 | * @access protected |
1658 | 1658 | * @param \EE_Payment | null $payment |
1659 | 1659 | */ |
1660 | - protected function _maybe_send_notifications( $payment = null ) { |
|
1661 | - switch ( $payment instanceof EE_Payment ) { |
|
1660 | + protected function _maybe_send_notifications($payment = null) { |
|
1661 | + switch ($payment instanceof EE_Payment) { |
|
1662 | 1662 | // payment notifications |
1663 | 1663 | case true : |
1664 | 1664 | if ( |
1665 | 1665 | isset( |
1666 | - $this->_req_data[ 'txn_payments' ], |
|
1667 | - $this->_req_data[ 'txn_payments' ][ 'send_notifications' ] |
|
1666 | + $this->_req_data['txn_payments'], |
|
1667 | + $this->_req_data['txn_payments']['send_notifications'] |
|
1668 | 1668 | ) && |
1669 | - filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1669 | + filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1670 | 1670 | ) { |
1671 | - $this->_process_payment_notification( $payment ); |
|
1671 | + $this->_process_payment_notification($payment); |
|
1672 | 1672 | } |
1673 | 1673 | break; |
1674 | 1674 | // registration notifications |
1675 | 1675 | case false : |
1676 | 1676 | if ( |
1677 | 1677 | isset( |
1678 | - $this->_req_data[ 'txn_reg_status_change' ], |
|
1679 | - $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] |
|
1678 | + $this->_req_data['txn_reg_status_change'], |
|
1679 | + $this->_req_data['txn_reg_status_change']['send_notifications'] |
|
1680 | 1680 | ) && |
1681 | - filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1681 | + filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1682 | 1682 | ) { |
1683 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
1683 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
1684 | 1684 | } |
1685 | 1685 | break; |
1686 | 1686 | } |
@@ -1696,11 +1696,11 @@ discard block |
||
1696 | 1696 | * @return void |
1697 | 1697 | */ |
1698 | 1698 | protected function _send_payment_reminder() { |
1699 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1700 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
1701 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array(); |
|
1702 | - do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction ); |
|
1703 | - $this->_redirect_after_action( FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE ); |
|
1699 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
1700 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
1701 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array(); |
|
1702 | + do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction); |
|
1703 | + $this->_redirect_after_action(FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE); |
|
1704 | 1704 | } |
1705 | 1705 | |
1706 | 1706 | |
@@ -1714,36 +1714,36 @@ discard block |
||
1714 | 1714 | * @param string $view |
1715 | 1715 | * @return mixed int = count || array of transaction objects |
1716 | 1716 | */ |
1717 | - public function get_transactions( $perpage, $count = FALSE, $view = '' ) { |
|
1717 | + public function get_transactions($perpage, $count = FALSE, $view = '') { |
|
1718 | 1718 | |
1719 | 1719 | $TXN = EEM_Transaction::instance(); |
1720 | 1720 | |
1721 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
1722 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
1721 | + $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year')); |
|
1722 | + $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y'); |
|
1723 | 1723 | |
1724 | 1724 | //make sure our timestamps start and end right at the boundaries for each day |
1725 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1726 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1725 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
1726 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
1727 | 1727 | |
1728 | 1728 | |
1729 | 1729 | //convert to timestamps |
1730 | - $start_date = strtotime( $start_date ); |
|
1731 | - $end_date = strtotime( $end_date ); |
|
1730 | + $start_date = strtotime($start_date); |
|
1731 | + $end_date = strtotime($end_date); |
|
1732 | 1732 | |
1733 | 1733 | //makes sure start date is the lowest value and vice versa |
1734 | - $start_date = min( $start_date, $end_date ); |
|
1735 | - $end_date = max( $start_date, $end_date ); |
|
1734 | + $start_date = min($start_date, $end_date); |
|
1735 | + $end_date = max($start_date, $end_date); |
|
1736 | 1736 | |
1737 | 1737 | //convert to correct format for query |
1738 | - $start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' ); |
|
1739 | - $end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' ); |
|
1738 | + $start_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s'); |
|
1739 | + $end_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s'); |
|
1740 | 1740 | |
1741 | 1741 | |
1742 | 1742 | |
1743 | 1743 | //set orderby |
1744 | 1744 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
1745 | 1745 | |
1746 | - switch ( $this->_req_data['orderby'] ) { |
|
1746 | + switch ($this->_req_data['orderby']) { |
|
1747 | 1747 | case 'TXN_ID': |
1748 | 1748 | $orderby = 'TXN_ID'; |
1749 | 1749 | break; |
@@ -1757,66 +1757,66 @@ discard block |
||
1757 | 1757 | $orderby = 'TXN_timestamp'; |
1758 | 1758 | } |
1759 | 1759 | |
1760 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
1761 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1762 | - $per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10; |
|
1763 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1760 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
1761 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1762 | + $per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10; |
|
1763 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1764 | 1764 | |
1765 | - $offset = ($current_page-1)*$per_page; |
|
1766 | - $limit = array( $offset, $per_page ); |
|
1765 | + $offset = ($current_page - 1) * $per_page; |
|
1766 | + $limit = array($offset, $per_page); |
|
1767 | 1767 | |
1768 | 1768 | $_where = array( |
1769 | - 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ), |
|
1769 | + 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)), |
|
1770 | 1770 | 'Registration.REG_count' => 1 |
1771 | 1771 | ); |
1772 | 1772 | |
1773 | - if ( isset( $this->_req_data['EVT_ID'] ) ) { |
|
1773 | + if (isset($this->_req_data['EVT_ID'])) { |
|
1774 | 1774 | $_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID']; |
1775 | 1775 | } |
1776 | 1776 | |
1777 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1778 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1777 | + if (isset($this->_req_data['s'])) { |
|
1778 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1779 | 1779 | $_where['OR'] = array( |
1780 | - 'Registration.Event.EVT_name' => array( 'LIKE', $search_string ), |
|
1781 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ), |
|
1782 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ), |
|
1783 | - 'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ), |
|
1784 | - 'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ), |
|
1785 | - 'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ), |
|
1786 | - 'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ), |
|
1787 | - 'Registration.Attendee.ATT_email' => array('LIKE', $search_string ), |
|
1788 | - 'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ), |
|
1789 | - 'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ), |
|
1790 | - 'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ), |
|
1791 | - 'Registration.REG_final_price' => array( 'LIKE', $search_string ), |
|
1792 | - 'Registration.REG_code' => array( 'LIKE', $search_string ), |
|
1793 | - 'Registration.REG_count' => array( 'LIKE' , $search_string ), |
|
1794 | - 'Registration.REG_group_size' => array( 'LIKE' , $search_string ), |
|
1795 | - 'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ), |
|
1796 | - 'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ), |
|
1797 | - 'Payment.PAY_source' => array('LIKE', $search_string ), |
|
1798 | - 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ), |
|
1799 | - 'TXN_session_data' => array( 'LIKE', $search_string ), |
|
1800 | - 'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string ) |
|
1780 | + 'Registration.Event.EVT_name' => array('LIKE', $search_string), |
|
1781 | + 'Registration.Event.EVT_desc' => array('LIKE', $search_string), |
|
1782 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $search_string), |
|
1783 | + 'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string), |
|
1784 | + 'Registration.Attendee.ATT_fname' => array('LIKE', $search_string), |
|
1785 | + 'Registration.Attendee.ATT_lname' => array('LIKE', $search_string), |
|
1786 | + 'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string), |
|
1787 | + 'Registration.Attendee.ATT_email' => array('LIKE', $search_string), |
|
1788 | + 'Registration.Attendee.ATT_address' => array('LIKE', $search_string), |
|
1789 | + 'Registration.Attendee.ATT_address2' => array('LIKE', $search_string), |
|
1790 | + 'Registration.Attendee.ATT_city' => array('LIKE', $search_string), |
|
1791 | + 'Registration.REG_final_price' => array('LIKE', $search_string), |
|
1792 | + 'Registration.REG_code' => array('LIKE', $search_string), |
|
1793 | + 'Registration.REG_count' => array('LIKE', $search_string), |
|
1794 | + 'Registration.REG_group_size' => array('LIKE', $search_string), |
|
1795 | + 'Registration.Ticket.TKT_name' => array('LIKE', $search_string), |
|
1796 | + 'Registration.Ticket.TKT_description' => array('LIKE', $search_string), |
|
1797 | + 'Payment.PAY_source' => array('LIKE', $search_string), |
|
1798 | + 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string), |
|
1799 | + 'TXN_session_data' => array('LIKE', $search_string), |
|
1800 | + 'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string) |
|
1801 | 1801 | ); |
1802 | 1802 | } |
1803 | 1803 | |
1804 | 1804 | //failed transactions |
1805 | - $failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE; |
|
1806 | - $abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE; |
|
1805 | + $failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE : FALSE; |
|
1806 | + $abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE : FALSE; |
|
1807 | 1807 | |
1808 | - if ( $failed ) { |
|
1809 | - $_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code; |
|
1810 | - } else if ( $abandoned ) { |
|
1808 | + if ($failed) { |
|
1809 | + $_where['STS_ID'] = EEM_Transaction::failed_status_code; |
|
1810 | + } else if ($abandoned) { |
|
1811 | 1811 | $_where['STS_ID'] = EEM_Transaction::abandoned_status_code; |
1812 | 1812 | } else { |
1813 | - $_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code ); |
|
1814 | - $_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code ); |
|
1813 | + $_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code); |
|
1814 | + $_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code); |
|
1815 | 1815 | } |
1816 | 1816 | |
1817 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit ); |
|
1817 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit); |
|
1818 | 1818 | |
1819 | - $transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params); |
|
1819 | + $transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params); |
|
1820 | 1820 | |
1821 | 1821 | |
1822 | 1822 | return $transactions; |
@@ -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 | |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | * @param bool $add_pound_sign |
28 | 28 | * @return string |
29 | 29 | */ |
30 | - public function get_sub_input_id( $option_value, $add_pound_sign = false ) { |
|
31 | - return $this->_append_chars( $this->_input->html_id( $add_pound_sign ), '-' ) . sanitize_key( $option_value ); |
|
30 | + public function get_sub_input_id($option_value, $add_pound_sign = false) { |
|
31 | + return $this->_append_chars($this->_input->html_id($add_pound_sign), '-').sanitize_key($option_value); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | * @return array |
41 | 41 | * @throws \EE_Error |
42 | 42 | */ |
43 | - public function get_html_input_ids( $add_pound_sign = false ) { |
|
43 | + public function get_html_input_ids($add_pound_sign = false) { |
|
44 | 44 | $html_input_ids = array(); |
45 | - foreach( $this->get_input()->options() as $value => $display ) { |
|
46 | - $html_input_ids[] = $this->get_sub_input_id( $value, $add_pound_sign ); |
|
45 | + foreach ($this->get_input()->options() as $value => $display) { |
|
46 | + $html_input_ids[] = $this->get_sub_input_id($value, $add_pound_sign); |
|
47 | 47 | } |
48 | 48 | return $html_input_ids; |
49 | 49 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @throws \EE_Error |
59 | 59 | */ |
60 | 60 | public function get_input() { |
61 | - if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base ){ |
|
61 | + if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) { |
|
62 | 62 | throw new EE_Error( |
63 | 63 | sprintf( |
64 | 64 | __( |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Class EE_Radio_Button_Display_Strategy |
4 | 4 | * displays a set of radio buttons |
@@ -15,33 +15,33 @@ discard block |
||
15 | 15 | * @throws EE_Error |
16 | 16 | * @return string of html to display the field |
17 | 17 | */ |
18 | - public function display(){ |
|
18 | + public function display() { |
|
19 | 19 | $input = $this->get_input(); |
20 | 20 | $input->set_label_sizes(); |
21 | 21 | $label_size_class = $input->get_label_size_class(); |
22 | 22 | $html = ''; |
23 | - foreach( $input->options() as $value => $display_text ){ |
|
24 | - $value = $input->get_normalization_strategy()->unnormalize( $value ); |
|
23 | + foreach ($input->options() as $value => $display_text) { |
|
24 | + $value = $input->get_normalization_strategy()->unnormalize($value); |
|
25 | 25 | |
26 | - $html_id = $this->get_sub_input_id( $value ); |
|
27 | - $html .= EEH_HTML::nl( 0, 'radio' ); |
|
28 | - $html .= '<label for="' . $html_id . '"'; |
|
29 | - $html .= ' id="' . $html_id . '-lbl"'; |
|
30 | - $html .= ' class="ee-radio-label-after' . $label_size_class . '">'; |
|
31 | - $html .= EEH_HTML::nl( 1, 'radio' ); |
|
32 | - $html .= '<input id="' . $html_id . '"'; |
|
33 | - $html .= ' name="' . $input->html_name() . '"'; |
|
34 | - $html .= ' class="' . $input->html_class() . '"'; |
|
35 | - $html .= ' style="' . $input->html_style() . '"'; |
|
26 | + $html_id = $this->get_sub_input_id($value); |
|
27 | + $html .= EEH_HTML::nl(0, 'radio'); |
|
28 | + $html .= '<label for="'.$html_id.'"'; |
|
29 | + $html .= ' id="'.$html_id.'-lbl"'; |
|
30 | + $html .= ' class="ee-radio-label-after'.$label_size_class.'">'; |
|
31 | + $html .= EEH_HTML::nl(1, 'radio'); |
|
32 | + $html .= '<input id="'.$html_id.'"'; |
|
33 | + $html .= ' name="'.$input->html_name().'"'; |
|
34 | + $html .= ' class="'.$input->html_class().'"'; |
|
35 | + $html .= ' style="'.$input->html_style().'"'; |
|
36 | 36 | $html .= ' type="radio"'; |
37 | - $html .= ' value="' . esc_attr( $value ) . '"'; |
|
37 | + $html .= ' value="'.esc_attr($value).'"'; |
|
38 | 38 | $html .= $input->raw_value() === $value ? ' checked="checked"' : ''; |
39 | 39 | $html .= '> '; |
40 | 40 | $html .= $display_text; |
41 | - $html .= EEH_HTML::nl( -1, 'radio' ) . '</label>'; |
|
41 | + $html .= EEH_HTML::nl( -1, 'radio' ).'</label>'; |
|
42 | 42 | |
43 | 43 | } |
44 | - $html .= EEH_HTML::div( '', '', 'clear-float' ); |
|
44 | + $html .= EEH_HTML::div('', '', 'clear-float'); |
|
45 | 45 | $html .= EEH_HTML::divx(); |
46 | 46 | return $html; |
47 | 47 | } |