@@ -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,8 +30,8 @@ discard block |
||
| 30 | 30 | class Support_Admin_Page extends EE_Admin_Page { |
| 31 | 31 | |
| 32 | 32 | |
| 33 | - public function __construct( $routing = TRUE ) { |
|
| 34 | - parent::__construct( $routing ); |
|
| 33 | + public function __construct($routing = TRUE) { |
|
| 34 | + parent::__construct($routing); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
@@ -124,8 +124,8 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | |
| 126 | 126 | protected function _installation() { |
| 127 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_installation.template.php'; |
|
| 128 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, '', TRUE); |
|
| 127 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_installation.template.php'; |
|
| 128 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, '', TRUE); |
|
| 129 | 129 | $this->display_admin_page_with_sidebar(); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -150,10 +150,10 @@ discard block |
||
| 150 | 150 | 'other_resources' => __('Other Resources', 'event_espresso') |
| 151 | 151 | ); |
| 152 | 152 | |
| 153 | - foreach ( $boxes as $box => $label ) { |
|
| 154 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
| 153 | + foreach ($boxes as $box => $label) { |
|
| 154 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
| 155 | 155 | $callback_args = array('template_path' => $template_path); |
| 156 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
| 156 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
@@ -178,10 +178,10 @@ discard block |
||
| 178 | 178 | /*'shortcodes_attendee_listings' => __('Attendee Listings', 'event_espresso'),*/ |
| 179 | 179 | ); |
| 180 | 180 | |
| 181 | - foreach ( $boxes as $box => $label ) { |
|
| 182 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
| 181 | + foreach ($boxes as $box => $label) { |
|
| 182 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
| 183 | 183 | $callback_args = array('template_path' => $template_path); |
| 184 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
| 184 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
@@ -200,10 +200,10 @@ discard block |
||
| 200 | 200 | 'important_information' => __('Important Information', 'event_espresso') |
| 201 | 201 | ); |
| 202 | 202 | |
| 203 | - foreach ( $boxes as $box => $label ) { |
|
| 204 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
| 203 | + foreach ($boxes as $box => $label) { |
|
| 204 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
| 205 | 205 | $callback_args = array('template_path' => $template_path, 'template_args' => $this->_template_args); |
| 206 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
| 206 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | |
@@ -1,6 +1,7 @@ |
||
| 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 |
@@ -1,22 +1,22 @@ |
||
| 1 | 1 | <div id="admin-side-mbox-billing-info-dv" class="admin-side-mbox-dv"> |
| 2 | -<?php if ( empty($billing_form) ) : ?> |
|
| 2 | +<?php if (empty($billing_form)) : ?> |
|
| 3 | 3 | <div class="clearfix"> |
| 4 | - <?php _e( 'There is no billing info for this transaction.', 'event_espresso' );?><br/> |
|
| 4 | + <?php _e('There is no billing info for this transaction.', 'event_espresso'); ?><br/> |
|
| 5 | 5 | </div> |
| 6 | 6 | <?php else : |
| 7 | - foreach ( $billing_form->inputs() as $form_input ) : |
|
| 7 | + foreach ($billing_form->inputs() as $form_input) : |
|
| 8 | 8 | /* @var $form_input EE_Form_Input_Base */ |
| 9 | - if( $form_input->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal || |
|
| 10 | - $form_input->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal ){ |
|
| 9 | + if ($form_input->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal || |
|
| 10 | + $form_input->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal) { |
|
| 11 | 11 | continue; |
| 12 | 12 | } |
| 13 | 13 | ?> |
| 14 | 14 | <div class="clearfix"> |
| 15 | - <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php echo $form_input->get_html_for_label();?></span><?php echo $form_input->pretty_value();?> |
|
| 15 | + <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php echo $form_input->get_html_for_label(); ?></span><?php echo $form_input->pretty_value(); ?> |
|
| 16 | 16 | </div> |
| 17 | 17 | |
| 18 | 18 | <?php endforeach; ?> |
| 19 | - <p class="help"><?php _e( 'Note: Card expiry dates and CCV are not stored. Only the last 4 digits of card numbers are stored.', 'event_espresso' );?></p> |
|
| 19 | + <p class="help"><?php _e('Note: Card expiry dates and CCV are not stored. Only the last 4 digits of card numbers are stored.', 'event_espresso'); ?></p> |
|
| 20 | 20 | <?php endif; ?> |
| 21 | 21 | |
| 22 | 22 | </div> |
@@ -3,12 +3,14 @@ |
||
| 3 | 3 | <div class="clearfix"> |
| 4 | 4 | <?php _e( 'There is no billing info for this transaction.', 'event_espresso' );?><br/> |
| 5 | 5 | </div> |
| 6 | -<?php else : |
|
| 6 | +<?php else { |
|
| 7 | + : |
|
| 7 | 8 | foreach ( $billing_form->inputs() as $form_input ) : |
| 8 | 9 | /* @var $form_input EE_Form_Input_Base */ |
| 9 | 10 | if( $form_input->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal || |
| 10 | 11 | $form_input->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal ){ |
| 11 | 12 | continue; |
| 13 | +} |
|
| 12 | 14 | } |
| 13 | 15 | ?> |
| 14 | 16 | <div class="clearfix"> |
@@ -1,36 +1,36 @@ |
||
| 1 | 1 | <div id="admin-side-mbox-primary-registrant-dv" class="admin-side-mbox-dv"> |
| 2 | -<?php if ( ! empty( $no_attendee_message ) ) : ?> |
|
| 2 | +<?php if ( ! empty($no_attendee_message)) : ?> |
|
| 3 | 3 | <p class="clearfix"> |
| 4 | 4 | <?php echo $no_attendee_message; ?> |
| 5 | 5 | </p> |
| 6 | 6 | </div> <!-- end #admin-side-mbox-primary-registrant-dv --> |
| 7 | 7 | <?php else : ?> |
| 8 | 8 | <p class="clearfix"> |
| 9 | - <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php _e( 'Name', 'event_espresso' );?></span><?php echo $prime_reg_fname . ' ' . $prime_reg_lname;?> |
|
| 9 | + <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php _e('Name', 'event_espresso'); ?></span><?php echo $prime_reg_fname.' '.$prime_reg_lname; ?> |
|
| 10 | 10 | </p> |
| 11 | 11 | <p class="clearfix"> |
| 12 | - <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php _e( 'Email', 'event_espresso' );?></span><a href="mailto:<?php echo $prime_reg_email;?>"><?php echo $prime_reg_email;?></a> |
|
| 12 | + <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php _e('Email', 'event_espresso'); ?></span><a href="mailto:<?php echo $prime_reg_email; ?>"><?php echo $prime_reg_email; ?></a> |
|
| 13 | 13 | </p> |
| 14 | 14 | <p class="clearfix"> |
| 15 | - <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php _e( 'Phone #', 'event_espresso' );?></span><?php echo $prime_reg_phone;?> |
|
| 15 | + <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php _e('Phone #', 'event_espresso'); ?></span><?php echo $prime_reg_phone; ?> |
|
| 16 | 16 | </p> |
| 17 | 17 | <p class="clearfix"> |
| 18 | - <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php _e( 'Address', 'event_espresso' );?></span> |
|
| 18 | + <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php _e('Address', 'event_espresso'); ?></span> |
|
| 19 | 19 | <div class="admin-side-mbox-text-dv"> |
| 20 | - <?php echo $prime_reg_address;?> |
|
| 21 | - <?php echo $prime_reg_address2;?> |
|
| 22 | - <?php echo $prime_reg_city;?> |
|
| 23 | - <?php echo $prime_reg_state . $prime_reg_country;?> |
|
| 24 | - <?php echo $prime_reg_zip;?> |
|
| 20 | + <?php echo $prime_reg_address; ?> |
|
| 21 | + <?php echo $prime_reg_address2; ?> |
|
| 22 | + <?php echo $prime_reg_city; ?> |
|
| 23 | + <?php echo $prime_reg_state.$prime_reg_country; ?> |
|
| 24 | + <?php echo $prime_reg_zip; ?> |
|
| 25 | 25 | </div> |
| 26 | 26 | </p> |
| 27 | 27 | </div> <!-- end #admin-side-mbox-primary-registrant-dv --> |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | <p style="text-align:right;"> |
| 31 | - <?php $att_link = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$ATT_ID ), REG_ADMIN_URL ); ?> |
|
| 32 | - <a class="button button-small" href="<?php echo $att_link; ?>" title="<?php esc_attr_e( 'View details for this contact.', 'event_espresso' );?>"> |
|
| 31 | + <?php $att_link = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$ATT_ID), REG_ADMIN_URL); ?> |
|
| 32 | + <a class="button button-small" href="<?php echo $att_link; ?>" title="<?php esc_attr_e('View details for this contact.', 'event_espresso'); ?>"> |
|
| 33 | 33 | <span class="ee-icon ee-icon-user-edit"></span><?php _e('View / Edit this Contact', 'event_espresso'); ?> |
| 34 | 34 | </a> |
| 35 | 35 | </p> |
| 36 | -<?php endif; //end no attendee check?> |
|
| 36 | +<?php endif; //end no attendee check?> |
|
@@ -4,9 +4,12 @@ |
||
| 4 | 4 | <?php echo $no_attendee_message; ?> |
| 5 | 5 | </p> |
| 6 | 6 | </div> <!-- end #admin-side-mbox-primary-registrant-dv --> |
| 7 | -<?php else : ?> |
|
| 7 | +<?php else { |
|
| 8 | + : ?> |
|
| 8 | 9 | <p class="clearfix"> |
| 9 | - <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php _e( 'Name', 'event_espresso' );?></span><?php echo $prime_reg_fname . ' ' . $prime_reg_lname;?> |
|
| 10 | + <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php _e( 'Name', 'event_espresso' ); |
|
| 11 | +} |
|
| 12 | +?></span><?php echo $prime_reg_fname . ' ' . $prime_reg_lname;?> |
|
| 10 | 13 | </p> |
| 11 | 14 | <p class="clearfix"> |
| 12 | 15 | <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php _e( 'Email', 'event_espresso' );?></span><a href="mailto:<?php echo $prime_reg_email;?>"><?php echo $prime_reg_email;?></a> |
@@ -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 | /** |
@@ -32,16 +32,16 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | |
| 35 | - public function __construct( $routing = TRUE ) { |
|
| 36 | - parent::__construct( $routing ); |
|
| 37 | - define( 'GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/' ); |
|
| 35 | + public function __construct($routing = TRUE) { |
|
| 36 | + parent::__construct($routing); |
|
| 37 | + define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'general_settings/templates/'); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | protected function _extend_page_config() { |
| 43 | 43 | |
| 44 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings'; |
|
| 44 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'general_settings'; |
|
| 45 | 45 | |
| 46 | 46 | $new_page_routes = array( |
| 47 | 47 | 'update_template_settings' => 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 | //template settings |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | 'label' => __('Templates'), |
| 70 | 70 | 'order' => 30 |
| 71 | 71 | ), |
| 72 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_espresso_links_post_box', '_espresso_sponsors_post_box' ), |
|
| 72 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_espresso_links_post_box', '_espresso_sponsors_post_box'), |
|
| 73 | 73 | 'help_tabs' => array( |
| 74 | 74 | 'general_settings_templates_help_tab' => array( |
| 75 | 75 | 'title' => __('Templates', 'event_espresso'), |
| 76 | 76 | 'filename' => 'general_settings_templates' |
| 77 | 77 | ) |
| 78 | 78 | ), |
| 79 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
| 79 | + 'help_tour' => array('Templates_Help_Tour'), |
|
| 80 | 80 | 'require_nonce' => FALSE |
| 81 | 81 | ), |
| 82 | 82 | 'google_map_settings' => array( |
@@ -84,32 +84,32 @@ discard block |
||
| 84 | 84 | 'label' => __('Google Maps'), |
| 85 | 85 | 'order' => 40 |
| 86 | 86 | ), |
| 87 | - 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_espresso_links_post_box', '_espresso_sponsors_post_box' ), |
|
| 87 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_espresso_links_post_box', '_espresso_sponsors_post_box'), |
|
| 88 | 88 | 'help_tabs' => array( |
| 89 | 89 | 'general_settings_google_maps_help_tab' => array( |
| 90 | 90 | 'title' => __('Google Maps', 'event_espresso'), |
| 91 | 91 | 'filename' => 'general_settings_google_maps' |
| 92 | 92 | ) |
| 93 | 93 | ), |
| 94 | - 'help_tour' => array( 'Google_Maps_Help_Tour' ), |
|
| 94 | + 'help_tour' => array('Google_Maps_Help_Tour'), |
|
| 95 | 95 | 'require_nonce' => FALSE |
| 96 | 96 | ) |
| 97 | 97 | ); |
| 98 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
| 98 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
| 99 | 99 | |
| 100 | 100 | //filters and action hooks here |
| 101 | - add_action('AHEE__admin_option_settings__template__before', array( $this, 'use_venue_and_staff_manager_settings'), 10 ); |
|
| 102 | - add_action( 'AHEE__admin_option_settings__template__before', array( $this, 'debug_logging_options' ), 9 ); |
|
| 103 | - add_filter( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', array( $this, 'update_debug_logging_options' ), 10, 1 ); |
|
| 101 | + add_action('AHEE__admin_option_settings__template__before', array($this, 'use_venue_and_staff_manager_settings'), 10); |
|
| 102 | + add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9); |
|
| 103 | + add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', array($this, 'update_debug_logging_options'), 10, 1); |
|
| 104 | 104 | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | |
| 109 | - public function use_venue_and_staff_manager_settings( $template_args ) { |
|
| 110 | - $_args['use_personnel_manager_select'] = EEH_Form_Fields::select_input('use_personnel_manager', $template_args['values'], $template_args['use_personnel_manager'] ); |
|
| 111 | - $template = GEN_SET_CAF_TEMPLATE_PATH . 'use_venue_and_staff_manager_settings.template.php'; |
|
| 112 | - EEH_Template::display_template( $template, $_args ); |
|
| 109 | + public function use_venue_and_staff_manager_settings($template_args) { |
|
| 110 | + $_args['use_personnel_manager_select'] = EEH_Form_Fields::select_input('use_personnel_manager', $template_args['values'], $template_args['use_personnel_manager']); |
|
| 111 | + $template = GEN_SET_CAF_TEMPLATE_PATH.'use_venue_and_staff_manager_settings.template.php'; |
|
| 112 | + EEH_Template::display_template($template, $_args); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | |
@@ -126,31 +126,31 @@ discard block |
||
| 126 | 126 | * @param bool $show_errors |
| 127 | 127 | * @return bool |
| 128 | 128 | */ |
| 129 | - protected function _request_filesystem_credentials( $show_errors = TRUE ) { |
|
| 130 | - |
|
| 131 | - require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
| 132 | - $url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'request_filesystem_credentials' ), $this->_admin_base_url ); |
|
| 133 | - $credentials = request_filesystem_credentials( $url ); |
|
| 134 | - if ( $credentials == FALSE ) { |
|
| 135 | - if ( $show_errors ) { |
|
| 136 | - EE_Error::get_notices( FALSE ); |
|
| 129 | + protected function _request_filesystem_credentials($show_errors = TRUE) { |
|
| 130 | + |
|
| 131 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
| 132 | + $url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'request_filesystem_credentials'), $this->_admin_base_url); |
|
| 133 | + $credentials = request_filesystem_credentials($url); |
|
| 134 | + if ($credentials == FALSE) { |
|
| 135 | + if ($show_errors) { |
|
| 136 | + EE_Error::get_notices(FALSE); |
|
| 137 | 137 | EE_Error::reset_notices(); |
| 138 | - EE_Error::add_error( __('Connection settings are missing or incorrect. Please verify that the connection settings below are correct.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 139 | - add_filter( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', '__return_false' ); |
|
| 138 | + EE_Error::add_error(__('Connection settings are missing or incorrect. Please verify that the connection settings below are correct.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 139 | + add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', '__return_false'); |
|
| 140 | 140 | } |
| 141 | 141 | return FALSE; |
| 142 | 142 | } |
| 143 | 143 | // now we have some credentials, try to get the wp_filesystem running |
| 144 | - $WP_Filesystem = WP_Filesystem( $credentials ); |
|
| 145 | - if ( ! $WP_Filesystem ) { |
|
| 146 | - if ( $show_errors ) { |
|
| 147 | - EE_Error::get_notices( FALSE ); |
|
| 144 | + $WP_Filesystem = WP_Filesystem($credentials); |
|
| 145 | + if ( ! $WP_Filesystem) { |
|
| 146 | + if ($show_errors) { |
|
| 147 | + EE_Error::get_notices(FALSE); |
|
| 148 | 148 | EE_Error::reset_notices(); |
| 149 | - EE_Error::add_error( __('There was an error connecting to the server. Please verify that the connection settings below are correct.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 150 | - add_filter( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', '__return_false' ); |
|
| 149 | + EE_Error::add_error(__('There was an error connecting to the server. Please verify that the connection settings below are correct.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 150 | + add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', '__return_false'); |
|
| 151 | 151 | } |
| 152 | 152 | // our credentials were no good, ask the user for them again |
| 153 | - request_filesystem_credentials( $url ); |
|
| 153 | + request_filesystem_credentials($url); |
|
| 154 | 154 | return FALSE; |
| 155 | 155 | } |
| 156 | 156 | EE_Registry::instance()->CFG->admin->use_full_logging = TRUE; |
@@ -165,21 +165,21 @@ discard block |
||
| 165 | 165 | * @param array $template_args |
| 166 | 166 | * @return void |
| 167 | 167 | */ |
| 168 | - public function debug_logging_options( $template_args = array() ) { |
|
| 169 | - if ( EE_Registry::instance()->CFG->admin->use_full_logging === NULL ) { |
|
| 170 | - $this->_request_filesystem_credentials( FALSE ); |
|
| 168 | + public function debug_logging_options($template_args = array()) { |
|
| 169 | + if (EE_Registry::instance()->CFG->admin->use_full_logging === NULL) { |
|
| 170 | + $this->_request_filesystem_credentials(FALSE); |
|
| 171 | 171 | $template_args['use_full_logging'] = TRUE; |
| 172 | - EE_Error::get_notices( FALSE ); |
|
| 172 | + EE_Error::get_notices(FALSE); |
|
| 173 | 173 | EE_Error::reset_notices(); |
| 174 | - EE_Error::add_attention( __('In order to enable Full Logging, the connection settings below are required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 174 | + EE_Error::add_attention(__('In order to enable Full Logging, the connection settings below are required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 175 | 175 | echo EE_Error::get_notices(); |
| 176 | 176 | } else { |
| 177 | 177 | $template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging; |
| 178 | 178 | } |
| 179 | - $template_args['use_remote_logging'] = isset( EE_Registry::instance()->CFG->admin->use_remote_logging ) ? absint( EE_Registry::instance()->CFG->admin->use_remote_logging ) : FALSE; |
|
| 180 | - $template_args['remote_logging_url'] = isset( EE_Registry::instance()->CFG->admin->remote_logging_url ) && ! empty( EE_Registry::instance()->CFG->admin->remote_logging_url ) ? stripslashes( EE_Registry::instance()->CFG->admin->remote_logging_url ) : ''; |
|
| 181 | - $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php'; |
|
| 182 | - EEH_Template::display_template( $template, $template_args ); |
|
| 179 | + $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : FALSE; |
|
| 180 | + $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : ''; |
|
| 181 | + $template = GEN_SET_CAF_TEMPLATE_PATH.'debug_log_settings.template.php'; |
|
| 182 | + EEH_Template::display_template($template, $template_args); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | |
@@ -190,24 +190,24 @@ discard block |
||
| 190 | 190 | * @param array $admin_options |
| 191 | 191 | * @return array |
| 192 | 192 | */ |
| 193 | - public function update_debug_logging_options( $admin_options = array() ) { |
|
| 194 | - $use_full_logging = isset( $this->_req_data['use_full_logging'] ) ? (bool)absint( $this->_req_data['use_full_logging'] ) : $admin_options->use_full_logging; |
|
| 193 | + public function update_debug_logging_options($admin_options = array()) { |
|
| 194 | + $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool) absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; |
|
| 195 | 195 | // trying to enable full logging for the first time? |
| 196 | - if ( $use_full_logging && $use_full_logging !== $admin_options->use_full_logging ) { |
|
| 196 | + if ($use_full_logging && $use_full_logging !== $admin_options->use_full_logging) { |
|
| 197 | 197 | $admin_options->use_full_logging = $this->_request_filesystem_credentials() ? TRUE : NULL; |
| 198 | - if ( $admin_options->use_full_logging === NULL ) { |
|
| 199 | - add_filter( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', '__return_false' ); |
|
| 198 | + if ($admin_options->use_full_logging === NULL) { |
|
| 199 | + add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', '__return_false'); |
|
| 200 | 200 | } |
| 201 | 201 | } else { |
| 202 | 202 | $admin_options->use_full_logging = $use_full_logging; |
| 203 | 203 | } |
| 204 | - if ( $use_full_logging === FALSE ) { |
|
| 205 | - EE_Error::get_notices( FALSE ); |
|
| 204 | + if ($use_full_logging === FALSE) { |
|
| 205 | + EE_Error::get_notices(FALSE); |
|
| 206 | 206 | EE_Error::reset_notices(); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - $admin_options->use_remote_logging = isset( $this->_req_data['use_remote_logging'] ) ? absint( $this->_req_data['use_remote_logging'] ) : $admin_options->use_remote_logging; |
|
| 210 | - $admin_options->remote_logging_url = isset( $this->_req_data['remote_logging_url'] ) ? esc_url_raw( $this->_req_data['remote_logging_url'] ) : $admin_options->remote_logging_url; |
|
| 209 | + $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging; |
|
| 210 | + $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url; |
|
| 211 | 211 | return $admin_options; |
| 212 | 212 | } |
| 213 | 213 | |
@@ -218,10 +218,10 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | protected function _template_settings() { |
| 220 | 220 | $this->_template_args['values'] = $this->_yes_no_values; |
| 221 | - $this->_template_args = apply_filters( 'FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args ); |
|
| 222 | - $this->_set_add_edit_form_tags( 'update_template_settings' ); |
|
| 223 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
| 224 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_CAF_TEMPLATE_PATH . 'template_settings.template.php', $this->_template_args, TRUE ); |
|
| 221 | + $this->_template_args = apply_filters('FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args); |
|
| 222 | + $this->_set_add_edit_form_tags('update_template_settings'); |
|
| 223 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
| 224 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_CAF_TEMPLATE_PATH.'template_settings.template.php', $this->_template_args, TRUE); |
|
| 225 | 225 | $this->display_admin_page_with_sidebar(); |
| 226 | 226 | } |
| 227 | 227 | |
@@ -229,11 +229,11 @@ discard block |
||
| 229 | 229 | |
| 230 | 230 | protected function _update_template_settings() { |
| 231 | 231 | |
| 232 | - EE_Registry::instance()->CFG->template_settings = apply_filters( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data ); |
|
| 232 | + EE_Registry::instance()->CFG->template_settings = apply_filters('FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data); |
|
| 233 | 233 | |
| 234 | 234 | $what = 'Template Settings'; |
| 235 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 236 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'template_settings' ) ); |
|
| 235 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__); |
|
| 236 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'template_settings')); |
|
| 237 | 237 | |
| 238 | 238 | } |
| 239 | 239 | |
@@ -249,115 +249,115 @@ discard block |
||
| 249 | 249 | $default_map_settings = new stdClass(); |
| 250 | 250 | $default_map_settings->use_google_maps = TRUE; |
| 251 | 251 | // for event details pages (reg page) |
| 252 | - $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
| 253 | - $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
| 254 | - $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
| 255 | - $default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
| 256 | - $default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
| 257 | - $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
| 258 | - $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
| 252 | + $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
| 253 | + $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
| 254 | + $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
| 255 | + $default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
| 256 | + $default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
| 257 | + $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
| 258 | + $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
| 259 | 259 | // for event list pages |
| 260 | - $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
| 261 | - $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
| 262 | - $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
| 263 | - $default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display |
|
| 264 | - $default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size |
|
| 265 | - $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
| 266 | - $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
| 260 | + $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
| 261 | + $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
| 262 | + $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
| 263 | + $default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display |
|
| 264 | + $default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size |
|
| 265 | + $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
| 266 | + $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
| 267 | 267 | |
| 268 | 268 | $this->_template_args['map_settings'] = |
| 269 | - isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings ) |
|
| 270 | - ? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings ) |
|
| 269 | + isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
| 270 | + ? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings) |
|
| 271 | 271 | : $default_map_settings; |
| 272 | 272 | |
| 273 | - $this->_set_add_edit_form_tags( 'update_google_map_settings' ); |
|
| 274 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
| 275 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_CAF_TEMPLATE_PATH . 'google_map.template.php', $this->_template_args, TRUE ); |
|
| 273 | + $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
| 274 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
| 275 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_CAF_TEMPLATE_PATH.'google_map.template.php', $this->_template_args, TRUE); |
|
| 276 | 276 | $this->display_admin_page_with_sidebar(); |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | protected function _update_google_map_settings() { |
| 280 | 280 | |
| 281 | 281 | EE_Registry::instance()->CFG->map_settings->use_google_maps = |
| 282 | - isset( $this->_req_data['use_google_maps'] ) |
|
| 283 | - ? absint( $this->_req_data['use_google_maps'] ) |
|
| 282 | + isset($this->_req_data['use_google_maps']) |
|
| 283 | + ? absint($this->_req_data['use_google_maps']) |
|
| 284 | 284 | : EE_Registry::instance()->CFG->map_settings->use_google_maps; |
| 285 | 285 | |
| 286 | 286 | EE_Registry::instance()->CFG->map_settings->event_details_map_width = |
| 287 | - isset( $this->_req_data['event_details_map_width'] ) |
|
| 288 | - ? absint( $this->_req_data['event_details_map_width'] ) |
|
| 287 | + isset($this->_req_data['event_details_map_width']) |
|
| 288 | + ? absint($this->_req_data['event_details_map_width']) |
|
| 289 | 289 | : EE_Registry::instance()->CFG->map_settings->event_details_map_width; |
| 290 | 290 | |
| 291 | 291 | EE_Registry::instance()->CFG->map_settings->event_details_map_height = |
| 292 | - isset( $this->_req_data['event_details_map_height'] ) |
|
| 293 | - ? absint( $this->_req_data['event_details_map_height'] ) |
|
| 292 | + isset($this->_req_data['event_details_map_height']) |
|
| 293 | + ? absint($this->_req_data['event_details_map_height']) |
|
| 294 | 294 | : EE_Registry::instance()->CFG->map_settings->event_details_map_height; |
| 295 | 295 | |
| 296 | 296 | EE_Registry::instance()->CFG->map_settings->event_details_map_zoom = |
| 297 | - isset( $this->_req_data['event_details_map_zoom'] ) |
|
| 298 | - ? absint( $this->_req_data['event_details_map_zoom'] ) |
|
| 297 | + isset($this->_req_data['event_details_map_zoom']) |
|
| 298 | + ? absint($this->_req_data['event_details_map_zoom']) |
|
| 299 | 299 | : EE_Registry::instance()->CFG->map_settings->event_details_map_zoom; |
| 300 | 300 | |
| 301 | 301 | EE_Registry::instance()->CFG->map_settings->event_details_display_nav = |
| 302 | - isset( $this->_req_data['event_details_display_nav'] ) |
|
| 303 | - ? absint( $this->_req_data['event_details_display_nav'] ) |
|
| 302 | + isset($this->_req_data['event_details_display_nav']) |
|
| 303 | + ? absint($this->_req_data['event_details_display_nav']) |
|
| 304 | 304 | : EE_Registry::instance()->CFG->map_settings->event_details_display_nav; |
| 305 | 305 | |
| 306 | 306 | EE_Registry::instance()->CFG->map_settings->event_details_nav_size = |
| 307 | - isset( $this->_req_data['event_details_nav_size'] ) |
|
| 308 | - ? absint( $this->_req_data['event_details_nav_size'] ) |
|
| 307 | + isset($this->_req_data['event_details_nav_size']) |
|
| 308 | + ? absint($this->_req_data['event_details_nav_size']) |
|
| 309 | 309 | : EE_Registry::instance()->CFG->map_settings->event_details_nav_size; |
| 310 | 310 | |
| 311 | 311 | EE_Registry::instance()->CFG->map_settings->event_details_control_type = |
| 312 | - isset( $this->_req_data['event_details_control_type'] ) |
|
| 313 | - ? sanitize_text_field( $this->_req_data['event_details_control_type'] ) |
|
| 312 | + isset($this->_req_data['event_details_control_type']) |
|
| 313 | + ? sanitize_text_field($this->_req_data['event_details_control_type']) |
|
| 314 | 314 | : EE_Registry::instance()->CFG->map_settings->event_details_control_type; |
| 315 | 315 | |
| 316 | 316 | EE_Registry::instance()->CFG->map_settings->event_details_map_align = |
| 317 | - isset( $this->_req_data['event_details_map_align'] ) |
|
| 318 | - ? sanitize_text_field( $this->_req_data['event_details_map_align'] ) |
|
| 317 | + isset($this->_req_data['event_details_map_align']) |
|
| 318 | + ? sanitize_text_field($this->_req_data['event_details_map_align']) |
|
| 319 | 319 | : EE_Registry::instance()->CFG->map_settings->event_details_map_align; |
| 320 | 320 | |
| 321 | 321 | EE_Registry::instance()->CFG->map_settings->event_list_map_width = |
| 322 | - isset( $this->_req_data['event_list_map_width'] ) |
|
| 323 | - ? absint( $this->_req_data['event_list_map_width'] ) |
|
| 322 | + isset($this->_req_data['event_list_map_width']) |
|
| 323 | + ? absint($this->_req_data['event_list_map_width']) |
|
| 324 | 324 | : EE_Registry::instance()->CFG->map_settings->event_list_map_width; |
| 325 | 325 | |
| 326 | 326 | EE_Registry::instance()->CFG->map_settings->event_list_map_height = |
| 327 | - isset( $this->_req_data['event_list_map_height'] ) |
|
| 328 | - ? absint( $this->_req_data['event_list_map_height'] ) |
|
| 327 | + isset($this->_req_data['event_list_map_height']) |
|
| 328 | + ? absint($this->_req_data['event_list_map_height']) |
|
| 329 | 329 | : EE_Registry::instance()->CFG->map_settings->event_list_map_height; |
| 330 | 330 | |
| 331 | 331 | EE_Registry::instance()->CFG->map_settings->event_list_map_zoom = |
| 332 | - isset( $this->_req_data['event_list_map_zoom'] ) |
|
| 333 | - ? absint( $this->_req_data['event_list_map_zoom'] ) |
|
| 332 | + isset($this->_req_data['event_list_map_zoom']) |
|
| 333 | + ? absint($this->_req_data['event_list_map_zoom']) |
|
| 334 | 334 | : EE_Registry::instance()->CFG->map_settings->event_list_map_zoom; |
| 335 | 335 | |
| 336 | 336 | EE_Registry::instance()->CFG->map_settings->event_list_display_nav = |
| 337 | - isset( $this->_req_data['event_list_display_nav'] ) |
|
| 338 | - ? absint( $this->_req_data['event_list_display_nav'] ) |
|
| 337 | + isset($this->_req_data['event_list_display_nav']) |
|
| 338 | + ? absint($this->_req_data['event_list_display_nav']) |
|
| 339 | 339 | : EE_Registry::instance()->CFG->map_settings->event_list_display_nav; |
| 340 | 340 | |
| 341 | 341 | EE_Registry::instance()->CFG->map_settings->event_list_nav_size = |
| 342 | - isset( $this->_req_data['event_list_nav_size'] ) |
|
| 343 | - ? absint( $this->_req_data['event_list_nav_size'] ) |
|
| 342 | + isset($this->_req_data['event_list_nav_size']) |
|
| 343 | + ? absint($this->_req_data['event_list_nav_size']) |
|
| 344 | 344 | : EE_Registry::instance()->CFG->map_settings->event_list_nav_size; |
| 345 | 345 | |
| 346 | 346 | EE_Registry::instance()->CFG->map_settings->event_list_control_type = |
| 347 | - isset( $this->_req_data['event_list_control_type'] ) |
|
| 348 | - ? sanitize_text_field( $this->_req_data['event_list_control_type'] ) |
|
| 347 | + isset($this->_req_data['event_list_control_type']) |
|
| 348 | + ? sanitize_text_field($this->_req_data['event_list_control_type']) |
|
| 349 | 349 | : EE_Registry::instance()->CFG->map_settings->event_list_control_type; |
| 350 | 350 | |
| 351 | 351 | EE_Registry::instance()->CFG->map_settings->event_list_map_align = |
| 352 | - isset( $this->_req_data['event_list_map_align'] ) |
|
| 353 | - ? sanitize_text_field( $this->_req_data['event_list_map_align'] ) |
|
| 352 | + isset($this->_req_data['event_list_map_align']) |
|
| 353 | + ? sanitize_text_field($this->_req_data['event_list_map_align']) |
|
| 354 | 354 | : EE_Registry::instance()->CFG->map_settings->event_list_map_align; |
| 355 | 355 | |
| 356 | - EE_Registry::instance()->CFG->map_settings = apply_filters( 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings ); |
|
| 356 | + EE_Registry::instance()->CFG->map_settings = apply_filters('FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings); |
|
| 357 | 357 | |
| 358 | 358 | $what = 'Google Map Settings'; |
| 359 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 360 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) ); |
|
| 359 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__); |
|
| 360 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings')); |
|
| 361 | 361 | |
| 362 | 362 | } |
| 363 | 363 | |
@@ -1,6 +1,7 @@ |
||
| 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 |
@@ -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 | /** |
@@ -125,46 +125,46 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | |
| 127 | 127 | protected function _start() { |
| 128 | - $content = '<h3>' . __('Questions Overview', 'event_espresso') . '</h3>'; |
|
| 129 | - $content .= '<p>' . __('This tour of the Questions Overview page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>'; |
|
| 128 | + $content = '<h3>'.__('Questions Overview', 'event_espresso').'</h3>'; |
|
| 129 | + $content .= '<p>'.__('This tour of the Questions Overview page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>'; |
|
| 130 | 130 | |
| 131 | 131 | return $content; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | protected function _question_id_stop() { |
| 135 | - return '<p>' . __('View the question ID. Can be sorted in ascending or descending order.', 'event_espresso') . '</p>'; |
|
| 135 | + return '<p>'.__('View the question ID. Can be sorted in ascending or descending order.', 'event_espresso').'</p>'; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | protected function _display_text_stop() { |
| 139 | - return '<p>' . __('View available questions. You can reorder your questions by dragging and dropping them.', 'event_espresso') . '</p>'; |
|
| 139 | + return '<p>'.__('View available questions. You can reorder your questions by dragging and dropping them.', 'event_espresso').'</p>'; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | protected function _admin_label_stop() { |
| 143 | - return '<p>' . __('View the admin label for your questions.', 'event_espresso') . '</p>'; |
|
| 143 | + return '<p>'.__('View the admin label for your questions.', 'event_espresso').'</p>'; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | protected function _type_stop() { |
| 147 | - return '<p>' . __('View the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', 'event_espresso') . '</p>'; |
|
| 147 | + return '<p>'.__('View the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', 'event_espresso').'</p>'; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | protected function _values_stop() { |
| 151 | - return '<p>' . __('View stored values for checkboxes, radio buttons, and select boxes.', 'event_espresso') . '</p>'; |
|
| 151 | + return '<p>'.__('View stored values for checkboxes, radio buttons, and select boxes.', 'event_espresso').'</p>'; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | protected function _required_stop() { |
| 155 | - return '<p>' . __('View if a question is required.', 'event_espresso') . '</p>'; |
|
| 155 | + return '<p>'.__('View if a question is required.', 'event_espresso').'</p>'; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | protected function _bulk_actions_stop() { |
| 159 | - return '<p>' . __('Perform bulk actions to multiple questions.', 'event_espresso') . '</p>'; |
|
| 159 | + return '<p>'.__('Perform bulk actions to multiple questions.', 'event_espresso').'</p>'; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | protected function _search_stop() { |
| 163 | - return '<p>' . __('Search through questions. The following sources will be searched: Name of Question (display text).', 'event_espresso') . '</p>'; |
|
| 163 | + return '<p>'.__('Search through questions. The following sources will be searched: Name of Question (display text).', 'event_espresso').'</p>'; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | protected function _add_new_question_stop() { |
| 167 | - return '<p>' . __('Click here to add a new question.', 'event_espresso') . '</p>'; |
|
| 167 | + return '<p>'.__('Click here to add a new question.', 'event_espresso').'</p>'; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | } |
| 171 | 171 | \ No newline at end of file |
@@ -1,6 +1,7 @@ |
||
| 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 |
@@ -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 | /** |
@@ -36,24 +36,24 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | private function _do_hooks() { |
| 39 | - add_filter('FHEE_show_sponsors_meta_box', create_function('$show_sponsors', 'return FALSE;' ), 10 ); |
|
| 40 | - add_filter('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array( $this, 'forums_lazy_loading'), 10 ); |
|
| 41 | - add_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content', array( $this, 'extra_news_box_content' ), 10 ); |
|
| 39 | + add_filter('FHEE_show_sponsors_meta_box', create_function('$show_sponsors', 'return FALSE;'), 10); |
|
| 40 | + add_filter('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array($this, 'forums_lazy_loading'), 10); |
|
| 41 | + add_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content', array($this, 'extra_news_box_content'), 10); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | |
| 47 | - public function extra_news_box_content( $content ) { |
|
| 48 | - echo '<h4 style="margin:0">' . __('From the Forums', 'event_espresso') . '</h4>'; |
|
| 47 | + public function extra_news_box_content($content) { |
|
| 48 | + echo '<h4 style="margin:0">'.__('From the Forums', 'event_espresso').'</h4>'; |
|
| 49 | 49 | echo '<div id="ee_forum_posts_content">'; |
| 50 | 50 | $url = 'http://eventespresso.com/forum/event-espresso-support/feed/'; |
| 51 | - EE_Admin_Page::cached_rss_display( 'ee_forum_posts_content', $url); |
|
| 51 | + EE_Admin_Page::cached_rss_display('ee_forum_posts_content', $url); |
|
| 52 | 52 | echo '</div>'; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
| 56 | - public function forums_lazy_loading( $ids ) { |
|
| 56 | + public function forums_lazy_loading($ids) { |
|
| 57 | 57 | $ids[] = 'ee_forum_posts_content'; |
| 58 | 58 | return $ids; |
| 59 | 59 | } |
@@ -1,6 +1,7 @@ |
||
| 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 |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 4 | 4 | exit('NO direct script access allowed'); |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -57,37 +57,37 @@ discard block |
||
| 57 | 57 | * @param string $shortcode the shortcode to be parsed. |
| 58 | 58 | * @return string parsed shortcode |
| 59 | 59 | */ |
| 60 | - protected function _parser( $shortcode ) { |
|
| 60 | + protected function _parser($shortcode) { |
|
| 61 | 61 | |
| 62 | - if ( ! $this->_data instanceof EE_Answer || !isset( $this->_extra_data['data'] ) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee ) { |
|
| 62 | + if ( ! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
| 63 | 63 | return ''; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - switch ( $shortcode ) { |
|
| 66 | + switch ($shortcode) { |
|
| 67 | 67 | |
| 68 | 68 | case '[QUESTION]' : |
| 69 | - if ( isset( $this->_extra_data['data']->questions[ $this->_data->ID() ] )) { |
|
| 70 | - return $this->_extra_data['data']->questions[ $this->_data->ID() ]->get_pretty('QST_display_text', 'no_wpautop'); |
|
| 69 | + if (isset($this->_extra_data['data']->questions[$this->_data->ID()])) { |
|
| 70 | + return $this->_extra_data['data']->questions[$this->_data->ID()]->get_pretty('QST_display_text', 'no_wpautop'); |
|
| 71 | 71 | } |
| 72 | 72 | break; |
| 73 | 73 | |
| 74 | 74 | case '[ANSWER]' : |
| 75 | 75 | //need to get the question to determine the type of question (some questions require translation of the answer). |
| 76 | - $question = isset( $this->_extra_data['data']->questions[$this->_data->ID()] ) ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question(); |
|
| 77 | - if ( ! $question instanceof EE_Question ) { |
|
| 76 | + $question = isset($this->_extra_data['data']->questions[$this->_data->ID()]) ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question(); |
|
| 77 | + if ( ! $question instanceof EE_Question) { |
|
| 78 | 78 | return ''; //get out cause we can't figure out what the question type is! |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | //what we show for the answer depends on the question type! |
| 82 | - switch ( $question->get( 'QST_type' ) ) { |
|
| 82 | + switch ($question->get('QST_type')) { |
|
| 83 | 83 | |
| 84 | 84 | case 'STATE' : |
| 85 | - $state = EEM_State::instance()->get_one_by_ID( $this->_data->get('ANS_value') ); |
|
| 85 | + $state = EEM_State::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
| 86 | 86 | $answer = $state instanceof EE_State ? $state->name() : ''; |
| 87 | 87 | break; |
| 88 | 88 | |
| 89 | 89 | case 'COUNTRY' : |
| 90 | - $country = EEM_Country::instance()->get_one_by_ID( $this->_data->get( 'ANS_value') ); |
|
| 90 | + $country = EEM_Country::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
| 91 | 91 | $answer = $country instanceof EE_Country ? $country->name() : ''; |
| 92 | 92 | break; |
| 93 | 93 | |
@@ -1,6 +1,7 @@ |
||
| 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 |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 4 | 4 | exit('No direct script access allowed'); |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * ------------------------------------------------------------------------ |
| 27 | 27 | */ |
| 28 | -class EEG_Paypal_Pro extends EE_Onsite_Gateway{ |
|
| 28 | +class EEG_Paypal_Pro extends EE_Onsite_Gateway { |
|
| 29 | 29 | /** |
| 30 | 30 | * |
| 31 | 31 | * @var $_paypal_api_username string |
@@ -85,21 +85,21 @@ discard block |
||
| 85 | 85 | * @type $cvv string |
| 86 | 86 | * } @see parent::do_direct_payment for more info |
| 87 | 87 | */ |
| 88 | - public function do_direct_payment($payment,$billing_info = null){ |
|
| 88 | + public function do_direct_payment($payment, $billing_info = null) { |
|
| 89 | 89 | $transaction = $payment->transaction(); |
| 90 | 90 | $primary_registrant = $transaction->primary_registration(); |
| 91 | - $order_description = sprintf(__("'Event Registrations from %s", "event_espresso"),get_bloginfo('name')); |
|
| 91 | + $order_description = sprintf(__("'Event Registrations from %s", "event_espresso"), get_bloginfo('name')); |
|
| 92 | 92 | //charge for the full amount. Show itemized list |
| 93 | - if( $this->_can_easily_itemize_transaction_for( $payment ) ){ |
|
| 93 | + if ($this->_can_easily_itemize_transaction_for($payment)) { |
|
| 94 | 94 | $item_num = 1; |
| 95 | 95 | $total_line_item = $transaction->total_line_item(); |
| 96 | 96 | $order_items = array(); |
| 97 | 97 | foreach ($total_line_item->get_items() as $line_item) { |
| 98 | 98 | $item = array( |
| 99 | 99 | // Item Name. 127 char max. |
| 100 | - 'l_name' => substr($line_item->name(),0,127), |
|
| 100 | + 'l_name' => substr($line_item->name(), 0, 127), |
|
| 101 | 101 | // Item description. 127 char max. |
| 102 | - 'l_desc' => substr($line_item->desc(),0,127), |
|
| 102 | + 'l_desc' => substr($line_item->desc(), 0, 127), |
|
| 103 | 103 | // Cost of individual item. |
| 104 | 104 | 'l_amt' => $line_item->unit_price(), |
| 105 | 105 | // Item Number. 127 char max. |
@@ -120,14 +120,14 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | $item_amount = $total_line_item->get_items_total(); |
| 122 | 122 | $tax_amount = $total_line_item->get_total_tax(); |
| 123 | - }else{ |
|
| 123 | + } else { |
|
| 124 | 124 | $order_items = array(); |
| 125 | 125 | $item_amount = $payment->amount(); |
| 126 | - $single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
|
| 126 | + $single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code()); |
|
| 127 | 127 | $tax_amount = 0; |
| 128 | - array_push($order_items,array( |
|
| 128 | + array_push($order_items, array( |
|
| 129 | 129 | // Item Name. 127 char max. |
| 130 | - 'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'),$primary_registrant->reg_code()), |
|
| 130 | + 'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'), $primary_registrant->reg_code()), |
|
| 131 | 131 | // Item description. 127 char max. |
| 132 | 132 | 'l_desc' => $single_item_desc, |
| 133 | 133 | // Cost of individual item. |
@@ -174,11 +174,11 @@ discard block |
||
| 174 | 174 | // Payer's salutation. 20 char max. |
| 175 | 175 | 'salutation' => '', |
| 176 | 176 | // Payer's first name. 25 char max. |
| 177 | - 'firstname' => substr($billing_info['first_name'],0,25), |
|
| 177 | + 'firstname' => substr($billing_info['first_name'], 0, 25), |
|
| 178 | 178 | // Payer's middle name. 25 char max. |
| 179 | 179 | 'middlename' => '', |
| 180 | 180 | // Payer's last name. 25 char max. |
| 181 | - 'lastname' => substr($billing_info['last_name'],0,25), |
|
| 181 | + 'lastname' => substr($billing_info['last_name'], 0, 25), |
|
| 182 | 182 | // Payer's suffix. 12 char max. |
| 183 | 183 | 'suffix' => '' |
| 184 | 184 | ); |
@@ -191,13 +191,13 @@ discard block |
||
| 191 | 191 | // Required. Name of City. |
| 192 | 192 | 'city' => $billing_info['city'], |
| 193 | 193 | // Required. Name of State or Province. |
| 194 | - 'state' => substr( $billing_info['state'], 0, 40 ), |
|
| 194 | + 'state' => substr($billing_info['state'], 0, 40), |
|
| 195 | 195 | // Required. Country code. |
| 196 | 196 | 'countrycode' => $billing_info['country'], |
| 197 | 197 | // Required. Postal code of payer. |
| 198 | 198 | 'zip' => $billing_info['zip'], |
| 199 | 199 | // Phone Number of payer. 20 char max. |
| 200 | - 'shiptophonenum' => substr($billing_info['phone'],0,20) |
|
| 200 | + 'shiptophonenum' => substr($billing_info['phone'], 0, 20) |
|
| 201 | 201 | ); |
| 202 | 202 | |
| 203 | 203 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | // Required. Three-letter currency code. Default is USD. |
| 208 | 208 | 'currencycode' => $payment->currency_code(), |
| 209 | 209 | // Required if you include itemized cart details. (L_AMTn, etc.) Subtotal of items not including S&H, or tax. |
| 210 | - 'itemamt' => $this->format_currency($item_amount),// |
|
| 210 | + 'itemamt' => $this->format_currency($item_amount), // |
|
| 211 | 211 | // Total shipping costs for the order. If you specify shippingamt, you must also specify itemamt. |
| 212 | 212 | 'shippingamt' => '', |
| 213 | 213 | // Total handling costs for the order. If you specify handlingamt, you must also specify itemamt. |
@@ -219,10 +219,10 @@ discard block |
||
| 219 | 219 | // Free-form field for your own use. 256 char max. |
| 220 | 220 | 'custom' => $primary_registrant ? $primary_registrant->ID() : '', |
| 221 | 221 | // Your own invoice or tracking number |
| 222 | - 'invnum' => wp_generate_password(12,false),//$transaction->ID(), |
|
| 222 | + 'invnum' => wp_generate_password(12, false), //$transaction->ID(), |
|
| 223 | 223 | // URL for receiving Instant Payment Notifications. This overrides what your profile is set to use. |
| 224 | 224 | 'notifyurl' => '', |
| 225 | - 'buttonsource' => 'EventEspresso_SP',//EE will blow up if you change this |
|
| 225 | + 'buttonsource' => 'EventEspresso_SP', //EE will blow up if you change this |
|
| 226 | 226 | ); |
| 227 | 227 | // Wrap all data arrays into a single, "master" array which will be passed into the class function. |
| 228 | 228 | $PayPalRequestData = array( |
@@ -235,33 +235,33 @@ discard block |
||
| 235 | 235 | 'OrderItems' => $order_items, |
| 236 | 236 | ); |
| 237 | 237 | $this->_log_clean_request($PayPalRequestData, $payment); |
| 238 | - try{ |
|
| 238 | + try { |
|
| 239 | 239 | $PayPalResult = $this->prep_and_curl_request($PayPalRequestData); |
| 240 | 240 | //remove PCI-sensitive data so it doesn't get stored |
| 241 | - $PayPalResult = $this->_log_clean_response($PayPalResult,$payment); |
|
| 241 | + $PayPalResult = $this->_log_clean_response($PayPalResult, $payment); |
|
| 242 | 242 | |
| 243 | 243 | $message = isset($PayPalResult['L_LONGMESSAGE0']) ? $PayPalResult['L_LONGMESSAGE0'] : $PayPalResult['ACK']; |
| 244 | - if( empty($PayPalResult[ 'RAWRESPONSE' ] ) ) { |
|
| 245 | - $payment->set_status( $this->_pay_model->failed_status() ) ; |
|
| 246 | - $payment->set_gateway_response( __( 'No response received from Paypal Pro', 'event_espresso' ) ); |
|
| 244 | + if (empty($PayPalResult['RAWRESPONSE'])) { |
|
| 245 | + $payment->set_status($this->_pay_model->failed_status()); |
|
| 246 | + $payment->set_gateway_response(__('No response received from Paypal Pro', 'event_espresso')); |
|
| 247 | 247 | $payment->set_details($PayPalResult); |
| 248 | - }else{ |
|
| 249 | - if($this->_APICallSuccessful($PayPalResult)){ |
|
| 248 | + } else { |
|
| 249 | + if ($this->_APICallSuccessful($PayPalResult)) { |
|
| 250 | 250 | $payment->set_status($this->_pay_model->approved_status()); |
| 251 | - }else{ |
|
| 251 | + } else { |
|
| 252 | 252 | $payment->set_status($this->_pay_model->declined_status()); |
| 253 | 253 | } |
| 254 | 254 | //make sure we interpret the AMT as a float, not an international string (where periods are thousand seperators) |
| 255 | - $payment->set_amount(isset($PayPalResult['AMT']) ? floatval( $PayPalResult['AMT'] ) : 0); |
|
| 255 | + $payment->set_amount(isset($PayPalResult['AMT']) ? floatval($PayPalResult['AMT']) : 0); |
|
| 256 | 256 | $payment->set_gateway_response($message); |
| 257 | - $payment->set_txn_id_chq_nmbr(isset( $PayPalResult['TRANSACTIONID'] )? $PayPalResult['TRANSACTIONID'] : null); |
|
| 257 | + $payment->set_txn_id_chq_nmbr(isset($PayPalResult['TRANSACTIONID']) ? $PayPalResult['TRANSACTIONID'] : null); |
|
| 258 | 258 | |
| 259 | 259 | $primary_registration_code = $primary_registrant instanceof EE_Registration ? $primary_registrant->reg_code() : ''; |
| 260 | 260 | $payment->set_extra_accntng($primary_registration_code); |
| 261 | 261 | $payment->set_details($PayPalResult); |
| 262 | 262 | return $payment; |
| 263 | 263 | } |
| 264 | - }catch(Exception $e){ |
|
| 264 | + } catch (Exception $e) { |
|
| 265 | 265 | $payment->set_status($this->_pay_model->failed_status()); |
| 266 | 266 | $payment->set_gateway_response($e->getMessage()); |
| 267 | 267 | return $payment; |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | * @param EEI_Payment $payment |
| 274 | 274 | * @return array |
| 275 | 275 | */ |
| 276 | - private function _log_clean_request($request,$payment){ |
|
| 276 | + private function _log_clean_request($request, $payment) { |
|
| 277 | 277 | $cleaned_request_data = $request; |
| 278 | 278 | unset($cleaned_request_data['CCDetails']['acct']); |
| 279 | 279 | unset($cleaned_request_data['CCDetails']['cvv2']); |
@@ -285,13 +285,13 @@ discard block |
||
| 285 | 285 | * @param EEI_Payment $payment |
| 286 | 286 | * @return array cleaned |
| 287 | 287 | */ |
| 288 | - private function _log_clean_response($response,$payment){ |
|
| 288 | + private function _log_clean_response($response, $payment) { |
|
| 289 | 289 | unset($response['REQUESTDATA']['CREDITCARDTYPE']); |
| 290 | 290 | unset($response['REQUESTDATA']['ACCT']); |
| 291 | 291 | unset($response['REQUESTDATA']['EXPDATE']); |
| 292 | 292 | unset($response['REQUESTDATA']['CVV2']); |
| 293 | 293 | unset($response['RAWREQUEST']); |
| 294 | - $this->log(array('Paypal Response'=>$response),$payment); |
|
| 294 | + $this->log(array('Paypal Response'=>$response), $payment); |
|
| 295 | 295 | return $response; |
| 296 | 296 | } |
| 297 | 297 | private function prep_and_curl_request($DataArray) { |
@@ -309,32 +309,32 @@ discard block |
||
| 309 | 309 | // DP Fields |
| 310 | 310 | $DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array(); |
| 311 | 311 | foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) |
| 312 | - $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal); |
|
| 312 | + $DPFieldsNVP .= '&'.strtoupper($DPFieldsVar).'='.urlencode($DPFieldsVal); |
|
| 313 | 313 | |
| 314 | 314 | // CC Details Fields |
| 315 | 315 | $CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array(); |
| 316 | 316 | foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) |
| 317 | - $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal); |
|
| 317 | + $CCDetailsNVP .= '&'.strtoupper($CCDetailsVar).'='.urlencode($CCDetailsVal); |
|
| 318 | 318 | |
| 319 | 319 | // PayerInfo Type Fields |
| 320 | 320 | $PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array(); |
| 321 | 321 | foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) |
| 322 | - $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal); |
|
| 322 | + $PayerInfoNVP .= '&'.strtoupper($PayerInfoVar).'='.urlencode($PayerInfoVal); |
|
| 323 | 323 | |
| 324 | 324 | // Payer Name Fields |
| 325 | 325 | $PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array(); |
| 326 | 326 | foreach ($PayerName as $PayerNameVar => $PayerNameVal) |
| 327 | - $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal); |
|
| 327 | + $PayerNameNVP .= '&'.strtoupper($PayerNameVar).'='.urlencode($PayerNameVal); |
|
| 328 | 328 | |
| 329 | 329 | // Address Fields (Billing) |
| 330 | 330 | $BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array(); |
| 331 | 331 | foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) |
| 332 | - $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal); |
|
| 332 | + $BillingAddressNVP .= '&'.strtoupper($BillingAddressVar).'='.urlencode($BillingAddressVal); |
|
| 333 | 333 | |
| 334 | 334 | // Payment Details Type Fields |
| 335 | 335 | $PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array(); |
| 336 | 336 | foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) |
| 337 | - $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal); |
|
| 337 | + $PaymentDetailsNVP .= '&'.strtoupper($PaymentDetailsVar).'='.urlencode($PaymentDetailsVal); |
|
| 338 | 338 | |
| 339 | 339 | // Payment Details Item Type Fields |
| 340 | 340 | $OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array(); |
@@ -342,22 +342,22 @@ discard block |
||
| 342 | 342 | foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) { |
| 343 | 343 | $CurrentItem = $OrderItems[$OrderItemsVar]; |
| 344 | 344 | foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) |
| 345 | - $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal); |
|
| 345 | + $OrderItemsNVP .= '&'.strtoupper($CurrentItemVar).$n.'='.urlencode($CurrentItemVal); |
|
| 346 | 346 | $n++; |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | // Ship To Address Fields |
| 350 | 350 | $ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array(); |
| 351 | 351 | foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) |
| 352 | - $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal); |
|
| 352 | + $ShippingAddressNVP .= '&'.strtoupper($ShippingAddressVar).'='.urlencode($ShippingAddressVal); |
|
| 353 | 353 | |
| 354 | 354 | // 3D Secure Fields |
| 355 | 355 | $Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array(); |
| 356 | 356 | foreach ($Secure3D as $Secure3DVar => $Secure3DVal) |
| 357 | - $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal); |
|
| 357 | + $Secure3DNVP .= '&'.strtoupper($Secure3DVar).'='.urlencode($Secure3DVal); |
|
| 358 | 358 | |
| 359 | 359 | // Now that we have each chunk we need to go ahead and append them all together for our entire NVP string |
| 360 | - $NVPRequest = 'USER=' . $this->_username . '&PWD=' . $this->_password . '&VERSION=64.0' . '&SIGNATURE=' . $this->_signature . $DPFieldsNVP . $CCDetailsNVP . $PayerInfoNVP . $PayerNameNVP . $BillingAddressNVP . $PaymentDetailsNVP . $OrderItemsNVP . $ShippingAddressNVP . $Secure3DNVP; |
|
| 360 | + $NVPRequest = 'USER='.$this->_username.'&PWD='.$this->_password.'&VERSION=64.0'.'&SIGNATURE='.$this->_signature.$DPFieldsNVP.$CCDetailsNVP.$PayerInfoNVP.$PayerNameNVP.$BillingAddressNVP.$PaymentDetailsNVP.$OrderItemsNVP.$ShippingAddressNVP.$Secure3DNVP; |
|
| 361 | 361 | $NVPResponse = $this->_CURLRequest($NVPRequest); |
| 362 | 362 | $NVPRequestArray = $this->_NVPToArray($NVPRequest); |
| 363 | 363 | $NVPResponseArray = $this->_NVPToArray($NVPResponse); |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | private function _CURLRequest($Request) { |
| 378 | 378 | $EndPointURL = $this->_debug_mode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp'; |
| 379 | 379 | $curl = curl_init(); |
| 380 | - curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE ) ); |
|
| 380 | + curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE)); |
|
| 381 | 381 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); |
| 382 | 382 | curl_setopt($curl, CURLOPT_TIMEOUT, 60); |
| 383 | 383 | curl_setopt($curl, CURLOPT_URL, $EndPointURL); |
@@ -414,9 +414,9 @@ discard block |
||
| 414 | 414 | |
| 415 | 415 | private function _APICallSuccessful($PayPalResult) { |
| 416 | 416 | // check main response message from PayPal |
| 417 | - if (isset($PayPalResult['ACK']) && !empty($PayPalResult['ACK'])) { |
|
| 417 | + if (isset($PayPalResult['ACK']) && ! empty($PayPalResult['ACK'])) { |
|
| 418 | 418 | $ack = strtoupper($PayPalResult['ACK']); |
| 419 | - $approved = ( $ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS' ) ? TRUE : FALSE; |
|
| 419 | + $approved = ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS') ? TRUE : FALSE; |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | return $approved; |
@@ -426,11 +426,11 @@ discard block |
||
| 426 | 426 | |
| 427 | 427 | $Errors = array(); |
| 428 | 428 | $n = 0; |
| 429 | - while (isset($DataArray['L_ERRORCODE' . $n . ''])) { |
|
| 430 | - $LErrorCode = isset($DataArray['L_ERRORCODE' . $n . '']) ? $DataArray['L_ERRORCODE' . $n . ''] : ''; |
|
| 431 | - $LShortMessage = isset($DataArray['L_SHORTMESSAGE' . $n . '']) ? $DataArray['L_SHORTMESSAGE' . $n . ''] : ''; |
|
| 432 | - $LLongMessage = isset($DataArray['L_LONGMESSAGE' . $n . '']) ? $DataArray['L_LONGMESSAGE' . $n . ''] : ''; |
|
| 433 | - $LSeverityCode = isset($DataArray['L_SEVERITYCODE' . $n . '']) ? $DataArray['L_SEVERITYCODE' . $n . ''] : ''; |
|
| 429 | + while (isset($DataArray['L_ERRORCODE'.$n.''])) { |
|
| 430 | + $LErrorCode = isset($DataArray['L_ERRORCODE'.$n.'']) ? $DataArray['L_ERRORCODE'.$n.''] : ''; |
|
| 431 | + $LShortMessage = isset($DataArray['L_SHORTMESSAGE'.$n.'']) ? $DataArray['L_SHORTMESSAGE'.$n.''] : ''; |
|
| 432 | + $LLongMessage = isset($DataArray['L_LONGMESSAGE'.$n.'']) ? $DataArray['L_LONGMESSAGE'.$n.''] : ''; |
|
| 433 | + $LSeverityCode = isset($DataArray['L_SEVERITYCODE'.$n.'']) ? $DataArray['L_SEVERITYCODE'.$n.''] : ''; |
|
| 434 | 434 | |
| 435 | 435 | $CurrentItem = array( |
| 436 | 436 | 'L_ERRORCODE' => $LErrorCode, |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | elseif ($CurrentErrorVar == 'L_SEVERITYCODE') |
| 466 | 466 | $CurrentVarName = 'Severity Code'; |
| 467 | 467 | |
| 468 | - $error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal; |
|
| 468 | + $error .= '<br />'.$CurrentVarName.': '.$CurrentErrorVal; |
|
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | return $error; |
@@ -1,7 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
| 4 | 4 | exit('No direct script access allowed'); |
| 5 | +} |
|
| 5 | 6 | |
| 6 | 7 | /** |
| 7 | 8 | * Event Espresso |
@@ -120,7 +121,7 @@ discard block |
||
| 120 | 121 | } |
| 121 | 122 | $item_amount = $total_line_item->get_items_total(); |
| 122 | 123 | $tax_amount = $total_line_item->get_total_tax(); |
| 123 | - }else{ |
|
| 124 | + } else{ |
|
| 124 | 125 | $order_items = array(); |
| 125 | 126 | $item_amount = $payment->amount(); |
| 126 | 127 | $single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
@@ -245,10 +246,10 @@ discard block |
||
| 245 | 246 | $payment->set_status( $this->_pay_model->failed_status() ) ; |
| 246 | 247 | $payment->set_gateway_response( __( 'No response received from Paypal Pro', 'event_espresso' ) ); |
| 247 | 248 | $payment->set_details($PayPalResult); |
| 248 | - }else{ |
|
| 249 | + } else{ |
|
| 249 | 250 | if($this->_APICallSuccessful($PayPalResult)){ |
| 250 | 251 | $payment->set_status($this->_pay_model->approved_status()); |
| 251 | - }else{ |
|
| 252 | + } else{ |
|
| 252 | 253 | $payment->set_status($this->_pay_model->declined_status()); |
| 253 | 254 | } |
| 254 | 255 | //make sure we interpret the AMT as a float, not an international string (where periods are thousand seperators) |
@@ -261,7 +262,7 @@ discard block |
||
| 261 | 262 | $payment->set_details($PayPalResult); |
| 262 | 263 | return $payment; |
| 263 | 264 | } |
| 264 | - }catch(Exception $e){ |
|
| 265 | + } catch(Exception $e){ |
|
| 265 | 266 | $payment->set_status($this->_pay_model->failed_status()); |
| 266 | 267 | $payment->set_gateway_response($e->getMessage()); |
| 267 | 268 | return $payment; |
@@ -308,53 +309,62 @@ discard block |
||
| 308 | 309 | |
| 309 | 310 | // DP Fields |
| 310 | 311 | $DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array(); |
| 311 | - foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) |
|
| 312 | - $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal); |
|
| 312 | + foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) { |
|
| 313 | + $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal); |
|
| 314 | + } |
|
| 313 | 315 | |
| 314 | 316 | // CC Details Fields |
| 315 | 317 | $CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array(); |
| 316 | - foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) |
|
| 317 | - $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal); |
|
| 318 | + foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) { |
|
| 319 | + $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal); |
|
| 320 | + } |
|
| 318 | 321 | |
| 319 | 322 | // PayerInfo Type Fields |
| 320 | 323 | $PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array(); |
| 321 | - foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) |
|
| 322 | - $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal); |
|
| 324 | + foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) { |
|
| 325 | + $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal); |
|
| 326 | + } |
|
| 323 | 327 | |
| 324 | 328 | // Payer Name Fields |
| 325 | 329 | $PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array(); |
| 326 | - foreach ($PayerName as $PayerNameVar => $PayerNameVal) |
|
| 327 | - $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal); |
|
| 330 | + foreach ($PayerName as $PayerNameVar => $PayerNameVal) { |
|
| 331 | + $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal); |
|
| 332 | + } |
|
| 328 | 333 | |
| 329 | 334 | // Address Fields (Billing) |
| 330 | 335 | $BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array(); |
| 331 | - foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) |
|
| 332 | - $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal); |
|
| 336 | + foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) { |
|
| 337 | + $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal); |
|
| 338 | + } |
|
| 333 | 339 | |
| 334 | 340 | // Payment Details Type Fields |
| 335 | 341 | $PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array(); |
| 336 | - foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) |
|
| 337 | - $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal); |
|
| 342 | + foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) { |
|
| 343 | + $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal); |
|
| 344 | + } |
|
| 338 | 345 | |
| 339 | 346 | // Payment Details Item Type Fields |
| 340 | 347 | $OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array(); |
| 341 | 348 | $n = 0; |
| 342 | 349 | foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) { |
| 343 | 350 | $CurrentItem = $OrderItems[$OrderItemsVar]; |
| 344 | - foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) |
|
| 345 | - $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal); |
|
| 351 | + foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) { |
|
| 352 | + $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal); |
|
| 353 | + } |
|
| 346 | 354 | $n++; |
| 347 | 355 | } |
| 348 | 356 | |
| 349 | 357 | // Ship To Address Fields |
| 350 | 358 | $ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array(); |
| 351 | - foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) |
|
| 352 | - $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal); |
|
| 359 | + foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) { |
|
| 360 | + $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal); |
|
| 361 | + } |
|
| 353 | 362 | |
| 354 | 363 | // 3D Secure Fields |
| 355 | 364 | $Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array(); |
| 356 | - foreach ($Secure3D as $Secure3DVar => $Secure3DVal) |
|
| 357 | - $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal); |
|
| 365 | + foreach ($Secure3D as $Secure3DVar => $Secure3DVal) { |
|
| 366 | + $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal); |
|
| 367 | + } |
|
| 358 | 368 | |
| 359 | 369 | // Now that we have each chunk we need to go ahead and append them all together for our entire NVP string |
| 360 | 370 | $NVPRequest = 'USER=' . $this->_username . '&PWD=' . $this->_password . '&VERSION=64.0' . '&SIGNATURE=' . $this->_signature . $DPFieldsNVP . $CCDetailsNVP . $PayerInfoNVP . $PayerNameNVP . $BillingAddressNVP . $PaymentDetailsNVP . $OrderItemsNVP . $ShippingAddressNVP . $Secure3DNVP; |
@@ -456,14 +466,15 @@ discard block |
||
| 456 | 466 | foreach ($Errors as $ErrorVar => $ErrorVal) { |
| 457 | 467 | $CurrentError = $Errors[$ErrorVar]; |
| 458 | 468 | foreach ($CurrentError as $CurrentErrorVar => $CurrentErrorVal) { |
| 459 | - if ($CurrentErrorVar == 'L_ERRORCODE') |
|
| 460 | - $CurrentVarName = 'Error Code'; |
|
| 461 | - elseif ($CurrentErrorVar == 'L_SHORTMESSAGE') |
|
| 462 | - $CurrentVarName = 'Short Message'; |
|
| 463 | - elseif ($CurrentErrorVar == 'L_LONGMESSAGE') |
|
| 464 | - $CurrentVarName = 'Long Message'; |
|
| 465 | - elseif ($CurrentErrorVar == 'L_SEVERITYCODE') |
|
| 466 | - $CurrentVarName = 'Severity Code'; |
|
| 469 | + if ($CurrentErrorVar == 'L_ERRORCODE') { |
|
| 470 | + $CurrentVarName = 'Error Code'; |
|
| 471 | + } elseif ($CurrentErrorVar == 'L_SHORTMESSAGE') { |
|
| 472 | + $CurrentVarName = 'Short Message'; |
|
| 473 | + } elseif ($CurrentErrorVar == 'L_LONGMESSAGE') { |
|
| 474 | + $CurrentVarName = 'Long Message'; |
|
| 475 | + } elseif ($CurrentErrorVar == 'L_SEVERITYCODE') { |
|
| 476 | + $CurrentVarName = 'Severity Code'; |
|
| 477 | + } |
|
| 467 | 478 | |
| 468 | 479 | $error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal; |
| 469 | 480 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 2 | -do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 2 | +do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 3 | 3 | /** |
| 4 | 4 | * EE_Export class |
| 5 | 5 | * |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | * @access private |
| 42 | 42 | * @param array $request_data |
| 43 | 43 | */ |
| 44 | - private function __construct( $request_data = array() ) { |
|
| 44 | + private function __construct($request_data = array()) { |
|
| 45 | 45 | $this->_req_data = $request_data; |
| 46 | - $this->today = date("Y-m-d",time()); |
|
| 47 | - require_once( EE_CLASSES . 'EE_CSV.class.php' ); |
|
| 48 | - $this->EE_CSV= EE_CSV::instance(); |
|
| 46 | + $this->today = date("Y-m-d", time()); |
|
| 47 | + require_once(EE_CLASSES.'EE_CSV.class.php'); |
|
| 48 | + $this->EE_CSV = EE_CSV::instance(); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | * @param array $request_data |
| 58 | 58 | * @return \EE_Export |
| 59 | 59 | */ |
| 60 | - public static function instance( $request_data = array() ) { |
|
| 60 | + public static function instance($request_data = array()) { |
|
| 61 | 61 | // check if class object is instantiated |
| 62 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Export )) { |
|
| 63 | - self::$_instance = new self( $request_data ); |
|
| 62 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Export)) { |
|
| 63 | + self::$_instance = new self($request_data); |
|
| 64 | 64 | } |
| 65 | 65 | return self::$_instance; |
| 66 | 66 | } |
@@ -74,15 +74,15 @@ discard block |
||
| 74 | 74 | public function export() { |
| 75 | 75 | |
| 76 | 76 | // in case of bulk exports, the "actual" action will be in action2, but first check regular action for "export" keyword |
| 77 | - if ( isset( $this->_req_data['action'] ) && strpos( $this->_req_data['action'], 'export' ) === FALSE ) { |
|
| 77 | + if (isset($this->_req_data['action']) && strpos($this->_req_data['action'], 'export') === FALSE) { |
|
| 78 | 78 | // check if action2 has export action |
| 79 | - if ( isset( $this->_req_data['action2'] ) && strpos( $this->_req_data['action2'], 'export' ) !== FALSE ) { |
|
| 79 | + if (isset($this->_req_data['action2']) && strpos($this->_req_data['action2'], 'export') !== FALSE) { |
|
| 80 | 80 | // whoop! there it is! |
| 81 | 81 | $this->_req_data['action'] = $this->_req_data['action2']; |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - $this->_req_data['export'] = isset( $this->_req_data['export'] ) ? $this->_req_data['export'] : ''; |
|
| 85 | + $this->_req_data['export'] = isset($this->_req_data['export']) ? $this->_req_data['export'] : ''; |
|
| 86 | 86 | |
| 87 | 87 | switch ($this->_req_data['export']) { |
| 88 | 88 | case 'report': |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | break; |
| 100 | 100 | |
| 101 | 101 | case 'registrations_report_for_event': |
| 102 | - $this->report_registrations_for_event( $this->_req_data['EVT_ID'] ); |
|
| 102 | + $this->report_registrations_for_event($this->_req_data['EVT_ID']); |
|
| 103 | 103 | break; |
| 104 | 104 | |
| 105 | 105 | case 'attendees': |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | break; |
| 112 | 112 | |
| 113 | 113 | default: |
| 114 | - EE_Error::add_error(__('An error occurred! The requested export report could not be found.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ ) ; |
|
| 114 | + EE_Error::add_error(__('An error occurred! The requested export report could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 115 | 115 | return FALSE; |
| 116 | 116 | break; |
| 117 | 117 | |
@@ -139,12 +139,12 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | $models_to_export = EE_Registry::instance()->non_abstract_db_models; |
| 141 | 141 | |
| 142 | - $table_data = $this->_get_export_data_for_models( array_keys( $models_to_export ) ); |
|
| 142 | + $table_data = $this->_get_export_data_for_models(array_keys($models_to_export)); |
|
| 143 | 143 | |
| 144 | - $filename = $this->generate_filename ( 'full-db-export' ); |
|
| 144 | + $filename = $this->generate_filename('full-db-export'); |
|
| 145 | 145 | |
| 146 | - if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename,$table_data )) { |
|
| 147 | - EE_Error::add_error(__("An error occurred and the Event details could not be exported from the database.", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 146 | + if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $table_data)) { |
|
| 147 | + EE_Error::add_error(__("An error occurred and the Event details could not be exported from the database.", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * Downloads a CSV file with all the columns, but no data. This should be used for importing |
| 153 | 153 | * @return null kills execution |
| 154 | 154 | */ |
| 155 | - function export_sample(){ |
|
| 155 | + function export_sample() { |
|
| 156 | 156 | $event = EEM_Event::instance()->get_one(); |
| 157 | 157 | $this->_req_data['EVT_ID'] = $event->ID(); |
| 158 | 158 | $this->export_all_event_data(); |
@@ -178,23 +178,23 @@ discard block |
||
| 178 | 178 | $state_country_query_params = array(); |
| 179 | 179 | $question_group_query_params = array(); |
| 180 | 180 | $question_query_params = array(); |
| 181 | - if ( isset( $this->_req_data['EVT_ID'] )) { |
|
| 181 | + if (isset($this->_req_data['EVT_ID'])) { |
|
| 182 | 182 | // do we have an array of IDs ? |
| 183 | 183 | |
| 184 | - if ( is_array( $this->_req_data['EVT_ID'] )) { |
|
| 185 | - $EVT_IDs = array_map( 'sanitize_text_field', $this->_req_data['EVT_ID'] ); |
|
| 186 | - $value_to_equal = array('IN',$EVT_IDs); |
|
| 184 | + if (is_array($this->_req_data['EVT_ID'])) { |
|
| 185 | + $EVT_IDs = array_map('sanitize_text_field', $this->_req_data['EVT_ID']); |
|
| 186 | + $value_to_equal = array('IN', $EVT_IDs); |
|
| 187 | 187 | $filename = 'events'; |
| 188 | 188 | } else { |
| 189 | 189 | // generate regular where = clause |
| 190 | - $EVT_ID = absint( $this->_req_data['EVT_ID'] ); |
|
| 190 | + $EVT_ID = absint($this->_req_data['EVT_ID']); |
|
| 191 | 191 | $value_to_equal = $EVT_ID; |
| 192 | 192 | $event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($EVT_ID); |
| 193 | 193 | |
| 194 | - $filename = 'event-' . ( $event instanceof EE_Event ? $event->slug() : __( 'unknown', 'event_espresso' ) ); |
|
| 194 | + $filename = 'event-'.($event instanceof EE_Event ? $event->slug() : __('unknown', 'event_espresso')); |
|
| 195 | 195 | |
| 196 | 196 | } |
| 197 | - $event_query_params[0]['EVT_ID'] =$value_to_equal; |
|
| 197 | + $event_query_params[0]['EVT_ID'] = $value_to_equal; |
|
| 198 | 198 | $related_models_query_params[0]['Event.EVT_ID'] = $value_to_equal; |
| 199 | 199 | $related_through_reg_query_params[0]['Registration.EVT_ID'] = $value_to_equal; |
| 200 | 200 | $datetime_ticket_query_params[0]['Datetime.EVT_ID'] = $value_to_equal; |
@@ -238,37 +238,37 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | ); |
| 240 | 240 | |
| 241 | - $model_data = $this->_get_export_data_for_models( $models_to_export ); |
|
| 241 | + $model_data = $this->_get_export_data_for_models($models_to_export); |
|
| 242 | 242 | |
| 243 | - $filename = $this->generate_filename ( $filename ); |
|
| 243 | + $filename = $this->generate_filename($filename); |
|
| 244 | 244 | |
| 245 | - if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $model_data )) { |
|
| 246 | - EE_Error::add_error(__("'An error occurred and the Event details could not be exported from the database.'", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 245 | + if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $model_data)) { |
|
| 246 | + EE_Error::add_error(__("'An error occurred and the Event details could not be exported from the database.'", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - function report_attendees(){ |
|
| 251 | - $attendee_rows = EEM_Attendee::instance()->get_all_wpdb_results( array( 'force_join' => array( 'State', 'Country' ) ) ); |
|
| 250 | + function report_attendees() { |
|
| 251 | + $attendee_rows = EEM_Attendee::instance()->get_all_wpdb_results(array('force_join' => array('State', 'Country'))); |
|
| 252 | 252 | $csv_data = array(); |
| 253 | - foreach( $attendee_rows as $attendee_row ){ |
|
| 253 | + foreach ($attendee_rows as $attendee_row) { |
|
| 254 | 254 | $csv_row = array(); |
| 255 | - foreach( EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){ |
|
| 256 | - if( $field_name == 'STA_ID' ){ |
|
| 257 | - $state_name_field = EEM_State::instance()->field_settings_for( 'STA_name' ); |
|
| 258 | - $csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ]; |
|
| 259 | - }elseif( $field_name == 'CNT_ISO' ){ |
|
| 260 | - $country_name_field = EEM_Country::instance()->field_settings_for( 'CNT_name' ); |
|
| 261 | - $csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ]; |
|
| 262 | - }else{ |
|
| 263 | - $csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ]; |
|
| 255 | + foreach (EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) { |
|
| 256 | + if ($field_name == 'STA_ID') { |
|
| 257 | + $state_name_field = EEM_State::instance()->field_settings_for('STA_name'); |
|
| 258 | + $csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()]; |
|
| 259 | + }elseif ($field_name == 'CNT_ISO') { |
|
| 260 | + $country_name_field = EEM_Country::instance()->field_settings_for('CNT_name'); |
|
| 261 | + $csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()]; |
|
| 262 | + } else { |
|
| 263 | + $csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()]; |
|
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | $csv_data[] = $csv_row; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - $filename = $this->generate_filename ( 'contact-list-report' ); |
|
| 269 | + $filename = $this->generate_filename('contact-list-report'); |
|
| 270 | 270 | |
| 271 | - $handle = $this->EE_CSV->begin_sending_csv( $filename); |
|
| 271 | + $handle = $this->EE_CSV->begin_sending_csv($filename); |
|
| 272 | 272 | $this->EE_CSV->write_data_array_to_csv($handle, $csv_data); |
| 273 | 273 | $this->EE_CSV->end_sending_csv($handle); |
| 274 | 274 | } |
@@ -285,18 +285,18 @@ discard block |
||
| 285 | 285 | $countries_that_have_an_attendee = EEM_Country::instance()->get_all(array(0=>array('Attendee.ATT_ID'=>array('IS NOT NULL')))); |
| 286 | 286 | // $states_to_export_query_params |
| 287 | 287 | $models_to_export = array( |
| 288 | - 'Country'=>array(array('CNT_ISO'=>array('IN',array_keys($countries_that_have_an_attendee)))), |
|
| 289 | - 'State'=>array(array('STA_ID'=>array('IN',array_keys($states_that_have_an_attendee)))), |
|
| 288 | + 'Country'=>array(array('CNT_ISO'=>array('IN', array_keys($countries_that_have_an_attendee)))), |
|
| 289 | + 'State'=>array(array('STA_ID'=>array('IN', array_keys($states_that_have_an_attendee)))), |
|
| 290 | 290 | 'Attendee'=>array(), |
| 291 | 291 | ); |
| 292 | 292 | |
| 293 | 293 | |
| 294 | 294 | |
| 295 | - $model_data = $this->_get_export_data_for_models( $models_to_export ); |
|
| 296 | - $filename = $this->generate_filename ( 'all-attendees' ); |
|
| 295 | + $model_data = $this->_get_export_data_for_models($models_to_export); |
|
| 296 | + $filename = $this->generate_filename('all-attendees'); |
|
| 297 | 297 | |
| 298 | - if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $model_data )) { |
|
| 299 | - EE_Error::add_error(__('An error occurred and the Attendee data could not be exported from the database.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 298 | + if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $model_data)) { |
|
| 299 | + EE_Error::add_error(__('An error occurred and the Attendee data could not be exported from the database.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 | |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | * and the questions associated with the registrations |
| 306 | 306 | * @param int $event_id |
| 307 | 307 | */ |
| 308 | - function report_registrations_for_event( $event_id = NULL ){ |
|
| 308 | + function report_registrations_for_event($event_id = NULL) { |
|
| 309 | 309 | $reg_fields_to_include = array( |
| 310 | 310 | 'TXN_ID', |
| 311 | 311 | 'ATT_ID', |
@@ -337,49 +337,49 @@ discard block |
||
| 337 | 337 | array( |
| 338 | 338 | 'OR' => array( |
| 339 | 339 | //don't include registrations from failed or abandoned transactions... |
| 340 | - 'Transaction.STS_ID' => array( 'NOT IN', array( EEM_Transaction::failed_status_code, EEM_Transaction::abandoned_status_code ) ), |
|
| 340 | + 'Transaction.STS_ID' => array('NOT IN', array(EEM_Transaction::failed_status_code, EEM_Transaction::abandoned_status_code)), |
|
| 341 | 341 | //unless the registration is approved, in which case include it regardless of transaction status |
| 342 | 342 | 'STS_ID' => EEM_Registration::status_id_approved |
| 343 | 343 | ), |
| 344 | - 'Ticket.TKT_deleted' => array( 'IN', array( true, false ) ) |
|
| 344 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)) |
|
| 345 | 345 | ), |
| 346 | - 'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'), |
|
| 347 | - 'force_join' => array( 'Transaction', 'Ticket' ) |
|
| 346 | + 'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'), |
|
| 347 | + 'force_join' => array('Transaction', 'Ticket') |
|
| 348 | 348 | ), |
| 349 | 349 | $event_id |
| 350 | 350 | ); |
| 351 | - if( $event_id ){ |
|
| 352 | - $query_params[0]['EVT_ID'] = $event_id; |
|
| 353 | - }else{ |
|
| 354 | - $query_params[ 'force_join' ][] = 'Event'; |
|
| 351 | + if ($event_id) { |
|
| 352 | + $query_params[0]['EVT_ID'] = $event_id; |
|
| 353 | + } else { |
|
| 354 | + $query_params['force_join'][] = 'Event'; |
|
| 355 | 355 | } |
| 356 | - $registrations = $reg_model->get_all( $query_params ); |
|
| 356 | + $registrations = $reg_model->get_all($query_params); |
|
| 357 | 357 | |
| 358 | 358 | //get all questions which relate to someone in this group |
| 359 | 359 | $registration_ids = array_keys($registrations); |
| 360 | 360 | // EEM_Question::instance()->show_next_x_db_queries(); |
| 361 | - $questions_for_these_registrations = EEM_Question::instance()->get_all(array(array('Answer.REG_ID'=>array('IN',$registration_ids)))); |
|
| 362 | - foreach($registrations as $registration){ |
|
| 363 | - if ( $registration instanceof EE_Registration ) { |
|
| 361 | + $questions_for_these_registrations = EEM_Question::instance()->get_all(array(array('Answer.REG_ID'=>array('IN', $registration_ids)))); |
|
| 362 | + foreach ($registrations as $registration) { |
|
| 363 | + if ($registration instanceof EE_Registration) { |
|
| 364 | 364 | $reg_csv_array = array(); |
| 365 | - if( ! $event_id ){ |
|
| 365 | + if ( ! $event_id) { |
|
| 366 | 366 | //get the event's name and Id |
| 367 | - $reg_csv_array[ __( 'Event', 'event_espresso' ) ] = $registration->event_name() . '(' . $registration->event_ID() . ')'; |
|
| 367 | + $reg_csv_array[__('Event', 'event_espresso')] = $registration->event_name().'('.$registration->event_ID().')'; |
|
| 368 | 368 | } |
| 369 | 369 | /*@var $registration EE_Registration */ |
| 370 | - foreach($reg_fields_to_include as $field_name){ |
|
| 370 | + foreach ($reg_fields_to_include as $field_name) { |
|
| 371 | 371 | $field = $reg_model->field_settings_for($field_name); |
| 372 | - if($field_name == 'REG_final_price'){ |
|
| 373 | - $value = $registration->get_pretty($field_name,'localized_float'); |
|
| 374 | - }elseif( $field_name == 'REG_count' ){ |
|
| 375 | - $value = sprintf( __( '%s of %s', 'event_espresso' ), $registration->get_pretty( 'REG_count' ), $registration->get_pretty( 'REG_group_size' ) ); |
|
| 376 | - }elseif( $field_name == 'REG_date' ) { |
|
| 377 | - $value = $registration->get_pretty( $field->get_name(), 'no_html' ); |
|
| 378 | - }else{ |
|
| 372 | + if ($field_name == 'REG_final_price') { |
|
| 373 | + $value = $registration->get_pretty($field_name, 'localized_float'); |
|
| 374 | + }elseif ($field_name == 'REG_count') { |
|
| 375 | + $value = sprintf(__('%s of %s', 'event_espresso'), $registration->get_pretty('REG_count'), $registration->get_pretty('REG_group_size')); |
|
| 376 | + }elseif ($field_name == 'REG_date') { |
|
| 377 | + $value = $registration->get_pretty($field->get_name(), 'no_html'); |
|
| 378 | + } else { |
|
| 379 | 379 | $value = $registration->get_pretty($field->get_name()); |
| 380 | 380 | } |
| 381 | 381 | $reg_csv_array[$this->_get_column_name_for_field($field)] = $value; |
| 382 | - if($field_name == 'REG_final_price'){ |
|
| 382 | + if ($field_name == 'REG_final_price') { |
|
| 383 | 383 | //add a column named Currency after the final price |
| 384 | 384 | $reg_csv_array[__("Currency", "event_espresso")] = EE_Config::instance()->currency->code; |
| 385 | 385 | } |
@@ -388,49 +388,49 @@ discard block |
||
| 388 | 388 | $reg_csv_array[__("Registration Status", 'event_espresso')] = $registration->pretty_status(); |
| 389 | 389 | //get pretty trnasaction status |
| 390 | 390 | $reg_csv_array[__("Transaction Status", 'event_espresso')] = $registration->transaction()->pretty_status(); |
| 391 | - $reg_csv_array[ __( 'Transaction Amount Due', 'event_espresso' ) ] = $registration->is_primary_registrant() ? $registration->transaction()->get_pretty('TXN_total', 'localized_float') : '0.00'; |
|
| 392 | - $reg_csv_array[ __( 'Amount Paid', 'event_espresso' )] = $registration->is_primary_registrant() ? $registration->transaction()->get_pretty( 'TXN_paid', 'localized_float' ) : '0.00'; |
|
| 391 | + $reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $registration->is_primary_registrant() ? $registration->transaction()->get_pretty('TXN_total', 'localized_float') : '0.00'; |
|
| 392 | + $reg_csv_array[__('Amount Paid', 'event_espresso')] = $registration->is_primary_registrant() ? $registration->transaction()->get_pretty('TXN_paid', 'localized_float') : '0.00'; |
|
| 393 | 393 | $payment_methods = array(); |
| 394 | 394 | $gateway_txn_ids_etc = array(); |
| 395 | 395 | $payment_times = array(); |
| 396 | - if($registration->is_primary_registrant() && $registration->transaction() instanceof EE_Transaction ){ |
|
| 396 | + if ($registration->is_primary_registrant() && $registration->transaction() instanceof EE_Transaction) { |
|
| 397 | 397 | $payments_info = EEM_Payment::instance()->get_all_wpdb_results( |
| 398 | 398 | array( |
| 399 | 399 | array( |
| 400 | 400 | 'TXN_ID' => $registration->get('TXN_ID'), |
| 401 | 401 | 'STS_ID' => EEM_Payment::status_id_approved |
| 402 | 402 | ), |
| 403 | - 'force_join' => array( 'Payment_Method' ), |
|
| 403 | + 'force_join' => array('Payment_Method'), |
|
| 404 | 404 | |
| 405 | 405 | ), |
| 406 | 406 | ARRAY_A, |
| 407 | 407 | 'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' ); |
| 408 | 408 | |
| 409 | - foreach( $payments_info as $payment_method_and_gateway_txn_id ){ |
|
| 410 | - $payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' ); |
|
| 411 | - $gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : ''; |
|
| 412 | - $payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : ''; |
|
| 409 | + foreach ($payments_info as $payment_method_and_gateway_txn_id) { |
|
| 410 | + $payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso'); |
|
| 411 | + $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : ''; |
|
| 412 | + $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : ''; |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | } |
| 416 | - $reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times ); |
|
| 417 | - $reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods ); |
|
| 418 | - $reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc ); |
|
| 416 | + $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times); |
|
| 417 | + $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods); |
|
| 418 | + $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc); |
|
| 419 | 419 | |
| 420 | 420 | //get whether or not the user has checked in |
| 421 | 421 | $reg_csv_array[__("Check-Ins", "event_espresso")] = $registration->count_checkins(); |
| 422 | 422 | //get ticket of registration and its price |
| 423 | 423 | $ticket_model = EE_Registry::instance()->load_model('Ticket'); |
| 424 | - if( $registration->ticket() ) { |
|
| 424 | + if ($registration->ticket()) { |
|
| 425 | 425 | $ticket_name = $registration->ticket()->name(); |
| 426 | 426 | $datetimes_strings = array(); |
| 427 | - foreach($registration->ticket()->datetimes() as $datetime){ |
|
| 427 | + foreach ($registration->ticket()->datetimes() as $datetime) { |
|
| 428 | 428 | $datetimes_strings[] = $datetime->start_date_and_time(); |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | } else { |
| 432 | - $ticket_name = __( 'Unknown', 'event_espresso' ); |
|
| 433 | - $datetimes_strings = array( __( 'Unknown', 'event_espresso' ) ); |
|
| 432 | + $ticket_name = __('Unknown', 'event_espresso'); |
|
| 433 | + $datetimes_strings = array(__('Unknown', 'event_espresso')); |
|
| 434 | 434 | } |
| 435 | 435 | $reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name; |
| 436 | 436 | $reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings); |
@@ -438,26 +438,26 @@ discard block |
||
| 438 | 438 | |
| 439 | 439 | //add attendee columns |
| 440 | 440 | $attendee = $registration->attendee(); |
| 441 | - foreach($att_fields_to_include as $att_field_name){ |
|
| 442 | - if($attendee){ |
|
| 443 | - if($att_field_name == 'STA_ID'){ |
|
| 441 | + foreach ($att_fields_to_include as $att_field_name) { |
|
| 442 | + if ($attendee) { |
|
| 443 | + if ($att_field_name == 'STA_ID') { |
|
| 444 | 444 | $state = $attendee->state_obj(); |
| 445 | - if($state){ |
|
| 445 | + if ($state) { |
|
| 446 | 446 | $value = $state->name(); |
| 447 | - }else{ |
|
| 447 | + } else { |
|
| 448 | 448 | $value = ''; |
| 449 | 449 | } |
| 450 | - }elseif($att_field_name == 'CNT_ISO'){ |
|
| 450 | + }elseif ($att_field_name == 'CNT_ISO') { |
|
| 451 | 451 | $country = $attendee->country_obj(); |
| 452 | - if($country){ |
|
| 452 | + if ($country) { |
|
| 453 | 453 | $value = $country->name(); |
| 454 | - }else{ |
|
| 454 | + } else { |
|
| 455 | 455 | $value = ''; |
| 456 | 456 | } |
| 457 | - }else{ |
|
| 457 | + } else { |
|
| 458 | 458 | $value = $attendee->get_pretty($att_field_name); |
| 459 | 459 | } |
| 460 | - }else{ |
|
| 460 | + } else { |
|
| 461 | 461 | $value = ''; |
| 462 | 462 | } |
| 463 | 463 | $field_obj = EEM_Attendee::instance()->field_settings_for($att_field_name); |
@@ -465,52 +465,52 @@ discard block |
||
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | //make sure each registration has the same questions in the same order |
| 468 | - foreach($questions_for_these_registrations as $question){ |
|
| 469 | - if ( $question instanceof EE_Question ) { |
|
| 470 | - if( ! isset($reg_csv_array[$question->admin_label()])){ |
|
| 468 | + foreach ($questions_for_these_registrations as $question) { |
|
| 469 | + if ($question instanceof EE_Question) { |
|
| 470 | + if ( ! isset($reg_csv_array[$question->admin_label()])) { |
|
| 471 | 471 | $reg_csv_array[$question->admin_label()] = null; |
| 472 | 472 | } |
| 473 | 473 | } |
| 474 | 474 | } |
| 475 | 475 | //now fill out the questions THEY answered |
| 476 | - foreach($registration->answers() as $answer){ |
|
| 476 | + foreach ($registration->answers() as $answer) { |
|
| 477 | 477 | /* @var $answer EE_Answer */ |
| 478 | - if( $answer->question() instanceof EE_Question ){ |
|
| 478 | + if ($answer->question() instanceof EE_Question) { |
|
| 479 | 479 | $question_label = $answer->question()->admin_label(); |
| 480 | - }else{ |
|
| 481 | - $question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer->question_ID() ); |
|
| 480 | + } else { |
|
| 481 | + $question_label = sprintf(__('Question $s', 'event_espresso'), $answer->question_ID()); |
|
| 482 | 482 | } |
| 483 | - $reg_csv_array[ $question_label ] = $answer->pretty_value(); |
|
| 483 | + $reg_csv_array[$question_label] = $answer->pretty_value(); |
|
| 484 | 484 | } |
| 485 | - $registrations_csv_ready_array[] = apply_filters( 'FHEE__EE_Export__report_registrations__reg_csv_array', $reg_csv_array, $registration ); |
|
| 485 | + $registrations_csv_ready_array[] = apply_filters('FHEE__EE_Export__report_registrations__reg_csv_array', $reg_csv_array, $registration); |
|
| 486 | 486 | } |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | //if we couldn't export anything, we want to at least show the column headers |
| 490 | - if(empty($registrations_csv_ready_array)){ |
|
| 490 | + if (empty($registrations_csv_ready_array)) { |
|
| 491 | 491 | $reg_csv_array = array(); |
| 492 | 492 | $model_and_fields_to_include = array( |
| 493 | 493 | 'Registration' => $reg_fields_to_include, |
| 494 | 494 | 'Attendee' => $att_fields_to_include |
| 495 | 495 | ); |
| 496 | - foreach($model_and_fields_to_include as $model_name => $field_list){ |
|
| 496 | + foreach ($model_and_fields_to_include as $model_name => $field_list) { |
|
| 497 | 497 | $model = EE_Registry::instance()->load_model($model_name); |
| 498 | - foreach($field_list as $field_name){ |
|
| 498 | + foreach ($field_list as $field_name) { |
|
| 499 | 499 | $field = $model->field_settings_for($field_name); |
| 500 | - $reg_csv_array[$this->_get_column_name_for_field($field)] = null;//$registration->get($field->get_name()); |
|
| 500 | + $reg_csv_array[$this->_get_column_name_for_field($field)] = null; //$registration->get($field->get_name()); |
|
| 501 | 501 | } |
| 502 | 502 | } |
| 503 | 503 | $registrations_csv_ready_array [] = $reg_csv_array; |
| 504 | 504 | } |
| 505 | - if( $event_id ){ |
|
| 505 | + if ($event_id) { |
|
| 506 | 506 | $event = EEM_Event::instance()->get_one_by_ID($event_id); |
| 507 | - $event_slug = $event instanceof EE_Event ? $event->slug() : __( 'unknown', 'event_espresso' ); |
|
| 508 | - }else{ |
|
| 509 | - $event_slug = __( 'all', 'event_espresso' ); |
|
| 507 | + $event_slug = $event instanceof EE_Event ? $event->slug() : __('unknown', 'event_espresso'); |
|
| 508 | + } else { |
|
| 509 | + $event_slug = __('all', 'event_espresso'); |
|
| 510 | 510 | } |
| 511 | - $filename = sprintf( "registrations-for-%s", $event_slug ); |
|
| 511 | + $filename = sprintf("registrations-for-%s", $event_slug); |
|
| 512 | 512 | |
| 513 | - $handle = $this->EE_CSV->begin_sending_csv( $filename); |
|
| 513 | + $handle = $this->EE_CSV->begin_sending_csv($filename); |
|
| 514 | 514 | $this->EE_CSV->write_data_array_to_csv($handle, $registrations_csv_ready_array); |
| 515 | 515 | $this->EE_CSV->end_sending_csv($handle); |
| 516 | 516 | } |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | * @param EE_Model_Field_Base $field |
| 521 | 521 | * @return string |
| 522 | 522 | */ |
| 523 | - protected function _get_column_name_for_field(EE_Model_Field_Base $field){ |
|
| 523 | + protected function _get_column_name_for_field(EE_Model_Field_Base $field) { |
|
| 524 | 524 | return $field->get_nicename()."[".$field->get_name()."]"; |
| 525 | 525 | } |
| 526 | 526 | |
@@ -533,17 +533,17 @@ discard block |
||
| 533 | 533 | function export_categories() { |
| 534 | 534 | // are any Event IDs set? |
| 535 | 535 | $query_params = array(); |
| 536 | - if ( isset( $this->_req_data['EVT_CAT_ID'] )) { |
|
| 536 | + if (isset($this->_req_data['EVT_CAT_ID'])) { |
|
| 537 | 537 | // do we have an array of IDs ? |
| 538 | - if ( is_array( $this->_req_data['EVT_CAT_ID'] )) { |
|
| 538 | + if (is_array($this->_req_data['EVT_CAT_ID'])) { |
|
| 539 | 539 | // generate an "IN (CSV)" where clause |
| 540 | - $EVT_CAT_IDs = array_map( 'sanitize_text_field', $this->_req_data['EVT_CAT_ID'] ); |
|
| 540 | + $EVT_CAT_IDs = array_map('sanitize_text_field', $this->_req_data['EVT_CAT_ID']); |
|
| 541 | 541 | $filename = 'event-categories'; |
| 542 | - $query_params[0]['term_taxonomy_id'] = array('IN',$EVT_CAT_IDs); |
|
| 542 | + $query_params[0]['term_taxonomy_id'] = array('IN', $EVT_CAT_IDs); |
|
| 543 | 543 | } else { |
| 544 | 544 | // generate regular where = clause |
| 545 | - $EVT_CAT_ID = absint( $this->_req_data['EVT_CAT_ID'] ); |
|
| 546 | - $filename = 'event-category#' . $EVT_CAT_ID; |
|
| 545 | + $EVT_CAT_ID = absint($this->_req_data['EVT_CAT_ID']); |
|
| 546 | + $filename = 'event-category#'.$EVT_CAT_ID; |
|
| 547 | 547 | $query_params[0]['term_taxonomy_id'] = $EVT_CAT_ID; |
| 548 | 548 | } |
| 549 | 549 | } else { |
@@ -555,11 +555,11 @@ discard block |
||
| 555 | 555 | 'Term_Taxonomy' => $query_params |
| 556 | 556 | ); |
| 557 | 557 | |
| 558 | - $table_data = $this->_get_export_data_for_models( $tables_to_export ); |
|
| 559 | - $filename = $this->generate_filename ( $filename ); |
|
| 558 | + $table_data = $this->_get_export_data_for_models($tables_to_export); |
|
| 559 | + $filename = $this->generate_filename($filename); |
|
| 560 | 560 | |
| 561 | - if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $table_data )) { |
|
| 562 | - EE_Error::add_error(__('An error occurred and the Category details could not be exported from the database.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 561 | + if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $table_data)) { |
|
| 562 | + EE_Error::add_error(__('An error occurred and the Category details could not be exported from the database.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 563 | 563 | } |
| 564 | 564 | } |
| 565 | 565 | |
@@ -570,13 +570,13 @@ discard block |
||
| 570 | 570 | * @param string - export_name |
| 571 | 571 | * @return string on success, FALSE on fail |
| 572 | 572 | */ |
| 573 | - private function generate_filename ( $export_name = '' ) { |
|
| 574 | - if ( $export_name != '' ) { |
|
| 575 | - $filename = get_bloginfo('name') . '-' . $export_name; |
|
| 576 | - $filename = sanitize_key( $filename ) . '-' . $this->today; |
|
| 573 | + private function generate_filename($export_name = '') { |
|
| 574 | + if ($export_name != '') { |
|
| 575 | + $filename = get_bloginfo('name').'-'.$export_name; |
|
| 576 | + $filename = sanitize_key($filename).'-'.$this->today; |
|
| 577 | 577 | return $filename; |
| 578 | - } else { |
|
| 579 | - EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 578 | + } else { |
|
| 579 | + EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
| 580 | 580 | } |
| 581 | 581 | return false; |
| 582 | 582 | } |
@@ -589,12 +589,12 @@ discard block |
||
| 589 | 589 | * @param array $models_to_export keys are model names (eg 'Event', 'Attendee', etc.) and values are arrays of query params like on EEM_Base::get_all |
| 590 | 590 | * @return array on success, FALSE on fail |
| 591 | 591 | */ |
| 592 | - private function _get_export_data_for_models( $models_to_export = array() ) { |
|
| 592 | + private function _get_export_data_for_models($models_to_export = array()) { |
|
| 593 | 593 | $table_data = FALSE; |
| 594 | - if ( is_array( $models_to_export ) ) { |
|
| 595 | - foreach ( $models_to_export as $model_name => $query_params ) { |
|
| 594 | + if (is_array($models_to_export)) { |
|
| 595 | + foreach ($models_to_export as $model_name => $query_params) { |
|
| 596 | 596 | //check for a numerically-indexed array. in that case, $model_name is the value!! |
| 597 | - if(is_int($model_name)){ |
|
| 597 | + if (is_int($model_name)) { |
|
| 598 | 598 | $model_name = $query_params; |
| 599 | 599 | $query_params = array(); |
| 600 | 600 | } |
@@ -602,17 +602,17 @@ discard block |
||
| 602 | 602 | $model_objects = $model->get_all($query_params); |
| 603 | 603 | |
| 604 | 604 | $table_data[$model_name] = array(); |
| 605 | - foreach($model_objects as $model_object){ |
|
| 605 | + foreach ($model_objects as $model_object) { |
|
| 606 | 606 | $model_data_array = array(); |
| 607 | 607 | $fields = $model->field_settings(); |
| 608 | - foreach($fields as $field){ |
|
| 608 | + foreach ($fields as $field) { |
|
| 609 | 609 | $column_name = $field->get_nicename()."[".$field->get_name()."]"; |
| 610 | - if($field instanceof EE_Datetime_Field){ |
|
| 610 | + if ($field instanceof EE_Datetime_Field) { |
|
| 611 | 611 | // $field->set_date_format('Y-m-d'); |
| 612 | 612 | // $field->set_time_format('H:i:s'); |
| 613 | - $model_data_array[$column_name] = $model_object->get_datetime($field->get_name(),'Y-m-d','H:i:s'); |
|
| 613 | + $model_data_array[$column_name] = $model_object->get_datetime($field->get_name(), 'Y-m-d', 'H:i:s'); |
|
| 614 | 614 | } |
| 615 | - else{ |
|
| 615 | + else { |
|
| 616 | 616 | $model_data_array[$column_name] = $model_object->get($field->get_name()); |
| 617 | 617 | } |
| 618 | 618 | } |
@@ -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 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
| 3 | 5 | /** |
| 4 | 6 | * EE_Export class |
@@ -256,10 +258,10 @@ discard block |
||
| 256 | 258 | if( $field_name == 'STA_ID' ){ |
| 257 | 259 | $state_name_field = EEM_State::instance()->field_settings_for( 'STA_name' ); |
| 258 | 260 | $csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ]; |
| 259 | - }elseif( $field_name == 'CNT_ISO' ){ |
|
| 261 | + } elseif( $field_name == 'CNT_ISO' ){ |
|
| 260 | 262 | $country_name_field = EEM_Country::instance()->field_settings_for( 'CNT_name' ); |
| 261 | 263 | $csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ]; |
| 262 | - }else{ |
|
| 264 | + } else{ |
|
| 263 | 265 | $csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ]; |
| 264 | 266 | } |
| 265 | 267 | } |
@@ -350,7 +352,7 @@ discard block |
||
| 350 | 352 | ); |
| 351 | 353 | if( $event_id ){ |
| 352 | 354 | $query_params[0]['EVT_ID'] = $event_id; |
| 353 | - }else{ |
|
| 355 | + } else{ |
|
| 354 | 356 | $query_params[ 'force_join' ][] = 'Event'; |
| 355 | 357 | } |
| 356 | 358 | $registrations = $reg_model->get_all( $query_params ); |
@@ -371,11 +373,11 @@ discard block |
||
| 371 | 373 | $field = $reg_model->field_settings_for($field_name); |
| 372 | 374 | if($field_name == 'REG_final_price'){ |
| 373 | 375 | $value = $registration->get_pretty($field_name,'localized_float'); |
| 374 | - }elseif( $field_name == 'REG_count' ){ |
|
| 376 | + } elseif( $field_name == 'REG_count' ){ |
|
| 375 | 377 | $value = sprintf( __( '%s of %s', 'event_espresso' ), $registration->get_pretty( 'REG_count' ), $registration->get_pretty( 'REG_group_size' ) ); |
| 376 | - }elseif( $field_name == 'REG_date' ) { |
|
| 378 | + } elseif( $field_name == 'REG_date' ) { |
|
| 377 | 379 | $value = $registration->get_pretty( $field->get_name(), 'no_html' ); |
| 378 | - }else{ |
|
| 380 | + } else{ |
|
| 379 | 381 | $value = $registration->get_pretty($field->get_name()); |
| 380 | 382 | } |
| 381 | 383 | $reg_csv_array[$this->_get_column_name_for_field($field)] = $value; |
@@ -444,20 +446,20 @@ discard block |
||
| 444 | 446 | $state = $attendee->state_obj(); |
| 445 | 447 | if($state){ |
| 446 | 448 | $value = $state->name(); |
| 447 | - }else{ |
|
| 449 | + } else{ |
|
| 448 | 450 | $value = ''; |
| 449 | 451 | } |
| 450 | - }elseif($att_field_name == 'CNT_ISO'){ |
|
| 452 | + } elseif($att_field_name == 'CNT_ISO'){ |
|
| 451 | 453 | $country = $attendee->country_obj(); |
| 452 | 454 | if($country){ |
| 453 | 455 | $value = $country->name(); |
| 454 | - }else{ |
|
| 456 | + } else{ |
|
| 455 | 457 | $value = ''; |
| 456 | 458 | } |
| 457 | - }else{ |
|
| 459 | + } else{ |
|
| 458 | 460 | $value = $attendee->get_pretty($att_field_name); |
| 459 | 461 | } |
| 460 | - }else{ |
|
| 462 | + } else{ |
|
| 461 | 463 | $value = ''; |
| 462 | 464 | } |
| 463 | 465 | $field_obj = EEM_Attendee::instance()->field_settings_for($att_field_name); |
@@ -477,7 +479,7 @@ discard block |
||
| 477 | 479 | /* @var $answer EE_Answer */ |
| 478 | 480 | if( $answer->question() instanceof EE_Question ){ |
| 479 | 481 | $question_label = $answer->question()->admin_label(); |
| 480 | - }else{ |
|
| 482 | + } else{ |
|
| 481 | 483 | $question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer->question_ID() ); |
| 482 | 484 | } |
| 483 | 485 | $reg_csv_array[ $question_label ] = $answer->pretty_value(); |
@@ -505,7 +507,7 @@ discard block |
||
| 505 | 507 | if( $event_id ){ |
| 506 | 508 | $event = EEM_Event::instance()->get_one_by_ID($event_id); |
| 507 | 509 | $event_slug = $event instanceof EE_Event ? $event->slug() : __( 'unknown', 'event_espresso' ); |
| 508 | - }else{ |
|
| 510 | + } else{ |
|
| 509 | 511 | $event_slug = __( 'all', 'event_espresso' ); |
| 510 | 512 | } |
| 511 | 513 | $filename = sprintf( "registrations-for-%s", $event_slug ); |
@@ -575,7 +577,7 @@ discard block |
||
| 575 | 577 | $filename = get_bloginfo('name') . '-' . $export_name; |
| 576 | 578 | $filename = sanitize_key( $filename ) . '-' . $this->today; |
| 577 | 579 | return $filename; |
| 578 | - } else { |
|
| 580 | + } else { |
|
| 579 | 581 | EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ ); |
| 580 | 582 | } |
| 581 | 583 | return false; |
@@ -611,8 +613,7 @@ discard block |
||
| 611 | 613 | // $field->set_date_format('Y-m-d'); |
| 612 | 614 | // $field->set_time_format('H:i:s'); |
| 613 | 615 | $model_data_array[$column_name] = $model_object->get_datetime($field->get_name(),'Y-m-d','H:i:s'); |
| 614 | - } |
|
| 615 | - else{ |
|
| 616 | + } else{ |
|
| 616 | 617 | $model_data_array[$column_name] = $model_object->get($field->get_name()); |
| 617 | 618 | } |
| 618 | 619 | } |