@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | * |
546 | 546 | * @access public |
547 | 547 | * @param string $CNT_ISO |
548 | - * @return mixed string | array |
|
548 | + * @return string|null string | array |
|
549 | 549 | */ |
550 | 550 | public function display_country_settings( $CNT_ISO = '' ) { |
551 | 551 | |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | * delete_state |
709 | 709 | * |
710 | 710 | * @access public |
711 | - * @return boolean | void |
|
711 | + * @return false|null | void |
|
712 | 712 | */ |
713 | 713 | public function delete_state() { |
714 | 714 | $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE; |
@@ -938,10 +938,10 @@ discard block |
||
938 | 938 | /** |
939 | 939 | * generates a dropdown of all parent pages - copied from WP core |
940 | 940 | * |
941 | - * @param unknown_type $default |
|
942 | - * @param unknown_type $parent |
|
943 | - * @param unknown_type $level |
|
944 | - * @return unknown |
|
941 | + * @param integer $default |
|
942 | + * @param integer $parent |
|
943 | + * @param integer $level |
|
944 | + * @return null|false |
|
945 | 945 | */ |
946 | 946 | public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) { |
947 | 947 | global $wpdb; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | 'order' => 50 |
155 | 155 | ), |
156 | 156 | 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
157 | - 'help_tabs' => array( |
|
157 | + 'help_tabs' => array( |
|
158 | 158 | 'general_settings_critical_pages_help_tab' => array( |
159 | 159 | 'title' => __('Critical Pages', 'event_espresso'), |
160 | 160 | 'filename' => 'general_settings_critical_pages' |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | 'label' => __('Your Organization', 'event_espresso'), |
169 | 169 | 'order' => 20 |
170 | 170 | ), |
171 | - 'help_tabs' => array( |
|
171 | + 'help_tabs' => array( |
|
172 | 172 | 'general_settings_your_organization_help_tab' => array( |
173 | 173 | 'title' => __('Your Organization', 'event_espresso'), |
174 | 174 | 'filename' => 'general_settings_your_organization' |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | 'order' => 60 |
185 | 185 | ), |
186 | 186 | 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
187 | - 'help_tabs' => array( |
|
187 | + 'help_tabs' => array( |
|
188 | 188 | 'general_settings_admin_options_help_tab' => array( |
189 | 189 | 'title' => __('Admin Options', 'event_espresso'), |
190 | 190 | 'filename' => 'general_settings_admin_options' |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | 'label' => __('Countries', 'event_espresso'), |
199 | 199 | 'order' => 70 |
200 | 200 | ), |
201 | - 'help_tabs' => array( |
|
201 | + 'help_tabs' => array( |
|
202 | 202 | 'general_settings_countries_help_tab' => array( |
203 | 203 | 'title' => __('Countries', 'event_espresso'), |
204 | 204 | 'filename' => 'general_settings_countries' |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -419,8 +420,9 @@ discard block |
||
419 | 420 | } |
420 | 421 | |
421 | 422 | protected function _update_your_organization_settings() { |
422 | - if ( is_main_site() ) |
|
423 | - EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
423 | + if ( is_main_site() ) { |
|
424 | + EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
425 | + } |
|
424 | 426 | EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name; |
425 | 427 | EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1; |
426 | 428 | EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2; |
@@ -950,10 +952,11 @@ discard block |
||
950 | 952 | if ( $items ) { |
951 | 953 | foreach ( $items as $item ) { |
952 | 954 | $pad = str_repeat( ' ', $level * 3 ); |
953 | - if ( $item->ID == $default) |
|
954 | - $current = ' selected="selected"'; |
|
955 | - else |
|
956 | - $current = ''; |
|
955 | + if ( $item->ID == $default) { |
|
956 | + $current = ' selected="selected"'; |
|
957 | + } else { |
|
958 | + $current = ''; |
|
959 | + } |
|
957 | 960 | |
958 | 961 | echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>"; |
959 | 962 | parent_dropdown( $default, $item->ID, $level +1 ); |
@@ -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 | /** |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | |
43 | - public function __construct( $routing = TRUE ) { |
|
44 | - parent::__construct( $routing ); |
|
43 | + public function __construct($routing = TRUE) { |
|
44 | + parent::__construct($routing); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | |
58 | 58 | |
59 | 59 | protected function _ajax_hooks() { |
60 | - add_action('wp_ajax_espresso_display_country_settings', array( $this, 'display_country_settings')); |
|
61 | - add_action('wp_ajax_espresso_display_country_states', array( $this, 'display_country_states')); |
|
62 | - add_action('wp_ajax_espresso_delete_state', array( $this, 'delete_state'), 10, 3 ); |
|
63 | - add_action('wp_ajax_espresso_add_new_state', array( $this, 'add_new_state')); |
|
60 | + add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings')); |
|
61 | + add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states')); |
|
62 | + add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3); |
|
63 | + add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state')); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -153,14 +153,14 @@ discard block |
||
153 | 153 | 'label' => __('Critical Pages', 'event_espresso'), |
154 | 154 | 'order' => 50 |
155 | 155 | ), |
156 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
156 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
157 | 157 | 'help_tabs' => array( |
158 | 158 | 'general_settings_critical_pages_help_tab' => array( |
159 | 159 | 'title' => __('Critical Pages', 'event_espresso'), |
160 | 160 | 'filename' => 'general_settings_critical_pages' |
161 | 161 | ) |
162 | 162 | ), |
163 | - 'help_tour' => array( 'Critical_Pages_Help_Tour' ), |
|
163 | + 'help_tour' => array('Critical_Pages_Help_Tour'), |
|
164 | 164 | 'require_nonce' => FALSE |
165 | 165 | ), |
166 | 166 | 'default' => array( |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | 'filename' => 'general_settings_your_organization' |
175 | 175 | ) |
176 | 176 | ), |
177 | - 'help_tour' => array( 'Your_Organization_Help_Tour' ), |
|
178 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
177 | + 'help_tour' => array('Your_Organization_Help_Tour'), |
|
178 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
179 | 179 | 'require_nonce' => FALSE |
180 | 180 | ), |
181 | 181 | 'admin_option_settings' => array( |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | 'label' => __('Admin Options', 'event_espresso'), |
184 | 184 | 'order' => 60 |
185 | 185 | ), |
186 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
186 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
187 | 187 | 'help_tabs' => array( |
188 | 188 | 'general_settings_admin_options_help_tab' => array( |
189 | 189 | 'title' => __('Admin Options', 'event_espresso'), |
190 | 190 | 'filename' => 'general_settings_admin_options' |
191 | 191 | ) |
192 | 192 | ), |
193 | - 'help_tour' => array( 'Admin_Options_Help_Tour' ), |
|
193 | + 'help_tour' => array('Admin_Options_Help_Tour'), |
|
194 | 194 | 'require_nonce' => FALSE |
195 | 195 | ), |
196 | 196 | 'country_settings' => array( |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | 'filename' => 'general_settings_countries' |
205 | 205 | ) |
206 | 206 | ), |
207 | - 'help_tour' => array( 'Countries_Help_Tour' ), |
|
207 | + 'help_tour' => array('Countries_Help_Tour'), |
|
208 | 208 | 'require_nonce' => FALSE |
209 | 209 | ) |
210 | 210 | ); |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | } |
223 | 223 | |
224 | 224 | public function admin_init() { |
225 | - 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' ); |
|
226 | - EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' ); |
|
227 | - EE_Registry::$i18n_js_strings[ 'confirm_delete_state' ] = __( 'Are you sure you want to delete this State / Province?', 'event_espresso' ); |
|
228 | - $protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://'; |
|
229 | - EE_Registry::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php?page=espresso_general_settings', $protocol ); |
|
225 | + 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'); |
|
226 | + EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso'); |
|
227 | + EE_Registry::$i18n_js_strings['confirm_delete_state'] = __('Are you sure you want to delete this State / Province?', 'event_espresso'); |
|
228 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
229 | + EE_Registry::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php?page=espresso_general_settings', $protocol); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | public function admin_notices() {} |
@@ -239,21 +239,21 @@ discard block |
||
239 | 239 | //scripts |
240 | 240 | wp_enqueue_script('media-upload'); |
241 | 241 | wp_enqueue_script('thickbox'); |
242 | - wp_register_script( 'organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', array( 'jquery','media-upload','thickbox' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
243 | - wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION ); |
|
244 | - wp_enqueue_script( 'organization_settings' ); |
|
245 | - wp_enqueue_style( 'organization-css' ); |
|
246 | - $confirm_image_delete = array( 'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso')); |
|
247 | - wp_localize_script( 'organization_settings', 'confirm_image_delete', $confirm_image_delete ); |
|
242 | + wp_register_script('organization_settings', GEN_SET_ASSETS_URL.'your_organization_settings.js', array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, TRUE); |
|
243 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
244 | + wp_enqueue_script('organization_settings'); |
|
245 | + wp_enqueue_style('organization-css'); |
|
246 | + $confirm_image_delete = array('text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso')); |
|
247 | + wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete); |
|
248 | 248 | |
249 | 249 | } |
250 | 250 | |
251 | 251 | public function load_scripts_styles_country_settings() { |
252 | 252 | //scripts |
253 | - wp_register_script( 'gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', array( 'ee_admin_js' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
254 | - wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION ); |
|
255 | - wp_enqueue_script( 'gen_settings_countries' ); |
|
256 | - wp_enqueue_style( 'organization-css' ); |
|
253 | + wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL.'gen_settings_countries.js', array('ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
254 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
255 | + wp_enqueue_script('gen_settings_countries'); |
|
256 | + wp_enqueue_style('organization-css'); |
|
257 | 257 | |
258 | 258 | } |
259 | 259 | |
@@ -265,37 +265,37 @@ discard block |
||
265 | 265 | |
266 | 266 | // Check to make sure all of the main pages are setup properly, |
267 | 267 | // if not create the default pages and display an admin notice |
268 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
268 | + EE_Registry::instance()->load_helper('Activation'); |
|
269 | 269 | EEH_Activation::verify_default_pages_exist(); |
270 | 270 | |
271 | 271 | $this->_transient_garbage_collection(); |
272 | 272 | $this->_template_args['values'] = $this->_yes_no_values; |
273 | 273 | |
274 | - $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL; |
|
275 | - $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id ) : FALSE; |
|
274 | + $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? EE_Registry::instance()->CFG->core->reg_page_id : NULL; |
|
275 | + $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id) : FALSE; |
|
276 | 276 | |
277 | - $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ?EE_Registry::instance()->CFG->core->txn_page_id : NULL; |
|
278 | - $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id ) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id ) : FALSE; |
|
277 | + $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? EE_Registry::instance()->CFG->core->txn_page_id : NULL; |
|
278 | + $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id) : FALSE; |
|
279 | 279 | |
280 | - $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ?EE_Registry::instance()->CFG->core->thank_you_page_id : NULL; |
|
281 | - $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id ) : FALSE; |
|
280 | + $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? EE_Registry::instance()->CFG->core->thank_you_page_id : NULL; |
|
281 | + $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id) : FALSE; |
|
282 | 282 | |
283 | - $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL; |
|
284 | - $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id ) : FALSE; |
|
283 | + $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? EE_Registry::instance()->CFG->core->cancel_page_id : NULL; |
|
284 | + $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id) : FALSE; |
|
285 | 285 | |
286 | - $this->_set_add_edit_form_tags( 'update_espresso_page_settings' ); |
|
287 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
288 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', $this->_template_args, TRUE ); |
|
286 | + $this->_set_add_edit_form_tags('update_espresso_page_settings'); |
|
287 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
288 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', $this->_template_args, TRUE); |
|
289 | 289 | $this->display_admin_page_with_sidebar(); |
290 | 290 | |
291 | 291 | } |
292 | 292 | |
293 | 293 | protected function _update_espresso_page_settings() { |
294 | 294 | // capture incoming request data |
295 | - $reg_page_id = isset( $this->_req_data['reg_page_id'] ) ? absint( $this->_req_data['reg_page_id'] ) : EE_Registry::instance()->CFG->core->reg_page_id; |
|
296 | - $txn_page_id = isset( $this->_req_data['txn_page_id'] ) ? absint( $this->_req_data['txn_page_id'] ) : EE_Registry::instance()->CFG->core->txn_page_id; |
|
297 | - $thank_you_page_id = isset( $this->_req_data['thank_you_page_id'] ) ? absint( $this->_req_data['thank_you_page_id'] ) : EE_Registry::instance()->CFG->core->thank_you_page_id; |
|
298 | - $cancel_page_id = isset( $this->_req_data['cancel_page_id'] ) ? absint( $this->_req_data['cancel_page_id'] ) : EE_Registry::instance()->CFG->core->cancel_page_id; |
|
295 | + $reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id; |
|
296 | + $txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id; |
|
297 | + $thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id; |
|
298 | + $cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id; |
|
299 | 299 | // pack critical_pages into an array |
300 | 300 | $critical_pages = array( |
301 | 301 | 'reg_page_id' => $reg_page_id, |
@@ -303,17 +303,17 @@ discard block |
||
303 | 303 | 'thank_you_page_id' => $thank_you_page_id, |
304 | 304 | 'cancel_page_id' => $cancel_page_id |
305 | 305 | ); |
306 | - foreach ( $critical_pages as $critical_page_name => $critical_page_id ) { |
|
306 | + foreach ($critical_pages as $critical_page_name => $critical_page_id) { |
|
307 | 307 | // has the page changed ? |
308 | - if ( EE_Registry::instance()->CFG->core->$critical_page_name != $critical_page_id ) { |
|
308 | + if (EE_Registry::instance()->CFG->core->$critical_page_name != $critical_page_id) { |
|
309 | 309 | // grab post object for old page |
310 | - $post = get_post( EE_Registry::instance()->CFG->core->$critical_page_name ); |
|
310 | + $post = get_post(EE_Registry::instance()->CFG->core->$critical_page_name); |
|
311 | 311 | // update post shortcodes for old page |
312 | - EE_Admin::parse_post_content_on_save( $critical_page_id, $post ); |
|
312 | + EE_Admin::parse_post_content_on_save($critical_page_id, $post); |
|
313 | 313 | // grab post object for new page |
314 | - $post = get_post( $critical_page_id ); |
|
314 | + $post = get_post($critical_page_id); |
|
315 | 315 | // update post shortcodes for new page |
316 | - EE_Admin::parse_post_content_on_save( $critical_page_id, $post ); |
|
316 | + EE_Admin::parse_post_content_on_save($critical_page_id, $post); |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | // set page IDs |
@@ -322,14 +322,14 @@ discard block |
||
322 | 322 | EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id; |
323 | 323 | EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id; |
324 | 324 | |
325 | - EE_Registry::instance()->CFG->core = apply_filters( 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data ); |
|
325 | + EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data); |
|
326 | 326 | |
327 | 327 | $what = __('Critical Pages & Shortcodes', 'event_espresso'); |
328 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__ ); |
|
328 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__); |
|
329 | 329 | $query_args = array( |
330 | 330 | 'action' => 'critical_pages' |
331 | 331 | ); |
332 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
332 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
333 | 333 | |
334 | 334 | } |
335 | 335 | |
@@ -344,35 +344,35 @@ discard block |
||
344 | 344 | |
345 | 345 | protected function _your_organization_settings() { |
346 | 346 | |
347 | - $this->_template_args['site_license_key'] = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->get_pretty( 'site_license_key' ) : ''; |
|
348 | - $this->_template_args['organization_name'] = isset( EE_Registry::instance()->CFG->organization->name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : ''; |
|
349 | - $this->_template_args['organization_address_1'] = isset( EE_Registry::instance()->CFG->organization->address_1 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ) : ''; |
|
350 | - $this->_template_args['organization_address_2'] = isset( EE_Registry::instance()->CFG->organization->address_2 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ) : ''; |
|
351 | - $this->_template_args['organization_city'] = isset( EE_Registry::instance()->CFG->organization->city ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'city' ) : ''; |
|
352 | - $this->_template_args['organization_zip'] = isset( EE_Registry::instance()->CFG->organization->zip ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ) : ''; |
|
353 | - $this->_template_args['organization_email'] = isset( EE_Registry::instance()->CFG->organization->email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : ''; |
|
354 | - $this->_template_args['organization_phone'] = isset( EE_Registry::instance()->CFG->organization->phone ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ) : ''; |
|
355 | - $this->_template_args['organization_vat'] = isset( EE_Registry::instance()->CFG->organization->vat ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'vat' ) : ''; |
|
356 | - $this->_template_args['currency_sign'] = isset( EE_Registry::instance()->CFG->currency->sign ) ? EE_Registry::instance()->CFG->currency->get_pretty( 'sign' ) : '$'; |
|
357 | - $this->_template_args['organization_logo_url'] = isset( EE_Registry::instance()->CFG->organization->logo_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) : FALSE; |
|
358 | - $this->_template_args['organization_facebook'] = isset( EE_Registry::instance()->CFG->organization->facebook ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : ''; |
|
359 | - $this->_template_args['organization_twitter'] = isset( EE_Registry::instance()->CFG->organization->twitter ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : ''; |
|
360 | - $this->_template_args['organization_linkedin'] = isset( EE_Registry::instance()->CFG->organization->linkedin ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ) : ''; |
|
361 | - $this->_template_args['organization_pinterest'] = isset( EE_Registry::instance()->CFG->organization->pinterest ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ) : ''; |
|
362 | - $this->_template_args['organization_google'] = isset( EE_Registry::instance()->CFG->organization->google ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'google' ) : ''; |
|
363 | - $this->_template_args['organization_instagram'] = isset( EE_Registry::instance()->CFG->organization->instagram ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ) : ''; |
|
347 | + $this->_template_args['site_license_key'] = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : ''; |
|
348 | + $this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : ''; |
|
349 | + $this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : ''; |
|
350 | + $this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : ''; |
|
351 | + $this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : ''; |
|
352 | + $this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : ''; |
|
353 | + $this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : ''; |
|
354 | + $this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : ''; |
|
355 | + $this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : ''; |
|
356 | + $this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$'; |
|
357 | + $this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : FALSE; |
|
358 | + $this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : ''; |
|
359 | + $this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : ''; |
|
360 | + $this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : ''; |
|
361 | + $this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : ''; |
|
362 | + $this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : ''; |
|
363 | + $this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : ''; |
|
364 | 364 | //UXIP settings |
365 | - $this->_template_args['ee_ueip_optin'] = isset( EE_Registry::instance()->CFG->core->ee_ueip_optin ) ? EE_Registry::instance()->CFG->core->get_pretty( 'ee_ueip_optin' ) : TRUE; |
|
365 | + $this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : TRUE; |
|
366 | 366 | |
367 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
368 | - $STA_ID = isset( EE_Registry::instance()->CFG->organization->STA_ID ) ? EE_Registry::instance()->CFG->organization->STA_ID : 4; |
|
367 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
368 | + $STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4; |
|
369 | 369 | $this->_template_args['states'] = new EE_Question_Form_Input( |
370 | - EE_Question::new_instance ( array( |
|
370 | + EE_Question::new_instance(array( |
|
371 | 371 | 'QST_ID'=> 0, |
372 | 372 | 'QST_display_text'=> __('State/Province', 'event_espresso'), |
373 | 373 | 'QST_system'=>'admin-state' |
374 | 374 | )), |
375 | - EE_Answer::new_instance ( array( |
|
375 | + EE_Answer::new_instance(array( |
|
376 | 376 | 'ANS_ID' => 0, |
377 | 377 | 'ANS_value' => $STA_ID |
378 | 378 | )), |
@@ -384,14 +384,14 @@ discard block |
||
384 | 384 | ) |
385 | 385 | ); |
386 | 386 | |
387 | - $CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
387 | + $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
388 | 388 | $this->_template_args['countries'] = new EE_Question_Form_Input( |
389 | - EE_Question::new_instance ( array( |
|
389 | + EE_Question::new_instance(array( |
|
390 | 390 | 'QST_ID'=> 0, |
391 | 391 | 'QST_display_text'=> __('Country', 'event_espresso'), |
392 | 392 | 'QST_system'=>'admin-country' |
393 | 393 | )), |
394 | - EE_Answer::new_instance ( array( |
|
394 | + EE_Answer::new_instance(array( |
|
395 | 395 | 'ANS_ID' => 0, |
396 | 396 | 'ANS_value' => $CNT_ISO |
397 | 397 | )), |
@@ -403,51 +403,51 @@ discard block |
||
403 | 403 | ) |
404 | 404 | ); |
405 | 405 | |
406 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
407 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
406 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
407 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
408 | 408 | |
409 | 409 | //PUE verification stuff |
410 | - $ver_option_key = 'puvererr_' . basename( EE_PLUGIN_BASENAME ); |
|
411 | - $verify_fail = get_option( $ver_option_key ); |
|
412 | - $this->_template_args['site_license_key_verified'] = $verify_fail || !empty( $verify_fail ) || ( empty( $this->_template_args['site_license_key'] ) && empty( $verify_fail ) )? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>'; |
|
410 | + $ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME); |
|
411 | + $verify_fail = get_option($ver_option_key); |
|
412 | + $this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>'; |
|
413 | 413 | |
414 | - $this->_set_add_edit_form_tags( 'update_your_organization_settings' ); |
|
415 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
416 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', $this->_template_args, TRUE ); |
|
414 | + $this->_set_add_edit_form_tags('update_your_organization_settings'); |
|
415 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
416 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php', $this->_template_args, TRUE); |
|
417 | 417 | |
418 | 418 | $this->display_admin_page_with_sidebar(); |
419 | 419 | } |
420 | 420 | |
421 | 421 | protected function _update_your_organization_settings() { |
422 | - if ( is_main_site() ) |
|
423 | - EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
424 | - EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name; |
|
425 | - EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1; |
|
426 | - EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2; |
|
427 | - EE_Registry::instance()->CFG->organization->city = isset( $this->_req_data['organization_city'] ) ? sanitize_text_field( $this->_req_data['organization_city'] ) : EE_Registry::instance()->CFG->organization->city; |
|
428 | - EE_Registry::instance()->CFG->organization->STA_ID = isset( $this->_req_data['organization_state'] ) ? absint( $this->_req_data['organization_state'] ) : EE_Registry::instance()->CFG->organization->STA_ID; |
|
429 | - EE_Registry::instance()->CFG->organization->CNT_ISO = isset( $this->_req_data['organization_country'] ) ? sanitize_text_field( $this->_req_data['organization_country'] ) : EE_Registry::instance()->CFG->organization->CNT_ISO; |
|
430 | - EE_Registry::instance()->CFG->organization->zip = isset( $this->_req_data['organization_zip'] ) ? sanitize_text_field( $this->_req_data['organization_zip'] ) : EE_Registry::instance()->CFG->organization->zip; |
|
431 | - EE_Registry::instance()->CFG->organization->email = isset( $this->_req_data['organization_email'] ) ? sanitize_email( $this->_req_data['organization_email'] ) : EE_Registry::instance()->CFG->organization->email; |
|
432 | - EE_Registry::instance()->CFG->organization->vat = isset( $this->_req_data['organization_vat'] ) ? sanitize_text_field( $this->_req_data['organization_vat'] ) : EE_Registry::instance()->CFG->organization->vat; |
|
433 | - EE_Registry::instance()->CFG->organization->phone = isset( $this->_req_data['organization_phone'] ) ? sanitize_text_field( $this->_req_data['organization_phone'] ) : EE_Registry::instance()->CFG->organization->phone; |
|
434 | - EE_Registry::instance()->CFG->organization->logo_url = isset( $this->_req_data['organization_logo_url'] ) ? esc_url_raw( $this->_req_data['organization_logo_url'] ) : EE_Registry::instance()->CFG->organization->logo_url; |
|
435 | - EE_Registry::instance()->CFG->organization->facebook = isset( $this->_req_data['organization_facebook'] ) ? esc_url_raw( $this->_req_data['organization_facebook'] ) : EE_Registry::instance()->CFG->organization->facebook; |
|
436 | - EE_Registry::instance()->CFG->organization->twitter = isset( $this->_req_data['organization_twitter'] ) ? esc_url_raw( $this->_req_data['organization_twitter'] ) : EE_Registry::instance()->CFG->organization->twitter; |
|
437 | - EE_Registry::instance()->CFG->organization->linkedin = isset( $this->_req_data['organization_linkedin'] ) ? esc_url_raw( $this->_req_data['organization_linkedin'] ) : EE_Registry::instance()->CFG->organization->linkedin; |
|
438 | - EE_Registry::instance()->CFG->organization->pinterest = isset( $this->_req_data['organization_pinterest'] ) ? esc_url_raw( $this->_req_data['organization_pinterest'] ) : EE_Registry::instance()->CFG->organization->pinterest; |
|
439 | - EE_Registry::instance()->CFG->organization->google = isset( $this->_req_data['organization_google'] ) ? esc_url_raw( $this->_req_data['organization_google'] ) : EE_Registry::instance()->CFG->organization->google; |
|
440 | - EE_Registry::instance()->CFG->organization->instagram = isset( $this->_req_data['organization_instagram'] ) ? esc_url_raw( $this->_req_data['organization_instagram'] ) : EE_Registry::instance()->CFG->organization->instagram; |
|
441 | - EE_Registry::instance()->CFG->core->ee_ueip_optin = isset( $this->_req_data['ueip_optin'] ) && !empty( $this->_req_data['ueip_optin'] ) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin; |
|
442 | - |
|
443 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config( EE_Registry::instance()->CFG->organization->CNT_ISO ); |
|
444 | - |
|
445 | - EE_Registry::instance()->CFG = apply_filters( 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG ); |
|
422 | + if (is_main_site()) |
|
423 | + EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
424 | + EE_Registry::instance()->CFG->organization->name = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name; |
|
425 | + EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1; |
|
426 | + EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2; |
|
427 | + EE_Registry::instance()->CFG->organization->city = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city; |
|
428 | + EE_Registry::instance()->CFG->organization->STA_ID = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID; |
|
429 | + EE_Registry::instance()->CFG->organization->CNT_ISO = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO; |
|
430 | + EE_Registry::instance()->CFG->organization->zip = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip; |
|
431 | + EE_Registry::instance()->CFG->organization->email = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email; |
|
432 | + EE_Registry::instance()->CFG->organization->vat = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat; |
|
433 | + EE_Registry::instance()->CFG->organization->phone = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone; |
|
434 | + EE_Registry::instance()->CFG->organization->logo_url = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url; |
|
435 | + EE_Registry::instance()->CFG->organization->facebook = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook; |
|
436 | + EE_Registry::instance()->CFG->organization->twitter = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter; |
|
437 | + EE_Registry::instance()->CFG->organization->linkedin = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin; |
|
438 | + EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest; |
|
439 | + EE_Registry::instance()->CFG->organization->google = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google; |
|
440 | + EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram; |
|
441 | + EE_Registry::instance()->CFG->core->ee_ueip_optin = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin; |
|
442 | + |
|
443 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO); |
|
444 | + |
|
445 | + EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG); |
|
446 | 446 | |
447 | 447 | $what = 'Your Organization Settings'; |
448 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ ); |
|
448 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__); |
|
449 | 449 | |
450 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default' ) ); |
|
450 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'default')); |
|
451 | 451 | |
452 | 452 | } |
453 | 453 | |
@@ -458,36 +458,36 @@ discard block |
||
458 | 458 | protected function _admin_option_settings() { |
459 | 459 | |
460 | 460 | $this->_template_args['values'] = $this->_yes_no_values; |
461 | - $this->_template_args['use_personnel_manager'] = isset( EE_Registry::instance()->CFG->admin->use_personnel_manager ) ? absint( EE_Registry::instance()->CFG->admin->use_personnel_manager ) : FALSE; |
|
462 | - $this->_template_args['use_dashboard_widget'] = isset( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) ? absint( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) : TRUE; |
|
463 | - $this->_template_args['events_in_dashboard'] = isset( EE_Registry::instance()->CFG->admin->events_in_dashboard ) ? absint( EE_Registry::instance()->CFG->admin->events_in_dashboard ) : 30; |
|
464 | - $this->_template_args['use_event_timezones'] = isset( EE_Registry::instance()->CFG->admin->use_event_timezones ) ? absint( EE_Registry::instance()->CFG->admin->use_event_timezones ) : FALSE; |
|
465 | - $this->_template_args['show_reg_footer'] = isset( EE_Registry::instance()->CFG->admin->show_reg_footer ) ? absint( EE_Registry::instance()->CFG->admin->show_reg_footer ) : TRUE; |
|
466 | - $this->_template_args['affiliate_id'] = isset( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : ''; |
|
467 | - $this->_template_args['help_tour_activation'] = isset( EE_Registry::instance()->CFG->admin->help_tour_activation ) ? absint( EE_Registry::instance()->CFG->admin->help_tour_activation ): 1; |
|
468 | - |
|
469 | - $this->_set_add_edit_form_tags( 'update_admin_option_settings' ); |
|
470 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
461 | + $this->_template_args['use_personnel_manager'] = isset(EE_Registry::instance()->CFG->admin->use_personnel_manager) ? absint(EE_Registry::instance()->CFG->admin->use_personnel_manager) : FALSE; |
|
462 | + $this->_template_args['use_dashboard_widget'] = isset(EE_Registry::instance()->CFG->admin->use_dashboard_widget) ? absint(EE_Registry::instance()->CFG->admin->use_dashboard_widget) : TRUE; |
|
463 | + $this->_template_args['events_in_dashboard'] = isset(EE_Registry::instance()->CFG->admin->events_in_dashboard) ? absint(EE_Registry::instance()->CFG->admin->events_in_dashboard) : 30; |
|
464 | + $this->_template_args['use_event_timezones'] = isset(EE_Registry::instance()->CFG->admin->use_event_timezones) ? absint(EE_Registry::instance()->CFG->admin->use_event_timezones) : FALSE; |
|
465 | + $this->_template_args['show_reg_footer'] = isset(EE_Registry::instance()->CFG->admin->show_reg_footer) ? absint(EE_Registry::instance()->CFG->admin->show_reg_footer) : TRUE; |
|
466 | + $this->_template_args['affiliate_id'] = isset(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : ''; |
|
467 | + $this->_template_args['help_tour_activation'] = isset(EE_Registry::instance()->CFG->admin->help_tour_activation) ? absint(EE_Registry::instance()->CFG->admin->help_tour_activation) : 1; |
|
468 | + |
|
469 | + $this->_set_add_edit_form_tags('update_admin_option_settings'); |
|
470 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
471 | 471 | $this->_template_args['template_args'] = $this->_template_args; |
472 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'admin_option_settings.template.php', $this->_template_args, TRUE ); |
|
472 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'admin_option_settings.template.php', $this->_template_args, TRUE); |
|
473 | 473 | $this->display_admin_page_with_sidebar(); |
474 | 474 | } |
475 | 475 | |
476 | 476 | protected function _update_admin_option_settings() { |
477 | - EE_Registry::instance()->CFG->admin->use_personnel_manager = isset( $this->_req_data['use_personnel_manager'] ) ? absint( $this->_req_data['use_personnel_manager'] ) : EE_Registry::instance()->CFG->admin->use_personnel_manager; |
|
478 | - EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset( $this->_req_data['use_dashboard_widget'] ) ? absint( $this->_req_data['use_dashboard_widget'] ) : EE_Registry::instance()->CFG->admin->use_dashboard_widget; |
|
479 | - EE_Registry::instance()->CFG->admin->events_in_dashboard = isset( $this->_req_data['events_in_dashboard'] ) ? absint( $this->_req_data['events_in_dashboard'] ) : EE_Registry::instance()->CFG->admin->events_in_dashboard; |
|
480 | - EE_Registry::instance()->CFG->admin->use_event_timezones = isset( $this->_req_data['use_event_timezones'] ) ? absint( $this->_req_data['use_event_timezones'] ) : EE_Registry::instance()->CFG->admin->use_event_timezones; |
|
481 | - EE_Registry::instance()->CFG->admin->show_reg_footer = isset( $this->_req_data['show_reg_footer'] ) ? absint( $this->_req_data['show_reg_footer'] ) : EE_Registry::instance()->CFG->admin->show_reg_footer; |
|
482 | - EE_Registry::instance()->CFG->admin->affiliate_id = isset( $this->_req_data['affiliate_id'] ) ? sanitize_text_field( $this->_req_data['affiliate_id'] ) : EE_Registry::instance()->CFG->admin->affiliate_id; |
|
483 | - EE_Registry::instance()->CFG->admin->help_tour_activation = isset( $this->_req_data['help_tour_activation'] ) ? absint( $this->_req_data['help_tour_activation'] ) : EE_Registry::instance()->CFG->admin->help_tour_activation; |
|
477 | + EE_Registry::instance()->CFG->admin->use_personnel_manager = isset($this->_req_data['use_personnel_manager']) ? absint($this->_req_data['use_personnel_manager']) : EE_Registry::instance()->CFG->admin->use_personnel_manager; |
|
478 | + EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset($this->_req_data['use_dashboard_widget']) ? absint($this->_req_data['use_dashboard_widget']) : EE_Registry::instance()->CFG->admin->use_dashboard_widget; |
|
479 | + EE_Registry::instance()->CFG->admin->events_in_dashboard = isset($this->_req_data['events_in_dashboard']) ? absint($this->_req_data['events_in_dashboard']) : EE_Registry::instance()->CFG->admin->events_in_dashboard; |
|
480 | + EE_Registry::instance()->CFG->admin->use_event_timezones = isset($this->_req_data['use_event_timezones']) ? absint($this->_req_data['use_event_timezones']) : EE_Registry::instance()->CFG->admin->use_event_timezones; |
|
481 | + EE_Registry::instance()->CFG->admin->show_reg_footer = isset($this->_req_data['show_reg_footer']) ? absint($this->_req_data['show_reg_footer']) : EE_Registry::instance()->CFG->admin->show_reg_footer; |
|
482 | + EE_Registry::instance()->CFG->admin->affiliate_id = isset($this->_req_data['affiliate_id']) ? sanitize_text_field($this->_req_data['affiliate_id']) : EE_Registry::instance()->CFG->admin->affiliate_id; |
|
483 | + EE_Registry::instance()->CFG->admin->help_tour_activation = isset($this->_req_data['help_tour_activation']) ? absint($this->_req_data['help_tour_activation']) : EE_Registry::instance()->CFG->admin->help_tour_activation; |
|
484 | 484 | |
485 | - EE_Registry::instance()->CFG->admin = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin ); |
|
485 | + EE_Registry::instance()->CFG->admin = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin); |
|
486 | 486 | |
487 | 487 | $what = 'Admin Options'; |
488 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__ ); |
|
489 | - $success = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success ); |
|
490 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'admin_option_settings' ) ); |
|
488 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__); |
|
489 | + $success = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success); |
|
490 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'admin_option_settings')); |
|
491 | 491 | |
492 | 492 | } |
493 | 493 | |
@@ -500,21 +500,21 @@ discard block |
||
500 | 500 | |
501 | 501 | protected function _country_settings() { |
502 | 502 | |
503 | - $CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
504 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO; |
|
503 | + $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
504 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO; |
|
505 | 505 | |
506 | 506 | //load field generator helper |
507 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
507 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
508 | 508 | |
509 | 509 | $this->_template_args['values'] = $this->_yes_no_values; |
510 | 510 | |
511 | 511 | $this->_template_args['countries'] = new EE_Question_Form_Input( |
512 | - EE_Question::new_instance ( array( |
|
512 | + EE_Question::new_instance(array( |
|
513 | 513 | 'QST_ID'=> 0, |
514 | 514 | 'QST_display_text'=> __('Select Country', 'event_espresso'), |
515 | 515 | 'QST_system'=>'admin-country' |
516 | 516 | )), |
517 | - EE_Answer::new_instance ( array( |
|
517 | + EE_Answer::new_instance(array( |
|
518 | 518 | 'ANS_ID' => 0, |
519 | 519 | 'ANS_value' => $CNT_ISO |
520 | 520 | )), |
@@ -527,14 +527,14 @@ discard block |
||
527 | 527 | ); |
528 | 528 | // EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
529 | 529 | |
530 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
531 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
530 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
531 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
532 | 532 | $this->_template_args['country_details_settings'] = $this->display_country_settings(); |
533 | 533 | $this->_template_args['country_states_settings'] = $this->display_country_states(); |
534 | 534 | |
535 | - $this->_set_add_edit_form_tags( 'update_country_settings' ); |
|
536 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
537 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', $this->_template_args, TRUE ); |
|
535 | + $this->_set_add_edit_form_tags('update_country_settings'); |
|
536 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
537 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', $this->_template_args, TRUE); |
|
538 | 538 | $this->display_admin_page_with_no_sidebar(); |
539 | 539 | } |
540 | 540 | |
@@ -547,44 +547,44 @@ discard block |
||
547 | 547 | * @param string $CNT_ISO |
548 | 548 | * @return mixed string | array |
549 | 549 | */ |
550 | - public function display_country_settings( $CNT_ISO = '' ) { |
|
550 | + public function display_country_settings($CNT_ISO = '') { |
|
551 | 551 | |
552 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO; |
|
553 | - if ( ! $CNT_ISO ) { |
|
552 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO; |
|
553 | + if ( ! $CNT_ISO) { |
|
554 | 554 | return ''; |
555 | 555 | } |
556 | 556 | |
557 | 557 | // for ajax |
558 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
559 | - remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' ); |
|
560 | - remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' ); |
|
561 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
562 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
563 | - $country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO ); |
|
558 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
559 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
560 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
561 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
562 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
563 | + $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
564 | 564 | //EEH_Debug_Tools::printr( $country, '$country <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
565 | 565 | $country_input_types = array( |
566 | - 'CNT_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ), |
|
567 | - 'CNT_ISO' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
568 | - 'CNT_ISO3' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
569 | - 'RGN_ID' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
570 | - 'CNT_name' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'regular-text' ), |
|
571 | - 'CNT_cur_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
572 | - 'CNT_cur_single' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ), |
|
573 | - 'CNT_cur_plural' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ), |
|
574 | - 'CNT_cur_sign' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text', 'htmlentities' => FALSE ), |
|
575 | - 'CNT_cur_sign_b4' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ), |
|
576 | - 'CNT_cur_dec_plc' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => 0, 'text' => '' ), array( 'id' => 1, 'text' => '' ), array( 'id' => 2, 'text' => '' ), array( 'id' => 3, 'text' => '' ))), |
|
577 | - 'CNT_cur_dec_mrk' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ), |
|
578 | - 'CNT_cur_thsnds' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ), |
|
579 | - 'CNT_tel_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
580 | - 'CNT_is_EU' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ) |
|
566 | + 'CNT_active' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE), |
|
567 | + 'CNT_ISO' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
568 | + 'CNT_ISO3' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
569 | + 'RGN_ID' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
570 | + 'CNT_name' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'regular-text'), |
|
571 | + 'CNT_cur_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
572 | + 'CNT_cur_single' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'), |
|
573 | + 'CNT_cur_plural' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'), |
|
574 | + 'CNT_cur_sign' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text', 'htmlentities' => FALSE), |
|
575 | + 'CNT_cur_sign_b4' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE), |
|
576 | + 'CNT_cur_dec_plc' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => 0, 'text' => ''), array('id' => 1, 'text' => ''), array('id' => 2, 'text' => ''), array('id' => 3, 'text' => ''))), |
|
577 | + 'CNT_cur_dec_mrk' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE), |
|
578 | + 'CNT_cur_thsnds' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE), |
|
579 | + 'CNT_tel_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
580 | + 'CNT_is_EU' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE) |
|
581 | 581 | ); |
582 | - $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $country, $country_input_types ); |
|
583 | - $country_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', $this->_template_args, TRUE ); |
|
582 | + $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, $country_input_types); |
|
583 | + $country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', $this->_template_args, TRUE); |
|
584 | 584 | |
585 | - if ( defined( 'DOING_AJAX' )) { |
|
586 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
587 | - echo json_encode( array( 'return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] )); |
|
585 | + if (defined('DOING_AJAX')) { |
|
586 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
587 | + echo json_encode(array('return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'])); |
|
588 | 588 | die(); |
589 | 589 | } else { |
590 | 590 | return $country_details_settings; |
@@ -602,50 +602,50 @@ discard block |
||
602 | 602 | * @param string $CNT_ISO |
603 | 603 | * @return string |
604 | 604 | */ |
605 | - public function display_country_states( $CNT_ISO = '' ) { |
|
605 | + public function display_country_states($CNT_ISO = '') { |
|
606 | 606 | |
607 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? sanitize_text_field( $this->_req_data['country'] ) : $CNT_ISO; |
|
607 | + $CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO; |
|
608 | 608 | |
609 | - if ( ! $CNT_ISO ) { |
|
609 | + if ( ! $CNT_ISO) { |
|
610 | 610 | return ''; |
611 | 611 | } |
612 | 612 | // for ajax |
613 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
614 | - remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' ); |
|
615 | - remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' ); |
|
616 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'state_form_field_label_wrap' ), 10, 2 ); |
|
617 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'state_form_field_input__wrap' ), 10, 2 ); |
|
618 | - $states = EEM_State::instance()->get_all_states_for_these_countries( array( $CNT_ISO => $CNT_ISO )); |
|
613 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
614 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
615 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
616 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2); |
|
617 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2); |
|
618 | + $states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO)); |
|
619 | 619 | |
620 | 620 | // echo '<h4>$CNT_ISO : ' . $CNT_ISO . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
621 | 621 | // global $wpdb; |
622 | 622 | // echo '<h4>' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
623 | 623 | // EEH_Debug_Tools::printr( $states, '$states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
624 | - if ( $states ) { |
|
625 | - foreach ( $states as $STA_ID => $state ) { |
|
626 | - if ( $state instanceof EE_State ) { |
|
624 | + if ($states) { |
|
625 | + foreach ($states as $STA_ID => $state) { |
|
626 | + if ($state instanceof EE_State) { |
|
627 | 627 | //STA_abbrev STA_name STA_active |
628 | 628 | $state_input_types = array( |
629 | - 'STA_abbrev' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'mid-text' ), |
|
630 | - 'STA_name' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'regular-text' ), |
|
631 | - 'STA_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'states[' . $STA_ID . ']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true ) |
|
629 | + 'STA_abbrev' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'mid-text'), |
|
630 | + 'STA_name' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'regular-text'), |
|
631 | + 'STA_active' => array('type' => 'RADIO_BTN', 'input_name' => 'states['.$STA_ID.']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true) |
|
632 | 632 | ); |
633 | - $this->_template_args[ 'states' ][ $STA_ID ][ 'inputs' ] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $state, $state_input_types ); |
|
634 | - $query_args = array( 'action' => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev() ); |
|
635 | - $this->_template_args[ 'states' ][ $STA_ID ][ 'delete_state_url' ] = EE_Admin_Page::add_query_args_and_nonce( $query_args, GEN_SET_ADMIN_URL ); |
|
633 | + $this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, $state_input_types); |
|
634 | + $query_args = array('action' => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev()); |
|
635 | + $this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, GEN_SET_ADMIN_URL); |
|
636 | 636 | } |
637 | 637 | } |
638 | 638 | } else { |
639 | 639 | $this->_template_args['states'] = FALSE; |
640 | 640 | } |
641 | 641 | // EEH_Debug_Tools::printr( $this->_template_args['states'], 'states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
642 | - $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'add_new_state' ), GEN_SET_ADMIN_URL ); |
|
642 | + $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), GEN_SET_ADMIN_URL); |
|
643 | 643 | |
644 | - $state_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', $this->_template_args, TRUE ); |
|
644 | + $state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', $this->_template_args, TRUE); |
|
645 | 645 | |
646 | - if ( defined( 'DOING_AJAX' )) { |
|
647 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
648 | - echo json_encode( array( 'return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] )); |
|
646 | + if (defined('DOING_AJAX')) { |
|
647 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
648 | + echo json_encode(array('return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'])); |
|
649 | 649 | die(); |
650 | 650 | } else { |
651 | 651 | return $state_details_settings; |
@@ -666,40 +666,39 @@ discard block |
||
666 | 666 | |
667 | 667 | $success = TRUE; |
668 | 668 | |
669 | - $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE; |
|
670 | - if ( ! $CNT_ISO ) { |
|
671 | - EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
669 | + $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE; |
|
670 | + if ( ! $CNT_ISO) { |
|
671 | + EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
672 | 672 | $success = FALSE; |
673 | 673 | } |
674 | - $STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE; |
|
675 | - if ( ! $STA_abbrev ) { |
|
676 | - EE_Error::add_error( __( 'No State ISO code or an invalid State ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
674 | + $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE; |
|
675 | + if ( ! $STA_abbrev) { |
|
676 | + EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
677 | 677 | $success = FALSE; |
678 | 678 | } |
679 | - $STA_name = isset( $this->_req_data['STA_name'] ) ? sanitize_text_field( $this->_req_data['STA_name'] ) : |
|
680 | - FALSE; |
|
681 | - if ( ! $STA_name ) { |
|
682 | - EE_Error::add_error( __( 'No State name or an invalid State name was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
679 | + $STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : FALSE; |
|
680 | + if ( ! $STA_name) { |
|
681 | + EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
683 | 682 | $success = FALSE; |
684 | 683 | } |
685 | 684 | |
686 | - if ( $success ) { |
|
685 | + if ($success) { |
|
687 | 686 | $cols_n_values = array( |
688 | 687 | 'CNT_ISO' => $CNT_ISO, |
689 | 688 | 'STA_abbrev' => $STA_abbrev, |
690 | 689 | 'STA_name' => $STA_name, |
691 | 690 | 'STA_active' => TRUE |
692 | 691 | ); |
693 | - $success = EEM_State::instance()->insert ( $cols_n_values ); |
|
694 | - EE_Error::add_success( __( 'The State was added successfully.', 'event_espresso' ) ); |
|
692 | + $success = EEM_State::instance()->insert($cols_n_values); |
|
693 | + EE_Error::add_success(__('The State was added successfully.', 'event_espresso')); |
|
695 | 694 | } |
696 | 695 | |
697 | - if ( defined( 'DOING_AJAX' )) { |
|
698 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
699 | - echo json_encode( array_merge( $notices, array( 'return_data' => $CNT_ISO ) ) ); |
|
696 | + if (defined('DOING_AJAX')) { |
|
697 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
698 | + echo json_encode(array_merge($notices, array('return_data' => $CNT_ISO))); |
|
700 | 699 | die(); |
701 | 700 | } else { |
702 | - $this->_redirect_after_action( $success, 'State', 'added', array( 'action' => 'country_settings' ) ); |
|
701 | + $this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings')); |
|
703 | 702 | } |
704 | 703 | } |
705 | 704 | |
@@ -712,25 +711,25 @@ discard block |
||
712 | 711 | * @return boolean | void |
713 | 712 | */ |
714 | 713 | public function delete_state() { |
715 | - $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE; |
|
716 | - $STA_ID = isset( $this->_req_data['STA_ID'] ) ? sanitize_text_field( $this->_req_data['STA_ID'] ) : FALSE; |
|
717 | - $STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE; |
|
718 | - if ( ! $STA_ID ) { |
|
719 | - EE_Error::add_error( __( 'No State ID or an invalid State ID was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
714 | + $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE; |
|
715 | + $STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : FALSE; |
|
716 | + $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE; |
|
717 | + if ( ! $STA_ID) { |
|
718 | + EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
720 | 719 | return FALSE; |
721 | 720 | } |
722 | - $success = EEM_State::instance()->delete_by_ID( $STA_ID ); |
|
723 | - if ( $success !== FALSE ) { |
|
724 | - do_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array( 'STA_abbrev' => $STA_abbrev )); |
|
725 | - EE_Error::add_success( __( 'The State was deleted successfully.', 'event_espresso' )); |
|
721 | + $success = EEM_State::instance()->delete_by_ID($STA_ID); |
|
722 | + if ($success !== FALSE) { |
|
723 | + do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array('STA_abbrev' => $STA_abbrev)); |
|
724 | + EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso')); |
|
726 | 725 | } |
727 | - if ( defined( 'DOING_AJAX' )) { |
|
728 | - $notices = EE_Error::get_notices( FALSE, FALSE ); |
|
726 | + if (defined('DOING_AJAX')) { |
|
727 | + $notices = EE_Error::get_notices(FALSE, FALSE); |
|
729 | 728 | $notices['return_data'] = TRUE; |
730 | - echo json_encode( $notices ); |
|
729 | + echo json_encode($notices); |
|
731 | 730 | die(); |
732 | 731 | } else { |
733 | - $this->_redirect_after_action( $success, 'State', 'deleted', array( 'action' => 'country_settings' ) ); |
|
732 | + $this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings')); |
|
734 | 733 | } |
735 | 734 | } |
736 | 735 | |
@@ -746,63 +745,63 @@ discard block |
||
746 | 745 | protected function _update_country_settings() { |
747 | 746 | // EEH_Debug_Tools::printr( $this->_req_data, '$this->_req_data <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
748 | 747 | // grab the country ISO code |
749 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : FALSE; |
|
750 | - if ( ! $CNT_ISO ) { |
|
751 | - EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
748 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : FALSE; |
|
749 | + if ( ! $CNT_ISO) { |
|
750 | + EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
752 | 751 | return; |
753 | 752 | } |
754 | 753 | $cols_n_values = array(); |
755 | - $cols_n_values['CNT_ISO3'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] )) : FALSE; |
|
756 | - $cols_n_values['RGN_ID'] = isset( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) : NULL; |
|
757 | - $cols_n_values['CNT_name'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) : NULL; |
|
758 | - $cols_n_values['CNT_cur_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] )) : 'USD'; |
|
759 | - $cols_n_values['CNT_cur_single'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) : 'dollar'; |
|
760 | - $cols_n_values['CNT_cur_plural'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) : 'dollars'; |
|
761 | - $cols_n_values['CNT_cur_sign'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) : '$'; |
|
762 | - $cols_n_values['CNT_cur_sign_b4'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) : TRUE; |
|
763 | - $cols_n_values['CNT_cur_dec_plc'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) : 2; |
|
764 | - $cols_n_values['CNT_cur_dec_mrk'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) : '.'; |
|
765 | - $cols_n_values['CNT_cur_thsnds'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) : ','; |
|
766 | - $cols_n_values['CNT_tel_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) : NULL; |
|
767 | - $cols_n_values['CNT_is_EU'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) : FALSE; |
|
768 | - $cols_n_values['CNT_active'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) : FALSE; |
|
754 | + $cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : FALSE; |
|
755 | + $cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : NULL; |
|
756 | + $cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : NULL; |
|
757 | + $cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD'; |
|
758 | + $cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar'; |
|
759 | + $cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars'; |
|
760 | + $cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$'; |
|
761 | + $cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : TRUE; |
|
762 | + $cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2; |
|
763 | + $cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.'; |
|
764 | + $cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ','; |
|
765 | + $cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : NULL; |
|
766 | + $cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : FALSE; |
|
767 | + $cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : FALSE; |
|
769 | 768 | // allow filtering of country data |
770 | - $cols_n_values = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values ); |
|
769 | + $cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values); |
|
771 | 770 | //EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
772 | 771 | // where values |
773 | - $where_cols_n_values = array( array( 'CNT_ISO' => $CNT_ISO )); |
|
772 | + $where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO)); |
|
774 | 773 | // run the update |
775 | - $success = EEM_Country::instance()->update( $cols_n_values, $where_cols_n_values ); |
|
774 | + $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values); |
|
776 | 775 | // global $wpdb; |
777 | 776 | // echo '<h4>' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
778 | 777 | // echo '<h4>$success : ' . $success . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
779 | - if ( isset( $this->_req_data['states'] ) && is_array( $this->_req_data['states'] ) && $success !== FALSE ) { |
|
778 | + if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== FALSE) { |
|
780 | 779 | // allow filtering of states data |
781 | - $states = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states'] ); |
|
780 | + $states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states']); |
|
782 | 781 | // EEH_Debug_Tools::printr( $states, '$states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
783 | 782 | // loop thru state data ( looks like : states[75][STA_name] ) |
784 | - foreach( $states as $STA_ID => $state ) { |
|
783 | + foreach ($states as $STA_ID => $state) { |
|
785 | 784 | $cols_n_values = array( |
786 | 785 | 'CNT_ISO' => $CNT_ISO, |
787 | - 'STA_abbrev' => sanitize_text_field( $state['STA_abbrev'] ), |
|
788 | - 'STA_name' => sanitize_text_field( $state['STA_name'] ), |
|
789 | - 'STA_active' => (bool)absint( $state['STA_active'] ) |
|
786 | + 'STA_abbrev' => sanitize_text_field($state['STA_abbrev']), |
|
787 | + 'STA_name' => sanitize_text_field($state['STA_name']), |
|
788 | + 'STA_active' => (bool) absint($state['STA_active']) |
|
790 | 789 | ); |
791 | 790 | // where values |
792 | - $where_cols_n_values = array( array( 'STA_ID' => $STA_ID )); |
|
791 | + $where_cols_n_values = array(array('STA_ID' => $STA_ID)); |
|
793 | 792 | // run the update |
794 | - $success = EEM_State::instance()->update( $cols_n_values, $where_cols_n_values ); |
|
795 | - if ( $success !== FALSE ) { |
|
796 | - do_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values ); |
|
793 | + $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values); |
|
794 | + if ($success !== FALSE) { |
|
795 | + do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values); |
|
797 | 796 | } |
798 | 797 | } |
799 | 798 | } |
800 | 799 | // check if country being edited matches org option country, and if so, then update EE_Config with new settings |
801 | - if ( isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO ) { |
|
802 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config( $CNT_ISO ); |
|
800 | + if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) { |
|
801 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO); |
|
803 | 802 | EE_Registry::instance()->CFG->update_espresso_config(); |
804 | 803 | } |
805 | - $this->_redirect_after_action( $success, 'Countries', 'updated', array( 'action' => 'country_settings', 'country' => $CNT_ISO )); |
|
804 | + $this->_redirect_after_action($success, 'Countries', 'updated', array('action' => 'country_settings', 'country' => $CNT_ISO)); |
|
806 | 805 | } |
807 | 806 | |
808 | 807 | |
@@ -816,11 +815,11 @@ discard block |
||
816 | 815 | * @param string $label |
817 | 816 | * @return string |
818 | 817 | */ |
819 | - public function country_form_field_label_wrap( $label, $required_text ) { |
|
818 | + public function country_form_field_label_wrap($label, $required_text) { |
|
820 | 819 | return ' |
821 | 820 | <tr> |
822 | 821 | <th> |
823 | - ' . $label . ' |
|
822 | + ' . $label.' |
|
824 | 823 | </th>'; |
825 | 824 | } |
826 | 825 | |
@@ -834,10 +833,10 @@ discard block |
||
834 | 833 | * @param string $label |
835 | 834 | * @return string |
836 | 835 | */ |
837 | - public function country_form_field_input__wrap( $input, $label ) { |
|
836 | + public function country_form_field_input__wrap($input, $label) { |
|
838 | 837 | return ' |
839 | 838 | <td class="general-settings-country-input-td"> |
840 | - ' . $input . ' |
|
839 | + ' . $input.' |
|
841 | 840 | </td> |
842 | 841 | </tr>'; |
843 | 842 | } |
@@ -853,7 +852,7 @@ discard block |
||
853 | 852 | * @param string $required_text |
854 | 853 | * @return string |
855 | 854 | */ |
856 | - public function state_form_field_label_wrap( $label, $required_text ) { |
|
855 | + public function state_form_field_label_wrap($label, $required_text) { |
|
857 | 856 | return $required_text; |
858 | 857 | } |
859 | 858 | |
@@ -867,10 +866,10 @@ discard block |
||
867 | 866 | * @param string $label |
868 | 867 | * @return string |
869 | 868 | */ |
870 | - public function state_form_field_input__wrap( $input, $label ) { |
|
869 | + public function state_form_field_input__wrap($input, $label) { |
|
871 | 870 | return ' |
872 | 871 | <td class="general-settings-country-state-input-td"> |
873 | - ' . $input . ' |
|
872 | + ' . $input.' |
|
874 | 873 | </td>'; |
875 | 874 | |
876 | 875 | } |
@@ -893,10 +892,10 @@ discard block |
||
893 | 892 | * @param int $ee_page_id |
894 | 893 | * @return string |
895 | 894 | */ |
896 | - public static function edit_view_links( $ee_page_id ) { |
|
897 | - $links = '<a href="' . add_query_arg( array( 'post' => $ee_page_id, 'action' => 'edit' ), admin_url( 'post.php' )) . '" >' . __('Edit', 'event_espresso') . '</a>'; |
|
895 | + public static function edit_view_links($ee_page_id) { |
|
896 | + $links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>'; |
|
898 | 897 | $links .= ' | '; |
899 | - $links .= '<a href="' . get_permalink( $ee_page_id ) . '" >' . __('View', 'event_espresso') . '</a>'; |
|
898 | + $links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>'; |
|
900 | 899 | return $links; |
901 | 900 | } |
902 | 901 | |
@@ -909,27 +908,27 @@ discard block |
||
909 | 908 | * @param WP page object $ee_page |
910 | 909 | * @return string |
911 | 910 | */ |
912 | - public static function page_and_shortcode_status( $ee_page, $shortcode ) { |
|
911 | + public static function page_and_shortcode_status($ee_page, $shortcode) { |
|
913 | 912 | |
914 | 913 | // page status |
915 | - if ( isset( $ee_page->post_status ) && $ee_page->post_status == 'publish') { |
|
914 | + if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') { |
|
916 | 915 | $pg_colour = 'green'; |
917 | - $pg_status = sprintf( __('Page%sStatus%sOK', 'event_espresso'), ' ' , ' ' ); |
|
916 | + $pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), ' ', ' '); |
|
918 | 917 | } else { |
919 | 918 | $pg_colour = 'red'; |
920 | - $pg_status = sprintf( __('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' ' ); |
|
919 | + $pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' '); |
|
921 | 920 | } |
922 | 921 | |
923 | 922 | // shortcode status |
924 | - if ( isset( $ee_page->post_content ) && strpos( $ee_page->post_content, $shortcode ) !== FALSE ) { |
|
923 | + if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== FALSE) { |
|
925 | 924 | $sc_colour = 'green'; |
926 | - $sc_status = sprintf( __('Shortcode%sOK', 'event_espresso'), ' ' ); |
|
925 | + $sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), ' '); |
|
927 | 926 | } else { |
928 | 927 | $sc_colour = 'red'; |
929 | - $sc_status = sprintf( __('Shortcode%sProblem', 'event_espresso'), ' ' ); |
|
928 | + $sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), ' '); |
|
930 | 929 | } |
931 | 930 | |
932 | - return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>'; |
|
931 | + return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'.$pg_status.'</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>'; |
|
933 | 932 | |
934 | 933 | } |
935 | 934 | |
@@ -944,20 +943,20 @@ discard block |
||
944 | 943 | * @param unknown_type $level |
945 | 944 | * @return unknown |
946 | 945 | */ |
947 | - public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) { |
|
946 | + public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) { |
|
948 | 947 | global $wpdb; |
949 | - $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent) ); |
|
948 | + $items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent)); |
|
950 | 949 | |
951 | - if ( $items ) { |
|
952 | - foreach ( $items as $item ) { |
|
953 | - $pad = str_repeat( ' ', $level * 3 ); |
|
954 | - if ( $item->ID == $default) |
|
950 | + if ($items) { |
|
951 | + foreach ($items as $item) { |
|
952 | + $pad = str_repeat(' ', $level * 3); |
|
953 | + if ($item->ID == $default) |
|
955 | 954 | $current = ' selected="selected"'; |
956 | 955 | else |
957 | 956 | $current = ''; |
958 | 957 | |
959 | - echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>"; |
|
960 | - parent_dropdown( $default, $item->ID, $level +1 ); |
|
958 | + echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>"; |
|
959 | + parent_dropdown($default, $item->ID, $level + 1); |
|
961 | 960 | } |
962 | 961 | } else { |
963 | 962 | return false; |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @access protected |
423 | 423 | * @param \EE_Payment_Method $payment_method |
424 | - * @return \EE_Form_Section_Proper |
|
424 | + * @return EE_Form_Section_HTML |
|
425 | 425 | */ |
426 | 426 | protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) { |
427 | 427 | if ( $payment_method->type_obj()->requires_https() ) { |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | * |
452 | 452 | * @access protected |
453 | 453 | * @param \EE_Payment_Method $payment_method |
454 | - * @return \EE_Form_Section_Proper |
|
454 | + * @return EE_Form_Section_HTML |
|
455 | 455 | */ |
456 | 456 | protected function _currency_support( EE_Payment_Method $payment_method ) { |
457 | 457 | if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) { |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | * |
484 | 484 | * @access protected |
485 | 485 | * @param \EE_Payment_Method $payment_method |
486 | - * @return \EE_Form_Section_HTML |
|
486 | + * @return EE_Payment_Method_Form |
|
487 | 487 | */ |
488 | 488 | protected function _payment_method_settings( EE_Payment_Method $payment_method ) { |
489 | 489 | //modify the form so we only have/show fields that will be implemented for this version |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | * |
552 | 552 | * @access protected |
553 | 553 | * @param \EE_Payment_Method $payment_method |
554 | - * @return \EE_Form_Section_Proper |
|
554 | + * @return EE_Form_Section_HTML |
|
555 | 555 | */ |
556 | 556 | protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) { |
557 | 557 | $link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() ); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * When cap mapping is implemented, some routes will need to use the singular form of |
85 | 85 | * capability method and also include the $id of the payment method for the route. |
86 | - **/ |
|
86 | + **/ |
|
87 | 87 | $this->_page_routes = array( |
88 | 88 | 'default' => array( |
89 | 89 | 'func'=>'_payment_methods_list', |
@@ -747,9 +747,9 @@ discard block |
||
747 | 747 | |
748 | 748 | /** |
749 | 749 | * _update_payment_settings |
750 | - * @access protected |
|
751 | - * @return array |
|
752 | - */ |
|
750 | + * @access protected |
|
751 | + * @return array |
|
752 | + */ |
|
753 | 753 | protected function _update_payment_settings() { |
754 | 754 | EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE; |
755 | 755 | EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG ); |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -655,7 +656,7 @@ discard block |
||
655 | 656 | $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type ); |
656 | 657 | |
657 | 658 | $this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug())); |
658 | - }else{ |
|
659 | + } else{ |
|
659 | 660 | $this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); |
660 | 661 | } |
661 | 662 | } |
@@ -670,7 +671,7 @@ discard block |
||
670 | 671 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
671 | 672 | $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug ); |
672 | 673 | $this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug)); |
673 | - }else{ |
|
674 | + } else{ |
|
674 | 675 | $this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default')); |
675 | 676 | } |
676 | 677 | } |
@@ -712,7 +713,7 @@ discard block |
||
712 | 713 | $pm = $correct_pmt_form_to_use->get_model_object(); |
713 | 714 | /** @var $pm EE_Payment_Method */ |
714 | 715 | $this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug())); |
715 | - }else{ |
|
716 | + } else{ |
|
716 | 717 | EE_Error::add_error( |
717 | 718 | sprintf( |
718 | 719 | __('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'), |
@@ -838,7 +839,7 @@ discard block |
||
838 | 839 | if(isset($this->_req_data['order'])){ |
839 | 840 | $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
840 | 841 | $query_params['order_by'] = array('LOG_time' => $sort); |
841 | - }else{ |
|
842 | + } else{ |
|
842 | 843 | $query_params['order_by'] = array('LOG_time' => 'DESC'); |
843 | 844 | } |
844 | 845 | $offset = ($current_page-1)*$per_page; |
@@ -881,7 +882,7 @@ discard block |
||
881 | 882 | $comparison = $timeA < $timeB ? -1 : 1; |
882 | 883 | if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){ |
883 | 884 | return $comparison * -1; |
884 | - }else{ |
|
885 | + } else{ |
|
885 | 886 | return $comparison; |
886 | 887 | } |
887 | 888 | } |
@@ -896,7 +897,7 @@ discard block |
||
896 | 897 | if( $payment_log->object() instanceof EE_Payment ){ |
897 | 898 | $payment_method = $payment_log->object()->payment_method(); |
898 | 899 | $transaction = $payment_log->object()->transaction(); |
899 | - }elseif($payment_log->object() instanceof EE_Payment_Method){ |
|
900 | + } elseif($payment_log->object() instanceof EE_Payment_Method){ |
|
900 | 901 | $payment_method = $payment_log->object(); |
901 | 902 | } |
902 | 903 | } |
@@ -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 | /** |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
45 | 45 | * @return \Payments_Admin_Page |
46 | 46 | */ |
47 | - public function __construct( $routing = TRUE ) { |
|
48 | - parent::__construct( $routing ); |
|
47 | + public function __construct($routing = TRUE) { |
|
48 | + parent::__construct($routing); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | protected function _set_page_config() { |
131 | 131 | $payment_method_list_config = array( |
132 | 132 | 'nav' => array( |
133 | - 'label' => __( 'Payment Methods', 'event_espresso' ), |
|
133 | + 'label' => __('Payment Methods', 'event_espresso'), |
|
134 | 134 | 'order' => 10 |
135 | 135 | ), |
136 | 136 | 'metaboxes' => $this->_default_espresso_metaboxes, |
137 | 137 | 'help_tabs' => array_merge( |
138 | 138 | array( |
139 | 139 | 'payment_methods_overview_help_tab' => array( |
140 | - 'title' => __( 'Payment Methods Overview', 'event_espresso' ), |
|
140 | + 'title' => __('Payment Methods Overview', 'event_espresso'), |
|
141 | 141 | 'filename' => 'payment_methods_overview' |
142 | 142 | ) |
143 | 143 | ), |
144 | 144 | $this->_add_payment_method_help_tabs() ), |
145 | - 'help_tour' => array( 'Payment_Methods_Selection_Help_Tour' ), |
|
145 | + 'help_tour' => array('Payment_Methods_Selection_Help_Tour'), |
|
146 | 146 | 'require_nonce' => false |
147 | 147 | ); |
148 | 148 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | ) |
161 | 161 | ), |
162 | 162 | //'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ), |
163 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
163 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
164 | 164 | 'require_nonce' => FALSE |
165 | 165 | ), |
166 | 166 | 'payment_log'=>array( |
@@ -179,17 +179,17 @@ discard block |
||
179 | 179 | /** |
180 | 180 | * @return array |
181 | 181 | */ |
182 | - protected function _add_payment_method_help_tabs(){ |
|
182 | + protected function _add_payment_method_help_tabs() { |
|
183 | 183 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
184 | 184 | $payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types(); |
185 | 185 | $all_pmt_help_tabs_config = array(); |
186 | - foreach( $payment_method_types as $payment_method_type ){ |
|
187 | - if ( ! EE_Registry::instance()->CAP->current_user_can( $payment_method_type->cap_name(), 'specific_payment_method_type_access' ) ) { |
|
186 | + foreach ($payment_method_types as $payment_method_type) { |
|
187 | + if ( ! EE_Registry::instance()->CAP->current_user_can($payment_method_type->cap_name(), 'specific_payment_method_type_access')) { |
|
188 | 188 | continue; |
189 | 189 | } |
190 | - foreach( $payment_method_type->help_tabs_config() as $help_tab_name => $config ){ |
|
191 | - $template_args = isset( $config[ 'template_args' ] ) ? $config[ 'template_args' ] : array(); |
|
192 | - $template_args[ 'admin_page_obj' ] = $this; |
|
190 | + foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) { |
|
191 | + $template_args = isset($config['template_args']) ? $config['template_args'] : array(); |
|
192 | + $template_args['admin_page_obj'] = $this; |
|
193 | 193 | $all_pmt_help_tabs_config[$help_tab_name] = array( |
194 | 194 | 'title'=>$config['title'], |
195 | 195 | 'content'=>EEH_Template::display_template( |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | |
217 | 217 | |
218 | 218 | public function load_scripts_styles() { |
219 | - wp_enqueue_script( 'ee_admin_js' ); |
|
220 | - wp_enqueue_script( 'ee-text-links' ); |
|
221 | - wp_enqueue_script( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', array( 'espresso-ui-theme', 'ee-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
219 | + wp_enqueue_script('ee_admin_js'); |
|
220 | + wp_enqueue_script('ee-text-links'); |
|
221 | + wp_enqueue_script('espresso_payments', EE_PAYMENTS_ASSETS_URL.'espresso_payments_admin.js', array('espresso-ui-theme', 'ee-datepicker'), EVENT_ESPRESSO_VERSION, TRUE); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | |
228 | 228 | public function load_scripts_styles_default() { |
229 | 229 | //styles |
230 | - wp_register_style( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', array(), EVENT_ESPRESSO_VERSION ); |
|
231 | - wp_enqueue_style( 'espresso_payments' ); |
|
232 | - wp_enqueue_style( 'ee-text-links' ); |
|
230 | + wp_register_style('espresso_payments', EE_PAYMENTS_ASSETS_URL.'ee-payments.css', array(), EVENT_ESPRESSO_VERSION); |
|
231 | + wp_enqueue_style('espresso_payments'); |
|
232 | + wp_enqueue_style('ee-text-links'); |
|
233 | 233 | //scripts |
234 | 234 | } |
235 | 235 | |
@@ -243,46 +243,46 @@ discard block |
||
243 | 243 | * to the loading process. However, people MUST setup the details for the payment method so its safe to do a |
244 | 244 | * recheck here. |
245 | 245 | */ |
246 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
246 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
247 | 247 | EEM_Payment_Method::instance()->verify_button_urls(); |
248 | - EE_Registry::instance()->load_helper( 'Tabbed_Content' ); |
|
249 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
248 | + EE_Registry::instance()->load_helper('Tabbed_Content'); |
|
249 | + EE_Registry::instance()->load_helper('HTML'); |
|
250 | 250 | //setup tabs, one for each payment method type |
251 | 251 | $tabs = array(); |
252 | 252 | $payment_methods = array(); |
253 | - foreach( EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj ) { |
|
253 | + foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { |
|
254 | 254 | // we don't want to show admin-only PMTs for now |
255 | - if ( $pmt_obj instanceof EE_PMT_Admin_Only ) { |
|
255 | + if ($pmt_obj instanceof EE_PMT_Admin_Only) { |
|
256 | 256 | continue; |
257 | 257 | } |
258 | 258 | //check access |
259 | - if ( ! EE_Registry::instance()->CAP->current_user_can( $pmt_obj->cap_name(), 'specific_payment_method_type_access' ) ) { |
|
259 | + if ( ! EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) { |
|
260 | 260 | continue; |
261 | 261 | } |
262 | 262 | //check for any active pms of that type |
263 | - $payment_method = EEM_Payment_Method::instance()->get_one_of_type( $pmt_obj->system_name() ); |
|
264 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
263 | + $payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name()); |
|
264 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
265 | 265 | $payment_method = EE_Payment_Method::new_instance( |
266 | 266 | array( |
267 | - 'PMD_slug' =>sanitize_key( $pmt_obj->system_name() ), |
|
267 | + 'PMD_slug' =>sanitize_key($pmt_obj->system_name()), |
|
268 | 268 | 'PMD_type' =>$pmt_obj->system_name(), |
269 | 269 | 'PMD_name' =>$pmt_obj->pretty_name(), |
270 | 270 | 'PMD_admin_name' =>$pmt_obj->pretty_name() |
271 | 271 | ) |
272 | 272 | ); |
273 | 273 | } |
274 | - $payment_methods[ $payment_method->slug() ] = $payment_method; |
|
274 | + $payment_methods[$payment_method->slug()] = $payment_method; |
|
275 | 275 | } |
276 | - $payment_methods = apply_filters( 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods ); |
|
277 | - foreach( $payment_methods as $payment_method ) { |
|
278 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
276 | + $payment_methods = apply_filters('FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods); |
|
277 | + foreach ($payment_methods as $payment_method) { |
|
278 | + if ($payment_method instanceof EE_Payment_Method) { |
|
279 | 279 | add_meta_box( |
280 | 280 | //html id |
281 | - 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
281 | + 'espresso_'.$payment_method->slug().'_payment_settings', |
|
282 | 282 | //title |
283 | - sprintf( __( '%s Settings', 'event_espresso' ), $payment_method->admin_name() ), |
|
283 | + sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()), |
|
284 | 284 | //callback |
285 | - array( $this, 'payment_method_settings_meta_box' ), |
|
285 | + array($this, 'payment_method_settings_meta_box'), |
|
286 | 286 | //post type |
287 | 287 | null, |
288 | 288 | //context |
@@ -290,19 +290,19 @@ discard block |
||
290 | 290 | //priority |
291 | 291 | 'default', |
292 | 292 | //callback args |
293 | - array( 'payment_method' => $payment_method ) |
|
293 | + array('payment_method' => $payment_method) |
|
294 | 294 | ); |
295 | 295 | //setup for tabbed content |
296 | - $tabs[ $payment_method->slug() ] = array( |
|
296 | + $tabs[$payment_method->slug()] = array( |
|
297 | 297 | 'label' => $payment_method->admin_name(), |
298 | 298 | 'class' => $payment_method->active() ? 'gateway-active' : '', |
299 | - 'href' => 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
300 | - 'title' => __( 'Modify this Payment Method', 'event_espresso' ), |
|
299 | + 'href' => 'espresso_'.$payment_method->slug().'_payment_settings', |
|
300 | + 'title' => __('Modify this Payment Method', 'event_espresso'), |
|
301 | 301 | 'slug' => $payment_method->slug() |
302 | 302 | ); |
303 | 303 | } |
304 | 304 | } |
305 | - $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug() ); |
|
305 | + $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug()); |
|
306 | 306 | $this->display_admin_page_with_sidebar(); |
307 | 307 | |
308 | 308 | } |
@@ -313,20 +313,20 @@ discard block |
||
313 | 313 | * _get_active_payment_method_slug |
314 | 314 | * @return string |
315 | 315 | */ |
316 | - protected function _get_active_payment_method_slug(){ |
|
316 | + protected function _get_active_payment_method_slug() { |
|
317 | 317 | $payment_method_slug = FALSE; |
318 | 318 | //decide which payment method tab to open first, as dictated by the request's 'payment_method' |
319 | - if ( isset( $this->_req_data['payment_method'] )) { |
|
319 | + if (isset($this->_req_data['payment_method'])) { |
|
320 | 320 | // if they provided the current payment method, use it |
321 | - $payment_method_slug = sanitize_key( $this->_req_data['payment_method'] ); |
|
321 | + $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
|
322 | 322 | } |
323 | - $payment_method = EEM_Payment_Method::instance()->get_one( array( array( 'PMD_slug' => $payment_method_slug ))); |
|
323 | + $payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug))); |
|
324 | 324 | // if that didn't work or wasn't provided, find another way to select the current pm |
325 | - if ( ! $this->_verify_payment_method( $payment_method )) { |
|
325 | + if ( ! $this->_verify_payment_method($payment_method)) { |
|
326 | 326 | // like, looking for an active one |
327 | - $payment_method = EEM_Payment_Method::instance()->get_one_active( 'CART' ); |
|
327 | + $payment_method = EEM_Payment_Method::instance()->get_one_active('CART'); |
|
328 | 328 | // test that one as well |
329 | - if ( $this->_verify_payment_method( $payment_method )) { |
|
329 | + if ($this->_verify_payment_method($payment_method)) { |
|
330 | 330 | $payment_method_slug = $payment_method->slug(); |
331 | 331 | } else { |
332 | 332 | $payment_method_slug = 'paypal_standard'; |
@@ -344,11 +344,11 @@ discard block |
||
344 | 344 | * @param \EE_Payment_Method $payment_method |
345 | 345 | * @return boolean |
346 | 346 | */ |
347 | - protected function _verify_payment_method( $payment_method ){ |
|
347 | + protected function _verify_payment_method($payment_method) { |
|
348 | 348 | if ( |
349 | 349 | $payment_method instanceof EE_Payment_Method && |
350 | 350 | $payment_method->type_obj() instanceof EE_PMT_Base && |
351 | - EE_Registry::instance()->CAP->current_user_can( $payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access' ) |
|
351 | + EE_Registry::instance()->CAP->current_user_can($payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access') |
|
352 | 352 | ) { |
353 | 353 | return TRUE; |
354 | 354 | } |
@@ -365,21 +365,21 @@ discard block |
||
365 | 365 | * @return string |
366 | 366 | * @throws EE_Error |
367 | 367 | */ |
368 | - public function payment_method_settings_meta_box( $post_obj_which_is_null, $metabox ){ |
|
369 | - $payment_method = isset( $metabox['args'], $metabox['args']['payment_method'] ) ? $metabox['args']['payment_method'] : NULL; |
|
370 | - if ( ! $payment_method instanceof EE_Payment_Method ){ |
|
371 | - throw new EE_Error( sprintf( __( 'Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso' ))); |
|
368 | + public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) { |
|
369 | + $payment_method = isset($metabox['args'], $metabox['args']['payment_method']) ? $metabox['args']['payment_method'] : NULL; |
|
370 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
371 | + throw new EE_Error(sprintf(__('Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso'))); |
|
372 | 372 | } |
373 | 373 | $payment_method_scopes = $payment_method->active(); |
374 | 374 | // if the payment method really exists show its form, otherwise the activation template |
375 | - if ( $payment_method->ID() && ! empty( $payment_method_scopes )) { |
|
376 | - $form = $this->_generate_payment_method_settings_form( $payment_method ); |
|
377 | - if ( $form->form_data_present_in( $this->_req_data )) { |
|
378 | - $form->receive_form_submission( $this->_req_data ); |
|
375 | + if ($payment_method->ID() && ! empty($payment_method_scopes)) { |
|
376 | + $form = $this->_generate_payment_method_settings_form($payment_method); |
|
377 | + if ($form->form_data_present_in($this->_req_data)) { |
|
378 | + $form->receive_form_submission($this->_req_data); |
|
379 | 379 | } |
380 | - echo $form->form_open() . $form->get_html_and_js() . $form->form_close(); |
|
380 | + echo $form->form_open().$form->get_html_and_js().$form->form_close(); |
|
381 | 381 | } else { |
382 | - echo $this->_activate_payment_method_button( $payment_method )->get_html_and_js(); |
|
382 | + echo $this->_activate_payment_method_button($payment_method)->get_html_and_js(); |
|
383 | 383 | } |
384 | 384 | } |
385 | 385 | |
@@ -392,14 +392,14 @@ discard block |
||
392 | 392 | * @param \EE_Payment_Method $payment_method |
393 | 393 | * @return \EE_Form_Section_Proper |
394 | 394 | */ |
395 | - protected function _generate_payment_method_settings_form( EE_Payment_Method $payment_method ) { |
|
396 | - if ( ! $payment_method instanceof EE_Payment_Method ){ |
|
395 | + protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method) { |
|
396 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
397 | 397 | return new EE_Form_Section_Proper(); |
398 | 398 | } |
399 | 399 | return new EE_Form_Section_Proper( |
400 | 400 | array( |
401 | - 'name' => $payment_method->slug() . '_settings_form', |
|
402 | - 'html_id' => $payment_method->slug() . '_settings_form', |
|
401 | + 'name' => $payment_method->slug().'_settings_form', |
|
402 | + 'html_id' => $payment_method->slug().'_settings_form', |
|
403 | 403 | 'action' => EE_Admin_Page::add_query_args_and_nonce( |
404 | 404 | array( |
405 | 405 | 'action' => 'update_payment_method', |
@@ -411,12 +411,12 @@ discard block |
||
411 | 411 | 'subsections' => apply_filters( |
412 | 412 | 'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections', |
413 | 413 | array( |
414 | - 'pci_dss_compliance_' . $payment_method->slug() => $this->_pci_dss_compliance( $payment_method ), |
|
415 | - 'currency_support_' . $payment_method->slug() => $this->_currency_support( $payment_method ), |
|
416 | - 'payment_method_settings_' . $payment_method->slug() => $this->_payment_method_settings( $payment_method ), |
|
417 | - 'update_' . $payment_method->slug() => $this->_update_payment_method_button( $payment_method ), |
|
418 | - 'deactivate_' . $payment_method->slug() => $this->_deactivate_payment_method_button( $payment_method ), |
|
419 | - 'fine_print_' . $payment_method->slug() => $this->_fine_print() |
|
414 | + 'pci_dss_compliance_'.$payment_method->slug() => $this->_pci_dss_compliance($payment_method), |
|
415 | + 'currency_support_'.$payment_method->slug() => $this->_currency_support($payment_method), |
|
416 | + 'payment_method_settings_'.$payment_method->slug() => $this->_payment_method_settings($payment_method), |
|
417 | + 'update_'.$payment_method->slug() => $this->_update_payment_method_button($payment_method), |
|
418 | + 'deactivate_'.$payment_method->slug() => $this->_deactivate_payment_method_button($payment_method), |
|
419 | + 'fine_print_'.$payment_method->slug() => $this->_fine_print() |
|
420 | 420 | ), |
421 | 421 | $payment_method |
422 | 422 | ) |
@@ -433,19 +433,19 @@ discard block |
||
433 | 433 | * @param \EE_Payment_Method $payment_method |
434 | 434 | * @return \EE_Form_Section_Proper |
435 | 435 | */ |
436 | - protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) { |
|
437 | - if ( $payment_method->type_obj()->requires_https() ) { |
|
436 | + protected function _pci_dss_compliance(EE_Payment_Method $payment_method) { |
|
437 | + if ($payment_method->type_obj()->requires_https()) { |
|
438 | 438 | return new EE_Form_Section_HTML( |
439 | 439 | EEH_HTML::tr( |
440 | 440 | EEH_HTML::th( |
441 | 441 | EEH_HTML::label( |
442 | - EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' ) |
|
442 | + EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice') |
|
443 | 443 | ) |
444 | - ) . |
|
444 | + ). |
|
445 | 445 | EEH_HTML::td( |
446 | - EEH_HTML::strong( __( 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso' )) . |
|
447 | - EEH_HTML::br() . |
|
448 | - __( 'Learn more about ', 'event_espresso' ) . EEH_HTML::link( 'https://www.pcisecuritystandards.org/merchants/index.php', __( 'PCI DSS compliance', 'event_espresso' )) |
|
446 | + EEH_HTML::strong(__('You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso')). |
|
447 | + EEH_HTML::br(). |
|
448 | + __('Learn more about ', 'event_espresso').EEH_HTML::link('https://www.pcisecuritystandards.org/merchants/index.php', __('PCI DSS compliance', 'event_espresso')) |
|
449 | 449 | ) |
450 | 450 | ) |
451 | 451 | ); |
@@ -463,19 +463,19 @@ discard block |
||
463 | 463 | * @param \EE_Payment_Method $payment_method |
464 | 464 | * @return \EE_Form_Section_Proper |
465 | 465 | */ |
466 | - protected function _currency_support( EE_Payment_Method $payment_method ) { |
|
467 | - if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) { |
|
466 | + protected function _currency_support(EE_Payment_Method $payment_method) { |
|
467 | + if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) { |
|
468 | 468 | return new EE_Form_Section_HTML( |
469 | 469 | EEH_HTML::tr( |
470 | 470 | EEH_HTML::th( |
471 | 471 | EEH_HTML::label( |
472 | - EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' ) |
|
472 | + EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice') |
|
473 | 473 | ) |
474 | - ) . |
|
474 | + ). |
|
475 | 475 | EEH_HTML::td( |
476 | 476 | EEH_HTML::strong( |
477 | 477 | sprintf( |
478 | - __( 'This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'), |
|
478 | + __('This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'), |
|
479 | 479 | EE_Config::instance()->currency->code |
480 | 480 | ) |
481 | 481 | ) |
@@ -495,9 +495,9 @@ discard block |
||
495 | 495 | * @param \EE_Payment_Method $payment_method |
496 | 496 | * @return \EE_Form_Section_HTML |
497 | 497 | */ |
498 | - protected function _payment_method_settings( EE_Payment_Method $payment_method ) { |
|
498 | + protected function _payment_method_settings(EE_Payment_Method $payment_method) { |
|
499 | 499 | //modify the form so we only have/show fields that will be implemented for this version |
500 | - return $this->_simplify_form( $payment_method->type_obj()->settings_form(), $payment_method->name() ); |
|
500 | + return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name()); |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | |
@@ -510,8 +510,8 @@ discard block |
||
510 | 510 | * @return \EE_Payment_Method_Form |
511 | 511 | * @throws \EE_Error |
512 | 512 | */ |
513 | - protected function _simplify_form( $form_section, $payment_method_name = '' ){ |
|
514 | - if ( $form_section instanceof EE_Payment_Method_Form ) { |
|
513 | + protected function _simplify_form($form_section, $payment_method_name = '') { |
|
514 | + if ($form_section instanceof EE_Payment_Method_Form) { |
|
515 | 515 | $form_section->exclude( |
516 | 516 | array( |
517 | 517 | 'PMD_type', //dont want them changing the type |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | ); |
523 | 523 | return $form_section; |
524 | 524 | } else { |
525 | - throw new EE_Error( sprintf( __( 'The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso' ), $payment_method_name )); |
|
525 | + throw new EE_Error(sprintf(__('The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso'), $payment_method_name)); |
|
526 | 526 | } |
527 | 527 | } |
528 | 528 | |
@@ -535,18 +535,18 @@ discard block |
||
535 | 535 | * @param \EE_Payment_Method $payment_method |
536 | 536 | * @return \EE_Form_Section_HTML |
537 | 537 | */ |
538 | - protected function _update_payment_method_button( EE_Payment_Method $payment_method ) { |
|
538 | + protected function _update_payment_method_button(EE_Payment_Method $payment_method) { |
|
539 | 539 | $update_button = new EE_Submit_Input( |
540 | 540 | array( |
541 | - 'html_id' => 'save_' . $payment_method->slug() . '_settings', |
|
542 | - 'default' => sprintf( __( 'Update %s Payment Settings', 'event_espresso' ), $payment_method->admin_name() ), |
|
541 | + 'html_id' => 'save_'.$payment_method->slug().'_settings', |
|
542 | + 'default' => sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()), |
|
543 | 543 | 'html_label' => EEH_HTML::nbsp() |
544 | 544 | ) |
545 | 545 | ); |
546 | 546 | return new EE_Form_Section_HTML( |
547 | - EEH_HTML::no_row( EEH_HTML::br(2) ) . |
|
547 | + EEH_HTML::no_row(EEH_HTML::br(2)). |
|
548 | 548 | EEH_HTML::tr( |
549 | - EEH_HTML::th( __( 'Update Settings', 'event_espresso') ) . |
|
549 | + EEH_HTML::th(__('Update Settings', 'event_espresso')). |
|
550 | 550 | EEH_HTML::td( |
551 | 551 | $update_button->get_html_for_input() |
552 | 552 | ) |
@@ -563,11 +563,11 @@ discard block |
||
563 | 563 | * @param \EE_Payment_Method $payment_method |
564 | 564 | * @return \EE_Form_Section_Proper |
565 | 565 | */ |
566 | - protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) { |
|
567 | - $link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() ); |
|
566 | + protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) { |
|
567 | + $link_text_and_title = sprintf(__('Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name()); |
|
568 | 568 | return new EE_Form_Section_HTML( |
569 | 569 | EEH_HTML::tr( |
570 | - EEH_HTML::th( __( 'Deactivate Payment Method', 'event_espresso') ) . |
|
570 | + EEH_HTML::th(__('Deactivate Payment Method', 'event_espresso')). |
|
571 | 571 | EEH_HTML::td( |
572 | 572 | EEH_HTML::link( |
573 | 573 | EE_Admin_Page::add_query_args_and_nonce( |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | ), |
580 | 580 | $link_text_and_title, |
581 | 581 | $link_text_and_title, |
582 | - 'deactivate_' . $payment_method->slug(), |
|
582 | + 'deactivate_'.$payment_method->slug(), |
|
583 | 583 | 'espresso-button button-secondary' |
584 | 584 | ) |
585 | 585 | ) |
@@ -595,12 +595,12 @@ discard block |
||
595 | 595 | * @param \EE_Payment_Method $payment_method |
596 | 596 | * @return \EE_Form_Section_Proper |
597 | 597 | */ |
598 | - protected function _activate_payment_method_button( EE_Payment_Method $payment_method ) { |
|
599 | - $link_text_and_title = sprintf( __( 'Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name() ); |
|
598 | + protected function _activate_payment_method_button(EE_Payment_Method $payment_method) { |
|
599 | + $link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name()); |
|
600 | 600 | return new EE_Form_Section_Proper( |
601 | 601 | array( |
602 | - 'name' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
603 | - 'html_id' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
602 | + 'name' => 'activate_'.$payment_method->slug().'_settings_form', |
|
603 | + 'html_id' => 'activate_'.$payment_method->slug().'_settings_form', |
|
604 | 604 | 'action' => '#', |
605 | 605 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
606 | 606 | 'subsections' => apply_filters( |
@@ -609,8 +609,8 @@ discard block |
||
609 | 609 | new EE_Form_Section_HTML( |
610 | 610 | EEH_HTML::tr( |
611 | 611 | EEH_HTML::th( |
612 | - EEH_HTML::label( __( 'Click to Activate ', 'event_espresso' )) |
|
613 | - ) . |
|
612 | + EEH_HTML::label(__('Click to Activate ', 'event_espresso')) |
|
613 | + ). |
|
614 | 614 | EEH_HTML::td( |
615 | 615 | EEH_HTML::link( |
616 | 616 | EE_Admin_Page::add_query_args_and_nonce( |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | ), |
623 | 623 | $link_text_and_title, |
624 | 624 | $link_text_and_title, |
625 | - 'activate_' . $payment_method->slug(), |
|
625 | + 'activate_'.$payment_method->slug(), |
|
626 | 626 | 'espresso-button-green button-primary' |
627 | 627 | ) |
628 | 628 | ) |
@@ -644,9 +644,9 @@ discard block |
||
644 | 644 | protected function _fine_print() { |
645 | 645 | return new EE_Form_Section_HTML( |
646 | 646 | EEH_HTML::tr( |
647 | - EEH_HTML::th() . |
|
647 | + EEH_HTML::th(). |
|
648 | 648 | EEH_HTML::td( |
649 | - EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' ) |
|
649 | + EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text') |
|
650 | 650 | ) |
651 | 651 | ) |
652 | 652 | ); |
@@ -658,15 +658,15 @@ discard block |
||
658 | 658 | * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far) |
659 | 659 | * @global WP_User $current_user |
660 | 660 | */ |
661 | - protected function _activate_payment_method(){ |
|
662 | - if(isset($this->_req_data['payment_method_type'])){ |
|
661 | + protected function _activate_payment_method() { |
|
662 | + if (isset($this->_req_data['payment_method_type'])) { |
|
663 | 663 | $payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']); |
664 | 664 | //see if one exists |
665 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
666 | - $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type ); |
|
665 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
666 | + $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type($payment_method_type); |
|
667 | 667 | |
668 | - $this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug())); |
|
669 | - }else{ |
|
668 | + $this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default', 'payment_method'=>$payment_method->slug())); |
|
669 | + } else { |
|
670 | 670 | $this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); |
671 | 671 | } |
672 | 672 | } |
@@ -674,14 +674,14 @@ discard block |
||
674 | 674 | /** |
675 | 675 | * Deactivates the payment method with the specified slug, and redirects. |
676 | 676 | */ |
677 | - protected function _deactivate_payment_method(){ |
|
678 | - if(isset($this->_req_data['payment_method'])){ |
|
677 | + protected function _deactivate_payment_method() { |
|
678 | + if (isset($this->_req_data['payment_method'])) { |
|
679 | 679 | $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
680 | 680 | //deactivate it |
681 | 681 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
682 | - $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug ); |
|
683 | - $this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug)); |
|
684 | - }else{ |
|
682 | + $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug); |
|
683 | + $this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default', 'payment_method'=>$payment_method_slug)); |
|
684 | + } else { |
|
685 | 685 | $this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default')); |
686 | 686 | } |
687 | 687 | } |
@@ -695,39 +695,39 @@ discard block |
||
695 | 695 | * subsequently called 'headers_sent_func' which is _payment_methods_list) |
696 | 696 | * @return void |
697 | 697 | */ |
698 | - protected function _update_payment_method(){ |
|
699 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
698 | + protected function _update_payment_method() { |
|
699 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
700 | 700 | //ok let's find which gateway form to use based on the form input |
701 | 701 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
702 | 702 | /** @var $correct_pmt_form_to_use EE_Payment_Method_Form */ |
703 | 703 | $correct_pmt_form_to_use = NULL; |
704 | 704 | $pmt_obj = NULL; |
705 | - foreach(EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj){ |
|
705 | + foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { |
|
706 | 706 | /** @var $pmt_obj EE_PMT_Base */ |
707 | 707 | //get the form and simplify it, like what we do when we display it |
708 | 708 | $pmt_form = $pmt_obj->settings_form(); |
709 | 709 | $this->_simplify_form($pmt_form); |
710 | - if($pmt_form->form_data_present_in($this->_req_data)){ |
|
710 | + if ($pmt_form->form_data_present_in($this->_req_data)) { |
|
711 | 711 | $correct_pmt_form_to_use = $pmt_form; |
712 | 712 | break; |
713 | 713 | } |
714 | 714 | } |
715 | 715 | //if we couldn't find the correct payment method type... |
716 | - if( ! $correct_pmt_form_to_use ){ |
|
716 | + if ( ! $correct_pmt_form_to_use) { |
|
717 | 717 | EE_Error::add_error(__("We could not find which payment method type your form submission related to. Please contact support", 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
718 | 718 | $this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); |
719 | 719 | } |
720 | 720 | $correct_pmt_form_to_use->receive_form_submission($this->_req_data); |
721 | - if($correct_pmt_form_to_use->is_valid()){ |
|
721 | + if ($correct_pmt_form_to_use->is_valid()) { |
|
722 | 722 | $correct_pmt_form_to_use->save(); |
723 | 723 | $pm = $correct_pmt_form_to_use->get_model_object(); |
724 | 724 | /** @var $pm EE_Payment_Method */ |
725 | - $this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug())); |
|
726 | - }else{ |
|
725 | + $this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default', 'payment_method'=>$pm->slug())); |
|
726 | + } else { |
|
727 | 727 | EE_Error::add_error( |
728 | 728 | sprintf( |
729 | 729 | __('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'), |
730 | - $pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __( '"(unknown)"', 'event_espresso' ) |
|
730 | + $pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __('"(unknown)"', 'event_espresso') |
|
731 | 731 | ), |
732 | 732 | __FILE__, |
733 | 733 | __FUNCTION__, |
@@ -744,11 +744,11 @@ discard block |
||
744 | 744 | protected function _payment_settings() { |
745 | 745 | |
746 | 746 | $this->_template_args['values'] = $this->_yes_no_values; |
747 | - $this->_template_args['show_pending_payment_options'] = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) ? absint( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) : FALSE; |
|
747 | + $this->_template_args['show_pending_payment_options'] = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) ? absint(EE_Registry::instance()->CFG->registration->show_pending_payment_options) : FALSE; |
|
748 | 748 | |
749 | - $this->_set_add_edit_form_tags( 'update_payment_settings' ); |
|
750 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
751 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_PAYMENTS_TEMPLATE_PATH . 'payment_settings.template.php', $this->_template_args, TRUE ); |
|
749 | + $this->_set_add_edit_form_tags('update_payment_settings'); |
|
750 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
751 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_PAYMENTS_TEMPLATE_PATH.'payment_settings.template.php', $this->_template_args, TRUE); |
|
752 | 752 | $this->display_admin_page_with_sidebar(); |
753 | 753 | |
754 | 754 | } |
@@ -762,13 +762,13 @@ discard block |
||
762 | 762 | * @return array |
763 | 763 | */ |
764 | 764 | protected function _update_payment_settings() { |
765 | - EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE; |
|
766 | - EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG ); |
|
765 | + EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset($this->_req_data['show_pending_payment_options']) ? $this->_req_data['show_pending_payment_options'] : FALSE; |
|
766 | + EE_Registry::instance()->CFG = apply_filters('FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG); |
|
767 | 767 | |
768 | 768 | |
769 | - $what = __('Payment Settings','event_espresso'); |
|
770 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ ); |
|
771 | - $this->_redirect_after_action( $success, $what, __('updated','event_espresso'), array( 'action' => 'payment_settings' ) ); |
|
769 | + $what = __('Payment Settings', 'event_espresso'); |
|
770 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__); |
|
771 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), array('action' => 'payment_settings')); |
|
772 | 772 | |
773 | 773 | } |
774 | 774 | protected function _payment_log_overview_list_table() { |
@@ -794,18 +794,18 @@ discard block |
||
794 | 794 | * @param bool $count |
795 | 795 | * @return array |
796 | 796 | */ |
797 | - public function get_payment_logs($per_page = 50, $current_page = 0, $count = false){ |
|
798 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
797 | + public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) { |
|
798 | + EE_Registry::instance()->load_model('Change_Log'); |
|
799 | 799 | //we may need to do multiple queries (joining differently), so we actually wan tan array of query params |
800 | - $query_params = array(array('LOG_type'=> EEM_Change_Log::type_gateway)); |
|
800 | + $query_params = array(array('LOG_type'=> EEM_Change_Log::type_gateway)); |
|
801 | 801 | //check if they've selected a specific payment method |
802 | - if( isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all'){ |
|
802 | + if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') { |
|
803 | 803 | $query_params[0]['OR*pm_or_pay_pm'] = array('Payment.Payment_Method.PMD_ID'=>$this->_req_data['_payment_method'], |
804 | 804 | 'Payment_Method.PMD_ID'=>$this->_req_data['_payment_method']); |
805 | 805 | } |
806 | 806 | //take into account search |
807 | - if(isset($this->_req_data['s']) && $this->_req_data['s']){ |
|
808 | - $similarity_string = array('LIKE','%'.str_replace("","%",$this->_req_data['s']) .'%'); |
|
807 | + if (isset($this->_req_data['s']) && $this->_req_data['s']) { |
|
808 | + $similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%'); |
|
809 | 809 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string; |
810 | 810 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string; |
811 | 811 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string; |
@@ -820,48 +820,48 @@ discard block |
||
820 | 820 | $query_params[0]['OR*s']['LOG_message'] = $similarity_string; |
821 | 821 | |
822 | 822 | } |
823 | - if(isset( $this->_req_data['payment-filter-start-date'] ) && isset( $this->_req_data['payment-filter-end-date'] )){ |
|
823 | + if (isset($this->_req_data['payment-filter-start-date']) && isset($this->_req_data['payment-filter-end-date'])) { |
|
824 | 824 | //add date |
825 | - $start_date =wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] ); |
|
826 | - $end_date = wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] ); |
|
825 | + $start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']); |
|
826 | + $end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']); |
|
827 | 827 | //make sure our timestamps start and end right at the boundaries for each day |
828 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
829 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
828 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
829 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
830 | 830 | |
831 | 831 | //convert to timestamps |
832 | - $start_date = strtotime( $start_date ); |
|
833 | - $end_date = strtotime( $end_date ); |
|
832 | + $start_date = strtotime($start_date); |
|
833 | + $end_date = strtotime($end_date); |
|
834 | 834 | |
835 | 835 | //makes sure start date is the lowest value and vice versa |
836 | - $start_date = min( $start_date, $end_date ); |
|
837 | - $end_date = max( $start_date, $end_date ); |
|
836 | + $start_date = min($start_date, $end_date); |
|
837 | + $end_date = max($start_date, $end_date); |
|
838 | 838 | |
839 | 839 | //convert for query |
840 | - $start_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' ); |
|
841 | - $end_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' ); |
|
840 | + $start_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s'); |
|
841 | + $end_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s'); |
|
842 | 842 | |
843 | - $query_params[0]['LOG_time'] = array('BETWEEN',array($start_date,$end_date)); |
|
843 | + $query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date)); |
|
844 | 844 | |
845 | 845 | } |
846 | - if($count){ |
|
846 | + if ($count) { |
|
847 | 847 | return EEM_Change_Log::instance()->count($query_params); |
848 | 848 | } |
849 | - if(isset($this->_req_data['order'])){ |
|
850 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
849 | + if (isset($this->_req_data['order'])) { |
|
850 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
851 | 851 | $query_params['order_by'] = array('LOG_time' => $sort); |
852 | - }else{ |
|
852 | + } else { |
|
853 | 853 | $query_params['order_by'] = array('LOG_time' => 'DESC'); |
854 | 854 | } |
855 | - $offset = ($current_page-1)*$per_page; |
|
855 | + $offset = ($current_page - 1) * $per_page; |
|
856 | 856 | |
857 | - if( ! isset($this->_req_data['download_results'])){ |
|
858 | - $query_params['limit'] = array( $offset, $per_page ); |
|
857 | + if ( ! isset($this->_req_data['download_results'])) { |
|
858 | + $query_params['limit'] = array($offset, $per_page); |
|
859 | 859 | } |
860 | 860 | |
861 | 861 | |
862 | 862 | |
863 | 863 | //now they've requested to instead just download the file instead of viewing it. |
864 | - if(isset($this->_req_data['download_results'])){ |
|
864 | + if (isset($this->_req_data['download_results'])) { |
|
865 | 865 | $wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params); |
866 | 866 | header('Content-Disposition: attachment'); |
867 | 867 | header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url())); |
@@ -883,36 +883,36 @@ discard block |
||
883 | 883 | * @param EE_Change_Log $logB |
884 | 884 | * @return int |
885 | 885 | */ |
886 | - protected function _sort_logs_again($logA,$logB){ |
|
886 | + protected function _sort_logs_again($logA, $logB) { |
|
887 | 887 | $timeA = $logA->get_raw('LOG_time'); |
888 | 888 | $timeB = $logB->get_raw('LOG_time'); |
889 | - if($timeA == $timeB){ |
|
889 | + if ($timeA == $timeB) { |
|
890 | 890 | return 0; |
891 | 891 | } |
892 | 892 | $comparison = $timeA < $timeB ? -1 : 1; |
893 | - if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){ |
|
893 | + if (strtoupper($this->_sort_logs_again_direction) == 'DESC') { |
|
894 | 894 | return $comparison * -1; |
895 | - }else{ |
|
895 | + } else { |
|
896 | 896 | return $comparison; |
897 | 897 | } |
898 | 898 | } |
899 | 899 | |
900 | 900 | protected function _payment_log_details() { |
901 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
901 | + EE_Registry::instance()->load_model('Change_Log'); |
|
902 | 902 | /** @var $payment_log EE_Change_Log */ |
903 | 903 | $payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']); |
904 | 904 | $payment_method = NULL; |
905 | 905 | $transaction = NULL; |
906 | - if( $payment_log instanceof EE_Change_Log ){ |
|
907 | - if( $payment_log->object() instanceof EE_Payment ){ |
|
906 | + if ($payment_log instanceof EE_Change_Log) { |
|
907 | + if ($payment_log->object() instanceof EE_Payment) { |
|
908 | 908 | $payment_method = $payment_log->object()->payment_method(); |
909 | 909 | $transaction = $payment_log->object()->transaction(); |
910 | - }elseif($payment_log->object() instanceof EE_Payment_Method){ |
|
910 | + }elseif ($payment_log->object() instanceof EE_Payment_Method) { |
|
911 | 911 | $payment_method = $payment_log->object(); |
912 | 912 | } |
913 | 913 | } |
914 | 914 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
915 | - EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php', |
|
915 | + EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php', |
|
916 | 916 | array( |
917 | 917 | 'payment_log'=>$payment_log, |
918 | 918 | 'payment_method'=>$payment_method, |
@@ -1565,8 +1565,6 @@ discard block |
||
1565 | 1565 | * form_form_field_input__wrap |
1566 | 1566 | * |
1567 | 1567 | * @access public |
1568 | - * @param string $label |
|
1569 | - * @return string |
|
1570 | 1568 | */ |
1571 | 1569 | public function form_form_field_input__wrap( $input ) { |
1572 | 1570 | return ' |
@@ -1649,6 +1647,10 @@ discard block |
||
1649 | 1647 | |
1650 | 1648 | |
1651 | 1649 | //TODO: try changing this to use the model directly... not indirectly through creating a default object... |
1650 | + |
|
1651 | + /** |
|
1652 | + * @param boolean $REG_ID |
|
1653 | + */ |
|
1652 | 1654 | private function _save_new_answer( $REG_ID, $QST_ID, $ans ) { |
1653 | 1655 | $set_values = array( |
1654 | 1656 | 'QST_ID' => $QST_ID, |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | |
125 | 125 | /** |
126 | 126 | * grab url requests and route them |
127 | - * @access private |
|
128 | - * @return void |
|
129 | - */ |
|
127 | + * @access private |
|
128 | + * @return void |
|
129 | + */ |
|
130 | 130 | public function _set_page_routes() { |
131 | 131 | |
132 | 132 | $this->_get_registration_status_array(); |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | 'title' => __('Registrations Other', 'event_espresso'), |
399 | 399 | 'filename' => 'registrations_overview_other' |
400 | 400 | ) |
401 | - ), |
|
401 | + ), |
|
402 | 402 | 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
403 | 403 | 'qtips' => array('Registration_List_Table_Tips'), |
404 | 404 | 'list_table' => 'EE_Registrations_List_Table', |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | '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, |
413 | 413 | 'persistent' => FALSE |
414 | 414 | ), |
415 | - 'help_tabs' => array( |
|
415 | + 'help_tabs' => array( |
|
416 | 416 | 'registrations_details_help_tab' => array( |
417 | 417 | 'title' => __('Registration Details', 'event_espresso'), |
418 | 418 | 'filename' => 'registrations_details' |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | 'order' => 20 |
477 | 477 | ), |
478 | 478 | 'list_table' => 'EE_Attendee_Contact_List_Table', |
479 | - 'help_tabs' => array( |
|
479 | + 'help_tabs' => array( |
|
480 | 480 | 'registrations_contact_list_help_tab' => array( |
481 | 481 | 'title' => __('Registrations Contact List', 'event_espresso'), |
482 | 482 | 'filename' => 'registrations_contact_list' |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | 'title' => __('Contact List Other', 'event_espresso'), |
494 | 494 | 'filename' => 'registrations_contact_list_other' |
495 | 495 | ) |
496 | - ), |
|
496 | + ), |
|
497 | 497 | 'help_tour' => array( 'Contact_List_Help_Tour' ), |
498 | 498 | 'metaboxes' => array(), |
499 | 499 | 'require_nonce' => FALSE |
@@ -527,9 +527,9 @@ discard block |
||
527 | 527 | |
528 | 528 | /** |
529 | 529 | * get list of registration statuses |
530 | - * @access private |
|
531 | - * @return void |
|
532 | - */ |
|
530 | + * @access private |
|
531 | + * @return void |
|
532 | + */ |
|
533 | 533 | private function _get_registration_status_array() { |
534 | 534 | self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
535 | 535 | } |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | return TRUE; |
831 | 831 | } |
832 | 832 | |
833 | - $REG = EEM_Registration::instance(); |
|
833 | + $REG = EEM_Registration::instance(); |
|
834 | 834 | |
835 | 835 | $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
836 | 836 | |
@@ -1051,9 +1051,9 @@ discard block |
||
1051 | 1051 | |
1052 | 1052 | /** |
1053 | 1053 | * generates HTML for the View Registration Details Admin page |
1054 | - * @access protected |
|
1055 | - * @return void |
|
1056 | - */ |
|
1054 | + * @access protected |
|
1055 | + * @return void |
|
1056 | + */ |
|
1057 | 1057 | protected function _registration_details() { |
1058 | 1058 | |
1059 | 1059 | $this->_template_args = array(); |
@@ -1130,9 +1130,9 @@ discard block |
||
1130 | 1130 | |
1131 | 1131 | /** |
1132 | 1132 | * _set_approve_or_decline_reg_status_buttons |
1133 | - * @access protected |
|
1134 | - * @return string |
|
1135 | - */ |
|
1133 | + * @access protected |
|
1134 | + * @return string |
|
1135 | + */ |
|
1136 | 1136 | public function set_reg_status_buttons_metabox() { |
1137 | 1137 | |
1138 | 1138 | //is registration for free event OR for a completed transaction? This will determine whether the set to pending option is shown. |
@@ -1321,10 +1321,10 @@ discard block |
||
1321 | 1321 | |
1322 | 1322 | /** |
1323 | 1323 | * approve_registration |
1324 | - * @access protected |
|
1325 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1326 | - * @return void |
|
1327 | - */ |
|
1324 | + * @access protected |
|
1325 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1326 | + * @return void |
|
1327 | + */ |
|
1328 | 1328 | protected function approve_registration( $notify = false ) { |
1329 | 1329 | $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
1330 | 1330 | } |
@@ -1334,10 +1334,10 @@ discard block |
||
1334 | 1334 | |
1335 | 1335 | /** |
1336 | 1336 | * decline_registration |
1337 | - * @access protected |
|
1338 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1339 | - * @return void |
|
1340 | - */ |
|
1337 | + * @access protected |
|
1338 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1339 | + * @return void |
|
1340 | + */ |
|
1341 | 1341 | protected function decline_registration( $notify = false ) { |
1342 | 1342 | $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
1343 | 1343 | } |
@@ -1347,10 +1347,10 @@ discard block |
||
1347 | 1347 | |
1348 | 1348 | /** |
1349 | 1349 | * cancel_registration |
1350 | - * @access protected |
|
1351 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1352 | - * @return void |
|
1353 | - */ |
|
1350 | + * @access protected |
|
1351 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1352 | + * @return void |
|
1353 | + */ |
|
1354 | 1354 | protected function cancel_registration( $notify = false ) { |
1355 | 1355 | $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
1356 | 1356 | } |
@@ -1361,10 +1361,10 @@ discard block |
||
1361 | 1361 | |
1362 | 1362 | /** |
1363 | 1363 | * not_approve_registration |
1364 | - * @access protected |
|
1365 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1366 | - * @return void |
|
1367 | - */ |
|
1364 | + * @access protected |
|
1365 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1366 | + * @return void |
|
1367 | + */ |
|
1368 | 1368 | protected function not_approve_registration( $notify = false ) { |
1369 | 1369 | $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
1370 | 1370 | } |
@@ -1373,10 +1373,10 @@ discard block |
||
1373 | 1373 | |
1374 | 1374 | /** |
1375 | 1375 | * decline_registration |
1376 | - * @access protected |
|
1377 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1378 | - * @return void |
|
1379 | - */ |
|
1376 | + * @access protected |
|
1377 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1378 | + * @return void |
|
1379 | + */ |
|
1380 | 1380 | protected function pending_registration( $notify = false ) { |
1381 | 1381 | $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
1382 | 1382 | } |
@@ -1386,9 +1386,9 @@ discard block |
||
1386 | 1386 | |
1387 | 1387 | /** |
1388 | 1388 | * generates HTML for the Registration main meta box |
1389 | - * @access public |
|
1390 | - * @return void |
|
1391 | - */ |
|
1389 | + * @access public |
|
1390 | + * @return void |
|
1391 | + */ |
|
1392 | 1392 | public function _reg_details_meta_box() { |
1393 | 1393 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1394 | 1394 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
@@ -1471,9 +1471,9 @@ discard block |
||
1471 | 1471 | |
1472 | 1472 | /** |
1473 | 1473 | * generates HTML for the Registration Questions meta box |
1474 | - * @access public |
|
1475 | - * @return void |
|
1476 | - */ |
|
1474 | + * @access public |
|
1475 | + * @return void |
|
1476 | + */ |
|
1477 | 1477 | public function _reg_questions_meta_box() { |
1478 | 1478 | |
1479 | 1479 | add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 ); |
@@ -1581,9 +1581,9 @@ discard block |
||
1581 | 1581 | |
1582 | 1582 | /** |
1583 | 1583 | * generates HTML for the Registration main meta box |
1584 | - * @access protected |
|
1585 | - * @return void |
|
1586 | - */ |
|
1584 | + * @access protected |
|
1585 | + * @return void |
|
1586 | + */ |
|
1587 | 1587 | protected function _update_attendee_registration_form() { |
1588 | 1588 | $qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE; |
1589 | 1589 | $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
@@ -1665,12 +1665,12 @@ discard block |
||
1665 | 1665 | |
1666 | 1666 | /** |
1667 | 1667 | * generates HTML for the Registration main meta box |
1668 | - * @access public |
|
1669 | - * @return void |
|
1670 | - */ |
|
1668 | + * @access public |
|
1669 | + * @return void |
|
1670 | + */ |
|
1671 | 1671 | public function _reg_attendees_meta_box() { |
1672 | 1672 | |
1673 | - $REG = EEM_Registration::instance(); |
|
1673 | + $REG = EEM_Registration::instance(); |
|
1674 | 1674 | //get all other registrations on this transaction, and cache |
1675 | 1675 | //the attendees for them so we don't have to run another query using force_join |
1676 | 1676 | $registrations = $REG->get_all(array( |
@@ -1723,9 +1723,9 @@ discard block |
||
1723 | 1723 | |
1724 | 1724 | /** |
1725 | 1725 | * generates HTML for the Edit Registration side meta box |
1726 | - * @access public |
|
1727 | - * @return void |
|
1728 | - */ |
|
1726 | + * @access public |
|
1727 | + * @return void |
|
1728 | + */ |
|
1729 | 1729 | public function _reg_registrant_side_meta_box() { |
1730 | 1730 | |
1731 | 1731 | /*@var $attendee EE_Attendee */ |
@@ -2071,9 +2071,9 @@ discard block |
||
2071 | 2071 | |
2072 | 2072 | /** |
2073 | 2073 | * set_reg_event |
2074 | - * @access private |
|
2075 | - * @return boolean |
|
2076 | - */ |
|
2074 | + * @access private |
|
2075 | + * @return boolean |
|
2076 | + */ |
|
2077 | 2077 | private function _set_reg_event() { |
2078 | 2078 | if ( is_object( $this->_reg_event )) { |
2079 | 2079 | return TRUE; |
@@ -2177,9 +2177,9 @@ discard block |
||
2177 | 2177 | |
2178 | 2178 | /** |
2179 | 2179 | * generates HTML for the Attendee Contact List |
2180 | - * @access protected |
|
2181 | - * @return void |
|
2182 | - */ |
|
2180 | + * @access protected |
|
2181 | + * @return void |
|
2182 | + */ |
|
2183 | 2183 | protected function _attendee_contact_list_table() { |
2184 | 2184 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
2185 | 2185 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
@@ -2193,9 +2193,9 @@ discard block |
||
2193 | 2193 | /** |
2194 | 2194 | * get_attendees |
2195 | 2195 | * @param bool $count whether to return count or data. |
2196 | - * @access public |
|
2197 | - * @return array |
|
2198 | - */ |
|
2196 | + * @access public |
|
2197 | + * @return array |
|
2198 | + */ |
|
2199 | 2199 | public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
2200 | 2200 | |
2201 | 2201 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2513,9 +2513,9 @@ discard block |
||
2513 | 2513 | |
2514 | 2514 | /** |
2515 | 2515 | * _attendee_details |
2516 | - * @access protected |
|
2517 | - * @return void |
|
2518 | - */ |
|
2516 | + * @access protected |
|
2517 | + * @return void |
|
2518 | + */ |
|
2519 | 2519 | public function attendee_registrations_meta_box( $post ) { |
2520 | 2520 | |
2521 | 2521 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
@@ -2548,10 +2548,10 @@ discard block |
||
2548 | 2548 | |
2549 | 2549 | /** |
2550 | 2550 | * _trash_or_restore_attendee |
2551 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
2552 | - * @access protected |
|
2553 | - * @return void |
|
2554 | - */ |
|
2551 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
2552 | + * @access protected |
|
2553 | + * @return void |
|
2554 | + */ |
|
2555 | 2555 | protected function _trash_or_restore_attendees( $trash = TRUE ) { |
2556 | 2556 | |
2557 | 2557 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -79,8 +81,9 @@ discard block |
||
79 | 81 | public function clear_comment_link( $link, $comment, $args ) { |
80 | 82 | //gotta make sure this only happens on this route |
81 | 83 | $post_type = get_post_type( $comment->comment_post_ID); |
82 | - if ( $post_type == 'espresso_attendees' ) |
|
83 | - return '#commentsdiv'; |
|
84 | + if ( $post_type == 'espresso_attendees' ) { |
|
85 | + return '#commentsdiv'; |
|
86 | + } |
|
84 | 87 | return $link; |
85 | 88 | } |
86 | 89 | |
@@ -834,9 +837,9 @@ discard block |
||
834 | 837 | |
835 | 838 | $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
836 | 839 | |
837 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
838 | - return TRUE; |
|
839 | - else { |
|
840 | + if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) { |
|
841 | + return TRUE; |
|
842 | + } else { |
|
840 | 843 | $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
841 | 844 | EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
842 | 845 | $this->_registration = NULL; |
@@ -933,7 +936,7 @@ discard block |
||
933 | 936 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
934 | 937 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
935 | 938 | )); |
936 | - }elseif($this_month_a || $this_month){ |
|
939 | + } elseif($this_month_a || $this_month){ |
|
937 | 940 | $this_month_r = date('m', current_time('timestamp')); |
938 | 941 | $days_this_month = date( 't', current_time('timestamp') ); |
939 | 942 | $_where['REG_date']= array('BETWEEN', |
@@ -941,18 +944,18 @@ discard block |
||
941 | 944 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
942 | 945 | 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' ) |
943 | 946 | )); |
944 | - }elseif($month_range){ |
|
947 | + } elseif($month_range){ |
|
945 | 948 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
946 | 949 | $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
947 | 950 | $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
948 | 951 | $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
949 | 952 | $_where['REG_date']= array('BETWEEN', |
950 | 953 | 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' ) ) ); |
951 | - }elseif($start_date && $end_date){ |
|
954 | + } elseif($start_date && $end_date){ |
|
952 | 955 | throw new EE_Error("not yet supported"); |
953 | - }elseif($start_date){ |
|
956 | + } elseif($start_date){ |
|
954 | 957 | throw new EE_Error("not yet supported"); |
955 | - }elseif($end_date){ |
|
958 | + } elseif($end_date){ |
|
956 | 959 | throw new EE_Error("not yet supported"); |
957 | 960 | } |
958 | 961 | |
@@ -1876,8 +1879,9 @@ discard block |
||
1876 | 1879 | // cycle thru checkboxes |
1877 | 1880 | while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
1878 | 1881 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1879 | - if ( ! $REG instanceof EE_Registration ) |
|
1880 | - continue; |
|
1882 | + if ( ! $REG instanceof EE_Registration ) { |
|
1883 | + continue; |
|
1884 | + } |
|
1881 | 1885 | $deleted = $this->_delete_registration($REG); |
1882 | 1886 | if ( !$deleted ) { |
1883 | 1887 | $success = 0; |
@@ -1916,8 +1920,9 @@ discard block |
||
1916 | 1920 | |
1917 | 1921 | $all_trashed = TRUE; |
1918 | 1922 | foreach ( $REGS as $registration ) { |
1919 | - if ( ! $registration->get('REG_deleted') ) |
|
1920 | - $all_trashed = FALSE; |
|
1923 | + if ( ! $registration->get('REG_deleted') ) { |
|
1924 | + $all_trashed = FALSE; |
|
1925 | + } |
|
1921 | 1926 | } |
1922 | 1927 | |
1923 | 1928 | if ( ! $all_trashed ) { |
@@ -1943,8 +1948,10 @@ discard block |
||
1943 | 1948 | //now delete permanently the checkins related to this registration. |
1944 | 1949 | $registration->delete_related_permanently('Checkin'); |
1945 | 1950 | |
1946 | - if ( $registration->ID() === $REG->ID() ) |
|
1947 | - continue; //we don't want to delete permanently the existing registration just yet. |
|
1951 | + if ( $registration->ID() === $REG->ID() ) { |
|
1952 | + continue; |
|
1953 | + } |
|
1954 | + //we don't want to delete permanently the existing registration just yet. |
|
1948 | 1955 | |
1949 | 1956 | //remove relation to transaction for these registrations if NOT the existing registrations |
1950 | 1957 | $registration->_remove_relations('Transaction'); |
@@ -1997,8 +2004,9 @@ discard block |
||
1997 | 2004 | |
1998 | 2005 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
1999 | 2006 | |
2000 | - if ( defined('DOING_AJAX' ) ) |
|
2001 | - $this->_return_json(); |
|
2007 | + if ( defined('DOING_AJAX' ) ) { |
|
2008 | + $this->_return_json(); |
|
2009 | + } |
|
2002 | 2010 | |
2003 | 2011 | |
2004 | 2012 | // grab header |
@@ -2412,8 +2420,9 @@ discard block |
||
2412 | 2420 | } |
2413 | 2421 | } |
2414 | 2422 | |
2415 | - if ( $success === FALSE ) |
|
2416 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2423 | + if ( $success === FALSE ) { |
|
2424 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2425 | + } |
|
2417 | 2426 | |
2418 | 2427 | } |
2419 | 2428 |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param bool $routing |
43 | 43 | * @return Registrations_Admin_Page |
44 | 44 | */ |
45 | - public function __construct( $routing = TRUE ) { |
|
46 | - parent::__construct( $routing ); |
|
45 | + public function __construct($routing = TRUE) { |
|
46 | + parent::__construct($routing); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -75,16 +75,16 @@ discard block |
||
75 | 75 | 'trash' => 'post.php' |
76 | 76 | ); |
77 | 77 | |
78 | - add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); |
|
78 | + add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
|
79 | 79 | //add filters so that the comment urls don't take users to a confusing 404 page |
80 | - add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); |
|
80 | + add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
84 | - public function clear_comment_link( $link, $comment, $args ) { |
|
84 | + public function clear_comment_link($link, $comment, $args) { |
|
85 | 85 | //gotta make sure this only happens on this route |
86 | - $post_type = get_post_type( $comment->comment_post_ID); |
|
87 | - if ( $post_type == 'espresso_attendees' ) |
|
86 | + $post_type = get_post_type($comment->comment_post_ID); |
|
87 | + if ($post_type == 'espresso_attendees') |
|
88 | 88 | return '#commentsdiv'; |
89 | 89 | return $link; |
90 | 90 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | protected function _ajax_hooks() { |
94 | 94 | //todo: all hooks for registrations ajax goes in here |
95 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' )); |
|
95 | + add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | 'add-attendee' => __('Add Contact', 'event_espresso'), |
108 | 108 | 'edit' => __('Edit Contact', 'event_espresso'), |
109 | 109 | 'report'=> __("Event Registrations CSV Report", "event_espresso"), |
110 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ), |
|
111 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ), |
|
110 | + 'report_all' => __('All Registrations CSV Report', 'event_espresso'), |
|
111 | + 'contact_list_report' => __('Contact List Report', 'event_espresso'), |
|
112 | 112 | 'contact_list_export'=> __("Export Data", "event_espresso"), |
113 | 113 | ), |
114 | 114 | 'publishbox' => array( |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | |
137 | 137 | $this->_get_registration_status_array(); |
138 | 138 | |
139 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
140 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0; |
|
141 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
139 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
140 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0; |
|
141 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
142 | 142 | |
143 | 143 | $this->_page_routes = array( |
144 | 144 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | 'edit_registration' => array( |
157 | 157 | 'func' => '_registration_details', |
158 | - 'args' => array( 'edit' ), |
|
158 | + 'args' => array('edit'), |
|
159 | 159 | 'noheader' => TRUE, |
160 | 160 | 'capability' => 'ee_edit_registration', |
161 | 161 | 'obj_id' => $reg_id |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | 'restore_registrations' => array( |
172 | 172 | 'func' => '_trash_or_restore_registrations', |
173 | - 'args' => array( 'trash' => FALSE ), |
|
173 | + 'args' => array('trash' => FALSE), |
|
174 | 174 | 'noheader' => TRUE, |
175 | 175 | 'capability' => 'ee_delete_registrations' |
176 | 176 | ), |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | 'filename' => 'registrations_overview_other' |
405 | 405 | ) |
406 | 406 | ), |
407 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
|
407 | + 'help_tour' => array('Registration_Overview_Help_Tour'), |
|
408 | 408 | 'qtips' => array('Registration_List_Table_Tips'), |
409 | 409 | 'list_table' => 'EE_Registrations_List_Table', |
410 | 410 | 'require_nonce' => FALSE |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | 'nav' => array( |
415 | 415 | 'label' => __('REG Details', 'event_espresso'), |
416 | 416 | 'order' => 15, |
417 | - '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, |
|
417 | + '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, |
|
418 | 418 | 'persistent' => FALSE |
419 | 419 | ), |
420 | 420 | 'help_tabs' => array( |
@@ -435,8 +435,8 @@ discard block |
||
435 | 435 | 'filename' => 'registrations_details_registrant_details' |
436 | 436 | ) |
437 | 437 | ), |
438 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ), |
|
439 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ), |
|
438 | + 'help_tour' => array('Registration_Details_Help_Tour'), |
|
439 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), |
|
440 | 440 | 'require_nonce' => FALSE |
441 | 441 | ), |
442 | 442 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | 'order' => 15, |
461 | 461 | 'persistent' => FALSE |
462 | 462 | ), |
463 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), |
|
463 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), |
|
464 | 464 | 'require_nonce' => FALSE |
465 | 465 | ), |
466 | 466 | |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | 'label' => __('Edit Contact', 'event_espresso'), |
470 | 470 | 'order' => 15, |
471 | 471 | 'persistent' => FALSE, |
472 | - '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 |
|
472 | + '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 |
|
473 | 473 | ), |
474 | 474 | 'metaboxes' => array('attendee_editor_metaboxes'), |
475 | 475 | 'require_nonce' => FALSE |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | 'filename' => 'registrations_contact_list_other' |
500 | 500 | ) |
501 | 501 | ), |
502 | - 'help_tour' => array( 'Contact_List_Help_Tour' ), |
|
502 | + 'help_tour' => array('Contact_List_Help_Tour'), |
|
503 | 503 | 'metaboxes' => array(), |
504 | 504 | 'require_nonce' => FALSE |
505 | 505 | ), |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | protected function _add_screen_options() {} |
519 | 519 | protected function _add_feature_pointers() {} |
520 | 520 | public function admin_init() { |
521 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' ); |
|
521 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); |
|
522 | 522 | } |
523 | 523 | public function admin_notices() {} |
524 | 524 | public function admin_footer_scripts() {} |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | * @return void |
537 | 537 | */ |
538 | 538 | private function _get_registration_status_array() { |
539 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
|
539 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE); |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | |
@@ -559,11 +559,11 @@ discard block |
||
559 | 559 | public function load_scripts_styles() { |
560 | 560 | //style |
561 | 561 | //wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
562 | - wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
562 | + wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
563 | 563 | wp_enqueue_style('espresso_reg'); |
564 | 564 | |
565 | 565 | //script |
566 | - 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); |
|
566 | + 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); |
|
567 | 567 | wp_enqueue_script('espresso_reg'); |
568 | 568 | } |
569 | 569 | |
@@ -572,9 +572,9 @@ discard block |
||
572 | 572 | public function load_scripts_styles_edit_attendee() { |
573 | 573 | //stuff to only show up on our attendee edit details page. |
574 | 574 | $attendee_details_translations = array( |
575 | - 'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) |
|
575 | + 'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) |
|
576 | 576 | ); |
577 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations ); |
|
577 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
578 | 578 | wp_enqueue_script('jquery-validate'); |
579 | 579 | } |
580 | 580 | |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | |
593 | 593 | public function load_scripts_styles_contact_list() { |
594 | 594 | wp_deregister_style('espresso_reg'); |
595 | - wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
595 | + wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
596 | 596 | wp_enqueue_style('espresso_att'); |
597 | 597 | } |
598 | 598 | |
@@ -601,9 +601,9 @@ discard block |
||
601 | 601 | |
602 | 602 | |
603 | 603 | public function load_scripts_styles_new_registration() { |
604 | - wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
604 | + wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
605 | 605 | wp_enqueue_script('ee-spco-for-admin'); |
606 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
606 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
607 | 607 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
608 | 608 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
609 | 609 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
@@ -642,23 +642,23 @@ discard block |
||
642 | 642 | |
643 | 643 | /** setup reg status bulk actions **/ |
644 | 644 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
645 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
645 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
646 | 646 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
647 | 647 | } |
648 | 648 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
649 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
649 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
650 | 650 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
651 | 651 | } |
652 | 652 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
653 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
653 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
654 | 654 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
655 | 655 | } |
656 | 656 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
657 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
657 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
658 | 658 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
659 | 659 | } |
660 | 660 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
661 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
661 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
662 | 662 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
663 | 663 | } |
664 | 664 | |
@@ -667,29 +667,29 @@ discard block |
||
667 | 667 | 'slug' => 'all', |
668 | 668 | 'label' => __('View All Registrations', 'event_espresso'), |
669 | 669 | 'count' => 0, |
670 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
670 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
671 | 671 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
672 | - ) ) |
|
672 | + )) |
|
673 | 673 | ), |
674 | 674 | 'month' => array( |
675 | 675 | 'slug' => 'month', |
676 | 676 | 'label' => __('This Month', 'event_espresso'), |
677 | 677 | 'count' => 0, |
678 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
678 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
679 | 679 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
680 | 680 | )) |
681 | 681 | ), |
682 | 682 | 'today' => array( |
683 | 683 | 'slug' => 'today', |
684 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
684 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
685 | 685 | 'count' => 0, |
686 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
686 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
687 | 687 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
688 | 688 | )) |
689 | 689 | ) |
690 | 690 | ); |
691 | 691 | |
692 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
692 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
693 | 693 | $this->_views['incomplete'] = array( |
694 | 694 | 'slug' => 'incomplete', |
695 | 695 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | ) |
726 | 726 | ); |
727 | 727 | |
728 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
728 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
729 | 729 | $this->_views['trash'] = array( |
730 | 730 | 'slug' => 'trash', |
731 | 731 | 'label' => __('Trash', 'event_espresso'), |
@@ -764,42 +764,42 @@ discard block |
||
764 | 764 | 'desc' => __('View Transaction Invoice', 'event_espresso') |
765 | 765 | ), |
766 | 766 | ); |
767 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
767 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
768 | 768 | $fc_items['resend_registration'] = array( |
769 | 769 | 'class' => 'dashicons dashicons-email-alt', |
770 | 770 | 'desc' => __('Resend Registration Details', 'event_espresso') |
771 | 771 | ); |
772 | 772 | } else { |
773 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
773 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | $sc_items = array( |
777 | 777 | 'approved_status' => array( |
778 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
779 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
778 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
779 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
780 | 780 | ), |
781 | 781 | 'pending_status' => array( |
782 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
783 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
782 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
783 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
784 | 784 | ), |
785 | 785 | 'incomplete_status' => array( |
786 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
787 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
786 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
787 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
788 | 788 | ), |
789 | 789 | 'not_approved' => array( |
790 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
791 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
790 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
791 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
792 | 792 | ), |
793 | 793 | 'declined_status' => array( |
794 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
795 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
794 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
795 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
796 | 796 | ), |
797 | 797 | 'cancelled_status' => array( |
798 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
799 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
798 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
799 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
800 | 800 | ) |
801 | 801 | ); |
802 | - return array_merge( $fc_items, $sc_items ); |
|
802 | + return array_merge($fc_items, $sc_items); |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | |
@@ -812,15 +812,15 @@ discard block |
||
812 | 812 | |
813 | 813 | |
814 | 814 | protected function _registrations_overview_list_table() { |
815 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
816 | - if ( $EVT_ID ) { |
|
817 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) { |
|
818 | - $this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' ); |
|
815 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
816 | + if ($EVT_ID) { |
|
817 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) { |
|
818 | + $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2'); |
|
819 | 819 | } |
820 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
821 | - $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>' ) : ''; |
|
820 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
821 | + $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>') : ''; |
|
822 | 822 | } |
823 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
823 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
824 | 824 | $this->display_admin_list_table_page_with_no_sidebar(); |
825 | 825 | } |
826 | 826 | |
@@ -835,19 +835,19 @@ discard block |
||
835 | 835 | */ |
836 | 836 | private function _set_registration_object() { |
837 | 837 | //get out if we've already set the object |
838 | - if ( is_object( $this->_registration )) { |
|
838 | + if (is_object($this->_registration)) { |
|
839 | 839 | return TRUE; |
840 | 840 | } |
841 | 841 | |
842 | 842 | $REG = EEM_Registration::instance(); |
843 | 843 | |
844 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
844 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
845 | 845 | |
846 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
846 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
847 | 847 | return TRUE; |
848 | 848 | else { |
849 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
850 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
849 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
850 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
851 | 851 | $this->_registration = NULL; |
852 | 852 | return FALSE; |
853 | 853 | } |
@@ -866,25 +866,25 @@ discard block |
||
866 | 866 | * @internal param bool $all whether to ignore all query params and just return ALL registrations (or count if count is set) |
867 | 867 | * @return mixed (int|array) int = count || array of registration objects |
868 | 868 | */ |
869 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
870 | - |
|
871 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
872 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
873 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
874 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
875 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
876 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
869 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
870 | + |
|
871 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
872 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
873 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
874 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
875 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
876 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
877 | 877 | $start_date = FALSE; |
878 | 878 | $end_date = FALSE; |
879 | 879 | $_where = array(); |
880 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
881 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
880 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
881 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
882 | 882 | |
883 | 883 | //set orderby |
884 | 884 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
885 | 885 | |
886 | 886 | |
887 | - switch ( $this->_req_data['orderby'] ) { |
|
887 | + switch ($this->_req_data['orderby']) { |
|
888 | 888 | case '_REG_ID': |
889 | 889 | $orderby = 'REG_ID'; |
890 | 890 | break; |
@@ -904,26 +904,26 @@ discard block |
||
904 | 904 | $orderby = 'REG_date'; |
905 | 905 | } |
906 | 906 | |
907 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
908 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
909 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
907 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
908 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
909 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
910 | 910 | |
911 | 911 | |
912 | - $offset = ($current_page-1)*$per_page; |
|
913 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
912 | + $offset = ($current_page - 1) * $per_page; |
|
913 | + $limit = $count ? NULL : array($offset, $per_page); |
|
914 | 914 | |
915 | - if($EVT_ID){ |
|
916 | - $_where['EVT_ID']=$EVT_ID; |
|
915 | + if ($EVT_ID) { |
|
916 | + $_where['EVT_ID'] = $EVT_ID; |
|
917 | 917 | } |
918 | - if($CAT_ID){ |
|
918 | + if ($CAT_ID) { |
|
919 | 919 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
920 | 920 | } |
921 | - if ( $incomplete ) { |
|
921 | + if ($incomplete) { |
|
922 | 922 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
923 | 923 | } else if ( ! $trash) { |
924 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
924 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
925 | 925 | } |
926 | - if($reg_status){ |
|
926 | + if ($reg_status) { |
|
927 | 927 | $_where['STS_ID'] = $reg_status; |
928 | 928 | } |
929 | 929 | |
@@ -935,105 +935,105 @@ discard block |
||
935 | 935 | $time_start = ' 00:00:00'; |
936 | 936 | $time_end = ' 23:59:59'; |
937 | 937 | |
938 | - if($today_a || $today ){ |
|
938 | + if ($today_a || $today) { |
|
939 | 939 | $curdate = date('Y-m-d', current_time('timestamp')); |
940 | - $_where['REG_date']= array('BETWEEN', |
|
940 | + $_where['REG_date'] = array('BETWEEN', |
|
941 | 941 | array( |
942 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
943 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
942 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
943 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
944 | 944 | )); |
945 | - }elseif($this_month_a || $this_month){ |
|
945 | + }elseif ($this_month_a || $this_month) { |
|
946 | 946 | $this_month_r = date('m', current_time('timestamp')); |
947 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
948 | - $_where['REG_date']= array('BETWEEN', |
|
947 | + $days_this_month = date('t', current_time('timestamp')); |
|
948 | + $_where['REG_date'] = array('BETWEEN', |
|
949 | 949 | array( |
950 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
951 | - 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' ) |
|
950 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
951 | + 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') |
|
952 | 952 | )); |
953 | - }elseif($month_range){ |
|
953 | + }elseif ($month_range) { |
|
954 | 954 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
955 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
956 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
957 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
958 | - $_where['REG_date']= array('BETWEEN', |
|
959 | - 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' ) ) ); |
|
960 | - }elseif($start_date && $end_date){ |
|
955 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
956 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
957 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
958 | + $_where['REG_date'] = array('BETWEEN', |
|
959 | + 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'))); |
|
960 | + }elseif ($start_date && $end_date) { |
|
961 | 961 | throw new EE_Error("not yet supported"); |
962 | - }elseif($start_date){ |
|
962 | + }elseif ($start_date) { |
|
963 | 963 | throw new EE_Error("not yet supported"); |
964 | - }elseif($end_date){ |
|
964 | + }elseif ($end_date) { |
|
965 | 965 | throw new EE_Error("not yet supported"); |
966 | 966 | } |
967 | 967 | |
968 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
969 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
968 | + if ( ! empty($this->_req_data['s'])) { |
|
969 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
970 | 970 | $_where['OR'] = array( |
971 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
972 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
973 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
974 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ), |
|
975 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
976 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
977 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
978 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
979 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
980 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
981 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
982 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
983 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
984 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
985 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
986 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
987 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
988 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr ) |
|
971 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
972 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
973 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
974 | + 'Attendee.ATT_full_name' => array('LIKE', $sstr), |
|
975 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
976 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
977 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
978 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
979 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
980 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
981 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
982 | + 'REG_final_price' => array('LIKE', $sstr), |
|
983 | + 'REG_code' => array('LIKE', $sstr), |
|
984 | + 'REG_count' => array('LIKE', $sstr), |
|
985 | + 'REG_group_size' => array('LIKE', $sstr), |
|
986 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
987 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
988 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) |
|
989 | 989 | ); |
990 | 990 | } |
991 | 991 | |
992 | 992 | //capability checks |
993 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
993 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
994 | 994 | $_where['AND'] = array( |
995 | 995 | 'Event.EVT_wp_user' => get_current_user_id() |
996 | 996 | ); |
997 | 997 | } |
998 | 998 | |
999 | 999 | |
1000 | - if( $count ){ |
|
1001 | - if ( $trash ) { |
|
1002 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
1003 | - } else if ( $incomplete ) { |
|
1004 | - return EEM_Registration::instance()->count( array( $_where )); |
|
1000 | + if ($count) { |
|
1001 | + if ($trash) { |
|
1002 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
1003 | + } else if ($incomplete) { |
|
1004 | + return EEM_Registration::instance()->count(array($_where)); |
|
1005 | 1005 | } else { |
1006 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
1006 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
1007 | 1007 | } |
1008 | 1008 | } else { |
1009 | 1009 | //make sure we remove default where conditions cause all registrations matching query are returned |
1010 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1011 | - if ( $per_page !== -1 ) { |
|
1010 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1011 | + if ($per_page !== -1) { |
|
1012 | 1012 | $query_params['limit'] = $limit; |
1013 | 1013 | } |
1014 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1014 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1015 | 1015 | |
1016 | 1016 | |
1017 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1017 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1018 | 1018 | $first_registration = $registrations[0]; |
1019 | 1019 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1020 | 1020 | $event_name = $first_registration->event_obj()->name(); |
1021 | - $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 ) : ''; |
|
1021 | + $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 ) : ''; |
|
1022 | 1022 | // edit event link |
1023 | - if ( $event_name != '' ) { |
|
1024 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1025 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1026 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1023 | + if ($event_name != '') { |
|
1024 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1025 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1026 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1030 | - $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>'; |
|
1029 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1030 | + $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>'; |
|
1031 | 1031 | |
1032 | 1032 | $this->_template_args['before_admin_page_content'] = ' |
1033 | 1033 | <div id="admin-page-header"> |
1034 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1035 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1036 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1034 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1035 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1036 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1037 | 1037 | </div> |
1038 | 1038 | '; |
1039 | 1039 | |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | |
1072 | 1072 | $this->_set_registration_object(); |
1073 | 1073 | |
1074 | - if ( is_object( $this->_registration )) { |
|
1074 | + if (is_object($this->_registration)) { |
|
1075 | 1075 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1076 | 1076 | $this->_session = $transaction->session_data(); |
1077 | 1077 | |
@@ -1079,10 +1079,10 @@ discard block |
||
1079 | 1079 | |
1080 | 1080 | |
1081 | 1081 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1082 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1082 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1083 | 1083 | |
1084 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y','g:i:s a') ; |
|
1085 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1084 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a'); |
|
1085 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1086 | 1086 | |
1087 | 1087 | $this->_template_args['grand_total'] = $transaction->total(); |
1088 | 1088 | |
@@ -1090,19 +1090,19 @@ discard block |
||
1090 | 1090 | // link back to overview |
1091 | 1091 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1092 | 1092 | $this->_template_args['registration'] = $this->_registration; |
1093 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1094 | - $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' ) ); |
|
1095 | - $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' ) ); |
|
1093 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1094 | + $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')); |
|
1095 | + $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')); |
|
1096 | 1096 | |
1097 | 1097 | //next and previous links |
1098 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1099 | - $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' ) : ''; |
|
1100 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1101 | - $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' ) : ''; |
|
1098 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1099 | + $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') : ''; |
|
1100 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1101 | + $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') : ''; |
|
1102 | 1102 | |
1103 | 1103 | // grab header |
1104 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1105 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1104 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1105 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1106 | 1106 | |
1107 | 1107 | } else { |
1108 | 1108 | |
@@ -1123,14 +1123,14 @@ discard block |
||
1123 | 1123 | protected function _registration_details_metaboxes() { |
1124 | 1124 | $this->_set_registration_object(); |
1125 | 1125 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1126 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1127 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1128 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1129 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1126 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1127 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1128 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1129 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1130 | 1130 | } |
1131 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1132 | - if ( $this->_registration->group_size() > 1 ) { |
|
1133 | - 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' ); |
|
1131 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1132 | + if ($this->_registration->group_size() > 1) { |
|
1133 | + 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'); |
|
1134 | 1134 | } |
1135 | 1135 | } |
1136 | 1136 | |
@@ -1151,23 +1151,23 @@ discard block |
||
1151 | 1151 | |
1152 | 1152 | //let's get an array of all possible buttons that we can just reference |
1153 | 1153 | $status_buttons = $this->_get_reg_status_buttons(); |
1154 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status(); |
|
1155 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID(); |
|
1154 | + $template_args['reg_status_value'] = $this->_registration->pretty_status(); |
|
1155 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID(); |
|
1156 | 1156 | $template_args['attendee'] = $this->_registration->attendee(); |
1157 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php'; |
|
1158 | - if ( $this->_set_registration_object() ) { |
|
1157 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php'; |
|
1158 | + if ($this->_set_registration_object()) { |
|
1159 | 1159 | $current_status = $this->_registration->status_ID(); |
1160 | - unset( $status_buttons[$current_status] ); |
|
1161 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { |
|
1162 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] ); |
|
1160 | + unset($status_buttons[$current_status]); |
|
1161 | + if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { |
|
1162 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]); |
|
1163 | 1163 | } |
1164 | - $template_args['status_buttons'] = implode( "\n", $status_buttons ); |
|
1164 | + $template_args['status_buttons'] = implode("\n", $status_buttons); |
|
1165 | 1165 | } |
1166 | 1166 | $template_args['form_url'] = REG_ADMIN_URL; |
1167 | 1167 | $template_args['REG_ID'] = $this->_registration->ID(); |
1168 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE ); |
|
1168 | + $template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); |
|
1169 | 1169 | |
1170 | - EEH_Template::display_template( $template, $template_args ); |
|
1170 | + EEH_Template::display_template($template, $template_args); |
|
1171 | 1171 | |
1172 | 1172 | } |
1173 | 1173 | |
@@ -1181,11 +1181,11 @@ discard block |
||
1181 | 1181 | private function _get_reg_status_buttons() { |
1182 | 1182 | |
1183 | 1183 | $buttons = array( |
1184 | - 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' ) . '">', |
|
1185 | - 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' ) . '">', |
|
1186 | - 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' ) . '">', |
|
1187 | - 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' ) . '">', |
|
1188 | - 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' ) . '">', |
|
1184 | + 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').'">', |
|
1185 | + 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').'">', |
|
1186 | + 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').'">', |
|
1187 | + 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').'">', |
|
1188 | + 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').'">', |
|
1189 | 1189 | ); |
1190 | 1190 | return $buttons; |
1191 | 1191 | } |
@@ -1199,13 +1199,13 @@ discard block |
||
1199 | 1199 | * |
1200 | 1200 | * @return array (array with reg_id(s) updated and whether update was successful. |
1201 | 1201 | */ |
1202 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1203 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1202 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1203 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1204 | 1204 | |
1205 | - $success = $this->_set_registration_status( $REG_ID, $status ); |
|
1205 | + $success = $this->_set_registration_status($REG_ID, $status); |
|
1206 | 1206 | |
1207 | 1207 | //notify? |
1208 | - if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
1208 | + if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
1209 | 1209 | $this->_process_resend_registration(); |
1210 | 1210 | } |
1211 | 1211 | |
@@ -1223,19 +1223,19 @@ discard block |
||
1223 | 1223 | * @param bool $status |
1224 | 1224 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1225 | 1225 | */ |
1226 | - protected function _set_registration_status( $REG_ID, $status = false ) { |
|
1226 | + protected function _set_registration_status($REG_ID, $status = false) { |
|
1227 | 1227 | $success = true; |
1228 | 1228 | // set default status if none is passed |
1229 | 1229 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1230 | 1230 | |
1231 | 1231 | //typecast and sanitize reg_id |
1232 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' ); |
|
1232 | + $reg_ids = array_filter((array) $REG_ID, 'absint'); |
|
1233 | 1233 | |
1234 | 1234 | //loop through REG_ID's and change status |
1235 | - foreach ( $reg_ids as $r_id ) { |
|
1236 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id ); |
|
1237 | - if ( $registration instanceof EE_Registration ) { |
|
1238 | - $registration->set_status( $status ); |
|
1235 | + foreach ($reg_ids as $r_id) { |
|
1236 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id); |
|
1237 | + if ($registration instanceof EE_Registration) { |
|
1238 | + $registration->set_status($status); |
|
1239 | 1239 | $result = $registration->save(); |
1240 | 1240 | |
1241 | 1241 | //verifying explicit fails because update *may* just return 0 for 0 rows affected |
@@ -1247,7 +1247,7 @@ discard block |
||
1247 | 1247 | $this->_req_data['_REG_ID'] = $reg_ids; |
1248 | 1248 | |
1249 | 1249 | //return $success and processed registrations |
1250 | - return array( 'REG_ID' => $reg_ids, 'success' => $success ); |
|
1250 | + return array('REG_ID' => $reg_ids, 'success' => $success); |
|
1251 | 1251 | } |
1252 | 1252 | |
1253 | 1253 | |
@@ -1259,37 +1259,37 @@ discard block |
||
1259 | 1259 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1260 | 1260 | * @return void |
1261 | 1261 | */ |
1262 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1262 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1263 | 1263 | |
1264 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false ); |
|
1264 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); |
|
1265 | 1265 | |
1266 | 1266 | |
1267 | - $success = isset( $result['success'] ) && $result['success']; |
|
1267 | + $success = isset($result['success']) && $result['success']; |
|
1268 | 1268 | |
1269 | 1269 | //setup success message |
1270 | - if ( $success ) { |
|
1271 | - $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' ) ) ; |
|
1272 | - EE_Error::add_success( $msg ); |
|
1270 | + if ($success) { |
|
1271 | + $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')); |
|
1272 | + EE_Error::add_success($msg); |
|
1273 | 1273 | } else { |
1274 | - EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); |
|
1274 | + EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
1275 | 1275 | } |
1276 | 1276 | |
1277 | - $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' ); |
|
1277 | + $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'); |
|
1278 | 1278 | //unset nonces |
1279 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1280 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1281 | - unset( $this->_req_data[$ref] ); |
|
1279 | + foreach ($this->_req_data as $ref => $value) { |
|
1280 | + if (strpos($ref, 'nonce') !== false) { |
|
1281 | + unset($this->_req_data[$ref]); |
|
1282 | 1282 | continue; |
1283 | 1283 | } |
1284 | 1284 | |
1285 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1285 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1286 | 1286 | $this->_req_data[$ref] = $value; |
1287 | 1287 | } |
1288 | 1288 | |
1289 | 1289 | //merge request vars so that the reloaded list table contains any existing filter query params |
1290 | - $route = array_merge( $this->_req_data, $route ); |
|
1290 | + $route = array_merge($this->_req_data, $route); |
|
1291 | 1291 | |
1292 | - $this->_redirect_after_action( $success, '', '', $route, true ); |
|
1292 | + $this->_redirect_after_action($success, '', '', $route, true); |
|
1293 | 1293 | |
1294 | 1294 | } |
1295 | 1295 | |
@@ -1302,29 +1302,29 @@ discard block |
||
1302 | 1302 | protected function _change_reg_status() { |
1303 | 1303 | $this->_req_data['return'] = 'view_registration'; |
1304 | 1304 | //set notify based on whether the send notifications toggle is set or not |
1305 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
|
1306 | - $this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : ''; |
|
1305 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']); |
|
1306 | + $this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : ''; |
|
1307 | 1307 | |
1308 | - switch ( $this->_req_data['_reg_status_id'] ) { |
|
1309 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1310 | - $this->approve_registration( $notify ); |
|
1308 | + switch ($this->_req_data['_reg_status_id']) { |
|
1309 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1310 | + $this->approve_registration($notify); |
|
1311 | 1311 | break; |
1312 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1313 | - $this->pending_registration( $notify ); |
|
1312 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1313 | + $this->pending_registration($notify); |
|
1314 | 1314 | break; |
1315 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1316 | - $this->not_approve_registration( $notify ); |
|
1315 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1316 | + $this->not_approve_registration($notify); |
|
1317 | 1317 | break; |
1318 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1319 | - $this->decline_registration( $notify ); |
|
1318 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1319 | + $this->decline_registration($notify); |
|
1320 | 1320 | break; |
1321 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1322 | - $this->cancel_registration( $notify ); |
|
1321 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1322 | + $this->cancel_registration($notify); |
|
1323 | 1323 | break; |
1324 | 1324 | default : |
1325 | 1325 | $result['success'] = false; |
1326 | - unset( $this->_req_data['return'] ); |
|
1327 | - $this->_reg_status_change_return( '', false ); |
|
1326 | + unset($this->_req_data['return']); |
|
1327 | + $this->_reg_status_change_return('', false); |
|
1328 | 1328 | break; |
1329 | 1329 | } |
1330 | 1330 | } |
@@ -1337,8 +1337,8 @@ discard block |
||
1337 | 1337 | * @param bool $notify whether or not to notify the registrant about their approval. |
1338 | 1338 | * @return void |
1339 | 1339 | */ |
1340 | - protected function approve_registration( $notify = false ) { |
|
1341 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1340 | + protected function approve_registration($notify = false) { |
|
1341 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1342 | 1342 | } |
1343 | 1343 | |
1344 | 1344 | |
@@ -1350,8 +1350,8 @@ discard block |
||
1350 | 1350 | * @param bool $notify whether or not to notify the registrant about their approval. |
1351 | 1351 | * @return void |
1352 | 1352 | */ |
1353 | - protected function decline_registration( $notify = false ) { |
|
1354 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1353 | + protected function decline_registration($notify = false) { |
|
1354 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | |
@@ -1363,8 +1363,8 @@ discard block |
||
1363 | 1363 | * @param bool $notify whether or not to notify the registrant about their approval. |
1364 | 1364 | * @return void |
1365 | 1365 | */ |
1366 | - protected function cancel_registration( $notify = false ) { |
|
1367 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1366 | + protected function cancel_registration($notify = false) { |
|
1367 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1368 | 1368 | } |
1369 | 1369 | |
1370 | 1370 | |
@@ -1377,8 +1377,8 @@ discard block |
||
1377 | 1377 | * @param bool $notify whether or not to notify the registrant about their approval. |
1378 | 1378 | * @return void |
1379 | 1379 | */ |
1380 | - protected function not_approve_registration( $notify = false ) { |
|
1381 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1380 | + protected function not_approve_registration($notify = false) { |
|
1381 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | |
@@ -1389,8 +1389,8 @@ discard block |
||
1389 | 1389 | * @param bool $notify whether or not to notify the registrant about their approval. |
1390 | 1390 | * @return void |
1391 | 1391 | */ |
1392 | - protected function pending_registration( $notify = false ) { |
|
1393 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1392 | + protected function pending_registration($notify = false) { |
|
1393 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1394 | 1394 | } |
1395 | 1395 | |
1396 | 1396 | |
@@ -1404,75 +1404,75 @@ discard block |
||
1404 | 1404 | public function _reg_details_meta_box() { |
1405 | 1405 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1406 | 1406 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1407 | - EE_Registry::instance()->load_Helper( 'Line_Item' ); |
|
1407 | + EE_Registry::instance()->load_Helper('Line_Item'); |
|
1408 | 1408 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1409 | 1409 | $this->_session = $transaction->session_data(); |
1410 | 1410 | |
1411 | 1411 | $filters = new EE_Line_Item_Filter_Collection(); |
1412 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1413 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
1414 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1412 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1413 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
1414 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1415 | 1415 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1416 | 1416 | |
1417 | 1417 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1418 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' ); |
|
1419 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) ); |
|
1418 | + $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); |
|
1419 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); |
|
1420 | 1420 | |
1421 | 1421 | |
1422 | 1422 | $attendee = $this->_registration->attendee(); |
1423 | 1423 | |
1424 | 1424 | |
1425 | - $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' ) : ''; |
|
1426 | - $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' ) : ''; |
|
1425 | + $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') : ''; |
|
1426 | + $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') : ''; |
|
1427 | 1427 | |
1428 | 1428 | |
1429 | 1429 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1430 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1430 | + $payment = $transaction->get_first_related('Payment'); |
|
1431 | 1431 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1432 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1432 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1433 | 1433 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1434 | - $reg_status_class = 'status-' . $this->_registration->status_ID(); |
|
1434 | + $reg_status_class = 'status-'.$this->_registration->status_ID(); |
|
1435 | 1435 | $reg_details = array( |
1436 | 1436 | 'payment_method' => $payment_method->name(), |
1437 | 1437 | 'response_msg' => $payment->gateway_response(), |
1438 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1438 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1439 | 1439 | 'registration_session' => $this->_registration->session_ID(), |
1440 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1441 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1440 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1441 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1442 | 1442 | ); |
1443 | 1443 | |
1444 | 1444 | |
1445 | - if ( isset( $reg_details['registration_id'] )) { |
|
1445 | + if (isset($reg_details['registration_id'])) { |
|
1446 | 1446 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1447 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1447 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1448 | 1448 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1449 | 1449 | } |
1450 | 1450 | |
1451 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1451 | + if (isset($reg_details['payment_method'])) { |
|
1452 | 1452 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1453 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1453 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1454 | 1454 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1455 | 1455 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1456 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1456 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1457 | 1457 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1458 | 1458 | } |
1459 | 1459 | |
1460 | 1460 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1461 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1461 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1462 | 1462 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1463 | 1463 | |
1464 | 1464 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1465 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1465 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1466 | 1466 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1467 | 1467 | |
1468 | 1468 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1469 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1469 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1470 | 1470 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1471 | 1471 | |
1472 | - $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 ); |
|
1472 | + $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); |
|
1473 | 1473 | |
1474 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1475 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1474 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1475 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1476 | 1476 | |
1477 | 1477 | } |
1478 | 1478 | |
@@ -1488,23 +1488,23 @@ discard block |
||
1488 | 1488 | */ |
1489 | 1489 | public function _reg_questions_meta_box() { |
1490 | 1490 | |
1491 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 ); |
|
1492 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $this, 'form_after_question_group' ), 10, 1 ); |
|
1493 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'form_form_field_label_wrap' ), 10, 1 ); |
|
1494 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'form_form_field_input__wrap' ), 10, 1 ); |
|
1491 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($this, 'form_before_question_group'), 10, 1); |
|
1492 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($this, 'form_after_question_group'), 10, 1); |
|
1493 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'form_form_field_label_wrap'), 10, 1); |
|
1494 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'form_form_field_input__wrap'), 10, 1); |
|
1495 | 1495 | |
1496 | - $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $this->_registration, $this->_registration->get('EVT_ID') ); |
|
1496 | + $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($this->_registration, $this->_registration->get('EVT_ID')); |
|
1497 | 1497 | |
1498 | 1498 | //EEH_Debug_Tools::printr( $question_groups, '$question_groups <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1499 | 1499 | |
1500 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
1501 | - $this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html( $question_groups ); |
|
1500 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
1501 | + $this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html($question_groups); |
|
1502 | 1502 | |
1503 | 1503 | $this->_template_args['reg_questions_form_action'] = 'update_attendee_registration_form'; |
1504 | 1504 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1505 | 1505 | |
1506 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1507 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1506 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1507 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1508 | 1508 | |
1509 | 1509 | } |
1510 | 1510 | |
@@ -1519,7 +1519,7 @@ discard block |
||
1519 | 1519 | * @param string $output |
1520 | 1520 | * @return string |
1521 | 1521 | */ |
1522 | - public function form_before_question_group( $output ) { |
|
1522 | + public function form_before_question_group($output) { |
|
1523 | 1523 | return ' |
1524 | 1524 | <table class="form-table ee-width-100"> |
1525 | 1525 | <tbody> |
@@ -1536,13 +1536,13 @@ discard block |
||
1536 | 1536 | * @param string $output |
1537 | 1537 | * @return string |
1538 | 1538 | */ |
1539 | - public function form_after_question_group( $output ) { |
|
1539 | + public function form_after_question_group($output) { |
|
1540 | 1540 | return ' |
1541 | 1541 | <tr class="hide-if-no-js"> |
1542 | 1542 | <th> </th> |
1543 | 1543 | <td class="reg-admin-edit-attendee-question-td"> |
1544 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1545 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1544 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1545 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1546 | 1546 | <div class="dashicons dashicons-edit"></div> |
1547 | 1547 | </a> |
1548 | 1548 | </td> |
@@ -1562,11 +1562,11 @@ discard block |
||
1562 | 1562 | * @param string $label |
1563 | 1563 | * @return string |
1564 | 1564 | */ |
1565 | - public function form_form_field_label_wrap( $label ) { |
|
1565 | + public function form_form_field_label_wrap($label) { |
|
1566 | 1566 | return ' |
1567 | 1567 | <tr> |
1568 | 1568 | <th> |
1569 | - ' . $label . ' |
|
1569 | + ' . $label.' |
|
1570 | 1570 | </th>'; |
1571 | 1571 | } |
1572 | 1572 | |
@@ -1580,10 +1580,10 @@ discard block |
||
1580 | 1580 | * @param string $label |
1581 | 1581 | * @return string |
1582 | 1582 | */ |
1583 | - public function form_form_field_input__wrap( $input ) { |
|
1583 | + public function form_form_field_input__wrap($input) { |
|
1584 | 1584 | return ' |
1585 | 1585 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1586 | - ' . $input . ' |
|
1586 | + ' . $input.' |
|
1587 | 1587 | </td> |
1588 | 1588 | </tr>'; |
1589 | 1589 | } |
@@ -1597,13 +1597,13 @@ discard block |
||
1597 | 1597 | * @return void |
1598 | 1598 | */ |
1599 | 1599 | protected function _update_attendee_registration_form() { |
1600 | - $qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE; |
|
1601 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1602 | - $qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns ); |
|
1603 | - $success = $this->_save_attendee_registration_form( $REG_ID, $qstns ); |
|
1600 | + $qstns = isset($this->_req_data['qstn']) ? $this->_req_data['qstn'] : FALSE; |
|
1601 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1602 | + $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns); |
|
1603 | + $success = $this->_save_attendee_registration_form($REG_ID, $qstns); |
|
1604 | 1604 | $what = __('Registration Form', 'event_espresso'); |
1605 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1606 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1605 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1606 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1607 | 1607 | |
1608 | 1608 | } |
1609 | 1609 | |
@@ -1616,26 +1616,26 @@ discard block |
||
1616 | 1616 | * @param bool $qstns |
1617 | 1617 | * @return bool |
1618 | 1618 | */ |
1619 | - private function _save_attendee_registration_form( $REG_ID = FALSE, $qstns = FALSE ) { |
|
1619 | + private function _save_attendee_registration_form($REG_ID = FALSE, $qstns = FALSE) { |
|
1620 | 1620 | |
1621 | - if ( ! $REG_ID || ! $qstns ) { |
|
1622 | - EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1621 | + if ( ! $REG_ID || ! $qstns) { |
|
1622 | + EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1623 | 1623 | } |
1624 | 1624 | $success = TRUE; |
1625 | 1625 | |
1626 | 1626 | // allow others to get in on this awesome fun :D |
1627 | - do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns ); |
|
1627 | + do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns); |
|
1628 | 1628 | // loop thru questions... FINALLY!!! |
1629 | 1629 | |
1630 | - foreach ( $qstns as $QST_ID => $qstn ) { |
|
1630 | + foreach ($qstns as $QST_ID => $qstn) { |
|
1631 | 1631 | //if $qstn isn't an array then it doesn't already have an answer, so let's create the answer |
1632 | - if ( !is_array($qstn) ) { |
|
1633 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
1632 | + if ( ! is_array($qstn)) { |
|
1633 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
1634 | 1634 | continue; |
1635 | 1635 | } |
1636 | 1636 | |
1637 | 1637 | |
1638 | - foreach ( $qstn as $ANS_ID => $ANS_value ) { |
|
1638 | + foreach ($qstn as $ANS_ID => $ANS_value) { |
|
1639 | 1639 | //get answer |
1640 | 1640 | $query_params = array( |
1641 | 1641 | 0 => array( |
@@ -1646,8 +1646,8 @@ discard block |
||
1646 | 1646 | ); |
1647 | 1647 | $answer = EEM_Answer::instance()->get_one($query_params); |
1648 | 1648 | //this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer |
1649 | - if ( ! $answer instanceof EE_Answer ) { |
|
1650 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
1649 | + if ( ! $answer instanceof EE_Answer) { |
|
1650 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
1651 | 1651 | continue 2; |
1652 | 1652 | } |
1653 | 1653 | |
@@ -1661,7 +1661,7 @@ discard block |
||
1661 | 1661 | |
1662 | 1662 | |
1663 | 1663 | //TODO: try changing this to use the model directly... not indirectly through creating a default object... |
1664 | - private function _save_new_answer( $REG_ID, $QST_ID, $ans ) { |
|
1664 | + private function _save_new_answer($REG_ID, $QST_ID, $ans) { |
|
1665 | 1665 | $set_values = array( |
1666 | 1666 | 'QST_ID' => $QST_ID, |
1667 | 1667 | 'REG_ID' => $REG_ID, |
@@ -1688,30 +1688,30 @@ discard block |
||
1688 | 1688 | $registrations = $REG->get_all(array( |
1689 | 1689 | array( |
1690 | 1690 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1691 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1691 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1692 | 1692 | ), |
1693 | 1693 | 'force_join'=>array('Attendee'))); |
1694 | 1694 | |
1695 | 1695 | $this->_template_args['attendees'] = array(); |
1696 | 1696 | $this->_template_args['attendee_notice'] = ''; |
1697 | 1697 | EE_Registry::instance()->load_helper('Array'); |
1698 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1699 | - 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__ ); |
|
1698 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1699 | + 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__); |
|
1700 | 1700 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1701 | 1701 | } else { |
1702 | 1702 | |
1703 | 1703 | $att_nmbr = 1; |
1704 | - foreach ( $registrations as $registration ) { |
|
1704 | + foreach ($registrations as $registration) { |
|
1705 | 1705 | /* @var $registration EE_Registration */ |
1706 | 1706 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1707 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1708 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1709 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1710 | - $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 : ''; |
|
1707 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1708 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1709 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1710 | + $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 : ''; |
|
1711 | 1711 | |
1712 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1712 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1713 | 1713 | |
1714 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1714 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1715 | 1715 | |
1716 | 1716 | $att_nmbr++; |
1717 | 1717 | } |
@@ -1723,8 +1723,8 @@ discard block |
||
1723 | 1723 | |
1724 | 1724 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
1725 | 1725 | } |
1726 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1727 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1726 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1727 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1728 | 1728 | |
1729 | 1729 | } |
1730 | 1730 | |
@@ -1745,11 +1745,11 @@ discard block |
||
1745 | 1745 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
1746 | 1746 | |
1747 | 1747 | //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) |
1748 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
1748 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
1749 | 1749 | $primary_registration = $this->_registration->get_primary_registration(); |
1750 | 1750 | $primary_attendee = $primary_registration->attendee(); |
1751 | 1751 | |
1752 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
1752 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
1753 | 1753 | //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. |
1754 | 1754 | $primary_registration = NULL; |
1755 | 1755 | } |
@@ -1758,28 +1758,28 @@ discard block |
||
1758 | 1758 | } |
1759 | 1759 | |
1760 | 1760 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
1761 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
1762 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
1763 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
1761 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
1762 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
1763 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
1764 | 1764 | $this->_template_args['phone'] = $attendee->phone(); |
1765 | 1765 | |
1766 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1767 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
1766 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1767 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
1768 | 1768 | |
1769 | 1769 | |
1770 | 1770 | //edit link |
1771 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1772 | - $this->_template_args['att_edit_label'] = __('View/Edit Contact' ); |
|
1771 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1772 | + $this->_template_args['att_edit_label'] = __('View/Edit Contact'); |
|
1773 | 1773 | |
1774 | 1774 | //create link |
1775 | - $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 ): ''; |
|
1775 | + $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) : ''; |
|
1776 | 1776 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
1777 | 1777 | |
1778 | 1778 | $this->_template_args['att_check'] = $att_check; |
1779 | 1779 | |
1780 | 1780 | |
1781 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1782 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1781 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1782 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1783 | 1783 | } |
1784 | 1784 | |
1785 | 1785 | |
@@ -1792,7 +1792,7 @@ discard block |
||
1792 | 1792 | * @access protected |
1793 | 1793 | * @return void |
1794 | 1794 | */ |
1795 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
1795 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
1796 | 1796 | $REGM = EEM_Registration::instance(); |
1797 | 1797 | |
1798 | 1798 | $success = 1; |
@@ -1802,26 +1802,26 @@ discard block |
||
1802 | 1802 | $dtts = array(); |
1803 | 1803 | |
1804 | 1804 | //if empty _REG_ID then get out because there's nothing to do |
1805 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
1805 | + if (empty($this->_req_data['_REG_ID'])) { |
|
1806 | 1806 | $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'); |
1807 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
1808 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
1807 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
1808 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
1809 | 1809 | } |
1810 | 1810 | |
1811 | 1811 | //Checkboxes |
1812 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1812 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1813 | 1813 | // if array has more than one element than success message should be plural |
1814 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1814 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1815 | 1815 | // cycle thru checkboxes |
1816 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1816 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1817 | 1817 | |
1818 | 1818 | $REG = $REGM->get_one_by_ID($REG_ID); |
1819 | 1819 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
1820 | - if ( $payment_count > 0 ) { |
|
1821 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
1820 | + if ($payment_count > 0) { |
|
1821 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
1822 | 1822 | $error = 1; |
1823 | 1823 | $success = 0; |
1824 | - 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__ ); |
|
1824 | + 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__); |
|
1825 | 1825 | continue; //can't trash this registration because it has payments. |
1826 | 1826 | } |
1827 | 1827 | $ticket = $REG->get_first_related('Ticket'); |
@@ -1830,7 +1830,7 @@ discard block |
||
1830 | 1830 | $dtts = array_merge($dtts, $dtt); |
1831 | 1831 | |
1832 | 1832 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1833 | - if ( !$updated ) { |
|
1833 | + if ( ! $updated) { |
|
1834 | 1834 | $success = 0; |
1835 | 1835 | } else { |
1836 | 1836 | $success = 2; |
@@ -1845,7 +1845,7 @@ discard block |
||
1845 | 1845 | $tickets[$ticket->ID()] = $ticket; |
1846 | 1846 | $dtts = $ticket->get_many_related('Datetime'); |
1847 | 1847 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1848 | - if ( ! $updated ) { |
|
1848 | + if ( ! $updated) { |
|
1849 | 1849 | $success = 0; |
1850 | 1850 | } |
1851 | 1851 | |
@@ -1855,10 +1855,10 @@ discard block |
||
1855 | 1855 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
1856 | 1856 | EEM_Datetime::instance()->update_sold($dtts); |
1857 | 1857 | |
1858 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1859 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
1858 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1859 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
1860 | 1860 | $overwrite_msgs = $error ? TRUE : FALSE; |
1861 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
1861 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
1862 | 1862 | } |
1863 | 1863 | |
1864 | 1864 | |
@@ -1882,16 +1882,16 @@ discard block |
||
1882 | 1882 | $success = 1; |
1883 | 1883 | |
1884 | 1884 | //Checkboxes |
1885 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1885 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1886 | 1886 | // if array has more than one element than success message should be plural |
1887 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1887 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1888 | 1888 | // cycle thru checkboxes |
1889 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1889 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1890 | 1890 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1891 | - if ( ! $REG instanceof EE_Registration ) |
|
1891 | + if ( ! $REG instanceof EE_Registration) |
|
1892 | 1892 | continue; |
1893 | 1893 | $deleted = $this->_delete_registration($REG); |
1894 | - if ( !$deleted ) { |
|
1894 | + if ( ! $deleted) { |
|
1895 | 1895 | $success = 0; |
1896 | 1896 | } |
1897 | 1897 | } |
@@ -1901,15 +1901,15 @@ discard block |
||
1901 | 1901 | $REG_ID = $this->_req_data['_REG_ID']; |
1902 | 1902 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1903 | 1903 | $deleted = $this->_delete_registration($REG); |
1904 | - if ( ! $deleted ) { |
|
1904 | + if ( ! $deleted) { |
|
1905 | 1905 | $success = 0; |
1906 | 1906 | } |
1907 | 1907 | |
1908 | 1908 | } |
1909 | 1909 | |
1910 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1911 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
1912 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
1910 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1911 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
1912 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
1913 | 1913 | } |
1914 | 1914 | |
1915 | 1915 | |
@@ -1921,31 +1921,31 @@ discard block |
||
1921 | 1921 | * @param EE_Registration $REG registration to be deleted permenantly |
1922 | 1922 | * @return boolean true = successful deletion, false = fail. |
1923 | 1923 | */ |
1924 | - protected function _delete_registration( EE_Registration $REG ) { |
|
1924 | + protected function _delete_registration(EE_Registration $REG) { |
|
1925 | 1925 | //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. |
1926 | 1926 | $TXN = $REG->get_first_related('Transaction'); |
1927 | 1927 | $REGS = $TXN->get_many_related('Registration'); |
1928 | 1928 | |
1929 | 1929 | $all_trashed = TRUE; |
1930 | - foreach ( $REGS as $registration ) { |
|
1931 | - if ( ! $registration->get('REG_deleted') ) |
|
1930 | + foreach ($REGS as $registration) { |
|
1931 | + if ( ! $registration->get('REG_deleted')) |
|
1932 | 1932 | $all_trashed = FALSE; |
1933 | 1933 | } |
1934 | 1934 | |
1935 | - if ( ! $all_trashed ) { |
|
1936 | - 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__ ); |
|
1935 | + if ( ! $all_trashed) { |
|
1936 | + 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__); |
|
1937 | 1937 | return false; |
1938 | 1938 | } |
1939 | 1939 | |
1940 | 1940 | //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). |
1941 | - foreach ( $REGS as $registration ) { |
|
1941 | + foreach ($REGS as $registration) { |
|
1942 | 1942 | |
1943 | 1943 | //delete related answers |
1944 | 1944 | $registration->delete_related_permanently('Answer'); |
1945 | 1945 | |
1946 | 1946 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
1947 | 1947 | $attendee = $registration->get_first_related('Attendee'); |
1948 | - if ( $attendee instanceof EE_Attendee ) { |
|
1948 | + if ($attendee instanceof EE_Attendee) { |
|
1949 | 1949 | $registration->_remove_relation_to($attendee, 'Attendee'); |
1950 | 1950 | } |
1951 | 1951 | |
@@ -1955,7 +1955,7 @@ discard block |
||
1955 | 1955 | //now delete permanently the checkins related to this registration. |
1956 | 1956 | $registration->delete_related_permanently('Checkin'); |
1957 | 1957 | |
1958 | - if ( $registration->ID() === $REG->ID() ) |
|
1958 | + if ($registration->ID() === $REG->ID()) |
|
1959 | 1959 | continue; //we don't want to delete permanently the existing registration just yet. |
1960 | 1960 | |
1961 | 1961 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -1988,34 +1988,34 @@ discard block |
||
1988 | 1988 | * @return void |
1989 | 1989 | */ |
1990 | 1990 | public function new_registration() { |
1991 | - if ( ! $this->_set_reg_event() ) { |
|
1992 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
1991 | + if ( ! $this->_set_reg_event()) { |
|
1992 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
1993 | 1993 | } |
1994 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
1994 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
1995 | 1995 | |
1996 | 1996 | // gotta start with a clean slate if we're not coming here via ajax |
1997 | - if ( ! defined('DOING_AJAX' ) && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ))) { |
|
1998 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
1997 | + if ( ! defined('DOING_AJAX') && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))) { |
|
1998 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
1999 | 1999 | } |
2000 | 2000 | |
2001 | - $this->_template_args['event_name'] = '' ; |
|
2001 | + $this->_template_args['event_name'] = ''; |
|
2002 | 2002 | // event name |
2003 | - if ( $this->_reg_event ) { |
|
2003 | + if ($this->_reg_event) { |
|
2004 | 2004 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2005 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2006 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2007 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2005 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2006 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2007 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2008 | 2008 | } |
2009 | 2009 | |
2010 | 2010 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2011 | 2011 | |
2012 | - if ( defined('DOING_AJAX' ) ) |
|
2012 | + if (defined('DOING_AJAX')) |
|
2013 | 2013 | $this->_return_json(); |
2014 | 2014 | |
2015 | 2015 | |
2016 | 2016 | // grab header |
2017 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2018 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2017 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2018 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2019 | 2019 | |
2020 | 2020 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2021 | 2021 | // the details template wrapper |
@@ -2033,7 +2033,7 @@ discard block |
||
2033 | 2033 | */ |
2034 | 2034 | protected function _get_registration_step_content() { |
2035 | 2035 | |
2036 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php'; |
|
2036 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php'; |
|
2037 | 2037 | $template_args = array( |
2038 | 2038 | 'title' => '', |
2039 | 2039 | 'content' => '', |
@@ -2054,11 +2054,11 @@ discard block |
||
2054 | 2054 | |
2055 | 2055 | //if the cart is empty then we know we're at step one so we'll display ticket selector |
2056 | 2056 | $cart = EE_Registry::instance()->SSN->get_session_data('cart'); |
2057 | - $step = empty( $cart ) ? 'ticket' : 'questions'; |
|
2058 | - switch ( $step ) { |
|
2057 | + $step = empty($cart) ? 'ticket' : 'questions'; |
|
2058 | + switch ($step) { |
|
2059 | 2059 | case 'ticket' : |
2060 | 2060 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2061 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2061 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2062 | 2062 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2063 | 2063 | $template_args['show_notification_toggle'] = FALSE; |
2064 | 2064 | break; |
@@ -2071,9 +2071,9 @@ discard block |
||
2071 | 2071 | break; |
2072 | 2072 | } |
2073 | 2073 | |
2074 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2074 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2075 | 2075 | |
2076 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
2076 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
2077 | 2077 | } |
2078 | 2078 | |
2079 | 2079 | |
@@ -2087,11 +2087,11 @@ discard block |
||
2087 | 2087 | * @return boolean |
2088 | 2088 | */ |
2089 | 2089 | private function _set_reg_event() { |
2090 | - if ( is_object( $this->_reg_event )) { |
|
2090 | + if (is_object($this->_reg_event)) { |
|
2091 | 2091 | return TRUE; |
2092 | 2092 | } |
2093 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2094 | - if ( ! $EVT_ID ) { |
|
2093 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2094 | + if ( ! $EVT_ID) { |
|
2095 | 2095 | return FALSE; |
2096 | 2096 | } |
2097 | 2097 | |
@@ -2112,62 +2112,62 @@ discard block |
||
2112 | 2112 | public function process_reg_step() { |
2113 | 2113 | |
2114 | 2114 | $this->_set_reg_event(); |
2115 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2115 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2116 | 2116 | |
2117 | 2117 | //what step are we on? |
2118 | - $cart = EE_Registry::instance()->SSN->get_session_data( 'cart' ); |
|
2119 | - $step = empty( $cart ) ? 'ticket' : 'questions'; |
|
2118 | + $cart = EE_Registry::instance()->SSN->get_session_data('cart'); |
|
2119 | + $step = empty($cart) ? 'ticket' : 'questions'; |
|
2120 | 2120 | |
2121 | 2121 | //if doing ajax then we need to verify the nonce |
2122 | - if ( 'DOING_AJAX' ) { |
|
2123 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2124 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2122 | + if ('DOING_AJAX') { |
|
2123 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2124 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2125 | 2125 | } |
2126 | 2126 | |
2127 | - switch ( $step ) { |
|
2127 | + switch ($step) { |
|
2128 | 2128 | case 'ticket' : |
2129 | 2129 | //process ticket selection |
2130 | 2130 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2131 | - if ( $success ) { |
|
2132 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2131 | + if ($success) { |
|
2132 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2133 | 2133 | } else { |
2134 | 2134 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2135 | 2135 | } |
2136 | - if ( defined('DOING_AJAX') ) { |
|
2136 | + if (defined('DOING_AJAX')) { |
|
2137 | 2137 | $this->new_registration(); //display next step |
2138 | 2138 | } else { |
2139 | 2139 | $query_args['action'] = 'new_registration'; |
2140 | 2140 | $query_args['processing_registration'] = true; |
2141 | 2141 | $query_args['event_id'] = $this->_reg_event->ID(); |
2142 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2142 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2143 | 2143 | } |
2144 | 2144 | break; |
2145 | 2145 | case 'questions' : |
2146 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2147 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2146 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2147 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2148 | 2148 | } |
2149 | 2149 | //process registration |
2150 | 2150 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2151 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2151 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2152 | 2152 | $query_args = array( |
2153 | 2153 | 'action' => 'new_registration', |
2154 | 2154 | 'processing_registration' => true, |
2155 | 2155 | 'event_id' => $this->_reg_event->ID() |
2156 | 2156 | ); |
2157 | 2157 | |
2158 | - if ( defined('DOING_AJAX' )) { |
|
2158 | + if (defined('DOING_AJAX')) { |
|
2159 | 2159 | //display registration form again because there are errors (maybe validation?) |
2160 | 2160 | $this->new_registration(); |
2161 | 2161 | return; |
2162 | 2162 | } else { |
2163 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2163 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2164 | 2164 | return; |
2165 | 2165 | } |
2166 | 2166 | } |
2167 | 2167 | /** @type EE_Transaction_Payments $transaction_payments */ |
2168 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2168 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2169 | 2169 | // maybe update status, and make sure to save transaction if not done already |
2170 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2170 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2171 | 2171 | $transaction->save(); |
2172 | 2172 | } |
2173 | 2173 | $query_args = array( |
@@ -2175,8 +2175,8 @@ discard block |
||
2175 | 2175 | 'TXN_ID' => $transaction->ID(), |
2176 | 2176 | 'page' => 'espresso_transactions' |
2177 | 2177 | ); |
2178 | - EE_Error::add_success( __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') ); |
|
2179 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2178 | + EE_Error::add_success(__('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso')); |
|
2179 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2180 | 2180 | break; |
2181 | 2181 | } |
2182 | 2182 | |
@@ -2196,7 +2196,7 @@ discard block |
||
2196 | 2196 | * @return void |
2197 | 2197 | */ |
2198 | 2198 | protected function _attendee_contact_list_table() { |
2199 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2199 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2200 | 2200 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2201 | 2201 | $this->display_admin_list_table_page_with_no_sidebar(); |
2202 | 2202 | } |
@@ -2211,10 +2211,10 @@ discard block |
||
2211 | 2211 | * @access public |
2212 | 2212 | * @return array |
2213 | 2213 | */ |
2214 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2214 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2215 | 2215 | |
2216 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2217 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2216 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2217 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2218 | 2218 | $ATT_MDL = EEM_Attendee::instance(); |
2219 | 2219 | |
2220 | 2220 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2242,47 +2242,47 @@ discard block |
||
2242 | 2242 | $orderby = 'ATT_lname'; |
2243 | 2243 | } |
2244 | 2244 | |
2245 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2245 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2246 | 2246 | |
2247 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2248 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2249 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2247 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2248 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2249 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2250 | 2250 | |
2251 | 2251 | $_where = array(); |
2252 | 2252 | |
2253 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2254 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2253 | + if (isset($this->_req_data['s'])) { |
|
2254 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2255 | 2255 | $_where['OR'] = array( |
2256 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2257 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2258 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2259 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2260 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2261 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2262 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2263 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2264 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2265 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2266 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2267 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2268 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2269 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2270 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2271 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2272 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2256 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2257 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2258 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2259 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2260 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2261 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2262 | + 'ATT_email' => array('LIKE', $sstr), |
|
2263 | + 'ATT_address' => array('LIKE', $sstr), |
|
2264 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2265 | + 'ATT_city' => array('LIKE', $sstr), |
|
2266 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2267 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2268 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2269 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2270 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2271 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2272 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2273 | 2273 | ); |
2274 | 2274 | } |
2275 | 2275 | |
2276 | 2276 | |
2277 | - $offset = ($current_page-1)*$per_page; |
|
2278 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2277 | + $offset = ($current_page - 1) * $per_page; |
|
2278 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2279 | 2279 | |
2280 | - if ( $trash ) { |
|
2281 | - $_where['status'] = array( '!=', 'publish' ); |
|
2282 | - $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)); |
|
2280 | + if ($trash) { |
|
2281 | + $_where['status'] = array('!=', 'publish'); |
|
2282 | + $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)); |
|
2283 | 2283 | } else { |
2284 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2285 | - $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) ); |
|
2284 | + $_where['status'] = array('IN', array('publish')); |
|
2285 | + $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)); |
|
2286 | 2286 | } |
2287 | 2287 | |
2288 | 2288 | return $all_attendees; |
@@ -2299,10 +2299,10 @@ discard block |
||
2299 | 2299 | */ |
2300 | 2300 | protected function _resend_registration() { |
2301 | 2301 | $this->_process_resend_registration(); |
2302 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2302 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2303 | 2303 | 'action' => 'default' |
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 | |
@@ -2310,27 +2310,27 @@ discard block |
||
2310 | 2310 | |
2311 | 2311 | |
2312 | 2312 | |
2313 | - public function _registrations_report(){ |
|
2314 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2315 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2313 | + public function _registrations_report() { |
|
2314 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2315 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2316 | 2316 | array( |
2317 | 2317 | 'page' => 'espresso_support', |
2318 | 2318 | 'action' => 'batch_file_create', |
2319 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2320 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ), |
|
2321 | - 'redirect_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2322 | - )) ); |
|
2319 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2320 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'), |
|
2321 | + 'redirect_url' => urlencode($this->_req_data['return_url']), |
|
2322 | + ))); |
|
2323 | 2323 | } else { |
2324 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2324 | + EE_Registry::instance()->load_helper('File'); |
|
2325 | 2325 | $new_request_args = array( |
2326 | 2326 | 'export' => 'report', |
2327 | 2327 | 'action' => 'registrations_report_for_event', |
2328 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2328 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2329 | 2329 | ); |
2330 | 2330 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2331 | 2331 | |
2332 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2333 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2332 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2333 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2334 | 2334 | $EE_Export = EE_Export::instance($this->_req_data); |
2335 | 2335 | $EE_Export->export(); |
2336 | 2336 | } |
@@ -2339,28 +2339,28 @@ discard block |
||
2339 | 2339 | |
2340 | 2340 | |
2341 | 2341 | |
2342 | - public function _contact_list_export(){ |
|
2343 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2344 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2345 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2342 | + public function _contact_list_export() { |
|
2343 | + EE_Registry::instance()->load_helper('File'); |
|
2344 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2345 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2346 | 2346 | $EE_Export = EE_Export::instance($this->_req_data); |
2347 | 2347 | $EE_Export->export_attendees(); |
2348 | 2348 | } |
2349 | 2349 | } |
2350 | 2350 | |
2351 | - public function _contact_list_report(){ |
|
2352 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2353 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2351 | + public function _contact_list_report() { |
|
2352 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2353 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2354 | 2354 | array( |
2355 | 2355 | 'page' => 'espresso_support', |
2356 | 2356 | 'action' => 'batch_file_create', |
2357 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ), |
|
2358 | - 'redirect_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2359 | - )) ); |
|
2357 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'), |
|
2358 | + 'redirect_url' => urlencode($this->_req_data['return_url']), |
|
2359 | + ))); |
|
2360 | 2360 | } else { |
2361 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2362 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2363 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2361 | + EE_Registry::instance()->load_helper('File'); |
|
2362 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2363 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2364 | 2364 | $EE_Export = EE_Export::instance($this->_req_data); |
2365 | 2365 | $EE_Export->report_attendees(); |
2366 | 2366 | } |
@@ -2380,73 +2380,73 @@ discard block |
||
2380 | 2380 | * @return void |
2381 | 2381 | */ |
2382 | 2382 | protected function _duplicate_attendee() { |
2383 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2383 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2384 | 2384 | //verify we have necessary info |
2385 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2386 | - 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__ ); |
|
2387 | - $query_args = array( 'action' => $action ); |
|
2385 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2386 | + 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__); |
|
2387 | + $query_args = array('action' => $action); |
|
2388 | 2388 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2389 | 2389 | } |
2390 | 2390 | |
2391 | 2391 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2392 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2392 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2393 | 2393 | $attendee = $registration->attendee(); |
2394 | 2394 | |
2395 | 2395 | //remove relation of existing attendee on registration |
2396 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2396 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2397 | 2397 | //new attendee |
2398 | 2398 | $new_attendee = clone $attendee; |
2399 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2399 | + $new_attendee->set('ATT_ID', 0); |
|
2400 | 2400 | $new_attendee->save(); |
2401 | 2401 | |
2402 | 2402 | //add new attendee to reg |
2403 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2403 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2404 | 2404 | |
2405 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2405 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2406 | 2406 | |
2407 | 2407 | //redirect to edit page for attendee |
2408 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2408 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2409 | 2409 | |
2410 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2410 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2411 | 2411 | } |
2412 | 2412 | |
2413 | 2413 | |
2414 | 2414 | //related to cpt routes |
2415 | 2415 | protected function _insert_update_cpt_item($post_id, $post) { |
2416 | 2416 | $success = true; |
2417 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2417 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2418 | 2418 | //for attendee updates |
2419 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2419 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2420 | 2420 | //note we should only be UPDATING attendees at this point. |
2421 | 2421 | $updated_fields = array( |
2422 | 2422 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2423 | 2423 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2424 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2424 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2425 | 2425 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2426 | 2426 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2427 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2428 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2429 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2430 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2431 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2432 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2427 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2428 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2429 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2430 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2431 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2432 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2433 | 2433 | ); |
2434 | - foreach ( $updated_fields as $field => $value ) { |
|
2434 | + foreach ($updated_fields as $field => $value) { |
|
2435 | 2435 | $attendee->set($field, $value); |
2436 | 2436 | } |
2437 | 2437 | |
2438 | 2438 | $success = $attendee->save(); |
2439 | 2439 | |
2440 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2441 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2442 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2443 | - 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 ) ); |
|
2440 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2441 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2442 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2443 | + 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)); |
|
2444 | 2444 | } |
2445 | 2445 | } |
2446 | 2446 | } |
2447 | 2447 | |
2448 | - if ( $success === FALSE ) |
|
2449 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2448 | + if ($success === FALSE) |
|
2449 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2450 | 2450 | |
2451 | 2451 | } |
2452 | 2452 | |
@@ -2466,17 +2466,17 @@ discard block |
||
2466 | 2466 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2467 | 2467 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2468 | 2468 | |
2469 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2470 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2469 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2470 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2471 | 2471 | } |
2472 | 2472 | |
2473 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2473 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2474 | 2474 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2475 | 2475 | } |
2476 | 2476 | |
2477 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2478 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2479 | - 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'); |
|
2477 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2478 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2479 | + 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'); |
|
2480 | 2480 | } |
2481 | 2481 | |
2482 | 2482 | |
@@ -2485,10 +2485,10 @@ discard block |
||
2485 | 2485 | * @param WP_Post $post wp post object |
2486 | 2486 | * @return string attendee contact info ( and form ) |
2487 | 2487 | */ |
2488 | - public function attendee_contact_info( $post ) { |
|
2488 | + public function attendee_contact_info($post) { |
|
2489 | 2489 | //get attendee object ( should already have it ) |
2490 | 2490 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2491 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2491 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2492 | 2492 | EEH_Template::display_template($template, $this->_template_args); |
2493 | 2493 | } |
2494 | 2494 | |
@@ -2504,12 +2504,12 @@ discard block |
||
2504 | 2504 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2505 | 2505 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2506 | 2506 | new EE_Question_Form_Input( |
2507 | - EE_Question::new_instance( array( |
|
2507 | + EE_Question::new_instance(array( |
|
2508 | 2508 | 'QST_ID' => 0, |
2509 | 2509 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2510 | 2510 | 'QST_system' => 'admin-state' |
2511 | 2511 | )), |
2512 | - EE_Answer::new_instance( array( |
|
2512 | + EE_Answer::new_instance(array( |
|
2513 | 2513 | 'ANS_ID' => 0, |
2514 | 2514 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2515 | 2515 | )), |
@@ -2522,12 +2522,12 @@ discard block |
||
2522 | 2522 | )); |
2523 | 2523 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2524 | 2524 | new EE_Question_Form_Input( |
2525 | - EE_Question::new_instance( array( |
|
2525 | + EE_Question::new_instance(array( |
|
2526 | 2526 | 'QST_ID' => 0, |
2527 | 2527 | 'QST_display_text' => __('Country', 'event_espresso'), |
2528 | 2528 | 'QST_system' => 'admin-country' |
2529 | 2529 | )), |
2530 | - EE_Answer::new_instance( array( |
|
2530 | + EE_Answer::new_instance(array( |
|
2531 | 2531 | 'ANS_ID' => 0, |
2532 | 2532 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2533 | 2533 | )), |
@@ -2538,8 +2538,8 @@ discard block |
||
2538 | 2538 | 'append_qstn_id' => FALSE |
2539 | 2539 | ) |
2540 | 2540 | )); |
2541 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2542 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2541 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2542 | + EEH_Template::display_template($template, $this->_template_args); |
|
2543 | 2543 | |
2544 | 2544 | } |
2545 | 2545 | |
@@ -2549,11 +2549,11 @@ discard block |
||
2549 | 2549 | * @access protected |
2550 | 2550 | * @return void |
2551 | 2551 | */ |
2552 | - public function attendee_registrations_meta_box( $post ) { |
|
2552 | + public function attendee_registrations_meta_box($post) { |
|
2553 | 2553 | |
2554 | 2554 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2555 | 2555 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2556 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2556 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2557 | 2557 | EEH_Template::display_template($template, $this->_template_args); |
2558 | 2558 | |
2559 | 2559 | } |
@@ -2567,8 +2567,8 @@ discard block |
||
2567 | 2567 | * @return string html for new form. |
2568 | 2568 | */ |
2569 | 2569 | public function after_title_form_fields($post) { |
2570 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2571 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2570 | + if ($post->post_type == 'espresso_attendees') { |
|
2571 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2572 | 2572 | $template_args['attendee'] = $this->_cpt_model_obj; |
2573 | 2573 | EEH_Template::display_template($template, $template_args); |
2574 | 2574 | } |
@@ -2585,21 +2585,21 @@ discard block |
||
2585 | 2585 | * @access protected |
2586 | 2586 | * @return void |
2587 | 2587 | */ |
2588 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2588 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2589 | 2589 | |
2590 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2590 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2591 | 2591 | |
2592 | 2592 | $ATT_MDL = EEM_Attendee::instance(); |
2593 | 2593 | |
2594 | 2594 | $success = 1; |
2595 | 2595 | //Checkboxes |
2596 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2596 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2597 | 2597 | // if array has more than one element than success message should be plural |
2598 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2598 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2599 | 2599 | // cycle thru checkboxes |
2600 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2601 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2602 | - if ( !$updated ) { |
|
2600 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2601 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2602 | + if ( ! $updated) { |
|
2603 | 2603 | $success = 0; |
2604 | 2604 | } |
2605 | 2605 | } |
@@ -2608,18 +2608,18 @@ discard block |
||
2608 | 2608 | // grab single id and delete |
2609 | 2609 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2610 | 2610 | //get attendee |
2611 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2611 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2612 | 2612 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2613 | 2613 | $updated = $att->save(); |
2614 | - if ( ! $updated ) { |
|
2614 | + if ( ! $updated) { |
|
2615 | 2615 | $success = 0; |
2616 | 2616 | } |
2617 | 2617 | |
2618 | 2618 | } |
2619 | 2619 | |
2620 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2621 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2622 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2620 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2621 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2622 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2623 | 2623 | |
2624 | 2624 | } |
2625 | 2625 |
@@ -93,7 +93,7 @@ |
||
93 | 93 | * |
94 | 94 | * @abstract |
95 | 95 | * @access protected |
96 | - * @return array |
|
96 | + * @return string[] |
|
97 | 97 | */ |
98 | 98 | protected function _get_table_filters() { |
99 | 99 | $filters = array(); |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -244,10 +246,11 @@ discard block |
||
244 | 246 | */ |
245 | 247 | function column_ATT_email( EE_Transaction $item ){ |
246 | 248 | $attendee = $item->primary_registration()->get_first_related('Attendee'); |
247 | - if ( !empty( $attendee ) ) |
|
248 | - return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>'; |
|
249 | - else |
|
250 | - return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
|
249 | + if ( !empty( $attendee ) ) { |
|
250 | + return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>'; |
|
251 | + } else { |
|
252 | + return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
|
253 | + } |
|
251 | 254 | ; |
252 | 255 | } |
253 | 256 |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return string |
141 | 141 | */ |
142 | 142 | function column_TXN_ID( EE_Transaction $item ){ |
143 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
143 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
144 | 144 | $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
145 | 145 | |
146 | 146 | //txn timestamp |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | * @param \EE_Transaction $item |
276 | 276 | * @return string|void |
277 | 277 | */ |
278 | - function column_event_name( EE_Transaction $item ){ |
|
279 | - $actions = array(); |
|
278 | + function column_event_name( EE_Transaction $item ){ |
|
279 | + $actions = array(); |
|
280 | 280 | $event = $item->primary_registration()->get_first_related('Event'); |
281 | 281 | if ( !empty( $event ) ) { |
282 | 282 | $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
@@ -300,21 +300,21 @@ discard block |
||
300 | 300 | * @param \EE_Transaction $item |
301 | 301 | * @return string |
302 | 302 | */ |
303 | - function column_actions( EE_Transaction $item ){ |
|
303 | + function column_actions( EE_Transaction $item ){ |
|
304 | 304 | |
305 | - $registration = $item->primary_registration(); |
|
306 | - $attendee = $registration->attendee(); |
|
305 | + $registration = $item->primary_registration(); |
|
306 | + $attendee = $registration->attendee(); |
|
307 | 307 | EE_Registry::instance()->load_helper( 'MSG_Template' ); |
308 | 308 | |
309 | - //Build row actions |
|
309 | + //Build row actions |
|
310 | 310 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
311 | 311 | $dl_invoice_lnk_url = $registration->invoice_url(); |
312 | 312 | $dl_receipt_lnk_url = $registration->receipt_url(); |
313 | 313 | $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
314 | 314 | $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
315 | - $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
316 | - 'TXN_ID' => $item->ID() |
|
317 | - )); |
|
315 | + $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
316 | + 'TXN_ID' => $item->ID() |
|
317 | + )); |
|
318 | 318 | |
319 | 319 | //Build row actions |
320 | 320 | $view_lnk = ' |
@@ -349,8 +349,8 @@ discard block |
||
349 | 349 | $dl_receipt_lnk = ''; |
350 | 350 | } |
351 | 351 | |
352 | - //only show payment reminder link if the message type is active. |
|
353 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
352 | + //only show payment reminder link if the message type is active. |
|
353 | + if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
354 | 354 | $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? ' |
355 | 355 | <li> |
356 | 356 | <a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text"> |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
379 | - } |
|
379 | + } |
|
380 | 380 | |
381 | 381 | |
382 | 382 | } |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @param \EE_Admin_Page $admin_page |
34 | 34 | * @return EE_Admin_Transactions_List_Table |
35 | 35 | */ |
36 | - function __construct( EE_Admin_Page $admin_page ){ |
|
37 | - parent::__construct( $admin_page ); |
|
36 | + function __construct(EE_Admin_Page $admin_page) { |
|
37 | + parent::__construct($admin_page); |
|
38 | 38 | $this->_status = $this->_admin_page->get_transaction_status_array(); |
39 | 39 | |
40 | 40 | } |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | |
45 | 45 | |
46 | 46 | protected function _setup_data() { |
47 | - $this->_data = $this->_admin_page->get_transactions( $this->_per_page ); |
|
48 | - $status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all'; |
|
49 | - $this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status ); |
|
47 | + $this->_data = $this->_admin_page->get_transactions($this->_per_page); |
|
48 | + $status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all'; |
|
49 | + $this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -65,20 +65,20 @@ discard block |
||
65 | 65 | ); |
66 | 66 | |
67 | 67 | $this->_columns = array( |
68 | - 'TXN_ID' => __( 'ID', 'event_espresso' ), |
|
69 | - 'TXN_timestamp' => __( 'Transaction Date', 'event_espresso' ), |
|
70 | - 'TXN_total' => __( 'Total', 'event_espresso' ), |
|
71 | - 'TXN_paid' => __( 'Paid', 'event_espresso' ), |
|
72 | - 'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ), |
|
73 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
74 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
68 | + 'TXN_ID' => __('ID', 'event_espresso'), |
|
69 | + 'TXN_timestamp' => __('Transaction Date', 'event_espresso'), |
|
70 | + 'TXN_total' => __('Total', 'event_espresso'), |
|
71 | + 'TXN_paid' => __('Paid', 'event_espresso'), |
|
72 | + 'ATT_fname' => __('Primary Registrant', 'event_espresso'), |
|
73 | + 'event_name' => __('Event', 'event_espresso'), |
|
74 | + 'actions' => __('Actions', 'event_espresso') |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | $this->_sortable_columns = array( |
78 | - 'TXN_ID' => array( 'TXN_ID' => FALSE ), |
|
79 | - 'event_name' => array( 'event_name'=> FALSE ), |
|
80 | - 'ATT_fname' => array( 'ATT_fname'=> FALSE ), |
|
81 | - 'TXN_timestamp' => array( 'TXN_timestamp'=> TRUE ) //true means its already sorted |
|
78 | + 'TXN_ID' => array('TXN_ID' => FALSE), |
|
79 | + 'event_name' => array('event_name'=> FALSE), |
|
80 | + 'ATT_fname' => array('ATT_fname'=> FALSE), |
|
81 | + 'TXN_timestamp' => array('TXN_timestamp'=> TRUE) //true means its already sorted |
|
82 | 82 | ); |
83 | 83 | |
84 | 84 | $this->_primary_column = 'TXN_ID'; |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | |
89 | 89 | |
90 | 90 | |
91 | - protected function _get_row_class( $item ) { |
|
92 | - $class = parent::_get_row_class( $item ); |
|
91 | + protected function _get_row_class($item) { |
|
92 | + $class = parent::_get_row_class($item); |
|
93 | 93 | //add status class |
94 | - $class .= ' ee-status-strip txn-status-' . $item->status_ID(); |
|
95 | - if ( $this->_has_checkbox_column ) { |
|
94 | + $class .= ' ee-status-strip txn-status-'.$item->status_ID(); |
|
95 | + if ($this->_has_checkbox_column) { |
|
96 | 96 | $class .= ' has-checkbox-column'; |
97 | 97 | } |
98 | 98 | return $class; |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | */ |
110 | 110 | protected function _get_table_filters() { |
111 | 111 | $filters = array(); |
112 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
113 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
112 | + $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year')); |
|
113 | + $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y'); |
|
114 | 114 | ob_start(); |
115 | 115 | ?> |
116 | 116 | <label for="txn-filter-start-date">Display Transactions from </label> |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | |
129 | 129 | |
130 | 130 | protected function _add_view_counts() { |
131 | - $this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' ); |
|
132 | - $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' ); |
|
133 | - $this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' ); |
|
131 | + $this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all'); |
|
132 | + $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned'); |
|
133 | + $this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed'); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -139,29 +139,29 @@ discard block |
||
139 | 139 | * @param \EE_Transaction $item |
140 | 140 | * @return string |
141 | 141 | */ |
142 | - function column_TXN_ID( EE_Transaction $item ){ |
|
143 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
144 | - $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
|
142 | + function column_TXN_ID(EE_Transaction $item) { |
|
143 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
144 | + $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>'; |
|
145 | 145 | |
146 | 146 | //txn timestamp |
147 | - $content .= ' <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp( $item ) . '</span>'; |
|
147 | + $content .= ' <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>'; |
|
148 | 148 | return $content; |
149 | 149 | } |
150 | 150 | |
151 | 151 | |
152 | 152 | |
153 | - protected function _get_txn_timestamp( EE_Transaction $item ) { |
|
153 | + protected function _get_txn_timestamp(EE_Transaction $item) { |
|
154 | 154 | //txn timestamp |
155 | 155 | // is TXN less than 2 hours old ? |
156 | 156 | if ( |
157 | - ( ( time() - EE_Registry::instance()->SSN->lifespan() ) |
|
158 | - < $item->datetime( false, true ) |
|
157 | + ((time() - EE_Registry::instance()->SSN->lifespan()) |
|
158 | + < $item->datetime(false, true) |
|
159 | 159 | ) |
160 | - && ( $item->failed() || $item->is_abandoned() ) |
|
160 | + && ($item->failed() || $item->is_abandoned()) |
|
161 | 161 | ) { |
162 | - $timestamp = __( 'TXN in progress...', 'event_espresso' ); |
|
162 | + $timestamp = __('TXN in progress...', 'event_espresso'); |
|
163 | 163 | } else { |
164 | - $timestamp = $item->get_i18n_datetime( 'TXN_timestamp' ); |
|
164 | + $timestamp = $item->get_i18n_datetime('TXN_timestamp'); |
|
165 | 165 | } |
166 | 166 | return $timestamp; |
167 | 167 | } |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param \EE_Transaction $item |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - function column_cb($item ){ |
|
177 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
176 | + function column_cb($item) { |
|
177 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | * @param \EE_Transaction $item |
186 | 186 | * @return string |
187 | 187 | */ |
188 | - function column_TXN_timestamp( EE_Transaction $item ){ |
|
189 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
190 | - $txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $this->_get_txn_timestamp( $item ) . '</a>'; |
|
188 | + function column_TXN_timestamp(EE_Transaction $item) { |
|
189 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
190 | + $txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>'; |
|
191 | 191 | //status |
192 | - $txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
192 | + $txn_date .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
193 | 193 | return $txn_date; |
194 | 194 | } |
195 | 195 | |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | * @param \EE_Transaction $item |
200 | 200 | * @return string |
201 | 201 | */ |
202 | - function column_TXN_total( EE_Transaction $item ){ |
|
203 | - if ( $item->get('TXN_total') > 0 ) { |
|
204 | - return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>'; |
|
202 | + function column_TXN_total(EE_Transaction $item) { |
|
203 | + if ($item->get('TXN_total') > 0) { |
|
204 | + return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>'; |
|
205 | 205 | } else { |
206 | - return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
206 | + return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>'; |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -213,19 +213,19 @@ discard block |
||
213 | 213 | * @param \EE_Transaction $item |
214 | 214 | * @return mixed|string |
215 | 215 | */ |
216 | - function column_TXN_paid( EE_Transaction $item ){ |
|
216 | + function column_TXN_paid(EE_Transaction $item) { |
|
217 | 217 | $transaction_total = $item->get('TXN_total'); |
218 | 218 | $transaction_paid = $item->get('TXN_paid'); |
219 | 219 | |
220 | - if (( $transaction_total > 0 ) && ( $transaction_paid >= $transaction_total )) { |
|
220 | + if (($transaction_total > 0) && ($transaction_paid >= $transaction_total)) { |
|
221 | 221 | // paid in full |
222 | 222 | $span_class = 'txn-overview-full-payment-spn'; |
223 | 223 | |
224 | - } elseif (( $transaction_total > 0 ) && ( $transaction_paid > 0 )) { |
|
224 | + } elseif (($transaction_total > 0) && ($transaction_paid > 0)) { |
|
225 | 225 | // monies owing |
226 | 226 | $span_class = 'txn-overview-part-payment-spn'; |
227 | 227 | |
228 | - } elseif (( $transaction_total > 0 ) && ( $transaction_paid == 0 )) { |
|
228 | + } elseif (($transaction_total > 0) && ($transaction_paid == 0)) { |
|
229 | 229 | // no payments made |
230 | 230 | $span_class = 'txn-overview-no-payment-spn'; |
231 | 231 | |
@@ -235,11 +235,11 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | $payment_method = $item->payment_method(); |
238 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
238 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
239 | 239 | |
240 | - $content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>'; |
|
241 | - if ( $transaction_paid > 0 ) { |
|
242 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
240 | + $content = '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>'; |
|
241 | + if ($transaction_paid > 0) { |
|
242 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
243 | 243 | } |
244 | 244 | return $content; |
245 | 245 | } |
@@ -250,13 +250,13 @@ discard block |
||
250 | 250 | * @param \EE_Transaction $item |
251 | 251 | * @return string|void |
252 | 252 | */ |
253 | - function column_ATT_fname( EE_Transaction $item ){ |
|
253 | + function column_ATT_fname(EE_Transaction $item) { |
|
254 | 254 | $primary_reg = $item->primary_registration(); |
255 | 255 | $attendee = $primary_reg->get_first_related('Attendee'); |
256 | - if ( $attendee instanceof EE_Attendee ) { |
|
257 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL ); |
|
258 | - $content = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name(); |
|
259 | - $content .= '<br>' . $attendee->email(); |
|
256 | + if ($attendee instanceof EE_Attendee) { |
|
257 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL); |
|
258 | + $content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name(); |
|
259 | + $content .= '<br>'.$attendee->email(); |
|
260 | 260 | return $content; |
261 | 261 | } |
262 | 262 | return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | * @param \EE_Transaction $item |
269 | 269 | * @return string|void |
270 | 270 | */ |
271 | - function column_ATT_email( EE_Transaction $item ){ |
|
271 | + function column_ATT_email(EE_Transaction $item) { |
|
272 | 272 | $attendee = $item->primary_registration()->get_first_related('Attendee'); |
273 | - if ( !empty( $attendee ) ) |
|
274 | - return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>'; |
|
273 | + if ( ! empty($attendee)) |
|
274 | + return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>'; |
|
275 | 275 | else |
276 | 276 | return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
277 | 277 | ; |
@@ -283,20 +283,20 @@ discard block |
||
283 | 283 | * @param \EE_Transaction $item |
284 | 284 | * @return string|void |
285 | 285 | */ |
286 | - function column_event_name( EE_Transaction $item ){ |
|
286 | + function column_event_name(EE_Transaction $item) { |
|
287 | 287 | $actions = array(); |
288 | 288 | $event = $item->primary_registration()->get_first_related('Event'); |
289 | - if ( !empty( $event ) ) { |
|
290 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
|
289 | + if ( ! empty($event)) { |
|
290 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL); |
|
291 | 291 | $event_name = $event->get('EVT_name'); |
292 | 292 | |
293 | 293 | //filter this view by transactions for this event |
294 | - $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) ); |
|
295 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) { |
|
296 | - $actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>'; |
|
294 | + $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID())); |
|
295 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) { |
|
296 | + $actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>'; |
|
297 | 297 | } |
298 | 298 | |
299 | - return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) ); |
|
299 | + return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions)); |
|
300 | 300 | } else { |
301 | 301 | return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso'); |
302 | 302 | } |
@@ -308,36 +308,36 @@ discard block |
||
308 | 308 | * @param \EE_Transaction $item |
309 | 309 | * @return string |
310 | 310 | */ |
311 | - function column_actions( EE_Transaction $item ){ |
|
311 | + function column_actions(EE_Transaction $item) { |
|
312 | 312 | |
313 | 313 | $registration = $item->primary_registration(); |
314 | 314 | $attendee = $registration->attendee(); |
315 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
315 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
316 | 316 | |
317 | 317 | //Build row actions |
318 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
318 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
319 | 319 | $dl_invoice_lnk_url = $registration->invoice_url(); |
320 | 320 | $dl_receipt_lnk_url = $registration->receipt_url(); |
321 | - $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
|
322 | - $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
323 | - $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
321 | + $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL); |
|
322 | + $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
323 | + $related_messages_link = EEH_MSG_Template::get_message_action_link('see_notifications_for', null, array( |
|
324 | 324 | 'TXN_ID' => $item->ID() |
325 | 325 | )); |
326 | 326 | |
327 | 327 | //Build row actions |
328 | 328 | $view_lnk = ' |
329 | 329 | <li> |
330 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text"> |
|
330 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text"> |
|
331 | 331 | <span class="dashicons dashicons-cart"></span> |
332 | 332 | </a> |
333 | 333 | </li>'; |
334 | 334 | |
335 | 335 | |
336 | 336 | //only show invoice link if message type is active. |
337 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
337 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) { |
|
338 | 338 | $dl_invoice_lnk = ' |
339 | 339 | <li> |
340 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
340 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
341 | 341 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
342 | 342 | </a> |
343 | 343 | </li>'; |
@@ -346,10 +346,10 @@ discard block |
||
346 | 346 | } |
347 | 347 | |
348 | 348 | //only show receipt link if message type is active. |
349 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) { |
|
349 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) { |
|
350 | 350 | $dl_receipt_lnk = ' |
351 | 351 | <li> |
352 | - <a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
352 | + <a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
353 | 353 | <span class="dashicons dashicons-media-default ee-icon-size-18"></span> |
354 | 354 | </a> |
355 | 355 | </li>'; |
@@ -358,10 +358,10 @@ discard block |
||
358 | 358 | } |
359 | 359 | |
360 | 360 | //only show payment reminder link if the message type is active. |
361 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
362 | - $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? ' |
|
361 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
362 | + $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder') ? ' |
|
363 | 363 | <li> |
364 | - <a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text"> |
|
364 | + <a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text"> |
|
365 | 365 | <span class="dashicons dashicons-email-alt"></span> |
366 | 366 | </a> |
367 | 367 | </li>' : ''; |
@@ -370,20 +370,20 @@ discard block |
||
370 | 370 | $send_pay_lnk = ''; |
371 | 371 | } |
372 | 372 | |
373 | - $view_reg_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? ' |
|
373 | + $view_reg_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? ' |
|
374 | 374 | <li> |
375 | - <a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
375 | + <a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
376 | 376 | <span class="dashicons dashicons-clipboard"></span> |
377 | 377 | </a> |
378 | 378 | </li>' : ''; |
379 | 379 | |
380 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) { |
|
381 | - $view_related_messages_lnk = '<li>' . $related_messages_link . '</li>'; |
|
380 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_messages', 'view_filtered_messages')) { |
|
381 | + $view_related_messages_lnk = '<li>'.$related_messages_link.'</li>'; |
|
382 | 382 | } else { |
383 | 383 | $view_related_messages_lnk = ''; |
384 | 384 | } |
385 | 385 | |
386 | - return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
|
386 | + return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk.$view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul'); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 |
@@ -94,7 +94,7 @@ |
||
94 | 94 | * Handles attaching Message Templates to the Event on save. |
95 | 95 | * @param EE_Event $evtobj EE event object |
96 | 96 | * @param array $data The request data from the form |
97 | - * @return bool success or fail |
|
97 | + * @return integer success or fail |
|
98 | 98 | */ |
99 | 99 | public function attach_evt_message_templates( $evtobj, $data ) { |
100 | 100 | //first we remove all existing relations on the Event for message types. |
@@ -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,15 +30,15 @@ discard block |
||
30 | 30 | class espresso_events_Messages_Hooks_Extend extends espresso_events_Messages_Hooks { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( EE_Admin_Page $adminpage ) { |
|
33 | + public function __construct(EE_Admin_Page $adminpage) { |
|
34 | 34 | /** |
35 | 35 | * Add cap restriction ... metaboxes should not show if user does not have the ability to edit_custom_messages |
36 | 36 | */ |
37 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'messages_events_editor_metabox' ) ) { |
|
37 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'messages_events_editor_metabox')) { |
|
38 | 38 | return; |
39 | 39 | } |
40 | - add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 ); |
|
41 | - parent::__construct( $adminpage ); |
|
40 | + add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10); |
|
41 | + parent::__construct($adminpage); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | */ |
50 | 50 | protected function _extend_properties() { |
51 | 51 | |
52 | - define( 'EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/' ); |
|
52 | + define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/'); |
|
53 | 53 | $this->_ajax_func = array( |
54 | 54 | 'ee_msgs_create_new_custom' => 'create_new_custom' |
55 | 55 | ); |
56 | 56 | $this->_metaboxes = array( |
57 | 57 | 0 => array( |
58 | - 'page_route' => array('edit','create_new'), |
|
58 | + 'page_route' => array('edit', 'create_new'), |
|
59 | 59 | 'func' => 'messages_metabox', |
60 | 60 | 'label' => __('Notifications', 'event_espresso'), |
61 | 61 | 'priority' => 'high' |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | $this->_scripts_styles = array( |
67 | 67 | 'registers' => array( |
68 | 68 | 'events_msg_admin' => array( |
69 | - 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js', |
|
69 | + 'url' => EE_MSGS_EXTEND_ASSETS_URL.'events_messages_admin.js', |
|
70 | 70 | 'depends' => array('ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array') |
71 | 71 | ), |
72 | 72 | 'events_msg_admin_css' => array( |
73 | - 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css', |
|
73 | + 'url' => EE_MSGS_EXTEND_ASSETS_URL.'ee_msg_events_admin.css', |
|
74 | 74 | 'type' => 'css' |
75 | 75 | ) |
76 | 76 | ), |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | |
85 | - public function caf_updates( $update_callbacks ) { |
|
86 | - $update_callbacks[] = array( $this, 'attach_evt_message_templates' ); |
|
85 | + public function caf_updates($update_callbacks) { |
|
86 | + $update_callbacks[] = array($this, 'attach_evt_message_templates'); |
|
87 | 87 | return $update_callbacks; |
88 | 88 | } |
89 | 89 | |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | * @param array $data The request data from the form |
97 | 97 | * @return bool success or fail |
98 | 98 | */ |
99 | - public function attach_evt_message_templates( $evtobj, $data ) { |
|
99 | + public function attach_evt_message_templates($evtobj, $data) { |
|
100 | 100 | //first we remove all existing relations on the Event for message types. |
101 | 101 | $evtobj->_remove_relations('Message_Template_Group'); |
102 | 102 | |
103 | 103 | //now let's just loop throught the selected templates and add relations! |
104 | - foreach( $data['event_message_templates_relation'] as $grp_ID ) { |
|
105 | - $evtobj->_add_relation_to( $grp_ID, 'Message_Template_Group' ); |
|
104 | + foreach ($data['event_message_templates_relation'] as $grp_ID) { |
|
105 | + $evtobj->_add_relation_to($grp_ID, 'Message_Template_Group'); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | //now save |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | |
116 | 116 | //let's get the active messengers (b/c messenger objects have the active message templates) |
117 | 117 | //convert 'evt_id' to 'EVT_ID' |
118 | - $this->_req_data['EVT_ID'] = isset( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : NULL; |
|
119 | - $this->_req_data['EVT_ID'] = isset( $this->_req_data['post'] ) && empty( $this->_req_data['EVT_ID'] ) ? $this->_req_data['post'] : $this->_req_data['EVT_ID']; |
|
118 | + $this->_req_data['EVT_ID'] = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL; |
|
119 | + $this->_req_data['EVT_ID'] = isset($this->_req_data['post']) && empty($this->_req_data['EVT_ID']) ? $this->_req_data['post'] : $this->_req_data['EVT_ID']; |
|
120 | 120 | |
121 | - $this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID'] ) && isset($this->_req_data['evt_id'] ) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID']; |
|
121 | + $this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID']) && isset($this->_req_data['evt_id']) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID']; |
|
122 | 122 | |
123 | 123 | |
124 | 124 | $EEM_controller = new EE_messages; |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | |
128 | 128 | //empty messengers? |
129 | 129 | //Note message types will always have at least one available because every messenger has a default message type associated with it (payment) if no other message types are selected. |
130 | - if ( empty( $active_messengers ) ) { |
|
131 | - $msg_activate_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'settings'), EE_MSG_ADMIN_URL ); |
|
132 | - $error_msg = sprintf( __('There are no active messengers. So no notifications will go out for <strong>any</strong> events. You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="' . $msg_activate_url . '">', '</a>'); |
|
133 | - $error_content = '<div class="error"><p>' . $error_msg . '</p></div>'; |
|
134 | - $internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>'; |
|
130 | + if (empty($active_messengers)) { |
|
131 | + $msg_activate_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'settings'), EE_MSG_ADMIN_URL); |
|
132 | + $error_msg = sprintf(__('There are no active messengers. So no notifications will go out for <strong>any</strong> events. You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="'.$msg_activate_url.'">', '</a>'); |
|
133 | + $error_content = '<div class="error"><p>'.$error_msg.'</p></div>'; |
|
134 | + $internal_content = '<div id="messages-error"><p>'.$error_msg.'</p></div>'; |
|
135 | 135 | |
136 | 136 | echo $error_content; |
137 | 137 | echo $internal_content; |
@@ -140,39 +140,39 @@ discard block |
||
140 | 140 | |
141 | 141 | $event_id = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL; |
142 | 142 | //get content for active messengers |
143 | - foreach ( $active_messengers as $name => $messenger ) { |
|
143 | + foreach ($active_messengers as $name => $messenger) { |
|
144 | 144 | //first check if there are any active message types for this messenger. |
145 | - $active_mts = $EEM_controller->get_active_message_types_per_messenger( $name ); |
|
146 | - if ( empty( $active_mts ) ) { |
|
145 | + $active_mts = $EEM_controller->get_active_message_types_per_messenger($name); |
|
146 | + if (empty($active_mts)) { |
|
147 | 147 | continue; |
148 | 148 | } |
149 | 149 | |
150 | - $tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id) ); |
|
150 | + $tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id)); |
|
151 | 151 | |
152 | - if ( ! empty( $tcont ) ) { |
|
152 | + if ( ! empty($tcont)) { |
|
153 | 153 | $tabs[$name] = $tcont; |
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
157 | 157 | |
158 | - EE_Registry::instance()->load_helper( 'Tabbed_Content' ); |
|
158 | + EE_Registry::instance()->load_helper('Tabbed_Content'); |
|
159 | 159 | //we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper. |
160 | 160 | $tabbed_content = EEH_Tabbed_Content::display($tabs); |
161 | - if ( is_wp_error($tabbed_content) ) { |
|
161 | + if (is_wp_error($tabbed_content)) { |
|
162 | 162 | $tabbed_content = $tabbed_content->get_error_message(); |
163 | 163 | } |
164 | 164 | |
165 | 165 | $notices = '<div id="espresso-ajax-loading" class="ajax-loader-grey"> |
166 | - <span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso') . '</span> |
|
166 | + <span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso').'</span> |
|
167 | 167 | </div><div class="ee-notices"></div>'; |
168 | 168 | |
169 | - if ( defined('DOING_AJAX' ) ) { |
|
169 | + if (defined('DOING_AJAX')) { |
|
170 | 170 | return $tabbed_content; |
171 | 171 | } |
172 | 172 | |
173 | - do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content' ); |
|
174 | - echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>'; |
|
175 | - do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content' ); |
|
173 | + do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content'); |
|
174 | + echo $notices.'<div class="messages-tabs-content">'.$tabbed_content.'</div>'; |
|
175 | + do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content'); |
|
176 | 176 | |
177 | 177 | } |
178 | 178 | |
@@ -186,22 +186,22 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function create_new_custom() { |
188 | 188 | |
189 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'create_new_custom_ajax' ) ) { |
|
190 | - wp_die( __('You don\'t have privileges to do this action', 'event_espresso' ) ); |
|
189 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) { |
|
190 | + wp_die(__('You don\'t have privileges to do this action', 'event_espresso')); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | //let's clean up the _POST global a bit for downstream usage of name and description. |
194 | - $_POST['templateName'] = !empty( $this->_req_data['custom_template_args']['MTP_name'] ) ? $this->_req_data['custom_template_args']['MTP_name'] : ''; |
|
195 | - $_POST['templateDescription'] = !empty( $this->_req_data['custom_template_args']['MTP_description'] ) ? $this->_req_data['custom_template_args']['MTP_description'] : ''; |
|
194 | + $_POST['templateName'] = ! empty($this->_req_data['custom_template_args']['MTP_name']) ? $this->_req_data['custom_template_args']['MTP_name'] : ''; |
|
195 | + $_POST['templateDescription'] = ! empty($this->_req_data['custom_template_args']['MTP_description']) ? $this->_req_data['custom_template_args']['MTP_description'] : ''; |
|
196 | 196 | |
197 | 197 | |
198 | 198 | //set EE_Admin_Page object (see method details in EE_Admin_Hooks parent |
199 | 199 | $this->_set_page_object(); |
200 | 200 | |
201 | 201 | //is this a template switch if so EE_Admin_Page child needs this object |
202 | - $this->_page_object->set_hook_object( $this ); |
|
202 | + $this->_page_object->set_hook_object($this); |
|
203 | 203 | |
204 | - $this->_page_object->add_message_template( $this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID'] ); |
|
204 | + $this->_page_object->add_message_template($this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID']); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @return string (admin_footer contents) |
217 | 217 | */ |
218 | 218 | public function edit_admin_footer() { |
219 | - $template_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php'; |
|
219 | + $template_path = EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/create_custom_template_form.template.php'; |
|
220 | 220 | EEH_Template::display_template($template_path, array()); |
221 | 221 | } |
222 | 222 |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | /** |
479 | 479 | * generates Business Report showing total registratiopns per day |
480 | 480 | * @access private |
481 | - * @return void |
|
481 | + * @return string |
|
482 | 482 | */ |
483 | 483 | private function _registrations_per_day_report( $period = '-1 month' ) { |
484 | 484 | |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | /** |
536 | 536 | * generates Business Report showing total registratiopns per event |
537 | 537 | * @access private |
538 | - * @return void |
|
538 | + * @return string |
|
539 | 539 | */ |
540 | 540 | private function _get_registrations_per_event_report( $period = '-1 month' ) { |
541 | 541 | |
@@ -650,8 +650,6 @@ discard block |
||
650 | 650 | /** |
651 | 651 | * handles toggleing the checkin status for the registration, |
652 | 652 | * @access protected |
653 | - * @param boolean $check_in |
|
654 | - * @return void |
|
655 | 653 | */ |
656 | 654 | protected function _toggle_checkin_status() { |
657 | 655 | //first let's get the query args out of the way for the redirect |
@@ -447,9 +447,9 @@ discard block |
||
447 | 447 | |
448 | 448 | /** |
449 | 449 | * generates Business Reports regarding Registrations |
450 | - * @access protected |
|
451 | - * @return void |
|
452 | - */ |
|
450 | + * @access protected |
|
451 | + * @return void |
|
452 | + */ |
|
453 | 453 | protected function _registration_reports() { |
454 | 454 | |
455 | 455 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -477,9 +477,9 @@ discard block |
||
477 | 477 | |
478 | 478 | /** |
479 | 479 | * generates Business Report showing total registratiopns per day |
480 | - * @access private |
|
481 | - * @return void |
|
482 | - */ |
|
480 | + * @access private |
|
481 | + * @return void |
|
482 | + */ |
|
483 | 483 | private function _registrations_per_day_report( $period = '-1 month' ) { |
484 | 484 | |
485 | 485 | $report_ID = 'reg-admin-registrations-per-day-report-dv'; |
@@ -534,9 +534,9 @@ discard block |
||
534 | 534 | |
535 | 535 | /** |
536 | 536 | * generates Business Report showing total registratiopns per event |
537 | - * @access private |
|
538 | - * @return void |
|
539 | - */ |
|
537 | + * @access private |
|
538 | + * @return void |
|
539 | + */ |
|
540 | 540 | private function _get_registrations_per_event_report( $period = '-1 month' ) { |
541 | 541 | |
542 | 542 | $report_ID = 'reg-admin-registrations-per-event-report-dv'; |
@@ -649,10 +649,10 @@ discard block |
||
649 | 649 | |
650 | 650 | /** |
651 | 651 | * handles toggleing the checkin status for the registration, |
652 | - * @access protected |
|
653 | - * @param boolean $check_in |
|
654 | - * @return void |
|
655 | - */ |
|
652 | + * @access protected |
|
653 | + * @param boolean $check_in |
|
654 | + * @return void |
|
655 | + */ |
|
656 | 656 | protected function _toggle_checkin_status() { |
657 | 657 | //first let's get the query args out of the way for the redirect |
658 | 658 | $query_args = array( |
@@ -773,9 +773,9 @@ discard block |
||
773 | 773 | |
774 | 774 | /** |
775 | 775 | * generates HTML for the Event Registrations List Table |
776 | - * @access protected |
|
777 | - * @return void |
|
778 | - */ |
|
776 | + * @access protected |
|
777 | + * @return void |
|
778 | + */ |
|
779 | 779 | protected function _event_registrations_list_table() { |
780 | 780 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
781 | 781 | $this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : ''; |
@@ -805,11 +805,11 @@ discard block |
||
805 | 805 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
806 | 806 | 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
807 | 807 | ), |
808 | - 'cancelled_status' => array( |
|
808 | + 'cancelled_status' => array( |
|
809 | 809 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
810 | 810 | 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
811 | 811 | ), |
812 | - 'declined_status' => array( |
|
812 | + 'declined_status' => array( |
|
813 | 813 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
814 | 814 | 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
815 | 815 | ), |
@@ -837,9 +837,9 @@ discard block |
||
837 | 837 | /** |
838 | 838 | * get_attendees |
839 | 839 | * @param bool $count whether to return count or data. |
840 | - * @access public |
|
841 | - * @return array |
|
842 | - */ |
|
840 | + * @access public |
|
841 | + * @return array |
|
842 | + */ |
|
843 | 843 | public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) { |
844 | 844 | |
845 | 845 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -679,8 +680,9 @@ discard block |
||
679 | 680 | EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
680 | 681 | } |
681 | 682 | |
682 | - if ( defined('DOING_AJAX' ) ) |
|
683 | - return $new_status; |
|
683 | + if ( defined('DOING_AJAX' ) ) { |
|
684 | + return $new_status; |
|
685 | + } |
|
684 | 686 | |
685 | 687 | $this->_redirect_after_action( FALSE,'', '', $query_args, TRUE ); |
686 | 688 | |
@@ -918,7 +920,7 @@ discard block |
||
918 | 920 | $query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
919 | 921 | if($count){ |
920 | 922 | $registrations = EEM_Registration::instance()->count(array($query_params[0])); |
921 | - }else{ |
|
923 | + } else{ |
|
922 | 924 | $registrations = EEM_Registration::instance()->get_all($query_params); |
923 | 925 | |
924 | 926 |
@@ -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 | /** |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | */ |
30 | 30 | class Extend_Registrations_Admin_Page extends Registrations_Admin_Page { |
31 | 31 | |
32 | - public function __construct( $routing = TRUE ) { |
|
33 | - parent::__construct( $routing ); |
|
34 | - define( 'REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/'); |
|
35 | - define( 'REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/'); |
|
36 | - define( 'REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/'); |
|
32 | + public function __construct($routing = TRUE) { |
|
33 | + parent::__construct($routing); |
|
34 | + define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/'); |
|
35 | + define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/'); |
|
36 | + define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | |
43 | 43 | |
44 | 44 | protected function _extend_page_config() { |
45 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations'; |
|
45 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations'; |
|
46 | 46 | |
47 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
48 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0; |
|
49 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
47 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
48 | + $att_id = ! empty($this->_req_data['ATT_ID']) ? ! is_array($this->_req_data['ATT_ID']) : 0; |
|
49 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
50 | 50 | |
51 | 51 | $new_page_routes = array( |
52 | 52 | 'reports' => array( |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ) |
86 | 86 | ); |
87 | 87 | |
88 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
88 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
89 | 89 | |
90 | 90 | $new_page_config = array( |
91 | 91 | 'reports' => array( |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | 'filename' => 'registrations_reports' |
100 | 100 | ) |
101 | 101 | ), |
102 | - 'help_tour' => array( 'Registration_Reports_Help_Tour' ), |
|
102 | + 'help_tour' => array('Registration_Reports_Help_Tour'), |
|
103 | 103 | 'require_nonce' => FALSE |
104 | 104 | ), |
105 | 105 | 'event_registrations' => array( |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | 'filename' => 'registrations_event_checkin_other' |
131 | 131 | ) |
132 | 132 | ), |
133 | - 'help_tour' => array( 'Event_Checkin_Help_Tour' ), |
|
134 | - 'qtips' => array('Registration_List_Table_Tips' ), |
|
133 | + 'help_tour' => array('Event_Checkin_Help_Tour'), |
|
134 | + 'qtips' => array('Registration_List_Table_Tips'), |
|
135 | 135 | 'list_table' => 'EE_Event_Registrations_List_Table', |
136 | 136 | 'metaboxes' => array(), |
137 | 137 | 'require_nonce' => FALSE |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // var_dump($this->_req_data); |
153 | 153 | // exit(); |
154 | 154 | |
155 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
155 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
156 | 156 | $this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table'; |
157 | 157 | $this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table'; |
158 | 158 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | protected function _ajax_hooks() { |
163 | 163 | parent::_ajax_hooks(); |
164 | - add_action('wp_ajax_get_newsletter_form_content', array( $this, 'get_newsletter_form_content') ); |
|
164 | + add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content')); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -171,12 +171,12 @@ discard block |
||
171 | 171 | |
172 | 172 | //if newsletter message type is active then let's add filter and load js for it. |
173 | 173 | EE_Registry::instance()->load_helper('MSG_Template'); |
174 | - if ( EEH_MSG_Template::is_mt_active('newsletter') ) { |
|
174 | + if (EEH_MSG_Template::is_mt_active('newsletter')) { |
|
175 | 175 | //enqueue newsletter js |
176 | - wp_enqueue_script( 'ee-newsletter-trigger', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', array( 'ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
177 | - wp_enqueue_style( 'ee-newsletter-trigger-css', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION ); |
|
176 | + wp_enqueue_script('ee-newsletter-trigger', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE); |
|
177 | + wp_enqueue_style('ee-newsletter-trigger-css', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION); |
|
178 | 178 | //hook in buttons for newsletter message type trigger. |
179 | - add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array( $this, 'add_newsletter_action_buttons'), 10 ); |
|
179 | + add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_newsletter_action_buttons'), 10); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | |
189 | 189 | //scripts |
190 | 190 | global $is_IE; |
191 | - if ( $is_IE ) { |
|
192 | - wp_enqueue_script( 'excanvas' ); |
|
191 | + if ($is_IE) { |
|
192 | + wp_enqueue_script('excanvas'); |
|
193 | 193 | } |
194 | 194 | |
195 | - wp_register_script('espresso_reg_admin_regs_per_day', REG_CAF_ASSETS_URL . 'espresso_reg_admin_regs_per_day_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
196 | - wp_register_script('espresso_reg_admin_regs_per_event', REG_CAF_ASSETS_URL . 'espresso_reg_admin_regs_per_event_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
195 | + wp_register_script('espresso_reg_admin_regs_per_day', REG_CAF_ASSETS_URL.'espresso_reg_admin_regs_per_day_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE); |
|
196 | + wp_register_script('espresso_reg_admin_regs_per_event', REG_CAF_ASSETS_URL.'espresso_reg_admin_regs_per_event_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | 'slug' => 'all', |
225 | 225 | 'label' => __('All', 'event_espresso'), |
226 | 226 | 'count' => 0, |
227 | - 'bulk_action' => !isset( $this->_req_data['event_id'] ) ? array() : array( |
|
227 | + 'bulk_action' => ! isset($this->_req_data['event_id']) ? array() : array( |
|
228 | 228 | 'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'), |
229 | 229 | //'trash_registrations' => __('Trash Registrations', 'event_espresso') |
230 | 230 | ) |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | 'slug' => 'all', |
243 | 243 | 'label' => __('All', 'event_espresso'), |
244 | 244 | 'count' => 0, |
245 | - 'bulk_action' => array( 'delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso') ) |
|
245 | + 'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso')) |
|
246 | 246 | ), |
247 | 247 | ); |
248 | 248 | } |
@@ -258,20 +258,20 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function get_newsletter_form_content() { |
260 | 260 | //do a nonce check cause we're not coming in from an normal route here. |
261 | - $nonce = isset( $this->_req_data['get_newsletter_form_content_nonce'] ) ? sanitize_text_field( $this->_req_data['get_newsletter_form_content_nonce'] ) : ''; |
|
261 | + $nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field($this->_req_data['get_newsletter_form_content_nonce']) : ''; |
|
262 | 262 | $nonce_ref = 'get_newsletter_form_content_nonce'; |
263 | 263 | |
264 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
264 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
265 | 265 | //let's get the mtp for the incoming MTP_ ID |
266 | - if ( !isset( $this->_req_data['GRP_ID'] ) ) { |
|
267 | - EE_Error::add_error( __('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
266 | + if ( ! isset($this->_req_data['GRP_ID'])) { |
|
267 | + EE_Error::add_error(__('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
268 | 268 | $this->_template_args['success'] = FALSE; |
269 | 269 | $this->_template_args['error'] = TRUE; |
270 | 270 | $this->_return_json(); |
271 | 271 | } |
272 | - $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['GRP_ID'] ); |
|
273 | - if ( ! $MTPG instanceof EE_Message_Template_Group ) { |
|
274 | - EE_Error::add_error( sprintf( __('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID'] ), __FILE__, __FUNCTION__, __LINE__ ); |
|
272 | + $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']); |
|
273 | + if ( ! $MTPG instanceof EE_Message_Template_Group) { |
|
274 | + EE_Error::add_error(sprintf(__('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID']), __FILE__, __FUNCTION__, __LINE__); |
|
275 | 275 | $this->_template_args['success'] = FALSE; |
276 | 276 | $this->_template_args['error'] = TRUE; |
277 | 277 | $this->_return_json(); |
@@ -280,11 +280,11 @@ discard block |
||
280 | 280 | $MTPs = $MTPG->context_templates(); |
281 | 281 | $MTPs = $MTPs['attendee']; |
282 | 282 | $template_fields = array(); |
283 | - foreach ( $MTPs as $MTP ) { |
|
283 | + foreach ($MTPs as $MTP) { |
|
284 | 284 | $field = $MTP->get('MTP_template_field'); |
285 | - if ( $field == 'content' ) { |
|
285 | + if ($field == 'content') { |
|
286 | 286 | $content = $MTP->get('MTP_content'); |
287 | - if ( !empty( $content['newsletter_content'] ) ) { |
|
287 | + if ( ! empty($content['newsletter_content'])) { |
|
288 | 288 | $template_fields['newsletter_content'] = $content['newsletter_content']; |
289 | 289 | } |
290 | 290 | continue; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $this->_template_args['data'] = array( |
298 | 298 | 'batch_message_from' => isset($template_fields['from']) ? $template_fields['from'] : '', |
299 | 299 | 'batch_message_subject' => isset($template_fields['subject']) ? $template_fields['subject'] : '', |
300 | - 'batch_message_content' => isset( $template_fields['newsletter_content'] ) ? $template_fields['newsletter_content'] : '' |
|
300 | + 'batch_message_content' => isset($template_fields['newsletter_content']) ? $template_fields['newsletter_content'] : '' |
|
301 | 301 | ); |
302 | 302 | $this->_return_json(); |
303 | 303 | } |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | * @param EE_Admin_List_Table $list_table |
314 | 314 | * @return string html string for extra buttons |
315 | 315 | */ |
316 | - public function add_newsletter_action_buttons( EE_Admin_List_Table $list_table ) { |
|
317 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_newsletter_selected_send' ) ) { |
|
316 | + public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) { |
|
317 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_newsletter_selected_send')) { |
|
318 | 318 | return ''; |
319 | 319 | } |
320 | 320 | |
@@ -323,13 +323,13 @@ discard block |
||
323 | 323 | 'event_registrations', |
324 | 324 | 'default' |
325 | 325 | ); |
326 | - if ( $this->_current_page == 'espresso_registrations' && in_array( $this->_req_action, $routes_to_add_to ) ) { |
|
327 | - if ( ( $this->_req_action == 'event_registrations' && empty( $this->_req_data['event_id'] ) ) || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ) ) { |
|
326 | + if ($this->_current_page == 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) { |
|
327 | + if (($this->_req_action == 'event_registrations' && empty($this->_req_data['event_id'])) || (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash')) { |
|
328 | 328 | echo ''; |
329 | 329 | } else { |
330 | - $button_text = sprintf( __('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>' ); |
|
331 | - echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>' . $button_text . '</button>'; |
|
332 | - add_action('admin_footer', array( $this, 'newsletter_send_form_skeleton') ); |
|
330 | + $button_text = sprintf(__('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>'); |
|
331 | + echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>'.$button_text.'</button>'; |
|
332 | + add_action('admin_footer', array($this, 'newsletter_send_form_skeleton')); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | } |
@@ -341,38 +341,38 @@ discard block |
||
341 | 341 | $list_table = $this->_list_table_object; |
342 | 342 | $codes = array(); |
343 | 343 | //need to templates for the newsletter message type for the template selector. |
344 | - $values[] = array( 'text' => __('Select Template to Use', 'event_espresso'), 'id' => 0 ); |
|
345 | - $mtps = EEM_Message_Template_Group::instance()->get_all( array( array( 'MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email' ) ) ); |
|
346 | - foreach ( $mtps as $mtp ) { |
|
344 | + $values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0); |
|
345 | + $mtps = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email'))); |
|
346 | + foreach ($mtps as $mtp) { |
|
347 | 347 | $name = $mtp->name(); |
348 | 348 | $values[] = array( |
349 | - 'text' => empty( $name ) ? __('Global', 'event_espresso') : $name, |
|
349 | + 'text' => empty($name) ? __('Global', 'event_espresso') : $name, |
|
350 | 350 | 'id' => $mtp->ID() |
351 | 351 | ); |
352 | 352 | } |
353 | 353 | |
354 | 354 | //need to get a list of shortcodes that are available for the newsletter message type. |
355 | 355 | EE_Registry::instance()->load_helper('MSG_Template'); |
356 | - $shortcodes = EEH_MSG_Template::get_shortcodes( 'newsletter', 'email', array(), 'attendee', FALSE ); |
|
357 | - foreach ( $shortcodes as $field => $shortcode_array ) { |
|
358 | - $codes[$field] = implode(', ', array_keys($shortcode_array ) ); |
|
356 | + $shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', FALSE); |
|
357 | + foreach ($shortcodes as $field => $shortcode_array) { |
|
358 | + $codes[$field] = implode(', ', array_keys($shortcode_array)); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | $shortcodes = $codes; |
362 | 362 | |
363 | - $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php'; |
|
363 | + $form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php'; |
|
364 | 364 | $form_template_args = array( |
365 | 365 | 'form_action' => admin_url('admin.php?page=espresso_registrations'), |
366 | 366 | 'form_route' => 'newsletter_selected_send', |
367 | 367 | 'form_nonce_name' => 'newsletter_selected_send_nonce', |
368 | - 'form_nonce' => wp_create_nonce( 'newsletter_selected_send_nonce' ), |
|
368 | + 'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'), |
|
369 | 369 | 'redirect_back_to' => $this->_req_action, |
370 | - 'ajax_nonce' => wp_create_nonce( 'get_newsletter_form_content_nonce'), |
|
371 | - 'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values ), |
|
370 | + 'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'), |
|
371 | + 'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values), |
|
372 | 372 | 'shortcodes' => $shortcodes, |
373 | 373 | 'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration' |
374 | 374 | ); |
375 | - EEH_Template::display_template( $form_template, $form_template_args ); |
|
375 | + EEH_Template::display_template($form_template, $form_template_args); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -387,35 +387,35 @@ discard block |
||
387 | 387 | protected function _newsletter_selected_send() { |
388 | 388 | $success = TRUE; |
389 | 389 | //first we need to make sure we have a GRP_ID so we know what template we're sending and updating! |
390 | - if ( empty( $this->_req_data['newsletter_mtp_selected'] ) ) { |
|
391 | - EE_Error::add_error( __('In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
390 | + if (empty($this->_req_data['newsletter_mtp_selected'])) { |
|
391 | + EE_Error::add_error(__('In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
392 | 392 | $success = FALSE; |
393 | 393 | } |
394 | 394 | |
395 | - if ( $success ) { |
|
395 | + if ($success) { |
|
396 | 396 | //update Message template in case there are any changes |
397 | - $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['newsletter_mtp_selected'] ); |
|
397 | + $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['newsletter_mtp_selected']); |
|
398 | 398 | $MTPs = $MTPG instanceof EE_Message_Template_Group ? $MTPG->context_templates() : array(); |
399 | - if ( empty( $MTPs ) ) { |
|
400 | - EE_Error::add_error( __('Unable to retrieve message template fields from the db. Messages not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
399 | + if (empty($MTPs)) { |
|
400 | + EE_Error::add_error(__('Unable to retrieve message template fields from the db. Messages not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
401 | 401 | $success = FALSE; |
402 | 402 | } |
403 | 403 | |
404 | 404 | //let's just update the specific fields |
405 | - foreach ( $MTPs['attendee'] as $MTP ) { |
|
405 | + foreach ($MTPs['attendee'] as $MTP) { |
|
406 | 406 | $field = $MTP->get('MTP_template_field'); |
407 | 407 | $content = $MTP->get('MTP_content'); |
408 | 408 | $new_content = $content; |
409 | - switch( $field ) { |
|
409 | + switch ($field) { |
|
410 | 410 | case 'from' : |
411 | - $new_content = !empty( $this->_req_data['batch_message']['from'] ) ? $this->_req_data['batch_message']['from'] : $content; |
|
411 | + $new_content = ! empty($this->_req_data['batch_message']['from']) ? $this->_req_data['batch_message']['from'] : $content; |
|
412 | 412 | break; |
413 | 413 | case 'subject' : |
414 | - $new_content = !empty( $this->_req_data['batch_message']['subject'] ) ? $this->_req_data['batch_message']['subject'] : $content; |
|
414 | + $new_content = ! empty($this->_req_data['batch_message']['subject']) ? $this->_req_data['batch_message']['subject'] : $content; |
|
415 | 415 | break; |
416 | 416 | case 'content' : |
417 | 417 | $new_content = $content; |
418 | - $new_content['newsletter_content'] = !empty( $this->_req_data['batch_message']['content'] ) ? $this->_req_data['batch_message']['content'] : $content['newsletter_content']; |
|
418 | + $new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content']) ? $this->_req_data['batch_message']['content'] : $content['newsletter_content']; |
|
419 | 419 | break; |
420 | 420 | default : |
421 | 421 | continue; |
@@ -426,20 +426,20 @@ discard block |
||
426 | 426 | } |
427 | 427 | |
428 | 428 | //great fields are updated! now let's make sure we just have contact objects (EE_Attendee). |
429 | - $id_type = !empty( $this->_req_data['batch_message']['id_type'] ) ? $this->_req_data['batch_message']['id_type'] : 'registration'; |
|
429 | + $id_type = ! empty($this->_req_data['batch_message']['id_type']) ? $this->_req_data['batch_message']['id_type'] : 'registration'; |
|
430 | 430 | |
431 | 431 | //id_type will affect how we assemble the ids. |
432 | - $ids = !empty( $this->_req_data['batch_message']['ids'] ) ? json_decode( stripslashes($this->_req_data['batch_message']['ids']) ) : array(); |
|
432 | + $ids = ! empty($this->_req_data['batch_message']['ids']) ? json_decode(stripslashes($this->_req_data['batch_message']['ids'])) : array(); |
|
433 | 433 | |
434 | - $contacts = $id_type == 'registration' ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids( $ids ) : EEM_Attendee::instance()->get_all( array( array( 'ATT_ID' => array('in', $ids ) ) ) ); |
|
434 | + $contacts = $id_type == 'registration' ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids) : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids)))); |
|
435 | 435 | |
436 | 436 | //we do _action because ALL triggers are handled in EED_Messages. |
437 | - do_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', $contacts, $MTPG->ID() ); |
|
437 | + do_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', $contacts, $MTPG->ID()); |
|
438 | 438 | } |
439 | 439 | $query_args = array( |
440 | - 'action' => !empty( $this->_req_data['redirect_back_to'] ) ? $this->_req_data['redirect_back_to'] : 'default' |
|
440 | + 'action' => ! empty($this->_req_data['redirect_back_to']) ? $this->_req_data['redirect_back_to'] : 'default' |
|
441 | 441 | ); |
442 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
442 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | |
@@ -452,16 +452,16 @@ discard block |
||
452 | 452 | */ |
453 | 453 | protected function _registration_reports() { |
454 | 454 | |
455 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
455 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
456 | 456 | |
457 | 457 | $page_args = array(); |
458 | 458 | |
459 | - $page_args['admin_reports'][] = $this->_registrations_per_day_report( '-1 month' ); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
460 | - $page_args['admin_reports'][] = $this->_get_registrations_per_event_report( '-1 month' ); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
459 | + $page_args['admin_reports'][] = $this->_registrations_per_day_report('-1 month'); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
460 | + $page_args['admin_reports'][] = $this->_get_registrations_per_event_report('-1 month'); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
461 | 461 | // $page_args['admin_reports'][] = 'chart1'; |
462 | 462 | |
463 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
464 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $page_args, TRUE ); |
|
463 | + $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php'; |
|
464 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $page_args, TRUE); |
|
465 | 465 | |
466 | 466 | // EEH_Debug_Tools::printr( $page_args, '$page_args' ); |
467 | 467 | |
@@ -480,36 +480,36 @@ discard block |
||
480 | 480 | * @access private |
481 | 481 | * @return void |
482 | 482 | */ |
483 | - private function _registrations_per_day_report( $period = '-1 month' ) { |
|
483 | + private function _registrations_per_day_report($period = '-1 month') { |
|
484 | 484 | |
485 | 485 | $report_ID = 'reg-admin-registrations-per-day-report-dv'; |
486 | 486 | $report_JS = 'espresso_reg_admin_regs_per_day'; |
487 | 487 | |
488 | - wp_enqueue_script( $report_JS ); |
|
488 | + wp_enqueue_script($report_JS); |
|
489 | 489 | |
490 | 490 | $REG = EEM_Registration::instance(); |
491 | 491 | |
492 | - $results = $REG->get_registrations_per_day_report( $period ); |
|
492 | + $results = $REG->get_registrations_per_day_report($period); |
|
493 | 493 | |
494 | 494 | //EEH_Debug_Tools::printr( $results, '$registrations_per_day' ); |
495 | 495 | $regs = array(); |
496 | - $xmin = date( 'Y-m-d', strtotime( '+1 year' )); |
|
496 | + $xmin = date('Y-m-d', strtotime('+1 year')); |
|
497 | 497 | $xmax = 0; |
498 | 498 | $ymax = 0; |
499 | 499 | $results = (array) $results; |
500 | - foreach ( $results as $result ) { |
|
501 | - $regs[] = array( $result->regDate, (int)$result->total ); |
|
502 | - $xmin = strtotime( $result->regDate ) < strtotime( $xmin ) ? $result->regDate : $xmin; |
|
503 | - $xmax = strtotime( $result->regDate ) > strtotime( $xmax ) ? $result->regDate : $xmax; |
|
500 | + foreach ($results as $result) { |
|
501 | + $regs[] = array($result->regDate, (int) $result->total); |
|
502 | + $xmin = strtotime($result->regDate) < strtotime($xmin) ? $result->regDate : $xmin; |
|
503 | + $xmax = strtotime($result->regDate) > strtotime($xmax) ? $result->regDate : $xmax; |
|
504 | 504 | $ymax = $result->total > $ymax ? $result->total : $ymax; |
505 | 505 | } |
506 | 506 | |
507 | - $xmin = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmin)) . ' -1 day' )); |
|
508 | - $xmax = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmax)) . ' +1 day' )); |
|
507 | + $xmin = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmin)).' -1 day')); |
|
508 | + $xmax = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmax)).' +1 day')); |
|
509 | 509 | // calculate # days between our min and max dates |
510 | - $span = floor( (strtotime($xmax) - strtotime($xmin)) / (60*60*24)) + 1; |
|
510 | + $span = floor((strtotime($xmax) - strtotime($xmin)) / (60 * 60 * 24)) + 1; |
|
511 | 511 | |
512 | - $report_title = __( 'Total Registrations per Day', 'event_espresso' ); |
|
512 | + $report_title = __('Total Registrations per Day', 'event_espresso'); |
|
513 | 513 | |
514 | 514 | $report_params = array( |
515 | 515 | 'title' => $report_title, |
@@ -520,9 +520,9 @@ discard block |
||
520 | 520 | 'ymax' => ceil($ymax * 1.25), |
521 | 521 | 'span' => $span, |
522 | 522 | 'width' => ceil(900 / $span), |
523 | - 'noRegsMsg' => sprintf( __('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title ) |
|
523 | + 'noRegsMsg' => sprintf(__('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title) |
|
524 | 524 | ); |
525 | - wp_localize_script( $report_JS, 'regPerDay', $report_params ); |
|
525 | + wp_localize_script($report_JS, 'regPerDay', $report_params); |
|
526 | 526 | |
527 | 527 | return $report_ID; |
528 | 528 | } |
@@ -537,29 +537,29 @@ discard block |
||
537 | 537 | * @access private |
538 | 538 | * @return void |
539 | 539 | */ |
540 | - private function _get_registrations_per_event_report( $period = '-1 month' ) { |
|
540 | + private function _get_registrations_per_event_report($period = '-1 month') { |
|
541 | 541 | |
542 | 542 | $report_ID = 'reg-admin-registrations-per-event-report-dv'; |
543 | 543 | $report_JS = 'espresso_reg_admin_regs_per_event'; |
544 | 544 | |
545 | - wp_enqueue_script( $report_JS ); |
|
545 | + wp_enqueue_script($report_JS); |
|
546 | 546 | |
547 | - require_once ( EE_MODELS . 'EEM_Registration.model.php' ); |
|
547 | + require_once (EE_MODELS.'EEM_Registration.model.php'); |
|
548 | 548 | $REG = EEM_Registration::instance(); |
549 | 549 | |
550 | - $results = $REG->get_registrations_per_event_report( $period ); |
|
550 | + $results = $REG->get_registrations_per_event_report($period); |
|
551 | 551 | //EEH_Debug_Tools::printr( $results, '$registrations_per_event' ); |
552 | 552 | $regs = array(); |
553 | 553 | $ymax = 0; |
554 | 554 | $results = (array) $results; |
555 | - foreach ( $results as $result ) { |
|
556 | - $regs[] = array( wp_trim_words( $result->event_name, 4, '...' ), (int)$result->total ); |
|
555 | + foreach ($results as $result) { |
|
556 | + $regs[] = array(wp_trim_words($result->event_name, 4, '...'), (int) $result->total); |
|
557 | 557 | $ymax = $result->total > $ymax ? $result->total : $ymax; |
558 | 558 | } |
559 | 559 | |
560 | 560 | $span = $period == 'week' ? 9 : 33; |
561 | 561 | |
562 | - $report_title = __( 'Total Registrations per Event', 'event_espresso' ); |
|
562 | + $report_title = __('Total Registrations per Event', 'event_espresso'); |
|
563 | 563 | |
564 | 564 | $report_params = array( |
565 | 565 | 'title' => $report_title, |
@@ -568,9 +568,9 @@ discard block |
||
568 | 568 | 'ymax' => ceil($ymax * 1.25), |
569 | 569 | 'span' => $span, |
570 | 570 | 'width' => ceil(900 / $span), |
571 | - 'noRegsMsg' => sprintf( __('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title ) |
|
571 | + 'noRegsMsg' => sprintf(__('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title) |
|
572 | 572 | ); |
573 | - wp_localize_script( $report_JS, 'regPerEvent', $report_params ); |
|
573 | + wp_localize_script($report_JS, 'regPerEvent', $report_params); |
|
574 | 574 | |
575 | 575 | return $report_ID; |
576 | 576 | } |
@@ -584,8 +584,8 @@ discard block |
||
584 | 584 | * @return void |
585 | 585 | */ |
586 | 586 | protected function _registration_checkin_list_table() { |
587 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
588 | - $reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null; |
|
587 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
588 | + $reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null; |
|
589 | 589 | $reg = EEM_Registration::instance()->get_one_by_ID($reg_id); |
590 | 590 | $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $reg->event_ID()), 'add-new-h2'); |
591 | 591 | |
@@ -599,15 +599,15 @@ discard block |
||
599 | 599 | 'desc' => __('This indicates the attendee has been checked out', 'event_espresso') |
600 | 600 | ) |
601 | 601 | ); |
602 | - $this->_template_args['after_list_table'] = $this->_display_legend( $legend_items ); |
|
602 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
603 | 603 | |
604 | 604 | |
605 | - $dtt_id = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
606 | - $go_back_url = !empty( $reg_id ) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id ), $this->_admin_base_url ) : ''; |
|
605 | + $dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
606 | + $go_back_url = ! empty($reg_id) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id), $this->_admin_base_url) : ''; |
|
607 | 607 | |
608 | - $this->_template_args['before_list_table'] = !empty( $reg_id ) && !empty( $dtt_id ) ? '<h2>' . sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">' . EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name() . '</span>', '<span id="checkin-dtt"><a href="' . $go_back_url . '">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time() . ' - ' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time() . '</a></span>', '<span id="checkin-event-name">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name') . '</span>' ) . '</h2>' : ''; |
|
609 | - $this->_template_args['list_table_hidden_fields'] = !empty( $reg_id ) ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : ''; |
|
610 | - $this->_template_args['list_table_hidden_fields'] .= !empty( $dtt_id ) ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : ''; |
|
608 | + $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) ? '<h2>'.sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">'.EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name().'</span>', '<span id="checkin-dtt"><a href="'.$go_back_url.'">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time().' - '.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time().'</a></span>', '<span id="checkin-event-name">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name').'</span>').'</h2>' : ''; |
|
609 | + $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) ? '<input type="hidden" name="_REGID" value="'.$reg_id.'">' : ''; |
|
610 | + $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : ''; |
|
611 | 611 | |
612 | 612 | $this->display_admin_list_table_page_with_no_sidebar(); |
613 | 613 | } |
@@ -620,24 +620,24 @@ discard block |
||
620 | 620 | */ |
621 | 621 | public function toggle_checkin_status() { |
622 | 622 | //first make sure we have the necessary data |
623 | - if ( !isset( $this->_req_data['_regid'] ) ) { |
|
624 | - EE_Error::add_error( __('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
623 | + if ( ! isset($this->_req_data['_regid'])) { |
|
624 | + EE_Error::add_error(__('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
625 | 625 | $this->_template_args['success'] = FALSE; |
626 | 626 | $this->_template_args['error'] = TRUE; |
627 | 627 | $this->_return_json(); |
628 | 628 | }; |
629 | 629 | |
630 | 630 | //do a nonce check cause we're not coming in from an normal route here. |
631 | - $nonce = isset( $this->_req_data['checkinnonce'] ) ? sanitize_text_field( $this->_req_data['checkinnonce'] ) : ''; |
|
631 | + $nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) : ''; |
|
632 | 632 | $nonce_ref = 'checkin_nonce'; |
633 | 633 | |
634 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
634 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
635 | 635 | |
636 | 636 | //beautiful! Made it this far so let's get the status. |
637 | 637 | $new_status = $this->_toggle_checkin_status(); |
638 | 638 | |
639 | 639 | //setup new class to return via ajax |
640 | - $this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-' . $new_status; |
|
640 | + $this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-'.$new_status; |
|
641 | 641 | $this->_template_args['success'] = TRUE; |
642 | 642 | $this->_return_json(); |
643 | 643 | } |
@@ -657,32 +657,32 @@ discard block |
||
657 | 657 | //first let's get the query args out of the way for the redirect |
658 | 658 | $query_args = array( |
659 | 659 | 'action' => 'event_registrations', |
660 | - 'event_id' => isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL, |
|
661 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL |
|
660 | + 'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL, |
|
661 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL |
|
662 | 662 | ); |
663 | 663 | $new_status = FALSE; |
664 | 664 | |
665 | 665 | // bulk action check in toggle |
666 | - if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) { |
|
666 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
667 | 667 | // cycle thru checkboxes |
668 | - while ( list( $REG_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
669 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
668 | + while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) { |
|
669 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
670 | 670 | $new_status = $this->_toggle_checkin($REG_ID, $DTT_ID); |
671 | 671 | } |
672 | 672 | |
673 | - } elseif ( isset( $this->_req_data['_regid'] ) ) { |
|
673 | + } elseif (isset($this->_req_data['_regid'])) { |
|
674 | 674 | //coming from ajax request |
675 | - $DTT_ID = isset( $this->_req_data['dttid'] ) ? $this->_req_data['dttid'] : NULL; |
|
675 | + $DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : NULL; |
|
676 | 676 | $query_args['DTT_ID'] = $DTT_ID; |
677 | 677 | $new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID); |
678 | 678 | } else { |
679 | - EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
679 | + EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
680 | 680 | } |
681 | 681 | |
682 | - if ( defined('DOING_AJAX' ) ) |
|
682 | + if (defined('DOING_AJAX')) |
|
683 | 683 | return $new_status; |
684 | 684 | |
685 | - $this->_redirect_after_action( FALSE,'', '', $query_args, TRUE ); |
|
685 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
686 | 686 | |
687 | 687 | } |
688 | 688 | |
@@ -698,11 +698,11 @@ discard block |
||
698 | 698 | */ |
699 | 699 | private function _toggle_checkin($REG_ID, $DTT_ID) { |
700 | 700 | $REG = EEM_Registration::instance()->get_one_by_ID($REG_ID); |
701 | - $new_status = $REG->toggle_checkin_status( $DTT_ID ); |
|
702 | - if ( $new_status !== FALSE ) { |
|
703 | - EE_Error::add_success($REG->get_checkin_msg($DTT_ID) ); |
|
701 | + $new_status = $REG->toggle_checkin_status($DTT_ID); |
|
702 | + if ($new_status !== FALSE) { |
|
703 | + EE_Error::add_success($REG->get_checkin_msg($DTT_ID)); |
|
704 | 704 | } else { |
705 | - EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__ ); |
|
705 | + EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__); |
|
706 | 706 | $new_status = FALSE; |
707 | 707 | } |
708 | 708 | return $new_status; |
@@ -718,28 +718,28 @@ discard block |
||
718 | 718 | protected function _delete_checkin_rows() { |
719 | 719 | $query_args = array( |
720 | 720 | 'action' => 'registration_checkins', |
721 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0, |
|
722 | - '_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0 |
|
721 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
722 | + '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0 |
|
723 | 723 | ); |
724 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
725 | - while ( list( $CHK_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
724 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
725 | + while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) { |
|
726 | 726 | $errors = 0; |
727 | - if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID ) ) { |
|
727 | + if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) { |
|
728 | 728 | $errors++; |
729 | 729 | } |
730 | 730 | } |
731 | 731 | } else { |
732 | - EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
733 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
732 | + EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
733 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
734 | 734 | } |
735 | 735 | |
736 | - if ( $errors > 0 ) { |
|
737 | - EE_Error::add_error( sprintf( __('There were %d records that did not delete successfully', 'event_espresso'), $errors ), __FILE__, __FUNCTION__, __LINE__ ); |
|
736 | + if ($errors > 0) { |
|
737 | + EE_Error::add_error(sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors), __FILE__, __FUNCTION__, __LINE__); |
|
738 | 738 | } else { |
739 | - EE_Error::add_success( __('Records were successfully deleted', 'event_espresso') ); |
|
739 | + EE_Error::add_success(__('Records were successfully deleted', 'event_espresso')); |
|
740 | 740 | } |
741 | 741 | |
742 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
742 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
743 | 743 | } |
744 | 744 | |
745 | 745 | |
@@ -751,20 +751,20 @@ discard block |
||
751 | 751 | protected function _delete_checkin_row() { |
752 | 752 | $query_args = array( |
753 | 753 | 'action' => 'registration_checkins', |
754 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0, |
|
755 | - '_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0 |
|
754 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
755 | + '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0 |
|
756 | 756 | ); |
757 | 757 | |
758 | - if ( !empty( $this->_req_data['CHK_ID'] ) ) { |
|
759 | - if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'] ) ) { |
|
760 | - EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
758 | + if ( ! empty($this->_req_data['CHK_ID'])) { |
|
759 | + if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) { |
|
760 | + EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
761 | 761 | } else { |
762 | - EE_Error::add_success( __('Check-In record successfully deleted', 'event_espresso') ); |
|
762 | + EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso')); |
|
763 | 763 | } |
764 | 764 | } else { |
765 | - EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
765 | + EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
766 | 766 | } |
767 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
767 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
768 | 768 | } |
769 | 769 | |
770 | 770 | |
@@ -777,8 +777,8 @@ discard block |
||
777 | 777 | * @return void |
778 | 778 | */ |
779 | 779 | protected function _event_registrations_list_table() { |
780 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
781 | - $this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : ''; |
|
780 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
781 | + $this->_admin_page_title .= isset($this->_req_data['event_id']) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : ''; |
|
782 | 782 | |
783 | 783 | $legend_items = array( |
784 | 784 | 'star-icon' => array( |
@@ -802,31 +802,31 @@ discard block |
||
802 | 802 | 'desc' => __('View All Check-in Records for this Registrant', 'event_espresso') |
803 | 803 | ), |
804 | 804 | 'approved_status' => array( |
805 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
806 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
805 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
806 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
807 | 807 | ), |
808 | 808 | 'cancelled_status' => array( |
809 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
810 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
809 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
810 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
811 | 811 | ), |
812 | 812 | 'declined_status' => array( |
813 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
814 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
813 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
814 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
815 | 815 | ), |
816 | 816 | 'not_approved' => array( |
817 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
818 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
817 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
818 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
819 | 819 | ), |
820 | 820 | 'pending_status' => array( |
821 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
822 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
821 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
822 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
823 | 823 | )/**/ |
824 | 824 | ); |
825 | - $this->_template_args['after_list_table'] = $this->_display_legend( $legend_items ); |
|
825 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
826 | 826 | |
827 | - $event_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null; |
|
828 | - $this->_template_args['before_list_table'] = !empty( $event_id ) ? '<h2>' . sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') ) . '</h2>' : ''; |
|
829 | - $this->_template_args['list_table_hidden_fields'] = !empty( $event_id ) ? '<input type="hidden" name="event_id" value="' . $event_id . '">' : ''; |
|
827 | + $event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null; |
|
828 | + $this->_template_args['before_list_table'] = ! empty($event_id) ? '<h2>'.sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')).'</h2>' : ''; |
|
829 | + $this->_template_args['list_table_hidden_fields'] = ! empty($event_id) ? '<input type="hidden" name="event_id" value="'.$event_id.'">' : ''; |
|
830 | 830 | |
831 | 831 | $this->display_admin_list_table_page_with_no_sidebar(); |
832 | 832 | } |
@@ -840,15 +840,15 @@ discard block |
||
840 | 840 | * @access public |
841 | 841 | * @return array |
842 | 842 | */ |
843 | - public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) { |
|
843 | + public function get_event_attendees($per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '') { |
|
844 | 844 | |
845 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
846 | - require_once(EE_MODELS . 'EEM_Attendee.model.php'); |
|
845 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
846 | + require_once(EE_MODELS.'EEM_Attendee.model.php'); |
|
847 | 847 | //$ATT_MDL = EEM_Attendee::instance(); |
848 | 848 | |
849 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
850 | - $CAT_ID = isset($this->_req_data['category_id']) ? absint( $this->_req_data['category_id'] ) : FALSE; |
|
851 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
849 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
850 | + $CAT_ID = isset($this->_req_data['category_id']) ? absint($this->_req_data['category_id']) : FALSE; |
|
851 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
852 | 852 | |
853 | 853 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby; |
854 | 854 | |
@@ -861,94 +861,94 @@ discard block |
||
861 | 861 | // $orderby = 'reg.REG_final_price'; |
862 | 862 | } |
863 | 863 | |
864 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
864 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
865 | 865 | |
866 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
867 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
866 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
867 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
868 | 868 | |
869 | 869 | |
870 | - $offset = ($current_page-1)*$per_page; |
|
871 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
872 | - $query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array())))); |
|
873 | - if ($EVT_ID){ |
|
874 | - $query_params[0]['EVT_ID']=$EVT_ID; |
|
870 | + $offset = ($current_page - 1) * $per_page; |
|
871 | + $limit = $count ? NULL : array($offset, $per_page); |
|
872 | + $query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array())))); |
|
873 | + if ($EVT_ID) { |
|
874 | + $query_params[0]['EVT_ID'] = $EVT_ID; |
|
875 | 875 | } |
876 | - if($CAT_ID){ |
|
876 | + if ($CAT_ID) { |
|
877 | 877 | throw new EE_Error("You specified a Category Id for this query. Thats odd because we are now using terms and taxonomies. So did you mean the term taxonomy id o rthe term id?"); |
878 | 878 | } |
879 | 879 | |
880 | 880 | //if DTT is included we do multiple datetimes. |
881 | - if ( $DTT_ID ) { |
|
881 | + if ($DTT_ID) { |
|
882 | 882 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
883 | 883 | } |
884 | 884 | |
885 | 885 | //make sure we only have default where on the current regs |
886 | 886 | $query_params['default_where_conditions'] = 'this_model_only'; |
887 | 887 | |
888 | - $status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) ); |
|
888 | + $status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)); |
|
889 | 889 | |
890 | - $query_params[0]['STS_ID']= array('IN', $status_ids_array ); |
|
890 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
891 | 891 | |
892 | - if($trash){ |
|
893 | - $query_params[0]['Attendee.status']= EEM_CPT_Base::post_status_trashed; |
|
892 | + if ($trash) { |
|
893 | + $query_params[0]['Attendee.status'] = EEM_CPT_Base::post_status_trashed; |
|
894 | 894 | } |
895 | 895 | |
896 | - if ( isset( $this->_req_data['s'] ) ) { |
|
897 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
896 | + if (isset($this->_req_data['s'])) { |
|
897 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
898 | 898 | $query_params[0]['OR'] = array( |
899 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
900 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
901 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
902 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
903 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
904 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
905 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
906 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
907 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
908 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
909 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
910 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
911 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
912 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
913 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
914 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ) |
|
899 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
900 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
901 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
902 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
903 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
904 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
905 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
906 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
907 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
908 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
909 | + 'REG_final_price' => array('LIKE', $sstr), |
|
910 | + 'REG_code' => array('LIKE', $sstr), |
|
911 | + 'REG_count' => array('LIKE', $sstr), |
|
912 | + 'REG_group_size' => array('LIKE', $sstr), |
|
913 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
914 | + 'Ticket.TKT_description' => array('LIKE', $sstr) |
|
915 | 915 | ); |
916 | 916 | } |
917 | 917 | |
918 | 918 | $query_params['order_by'][$orderby] = $sort; |
919 | 919 | $query_params['limit'] = $limit; |
920 | - $query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
|
921 | - if($count){ |
|
922 | - $registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only' )); |
|
923 | - }else{ |
|
920 | + $query_params['force_join'] = array('Attendee'); //force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
|
921 | + if ($count) { |
|
922 | + $registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only')); |
|
923 | + } else { |
|
924 | 924 | $registrations = EEM_Registration::instance()->get_all($query_params); |
925 | 925 | |
926 | 926 | |
927 | 927 | // $registrations = EEM_Registration::instance(); |
928 | 928 | // $all_attendees = EEM_Attendee::instance()->get_event_attendees( $EVT_ID, $CAT_ID, $reg_status, $trash, $orderby, $sort, $limit, $output ); |
929 | - if ( isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration ) { |
|
929 | + if (isset($registrations[0]) && $registrations[0] instanceof EE_Registration) { |
|
930 | 930 | //EEH_Debug_Tools::printr( $all_attendees[0], '$all_attendees[0] <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
931 | 931 | // name |
932 | 932 | $first_registration = $registrations[0]; |
933 | 933 | $event_obj = $first_registration->event_obj(); |
934 | - if($event_obj){ |
|
934 | + if ($event_obj) { |
|
935 | 935 | $event_name = $first_registration->event_obj()->name(); |
936 | - $event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?';//$first_registration->date_obj()->reg_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 ) : ''; |
|
936 | + $event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?'; //$first_registration->date_obj()->reg_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 ) : ''; |
|
937 | 937 | // edit event link |
938 | - if ( $event_name != '' ) { |
|
939 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
940 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
941 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
938 | + if ($event_name != '') { |
|
939 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
940 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
941 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
942 | 942 | } |
943 | 943 | |
944 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
945 | - $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>'; |
|
944 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
945 | + $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>'; |
|
946 | 946 | |
947 | 947 | $this->_template_args['before_admin_page_content'] = ' |
948 | 948 | <div id="admin-page-header"> |
949 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
950 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
951 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
949 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
950 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
951 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
952 | 952 | </div> |
953 | 953 | '; |
954 | 954 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @access private |
137 | 137 | * @param string $period |
138 | - * @return int |
|
138 | + * @return string |
|
139 | 139 | */ |
140 | 140 | private function _revenue_per_day_report( $period = '-1 month' ) { |
141 | 141 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @access private |
195 | 195 | * @param string $period |
196 | - * @return int |
|
196 | + * @return string |
|
197 | 197 | */ |
198 | 198 | private function _revenue_per_event_report( $period = '-1 month' ) { |
199 | 199 |
@@ -105,10 +105,10 @@ |
||
105 | 105 | /** |
106 | 106 | * _transaction_reports |
107 | 107 | * generates Business Reports regarding Transactions |
108 | - * |
|
108 | + * |
|
109 | 109 | * @access protected |
110 | - * @return void |
|
111 | - */ |
|
110 | + * @return void |
|
111 | + */ |
|
112 | 112 | protected function _transaction_reports() { |
113 | 113 | |
114 | 114 | $page_args = array(); |
@@ -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 | /** |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | * @param bool $routing |
36 | 36 | * @return \Extend_Transactions_Admin_Page |
37 | 37 | */ |
38 | - public function __construct( $routing = TRUE ) { |
|
39 | - parent::__construct( $routing ); |
|
40 | - define( 'TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/templates/'); |
|
41 | - define( 'TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/assets/'); |
|
42 | - define( 'TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'transactions/assets/'); |
|
38 | + public function __construct($routing = TRUE) { |
|
39 | + parent::__construct($routing); |
|
40 | + define('TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'transactions/templates/'); |
|
41 | + define('TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'transactions/assets/'); |
|
42 | + define('TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'transactions/assets/'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @return void |
52 | 52 | */ |
53 | 53 | protected function _extend_page_config() { |
54 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'transactions'; |
|
54 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'transactions'; |
|
55 | 55 | |
56 | 56 | $new_page_routes = array( |
57 | 57 | 'reports' => array( |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | ) |
61 | 61 | ); |
62 | 62 | |
63 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
63 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
64 | 64 | |
65 | 65 | $new_page_config = array( |
66 | 66 | 'reports' => array( |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | 'filename' => 'transactions_reports' |
75 | 75 | ) |
76 | 76 | ), |
77 | - 'help_tour' => array( 'Transaction_Reports_Help_Tour' ), |
|
77 | + 'help_tour' => array('Transaction_Reports_Help_Tour'), |
|
78 | 78 | 'require_nonce' => FALSE |
79 | 79 | ) |
80 | 80 | ); |
81 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
81 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | wp_enqueue_style('jquery-jqplot-css'); |
95 | 95 | //scripts |
96 | 96 | global $is_IE; |
97 | - if ( $is_IE ) { |
|
98 | - wp_enqueue_script( 'excanvas' ); |
|
97 | + if ($is_IE) { |
|
98 | + wp_enqueue_script('excanvas'); |
|
99 | 99 | } |
100 | 100 | wp_enqueue_script('jqplot-all'); |
101 | 101 | } |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | |
114 | 114 | $page_args = array(); |
115 | 115 | |
116 | - $page_args['admin_reports'][] = $this->_revenue_per_day_report( '-1 month' ); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
117 | - $page_args['admin_reports'][] = $this->_revenue_per_event_report( '-1 month' ); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
116 | + $page_args['admin_reports'][] = $this->_revenue_per_day_report('-1 month'); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
117 | + $page_args['admin_reports'][] = $this->_revenue_per_event_report('-1 month'); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
118 | 118 | // $page_args['admin_reports'][] = 'chart1'; |
119 | 119 | |
120 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
120 | + $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php'; |
|
121 | 121 | $this->_admin_page_title = __('Transactions', 'event_espresso'); |
122 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $page_args, TRUE ); |
|
122 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $page_args, TRUE); |
|
123 | 123 | |
124 | 124 | |
125 | 125 | // the final template wrapper |
@@ -137,37 +137,37 @@ discard block |
||
137 | 137 | * @param string $period |
138 | 138 | * @return int |
139 | 139 | */ |
140 | - private function _revenue_per_day_report( $period = '-1 month' ) { |
|
140 | + private function _revenue_per_day_report($period = '-1 month') { |
|
141 | 141 | |
142 | 142 | $report_ID = 'txn-admin-revenue-per-day-report-dv'; |
143 | 143 | $report_JS = 'espresso_txn_admin_revenue_per_day'; |
144 | 144 | |
145 | - wp_enqueue_script( $report_JS, TXN_CAF_ASSETS_URL . $report_JS . '_report.js', array('jqplot-all'), '1.0', TRUE); |
|
145 | + wp_enqueue_script($report_JS, TXN_CAF_ASSETS_URL.$report_JS.'_report.js', array('jqplot-all'), '1.0', TRUE); |
|
146 | 146 | |
147 | 147 | $TXN = EEM_Transaction::instance(); |
148 | 148 | |
149 | - $results = $TXN->get_revenue_per_day_report( $period ); |
|
149 | + $results = $TXN->get_revenue_per_day_report($period); |
|
150 | 150 | //EEH_Debug_Tools::printr( $results, '$registrations_per_day' ); |
151 | 151 | $revenue = array(); |
152 | - $xmin = date( 'Y-m-d', strtotime( '+1 year' )); |
|
152 | + $xmin = date('Y-m-d', strtotime('+1 year')); |
|
153 | 153 | $xmax = 0; |
154 | 154 | $ymax = 0; |
155 | 155 | |
156 | 156 | $results = (array) $results; |
157 | 157 | |
158 | - foreach ( $results as $result ) { |
|
159 | - $revenue[] = array( $result->txnDate, (float)$result->revenue ); |
|
160 | - $xmin = strtotime( $result->txnDate ) < strtotime( $xmin ) ? $result->txnDate : $xmin; |
|
161 | - $xmax = strtotime( $result->txnDate ) > strtotime( $xmax ) ? $result->txnDate : $xmax; |
|
158 | + foreach ($results as $result) { |
|
159 | + $revenue[] = array($result->txnDate, (float) $result->revenue); |
|
160 | + $xmin = strtotime($result->txnDate) < strtotime($xmin) ? $result->txnDate : $xmin; |
|
161 | + $xmax = strtotime($result->txnDate) > strtotime($xmax) ? $result->txnDate : $xmax; |
|
162 | 162 | $ymax = $result->revenue > $ymax ? $result->revenue : $ymax; |
163 | 163 | } |
164 | 164 | |
165 | - $xmin = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmin)) . ' -1 day' )); |
|
166 | - $xmax = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmax)) . ' +1 day' )); |
|
165 | + $xmin = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmin)).' -1 day')); |
|
166 | + $xmax = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmax)).' +1 day')); |
|
167 | 167 | // calculate # days between our min and max dates |
168 | - $span = floor( (strtotime($xmax) - strtotime($xmin)) / (60*60*24)) + 1; |
|
168 | + $span = floor((strtotime($xmax) - strtotime($xmin)) / (60 * 60 * 24)) + 1; |
|
169 | 169 | |
170 | - $report_title = __( 'Total Revenue per Day' ); |
|
170 | + $report_title = __('Total Revenue per Day'); |
|
171 | 171 | |
172 | 172 | $report_params = array( |
173 | 173 | 'title' => $report_title, |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | 'ymax' => ceil($ymax * 1.25), |
179 | 179 | 'span' => $span, |
180 | 180 | 'width' => ceil(900 / $span), |
181 | - 'noTxnMsg' => sprintf( __('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title ) |
|
181 | + 'noTxnMsg' => sprintf(__('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title) |
|
182 | 182 | ); |
183 | - wp_localize_script( $report_JS, 'txnRevPerDay', $report_params ); |
|
183 | + wp_localize_script($report_JS, 'txnRevPerDay', $report_params); |
|
184 | 184 | |
185 | 185 | return $report_ID; |
186 | 186 | } |
@@ -195,29 +195,29 @@ discard block |
||
195 | 195 | * @param string $period |
196 | 196 | * @return int |
197 | 197 | */ |
198 | - private function _revenue_per_event_report( $period = '-1 month' ) { |
|
198 | + private function _revenue_per_event_report($period = '-1 month') { |
|
199 | 199 | |
200 | 200 | $report_ID = 'txn-admin-revenue-per-event-report-dv'; |
201 | 201 | $report_JS = 'espresso_txn_admin_revenue_per_event'; |
202 | 202 | |
203 | - wp_enqueue_script( $report_JS, TXN_CAF_ASSETS_URL . $report_JS . '_report.js', array('jqplot-all'), '1.0', TRUE); |
|
203 | + wp_enqueue_script($report_JS, TXN_CAF_ASSETS_URL.$report_JS.'_report.js', array('jqplot-all'), '1.0', TRUE); |
|
204 | 204 | |
205 | 205 | $TXN = EEM_Transaction::instance(); |
206 | 206 | |
207 | - $results = $TXN->get_revenue_per_event_report( $period ); |
|
207 | + $results = $TXN->get_revenue_per_event_report($period); |
|
208 | 208 | |
209 | 209 | //EEH_Debug_Tools::printr( $results, '$registrations_per_event' ); |
210 | 210 | $revenue = array(); |
211 | 211 | $results = (array) $results; |
212 | - foreach ( $results as $result ) { |
|
213 | - $event_name = stripslashes( html_entity_decode( $result->event_name, ENT_QUOTES, 'UTF-8' )); |
|
214 | - $event_name = wp_trim_words( $event_name, 5, '...' ); |
|
215 | - $revenue[] = array( $event_name, (float)$result->revenue ); |
|
212 | + foreach ($results as $result) { |
|
213 | + $event_name = stripslashes(html_entity_decode($result->event_name, ENT_QUOTES, 'UTF-8')); |
|
214 | + $event_name = wp_trim_words($event_name, 5, '...'); |
|
215 | + $revenue[] = array($event_name, (float) $result->revenue); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | $span = $period == 'week' ? 9 : 33; |
219 | 219 | |
220 | - $report_title = __( 'Total Revenue per Event' ); |
|
220 | + $report_title = __('Total Revenue per Event'); |
|
221 | 221 | |
222 | 222 | $report_params = array( |
223 | 223 | 'title' => $report_title, |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | 'revenue' => $revenue, |
226 | 226 | 'span' => $span, |
227 | 227 | 'width' => ceil(900 / $span), |
228 | - 'noTxnMsg' => sprintf( __('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title ) |
|
228 | + 'noTxnMsg' => sprintf(__('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title) |
|
229 | 229 | ); |
230 | - wp_localize_script( $report_JS, 'revenuePerEvent', $report_params ); |
|
230 | + wp_localize_script($report_JS, 'revenuePerEvent', $report_params); |
|
231 | 231 | |
232 | 232 | return $report_ID; |
233 | 233 | } |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -56,7 +56,7 @@ |
||
56 | 56 | /** |
57 | 57 | * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths |
58 | 58 | * @param array $paths original helper paths array |
59 | - * @return array new array of paths |
|
59 | + * @return string[] new array of paths |
|
60 | 60 | */ |
61 | 61 | public function caf_helper_paths( $paths ) { |
62 | 62 | $paths[] = EE_CAF_CORE . 'helpers' . DS; |
@@ -25,30 +25,30 @@ discard block |
||
25 | 25 | * ------------------------------------------------------------------------ |
26 | 26 | */ |
27 | 27 | // defined some new constants related to caffeinated folder |
28 | -define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' ); |
|
29 | -define('EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS); |
|
30 | -define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS); |
|
31 | -define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS ); |
|
28 | +define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/'); |
|
29 | +define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS); |
|
30 | +define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS); |
|
31 | +define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS); |
|
32 | 32 | class EE_Brewing_Regular extends EE_Base { |
33 | 33 | |
34 | 34 | public function __construct() { |
35 | - if ( defined( 'EE_CAFF_PATH' )) { |
|
35 | + if (defined('EE_CAFF_PATH')) { |
|
36 | 36 | // activation |
37 | - add_action( 'AHEE__EEH_Activation__initialize_db_content', array( $this, 'initialize_caf_db_content' )); |
|
37 | + add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); |
|
38 | 38 | // load caff init |
39 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'caffeinated_init' )); |
|
39 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); |
|
40 | 40 | // make it so the PDF receipt doesn't show our shameless plug |
41 | - add_filter( 'FHEE_Invoice__send_invoice__shameless_plug', '__return_false' ); |
|
41 | + add_filter('FHEE_Invoice__send_invoice__shameless_plug', '__return_false'); |
|
42 | 42 | // add caffeinated modules |
43 | - add_filter( 'FHEE__EE_Config__register_modules__modules_to_register', array( $this, 'caffeinated_modules_to_register' )); |
|
43 | + add_filter('FHEE__EE_Config__register_modules__modules_to_register', array($this, 'caffeinated_modules_to_register')); |
|
44 | 44 | // load caff scripts |
45 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_caffeinated_scripts'), 10 ); |
|
45 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); |
|
46 | 46 | |
47 | - add_filter( 'FHEE__EE_Registry__load_helper__helper_paths', array( $this, 'caf_helper_paths' ), 10 ); |
|
47 | + add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
48 | 48 | |
49 | - add_filter( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array( $this, 'caf_payment_methods' ) ); |
|
49 | + add_filter('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array($this, 'caf_payment_methods')); |
|
50 | 50 | // caffeinated constructed |
51 | - do_action( 'AHEE__EE_Brewing_Regular__construct__complete' ); |
|
51 | + do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | * @param array $paths original helper paths array |
59 | 59 | * @return array new array of paths |
60 | 60 | */ |
61 | - public function caf_helper_paths( $paths ) { |
|
62 | - $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
61 | + public function caf_helper_paths($paths) { |
|
62 | + $paths[] = EE_CAF_CORE.'helpers'.DS; |
|
63 | 63 | return $paths; |
64 | 64 | } |
65 | 65 | |
@@ -75,22 +75,22 @@ discard block |
||
75 | 75 | * Right now, we ASSUME the only price types in the system are default ones |
76 | 76 | * @global type $wpdb |
77 | 77 | */ |
78 | - function initialize_caf_db_content(){ |
|
78 | + function initialize_caf_db_content() { |
|
79 | 79 | // echo "initialize caf db content!"; |
80 | 80 | global $wpdb; |
81 | 81 | |
82 | 82 | //use same method of getting creator id as the version introducing the change |
83 | - $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id',get_current_user_id()); |
|
83 | + $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
84 | 84 | |
85 | 85 | $price_type_table = $wpdb->prefix."esp_price_type"; |
86 | 86 | $price_table = $wpdb->prefix."esp_price"; |
87 | 87 | |
88 | 88 | if ($wpdb->get_var("SHOW TABLES LIKE '$price_type_table'") == $price_type_table) { |
89 | 89 | |
90 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';//include trashed price types |
|
91 | - $tax_price_type_count = $wpdb->get_var( $SQL ); |
|
90 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; //include trashed price types |
|
91 | + $tax_price_type_count = $wpdb->get_var($SQL); |
|
92 | 92 | |
93 | - if ( $tax_price_type_count <= 1) { |
|
93 | + if ($tax_price_type_count <= 1) { |
|
94 | 94 | $result = $wpdb->insert($price_type_table, |
95 | 95 | array( |
96 | 96 | 'PRT_name'=> __("Regional Tax", "event_espresso"), |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | 'PRT_wp_user' => $default_creator_id |
102 | 102 | ), |
103 | 103 | array( |
104 | - '%s',//PRT_name |
|
105 | - '%d',//PBT_id |
|
106 | - '%d',//PRT_is_percent |
|
107 | - '%d',//PRT_order |
|
108 | - '%d',//PRT_deleted |
|
104 | + '%s', //PRT_name |
|
105 | + '%d', //PBT_id |
|
106 | + '%d', //PRT_is_percent |
|
107 | + '%d', //PRT_order |
|
108 | + '%d', //PRT_deleted |
|
109 | 109 | '%d', //PRT_wp_user |
110 | 110 | )); |
111 | 111 | //federal tax |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | 'PRT_wp_user' => $default_creator_id, |
120 | 120 | ), |
121 | 121 | array( |
122 | - '%s',//PRT_name |
|
123 | - '%d',//PBT_id |
|
124 | - '%d',//PRT_is_percent |
|
125 | - '%d',//PRT_order |
|
126 | - '%d',//PRT_deleted |
|
122 | + '%s', //PRT_name |
|
123 | + '%d', //PBT_id |
|
124 | + '%d', //PRT_is_percent |
|
125 | + '%d', //PRT_order |
|
126 | + '%d', //PRT_deleted |
|
127 | 127 | '%d' //PRT_wp_user |
128 | 128 | )); |
129 | - if( $result){ |
|
129 | + if ($result) { |
|
130 | 130 | $wpdb->insert($price_table, |
131 | 131 | array( |
132 | 132 | 'PRT_ID'=>$wpdb->insert_id, |
@@ -141,15 +141,15 @@ discard block |
||
141 | 141 | 'PRC_wp_user' => $default_creator_id |
142 | 142 | ), |
143 | 143 | array( |
144 | - '%d',//PRT_id |
|
145 | - '%f',//PRC_amount |
|
146 | - '%s',//PRC_name |
|
147 | - '%s',//PRC_desc |
|
148 | - '%d',//PRC_is_default |
|
149 | - '%d',//PRC_overrides |
|
150 | - '%d',//PRC_deleted |
|
151 | - '%d',//PRC_order |
|
152 | - '%d',//PRC_parent |
|
144 | + '%d', //PRT_id |
|
145 | + '%f', //PRC_amount |
|
146 | + '%s', //PRC_name |
|
147 | + '%s', //PRC_desc |
|
148 | + '%d', //PRC_is_default |
|
149 | + '%d', //PRC_overrides |
|
150 | + '%d', //PRC_deleted |
|
151 | + '%d', //PRC_order |
|
152 | + '%d', //PRC_parent |
|
153 | 153 | '%d' //PRC_wp_user |
154 | 154 | )); |
155 | 155 | } |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | * @param array $modules_to_register |
170 | 170 | * @return array |
171 | 171 | */ |
172 | - public function caffeinated_modules_to_register( $modules_to_register = array() ){ |
|
173 | - if ( is_readable( EE_CAFF_PATH . 'modules' )) { |
|
174 | - $caffeinated_modules_to_register = glob( EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR ); |
|
175 | - if ( is_array( $caffeinated_modules_to_register ) && ! empty( $caffeinated_modules_to_register )) { |
|
176 | - $modules_to_register = array_merge( $modules_to_register, $caffeinated_modules_to_register ); |
|
172 | + public function caffeinated_modules_to_register($modules_to_register = array()) { |
|
173 | + if (is_readable(EE_CAFF_PATH.'modules')) { |
|
174 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR); |
|
175 | + if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
176 | + $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | return $modules_to_register; |
@@ -181,19 +181,19 @@ discard block |
||
181 | 181 | |
182 | 182 | |
183 | 183 | |
184 | - public function caffeinated_init(){ |
|
184 | + public function caffeinated_init() { |
|
185 | 185 | // EE_Register_CPTs hooks |
186 | - add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( $this, 'filter_taxonomies' ), 10 ); |
|
187 | - add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array( $this, 'filter_cpts' ), 10 ); |
|
188 | - add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array( $this, 'nav_metabox_items' ), 10 ); |
|
189 | - EE_Registry::instance()->load_file( EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE ); |
|
186 | + add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array($this, 'filter_taxonomies'), 10); |
|
187 | + add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array($this, 'filter_cpts'), 10); |
|
188 | + add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array($this, 'nav_metabox_items'), 10); |
|
189 | + EE_Registry::instance()->load_file(EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE); |
|
190 | 190 | // caffeinated_init__complete hook |
191 | - do_action( 'AHEE__EE_Brewing_Regular__caffeinated_init__complete' ); |
|
191 | + do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | |
195 | 195 | |
196 | - public function enqueue_caffeinated_scripts(){ |
|
196 | + public function enqueue_caffeinated_scripts() { |
|
197 | 197 | // sound of crickets... |
198 | 198 | } |
199 | 199 | |
@@ -202,23 +202,23 @@ discard block |
||
202 | 202 | * callbacks below here |
203 | 203 | */ |
204 | 204 | |
205 | - public function filter_taxonomies( $taxonomy_array ) { |
|
205 | + public function filter_taxonomies($taxonomy_array) { |
|
206 | 206 | $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = TRUE; |
207 | 207 | return $taxonomy_array; |
208 | 208 | } |
209 | 209 | |
210 | 210 | |
211 | 211 | |
212 | - public function filter_cpts( $cpt_array ) { |
|
212 | + public function filter_cpts($cpt_array) { |
|
213 | 213 | $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = TRUE; |
214 | 214 | return $cpt_array; |
215 | 215 | } |
216 | 216 | |
217 | 217 | |
218 | - public function nav_metabox_items( $menuitems ) { |
|
218 | + public function nav_metabox_items($menuitems) { |
|
219 | 219 | $menuitems[] = array( |
220 | 220 | 'title' => __('Venue List', 'event_espresso'), |
221 | - 'url' => get_post_type_archive_link( 'espresso_venues' ), |
|
221 | + 'url' => get_post_type_archive_link('espresso_venues'), |
|
222 | 222 | 'description' => __('Archive page for all venues.', 'event_espresso') |
223 | 223 | ); |
224 | 224 | return $menuitems; |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | * @param array $payment_method_paths |
230 | 230 | * @return array values are folder paths to payment method folders |
231 | 231 | */ |
232 | - public function caf_payment_methods( $payment_method_paths ) { |
|
233 | - $caf_payment_methods_paths = glob( EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR ); |
|
234 | - $payment_method_paths = array_merge( $payment_method_paths, $caf_payment_methods_paths ); |
|
232 | + public function caf_payment_methods($payment_method_paths) { |
|
233 | + $caf_payment_methods_paths = glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR); |
|
234 | + $payment_method_paths = array_merge($payment_method_paths, $caf_payment_methods_paths); |
|
235 | 235 | return $payment_method_paths; |
236 | 236 | } |
237 | 237 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -1,29 +1,29 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * the purpose of this file is to simply contain any action/filter hook callbacks etc for specific aspects of EE related to caffeinated (regular) use. Before putting any code in here, First be certain that it isn't better to define and use the hook in a specific caffeinated/whatever class or file. |
|
4 | - */ |
|
3 | + * the purpose of this file is to simply contain any action/filter hook callbacks etc for specific aspects of EE related to caffeinated (regular) use. Before putting any code in here, First be certain that it isn't better to define and use the hook in a specific caffeinated/whatever class or file. |
|
4 | + */ |
|
5 | 5 | /** |
6 | - * Event Espresso |
|
7 | - * |
|
8 | - * Event Registration and Management Plugin for WordPress |
|
9 | - * |
|
10 | - * @ package Event Espresso |
|
11 | - * @ author Seth Shoultes |
|
12 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
13 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
14 | - * @ link http://www.eventespresso.com |
|
15 | - * @ version 4.0 |
|
16 | - * |
|
17 | - * ------------------------------------------------------------------------ |
|
18 | - * |
|
19 | - * EE_Brewing_Regular class. Just a wrapper to help namespace activity for the functionality of this file. |
|
20 | - * |
|
21 | - * @package Event Espresso |
|
22 | - * @subpackage /caffeinated/brewing_regular.php |
|
23 | - * @author Darren Ethier |
|
24 | - * |
|
25 | - * ------------------------------------------------------------------------ |
|
26 | - */ |
|
6 | + * Event Espresso |
|
7 | + * |
|
8 | + * Event Registration and Management Plugin for WordPress |
|
9 | + * |
|
10 | + * @ package Event Espresso |
|
11 | + * @ author Seth Shoultes |
|
12 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
13 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
14 | + * @ link http://www.eventespresso.com |
|
15 | + * @ version 4.0 |
|
16 | + * |
|
17 | + * ------------------------------------------------------------------------ |
|
18 | + * |
|
19 | + * EE_Brewing_Regular class. Just a wrapper to help namespace activity for the functionality of this file. |
|
20 | + * |
|
21 | + * @package Event Espresso |
|
22 | + * @subpackage /caffeinated/brewing_regular.php |
|
23 | + * @author Darren Ethier |
|
24 | + * |
|
25 | + * ------------------------------------------------------------------------ |
|
26 | + */ |
|
27 | 27 | // defined some new constants related to caffeinated folder |
28 | 28 | define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' ); |
29 | 29 | define('EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS); |
@@ -72,7 +72,7 @@ |
||
72 | 72 | /** |
73 | 73 | * This just allows us to add additional paths to the autoloader (EED_Messages::autoload_messages()) for the messages system. |
74 | 74 | * @param array $dir_ref original array of paths |
75 | - * @return array appended paths |
|
75 | + * @return string[] appended paths |
|
76 | 76 | */ |
77 | 77 | public function messages_autoload_paths( $dir_ref ) { |
78 | 78 | $dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/'; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @since 4.3.2 |
16 | 16 | * @author Darren Ethier |
17 | 17 | */ |
18 | -class EE_Caf_Messages { |
|
18 | +class EE_Caf_Messages { |
|
19 | 19 | |
20 | 20 | |
21 | 21 | /** |
@@ -34,36 +34,36 @@ discard block |
||
34 | 34 | * @return void |
35 | 35 | */ |
36 | 36 | private function _caf_hooks() { |
37 | - add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array( $this, 'messages_autoload_paths'), 5 ); |
|
38 | - add_filter('FHEE__EE_Email_messenger__get_validator_config', array( $this, 'email_messenger_validator_config'), 5, 2 ); |
|
39 | - add_filter('FHEE__EE_Email_messenger__get_template_fields', array( $this, 'email_messenger_template_fields'), 5, 2 ); |
|
40 | - add_filter( 'FHEE__EE_Html_messenger__get_template_fields', array( $this, 'html_messenger_template_fields' ), 5, 2 ); |
|
41 | - add_filter( 'FHEE__EE_Html_messenger__get_validator_config', array( $this, 'html_messenger_validator_config' ), 5, 2 ); |
|
42 | - add_filter( 'FHEE__EE_Pdf_messenger__get_template_fields', array( $this, 'pdf_messenger_template_fields' ), 5, 2 ); |
|
43 | - add_filter( 'FHEE__EE_Pdf_messenger__get_validator_config', array( $this, 'pdf_messenger_validator_config' ), 5, 2 ); |
|
44 | - add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', array( $this, 'new_default_templates'), 5, 7 ); |
|
45 | - add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array( $this, 'message_types_valid_shortcodes'), 5, 2 ); |
|
37 | + add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array($this, 'messages_autoload_paths'), 5); |
|
38 | + add_filter('FHEE__EE_Email_messenger__get_validator_config', array($this, 'email_messenger_validator_config'), 5, 2); |
|
39 | + add_filter('FHEE__EE_Email_messenger__get_template_fields', array($this, 'email_messenger_template_fields'), 5, 2); |
|
40 | + add_filter('FHEE__EE_Html_messenger__get_template_fields', array($this, 'html_messenger_template_fields'), 5, 2); |
|
41 | + add_filter('FHEE__EE_Html_messenger__get_validator_config', array($this, 'html_messenger_validator_config'), 5, 2); |
|
42 | + add_filter('FHEE__EE_Pdf_messenger__get_template_fields', array($this, 'pdf_messenger_template_fields'), 5, 2); |
|
43 | + add_filter('FHEE__EE_Pdf_messenger__get_validator_config', array($this, 'pdf_messenger_validator_config'), 5, 2); |
|
44 | + add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', array($this, 'new_default_templates'), 5, 7); |
|
45 | + add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array($this, 'message_types_valid_shortcodes'), 5, 2); |
|
46 | 46 | |
47 | 47 | //shortcode parsers |
48 | - add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array( $this, 'additional_attendee_shortcodes'), 5, 2 ); |
|
49 | - add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array( $this, 'additional_attendee_parser'), 5, 5 ); |
|
50 | - add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', array( $this, 'additional_recipient_details_shortcodes'), 5, 2 ); |
|
51 | - add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', array( $this, 'additional_recipient_details_parser'), 5, 5 ); |
|
52 | - add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', array( $this, 'additional_primary_registration_details_shortcodes'), 5, 2 ); |
|
53 | - add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', array( $this, 'additional_primary_registration_details_parser'), 5, 5 ); |
|
48 | + add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array($this, 'additional_attendee_shortcodes'), 5, 2); |
|
49 | + add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array($this, 'additional_attendee_parser'), 5, 5); |
|
50 | + add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', array($this, 'additional_recipient_details_shortcodes'), 5, 2); |
|
51 | + add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', array($this, 'additional_recipient_details_parser'), 5, 5); |
|
52 | + add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', array($this, 'additional_primary_registration_details_shortcodes'), 5, 2); |
|
53 | + add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', array($this, 'additional_primary_registration_details_parser'), 5, 5); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @since 4.2.0 |
57 | 57 | */ |
58 | - add_filter( 'FHEE__EE_Datetime_Shortcodes__shortcodes', array( $this, 'additional_datetime_shortcodes'), 10, 2 ); |
|
59 | - add_filter( 'FHEE__EE_Datetime_Shortcodes__parser_after', array( $this, 'additional_datetime_parser'), 10, 5 ); |
|
58 | + add_filter('FHEE__EE_Datetime_Shortcodes__shortcodes', array($this, 'additional_datetime_shortcodes'), 10, 2); |
|
59 | + add_filter('FHEE__EE_Datetime_Shortcodes__parser_after', array($this, 'additional_datetime_parser'), 10, 5); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @since 4.3.0 |
63 | 63 | */ |
64 | 64 | //eat our own dog food! |
65 | - add_action('EE_Brewing_Regular___messages_caf', array( $this, 'register_caf_message_types' ) ); |
|
66 | - add_action('EE_Brewing_Regular___messages_caf', array( $this, 'register_caf_shortcodes' ) ); |
|
65 | + add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_message_types')); |
|
66 | + add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_shortcodes')); |
|
67 | 67 | do_action('EE_Brewing_Regular___messages_caf'); |
68 | 68 | } |
69 | 69 | |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | * @param array $dir_ref original array of paths |
75 | 75 | * @return array appended paths |
76 | 76 | */ |
77 | - public function messages_autoload_paths( $dir_ref ) { |
|
78 | - $dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/'; |
|
77 | + public function messages_autoload_paths($dir_ref) { |
|
78 | + $dir_ref[] = EE_CAF_LIBRARIES.'shortcodes/'; |
|
79 | 79 | return $dir_ref; |
80 | 80 | } |
81 | 81 | |
82 | 82 | |
83 | 83 | |
84 | - public function email_messenger_validator_config( $validator_config, EE_Email_messenger $messenger ) { |
|
84 | + public function email_messenger_validator_config($validator_config, EE_Email_messenger $messenger) { |
|
85 | 85 | $validator_config['attendee_list'] = array( |
86 | 86 | 'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'), |
87 | 87 | 'required' => array('[ATTENDEE_LIST]') |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | |
97 | 97 | |
98 | - public function html_messenger_validator_config( $validator_config, EE_Html_messenger $messenger ) { |
|
98 | + public function html_messenger_validator_config($validator_config, EE_Html_messenger $messenger) { |
|
99 | 99 | $validator_config['attendee_list'] = array( |
100 | 100 | 'shortcodes' => array('attendee', 'question_list'), |
101 | 101 | 'required' => array('[ATTENDEE_LIST]') |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | |
111 | 111 | |
112 | - public function pdf_messenger_validator_config( $validator_config, EE_Pdf_messenger $messenger ) { |
|
112 | + public function pdf_messenger_validator_config($validator_config, EE_Pdf_messenger $messenger) { |
|
113 | 113 | $validator_config['attendee_list'] = array( |
114 | 114 | 'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'), |
115 | 115 | 'required' => array('[ATTENDEE_LIST]') |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | |
126 | 126 | |
127 | - public function email_messenger_template_fields( $template_fields, EE_Email_messenger $messenger ) { |
|
127 | + public function email_messenger_template_fields($template_fields, EE_Email_messenger $messenger) { |
|
128 | 128 | $template_fields['extra']['content']['question_list'] = array( |
129 | 129 | 'input' => 'textarea', |
130 | 130 | 'label' => '[QUESTION_LIST]', |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | - public function html_messenger_template_fields( $template_fields, EE_Html_messenger $messenger ) { |
|
143 | + public function html_messenger_template_fields($template_fields, EE_Html_messenger $messenger) { |
|
144 | 144 | $template_fields['extra']['content']['question_list'] = array( |
145 | 145 | 'input' => 'textarea', |
146 | 146 | 'label' => '[QUESTION_LIST]', |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | |
159 | 159 | |
160 | - public function pdf_messenger_template_fields( $template_fields, EE_Pdf_messenger $messenger ) { |
|
160 | + public function pdf_messenger_template_fields($template_fields, EE_Pdf_messenger $messenger) { |
|
161 | 161 | $template_fields['extra']['content']['question_list'] = array( |
162 | 162 | 'input' => 'textarea', |
163 | 163 | 'label' => '[QUESTION_LIST]', |
@@ -174,39 +174,39 @@ discard block |
||
174 | 174 | |
175 | 175 | |
176 | 176 | |
177 | - public function new_default_templates( $contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack ) { |
|
177 | + public function new_default_templates($contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack) { |
|
178 | 178 | |
179 | 179 | //we're only modifying templates for the default template pack |
180 | - if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default ) { |
|
180 | + if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default) { |
|
181 | 181 | return $contents; |
182 | 182 | } |
183 | 183 | |
184 | 184 | //the template file name we're replacing contents for. |
185 | - $template_file_prefix = $field . '_' . $context; |
|
186 | - $msg_prefix = $messenger->name . '_' . $message_type->name . '_' ; |
|
185 | + $template_file_prefix = $field.'_'.$context; |
|
186 | + $msg_prefix = $messenger->name.'_'.$message_type->name.'_'; |
|
187 | 187 | |
188 | - $base_path = EE_CAF_LIBRARIES . 'messages/defaults/default/'; |
|
188 | + $base_path = EE_CAF_LIBRARIES.'messages/defaults/default/'; |
|
189 | 189 | |
190 | - if ( $messenger->name == 'email' && $message_type->name == 'registration' ) { |
|
190 | + if ($messenger->name == 'email' && $message_type->name == 'registration') { |
|
191 | 191 | |
192 | - switch ( $template_file_prefix ) { |
|
192 | + switch ($template_file_prefix) { |
|
193 | 193 | |
194 | 194 | case 'question_list_admin' : |
195 | 195 | case 'question_list_attendee' : |
196 | 196 | case 'question_list_primary_attendee' : |
197 | - $path = $base_path . $msg_prefix . 'question_list.template.php'; |
|
198 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
197 | + $path = $base_path.$msg_prefix.'question_list.template.php'; |
|
198 | + $contents = EEH_Template::display_template($path, array(), true); |
|
199 | 199 | break; |
200 | 200 | |
201 | 201 | case 'attendee_list_primary_attendee' : |
202 | - $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
203 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
202 | + $path = $base_path.$msg_prefix.'attendee_list.template.php'; |
|
203 | + $contents = EEH_Template::display_template($path, array(), true); |
|
204 | 204 | break; |
205 | 205 | |
206 | 206 | case 'attendee_list_admin' : |
207 | - $path = $base_path . $msg_prefix . 'attendee_list_admin.template.php'; |
|
208 | - $contents = EEH_Template::display_template( $path, |
|
209 | - array(), true ); |
|
207 | + $path = $base_path.$msg_prefix.'attendee_list_admin.template.php'; |
|
208 | + $contents = EEH_Template::display_template($path, |
|
209 | + array(), true); |
|
210 | 210 | break; |
211 | 211 | |
212 | 212 | case 'attendee_list_attendee' : |
@@ -214,33 +214,33 @@ discard block |
||
214 | 214 | break; |
215 | 215 | |
216 | 216 | case 'event_list_attendee' : |
217 | - $path = $base_path . $msg_prefix . 'event_list_attendee.template.php'; |
|
218 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
217 | + $path = $base_path.$msg_prefix.'event_list_attendee.template.php'; |
|
218 | + $contents = EEH_Template::display_template($path, array(), true); |
|
219 | 219 | break; |
220 | 220 | } |
221 | - } elseif ( $messenger->name == 'email' && $message_type->name == 'newsletter' ) { |
|
222 | - switch( $template_file_prefix ) { |
|
221 | + } elseif ($messenger->name == 'email' && $message_type->name == 'newsletter') { |
|
222 | + switch ($template_file_prefix) { |
|
223 | 223 | |
224 | 224 | case 'content_attendee' : |
225 | - $path = $base_path . $msg_prefix . 'content.template.php'; |
|
226 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
225 | + $path = $base_path.$msg_prefix.'content.template.php'; |
|
226 | + $contents = EEH_Template::display_template($path, array(), true); |
|
227 | 227 | break; |
228 | 228 | |
229 | 229 | case 'newsletter_content_attendee' : |
230 | - $path = $base_path . $msg_prefix . 'newsletter_content.template.php'; |
|
231 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
230 | + $path = $base_path.$msg_prefix.'newsletter_content.template.php'; |
|
231 | + $contents = EEH_Template::display_template($path, array(), true); |
|
232 | 232 | break; |
233 | 233 | |
234 | 234 | case 'newsletter_subject_attendee' : |
235 | - $path = $base_path . $msg_prefix . 'subject.template.php'; |
|
236 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
235 | + $path = $base_path.$msg_prefix.'subject.template.php'; |
|
236 | + $contents = EEH_Template::display_template($path, array(), true); |
|
237 | 237 | break; |
238 | 238 | } |
239 | - } elseif ( $messenger->name == 'html' && $message_type->name == 'receipt' ) { |
|
240 | - switch ( $template_file_prefix ) { |
|
239 | + } elseif ($messenger->name == 'html' && $message_type->name == 'receipt') { |
|
240 | + switch ($template_file_prefix) { |
|
241 | 241 | case 'attendee_list_purchaser' : |
242 | - $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
243 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
242 | + $path = $base_path.$msg_prefix.'attendee_list.template.php'; |
|
243 | + $contents = EEH_Template::display_template($path, array(), true); |
|
244 | 244 | break; |
245 | 245 | } |
246 | 246 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | |
253 | 253 | |
254 | - public function message_types_valid_shortcodes( $valid_shortcodes, EE_Messages_Base $msg ) { |
|
254 | + public function message_types_valid_shortcodes($valid_shortcodes, EE_Messages_Base $msg) { |
|
255 | 255 | //make sure question_list and question are ONLY added for the core message types. Any other message types will have to explicitly set question_list as a valid shortcode. |
256 | 256 | $include_with = array( |
257 | 257 | 'registration', |
@@ -268,9 +268,9 @@ discard block |
||
268 | 268 | 'invoice', |
269 | 269 | 'receipt' |
270 | 270 | ); |
271 | - if ( $msg instanceof EE_message_type && in_array( $msg->name, $include_with )) { |
|
271 | + if ($msg instanceof EE_message_type && in_array($msg->name, $include_with)) { |
|
272 | 272 | $contexts = array_keys($msg->get_contexts()); |
273 | - foreach ( $contexts as $context ) { |
|
273 | + foreach ($contexts as $context) { |
|
274 | 274 | $valid_shortcodes[$context][] = 'question_list'; |
275 | 275 | $valid_shortcodes[$context][] = 'question'; |
276 | 276 | } |
@@ -282,35 +282,35 @@ discard block |
||
282 | 282 | |
283 | 283 | |
284 | 284 | |
285 | - public function additional_attendee_shortcodes( $shortcodes, $shortcode_parser ) { |
|
285 | + public function additional_attendee_shortcodes($shortcodes, $shortcode_parser) { |
|
286 | 286 | $shortcodes['[ANSWER_*]'] = __('This is a special dynamic shortcode. Right after the "*", add the exact text of a existing question, and if there is an answer for that question for this registrant, that will take the place of this shortcode.', 'event_espresso'); |
287 | 287 | return $shortcodes; |
288 | 288 | } |
289 | 289 | |
290 | 290 | |
291 | 291 | |
292 | - public function additional_attendee_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
|
292 | + public function additional_attendee_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) { |
|
293 | 293 | |
294 | - if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) ) |
|
294 | + if (strpos($shortcode, '[ANSWER_*') === FALSE || ! isset($extra_data['data']->questions) || ! isset($extra_data['data']->registrations)) |
|
295 | 295 | return $parsed; |
296 | 296 | |
297 | 297 | //let's get the question from the code. |
298 | 298 | $shortcode = str_replace('[ANSWER_*', '', $shortcode); |
299 | - $shortcode = trim( str_replace(']', '', $shortcode) ); |
|
299 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
300 | 300 | |
301 | 301 | $registration = $data instanceof EE_Registration ? $data : null; |
302 | - $registration = ! $registration instanceof EE_Registration && is_array( $extra_data ) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration; |
|
302 | + $registration = ! $registration instanceof EE_Registration && is_array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration; |
|
303 | 303 | |
304 | 304 | $aee = $data instanceof EE_Messages_Addressee ? $data : null; |
305 | - $aee = ! $aee instanceof EE_Messages_Addressee && is_array( $extra_data ) && isset( $extra_data['data'] ) ? $extra_data['data'] : $aee; |
|
305 | + $aee = ! $aee instanceof EE_Messages_Addressee && is_array($extra_data) && isset($extra_data['data']) ? $extra_data['data'] : $aee; |
|
306 | 306 | |
307 | - if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee ) { |
|
307 | + if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee) { |
|
308 | 308 | return $parsed; |
309 | 309 | } |
310 | 310 | |
311 | 311 | //now let's figure out which question has this text. |
312 | - foreach ( $aee->questions as $ansid => $question ) { |
|
313 | - if ( $question instanceof EE_Question && $question->display_text() == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid]) ) { |
|
312 | + foreach ($aee->questions as $ansid => $question) { |
|
313 | + if ($question instanceof EE_Question && $question->display_text() == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid])) { |
|
314 | 314 | return $aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop'); |
315 | 315 | } |
316 | 316 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @return array array of shortcodes and |
333 | 333 | * descriptions |
334 | 334 | */ |
335 | - public function additional_datetime_shortcodes( $shortcodes, $shortcode_parser ) { |
|
335 | + public function additional_datetime_shortcodes($shortcodes, $shortcode_parser) { |
|
336 | 336 | $shortcodes['[DTT_NAME]'] = __('This will be parsed to the Title given for a Datetime', 'event_espresso'); |
337 | 337 | $shortcodes['[DTT_DESCRIPTION]'] = __('This will be parsed to the description for a Datetime', 'event_espresso'); |
338 | 338 | $shortcodes['[DTT_NAME_OR_DATES]'] = __('When parsed, if the Datetime has a name, it is used, otherwise a formatted string including the start date and end date will be used.', 'event_espresso'); |
@@ -354,13 +354,13 @@ discard block |
||
354 | 354 | * @param EE_Datetime_Shortcodes $shortcode_parser |
355 | 355 | * @return string The new parsed string. |
356 | 356 | */ |
357 | - public function additional_datetime_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
|
357 | + public function additional_datetime_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) { |
|
358 | 358 | |
359 | - if ( ! $data instanceof EE_Datetime ) { |
|
359 | + if ( ! $data instanceof EE_Datetime) { |
|
360 | 360 | return ''; //get out because we can only parse with the datetime object. |
361 | 361 | } |
362 | 362 | |
363 | - switch ( $shortcode ) { |
|
363 | + switch ($shortcode) { |
|
364 | 364 | case '[DTT_NAME]' : |
365 | 365 | return $data->name(); |
366 | 366 | break; |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | return $data->description(); |
369 | 369 | break; |
370 | 370 | case '[DTT_NAME_OR_DATES]' : |
371 | - return $data->get_dtt_display_name( TRUE ); |
|
371 | + return $data->get_dtt_display_name(TRUE); |
|
372 | 372 | break; |
373 | 373 | default : |
374 | 374 | return $parsed; |
@@ -380,40 +380,40 @@ discard block |
||
380 | 380 | |
381 | 381 | |
382 | 382 | |
383 | - public function additional_recipient_details_shortcodes( $shortcodes, $shortcode_parser ) { |
|
383 | + public function additional_recipient_details_shortcodes($shortcodes, $shortcode_parser) { |
|
384 | 384 | $shortcodes['[RECIPIENT_QUESTION_LIST]'] = __('This is used to indicate where you want the list of questions and answers to show for the person receiving the message.', 'event_espresso'); |
385 | 385 | return $shortcodes; |
386 | 386 | } |
387 | 387 | |
388 | 388 | |
389 | - public function additional_recipient_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
|
389 | + public function additional_recipient_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) { |
|
390 | 390 | |
391 | - if ( array($data) && ! isset( $data['data'] ) ) |
|
391 | + if (array($data) && ! isset($data['data'])) |
|
392 | 392 | return $parsed; |
393 | 393 | |
394 | 394 | $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL; |
395 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
395 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
396 | 396 | |
397 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
397 | + if ( ! $recipient instanceof EE_Messages_Addressee) |
|
398 | 398 | return $parsed; |
399 | 399 | |
400 | - switch ( $shortcode ) { |
|
400 | + switch ($shortcode) { |
|
401 | 401 | case '[RECIPIENT_QUESTION_LIST]' : |
402 | 402 | $att = $recipient->att_obj; |
403 | 403 | $registrations_on_attendee = $att instanceof EE_Attendee ? $recipient->attendees[$att->ID()]['reg_objs'] : array(); |
404 | - $registrations_on_attendee = empty( $registrations_on_attendee ) && $recipient->reg_obj instanceof EE_Registration ? array( $recipient->reg_obj ) : $registrations_on_attendee; |
|
404 | + $registrations_on_attendee = empty($registrations_on_attendee) && $recipient->reg_obj instanceof EE_Registration ? array($recipient->reg_obj) : $registrations_on_attendee; |
|
405 | 405 | $answers = array(); |
406 | 406 | |
407 | - $template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
407 | + $template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
408 | 408 | $valid_shortcodes = array('question'); |
409 | 409 | |
410 | 410 | //if the context is main_content then get all answers for all registrations on this attendee |
411 | - if ( $data['data'] instanceof EE_Messages_Addressee ) { |
|
412 | - foreach ( $registrations_on_attendee as $reg ) { |
|
413 | - if ( $reg instanceof EE_Registration ) { |
|
414 | - $anss = !empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array(); |
|
415 | - foreach( $anss as $ans ) { |
|
416 | - if ( $ans instanceof EE_Answer ) { |
|
411 | + if ($data['data'] instanceof EE_Messages_Addressee) { |
|
412 | + foreach ($registrations_on_attendee as $reg) { |
|
413 | + if ($reg instanceof EE_Registration) { |
|
414 | + $anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array(); |
|
415 | + foreach ($anss as $ans) { |
|
416 | + if ($ans instanceof EE_Answer) { |
|
417 | 417 | $answers[$ans->ID()] = $ans; |
418 | 418 | } |
419 | 419 | } |
@@ -422,13 +422,13 @@ discard block |
||
422 | 422 | } |
423 | 423 | |
424 | 424 | //if the context is the event list parser, then let's return just the answers for all registrations attached to the recipient for that event. |
425 | - if ( $data['data'] instanceof EE_Event ) { |
|
425 | + if ($data['data'] instanceof EE_Event) { |
|
426 | 426 | $event = $data['data']; |
427 | - foreach( $registrations_on_attendee as $reg ) { |
|
428 | - if ( $reg instanceof EE_Registration && $reg->event_ID() == $event->ID() ) { |
|
429 | - $anss = !empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array(); |
|
430 | - foreach( $anss as $ans ) { |
|
431 | - if ( $ans instanceof EE_Answer ) { |
|
427 | + foreach ($registrations_on_attendee as $reg) { |
|
428 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
429 | + $anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array(); |
|
430 | + foreach ($anss as $ans) { |
|
431 | + if ($ans instanceof EE_Answer) { |
|
432 | 432 | $answers[$ans->ID()] = $ans; |
433 | 433 | } |
434 | 434 | } |
@@ -438,13 +438,13 @@ discard block |
||
438 | 438 | |
439 | 439 | $question_list = ''; |
440 | 440 | $shortcode_helper = $shortcode_parser->get_shortcode_helper(); |
441 | - foreach ( $answers as $answer ) { |
|
442 | - if ( $answer instanceof EE_Answer ) { |
|
441 | + foreach ($answers as $answer) { |
|
442 | + if ($answer instanceof EE_Answer) { |
|
443 | 443 | $question = $answer->question(); |
444 | - if ( ! $question instanceof EE_Question || ( $question instanceof EE_Question && $question->admin_only() ) ) { |
|
444 | + if ( ! $question instanceof EE_Question || ($question instanceof EE_Question && $question->admin_only())) { |
|
445 | 445 | continue; |
446 | 446 | } |
447 | - $question_list .= $shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $extra_data); |
|
447 | + $question_list .= $shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $extra_data); |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | return $question_list; |
@@ -457,41 +457,41 @@ discard block |
||
457 | 457 | } |
458 | 458 | |
459 | 459 | |
460 | - public function additional_primary_registration_details_shortcodes( $shortcodes, $shortcode_parser ) { |
|
460 | + public function additional_primary_registration_details_shortcodes($shortcodes, $shortcode_parser) { |
|
461 | 461 | $shortcodes['[PRIMARY_REGISTRANT_QUESTION_LIST]'] = __('This is used to indicate the questions and answers for the primary_registrant. It should be placed in the "[attendee_list]" field', 'event_espresso'); |
462 | 462 | return $shortcodes; |
463 | 463 | } |
464 | 464 | |
465 | 465 | |
466 | - public function additional_primary_registration_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
|
467 | - if ( array($data) && ! isset( $data['data'] ) ) |
|
466 | + public function additional_primary_registration_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) { |
|
467 | + if (array($data) && ! isset($data['data'])) |
|
468 | 468 | return $parsed; |
469 | 469 | |
470 | 470 | $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL; |
471 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
471 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
472 | 472 | |
473 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
473 | + if ( ! $recipient instanceof EE_Messages_Addressee) |
|
474 | 474 | return $parsed; |
475 | 475 | |
476 | 476 | $send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data; |
477 | 477 | |
478 | - switch ( $shortcode ) { |
|
478 | + switch ($shortcode) { |
|
479 | 479 | case '[RECIPIENT_QUESTION_LIST]' : |
480 | - if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration ) |
|
480 | + if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration) |
|
481 | 481 | return ''; |
482 | 482 | $registration = $recipient->primary_reg_obj; |
483 | - $template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
483 | + $template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
484 | 484 | $valid_shortcodes = array('question'); |
485 | 485 | $shortcode_helper = $shortcode_parser->get_shortcode_helper(); |
486 | 486 | $answers = $recipient->registrations[$registration->ID()]['ans_objs']; |
487 | 487 | $question_list = ''; |
488 | - foreach ( $answers as $answer ) { |
|
489 | - if ( $answer instanceof EE_Answer ) { |
|
488 | + foreach ($answers as $answer) { |
|
489 | + if ($answer instanceof EE_Answer) { |
|
490 | 490 | $question = $answer->question(); |
491 | - if ( $question instanceof EE_Question and $question->admin_only() ) { |
|
491 | + if ($question instanceof EE_Question and $question->admin_only()) { |
|
492 | 492 | continue; |
493 | 493 | } |
494 | - $question_list .= $shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $send_data); |
|
494 | + $question_list .= $shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $send_data); |
|
495 | 495 | } |
496 | 496 | } |
497 | 497 | return $question_list; |
@@ -517,67 +517,67 @@ discard block |
||
517 | 517 | $setup_args = array( |
518 | 518 | 'mtfilename' => 'EE_Newsletter_message_type.class.php', |
519 | 519 | 'autoloadpaths' => array( |
520 | - EE_CAF_LIBRARIES . 'messages/message_type/newsletter/' |
|
520 | + EE_CAF_LIBRARIES.'messages/message_type/newsletter/' |
|
521 | 521 | ), |
522 | - 'messengers_to_activate_with' => array( 'email' ), |
|
523 | - 'messengers_to_validate_with' => array( 'email' ) |
|
522 | + 'messengers_to_activate_with' => array('email'), |
|
523 | + 'messengers_to_validate_with' => array('email') |
|
524 | 524 | ); |
525 | - EE_Register_Message_Type::register( 'newsletter', $setup_args ); |
|
525 | + EE_Register_Message_Type::register('newsletter', $setup_args); |
|
526 | 526 | |
527 | 527 | //register payment reminder message type |
528 | 528 | $setup_args = array( |
529 | 529 | 'mtfilename' => 'EE_Payment_Reminder_message_type.class.php', |
530 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_reminder/' ), |
|
531 | - 'messengers_to_activate_with' => array( 'email' ), |
|
532 | - 'messengers_to_validate_with' => array( 'email' ) |
|
530 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_reminder/'), |
|
531 | + 'messengers_to_activate_with' => array('email'), |
|
532 | + 'messengers_to_validate_with' => array('email') |
|
533 | 533 | ); |
534 | - EE_Register_Message_Type::register( 'payment_reminder', $setup_args ); |
|
534 | + EE_Register_Message_Type::register('payment_reminder', $setup_args); |
|
535 | 535 | |
536 | 536 | //register payment declined message type |
537 | 537 | $setup_args = array( |
538 | 538 | 'mtfilename' => 'EE_Payment_Declined_message_type.class.php', |
539 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_declined/' ), |
|
540 | - 'messengers_to_activate_with' => array( 'email' ), |
|
541 | - 'messengers_to_validate_with' => array( 'email' ) |
|
539 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_declined/'), |
|
540 | + 'messengers_to_activate_with' => array('email'), |
|
541 | + 'messengers_to_validate_with' => array('email') |
|
542 | 542 | ); |
543 | - EE_Register_Message_Type::register( 'payment_declined', $setup_args ); |
|
543 | + EE_Register_Message_Type::register('payment_declined', $setup_args); |
|
544 | 544 | |
545 | 545 | //register registration declined message type |
546 | 546 | $setup_args = array( |
547 | 547 | 'mtfilename' => 'EE_Declined_Registration_message_type.class.php', |
548 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/declined_registration/' ), |
|
549 | - 'messengers_to_activate_with' => array( 'email' ), |
|
550 | - 'messengers_to_validate_with' => array( 'email' ) |
|
548 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/declined_registration/'), |
|
549 | + 'messengers_to_activate_with' => array('email'), |
|
550 | + 'messengers_to_validate_with' => array('email') |
|
551 | 551 | ); |
552 | - EE_Register_Message_Type::register( 'declined_registration', $setup_args ); |
|
552 | + EE_Register_Message_Type::register('declined_registration', $setup_args); |
|
553 | 553 | |
554 | 554 | //register registration cancelled message type |
555 | 555 | $setup_args = array( |
556 | 556 | 'mtfilename' => 'EE_Cancelled_Registration_message_type.class.php', |
557 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/cancelled_registration/' ), |
|
558 | - 'messengers_to_activate_with' => array( 'email' ), |
|
559 | - 'messengers_to_validate_with' => array( 'email' ) |
|
557 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/cancelled_registration/'), |
|
558 | + 'messengers_to_activate_with' => array('email'), |
|
559 | + 'messengers_to_validate_with' => array('email') |
|
560 | 560 | ); |
561 | - EE_Register_Message_Type::register( 'cancelled_registration', $setup_args ); |
|
561 | + EE_Register_Message_Type::register('cancelled_registration', $setup_args); |
|
562 | 562 | |
563 | 563 | |
564 | 564 | //register payment failed message type |
565 | 565 | $setup_args = array( |
566 | 566 | 'mtfilename' => 'EE_Payment_Failed_message_type.class.php', |
567 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_failed/' ), |
|
568 | - 'messengers_to_activate_with' => array( 'email' ), |
|
569 | - 'messengers_to_validate_with' => array( 'email' ) |
|
567 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_failed/'), |
|
568 | + 'messengers_to_activate_with' => array('email'), |
|
569 | + 'messengers_to_validate_with' => array('email') |
|
570 | 570 | ); |
571 | - EE_Register_Message_Type::register( 'payment_failed', $setup_args ); |
|
571 | + EE_Register_Message_Type::register('payment_failed', $setup_args); |
|
572 | 572 | |
573 | 573 | //register payment declined message type |
574 | 574 | $setup_args = array( |
575 | 575 | 'mtfilename' => 'EE_Payment_Cancelled_message_type.class.php', |
576 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_cancelled/' ), |
|
577 | - 'messengers_to_activate_with' => array( 'email' ), |
|
578 | - 'messengers_to_validate_with' => array( 'email' ) |
|
576 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_cancelled/'), |
|
577 | + 'messengers_to_activate_with' => array('email'), |
|
578 | + 'messengers_to_validate_with' => array('email') |
|
579 | 579 | ); |
580 | - EE_Register_Message_Type::register( 'payment_cancelled', $setup_args ); |
|
580 | + EE_Register_Message_Type::register('payment_cancelled', $setup_args); |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | |
@@ -593,12 +593,12 @@ discard block |
||
593 | 593 | public function register_caf_shortcodes() { |
594 | 594 | $setup_args = array( |
595 | 595 | 'autoloadpaths' => array( |
596 | - EE_CAF_LIBRARIES . 'shortcodes/' |
|
596 | + EE_CAF_LIBRARIES.'shortcodes/' |
|
597 | 597 | ), |
598 | - 'msgr_validator_callback' => array( 'EE_Newsletter_Shortcodes', 'messenger_validator_config' ), |
|
599 | - 'msgr_template_fields_callback' => array( 'EE_Newsletter_Shortcodes', 'messenger_template_fields' ), |
|
600 | - 'list_type_shortcodes' => array( '[NEWSLETTER_CONTENT]' ) |
|
598 | + 'msgr_validator_callback' => array('EE_Newsletter_Shortcodes', 'messenger_validator_config'), |
|
599 | + 'msgr_template_fields_callback' => array('EE_Newsletter_Shortcodes', 'messenger_template_fields'), |
|
600 | + 'list_type_shortcodes' => array('[NEWSLETTER_CONTENT]') |
|
601 | 601 | ); |
602 | - EE_Register_Messages_Shortcode_Library::register( 'newsletter', $setup_args ); |
|
602 | + EE_Register_Messages_Shortcode_Library::register('newsletter', $setup_args); |
|
603 | 603 | } |
604 | 604 | } |
@@ -5,7 +5,9 @@ discard block |
||
5 | 5 | * @subpackage plugin api, messages |
6 | 6 | * @since 4.3.2 |
7 | 7 | */ |
8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | /** |
11 | 13 | * Used to initialize all EE messages caffeinated functionality. |
@@ -291,8 +293,9 @@ discard block |
||
291 | 293 | |
292 | 294 | public function additional_attendee_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
293 | 295 | |
294 | - if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) ) |
|
295 | - return $parsed; |
|
296 | + if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) ) { |
|
297 | + return $parsed; |
|
298 | + } |
|
296 | 299 | |
297 | 300 | //let's get the question from the code. |
298 | 301 | $shortcode = str_replace('[ANSWER_*', '', $shortcode); |
@@ -388,14 +391,16 @@ discard block |
||
388 | 391 | |
389 | 392 | public function additional_recipient_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
390 | 393 | |
391 | - if ( array($data) && ! isset( $data['data'] ) ) |
|
392 | - return $parsed; |
|
394 | + if ( array($data) && ! isset( $data['data'] ) ) { |
|
395 | + return $parsed; |
|
396 | + } |
|
393 | 397 | |
394 | 398 | $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL; |
395 | 399 | $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
396 | 400 | |
397 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
398 | - return $parsed; |
|
401 | + if ( ! $recipient instanceof EE_Messages_Addressee ) { |
|
402 | + return $parsed; |
|
403 | + } |
|
399 | 404 | |
400 | 405 | switch ( $shortcode ) { |
401 | 406 | case '[RECIPIENT_QUESTION_LIST]' : |
@@ -464,21 +469,24 @@ discard block |
||
464 | 469 | |
465 | 470 | |
466 | 471 | public function additional_primary_registration_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
467 | - if ( array($data) && ! isset( $data['data'] ) ) |
|
468 | - return $parsed; |
|
472 | + if ( array($data) && ! isset( $data['data'] ) ) { |
|
473 | + return $parsed; |
|
474 | + } |
|
469 | 475 | |
470 | 476 | $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL; |
471 | 477 | $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
472 | 478 | |
473 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
474 | - return $parsed; |
|
479 | + if ( ! $recipient instanceof EE_Messages_Addressee ) { |
|
480 | + return $parsed; |
|
481 | + } |
|
475 | 482 | |
476 | 483 | $send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data; |
477 | 484 | |
478 | 485 | switch ( $shortcode ) { |
479 | 486 | case '[RECIPIENT_QUESTION_LIST]' : |
480 | - if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration ) |
|
481 | - return ''; |
|
487 | + if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration ) { |
|
488 | + return ''; |
|
489 | + } |
|
482 | 490 | $registration = $recipient->primary_reg_obj; |
483 | 491 | $template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
484 | 492 | $valid_shortcodes = array('question'); |