@@ -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 | /** |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * @param bool $routing |
43 | 43 | * @return \Extend_Transactions_Admin_Page |
44 | 44 | */ |
45 | - public function __construct( $routing = TRUE ) { |
|
46 | - parent::__construct( $routing ); |
|
47 | - define( 'TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/templates/'); |
|
48 | - define( 'TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/assets/'); |
|
49 | - define( 'TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'transactions/assets/'); |
|
45 | + public function __construct($routing = TRUE) { |
|
46 | + parent::__construct($routing); |
|
47 | + define('TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'transactions/templates/'); |
|
48 | + define('TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'transactions/assets/'); |
|
49 | + define('TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'transactions/assets/'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @return void |
59 | 59 | */ |
60 | 60 | protected function _extend_page_config() { |
61 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'transactions'; |
|
61 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'transactions'; |
|
62 | 62 | |
63 | 63 | $new_page_routes = array( |
64 | 64 | 'reports' => array( |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | ) |
68 | 68 | ); |
69 | 69 | |
70 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
70 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
71 | 71 | |
72 | 72 | $new_page_config = array( |
73 | 73 | 'reports' => array( |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | 'require_nonce' => FALSE |
86 | 86 | ) |
87 | 87 | ); |
88 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
88 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * @return void |
98 | 98 | */ |
99 | 99 | public function load_scripts_styles_reports() { |
100 | - wp_register_script( 'ee-txn-reports-js', TXN_CAF_ASSETS_URL . 'ee-transaction-admin-reports.js', array( 'google-charts' ), EVENT_ESPRESSO_VERSION, true ); |
|
101 | - wp_enqueue_script( 'ee-txn-reports-js' ); |
|
100 | + wp_register_script('ee-txn-reports-js', TXN_CAF_ASSETS_URL.'ee-transaction-admin-reports.js', array('google-charts'), EVENT_ESPRESSO_VERSION, true); |
|
101 | + wp_enqueue_script('ee-txn-reports-js'); |
|
102 | 102 | $this->_transaction_reports_js_setup(); |
103 | 103 | EE_Registry::$i18n_js_strings['currency_format'] = EEH_Money::get_format_for_google_charts(); |
104 | 104 | } |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @return void |
126 | 126 | */ |
127 | 127 | protected function _transaction_reports() { |
128 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
128 | + $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php'; |
|
129 | 129 | $this->_admin_page_title = __('Transactions', 'event_espresso'); |
130 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_reports_template_data, TRUE ); |
|
130 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_reports_template_data, TRUE); |
|
131 | 131 | |
132 | 132 | // the final template wrapper |
133 | 133 | $this->display_admin_page_with_no_sidebar(); |
@@ -142,40 +142,40 @@ discard block |
||
142 | 142 | * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated. |
143 | 143 | * @return string |
144 | 144 | */ |
145 | - private function _revenue_per_day_report( $period = '-1 month' ) { |
|
145 | + private function _revenue_per_day_report($period = '-1 month') { |
|
146 | 146 | |
147 | 147 | $report_ID = 'txn-admin-revenue-per-day-report-dv'; |
148 | 148 | |
149 | 149 | $TXN = EEM_Transaction::instance(); |
150 | 150 | |
151 | - $results = $TXN->get_revenue_per_day_report( $period ); |
|
151 | + $results = $TXN->get_revenue_per_day_report($period); |
|
152 | 152 | $results = (array) $results; |
153 | 153 | $revenue = array(); |
154 | 154 | $subtitle = ''; |
155 | 155 | |
156 | - if ( $results ) { |
|
157 | - $revenue[] = array( __( 'Date (only shows dates that have a revenue greater than 1)', 'event_espresso' ), __( 'Total Revenue', 'event_espresso' ) ); |
|
158 | - foreach ( $results as $result ) { |
|
159 | - $revenue[] = array( $result->txnDate, (float) $result->revenue ); |
|
156 | + if ($results) { |
|
157 | + $revenue[] = array(__('Date (only shows dates that have a revenue greater than 1)', 'event_espresso'), __('Total Revenue', 'event_espresso')); |
|
158 | + foreach ($results as $result) { |
|
159 | + $revenue[] = array($result->txnDate, (float) $result->revenue); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | //setup the date range. |
163 | - $beginning_date = new DateTime( 'now' . $period, new DateTimeZone( EEH_DTT_Helper::get_timezone() ) ); |
|
164 | - $ending_date = new DateTime( 'now', new DateTimeZone( EEH_DTT_Helper::get_timezone() ) ); |
|
165 | - $subtitle = sprintf( _x( 'For the period: %s to %s', 'Used to give date range', 'event_espresso' ), $beginning_date->format( 'Y-m-d' ), $ending_date->format( 'Y-m-d' ) ); |
|
163 | + $beginning_date = new DateTime('now'.$period, new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
164 | + $ending_date = new DateTime('now', new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
165 | + $subtitle = sprintf(_x('For the period: %s to %s', 'Used to give date range', 'event_espresso'), $beginning_date->format('Y-m-d'), $ending_date->format('Y-m-d')); |
|
166 | 166 | } |
167 | 167 | |
168 | - $report_title = esc_html__( 'Total Revenue per Day', 'event_espresso' ); |
|
168 | + $report_title = esc_html__('Total Revenue per Day', 'event_espresso'); |
|
169 | 169 | |
170 | 170 | $report_params = array( |
171 | 171 | 'title' => $report_title, |
172 | 172 | 'subtitle' => $subtitle, |
173 | 173 | 'id' => $report_ID, |
174 | 174 | 'revenue' => $revenue, |
175 | - 'noResults' => empty( $revenue ) || count( $revenue ) === 1, |
|
176 | - 'noTxnMsg' => sprintf( __( '%sThere is no revenue to report for the last 30 days.%s', 'event_espresso' ), '<h2>' . $report_title . '</h2><p>', '</p>' ) |
|
175 | + 'noResults' => empty($revenue) || count($revenue) === 1, |
|
176 | + 'noTxnMsg' => sprintf(__('%sThere is no revenue to report for the last 30 days.%s', 'event_espresso'), '<h2>'.$report_title.'</h2><p>', '</p>') |
|
177 | 177 | ); |
178 | - wp_localize_script( 'ee-txn-reports-js', 'txnRevPerDay', $report_params ); |
|
178 | + wp_localize_script('ee-txn-reports-js', 'txnRevPerDay', $report_params); |
|
179 | 179 | |
180 | 180 | return $report_ID; |
181 | 181 | } |
@@ -189,43 +189,43 @@ discard block |
||
189 | 189 | * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated. |
190 | 190 | * @return int |
191 | 191 | */ |
192 | - private function _revenue_per_event_report( $period = '-1 month' ) { |
|
192 | + private function _revenue_per_event_report($period = '-1 month') { |
|
193 | 193 | |
194 | 194 | $report_ID = 'txn-admin-revenue-per-event-report-dv'; |
195 | 195 | |
196 | 196 | $TXN = EEM_Transaction::instance(); |
197 | - $results = $TXN->get_revenue_per_event_report( $period ); |
|
197 | + $results = $TXN->get_revenue_per_event_report($period); |
|
198 | 198 | $results = (array) $results; |
199 | 199 | $revenue = array(); |
200 | 200 | $subtitle = ''; |
201 | 201 | |
202 | - if ( $results ) { |
|
203 | - $revenue[] = array( __( 'Event (only events that have a revenue greater than 1 are shown)', 'event_espresso' ), __( 'Total Revenue', 'event_espresso' ) ); |
|
204 | - foreach ( $results as $result ) { |
|
205 | - if ( $result->revenue > 1 ) { |
|
206 | - $event_name = stripslashes( html_entity_decode( $result->event_name, ENT_QUOTES, 'UTF-8' ) ); |
|
207 | - $event_name = wp_trim_words( $event_name, 5, '...' ); |
|
208 | - $revenue[] = array( $event_name, (float) $result->revenue ); |
|
202 | + if ($results) { |
|
203 | + $revenue[] = array(__('Event (only events that have a revenue greater than 1 are shown)', 'event_espresso'), __('Total Revenue', 'event_espresso')); |
|
204 | + foreach ($results as $result) { |
|
205 | + if ($result->revenue > 1) { |
|
206 | + $event_name = stripslashes(html_entity_decode($result->event_name, ENT_QUOTES, 'UTF-8')); |
|
207 | + $event_name = wp_trim_words($event_name, 5, '...'); |
|
208 | + $revenue[] = array($event_name, (float) $result->revenue); |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 | |
212 | 212 | //setup the date range. |
213 | - $beginning_date = new DateTime( 'now' . $period, new DateTimeZone( EEH_DTT_Helper::get_timezone() ) ); |
|
214 | - $ending_date = new DateTime( 'now', new DateTimeZone( EEH_DTT_Helper::get_timezone() ) ); |
|
215 | - $subtitle = sprintf( _x( 'For the period: %s to %s', 'Used to give date range', 'event_espresso' ), $beginning_date->format( 'Y-m-d' ), $ending_date->format( 'Y-m-d' ) ); |
|
213 | + $beginning_date = new DateTime('now'.$period, new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
214 | + $ending_date = new DateTime('now', new DateTimeZone(EEH_DTT_Helper::get_timezone())); |
|
215 | + $subtitle = sprintf(_x('For the period: %s to %s', 'Used to give date range', 'event_espresso'), $beginning_date->format('Y-m-d'), $ending_date->format('Y-m-d')); |
|
216 | 216 | } |
217 | 217 | |
218 | - $report_title = esc_html__( 'Total Revenue per Event', 'event_espresso' ); |
|
218 | + $report_title = esc_html__('Total Revenue per Event', 'event_espresso'); |
|
219 | 219 | |
220 | 220 | $report_params = array( |
221 | 221 | 'title' => $report_title, |
222 | 222 | 'subtitle' => $subtitle, |
223 | 223 | 'id' => $report_ID, |
224 | 224 | 'revenue' => $revenue, |
225 | - 'noResults' => empty( $revenue ), |
|
226 | - 'noTxnMsg' => sprintf( __( '%sThere is no revenue to report for the last 30 days.%s', 'event_espresso' ), '<h2>' . $report_title . '</h2><p>', '</p>' ) |
|
225 | + 'noResults' => empty($revenue), |
|
226 | + 'noTxnMsg' => sprintf(__('%sThere is no revenue to report for the last 30 days.%s', 'event_espresso'), '<h2>'.$report_title.'</h2><p>', '</p>') |
|
227 | 227 | ); |
228 | - wp_localize_script( 'ee-txn-reports-js', 'txnRevPerEvent', $report_params ); |
|
228 | + wp_localize_script('ee-txn-reports-js', 'txnRevPerEvent', $report_params); |
|
229 | 229 | |
230 | 230 | return $report_ID; |
231 | 231 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('ABSPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | */ |
44 | 44 | |
45 | -if ( function_exists( 'espresso_version' ) ) { |
|
45 | +if (function_exists('espresso_version')) { |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * espresso_duplicate_plugin_error |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | function espresso_duplicate_plugin_error() { |
52 | 52 | ?> |
53 | 53 | <div class="error"> |
54 | - <p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p> |
|
54 | + <p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p> |
|
55 | 55 | </div> |
56 | 56 | <?php |
57 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
57 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
58 | 58 | } |
59 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
59 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
60 | 60 | |
61 | 61 | } else { |
62 | 62 | |
@@ -67,102 +67,102 @@ discard block |
||
67 | 67 | * @return string |
68 | 68 | */ |
69 | 69 | function espresso_version() { |
70 | - return apply_filters( 'FHEE__espresso__espresso_version', '4.9.17.rc.027' ); |
|
70 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.17.rc.027'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // define versions |
74 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
75 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.1' ); |
|
76 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' ); |
|
77 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
78 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
79 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
74 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
75 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
76 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
77 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
78 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
79 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
80 | 80 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
81 | - if ( ! defined( 'DS' ) ) { |
|
82 | - define( 'DS', '/' ); |
|
81 | + if ( ! defined('DS')) { |
|
82 | + define('DS', '/'); |
|
83 | 83 | } |
84 | - if ( ! defined( 'PS' ) ) { |
|
85 | - define( 'PS', PATH_SEPARATOR ); |
|
84 | + if ( ! defined('PS')) { |
|
85 | + define('PS', PATH_SEPARATOR); |
|
86 | 86 | } |
87 | - if ( ! defined( 'SP' ) ) { |
|
88 | - define( 'SP', ' ' ); |
|
87 | + if ( ! defined('SP')) { |
|
88 | + define('SP', ' '); |
|
89 | 89 | } |
90 | - if ( ! defined( 'EENL' ) ) { |
|
91 | - define( 'EENL', "\n" ); |
|
90 | + if ( ! defined('EENL')) { |
|
91 | + define('EENL', "\n"); |
|
92 | 92 | } |
93 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
93 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
94 | 94 | // define the plugin directory and URL |
95 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
96 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
97 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
95 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
96 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
97 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
98 | 98 | // main root folder paths |
99 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
100 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
101 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
102 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
103 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
104 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
105 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
106 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
99 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
100 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
101 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
102 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
103 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
104 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
105 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
106 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
107 | 107 | // core system paths |
108 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
109 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
110 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
111 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
112 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
113 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
114 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
115 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
116 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
117 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
118 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
119 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
108 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
109 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
110 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
111 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
112 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
113 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
114 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
115 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
116 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
117 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
118 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
119 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
120 | 120 | // gateways |
121 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
122 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
121 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
122 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
123 | 123 | // asset URL paths |
124 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
125 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
126 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
127 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
128 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
129 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
124 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
125 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
126 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
127 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
128 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
129 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
130 | 130 | // define upload paths |
131 | 131 | $uploads = wp_upload_dir(); |
132 | 132 | // define the uploads directory and URL |
133 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS ); |
|
134 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS ); |
|
133 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
134 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
135 | 135 | // define the templates directory and URL |
136 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
137 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
136 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
137 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
138 | 138 | // define the gateway directory and URL |
139 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
140 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
139 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
140 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
141 | 141 | // languages folder/path |
142 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
143 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
142 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
143 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
144 | 144 | //check for dompdf fonts in uploads |
145 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
146 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
145 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
146 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
147 | 147 | } |
148 | 148 | //ajax constants |
149 | - define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false ); |
|
150 | - define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false ); |
|
149 | + define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false); |
|
150 | + define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false); |
|
151 | 151 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
152 | 152 | //you're better to use this than its straight value (currently -1) in case you ever |
153 | 153 | //want to change its default value! or find when -1 means infinity |
154 | - define( 'EE_INF_IN_DB', -1 ); |
|
155 | - define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
156 | - define( 'EE_DEBUG', false ); |
|
154 | + define('EE_INF_IN_DB', -1); |
|
155 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
156 | + define('EE_DEBUG', false); |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * espresso_plugin_activation |
160 | 160 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
161 | 161 | */ |
162 | 162 | function espresso_plugin_activation() { |
163 | - update_option( 'ee_espresso_activation', true ); |
|
163 | + update_option('ee_espresso_activation', true); |
|
164 | 164 | } |
165 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
165 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
166 | 166 | |
167 | 167 | |
168 | 168 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | // } |
177 | 177 | // |
178 | 178 | } |
179 | - register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' ); |
|
179 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function espresso_load_error_handling() { |
188 | 188 | // load debugging tools |
189 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
190 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
189 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
190 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
191 | 191 | EEH_Debug_Tools::instance(); |
192 | 192 | } |
193 | 193 | // load error handling |
194 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
195 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
194 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
195 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
196 | 196 | } else { |
197 | - wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
197 | + wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -208,25 +208,25 @@ discard block |
||
208 | 208 | * @param string $full_path_to_file |
209 | 209 | * @throws EE_Error |
210 | 210 | */ |
211 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
211 | + function espresso_load_required($classname, $full_path_to_file) { |
|
212 | 212 | static $error_handling_loaded = false; |
213 | - if ( ! $error_handling_loaded ) { |
|
213 | + if ( ! $error_handling_loaded) { |
|
214 | 214 | espresso_load_error_handling(); |
215 | 215 | $error_handling_loaded = true; |
216 | 216 | } |
217 | - if ( is_readable( $full_path_to_file ) ) { |
|
218 | - require_once( $full_path_to_file ); |
|
217 | + if (is_readable($full_path_to_file)) { |
|
218 | + require_once($full_path_to_file); |
|
219 | 219 | } else { |
220 | - throw new EE_Error ( sprintf( |
|
221 | - __( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ), |
|
220 | + throw new EE_Error(sprintf( |
|
221 | + __('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), |
|
222 | 222 | $classname |
223 | - ) ); |
|
223 | + )); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
228 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
229 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
227 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
228 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
229 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
230 | 230 | new EE_Bootstrap(); |
231 | 231 | |
232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | |
237 | 237 | |
238 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
238 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
239 | 239 | /** |
240 | 240 | * deactivate_plugin |
241 | 241 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -244,11 +244,11 @@ discard block |
||
244 | 244 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
245 | 245 | * @return void |
246 | 246 | */ |
247 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
248 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
249 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
247 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
248 | + if ( ! function_exists('deactivate_plugins')) { |
|
249 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
250 | 250 | } |
251 | - unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] ); |
|
252 | - deactivate_plugins( $plugin_basename ); |
|
251 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
252 | + deactivate_plugins($plugin_basename); |
|
253 | 253 | } |
254 | 254 | } |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | /** |
580 | 580 | * returns any events attached to this attendee ($_Event property); |
581 | 581 | * |
582 | - * @return array |
|
582 | + * @return EE_Base_Class[] |
|
583 | 583 | */ |
584 | 584 | public function events() |
585 | 585 | { |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | * used to save the billing info |
595 | 595 | * |
596 | 596 | * @param EE_Payment_Method $payment_method the _gateway_name property on the gateway class |
597 | - * @return EE_Form_Section_Proper|null |
|
597 | + * @return null|EE_Billing_Info_Form |
|
598 | 598 | */ |
599 | 599 | public function billing_info_for_payment_method($payment_method) |
600 | 600 | { |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
2 | - exit('No direct script access allowed'); |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -10,7 +10,6 @@ discard block |
||
10 | 10 | * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
11 | 11 | * @ link {@link http://www.eventespresso.com} |
12 | 12 | * @ since 4.0 |
13 | - |
|
14 | 13 | */ |
15 | 14 | |
16 | 15 | |
@@ -25,695 +24,695 @@ discard block |
||
25 | 24 | class EE_Attendee extends EE_CPT_Base implements EEI_Contact, EEI_Address, EEI_Admin_Links, EEI_Attendee |
26 | 25 | { |
27 | 26 | |
28 | - /** |
|
29 | - * Sets some dynamic defaults |
|
30 | - * |
|
31 | - * @param array $fieldValues |
|
32 | - * @param bool $bydb |
|
33 | - * @param string $timezone |
|
34 | - * @param array $date_formats |
|
35 | - */ |
|
36 | - protected function __construct($fieldValues = null, $bydb = false, $timezone = null, $date_formats = array()) |
|
37 | - { |
|
38 | - if ( ! isset($fieldValues['ATT_full_name'])) { |
|
39 | - $fname = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'] . ' ' : ''; |
|
40 | - $lname = isset($fieldValues['ATT_lname']) ? $fieldValues['ATT_lname'] : ''; |
|
41 | - $fieldValues['ATT_full_name'] = $fname . $lname; |
|
42 | - } |
|
43 | - if ( ! isset($fieldValues['ATT_slug'])) { |
|
44 | - // $fieldValues['ATT_slug'] = sanitize_key(wp_generate_password(20)); |
|
45 | - $fieldValues['ATT_slug'] = sanitize_title($fieldValues['ATT_full_name']); |
|
46 | - } |
|
47 | - if ( ! isset($fieldValues['ATT_short_bio']) && isset($fieldValues['ATT_bio'])) { |
|
48 | - $fieldValues['ATT_short_bio'] = substr($fieldValues['ATT_bio'], 0, 50); |
|
49 | - } |
|
50 | - parent::__construct($fieldValues, $bydb, $timezone, $date_formats); |
|
51 | - } |
|
52 | - |
|
53 | - |
|
54 | - |
|
55 | - /** |
|
56 | - * @param array $props_n_values incoming values |
|
57 | - * @param string $timezone incoming timezone (if not set the timezone set for the website will be |
|
58 | - * used.) |
|
59 | - * @param array $date_formats incoming date_formats in an array where the first value is the |
|
60 | - * date_format and the second value is the time format |
|
61 | - * @return EE_Attendee |
|
62 | - */ |
|
63 | - public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) |
|
64 | - { |
|
65 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
66 | - return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - |
|
71 | - /** |
|
72 | - * @param array $props_n_values incoming values from the database |
|
73 | - * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
|
74 | - * the website will be used. |
|
75 | - * @return EE_Attendee |
|
76 | - */ |
|
77 | - public static function new_instance_from_db($props_n_values = array(), $timezone = null) |
|
78 | - { |
|
79 | - return new self($props_n_values, true, $timezone); |
|
80 | - } |
|
81 | - |
|
82 | - |
|
83 | - |
|
84 | - /** |
|
85 | - * Set Attendee First Name |
|
86 | - * |
|
87 | - * @access public |
|
88 | - * @param string $fname |
|
89 | - */ |
|
90 | - public function set_fname($fname = '') |
|
91 | - { |
|
92 | - $this->set('ATT_fname', $fname); |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * Set Attendee Last Name |
|
99 | - * |
|
100 | - * @access public |
|
101 | - * @param string $lname |
|
102 | - */ |
|
103 | - public function set_lname($lname = '') |
|
104 | - { |
|
105 | - $this->set('ATT_lname', $lname); |
|
106 | - } |
|
107 | - |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * Set Attendee Address |
|
112 | - * |
|
113 | - * @access public |
|
114 | - * @param string $address |
|
115 | - */ |
|
116 | - public function set_address($address = '') |
|
117 | - { |
|
118 | - $this->set('ATT_address', $address); |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - |
|
123 | - /** |
|
124 | - * Set Attendee Address2 |
|
125 | - * |
|
126 | - * @access public |
|
127 | - * @param string $address2 |
|
128 | - */ |
|
129 | - public function set_address2($address2 = '') |
|
130 | - { |
|
131 | - $this->set('ATT_address2', $address2); |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - |
|
136 | - /** |
|
137 | - * Set Attendee City |
|
138 | - * |
|
139 | - * @access public |
|
140 | - * @param string $city |
|
141 | - */ |
|
142 | - public function set_city($city = '') |
|
143 | - { |
|
144 | - $this->set('ATT_city', $city); |
|
145 | - } |
|
146 | - |
|
147 | - |
|
148 | - |
|
149 | - /** |
|
150 | - * Set Attendee State ID |
|
151 | - * |
|
152 | - * @access public |
|
153 | - * @param int $STA_ID |
|
154 | - */ |
|
155 | - public function set_state($STA_ID = 0) |
|
156 | - { |
|
157 | - $this->set('STA_ID', $STA_ID); |
|
158 | - } |
|
159 | - |
|
160 | - |
|
161 | - |
|
162 | - /** |
|
163 | - * Set Attendee Country ISO Code |
|
164 | - * |
|
165 | - * @access public |
|
166 | - * @param string $CNT_ISO |
|
167 | - */ |
|
168 | - public function set_country($CNT_ISO = '') |
|
169 | - { |
|
170 | - $this->set('CNT_ISO', $CNT_ISO); |
|
171 | - } |
|
172 | - |
|
173 | - |
|
174 | - |
|
175 | - /** |
|
176 | - * Set Attendee Zip/Postal Code |
|
177 | - * |
|
178 | - * @access public |
|
179 | - * @param string $zip |
|
180 | - */ |
|
181 | - public function set_zip($zip = '') |
|
182 | - { |
|
183 | - $this->set('ATT_zip', $zip); |
|
184 | - } |
|
185 | - |
|
186 | - |
|
187 | - |
|
188 | - /** |
|
189 | - * Set Attendee Email Address |
|
190 | - * |
|
191 | - * @access public |
|
192 | - * @param string $email |
|
193 | - */ |
|
194 | - public function set_email($email = '') |
|
195 | - { |
|
196 | - $this->set('ATT_email', $email); |
|
197 | - } |
|
198 | - |
|
199 | - |
|
200 | - |
|
201 | - /** |
|
202 | - * Set Attendee Phone |
|
203 | - * |
|
204 | - * @access public |
|
205 | - * @param string $phone |
|
206 | - */ |
|
207 | - public function set_phone($phone = '') |
|
208 | - { |
|
209 | - $this->set('ATT_phone', $phone); |
|
210 | - } |
|
211 | - |
|
212 | - |
|
213 | - |
|
214 | - /** |
|
215 | - * set deleted |
|
216 | - * |
|
217 | - * @access public |
|
218 | - * @param bool $ATT_deleted |
|
219 | - */ |
|
220 | - public function set_deleted($ATT_deleted = false) |
|
221 | - { |
|
222 | - $this->set('ATT_deleted', $ATT_deleted); |
|
223 | - } |
|
224 | - |
|
225 | - |
|
226 | - |
|
227 | - /** |
|
228 | - * Returns the value for the post_author id saved with the cpt |
|
229 | - * |
|
230 | - * @since 4.5.0 |
|
231 | - * @return int |
|
232 | - */ |
|
233 | - public function wp_user() |
|
234 | - { |
|
235 | - return $this->get('ATT_author'); |
|
236 | - } |
|
237 | - |
|
238 | - |
|
239 | - |
|
240 | - /** |
|
241 | - * get Attendee First Name |
|
242 | - * |
|
243 | - * @access public |
|
244 | - * @return string |
|
245 | - */ |
|
246 | - public function fname() |
|
247 | - { |
|
248 | - return $this->get('ATT_fname'); |
|
249 | - } |
|
250 | - |
|
251 | - |
|
252 | - |
|
253 | - /** |
|
254 | - * echoes out the attendee's first name |
|
255 | - * |
|
256 | - * @return void |
|
257 | - */ |
|
258 | - public function e_full_name() |
|
259 | - { |
|
260 | - echo $this->full_name(); |
|
261 | - } |
|
262 | - |
|
263 | - |
|
264 | - |
|
265 | - /** |
|
266 | - * Returns the first and last name concatenated together with a space. |
|
267 | - * |
|
268 | - * @param bool $apply_html_entities |
|
269 | - * @return string |
|
270 | - */ |
|
271 | - public function full_name($apply_html_entities = false) |
|
272 | - { |
|
273 | - $full_name = $this->fname() . ' ' . $this->lname(); |
|
274 | - return $apply_html_entities ? htmlentities($full_name, ENT_QUOTES, 'UTF-8') : $full_name; |
|
275 | - } |
|
276 | - |
|
277 | - |
|
278 | - |
|
279 | - /** |
|
280 | - * get Attendee Last Name |
|
281 | - * |
|
282 | - * @access public |
|
283 | - * @return string |
|
284 | - */ |
|
285 | - public function lname() |
|
286 | - { |
|
287 | - return $this->get('ATT_lname'); |
|
288 | - } |
|
289 | - |
|
290 | - |
|
291 | - |
|
292 | - /** |
|
293 | - * Gets the attendee's full address as an array so client code can decide hwo to display it |
|
294 | - * |
|
295 | - * @return array numerically indexed, with each part of the address that is known. |
|
296 | - * Eg, if the user only responded to state and country, |
|
297 | - * it would be array(0=>'Alabama',1=>'USA') |
|
298 | - * @return array |
|
299 | - */ |
|
300 | - public function full_address_as_array() |
|
301 | - { |
|
302 | - $full_address_array = array(); |
|
303 | - $initial_address_fields = array('ATT_address', 'ATT_address2', 'ATT_city',); |
|
304 | - foreach ($initial_address_fields as $address_field_name) { |
|
305 | - $address_fields_value = $this->get($address_field_name); |
|
306 | - if ( ! empty($address_fields_value)) { |
|
307 | - $full_address_array[] = $address_fields_value; |
|
308 | - } |
|
309 | - } |
|
310 | - //now handle state and country |
|
311 | - $state_obj = $this->state_obj(); |
|
312 | - if ( ! empty($state_obj)) { |
|
313 | - $full_address_array[] = $state_obj->name(); |
|
314 | - } |
|
315 | - $country_obj = $this->country_obj(); |
|
316 | - if ( ! empty($country_obj)) { |
|
317 | - $full_address_array[] = $country_obj->name(); |
|
318 | - } |
|
319 | - //lastly get the xip |
|
320 | - $zip_value = $this->zip(); |
|
321 | - if ( ! empty($zip_value)) { |
|
322 | - $full_address_array[] = $zip_value; |
|
323 | - } |
|
324 | - return $full_address_array; |
|
325 | - } |
|
326 | - |
|
327 | - |
|
328 | - |
|
329 | - /** |
|
330 | - * get Attendee Address |
|
331 | - * |
|
332 | - * @return string |
|
333 | - */ |
|
334 | - public function address() |
|
335 | - { |
|
336 | - return $this->get('ATT_address'); |
|
337 | - } |
|
338 | - |
|
339 | - |
|
340 | - |
|
341 | - /** |
|
342 | - * get Attendee Address2 |
|
343 | - * |
|
344 | - * @return string |
|
345 | - */ |
|
346 | - public function address2() |
|
347 | - { |
|
348 | - return $this->get('ATT_address2'); |
|
349 | - } |
|
350 | - |
|
351 | - |
|
352 | - |
|
353 | - /** |
|
354 | - * get Attendee City |
|
355 | - * |
|
356 | - * @return string |
|
357 | - */ |
|
358 | - public function city() |
|
359 | - { |
|
360 | - return $this->get('ATT_city'); |
|
361 | - } |
|
362 | - |
|
363 | - |
|
364 | - |
|
365 | - /** |
|
366 | - * get Attendee State ID |
|
367 | - * |
|
368 | - * @return string |
|
369 | - */ |
|
370 | - public function state_ID() |
|
371 | - { |
|
372 | - return $this->get('STA_ID'); |
|
373 | - } |
|
374 | - |
|
375 | - |
|
376 | - |
|
377 | - /** |
|
378 | - * @return string |
|
379 | - */ |
|
380 | - public function state_abbrev() |
|
381 | - { |
|
382 | - return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : ''; |
|
383 | - } |
|
384 | - |
|
385 | - |
|
386 | - |
|
387 | - /** |
|
388 | - * Gets the state set to this attendee |
|
389 | - * |
|
390 | - * @return EE_State |
|
391 | - */ |
|
392 | - public function state_obj() |
|
393 | - { |
|
394 | - return $this->get_first_related('State'); |
|
395 | - } |
|
396 | - |
|
397 | - |
|
398 | - |
|
399 | - /** |
|
400 | - * Returns the state's name, otherwise 'Unknown' |
|
401 | - * |
|
402 | - * @return string |
|
403 | - */ |
|
404 | - public function state_name() |
|
405 | - { |
|
406 | - if ($this->state_obj()) { |
|
407 | - return $this->state_obj()->name(); |
|
408 | - } else { |
|
409 | - return ''; |
|
410 | - } |
|
411 | - } |
|
412 | - |
|
413 | - |
|
414 | - |
|
415 | - /** |
|
416 | - * either displays the state abbreviation or the state name, as determined |
|
417 | - * by the "FHEE__EEI_Address__state__use_abbreviation" filter. |
|
418 | - * defaults to abbreviation |
|
419 | - * |
|
420 | - * @return string |
|
421 | - */ |
|
422 | - public function state() |
|
423 | - { |
|
424 | - if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) { |
|
425 | - return $this->state_abbrev(); |
|
426 | - } else { |
|
427 | - return $this->state_name(); |
|
428 | - } |
|
429 | - } |
|
430 | - |
|
431 | - |
|
432 | - |
|
433 | - /** |
|
434 | - * get Attendee Country ISO Code |
|
435 | - * |
|
436 | - * @return string |
|
437 | - */ |
|
438 | - public function country_ID() |
|
439 | - { |
|
440 | - return $this->get('CNT_ISO'); |
|
441 | - } |
|
442 | - |
|
443 | - |
|
444 | - |
|
445 | - /** |
|
446 | - * Gets country set for this attendee |
|
447 | - * |
|
448 | - * @return EE_Country |
|
449 | - */ |
|
450 | - public function country_obj() |
|
451 | - { |
|
452 | - return $this->get_first_related('Country'); |
|
453 | - } |
|
454 | - |
|
455 | - |
|
456 | - |
|
457 | - /** |
|
458 | - * Returns the country's name if known, otherwise 'Unknown' |
|
459 | - * |
|
460 | - * @return string |
|
461 | - */ |
|
462 | - public function country_name() |
|
463 | - { |
|
464 | - if ($this->country_obj()) { |
|
465 | - return $this->country_obj()->name(); |
|
466 | - } else { |
|
467 | - return ''; |
|
468 | - } |
|
469 | - } |
|
470 | - |
|
471 | - |
|
472 | - |
|
473 | - /** |
|
474 | - * either displays the country ISO2 code or the country name, as determined |
|
475 | - * by the "FHEE__EEI_Address__country__use_abbreviation" filter. |
|
476 | - * defaults to abbreviation |
|
477 | - * |
|
478 | - * @return string |
|
479 | - */ |
|
480 | - public function country() |
|
481 | - { |
|
482 | - if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) { |
|
483 | - return $this->country_ID(); |
|
484 | - } else { |
|
485 | - return $this->country_name(); |
|
486 | - } |
|
487 | - } |
|
488 | - |
|
489 | - |
|
490 | - |
|
491 | - /** |
|
492 | - * get Attendee Zip/Postal Code |
|
493 | - * |
|
494 | - * @return string |
|
495 | - */ |
|
496 | - public function zip() |
|
497 | - { |
|
498 | - return $this->get('ATT_zip'); |
|
499 | - } |
|
500 | - |
|
501 | - |
|
502 | - |
|
503 | - /** |
|
504 | - * get Attendee Email Address |
|
505 | - * |
|
506 | - * @return string |
|
507 | - */ |
|
508 | - public function email() |
|
509 | - { |
|
510 | - return $this->get('ATT_email'); |
|
511 | - } |
|
512 | - |
|
513 | - |
|
514 | - |
|
515 | - /** |
|
516 | - * get Attendee Phone # |
|
517 | - * |
|
518 | - * @return string |
|
519 | - */ |
|
520 | - public function phone() |
|
521 | - { |
|
522 | - return $this->get('ATT_phone'); |
|
523 | - } |
|
524 | - |
|
525 | - |
|
526 | - |
|
527 | - /** |
|
528 | - * get deleted |
|
529 | - * |
|
530 | - * @return bool |
|
531 | - */ |
|
532 | - public function deleted() |
|
533 | - { |
|
534 | - return $this->get('ATT_deleted'); |
|
535 | - } |
|
536 | - |
|
537 | - |
|
538 | - |
|
539 | - /** |
|
540 | - * Gets registrations of this attendee |
|
541 | - * |
|
542 | - * @param array $query_params |
|
543 | - * @return EE_Registration[] |
|
544 | - */ |
|
545 | - public function get_registrations($query_params = array()) |
|
546 | - { |
|
547 | - return $this->get_many_related('Registration', $query_params); |
|
548 | - } |
|
549 | - |
|
550 | - |
|
551 | - |
|
552 | - /** |
|
553 | - * Gets the most recent registration of this attendee |
|
554 | - * |
|
555 | - * @return EE_Registration |
|
556 | - */ |
|
557 | - public function get_most_recent_registration() |
|
558 | - { |
|
559 | - return $this->get_first_related('Registration', |
|
560 | - array('order_by' => array('REG_date' => 'DESC'))); //null, 'REG_date', 'DESC', '=', 'OBJECT_K'); |
|
561 | - } |
|
562 | - |
|
563 | - |
|
564 | - |
|
565 | - /** |
|
566 | - * Gets the most recent registration for this attend at this event |
|
567 | - * |
|
568 | - * @param int $event_id |
|
569 | - * @return EE_Registration |
|
570 | - */ |
|
571 | - public function get_most_recent_registration_for_event($event_id) |
|
572 | - { |
|
573 | - return $this->get_first_related('Registration', |
|
574 | - array(array('EVT_ID' => $event_id), 'order_by' => array('REG_date' => 'DESC')));//, '=', 'OBJECT_K' ); |
|
575 | - } |
|
576 | - |
|
577 | - |
|
578 | - |
|
579 | - /** |
|
580 | - * returns any events attached to this attendee ($_Event property); |
|
581 | - * |
|
582 | - * @return array |
|
583 | - */ |
|
584 | - public function events() |
|
585 | - { |
|
586 | - return $this->get_many_related('Event'); |
|
587 | - } |
|
588 | - |
|
589 | - |
|
590 | - |
|
591 | - /** |
|
592 | - * Gets the billing info array where keys match espresso_reg_page_billing_inputs(), |
|
593 | - * and keys are their cleaned values. @see EE_Attendee::save_and_clean_billing_info_for_payment_method() which was |
|
594 | - * used to save the billing info |
|
595 | - * |
|
596 | - * @param EE_Payment_Method $payment_method the _gateway_name property on the gateway class |
|
597 | - * @return EE_Form_Section_Proper|null |
|
598 | - */ |
|
599 | - public function billing_info_for_payment_method($payment_method) |
|
600 | - { |
|
601 | - $pm_type = $payment_method->type_obj(); |
|
602 | - if ( ! $pm_type instanceof EE_PMT_Base) { |
|
603 | - return null; |
|
604 | - } |
|
605 | - $billing_info = $this->get_post_meta($this->get_billing_info_postmeta_name($payment_method), true); |
|
606 | - if ( ! $billing_info) { |
|
607 | - return null; |
|
608 | - } |
|
609 | - $billing_form = $pm_type->billing_form(); |
|
610 | - if ($billing_form instanceof EE_Form_Section_Proper) { |
|
611 | - $billing_form->receive_form_submission(array($billing_form->name() => $billing_info), false); |
|
612 | - } |
|
613 | - return $billing_form; |
|
614 | - } |
|
615 | - |
|
616 | - |
|
617 | - |
|
618 | - /** |
|
619 | - * Gets the postmeta key that holds this attendee's billing info for the |
|
620 | - * specified payment method |
|
621 | - * |
|
622 | - * @param EE_Payment_Method $payment_method |
|
623 | - * @return string |
|
624 | - */ |
|
625 | - public function get_billing_info_postmeta_name($payment_method) |
|
626 | - { |
|
627 | - if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
628 | - return 'billing_info_' . $payment_method->type_obj()->system_name(); |
|
629 | - } else { |
|
630 | - return null; |
|
631 | - } |
|
632 | - } |
|
633 | - |
|
634 | - |
|
635 | - |
|
636 | - /** |
|
637 | - * Saves the billing info to the attendee. @see EE_Attendee::billing_info_for_payment_method() which is used to |
|
638 | - * retrieve it |
|
639 | - * |
|
640 | - * @param EE_Billing_Attendee_Info_Form $billing_form |
|
641 | - * @param EE_Payment_Method $payment_method |
|
642 | - * @return boolean |
|
643 | - */ |
|
644 | - public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method) |
|
645 | - { |
|
646 | - if ( ! $billing_form instanceof EE_Billing_Attendee_Info_Form) { |
|
647 | - EE_Error::add_error(__('Cannot save billing info because there is none.', 'event_espresso')); |
|
648 | - return false; |
|
649 | - } |
|
650 | - $billing_form->clean_sensitive_data(); |
|
651 | - return update_post_meta($this->ID(), $this->get_billing_info_postmeta_name($payment_method), |
|
652 | - $billing_form->input_values(true)); |
|
653 | - } |
|
654 | - |
|
655 | - |
|
656 | - |
|
657 | - /** |
|
658 | - * Return the link to the admin details for the object. |
|
659 | - * |
|
660 | - * @return string |
|
661 | - */ |
|
662 | - public function get_admin_details_link() |
|
663 | - { |
|
664 | - return $this->get_admin_edit_link(); |
|
665 | - } |
|
666 | - |
|
667 | - |
|
668 | - |
|
669 | - /** |
|
670 | - * Returns the link to the editor for the object. Sometimes this is the same as the details. |
|
671 | - * |
|
672 | - * @return string |
|
673 | - */ |
|
674 | - public function get_admin_edit_link() |
|
675 | - { |
|
676 | - EE_Registry::instance()->load_helper('URL'); |
|
677 | - return EEH_URL::add_query_args_and_nonce( |
|
678 | - array( |
|
679 | - 'page' => 'espresso_registrations', |
|
680 | - 'action' => 'edit_attendee', |
|
681 | - 'post' => $this->ID(), |
|
682 | - ), |
|
683 | - admin_url('admin.php') |
|
684 | - ); |
|
685 | - } |
|
686 | - |
|
687 | - |
|
688 | - |
|
689 | - /** |
|
690 | - * Returns the link to a settings page for the object. |
|
691 | - * |
|
692 | - * @return string |
|
693 | - */ |
|
694 | - public function get_admin_settings_link() |
|
695 | - { |
|
696 | - return $this->get_admin_edit_link(); |
|
697 | - } |
|
698 | - |
|
699 | - |
|
700 | - |
|
701 | - /** |
|
702 | - * Returns the link to the "overview" for the object (typically the "list table" view). |
|
703 | - * |
|
704 | - * @return string |
|
705 | - */ |
|
706 | - public function get_admin_overview_link() |
|
707 | - { |
|
708 | - EE_Registry::instance()->load_helper('URL'); |
|
709 | - return EEH_URL::add_query_args_and_nonce( |
|
710 | - array( |
|
711 | - 'page' => 'espresso_registrations', |
|
712 | - 'action' => 'contact_list', |
|
713 | - ), |
|
714 | - admin_url('admin.php') |
|
715 | - ); |
|
716 | - } |
|
27 | + /** |
|
28 | + * Sets some dynamic defaults |
|
29 | + * |
|
30 | + * @param array $fieldValues |
|
31 | + * @param bool $bydb |
|
32 | + * @param string $timezone |
|
33 | + * @param array $date_formats |
|
34 | + */ |
|
35 | + protected function __construct($fieldValues = null, $bydb = false, $timezone = null, $date_formats = array()) |
|
36 | + { |
|
37 | + if ( ! isset($fieldValues['ATT_full_name'])) { |
|
38 | + $fname = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'] . ' ' : ''; |
|
39 | + $lname = isset($fieldValues['ATT_lname']) ? $fieldValues['ATT_lname'] : ''; |
|
40 | + $fieldValues['ATT_full_name'] = $fname . $lname; |
|
41 | + } |
|
42 | + if ( ! isset($fieldValues['ATT_slug'])) { |
|
43 | + // $fieldValues['ATT_slug'] = sanitize_key(wp_generate_password(20)); |
|
44 | + $fieldValues['ATT_slug'] = sanitize_title($fieldValues['ATT_full_name']); |
|
45 | + } |
|
46 | + if ( ! isset($fieldValues['ATT_short_bio']) && isset($fieldValues['ATT_bio'])) { |
|
47 | + $fieldValues['ATT_short_bio'] = substr($fieldValues['ATT_bio'], 0, 50); |
|
48 | + } |
|
49 | + parent::__construct($fieldValues, $bydb, $timezone, $date_formats); |
|
50 | + } |
|
51 | + |
|
52 | + |
|
53 | + |
|
54 | + /** |
|
55 | + * @param array $props_n_values incoming values |
|
56 | + * @param string $timezone incoming timezone (if not set the timezone set for the website will be |
|
57 | + * used.) |
|
58 | + * @param array $date_formats incoming date_formats in an array where the first value is the |
|
59 | + * date_format and the second value is the time format |
|
60 | + * @return EE_Attendee |
|
61 | + */ |
|
62 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) |
|
63 | + { |
|
64 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
65 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
66 | + } |
|
67 | + |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * @param array $props_n_values incoming values from the database |
|
72 | + * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
|
73 | + * the website will be used. |
|
74 | + * @return EE_Attendee |
|
75 | + */ |
|
76 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) |
|
77 | + { |
|
78 | + return new self($props_n_values, true, $timezone); |
|
79 | + } |
|
80 | + |
|
81 | + |
|
82 | + |
|
83 | + /** |
|
84 | + * Set Attendee First Name |
|
85 | + * |
|
86 | + * @access public |
|
87 | + * @param string $fname |
|
88 | + */ |
|
89 | + public function set_fname($fname = '') |
|
90 | + { |
|
91 | + $this->set('ATT_fname', $fname); |
|
92 | + } |
|
93 | + |
|
94 | + |
|
95 | + |
|
96 | + /** |
|
97 | + * Set Attendee Last Name |
|
98 | + * |
|
99 | + * @access public |
|
100 | + * @param string $lname |
|
101 | + */ |
|
102 | + public function set_lname($lname = '') |
|
103 | + { |
|
104 | + $this->set('ATT_lname', $lname); |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * Set Attendee Address |
|
111 | + * |
|
112 | + * @access public |
|
113 | + * @param string $address |
|
114 | + */ |
|
115 | + public function set_address($address = '') |
|
116 | + { |
|
117 | + $this->set('ATT_address', $address); |
|
118 | + } |
|
119 | + |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * Set Attendee Address2 |
|
124 | + * |
|
125 | + * @access public |
|
126 | + * @param string $address2 |
|
127 | + */ |
|
128 | + public function set_address2($address2 = '') |
|
129 | + { |
|
130 | + $this->set('ATT_address2', $address2); |
|
131 | + } |
|
132 | + |
|
133 | + |
|
134 | + |
|
135 | + /** |
|
136 | + * Set Attendee City |
|
137 | + * |
|
138 | + * @access public |
|
139 | + * @param string $city |
|
140 | + */ |
|
141 | + public function set_city($city = '') |
|
142 | + { |
|
143 | + $this->set('ATT_city', $city); |
|
144 | + } |
|
145 | + |
|
146 | + |
|
147 | + |
|
148 | + /** |
|
149 | + * Set Attendee State ID |
|
150 | + * |
|
151 | + * @access public |
|
152 | + * @param int $STA_ID |
|
153 | + */ |
|
154 | + public function set_state($STA_ID = 0) |
|
155 | + { |
|
156 | + $this->set('STA_ID', $STA_ID); |
|
157 | + } |
|
158 | + |
|
159 | + |
|
160 | + |
|
161 | + /** |
|
162 | + * Set Attendee Country ISO Code |
|
163 | + * |
|
164 | + * @access public |
|
165 | + * @param string $CNT_ISO |
|
166 | + */ |
|
167 | + public function set_country($CNT_ISO = '') |
|
168 | + { |
|
169 | + $this->set('CNT_ISO', $CNT_ISO); |
|
170 | + } |
|
171 | + |
|
172 | + |
|
173 | + |
|
174 | + /** |
|
175 | + * Set Attendee Zip/Postal Code |
|
176 | + * |
|
177 | + * @access public |
|
178 | + * @param string $zip |
|
179 | + */ |
|
180 | + public function set_zip($zip = '') |
|
181 | + { |
|
182 | + $this->set('ATT_zip', $zip); |
|
183 | + } |
|
184 | + |
|
185 | + |
|
186 | + |
|
187 | + /** |
|
188 | + * Set Attendee Email Address |
|
189 | + * |
|
190 | + * @access public |
|
191 | + * @param string $email |
|
192 | + */ |
|
193 | + public function set_email($email = '') |
|
194 | + { |
|
195 | + $this->set('ATT_email', $email); |
|
196 | + } |
|
197 | + |
|
198 | + |
|
199 | + |
|
200 | + /** |
|
201 | + * Set Attendee Phone |
|
202 | + * |
|
203 | + * @access public |
|
204 | + * @param string $phone |
|
205 | + */ |
|
206 | + public function set_phone($phone = '') |
|
207 | + { |
|
208 | + $this->set('ATT_phone', $phone); |
|
209 | + } |
|
210 | + |
|
211 | + |
|
212 | + |
|
213 | + /** |
|
214 | + * set deleted |
|
215 | + * |
|
216 | + * @access public |
|
217 | + * @param bool $ATT_deleted |
|
218 | + */ |
|
219 | + public function set_deleted($ATT_deleted = false) |
|
220 | + { |
|
221 | + $this->set('ATT_deleted', $ATT_deleted); |
|
222 | + } |
|
223 | + |
|
224 | + |
|
225 | + |
|
226 | + /** |
|
227 | + * Returns the value for the post_author id saved with the cpt |
|
228 | + * |
|
229 | + * @since 4.5.0 |
|
230 | + * @return int |
|
231 | + */ |
|
232 | + public function wp_user() |
|
233 | + { |
|
234 | + return $this->get('ATT_author'); |
|
235 | + } |
|
236 | + |
|
237 | + |
|
238 | + |
|
239 | + /** |
|
240 | + * get Attendee First Name |
|
241 | + * |
|
242 | + * @access public |
|
243 | + * @return string |
|
244 | + */ |
|
245 | + public function fname() |
|
246 | + { |
|
247 | + return $this->get('ATT_fname'); |
|
248 | + } |
|
249 | + |
|
250 | + |
|
251 | + |
|
252 | + /** |
|
253 | + * echoes out the attendee's first name |
|
254 | + * |
|
255 | + * @return void |
|
256 | + */ |
|
257 | + public function e_full_name() |
|
258 | + { |
|
259 | + echo $this->full_name(); |
|
260 | + } |
|
261 | + |
|
262 | + |
|
263 | + |
|
264 | + /** |
|
265 | + * Returns the first and last name concatenated together with a space. |
|
266 | + * |
|
267 | + * @param bool $apply_html_entities |
|
268 | + * @return string |
|
269 | + */ |
|
270 | + public function full_name($apply_html_entities = false) |
|
271 | + { |
|
272 | + $full_name = $this->fname() . ' ' . $this->lname(); |
|
273 | + return $apply_html_entities ? htmlentities($full_name, ENT_QUOTES, 'UTF-8') : $full_name; |
|
274 | + } |
|
275 | + |
|
276 | + |
|
277 | + |
|
278 | + /** |
|
279 | + * get Attendee Last Name |
|
280 | + * |
|
281 | + * @access public |
|
282 | + * @return string |
|
283 | + */ |
|
284 | + public function lname() |
|
285 | + { |
|
286 | + return $this->get('ATT_lname'); |
|
287 | + } |
|
288 | + |
|
289 | + |
|
290 | + |
|
291 | + /** |
|
292 | + * Gets the attendee's full address as an array so client code can decide hwo to display it |
|
293 | + * |
|
294 | + * @return array numerically indexed, with each part of the address that is known. |
|
295 | + * Eg, if the user only responded to state and country, |
|
296 | + * it would be array(0=>'Alabama',1=>'USA') |
|
297 | + * @return array |
|
298 | + */ |
|
299 | + public function full_address_as_array() |
|
300 | + { |
|
301 | + $full_address_array = array(); |
|
302 | + $initial_address_fields = array('ATT_address', 'ATT_address2', 'ATT_city',); |
|
303 | + foreach ($initial_address_fields as $address_field_name) { |
|
304 | + $address_fields_value = $this->get($address_field_name); |
|
305 | + if ( ! empty($address_fields_value)) { |
|
306 | + $full_address_array[] = $address_fields_value; |
|
307 | + } |
|
308 | + } |
|
309 | + //now handle state and country |
|
310 | + $state_obj = $this->state_obj(); |
|
311 | + if ( ! empty($state_obj)) { |
|
312 | + $full_address_array[] = $state_obj->name(); |
|
313 | + } |
|
314 | + $country_obj = $this->country_obj(); |
|
315 | + if ( ! empty($country_obj)) { |
|
316 | + $full_address_array[] = $country_obj->name(); |
|
317 | + } |
|
318 | + //lastly get the xip |
|
319 | + $zip_value = $this->zip(); |
|
320 | + if ( ! empty($zip_value)) { |
|
321 | + $full_address_array[] = $zip_value; |
|
322 | + } |
|
323 | + return $full_address_array; |
|
324 | + } |
|
325 | + |
|
326 | + |
|
327 | + |
|
328 | + /** |
|
329 | + * get Attendee Address |
|
330 | + * |
|
331 | + * @return string |
|
332 | + */ |
|
333 | + public function address() |
|
334 | + { |
|
335 | + return $this->get('ATT_address'); |
|
336 | + } |
|
337 | + |
|
338 | + |
|
339 | + |
|
340 | + /** |
|
341 | + * get Attendee Address2 |
|
342 | + * |
|
343 | + * @return string |
|
344 | + */ |
|
345 | + public function address2() |
|
346 | + { |
|
347 | + return $this->get('ATT_address2'); |
|
348 | + } |
|
349 | + |
|
350 | + |
|
351 | + |
|
352 | + /** |
|
353 | + * get Attendee City |
|
354 | + * |
|
355 | + * @return string |
|
356 | + */ |
|
357 | + public function city() |
|
358 | + { |
|
359 | + return $this->get('ATT_city'); |
|
360 | + } |
|
361 | + |
|
362 | + |
|
363 | + |
|
364 | + /** |
|
365 | + * get Attendee State ID |
|
366 | + * |
|
367 | + * @return string |
|
368 | + */ |
|
369 | + public function state_ID() |
|
370 | + { |
|
371 | + return $this->get('STA_ID'); |
|
372 | + } |
|
373 | + |
|
374 | + |
|
375 | + |
|
376 | + /** |
|
377 | + * @return string |
|
378 | + */ |
|
379 | + public function state_abbrev() |
|
380 | + { |
|
381 | + return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : ''; |
|
382 | + } |
|
383 | + |
|
384 | + |
|
385 | + |
|
386 | + /** |
|
387 | + * Gets the state set to this attendee |
|
388 | + * |
|
389 | + * @return EE_State |
|
390 | + */ |
|
391 | + public function state_obj() |
|
392 | + { |
|
393 | + return $this->get_first_related('State'); |
|
394 | + } |
|
395 | + |
|
396 | + |
|
397 | + |
|
398 | + /** |
|
399 | + * Returns the state's name, otherwise 'Unknown' |
|
400 | + * |
|
401 | + * @return string |
|
402 | + */ |
|
403 | + public function state_name() |
|
404 | + { |
|
405 | + if ($this->state_obj()) { |
|
406 | + return $this->state_obj()->name(); |
|
407 | + } else { |
|
408 | + return ''; |
|
409 | + } |
|
410 | + } |
|
411 | + |
|
412 | + |
|
413 | + |
|
414 | + /** |
|
415 | + * either displays the state abbreviation or the state name, as determined |
|
416 | + * by the "FHEE__EEI_Address__state__use_abbreviation" filter. |
|
417 | + * defaults to abbreviation |
|
418 | + * |
|
419 | + * @return string |
|
420 | + */ |
|
421 | + public function state() |
|
422 | + { |
|
423 | + if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) { |
|
424 | + return $this->state_abbrev(); |
|
425 | + } else { |
|
426 | + return $this->state_name(); |
|
427 | + } |
|
428 | + } |
|
429 | + |
|
430 | + |
|
431 | + |
|
432 | + /** |
|
433 | + * get Attendee Country ISO Code |
|
434 | + * |
|
435 | + * @return string |
|
436 | + */ |
|
437 | + public function country_ID() |
|
438 | + { |
|
439 | + return $this->get('CNT_ISO'); |
|
440 | + } |
|
441 | + |
|
442 | + |
|
443 | + |
|
444 | + /** |
|
445 | + * Gets country set for this attendee |
|
446 | + * |
|
447 | + * @return EE_Country |
|
448 | + */ |
|
449 | + public function country_obj() |
|
450 | + { |
|
451 | + return $this->get_first_related('Country'); |
|
452 | + } |
|
453 | + |
|
454 | + |
|
455 | + |
|
456 | + /** |
|
457 | + * Returns the country's name if known, otherwise 'Unknown' |
|
458 | + * |
|
459 | + * @return string |
|
460 | + */ |
|
461 | + public function country_name() |
|
462 | + { |
|
463 | + if ($this->country_obj()) { |
|
464 | + return $this->country_obj()->name(); |
|
465 | + } else { |
|
466 | + return ''; |
|
467 | + } |
|
468 | + } |
|
469 | + |
|
470 | + |
|
471 | + |
|
472 | + /** |
|
473 | + * either displays the country ISO2 code or the country name, as determined |
|
474 | + * by the "FHEE__EEI_Address__country__use_abbreviation" filter. |
|
475 | + * defaults to abbreviation |
|
476 | + * |
|
477 | + * @return string |
|
478 | + */ |
|
479 | + public function country() |
|
480 | + { |
|
481 | + if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) { |
|
482 | + return $this->country_ID(); |
|
483 | + } else { |
|
484 | + return $this->country_name(); |
|
485 | + } |
|
486 | + } |
|
487 | + |
|
488 | + |
|
489 | + |
|
490 | + /** |
|
491 | + * get Attendee Zip/Postal Code |
|
492 | + * |
|
493 | + * @return string |
|
494 | + */ |
|
495 | + public function zip() |
|
496 | + { |
|
497 | + return $this->get('ATT_zip'); |
|
498 | + } |
|
499 | + |
|
500 | + |
|
501 | + |
|
502 | + /** |
|
503 | + * get Attendee Email Address |
|
504 | + * |
|
505 | + * @return string |
|
506 | + */ |
|
507 | + public function email() |
|
508 | + { |
|
509 | + return $this->get('ATT_email'); |
|
510 | + } |
|
511 | + |
|
512 | + |
|
513 | + |
|
514 | + /** |
|
515 | + * get Attendee Phone # |
|
516 | + * |
|
517 | + * @return string |
|
518 | + */ |
|
519 | + public function phone() |
|
520 | + { |
|
521 | + return $this->get('ATT_phone'); |
|
522 | + } |
|
523 | + |
|
524 | + |
|
525 | + |
|
526 | + /** |
|
527 | + * get deleted |
|
528 | + * |
|
529 | + * @return bool |
|
530 | + */ |
|
531 | + public function deleted() |
|
532 | + { |
|
533 | + return $this->get('ATT_deleted'); |
|
534 | + } |
|
535 | + |
|
536 | + |
|
537 | + |
|
538 | + /** |
|
539 | + * Gets registrations of this attendee |
|
540 | + * |
|
541 | + * @param array $query_params |
|
542 | + * @return EE_Registration[] |
|
543 | + */ |
|
544 | + public function get_registrations($query_params = array()) |
|
545 | + { |
|
546 | + return $this->get_many_related('Registration', $query_params); |
|
547 | + } |
|
548 | + |
|
549 | + |
|
550 | + |
|
551 | + /** |
|
552 | + * Gets the most recent registration of this attendee |
|
553 | + * |
|
554 | + * @return EE_Registration |
|
555 | + */ |
|
556 | + public function get_most_recent_registration() |
|
557 | + { |
|
558 | + return $this->get_first_related('Registration', |
|
559 | + array('order_by' => array('REG_date' => 'DESC'))); //null, 'REG_date', 'DESC', '=', 'OBJECT_K'); |
|
560 | + } |
|
561 | + |
|
562 | + |
|
563 | + |
|
564 | + /** |
|
565 | + * Gets the most recent registration for this attend at this event |
|
566 | + * |
|
567 | + * @param int $event_id |
|
568 | + * @return EE_Registration |
|
569 | + */ |
|
570 | + public function get_most_recent_registration_for_event($event_id) |
|
571 | + { |
|
572 | + return $this->get_first_related('Registration', |
|
573 | + array(array('EVT_ID' => $event_id), 'order_by' => array('REG_date' => 'DESC')));//, '=', 'OBJECT_K' ); |
|
574 | + } |
|
575 | + |
|
576 | + |
|
577 | + |
|
578 | + /** |
|
579 | + * returns any events attached to this attendee ($_Event property); |
|
580 | + * |
|
581 | + * @return array |
|
582 | + */ |
|
583 | + public function events() |
|
584 | + { |
|
585 | + return $this->get_many_related('Event'); |
|
586 | + } |
|
587 | + |
|
588 | + |
|
589 | + |
|
590 | + /** |
|
591 | + * Gets the billing info array where keys match espresso_reg_page_billing_inputs(), |
|
592 | + * and keys are their cleaned values. @see EE_Attendee::save_and_clean_billing_info_for_payment_method() which was |
|
593 | + * used to save the billing info |
|
594 | + * |
|
595 | + * @param EE_Payment_Method $payment_method the _gateway_name property on the gateway class |
|
596 | + * @return EE_Form_Section_Proper|null |
|
597 | + */ |
|
598 | + public function billing_info_for_payment_method($payment_method) |
|
599 | + { |
|
600 | + $pm_type = $payment_method->type_obj(); |
|
601 | + if ( ! $pm_type instanceof EE_PMT_Base) { |
|
602 | + return null; |
|
603 | + } |
|
604 | + $billing_info = $this->get_post_meta($this->get_billing_info_postmeta_name($payment_method), true); |
|
605 | + if ( ! $billing_info) { |
|
606 | + return null; |
|
607 | + } |
|
608 | + $billing_form = $pm_type->billing_form(); |
|
609 | + if ($billing_form instanceof EE_Form_Section_Proper) { |
|
610 | + $billing_form->receive_form_submission(array($billing_form->name() => $billing_info), false); |
|
611 | + } |
|
612 | + return $billing_form; |
|
613 | + } |
|
614 | + |
|
615 | + |
|
616 | + |
|
617 | + /** |
|
618 | + * Gets the postmeta key that holds this attendee's billing info for the |
|
619 | + * specified payment method |
|
620 | + * |
|
621 | + * @param EE_Payment_Method $payment_method |
|
622 | + * @return string |
|
623 | + */ |
|
624 | + public function get_billing_info_postmeta_name($payment_method) |
|
625 | + { |
|
626 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
627 | + return 'billing_info_' . $payment_method->type_obj()->system_name(); |
|
628 | + } else { |
|
629 | + return null; |
|
630 | + } |
|
631 | + } |
|
632 | + |
|
633 | + |
|
634 | + |
|
635 | + /** |
|
636 | + * Saves the billing info to the attendee. @see EE_Attendee::billing_info_for_payment_method() which is used to |
|
637 | + * retrieve it |
|
638 | + * |
|
639 | + * @param EE_Billing_Attendee_Info_Form $billing_form |
|
640 | + * @param EE_Payment_Method $payment_method |
|
641 | + * @return boolean |
|
642 | + */ |
|
643 | + public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method) |
|
644 | + { |
|
645 | + if ( ! $billing_form instanceof EE_Billing_Attendee_Info_Form) { |
|
646 | + EE_Error::add_error(__('Cannot save billing info because there is none.', 'event_espresso')); |
|
647 | + return false; |
|
648 | + } |
|
649 | + $billing_form->clean_sensitive_data(); |
|
650 | + return update_post_meta($this->ID(), $this->get_billing_info_postmeta_name($payment_method), |
|
651 | + $billing_form->input_values(true)); |
|
652 | + } |
|
653 | + |
|
654 | + |
|
655 | + |
|
656 | + /** |
|
657 | + * Return the link to the admin details for the object. |
|
658 | + * |
|
659 | + * @return string |
|
660 | + */ |
|
661 | + public function get_admin_details_link() |
|
662 | + { |
|
663 | + return $this->get_admin_edit_link(); |
|
664 | + } |
|
665 | + |
|
666 | + |
|
667 | + |
|
668 | + /** |
|
669 | + * Returns the link to the editor for the object. Sometimes this is the same as the details. |
|
670 | + * |
|
671 | + * @return string |
|
672 | + */ |
|
673 | + public function get_admin_edit_link() |
|
674 | + { |
|
675 | + EE_Registry::instance()->load_helper('URL'); |
|
676 | + return EEH_URL::add_query_args_and_nonce( |
|
677 | + array( |
|
678 | + 'page' => 'espresso_registrations', |
|
679 | + 'action' => 'edit_attendee', |
|
680 | + 'post' => $this->ID(), |
|
681 | + ), |
|
682 | + admin_url('admin.php') |
|
683 | + ); |
|
684 | + } |
|
685 | + |
|
686 | + |
|
687 | + |
|
688 | + /** |
|
689 | + * Returns the link to a settings page for the object. |
|
690 | + * |
|
691 | + * @return string |
|
692 | + */ |
|
693 | + public function get_admin_settings_link() |
|
694 | + { |
|
695 | + return $this->get_admin_edit_link(); |
|
696 | + } |
|
697 | + |
|
698 | + |
|
699 | + |
|
700 | + /** |
|
701 | + * Returns the link to the "overview" for the object (typically the "list table" view). |
|
702 | + * |
|
703 | + * @return string |
|
704 | + */ |
|
705 | + public function get_admin_overview_link() |
|
706 | + { |
|
707 | + EE_Registry::instance()->load_helper('URL'); |
|
708 | + return EEH_URL::add_query_args_and_nonce( |
|
709 | + array( |
|
710 | + 'page' => 'espresso_registrations', |
|
711 | + 'action' => 'contact_list', |
|
712 | + ), |
|
713 | + admin_url('admin.php') |
|
714 | + ); |
|
715 | + } |
|
717 | 716 | |
718 | 717 | |
719 | 718 | } |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | protected function __construct($fieldValues = null, $bydb = false, $timezone = null, $date_formats = array()) |
37 | 37 | { |
38 | 38 | if ( ! isset($fieldValues['ATT_full_name'])) { |
39 | - $fname = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'] . ' ' : ''; |
|
39 | + $fname = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'].' ' : ''; |
|
40 | 40 | $lname = isset($fieldValues['ATT_lname']) ? $fieldValues['ATT_lname'] : ''; |
41 | - $fieldValues['ATT_full_name'] = $fname . $lname; |
|
41 | + $fieldValues['ATT_full_name'] = $fname.$lname; |
|
42 | 42 | } |
43 | 43 | if ( ! isset($fieldValues['ATT_slug'])) { |
44 | 44 | // $fieldValues['ATT_slug'] = sanitize_key(wp_generate_password(20)); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | */ |
271 | 271 | public function full_name($apply_html_entities = false) |
272 | 272 | { |
273 | - $full_name = $this->fname() . ' ' . $this->lname(); |
|
273 | + $full_name = $this->fname().' '.$this->lname(); |
|
274 | 274 | return $apply_html_entities ? htmlentities($full_name, ENT_QUOTES, 'UTF-8') : $full_name; |
275 | 275 | } |
276 | 276 | |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | public function get_most_recent_registration_for_event($event_id) |
572 | 572 | { |
573 | 573 | return $this->get_first_related('Registration', |
574 | - array(array('EVT_ID' => $event_id), 'order_by' => array('REG_date' => 'DESC')));//, '=', 'OBJECT_K' ); |
|
574 | + array(array('EVT_ID' => $event_id), 'order_by' => array('REG_date' => 'DESC'))); //, '=', 'OBJECT_K' ); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | public function get_billing_info_postmeta_name($payment_method) |
626 | 626 | { |
627 | 627 | if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
628 | - return 'billing_info_' . $payment_method->type_obj()->system_name(); |
|
628 | + return 'billing_info_'.$payment_method->type_obj()->system_name(); |
|
629 | 629 | } else { |
630 | 630 | return null; |
631 | 631 | } |